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I,KAAK,UAAb,EAAyB;AACvB,wBAAI,KAAK,UAAT;AACD;AACF;AAED,mBAAO,CAAP;AACD;AAlEM;AA1DwB,CAApB,C","sourcesContent":["\n// Mixins\nimport CalendarBase from './calendar-base'\n\n// Util\nimport props from '../util/props'\nimport {\n VTimestamp,\n VTime,\n VTimestampFormatter,\n parseTime,\n copyTimestamp,\n updateMinutes,\n createDayList,\n createIntervalList,\n createNativeLocaleFormatter\n} from '../util/timestamp'\n\n/* @vue/component */\nexport default CalendarBase.extend({\n name: 'calendar-with-intervals',\n\n props: props.intervals,\n\n computed: {\n parsedFirstInterval (): number {\n return parseInt(this.firstInterval)\n },\n parsedIntervalMinutes (): number {\n return parseInt(this.intervalMinutes)\n },\n parsedIntervalCount (): number {\n return parseInt(this.intervalCount)\n },\n parsedIntervalHeight (): number {\n return parseFloat(this.intervalHeight)\n },\n firstMinute (): number {\n return this.parsedFirstInterval * this.parsedIntervalMinutes\n },\n bodyHeight (): number {\n return this.parsedIntervalCount * this.parsedIntervalHeight\n },\n days (): VTimestamp[] {\n return createDayList(\n this.parsedStart,\n this.parsedEnd,\n this.times.today,\n this.weekdaySkips,\n this.maxDays\n )\n },\n intervals (): VTimestamp[][] {\n const days: VTimestamp[] = this.days\n const first: number = this.parsedFirstInterval\n const minutes: number = this.parsedIntervalMinutes\n const count: number = this.parsedIntervalCount\n const now: VTimestamp = this.times.now\n\n return days.map(d => createIntervalList(d, first, minutes, count, now))\n },\n intervalFormatter (): VTimestampFormatter {\n if (this.intervalFormat) {\n return this.intervalFormat as VTimestampFormatter\n }\n\n const longOptions = { timeZone: 'UTC', hour12: true, hour: '2-digit', minute: '2-digit' }\n const shortOptions = { timeZone: 'UTC', hour12: true, hour: 'numeric', minute: '2-digit' }\n const shortHourOptions = { timeZone: 'UTC', hour12: true, hour: 'numeric' }\n\n return createNativeLocaleFormatter(\n this.locale,\n (tms, short) => short ? (tms.minute === 0 ? shortHourOptions : shortOptions) : longOptions\n )\n }\n },\n\n methods: {\n showIntervalLabelDefault (interval: VTimestamp): boolean {\n const first: VTimestamp = this.intervals[0][0]\n const isFirst: boolean = first.hour === interval.hour && first.minute === interval.minute\n return !isFirst && interval.minute === 0\n },\n intervalStyleDefault (_interval: VTimestamp): object | undefined {\n return undefined\n },\n getTimestampAtEvent (e: MouseEvent | TouchEvent, day: VTimestamp): VTimestamp {\n const timestamp: VTimestamp = copyTimestamp(day)\n const bounds = (e.currentTarget as HTMLElement).getBoundingClientRect()\n const baseMinutes: number = this.firstMinute\n const touchEvent: TouchEvent = e as TouchEvent\n const mouseEvent: MouseEvent = e as MouseEvent\n const touches: TouchList = touchEvent.changedTouches || touchEvent.touches\n const clientY: number = touches && touches[0] ? touches[0].clientY : mouseEvent.clientY\n const addIntervals: number = (clientY - bounds.top) / this.parsedIntervalHeight\n const addMinutes: number = Math.floor(addIntervals * this.parsedIntervalMinutes)\n const minutes: number = baseMinutes + addMinutes\n\n return updateMinutes(timestamp, minutes, this.times.now)\n },\n getSlotScope (timestamp: VTimestamp): any {\n const scope = copyTimestamp(timestamp) as any\n scope.timeToY = this.timeToY\n scope.minutesToPixels = this.minutesToPixels\n return scope\n },\n scrollToTime (time: VTime): boolean {\n const y = this.timeToY(time)\n const pane = this.$refs.scrollArea as HTMLElement\n\n if (y === false || !pane) {\n return false\n }\n\n pane.scrollTop = y\n\n return true\n },\n minutesToPixels (minutes: number): number {\n return minutes / this.parsedIntervalMinutes * this.parsedIntervalHeight\n },\n timeToY (time: VTime, clamp = true): number | false {\n const minutes = parseTime(time)\n\n if (minutes === false) {\n return false\n }\n\n const min: number = this.firstMinute\n const gap: number = this.parsedIntervalCount * this.parsedIntervalMinutes\n const delta: number = (minutes - min) / gap\n let y: number = delta * this.bodyHeight\n\n if (clamp) {\n if (y < 0) {\n y = 0\n }\n if (y > this.bodyHeight) {\n y = this.bodyHeight\n }\n }\n\n return y\n }\n }\n})\n"],"sourceRoot":""}
|