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YACM,MADN,eACM,MADN;AAAA,YACc,KADd,eACc,KADd;AAAA,YACqB,IADrB,eACqB,IADrB;;AAGP,eAAO,EAAE,KAAF,EAAS;AACd,yBAAa,QADC;AAEd,wBAAY,CAAC;AACX,sBAAM,QADK;AAEX,2BAAW,EAAE,OAAO,IAAT,EAFA;AAGX,uBAAO,KAAK;AAHD,aAAD;AAFE,SAAT,EAOJ,CACD,KAAK,MAAL,CAAY,CAAC,KAAK,UAAL,GAAkB,IAAlB,GAAyB,KAAK,SAAL,CAAe,MAAf,CAA1B,EAAkD,GAAlD,CAAZ,CADC,EAED,EAAE,uBAAF,EAAiB;AACf,mBAAO,EAAE,MAAM,KAAK,KAAL,CAAW,MAAnB,EAA2B,OAAO,CAAC,KAAK,KAAL,CAAW,MAA9C;AADQ,SAAjB,EAEG,CACD,KAAK,QAAL,CAAc,KAAd,EAAqB,IAArB,CADC,CAFH,CAFC,CAPI,CAAP;AAeD;AAlNiC,CAArB,C;AAJf;;AAVA;;AAVA","sourcesContent":["// Styles\nimport '../../stylus/components/_tabs.styl'\n\n// Extensions\nimport { BaseItemGroup } from '../VItemGroup/VItemGroup'\n\n// Component level mixins\nimport TabsComputed from './mixins/tabs-computed'\nimport TabsGenerators from './mixins/tabs-generators'\nimport TabsProps from './mixins/tabs-props'\nimport TabsTouch from './mixins/tabs-touch'\nimport TabsWatchers from './mixins/tabs-watchers'\n\n// Mixins\nimport Colorable from '../../mixins/colorable'\nimport SSRBootable from '../../mixins/ssr-bootable'\nimport Themeable from '../../mixins/themeable'\n\n// Directives\nimport Resize from '../../directives/resize'\nimport Touch from '../../directives/touch'\nimport { deprecate } from '../../util/console'\n\n// Utils\nimport ThemeProvider from '../../util/ThemeProvider'\n\n/* @vue/component */\nexport default BaseItemGroup.extend({\n name: 'v-tabs',\n\n directives: {\n Resize,\n Touch\n },\n\n mixins: [\n Colorable,\n SSRBootable,\n TabsComputed,\n TabsProps,\n TabsGenerators,\n TabsTouch,\n TabsWatchers,\n Themeable\n ],\n\n provide () {\n return {\n tabGroup: this,\n tabProxy: this.tabProxy,\n registerItems: this.registerItems,\n unregisterItems: this.unregisterItems\n }\n },\n\n data () {\n return {\n bar: [],\n content: [],\n isOverflowing: false,\n nextIconVisible: false,\n prevIconVisible: false,\n resizeTimeout: null,\n scrollOffset: 0,\n sliderWidth: null,\n sliderLeft: null,\n startX: 0,\n tabItems: null,\n transitionTime: 300,\n widths: {\n bar: 0,\n container: 0,\n wrapper: 0\n }\n }\n },\n\n watch: {\n items: 'onResize',\n tabs: 'onResize'\n },\n\n mounted () {\n this.init()\n },\n\n methods: {\n checkIcons () {\n this.prevIconVisible = this.checkPrevIcon()\n this.nextIconVisible = this.checkNextIcon()\n },\n checkPrevIcon () {\n return this.scrollOffset > 0\n },\n checkNextIcon () {\n // Check one scroll ahead to know the width of right-most item\n return this.widths.container > this.scrollOffset + this.widths.wrapper\n },\n callSlider () {\n if (this.hideSlider || !this.activeTab) return false\n\n // Give screen time to paint\n const activeTab = this.activeTab\n\n this.$nextTick(() => {\n /* istanbul ignore if */\n if (!activeTab || !activeTab.$el) return\n this.sliderWidth = activeTab.$el.scrollWidth\n this.sliderLeft = activeTab.$el.offsetLeft\n })\n },\n // Do not process\n // until DOM is\n // painted\n init () {\n /* istanbul ignore next */\n if (this.$listeners['input']) {\n deprecate('@input', '@change', this)\n }\n },\n /**\n * When v-navigation-drawer changes the\n * width of the container, call resize\n * after the transition is complete\n */\n onResize () {\n if (this._isDestroyed) return\n\n this.setWidths()\n\n const delay = this.isBooted ? this.transitionTime : 0\n\n clearTimeout(this.resizeTimeout)\n this.resizeTimeout = setTimeout(this.updateTabsView, delay)\n },\n overflowCheck (e, fn) {\n this.isOverflowing && fn(e)\n },\n scrollTo (direction) {\n this.scrollOffset = this.newOffset(direction)\n },\n setOverflow () {\n this.isOverflowing = this.widths.bar < this.widths.container\n },\n setWidths () {\n const bar = this.$refs.bar ? this.$refs.bar.clientWidth : 0\n const container = this.$refs.container ? this.$refs.container.clientWidth : 0\n const wrapper = this.$refs.wrapper ? this.$refs.wrapper.clientWidth : 0\n\n this.widths = { bar, container, wrapper }\n\n this.setOverflow()\n },\n parseNodes () {\n const item = []\n const items = []\n const slider = []\n const tab = []\n const length = (this.$slots.default || []).length\n\n for (let i = 0; i < length; i++) {\n const vnode = this.$slots.default[i]\n\n if (vnode.componentOptions) {\n switch (vnode.componentOptions.Ctor.options.name) {\n case 'v-tabs-slider': slider.push(vnode)\n break\n case 'v-tabs-items': items.push(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 return { tab, slider, items, item }\n },\n registerItems (fn) {\n this.tabItems = fn\n fn(this.internalValue)\n },\n unregisterItems () {\n this.tabItems = null\n },\n updateTabsView () {\n this.callSlider()\n this.scrollIntoView()\n this.checkIcons()\n },\n scrollIntoView () {\n /* istanbul ignore next */\n if (!this.activeTab) return\n if (!this.isOverflowing) return (this.scrollOffset = 0)\n\n const totalWidth = this.widths.wrapper + this.scrollOffset\n const { clientWidth, offsetLeft } = this.activeTab.$el\n const itemOffset = clientWidth + offsetLeft\n let additionalOffset = clientWidth * 0.3\n\n if (this.activeTab === this.items[this.items.length - 1]) {\n additionalOffset = 0 // don't add an offset if selecting the last tab\n }\n\n /* istanbul ignore else */\n if (offsetLeft < this.scrollOffset) {\n this.scrollOffset = Math.max(offsetLeft - additionalOffset, 0)\n } else if (totalWidth < itemOffset) {\n this.scrollOffset -= totalWidth - itemOffset - additionalOffset\n }\n },\n tabProxy (val) {\n this.internalValue = val\n }\n },\n\n render (h) {\n const { tab, slider, items, item } = this.parseNodes()\n\n return h('div', {\n staticClass: 'v-tabs',\n directives: [{\n name: 'resize',\n modifiers: { quiet: true },\n value: this.onResize\n }]\n }, [\n this.genBar([this.hideSlider ? null : this.genSlider(slider), tab]),\n h(ThemeProvider, {\n props: { dark: this.theme.isDark, light: !this.theme.isDark }\n }, [\n this.genItems(items, item)\n ])\n ])\n }\n})\n"],"sourceRoot":""}