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,WAAW,EAAE,UADF;AAEX,MAAA,KAAK,EAAE,KAAK,OAFD;AAGX,MAAA,UAAU,EAAE;AAHD,KAAb;;AAMA,QAAI,CAAC,KAAK,SAAV,EAAqB;AACnB,UAAM,KAAK,GAAG,KAAK,KAAL,IAAc;AAC1B,QAAA,IAAI,EAAE,gBAAK;AACT,UAAA,MAAI,CAAC,QAAL,CAAc,GAAd,GAAoB,MAAI,CAAC,IAAL,EAApB,GAAkC,MAAI,CAAC,IAAL,EAAlC;AACD,SAHyB;AAI1B,QAAA,KAAK,EAAE,iBAAK;AACV,UAAA,MAAI,CAAC,QAAL,CAAc,GAAd,GAAoB,MAAI,CAAC,IAAL,EAApB,GAAkC,MAAI,CAAC,IAAL,EAAlC;AACD,SANyB;AAO1B,QAAA,GAAG,EAAE,aAAC,CAAD,EAAkB;AACrB,UAAA,CAAC,CAAC,eAAF;AACD,SATyB;AAU1B,QAAA,KAAK,EAAE,eAAC,CAAD,EAAkB;AACvB,UAAA,CAAC,CAAC,eAAF;AACD;AAZyB,OAA5B;AAeA,MAAA,IAAI,CAAC,UAAL,CAAgB,IAAhB,CAAqB;AACnB,QAAA,IAAI,EAAE,OADa;AAEnB,QAAA,KAAK,EAAL;AAFmB,OAArB;AAID;;AAED,WAAO,CAAC,CAAC,KAAD,EAAQ,IAAR,EAAc,CAAC,KAAK,YAAL,EAAD,CAAd,CAAR;AACD;AAhQiC,CAArB,C","sourcesContent":["// Styles\nimport './VWindow.sass'\n\n// Components\nimport VBtn from '../VBtn'\nimport VIcon from '../VIcon'\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 activeClass: {\n type: String,\n default: 'v-window-item--active',\n },\n continuous: Boolean,\n mandatory: {\n type: Boolean,\n default: true,\n },\n nextIcon: {\n type: [Boolean, String],\n default: '$vuetify.icons.next',\n },\n prevIcon: {\n type: [Boolean, String],\n default: '$vuetify.icons.prev',\n },\n reverse: {\n type: Boolean,\n default: undefined,\n },\n showArrows: Boolean,\n showArrowsOnHover: Boolean,\n touch: Object,\n touchless: Boolean,\n value: {\n required: false,\n },\n vertical: Boolean,\n },\n\n data () {\n return {\n changedByDelimiters: false,\n internalHeight: undefined as undefined | string,\n isActive: false,\n isBooted: false,\n isReverse: false,\n }\n },\n\n computed: {\n classes (): object {\n return {\n ...BaseItemGroup.options.computed.classes.call(this),\n 'v-window--show-arrows-on-hover': this.showArrowsOnHover,\n }\n },\n computedTransition (): string {\n if (!this.isBooted) return ''\n\n const axis = this.vertical ? 'y' : 'x'\n const direction = this.internalReverse ? '-reverse' : ''\n\n return `v-window-${axis}${direction}-transition`\n },\n hasActiveItems (): boolean {\n return Boolean(\n this.items.find(item => !item.disabled)\n )\n },\n hasNext (): boolean {\n return this.continuous || this.internalIndex < this.items.length - 1\n },\n hasPrev (): boolean {\n return this.continuous || this.internalIndex > 0\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 window.requestAnimationFrame(() => (this.isBooted = true))\n },\n\n methods: {\n genContainer (): VNode {\n const children = [this.$slots.default]\n\n if (this.showArrows) {\n children.push(this.genControlIcons())\n }\n\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 }, children)\n },\n genIcon (\n direction: 'prev' | 'next',\n icon: string,\n fn: () => void\n ) {\n return this.$createElement('div', {\n staticClass: `v-window__${direction}`,\n }, [\n this.$createElement(VBtn, {\n props: {\n icon: true,\n },\n attrs: {\n 'aria-label': this.$vuetify.lang.t(`$vuetify.carousel.${direction}`),\n },\n on: {\n click: () => {\n this.changedByDelimiters = true\n fn()\n },\n },\n }, [\n this.$createElement(VIcon, {\n props: { size: 40 },\n }, icon),\n ]),\n ])\n },\n genControlIcons () {\n const icons = []\n\n const prevIcon = this.$vuetify.rtl\n ? this.nextIcon\n : this.prevIcon\n\n /* istanbul ignore else */\n if (\n this.hasPrev &&\n prevIcon &&\n typeof prevIcon === 'string'\n ) {\n const icon = this.genIcon('prev', prevIcon, this.prev)\n icon && icons.push(icon)\n }\n\n const nextIcon = this.$vuetify.rtl\n ? this.prevIcon\n : this.nextIcon\n\n /* istanbul ignore else */\n if (\n this.hasNext &&\n nextIcon &&\n typeof nextIcon === 'string'\n ) {\n const icon = this.genIcon('next', nextIcon, this.next)\n icon && icons.push(icon)\n }\n\n return icons\n },\n getNextIndex (index: number): number {\n const nextIndex = (index + 1) % this.items.length\n const item = this.items[nextIndex]\n\n if (item.disabled) return this.getNextIndex(nextIndex)\n\n return nextIndex\n },\n getPrevIndex (index: number): number {\n const prevIndex = (index + this.items.length - 1) % this.items.length\n const item = this.items[prevIndex]\n\n if (item.disabled) return this.getPrevIndex(prevIndex)\n\n return prevIndex\n },\n next () {\n this.isReverse = this.$vuetify.rtl\n\n /* istanbul ignore if */\n if (!this.hasActiveItems || !this.hasNext) return\n\n const nextIndex = this.getNextIndex(this.internalIndex)\n const item = this.items[nextIndex]\n\n this.internalValue = this.getValue(item, nextIndex)\n },\n prev () {\n this.isReverse = !this.$vuetify.rtl\n\n /* istanbul ignore if */\n if (!this.hasActiveItems || !this.hasPrev) return\n\n const lastIndex = this.getPrevIndex(this.internalIndex)\n const item = this.items[lastIndex]\n\n this.internalValue = this.getValue(item, lastIndex)\n },\n updateReverse (val: number, oldVal: number) {\n if (this.changedByDelimiters) {\n this.changedByDelimiters = false\n return\n }\n\n this.isReverse = val < oldVal\n },\n },\n\n render (h): VNode {\n const data = {\n staticClass: 'v-window',\n class: this.classes,\n directives: [] as VNodeDirective[],\n }\n\n if (!this.touchless) {\n const value = this.touch || {\n left: () => {\n this.$vuetify.rtl ? this.prev() : this.next()\n },\n right: () => {\n this.$vuetify.rtl ? this.next() : this.prev()\n },\n end: (e: TouchEvent) => {\n e.stopPropagation()\n },\n start: (e: TouchEvent) => {\n e.stopPropagation()\n },\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":"","file":"VWindow.js"} |