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Ad,EAAqB,EAArB,MAA6B,IAA5C;AACA,gBAAM,QAAQ,WAAW,KAAK,KAAL,IAAc,SAAzB,CAAd;AAEA,mBAAO,KAAK,cAAL,CAAoB,IAApB,EAA0B,KAAK,YAAL,CAAkB,KAAlB,EAAyB;AACxD,qBAAK,IADmD;AAExD,yBAAS,EAAE,cAAF,EAF+C;AAGxD,oBAAI;AACF,2BAAO;AAAA,+BAAM,OAAK,KAAL,CAAW,OAAX,EAAoB,IAApB,CAAN;AAAA;AADL;AAHoD,aAAzB,CAA1B,EAMH,SANG,CAAP;AAOD,SAbM;AAeP,oBAfO,0BAeK;AACV,gBAAM,WAAW,EAAjB;AACA,gBAAM,eAAe,KAAK,KAAL,GAAa,SAAS,KAAK,KAAd,EAAqB,EAArB,CAAb,GAAwC,IAAI,IAAJ,GAAW,WAAX,EAA7D;AACA,gBAAM,UAAU,KAAK,GAAL,GAAW,SAAS,KAAK,GAAd,EAAmB,EAAnB,CAAX,GAAqC,eAAe,GAApE;AACA,gBAAM,UAAU,KAAK,GAAL,CAAS,OAAT,EAAkB,KAAK,GAAL,GAAW,SAAS,KAAK,GAAd,EAAmB,EAAnB,CAAX,GAAqC,eAAe,GAAtE,CAAhB;AAEA,iBAAK,IAAI,OAAO,OAAhB,EAAyB,QAAQ,OAAjC,EAA0C,MAA1C,EAAkD;AAChD,yBAAS,IAAT,CAAc,KAAK,WAAL,CAAiB,IAAjB,CAAd;AACD;AAED,mBAAO,QAAP;AACD;AA1BM,KAtCF;AAmEP,UAnEO,oBAmED;AACJ,eAAO,KAAK,cAAL,CAAoB,IAApB,EAA0B;AAC/B,yBAAa,qBADkB;AAE/B,iBAAK;AAF0B,SAA1B,EAGJ,KAAK,YAAL,EAHI,CAAP;AAID;AAxEM,CATM,C;AAhBf","sourcesContent":["import '../../stylus/components/_date-picker-years.styl'\n\n// Mixins\nimport Colorable from '../../mixins/colorable'\n\n// Utils\nimport { createNativeLocaleFormatter } from './util'\nimport mixins, { ExtractVue } from '../../util/mixins'\n\n// Types\nimport Vue, { VNode } from 'vue'\nimport { DatePickerFormatter } from './util/createNativeLocaleFormatter'\nimport { PropValidator } from 'vue/types/options'\n\ninterface options extends Vue {\n $el: HTMLElement\n}\n\nexport default mixins\n/* eslint-enable indent */\n>(\n Colorable\n/* @vue/component */\n).extend({\n name: 'v-date-picker-years',\n\n props: {\n format: Function as PropValidator,\n locale: {\n type: String,\n default: 'en-us'\n },\n min: [Number, String],\n max: [Number, String],\n readonly: Boolean,\n value: [Number, String]\n },\n\n data () {\n return {\n defaultColor: 'primary'\n }\n },\n\n computed: {\n formatter (): DatePickerFormatter {\n return this.format || createNativeLocaleFormatter(this.locale, { year: 'numeric', timeZone: 'UTC' }, { length: 4 })\n }\n },\n\n mounted () {\n setTimeout(() => {\n const activeItem = this.$el.getElementsByClassName('active')[0]\n if (activeItem) {\n this.$el.scrollTop = activeItem.offsetTop - this.$el.offsetHeight / 2 + activeItem.offsetHeight / 2\n } else {\n this.$el.scrollTop = this.$el.scrollHeight / 2 - this.$el.offsetHeight / 2\n }\n })\n },\n\n methods: {\n genYearItem (year: number): VNode {\n const formatted = this.formatter(`${year}`)\n const active = parseInt(this.value, 10) === year\n const color = active && (this.color || 'primary')\n\n return this.$createElement('li', this.setTextColor(color, {\n key: year,\n 'class': { active },\n on: {\n click: () => this.$emit('input', year)\n }\n }), formatted)\n },\n\n genYearItems (): VNode[] {\n const children = []\n const selectedYear = this.value ? parseInt(this.value, 10) : new Date().getFullYear()\n const maxYear = this.max ? parseInt(this.max, 10) : (selectedYear + 100)\n const minYear = Math.min(maxYear, this.min ? parseInt(this.min, 10) : (selectedYear - 100))\n\n for (let year = maxYear; year >= minYear; year--) {\n children.push(this.genYearItem(year))\n }\n\n return children\n }\n },\n\n render (): VNode {\n return this.$createElement('ul', {\n staticClass: 'v-date-picker-years',\n ref: 'years'\n }, this.genYearItems())\n }\n})\n"],"sourceRoot":""}