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,IAAT,EAAe,CAAC,KAAK,YAAL,EAAD,EAAsB,QAAtB,CAAf,CAAP;AACD;AAhO2B,CAAf,C;AAZf;AACA;;AALA","sourcesContent":["// Styles\nimport '../../stylus/components/_carousel.styl'\n\n// Extensions\nimport VWindow from '../VWindow/VWindow'\n\n// Components\nimport VBtn from '../VBtn'\nimport VIcon from '../VIcon'\n\n// Mixins\n// TODO: Move this into core components v2.0\nimport ButtonGroup from '../../mixins/button-group'\n\n// Utilities\nimport { convertToUnit } from '../../util/helpers'\nimport { deprecate } from '../../util/console'\n\n// Types\nimport { VNode } from 'vue'\nimport { VNodeDirective } from 'vue/types/vnode'\n\nexport default VWindow.extend({\n name: 'v-carousel',\n\n props: {\n cycle: {\n type: Boolean,\n default: true\n },\n delimiterIcon: {\n type: String,\n default: '$vuetify.icons.delimiter'\n },\n height: {\n type: [Number, String],\n default: 500\n },\n hideControls: Boolean,\n hideDelimiters: Boolean,\n interval: {\n type: [Number, String],\n default: 6000,\n validator: (value: string | number) => value > 0\n },\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 },\n\n data () {\n return {\n changedByDelimiters: false,\n internalHeight: this.height,\n slideTimeout: undefined as number | undefined\n }\n },\n\n computed: {\n isDark (): boolean {\n return this.dark || !this.light\n }\n },\n\n watch: {\n internalValue (val) {\n this.restartTimeout()\n /* @deprecate */\n /* istanbul ignore else */\n if (!this.$listeners['input']) return\n\n this.$emit('input', val)\n },\n interval: 'restartTimeout',\n height (val, oldVal) {\n if (val === oldVal || !val) return\n this.internalHeight = val\n },\n cycle (val) {\n if (val) {\n this.restartTimeout()\n } else {\n clearTimeout(this.slideTimeout)\n this.slideTimeout = undefined\n }\n }\n },\n\n mounted () {\n /* @deprecate */\n /* istanbul ignore next */\n if (this.$listeners['input']) {\n deprecate('@input', '@change', this)\n }\n this.startTimeout()\n },\n\n methods: {\n genDelimiters (): VNode {\n return this.$createElement('div', {\n staticClass: 'v-carousel__controls'\n }, [this.genItems()])\n },\n genIcon (\n direction: 'prev' | 'next',\n icon: string,\n fn: () => void\n ): VNode {\n return this.$createElement('div', {\n staticClass: `v-carousel__${direction}`\n }, [\n this.$createElement(VBtn, {\n props: {\n icon: true\n },\n attrs: {\n 'aria-label': this.$vuetify.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': '46px' }\n }, icon)\n ])\n ])\n },\n genIcons (): VNode[] {\n const icons = []\n\n const prevIcon = this.$vuetify.rtl\n ? this.nextIcon\n : this.prevIcon\n\n if (prevIcon && typeof prevIcon === 'string') {\n icons.push(this.genIcon('prev', prevIcon, this.prev))\n }\n\n const nextIcon = this.$vuetify.rtl\n ? this.prevIcon\n : this.nextIcon\n\n if (nextIcon && typeof nextIcon === 'string') {\n icons.push(this.genIcon('next', nextIcon, this.next))\n }\n\n return icons\n },\n genItems (): VNode {\n const length = this.items.length\n const children = []\n\n for (let i = 0; i < length; i++) {\n const child = this.$createElement(VBtn, {\n class: {\n 'v-carousel__controls__item': true\n },\n props: {\n icon: true,\n small: true,\n value: this.getValue(this.items[i], i)\n }\n }, [\n this.$createElement(VIcon, {\n props: { size: 18 }\n }, this.delimiterIcon)\n ])\n\n children.push(child)\n }\n\n return this.$createElement(ButtonGroup, {\n props: {\n value: this.internalValue\n },\n on: {\n change: (val: any) => {\n this.internalValue = val\n }\n }\n }, children)\n },\n restartTimeout () {\n this.slideTimeout && clearTimeout(this.slideTimeout)\n this.slideTimeout = undefined\n\n const raf = requestAnimationFrame || setTimeout\n raf(this.startTimeout)\n },\n startTimeout () {\n if (!this.cycle) return\n\n this.slideTimeout = window.setTimeout(this.next, +this.interval > 0 ? +this.interval : 6000)\n },\n updateReverse (val: number, oldVal: number) {\n if (this.changedByDelimiters) {\n this.changedByDelimiters = false\n return\n }\n\n VWindow.options.methods.updateReverse.call(this, val, oldVal)\n }\n },\n\n render (h): VNode {\n const children = []\n const data = {\n staticClass: 'v-window v-carousel',\n style: {\n height: convertToUnit(this.height)\n },\n directives: [] as VNodeDirective[]\n }\n\n if (!this.touchless) {\n data.directives.push({\n name: 'touch',\n value: {\n left: this.next,\n right: this.prev\n }\n } as VNodeDirective)\n }\n\n if (!this.hideControls) {\n children.push(this.genIcons())\n }\n\n if (!this.hideDelimiters) {\n children.push(this.genDelimiters())\n }\n\n return h('div', data, [this.genContainer(), children])\n }\n})\n"],"sourceRoot":""}
|