@event-calendar/core 4.7.1 → 5.0.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 +29 -51
- package/dist/index.css +627 -731
- package/dist/index.js +2499 -3191
- package/package.json +2 -2
- package/src/Auxiliary.svelte +2 -13
- package/src/Buttons.svelte +62 -52
- package/src/Calendar.svelte +9 -3
- package/src/lib/a11y.js +2 -2
- package/src/lib/attachments.js +61 -0
- package/src/lib/chunks.js +117 -0
- package/src/lib/components/BaseDay.svelte +50 -0
- package/src/lib/components/BaseEvent.svelte +3 -3
- package/src/lib/components/ColHead.svelte +34 -0
- package/src/lib/components/DayHeader.svelte +14 -0
- package/src/lib/components/InteractableEvent.svelte +1 -3
- package/src/lib/components/index.js +3 -0
- package/src/lib/date.js +1 -1
- package/src/lib/dom.js +0 -4
- package/src/lib/events.js +10 -134
- package/src/lib/index.js +3 -2
- package/src/lib/{times.js → slots.js} +14 -19
- package/src/lib/stores.js +0 -33
- package/src/lib/utils.js +11 -2
- package/src/lib/view.js +0 -4
- package/src/plugins/day-grid/Day.svelte +36 -129
- package/src/plugins/day-grid/Event.svelte +42 -41
- package/src/plugins/day-grid/Popup.svelte +65 -48
- package/src/plugins/day-grid/View.svelte +76 -4
- package/src/plugins/day-grid/index.js +5 -5
- package/src/plugins/day-grid/lib.js +61 -0
- package/src/plugins/day-grid/stores.js +2 -20
- package/src/plugins/interaction/Action.svelte +37 -43
- package/src/plugins/interaction/Auxiliary.svelte +4 -4
- package/src/plugins/interaction/Pointer.svelte +8 -12
- package/src/plugins/interaction/Resizer.svelte +2 -2
- package/src/plugins/interaction/lib/utils.js +1 -5
- package/src/plugins/list/Day.svelte +8 -24
- package/src/plugins/list/View.svelte +39 -2
- package/src/plugins/resource-time-grid/Label.svelte +2 -2
- package/src/plugins/resource-time-grid/View.svelte +38 -82
- package/src/plugins/resource-time-grid/index.js +18 -10
- package/src/plugins/resource-time-grid/lib.js +31 -0
- package/src/plugins/resource-time-grid/options.js +10 -0
- package/src/plugins/resource-time-grid/stores.js +34 -0
- package/src/plugins/resource-timeline/Day.svelte +10 -73
- package/src/plugins/resource-timeline/Event.svelte +14 -23
- package/src/plugins/resource-timeline/Header.svelte +5 -5
- package/src/plugins/resource-timeline/Label.svelte +4 -12
- package/src/plugins/resource-timeline/NowIndicator.svelte +33 -28
- package/src/plugins/resource-timeline/View.svelte +129 -14
- package/src/plugins/resource-timeline/index.js +26 -23
- package/src/plugins/resource-timeline/lib.js +115 -118
- package/src/plugins/resource-timeline/stores.js +11 -7
- package/src/plugins/time-grid/AllDayEvent.svelte +31 -0
- package/src/plugins/time-grid/Day.svelte +11 -99
- package/src/plugins/time-grid/Event.svelte +18 -20
- package/src/plugins/time-grid/NowIndicator.svelte +32 -10
- package/src/plugins/time-grid/View.svelte +127 -35
- package/src/plugins/time-grid/index.js +10 -8
- package/src/plugins/time-grid/lib.js +142 -0
- package/src/plugins/time-grid/options.js +57 -0
- package/src/plugins/time-grid/stores.js +41 -8
- package/src/storage/options.js +4 -39
- package/src/storage/state.js +1 -4
- package/src/storage/stores.js +42 -11
- package/src/styles/days.css +91 -0
- package/src/styles/events.css +180 -0
- package/src/styles/index.css +126 -0
- package/src/styles/now-indicator.css +35 -0
- package/src/styles/popup.css +30 -0
- package/src/styles/sidebar.css +59 -0
- package/src/styles/slots.css +42 -0
- package/src/styles/theme.css +68 -0
- package/src/styles/toolbar.css +80 -0
- package/src/lib/actions.js +0 -52
- package/src/plugins/day-grid/Body.svelte +0 -54
- package/src/plugins/day-grid/Header.svelte +0 -20
- package/src/plugins/day-grid/Week.svelte +0 -60
- package/src/plugins/list/Body.svelte +0 -44
- package/src/plugins/resource-timeline/Body.svelte +0 -67
- package/src/plugins/resource-timeline/Days.svelte +0 -72
- package/src/plugins/resource-timeline/Sidebar.svelte +0 -35
- package/src/plugins/time-grid/Body.svelte +0 -43
- package/src/plugins/time-grid/Section.svelte +0 -29
- package/src/plugins/time-grid/all-day/Day.svelte +0 -65
- package/src/plugins/time-grid/all-day/Event.svelte +0 -37
- package/src/plugins/time-grid/all-day/Week.svelte +0 -65
- package/src/plugins/time-grid/utils.js +0 -58
- package/src/styles/day-grid.scss +0 -51
- package/src/styles/index.scss +0 -553
- package/src/styles/theme.scss +0 -95
- package/src/styles/time-grid.scss +0 -83
- package/src/styles/timeline.scss +0 -152
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.ec-popup {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
block-size: max-content;
|
|
6
|
+
inline-size: 110%;
|
|
7
|
+
min-block-size: 6em;
|
|
8
|
+
min-inline-size: 10em;
|
|
9
|
+
padding: .375rem .75rem .75rem;
|
|
10
|
+
background-color: var(--ec-popup-bg-color);
|
|
11
|
+
border: 1px solid var(--ec-border-color);
|
|
12
|
+
border-radius: .25rem;
|
|
13
|
+
box-shadow: var(--ec-color-300) 0 10px 15px -3px, var(--ec-color-300) 0 4px 6px -4px;
|
|
14
|
+
|
|
15
|
+
.ec-day-head {
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
padding-inline: 0;
|
|
18
|
+
|
|
19
|
+
a {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
font-size: 1.5em;
|
|
22
|
+
line-height: .8;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ec-events {
|
|
27
|
+
--ec-event-col-gap: 0;
|
|
28
|
+
display: block;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.ec-sidebar {
|
|
2
|
+
position: sticky;
|
|
3
|
+
inset-inline-start: 0;
|
|
4
|
+
z-index: 1;
|
|
5
|
+
background-color: var(--ec-bg-color);
|
|
6
|
+
border-inline-end: 1px solid var(--ec-border-color);
|
|
7
|
+
margin-inline-end: -1px;
|
|
8
|
+
text-align: end;
|
|
9
|
+
overflow: clip;
|
|
10
|
+
|
|
11
|
+
.ec-header & {
|
|
12
|
+
padding-block: .375rem;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ec-time-grid & {
|
|
16
|
+
padding-inline: .75rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ec-time-grid .ec-body & {
|
|
20
|
+
background-image:
|
|
21
|
+
linear-gradient(to left, transparent .375rem, var(--ec-bg-color) .375rem),
|
|
22
|
+
linear-gradient(var(--ec-bg-color) 1px, transparent 1px),
|
|
23
|
+
linear-gradient(var(--ec-border-color) 1px, transparent 1px),
|
|
24
|
+
linear-gradient(to right, var(--ec-bg-color) 1px, transparent 1px),
|
|
25
|
+
linear-gradient(var(--ec-border-color) 1px, transparent 1px);
|
|
26
|
+
background-size:
|
|
27
|
+
100% 100%,
|
|
28
|
+
100% 100%,
|
|
29
|
+
100% calc(var(--ec-slot-height) * var(--ec-slot-label-periodicity)),
|
|
30
|
+
2px 100%,
|
|
31
|
+
100% var(--ec-slot-height);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ec-timeline .ec-body & {
|
|
35
|
+
grid-area: 1 / 1 / -1 / 2;
|
|
36
|
+
display: grid;
|
|
37
|
+
grid-template-rows: subgrid;
|
|
38
|
+
background-color: var(--ec-border-color);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ec-row-head {
|
|
43
|
+
display: flex;
|
|
44
|
+
background-color: var(--ec-bg-color);
|
|
45
|
+
padding: .375em .75rem;
|
|
46
|
+
min-block-size: 1.5em;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ec-expander {
|
|
50
|
+
margin-right: .25em;
|
|
51
|
+
width: 1.25em;
|
|
52
|
+
|
|
53
|
+
.ec-button {
|
|
54
|
+
line-height: normal;
|
|
55
|
+
padding: 0;
|
|
56
|
+
aspect-ratio: 1;
|
|
57
|
+
height: 1.25em;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.ec-slot {
|
|
2
|
+
white-space: nowrap;
|
|
3
|
+
|
|
4
|
+
.ec-time-grid & {
|
|
5
|
+
block-size: calc(var(--ec-slot-height) * var(--ec-slot-label-periodicity));
|
|
6
|
+
position: relative;
|
|
7
|
+
inset-block-start: -.5em;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ec-timeline & {
|
|
11
|
+
grid-column: span var(--ec-slot-label-periodicity);
|
|
12
|
+
font-size: .95em;
|
|
13
|
+
padding: .18rem 0;
|
|
14
|
+
overflow: clip;
|
|
15
|
+
text-overflow: ellipsis;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ec-slots {
|
|
20
|
+
display: grid;
|
|
21
|
+
grid-auto-flow: column;
|
|
22
|
+
grid-auto-columns: var(--ec-slot-width);
|
|
23
|
+
text-align: center;
|
|
24
|
+
|
|
25
|
+
--ec-day-bg-color: var(--ec-bg-color);
|
|
26
|
+
background-color: var(--ec-day-bg-color);
|
|
27
|
+
|
|
28
|
+
&.ec-today {
|
|
29
|
+
--ec-day-bg-color: var(--ec-today-bg-color);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.ec-highlight {
|
|
33
|
+
--ec-day-bg-color: var(--ec-highlight-color);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
background-image:
|
|
37
|
+
linear-gradient(to right, var(--ec-day-bg-color) 1px, transparent 1px),
|
|
38
|
+
linear-gradient(to right, var(--ec-border-color) 1px, transparent 1px);
|
|
39
|
+
background-size:
|
|
40
|
+
100% 100%,
|
|
41
|
+
calc(var(--ec-slot-width) * var(--ec-slot-label-periodicity)) 100%;
|
|
42
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
.ec {
|
|
2
|
+
color-scheme: light;
|
|
3
|
+
|
|
4
|
+
/* Main colors */
|
|
5
|
+
--ec-color-400: oklch(70.8% 0 0);
|
|
6
|
+
--ec-color-300: oklch(87% 0 0);
|
|
7
|
+
--ec-color-200: oklch(92.2% 0 0);
|
|
8
|
+
--ec-color-100: oklch(97% 0 0);
|
|
9
|
+
--ec-color-50: oklch(98.5% 0 0);
|
|
10
|
+
|
|
11
|
+
/* General props */
|
|
12
|
+
--ec-bg-color: #fff;
|
|
13
|
+
--ec-text-color: currentcolor;
|
|
14
|
+
--ec-border-color: var(--ec-color-300);
|
|
15
|
+
|
|
16
|
+
/* Buttons */
|
|
17
|
+
--ec-button-bg-color: var(--ec-bg-color);
|
|
18
|
+
--ec-button-border-color: var(--ec-border-color);
|
|
19
|
+
--ec-button-text-color: var(--ec-text-color);
|
|
20
|
+
--ec-button-active-bg-color: var(--ec-color-200);
|
|
21
|
+
--ec-button-active-border-color: var(--ec-color-400);
|
|
22
|
+
--ec-button-active-text-color: var(--ec-button-text-color);
|
|
23
|
+
|
|
24
|
+
/* Days */
|
|
25
|
+
--ec-today-bg-color: oklch(98.7% 0.026 102.212);
|
|
26
|
+
--ec-highlight-color: oklch(98.4% 0.019 200.873);
|
|
27
|
+
|
|
28
|
+
/* Events */
|
|
29
|
+
--ec-event-bg-color: oklch(70.7% 0.165 254.624);
|
|
30
|
+
--ec-event-text-color: #fff;
|
|
31
|
+
--ec-bg-event-color: var(--ec-color-300);
|
|
32
|
+
--ec-bg-event-opacity: 0.3;
|
|
33
|
+
--ec-event-col-gap: .375rem;
|
|
34
|
+
|
|
35
|
+
/* Now Indicator */
|
|
36
|
+
--ec-now-indicator-color: oklch(63.7% 0.237 25.331);
|
|
37
|
+
|
|
38
|
+
/* Popup */
|
|
39
|
+
--ec-popup-bg-color: var(--ec-bg-color);
|
|
40
|
+
|
|
41
|
+
.ec-dark & {
|
|
42
|
+
color-scheme: dark;
|
|
43
|
+
--ec-color-400: oklch(43.9% 0 0);
|
|
44
|
+
--ec-color-300: oklch(37.1% 0 0);
|
|
45
|
+
--ec-color-200: oklch(26.9% 0 0);
|
|
46
|
+
--ec-color-100: oklch(20.5% 0 0);
|
|
47
|
+
--ec-color-50: oklch(14.5% 0 0);
|
|
48
|
+
--ec-bg-color: var(--ec-color-100);
|
|
49
|
+
--ec-today-bg-color: oklch(28.6% 0.066 53.813);
|
|
50
|
+
--ec-highlight-color: oklch(30.2% 0.056 229.695);
|
|
51
|
+
--ec-bg-event-opacity: 0.5;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (prefers-color-scheme: dark) {
|
|
55
|
+
.ec-auto-dark & {
|
|
56
|
+
color-scheme: dark;
|
|
57
|
+
--ec-color-400: oklch(43.9% 0 0);
|
|
58
|
+
--ec-color-300: oklch(37.1% 0 0);
|
|
59
|
+
--ec-color-200: oklch(26.9% 0 0);
|
|
60
|
+
--ec-color-100: oklch(20.5% 0 0);
|
|
61
|
+
--ec-color-50: oklch(14.5% 0 0);
|
|
62
|
+
--ec-bg-color: var(--ec-color-100);
|
|
63
|
+
--ec-today-bg-color: oklch(28.6% 0.066 53.813);
|
|
64
|
+
--ec-highlight-color: oklch(30.2% 0.056 229.695);
|
|
65
|
+
--ec-bg-event-opacity: 0.5;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* Toolbar */
|
|
2
|
+
.ec-toolbar {
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
align-items: center;
|
|
6
|
+
margin-block-end: 1em;
|
|
7
|
+
|
|
8
|
+
> * {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
column-gap: .75rem;
|
|
12
|
+
row-gap: .5rem;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ec-title {
|
|
17
|
+
margin: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ec-button {
|
|
21
|
+
background-color: var(--ec-button-bg-color);
|
|
22
|
+
border: 1px solid var(--ec-button-border-color);
|
|
23
|
+
padding: .375rem .75rem;
|
|
24
|
+
font-size: 1rem;
|
|
25
|
+
line-height: 1.5;
|
|
26
|
+
border-radius: .25rem;
|
|
27
|
+
|
|
28
|
+
&:not(:disabled) {
|
|
29
|
+
color: var(--ec-button-text-color);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:not(:disabled):hover,
|
|
34
|
+
&.ec-active {
|
|
35
|
+
background-color: var(--ec-button-active-bg-color);
|
|
36
|
+
border-color: var(--ec-button-active-border-color);
|
|
37
|
+
color: var(--ec-button-active-text-color);
|
|
38
|
+
z-index: 1; /* make all borders visible */
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ec-button-group {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
vertical-align: top;
|
|
45
|
+
|
|
46
|
+
.ec-button:not(:first-child) {
|
|
47
|
+
border-start-start-radius: 0;
|
|
48
|
+
border-end-start-radius: 0;
|
|
49
|
+
margin-inline-start: -1px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ec-button:not(:last-child) {
|
|
53
|
+
border-start-end-radius: 0;
|
|
54
|
+
border-end-end-radius: 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ec-icon {
|
|
59
|
+
display: inline-block;
|
|
60
|
+
width: 1em;
|
|
61
|
+
|
|
62
|
+
&.ec-prev:after,
|
|
63
|
+
&.ec-next:after {
|
|
64
|
+
content: '';
|
|
65
|
+
position: relative;
|
|
66
|
+
inline-size: .5em;
|
|
67
|
+
block-size: .5em;
|
|
68
|
+
border-block-start: 2px solid currentcolor;
|
|
69
|
+
border-inline-end: 2px solid currentcolor;
|
|
70
|
+
display: inline-block;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.ec-prev:after {
|
|
74
|
+
transform: rotate(-135deg) translate(-2px, 2px);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.ec-next:after {
|
|
78
|
+
transform: rotate(45deg) translate(-2px, 2px);
|
|
79
|
+
}
|
|
80
|
+
}
|
package/src/lib/actions.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export function setContent(node, content) {
|
|
3
|
-
let actions = {
|
|
4
|
-
update(content) {
|
|
5
|
-
if (typeof content == 'string') {
|
|
6
|
-
node.innerText = content;
|
|
7
|
-
} else if (content?.domNodes) {
|
|
8
|
-
node.replaceChildren(...content.domNodes);
|
|
9
|
-
} else if (content?.html) {
|
|
10
|
-
node.innerHTML = content.html;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
actions.update(content);
|
|
15
|
-
|
|
16
|
-
return actions;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** Dispatch event occurred outside of node */
|
|
20
|
-
export function outsideEvent(node, type) {
|
|
21
|
-
|
|
22
|
-
const handlePointerDown = jsEvent => {
|
|
23
|
-
if (node && !node.contains(jsEvent.target)) {
|
|
24
|
-
node.dispatchEvent(
|
|
25
|
-
new CustomEvent(type + 'outside', {detail: {jsEvent}})
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
document.addEventListener(type, handlePointerDown, true);
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
destroy() {
|
|
34
|
-
document.removeEventListener(type, handlePointerDown, true);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function observeResize(node, callback) {
|
|
40
|
-
let resizeObserver = new ResizeObserver(entries => {
|
|
41
|
-
for (let entry of entries) {
|
|
42
|
-
callback(entry);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
resizeObserver.observe(node);
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
destroy() {
|
|
49
|
-
resizeObserver.unobserve(node);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {getContext, untrack} from 'svelte';
|
|
3
|
-
import {runReposition, observeResize} from '#lib';
|
|
4
|
-
import Week from './Week.svelte';
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
_bodyEl, _viewDates, _filteredEvents, _hiddenEvents, _recheckScrollable, dayMaxEvents, hiddenDays, theme
|
|
8
|
-
} = getContext('state');
|
|
9
|
-
|
|
10
|
-
let refs = [];
|
|
11
|
-
|
|
12
|
-
let days = $derived(7 - $hiddenDays.length);
|
|
13
|
-
let weeks = $derived.by(() => {
|
|
14
|
-
let weeks = [];
|
|
15
|
-
for (let i = 0; i < $_viewDates.length / days; ++i) {
|
|
16
|
-
let dates = [];
|
|
17
|
-
for (let j = 0; j < days; ++j) {
|
|
18
|
-
dates.push($_viewDates[i * days + j]);
|
|
19
|
-
}
|
|
20
|
-
weeks.push(dates);
|
|
21
|
-
}
|
|
22
|
-
return weeks;
|
|
23
|
-
});
|
|
24
|
-
$effect.pre(() => {
|
|
25
|
-
weeks;
|
|
26
|
-
$dayMaxEvents;
|
|
27
|
-
$_hiddenEvents = {};
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
function reposition() {
|
|
31
|
-
runReposition(refs, weeks);
|
|
32
|
-
}
|
|
33
|
-
$effect(() => {
|
|
34
|
-
$_filteredEvents;
|
|
35
|
-
$_hiddenEvents;
|
|
36
|
-
$dayMaxEvents;
|
|
37
|
-
untrack(reposition);
|
|
38
|
-
});
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<div
|
|
42
|
-
bind:this={$_bodyEl}
|
|
43
|
-
class="{$theme.body}{$dayMaxEvents === true ? ' ' + $theme.uniform : ''}"
|
|
44
|
-
use:observeResize={() => $_recheckScrollable = true}
|
|
45
|
-
>
|
|
46
|
-
<div class="{$theme.content}">
|
|
47
|
-
{#each weeks as dates, i}
|
|
48
|
-
<!-- svelte-ignore binding_property_non_reactive -->
|
|
49
|
-
<Week {dates} bind:this={refs[i]}/>
|
|
50
|
-
{/each}
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<svelte:window on:resize={reposition}/>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {getContext} from 'svelte';
|
|
3
|
-
import {setContent} from '#lib';
|
|
4
|
-
|
|
5
|
-
let {theme, _intlDayHeader, _intlDayHeaderAL, _days} = getContext('state');
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<div class="{$theme.header}">
|
|
9
|
-
<div class="{$theme.days}" role="row">
|
|
10
|
-
{#each $_days as day}
|
|
11
|
-
<div class="{$theme.day} {$theme.weekdays?.[day.getUTCDay()]}" role="columnheader">
|
|
12
|
-
<span
|
|
13
|
-
aria-label="{$_intlDayHeaderAL.format(day)}"
|
|
14
|
-
use:setContent={$_intlDayHeader.format(day)}
|
|
15
|
-
></span>
|
|
16
|
-
</div>
|
|
17
|
-
{/each}
|
|
18
|
-
</div>
|
|
19
|
-
<div class="{$theme.hiddenScroll}"></div>
|
|
20
|
-
</div>
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {getContext} from 'svelte';
|
|
3
|
-
import {
|
|
4
|
-
addDay, bgEvent, cloneDate, createEventChunk, eventIntersects, limitToRange, prepareEventChunks,
|
|
5
|
-
runReposition
|
|
6
|
-
} from '#lib';
|
|
7
|
-
import Day from './Day.svelte';
|
|
8
|
-
|
|
9
|
-
let {dates} = $props();
|
|
10
|
-
|
|
11
|
-
let {_filteredEvents, _iEvents, resources, eventOrder, filterEventsWithResources, hiddenDays, theme,
|
|
12
|
-
validRange} = getContext('state');
|
|
13
|
-
|
|
14
|
-
let refs = [];
|
|
15
|
-
|
|
16
|
-
let start = $derived(limitToRange(dates[0], $validRange));
|
|
17
|
-
let end = $derived(addDay(cloneDate(limitToRange(dates.at(-1), $validRange))));
|
|
18
|
-
|
|
19
|
-
let [chunks, bgChunks, longChunks] = $derived.by(() => {
|
|
20
|
-
let chunks = [];
|
|
21
|
-
let bgChunks = [];
|
|
22
|
-
for (let event of $_filteredEvents) {
|
|
23
|
-
if (eventIntersects(event, start, end, $filterEventsWithResources ? $resources : undefined)) {
|
|
24
|
-
let chunk = createEventChunk(event, start, end);
|
|
25
|
-
if (bgEvent(event.display)) {
|
|
26
|
-
if (event.allDay) {
|
|
27
|
-
bgChunks.push(chunk);
|
|
28
|
-
}
|
|
29
|
-
} else {
|
|
30
|
-
chunks.push(chunk);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
prepareEventChunks(bgChunks, $hiddenDays, $eventOrder);
|
|
35
|
-
let longChunks = prepareEventChunks(chunks, $hiddenDays, $eventOrder);
|
|
36
|
-
return [chunks, bgChunks, longChunks];
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
let iChunks = $derived($_iEvents.map(event => {
|
|
40
|
-
let chunk;
|
|
41
|
-
if (event && eventIntersects(event, start, end)) {
|
|
42
|
-
chunk = createEventChunk(event, start, end);
|
|
43
|
-
prepareEventChunks([chunk], $hiddenDays, $eventOrder);
|
|
44
|
-
} else {
|
|
45
|
-
chunk = null;
|
|
46
|
-
}
|
|
47
|
-
return chunk;
|
|
48
|
-
}));
|
|
49
|
-
|
|
50
|
-
export function reposition() {
|
|
51
|
-
runReposition(refs, dates);
|
|
52
|
-
}
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
<div class="{$theme.days}" role="row">
|
|
56
|
-
{#each dates as date, i}
|
|
57
|
-
<!-- svelte-ignore binding_property_non_reactive -->
|
|
58
|
-
<Day {date} {chunks} {bgChunks} {longChunks} {iChunks} {dates} bind:this={refs[i]} />
|
|
59
|
-
{/each}
|
|
60
|
-
</div>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {getContext} from 'svelte';
|
|
3
|
-
import {addDay, cloneDate, toViewWithLocalDates, setContent, bgEvent, isFunction} from '#lib';
|
|
4
|
-
import Day from './Day.svelte';
|
|
5
|
-
|
|
6
|
-
let {_bodyEl, _filteredEvents, _view, _viewDates, noEventsClick, noEventsContent, theme} = getContext('state');
|
|
7
|
-
|
|
8
|
-
let noEvents = $derived.by(() => {
|
|
9
|
-
let noEvents = true;
|
|
10
|
-
if ($_viewDates.length) {
|
|
11
|
-
let start = $_viewDates[0];
|
|
12
|
-
let end = addDay(cloneDate($_viewDates.at(-1)));
|
|
13
|
-
for (let event of $_filteredEvents) {
|
|
14
|
-
if (!bgEvent(event.display) && event.start < end && event.end > start) {
|
|
15
|
-
noEvents = false;
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return noEvents;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
let content = $derived(isFunction($noEventsContent) ? $noEventsContent() : $noEventsContent);
|
|
24
|
-
|
|
25
|
-
function onclick(jsEvent) {
|
|
26
|
-
if (isFunction($noEventsClick)) {
|
|
27
|
-
$noEventsClick({jsEvent, view: toViewWithLocalDates($_view)});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<div bind:this={$_bodyEl} class="{$theme.body}">
|
|
33
|
-
<div class="{$theme.content}">
|
|
34
|
-
{#if noEvents}
|
|
35
|
-
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
36
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
37
|
-
<div use:setContent={content} class="{$theme.noEvents}" {onclick}></div>
|
|
38
|
-
{:else}
|
|
39
|
-
{#each $_viewDates as date}
|
|
40
|
-
<Day {date}/>
|
|
41
|
-
{/each}
|
|
42
|
-
{/if}
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {getContext, untrack} from 'svelte';
|
|
3
|
-
import {observeResize, runReposition, toSeconds} from '#lib';
|
|
4
|
-
import {getSlotTimeLimits} from './lib.js';
|
|
5
|
-
import Days from './Days.svelte';
|
|
6
|
-
|
|
7
|
-
let {_bodyEl, _bodyHeight, _bodyWidth, _bodyScrollLeft, _headerEl, _filteredEvents, _sidebarEl, _dayTimes, _dayTimeLimits,
|
|
8
|
-
_recheckScrollable, _daysHs, _viewResources, _viewDates, scrollTime, slotDuration, slotWidth, theme} = getContext('state');
|
|
9
|
-
|
|
10
|
-
let refs = [];
|
|
11
|
-
|
|
12
|
-
function scrollToTime() {
|
|
13
|
-
let slotTimeLimits = getSlotTimeLimits($_dayTimeLimits, $_viewDates[0]);
|
|
14
|
-
$_bodyEl.scrollLeft = (toSeconds($scrollTime) - toSeconds(slotTimeLimits.min)) / toSeconds($slotDuration) * $slotWidth;
|
|
15
|
-
$_bodyScrollLeft = $_bodyEl.scrollLeft;
|
|
16
|
-
}
|
|
17
|
-
$effect(() => {
|
|
18
|
-
$_viewDates;
|
|
19
|
-
$scrollTime;
|
|
20
|
-
untrack(scrollToTime);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
function reposition() {
|
|
24
|
-
$_daysHs.clear();
|
|
25
|
-
runReposition(refs, $_viewResources);
|
|
26
|
-
}
|
|
27
|
-
$effect(() => {
|
|
28
|
-
$_filteredEvents;
|
|
29
|
-
$_viewResources;
|
|
30
|
-
untrack(reposition);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
function onscroll() {
|
|
34
|
-
$_headerEl.scrollLeft = $_bodyEl.scrollLeft;
|
|
35
|
-
$_sidebarEl.scrollTop = $_bodyEl.scrollTop;
|
|
36
|
-
$_bodyScrollLeft = $_bodyEl.scrollLeft;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function onresize() {
|
|
40
|
-
$_bodyHeight = $_bodyEl.clientHeight;
|
|
41
|
-
$_bodyWidth = $_bodyEl.clientWidth;
|
|
42
|
-
$_recheckScrollable = true;
|
|
43
|
-
}
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<div
|
|
47
|
-
bind:this={$_bodyEl}
|
|
48
|
-
class="{$theme.body}"
|
|
49
|
-
{onscroll}
|
|
50
|
-
use:observeResize={onresize}
|
|
51
|
-
>
|
|
52
|
-
<div class="{$theme.content}">
|
|
53
|
-
<div class="{$theme.lines}">
|
|
54
|
-
{#each $_viewDates as date}
|
|
55
|
-
{#each $_dayTimes[date.getTime()] as time}
|
|
56
|
-
<div class="{$theme.line}{time[2] ? '' : ' ' + $theme.minor}"></div>
|
|
57
|
-
{/each}
|
|
58
|
-
{/each}
|
|
59
|
-
</div>
|
|
60
|
-
{#each $_viewResources as resource, i}
|
|
61
|
-
<!-- svelte-ignore binding_property_non_reactive -->
|
|
62
|
-
<Days {resource} bind:this={refs[i]}/>
|
|
63
|
-
{/each}
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<svelte:window on:resize={reposition}/>
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {getContext} from 'svelte';
|
|
3
|
-
import {
|
|
4
|
-
addDay, addDuration, bgEvent, ceil, cloneDate, createEventChunk, DAY_IN_SECONDS, eventIntersects,
|
|
5
|
-
limitToRange, max, runReposition
|
|
6
|
-
} from '#lib';
|
|
7
|
-
import {getSlotTimeLimits, prepareEventChunks} from './lib.js';
|
|
8
|
-
import Day from './Day.svelte';
|
|
9
|
-
|
|
10
|
-
let {resource} = $props();
|
|
11
|
-
|
|
12
|
-
let {_viewDates, _filteredEvents, _iEvents, _dayTimeLimits, _daysHs, _resHs,
|
|
13
|
-
eventOrder, slotDuration, theme, validRange} = getContext('state');
|
|
14
|
-
|
|
15
|
-
let refs = [];
|
|
16
|
-
|
|
17
|
-
let [start, end] = $derived.by(() => {
|
|
18
|
-
let start = cloneDate(limitToRange($_viewDates[0], $validRange));
|
|
19
|
-
let end = cloneDate(limitToRange($_viewDates.at(-1), $validRange));
|
|
20
|
-
let slotTimeLimits = getSlotTimeLimits($_dayTimeLimits, start);
|
|
21
|
-
addDuration(start, slotTimeLimits.min);
|
|
22
|
-
slotTimeLimits = getSlotTimeLimits($_dayTimeLimits, end);
|
|
23
|
-
if (slotTimeLimits.max.seconds > DAY_IN_SECONDS) {
|
|
24
|
-
addDuration(end, slotTimeLimits.max) /** @see https://github.com/vkurko/calendar/issues/333 */
|
|
25
|
-
} else {
|
|
26
|
-
addDay(end);
|
|
27
|
-
}
|
|
28
|
-
return [start, end];
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
let [chunks, bgChunks, longChunks] = $derived.by(() => {
|
|
32
|
-
let chunks = [];
|
|
33
|
-
let bgChunks = [];
|
|
34
|
-
let longChunks;
|
|
35
|
-
for (let event of $_filteredEvents) {
|
|
36
|
-
if (eventIntersects(event, start, end, resource)) {
|
|
37
|
-
let chunk = createEventChunk(event, start, end);
|
|
38
|
-
if (bgEvent(event.display)) {
|
|
39
|
-
bgChunks.push(chunk);
|
|
40
|
-
} else {
|
|
41
|
-
chunks.push(chunk);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
[bgChunks] = prepareEventChunks(bgChunks, $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder);
|
|
46
|
-
[chunks, longChunks] = prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder);
|
|
47
|
-
return [chunks, bgChunks, longChunks];
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
let iChunks = $derived($_iEvents.map(event => {
|
|
51
|
-
let chunk;
|
|
52
|
-
if (event && eventIntersects(event, start, end, resource)) {
|
|
53
|
-
chunk = createEventChunk(event, start, end);
|
|
54
|
-
[[chunk]] = prepareEventChunks([chunk], $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder);
|
|
55
|
-
} else {
|
|
56
|
-
chunk = null;
|
|
57
|
-
}
|
|
58
|
-
return chunk;
|
|
59
|
-
}));
|
|
60
|
-
|
|
61
|
-
export function reposition() {
|
|
62
|
-
$_daysHs.set(resource, ceil(max(...runReposition(refs, $_viewDates))) + 10);
|
|
63
|
-
$_daysHs = $_daysHs;
|
|
64
|
-
}
|
|
65
|
-
</script>
|
|
66
|
-
|
|
67
|
-
<div class="{$theme.days}" style="flex-basis: {max($_daysHs.get(resource) ?? 0, $_resHs.get(resource) ?? 0, 34)}px" role="row">
|
|
68
|
-
{#each $_viewDates as date, i}
|
|
69
|
-
<!-- svelte-ignore binding_property_non_reactive -->
|
|
70
|
-
<Day {date} {resource} {chunks} {bgChunks} {longChunks} {iChunks} bind:this={refs[i]}/>
|
|
71
|
-
{/each}
|
|
72
|
-
</div>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {getContext, untrack} from 'svelte';
|
|
3
|
-
import {max} from '#lib';
|
|
4
|
-
import Label from './Label.svelte';
|
|
5
|
-
import Expander from './Expander.svelte';
|
|
6
|
-
|
|
7
|
-
let {_viewResources, _headerHeight, _bodyEl, _daysHs, _resHs, _sidebarEl, _nestedResources, theme} = getContext('state');
|
|
8
|
-
|
|
9
|
-
$effect.pre(() => {
|
|
10
|
-
$_viewResources;
|
|
11
|
-
untrack(() => {
|
|
12
|
-
$_resHs.clear();
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
function onwheel(jsEvent) {
|
|
17
|
-
$_bodyEl.scrollBy({
|
|
18
|
-
top: jsEvent.deltaY < 0 ? -30 : 30
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<div class="{$theme.sidebar}">
|
|
24
|
-
<div class="{$theme.sidebarTitle}" style="flex-basis: {$_headerHeight}px"></div>
|
|
25
|
-
<div class="{$theme.content}" bind:this={$_sidebarEl} {onwheel}>
|
|
26
|
-
{#each $_viewResources as resource}
|
|
27
|
-
<div class="{$theme.resource}" style="flex-basis: {max($_daysHs.get(resource) ?? 0, $_resHs.get(resource) ?? 0, 34)}px" role="rowheader">
|
|
28
|
-
{#if $_nestedResources}
|
|
29
|
-
<Expander {resource} />
|
|
30
|
-
{/if}
|
|
31
|
-
<Label {resource}/>
|
|
32
|
-
</div>
|
|
33
|
-
{/each}
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|