@mintplayer/web-components 2.2.0 → 2.4.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/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.mjs +180 -174
- package/accordion/src/components/mp-accordion.d.ts +18 -13
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.mjs +211 -164
- package/carousel/src/components/mp-carousel.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/color-CpFtrIoX.mjs +899 -0
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +9 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +892 -493
- package/scheduler/src/components/mp-scheduler.d.ts +30 -0
- package/scheduler/src/input/input-handler.d.ts +2 -0
- package/scheduler/src/views/base-view.d.ts +43 -6
- package/scheduler/src/views/timeline-view.d.ts +6 -0
- package/scheduler-core/index.mjs +73 -70
- package/scheduler-core/src/models/index.d.ts +1 -0
- package/scheduler-core/src/models/messages.d.ts +69 -0
- package/scheduler-core/src/models/options.d.ts +4 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/color-CyamnJnn.mjs +0 -847
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
package/scheduler/index.mjs
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import { L as
|
|
3
|
-
import { D as
|
|
4
|
-
function
|
|
5
|
-
|
|
1
|
+
import { unsafeCSS as N, LitElement as V, html as q } from "lit";
|
|
2
|
+
import { L as Y } from "../chunks/live-announcer-Bi0orG4n.mjs";
|
|
3
|
+
import { D as G, o as $, d as h, r as S, g as x, t as M, m as H, q as C, n as W, h as _ } from "../chunks/color-CpFtrIoX.mjs";
|
|
4
|
+
function B(m, e) {
|
|
5
|
+
if ($(m)) {
|
|
6
|
+
const t = m.children.map((s) => B(s, e));
|
|
7
|
+
return t.some((s, n) => s !== m.children[n]) ? { ...m, children: t } : m;
|
|
8
|
+
}
|
|
9
|
+
return (m.events ?? []).some((t) => t.id === e.id) ? {
|
|
10
|
+
...m,
|
|
11
|
+
events: (m.events ?? []).map((t) => t.id === e.id ? e : t)
|
|
12
|
+
} : m;
|
|
13
|
+
}
|
|
14
|
+
function j(m = {}) {
|
|
15
|
+
const e = { ...G, ...m };
|
|
6
16
|
return {
|
|
7
17
|
view: e.initialView,
|
|
8
18
|
date: e.initialDate,
|
|
@@ -26,9 +36,9 @@ function q(g = {}) {
|
|
|
26
36
|
focusedDate: null
|
|
27
37
|
};
|
|
28
38
|
}
|
|
29
|
-
class
|
|
39
|
+
class X {
|
|
30
40
|
constructor(e = {}) {
|
|
31
|
-
this.listeners = /* @__PURE__ */ new Set(), this.state =
|
|
41
|
+
this.listeners = /* @__PURE__ */ new Set(), this.state = j(e);
|
|
32
42
|
}
|
|
33
43
|
/**
|
|
34
44
|
* Get current state
|
|
@@ -88,7 +98,8 @@ class Y {
|
|
|
88
98
|
*/
|
|
89
99
|
updateEvent(e) {
|
|
90
100
|
this.setState((t) => ({
|
|
91
|
-
events: t.events.map((s) => s.id === e.id ? e : s)
|
|
101
|
+
events: t.events.map((s) => s.id === e.id ? e : s),
|
|
102
|
+
resources: t.resources.map((s) => B(s, e))
|
|
92
103
|
}));
|
|
93
104
|
}
|
|
94
105
|
/**
|
|
@@ -291,12 +302,12 @@ class Y {
|
|
|
291
302
|
this.setState({ focusedDate: e });
|
|
292
303
|
}
|
|
293
304
|
}
|
|
294
|
-
function
|
|
295
|
-
const s = h.formatTime(
|
|
296
|
-
return e && o.push(
|
|
305
|
+
function L(m, e, t) {
|
|
306
|
+
const s = t.timeFormat ?? "24h", n = h.formatTime(m.start, s), i = h.formatTime(m.end, s), r = m.start.toLocaleDateString(t.locale, { weekday: "long", month: "short", day: "numeric" }), o = [`${m.title}, ${n}–${i}`, r];
|
|
307
|
+
return e && o.push(x(S(t.messages).eventOnResource, { resource: e })), o.join(", ");
|
|
297
308
|
}
|
|
298
|
-
function
|
|
299
|
-
const { selectionAnchor: e, selectionExtent: t, selectionResourceId: s } =
|
|
309
|
+
function P(m) {
|
|
310
|
+
const { selectionAnchor: e, selectionExtent: t, selectionResourceId: s } = m;
|
|
300
311
|
if (!e || !t) return null;
|
|
301
312
|
const n = Math.min(e.start.getTime(), t.start.getTime()), i = Math.max(e.end.getTime(), t.end.getTime());
|
|
302
313
|
return {
|
|
@@ -305,32 +316,46 @@ function k(g) {
|
|
|
305
316
|
resourceId: s
|
|
306
317
|
};
|
|
307
318
|
}
|
|
308
|
-
function
|
|
309
|
-
const s =
|
|
310
|
-
return !s || s.resourceId && t && s.resourceId !== t ? !1 :
|
|
319
|
+
function K(m, e, t = null) {
|
|
320
|
+
const s = P(e);
|
|
321
|
+
return !s || s.resourceId && t && s.resourceId !== t ? !1 : m.start.getTime() < s.end.getTime() && m.end.getTime() > s.start.getTime();
|
|
311
322
|
}
|
|
312
|
-
function
|
|
313
|
-
const s =
|
|
323
|
+
function J(m, e, t = null) {
|
|
324
|
+
const s = m.start.toLocaleDateString(e.locale, {
|
|
314
325
|
weekday: "long",
|
|
315
326
|
month: "short",
|
|
316
327
|
day: "numeric"
|
|
317
|
-
}), n = h.formatTime(
|
|
328
|
+
}), n = h.formatTime(m.start, e.timeFormat ?? "24h"), i = [`${s}, ${n}`];
|
|
318
329
|
return t && i.push(t), i.join(", ");
|
|
319
330
|
}
|
|
320
|
-
function
|
|
321
|
-
const
|
|
322
|
-
if (!
|
|
323
|
-
const
|
|
324
|
-
return
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
|
|
331
|
+
function Z(m, e) {
|
|
332
|
+
const t = P(m);
|
|
333
|
+
if (!t) return "";
|
|
334
|
+
const { options: s } = m, n = s.timeFormat ?? "24h", i = { weekday: "short", month: "short", day: "numeric" }, r = `${h.formatTime(t.start, n)} ${t.start.toLocaleDateString(s.locale, i)}`, o = `${h.formatTime(t.end, n)} ${t.end.toLocaleDateString(s.locale, i)}`, a = e * 1e3, l = Math.max(1, Math.round((t.end.getTime() - t.start.getTime()) / a)), d = S(s.messages);
|
|
335
|
+
return x(d.selection, {
|
|
336
|
+
start: r,
|
|
337
|
+
end: o,
|
|
338
|
+
count: l,
|
|
339
|
+
slots: l === 1 ? d.slotSingular : d.slotPlural
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
function Q(m, e, t) {
|
|
343
|
+
const s = t.timeFormat ?? "24h", n = m.toLocaleDateString(t.locale, { weekday: "short", month: "short", day: "numeric" });
|
|
344
|
+
return x(S(t.messages).movedTo, {
|
|
345
|
+
start: h.formatTime(m, s),
|
|
346
|
+
end: h.formatTime(e, s),
|
|
347
|
+
day: n
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function ee(m, e, t, s) {
|
|
351
|
+
const n = s.timeFormat ?? "24h", i = S(s.messages);
|
|
352
|
+
return x(i.resizedEdge, {
|
|
353
|
+
edge: t === "start" ? i.startEdge : i.endEdge,
|
|
354
|
+
start: h.formatTime(m, n),
|
|
355
|
+
end: h.formatTime(e, n)
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
class A {
|
|
334
359
|
constructor(e, t) {
|
|
335
360
|
this.container = e, this.state = t;
|
|
336
361
|
}
|
|
@@ -366,8 +391,50 @@ class x {
|
|
|
366
391
|
clearContainer() {
|
|
367
392
|
this.container.innerHTML = "";
|
|
368
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Append the start/end resize handles for an event part. The handle strip
|
|
396
|
+
* is the pointer hit zone the drag machine targets via
|
|
397
|
+
* closest('.resize-handle'); the glyph inside it is a purely decorative
|
|
398
|
+
* affordance revealed by the .selected class — never focusable, the
|
|
399
|
+
* keyboard resize path lives on the event element (move-mode).
|
|
400
|
+
* Position classes are per-view: ['top','bottom'] for time grids,
|
|
401
|
+
* ['left','right'] for the timeline.
|
|
402
|
+
*/
|
|
403
|
+
appendResizeHandles(e, t, [s, n] = ["top", "bottom"]) {
|
|
404
|
+
t.event?.resizable === !1 || this.state.options.editable === !1 || (t.isStart && e.appendChild(this.createResizeHandle(s, "start")), t.isEnd && e.appendChild(this.createResizeHandle(n, "end")));
|
|
405
|
+
}
|
|
406
|
+
createResizeHandle(e, t) {
|
|
407
|
+
const s = this.createElement("div", "resize-handle", e);
|
|
408
|
+
this.setData(s, { handle: t });
|
|
409
|
+
const n = this.createElement("span", "resize-glyph");
|
|
410
|
+
return n.setAttribute("aria-hidden", "true"), s.appendChild(n), s;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Retrofit the ARIA grid chain onto a rendered view (wc-aria PRD step 5.7):
|
|
414
|
+
* the container claims `grid`, layout-only wrappers become `presentation`
|
|
415
|
+
* so they stop breaking the chain, the header strip becomes the
|
|
416
|
+
* column-header row, and the cell groups named by `rows` become rows. The
|
|
417
|
+
* cells themselves already carry role="gridcell" + ids + roving tabindex.
|
|
418
|
+
*
|
|
419
|
+
* The mapping is pragmatic, not ideal: week/day DOM is COLUMN-major (a row
|
|
420
|
+
* here is one day's column of time cells), because the layout was built
|
|
421
|
+
* for CSS first. The cells' focus announcements carry full day+time, so
|
|
422
|
+
* navigation stays understandable.
|
|
423
|
+
*/
|
|
424
|
+
applyGridRoles(e) {
|
|
425
|
+
const t = this.container;
|
|
426
|
+
t.getAttribute("role") !== "grid" && t.setAttribute("role", "grid"), t.setAttribute("aria-describedby", "scheduler-kbd-grid"), e.multiselectable && t.setAttribute("aria-multiselectable", "true");
|
|
427
|
+
const s = (n, i) => t.querySelectorAll(n).forEach((r) => {
|
|
428
|
+
r.hasAttribute("role") || r.setAttribute("role", i);
|
|
429
|
+
});
|
|
430
|
+
e.columnHeaderRow && s(e.columnHeaderRow, "row"), e.columnHeaders && s(e.columnHeaders, "columnheader"), (e.presentation ?? []).forEach((n) => s(n, "presentation")), e.rows && s(e.rows, "row"), e.cells && s(e.cells, "gridcell");
|
|
431
|
+
}
|
|
432
|
+
/** aria-current="date" on every element the views styled `.today`. */
|
|
433
|
+
markToday() {
|
|
434
|
+
this.container.querySelectorAll(".today").forEach((e) => e.setAttribute("aria-current", "date"));
|
|
435
|
+
}
|
|
369
436
|
}
|
|
370
|
-
class
|
|
437
|
+
class R extends A {
|
|
371
438
|
constructor() {
|
|
372
439
|
super(...arguments), this.monthCards = /* @__PURE__ */ new Map();
|
|
373
440
|
}
|
|
@@ -376,10 +443,10 @@ class A extends x {
|
|
|
376
443
|
const { date: e, options: t } = this.state, s = h.getYearMonths(e), n = this.createElement("div", "scheduler-year-grid");
|
|
377
444
|
this.monthCards.clear();
|
|
378
445
|
for (const i of s) {
|
|
379
|
-
const
|
|
380
|
-
n.appendChild(
|
|
446
|
+
const r = this.createMonthCard(i);
|
|
447
|
+
n.appendChild(r);
|
|
381
448
|
}
|
|
382
|
-
this.container.appendChild(n), this.updateMonthCardFocus();
|
|
449
|
+
this.container.appendChild(n), this.applyGridRoles({ rows: ".scheduler-year-grid" }), this.markToday(), this.updateMonthCardFocus();
|
|
383
450
|
}
|
|
384
451
|
/**
|
|
385
452
|
* Build a `YYYY-MM` key from a Date, which is the unit of focus on year
|
|
@@ -390,29 +457,29 @@ class A extends x {
|
|
|
390
457
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
|
|
391
458
|
}
|
|
392
459
|
createMonthCard(e) {
|
|
393
|
-
const { events: t, options: s } = this.state, n = this.createElement("div", "scheduler-year-month"), i =
|
|
394
|
-
n.setAttribute("role", "gridcell"), n.setAttribute("tabindex", "-1"), n.
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
for (const
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
const d = h.getMonthStart(e), c = h.getMonthEnd(e), u = M.filterByRange(t, d, c),
|
|
403
|
-
for (const
|
|
404
|
-
const
|
|
405
|
-
for (
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
for (const
|
|
409
|
-
for (const
|
|
460
|
+
const { events: t, options: s } = this.state, n = this.createElement("div", "scheduler-year-month"), i = R.monthKey(e);
|
|
461
|
+
n.setAttribute("role", "gridcell"), n.setAttribute("tabindex", "-1"), n.id = `scheduler-cell-y-${i}`, this.setData(n, { month: e.toISOString() }), this.monthCards.set(i, n);
|
|
462
|
+
const r = this.createElement("div", "scheduler-year-month-header");
|
|
463
|
+
r.textContent = h.getMonthName(e, s.locale), r.setAttribute("role", "button"), r.setAttribute("tabindex", "0"), this.setData(r, { month: e.toISOString() }), n.appendChild(r);
|
|
464
|
+
const o = this.createElement("div", "scheduler-mini-month"), a = h.getMonthWeeks(e, s.firstDayOfWeek), l = a[0];
|
|
465
|
+
for (const v of l) {
|
|
466
|
+
const g = this.createElement("div", "scheduler-mini-day", "header");
|
|
467
|
+
g.textContent = h.getDayName(v, s.locale, "narrow"), g.style.fontWeight = "600", g.style.color = "#666", o.appendChild(g);
|
|
468
|
+
}
|
|
469
|
+
const d = h.getMonthStart(e), c = h.getMonthEnd(e), u = M.filterByRange(t, d, c), p = /* @__PURE__ */ new Set();
|
|
470
|
+
for (const v of u) {
|
|
471
|
+
const g = new Date(v.start);
|
|
472
|
+
for (g.setHours(0, 0, 0, 0); g <= v.end; )
|
|
473
|
+
p.add(g.toISOString().split("T")[0]), g.setDate(g.getDate() + 1);
|
|
474
|
+
}
|
|
475
|
+
for (const v of a)
|
|
476
|
+
for (const g of v) {
|
|
410
477
|
const f = this.createElement("div", "scheduler-mini-day");
|
|
411
|
-
f.textContent = String(
|
|
412
|
-
const b =
|
|
413
|
-
|
|
478
|
+
f.textContent = String(g.getDate()), this.setData(f, { date: g.toISOString() }), h.isSameMonth(g, e) || f.classList.add("other-month"), h.isToday(g) && f.classList.add("today");
|
|
479
|
+
const b = g.toISOString().split("T")[0];
|
|
480
|
+
p.has(b) && f.classList.add("has-events"), o.appendChild(f);
|
|
414
481
|
}
|
|
415
|
-
return n.appendChild(
|
|
482
|
+
return n.appendChild(o), n;
|
|
416
483
|
}
|
|
417
484
|
/**
|
|
418
485
|
* Apply roving tabindex based on `state.focusedDate`'s month. Year-view's
|
|
@@ -422,10 +489,10 @@ class A extends x {
|
|
|
422
489
|
updateMonthCardFocus() {
|
|
423
490
|
const e = this.state.focusedDate;
|
|
424
491
|
let t = !1;
|
|
425
|
-
const s = e ?
|
|
492
|
+
const s = e ? R.monthKey(e) : null;
|
|
426
493
|
for (const [n, i] of this.monthCards) {
|
|
427
|
-
const
|
|
428
|
-
i.setAttribute("tabindex",
|
|
494
|
+
const r = n === s;
|
|
495
|
+
i.setAttribute("tabindex", r ? "0" : "-1"), i.removeAttribute("aria-selected"), r && (t = !0);
|
|
429
496
|
}
|
|
430
497
|
t || this.monthCards.values().next().value?.setAttribute("tabindex", "0");
|
|
431
498
|
}
|
|
@@ -441,25 +508,33 @@ class A extends x {
|
|
|
441
508
|
this.monthCards.clear(), this.clearContainer();
|
|
442
509
|
}
|
|
443
510
|
}
|
|
444
|
-
class
|
|
511
|
+
class k extends A {
|
|
445
512
|
constructor() {
|
|
446
513
|
super(...arguments), this.dayCells = /* @__PURE__ */ new Map();
|
|
447
514
|
}
|
|
448
515
|
render() {
|
|
449
516
|
this.clearContainer(), this.container.classList.add("scheduler-month-view");
|
|
450
517
|
const { date: e, options: t } = this.state, s = h.getMonthWeeks(e, t.firstDayOfWeek), n = this.createElement("div", "scheduler-day-headers"), i = s[0];
|
|
451
|
-
for (const
|
|
518
|
+
for (const o of i) {
|
|
452
519
|
const a = this.createElement("div", "scheduler-day-header");
|
|
453
|
-
a.textContent = h.getDayName(
|
|
520
|
+
a.textContent = h.getDayName(o, t.locale), n.appendChild(a);
|
|
454
521
|
}
|
|
455
522
|
this.container.appendChild(n);
|
|
456
|
-
const
|
|
457
|
-
for (const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
523
|
+
const r = this.createElement("div", "scheduler-month-grid");
|
|
524
|
+
for (const o of s) {
|
|
525
|
+
const a = this.createElement("div", "scheduler-month-week");
|
|
526
|
+
for (const l of o) {
|
|
527
|
+
const d = this.createDayCell(l);
|
|
528
|
+
a.appendChild(d);
|
|
461
529
|
}
|
|
462
|
-
|
|
530
|
+
r.appendChild(a);
|
|
531
|
+
}
|
|
532
|
+
this.container.appendChild(r), this.renderEvents(), this.updateDayCellFocus(), this.applyGridRoles({
|
|
533
|
+
columnHeaderRow: ":scope > .scheduler-day-headers",
|
|
534
|
+
columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
|
|
535
|
+
presentation: [".scheduler-month-grid"],
|
|
536
|
+
rows: ".scheduler-month-week"
|
|
537
|
+
}), this.markToday();
|
|
463
538
|
}
|
|
464
539
|
/**
|
|
465
540
|
* Build a `YYYY-MM-DD` key from a Date using *local* components. Using
|
|
@@ -473,12 +548,12 @@ class T extends x {
|
|
|
473
548
|
createDayCell(e) {
|
|
474
549
|
const { date: t } = this.state, s = this.createElement("div", "scheduler-month-day");
|
|
475
550
|
h.isSameMonth(e, t) || s.classList.add("other-month"), h.isToday(e) && s.classList.add("today");
|
|
476
|
-
const n =
|
|
477
|
-
s.setAttribute("role", "gridcell"), s.setAttribute("tabindex", "-1"), s.
|
|
551
|
+
const n = k.dayKey(e);
|
|
552
|
+
s.setAttribute("role", "gridcell"), s.setAttribute("tabindex", "-1"), s.id = `scheduler-cell-m-${n}`;
|
|
478
553
|
const i = this.createElement("div", "day-number");
|
|
479
554
|
i.textContent = String(e.getDate()), s.appendChild(i);
|
|
480
|
-
const
|
|
481
|
-
return s.appendChild(
|
|
555
|
+
const r = this.createElement("div", "month-events");
|
|
556
|
+
return s.appendChild(r), this.dayCells.set(n, s), this.setData(s, { date: n }), s;
|
|
482
557
|
}
|
|
483
558
|
/**
|
|
484
559
|
* Apply roving tabindex based on `state.focusedDate`. The grid must always
|
|
@@ -488,41 +563,44 @@ class T extends x {
|
|
|
488
563
|
updateDayCellFocus() {
|
|
489
564
|
const e = this.state.focusedDate;
|
|
490
565
|
let t = !1;
|
|
491
|
-
const s = e ?
|
|
566
|
+
const s = e ? k.dayKey(e) : null;
|
|
492
567
|
for (const [n, i] of this.dayCells) {
|
|
493
|
-
const
|
|
494
|
-
i.setAttribute("tabindex",
|
|
568
|
+
const r = n === s;
|
|
569
|
+
i.setAttribute("tabindex", r ? "0" : "-1"), i.removeAttribute("aria-selected"), r && (t = !0);
|
|
495
570
|
}
|
|
496
571
|
t || (Array.from(this.dayCells.values()).find((i) => i.classList.contains("today") && !i.classList.contains("other-month")) || Array.from(this.dayCells.values()).find((i) => !i.classList.contains("other-month")) || this.dayCells.values().next().value)?.setAttribute("tabindex", "0");
|
|
497
572
|
}
|
|
498
573
|
renderEvents() {
|
|
499
574
|
const { date: e, events: t, options: s } = this.state;
|
|
500
575
|
h.getMonthStart(e), h.getMonthEnd(e);
|
|
501
|
-
const n = h.getMonthWeeks(e, s.firstDayOfWeek), i = n[0][0],
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
for (const d of
|
|
505
|
-
const c = new Date(d.start), u = new Date(d.end),
|
|
506
|
-
for (
|
|
507
|
-
const
|
|
508
|
-
a.has(
|
|
576
|
+
const n = h.getMonthWeeks(e, s.firstDayOfWeek), i = n[0][0], r = n[n.length - 1][6];
|
|
577
|
+
r.setHours(23, 59, 59, 999);
|
|
578
|
+
const o = M.filterByRange(t, i, r), a = /* @__PURE__ */ new Map();
|
|
579
|
+
for (const d of o) {
|
|
580
|
+
const c = new Date(d.start), u = new Date(d.end), p = new Date(c);
|
|
581
|
+
for (p.setHours(0, 0, 0, 0); p <= u; ) {
|
|
582
|
+
const v = k.dayKey(p);
|
|
583
|
+
a.has(v) || a.set(v, []), a.get(v).push(d), p.setDate(p.getDate() + 1);
|
|
509
584
|
}
|
|
510
585
|
}
|
|
511
586
|
const l = typeof s.dayMaxEvents == "number" ? s.dayMaxEvents : 3;
|
|
512
587
|
for (const [d, c] of a) {
|
|
513
588
|
const u = this.dayCells.get(d);
|
|
514
589
|
if (!u) continue;
|
|
515
|
-
const
|
|
516
|
-
if (!
|
|
517
|
-
|
|
518
|
-
const
|
|
519
|
-
for (const f of
|
|
590
|
+
const p = u.querySelector(".month-events");
|
|
591
|
+
if (!p) continue;
|
|
592
|
+
p.innerHTML = "";
|
|
593
|
+
const v = c.slice(0, l), g = c.length - v.length;
|
|
594
|
+
for (const f of v) {
|
|
520
595
|
const b = this.createElement("div", "scheduler-month-event");
|
|
521
|
-
b.textContent = f.title, b.style.backgroundColor = f.color ?? "#3788d8", b.style.color = f.textColor ??
|
|
596
|
+
b.textContent = f.title, b.style.backgroundColor = f.color ?? "#3788d8", b.style.color = f.textColor ?? H(f.color ?? "#3788d8"), b.setAttribute("role", "button"), b.setAttribute("tabindex", "0"), b.setAttribute("aria-label", L(f, null, this.state.options)), this.setData(b, { eventId: f.id }), p.appendChild(b);
|
|
522
597
|
}
|
|
523
|
-
if (
|
|
598
|
+
if (g > 0) {
|
|
524
599
|
const f = this.createElement("div", "scheduler-more-link");
|
|
525
|
-
f.textContent =
|
|
600
|
+
f.textContent = x(
|
|
601
|
+
S(this.state.options.messages).moreEvents,
|
|
602
|
+
{ count: g }
|
|
603
|
+
), f.setAttribute("role", "button"), f.setAttribute("tabindex", "0"), this.setData(f, { date: d }), p.appendChild(f);
|
|
526
604
|
}
|
|
527
605
|
}
|
|
528
606
|
}
|
|
@@ -541,7 +619,7 @@ class T extends x {
|
|
|
541
619
|
this.dayCells.clear(), this.clearContainer();
|
|
542
620
|
}
|
|
543
621
|
}
|
|
544
|
-
class
|
|
622
|
+
class te extends A {
|
|
545
623
|
constructor() {
|
|
546
624
|
super(...arguments), this.dayColumns = [], this.eventElements = /* @__PURE__ */ new Map(), this.slotElements = /* @__PURE__ */ new Map();
|
|
547
625
|
}
|
|
@@ -554,11 +632,11 @@ class J extends x {
|
|
|
554
632
|
h.isToday(d) && c.classList.add("today");
|
|
555
633
|
const u = this.createElement("div", "day-name");
|
|
556
634
|
u.textContent = h.getDayName(d, t.locale);
|
|
557
|
-
const
|
|
558
|
-
|
|
635
|
+
const p = this.createElement("div", "day-number");
|
|
636
|
+
p.textContent = String(d.getDate()), c.appendChild(u), c.appendChild(p), n.appendChild(c);
|
|
559
637
|
}
|
|
560
638
|
this.container.appendChild(n);
|
|
561
|
-
const
|
|
639
|
+
const r = this.createElement("div", "scheduler-time-grid"), o = this.createElement("div", "scheduler-time-gutter"), a = h.getTimeSlots(
|
|
562
640
|
s[0],
|
|
563
641
|
t.slotDuration,
|
|
564
642
|
t.slotMinTime,
|
|
@@ -566,43 +644,60 @@ class J extends x {
|
|
|
566
644
|
);
|
|
567
645
|
for (const d of a) {
|
|
568
646
|
const c = this.createElement("div", "scheduler-time-slot-label");
|
|
569
|
-
c.textContent = h.formatTime(d.start, t.timeFormat),
|
|
647
|
+
c.textContent = h.formatTime(d.start, t.timeFormat), o.appendChild(c);
|
|
570
648
|
}
|
|
571
|
-
|
|
649
|
+
r.appendChild(o);
|
|
572
650
|
const l = this.createElement("div", "scheduler-days-container");
|
|
573
651
|
this.dayColumns = [];
|
|
574
652
|
for (let d = 0; d < s.length; d++) {
|
|
575
653
|
const c = s[d], u = this.createElement("div", "scheduler-day-column");
|
|
576
654
|
this.setData(u, { dayIndex: d });
|
|
577
|
-
for (let
|
|
578
|
-
const
|
|
655
|
+
for (let v = 0; v < a.length; v++) {
|
|
656
|
+
const g = a[v], f = new Date(c);
|
|
579
657
|
f.setHours(
|
|
580
|
-
|
|
581
|
-
|
|
658
|
+
g.start.getHours(),
|
|
659
|
+
g.start.getMinutes(),
|
|
582
660
|
0,
|
|
583
661
|
0
|
|
584
662
|
);
|
|
585
663
|
const b = new Date(c);
|
|
586
664
|
b.setHours(
|
|
587
|
-
|
|
588
|
-
|
|
665
|
+
g.end.getHours(),
|
|
666
|
+
g.end.getMinutes(),
|
|
589
667
|
0,
|
|
590
668
|
0
|
|
591
669
|
);
|
|
592
670
|
const y = this.createElement("div", "scheduler-time-slot");
|
|
593
|
-
y.setAttribute("role", "gridcell"), y.setAttribute("tabindex", "-1"), y.setAttribute("aria-selected", "false"), y.id = `scheduler-cell-w-${d}-${
|
|
671
|
+
y.setAttribute("role", "gridcell"), y.setAttribute("tabindex", "-1"), y.setAttribute("aria-selected", "false"), y.id = `scheduler-cell-w-${d}-${v}`, this.setData(y, {
|
|
594
672
|
dayIndex: d,
|
|
595
|
-
slotIndex:
|
|
673
|
+
slotIndex: v,
|
|
596
674
|
start: f.toISOString(),
|
|
597
675
|
end: b.toISOString()
|
|
598
676
|
});
|
|
599
|
-
const
|
|
600
|
-
this.slotElements.set(
|
|
677
|
+
const w = `${d}-${v}`;
|
|
678
|
+
this.slotElements.set(w, y), u.appendChild(y);
|
|
601
679
|
}
|
|
602
|
-
const
|
|
603
|
-
u.appendChild(
|
|
604
|
-
}
|
|
605
|
-
|
|
680
|
+
const p = this.createElement("div", "scheduler-events-container");
|
|
681
|
+
u.appendChild(p), this.dayColumns.push(u), l.appendChild(u);
|
|
682
|
+
}
|
|
683
|
+
r.appendChild(l), this.container.appendChild(r), this.renderEvents(), this.updateCellFocusAndSelection(), this.renderNowIndicator(s, a), this.applyGridRoles({
|
|
684
|
+
multiselectable: !0,
|
|
685
|
+
columnHeaderRow: ":scope > .scheduler-day-headers",
|
|
686
|
+
columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
|
|
687
|
+
presentation: [
|
|
688
|
+
".scheduler-time-gutter-space",
|
|
689
|
+
".scheduler-time-grid",
|
|
690
|
+
".scheduler-time-gutter",
|
|
691
|
+
".scheduler-time-slot-label",
|
|
692
|
+
".scheduler-days-container"
|
|
693
|
+
],
|
|
694
|
+
rows: ".scheduler-day-column",
|
|
695
|
+
// The events overlay is a CELL, not presentation: a presentational
|
|
696
|
+
// wrapper leaves its role=button events owned directly by the row,
|
|
697
|
+
// which is invalid (axe aria-required-children). A gridcell may
|
|
698
|
+
// contain buttons.
|
|
699
|
+
cells: ".scheduler-events-container"
|
|
700
|
+
}), this.markToday();
|
|
606
701
|
}
|
|
607
702
|
update(e) {
|
|
608
703
|
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options), n = this.state.selectedEvent?.id !== e.selectedEvent?.id;
|
|
@@ -624,11 +719,11 @@ class J extends x {
|
|
|
624
719
|
let t = !1, s = null;
|
|
625
720
|
for (const [, n] of this.slotElements) {
|
|
626
721
|
s || (s = n);
|
|
627
|
-
const i = n.dataset.start,
|
|
628
|
-
if (!i || !
|
|
629
|
-
const
|
|
722
|
+
const i = n.dataset.start, r = n.dataset.end;
|
|
723
|
+
if (!i || !r) continue;
|
|
724
|
+
const o = { start: new Date(i), end: new Date(r) }, a = !!e && o.start.getTime() === e.start.getTime();
|
|
630
725
|
n.setAttribute("tabindex", a ? "0" : "-1");
|
|
631
|
-
const l =
|
|
726
|
+
const l = K(o, this.state, null);
|
|
632
727
|
n.setAttribute("aria-selected", l ? "true" : "false"), n.classList.toggle("selected", l), a && (t = !0);
|
|
633
728
|
}
|
|
634
729
|
!t && s && s.setAttribute("tabindex", "0");
|
|
@@ -637,84 +732,74 @@ class J extends x {
|
|
|
637
732
|
return e.slotDuration !== t.slotDuration || e.timeFormat !== t.timeFormat || e.firstDayOfWeek !== t.firstDayOfWeek || e.slotMinTime !== t.slotMinTime || e.slotMaxTime !== t.slotMaxTime || e.locale !== t.locale;
|
|
638
733
|
}
|
|
639
734
|
renderEvents() {
|
|
640
|
-
const { date: e, events: t, options: s } = this.state, n = h.getWeekDays(e, s.firstDayOfWeek), i = n[0],
|
|
641
|
-
|
|
642
|
-
const
|
|
643
|
-
for (const c of
|
|
735
|
+
const { date: e, events: t, options: s } = this.state, n = h.getWeekDays(e, s.firstDayOfWeek), i = n[0], r = new Date(n[6]);
|
|
736
|
+
r.setHours(23, 59, 59, 999);
|
|
737
|
+
const o = M.filterByRange(t, i, r), a = [];
|
|
738
|
+
for (const c of o) {
|
|
644
739
|
const { parts: u } = M.splitInParts(c);
|
|
645
740
|
a.push(...u);
|
|
646
741
|
}
|
|
647
|
-
const l = M.filterPartsByRange(a, i,
|
|
742
|
+
const l = M.filterPartsByRange(a, i, r), d = M.getTimelinedParts(l);
|
|
648
743
|
this.eventElements.forEach((c) => c.remove()), this.eventElements.clear();
|
|
649
|
-
for (const { part: c, trackIndex: u, totalTracks:
|
|
744
|
+
for (const { part: c, trackIndex: u, totalTracks: p, colspan: v } of d) {
|
|
650
745
|
if (!c.event) continue;
|
|
651
|
-
const
|
|
652
|
-
if (
|
|
653
|
-
const b = this.dayColumns[
|
|
746
|
+
const g = n.findIndex((w) => h.isSameDay(w, c.start));
|
|
747
|
+
if (g === -1) continue;
|
|
748
|
+
const b = this.dayColumns[g].querySelector(".scheduler-events-container");
|
|
654
749
|
if (!b) continue;
|
|
655
750
|
const y = this.createEventElement(
|
|
656
751
|
c,
|
|
657
752
|
u,
|
|
753
|
+
p,
|
|
658
754
|
v,
|
|
659
|
-
m,
|
|
660
755
|
s.slotDuration ?? 1800
|
|
661
756
|
);
|
|
662
757
|
b.appendChild(y), this.eventElements.set(c.id, y);
|
|
663
758
|
}
|
|
664
759
|
}
|
|
665
760
|
createEventElement(e, t, s, n, i) {
|
|
666
|
-
const
|
|
667
|
-
r.setAttribute("role", "button"),
|
|
761
|
+
const r = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === r.id;
|
|
762
|
+
this.state.keyboardMoveEventId, r.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
|
|
668
763
|
"aria-label",
|
|
669
|
-
|
|
670
|
-
),
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
const
|
|
676
|
-
|
|
764
|
+
L(r, null, this.state.options)
|
|
765
|
+
), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
|
|
766
|
+
const l = new Date(e.start);
|
|
767
|
+
l.setHours(0, 0, 0, 0);
|
|
768
|
+
const d = (e.start.getTime() - l.getTime()) / (1e3 * 60), u = (e.end.getTime() - l.getTime()) / (1e3 * 60) - d, p = i / 60, v = d / p * 40, g = Math.max(u / p * 40, 20), f = t / s * 100, b = n / s * 100;
|
|
769
|
+
o.style.top = `${v}px`, o.style.height = `${g}px`, o.style.left = `${f}%`, o.style.width = `calc(${b}% - 2px)`, o.style.backgroundColor = r.color ?? "#3788d8", o.style.color = r.textColor ?? H(r.color ?? "#3788d8"), this.setData(o, { eventId: r.id });
|
|
770
|
+
const y = this.createElement("div", "event-content"), w = this.createElement("div", "event-title");
|
|
771
|
+
w.textContent = r.title, y.appendChild(w);
|
|
677
772
|
const D = this.createElement("div", "event-time");
|
|
678
|
-
|
|
679
|
-
if (e.isStart) {
|
|
680
|
-
const w = this.createElement("div", "resize-handle", "top");
|
|
681
|
-
this.setData(w, { handle: "start" }), r.appendChild(w);
|
|
682
|
-
}
|
|
683
|
-
if (e.isEnd) {
|
|
684
|
-
const w = this.createElement("div", "resize-handle", "bottom");
|
|
685
|
-
this.setData(w, { handle: "end" }), r.appendChild(w);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
return r;
|
|
773
|
+
return D.textContent = `${h.formatTime(e.start, this.state.options.timeFormat)} - ${h.formatTime(e.end, this.state.options.timeFormat)}`, y.appendChild(D), o.appendChild(y), this.appendResizeHandles(o, e), o;
|
|
689
774
|
}
|
|
690
775
|
renderPreviewEvent() {
|
|
691
776
|
const e = this.container.querySelector(".scheduler-event.preview");
|
|
692
777
|
e && e.remove();
|
|
693
778
|
const { previewEvent: t, options: s, date: n } = this.state;
|
|
694
779
|
if (!t) return;
|
|
695
|
-
const
|
|
696
|
-
if (
|
|
697
|
-
const a = this.dayColumns[
|
|
780
|
+
const r = h.getWeekDays(n, s.firstDayOfWeek).findIndex((b) => h.isSameDay(b, t.start));
|
|
781
|
+
if (r === -1) return;
|
|
782
|
+
const a = this.dayColumns[r]?.querySelector(".scheduler-events-container");
|
|
698
783
|
if (!a) return;
|
|
699
784
|
const l = this.createElement("div", "scheduler-event", "preview"), d = new Date(t.start);
|
|
700
785
|
d.setHours(0, 0, 0, 0);
|
|
701
|
-
const c = (t.start.getTime() - d.getTime()) / (1e3 * 60),
|
|
702
|
-
l.style.top = `${
|
|
786
|
+
const c = (t.start.getTime() - d.getTime()) / (1e3 * 60), p = (t.end.getTime() - d.getTime()) / (1e3 * 60) - c, v = (s.slotDuration ?? 1800) / 60, g = c / v * 40, f = Math.max(p / v * 40, 20);
|
|
787
|
+
l.style.top = `${g}px`, l.style.height = `${f}px`, l.style.left = "0", l.style.width = "100%", a.appendChild(l);
|
|
703
788
|
}
|
|
704
789
|
updateGreyedSlots() {
|
|
705
790
|
const { dragState: e, previewEvent: t, options: s, date: n } = this.state;
|
|
706
|
-
if (this.slotElements.forEach((
|
|
707
|
-
const i = h.getWeekDays(n, s.firstDayOfWeek),
|
|
791
|
+
if (this.slotElements.forEach((o) => o.classList.remove("greyed")), !e || !t) return;
|
|
792
|
+
const i = h.getWeekDays(n, s.firstDayOfWeek), r = h.getTimeSlots(
|
|
708
793
|
i[0],
|
|
709
794
|
s.slotDuration,
|
|
710
795
|
s.slotMinTime,
|
|
711
796
|
s.slotMaxTime
|
|
712
797
|
);
|
|
713
|
-
for (let
|
|
714
|
-
const a = i[
|
|
798
|
+
for (let o = 0; o < i.length; o++) {
|
|
799
|
+
const a = i[o];
|
|
715
800
|
if (!(!h.isSameDay(a, t.start) && !h.isSameDay(a, t.end)))
|
|
716
|
-
for (let l = 0; l <
|
|
717
|
-
const d =
|
|
801
|
+
for (let l = 0; l < r.length; l++) {
|
|
802
|
+
const d = r[l], c = new Date(a);
|
|
718
803
|
c.setHours(
|
|
719
804
|
d.start.getHours(),
|
|
720
805
|
d.start.getMinutes(),
|
|
@@ -728,8 +813,8 @@ class J extends x {
|
|
|
728
813
|
0,
|
|
729
814
|
0
|
|
730
815
|
), c < t.end && u > t.start) {
|
|
731
|
-
const
|
|
732
|
-
|
|
816
|
+
const p = `${o}-${l}`, v = this.slotElements.get(p);
|
|
817
|
+
v && v.classList.add("greyed");
|
|
733
818
|
}
|
|
734
819
|
}
|
|
735
820
|
}
|
|
@@ -740,32 +825,32 @@ class J extends x {
|
|
|
740
825
|
if (n === -1) return;
|
|
741
826
|
const i = this.dayColumns[n];
|
|
742
827
|
if (!i) return;
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
const
|
|
828
|
+
const r = new Date(s);
|
|
829
|
+
r.setHours(0, 0, 0, 0);
|
|
830
|
+
const o = (s.getTime() - r.getTime()) / (1e3 * 60), a = (this.state.options.slotDuration ?? 1800) / 60, l = o / a * 40, d = this.createElement("div", "scheduler-now-indicator");
|
|
746
831
|
d.style.top = `${l}px`, i.appendChild(d);
|
|
747
832
|
}
|
|
748
833
|
updateNowIndicator() {
|
|
749
834
|
if (!this.state.options.nowIndicator) return;
|
|
750
835
|
const { date: e, options: t } = this.state, s = h.getWeekDays(e, t.firstDayOfWeek), n = /* @__PURE__ */ new Date(), i = s.findIndex((u) => h.isSameDay(u, n));
|
|
751
836
|
if (i === -1) return;
|
|
752
|
-
const
|
|
753
|
-
if (!
|
|
754
|
-
const
|
|
837
|
+
const r = this.dayColumns[i];
|
|
838
|
+
if (!r) return;
|
|
839
|
+
const o = r.querySelector(".scheduler-now-indicator"), a = new Date(n);
|
|
755
840
|
a.setHours(0, 0, 0, 0);
|
|
756
841
|
const l = (n.getTime() - a.getTime()) / (1e3 * 60), d = (t.slotDuration ?? 1800) / 60, c = l / d * 40;
|
|
757
|
-
if (
|
|
758
|
-
|
|
842
|
+
if (o)
|
|
843
|
+
o.style.top = `${c}px`;
|
|
759
844
|
else {
|
|
760
845
|
const u = this.createElement("div", "scheduler-now-indicator");
|
|
761
|
-
u.style.top = `${c}px`,
|
|
846
|
+
u.style.top = `${c}px`, r.appendChild(u);
|
|
762
847
|
}
|
|
763
848
|
}
|
|
764
849
|
destroy() {
|
|
765
850
|
this.eventElements.clear(), this.slotElements.clear(), this.dayColumns = [], this.clearContainer();
|
|
766
851
|
}
|
|
767
852
|
}
|
|
768
|
-
class
|
|
853
|
+
class se extends A {
|
|
769
854
|
constructor() {
|
|
770
855
|
super(...arguments), this.eventsContainer = null, this.slotElements = /* @__PURE__ */ new Map(), this.dayColumn = null;
|
|
771
856
|
}
|
|
@@ -775,38 +860,55 @@ class Z extends x {
|
|
|
775
860
|
n.style.width = "var(--scheduler-time-gutter-width)", s.appendChild(n);
|
|
776
861
|
const i = this.createElement("div", "scheduler-day-header");
|
|
777
862
|
h.isToday(e) && i.classList.add("today");
|
|
778
|
-
const
|
|
779
|
-
|
|
780
|
-
const
|
|
781
|
-
|
|
863
|
+
const r = this.createElement("div", "day-name");
|
|
864
|
+
r.textContent = h.getDayName(e, t.locale);
|
|
865
|
+
const o = this.createElement("div", "day-number");
|
|
866
|
+
o.textContent = String(e.getDate());
|
|
782
867
|
const a = this.createElement("div", "month-year");
|
|
783
868
|
a.textContent = h.formatDate(e, t.locale, {
|
|
784
869
|
month: "long",
|
|
785
870
|
year: "numeric"
|
|
786
|
-
}), a.style.fontSize = "12px", a.style.color = "#666", i.appendChild(
|
|
871
|
+
}), a.style.fontSize = "12px", a.style.color = "#666", i.appendChild(r), i.appendChild(o), i.appendChild(a), s.appendChild(i), this.container.appendChild(s);
|
|
787
872
|
const l = this.createElement("div", "scheduler-time-grid"), d = this.createElement("div", "scheduler-time-gutter"), c = h.getTimeSlots(
|
|
788
873
|
e,
|
|
789
874
|
t.slotDuration,
|
|
790
875
|
t.slotMinTime,
|
|
791
876
|
t.slotMaxTime
|
|
792
877
|
);
|
|
793
|
-
for (const
|
|
794
|
-
const
|
|
795
|
-
|
|
878
|
+
for (const v of c) {
|
|
879
|
+
const g = this.createElement("div", "scheduler-time-slot-label");
|
|
880
|
+
g.textContent = h.formatTime(v.start, t.timeFormat), d.appendChild(g);
|
|
796
881
|
}
|
|
797
882
|
l.appendChild(d);
|
|
798
883
|
const u = this.createElement("div", "scheduler-days-container");
|
|
799
884
|
this.dayColumn = this.createElement("div", "scheduler-day-column");
|
|
800
|
-
const
|
|
801
|
-
for (let
|
|
802
|
-
const
|
|
803
|
-
f.setAttribute("role", "gridcell"), f.setAttribute("tabindex", "-1"), f.setAttribute("aria-selected", "false"), f.id = `scheduler-cell-d-${
|
|
804
|
-
slotIndex:
|
|
805
|
-
start:
|
|
806
|
-
end:
|
|
807
|
-
}), this.slotElements.set(
|
|
808
|
-
}
|
|
809
|
-
this.eventsContainer = this.createElement("div", "scheduler-events-container"),
|
|
885
|
+
const p = this.dayColumn;
|
|
886
|
+
for (let v = 0; v < c.length; v++) {
|
|
887
|
+
const g = c[v], f = this.createElement("div", "scheduler-time-slot");
|
|
888
|
+
f.setAttribute("role", "gridcell"), f.setAttribute("tabindex", "-1"), f.setAttribute("aria-selected", "false"), f.id = `scheduler-cell-d-${v}`, this.setData(f, {
|
|
889
|
+
slotIndex: v,
|
|
890
|
+
start: g.start.toISOString(),
|
|
891
|
+
end: g.end.toISOString()
|
|
892
|
+
}), this.slotElements.set(v, f), p.appendChild(f);
|
|
893
|
+
}
|
|
894
|
+
this.eventsContainer = this.createElement("div", "scheduler-events-container"), p.appendChild(this.eventsContainer), u.appendChild(p), l.appendChild(u), this.container.appendChild(l), this.renderEvents(), this.updateCellFocusAndSelection(), h.isToday(e) && t.nowIndicator && this.renderNowIndicator(p), this.applyGridRoles({
|
|
895
|
+
multiselectable: !0,
|
|
896
|
+
columnHeaderRow: ":scope > .scheduler-day-headers",
|
|
897
|
+
columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
|
|
898
|
+
presentation: [
|
|
899
|
+
".scheduler-time-gutter-space",
|
|
900
|
+
".scheduler-time-grid",
|
|
901
|
+
".scheduler-time-gutter",
|
|
902
|
+
".scheduler-time-slot-label",
|
|
903
|
+
".scheduler-days-container"
|
|
904
|
+
],
|
|
905
|
+
rows: ".scheduler-day-column",
|
|
906
|
+
// The events overlay is a CELL, not presentation: a presentational
|
|
907
|
+
// wrapper leaves its role=button events owned directly by the row,
|
|
908
|
+
// which is invalid (axe aria-required-children). A gridcell may
|
|
909
|
+
// contain buttons.
|
|
910
|
+
cells: ".scheduler-events-container"
|
|
911
|
+
}), this.markToday();
|
|
810
912
|
}
|
|
811
913
|
/**
|
|
812
914
|
* Apply roving tabindex + aria-selected + `.selected` class to each cached
|
|
@@ -817,11 +919,11 @@ class Z extends x {
|
|
|
817
919
|
let t = !1, s = null;
|
|
818
920
|
for (const [, n] of this.slotElements) {
|
|
819
921
|
s || (s = n);
|
|
820
|
-
const i = n.dataset.start,
|
|
821
|
-
if (!i || !
|
|
822
|
-
const
|
|
922
|
+
const i = n.dataset.start, r = n.dataset.end;
|
|
923
|
+
if (!i || !r) continue;
|
|
924
|
+
const o = { start: new Date(i), end: new Date(r) }, a = !!e && o.start.getTime() === e.start.getTime();
|
|
823
925
|
n.setAttribute("tabindex", a ? "0" : "-1");
|
|
824
|
-
const l =
|
|
926
|
+
const l = K(o, this.state, null);
|
|
825
927
|
n.setAttribute("aria-selected", l ? "true" : "false"), n.classList.toggle("selected", l), a && (t = !0);
|
|
826
928
|
}
|
|
827
929
|
!t && s && s.setAttribute("tabindex", "0");
|
|
@@ -833,61 +935,51 @@ class Z extends x {
|
|
|
833
935
|
n.setHours(0, 0, 0, 0);
|
|
834
936
|
const i = new Date(e);
|
|
835
937
|
i.setHours(23, 59, 59, 999);
|
|
836
|
-
const
|
|
837
|
-
for (const l of
|
|
938
|
+
const r = M.filterByRange(t, n, i), o = [];
|
|
939
|
+
for (const l of r) {
|
|
838
940
|
const { parts: d } = M.splitInParts(l), c = M.filterPartsByRange(d, n, i);
|
|
839
|
-
|
|
941
|
+
o.push(...c);
|
|
840
942
|
}
|
|
841
|
-
const a = M.getTimelinedParts(
|
|
943
|
+
const a = M.getTimelinedParts(o);
|
|
842
944
|
for (const { part: l, trackIndex: d, totalTracks: c, colspan: u } of a) {
|
|
843
945
|
if (!l.event) continue;
|
|
844
|
-
const
|
|
946
|
+
const p = this.createEventElement(
|
|
845
947
|
l,
|
|
846
948
|
d,
|
|
847
949
|
c,
|
|
848
950
|
u,
|
|
849
951
|
s.slotDuration ?? 1800
|
|
850
952
|
);
|
|
851
|
-
this.eventsContainer.appendChild(
|
|
953
|
+
this.eventsContainer.appendChild(p);
|
|
852
954
|
}
|
|
853
955
|
}
|
|
854
956
|
createEventElement(e, t, s, n, i) {
|
|
855
|
-
const
|
|
856
|
-
r.setAttribute("role", "button"),
|
|
957
|
+
const r = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === r.id;
|
|
958
|
+
this.state.keyboardMoveEventId, r.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
|
|
857
959
|
"aria-label",
|
|
858
|
-
|
|
859
|
-
),
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
const
|
|
865
|
-
|
|
960
|
+
L(r, null, this.state.options)
|
|
961
|
+
), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
|
|
962
|
+
const l = new Date(e.start);
|
|
963
|
+
l.setHours(0, 0, 0, 0);
|
|
964
|
+
const d = (e.start.getTime() - l.getTime()) / (1e3 * 60), u = (e.end.getTime() - l.getTime()) / (1e3 * 60) - d, p = i / 60, v = d / p * 40, g = Math.max(u / p * 40, 20), f = t / s * 100, b = n / s * 100;
|
|
965
|
+
o.style.top = `${v}px`, o.style.height = `${g}px`, o.style.left = `${f}%`, o.style.width = `calc(${b}% - 2px)`, o.style.backgroundColor = r.color ?? "#3788d8", o.style.color = r.textColor ?? H(r.color ?? "#3788d8"), this.setData(o, { eventId: r.id });
|
|
966
|
+
const y = this.createElement("div", "event-content"), w = this.createElement("div", "event-title");
|
|
967
|
+
w.textContent = r.title, y.appendChild(w);
|
|
866
968
|
const D = this.createElement("div", "event-time");
|
|
867
|
-
|
|
868
|
-
if (e.isStart) {
|
|
869
|
-
const w = this.createElement("div", "resize-handle", "top");
|
|
870
|
-
this.setData(w, { handle: "start" }), r.appendChild(w);
|
|
871
|
-
}
|
|
872
|
-
if (e.isEnd) {
|
|
873
|
-
const w = this.createElement("div", "resize-handle", "bottom");
|
|
874
|
-
this.setData(w, { handle: "end" }), r.appendChild(w);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
return r;
|
|
969
|
+
return D.textContent = `${h.formatTime(e.start, this.state.options.timeFormat)} - ${h.formatTime(e.end, this.state.options.timeFormat)}`, y.appendChild(D), o.appendChild(y), this.appendResizeHandles(o, e), o;
|
|
878
970
|
}
|
|
879
971
|
renderNowIndicator(e) {
|
|
880
972
|
const t = /* @__PURE__ */ new Date(), s = new Date(t);
|
|
881
973
|
s.setHours(0, 0, 0, 0);
|
|
882
|
-
const n = (t.getTime() - s.getTime()) / (1e3 * 60), i = (this.state.options.slotDuration ?? 1800) / 60,
|
|
883
|
-
|
|
974
|
+
const n = (t.getTime() - s.getTime()) / (1e3 * 60), i = (this.state.options.slotDuration ?? 1800) / 60, r = n / i * 40, o = this.createElement("div", "scheduler-now-indicator");
|
|
975
|
+
o.style.top = `${r}px`, e.appendChild(o);
|
|
884
976
|
}
|
|
885
977
|
updateNowIndicator() {
|
|
886
978
|
if (!this.dayColumn || !this.state.options.nowIndicator || !h.isToday(this.state.date)) return;
|
|
887
979
|
const e = this.dayColumn.querySelector(".scheduler-now-indicator"), t = /* @__PURE__ */ new Date(), s = new Date(t);
|
|
888
980
|
s.setHours(0, 0, 0, 0);
|
|
889
|
-
const n = (t.getTime() - s.getTime()) / (1e3 * 60), i = (this.state.options.slotDuration ?? 1800) / 60,
|
|
890
|
-
e ? e.style.top = `${
|
|
981
|
+
const n = (t.getTime() - s.getTime()) / (1e3 * 60), i = (this.state.options.slotDuration ?? 1800) / 60, r = n / i * 40;
|
|
982
|
+
e ? e.style.top = `${r}px` : this.renderNowIndicator(this.dayColumn);
|
|
891
983
|
}
|
|
892
984
|
update(e) {
|
|
893
985
|
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options);
|
|
@@ -902,17 +994,17 @@ class Z extends x {
|
|
|
902
994
|
}
|
|
903
995
|
updateGreyedSlots() {
|
|
904
996
|
const { dragState: e, previewEvent: t, options: s, date: n } = this.state;
|
|
905
|
-
if (this.slotElements.forEach((
|
|
997
|
+
if (this.slotElements.forEach((r) => r.classList.remove("greyed")), !e || !t || !h.isSameDay(n, t.start)) return;
|
|
906
998
|
const i = h.getTimeSlots(
|
|
907
999
|
n,
|
|
908
1000
|
s.slotDuration,
|
|
909
1001
|
s.slotMinTime,
|
|
910
1002
|
s.slotMaxTime
|
|
911
1003
|
);
|
|
912
|
-
for (let
|
|
913
|
-
const
|
|
914
|
-
if (
|
|
915
|
-
const a = this.slotElements.get(
|
|
1004
|
+
for (let r = 0; r < i.length; r++) {
|
|
1005
|
+
const o = i[r];
|
|
1006
|
+
if (o.start < t.end && o.end > t.start) {
|
|
1007
|
+
const a = this.slotElements.get(r);
|
|
916
1008
|
a && a.classList.add("greyed");
|
|
917
1009
|
}
|
|
918
1010
|
}
|
|
@@ -923,30 +1015,32 @@ class Z extends x {
|
|
|
923
1015
|
e && e.remove();
|
|
924
1016
|
const { previewEvent: t, options: s, date: n } = this.state;
|
|
925
1017
|
if (!t || !h.isSameDay(n, t.start)) return;
|
|
926
|
-
const i = this.createElement("div", "scheduler-event", "preview"),
|
|
927
|
-
|
|
928
|
-
const
|
|
1018
|
+
const i = this.createElement("div", "scheduler-event", "preview"), r = new Date(t.start);
|
|
1019
|
+
r.setHours(0, 0, 0, 0);
|
|
1020
|
+
const o = (t.start.getTime() - r.getTime()) / (1e3 * 60), l = (t.end.getTime() - r.getTime()) / (1e3 * 60) - o, d = (s.slotDuration ?? 1800) / 60, c = o / d * 40, u = Math.max(l / d * 40, 20);
|
|
929
1021
|
i.style.top = `${c}px`, i.style.height = `${u}px`, i.style.left = "0", i.style.width = "100%", this.eventsContainer.appendChild(i);
|
|
930
1022
|
}
|
|
931
1023
|
destroy() {
|
|
932
1024
|
this.eventsContainer = null, this.dayColumn = null, this.slotElements.clear(), this.clearContainer();
|
|
933
1025
|
}
|
|
934
1026
|
}
|
|
935
|
-
class
|
|
1027
|
+
class ne extends A {
|
|
936
1028
|
constructor() {
|
|
937
1029
|
super(...arguments), this.rowElements = /* @__PURE__ */ new Map(), this.slotWidth = 50;
|
|
938
1030
|
}
|
|
939
1031
|
render() {
|
|
940
1032
|
this.clearContainer(), this.container.classList.add("scheduler-timeline-view");
|
|
941
|
-
const { date: e, options: t, resources: s, collapsedGroups: n } = this.state, i = h.getWeekDays(e, t.firstDayOfWeek),
|
|
1033
|
+
const { date: e, options: t, resources: s, collapsedGroups: n } = this.state, i = h.getWeekDays(e, t.firstDayOfWeek), o = C.flatten(s, n).filter((y) => y.visible).length + 1, a = this.createElement("div", "scheduler-timeline");
|
|
942
1034
|
a.setAttribute("role", "grid"), a.setAttribute(
|
|
943
1035
|
"aria-label",
|
|
944
|
-
|
|
945
|
-
|
|
1036
|
+
x(S(t.messages).timelineGridLabel, {
|
|
1037
|
+
date: h.formatDateWithWeekday(i[0], t.locale)
|
|
1038
|
+
})
|
|
1039
|
+
), a.setAttribute("aria-rowcount", String(o)), a.setAttribute("aria-describedby", "scheduler-kbd-grid"), a.setAttribute("aria-multiselectable", "true");
|
|
946
1040
|
const l = this.createElement("div", "scheduler-timeline-header");
|
|
947
1041
|
l.setAttribute("role", "row"), l.setAttribute("aria-rowindex", "1");
|
|
948
1042
|
const d = this.createElement("div", "scheduler-resource-header");
|
|
949
|
-
d.setAttribute("role", "columnheader"), d.textContent =
|
|
1043
|
+
d.setAttribute("role", "columnheader"), d.textContent = S(this.state.options.messages).resourcesHeader, l.appendChild(d);
|
|
950
1044
|
const c = this.createElement("div", "scheduler-timeline-slots-header");
|
|
951
1045
|
for (const y of i) {
|
|
952
1046
|
const D = h.getTimeSlots(
|
|
@@ -954,34 +1048,34 @@ class Q extends x {
|
|
|
954
1048
|
t.slotDuration,
|
|
955
1049
|
t.slotMinTime,
|
|
956
1050
|
t.slotMaxTime
|
|
957
|
-
).length,
|
|
958
|
-
|
|
1051
|
+
).length, E = this.createElement("div", "scheduler-timeline-slot-header");
|
|
1052
|
+
E.setAttribute("role", "columnheader"), E.style.width = `${D * this.slotWidth}px`, E.textContent = h.formatDateWithWeekday(y, t.locale), E.style.borderBottom = "1px solid var(--scheduler-border-color)", c.appendChild(E);
|
|
959
1053
|
}
|
|
960
1054
|
l.appendChild(c), a.appendChild(l);
|
|
961
|
-
const u = this.createElement("div", "scheduler-timeline-header"),
|
|
962
|
-
|
|
963
|
-
const
|
|
1055
|
+
const u = this.createElement("div", "scheduler-timeline-header"), p = this.createElement("div", "scheduler-resource-header");
|
|
1056
|
+
p.style.borderBottom = "1px solid var(--scheduler-border-color)", u.appendChild(p);
|
|
1057
|
+
const v = this.createElement("div", "scheduler-timeline-slots-header");
|
|
964
1058
|
for (const y of i) {
|
|
965
|
-
const
|
|
1059
|
+
const w = h.getTimeSlots(
|
|
966
1060
|
y,
|
|
967
1061
|
t.slotDuration,
|
|
968
1062
|
t.slotMinTime,
|
|
969
1063
|
t.slotMaxTime
|
|
970
1064
|
);
|
|
971
|
-
for (const D of
|
|
972
|
-
const
|
|
973
|
-
|
|
1065
|
+
for (const D of w) {
|
|
1066
|
+
const E = this.createElement("div", "scheduler-timeline-slot-header");
|
|
1067
|
+
E.setAttribute("role", "columnheader"), E.style.width = `${this.slotWidth}px`, E.textContent = h.formatTime(D.start, t.timeFormat), E.style.fontSize = "10px", v.appendChild(E);
|
|
974
1068
|
}
|
|
975
1069
|
}
|
|
976
|
-
u.appendChild(
|
|
977
|
-
const
|
|
1070
|
+
u.appendChild(v), a.appendChild(u);
|
|
1071
|
+
const g = this.createElement("div", "scheduler-timeline-body"), f = C.flatten(s, n);
|
|
978
1072
|
let b = 2;
|
|
979
1073
|
for (const y of f) {
|
|
980
1074
|
if (!y.visible) continue;
|
|
981
|
-
const
|
|
982
|
-
|
|
1075
|
+
const w = this.createResourceRow(y, i);
|
|
1076
|
+
w.setAttribute("aria-rowindex", String(b)), g.appendChild(w), b++;
|
|
983
1077
|
}
|
|
984
|
-
a.appendChild(
|
|
1078
|
+
a.appendChild(g), this.container.appendChild(a), this.renderEvents(i), this.updateCellFocusAndSelection();
|
|
985
1079
|
}
|
|
986
1080
|
/**
|
|
987
1081
|
* Apply roving tabindex + aria-selected + `.selected` class to each
|
|
@@ -991,14 +1085,14 @@ class Q extends x {
|
|
|
991
1085
|
updateCellFocusAndSelection() {
|
|
992
1086
|
const e = this.state.focusedCell, t = this.state.focusedResourceId, s = this.container.querySelectorAll(".scheduler-timeline-slot");
|
|
993
1087
|
let n = !1, i = null;
|
|
994
|
-
s.forEach((
|
|
995
|
-
i || (i =
|
|
996
|
-
const
|
|
997
|
-
if (!
|
|
998
|
-
const d = { start: new Date(
|
|
999
|
-
|
|
1000
|
-
const u =
|
|
1001
|
-
|
|
1088
|
+
s.forEach((r) => {
|
|
1089
|
+
i || (i = r);
|
|
1090
|
+
const o = r.dataset.start, a = r.dataset.end, l = r.dataset.resourceId ?? null;
|
|
1091
|
+
if (!o || !a) return;
|
|
1092
|
+
const d = { start: new Date(o), end: new Date(a) }, c = !!e && d.start.getTime() === e.start.getTime() && t === l;
|
|
1093
|
+
r.setAttribute("tabindex", c ? "0" : "-1");
|
|
1094
|
+
const u = K(d, this.state, l);
|
|
1095
|
+
r.setAttribute("aria-selected", u ? "true" : "false"), r.classList.toggle("selected", u), c && (n = !0);
|
|
1002
1096
|
}), !n && i && i.setAttribute("tabindex", "0");
|
|
1003
1097
|
}
|
|
1004
1098
|
createResourceRow(e, t) {
|
|
@@ -1009,11 +1103,18 @@ class Q extends x {
|
|
|
1009
1103
|
const a = this.createElement("button", "expand-toggle");
|
|
1010
1104
|
a.type = "button";
|
|
1011
1105
|
const l = this.state.collapsedGroups.has(e.item.id);
|
|
1012
|
-
a.textContent = l ? "▶" : "▼", a.setAttribute("aria-expanded", String(!l)), a.setAttribute(
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1106
|
+
a.textContent = l ? "▶" : "▼", a.setAttribute("aria-expanded", String(!l)), a.setAttribute(
|
|
1107
|
+
"aria-label",
|
|
1108
|
+
x(
|
|
1109
|
+
S(this.state.options.messages)[l ? "expandGroup" : "collapseGroup"],
|
|
1110
|
+
{ title: e.item.title }
|
|
1111
|
+
)
|
|
1112
|
+
), this.setData(a, { groupId: e.item.id }), i.appendChild(a);
|
|
1113
|
+
}
|
|
1114
|
+
const r = this.createElement("span");
|
|
1115
|
+
r.textContent = e.item.title, i.appendChild(r), n.appendChild(i);
|
|
1116
|
+
const o = this.createElement("div", "scheduler-timeline-slots");
|
|
1117
|
+
o.setAttribute("role", "presentation");
|
|
1017
1118
|
for (const a of t) {
|
|
1018
1119
|
const l = h.getTimeSlots(
|
|
1019
1120
|
a,
|
|
@@ -1027,32 +1128,32 @@ class Q extends x {
|
|
|
1027
1128
|
resourceId: e.item.id,
|
|
1028
1129
|
start: d.start.toISOString(),
|
|
1029
1130
|
end: d.end.toISOString()
|
|
1030
|
-
}),
|
|
1131
|
+
}), o.appendChild(c);
|
|
1031
1132
|
}
|
|
1032
1133
|
}
|
|
1033
|
-
if (
|
|
1134
|
+
if (W(e.item)) {
|
|
1034
1135
|
const a = this.createElement("div", "scheduler-timeline-events");
|
|
1035
|
-
|
|
1136
|
+
a.setAttribute("role", "gridcell"), o.appendChild(a);
|
|
1036
1137
|
}
|
|
1037
|
-
return n.appendChild(
|
|
1138
|
+
return n.appendChild(o), this.rowElements.set(e.item.id, n), n;
|
|
1038
1139
|
}
|
|
1039
1140
|
renderEvents(e) {
|
|
1040
|
-
const { events: t, resources: s, options: n, collapsedGroups: i } = this.state,
|
|
1041
|
-
|
|
1141
|
+
const { events: t, resources: s, options: n, collapsedGroups: i } = this.state, r = e[0], o = new Date(e[6]);
|
|
1142
|
+
o.setHours(23, 59, 59, 999);
|
|
1042
1143
|
const d = h.getTimeSlots(
|
|
1043
1144
|
e[0],
|
|
1044
1145
|
n.slotDuration,
|
|
1045
1146
|
n.slotMinTime,
|
|
1046
1147
|
n.slotMaxTime
|
|
1047
|
-
).length * 7 * this.slotWidth, c =
|
|
1148
|
+
).length * 7 * this.slotWidth, c = C.getAllResources(s);
|
|
1048
1149
|
for (const u of c) {
|
|
1049
|
-
const
|
|
1150
|
+
const p = this.rowElements.get(u.id);
|
|
1151
|
+
if (!p) continue;
|
|
1152
|
+
const v = p.querySelector(".scheduler-timeline-events");
|
|
1050
1153
|
if (!v) continue;
|
|
1051
|
-
|
|
1052
|
-
if (!m) continue;
|
|
1053
|
-
m.innerHTML = "";
|
|
1154
|
+
v.innerHTML = "";
|
|
1054
1155
|
const f = (u.events ?? []).filter(
|
|
1055
|
-
(y) => y.start <
|
|
1156
|
+
(y) => y.start < o && y.end > r
|
|
1056
1157
|
).map((y) => ({
|
|
1057
1158
|
id: y.id,
|
|
1058
1159
|
event: y,
|
|
@@ -1063,30 +1164,64 @@ class Q extends x {
|
|
|
1063
1164
|
dayIndex: 0,
|
|
1064
1165
|
totalDays: 1
|
|
1065
1166
|
})), b = M.getTimelinedParts(f);
|
|
1066
|
-
for (const { part: y, trackIndex:
|
|
1167
|
+
for (const { part: y, trackIndex: w, totalTracks: D, colspan: E } of b) {
|
|
1067
1168
|
if (!y.event) continue;
|
|
1068
|
-
const
|
|
1169
|
+
const I = this.createEventElement(
|
|
1069
1170
|
y.event,
|
|
1070
|
-
E,
|
|
1071
|
-
D,
|
|
1072
1171
|
w,
|
|
1073
|
-
|
|
1172
|
+
D,
|
|
1173
|
+
E,
|
|
1174
|
+
r,
|
|
1074
1175
|
d,
|
|
1075
1176
|
n.slotDuration ?? 1800,
|
|
1076
1177
|
u.title
|
|
1077
1178
|
);
|
|
1078
|
-
|
|
1179
|
+
v.appendChild(I);
|
|
1079
1180
|
}
|
|
1080
1181
|
}
|
|
1081
1182
|
}
|
|
1082
|
-
createEventElement(e, t, s, n, i,
|
|
1083
|
-
const l = this.createElement("div", "scheduler-timeline-event"), d = this.state.selectedEvent?.id === e.id
|
|
1084
|
-
l.setAttribute("role", "button"), l.setAttribute("tabindex", "0"), l.setAttribute(
|
|
1183
|
+
createEventElement(e, t, s, n, i, r, o, a = null) {
|
|
1184
|
+
const l = this.createElement("div", "scheduler-timeline-event"), d = this.state.selectedEvent?.id === e.id;
|
|
1185
|
+
this.state.keyboardMoveEventId, e.id, l.setAttribute("role", "button"), l.setAttribute("tabindex", "0"), l.setAttribute(
|
|
1085
1186
|
"aria-label",
|
|
1086
|
-
|
|
1087
|
-
),
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1187
|
+
L(e, a, this.state.options)
|
|
1188
|
+
), l.setAttribute("aria-pressed", d ? "true" : "false"), l.setAttribute("aria-describedby", "scheduler-kbd-event"), d && l.classList.add("selected");
|
|
1189
|
+
const c = Math.max(e.start.getTime(), i.getTime()), u = i.getTime() + 10080 * 60 * 1e3, p = Math.min(e.end.getTime(), u), v = c - i.getTime(), g = p - c, f = u - i.getTime(), b = v / f * r, y = Math.max(g / f * r, 20), w = t / s * 100, D = n / s * 100;
|
|
1190
|
+
l.style.left = `${b}px`, l.style.width = `${y}px`, l.style.top = `${w}%`, l.style.height = `${D}%`, l.style.backgroundColor = e.color ?? "#3788d8", l.style.color = e.textColor ?? H(e.color ?? "#3788d8"), this.setData(l, { eventId: e.id });
|
|
1191
|
+
const E = this.createElement("div", "event-content"), I = this.createElement("div", "event-title");
|
|
1192
|
+
return I.textContent = e.title, E.appendChild(I), l.appendChild(E), this.appendResizeHandles(
|
|
1193
|
+
l,
|
|
1194
|
+
{
|
|
1195
|
+
id: e.id,
|
|
1196
|
+
event: e,
|
|
1197
|
+
start: e.start,
|
|
1198
|
+
end: e.end,
|
|
1199
|
+
isStart: e.start.getTime() >= i.getTime(),
|
|
1200
|
+
isEnd: e.end.getTime() <= u,
|
|
1201
|
+
dayIndex: 0,
|
|
1202
|
+
totalDays: 1
|
|
1203
|
+
},
|
|
1204
|
+
["left", "right"]
|
|
1205
|
+
), l;
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Dashed ghost showing where the dragged event will land, rendered in the
|
|
1209
|
+
* dragged event's own resource row (pointer drags don't change resource).
|
|
1210
|
+
* Mirrors week-view.renderPreviewEvent for the horizontal axis.
|
|
1211
|
+
*/
|
|
1212
|
+
renderPreviewEvent(e) {
|
|
1213
|
+
this.container.querySelector(".scheduler-timeline-event.preview")?.remove();
|
|
1214
|
+
const { dragState: t, previewEvent: s, resources: n, options: i } = this.state, r = t?.event?.id;
|
|
1215
|
+
if (!r || !s) return;
|
|
1216
|
+
const o = C.getAllResources(n).find((y) => (y.events ?? []).some((w) => w.id === r)), l = (o ? this.rowElements.get(o.id) : null)?.querySelector(".scheduler-timeline-events");
|
|
1217
|
+
if (!l) return;
|
|
1218
|
+
const c = h.getTimeSlots(
|
|
1219
|
+
e[0],
|
|
1220
|
+
i.slotDuration,
|
|
1221
|
+
i.slotMinTime,
|
|
1222
|
+
i.slotMaxTime
|
|
1223
|
+
).length * 7 * this.slotWidth, u = e[0], p = u.getTime() + 10080 * 60 * 1e3, v = Math.max(s.start.getTime(), u.getTime()), g = Math.min(s.end.getTime(), p), f = p - u.getTime(), b = this.createElement("div", "scheduler-timeline-event", "preview");
|
|
1224
|
+
b.style.left = `${(v - u.getTime()) / f * c}px`, b.style.width = `${Math.max((g - v) / f * c, 20)}px`, l.appendChild(b);
|
|
1090
1225
|
}
|
|
1091
1226
|
update(e) {
|
|
1092
1227
|
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options);
|
|
@@ -1096,7 +1231,7 @@ class Q extends x {
|
|
|
1096
1231
|
}
|
|
1097
1232
|
this.updateGreyedSlots();
|
|
1098
1233
|
const n = h.getWeekDays(e.date, e.options.firstDayOfWeek);
|
|
1099
|
-
this.renderEvents(n), this.updateCellFocusAndSelection();
|
|
1234
|
+
this.renderEvents(n), this.renderPreviewEvent(n), this.updateCellFocusAndSelection();
|
|
1100
1235
|
}
|
|
1101
1236
|
optionsRequireRerender(e, t) {
|
|
1102
1237
|
return e.slotDuration !== t.slotDuration || e.timeFormat !== t.timeFormat || e.firstDayOfWeek !== t.firstDayOfWeek || e.slotMinTime !== t.slotMinTime || e.slotMaxTime !== t.slotMaxTime || e.locale !== t.locale;
|
|
@@ -1104,15 +1239,16 @@ class Q extends x {
|
|
|
1104
1239
|
updateGreyedSlots() {
|
|
1105
1240
|
const { dragState: e, previewEvent: t } = this.state, s = this.container.querySelectorAll(".scheduler-timeline-slot");
|
|
1106
1241
|
s.forEach((n) => n.classList.remove("greyed")), !(!e || !t) && s.forEach((n) => {
|
|
1107
|
-
const i = new Date(n.dataset.start ?? ""),
|
|
1108
|
-
i < t.end &&
|
|
1242
|
+
const i = new Date(n.dataset.start ?? ""), r = new Date(n.dataset.end ?? "");
|
|
1243
|
+
i < t.end && r > t.start && n.classList.add("greyed");
|
|
1109
1244
|
});
|
|
1110
1245
|
}
|
|
1111
1246
|
destroy() {
|
|
1112
1247
|
this.rowElements.clear(), this.clearContainer();
|
|
1113
1248
|
}
|
|
1114
1249
|
}
|
|
1115
|
-
const
|
|
1250
|
+
const ie = N(`@charset "UTF-8";
|
|
1251
|
+
:host {
|
|
1116
1252
|
display: block;
|
|
1117
1253
|
height: 100%;
|
|
1118
1254
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
|
|
@@ -1128,12 +1264,29 @@ const ee = W(`:host {
|
|
|
1128
1264
|
--scheduler-greyed-slot-bg: rgba(0, 0, 0, 0.1);
|
|
1129
1265
|
--scheduler-column-min-width: 120px;
|
|
1130
1266
|
--scheduler-touch-hold-duration: 500ms;
|
|
1267
|
+
--scheduler-resize-glyph-size: 14px;
|
|
1268
|
+
--scheduler-resize-glyph-color: var(--bs-body-color, #212529);
|
|
1269
|
+
--scheduler-resize-glyph-bg: var(--bs-body-bg, #fff);
|
|
1131
1270
|
}
|
|
1132
1271
|
|
|
1133
1272
|
* {
|
|
1134
1273
|
box-sizing: border-box;
|
|
1135
1274
|
}
|
|
1136
1275
|
|
|
1276
|
+
/* Off-screen but readable by AT — carries the aria-describedby keymap
|
|
1277
|
+
instructions (never applied to focusable elements). */
|
|
1278
|
+
.visually-hidden {
|
|
1279
|
+
position: absolute;
|
|
1280
|
+
width: 1px;
|
|
1281
|
+
height: 1px;
|
|
1282
|
+
margin: -1px;
|
|
1283
|
+
padding: 0;
|
|
1284
|
+
overflow: hidden;
|
|
1285
|
+
clip-path: inset(50%);
|
|
1286
|
+
white-space: nowrap;
|
|
1287
|
+
border: 0;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1137
1290
|
.scheduler-container {
|
|
1138
1291
|
display: flex;
|
|
1139
1292
|
flex-direction: column;
|
|
@@ -1144,17 +1297,44 @@ const ee = W(`:host {
|
|
|
1144
1297
|
background: var(--bs-body-bg);
|
|
1145
1298
|
}
|
|
1146
1299
|
|
|
1147
|
-
/* Header
|
|
1300
|
+
/* Header — wraps as GROUPS when narrow ([data-narrow], set by a
|
|
1301
|
+
ResizeObserver on component width): nav + view switcher share the first
|
|
1302
|
+
row(s), the title takes a full-width row, so no control ever leaves reach
|
|
1303
|
+
and the title never word-wraps (PRD D9). */
|
|
1148
1304
|
.scheduler-header {
|
|
1149
1305
|
display: flex;
|
|
1150
1306
|
align-items: center;
|
|
1151
1307
|
justify-content: space-between;
|
|
1308
|
+
flex-wrap: wrap;
|
|
1309
|
+
gap: 8px;
|
|
1152
1310
|
padding: 8px 12px;
|
|
1153
1311
|
background: var(--scheduler-header-bg);
|
|
1154
1312
|
border-bottom: 1px solid var(--scheduler-border-color);
|
|
1155
1313
|
flex-shrink: 0;
|
|
1156
1314
|
}
|
|
1157
1315
|
|
|
1316
|
+
.scheduler-header[data-narrow] {
|
|
1317
|
+
justify-content: center;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
.scheduler-header[data-narrow] .scheduler-nav {
|
|
1321
|
+
order: 1;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
.scheduler-header[data-narrow] .scheduler-view-switcher {
|
|
1325
|
+
order: 2;
|
|
1326
|
+
flex-wrap: wrap;
|
|
1327
|
+
justify-content: center;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
.scheduler-header[data-narrow] .scheduler-title {
|
|
1331
|
+
order: 3;
|
|
1332
|
+
flex-basis: 100%;
|
|
1333
|
+
text-align: center;
|
|
1334
|
+
overflow: hidden;
|
|
1335
|
+
text-overflow: ellipsis;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1158
1338
|
.scheduler-nav {
|
|
1159
1339
|
display: flex;
|
|
1160
1340
|
align-items: center;
|
|
@@ -1177,6 +1357,9 @@ const ee = W(`:host {
|
|
|
1177
1357
|
.scheduler-title {
|
|
1178
1358
|
font-size: 18px;
|
|
1179
1359
|
font-weight: 600;
|
|
1360
|
+
/* Never word-wrap the period title — multi-line titles distorted the whole
|
|
1361
|
+
header on phones; narrow mode compacts the text instead. */
|
|
1362
|
+
white-space: nowrap;
|
|
1180
1363
|
}
|
|
1181
1364
|
|
|
1182
1365
|
.scheduler-view-switcher {
|
|
@@ -1350,14 +1533,29 @@ const ee = W(`:host {
|
|
|
1350
1533
|
border-radius: var(--scheduler-event-border-radius);
|
|
1351
1534
|
padding: 2px 4px;
|
|
1352
1535
|
font-size: 12px;
|
|
1353
|
-
|
|
1536
|
+
/* The box stays unclipped so the selected-state resize handles/glyphs can
|
|
1537
|
+
straddle the top/bottom edges; text clipping lives on .event-content. */
|
|
1538
|
+
overflow: visible;
|
|
1354
1539
|
cursor: pointer;
|
|
1355
1540
|
pointer-events: auto;
|
|
1356
1541
|
border-left: 3px solid rgba(0, 0, 0, 0.2);
|
|
1357
1542
|
}
|
|
1358
1543
|
|
|
1544
|
+
.scheduler-event .event-content,
|
|
1545
|
+
.scheduler-timeline-event .event-content {
|
|
1546
|
+
height: 100%;
|
|
1547
|
+
overflow: hidden;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
.scheduler-timeline-event .event-title {
|
|
1551
|
+
white-space: nowrap;
|
|
1552
|
+
overflow: hidden;
|
|
1553
|
+
text-overflow: ellipsis;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1359
1556
|
/* Prevent browser from handling touch gestures on events (enables drag) */
|
|
1360
|
-
.scheduler-event:not(.preview)
|
|
1557
|
+
.scheduler-event:not(.preview),
|
|
1558
|
+
.scheduler-timeline-event:not(.preview) {
|
|
1361
1559
|
touch-action: none;
|
|
1362
1560
|
-ms-touch-action: none;
|
|
1363
1561
|
}
|
|
@@ -1366,8 +1564,24 @@ const ee = W(`:host {
|
|
|
1366
1564
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
1367
1565
|
}
|
|
1368
1566
|
|
|
1567
|
+
/* Focus indicator independent of the .selected box-shadow — selection can be
|
|
1568
|
+
driven externally, so focus needs its own visible signal (audit MAJOR).
|
|
1569
|
+
Inset like the slot outlines so it isn't clipped by scroll containers. */
|
|
1570
|
+
.scheduler-event:focus-visible,
|
|
1571
|
+
.scheduler-timeline-event:focus-visible,
|
|
1572
|
+
.scheduler-month-event:focus-visible,
|
|
1573
|
+
.scheduler-month-day:focus-visible,
|
|
1574
|
+
.scheduler-year-month:focus-visible {
|
|
1575
|
+
outline: 2px solid var(--bs-primary);
|
|
1576
|
+
outline-offset: -2px;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1369
1579
|
.scheduler-event.selected {
|
|
1370
1580
|
box-shadow: 0 0 0 3px var(--bs-body-color);
|
|
1581
|
+
/* Raise above sibling events so the straddling handles win pointer hits.
|
|
1582
|
+
At most one event is selected; the now-indicator (z-index 5) stays above
|
|
1583
|
+
but is pointer-events: none. */
|
|
1584
|
+
z-index: 2;
|
|
1371
1585
|
}
|
|
1372
1586
|
|
|
1373
1587
|
.scheduler-event .event-title {
|
|
@@ -1388,13 +1602,18 @@ const ee = W(`:host {
|
|
|
1388
1602
|
pointer-events: none;
|
|
1389
1603
|
}
|
|
1390
1604
|
|
|
1391
|
-
/* Resize handles
|
|
1605
|
+
/* Resize handles — invisible 8px strips on every resizable event (the
|
|
1606
|
+
long-standing mouse hit zone). On the SELECTED event they grow to a
|
|
1607
|
+
WCAG-2.5.8-sized strip centered on the edge (half outside the box) and
|
|
1608
|
+
reveal the round glyph, which is the documented touch affordance. */
|
|
1392
1609
|
.scheduler-event .resize-handle {
|
|
1393
1610
|
position: absolute;
|
|
1394
1611
|
left: 0;
|
|
1395
1612
|
right: 0;
|
|
1396
1613
|
height: 8px;
|
|
1397
1614
|
cursor: ns-resize;
|
|
1615
|
+
touch-action: none;
|
|
1616
|
+
-ms-touch-action: none;
|
|
1398
1617
|
}
|
|
1399
1618
|
|
|
1400
1619
|
.scheduler-event .resize-handle.top {
|
|
@@ -1405,6 +1624,55 @@ const ee = W(`:host {
|
|
|
1405
1624
|
bottom: 0;
|
|
1406
1625
|
}
|
|
1407
1626
|
|
|
1627
|
+
.scheduler-event.selected .resize-handle {
|
|
1628
|
+
height: 24px;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
.scheduler-event.selected .resize-handle.top {
|
|
1632
|
+
top: -12px;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
.scheduler-event.selected .resize-handle.bottom {
|
|
1636
|
+
bottom: -12px;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
@media (pointer: coarse) {
|
|
1640
|
+
.scheduler-event.selected .resize-handle {
|
|
1641
|
+
height: 44px;
|
|
1642
|
+
}
|
|
1643
|
+
.scheduler-event.selected .resize-handle.top {
|
|
1644
|
+
top: -22px;
|
|
1645
|
+
}
|
|
1646
|
+
.scheduler-event.selected .resize-handle.bottom {
|
|
1647
|
+
bottom: -22px;
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
/* Decorative resize glyph, revealed by selection. Never focusable and
|
|
1651
|
+
aria-hidden — the keyboard resize path is move-mode on the event itself.
|
|
1652
|
+
Border + background only, so forced-colors mode keeps it visible. */
|
|
1653
|
+
.scheduler-event .resize-glyph,
|
|
1654
|
+
.scheduler-timeline-event .resize-glyph {
|
|
1655
|
+
position: absolute;
|
|
1656
|
+
top: 50%;
|
|
1657
|
+
left: 50%;
|
|
1658
|
+
width: var(--scheduler-resize-glyph-size);
|
|
1659
|
+
height: var(--scheduler-resize-glyph-size);
|
|
1660
|
+
transform: translate(-50%, -50%);
|
|
1661
|
+
border: 2px solid var(--scheduler-resize-glyph-color);
|
|
1662
|
+
border-radius: 50%;
|
|
1663
|
+
background: var(--scheduler-resize-glyph-bg);
|
|
1664
|
+
opacity: 0;
|
|
1665
|
+
visibility: hidden;
|
|
1666
|
+
transition: opacity 0.15s ease;
|
|
1667
|
+
pointer-events: none;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
.scheduler-event.selected .resize-glyph,
|
|
1671
|
+
.scheduler-timeline-event.selected .resize-glyph {
|
|
1672
|
+
opacity: 1;
|
|
1673
|
+
visibility: visible;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1408
1676
|
/* Now indicator */
|
|
1409
1677
|
.scheduler-now-indicator {
|
|
1410
1678
|
position: absolute;
|
|
@@ -1428,6 +1696,10 @@ const ee = W(`:host {
|
|
|
1428
1696
|
}
|
|
1429
1697
|
|
|
1430
1698
|
/* Month View */
|
|
1699
|
+
.scheduler-month-week {
|
|
1700
|
+
display: contents;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1431
1703
|
.scheduler-month-grid {
|
|
1432
1704
|
display: grid;
|
|
1433
1705
|
grid-template-columns: repeat(7, 1fr);
|
|
@@ -1670,15 +1942,66 @@ const ee = W(`:host {
|
|
|
1670
1942
|
border-radius: var(--scheduler-event-border-radius);
|
|
1671
1943
|
padding: 2px 6px;
|
|
1672
1944
|
font-size: 12px;
|
|
1673
|
-
|
|
1945
|
+
/* Unclipped so the selected-state handles/glyphs straddle the left/right
|
|
1946
|
+
edges; title clipping lives on .event-content (same as .scheduler-event). */
|
|
1947
|
+
overflow: visible;
|
|
1674
1948
|
cursor: pointer;
|
|
1675
1949
|
pointer-events: auto;
|
|
1676
1950
|
}
|
|
1677
1951
|
|
|
1678
1952
|
.scheduler-timeline-event.selected {
|
|
1679
1953
|
box-shadow: 0 0 0 3px var(--bs-body-color);
|
|
1954
|
+
z-index: 2;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
.scheduler-timeline-event.preview {
|
|
1958
|
+
background: var(--scheduler-preview-bg);
|
|
1959
|
+
border: 2px dashed var(--bs-primary);
|
|
1960
|
+
pointer-events: none;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
/* Horizontal resize handles — timeline counterpart of the week/day strips. */
|
|
1964
|
+
.scheduler-timeline-event .resize-handle {
|
|
1965
|
+
position: absolute;
|
|
1966
|
+
top: 0;
|
|
1967
|
+
bottom: 0;
|
|
1968
|
+
width: 8px;
|
|
1969
|
+
cursor: ew-resize;
|
|
1970
|
+
touch-action: none;
|
|
1971
|
+
-ms-touch-action: none;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
.scheduler-timeline-event .resize-handle.left {
|
|
1975
|
+
left: 0;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
.scheduler-timeline-event .resize-handle.right {
|
|
1979
|
+
right: 0;
|
|
1680
1980
|
}
|
|
1681
1981
|
|
|
1982
|
+
.scheduler-timeline-event.selected .resize-handle {
|
|
1983
|
+
width: 24px;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
.scheduler-timeline-event.selected .resize-handle.left {
|
|
1987
|
+
left: -12px;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
.scheduler-timeline-event.selected .resize-handle.right {
|
|
1991
|
+
right: -12px;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
@media (pointer: coarse) {
|
|
1995
|
+
.scheduler-timeline-event.selected .resize-handle {
|
|
1996
|
+
width: 44px;
|
|
1997
|
+
}
|
|
1998
|
+
.scheduler-timeline-event.selected .resize-handle.left {
|
|
1999
|
+
left: -22px;
|
|
2000
|
+
}
|
|
2001
|
+
.scheduler-timeline-event.selected .resize-handle.right {
|
|
2002
|
+
right: -22px;
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
1682
2005
|
/* Loading state */
|
|
1683
2006
|
.scheduler-loading {
|
|
1684
2007
|
display: flex;
|
|
@@ -1781,18 +2104,19 @@ const ee = W(`:host {
|
|
|
1781
2104
|
|
|
1782
2105
|
@media (prefers-reduced-motion: reduce) {
|
|
1783
2106
|
.scheduler-event,
|
|
1784
|
-
.scheduler-timeline-event
|
|
2107
|
+
.scheduler-timeline-event,
|
|
2108
|
+
.resize-glyph {
|
|
1785
2109
|
animation: none !important;
|
|
1786
2110
|
transition: none !important;
|
|
1787
2111
|
}
|
|
1788
|
-
}`),
|
|
2112
|
+
}`), O = {
|
|
1789
2113
|
dragThreshold: 5,
|
|
1790
2114
|
minDurationMs: 1800 * 1e3
|
|
1791
2115
|
// 30 minutes
|
|
1792
2116
|
};
|
|
1793
|
-
class
|
|
2117
|
+
class re {
|
|
1794
2118
|
constructor(e = {}) {
|
|
1795
|
-
this.config = { ...
|
|
2119
|
+
this.config = { ...O, ...e };
|
|
1796
2120
|
}
|
|
1797
2121
|
/**
|
|
1798
2122
|
* Calculate the preview event position based on drag state.
|
|
@@ -1834,8 +2158,8 @@ class te {
|
|
|
1834
2158
|
* Preserves event duration, applies offset from drag start.
|
|
1835
2159
|
*/
|
|
1836
2160
|
calculateMovePreview(e, t, s) {
|
|
1837
|
-
const n = t.start.getTime() - e.start.getTime(), i = s.end.getTime() - s.start.getTime(),
|
|
1838
|
-
return { start:
|
|
2161
|
+
const n = t.start.getTime() - e.start.getTime(), i = s.end.getTime() - s.start.getTime(), r = new Date(s.start.getTime() + n), o = new Date(r.getTime() + i);
|
|
2162
|
+
return { start: r, end: o };
|
|
1839
2163
|
}
|
|
1840
2164
|
/**
|
|
1841
2165
|
* Calculate preview for resizing event start.
|
|
@@ -1860,36 +2184,36 @@ class te {
|
|
|
1860
2184
|
return { start: t.start, end: n };
|
|
1861
2185
|
}
|
|
1862
2186
|
}
|
|
1863
|
-
function
|
|
2187
|
+
function T(m) {
|
|
1864
2188
|
return {
|
|
1865
2189
|
pointerId: 0,
|
|
1866
2190
|
pointerType: "mouse",
|
|
1867
|
-
clientX:
|
|
1868
|
-
clientY:
|
|
1869
|
-
originalEvent:
|
|
1870
|
-
target:
|
|
2191
|
+
clientX: m.clientX,
|
|
2192
|
+
clientY: m.clientY,
|
|
2193
|
+
originalEvent: m,
|
|
2194
|
+
target: m.target,
|
|
1871
2195
|
isPrimary: !0
|
|
1872
2196
|
};
|
|
1873
2197
|
}
|
|
1874
|
-
function
|
|
1875
|
-
const e =
|
|
2198
|
+
function z(m) {
|
|
2199
|
+
const e = m.touches[0] || m.changedTouches[0];
|
|
1876
2200
|
return e ? {
|
|
1877
2201
|
pointerId: e.identifier,
|
|
1878
2202
|
pointerType: "touch",
|
|
1879
2203
|
clientX: e.clientX,
|
|
1880
2204
|
clientY: e.clientY,
|
|
1881
|
-
originalEvent:
|
|
2205
|
+
originalEvent: m,
|
|
1882
2206
|
target: e.target,
|
|
1883
2207
|
isPrimary: e.identifier === 0
|
|
1884
2208
|
} : null;
|
|
1885
2209
|
}
|
|
1886
|
-
function
|
|
1887
|
-
const t = e.x -
|
|
2210
|
+
function U(m, e) {
|
|
2211
|
+
const t = e.x - m.x, s = e.y - m.y;
|
|
1888
2212
|
return Math.sqrt(t * t + s * s);
|
|
1889
2213
|
}
|
|
1890
|
-
class
|
|
2214
|
+
class oe {
|
|
1891
2215
|
constructor(e = {}) {
|
|
1892
|
-
this.state = { phase: "idle" }, this.config = { ...
|
|
2216
|
+
this.state = { phase: "idle" }, this.config = { ...O, ...e }, this.previewCalculator = new re(this.config);
|
|
1893
2217
|
}
|
|
1894
2218
|
/**
|
|
1895
2219
|
* Get current state (read-only).
|
|
@@ -1982,20 +2306,20 @@ class se {
|
|
|
1982
2306
|
transitionFromIdle(e) {
|
|
1983
2307
|
if (e.type !== "POINTER_DOWN")
|
|
1984
2308
|
return this.state;
|
|
1985
|
-
const { target: t, position: s, slot: n, slotElement: i, immediate:
|
|
1986
|
-
if (!
|
|
2309
|
+
const { target: t, position: s, slot: n, slotElement: i, immediate: r } = e, o = this.getOperationType(t);
|
|
2310
|
+
if (!o)
|
|
1987
2311
|
return this.state;
|
|
1988
2312
|
const a = t.event ?? null;
|
|
1989
2313
|
if (a && a.draggable === !1)
|
|
1990
2314
|
return this.state;
|
|
1991
|
-
if (
|
|
2315
|
+
if (r) {
|
|
1992
2316
|
let l = n;
|
|
1993
|
-
if (!l && a &&
|
|
2317
|
+
if (!l && a && (l = {
|
|
1994
2318
|
start: a.start,
|
|
1995
2319
|
end: a.end
|
|
1996
2320
|
}), l) {
|
|
1997
2321
|
const d = this.previewCalculator.calculatePreview(
|
|
1998
|
-
|
|
2322
|
+
o,
|
|
1999
2323
|
l,
|
|
2000
2324
|
l,
|
|
2001
2325
|
a
|
|
@@ -2003,7 +2327,7 @@ class se {
|
|
|
2003
2327
|
if (d)
|
|
2004
2328
|
return {
|
|
2005
2329
|
phase: "active",
|
|
2006
|
-
operationType:
|
|
2330
|
+
operationType: o,
|
|
2007
2331
|
event: a,
|
|
2008
2332
|
startSlot: l,
|
|
2009
2333
|
currentSlot: l,
|
|
@@ -2014,7 +2338,7 @@ class se {
|
|
|
2014
2338
|
}
|
|
2015
2339
|
return {
|
|
2016
2340
|
phase: "pending",
|
|
2017
|
-
operationType:
|
|
2341
|
+
operationType: o,
|
|
2018
2342
|
event: a,
|
|
2019
2343
|
startPosition: s,
|
|
2020
2344
|
startSlot: n,
|
|
@@ -2028,7 +2352,7 @@ class se {
|
|
|
2028
2352
|
if (this.state.phase !== "pending") return this.state;
|
|
2029
2353
|
switch (e.type) {
|
|
2030
2354
|
case "POINTER_MOVE":
|
|
2031
|
-
return
|
|
2355
|
+
return U(
|
|
2032
2356
|
this.state.startPosition,
|
|
2033
2357
|
e.position
|
|
2034
2358
|
) < this.config.dragThreshold ? this.state : this.activateDrag(e.slot);
|
|
@@ -2146,9 +2470,9 @@ class se {
|
|
|
2146
2470
|
} : { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date() };
|
|
2147
2471
|
}
|
|
2148
2472
|
}
|
|
2149
|
-
class
|
|
2473
|
+
class ae {
|
|
2150
2474
|
constructor(e, t = {}) {
|
|
2151
|
-
this.pendingUpdate = null, this.latestPointer = null, this.getSlotAtPosition = null, this.stateManager = e, this.config = { ...
|
|
2475
|
+
this.pendingUpdate = null, this.latestPointer = null, this.getSlotAtPosition = null, this.stateManager = e, this.config = { ...O, ...t }, this.stateMachine = new oe(this.config);
|
|
2152
2476
|
}
|
|
2153
2477
|
/**
|
|
2154
2478
|
* Set the function used to get a slot at a position.
|
|
@@ -2239,7 +2563,7 @@ class ne {
|
|
|
2239
2563
|
*/
|
|
2240
2564
|
createEventFromResult(e) {
|
|
2241
2565
|
return {
|
|
2242
|
-
id:
|
|
2566
|
+
id: _(),
|
|
2243
2567
|
title: "New Event",
|
|
2244
2568
|
start: e.preview.start,
|
|
2245
2569
|
end: e.preview.end,
|
|
@@ -2292,8 +2616,8 @@ class ne {
|
|
|
2292
2616
|
this.pendingUpdate !== null && (cancelAnimationFrame(this.pendingUpdate), this.pendingUpdate = null), this.latestPointer = null;
|
|
2293
2617
|
}
|
|
2294
2618
|
}
|
|
2295
|
-
const
|
|
2296
|
-
class
|
|
2619
|
+
const le = 600, de = 10;
|
|
2620
|
+
class ce {
|
|
2297
2621
|
constructor(e, t) {
|
|
2298
2622
|
this.touchHoldTimer = null, this.touchStartPosition = null, this.isTouchDragMode = !1, this.touchHoldTarget = null, this.touchHoldPointer = null, this.isPanMode = !1, this.panStartPosition = null, this.panStartScroll = null, this.panStartedOnEvent = !1, this.savedBodyStyles = null, this.config = e, this.callbacks = t, this.boundHandleMouseDown = this.handleMouseDown.bind(this), this.boundHandleMouseMove = this.handleMouseMove.bind(this), this.boundHandleMouseUp = this.handleMouseUp.bind(this), this.boundHandleClick = this.handleClick.bind(this), this.boundHandleDblClick = this.handleDblClick.bind(this), this.boundHandleTouchStart = this.handleTouchStart.bind(this), this.boundHandleTouchMove = this.handleTouchMove.bind(this), this.boundHandleTouchEnd = this.handleTouchEnd.bind(this), this.boundHandleTouchCancel = this.handleTouchCancel.bind(this);
|
|
2299
2623
|
}
|
|
@@ -2327,19 +2651,23 @@ class re {
|
|
|
2327
2651
|
analyzeTarget(e) {
|
|
2328
2652
|
const t = e.closest(".resize-handle");
|
|
2329
2653
|
if (t) {
|
|
2330
|
-
const
|
|
2331
|
-
|
|
2654
|
+
const r = t.closest(
|
|
2655
|
+
".scheduler-event, .scheduler-timeline-event"
|
|
2656
|
+
)?.dataset.eventId, o = r ? this.config.getEventById(r) : null;
|
|
2657
|
+
if (o)
|
|
2332
2658
|
return {
|
|
2333
2659
|
type: "resize-handle",
|
|
2334
|
-
event:
|
|
2660
|
+
event: o,
|
|
2335
2661
|
resizeHandle: t.dataset.handle
|
|
2336
2662
|
};
|
|
2337
2663
|
}
|
|
2338
|
-
const s = e.closest(
|
|
2664
|
+
const s = e.closest(
|
|
2665
|
+
".scheduler-event:not(.preview), .scheduler-timeline-event:not(.preview)"
|
|
2666
|
+
);
|
|
2339
2667
|
if (s) {
|
|
2340
|
-
const i = s.dataset.eventId,
|
|
2341
|
-
if (
|
|
2342
|
-
return { type: "event", event:
|
|
2668
|
+
const i = s.dataset.eventId, r = i ? this.config.getEventById(i) : null;
|
|
2669
|
+
if (r)
|
|
2670
|
+
return { type: "event", event: r };
|
|
2343
2671
|
}
|
|
2344
2672
|
const n = e.closest(
|
|
2345
2673
|
".scheduler-time-slot, .scheduler-timeline-slot"
|
|
@@ -2349,23 +2677,23 @@ class re {
|
|
|
2349
2677
|
// Mouse event handlers
|
|
2350
2678
|
handleMouseDown(e) {
|
|
2351
2679
|
if (!this.config.isEditable()) return;
|
|
2352
|
-
const t =
|
|
2680
|
+
const t = T(e), s = this.analyzeTarget(t.target);
|
|
2353
2681
|
s.type !== "none" && (s.type === "slot" && !this.config.isSelectable() || (e.preventDefault(), this.callbacks.onPointerDown(t, s)));
|
|
2354
2682
|
}
|
|
2355
2683
|
handleMouseMove(e) {
|
|
2356
|
-
const t =
|
|
2684
|
+
const t = T(e);
|
|
2357
2685
|
this.callbacks.onPointerMove(t);
|
|
2358
2686
|
}
|
|
2359
2687
|
handleMouseUp(e) {
|
|
2360
|
-
const t =
|
|
2688
|
+
const t = T(e);
|
|
2361
2689
|
this.callbacks.onPointerUp(t);
|
|
2362
2690
|
}
|
|
2363
2691
|
handleClick(e) {
|
|
2364
|
-
const t =
|
|
2692
|
+
const t = T(e), s = this.analyzeTarget(t.target);
|
|
2365
2693
|
s.type === "event" || s.type === "resize-handle" || this.callbacks.onClick(t, s);
|
|
2366
2694
|
}
|
|
2367
2695
|
handleDblClick(e) {
|
|
2368
|
-
const t =
|
|
2696
|
+
const t = T(e), s = this.analyzeTarget(t.target);
|
|
2369
2697
|
this.callbacks.onDoubleClick(t, s);
|
|
2370
2698
|
}
|
|
2371
2699
|
// Touch event handlers
|
|
@@ -2375,38 +2703,42 @@ class re {
|
|
|
2375
2703
|
this.cancelTouchHold();
|
|
2376
2704
|
return;
|
|
2377
2705
|
}
|
|
2378
|
-
const t =
|
|
2706
|
+
const t = z(e);
|
|
2379
2707
|
if (!t) return;
|
|
2380
2708
|
const s = this.analyzeTarget(t.target);
|
|
2381
2709
|
if (s.type === "none" || s.type === "slot" && !this.config.isSelectable()) return;
|
|
2382
2710
|
this.touchStartPosition = { x: t.clientX, y: t.clientY }, this.touchHoldTarget = t.target, this.touchHoldPointer = t, this.panStartedOnEvent = s.type === "event" || s.type === "resize-handle";
|
|
2383
2711
|
const n = this, i = e.target;
|
|
2384
|
-
i.addEventListener("touchmove", function(
|
|
2385
|
-
n.handleTouchMove(
|
|
2386
|
-
}, { passive: !1 }), i.addEventListener("touchend", function(
|
|
2387
|
-
n.handleTouchEnd(
|
|
2388
|
-
}), i.addEventListener("touchcancel", function(
|
|
2389
|
-
n.handleTouchCancel(
|
|
2390
|
-
}), this.
|
|
2391
|
-
|
|
2712
|
+
if (i.addEventListener("touchmove", function(o) {
|
|
2713
|
+
n.handleTouchMove(o);
|
|
2714
|
+
}, { passive: !1 }), i.addEventListener("touchend", function(o) {
|
|
2715
|
+
n.handleTouchEnd(o);
|
|
2716
|
+
}), i.addEventListener("touchcancel", function(o) {
|
|
2717
|
+
n.handleTouchCancel(o);
|
|
2718
|
+
}), s.type === "resize-handle" && s.event && this.config.isEventSelected?.(s.event.id)) {
|
|
2719
|
+
this.activateTouchDragMode(t, s);
|
|
2720
|
+
return;
|
|
2721
|
+
}
|
|
2722
|
+
this.addTouchFeedback(t.target, "pending");
|
|
2723
|
+
const r = this.config.touchHoldDuration ?? le;
|
|
2392
2724
|
this.touchHoldTimer = setTimeout(() => {
|
|
2393
2725
|
this.activateTouchDragMode(t, s);
|
|
2394
|
-
},
|
|
2726
|
+
}, r);
|
|
2395
2727
|
}
|
|
2396
2728
|
handleTouchMove(e) {
|
|
2397
2729
|
if (e.touches.length !== 1) {
|
|
2398
2730
|
this.cancelTouchHold(), this.exitPanMode();
|
|
2399
2731
|
return;
|
|
2400
2732
|
}
|
|
2401
|
-
const t =
|
|
2733
|
+
const t = z(e);
|
|
2402
2734
|
if (t) {
|
|
2403
2735
|
if (this.isPanMode) {
|
|
2404
2736
|
e.preventDefault(), this.performPan(t.clientX, t.clientY);
|
|
2405
2737
|
return;
|
|
2406
2738
|
}
|
|
2407
2739
|
if (this.touchHoldTimer && this.touchStartPosition) {
|
|
2408
|
-
const s = this.config.touchMoveThreshold ??
|
|
2409
|
-
if (
|
|
2740
|
+
const s = this.config.touchMoveThreshold ?? de;
|
|
2741
|
+
if (U(this.touchStartPosition, {
|
|
2410
2742
|
x: t.clientX,
|
|
2411
2743
|
y: t.clientY
|
|
2412
2744
|
}) > s) {
|
|
@@ -2420,7 +2752,7 @@ class re {
|
|
|
2420
2752
|
}
|
|
2421
2753
|
}
|
|
2422
2754
|
handleTouchEnd(e) {
|
|
2423
|
-
const t =
|
|
2755
|
+
const t = z(e);
|
|
2424
2756
|
if (this.isPanMode) {
|
|
2425
2757
|
this.exitPanMode();
|
|
2426
2758
|
return;
|
|
@@ -2501,7 +2833,7 @@ class re {
|
|
|
2501
2833
|
e && e.classList.remove("scroll-blocked");
|
|
2502
2834
|
}
|
|
2503
2835
|
}
|
|
2504
|
-
class
|
|
2836
|
+
class he {
|
|
2505
2837
|
constructor(e) {
|
|
2506
2838
|
this.host = e;
|
|
2507
2839
|
}
|
|
@@ -2572,12 +2904,12 @@ class ae {
|
|
|
2572
2904
|
this.emit({ type: "selection-change", selectedEvent: e, range: t, view: s, resourceId: n });
|
|
2573
2905
|
}
|
|
2574
2906
|
}
|
|
2575
|
-
class
|
|
2907
|
+
class F extends V {
|
|
2576
2908
|
constructor() {
|
|
2577
|
-
super(), this.currentView = null, this.currentViewType = null, this.contentContainer = null, this.inputHandler = null, this.previousView = null, this.previousDate = null, this.previousSelectedEventId = null, this.previousRangeKey = "__init__", this.pendingDragUpdate = null, this.latestDragState = null, this.nowIndicatorTimer = null, this.liveAnnouncer = new
|
|
2909
|
+
super(), this.currentView = null, this.currentViewType = null, this.contentContainer = null, this.inputHandler = null, this.previousView = null, this.previousDate = null, this.previousSelectedEventId = null, this.previousRangeKey = "__init__", this.pendingDragUpdate = null, this.latestDragState = null, this.nowIndicatorTimer = null, this.liveAnnouncer = new Y(this), this.headerResizeObserver = null, this.headerIsNarrow = !1, this.previousIsLoading = null, this.lastEventActivation = null, this.keyboardMove = null, this.stateManager = new X(), this.eventEmitter = new he(this), this.dragManager = new ae(this.stateManager), this.dragManager.setSlotResolver((e, t) => this.getSlotAtPosition(e, t)), this.boundHandleKeyDown = this.handleKeyDown.bind(this), this.boundHandleFocusIn = this.handleFocusIn.bind(this), this.stateManager.subscribe((e) => this.onStateChange(e));
|
|
2578
2910
|
}
|
|
2579
2911
|
static {
|
|
2580
|
-
this.styles = [
|
|
2912
|
+
this.styles = [ie];
|
|
2581
2913
|
}
|
|
2582
2914
|
static get observedAttributes() {
|
|
2583
2915
|
return [
|
|
@@ -2596,7 +2928,7 @@ class le extends B {
|
|
|
2596
2928
|
super.connectedCallback(), this.inputHandler && this.inputHandler.attach(), this.addEventListener("keydown", this.boundHandleKeyDown), this.startNowIndicatorTimer();
|
|
2597
2929
|
}
|
|
2598
2930
|
disconnectedCallback() {
|
|
2599
|
-
this.inputHandler?.detach(), this.removeEventListener("keydown", this.boundHandleKeyDown), this.shadowRoot?.removeEventListener("focusin", this.boundHandleFocusIn), this.currentView?.destroy(), this.dragManager.destroy(), this.stopNowIndicatorTimer(), this.pendingDragUpdate !== null && (cancelAnimationFrame(this.pendingDragUpdate), this.pendingDragUpdate = null), this.latestDragState = null, super.disconnectedCallback();
|
|
2931
|
+
this.inputHandler?.detach(), this.removeEventListener("keydown", this.boundHandleKeyDown), this.shadowRoot?.removeEventListener("focusin", this.boundHandleFocusIn), this.currentView?.destroy(), this.dragManager.destroy(), this.stopNowIndicatorTimer(), this.headerResizeObserver?.disconnect(), this.headerResizeObserver = null, this.pendingDragUpdate !== null && (cancelAnimationFrame(this.pendingDragUpdate), this.pendingDragUpdate = null), this.latestDragState = null, super.disconnectedCallback();
|
|
2600
2932
|
}
|
|
2601
2933
|
attributeChangedCallback(e, t, s) {
|
|
2602
2934
|
if (super.attributeChangedCallback(e, t, s), t !== s)
|
|
@@ -2688,7 +3020,18 @@ class le extends B {
|
|
|
2688
3020
|
this.stateManager.gotoDate(e);
|
|
2689
3021
|
}
|
|
2690
3022
|
changeView(e) {
|
|
2691
|
-
this.stateManager.setView(e), this.liveAnnouncer.announce(
|
|
3023
|
+
this.stateManager.setView(e), this.liveAnnouncer.announce(this.msg("viewChanged", { view: this.viewLabel(e) }));
|
|
3024
|
+
}
|
|
3025
|
+
/** Localized display name of a view (also the view-switcher button text). */
|
|
3026
|
+
viewLabel(e) {
|
|
3027
|
+
const t = {
|
|
3028
|
+
year: "viewYear",
|
|
3029
|
+
month: "viewMonth",
|
|
3030
|
+
week: "viewWeek",
|
|
3031
|
+
day: "viewDay",
|
|
3032
|
+
timeline: "viewTimeline"
|
|
3033
|
+
};
|
|
3034
|
+
return this.msg(t[e]);
|
|
2692
3035
|
}
|
|
2693
3036
|
/**
|
|
2694
3037
|
* Clear the time-range selection and the focused-cell selection. Public
|
|
@@ -2700,41 +3043,54 @@ class le extends B {
|
|
|
2700
3043
|
this.stateManager.clearSelection();
|
|
2701
3044
|
}
|
|
2702
3045
|
addEvent(e) {
|
|
2703
|
-
this.stateManager.addEvent(e), this.liveAnnouncer.announce(
|
|
3046
|
+
this.stateManager.addEvent(e), this.liveAnnouncer.announce(this.msg("eventAdded", { title: e.title }));
|
|
2704
3047
|
}
|
|
2705
3048
|
updateEvent(e) {
|
|
2706
|
-
this.stateManager.updateEvent(e), this.liveAnnouncer.announce(
|
|
3049
|
+
this.stateManager.updateEvent(e), this.liveAnnouncer.announce(this.msg("eventUpdated", { title: e.title }));
|
|
2707
3050
|
}
|
|
2708
3051
|
removeEvent(e) {
|
|
2709
3052
|
const t = this.getEventById(e);
|
|
2710
|
-
this.stateManager.removeEvent(e), t && this.liveAnnouncer.announce(
|
|
3053
|
+
this.stateManager.removeEvent(e), t && this.liveAnnouncer.announce(this.msg("eventRemoved", { title: t.title }));
|
|
2711
3054
|
}
|
|
2712
3055
|
getEventById(e) {
|
|
2713
|
-
return this.events.find((t) => t.id === e) ?? null;
|
|
3056
|
+
return this.events.find((t) => t.id === e) ?? C.getAllResources(this.stateManager.getState().resources).flatMap((t) => t.events ?? []).find((t) => t.id === e) ?? null;
|
|
2714
3057
|
}
|
|
2715
3058
|
refetchEvents() {
|
|
2716
3059
|
this.currentView?.update(this.stateManager.getState());
|
|
2717
3060
|
}
|
|
3061
|
+
/**
|
|
3062
|
+
* Localized string lookup: options.messages overrides merged onto the
|
|
3063
|
+
* English defaults, with {placeholder} interpolation.
|
|
3064
|
+
*/
|
|
3065
|
+
msg(e, t) {
|
|
3066
|
+
return x(
|
|
3067
|
+
S(this.stateManager.getState().options.messages)[e],
|
|
3068
|
+
t
|
|
3069
|
+
);
|
|
3070
|
+
}
|
|
2718
3071
|
// ============================================
|
|
2719
3072
|
// Rendering
|
|
2720
3073
|
// ============================================
|
|
2721
3074
|
render() {
|
|
2722
|
-
return
|
|
3075
|
+
return q`
|
|
2723
3076
|
<div class="scheduler-container">
|
|
2724
3077
|
<header class="scheduler-header"></header>
|
|
2725
3078
|
<div class="scheduler-content"></div>
|
|
2726
3079
|
</div>
|
|
3080
|
+
<div id="scheduler-kbd-grid" class="visually-hidden">${this.msg("gridInstructions")}</div>
|
|
3081
|
+
<div id="scheduler-kbd-event" class="visually-hidden">${this.msg("eventInstructions")}</div>
|
|
2727
3082
|
${this.liveAnnouncer.template()}
|
|
2728
3083
|
`;
|
|
2729
3084
|
}
|
|
2730
3085
|
firstUpdated() {
|
|
2731
3086
|
const e = this.shadowRoot.querySelector(".scheduler-header");
|
|
2732
|
-
this.contentContainer = this.shadowRoot.querySelector(".scheduler-content"), this.populateHeader(e), this.inputHandler = new
|
|
3087
|
+
this.contentContainer = this.shadowRoot.querySelector(".scheduler-content"), this.populateHeader(e), this.observeHeaderWidth(e), this.inputHandler = new ce(
|
|
2733
3088
|
{
|
|
2734
3089
|
shadowRoot: this.shadowRoot,
|
|
2735
3090
|
getEventById: (t) => this.getEventById(t),
|
|
2736
3091
|
isEditable: () => this.stateManager.getState().options.editable ?? !0,
|
|
2737
|
-
isSelectable: () => this.stateManager.getState().options.selectable ?? !0
|
|
3092
|
+
isSelectable: () => this.stateManager.getState().options.selectable ?? !0,
|
|
3093
|
+
isEventSelected: (t) => this.stateManager.getState().selectedEvent?.id === t
|
|
2738
3094
|
},
|
|
2739
3095
|
{
|
|
2740
3096
|
onPointerDown: (t, s, n) => this.handlePointerDown(t, s, n),
|
|
@@ -2748,54 +3104,48 @@ class le extends B {
|
|
|
2748
3104
|
}
|
|
2749
3105
|
populateHeader(e) {
|
|
2750
3106
|
const t = document.createElement("nav");
|
|
2751
|
-
t.className = "scheduler-nav", t.setAttribute("aria-label", "
|
|
3107
|
+
t.className = "scheduler-nav", t.setAttribute("aria-label", this.msg("navLabel"));
|
|
2752
3108
|
const s = document.createElement("button");
|
|
2753
|
-
s.type = "button", s.textContent = "‹", s.setAttribute("aria-label", "
|
|
3109
|
+
s.type = "button", s.textContent = "‹", s.setAttribute("aria-label", this.msg("previousPeriod")), s.title = this.msg("previousPeriod"), s.addEventListener("click", () => this.prev());
|
|
2754
3110
|
const n = document.createElement("button");
|
|
2755
|
-
n.type = "button", n.textContent = "›", n.setAttribute("aria-label", "
|
|
3111
|
+
n.type = "button", n.textContent = "›", n.setAttribute("aria-label", this.msg("nextPeriod")), n.title = this.msg("nextPeriod"), n.addEventListener("click", () => this.next());
|
|
2756
3112
|
const i = document.createElement("button");
|
|
2757
|
-
i.type = "button", i.textContent = "
|
|
2758
|
-
const o = document.createElement("div");
|
|
2759
|
-
o.className = "scheduler-title", o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true"), this.updateTitle(o);
|
|
3113
|
+
i.type = "button", i.textContent = this.msg("today"), i.setAttribute("aria-label", this.msg("jumpToToday")), i.addEventListener("click", () => this.today()), t.appendChild(s), t.appendChild(n), t.appendChild(i);
|
|
2760
3114
|
const r = document.createElement("div");
|
|
2761
|
-
r.className = "scheduler-
|
|
2762
|
-
const
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
const c = document.createElement("button");
|
|
2771
|
-
c.type = "button", c.textContent = d, c.dataset.view = l;
|
|
2772
|
-
const u = l === this.view;
|
|
2773
|
-
c.setAttribute("aria-pressed", String(u)), u && c.classList.add("active"), c.addEventListener("click", () => this.changeView(l)), r.appendChild(c);
|
|
3115
|
+
r.className = "scheduler-title", r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), this.updateTitle(r);
|
|
3116
|
+
const o = document.createElement("div");
|
|
3117
|
+
o.className = "scheduler-view-switcher", o.setAttribute("role", "group"), o.setAttribute("aria-label", this.msg("switchView"));
|
|
3118
|
+
const a = ["year", "month", "week", "day", "timeline"];
|
|
3119
|
+
for (const l of a) {
|
|
3120
|
+
const d = document.createElement("button");
|
|
3121
|
+
d.type = "button", d.textContent = this.viewLabel(l), d.dataset.view = l;
|
|
3122
|
+
const c = l === this.view;
|
|
3123
|
+
d.setAttribute("aria-pressed", String(c)), c && d.classList.add("active"), d.addEventListener("click", () => this.changeView(l)), o.appendChild(d);
|
|
2774
3124
|
}
|
|
2775
|
-
e.appendChild(t), e.appendChild(
|
|
3125
|
+
e.appendChild(t), e.appendChild(r), e.appendChild(o);
|
|
2776
3126
|
}
|
|
2777
3127
|
updateTitle(e) {
|
|
2778
3128
|
const t = e ?? this.shadowRoot.querySelector(".scheduler-title");
|
|
2779
3129
|
if (!t) return;
|
|
2780
|
-
const s = this.stateManager.getState(), { date: n, view: i, options:
|
|
2781
|
-
let
|
|
3130
|
+
const s = this.stateManager.getState(), { date: n, view: i, options: r } = s;
|
|
3131
|
+
let o = "";
|
|
2782
3132
|
switch (i) {
|
|
2783
3133
|
case "year":
|
|
2784
|
-
|
|
3134
|
+
o = n.getFullYear().toString();
|
|
2785
3135
|
break;
|
|
2786
3136
|
case "month":
|
|
2787
|
-
|
|
3137
|
+
o = h.formatDate(n, r.locale, {
|
|
2788
3138
|
month: "long",
|
|
2789
3139
|
year: "numeric"
|
|
2790
3140
|
});
|
|
2791
3141
|
break;
|
|
2792
3142
|
case "week":
|
|
2793
3143
|
case "timeline": {
|
|
2794
|
-
const a = h.getWeekStart(n,
|
|
2795
|
-
|
|
3144
|
+
const a = h.getWeekStart(n, r.firstDayOfWeek), l = h.addDays(a, 6);
|
|
3145
|
+
o = `${h.formatDate(a, r.locale, {
|
|
2796
3146
|
month: "short",
|
|
2797
3147
|
day: "numeric"
|
|
2798
|
-
})} - ${h.formatDate(l,
|
|
3148
|
+
})} - ${h.formatDate(l, r.locale, {
|
|
2799
3149
|
month: "short",
|
|
2800
3150
|
day: "numeric",
|
|
2801
3151
|
year: "numeric"
|
|
@@ -2803,7 +3153,7 @@ class le extends B {
|
|
|
2803
3153
|
break;
|
|
2804
3154
|
}
|
|
2805
3155
|
case "day":
|
|
2806
|
-
|
|
3156
|
+
o = h.formatDate(n, r.locale, {
|
|
2807
3157
|
weekday: "long",
|
|
2808
3158
|
month: "long",
|
|
2809
3159
|
day: "numeric",
|
|
@@ -2811,7 +3161,23 @@ class le extends B {
|
|
|
2811
3161
|
});
|
|
2812
3162
|
break;
|
|
2813
3163
|
}
|
|
2814
|
-
t.textContent =
|
|
3164
|
+
t.textContent = o;
|
|
3165
|
+
}
|
|
3166
|
+
static {
|
|
3167
|
+
this.NARROW_HEADER_WIDTH = 560;
|
|
3168
|
+
}
|
|
3169
|
+
/**
|
|
3170
|
+
* Component-width (not viewport) driven narrow mode — the scheduler can sit
|
|
3171
|
+
* in a pane far narrower than the screen (splitter/dock). CSS keys the
|
|
3172
|
+
* wrapped layout off [data-narrow]; the title text swap needs JS anyway.
|
|
3173
|
+
*/
|
|
3174
|
+
observeHeaderWidth(e) {
|
|
3175
|
+
typeof ResizeObserver > "u" || (this.headerResizeObserver = new ResizeObserver((t) => {
|
|
3176
|
+
const n = (t[0]?.contentRect.width ?? e.clientWidth) < F.NARROW_HEADER_WIDTH;
|
|
3177
|
+
n !== this.headerIsNarrow && (this.headerIsNarrow = n, requestAnimationFrame(() => {
|
|
3178
|
+
e.toggleAttribute("data-narrow", n);
|
|
3179
|
+
}));
|
|
3180
|
+
}), this.headerResizeObserver.observe(e));
|
|
2815
3181
|
}
|
|
2816
3182
|
renderView() {
|
|
2817
3183
|
if (!this.contentContainer) return;
|
|
@@ -2819,19 +3185,19 @@ class le extends B {
|
|
|
2819
3185
|
const e = this.stateManager.getState();
|
|
2820
3186
|
switch (e.view) {
|
|
2821
3187
|
case "year":
|
|
2822
|
-
this.currentView = new
|
|
3188
|
+
this.currentView = new R(this.contentContainer, e), this.currentViewType = "year";
|
|
2823
3189
|
break;
|
|
2824
3190
|
case "month":
|
|
2825
|
-
this.currentView = new
|
|
3191
|
+
this.currentView = new k(this.contentContainer, e), this.currentViewType = "month";
|
|
2826
3192
|
break;
|
|
2827
3193
|
case "week":
|
|
2828
|
-
this.currentView = new
|
|
3194
|
+
this.currentView = new te(this.contentContainer, e), this.currentViewType = "week";
|
|
2829
3195
|
break;
|
|
2830
3196
|
case "day":
|
|
2831
|
-
this.currentView = new
|
|
3197
|
+
this.currentView = new se(this.contentContainer, e), this.currentViewType = "day";
|
|
2832
3198
|
break;
|
|
2833
3199
|
case "timeline":
|
|
2834
|
-
this.currentView = new
|
|
3200
|
+
this.currentView = new ne(this.contentContainer, e), this.currentViewType = "timeline";
|
|
2835
3201
|
break;
|
|
2836
3202
|
}
|
|
2837
3203
|
this.currentView?.render();
|
|
@@ -2840,16 +3206,16 @@ class le extends B {
|
|
|
2840
3206
|
// State Change Handling
|
|
2841
3207
|
// ============================================
|
|
2842
3208
|
onStateChange(e) {
|
|
2843
|
-
this.detectAndEmitChanges(e), this.updateUI(e);
|
|
3209
|
+
e.isLoading !== this.previousIsLoading && (this.previousIsLoading !== null && this.liveAnnouncer.announce(this.msg(e.isLoading ? "loadingEvents" : "eventsLoaded")), this.previousIsLoading = e.isLoading), this.detectAndEmitChanges(e), this.updateUI(e);
|
|
2844
3210
|
}
|
|
2845
3211
|
detectAndEmitChanges(e) {
|
|
2846
|
-
const t = this.previousView !== null && this.previousView !== e.view, s = this.previousDate !== null && this.previousDate.getTime() !== e.date.getTime(), n = e.selectedEvent?.id ?? null, i =
|
|
2847
|
-
(t || s) && this.eventEmitter.emitViewChange(e.view, e.date),
|
|
3212
|
+
const t = this.previousView !== null && this.previousView !== e.view, s = this.previousDate !== null && this.previousDate.getTime() !== e.date.getTime(), n = e.selectedEvent?.id ?? null, i = P(e), r = i ? `${i.start.getTime()}-${i.end.getTime()}-${e.selectionResourceId ?? ""}` : null, o = this.previousSelectedEventId !== n || this.previousRangeKey !== r;
|
|
3213
|
+
(t || s) && this.eventEmitter.emitViewChange(e.view, e.date), o && this.eventEmitter.emitSelectionChange(
|
|
2848
3214
|
e.selectedEvent,
|
|
2849
3215
|
i,
|
|
2850
3216
|
e.view,
|
|
2851
3217
|
e.selectionResourceId ?? void 0
|
|
2852
|
-
), this.previousView = e.view, this.previousDate = new Date(e.date), this.previousSelectedEventId = n, this.previousRangeKey =
|
|
3218
|
+
), this.previousView = e.view, this.previousDate = new Date(e.date), this.previousSelectedEventId = n, this.previousRangeKey = r;
|
|
2853
3219
|
}
|
|
2854
3220
|
updateUI(e) {
|
|
2855
3221
|
this.updateTitle(), this.shadowRoot.querySelectorAll(".scheduler-view-switcher button").forEach((s) => {
|
|
@@ -2877,9 +3243,16 @@ class le extends B {
|
|
|
2877
3243
|
const t = this.dragManager.handlePointerUp(e);
|
|
2878
3244
|
t && this.handleDragComplete(t, e.originalEvent);
|
|
2879
3245
|
}
|
|
3246
|
+
static {
|
|
3247
|
+
this.DBLCLICK_WINDOW_MS = 500;
|
|
3248
|
+
}
|
|
3249
|
+
registerEventActivation(e, t) {
|
|
3250
|
+
const s = Date.now(), n = this.lastEventActivation;
|
|
3251
|
+
this.lastEventActivation = { eventId: e.id, time: s }, n && n.eventId === e.id && s - n.time < F.DBLCLICK_WINDOW_MS && (this.lastEventActivation = null, this.eventEmitter.emitEventDblClick(e, t));
|
|
3252
|
+
}
|
|
2880
3253
|
handleDragComplete(e, t) {
|
|
2881
3254
|
if (e.wasClick) {
|
|
2882
|
-
e.event && (this.stateManager.setSelectedEvent(e.event), this.eventEmitter.emitEventSelected(e.event, t));
|
|
3255
|
+
e.event && (this.stateManager.setSelectedEvent(e.event), this.eventEmitter.emitEventSelected(e.event, t), this.registerEventActivation(e.event, t));
|
|
2883
3256
|
return;
|
|
2884
3257
|
}
|
|
2885
3258
|
switch (e.type) {
|
|
@@ -2926,19 +3299,19 @@ class le extends B {
|
|
|
2926
3299
|
const a = i.dataset.date;
|
|
2927
3300
|
a && this.eventEmitter.emitDateClick(new Date(a), e.originalEvent);
|
|
2928
3301
|
}
|
|
2929
|
-
const
|
|
3302
|
+
const r = s.closest(
|
|
2930
3303
|
".scheduler-year-month-header"
|
|
2931
3304
|
);
|
|
2932
|
-
if (
|
|
2933
|
-
const a =
|
|
3305
|
+
if (r) {
|
|
3306
|
+
const a = r.dataset.month;
|
|
2934
3307
|
a && (this.stateManager.setDate(new Date(a)), this.stateManager.setView("month"));
|
|
2935
3308
|
}
|
|
2936
|
-
const
|
|
2937
|
-
if (
|
|
2938
|
-
const a =
|
|
3309
|
+
const o = s.closest(".scheduler-more-link");
|
|
3310
|
+
if (o) {
|
|
3311
|
+
const a = o.dataset.date;
|
|
2939
3312
|
a && (this.stateManager.setDate(new Date(a)), this.stateManager.setView("day"));
|
|
2940
3313
|
}
|
|
2941
|
-
t.type === "event" && t.event && this.stateManager.setSelectedEvent(t.event);
|
|
3314
|
+
t.type === "event" && t.event && (this.stateManager.setSelectedEvent(t.event), this.registerEventActivation(t.event, e.originalEvent));
|
|
2942
3315
|
}
|
|
2943
3316
|
handleDoubleClick(e, t) {
|
|
2944
3317
|
t.type === "event" && t.event && this.eventEmitter.emitEventDblClick(t.event, e.originalEvent);
|
|
@@ -2956,12 +3329,12 @@ class le extends B {
|
|
|
2956
3329
|
const s = (e.composedPath?.() ?? [])[0] ?? e.target;
|
|
2957
3330
|
if (!s || !s.dataset) return;
|
|
2958
3331
|
const n = s.dataset.eventId;
|
|
2959
|
-
if (!n || !s.classList.contains("scheduler-event") && !s.classList.contains("scheduler-timeline-event"))
|
|
3332
|
+
if (!n || !s.classList.contains("scheduler-event") && !s.classList.contains("scheduler-timeline-event") && !s.classList.contains("scheduler-month-event"))
|
|
2960
3333
|
return;
|
|
2961
3334
|
const i = this.getEventById(n);
|
|
2962
3335
|
i && this.stateManager.getState().selectedEvent?.id !== i.id && (this.stateManager.setSelectedEvent(i), this.eventEmitter.emitEventSelected(i, e), requestAnimationFrame(() => {
|
|
2963
|
-
const
|
|
2964
|
-
this.shadowRoot?.querySelector(
|
|
3336
|
+
const r = `[data-event-id="${this.cssEscape(i.id)}"]`;
|
|
3337
|
+
this.shadowRoot?.querySelector(r)?.focus({ preventScroll: !0 });
|
|
2965
3338
|
}));
|
|
2966
3339
|
}
|
|
2967
3340
|
handleKeyDown(e) {
|
|
@@ -2975,12 +3348,30 @@ class le extends B {
|
|
|
2975
3348
|
}
|
|
2976
3349
|
if (e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey && this.handleAltShortcut(e))
|
|
2977
3350
|
return;
|
|
3351
|
+
if ((e.key === "Enter" || e.key === " ") && this.activateFocusedDrillControl()) {
|
|
3352
|
+
e.preventDefault();
|
|
3353
|
+
return;
|
|
3354
|
+
}
|
|
2978
3355
|
const t = this.getFocusedKind();
|
|
2979
3356
|
t === "cell" ? this.handleCellKeyDown(e) : t === "event" && this.handleEventKeyDown(e);
|
|
2980
3357
|
}
|
|
3358
|
+
/** Keyboard face of the more-link / year-month-header click delegation. */
|
|
3359
|
+
activateFocusedDrillControl() {
|
|
3360
|
+
const e = this.shadowRoot?.activeElement;
|
|
3361
|
+
if (!e) return !1;
|
|
3362
|
+
if (e.classList.contains("scheduler-more-link")) {
|
|
3363
|
+
const t = e.dataset.date;
|
|
3364
|
+
return t ? (this.stateManager.setDate(new Date(t)), this.stateManager.setView("day"), !0) : !1;
|
|
3365
|
+
}
|
|
3366
|
+
if (e.classList.contains("scheduler-year-month-header")) {
|
|
3367
|
+
const t = e.dataset.month;
|
|
3368
|
+
return t ? (this.stateManager.setDate(new Date(t)), this.stateManager.setView("month"), !0) : !1;
|
|
3369
|
+
}
|
|
3370
|
+
return !1;
|
|
3371
|
+
}
|
|
2981
3372
|
getFocusedKind() {
|
|
2982
3373
|
const e = this.shadowRoot?.activeElement;
|
|
2983
|
-
return e ? e.classList.contains("scheduler-time-slot") || e.classList.contains("scheduler-timeline-slot") || e.classList.contains("scheduler-month-day") || e.classList.contains("scheduler-year-month") ? "cell" : e.classList.contains("scheduler-event") || e.classList.contains("scheduler-timeline-event") ? "event" : "other" : "other";
|
|
3374
|
+
return e ? e.classList.contains("scheduler-time-slot") || e.classList.contains("scheduler-timeline-slot") || e.classList.contains("scheduler-month-day") || e.classList.contains("scheduler-year-month") ? "cell" : e.classList.contains("scheduler-event") || e.classList.contains("scheduler-timeline-event") || e.classList.contains("scheduler-month-event") ? "event" : "other" : "other";
|
|
2984
3375
|
}
|
|
2985
3376
|
handleAltShortcut(e) {
|
|
2986
3377
|
switch (e.key.toLowerCase()) {
|
|
@@ -3001,6 +3392,13 @@ class le extends B {
|
|
|
3001
3392
|
const s = this.stateManager.getState().selectedEvent;
|
|
3002
3393
|
if (s)
|
|
3003
3394
|
switch (e.key) {
|
|
3395
|
+
// M is the canonical move-mode key across the workspace (tile-manager,
|
|
3396
|
+
// dock); Enter is kept for back-compat (screen-reader programme D4).
|
|
3397
|
+
case "m":
|
|
3398
|
+
case "M":
|
|
3399
|
+
if (e.altKey || e.ctrlKey || e.metaKey) break;
|
|
3400
|
+
e.preventDefault(), this.enterEventMoveMode(s);
|
|
3401
|
+
return;
|
|
3004
3402
|
case "Enter":
|
|
3005
3403
|
e.preventDefault(), this.enterEventMoveMode(s);
|
|
3006
3404
|
return;
|
|
@@ -3030,12 +3428,12 @@ class le extends B {
|
|
|
3030
3428
|
return c !== 0 ? c : l.id.localeCompare(d.id);
|
|
3031
3429
|
}), i = n.findIndex((l) => l.id === e.id);
|
|
3032
3430
|
if (i < 0) return;
|
|
3033
|
-
const
|
|
3034
|
-
if (!o) return;
|
|
3035
|
-
const r = this.shadowRoot;
|
|
3431
|
+
const r = n[i + t];
|
|
3036
3432
|
if (!r) return;
|
|
3037
|
-
|
|
3038
|
-
|
|
3433
|
+
const o = this.shadowRoot;
|
|
3434
|
+
if (!o) return;
|
|
3435
|
+
o.querySelector(
|
|
3436
|
+
`[data-event-id="${this.cssEscape(r.id)}"]`
|
|
3039
3437
|
)?.focus({ preventScroll: !1 });
|
|
3040
3438
|
}
|
|
3041
3439
|
handleCellKeyDown(e) {
|
|
@@ -3186,8 +3584,8 @@ class le extends B {
|
|
|
3186
3584
|
scrollAndFocusDateCell(e) {
|
|
3187
3585
|
const t = this.stateManager.getState(), s = this.shadowRoot;
|
|
3188
3586
|
if (!s) return;
|
|
3189
|
-
const n = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, i = t.view === "year" ? `scheduler-cell-y-${n}` : `scheduler-cell-m-${n}-${String(e.getDate()).padStart(2, "0")}`,
|
|
3190
|
-
|
|
3587
|
+
const n = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, i = t.view === "year" ? `scheduler-cell-y-${n}` : `scheduler-cell-m-${n}-${String(e.getDate()).padStart(2, "0")}`, r = s.getElementById(i);
|
|
3588
|
+
r && (r.focus({ preventScroll: !0 }), typeof r.scrollIntoView == "function" && r.scrollIntoView({ block: "nearest", inline: "nearest" }));
|
|
3191
3589
|
}
|
|
3192
3590
|
/**
|
|
3193
3591
|
* Emit `event-create` covering the focused day (month view) or focused
|
|
@@ -3199,9 +3597,9 @@ class le extends B {
|
|
|
3199
3597
|
if (!n) return;
|
|
3200
3598
|
const i = new Date(n);
|
|
3201
3599
|
i.setHours(0, 0, 0, 0);
|
|
3202
|
-
const
|
|
3203
|
-
t === "day" ?
|
|
3204
|
-
{ start: i, end:
|
|
3600
|
+
const r = new Date(i);
|
|
3601
|
+
t === "day" ? r.setDate(r.getDate() + 1) : r.setMonth(r.getMonth() + 1), this.eventEmitter.emitEventCreate(
|
|
3602
|
+
{ start: i, end: r },
|
|
3205
3603
|
s.view,
|
|
3206
3604
|
e
|
|
3207
3605
|
);
|
|
@@ -3209,17 +3607,17 @@ class le extends B {
|
|
|
3209
3607
|
moveCellByTime(e, t) {
|
|
3210
3608
|
const s = this.stateManager.getState(), n = s.focusedCell;
|
|
3211
3609
|
if (!n) return;
|
|
3212
|
-
const i = (s.options.slotDuration ?? 1800) * 1e3,
|
|
3213
|
-
this.cellIsWithinView(
|
|
3610
|
+
const i = (s.options.slotDuration ?? 1800) * 1e3, r = new Date(n.start.getTime() + e * i), o = new Date(r.getTime() + i);
|
|
3611
|
+
this.cellIsWithinView(r, s) && this.commitFocusMove({ start: r, end: o }, s.focusedResourceId, t);
|
|
3214
3612
|
}
|
|
3215
3613
|
/** Week view ArrowLeft/Right: ±1 day, same time-of-day. No-op on day view. */
|
|
3216
3614
|
moveCellByDay(e, t) {
|
|
3217
3615
|
const s = this.stateManager.getState(), n = s.focusedCell;
|
|
3218
3616
|
if (!n || s.view !== "week") return;
|
|
3219
|
-
const i = (s.options.slotDuration ?? 1800) * 1e3,
|
|
3220
|
-
|
|
3221
|
-
const
|
|
3222
|
-
this.cellIsWithinView(
|
|
3617
|
+
const i = (s.options.slotDuration ?? 1800) * 1e3, r = new Date(n.start);
|
|
3618
|
+
r.setDate(r.getDate() + e);
|
|
3619
|
+
const o = new Date(r.getTime() + i);
|
|
3620
|
+
this.cellIsWithinView(r, s) && this.commitFocusMove({ start: r, end: o }, null, t);
|
|
3223
3621
|
}
|
|
3224
3622
|
/** Timeline ArrowUp/Down: ±1 resource, same time-of-day. PRD D1: cross-resource
|
|
3225
3623
|
* Shift+Arrow is intentionally ignored (resource is categorical). */
|
|
@@ -3234,32 +3632,32 @@ class le extends B {
|
|
|
3234
3632
|
if (!n) return;
|
|
3235
3633
|
const i = new Date(n.start);
|
|
3236
3634
|
i.setHours(0, 0, 0, 0);
|
|
3237
|
-
const
|
|
3635
|
+
const r = h.getTimeSlots(
|
|
3238
3636
|
i,
|
|
3239
3637
|
s.options.slotDuration,
|
|
3240
3638
|
s.options.slotMinTime,
|
|
3241
3639
|
s.options.slotMaxTime
|
|
3242
|
-
),
|
|
3243
|
-
|
|
3640
|
+
), o = e === "start" ? r[0] : r[r.length - 1];
|
|
3641
|
+
o && this.commitFocusMove(o, s.focusedResourceId, t);
|
|
3244
3642
|
}
|
|
3245
3643
|
moveCellToViewExtreme(e, t) {
|
|
3246
3644
|
const s = this.stateManager.getState();
|
|
3247
3645
|
let n = null, i = s.focusedResourceId;
|
|
3248
3646
|
switch (s.view) {
|
|
3249
3647
|
case "day": {
|
|
3250
|
-
const
|
|
3251
|
-
n = e === "start" ?
|
|
3648
|
+
const r = h.getTimeSlots(s.date, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
|
|
3649
|
+
n = e === "start" ? r[0] : r[r.length - 1];
|
|
3252
3650
|
break;
|
|
3253
3651
|
}
|
|
3254
3652
|
case "week": {
|
|
3255
|
-
const
|
|
3653
|
+
const r = h.getWeekDays(s.date, s.options.firstDayOfWeek), o = e === "start" ? r[0] : r[6], a = h.getTimeSlots(o, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
|
|
3256
3654
|
n = e === "start" ? a[0] : a[a.length - 1];
|
|
3257
3655
|
break;
|
|
3258
3656
|
}
|
|
3259
3657
|
case "timeline": {
|
|
3260
|
-
const
|
|
3261
|
-
if (
|
|
3262
|
-
i = e === "start" ?
|
|
3658
|
+
const o = C.flatten(s.resources, s.collapsedGroups).filter((c) => c.visible && W(c.item));
|
|
3659
|
+
if (o.length === 0) return;
|
|
3660
|
+
i = e === "start" ? o[0].item.id : o[o.length - 1].item.id;
|
|
3263
3661
|
const a = h.getWeekDays(s.date, s.options.firstDayOfWeek), l = e === "start" ? a[0] : a[6], d = h.getTimeSlots(l, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
|
|
3264
3662
|
n = e === "start" ? d[0] : d[d.length - 1];
|
|
3265
3663
|
break;
|
|
@@ -3276,14 +3674,14 @@ class le extends B {
|
|
|
3276
3674
|
const t = this.stateManager.getState(), s = t.focusedCell, n = t.date;
|
|
3277
3675
|
if (e > 0 ? this.next() : this.prev(), !s) return;
|
|
3278
3676
|
const i = this.stateManager.getState();
|
|
3279
|
-
let
|
|
3677
|
+
let r;
|
|
3280
3678
|
if (i.view === "day")
|
|
3281
|
-
|
|
3679
|
+
r = new Date(i.date), r.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
|
|
3282
3680
|
else {
|
|
3283
|
-
const l = h.getWeekDays(n, t.options.firstDayOfWeek), d = h.getWeekDays(i.date, i.options.firstDayOfWeek), c = l.findIndex((
|
|
3284
|
-
|
|
3681
|
+
const l = h.getWeekDays(n, t.options.firstDayOfWeek), d = h.getWeekDays(i.date, i.options.firstDayOfWeek), c = l.findIndex((p) => h.isSameDay(p, s.start)), u = d[Math.max(0, c)] ?? d[0];
|
|
3682
|
+
r = new Date(u), r.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
|
|
3285
3683
|
}
|
|
3286
|
-
const
|
|
3684
|
+
const o = (i.options.slotDuration ?? 1800) * 1e3, a = { start: r, end: new Date(r.getTime() + o) };
|
|
3287
3685
|
this.commitFocusMove(a, t.focusedResourceId, !1);
|
|
3288
3686
|
}
|
|
3289
3687
|
/**
|
|
@@ -3295,12 +3693,12 @@ class le extends B {
|
|
|
3295
3693
|
const n = this.stateManager.getState(), i = n.options.slotDuration ?? 1800;
|
|
3296
3694
|
if (s) {
|
|
3297
3695
|
this.stateManager.extendSelection(e, t), this.stateManager.setFocusedCell(e, t, !1);
|
|
3298
|
-
const
|
|
3299
|
-
this.liveAnnouncer.announce(
|
|
3696
|
+
const r = this.stateManager.getState();
|
|
3697
|
+
this.liveAnnouncer.announce(Z(r, i));
|
|
3300
3698
|
} else {
|
|
3301
3699
|
this.stateManager.setFocusedCell(e, t, !0);
|
|
3302
|
-
const
|
|
3303
|
-
this.liveAnnouncer.announce(
|
|
3700
|
+
const r = this.getResourceTitle(t);
|
|
3701
|
+
this.liveAnnouncer.announce(J(e, n.options, r));
|
|
3304
3702
|
}
|
|
3305
3703
|
this.scrollAndFocusCell(e, t);
|
|
3306
3704
|
}
|
|
@@ -3320,21 +3718,21 @@ class le extends B {
|
|
|
3320
3718
|
}
|
|
3321
3719
|
}
|
|
3322
3720
|
parseTimeOnDay(e, t) {
|
|
3323
|
-
const [s, n, i] = (t ?? "00:00:00").split(":").map(Number),
|
|
3324
|
-
return
|
|
3721
|
+
const [s, n, i] = (t ?? "00:00:00").split(":").map(Number), r = new Date(e);
|
|
3722
|
+
return r.setHours(0, 0, 0, 0), r.setSeconds((s ?? 0) * 3600 + (n ?? 0) * 60 + (i ?? 0)), r;
|
|
3325
3723
|
}
|
|
3326
3724
|
adjacentResource(e, t, s) {
|
|
3327
|
-
const i =
|
|
3725
|
+
const i = C.flatten(s.resources, s.collapsedGroups).filter((a) => a.visible && W(a.item));
|
|
3328
3726
|
if (i.length === 0) return null;
|
|
3329
3727
|
if (!e) return i[0].item.id;
|
|
3330
|
-
const
|
|
3331
|
-
if (
|
|
3332
|
-
const
|
|
3333
|
-
return
|
|
3728
|
+
const r = i.findIndex((a) => a.item.id === e);
|
|
3729
|
+
if (r < 0) return i[0].item.id;
|
|
3730
|
+
const o = r + t;
|
|
3731
|
+
return o < 0 || o >= i.length ? null : i[o].item.id;
|
|
3334
3732
|
}
|
|
3335
3733
|
getResourceTitle(e) {
|
|
3336
3734
|
if (!e) return null;
|
|
3337
|
-
for (const t of
|
|
3735
|
+
for (const t of C.getAllResources(this.stateManager.getState().resources))
|
|
3338
3736
|
if (t.id === e) return t.title;
|
|
3339
3737
|
return null;
|
|
3340
3738
|
}
|
|
@@ -3346,8 +3744,8 @@ class le extends B {
|
|
|
3346
3744
|
scrollAndFocusCell(e, t) {
|
|
3347
3745
|
const s = e.start.toISOString(), n = this.shadowRoot;
|
|
3348
3746
|
if (!n) return;
|
|
3349
|
-
const i = t ? `.scheduler-timeline-slot[data-resource-id="${this.cssEscape(t)}"][data-start="${s}"]` : `.scheduler-time-slot[data-start="${s}"]`,
|
|
3350
|
-
|
|
3747
|
+
const i = t ? `.scheduler-timeline-slot[data-resource-id="${this.cssEscape(t)}"][data-start="${s}"]` : `.scheduler-time-slot[data-start="${s}"]`, r = n.querySelector(i);
|
|
3748
|
+
r && (r.focus({ preventScroll: !0 }), typeof r.scrollIntoView == "function" && r.scrollIntoView({ block: "nearest", inline: "nearest" }));
|
|
3351
3749
|
}
|
|
3352
3750
|
/** Re-focus whatever cell the keyboard model currently considers focused. */
|
|
3353
3751
|
focusFocusedCell() {
|
|
@@ -3365,22 +3763,23 @@ class le extends B {
|
|
|
3365
3763
|
* whether/when to clear the selection.
|
|
3366
3764
|
*/
|
|
3367
3765
|
createEventFromCellOrSelection(e) {
|
|
3368
|
-
const t = this.stateManager.getState(), s =
|
|
3369
|
-
let n, i,
|
|
3766
|
+
const t = this.stateManager.getState(), s = P(t);
|
|
3767
|
+
let n, i, r;
|
|
3370
3768
|
if (s)
|
|
3371
|
-
n = s.start, i = s.end,
|
|
3769
|
+
n = s.start, i = s.end, r = t.selectionResourceId ?? void 0;
|
|
3372
3770
|
else if (t.focusedCell)
|
|
3373
|
-
n = t.focusedCell.start, i = t.focusedCell.end,
|
|
3771
|
+
n = t.focusedCell.start, i = t.focusedCell.end, r = t.focusedResourceId ?? void 0;
|
|
3374
3772
|
else
|
|
3375
3773
|
return;
|
|
3376
3774
|
this.eventEmitter.emitEventCreate(
|
|
3377
3775
|
{ start: n, end: i },
|
|
3378
3776
|
t.view,
|
|
3379
3777
|
e,
|
|
3380
|
-
|
|
3381
|
-
), this.liveAnnouncer.announce(
|
|
3382
|
-
|
|
3383
|
-
|
|
3778
|
+
r
|
|
3779
|
+
), this.liveAnnouncer.announce(this.msg("selectionCommitted", {
|
|
3780
|
+
start: h.formatTime(n, t.options.timeFormat),
|
|
3781
|
+
end: h.formatTime(i, t.options.timeFormat)
|
|
3782
|
+
}));
|
|
3384
3783
|
}
|
|
3385
3784
|
/**
|
|
3386
3785
|
* Enter keyboard event-move mode. Captures the working copy and a snapshot
|
|
@@ -3408,7 +3807,7 @@ class le extends B {
|
|
|
3408
3807
|
});
|
|
3409
3808
|
const s = this.minutesPerSlot();
|
|
3410
3809
|
this.liveAnnouncer.announce(
|
|
3411
|
-
|
|
3810
|
+
this.msg("moveModeEntered", { title: e.title, minutes: s })
|
|
3412
3811
|
), requestAnimationFrame(() => {
|
|
3413
3812
|
const n = `[data-event-id="${this.cssEscape(e.id)}"]`;
|
|
3414
3813
|
this.shadowRoot?.querySelector(n)?.focus({ preventScroll: !0 });
|
|
@@ -3433,19 +3832,19 @@ class le extends B {
|
|
|
3433
3832
|
e.preventDefault(), this.commitEventMoveMode();
|
|
3434
3833
|
return;
|
|
3435
3834
|
}
|
|
3436
|
-
const t = this.stateManager.getState().view, s = t === "timeline", n = this.minutesPerSlot() * 60 * 1e3, i = e.shiftKey,
|
|
3835
|
+
const t = this.stateManager.getState().view, s = t === "timeline", n = this.minutesPerSlot() * 60 * 1e3, i = e.shiftKey, r = e.altKey;
|
|
3437
3836
|
switch (e.key) {
|
|
3438
3837
|
case "ArrowUp":
|
|
3439
|
-
e.preventDefault(), s ? !i && !
|
|
3838
|
+
e.preventDefault(), s ? !i && !r && this.nudgeKeyboardMoveResource(-1) : i && r ? this.resizeKeyboardMoveEdge("start", -n) : i ? this.resizeKeyboardMoveEdge("end", -n) : this.nudgeKeyboardMove(-n);
|
|
3440
3839
|
return;
|
|
3441
3840
|
case "ArrowDown":
|
|
3442
|
-
e.preventDefault(), s ? !i && !
|
|
3841
|
+
e.preventDefault(), s ? !i && !r && this.nudgeKeyboardMoveResource(1) : i && r ? this.resizeKeyboardMoveEdge("start", +n) : i ? this.resizeKeyboardMoveEdge("end", +n) : this.nudgeKeyboardMove(+n);
|
|
3443
3842
|
return;
|
|
3444
3843
|
case "ArrowLeft":
|
|
3445
|
-
e.preventDefault(), s ? i &&
|
|
3844
|
+
e.preventDefault(), s ? i && r ? this.resizeKeyboardMoveEdge("start", -n) : i ? this.resizeKeyboardMoveEdge("end", -n) : this.nudgeKeyboardMove(-n) : t === "week" && (i && r ? this.resizeKeyboardMoveEdge("start", -864e5) : i ? this.resizeKeyboardMoveEdge("end", -864e5) : this.nudgeKeyboardMove(-864e5));
|
|
3446
3845
|
return;
|
|
3447
3846
|
case "ArrowRight":
|
|
3448
|
-
e.preventDefault(), s ? i &&
|
|
3847
|
+
e.preventDefault(), s ? i && r ? this.resizeKeyboardMoveEdge("start", +n) : i ? this.resizeKeyboardMoveEdge("end", +n) : this.nudgeKeyboardMove(+n) : t === "week" && (i && r ? this.resizeKeyboardMoveEdge("start", 864e5) : i ? this.resizeKeyboardMoveEdge("end", 864e5) : this.nudgeKeyboardMove(864e5));
|
|
3449
3848
|
return;
|
|
3450
3849
|
}
|
|
3451
3850
|
}
|
|
@@ -3457,7 +3856,7 @@ class le extends B {
|
|
|
3457
3856
|
nudgeKeyboardMove(e) {
|
|
3458
3857
|
if (!this.keyboardMove) return;
|
|
3459
3858
|
const t = new Date(this.keyboardMove.workingStart.getTime() + e), s = new Date(this.keyboardMove.workingEnd.getTime() + e);
|
|
3460
|
-
this.keyboardMove.workingStart = t, this.keyboardMove.workingEnd = s, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(
|
|
3859
|
+
this.keyboardMove.workingStart = t, this.keyboardMove.workingEnd = s, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(Q(t, s, this.stateManager.getState().options));
|
|
3461
3860
|
}
|
|
3462
3861
|
/** Walk to the next/previous resource (timeline only). Updates the preview's resourceId. */
|
|
3463
3862
|
nudgeKeyboardMoveResource(e) {
|
|
@@ -3466,7 +3865,7 @@ class le extends B {
|
|
|
3466
3865
|
if (!t) return;
|
|
3467
3866
|
this.keyboardMove.workingResourceId = t, this.applyKeyboardMovePreview();
|
|
3468
3867
|
const s = this.getResourceTitle(t) ?? t;
|
|
3469
|
-
this.liveAnnouncer.announce(
|
|
3868
|
+
this.liveAnnouncer.announce(this.msg("movedToResource", { resource: s }));
|
|
3470
3869
|
}
|
|
3471
3870
|
/**
|
|
3472
3871
|
* Resize one edge of the working event. Clamps to a minimum duration of
|
|
@@ -3479,7 +3878,7 @@ class le extends B {
|
|
|
3479
3878
|
if (e === "end") {
|
|
3480
3879
|
if (i = new Date(i.getTime() + t), i.getTime() - n.getTime() < s) return;
|
|
3481
3880
|
} else if (n = new Date(n.getTime() + t), i.getTime() - n.getTime() < s) return;
|
|
3482
|
-
this.keyboardMove.workingStart = n, this.keyboardMove.workingEnd = i, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(
|
|
3881
|
+
this.keyboardMove.workingStart = n, this.keyboardMove.workingEnd = i, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(ee(n, i, e, this.stateManager.getState().options));
|
|
3483
3882
|
}
|
|
3484
3883
|
/** Mirror keyboardMove.working* into state.previewEvent so views render the destination,
|
|
3485
3884
|
* then scroll the destination into view so the sighted-keyboard user can see it (PRD D6). */
|
|
@@ -3496,7 +3895,7 @@ class le extends B {
|
|
|
3496
3895
|
const i = this.shadowRoot;
|
|
3497
3896
|
if (!i) return;
|
|
3498
3897
|
i.querySelector(`[data-event-id="${this.cssEscape(e)}"]`)?.focus({ preventScroll: !0 });
|
|
3499
|
-
const
|
|
3898
|
+
const o = t.toISOString(), a = n ? `.scheduler-timeline-slot[data-resource-id="${this.cssEscape(n)}"][data-start="${o}"]` : `.scheduler-time-slot[data-start="${o}"]`, l = i.querySelector(a);
|
|
3500
3899
|
l && typeof l.scrollIntoView == "function" && l.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
3501
3900
|
});
|
|
3502
3901
|
}
|
|
@@ -3510,7 +3909,7 @@ class le extends B {
|
|
|
3510
3909
|
end: this.keyboardMove.workingEnd,
|
|
3511
3910
|
...this.keyboardMove.workingResourceId ? { resourceId: this.keyboardMove.workingResourceId } : {}
|
|
3512
3911
|
};
|
|
3513
|
-
this.stateManager.updateEvent(t), this.eventEmitter.emitEventUpdate(t, e, new CustomEvent("keyboard-move")), this.liveAnnouncer.announce(
|
|
3912
|
+
this.stateManager.updateEvent(t), this.eventEmitter.emitEventUpdate(t, e, new CustomEvent("keyboard-move")), this.liveAnnouncer.announce(this.msg("moveCommitted"));
|
|
3514
3913
|
}
|
|
3515
3914
|
this.keyboardMove = null, this.stateManager.setState({ keyboardMoveEventId: null, previewEvent: null }), requestAnimationFrame(() => {
|
|
3516
3915
|
const t = `[data-event-id="${this.cssEscape(e?.id ?? "")}"]`;
|
|
@@ -3519,7 +3918,7 @@ class le extends B {
|
|
|
3519
3918
|
}
|
|
3520
3919
|
cancelEventMoveMode() {
|
|
3521
3920
|
const e = this.keyboardMove?.eventId ?? null;
|
|
3522
|
-
this.keyboardMove = null, this.stateManager.setState({ keyboardMoveEventId: null, previewEvent: null }), this.liveAnnouncer.announce(
|
|
3921
|
+
this.keyboardMove = null, this.stateManager.setState({ keyboardMoveEventId: null, previewEvent: null }), this.liveAnnouncer.announce(this.msg("moveCancelled")), e && requestAnimationFrame(() => {
|
|
3523
3922
|
const t = `[data-event-id="${this.cssEscape(e)}"]`;
|
|
3524
3923
|
this.shadowRoot?.querySelector(t)?.focus({ preventScroll: !1 });
|
|
3525
3924
|
});
|
|
@@ -3552,16 +3951,16 @@ class le extends B {
|
|
|
3552
3951
|
};
|
|
3553
3952
|
}
|
|
3554
3953
|
}
|
|
3555
|
-
typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler",
|
|
3954
|
+
typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler", F);
|
|
3556
3955
|
export {
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3956
|
+
A as BaseView,
|
|
3957
|
+
se as DayView,
|
|
3958
|
+
k as MonthView,
|
|
3959
|
+
F as MpScheduler,
|
|
3960
|
+
X as SchedulerStateManager,
|
|
3961
|
+
ne as TimelineView,
|
|
3962
|
+
te as WeekView,
|
|
3963
|
+
R as YearView,
|
|
3964
|
+
j as createInitialState,
|
|
3965
|
+
ie as schedulerStyles
|
|
3567
3966
|
};
|