1 line
No EOL
10 KiB
Text
1 line
No EOL
10 KiB
Text
{"version":3,"sources":["../../../src/components/VCalendar/VCalendar.ts"],"names":[],"mappings":";;;;;;;AAOA;;AAGA;;AACA;;AAoBA;;AACA;;AACA;;;;;;;;;;AAUA;eACe,4BAAmB,MAAnB,CAA0B;AACvC,EAAA,IAAI,EAAE,YADiC;AAGvC,EAAA,KAAK,oBACA,eAAM,QADN,MAEA,eAAM,KAFN,MAGA,eAAM,SAHN,CAHkC;AASvC,EAAA,IAAI,EAAE;AAAA,WAAO;AACX,MAAA,SAAS,EAAE,IADA;AAEX,MAAA,OAAO,EAAE;AAFE,KAAP;AAAA,GATiC;AAcvC,EAAA,QAAQ,EAAE;AACR,IAAA,WADQ,yBACG;AACT,aAAQ,kCAAkB,KAAK,KAAvB,IACJ,+BAAe,KAAK,KAApB,CADI,GAEH,KAAK,WAAL,IAAoB,KAAK,KAAL,CAAW,KAFpC;AAGD,KALO;AAMR,IAAA,WANQ,yBAMG;AACT,UAAM,MAAM,GAAG,KAAK,WAApB;AACA,UAAI,SAAS,GAAQ,IAArB;AACA,UAAI,OAAO,GAAG,KAAK,OAAnB;AACA,UAAI,KAAK,GAAG,MAAZ;AACA,UAAI,GAAG,GAAG,MAAV;;AACA,cAAQ,KAAK,IAAb;AACE,aAAK,OAAL;AACE,UAAA,SAAS,GAAG,yBAAZ;AACA,UAAA,KAAK,GAAG,gCAAgB,MAAhB,CAAR;AACA,UAAA,GAAG,GAAG,8BAAc,MAAd,CAAN;AACA;;AACF,aAAK,MAAL;AACE,UAAA,SAAS,GAAG,uBAAZ;AACA,UAAA,KAAK,GAAG,KAAK,cAAL,CAAoB,MAApB,CAAR;AACA,UAAA,GAAG,GAAG,KAAK,YAAL,CAAkB,MAAlB,CAAN;AACA,UAAA,OAAO,GAAG,CAAV;AACA;;AACF,aAAK,KAAL;AACE,UAAA,SAAS,GAAG,uBAAZ;AACA,UAAA,OAAO,GAAG,CAAV;AACA;;AACF,aAAK,MAAL;AACE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AAEH,QAAA,KAAK,EAAE,KAAK,CAAC,IAFV;AAGH,QAAA,GAAG,EAAE,GAAG,CAAC,IAHN;AAIH,QAAA,OAAO,EAAP;AAJG,QALa;AAWlB,MAAA,UAAU,EAAE,CAAC;AACX,QAAA,SAAS,EAAE;AAAE,UAAA,KAAK,EAAE;AAAT,SADA;AAEX,QAAA,IAAI,EAAE,QAFK;AAGX,QAAA,KAAK,EAAE,KAAK;AAHD,OAAD,CAXM;AAgBlB,MAAA,EAAE,oBACG,KAAK,UADR;AAEA,sBAAc,mBAAC,GAAD,EAAoB;AAChC,cAAI,KAAI,CAAC,UAAL,CAAgB,OAAhB,CAAJ,EAA8B;AAC5B,YAAA,KAAI,CAAC,KAAL,CAAW,OAAX,EAAoB,GAAG,CAAC,IAAxB;AACD;;AACD,cAAI,KAAI,CAAC,UAAL,CAAgB,YAAhB,CAAJ,EAAmC;AACjC,YAAA,KAAI,CAAC,KAAL,CAAW,YAAX,EAAyB,GAAzB;AACD;AACF;AATD,QAhBgB;AA2BlB,MAAA,WAAW,EAAE,KAAK,cAAL;AA3BK,KAAZ,CAAR;AA6BD;AAzLsC,CAA1B,C","sourcesContent":["// Styles\n// import '../../stylus/components/_calendar-daily.styl'\n\n// Types\nimport { VNode, Component } from 'vue'\n\n// Mixins\nimport CalendarWithEvents from './mixins/calendar-with-events'\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 validateTimestamp,\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 CalendarWithEvents.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 (validateTimestamp(this.value)\n ? parseTimestamp(this.value)\n : (this.parsedStart || this.times.today)) as VTimestamp\n },\n renderProps (): VCalendarRenderProps {\n const around = this.parsedValue\n let component: any = null\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 default:\n throw new Error(this.type + ' is not a valid Calendar type')\n }\n\n return { component, start, end, maxDays }\n },\n },\n\n watch: {\n renderProps: 'checkChange',\n },\n\n mounted () {\n this.updateEventVisibility()\n },\n\n updated () {\n this.updateEventVisibility()\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 const index = moved.weekday\n const days = forward ? this.weekdaySkips[index] : this.weekdaySkipsReverse[index]\n relativeDays(moved, mover, days)\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 class: {\n 'v-calendar-events': !this.noEvents,\n },\n props: {\n ...this.$props,\n start: start.date,\n end: end.date,\n maxDays,\n },\n directives: [{\n modifiers: { quiet: true },\n name: 'resize',\n value: this.updateEventVisibility,\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.getScopedSlots(),\n })\n },\n})\n"],"sourceRoot":"","file":"VCalendar.js"} |