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ent":["// Styles\nimport './VCalendarWeekly.sass'\n\n// Types\nimport { VNode, VNodeChildren } from 'vue'\n\n// Components\nimport VBtn from '../VBtn'\n\n// Mixins\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.currentLocale,\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, index: number): VNode {\n const outside = this.isOutside(day)\n const slot = this.$scopedSlots.day\n const scope = { outside, index, ...day }\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 slot ? slot(scope) : '',\n // renders the orginial month text\n // (day.day === 1 && this.showMonthOnFirst) ? this.genDayMonth(day) : '',\n ])\n },\n genDayLabel (day: VTimestamp): VNode {\n const slot = this.$scopedSlots['day-label']\n\n return this.$createElement('div', {\n staticClass: 'v-calendar-weekly__day-label',\n }, [\n slot ? slot(day) as VNodeChildren : this.genDayLabelButton(day),\n ])\n },\n genDayLabelButton (day: VTimestamp): VNode {\n const color = day.present ? this.color : 'transparent'\n const hasMonth = day.day === 1 && this.showMonthOnFirst\n\n return this.$createElement(VBtn, {\n props: {\n color,\n fab: !hasMonth,\n rounded: hasMonth,\n depressed: true,\n small: true,\n },\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 }, hasMonth\n ? this.monthFormatter(day, this.shortMonths) + ' ' + this.dayFormatter(day, false)\n : this.dayFormatter(day, false)\n )\n },\n genDayMonth (day: VTimestamp): VNode | string {\n const color = day.present ? this.color : undefined\n const slot = this.$scopedSlots['day-month']\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":"","file":"VCalendarWeekly.js"} |