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AI,IAAI,OAAjC,EAA0C,IAAI,EAA9C,EAAkD;AAChD,QAAA,QAAQ,CAAC,IAAT,CAAc,KAAK,WAAL,CAAiB,IAAjB,CAAd;AACD;;AAED,aAAO,QAAP;AACD;AA1BM,GAlCF;AA+DP,EAAA,MA/DO,oBA+DD;AACJ,WAAO,KAAK,cAAL,CAAoB,IAApB,EAA0B;AAC/B,MAAA,WAAW,EAAE,qBADkB;AAE/B,MAAA,GAAG,EAAE;AAF0B,KAA1B,EAGJ,KAAK,YAAL,EAHI,CAAP;AAID;AApEM,CAXM,C","sourcesContent":["import './VDatePickerYears.sass'\n\n// Mixins\nimport Colorable from '../../mixins/colorable'\nimport Localable from '../../mixins/localable'\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<options &\n/* eslint-disable indent */\n ExtractVue<[\n typeof Colorable,\n typeof Localable\n ]>\n/* eslint-enable indent */\n>(\n Colorable,\n Localable\n/* @vue/component */\n).extend({\n name: 'v-date-picker-years',\n\n props: {\n format: Function as PropValidator<DatePickerFormatter | undefined>,\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.currentLocale, { 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":"","file":"VDatePickerYears.js"} |