@event-calendar/core 4.0.3 → 4.2.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 +6 -6
- package/dist/index.css +18 -2
- package/dist/index.js +63 -56
- package/package.json +3 -3
- package/src/Calendar.svelte +7 -8
- package/src/lib/components/BaseEvent.svelte +2 -2
- package/src/lib/components/InteractableEvent.svelte +4 -2
- package/src/lib/dom.js +1 -1
- package/src/lib/times.js +3 -7
- package/src/plugins/interaction/Auxiliary.svelte +6 -2
- package/src/plugins/interaction/Resizer.svelte +5 -1
- package/src/plugins/interaction/lib/events.js +2 -6
- package/src/plugins/list/Event.svelte +1 -1
- package/src/plugins/resource-time-grid/View.svelte +7 -4
- package/src/plugins/resource-timeline/Body.svelte +1 -1
- package/src/plugins/resource-timeline/Header.svelte +8 -8
- package/src/plugins/time-grid/Body.svelte +3 -5
- package/src/plugins/time-grid/Section.svelte +8 -3
- package/src/plugins/time-grid/View.svelte +6 -3
- package/src/storage/options.js +1 -1
- package/src/styles/index.scss +7 -0
- package/src/styles/time-grid.scss +5 -1
- package/src/styles/timeline.scss +7 -3
package/README.md
CHANGED
|
@@ -227,8 +227,8 @@ This bundle contains a version of the calendar that includes all plugins and is
|
|
|
227
227
|
|
|
228
228
|
The first step is to include the following lines of code in the `<head>` section of your page:
|
|
229
229
|
```html
|
|
230
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.0
|
|
231
|
-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.0
|
|
230
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.2.0/dist/event-calendar.min.css">
|
|
231
|
+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.2.0/dist/event-calendar.min.js"></script>
|
|
232
232
|
```
|
|
233
233
|
|
|
234
234
|
<details>
|
|
@@ -1552,7 +1552,7 @@ function (start, end) {
|
|
|
1552
1552
|
- Type `string`
|
|
1553
1553
|
- Default `undefined`
|
|
1554
1554
|
|
|
1555
|
-
Sets the default text color for events
|
|
1555
|
+
Sets the default text color for calendar events (except for `list` view).
|
|
1556
1556
|
|
|
1557
1557
|
You can use any of the CSS color formats such `'#f00'`, `'#ff0000'`, `'rgb(255,0,0)'`, or `'red'`.
|
|
1558
1558
|
|
|
@@ -2138,13 +2138,13 @@ function (time) {
|
|
|
2138
2138
|
- Type `string`, `integer` or `object`
|
|
2139
2139
|
- Default `undefined`
|
|
2140
2140
|
|
|
2141
|
-
The interval at which slot labels should be displayed in `timeGrid` views.
|
|
2141
|
+
The interval at which slot labels should be displayed in `timeGrid`/`resourceTimeline` views.
|
|
2142
2142
|
|
|
2143
2143
|
This should be a value that can be parsed into a [Duration](#duration-object) object.
|
|
2144
2144
|
|
|
2145
2145
|
If not specified, then if `slotDuration` is less than 1 hour, the interval is considered to be twice as long, i.e. the labels are displayed every other time.
|
|
2146
2146
|
|
|
2147
|
-
If the interval is set to zero, then labels are displayed for all slots, including the very first one, which is not normally displayed.
|
|
2147
|
+
If the interval is set to zero, then labels are displayed for all slots, including the very first one, which is not normally displayed in `timeGrid` views.
|
|
2148
2148
|
|
|
2149
2149
|
### slotMaxTime
|
|
2150
2150
|
- Type `string`, `integer` or `object`
|
|
@@ -2176,7 +2176,7 @@ Defines the time slot width in pixels in `resourceTimeline` views. When changing
|
|
|
2176
2176
|
|
|
2177
2177
|
### theme
|
|
2178
2178
|
- Type `object` or `function`
|
|
2179
|
-
- Default `{allDay: 'ec-all-day', active: 'ec-active', bgEvent: 'ec-bg-event', bgEvents: 'ec-bg-events', body: 'ec-body', button: 'ec-button', buttonGroup: 'ec-button-group', calendar: 'ec',
|
|
2179
|
+
- Default `{allDay: 'ec-all-day', active: 'ec-active', bgEvent: 'ec-bg-event', bgEvents: 'ec-bg-events', body: 'ec-body', button: 'ec-button', buttonGroup: 'ec-button-group', calendar: 'ec', container: 'ec-container', content: 'ec-content', day: 'ec-day', dayHead: 'ec-day-head', dayFoot: 'ec-day-foot', days: 'ec-days', daySide: 'ec-day-side', draggable: 'ec-draggable', dragging: 'ec-dragging', event: 'ec-event', eventBody: 'ec-event-body', eventTag: 'ec-event-tag', eventTime: 'ec-event-time', eventTitle: 'ec-event-title', events: 'ec-events', expander: 'ec-expander', extra: 'ec-extra', ghost: 'ec-ghost', handle: 'ec-handle', header: 'ec-header', hiddenScroll: 'ec-hidden-scroll', highlight: 'ec-highlight', icon: 'ec-icon', line: 'ec-line', lines: 'ec-lines', main: 'ec-main', minor: 'ec-minor', noEvents: 'ec-no-events', nowIndicator: 'ec-now-indicator', otherMonth: 'ec-other-month', pointer: 'ec-pointer', popup: 'ec-popup', preview: 'ec-preview', resizer: 'ec-resizer', resizingX: 'ec-resizing-x', resizingY: 'ec-resizing-y', resource: 'ec-resource', selecting: 'ec-selecting', sidebar: 'ec-sidebar', sidebarTitle: 'ec-sidebar-title', today: 'ec-today', time: 'ec-time', times: 'ec-times', title: 'ec-title', toolbar: 'ec-toolbar', view: 'ec-timeline ec-resource-week-view', weekdays: ['ec-sun', 'ec-mon', 'ec-tue', 'ec-wed', 'ec-thu', 'ec-fri', 'ec-sat'], withScroll: 'ec-with-scroll', uniform: 'ec-uniform'}`
|
|
2180
2180
|
> Views override the default value as follows:
|
|
2181
2181
|
> - dayGridMonth `theme => ({...theme, view: 'ec-day-grid ec-month-view'})`
|
|
2182
2182
|
> - listDay `theme => ({...theme, view: 'ec-list ec-day-view'})`
|
package/dist/index.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* EventCalendar v4.0
|
|
2
|
+
* EventCalendar v4.2.0
|
|
3
3
|
* https://github.com/vkurko/calendar
|
|
4
4
|
*/
|
|
5
5
|
.ec {
|
|
@@ -126,6 +126,9 @@
|
|
|
126
126
|
overflow: hidden;
|
|
127
127
|
text-overflow: ellipsis;
|
|
128
128
|
}
|
|
129
|
+
.ec-timeline .ec-time.ec-minor {
|
|
130
|
+
visibility: hidden;
|
|
131
|
+
}
|
|
129
132
|
.ec-timeline .ec-time, .ec-timeline .ec-line {
|
|
130
133
|
width: 72px;
|
|
131
134
|
}
|
|
@@ -151,6 +154,9 @@
|
|
|
151
154
|
border-left: 1px solid var(--ec-border-color);
|
|
152
155
|
pointer-events: none;
|
|
153
156
|
}
|
|
157
|
+
.ec-timeline .ec-line.ec-minor:after {
|
|
158
|
+
border-left-style: dotted;
|
|
159
|
+
}
|
|
154
160
|
.ec-timeline .ec-sidebar {
|
|
155
161
|
padding: 0;
|
|
156
162
|
border: 1px solid var(--ec-border-color);
|
|
@@ -209,6 +215,9 @@
|
|
|
209
215
|
top: -12px;
|
|
210
216
|
text-align: right;
|
|
211
217
|
}
|
|
218
|
+
.ec-time-grid .ec-time.ec-minor {
|
|
219
|
+
visibility: hidden;
|
|
220
|
+
}
|
|
212
221
|
.ec-time-grid .ec-header .ec-time,
|
|
213
222
|
.ec-time-grid .ec-all-day .ec-time {
|
|
214
223
|
visibility: hidden;
|
|
@@ -229,7 +238,7 @@
|
|
|
229
238
|
border-bottom: 1px solid var(--ec-border-color);
|
|
230
239
|
pointer-events: none;
|
|
231
240
|
}
|
|
232
|
-
.ec-time-grid .ec-
|
|
241
|
+
.ec-time-grid .ec-line.ec-minor:after {
|
|
233
242
|
border-bottom-style: dotted;
|
|
234
243
|
}
|
|
235
244
|
.ec-time-grid .ec-sidebar-title {
|
|
@@ -532,6 +541,13 @@
|
|
|
532
541
|
top: 0;
|
|
533
542
|
z-index: 2;
|
|
534
543
|
}
|
|
544
|
+
.ec-list .ec-day.ec-today .ec-day-head:before {
|
|
545
|
+
content: "";
|
|
546
|
+
position: absolute;
|
|
547
|
+
inset: 0;
|
|
548
|
+
z-index: -1;
|
|
549
|
+
background-color: var(--ec-today-bg-color);
|
|
550
|
+
}
|
|
535
551
|
.ec-list .ec-day:first-child .ec-day-head {
|
|
536
552
|
border-top: none;
|
|
537
553
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* EventCalendar v4.0
|
|
2
|
+
* EventCalendar v4.2.0
|
|
3
3
|
* https://github.com/vkurko/calendar
|
|
4
4
|
*/
|
|
5
5
|
import { tick, getContext, untrack, setContext, onMount, mount, unmount } from "svelte";
|
|
@@ -304,7 +304,7 @@ function getElementWithPayload(x, y, root2 = document) {
|
|
|
304
304
|
if (hasPayload(el)) {
|
|
305
305
|
return el;
|
|
306
306
|
}
|
|
307
|
-
if (el.shadowRoot) {
|
|
307
|
+
if (el.shadowRoot && el.shadowRoot !== root2) {
|
|
308
308
|
let shadowEl = getElementWithPayload(x, y, el.shadowRoot);
|
|
309
309
|
if (shadowEl) {
|
|
310
310
|
return shadowEl;
|
|
@@ -748,18 +748,14 @@ function createTimes(date, $slotDuration, $slotLabelInterval, $_slotTimeLimits,
|
|
|
748
748
|
if ($slotLabelInterval === void 0) {
|
|
749
749
|
$slotLabelInterval = $slotDuration.seconds < 3600 ? createDuration($slotDuration.seconds * 2) : $slotDuration;
|
|
750
750
|
}
|
|
751
|
-
let
|
|
752
|
-
let label;
|
|
753
|
-
if (!showAll) {
|
|
754
|
-
label = cloneDate(date);
|
|
755
|
-
}
|
|
751
|
+
let label = cloneDate(date);
|
|
756
752
|
while (date < end) {
|
|
757
753
|
times2.push([
|
|
758
754
|
toISOString(date),
|
|
759
755
|
$_intlSlotLabel.format(date),
|
|
760
|
-
|
|
756
|
+
date >= label
|
|
761
757
|
]);
|
|
762
|
-
while (
|
|
758
|
+
while ($slotLabelInterval.seconds && date >= label) {
|
|
763
759
|
addDuration(label, $slotLabelInterval);
|
|
764
760
|
}
|
|
765
761
|
addDuration(date, $slotDuration);
|
|
@@ -882,7 +878,6 @@ function createOptions(plugins) {
|
|
|
882
878
|
button: "ec-button",
|
|
883
879
|
buttonGroup: "ec-button-group",
|
|
884
880
|
calendar: "ec",
|
|
885
|
-
compact: "ec-compact",
|
|
886
881
|
content: "ec-content",
|
|
887
882
|
day: "ec-day",
|
|
888
883
|
dayHead: "ec-day-head",
|
|
@@ -901,6 +896,7 @@ function createOptions(plugins) {
|
|
|
901
896
|
icon: "ec-icon",
|
|
902
897
|
line: "ec-line",
|
|
903
898
|
lines: "ec-lines",
|
|
899
|
+
minor: "ec-minor",
|
|
904
900
|
nowIndicator: "ec-now-indicator",
|
|
905
901
|
otherMonth: "ec-other-month",
|
|
906
902
|
resource: "ec-resource",
|
|
@@ -1674,18 +1670,17 @@ function Calendar($$anchor, $$props) {
|
|
|
1674
1670
|
return toEventWithLocalDates(event);
|
|
1675
1671
|
}
|
|
1676
1672
|
function updateEvent(event) {
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
return toEventWithLocalDates(event);
|
|
1683
|
-
}
|
|
1673
|
+
let id = String(event.id);
|
|
1674
|
+
let idx = $_events().findIndex((event2) => event2.id === id);
|
|
1675
|
+
if (idx >= 0) {
|
|
1676
|
+
$.store_mutate(_events, $.untrack($_events)[idx] = createEvents([event])[0], $.untrack($_events));
|
|
1677
|
+
return toEventWithLocalDates(event);
|
|
1684
1678
|
}
|
|
1685
1679
|
return null;
|
|
1686
1680
|
}
|
|
1687
1681
|
function removeEventById(id) {
|
|
1688
|
-
|
|
1682
|
+
id = String(id);
|
|
1683
|
+
let idx = $_events().findIndex((event) => event.id === id);
|
|
1689
1684
|
if (idx >= 0) {
|
|
1690
1685
|
$_events().splice(idx, 1);
|
|
1691
1686
|
$.store_set(_events, $_events());
|
|
@@ -1913,13 +1908,10 @@ function BaseEvent($$anchor, $$props) {
|
|
|
1913
1908
|
(_a = $$props.onpointerdown) == null ? void 0 : _a.apply(this, $$args);
|
|
1914
1909
|
};
|
|
1915
1910
|
{
|
|
1916
|
-
const defaultBody = ($$anchor2
|
|
1911
|
+
const defaultBody = ($$anchor2) => {
|
|
1917
1912
|
var div = root_1$a();
|
|
1918
1913
|
$.action(div, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $.get(content));
|
|
1919
|
-
$.template_effect(() =>
|
|
1920
|
-
$.set_class(div, 1, $.clsx($theme().eventBody));
|
|
1921
|
-
$.set_style(div, style2());
|
|
1922
|
-
});
|
|
1914
|
+
$.template_effect(() => $.set_class(div, 1, $.clsx($theme().eventBody)));
|
|
1923
1915
|
$.append($$anchor2, div);
|
|
1924
1916
|
};
|
|
1925
1917
|
var node = $.child(article);
|
|
@@ -1968,15 +1960,16 @@ function InteractableEvent($$anchor, $$props) {
|
|
|
1968
1960
|
let el = $.prop($$props, "el", 15);
|
|
1969
1961
|
let { _interaction, _iClasses } = getContext("state");
|
|
1970
1962
|
let event = $.derived(() => $$props.chunk.event);
|
|
1963
|
+
let display = $.derived(() => $$props.chunk.event.display);
|
|
1971
1964
|
let classes = $.derived(() => (classNames) => $_iClasses()(classNames, $.get(event)));
|
|
1972
1965
|
function createDragHandler(event2) {
|
|
1973
|
-
var _a;
|
|
1966
|
+
var _a, _b;
|
|
1974
1967
|
return ((_a = $_interaction().action) == null ? void 0 : _a.draggable(event2)) ? (jsEvent) => {
|
|
1975
|
-
var _a2,
|
|
1976
|
-
return $_interaction().action.drag(event2, jsEvent, (_a2 = $$props.forceDate) == null ? void 0 : _a2.call($$props), (
|
|
1977
|
-
} : void 0;
|
|
1968
|
+
var _a2, _b2;
|
|
1969
|
+
return $_interaction().action.drag(event2, jsEvent, (_a2 = $$props.forceDate) == null ? void 0 : _a2.call($$props), (_b2 = $$props.forceMargin) == null ? void 0 : _b2.call($$props));
|
|
1970
|
+
} : (_b = $_interaction().action) == null ? void 0 : _b.noAction;
|
|
1978
1971
|
}
|
|
1979
|
-
let onpointerdown = $.derived(() => createDragHandler($.get(event)));
|
|
1972
|
+
let onpointerdown = $.derived(() => !bgEvent($.get(display)) && !helperEvent($.get(display)) ? createDragHandler($.get(event)) : void 0);
|
|
1980
1973
|
let Resizer2 = $.derived(() => $_interaction().resizer);
|
|
1981
1974
|
{
|
|
1982
1975
|
const body = ($$anchor2, defaultBody = $.noop) => {
|
|
@@ -2787,10 +2780,10 @@ const index$4 = {
|
|
|
2787
2780
|
}
|
|
2788
2781
|
};
|
|
2789
2782
|
function eventDraggable(event, $eventStartEditable, $editable) {
|
|
2790
|
-
return
|
|
2783
|
+
return event.startEditable ?? $eventStartEditable ?? event.editable ?? $editable;
|
|
2791
2784
|
}
|
|
2792
2785
|
function eventResizable(event, $eventDurationEditable, $editable) {
|
|
2793
|
-
return
|
|
2786
|
+
return event.durationEditable ?? $eventDurationEditable ?? event.editable ?? $editable;
|
|
2794
2787
|
}
|
|
2795
2788
|
let busy = false;
|
|
2796
2789
|
function animate(fn) {
|
|
@@ -3514,7 +3507,8 @@ function Resizer($$anchor, $$props) {
|
|
|
3514
3507
|
_interaction
|
|
3515
3508
|
} = getContext("state");
|
|
3516
3509
|
let event = $.derived(() => $$props.chunk.event);
|
|
3517
|
-
let
|
|
3510
|
+
let display = $.derived(() => $$props.chunk.event.display);
|
|
3511
|
+
let resizable = $.derived(() => !bgEvent($.get(display)) && !helperEvent($.get(display)) && eventResizable($.get(event), $eventDurationEditable(), $editable()));
|
|
3518
3512
|
function createResizeHandler(start) {
|
|
3519
3513
|
return (jsEvent) => {
|
|
3520
3514
|
var _a, _b;
|
|
@@ -3589,7 +3583,7 @@ function Auxiliary($$anchor, $$props) {
|
|
|
3589
3583
|
let { display } = event;
|
|
3590
3584
|
return [
|
|
3591
3585
|
...classNames,
|
|
3592
|
-
helperEvent(display) ? [$theme()[display]] : eventDraggable(event, $eventStartEditable(), $editable()) ? [$theme().draggable] : []
|
|
3586
|
+
helperEvent(display) ? [$theme()[display]] : !bgEvent(display) && eventDraggable(event, $eventStartEditable(), $editable()) ? [$theme().draggable] : []
|
|
3593
3587
|
];
|
|
3594
3588
|
});
|
|
3595
3589
|
});
|
|
@@ -3691,7 +3685,7 @@ function Event$3($$anchor, $$props) {
|
|
|
3691
3685
|
var div = $.first_child(fragment_1);
|
|
3692
3686
|
let styles_1;
|
|
3693
3687
|
var node = $.sibling(div, 2);
|
|
3694
|
-
$.snippet(node, defaultBody
|
|
3688
|
+
$.snippet(node, defaultBody);
|
|
3695
3689
|
$.template_effect(() => {
|
|
3696
3690
|
$.set_class(div, 1, $theme().eventTag);
|
|
3697
3691
|
styles_1 = $.set_style(div, "", styles_1, { "background-color": bgColor() });
|
|
@@ -4027,20 +4021,27 @@ function Section($$anchor, $$props) {
|
|
|
4027
4021
|
$.push($$props, true);
|
|
4028
4022
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
4029
4023
|
const $allDayContent = () => $.store_get(allDayContent, "$allDayContent", $$stores);
|
|
4024
|
+
const $slotLabelInterval = () => $.store_get(slotLabelInterval, "$slotLabelInterval", $$stores);
|
|
4030
4025
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
4031
4026
|
const $_times = () => $.store_get(_times, "$_times", $$stores);
|
|
4032
|
-
let {
|
|
4027
|
+
let {
|
|
4028
|
+
allDayContent,
|
|
4029
|
+
slotLabelInterval,
|
|
4030
|
+
theme,
|
|
4031
|
+
_times
|
|
4032
|
+
} = getContext("state");
|
|
4033
4033
|
let allDayText = $.derived(() => createAllDayContent($allDayContent()));
|
|
4034
|
+
let showAllTimes = $.derived(() => $slotLabelInterval() && $slotLabelInterval().seconds <= 0);
|
|
4034
4035
|
var fragment = root$f();
|
|
4035
4036
|
var div = $.first_child(fragment);
|
|
4036
4037
|
var div_1 = $.child(div);
|
|
4037
4038
|
$.action(div_1, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $.get(allDayText));
|
|
4038
4039
|
var node = $.sibling(div_1, 2);
|
|
4039
|
-
$.each(node, 1, $_times, $.index, ($$anchor2, time) => {
|
|
4040
|
+
$.each(node, 1, $_times, $.index, ($$anchor2, time, i) => {
|
|
4040
4041
|
var time_1 = root_1$4();
|
|
4041
|
-
$.action(time_1, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $.get(time)[
|
|
4042
|
+
$.action(time_1, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $.get(time)[1]);
|
|
4042
4043
|
$.template_effect(() => {
|
|
4043
|
-
$.set_class(time_1, 1, $theme().time);
|
|
4044
|
+
$.set_class(time_1, 1, `${$theme().time ?? ""}${(i || $.get(showAllTimes)) && $.get(time)[2] ? "" : " " + $theme().minor}`);
|
|
4044
4045
|
$.set_attribute(time_1, "datetime", $.get(time)[0]);
|
|
4045
4046
|
});
|
|
4046
4047
|
$.append($$anchor2, time_1);
|
|
@@ -4089,10 +4090,10 @@ var root$e = $.template(`<div><div><!></div></div>`);
|
|
|
4089
4090
|
function Body$1($$anchor, $$props) {
|
|
4090
4091
|
$.push($$props, true);
|
|
4091
4092
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
4092
|
-
const $slotDuration = () => $.store_get(slotDuration, "$slotDuration", $$stores);
|
|
4093
4093
|
const $_viewDates = () => $.store_get(_viewDates, "$_viewDates", $$stores);
|
|
4094
4094
|
const $scrollTime = () => $.store_get(scrollTime, "$scrollTime", $$stores);
|
|
4095
4095
|
const $_slotTimeLimits = () => $.store_get(_slotTimeLimits, "$_slotTimeLimits", $$stores);
|
|
4096
|
+
const $slotDuration = () => $.store_get(slotDuration, "$slotDuration", $$stores);
|
|
4096
4097
|
const $slotHeight = () => $.store_get(slotHeight, "$slotHeight", $$stores);
|
|
4097
4098
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
4098
4099
|
const $_times = () => $.store_get(_times, "$_times", $$stores);
|
|
@@ -4108,7 +4109,6 @@ function Body$1($$anchor, $$props) {
|
|
|
4108
4109
|
theme
|
|
4109
4110
|
} = getContext("state");
|
|
4110
4111
|
let el = $.state(void 0);
|
|
4111
|
-
let compact = $.derived(() => $slotDuration().seconds >= 3600);
|
|
4112
4112
|
$.user_effect(() => {
|
|
4113
4113
|
$.store_set(_bodyEl, $.get(el));
|
|
4114
4114
|
});
|
|
@@ -4127,9 +4127,9 @@ function Body$1($$anchor, $$props) {
|
|
|
4127
4127
|
const lines = ($$anchor2) => {
|
|
4128
4128
|
var fragment = $.comment();
|
|
4129
4129
|
var node_1 = $.first_child(fragment);
|
|
4130
|
-
$.each(node_1, 1,
|
|
4130
|
+
$.each(node_1, 1, $_times, $.index, ($$anchor3, time) => {
|
|
4131
4131
|
var div_2 = root_2$5();
|
|
4132
|
-
$.template_effect(() => $.set_class(div_2, 1, $theme().line));
|
|
4132
|
+
$.template_effect(() => $.set_class(div_2, 1, `${$theme().line ?? ""}${$.get(time)[2] ? "" : " " + $theme().minor}`));
|
|
4133
4133
|
$.append($$anchor3, div_2);
|
|
4134
4134
|
});
|
|
4135
4135
|
$.append($$anchor2, fragment);
|
|
@@ -4147,7 +4147,7 @@ function Body$1($$anchor, $$props) {
|
|
|
4147
4147
|
$.bind_this(div, ($$value) => $.set(el, $$value), () => $.get(el));
|
|
4148
4148
|
$.action(div, ($$node, $$action_arg) => observeResize == null ? void 0 : observeResize($$node, $$action_arg), () => () => $.store_set(_recheckScrollable, true));
|
|
4149
4149
|
$.template_effect(() => {
|
|
4150
|
-
$.set_class(div, 1,
|
|
4150
|
+
$.set_class(div, 1, $theme().body);
|
|
4151
4151
|
$.set_class(div_1, 1, $theme().content);
|
|
4152
4152
|
});
|
|
4153
4153
|
$.append($$anchor, div);
|
|
@@ -4697,6 +4697,7 @@ function View$2($$anchor, $$props) {
|
|
|
4697
4697
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
4698
4698
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
4699
4699
|
const $_viewDates = () => $.store_get(_viewDates, "$_viewDates", $$stores);
|
|
4700
|
+
const $_today = () => $.store_get(_today, "$_today", $$stores);
|
|
4700
4701
|
const $_intlDayHeaderAL = () => $.store_get(_intlDayHeaderAL, "$_intlDayHeaderAL", $$stores);
|
|
4701
4702
|
const $_intlDayHeader = () => $.store_get(_intlDayHeader, "$_intlDayHeader", $$stores);
|
|
4702
4703
|
const $allDaySlot = () => $.store_get(allDaySlot, "$allDaySlot", $$stores);
|
|
@@ -4704,6 +4705,7 @@ function View$2($$anchor, $$props) {
|
|
|
4704
4705
|
_viewDates,
|
|
4705
4706
|
_intlDayHeader,
|
|
4706
4707
|
_intlDayHeaderAL,
|
|
4708
|
+
_today,
|
|
4707
4709
|
allDaySlot,
|
|
4708
4710
|
theme
|
|
4709
4711
|
} = getContext("state");
|
|
@@ -4721,16 +4723,17 @@ function View$2($$anchor, $$props) {
|
|
|
4721
4723
|
$.action(time, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $_intlDayHeader().format($.get(date)));
|
|
4722
4724
|
$.reset(div_1);
|
|
4723
4725
|
$.template_effect(
|
|
4724
|
-
($0, $1, $2) => {
|
|
4725
|
-
$.set_class(div_1, 1, `${$theme().day ?? ""} ${$0 ?? ""}`);
|
|
4726
|
-
$.set_attribute(time, "datetime", $
|
|
4727
|
-
$.set_attribute(time, "aria-label", $
|
|
4726
|
+
($0, $1, $2, $3) => {
|
|
4727
|
+
$.set_class(div_1, 1, `${$theme().day ?? ""} ${$0 ?? ""}${$1 ?? ""}`);
|
|
4728
|
+
$.set_attribute(time, "datetime", $2);
|
|
4729
|
+
$.set_attribute(time, "aria-label", $3);
|
|
4728
4730
|
},
|
|
4729
4731
|
[
|
|
4730
4732
|
() => {
|
|
4731
4733
|
var _a;
|
|
4732
4734
|
return (_a = $theme().weekdays) == null ? void 0 : _a[$.get(date).getUTCDay()];
|
|
4733
4735
|
},
|
|
4736
|
+
() => datesEqual($.get(date), $_today()) ? " " + $theme().today : "",
|
|
4734
4737
|
() => toISOString($.get(date), 10),
|
|
4735
4738
|
() => $_intlDayHeaderAL().format($.get(date))
|
|
4736
4739
|
],
|
|
@@ -4894,11 +4897,13 @@ function View$1($$anchor, $$props) {
|
|
|
4894
4897
|
const $_viewDates = () => $.store_get(_viewDates, "$_viewDates", $$stores);
|
|
4895
4898
|
const $_viewResources = () => $.store_get(_viewResources, "$_viewResources", $$stores);
|
|
4896
4899
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
4900
|
+
const $_today = () => $.store_get(_today, "$_today", $$stores);
|
|
4897
4901
|
const $_intlDayHeaderAL = () => $.store_get(_intlDayHeaderAL, "$_intlDayHeaderAL", $$stores);
|
|
4898
4902
|
const $_intlDayHeader = () => $.store_get(_intlDayHeader, "$_intlDayHeader", $$stores);
|
|
4899
4903
|
const $allDaySlot = () => $.store_get(allDaySlot, "$allDaySlot", $$stores);
|
|
4900
4904
|
let {
|
|
4901
4905
|
datesAboveResources,
|
|
4906
|
+
_today,
|
|
4902
4907
|
_viewDates,
|
|
4903
4908
|
_viewResources,
|
|
4904
4909
|
_intlDayHeader,
|
|
@@ -4925,16 +4930,17 @@ function View$1($$anchor, $$props) {
|
|
|
4925
4930
|
$.action(time, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $_intlDayHeader().format($.get(item0)));
|
|
4926
4931
|
$.reset(div_2);
|
|
4927
4932
|
$.template_effect(
|
|
4928
|
-
($0, $1, $2) => {
|
|
4929
|
-
$.set_class(div_2, 1, `${$theme().day ?? ""} ${$0 ?? ""}`);
|
|
4930
|
-
$.set_attribute(time, "datetime", $
|
|
4931
|
-
$.set_attribute(time, "aria-label", $
|
|
4933
|
+
($0, $1, $2, $3) => {
|
|
4934
|
+
$.set_class(div_2, 1, `${$theme().day ?? ""} ${$0 ?? ""}${$1 ?? ""}`);
|
|
4935
|
+
$.set_attribute(time, "datetime", $2);
|
|
4936
|
+
$.set_attribute(time, "aria-label", $3);
|
|
4932
4937
|
},
|
|
4933
4938
|
[
|
|
4934
4939
|
() => {
|
|
4935
4940
|
var _a;
|
|
4936
4941
|
return (_a = $theme().weekdays) == null ? void 0 : _a[$.get(item0).getUTCDay()];
|
|
4937
4942
|
},
|
|
4943
|
+
() => datesEqual($.get(item0), $_today()) ? " " + $theme().today : "",
|
|
4938
4944
|
() => toISOString($.get(item0), 10),
|
|
4939
4945
|
() => $_intlDayHeaderAL().format($.get(item0))
|
|
4940
4946
|
]
|
|
@@ -4988,16 +4994,17 @@ function View$1($$anchor, $$props) {
|
|
|
4988
4994
|
$.action(time_1, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $_intlDayHeader().format($.get(item1)));
|
|
4989
4995
|
$.reset(div_6);
|
|
4990
4996
|
$.template_effect(
|
|
4991
|
-
($0, $1, $2) => {
|
|
4992
|
-
$.set_class(div_6, 1, `${$theme().day ?? ""} ${$0 ?? ""}`);
|
|
4993
|
-
$.set_attribute(time_1, "datetime", $
|
|
4994
|
-
$.set_attribute(time_1, "aria-label", `${resourceLabels[i] ?? ""}${$
|
|
4997
|
+
($0, $1, $2, $3) => {
|
|
4998
|
+
$.set_class(div_6, 1, `${$theme().day ?? ""} ${$0 ?? ""}${$1 ?? ""}`);
|
|
4999
|
+
$.set_attribute(time_1, "datetime", $2);
|
|
5000
|
+
$.set_attribute(time_1, "aria-label", `${resourceLabels[i] ?? ""}${$3 ?? ""}`);
|
|
4995
5001
|
},
|
|
4996
5002
|
[
|
|
4997
5003
|
() => {
|
|
4998
5004
|
var _a;
|
|
4999
5005
|
return (_a = $theme().weekdays) == null ? void 0 : _a[$.get(item1).getUTCDay()];
|
|
5000
5006
|
},
|
|
5007
|
+
() => datesEqual($.get(item1), $_today()) ? " " + $theme().today : "",
|
|
5001
5008
|
() => toISOString($.get(item1), 10),
|
|
5002
5009
|
() => $_intlDayHeaderAL().format($.get(item1))
|
|
5003
5010
|
]
|
|
@@ -5437,7 +5444,7 @@ function Header($$anchor, $$props) {
|
|
|
5437
5444
|
$.action(time_2, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $.get(time)[1]);
|
|
5438
5445
|
$.reset(div_5);
|
|
5439
5446
|
$.template_effect(() => {
|
|
5440
|
-
$.set_class(div_5, 1, $theme().time);
|
|
5447
|
+
$.set_class(div_5, 1, `${$theme().time ?? ""}${$.get(time)[2] ? "" : " " + $theme().minor}`);
|
|
5441
5448
|
$.set_attribute(time_2, "datetime", $.get(time)[0]);
|
|
5442
5449
|
});
|
|
5443
5450
|
$.append($$anchor4, div_5);
|
|
@@ -6024,7 +6031,7 @@ function Body($$anchor, $$props) {
|
|
|
6024
6031
|
var node = $.first_child(fragment);
|
|
6025
6032
|
$.each(node, 1, () => $_dayTimes()[$.get(date).getTime()], $.index, ($$anchor3, time) => {
|
|
6026
6033
|
var div_3 = root_2();
|
|
6027
|
-
$.template_effect(() => $.set_class(div_3, 1, $theme().line));
|
|
6034
|
+
$.template_effect(() => $.set_class(div_3, 1, `${$theme().line ?? ""}${$.get(time)[2] ? "" : " " + $theme().minor}`));
|
|
6028
6035
|
$.append($$anchor3, div_3);
|
|
6029
6036
|
});
|
|
6030
6037
|
$.append($$anchor2, fragment);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@event-calendar/core",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.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.28.
|
|
35
|
+
"svelte": "^5.28.6"
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|
package/src/Calendar.svelte
CHANGED
|
@@ -68,19 +68,18 @@
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export function updateEvent(event) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return toEventWithLocalDates(event);
|
|
77
|
-
}
|
|
71
|
+
let id = String(event.id);
|
|
72
|
+
let idx = $_events.findIndex(event => event.id === id);
|
|
73
|
+
if (idx >= 0) {
|
|
74
|
+
$_events[idx] = createEvents([event])[0];
|
|
75
|
+
return toEventWithLocalDates(event);
|
|
78
76
|
}
|
|
79
77
|
return null;
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
export function removeEventById(id) {
|
|
83
|
-
|
|
81
|
+
id = String(id);
|
|
82
|
+
let idx = $_events.findIndex(event => event.id === id);
|
|
84
83
|
if (idx >= 0) {
|
|
85
84
|
$_events.splice(idx, 1);
|
|
86
85
|
$_events = $_events;
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
{onmouseleave}
|
|
78
78
|
{onpointerdown}
|
|
79
79
|
>
|
|
80
|
-
{#snippet defaultBody(
|
|
81
|
-
<div class={$theme.eventBody}
|
|
80
|
+
{#snippet defaultBody()}
|
|
81
|
+
<div class={$theme.eventBody} use:setContent={content}></div>
|
|
82
82
|
{/snippet}
|
|
83
83
|
{#if body}
|
|
84
84
|
{@render body(defaultBody, bgColor, txtColor)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
3
|
import BaseEvent from './BaseEvent.svelte';
|
|
4
|
+
import {bgEvent, helperEvent} from "#lib";
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
el = $bindable(),
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
let {_interaction, _iClasses} = getContext('state');
|
|
15
16
|
|
|
16
17
|
let event = $derived(chunk.event);
|
|
18
|
+
let display = $derived(chunk.event.display);
|
|
17
19
|
|
|
18
20
|
// Class
|
|
19
21
|
let classes = $derived(classNames => $_iClasses(classNames, event));
|
|
@@ -23,9 +25,9 @@
|
|
|
23
25
|
? jsEvent => $_interaction.action.drag(
|
|
24
26
|
event, jsEvent, forceDate?.(), forceMargin?.()
|
|
25
27
|
)
|
|
26
|
-
:
|
|
28
|
+
: $_interaction.action?.noAction;
|
|
27
29
|
}
|
|
28
|
-
let onpointerdown = $derived(createDragHandler(event));
|
|
30
|
+
let onpointerdown = $derived(!bgEvent(display) && !helperEvent(display) ? createDragHandler(event) : undefined);
|
|
29
31
|
|
|
30
32
|
let Resizer = $derived($_interaction.resizer);
|
|
31
33
|
</script>
|
package/src/lib/dom.js
CHANGED
|
@@ -41,7 +41,7 @@ export function getElementWithPayload(x, y, root = document) {
|
|
|
41
41
|
return el;
|
|
42
42
|
}
|
|
43
43
|
/** @see https://github.com/vkurko/calendar/issues/142 */
|
|
44
|
-
if (el.shadowRoot) {
|
|
44
|
+
if (el.shadowRoot && el.shadowRoot !== root) {
|
|
45
45
|
let shadowEl = getElementWithPayload(x, y, el.shadowRoot);
|
|
46
46
|
if (shadowEl) {
|
|
47
47
|
return shadowEl;
|
package/src/lib/times.js
CHANGED
|
@@ -14,19 +14,15 @@ export function createTimes(date, $slotDuration, $slotLabelInterval, $_slotTimeL
|
|
|
14
14
|
? createDuration($slotDuration.seconds * 2)
|
|
15
15
|
: $slotDuration;
|
|
16
16
|
}
|
|
17
|
-
let
|
|
18
|
-
let label;
|
|
19
|
-
if (!showAll) {
|
|
20
|
-
label = cloneDate(date);
|
|
21
|
-
}
|
|
17
|
+
let label = cloneDate(date);
|
|
22
18
|
// Build times
|
|
23
19
|
while (date < end) {
|
|
24
20
|
times.push([
|
|
25
21
|
toISOString(date),
|
|
26
22
|
$_intlSlotLabel.format(date),
|
|
27
|
-
|
|
23
|
+
date >= label
|
|
28
24
|
]);
|
|
29
|
-
while (
|
|
25
|
+
while ($slotLabelInterval.seconds && date >= label) {
|
|
30
26
|
addDuration(label, $slotLabelInterval);
|
|
31
27
|
}
|
|
32
28
|
addDuration(date, $slotDuration);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
|
-
import {helperEvent, listen} from '#lib';
|
|
3
|
+
import {bgEvent, helperEvent, listen} from '#lib';
|
|
4
4
|
import {eventDraggable} from './lib';
|
|
5
5
|
import Action from './Action.svelte';
|
|
6
6
|
import Pointer from './Pointer.svelte';
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
...classNames,
|
|
22
22
|
helperEvent(display)
|
|
23
23
|
? [$theme[display]]
|
|
24
|
-
: (
|
|
24
|
+
: (
|
|
25
|
+
!bgEvent(display) && eventDraggable(event, $eventStartEditable, $editable)
|
|
26
|
+
? [$theme.draggable]
|
|
27
|
+
: []
|
|
28
|
+
)
|
|
25
29
|
];
|
|
26
30
|
};
|
|
27
31
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
|
+
import {bgEvent, helperEvent} from '#lib';
|
|
3
4
|
import {eventResizable} from './lib';
|
|
4
5
|
|
|
5
6
|
let {chunk, axis, forceDate = undefined, forceMargin = undefined, children} = $props();
|
|
@@ -7,8 +8,11 @@
|
|
|
7
8
|
let {theme, eventDurationEditable, eventResizableFromStart, editable, _interaction} = getContext('state');
|
|
8
9
|
|
|
9
10
|
let event = $derived(chunk.event);
|
|
11
|
+
let display = $derived(chunk.event.display);
|
|
10
12
|
|
|
11
|
-
let resizable = $derived(
|
|
13
|
+
let resizable = $derived(
|
|
14
|
+
!bgEvent(display) && !helperEvent(display) && eventResizable(event, $eventDurationEditable, $editable)
|
|
15
|
+
);
|
|
12
16
|
|
|
13
17
|
function createResizeHandler(start) {
|
|
14
18
|
return jsEvent => $_interaction.action.resize(
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import {bgEvent, helperEvent} from '#lib';
|
|
2
2
|
|
|
3
3
|
export function eventDraggable(event, $eventStartEditable, $editable) {
|
|
4
|
-
return (event.startEditable ?? $eventStartEditable ?? event.editable ?? $editable)
|
|
5
|
-
!bgEvent(event.display) &&
|
|
6
|
-
!helperEvent(event.display);
|
|
4
|
+
return (event.startEditable ?? $eventStartEditable ?? event.editable ?? $editable);
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
export function eventResizable(event, $eventDurationEditable, $editable) {
|
|
10
|
-
return (event.durationEditable ?? $eventDurationEditable ?? event.editable ?? $editable)
|
|
11
|
-
!bgEvent(event.display) &&
|
|
12
|
-
!helperEvent(event.display);
|
|
8
|
+
return (event.durationEditable ?? $eventDurationEditable ?? event.editable ?? $editable);
|
|
13
9
|
}
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
<BaseEvent {chunk} {styles} onpointerdown={$_interaction.action?.noAction}>
|
|
18
18
|
{#snippet body(defaultBody, bgColor, txtColor)}
|
|
19
19
|
<div class="{$theme.eventTag}" style:background-color={bgColor}></div>
|
|
20
|
-
{@render defaultBody(
|
|
20
|
+
{@render defaultBody()}
|
|
21
21
|
{/snippet}
|
|
22
22
|
</BaseEvent>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
|
-
import {setContent, toISOString} from '#lib';
|
|
3
|
+
import {datesEqual, setContent, toISOString} from '#lib';
|
|
4
4
|
import {Section, Body, Day, Week} from '../time-grid/index.js';
|
|
5
5
|
import Label from './Label.svelte';
|
|
6
6
|
|
|
7
7
|
let {
|
|
8
|
-
datesAboveResources, _viewDates, _viewResources, _intlDayHeader, _intlDayHeaderAL, allDaySlot, theme
|
|
8
|
+
datesAboveResources, _today, _viewDates, _viewResources, _intlDayHeader, _intlDayHeaderAL, allDaySlot, theme
|
|
9
9
|
} = getContext('state');
|
|
10
10
|
|
|
11
11
|
let loops = $derived($datesAboveResources ? [$_viewDates, $_viewResources] : [$_viewResources, $_viewDates]);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
{#each loops[0] as item0, i}
|
|
19
19
|
<div class="{$theme.resource}">
|
|
20
20
|
{#if $datesAboveResources}
|
|
21
|
-
<div class="{$theme.day} {$theme.weekdays?.[item0.getUTCDay()]}">
|
|
21
|
+
<div class="{$theme.day} {$theme.weekdays?.[item0.getUTCDay()]}{datesEqual(item0, $_today) ? ' ' + $theme.today : ''}">
|
|
22
22
|
<time
|
|
23
23
|
datetime="{toISOString(item0, 10)}"
|
|
24
24
|
aria-label="{$_intlDayHeaderAL.format(item0)}"
|
|
@@ -38,7 +38,10 @@
|
|
|
38
38
|
<Label resource={item1} date={item0} />
|
|
39
39
|
</div>
|
|
40
40
|
{:else}
|
|
41
|
-
<div
|
|
41
|
+
<div
|
|
42
|
+
class="{$theme.day} {$theme.weekdays?.[item1.getUTCDay()]}{datesEqual(item1, $_today) ? ' ' + $theme.today : ''}"
|
|
43
|
+
role="columnheader"
|
|
44
|
+
>
|
|
42
45
|
<time
|
|
43
46
|
datetime="{toISOString(item1, 10)}"
|
|
44
47
|
aria-label="{resourceLabels[i]}{$_intlDayHeaderAL.format(item1)}"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
</div>
|
|
20
20
|
<div class="{$theme.times}">
|
|
21
21
|
{#each $_dayTimes[date.getTime()] as time}
|
|
22
|
-
<div class="{$theme.time}" role="columnheader">
|
|
22
|
+
<div class="{$theme.time}{time[2] ? '' : ' ' + $theme.minor}" role="columnheader">
|
|
23
23
|
<time
|
|
24
24
|
datetime="{time[0]}"
|
|
25
25
|
use:setContent={time[1]}
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
{/each}
|
|
29
29
|
</div>
|
|
30
30
|
{:else}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
<div class="{$theme.time}" role="columnheader">
|
|
32
|
+
<time
|
|
33
|
+
datetime="{toISOString(date, 10)}"
|
|
34
|
+
aria-label="{$_intlDayHeaderAL.format(date)}"
|
|
35
|
+
use:setContent={$_intlDayHeader.format(date)}
|
|
36
|
+
></time>
|
|
37
|
+
</div>
|
|
38
38
|
{/if}
|
|
39
39
|
</div>
|
|
40
40
|
{/each}
|
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
let el = $state();
|
|
13
13
|
|
|
14
|
-
let compact = $derived($slotDuration.seconds >= 3600);
|
|
15
|
-
|
|
16
14
|
$effect(() => {
|
|
17
15
|
$_bodyEl = el;
|
|
18
16
|
});
|
|
@@ -30,14 +28,14 @@
|
|
|
30
28
|
|
|
31
29
|
<div
|
|
32
30
|
bind:this={el}
|
|
33
|
-
class="{$theme.body}
|
|
31
|
+
class="{$theme.body}"
|
|
34
32
|
use:observeResize={() => $_recheckScrollable = true}
|
|
35
33
|
>
|
|
36
34
|
<div class="{$theme.content}">
|
|
37
35
|
<Section {children}>
|
|
38
36
|
{#snippet lines()}
|
|
39
|
-
{#each
|
|
40
|
-
<div class="{$theme.line}"></div>
|
|
37
|
+
{#each $_times as time}
|
|
38
|
+
<div class="{$theme.line}{time[2] ? '' : ' ' + $theme.minor}"></div>
|
|
41
39
|
{/each}
|
|
42
40
|
{/snippet}
|
|
43
41
|
</Section>
|
|
@@ -5,15 +5,20 @@
|
|
|
5
5
|
|
|
6
6
|
let {children, lines} = $props();
|
|
7
7
|
|
|
8
|
-
let {allDayContent, theme, _times} = getContext('state');
|
|
8
|
+
let {allDayContent, slotLabelInterval, theme, _times} = getContext('state');
|
|
9
9
|
|
|
10
10
|
let allDayText = $derived(createAllDayContent($allDayContent));
|
|
11
|
+
let showAllTimes = $derived($slotLabelInterval && $slotLabelInterval.seconds <= 0);
|
|
11
12
|
</script>
|
|
12
13
|
|
|
13
14
|
<div class="{$theme.sidebar}">
|
|
14
15
|
<div class="{$theme.sidebarTitle}" use:setContent={allDayText}></div>
|
|
15
|
-
{#each $_times as time}
|
|
16
|
-
<time
|
|
16
|
+
{#each $_times as time, i}
|
|
17
|
+
<time
|
|
18
|
+
class="{$theme.time}{(i || showAllTimes) && time[2] ? '' : ' ' + $theme.minor}"
|
|
19
|
+
datetime="{time[0]}"
|
|
20
|
+
use:setContent={time[1]}
|
|
21
|
+
></time>
|
|
17
22
|
{/each}
|
|
18
23
|
</div>
|
|
19
24
|
<div class="{$theme.days}" role="row">
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
|
-
import {setContent, toISOString} from '#lib';
|
|
3
|
+
import {datesEqual, setContent, toISOString} from '#lib';
|
|
4
4
|
import Section from './Section.svelte';
|
|
5
5
|
import Body from './Body.svelte';
|
|
6
6
|
import Day from './Day.svelte';
|
|
7
7
|
import Week from './all-day/Week.svelte';
|
|
8
8
|
|
|
9
|
-
let {_viewDates, _intlDayHeader, _intlDayHeaderAL, allDaySlot, theme} = getContext('state');
|
|
9
|
+
let {_viewDates, _intlDayHeader, _intlDayHeaderAL, _today, allDaySlot, theme} = getContext('state');
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<div class="{$theme.header}">
|
|
13
13
|
<Section>
|
|
14
14
|
{#each $_viewDates as date}
|
|
15
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
class="{$theme.day} {$theme.weekdays?.[date.getUTCDay()]}{datesEqual(date, $_today) ? ' ' + $theme.today : ''}"
|
|
17
|
+
role="columnheader"
|
|
18
|
+
>
|
|
16
19
|
<time
|
|
17
20
|
datetime="{toISOString(date, 10)}"
|
|
18
21
|
aria-label="{$_intlDayHeaderAL.format(date)}"
|
package/src/storage/options.js
CHANGED
|
@@ -79,7 +79,6 @@ export function createOptions(plugins) {
|
|
|
79
79
|
button: 'ec-button',
|
|
80
80
|
buttonGroup: 'ec-button-group',
|
|
81
81
|
calendar: 'ec',
|
|
82
|
-
compact: 'ec-compact',
|
|
83
82
|
content: 'ec-content',
|
|
84
83
|
day: 'ec-day',
|
|
85
84
|
dayHead: 'ec-day-head',
|
|
@@ -98,6 +97,7 @@ export function createOptions(plugins) {
|
|
|
98
97
|
icon: 'ec-icon',
|
|
99
98
|
line: 'ec-line',
|
|
100
99
|
lines: 'ec-lines',
|
|
100
|
+
minor: 'ec-minor',
|
|
101
101
|
nowIndicator: 'ec-now-indicator',
|
|
102
102
|
otherMonth: 'ec-other-month',
|
|
103
103
|
resource: 'ec-resource',
|
package/src/styles/index.scss
CHANGED
|
@@ -284,6 +284,13 @@
|
|
|
284
284
|
top: 0;
|
|
285
285
|
z-index: 2;
|
|
286
286
|
}
|
|
287
|
+
.ec-day.ec-today .ec-day-head:before {
|
|
288
|
+
content: '';
|
|
289
|
+
position: absolute;
|
|
290
|
+
inset: 0;
|
|
291
|
+
z-index: -1;
|
|
292
|
+
background-color: var(--ec-today-bg-color);
|
|
293
|
+
}
|
|
287
294
|
|
|
288
295
|
.ec-day:first-child .ec-day-head {
|
|
289
296
|
border-top: none;
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
line-height: 24px;
|
|
35
35
|
top: -12px;
|
|
36
36
|
text-align: right;
|
|
37
|
+
|
|
38
|
+
&.ec-minor {
|
|
39
|
+
visibility: hidden;
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
.ec-header .ec-time ,
|
|
@@ -60,7 +64,7 @@
|
|
|
60
64
|
pointer-events: none;
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
.ec-
|
|
67
|
+
.ec-line.ec-minor:after {
|
|
64
68
|
border-bottom-style: dotted;
|
|
65
69
|
}
|
|
66
70
|
|
package/src/styles/timeline.scss
CHANGED
|
@@ -74,6 +74,10 @@
|
|
|
74
74
|
min-height: 24px;
|
|
75
75
|
overflow: hidden;
|
|
76
76
|
text-overflow: ellipsis;
|
|
77
|
+
|
|
78
|
+
&.ec-minor {
|
|
79
|
+
visibility: hidden;
|
|
80
|
+
}
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
.ec-time, .ec-line {
|
|
@@ -107,9 +111,9 @@
|
|
|
107
111
|
pointer-events: none;
|
|
108
112
|
}
|
|
109
113
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
.ec-line.ec-minor:after {
|
|
115
|
+
border-left-style: dotted;
|
|
116
|
+
}
|
|
113
117
|
|
|
114
118
|
.ec-sidebar {
|
|
115
119
|
padding: 0;
|