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ixins\nimport CalendarBase from './mixins/calendar-base'\n\n// Util\nimport props from './util/props'\nimport {\n VTimestamp,\n VTimestampFormatter,\n createDayList,\n getDayIdentifier,\n createNativeLocaleFormatter\n} from './util/timestamp'\n\n/* @vue/component */\nexport default CalendarBase.extend({\n name: 'v-calendar-weekly',\n\n props: props.weeks,\n\n computed: {\n staticClass (): string {\n return 'v-calendar-weekly'\n },\n classes (): object {\n return this.themeClasses\n },\n parsedMinWeeks (): number {\n return parseInt(this.minWeeks)\n },\n days (): VTimestamp[] {\n const minDays = this.parsedMinWeeks * this.weekdays.length\n const start = this.getStartOfWeek(this.parsedStart)\n const end = this.getEndOfWeek(this.parsedEnd)\n\n return createDayList(\n start,\n end,\n this.times.today,\n this.weekdaySkips,\n Number.MAX_SAFE_INTEGER,\n minDays\n )\n },\n todayWeek (): VTimestamp[] {\n const today = this.times.today\n const start = this.getStartOfWeek(today)\n const end = this.getEndOfWeek(today)\n\n return createDayList(\n start,\n end,\n today,\n this.weekdaySkips,\n this.weekdays.length,\n this.weekdays.length\n )\n },\n monthFormatter (): VTimestampFormatter {\n if (this.monthFormat) {\n return this.monthFormat as VTimestampFormatter\n }\n\n const longOptions = { timeZone: 'UTC', month: 'long' }\n const shortOptions = { timeZone: 'UTC', month: 'short' }\n\n return createNativeLocaleFormatter(\n this.locale,\n (_tms, short) => short ? shortOptions : longOptions\n )\n }\n },\n\n methods: {\n isOutside (day: VTimestamp): boolean {\n const dayIdentifier = getDayIdentifier(day)\n\n return dayIdentifier < getDayIdentifier(this.parsedStart) ||\n dayIdentifier > getDayIdentifier(this.parsedEnd)\n },\n genHead (): VNode {\n return this.$createElement('div', {\n staticClass: 'v-calendar-weekly__head'\n }, this.genHeadDays())\n },\n genHeadDays (): VNode[] {\n return this.todayWeek.map(this.genHeadDay)\n },\n genHeadDay (day: VTimestamp, index: number): VNode {\n const outside = this.isOutside(this.days[index])\n const color = day.present ? this.color : undefined\n\n return this.$createElement('div', this.setTextColor(color, {\n key: day.date,\n staticClass: 'v-calendar-weekly__head-weekday',\n class: this.getRelativeClasses(day, outside)\n }), this.weekdayFormatter(day, this.shortWeekdays))\n },\n genWeeks (): VNode[] {\n const days = this.days\n const weekDays = this.weekdays.length\n const weeks: VNode[] = []\n for (let i = 0; i < days.length; i += weekDays) {\n weeks.push(this.genWeek(days.slice(i, i + weekDays)))\n }\n\n return weeks\n },\n genWeek (week: VTimestamp[]): VNode {\n return this.$createElement('div', {\n key: week[0].date,\n staticClass: 'v-calendar-weekly__week'\n }, week.map(this.genDay))\n },\n genDay (day: VTimestamp): VNode {\n const outside = this.isOutside(day)\n const slot = this.$scopedSlots.day\n const slotData = { outside, ...day }\n const hasMonth = day.day === 1 && this.showMonthOnFirst\n\n return this.$createElement('div', {\n key: day.date,\n staticClass: 'v-calendar-weekly__day',\n class: this.getRelativeClasses(day, outside),\n on: this.getDefaultMouseEventHandlers(':day', _e => day)\n }, [\n this.genDayLabel(day),\n hasMonth ? this.genDayMonth(day) : '',\n slot ? slot(slotData) : ''\n ])\n },\n genDayLabel (day: VTimestamp): VNode {\n const color = day.present ? this.color : undefined\n const slot = this.$scopedSlots.dayLabel\n\n return this.$createElement('div', this.setTextColor(color, {\n staticClass: 'v-calendar-weekly__day-label',\n on: this.getMouseEventHandlers({\n 'click:date': { event: 'click', stop: true },\n 'contextmenu:date': { event: 'contextmenu', stop: true, prevent: true, result: false }\n }, _e => day)\n }), slot ? slot(day) as VNodeChildren : this.dayFormatter(day, false))\n },\n genDayMonth (day: VTimestamp): VNode | string {\n const color = day.present ? this.color : undefined\n const slot = this.$scopedSlots.dayMonth\n\n return this.$createElement('div', this.setTextColor(color, {\n staticClass: 'v-calendar-weekly__day-month'\n }), slot ? slot(day) as VNodeChildren : this.monthFormatter(day, this.shortMonths))\n }\n },\n\n render (h): VNode {\n return h('div', {\n staticClass: this.staticClass,\n class: this.classes,\n nativeOn: {\n dragstart: (e: MouseEvent) => {\n e.preventDefault()\n }\n }\n }, [\n !this.hideHeader ? this.genHead() : '',\n ...this.genWeeks()\n ])\n }\n})\n"],"sourceRoot":""}
|