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,IAAe,KAAK,QAAL,GAAgB,CAAhB,GAAoB,CAAnC,MAA0C,CAA9C,EAAiD;AAC/C,6BAAS,IAAT,CAAc,KAAK,KAAL,CAAW,IAAX,CAAd;AACA,2BAAO,EAAP;AACA,0BAAM,WAAN,IAAqB,KAAK,QAA1B,IAAsC,KAAK,IAAL,CAAU,KAAK,aAAL,CAAmB,YAAnB,CAAV,CAAtC;AACD;AACF;AAED,gBAAI,KAAK,MAAT,EAAiB;AACf,yBAAS,IAAT,CAAc,KAAK,KAAL,CAAW,IAAX,CAAd;AACD;AAED,mBAAO,KAAK,cAAL,CAAoB,OAApB,EAA6B,QAA7B,CAAP;AACD,SAnEM;AAoEP,aApEO,iBAoEA,QApEA,EAoEuB;AAC5B,mBAAO,CAAC,KAAK,cAAL,CAAoB,IAApB,EAA0B,QAA1B,CAAD,CAAP;AACD;AAtEM,KA5BF;AAqGP,UArGO,oBAqGD;AACJ,eAAO,KAAK,QAAL,CAAc,+CAAd,EAA+D,CACpE,KAAK,QAAL,EADoE,EAEpE,KAAK,QAAL,EAFoE,CAA/D,EAGJ,KAAK,kBAHD,CAAP;AAID;AA1GM,CAHM,C;AAVf","sourcesContent":["// Mixins\nimport DatePickerTable from './mixins/date-picker-table'\n\n// Utils\nimport { pad, createNativeLocaleFormatter, monthChange } from './util'\nimport { createRange } from '../../util/helpers'\nimport mixins from '../../util/mixins'\n\n// Types\nimport { DatePickerFormatter } from './util/createNativeLocaleFormatter'\nimport { PropValidator } from 'vue/types/options'\nimport { VNode, VNodeChildren } from 'vue'\n\nexport default mixins(\n DatePickerTable\n/* @vue/component */\n).extend({\n name: 'v-date-picker-date-table',\n\n props: {\n firstDayOfWeek: {\n type: [String, Number],\n default: 0\n },\n showWeek: Boolean,\n weekdayFormat: Function as PropValidator\n },\n\n computed: {\n formatter (): DatePickerFormatter {\n return this.format || createNativeLocaleFormatter(this.locale, { day: 'numeric', timeZone: 'UTC' }, { start: 8, length: 2 })\n },\n weekdayFormatter (): DatePickerFormatter | undefined {\n return this.weekdayFormat || createNativeLocaleFormatter(this.locale, { weekday: 'narrow', timeZone: 'UTC' })\n },\n weekDays (): string[] {\n const first = parseInt(this.firstDayOfWeek, 10)\n\n return this.weekdayFormatter\n ? createRange(7).map(i => this.weekdayFormatter!(`2017-01-${first + i + 15}`)) // 2017-01-15 is Sunday\n : createRange(7).map(i => ['S', 'M', 'T', 'W', 'T', 'F', 'S'][(i + first) % 7])\n }\n },\n\n methods: {\n calculateTableDate (delta: number) {\n return monthChange(this.tableDate, Math.sign(delta || 1))\n },\n genTHead () {\n const days = this.weekDays.map(day => this.$createElement('th', day))\n this.showWeek && days.unshift(this.$createElement('th'))\n return this.$createElement('thead', this.genTR(days))\n },\n // Returns number of the days from the firstDayOfWeek to the first day of the current month\n weekDaysBeforeFirstDayOfTheMonth () {\n const firstDayOfTheMonth = new Date(`${this.displayedYear}-${pad(this.displayedMonth + 1)}-01T00:00:00+00:00`)\n const weekDay = firstDayOfTheMonth.getUTCDay()\n return (weekDay - parseInt(this.firstDayOfWeek) + 7) % 7\n },\n getWeekNumber () {\n let dayOfYear = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334][this.displayedMonth]\n if (this.displayedMonth > 1 &&\n (((this.displayedYear % 4 === 0) && (this.displayedYear % 100 !== 0)) || (this.displayedYear % 400 === 0))\n ) {\n dayOfYear++\n }\n const offset = (\n this.displayedYear +\n ((this.displayedYear - 1) >> 2) -\n Math.floor((this.displayedYear - 1) / 100) +\n Math.floor((this.displayedYear - 1) / 400) -\n Number(this.firstDayOfWeek)\n ) % 7 // https://en.wikipedia.org/wiki/Zeller%27s_congruence\n return Math.floor((dayOfYear + offset) / 7) + 1\n },\n genWeekNumber (weekNumber: number) {\n return this.$createElement('td', [\n this.$createElement('small', {\n staticClass: 'v-date-picker-table--date__week'\n }, String(weekNumber).padStart(2, '0'))\n ])\n },\n genTBody () {\n const children = []\n const daysInMonth = new Date(this.displayedYear, this.displayedMonth + 1, 0).getDate()\n let rows = []\n let day = this.weekDaysBeforeFirstDayOfTheMonth()\n let weekNumber = this.getWeekNumber()\n\n this.showWeek && rows.push(this.genWeekNumber(weekNumber++))\n\n while (day--) rows.push(this.$createElement('td'))\n for (day = 1; day <= daysInMonth; day++) {\n const date = `${this.displayedYear}-${pad(this.displayedMonth + 1)}-${pad(day)}`\n\n rows.push(this.$createElement('td', [\n this.genButton(date, true, 'date', this.formatter)\n ]))\n\n if (rows.length % (this.showWeek ? 8 : 7) === 0) {\n children.push(this.genTR(rows))\n rows = []\n day < daysInMonth && this.showWeek && rows.push(this.genWeekNumber(weekNumber++))\n }\n }\n\n if (rows.length) {\n children.push(this.genTR(rows))\n }\n\n return this.$createElement('tbody', children)\n },\n genTR (children: VNodeChildren) {\n return [this.$createElement('tr', children)]\n }\n },\n\n render (): VNode {\n return this.genTable('v-date-picker-table v-date-picker-table--date', [\n this.genTHead(),\n this.genTBody()\n ], this.calculateTableDate)\n }\n})\n"],"sourceRoot":""}