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,CAAoB,KAApB,EAA2B,KAAK,YAAL,CAAkB,KAAlB,EAAyB;AACjE,qBAAK,OAAO,KAAK,KAAZ;AAD4D,aAAzB,CAA3B,EAEX,CAAC,KAAK,cAAL,CAAoB,QAApB,EAA8B;AACjC,uBAAO;AACL,0BAAM;AADD,iBAD0B;AAIjC,oBAAI;AACF,2BAAO;AAAA,+BAAM,OAAK,KAAL,CAAW,QAAX,CAAN;AAAA;AADL;AAJ6B,aAA9B,EAOF,CAAC,KAAK,MAAL,CAAY,OAAZ,IAAuB,KAAK,SAAL,CAAe,OAAO,KAAK,KAAZ,CAAf,CAAxB,CAPE,CAAD,CAFW,CAAf;AAWA,gBAAM,aAAa,KAAK,cAAL,CAAoB,YAApB,EAAkC;AACnD,uBAAO;AACL,0BAAO,KAAK,WAAL,KAAqB,CAAC,KAAK,QAAL,CAAc,GAArC,GAA4C,wBAA5C,GAAuE;AADxE;AAD4C,aAAlC,EAIhB,CAAC,MAAD,CAJgB,CAAnB;AAMA,mBAAO,KAAK,cAAL,CAAoB,KAApB,EAA2B;AAChC,6BAAa,6BADmB;AAEhC,uBAAO;AACL,6DAAyC,KAAK;AADzC;AAFyB,aAA3B,EAKJ,CAAC,UAAD,CALI,CAAP;AAMD;AAzDM,KAnDF;AA+GP,UA/GO,oBA+GD;AACJ,eAAO,KAAK,cAAL,CAAoB,KAApB,EAA2B;AAChC,yBAAa,sBADmB;AAEhC;AACE,kDAAkC,KAAK;AADzC,eAEK,KAAK,YAFV;AAFgC,SAA3B,EAMJ,CACD,KAAK,MAAL,CAAY,CAAC,CAAb,CADC,EAED,KAAK,SAAL,EAFC,EAGD,KAAK,MAAL,CAAY,CAAC,CAAb,CAHC,CANI,CAAP;AAWD;AA3HM,CAJM,C","sourcesContent":["import '../../stylus/components/_date-picker-header.styl'\n\n// Components\nimport VBtn from '../VBtn'\nimport VIcon from '../VIcon'\n\n// Mixins\nimport Colorable from '../../mixins/colorable'\nimport Themeable from '../../mixins/themeable'\n\n// Utils\nimport { createNativeLocaleFormatter, monthChange } from './util'\nimport mixins from '../../util/mixins'\n\n// Types\nimport { VNode } from 'vue'\nimport { DatePickerFormatter } from './util/createNativeLocaleFormatter'\nimport { PropValidator } from 'vue/types/options'\n\nexport default mixins(\n Colorable,\n Themeable\n/* @vue/component */\n).extend({\n name: 'v-date-picker-header',\n\n props: {\n disabled: Boolean,\n format: Function as PropValidator<DatePickerFormatter | undefined>,\n locale: {\n type: String,\n default: 'en-us'\n },\n min: String,\n max: String,\n nextIcon: {\n type: String,\n default: '$vuetify.icons.next'\n },\n prevIcon: {\n type: String,\n default: '$vuetify.icons.prev'\n },\n readonly: Boolean,\n value: {\n type: [Number, String],\n required: true\n }\n },\n\n data () {\n return {\n isReversing: false\n }\n },\n\n computed: {\n formatter (): DatePickerFormatter {\n if (this.format) {\n return this.format\n } else if (String(this.value).split('-')[1]) {\n return createNativeLocaleFormatter(this.locale, { month: 'long', year: 'numeric', timeZone: 'UTC' }, { length: 7 })\n } else {\n return createNativeLocaleFormatter(this.locale, { year: 'numeric', timeZone: 'UTC' }, { length: 4 })\n }\n }\n },\n\n watch: {\n value (newVal, oldVal) {\n this.isReversing = newVal < oldVal\n }\n },\n\n methods: {\n genBtn (change: number) {\n const disabled = this.disabled ||\n (change < 0 && this.min && this.calculateChange(change) < this.min) ||\n (change > 0 && this.max && this.calculateChange(change) > this.max)\n\n return this.$createElement(VBtn, {\n props: {\n dark: this.dark,\n disabled,\n icon: true,\n light: this.light\n },\n nativeOn: {\n click: (e: Event) => {\n e.stopPropagation()\n this.$emit('input', this.calculateChange(change))\n }\n }\n }, [\n this.$createElement(VIcon, ((change < 0) === !this.$vuetify.rtl) ? this.prevIcon : this.nextIcon)\n ])\n },\n calculateChange (sign: number) {\n const [year, month] = String(this.value).split('-').map(Number)\n\n if (month == null) {\n return `${year + sign}`\n } else {\n return monthChange(String(this.value), sign)\n }\n },\n genHeader () {\n const color = !this.disabled && (this.color || 'accent')\n const header = this.$createElement('div', this.setTextColor(color, {\n key: String(this.value)\n }), [this.$createElement('button', {\n attrs: {\n type: 'button'\n },\n on: {\n click: () => this.$emit('toggle')\n }\n }, [this.$slots.default || this.formatter(String(this.value))])])\n\n const transition = this.$createElement('transition', {\n props: {\n name: (this.isReversing === !this.$vuetify.rtl) ? 'tab-reverse-transition' : 'tab-transition'\n }\n }, [header])\n\n return this.$createElement('div', {\n staticClass: 'v-date-picker-header__value',\n class: {\n 'v-date-picker-header__value--disabled': this.disabled\n }\n }, [transition])\n }\n },\n\n render (): VNode {\n return this.$createElement('div', {\n staticClass: 'v-date-picker-header',\n class: {\n 'v-date-picker-header--disabled': this.disabled,\n ...this.themeClasses\n }\n }, [\n this.genBtn(-1),\n this.genHeader(),\n this.genBtn(+1)\n ])\n }\n})\n"],"sourceRoot":""}
|