@event-calendar/core 5.2.3 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -14
- package/dist/index.css +1 -1
- package/dist/index.js +792 -660
- package/package.json +2 -2
- package/src/Calendar.svelte +6 -1
- package/src/lib/chunks.js +6 -3
- package/src/lib/components/BaseEvent.svelte +11 -5
- package/src/lib/dom.js +9 -0
- package/src/lib/range.js +0 -10
- package/src/lib/resources.js +9 -8
- package/src/lib/utils.js +8 -9
- package/src/plugins/day-grid/View.svelte +50 -48
- package/src/plugins/list/View.svelte +2 -2
- package/src/plugins/resource-time-grid/View.svelte +10 -10
- package/src/plugins/resource-time-grid/derived.js +3 -3
- package/src/plugins/resource-timeline/View.svelte +80 -75
- package/src/plugins/resource-timeline/derived.js +1 -1
- package/src/plugins/resource-timeline/lib.js +7 -4
- package/src/plugins/time-grid/View.svelte +91 -88
- package/src/plugins/time-grid/lib.js +1 -0
- package/src/storage/derived.js +5 -4
- package/src/storage/effects.js +126 -74
- package/src/storage/options.svelte.js +6 -5
- package/src/storage/state.svelte.js +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@event-calendar/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"title": "Event Calendar Core package",
|
|
5
5
|
"description": "Full-sized drag & drop event calendar with resource & timeline views",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
"#components": "./src/lib/components/index.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"svelte": "^5.
|
|
35
|
+
"svelte": "^5.48.0"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/Calendar.svelte
CHANGED
|
@@ -48,8 +48,13 @@
|
|
|
48
48
|
return isDate(value) ? toLocalDate(value) : value;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
export function refetchResources() {
|
|
52
|
+
mainState.fetchedRange.resources = {};
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
export function refetchEvents() {
|
|
52
|
-
mainState.fetchedRange = {
|
|
57
|
+
mainState.fetchedRange.events = {};
|
|
53
58
|
return this;
|
|
54
59
|
}
|
|
55
60
|
|
package/src/lib/chunks.js
CHANGED
|
@@ -11,6 +11,7 @@ import {assign} from './utils.js';
|
|
|
11
11
|
* zeroDuration: boolean,
|
|
12
12
|
* gridColumn?: Number,
|
|
13
13
|
* gridRow?: Number,
|
|
14
|
+
* resource?: Object,
|
|
14
15
|
* group?: Object,
|
|
15
16
|
* groupColumn?: Number,
|
|
16
17
|
* dates?: Array
|
|
@@ -44,20 +45,22 @@ export function createAllDayChunks(event, days, withId = true) {
|
|
|
44
45
|
let lastEnd;
|
|
45
46
|
let gridColumn;
|
|
46
47
|
let gridRow;
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
let resource;
|
|
49
|
+
for (let {gridColumn: column, gridRow: row, resource: dayResource, dayStart, dayEnd, disabled} of days) {
|
|
50
|
+
if (!disabled && eventIntersects(event, dayStart, dayEnd, dayResource)) {
|
|
49
51
|
dates.push(dayStart);
|
|
50
52
|
lastEnd = dayEnd;
|
|
51
53
|
if (!gridColumn) {
|
|
52
54
|
gridColumn = column;
|
|
53
55
|
gridRow = row;
|
|
56
|
+
resource = dayResource;
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
if (dates.length) {
|
|
58
61
|
let chunk = createEventChunk(event, dates[0], lastEnd);
|
|
59
62
|
// Chunk layout
|
|
60
|
-
assign(chunk, {gridColumn, gridRow, dates});
|
|
63
|
+
assign(chunk, {gridColumn, gridRow, resource, dates});
|
|
61
64
|
if (withId) {
|
|
62
65
|
assignChunkId(chunk);
|
|
63
66
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import {getContext, onMount} from 'svelte';
|
|
3
3
|
import {
|
|
4
4
|
bgEvent, createEventClasses, createEventContent, entries, helperEvent, identity, isFunction, keyEnter,
|
|
5
|
-
|
|
5
|
+
findFirstResource, contentFrom, toEventWithLocalDates, toViewWithLocalDates, eventBackgroundColor as getEventBackgroundColor,
|
|
6
|
+
eventTextColor as getEventTextColor
|
|
6
7
|
} from '#lib';
|
|
7
8
|
|
|
8
9
|
let {
|
|
@@ -14,17 +15,22 @@
|
|
|
14
15
|
body
|
|
15
16
|
} = $props();
|
|
16
17
|
|
|
17
|
-
let {intlEventTime, view, options: {
|
|
18
|
+
let {intlEventTime, resources, view, options: {
|
|
18
19
|
displayEventEnd, eventBackgroundColor, eventColor, eventContent, eventClick, eventDidMount, eventClassNames,
|
|
19
|
-
eventMouseEnter, eventMouseLeave, eventTextColor,
|
|
20
|
+
eventMouseEnter, eventMouseLeave, eventTextColor, theme
|
|
20
21
|
}} = $derived(getContext('state'));
|
|
21
22
|
|
|
22
23
|
let event = $derived(chunk.event);
|
|
23
24
|
let display = $derived(chunk.event.display);
|
|
24
25
|
|
|
25
26
|
// Style
|
|
26
|
-
let bgColor = $derived(
|
|
27
|
-
|
|
27
|
+
let bgColor = $derived(
|
|
28
|
+
event.backgroundColor ?? getEventBackgroundColor(chunk.resource ?? findFirstResource(event, resources)) ??
|
|
29
|
+
eventBackgroundColor ?? eventColor
|
|
30
|
+
);
|
|
31
|
+
let txtColor = $derived(
|
|
32
|
+
event.textColor ?? getEventTextColor(chunk.resource ?? findFirstResource(event, resources)) ?? eventTextColor
|
|
33
|
+
);
|
|
28
34
|
let style = $derived(entries(styles(
|
|
29
35
|
{'background-color': bgColor, 'color': txtColor}
|
|
30
36
|
)).map(entry => `${entry[0]}:${entry[1]}`).concat(event.styles).join(';'));
|
package/src/lib/dom.js
CHANGED
|
@@ -52,3 +52,12 @@ export function listen(node, event, handler, options) {
|
|
|
52
52
|
node.addEventListener(event, handler, options);
|
|
53
53
|
return () => node.removeEventListener(event, handler, options);
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
export function stopPropagation(fn, _this = undefined) {
|
|
57
|
+
return function (jsEvent) {
|
|
58
|
+
jsEvent.stopPropagation();
|
|
59
|
+
if (fn) {
|
|
60
|
+
fn.call(_this, jsEvent);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
package/src/lib/range.js
CHANGED
|
@@ -17,13 +17,3 @@ export function createDateRange(input) {
|
|
|
17
17
|
export function outsideRange(date, range) {
|
|
18
18
|
return range.start && date < range.start || range.end && date > range.end;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
export function limitToRange(date, range) {
|
|
22
|
-
if (range.start && date < range.start) {
|
|
23
|
-
date = range.start;
|
|
24
|
-
}
|
|
25
|
-
if (range.end && date > range.end) {
|
|
26
|
-
date = range.end;
|
|
27
|
-
}
|
|
28
|
-
return date;
|
|
29
|
-
}
|
package/src/lib/resources.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {setPayload} from './payload.js';
|
|
2
|
+
import {empty} from './utils.js';
|
|
2
3
|
|
|
3
4
|
export function createResources(input) {
|
|
4
5
|
let result = [];
|
|
@@ -30,20 +31,20 @@ export function createResource(input) {
|
|
|
30
31
|
return {
|
|
31
32
|
id: String(input.id),
|
|
32
33
|
title: input.title || '',
|
|
33
|
-
eventBackgroundColor: input
|
|
34
|
-
eventTextColor: input
|
|
34
|
+
eventBackgroundColor: eventBackgroundColor(input),
|
|
35
|
+
eventTextColor: eventTextColor(input),
|
|
35
36
|
extendedProps: input.extendedProps ?? {}
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
export function
|
|
40
|
-
return
|
|
40
|
+
export function eventBackgroundColor(resource) {
|
|
41
|
+
return resource?.eventBackgroundColor;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
export function
|
|
44
|
-
return
|
|
44
|
+
export function eventTextColor(resource) {
|
|
45
|
+
return resource?.eventTextColor;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
function
|
|
48
|
-
return resources.find(resource => event.resourceIds.includes(resource.id));
|
|
48
|
+
export function findFirstResource(event, resources) {
|
|
49
|
+
return empty(event.resourceIds) ? undefined : resources.find(resource => event.resourceIds.includes(resource.id));
|
|
49
50
|
}
|
package/src/lib/utils.js
CHANGED
|
@@ -30,6 +30,14 @@ export function symbol() {
|
|
|
30
30
|
return Symbol('ec');
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export function length(array) {
|
|
34
|
+
return array.length;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function empty(array) {
|
|
38
|
+
return !length(array);
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
export function isArray(value) {
|
|
34
42
|
return Array.isArray(value);
|
|
35
43
|
}
|
|
@@ -62,15 +70,6 @@ export function noop() {}
|
|
|
62
70
|
|
|
63
71
|
export const identity = (x) => x;
|
|
64
72
|
|
|
65
|
-
export function stopPropagation(fn, _this = undefined) {
|
|
66
|
-
return function (event) {
|
|
67
|
-
event.stopPropagation();
|
|
68
|
-
if (fn) {
|
|
69
|
-
fn.call(_this, event);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
73
|
export function isRtl() {
|
|
75
74
|
return window.getComputedStyle(document.documentElement).direction === 'rtl';
|
|
76
75
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext, setContext, tick} from 'svelte';
|
|
3
|
-
import {contentFrom, resizeObserver, runReposition} from '#lib';
|
|
3
|
+
import {contentFrom, empty, length, resizeObserver, runReposition} from '#lib';
|
|
4
4
|
import ViewState from './state.svelte.js';
|
|
5
5
|
import Day from './Day.svelte';
|
|
6
6
|
import Event from './Event.svelte';
|
|
@@ -22,59 +22,61 @@
|
|
|
22
22
|
}
|
|
23
23
|
function hide() {
|
|
24
24
|
hiddenChunks.size;
|
|
25
|
-
refs.forEach(ref => ref
|
|
25
|
+
refs.forEach(ref => ref?.hide());
|
|
26
26
|
}
|
|
27
27
|
$effect(reposition);
|
|
28
28
|
$effect(hide);
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
31
|
+
{#if !empty(grid) && !empty(grid[0])}
|
|
32
|
+
<section
|
|
33
|
+
bind:this={mainState.mainEl}
|
|
34
|
+
class={[theme.main, dayMaxEvents === true && theme.uniform]}
|
|
35
|
+
style:--ec-grid-cols="{length(grid[0])}"
|
|
36
|
+
style:--ec-grid-rows="{length(grid)}"
|
|
37
|
+
{@attach resizeObserver(reposition)}
|
|
38
|
+
>
|
|
39
|
+
<header class="{theme.header}">
|
|
40
|
+
<div class="{theme.grid}" role="row">
|
|
41
|
+
{#each grid[0] as {dayStart}, i}
|
|
42
|
+
<div
|
|
43
|
+
class={[theme.colHead, theme.weekdays?.[dayStart.getUTCDay()]]}
|
|
44
|
+
role="columnheader"
|
|
45
|
+
aria-colindex="{1 + i}"
|
|
46
|
+
>
|
|
47
|
+
<span
|
|
48
|
+
aria-label="{intlDayHeaderAL.format(dayStart)}"
|
|
49
|
+
{@attach contentFrom(intlDayHeader.format(dayStart))}
|
|
50
|
+
></span>
|
|
51
|
+
</div>
|
|
52
|
+
{/each}
|
|
53
|
+
</div>
|
|
54
|
+
</header>
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
<div class="{theme.body}">
|
|
57
|
+
<div bind:this={viewState.gridEl} class="{theme.grid}">
|
|
58
|
+
{#each grid as days, i}
|
|
59
|
+
{#each days as day, j}
|
|
60
|
+
<Day {day} noIeb={j + 1 === length(days)} noBeb={i + 1 === length(grid)}/>
|
|
61
|
+
{/each}
|
|
60
62
|
{/each}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
</div>
|
|
64
|
+
<div class="{theme.events}">
|
|
65
|
+
{#each chunks as chunk, i (chunk.id)}
|
|
66
|
+
<!-- svelte-ignore binding_property_non_reactive -->
|
|
67
|
+
<Event bind:this={refs[i]} {chunk}/>
|
|
68
|
+
{/each}
|
|
69
|
+
{#each bgChunks as chunk (chunk.id)}
|
|
70
|
+
<Event {chunk}/>
|
|
71
|
+
{/each}
|
|
72
|
+
{#each iChunks as chunk}
|
|
73
|
+
<Event {chunk}/>
|
|
74
|
+
{/each}
|
|
75
|
+
</div>
|
|
74
76
|
</div>
|
|
75
|
-
</div>
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</section>
|
|
78
|
+
{#if popupDay}
|
|
79
|
+
<Popup/>
|
|
80
|
+
{/if}
|
|
81
|
+
</section>
|
|
82
|
+
{/if}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext, setContext} from 'svelte';
|
|
3
|
-
import {addDay, cloneDate, contentFrom, bgEvent, isFunction, toViewWithLocalDates} from '#lib';
|
|
3
|
+
import {addDay, cloneDate, contentFrom, bgEvent, isFunction, toViewWithLocalDates, empty} from '#lib';
|
|
4
4
|
import ViewState from './state.svelte.js';
|
|
5
5
|
import Day from './Day.svelte';
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
let noEvents = $derived.by(() => {
|
|
14
14
|
let noEvents = true;
|
|
15
|
-
if (viewDates
|
|
15
|
+
if (!empty(viewDates)) {
|
|
16
16
|
let start = viewDates[0];
|
|
17
17
|
let end = addDay(cloneDate(viewDates.at(-1)));
|
|
18
18
|
for (let event of filteredEvents) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext, tick} from 'svelte';
|
|
3
3
|
import {ColHead, DayHeader} from '#components';
|
|
4
|
-
import {datesEqual, isRtl} from '#lib';
|
|
4
|
+
import {datesEqual, isRtl, length} from '#lib';
|
|
5
5
|
import ViewState from './state.svelte.js';
|
|
6
6
|
import Label from './Label.svelte';
|
|
7
7
|
import View from '../time-grid/View.svelte';
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
for (let days of grid) {
|
|
29
29
|
let day = days[0];
|
|
30
30
|
if (datesEqual(day.dayStart, today)) {
|
|
31
|
-
mainEl.scrollLeft = (mainEl.scrollWidth - sidebarWidth) / (grid
|
|
31
|
+
mainEl.scrollLeft = (mainEl.scrollWidth - sidebarWidth) / (length(grid) * length(days)) * (day.gridColumn - 1) * (isRtl() ? -1 : 1);
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
{@const {dayStart: date, resource, disabled, highlight} = days[0]}
|
|
43
43
|
<ColHead
|
|
44
44
|
{date}
|
|
45
|
-
className={grid[0]
|
|
45
|
+
className={length(grid[0]) > 1 ? theme.colGroup : undefined}
|
|
46
46
|
weekday={datesAboveResources}
|
|
47
|
-
colSpan={days
|
|
48
|
-
colIndex={1 + i * days
|
|
47
|
+
colSpan={length(days)}
|
|
48
|
+
colIndex={1 + i * length(days)}
|
|
49
49
|
disabled={datesAboveResources && disabled}
|
|
50
50
|
highlight={datesAboveResources && highlight}
|
|
51
51
|
>
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
{/if}
|
|
57
57
|
</ColHead>
|
|
58
58
|
{/each}
|
|
59
|
-
{#if grid[0]
|
|
59
|
+
{#if length(grid[0]) > 1}
|
|
60
60
|
{#each grid as days, i}
|
|
61
61
|
{#each days as day, j}
|
|
62
62
|
{@const {dayStart: date, resource, disabled, highlight} = day}
|
|
63
|
-
<ColHead {date} colIndex={1 + j + i * days
|
|
63
|
+
<ColHead {date} colIndex={1 + j + i * length(days)} {disabled} {highlight}>
|
|
64
64
|
{#if datesAboveResources}
|
|
65
65
|
<Label {resource} {date}/>
|
|
66
66
|
{:else}
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
|
|
75
75
|
{#snippet nowIndicator()}
|
|
76
76
|
{#if datesAboveResources}
|
|
77
|
-
<NowIndicator days={grid.flat()} span={grid[0]
|
|
77
|
+
<NowIndicator days={grid.flat()} span={length(grid[0])}/>
|
|
78
78
|
{:else}
|
|
79
|
-
{#if grid[0]
|
|
79
|
+
{#if length(grid[0]) > 1}
|
|
80
80
|
{#each grid as days}
|
|
81
81
|
<NowIndicator {days} />
|
|
82
82
|
{/each}
|
|
83
83
|
{:else}
|
|
84
|
-
<NowIndicator days={grid.flat()} span={grid
|
|
84
|
+
<NowIndicator days={grid.flat()} span={length(grid)}/>
|
|
85
85
|
{/if}
|
|
86
86
|
{/if}
|
|
87
87
|
{/snippet}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {untrack} from 'svelte';
|
|
2
2
|
import {
|
|
3
|
-
addDay, addDuration, cloneDate, createResources, datesEqual, eventIntersects, outsideRange
|
|
3
|
+
addDay, addDuration, bgEvent, cloneDate, createResources, datesEqual, eventIntersects, outsideRange
|
|
4
4
|
} from '#lib';
|
|
5
5
|
|
|
6
6
|
export function viewResources(mainState) {
|
|
7
7
|
return () => {
|
|
8
8
|
// Dependencies
|
|
9
9
|
let {
|
|
10
|
-
activeRange, filteredEvents, options: {filterResourcesWithEvents
|
|
10
|
+
activeRange, filteredEvents, resources, options: {filterResourcesWithEvents}, extensions: {viewResources}
|
|
11
11
|
} = mainState;
|
|
12
12
|
|
|
13
13
|
let result = viewResources ? viewResources(resources) : resources;
|
|
@@ -16,7 +16,7 @@ export function viewResources(mainState) {
|
|
|
16
16
|
if (filterResourcesWithEvents) {
|
|
17
17
|
result = resources.filter(
|
|
18
18
|
resource => filteredEvents.some(
|
|
19
|
-
event => eventIntersects(event, activeRange.start, activeRange.end, resource)
|
|
19
|
+
event => !bgEvent(event.display) && eventIntersects(event, activeRange.start, activeRange.end, resource)
|
|
20
20
|
)
|
|
21
21
|
);
|
|
22
22
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext, setContext, tick} from 'svelte';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
max, resizeObserver, runReposition, contentFrom, toSeconds, datesEqual, min, isRtl, empty, length
|
|
5
|
+
} from '#lib';
|
|
4
6
|
import {getSlotTimeLimits} from './lib.js';
|
|
5
7
|
import ViewState from './state.svelte.js';
|
|
6
8
|
import {ColHead, DayHeader} from '#components';
|
|
@@ -22,9 +24,10 @@
|
|
|
22
24
|
|
|
23
25
|
// Handle scrollTime
|
|
24
26
|
$effect(() => {
|
|
25
|
-
viewDates;
|
|
26
27
|
scrollTime;
|
|
27
|
-
|
|
28
|
+
if (!empty(viewDates)) {
|
|
29
|
+
tick().then(scrollToTime);
|
|
30
|
+
}
|
|
28
31
|
});
|
|
29
32
|
function scrollToTime() {
|
|
30
33
|
let scrollLeft = 0;
|
|
@@ -34,7 +37,7 @@
|
|
|
34
37
|
let days = grid[0];
|
|
35
38
|
for (let day of days) {
|
|
36
39
|
if (datesEqual(day.dayStart, today)) {
|
|
37
|
-
mainEl.scrollLeft = (mainEl.scrollWidth - sidebarWidth) / days
|
|
40
|
+
mainEl.scrollLeft = (mainEl.scrollWidth - sidebarWidth) / length(days) * (day.gridColumn - 1) * (isRtl() ? -1 : 1);
|
|
38
41
|
break;
|
|
39
42
|
}
|
|
40
43
|
}
|
|
@@ -64,80 +67,82 @@
|
|
|
64
67
|
$effect(reposition);
|
|
65
68
|
</script>
|
|
66
69
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
{/each}
|
|
88
|
-
{#if !monthView}
|
|
89
|
-
{#each grid[0] as {dayStart: date, disabled, highlight}}
|
|
90
|
-
<ColHead {date} className={theme.slots} {disabled} {highlight} ariaHidden>
|
|
91
|
-
{#each daySlots[date.getTime()] as slot}
|
|
92
|
-
<div
|
|
93
|
-
class="{theme.slot}"
|
|
94
|
-
style:--ec-slot-label-periodicity={slot[2]}
|
|
95
|
-
>
|
|
96
|
-
<time
|
|
97
|
-
datetime="{slot[0]}"
|
|
98
|
-
{@attach contentFrom(slot[1])}
|
|
99
|
-
></time>
|
|
100
|
-
</div>
|
|
101
|
-
{/each}
|
|
70
|
+
{#if !empty(grid) && !empty(grid[0])}
|
|
71
|
+
<section
|
|
72
|
+
bind:this={mainState.mainEl}
|
|
73
|
+
class="{theme.main}"
|
|
74
|
+
style:--ec-grid-cols="{length(grid[0])}"
|
|
75
|
+
style:--ec-grid-rows="{length(grid) > 1 ? `repeat(${length(grid) - 1}, auto)` : ''} 1fr"
|
|
76
|
+
style:--ec-col-width="{columnWidth ?? 'minmax(4em, 1fr)'}"
|
|
77
|
+
style:--ec-slot-label-periodicity="{slotLabelPeriodicity}"
|
|
78
|
+
style:--ec-slot-height="{slotHeight}px"
|
|
79
|
+
style:--ec-slot-width="{slotWidth}px"
|
|
80
|
+
style:--ec-header-height="{headerHeight}px"
|
|
81
|
+
style:--ec-sidebar-width="{sidebarWidth}px"
|
|
82
|
+
{@attach resizeObserver(reposition)}
|
|
83
|
+
>
|
|
84
|
+
<header bind:offsetHeight={headerHeight} class="{theme.header}">
|
|
85
|
+
<aside class="{theme.sidebar}" bind:offsetWidth={viewState.sidebarWidth}></aside>
|
|
86
|
+
<div class="{theme.grid}" role="row">
|
|
87
|
+
{#each grid[0] as {dayStart: date, disabled, highlight}, i}
|
|
88
|
+
<ColHead {date} colIndex={1 + i} {disabled} {highlight}>
|
|
89
|
+
<DayHeader {date}/>
|
|
102
90
|
</ColHead>
|
|
103
91
|
{/each}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
92
|
+
{#if !monthView}
|
|
93
|
+
{#each grid[0] as {dayStart: date, disabled, highlight}}
|
|
94
|
+
<ColHead {date} className={theme.slots} {disabled} {highlight} ariaHidden>
|
|
95
|
+
{#each daySlots[date.getTime()] as slot}
|
|
96
|
+
<div
|
|
97
|
+
class="{theme.slot}"
|
|
98
|
+
style:--ec-slot-label-periodicity={slot[2]}
|
|
99
|
+
>
|
|
100
|
+
<time
|
|
101
|
+
datetime="{slot[0]}"
|
|
102
|
+
{@attach contentFrom(slot[1])}
|
|
103
|
+
></time>
|
|
104
|
+
</div>
|
|
105
|
+
{/each}
|
|
106
|
+
</ColHead>
|
|
107
|
+
{/each}
|
|
108
|
+
{/if}
|
|
109
|
+
</div>
|
|
110
|
+
</header>
|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
{/each}
|
|
118
|
-
</aside>
|
|
119
|
-
<div class="{theme.grid}" role="row">
|
|
120
|
-
{#each grid as days, i}
|
|
121
|
-
{#each days as day, j}
|
|
122
|
-
<Day {day} noIeb={j + 1 === days.length} noBeb={i + 1 === grid.length}/>
|
|
112
|
+
<div class="{theme.body}" role="rowgroup">
|
|
113
|
+
<aside class="{theme.sidebar}">
|
|
114
|
+
{#each viewResources as resource}
|
|
115
|
+
<div class="{theme.rowHead}" role="rowheader">
|
|
116
|
+
{#if nestedResources}
|
|
117
|
+
<Expander {resource} />
|
|
118
|
+
{/if}
|
|
119
|
+
<Label {resource}/>
|
|
120
|
+
</div>
|
|
123
121
|
{/each}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
122
|
+
</aside>
|
|
123
|
+
<div class="{theme.grid}" role="row">
|
|
124
|
+
{#each grid as days, i}
|
|
125
|
+
{#each days as day, j}
|
|
126
|
+
<Day {day} noIeb={j + 1 === length(days)} noBeb={i + 1 === length(grid)}/>
|
|
127
|
+
{/each}
|
|
128
|
+
{/each}
|
|
129
|
+
</div>
|
|
130
|
+
<div class="{theme.events}">
|
|
131
|
+
{#each chunks as chunk, i (chunk.id)}
|
|
132
|
+
<!-- svelte-ignore binding_property_non_reactive -->
|
|
133
|
+
<Event bind:this={refs[i]} {chunk}/>
|
|
134
|
+
{/each}
|
|
135
|
+
{#each bgChunks as chunk (chunk.id)}
|
|
136
|
+
<Event {chunk}/>
|
|
137
|
+
{/each}
|
|
138
|
+
{#each iChunks as chunk}
|
|
139
|
+
<Event {chunk}/>
|
|
140
|
+
{/each}
|
|
141
|
+
</div>
|
|
137
142
|
</div>
|
|
138
|
-
</div>
|
|
139
143
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
</section>
|
|
144
|
+
{#if nowIndicator && !monthView}
|
|
145
|
+
<NowIndicator/>
|
|
146
|
+
{/if}
|
|
147
|
+
</section>
|
|
148
|
+
{/if}
|