1 line
9.3 KiB
Plaintext
1 line
9.3 KiB
Plaintext
|
{"version":3,"file":"VCalendarInterval.mjs","names":["VCalendarIntervalEvent","useDate","computed","convertToUnit","genericComponent","propsFactory","useRender","makeVCalendarIntervalProps","day","type","Object","default","dayIndex","Number","events","Array","intervalDivisions","intervalDuration","intervalHeight","intervalFormat","String","Function","intervalStart","VCalendarInterval","name","props","index","required","setup","_ref","emit","slots","adapter","interval","start","addMinutes","startOfDay","date","end","label","format","filter","e","allDay","isEqual","isWithinRange","map","first","last","_createVNode","value","some","event"],"sources":["../../../src/labs/VCalendar/VCalendarInterval.tsx"],"sourcesContent":["// Styles\nimport './VCalendarInterval.sass'\n\n// Components\nimport { VCalendarIntervalEvent } from './VCalendarIntervalEvent'\n\n// Composables\nimport { useDate } from '@/composables/date'\n\n// Utilities\nimport { computed } from 'vue'\nimport { convertToUnit, genericComponent, propsFactory, useRender } from '@/util'\n\nexport const makeVCalendarIntervalProps = propsFactory({\n day: {\n type: Object,\n default: () => ({}),\n },\n dayIndex: Number,\n events: Array<any>,\n intervalDivisions: {\n type: Number,\n default: 2,\n },\n intervalDuration: {\n type: Number,\n default: 60,\n },\n intervalHeight: {\n type: Number,\n default: 48,\n },\n intervalFormat: {\n type: [String, Function],\n default: 'fullTime12h',\n },\n intervalStart: {\n type: Number,\n default: 0,\n },\n}, 'VCalendarInterval')\n\nexport const VCalendarInterval = genericComponent()({\n name: 'VCalendarInterval',\n\n props: {\n index: {\n type: Number,\n required: true,\n },\n\n ...makeVCalendarIntervalProps(),\n },\n\n setup (props, { emit, slots }) {\n const adapter = useDate()\n const interval = computed(() => {\n const start = adapter.addMinutes(adapter.startOfDay(props.day.date), (props.intervalDuration * (props.index + props.intervalStart)))\n const end = adapter.addMinutes(\n adapter.startOfDay(props.day.date),\n (props.intervalDuration * (props.index + props.intervalStart + 1)) - 1\n )\n return {\n ...props.day,\n label: adapter.format(start, 'fullTime24h'),\n start,\n end,\n events: props.events\n ? props.events\n .filter(e => !e.allDay &&\n (adapter.isEqual(start, e.start) ||\n adapter.isWithinRange(e.start, [start, end]) ||\n adapter.isWithinRange(start, [e.start, e.end]) ||\n adapter.isEqual(end, e.end))\n )\n .map(e => {\n return {\n ...e,\n first: adapter.isEqual(start, e.start) || adapter.isWithinRange(e.start, [start, end]),\n last: adapter.isEqual(end, e.end) || adapter.isWithinRange(e.end, [start, end]),\n }\n })\n : [],\n }\n })\n\n useRender(() => {\n return (\n props.dayIndex === 0 ? (\n <div class=\"v-calendar-day__row-with-label\" style={ `height: ${convertToUnit(props.intervalHeight)}` }>\n <div class=\"v-calendar-day__row-label\">\n <slot name=\"intervalFormat\" interval={ interval.value }>\n { props.index\n ? props.intervalFormat\n ? typeof props.intervalFormat === 'string'\n ? adapter.format(interval.value.start, 'hours12h')\n : props.intervalFormat(interval.value)\n : interval.value.label\n : ''\n }\n </slot>\n </div>\n <div class=\"v-calendar-day__row-hairline\"></div>\n <div class={['v-calendar-day__row-content', interval.value.events.some(e => !e.last)\n ? 'v-calendar-day__row-content-through'\n : '']}\n >\n <slot name=\"intervalBody\" interval={ interval.value }>\n { inter
|