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AAFD,SAAb;AAKA,YAAI,CAAC,KAAK,SAAV,EAAqB;AACnB,gBAAM,QAAQ,KAAK,KAAL,IAAc;AAC1B,sBAAM,KAAK,IADe;AAE1B,uBAAO,KAAK;AAFc,aAA5B;AAKA,iBAAK,UAAL,CAAgB,IAAhB,CAAqB;AACnB,sBAAM,OADa;AAEnB;AAFmB,aAArB;AAID;AAED,eAAO,EAAE,KAAF,EAAS,IAAT,EAAe,CAAC,KAAK,YAAL,EAAD,CAAf,CAAP;AACD;AAtHiC,CAArB,CAAf","sourcesContent":["// Styles\nimport '../../stylus/components/_windows.styl'\n\n// Components\nimport { BaseItemGroup } from '../VItemGroup/VItemGroup'\n\n// Directives\nimport Touch from '../../directives/touch'\n\n// Types\nimport { VNode, VNodeDirective } from 'vue/types/vnode'\n\n/* @vue/component */\nexport default BaseItemGroup.extend({\n name: 'v-window',\n\n provide (): object {\n return {\n windowGroup: this\n }\n },\n\n directives: { Touch },\n\n props: {\n mandatory: {\n type: Boolean,\n default: true\n },\n reverse: {\n type: Boolean,\n default: undefined\n },\n touch: Object,\n touchless: Boolean,\n value: {\n required: false\n },\n vertical: Boolean\n },\n\n data () {\n return {\n internalHeight: undefined as undefined | string,\n isActive: false,\n isBooted: false,\n isReverse: false\n }\n },\n\n computed: {\n computedTransition (): string {\n if (!this.isBooted) return ''\n\n const axis = this.vertical ? 'y' : 'x'\n const direction = this.internalReverse === !this.$vuetify.rtl\n ? '-reverse'\n : ''\n\n return `v-window-${axis}${direction}-transition`\n },\n internalIndex (): number {\n return this.items.findIndex((item, i) => {\n return this.internalValue === this.getValue(item, i)\n })\n },\n internalReverse (): boolean {\n if (this.reverse !== undefined) return this.reverse\n\n return this.isReverse\n }\n },\n\n watch: {\n internalIndex: 'updateReverse'\n },\n\n mounted () {\n this.$nextTick(() => (this.isBooted = true))\n },\n\n methods: {\n genContainer (): VNode {\n return this.$createElement('div', {\n staticClass: 'v-window__container',\n class: {\n 'v-window__container--is-active': this.isActive\n },\n style: {\n height: this.internalHeight\n }\n }, this.$slots.default)\n },\n next () {\n this.isReverse = false\n const nextIndex = (this.internalIndex + 1) % this.items.length\n const item = this.items[nextIndex]\n\n this.internalValue = this.getValue(item, nextIndex)\n },\n prev () {\n this.isReverse = true\n const lastIndex = (this.internalIndex + this.items.length - 1) % this.items.length\n const item = this.items[lastIndex]\n\n this.internalValue = this.getValue(item, lastIndex)\n },\n updateReverse (val: number, oldVal: number) {\n this.isReverse = val < oldVal\n }\n },\n\n render (h): VNode {\n const data = {\n staticClass: 'v-window',\n directives: [] as VNodeDirective[]\n }\n\n if (!this.touchless) {\n const value = this.touch || {\n left: this.next,\n right: this.prev\n }\n\n data.directives.push({\n name: 'touch',\n value\n })\n }\n\n return h('div', data, [this.genContainer()])\n }\n})\n"],"sourceRoot":""}
|