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,IAAL,CAAU,KAAV;AACjB;AACF;;AACA;AAAS,cAAA,GAAG,CAAC,IAAJ,CAAS,KAAT;AARX;AAUD,SAXD,MAWO;AACL,UAAA,GAAG,CAAC,IAAJ,CAAS,KAAT;AACD;AACF;AAED;;;;;;;;AAMA,aAAO;AAAE,QAAA,GAAF;AAAO,QAAA,MAAP;AAAe,QAAA,KAAf;AAAsB,QAAA;AAAtB,OAAP;AACD;;AA7IM,GAlHwC;;AAkQjD,EAAA,MAAM,CAAE,CAAF,EAAG;AACP,UAAM;AAAE,MAAA,GAAF;AAAO,MAAA,MAAP;AAAe,MAAA,KAAf;AAAsB,MAAA;AAAtB,QAA+B,KAAK,UAAL,EAArC;AAEA,WAAO,CAAC,CAAC,KAAD,EAAQ;AACd,MAAA,WAAW,EAAE,QADC;AAEd,MAAA,KAAK,EAAE,KAAK,OAFE;AAGd,MAAA,UAAU,EAAE,CAAC;AACX,QAAA,IAAI,EAAE,QADK;AAEX,QAAA,SAAS,EAAE;AAAE,UAAA,KAAK,EAAE;AAAT,SAFA;AAGX,QAAA,KAAK,EAAE,KAAK;AAHD,OAAD;AAHE,KAAR,EAQL,CACD,KAAK,MAAL,CAAY,GAAZ,EAAiB,MAAjB,CADC,EAED,KAAK,QAAL,CAAc,KAAd,EAAqB,IAArB,CAFC,CARK,CAAR;AAYD;;AAjRgD,CAApC,CAAf","sourcesContent":["// Styles\nimport './VTabs.sass'\n\n// Components\nimport VTabsBar from './VTabsBar'\nimport VTabsItems from './VTabsItems'\nimport VTabsSlider from './VTabsSlider'\n\n// Mixins\nimport Colorable from '../../mixins/colorable'\nimport Proxyable from '../../mixins/proxyable'\nimport Themeable from '../../mixins/themeable'\n\n// Directives\nimport Resize from '../../directives/resize'\n\n// Utilities\nimport { convertToUnit } from '../../util/helpers'\nimport { ExtractVue } from './../../util/mixins'\nimport mixins from '../../util/mixins'\n\n// Types\nimport { VNode } from 'vue/types'\n\nconst baseMixins = mixins(\n Colorable,\n Proxyable,\n Themeable\n)\n\ninterface options extends ExtractVue<typeof baseMixins> {\n $refs: {\n items: InstanceType<typeof VTabsBar>\n }\n}\n\nexport default baseMixins.extend<options>().extend({\n name: 'v-tabs',\n\n directives: {\n Resize,\n },\n\n props: {\n activeClass: {\n type: String,\n default: '',\n },\n alignWithTitle: Boolean,\n backgroundColor: String,\n centerActive: Boolean,\n centered: Boolean,\n fixedTabs: Boolean,\n grow: Boolean,\n height: {\n type: [Number, String],\n default: undefined,\n },\n hideSlider: Boolean,\n iconsAndText: Boolean,\n mobileBreakPoint: {\n type: [Number, String],\n default: 1264,\n },\n nextIcon: {\n type: String,\n default: '$vuetify.icons.next',\n },\n optional: Boolean,\n prevIcon: {\n type: String,\n default: '$vuetify.icons.prev',\n },\n right: Boolean,\n showArrows: Boolean,\n sliderColor: String,\n sliderSize: {\n type: [Number, String],\n default: 2,\n },\n vertical: Boolean,\n },\n\n data () {\n return {\n resizeTimeout: 0,\n slider: {\n height: null as null | number,\n left: null as null | number,\n right: null as null | number,\n top: null as null | number,\n width: null as null | number,\n },\n transitionTime: 300,\n }\n },\n\n computed: {\n classes (): object {\n return {\n 'v-tabs--align-with-title': this.alignWithTitle,\n 'v-tabs--centered': this.centered,\n 'v-tabs--fixed-tabs': this.fixedTabs,\n 'v-tabs--grow': this.grow,\n 'v-tabs--icons-and-text': this.iconsAndText,\n 'v-tabs--right': this.right,\n 'v-tabs--vertical': this.vertical,\n ...this.themeClasses,\n }\n },\n isReversed (): boolean {\n return this.$vuetify.rtl && this.vertical\n },\n sliderStyles (): object {\n return {\n height: convertToUnit(this.slider.height),\n left: this.isReversed ? undefined : convertToUnit(this.slider.left),\n right: this.isReversed ? convertToUnit(this.slider.right) : undefined,\n top: this.vertical ? convertToUnit(this.slider.top) : undefined,\n transition: this.slider.left != null ? null : 'none',\n width: convertToUnit(this.slider.width),\n }\n },\n computedColor (): string {\n if (this.color) return this.color\n else if (this.isDark && !this.appIsDark) return 'white'\n else return 'primary'\n },\n },\n\n watch: {\n alignWithTitle: 'callSlider',\n centered: 'callSlider',\n centerActive: 'callSlider',\n fixedTabs: 'callSlider',\n grow: 'callSlider',\n right: 'callSlider',\n showArrows: 'callSlider',\n vertical: 'callSlider',\n '$vuetify.application.left': 'onResize',\n '$vuetify.application.right': 'onResize',\n '$vuetify.rtl': 'onResize',\n },\n\n mounted () {\n this.$nextTick(() => {\n window.setTimeout(this.callSlider, 30)\n })\n },\n\n methods: {\n callSlider () {\n if (\n this.hideSlider ||\n !this.$refs.items ||\n !this.$refs.items.selectedItems.length\n ) {\n this.slider.width = 0\n return false\n }\n\n this.$nextTick(() => {\n // Give screen time to paint\n const activeTab = this.$refs.items.selectedItems[0]\n /* istanbul ignore if */\n if (!activeTab || !activeTab.$el) {\n this.slider.width = 0\n this.slider.left = 0\n return\n }\n const el = activeTab.$el as HTMLElement\n\n this.slider = {\n height: !this.vertical ? Number(this.sliderSize) : el.scrollHeight,\n left: this.vertical ? 0 : el.offsetLeft,\n right: this.vertical ? 0 : el.offsetLeft + el.offsetWidth,\n top: el.offsetTop,\n width: this.vertical ? Number(this.sliderSize) : el.scrollWidth,\n }\n })\n\n return true\n },\n genBar (items: VNode[], slider: VNode | null) {\n const data = {\n style: {\n height: convertToUnit(this.height),\n },\n props: {\n activeClass: this.activeClass,\n centerActive: this.centerActive,\n dark: this.dark,\n light: this.light,\n mandatory: !this.optional,\n mobileBreakPoint: this.mobileBreakPoint,\n nextIcon: this.nextIcon,\n prevIcon: this.prevIcon,\n showArrows: this.showArrows,\n value: this.internalValue,\n },\n on: {\n 'call:slider': this.callSlider,\n change: (val: any) => {\n this.internalValue = val\n },\n },\n ref: 'items',\n }\n\n this.setTextColor(this.computedColor, data)\n this.setBackgroundColor(this.backgroundColor, data)\n\n return this.$createElement(VTabsBar, data, [\n this.genSlider(slider),\n items,\n ])\n },\n genItems (items: VNode | null, item: VNode[]) {\n // If user provides items\n // opt to use theirs\n if (items) return items\n\n // If no tabs are provided\n // render nothing\n if (!item.length) return null\n\n return this.$createElement(VTabsItems, {\n props: {\n value: this.internalValue,\n },\n on: {\n change: (val: any) => {\n this.internalValue = val\n },\n },\n }, item)\n },\n genSlider (slider: VNode | null) {\n if (this.hideSlider) return null\n\n if (!slider) {\n slider = this.$createElement(VTabsSlider, {\n props: { color: this.sliderColor },\n })\n }\n\n return this.$createElement('div', {\n staticClass: 'v-tabs-slider-wrapper',\n style: this.sliderStyles,\n }, [slider])\n },\n onResize () {\n if (this._isDestroyed) return\n\n clearTimeout(this.resizeTimeout)\n this.resizeTimeout = window.setTimeout(this.callSlider, 0)\n },\n parseNodes () {\n let items = null\n let slider = null\n const item = []\n const tab = []\n const slot = this.$slots.default || []\n const length = slot.length\n\n for (let i = 0; i < length; i++) {\n const vnode = slot[i]\n\n if (vnode.componentOptions) {\n switch (vnode.componentOptions.Ctor.options.name) {\n case 'v-tabs-slider': slider = vnode\n break\n case 'v-tabs-items': items = vnode\n break\n case 'v-tab-item': item.push(vnode)\n break\n // case 'v-tab' - intentionally omitted\n default: tab.push(vnode)\n }\n } else {\n tab.push(vnode)\n }\n }\n\n /**\n * tab: array of `v-tab`\n * slider: single `v-tabs-slider`\n * items: single `v-tabs-items`\n * item: array of `v-tab-item`\n */\n return { tab, slider, items, item }\n },\n },\n\n render (h): VNode {\n const { tab, slider, items, item } = this.parseNodes()\n\n return h('div', {\n staticClass: 'v-tabs',\n class: this.classes,\n directives: [{\n name: 'resize',\n modifiers: { quiet: true },\n value: this.onResize,\n }],\n }, [\n this.genBar(tab, slider),\n this.genItems(items, item),\n ])\n },\n})\n"],"sourceRoot":"","file":"VTabs.js"} |