@event-calendar/core 5.1.3 → 5.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 +46 -13
- package/dist/index.css +11 -5
- package/dist/index.js +229 -151
- package/package.json +1 -1
- package/src/Calendar.svelte +8 -2
- package/src/lib/chunks.js +25 -9
- package/src/lib/date.js +4 -2
- package/src/lib/utils.js +12 -4
- package/src/plugins/day-grid/Day.svelte +7 -5
- package/src/plugins/day-grid/Event.svelte +3 -3
- package/src/plugins/day-grid/Popup.svelte +1 -2
- package/src/plugins/day-grid/View.svelte +10 -8
- package/src/plugins/day-grid/derived.js +2 -2
- package/src/plugins/day-grid/index.js +20 -4
- package/src/plugins/list/Day.svelte +1 -1
- package/src/plugins/resource-timeline/View.svelte +25 -16
- package/src/plugins/resource-timeline/derived.js +5 -3
- package/src/plugins/resource-timeline/lib.js +25 -11
- package/src/plugins/resource-timeline/state.svelte.js +1 -1
- package/src/plugins/time-grid/View.svelte +4 -4
- package/src/storage/derived.js +5 -7
- package/src/storage/effects.js +1 -1
- package/src/styles/days.css +4 -1
- package/src/styles/popup.css +6 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* EventCalendar v5.
|
|
2
|
+
* EventCalendar v5.2.0
|
|
3
3
|
* https://github.com/vkurko/calendar
|
|
4
4
|
*/
|
|
5
5
|
import { untrack, getAbortSignal, tick, getContext, setContext, onMount, mount, unmount } from "svelte";
|
|
@@ -63,10 +63,70 @@ function intersectionObserver(callback, options) {
|
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
+
function assign(...args) {
|
|
67
|
+
return Object.assign(...args);
|
|
68
|
+
}
|
|
69
|
+
function keys(object) {
|
|
70
|
+
return Object.keys(object);
|
|
71
|
+
}
|
|
72
|
+
function entries(object) {
|
|
73
|
+
return Object.entries(object);
|
|
74
|
+
}
|
|
75
|
+
function floor(value) {
|
|
76
|
+
return Math.floor(value);
|
|
77
|
+
}
|
|
78
|
+
function ceil(value) {
|
|
79
|
+
return Math.ceil(value);
|
|
80
|
+
}
|
|
81
|
+
function min(...args) {
|
|
82
|
+
return Math.min(...args);
|
|
83
|
+
}
|
|
84
|
+
function max(...args) {
|
|
85
|
+
return Math.max(...args);
|
|
86
|
+
}
|
|
87
|
+
function symbol() {
|
|
88
|
+
return /* @__PURE__ */ Symbol("ec");
|
|
89
|
+
}
|
|
90
|
+
function isArray(value) {
|
|
91
|
+
return Array.isArray(value);
|
|
92
|
+
}
|
|
93
|
+
function isFunction(value) {
|
|
94
|
+
return typeof value === "function";
|
|
95
|
+
}
|
|
96
|
+
function isPlainObject(value) {
|
|
97
|
+
if (typeof value !== "object" || value === null) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const prototype = Object.getPrototypeOf(value);
|
|
101
|
+
return prototype === null || prototype === Object.prototype;
|
|
102
|
+
}
|
|
103
|
+
function isDate(value) {
|
|
104
|
+
return value instanceof Date;
|
|
105
|
+
}
|
|
106
|
+
function run(fn) {
|
|
107
|
+
return fn();
|
|
108
|
+
}
|
|
109
|
+
function runAll(fns) {
|
|
110
|
+
fns.forEach(run);
|
|
111
|
+
}
|
|
112
|
+
function noop() {
|
|
113
|
+
}
|
|
114
|
+
const identity = (x) => x;
|
|
115
|
+
function stopPropagation(fn, _this = void 0) {
|
|
116
|
+
return function(event) {
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
if (fn) {
|
|
119
|
+
fn.call(_this, event);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function isRtl() {
|
|
124
|
+
return window.getComputedStyle(document.documentElement).direction === "rtl";
|
|
125
|
+
}
|
|
66
126
|
const DAY_IN_SECONDS = 86400;
|
|
67
127
|
function createDate(input = void 0) {
|
|
68
128
|
if (input !== void 0) {
|
|
69
|
-
return input
|
|
129
|
+
return isDate(input) ? _fromLocalDate(input) : _fromISOString(input);
|
|
70
130
|
}
|
|
71
131
|
return _fromLocalDate(/* @__PURE__ */ new Date());
|
|
72
132
|
}
|
|
@@ -79,7 +139,7 @@ function createDuration(input) {
|
|
|
79
139
|
seconds += parseInt(part, 10) * Math.pow(60, exp--);
|
|
80
140
|
}
|
|
81
141
|
input = { seconds };
|
|
82
|
-
} else if (input
|
|
142
|
+
} else if (isDate(input)) {
|
|
83
143
|
input = { hours: input.getUTCHours(), minutes: input.getUTCMinutes(), seconds: input.getUTCSeconds() };
|
|
84
144
|
}
|
|
85
145
|
let weeks = input.weeks || input.week || 0;
|
|
@@ -203,56 +263,6 @@ function _fromISOString(str) {
|
|
|
203
263
|
Number(parts[5] || 0)
|
|
204
264
|
));
|
|
205
265
|
}
|
|
206
|
-
function assign(...args) {
|
|
207
|
-
return Object.assign(...args);
|
|
208
|
-
}
|
|
209
|
-
function keys(object) {
|
|
210
|
-
return Object.keys(object);
|
|
211
|
-
}
|
|
212
|
-
function entries(object) {
|
|
213
|
-
return Object.entries(object);
|
|
214
|
-
}
|
|
215
|
-
function floor(value) {
|
|
216
|
-
return Math.floor(value);
|
|
217
|
-
}
|
|
218
|
-
function ceil(value) {
|
|
219
|
-
return Math.ceil(value);
|
|
220
|
-
}
|
|
221
|
-
function min(...args) {
|
|
222
|
-
return Math.min(...args);
|
|
223
|
-
}
|
|
224
|
-
function max(...args) {
|
|
225
|
-
return Math.max(...args);
|
|
226
|
-
}
|
|
227
|
-
function symbol() {
|
|
228
|
-
return /* @__PURE__ */ Symbol("ec");
|
|
229
|
-
}
|
|
230
|
-
function isArray(value) {
|
|
231
|
-
return Array.isArray(value);
|
|
232
|
-
}
|
|
233
|
-
function isFunction(value) {
|
|
234
|
-
return typeof value === "function";
|
|
235
|
-
}
|
|
236
|
-
function run(fn) {
|
|
237
|
-
return fn();
|
|
238
|
-
}
|
|
239
|
-
function runAll(fns) {
|
|
240
|
-
fns.forEach(run);
|
|
241
|
-
}
|
|
242
|
-
function noop() {
|
|
243
|
-
}
|
|
244
|
-
const identity = (x) => x;
|
|
245
|
-
function stopPropagation(fn, _this = void 0) {
|
|
246
|
-
return function(event) {
|
|
247
|
-
event.stopPropagation();
|
|
248
|
-
if (fn) {
|
|
249
|
-
fn.call(_this, event);
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
function isRtl() {
|
|
254
|
-
return window.getComputedStyle(document.documentElement).direction === "rtl";
|
|
255
|
-
}
|
|
256
266
|
let payloadProp = symbol();
|
|
257
267
|
function setPayload(obj, payload) {
|
|
258
268
|
obj[payloadProp] = payload;
|
|
@@ -463,14 +473,27 @@ function ghostEvent(display) {
|
|
|
463
473
|
function pointerEvent(display) {
|
|
464
474
|
return display === "pointer";
|
|
465
475
|
}
|
|
476
|
+
const ids = /* @__PURE__ */ new WeakMap();
|
|
477
|
+
let idCounter = 1;
|
|
466
478
|
function createEventChunk(event, start, end) {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
479
|
+
start = event.start > start ? event.start : start;
|
|
480
|
+
end = event.end < end ? event.end : end;
|
|
481
|
+
return {
|
|
482
|
+
start,
|
|
483
|
+
end,
|
|
484
|
+
event,
|
|
485
|
+
get id() {
|
|
486
|
+
let id = ids.get(event);
|
|
487
|
+
if (!id) {
|
|
488
|
+
id = idCounter++;
|
|
489
|
+
ids.set(event, id);
|
|
490
|
+
}
|
|
491
|
+
delete this.id;
|
|
492
|
+
this.id = `${id}-${start.getTime()}`;
|
|
493
|
+
return this.id;
|
|
494
|
+
},
|
|
495
|
+
zeroDuration: datesEqual(start, end)
|
|
471
496
|
};
|
|
472
|
-
chunk.zeroDuration = datesEqual(chunk.start, chunk.end);
|
|
473
|
-
return chunk;
|
|
474
497
|
}
|
|
475
498
|
function createAllDayChunks(event, days) {
|
|
476
499
|
let dates = [];
|
|
@@ -516,7 +539,7 @@ function prepareAllDayChunks(chunks) {
|
|
|
516
539
|
prevChunks[key] = chunk;
|
|
517
540
|
}
|
|
518
541
|
}
|
|
519
|
-
function repositionEvent$1(chunk, height2, top =
|
|
542
|
+
function repositionEvent$1(chunk, height2, top = 1) {
|
|
520
543
|
if (chunk.prev) {
|
|
521
544
|
top = chunk.prev.bottom + 1;
|
|
522
545
|
}
|
|
@@ -1065,7 +1088,7 @@ function runEventAllUpdated(mainState) {
|
|
|
1065
1088
|
}
|
|
1066
1089
|
function runViewDidMount(mainState) {
|
|
1067
1090
|
return () => {
|
|
1068
|
-
let {
|
|
1091
|
+
let { options: { view: view2, viewDidMount } } = mainState;
|
|
1069
1092
|
untrack(() => {
|
|
1070
1093
|
if (isFunction(viewDidMount)) {
|
|
1071
1094
|
tick().then(() => viewDidMount({
|
|
@@ -1138,8 +1161,8 @@ function viewDates(mainState) {
|
|
|
1138
1161
|
let { hiddenDays } = options;
|
|
1139
1162
|
let dates = [];
|
|
1140
1163
|
untrack(() => {
|
|
1141
|
-
let date =
|
|
1142
|
-
let end =
|
|
1164
|
+
let date = cloneDate(activeRange2.start);
|
|
1165
|
+
let end = cloneDate(activeRange2.end);
|
|
1143
1166
|
while (date < end) {
|
|
1144
1167
|
if (!hiddenDays.includes(date.getUTCDay())) {
|
|
1145
1168
|
dates.push(cloneDate(date));
|
|
@@ -1157,10 +1180,10 @@ function viewDates(mainState) {
|
|
|
1157
1180
|
}
|
|
1158
1181
|
function viewTitle(mainState) {
|
|
1159
1182
|
return () => {
|
|
1160
|
-
let {
|
|
1183
|
+
let { currentRange: currentRange2, intlTitle } = mainState;
|
|
1161
1184
|
let title;
|
|
1162
1185
|
untrack(() => {
|
|
1163
|
-
title =
|
|
1186
|
+
title = intlTitle.formatRange(currentRange2.start, subtractDay(cloneDate(currentRange2.end)));
|
|
1164
1187
|
});
|
|
1165
1188
|
return title;
|
|
1166
1189
|
};
|
|
@@ -1381,7 +1404,7 @@ class State {
|
|
|
1381
1404
|
}
|
|
1382
1405
|
}
|
|
1383
1406
|
var root_2$4 = $.from_html(`<h2></h2>`);
|
|
1384
|
-
var root_4 = $.from_html(`<button><i></i></button>`);
|
|
1407
|
+
var root_4$1 = $.from_html(`<button><i></i></button>`);
|
|
1385
1408
|
var root_6$1 = $.from_html(`<button><i></i></button>`);
|
|
1386
1409
|
var root_8 = $.from_html(`<button> </button>`);
|
|
1387
1410
|
var root_10 = $.from_html(`<button></button>`);
|
|
@@ -1456,7 +1479,7 @@ function Buttons($$anchor, $$props) {
|
|
|
1456
1479
|
var node_2 = $.first_child(fragment_2);
|
|
1457
1480
|
{
|
|
1458
1481
|
var consequent_1 = ($$anchor4) => {
|
|
1459
|
-
var button_1 = root_4();
|
|
1482
|
+
var button_1 = root_4$1();
|
|
1460
1483
|
button_1.__click = prev;
|
|
1461
1484
|
var i = $.child(button_1);
|
|
1462
1485
|
$.reset(button_1);
|
|
@@ -1676,12 +1699,18 @@ function Calendar($$anchor, $$props) {
|
|
|
1676
1699
|
assign(prevOptions, options());
|
|
1677
1700
|
});
|
|
1678
1701
|
function setOption(name, value) {
|
|
1702
|
+
if (isPlainObject(value)) {
|
|
1703
|
+
value = { ...value };
|
|
1704
|
+
}
|
|
1705
|
+
if (isArray(value)) {
|
|
1706
|
+
value = [...value];
|
|
1707
|
+
}
|
|
1679
1708
|
mainState.setOption(name, value, false);
|
|
1680
1709
|
return this;
|
|
1681
1710
|
}
|
|
1682
1711
|
function getOption(name) {
|
|
1683
1712
|
let value = mainState.options[name];
|
|
1684
|
-
return value
|
|
1713
|
+
return isDate(value) ? toLocalDate(value) : value;
|
|
1685
1714
|
}
|
|
1686
1715
|
function refetchEvents() {
|
|
1687
1716
|
mainState.fetchedRange = { start: void 0, end: void 0 };
|
|
@@ -1809,9 +1838,9 @@ function Calendar($$anchor, $$props) {
|
|
|
1809
1838
|
}
|
|
1810
1839
|
function colsCount(mainState) {
|
|
1811
1840
|
return () => {
|
|
1812
|
-
let { options: { hiddenDays } } = mainState;
|
|
1841
|
+
let { viewDates: viewDates2, options: { duration, hiddenDays } } = mainState;
|
|
1813
1842
|
let count;
|
|
1814
|
-
untrack(() => count = 7 - hiddenDays.length);
|
|
1843
|
+
untrack(() => count = duration.months || duration.inWeeks ? 7 - hiddenDays.length : viewDates2.length);
|
|
1815
1844
|
return count;
|
|
1816
1845
|
};
|
|
1817
1846
|
}
|
|
@@ -2232,16 +2261,17 @@ function InteractableEvent($$anchor, $$props) {
|
|
|
2232
2261
|
}
|
|
2233
2262
|
$.pop();
|
|
2234
2263
|
}
|
|
2235
|
-
var root_2$3 = $.from_html(`<
|
|
2236
|
-
var root_3 = $.from_html(`<
|
|
2237
|
-
var
|
|
2264
|
+
var root_2$3 = $.from_html(`<time></time>`);
|
|
2265
|
+
var root_3 = $.from_html(`<span></span>`);
|
|
2266
|
+
var root_4 = $.from_html(`<a role="button" tabindex="0" aria-haspopup="dialog"></a>`);
|
|
2267
|
+
var root_1$8 = $.from_html(`<div><!> <!></div> <div><!></div>`, 1);
|
|
2238
2268
|
function Day$3($$anchor, $$props) {
|
|
2239
2269
|
$.push($$props, true);
|
|
2240
2270
|
const $firstDay = () => $.store_get($.get(firstDay), "$firstDay", $$stores);
|
|
2241
2271
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
2242
2272
|
let mainState = getContext("state");
|
|
2243
2273
|
let viewState = getContext("view-state");
|
|
2244
|
-
let date = $.derived(() => mainState.options.date), firstDay = $.derived(() => mainState.options.firstDay), moreLinkContent = $.derived(() => mainState.options.moreLinkContent), theme = $.derived(() => mainState.options.theme), weekNumbers = $.derived(() => mainState.options.weekNumbers), weekNumberContent = $.derived(() => mainState.options.weekNumberContent);
|
|
2274
|
+
let features = $.derived(() => mainState.features), date = $.derived(() => mainState.options.date), firstDay = $.derived(() => mainState.options.firstDay), moreLinkContent = $.derived(() => mainState.options.moreLinkContent), theme = $.derived(() => mainState.options.theme), weekNumbers = $.derived(() => mainState.options.weekNumbers), weekNumberContent = $.derived(() => mainState.options.weekNumberContent);
|
|
2245
2275
|
let hiddenChunks = $.derived(() => viewState.hiddenChunks), intlDayCell = $.derived(() => viewState.intlDayCell);
|
|
2246
2276
|
let dayStart = $.derived(() => $$props.day.dayStart), disabled = $.derived(() => $$props.day.disabled), highlight = $.derived(() => $$props.day.highlight);
|
|
2247
2277
|
let otherMonth = $.derived(() => $.get(dayStart).getUTCMonth() !== $.get(date).getUTCMonth());
|
|
@@ -2298,26 +2328,36 @@ function Day$3($$anchor, $$props) {
|
|
|
2298
2328
|
children: ($$anchor2, $$slotProps) => {
|
|
2299
2329
|
var fragment_1 = root_1$8();
|
|
2300
2330
|
var div = $.first_child(fragment_1);
|
|
2301
|
-
var
|
|
2302
|
-
$.attach(time, () => contentFrom($.get(intlDayCell).format($.get(dayStart))));
|
|
2303
|
-
var node = $.sibling(time, 2);
|
|
2331
|
+
var node = $.child(div);
|
|
2304
2332
|
{
|
|
2305
2333
|
var consequent = ($$anchor3) => {
|
|
2306
|
-
var
|
|
2334
|
+
var time = root_2$3();
|
|
2335
|
+
$.attach(time, () => contentFrom($.get(intlDayCell).format($.get(dayStart))));
|
|
2336
|
+
$.template_effect(($0) => $.set_attribute(time, "datetime", $0), [() => toISOString($.get(dayStart), 10)]);
|
|
2337
|
+
$.append($$anchor3, time);
|
|
2338
|
+
};
|
|
2339
|
+
$.if(node, ($$render) => {
|
|
2340
|
+
if ($.get(features).includes("dayNumber")) $$render(consequent);
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
var node_1 = $.sibling(node, 2);
|
|
2344
|
+
{
|
|
2345
|
+
var consequent_1 = ($$anchor3) => {
|
|
2346
|
+
var span = root_3();
|
|
2307
2347
|
$.attach(span, () => contentFrom($.get(weekNumber)));
|
|
2308
2348
|
$.template_effect(() => $.set_class(span, 1, $.get(theme).weekNumber));
|
|
2309
2349
|
$.append($$anchor3, span);
|
|
2310
2350
|
};
|
|
2311
|
-
$.if(
|
|
2312
|
-
if ($.get(showWeekNumber)) $$render(
|
|
2351
|
+
$.if(node_1, ($$render) => {
|
|
2352
|
+
if ($.get(showWeekNumber)) $$render(consequent_1);
|
|
2313
2353
|
});
|
|
2314
2354
|
}
|
|
2315
2355
|
$.reset(div);
|
|
2316
2356
|
var div_1 = $.sibling(div, 2);
|
|
2317
|
-
var
|
|
2357
|
+
var node_2 = $.child(div_1);
|
|
2318
2358
|
{
|
|
2319
|
-
var
|
|
2320
|
-
var a =
|
|
2359
|
+
var consequent_2 = ($$anchor3) => {
|
|
2360
|
+
var a = root_4();
|
|
2321
2361
|
var event_handler = $.derived(() => stopPropagation(showMore));
|
|
2322
2362
|
a.__click = function(...$$args) {
|
|
2323
2363
|
$.get(event_handler)?.apply(this, $$args);
|
|
@@ -2333,19 +2373,15 @@ function Day$3($$anchor, $$props) {
|
|
|
2333
2373
|
$.attach(a, () => contentFrom($.get(moreLink)));
|
|
2334
2374
|
$.append($$anchor3, a);
|
|
2335
2375
|
};
|
|
2336
|
-
$.if(
|
|
2337
|
-
if ($.get(dayHiddenChunks)) $$render(
|
|
2376
|
+
$.if(node_2, ($$render) => {
|
|
2377
|
+
if ($.get(dayHiddenChunks)) $$render(consequent_2);
|
|
2338
2378
|
});
|
|
2339
2379
|
}
|
|
2340
2380
|
$.reset(div_1);
|
|
2341
|
-
$.template_effect(
|
|
2342
|
-
(
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
$.set_class(div_1, 1, $.get(theme).dayFoot);
|
|
2346
|
-
},
|
|
2347
|
-
[() => toISOString($.get(dayStart), 10)]
|
|
2348
|
-
);
|
|
2381
|
+
$.template_effect(() => {
|
|
2382
|
+
$.set_class(div, 1, $.get(theme).dayHead);
|
|
2383
|
+
$.set_class(div_1, 1, $.get(theme).dayFoot);
|
|
2384
|
+
});
|
|
2349
2385
|
$.append($$anchor2, fragment_1);
|
|
2350
2386
|
},
|
|
2351
2387
|
$$slots: { default: true }
|
|
@@ -2360,14 +2396,14 @@ function Event$3($$anchor, $$props) {
|
|
|
2360
2396
|
let $$d = $.derived(() => getContext("state")), dayMaxEvents = $.derived(() => $.get($$d).options.dayMaxEvents);
|
|
2361
2397
|
let $$d_1 = $.derived(() => getContext("view-state")), colsCount2 = $.derived(() => $.get($$d_1).colsCount), gridEl = $.derived(() => $.get($$d_1).gridEl), hiddenChunks = $.derived(() => $.get($$d_1).hiddenChunks), popupDay = $.derived(() => $.get($$d_1).popupDay);
|
|
2362
2398
|
let el = $.state(void 0);
|
|
2363
|
-
let margin = $.state(
|
|
2399
|
+
let margin = $.state(1);
|
|
2364
2400
|
let hidden = $.state(false);
|
|
2365
2401
|
let event = $.derived(() => $$props.chunk.event);
|
|
2366
2402
|
let display = $.derived(() => $$props.chunk.event.display);
|
|
2367
2403
|
let dayEl = $.derived(() => $.get(gridEl).children.item(($$props.chunk.gridRow - 1) * $.get(colsCount2) + $$props.chunk.gridColumn - 1));
|
|
2368
2404
|
$.user_effect(() => {
|
|
2369
2405
|
if (!inPopup()) {
|
|
2370
|
-
$.set(margin, height($.get(dayEl).firstElementChild), true);
|
|
2406
|
+
$.set(margin, height($.get(dayEl).firstElementChild) || 1, true);
|
|
2371
2407
|
}
|
|
2372
2408
|
});
|
|
2373
2409
|
let styles = $.derived(() => (style) => {
|
|
@@ -2389,7 +2425,7 @@ function Event$3($$anchor, $$props) {
|
|
|
2389
2425
|
return style;
|
|
2390
2426
|
});
|
|
2391
2427
|
function reposition() {
|
|
2392
|
-
$.set(margin, repositionEvent$1($$props.chunk, height($.get(el)), height($.get(dayEl).firstElementChild)), true);
|
|
2428
|
+
$.set(margin, repositionEvent$1($$props.chunk, height($.get(el)), height($.get(dayEl).firstElementChild) || 1), true);
|
|
2393
2429
|
}
|
|
2394
2430
|
function hide() {
|
|
2395
2431
|
if ($.get(dayMaxEvents) === true) {
|
|
@@ -2506,8 +2542,7 @@ function Popup($$anchor, $$props) {
|
|
|
2506
2542
|
let top;
|
|
2507
2543
|
if (popupRect.height >= gridRect.height) {
|
|
2508
2544
|
top = gridRect.top - dayRect.top;
|
|
2509
|
-
|
|
2510
|
-
$.set(style, $.get(style) + `inset-block-end:${bottom}px;`);
|
|
2545
|
+
$.set(style, $.get(style) + `block-size:${gridRect.height}px;`);
|
|
2511
2546
|
} else {
|
|
2512
2547
|
top = (dayRect.height - popupRect.height) / 2;
|
|
2513
2548
|
if (dayRect.top + top < gridRect.top) {
|
|
@@ -2582,14 +2617,16 @@ function View$3($$anchor, $$props) {
|
|
|
2582
2617
|
let grid2 = $.derived(() => viewState.grid), chunks = $.derived(() => viewState.chunks), bgChunks = $.derived(() => viewState.bgChunks), iChunks = $.derived(() => viewState.iChunks), hiddenChunks = $.derived(() => viewState.hiddenChunks), popupDay = $.derived(() => viewState.popupDay);
|
|
2583
2618
|
let refs = [];
|
|
2584
2619
|
function reposition() {
|
|
2585
|
-
$.get(hiddenChunks).clear();
|
|
2586
2620
|
runReposition(refs, $.get(chunks));
|
|
2621
|
+
$.get(hiddenChunks).clear();
|
|
2622
|
+
tick().then(hide);
|
|
2587
2623
|
}
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
$.get(chunks);
|
|
2624
|
+
function hide() {
|
|
2625
|
+
$.get(hiddenChunks).size;
|
|
2591
2626
|
refs.forEach((ref) => ref.hide());
|
|
2592
|
-
}
|
|
2627
|
+
}
|
|
2628
|
+
$.user_effect(reposition);
|
|
2629
|
+
$.user_effect(hide);
|
|
2593
2630
|
var section = root$7();
|
|
2594
2631
|
let styles;
|
|
2595
2632
|
var header = $.child(section);
|
|
@@ -2646,7 +2683,7 @@ function View$3($$anchor, $$props) {
|
|
|
2646
2683
|
$.bind_this(div_3, ($$value) => viewState.gridEl = $$value, () => viewState?.gridEl);
|
|
2647
2684
|
var div_4 = $.sibling(div_3, 2);
|
|
2648
2685
|
var node_1 = $.child(div_4);
|
|
2649
|
-
$.each(node_1,
|
|
2686
|
+
$.each(node_1, 19, () => $.get(chunks), (chunk) => chunk.id, ($$anchor2, chunk, i) => {
|
|
2650
2687
|
$.bind_this(
|
|
2651
2688
|
Event$3($$anchor2, {
|
|
2652
2689
|
get chunk() {
|
|
@@ -2655,11 +2692,11 @@ function View$3($$anchor, $$props) {
|
|
|
2655
2692
|
}),
|
|
2656
2693
|
($$value, i2) => refs[i2] = $$value,
|
|
2657
2694
|
(i2) => refs?.[i2],
|
|
2658
|
-
() => [i]
|
|
2695
|
+
() => [$.get(i)]
|
|
2659
2696
|
);
|
|
2660
2697
|
});
|
|
2661
2698
|
var node_2 = $.sibling(node_1, 2);
|
|
2662
|
-
$.each(node_2, 17, () => $.get(bgChunks),
|
|
2699
|
+
$.each(node_2, 17, () => $.get(bgChunks), (chunk) => chunk.id, ($$anchor2, chunk) => {
|
|
2663
2700
|
Event$3($$anchor2, {
|
|
2664
2701
|
get chunk() {
|
|
2665
2702
|
return $.get(chunk);
|
|
@@ -2719,7 +2756,9 @@ const index$5 = {
|
|
|
2719
2756
|
view: "dayGridMonth"
|
|
2720
2757
|
});
|
|
2721
2758
|
assign(options.buttonText, {
|
|
2759
|
+
dayGridDay: "day",
|
|
2722
2760
|
dayGridMonth: "month",
|
|
2761
|
+
dayGridWeek: "week",
|
|
2723
2762
|
close: "Close"
|
|
2724
2763
|
});
|
|
2725
2764
|
assign(options.theme, {
|
|
@@ -2730,9 +2769,23 @@ const index$5 = {
|
|
|
2730
2769
|
weekNumber: "ec-week-number"
|
|
2731
2770
|
});
|
|
2732
2771
|
assign(options.views, {
|
|
2772
|
+
dayGridDay: {
|
|
2773
|
+
buttonText: btnTextDay,
|
|
2774
|
+
component: () => View$3,
|
|
2775
|
+
dayHeaderFormat: { weekday: "long" },
|
|
2776
|
+
displayEventEnd: false,
|
|
2777
|
+
duration: { days: 1 },
|
|
2778
|
+
theme: themeView("ec-day-grid ec-day-view")
|
|
2779
|
+
},
|
|
2780
|
+
dayGridWeek: {
|
|
2781
|
+
buttonText: btnTextWeek,
|
|
2782
|
+
component: () => View$3,
|
|
2783
|
+
displayEventEnd: false,
|
|
2784
|
+
theme: themeView("ec-day-grid ec-week-view")
|
|
2785
|
+
},
|
|
2733
2786
|
dayGridMonth: {
|
|
2734
2787
|
buttonText: btnTextMonth,
|
|
2735
|
-
component:
|
|
2788
|
+
component: initMonthViewComponent$1,
|
|
2736
2789
|
dayHeaderFormat: { weekday: "short" },
|
|
2737
2790
|
dayHeaderAriaLabelFormat: { weekday: "long" },
|
|
2738
2791
|
displayEventEnd: false,
|
|
@@ -2743,8 +2796,8 @@ const index$5 = {
|
|
|
2743
2796
|
});
|
|
2744
2797
|
}
|
|
2745
2798
|
};
|
|
2746
|
-
function
|
|
2747
|
-
mainState.features = ["
|
|
2799
|
+
function initMonthViewComponent$1(mainState) {
|
|
2800
|
+
mainState.features = ["dayNumber"];
|
|
2748
2801
|
mainState.extensions.activeRange = (start, end) => {
|
|
2749
2802
|
let { options: { firstDay } } = mainState;
|
|
2750
2803
|
return {
|
|
@@ -3622,7 +3675,7 @@ function Day$2($$anchor, $$props) {
|
|
|
3622
3675
|
$.attach(time_1, () => contentFrom($.get(intlListDaySide).format($$props.date)));
|
|
3623
3676
|
$.reset(h4);
|
|
3624
3677
|
var node_1 = $.sibling(h4, 2);
|
|
3625
|
-
$.each(node_1, 17, () => $.get(chunks), (chunk) => chunk.
|
|
3678
|
+
$.each(node_1, 17, () => $.get(chunks), (chunk) => chunk.id, ($$anchor4, chunk) => {
|
|
3626
3679
|
Event$2($$anchor4, {
|
|
3627
3680
|
get chunk() {
|
|
3628
3681
|
return $.get(chunk);
|
|
@@ -4547,7 +4600,7 @@ function View$1($$anchor, $$props) {
|
|
|
4547
4600
|
$.reset(div_2);
|
|
4548
4601
|
var div_3 = $.sibling(div_2, 2);
|
|
4549
4602
|
var node_5 = $.child(div_3);
|
|
4550
|
-
$.each(node_5,
|
|
4603
|
+
$.each(node_5, 19, () => $.get(allDayChunks), (chunk) => chunk.id, ($$anchor3, chunk, i) => {
|
|
4551
4604
|
$.bind_this(
|
|
4552
4605
|
AllDayEvent($$anchor3, {
|
|
4553
4606
|
get chunk() {
|
|
@@ -4556,11 +4609,11 @@ function View$1($$anchor, $$props) {
|
|
|
4556
4609
|
}),
|
|
4557
4610
|
($$value, i2) => refs[i2] = $$value,
|
|
4558
4611
|
(i2) => refs?.[i2],
|
|
4559
|
-
() => [i]
|
|
4612
|
+
() => [$.get(i)]
|
|
4560
4613
|
);
|
|
4561
4614
|
});
|
|
4562
4615
|
var node_6 = $.sibling(node_5, 2);
|
|
4563
|
-
$.each(node_6, 17, () => $.get(allDayBgChunks),
|
|
4616
|
+
$.each(node_6, 17, () => $.get(allDayBgChunks), (chunk) => chunk.id, ($$anchor3, chunk) => {
|
|
4564
4617
|
AllDayEvent($$anchor3, {
|
|
4565
4618
|
get chunk() {
|
|
4566
4619
|
return $.get(chunk);
|
|
@@ -4629,7 +4682,7 @@ function View$1($$anchor, $$props) {
|
|
|
4629
4682
|
$.reset(div_6);
|
|
4630
4683
|
var div_7 = $.sibling(div_6, 2);
|
|
4631
4684
|
var node_9 = $.child(div_7);
|
|
4632
|
-
$.each(node_9, 17, () => $.get(chunks),
|
|
4685
|
+
$.each(node_9, 17, () => $.get(chunks), (chunk) => chunk.id, ($$anchor2, chunk) => {
|
|
4633
4686
|
Event$1($$anchor2, {
|
|
4634
4687
|
get chunk() {
|
|
4635
4688
|
return $.get(chunk);
|
|
@@ -4637,7 +4690,7 @@ function View$1($$anchor, $$props) {
|
|
|
4637
4690
|
});
|
|
4638
4691
|
});
|
|
4639
4692
|
var node_10 = $.sibling(node_9, 2);
|
|
4640
|
-
$.each(node_10, 17, () => $.get(bgChunks),
|
|
4693
|
+
$.each(node_10, 17, () => $.get(bgChunks), (chunk) => chunk.id, ($$anchor2, chunk) => {
|
|
4641
4694
|
Event$1($$anchor2, {
|
|
4642
4695
|
get chunk() {
|
|
4643
4696
|
return $.get(chunk);
|
|
@@ -4988,7 +5041,7 @@ function initViewComponent$2(mainState) {
|
|
|
4988
5041
|
setExtensions(mainState);
|
|
4989
5042
|
return View_1;
|
|
4990
5043
|
}
|
|
4991
|
-
function createChunks(event, days) {
|
|
5044
|
+
function createChunks(event, days, monthView2) {
|
|
4992
5045
|
let dates = [];
|
|
4993
5046
|
let firstStart;
|
|
4994
5047
|
let lastEnd;
|
|
@@ -4996,17 +5049,31 @@ function createChunks(event, days) {
|
|
|
4996
5049
|
let gridRow;
|
|
4997
5050
|
let left;
|
|
4998
5051
|
let width = 0;
|
|
4999
|
-
for (let { gridColumn: column, gridRow: row, resource, dayStart, start, end, disabled } of days) {
|
|
5000
|
-
if (!disabled
|
|
5001
|
-
if (
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5052
|
+
for (let { gridColumn: column, gridRow: row, resource, dayStart, dayEnd, start, end, disabled } of days) {
|
|
5053
|
+
if (!disabled) {
|
|
5054
|
+
if (monthView2) {
|
|
5055
|
+
if (eventIntersects(event, dayStart, dayEnd, resource)) {
|
|
5056
|
+
if (!dates.length) {
|
|
5057
|
+
firstStart = dayStart;
|
|
5058
|
+
gridColumn = column;
|
|
5059
|
+
gridRow = row;
|
|
5060
|
+
}
|
|
5061
|
+
dates.push(dayStart);
|
|
5062
|
+
lastEnd = end;
|
|
5063
|
+
}
|
|
5064
|
+
} else {
|
|
5065
|
+
if (eventIntersects(event, start, end, resource)) {
|
|
5066
|
+
if (!dates.length) {
|
|
5067
|
+
firstStart = start;
|
|
5068
|
+
gridColumn = column;
|
|
5069
|
+
gridRow = row;
|
|
5070
|
+
left = max(event.start - start, 0) / 1e3;
|
|
5071
|
+
}
|
|
5072
|
+
dates.push(dayStart);
|
|
5073
|
+
lastEnd = end;
|
|
5074
|
+
width += (min(end, event.end) - max(start, event.start)) / 1e3;
|
|
5075
|
+
}
|
|
5006
5076
|
}
|
|
5007
|
-
dates.push(dayStart);
|
|
5008
|
-
lastEnd = end;
|
|
5009
|
-
width += (min(end, event.end) - max(start, event.start)) / 1e3;
|
|
5010
5077
|
}
|
|
5011
5078
|
}
|
|
5012
5079
|
if (dates.length) {
|
|
@@ -5088,16 +5155,18 @@ function grid(mainState, viewState) {
|
|
|
5088
5155
|
function eventChunks(mainState, viewState) {
|
|
5089
5156
|
return () => {
|
|
5090
5157
|
let { filteredEvents: filteredEvents2 } = mainState;
|
|
5091
|
-
let { grid: grid2 } = viewState;
|
|
5158
|
+
let { grid: grid2, monthView: monthView2 } = viewState;
|
|
5092
5159
|
let chunks = [];
|
|
5093
5160
|
let bgChunks = [];
|
|
5094
5161
|
untrack(() => {
|
|
5095
5162
|
for (let event of filteredEvents2) {
|
|
5096
5163
|
for (let days of grid2) {
|
|
5097
5164
|
if (bgEvent(event.display)) {
|
|
5098
|
-
|
|
5165
|
+
if (!monthView2 || event.allDay) {
|
|
5166
|
+
bgChunks = bgChunks.concat(createChunks(event, days, monthView2));
|
|
5167
|
+
}
|
|
5099
5168
|
} else {
|
|
5100
|
-
chunks = chunks.concat(createChunks(event, days));
|
|
5169
|
+
chunks = chunks.concat(createChunks(event, days, monthView2));
|
|
5101
5170
|
}
|
|
5102
5171
|
}
|
|
5103
5172
|
}
|
|
@@ -5198,6 +5267,13 @@ class ViewState5 extends RRState(TRRState()) {
|
|
|
5198
5267
|
set grid(value) {
|
|
5199
5268
|
$.set(this.#grid, value);
|
|
5200
5269
|
}
|
|
5270
|
+
#monthView;
|
|
5271
|
+
get monthView() {
|
|
5272
|
+
return $.get(this.#monthView);
|
|
5273
|
+
}
|
|
5274
|
+
set monthView(value) {
|
|
5275
|
+
$.set(this.#monthView, value);
|
|
5276
|
+
}
|
|
5201
5277
|
#chunks;
|
|
5202
5278
|
get chunks() {
|
|
5203
5279
|
return $.get(this.#chunks);
|
|
@@ -5219,13 +5295,6 @@ class ViewState5 extends RRState(TRRState()) {
|
|
|
5219
5295
|
set iChunks(value) {
|
|
5220
5296
|
$.set(this.#iChunks, value);
|
|
5221
5297
|
}
|
|
5222
|
-
#monthView;
|
|
5223
|
-
get monthView() {
|
|
5224
|
-
return $.get(this.#monthView);
|
|
5225
|
-
}
|
|
5226
|
-
set monthView(value) {
|
|
5227
|
-
$.set(this.#monthView, value);
|
|
5228
|
-
}
|
|
5229
5298
|
#nestedResources;
|
|
5230
5299
|
get nestedResources() {
|
|
5231
5300
|
return $.get(this.#nestedResources);
|
|
@@ -5241,11 +5310,11 @@ class ViewState5 extends RRState(TRRState()) {
|
|
|
5241
5310
|
);
|
|
5242
5311
|
this.#daySlots = $.derived(daySlots(mainState, this));
|
|
5243
5312
|
this.#grid = $.derived(grid(mainState, this));
|
|
5313
|
+
this.#monthView = $.derived(monthView(mainState));
|
|
5244
5314
|
let $$d = $.derived(eventChunks(mainState, this)), chunks = $.derived(() => $.get($$d).chunks), bgChunks = $.derived(() => $.get($$d).bgChunks);
|
|
5245
5315
|
this.#chunks = $.derived(() => $.get(chunks));
|
|
5246
5316
|
this.#bgChunks = $.derived(() => $.get(bgChunks));
|
|
5247
5317
|
this.#iChunks = $.derived(iEventChunks(mainState, this));
|
|
5248
|
-
this.#monthView = $.derived(monthView(mainState));
|
|
5249
5318
|
this.#nestedResources = $.derived(nestedResources(mainState));
|
|
5250
5319
|
}
|
|
5251
5320
|
}
|
|
@@ -5487,21 +5556,30 @@ function View($$anchor, $$props) {
|
|
|
5487
5556
|
tick().then(scrollToTime);
|
|
5488
5557
|
});
|
|
5489
5558
|
function scrollToTime() {
|
|
5490
|
-
if ($.get(monthView2)) {
|
|
5491
|
-
return;
|
|
5492
|
-
}
|
|
5493
5559
|
let scrollLeft = 0;
|
|
5494
5560
|
let todayOutOfView = $.get(today) < $.get(viewDates2)[0] || $.get(today) > $.get(viewDates2).at(-1);
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5561
|
+
if ($.get(monthView2)) {
|
|
5562
|
+
if (!todayOutOfView) {
|
|
5563
|
+
let days = $.get(grid2)[0];
|
|
5564
|
+
for (let day of days) {
|
|
5565
|
+
if (datesEqual(day.dayStart, $.get(today))) {
|
|
5566
|
+
$.get(mainEl).scrollLeft = ($.get(mainEl).scrollWidth - $.get(sidebarWidth)) / days.length * (day.gridColumn - 1) * (isRtl() ? -1 : 1);
|
|
5567
|
+
break;
|
|
5568
|
+
}
|
|
5569
|
+
}
|
|
5570
|
+
}
|
|
5571
|
+
} else {
|
|
5572
|
+
for (let date of $.get(viewDates2)) {
|
|
5573
|
+
let slotTimeLimits2 = getSlotTimeLimits($.get(dayTimeLimits2), date);
|
|
5574
|
+
if (todayOutOfView || datesEqual(date, $.get(today))) {
|
|
5575
|
+
scrollLeft += max(min(toSeconds($.get(scrollTime)), toSeconds(slotTimeLimits2.max)) - toSeconds(slotTimeLimits2.min), 0);
|
|
5576
|
+
break;
|
|
5577
|
+
} else {
|
|
5578
|
+
scrollLeft += toSeconds(slotTimeLimits2.max) - toSeconds(slotTimeLimits2.min);
|
|
5579
|
+
}
|
|
5502
5580
|
}
|
|
5581
|
+
$.get(mainEl).scrollLeft = scrollLeft / toSeconds($.get(slotDuration)) * $.get(slotWidth) * (isRtl() ? -1 : 1);
|
|
5503
5582
|
}
|
|
5504
|
-
$.get(mainEl).scrollLeft = scrollLeft / toSeconds($.get(slotDuration)) * $.get(slotWidth) * (isRtl() ? -1 : 1);
|
|
5505
5583
|
}
|
|
5506
5584
|
let refs = [];
|
|
5507
5585
|
function reposition() {
|
|
@@ -5645,7 +5723,7 @@ function View($$anchor, $$props) {
|
|
|
5645
5723
|
$.reset(div_4);
|
|
5646
5724
|
var div_5 = $.sibling(div_4, 2);
|
|
5647
5725
|
var node_7 = $.child(div_5);
|
|
5648
|
-
$.each(node_7,
|
|
5726
|
+
$.each(node_7, 19, () => $.get(chunks), (chunk) => chunk.id, ($$anchor2, chunk, i) => {
|
|
5649
5727
|
$.bind_this(
|
|
5650
5728
|
Event($$anchor2, {
|
|
5651
5729
|
get chunk() {
|
|
@@ -5654,11 +5732,11 @@ function View($$anchor, $$props) {
|
|
|
5654
5732
|
}),
|
|
5655
5733
|
($$value, i2) => refs[i2] = $$value,
|
|
5656
5734
|
(i2) => refs?.[i2],
|
|
5657
|
-
() => [i]
|
|
5735
|
+
() => [$.get(i)]
|
|
5658
5736
|
);
|
|
5659
5737
|
});
|
|
5660
5738
|
var node_8 = $.sibling(node_7, 2);
|
|
5661
|
-
$.each(node_8, 17, () => $.get(bgChunks),
|
|
5739
|
+
$.each(node_8, 17, () => $.get(bgChunks), (chunk) => chunk.id, ($$anchor2, chunk) => {
|
|
5662
5740
|
Event($$anchor2, {
|
|
5663
5741
|
get chunk() {
|
|
5664
5742
|
return $.get(chunk);
|