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L,CAAW,OAAX,CAAmB,YAAjC;AACA,MAAA,UAAU,CAAC,MAAO,KAAK,MAAL,GAAc,CAAtB,EAA0B,EAA1B,CAAV;AACD,KAxBM;;AAyBP,IAAA,MAAM,CAAE,IAAF,EAAyB,OAAzB,EAAyC;AAC7C,WAAK,QAAL,GAAgB,IAAI,CAAC,QAAL,OAAoB,KAAK,IAAL,CAAU,QAAV,EAApC;AACA,WAAK,SAAL,GAAiB,OAAjB;AACD;;AA5BM,GA5EwC;;AA2GjD,EAAA,MAAM,CAAE,CAAF,EAAG;AACP,UAAM,WAAW,GAAG;AAClB,MAAA,WAAW,EAAE;AADK,KAApB;AAGA,UAAM,WAAW,GAAG;AAClB,MAAA,WAAW,EAAE,oBADK;AAElB,MAAA,KAAK,EAAE,KAAK,MAFM;AAGlB,MAAA,GAAG,EAAE;AAHa,KAApB;;AAMA,QAAI,CAAC,KAAK,UAAV,EAAsB;AACpB,MAAA,WAAW,CAAC,UAAZ,GAAyB,CAAC;AACxB,QAAA,IAAI,EAAE,MADkB;AAExB,QAAA,KAAK,EAAE,KAAK;AAFY,OAAD,CAAzB;AAID;;AAED,UAAM,OAAO,GAAG,CAAC,CAAC,KAAD,EAAQ,WAAR,EAAqB,CAAC,KAAK,MAAL,CAAY,OAAb,CAArB,CAAjB;AACA,UAAM,OAAO,GAAG,CAAC,CAAC,KAAD,EAAQ,WAAR,EAAqB,CAAC,OAAD,CAArB,CAAjB;AAEA,WAAO,CAAC,CAAC,KAAK,kBAAN,EAA0B;AAChC,MAAA,EAAE,EAAE,KAAK;AADuB,KAA1B,EAEL,CAAC,OAAD,CAFK,CAAR;AAGD;;AAlIgD,CAApC,CAAf","sourcesContent":["// Components\nimport {\n VTabTransition,\n VTabReverseTransition,\n} from '../transitions'\n\n// Mixins\nimport { inject as RegistrableInject } from '../../mixins/registrable'\n\n// Helpers\nimport { convertToUnit } from '../../util/helpers'\n\n// Utilities\nimport mixins from '../../util/mixins'\n\n// Types\nimport { VNode, FunctionalComponentOptions, VNodeData } from 'vue'\n\nconst baseMixins = mixins(\n RegistrableInject('stepper', 'v-stepper-content', 'v-stepper')\n)\n\ninterface options extends InstanceType<typeof baseMixins> {\n $refs: {\n wrapper: HTMLElement\n }\n isVerticalProvided: boolean\n}\n\n/* @vue/component */\nexport default baseMixins.extend<options>().extend({\n name: 'v-stepper-content',\n\n inject: {\n isVerticalProvided: {\n from: 'isVertical',\n },\n },\n\n props: {\n step: {\n type: [Number, String],\n required: true,\n },\n },\n\n data () {\n return {\n height: 0 as number | string,\n // Must be null to allow\n // previous comparison\n isActive: null as boolean | null,\n isReverse: false,\n isVertical: this.isVerticalProvided,\n }\n },\n\n computed: {\n computedTransition (): FunctionalComponentOptions {\n return this.isReverse\n ? VTabReverseTransition\n : VTabTransition\n },\n styles (): object {\n if (!this.isVertical) return {}\n\n return {\n height: convertToUnit(this.height),\n }\n },\n },\n\n watch: {\n isActive (current, previous) {\n // If active and the previous state\n // was null, is just booting up\n if (current && previous == null) {\n this.height = 'auto'\n return\n }\n\n if (!this.isVertical) return\n\n if (this.isActive) this.enter()\n else this.leave()\n },\n },\n\n mounted () {\n this.$refs.wrapper.addEventListener(\n 'transitionend',\n this.onTransition,\n false\n )\n this.stepper && this.stepper.register(this)\n },\n\n beforeDestroy () {\n this.$refs.wrapper.removeEventListener(\n 'transitionend',\n this.onTransition,\n false\n )\n this.stepper && this.stepper.unregister(this)\n },\n\n methods: {\n onTransition (e: TransitionEvent) {\n if (!this.isActive ||\n e.propertyName !== 'height'\n ) return\n\n this.height = 'auto'\n },\n enter () {\n let scrollHeight = 0\n\n // Render bug with height\n requestAnimationFrame(() => {\n scrollHeight = this.$refs.wrapper.scrollHeight\n })\n\n this.height = 0\n\n // Give the collapsing element time to collapse\n setTimeout(() => this.isActive && (this.height = (scrollHeight || 'auto')), 450)\n },\n leave () {\n this.height = this.$refs.wrapper.clientHeight\n setTimeout(() => (this.height = 0), 10)\n },\n toggle (step: string | number, reverse: boolean) {\n this.isActive = step.toString() === this.step.toString()\n this.isReverse = reverse\n },\n },\n\n render (h): VNode {\n const contentData = {\n staticClass: 'v-stepper__content',\n } as VNodeData\n const wrapperData = {\n staticClass: 'v-stepper__wrapper',\n style: this.styles,\n ref: 'wrapper',\n }\n\n if (!this.isVertical) {\n contentData.directives = [{\n name: 'show',\n value: this.isActive,\n }]\n }\n\n const wrapper = h('div', wrapperData, [this.$slots.default])\n const content = h('div', contentData, [wrapper])\n\n return h(this.computedTransition, {\n on: this.$listeners,\n }, [content])\n },\n})\n"],"sourceRoot":"","file":"VStepperContent.js"} |