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OADb,iBACa,OADb;AAAA,YACsB,SADtB,iBACsB,SADtB;;AAGP,eAAO,EAAE,SAAF,EAAa;AAClB,yBAAa,YADK;AAElB,gCACK,KAAK,MADV;AAEE,uBAAO,MAAM,IAFf;AAGE,qBAAK,IAAI,IAHX;AAIE;AAJF,cAFkB;AAQlB,6BACK,KAAK,UADV;AAEE,8BAAc,mBAAC,GAAD,EAAoB;AAChC,wBAAI,MAAK,UAAL,CAAgB,OAAhB,CAAJ,EAA8B;AAC5B,8BAAK,KAAL,CAAW,OAAX,EAAoB,IAAI,IAAxB;AACD;AACD,wBAAI,MAAK,UAAL,CAAgB,YAAhB,CAAJ,EAAmC;AACjC,8BAAK,KAAL,CAAW,YAAX,EAAyB,GAAzB;AACD;AACF;AATH,cARkB;AAmBlB,yBAAa,KAAK;AAnBA,SAAb,CAAP;AAqBD;AArKgC,CAApB,C","sourcesContent":["// Styles\n// import '../../stylus/components/_calendar-daily.styl'\n\n// Types\nimport { VNode, Component } from 'vue'\n\n// Mixins\nimport CalendarBase from './mixins/calendar-base'\n\n// Util\nimport props from './util/props'\nimport {\n DAYS_IN_MONTH_MAX,\n DAY_MIN,\n DAYS_IN_WEEK,\n VTimestamp,\n VTime,\n parseTimestamp,\n relativeDays,\n nextDay,\n prevDay,\n copyTimestamp,\n updateFormatted,\n updateWeekday,\n updateRelative,\n getStartOfMonth,\n getEndOfMonth\n} from './util/timestamp'\n\n// Calendars\nimport VCalendarMonthly from './VCalendarMonthly'\nimport VCalendarDaily from './VCalendarDaily'\nimport VCalendarWeekly from './VCalendarWeekly'\n\n// Types\ninterface VCalendarRenderProps {\n start: VTimestamp\n end: VTimestamp\n component: string | Component\n maxDays: number\n}\n\n/* @vue/component */\nexport default CalendarBase.extend({\n name: 'v-calendar',\n\n props: {\n ...props.calendar,\n ...props.weeks,\n ...props.intervals\n },\n\n data: () => ({\n lastStart: null as VTimestamp | null,\n lastEnd: null as VTimestamp | null\n }),\n\n computed: {\n parsedValue (): VTimestamp {\n return parseTimestamp(this.value) ||\n this.parsedStart ||\n this.times.today\n },\n renderProps (): VCalendarRenderProps {\n const around = this.parsedValue\n let component: any = 'div'\n let maxDays = this.maxDays\n let start = around\n let end = around\n switch (this.type) {\n case 'month':\n component = VCalendarMonthly\n start = getStartOfMonth(around)\n end = getEndOfMonth(around)\n break\n case 'week':\n component = VCalendarDaily\n start = this.getStartOfWeek(around)\n end = this.getEndOfWeek(around)\n maxDays = 7\n break\n case 'day':\n component = VCalendarDaily\n maxDays = 1\n break\n case '4day':\n component = VCalendarDaily\n end = relativeDays(copyTimestamp(end), nextDay, 4)\n updateFormatted(end)\n maxDays = 4\n break\n case 'custom-weekly':\n component = VCalendarWeekly\n start = this.parsedStart || around\n end = this.parsedEnd\n break\n case 'custom-daily':\n component = VCalendarDaily\n start = this.parsedStart || around\n end = this.parsedEnd\n break\n }\n\n return { component, start, end, maxDays }\n }\n },\n\n watch: {\n renderProps: 'checkChange'\n },\n\n methods: {\n checkChange (): void {\n const { start, end } = this.renderProps\n if (start !== this.lastStart || end !== this.lastEnd) {\n this.lastStart = start\n this.lastEnd = end\n this.$emit('change', { start, end })\n }\n },\n move (amount = 1): void {\n const moved = copyTimestamp(this.parsedValue)\n const forward = amount > 0\n const mover = forward ? nextDay : prevDay\n const limit = forward ? DAYS_IN_MONTH_MAX : DAY_MIN\n let times = forward ? amount : -amount\n\n while (--times >= 0) {\n switch (this.type) {\n case 'month':\n moved.day = limit\n mover(moved)\n break\n case 'week':\n relativeDays(moved, mover, DAYS_IN_WEEK)\n break\n case 'day':\n mover(moved)\n break\n case '4day':\n relativeDays(moved, mover, 4)\n break\n }\n }\n\n updateWeekday(moved)\n updateFormatted(moved)\n updateRelative(moved, this.times.now)\n\n this.$emit('input', moved.date)\n this.$emit('moved', moved)\n },\n next (amount = 1): void {\n this.move(amount)\n },\n prev (amount = 1): void {\n this.move(-amount)\n },\n timeToY (time: VTime, clamp = true): number | false {\n const c = this.$children[0] as any\n if (c && c.timeToY) {\n return c.timeToY(time, clamp)\n } else {\n return false\n }\n },\n minutesToPixels (minutes: number): number {\n const c = this.$children[0] as any\n if (c && c.minutesToPixels) {\n return c.minutesToPixels(minutes)\n } else {\n return -1\n }\n },\n scrollToTime (time: VTime): boolean {\n const c = this.$children[0] as any\n if (c && c.scrollToTime) {\n return c.scrollToTime(time)\n } else {\n return false\n }\n }\n },\n\n render (h): VNode {\n const { start, end, maxDays, component } = this.renderProps\n\n return h(component, {\n staticClass: 'v-calendar',\n props: {\n ...this.$props,\n start: start.date,\n end: end.date,\n maxDays\n },\n on: {\n ...this.$listeners,\n 'click:date': (day: VTimestamp) => {\n if (this.$listeners['input']) {\n this.$emit('input', day.date)\n }\n if (this.$listeners['click:date']) {\n this.$emit('click:date', day)\n }\n }\n },\n scopedSlots: this.$scopedSlots\n })\n }\n})\n"],"sourceRoot":""}
|