@mintplayer/web-components 2.3.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/chunks/color-CpFtrIoX.mjs +899 -0
- package/package.json +1 -1
- package/scheduler/index.mjs +776 -464
- package/scheduler/src/components/mp-scheduler.d.ts +27 -0
- package/scheduler/src/input/input-handler.d.ts +2 -0
- package/scheduler/src/views/base-view.d.ts +20 -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/chunks/color-CyamnJnn.mjs +0 -847
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,6 +391,24 @@ 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
|
+
}
|
|
369
412
|
/**
|
|
370
413
|
* Retrofit the ARIA grid chain onto a rendered view (wc-aria PRD step 5.7):
|
|
371
414
|
* the container claims `grid`, layout-only wrappers become `presentation`
|
|
@@ -380,9 +423,9 @@ class x {
|
|
|
380
423
|
*/
|
|
381
424
|
applyGridRoles(e) {
|
|
382
425
|
const t = this.container;
|
|
383
|
-
t.getAttribute("role") !== "grid" && t.setAttribute("role", "grid");
|
|
384
|
-
const s = (n, i) => t.querySelectorAll(n).forEach((
|
|
385
|
-
|
|
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);
|
|
386
429
|
});
|
|
387
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");
|
|
388
431
|
}
|
|
@@ -391,7 +434,7 @@ class x {
|
|
|
391
434
|
this.container.querySelectorAll(".today").forEach((e) => e.setAttribute("aria-current", "date"));
|
|
392
435
|
}
|
|
393
436
|
}
|
|
394
|
-
class
|
|
437
|
+
class R extends A {
|
|
395
438
|
constructor() {
|
|
396
439
|
super(...arguments), this.monthCards = /* @__PURE__ */ new Map();
|
|
397
440
|
}
|
|
@@ -400,8 +443,8 @@ class A extends x {
|
|
|
400
443
|
const { date: e, options: t } = this.state, s = h.getYearMonths(e), n = this.createElement("div", "scheduler-year-grid");
|
|
401
444
|
this.monthCards.clear();
|
|
402
445
|
for (const i of s) {
|
|
403
|
-
const
|
|
404
|
-
n.appendChild(
|
|
446
|
+
const r = this.createMonthCard(i);
|
|
447
|
+
n.appendChild(r);
|
|
405
448
|
}
|
|
406
449
|
this.container.appendChild(n), this.applyGridRoles({ rows: ".scheduler-year-grid" }), this.markToday(), this.updateMonthCardFocus();
|
|
407
450
|
}
|
|
@@ -414,29 +457,29 @@ class A extends x {
|
|
|
414
457
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
|
|
415
458
|
}
|
|
416
459
|
createMonthCard(e) {
|
|
417
|
-
const { events: t, options: s } = this.state, n = this.createElement("div", "scheduler-year-month"), i =
|
|
418
|
-
n.setAttribute("role", "gridcell"), n.setAttribute("tabindex", "-1"), n.
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
const
|
|
422
|
-
for (const
|
|
423
|
-
const
|
|
424
|
-
|
|
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);
|
|
425
468
|
}
|
|
426
469
|
const d = h.getMonthStart(e), c = h.getMonthEnd(e), u = M.filterByRange(t, d, c), p = /* @__PURE__ */ new Set();
|
|
427
|
-
for (const
|
|
428
|
-
const
|
|
429
|
-
for (
|
|
430
|
-
p.add(
|
|
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);
|
|
431
474
|
}
|
|
432
|
-
for (const
|
|
433
|
-
for (const
|
|
475
|
+
for (const v of a)
|
|
476
|
+
for (const g of v) {
|
|
434
477
|
const f = this.createElement("div", "scheduler-mini-day");
|
|
435
|
-
f.textContent = String(
|
|
436
|
-
const b =
|
|
437
|
-
p.has(b) && f.classList.add("has-events"),
|
|
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);
|
|
438
481
|
}
|
|
439
|
-
return n.appendChild(
|
|
482
|
+
return n.appendChild(o), n;
|
|
440
483
|
}
|
|
441
484
|
/**
|
|
442
485
|
* Apply roving tabindex based on `state.focusedDate`'s month. Year-view's
|
|
@@ -446,10 +489,10 @@ class A extends x {
|
|
|
446
489
|
updateMonthCardFocus() {
|
|
447
490
|
const e = this.state.focusedDate;
|
|
448
491
|
let t = !1;
|
|
449
|
-
const s = e ?
|
|
492
|
+
const s = e ? R.monthKey(e) : null;
|
|
450
493
|
for (const [n, i] of this.monthCards) {
|
|
451
|
-
const
|
|
452
|
-
i.setAttribute("tabindex",
|
|
494
|
+
const r = n === s;
|
|
495
|
+
i.setAttribute("tabindex", r ? "0" : "-1"), i.removeAttribute("aria-selected"), r && (t = !0);
|
|
453
496
|
}
|
|
454
497
|
t || this.monthCards.values().next().value?.setAttribute("tabindex", "0");
|
|
455
498
|
}
|
|
@@ -465,28 +508,28 @@ class A extends x {
|
|
|
465
508
|
this.monthCards.clear(), this.clearContainer();
|
|
466
509
|
}
|
|
467
510
|
}
|
|
468
|
-
class
|
|
511
|
+
class k extends A {
|
|
469
512
|
constructor() {
|
|
470
513
|
super(...arguments), this.dayCells = /* @__PURE__ */ new Map();
|
|
471
514
|
}
|
|
472
515
|
render() {
|
|
473
516
|
this.clearContainer(), this.container.classList.add("scheduler-month-view");
|
|
474
517
|
const { date: e, options: t } = this.state, s = h.getMonthWeeks(e, t.firstDayOfWeek), n = this.createElement("div", "scheduler-day-headers"), i = s[0];
|
|
475
|
-
for (const
|
|
518
|
+
for (const o of i) {
|
|
476
519
|
const a = this.createElement("div", "scheduler-day-header");
|
|
477
|
-
a.textContent = h.getDayName(
|
|
520
|
+
a.textContent = h.getDayName(o, t.locale), n.appendChild(a);
|
|
478
521
|
}
|
|
479
522
|
this.container.appendChild(n);
|
|
480
|
-
const
|
|
481
|
-
for (const
|
|
523
|
+
const r = this.createElement("div", "scheduler-month-grid");
|
|
524
|
+
for (const o of s) {
|
|
482
525
|
const a = this.createElement("div", "scheduler-month-week");
|
|
483
|
-
for (const l of
|
|
526
|
+
for (const l of o) {
|
|
484
527
|
const d = this.createDayCell(l);
|
|
485
528
|
a.appendChild(d);
|
|
486
529
|
}
|
|
487
|
-
|
|
530
|
+
r.appendChild(a);
|
|
488
531
|
}
|
|
489
|
-
this.container.appendChild(
|
|
532
|
+
this.container.appendChild(r), this.renderEvents(), this.updateDayCellFocus(), this.applyGridRoles({
|
|
490
533
|
columnHeaderRow: ":scope > .scheduler-day-headers",
|
|
491
534
|
columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
|
|
492
535
|
presentation: [".scheduler-month-grid"],
|
|
@@ -505,12 +548,12 @@ class T extends x {
|
|
|
505
548
|
createDayCell(e) {
|
|
506
549
|
const { date: t } = this.state, s = this.createElement("div", "scheduler-month-day");
|
|
507
550
|
h.isSameMonth(e, t) || s.classList.add("other-month"), h.isToday(e) && s.classList.add("today");
|
|
508
|
-
const n =
|
|
509
|
-
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}`;
|
|
510
553
|
const i = this.createElement("div", "day-number");
|
|
511
554
|
i.textContent = String(e.getDate()), s.appendChild(i);
|
|
512
|
-
const
|
|
513
|
-
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;
|
|
514
557
|
}
|
|
515
558
|
/**
|
|
516
559
|
* Apply roving tabindex based on `state.focusedDate`. The grid must always
|
|
@@ -520,24 +563,24 @@ class T extends x {
|
|
|
520
563
|
updateDayCellFocus() {
|
|
521
564
|
const e = this.state.focusedDate;
|
|
522
565
|
let t = !1;
|
|
523
|
-
const s = e ?
|
|
566
|
+
const s = e ? k.dayKey(e) : null;
|
|
524
567
|
for (const [n, i] of this.dayCells) {
|
|
525
|
-
const
|
|
526
|
-
i.setAttribute("tabindex",
|
|
568
|
+
const r = n === s;
|
|
569
|
+
i.setAttribute("tabindex", r ? "0" : "-1"), i.removeAttribute("aria-selected"), r && (t = !0);
|
|
527
570
|
}
|
|
528
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");
|
|
529
572
|
}
|
|
530
573
|
renderEvents() {
|
|
531
574
|
const { date: e, events: t, options: s } = this.state;
|
|
532
575
|
h.getMonthStart(e), h.getMonthEnd(e);
|
|
533
|
-
const n = h.getMonthWeeks(e, s.firstDayOfWeek), i = n[0][0],
|
|
534
|
-
|
|
535
|
-
const
|
|
536
|
-
for (const d of
|
|
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) {
|
|
537
580
|
const c = new Date(d.start), u = new Date(d.end), p = new Date(c);
|
|
538
581
|
for (p.setHours(0, 0, 0, 0); p <= u; ) {
|
|
539
|
-
const
|
|
540
|
-
a.has(
|
|
582
|
+
const v = k.dayKey(p);
|
|
583
|
+
a.has(v) || a.set(v, []), a.get(v).push(d), p.setDate(p.getDate() + 1);
|
|
541
584
|
}
|
|
542
585
|
}
|
|
543
586
|
const l = typeof s.dayMaxEvents == "number" ? s.dayMaxEvents : 3;
|
|
@@ -547,14 +590,17 @@ class T extends x {
|
|
|
547
590
|
const p = u.querySelector(".month-events");
|
|
548
591
|
if (!p) continue;
|
|
549
592
|
p.innerHTML = "";
|
|
550
|
-
const
|
|
551
|
-
for (const f of
|
|
593
|
+
const v = c.slice(0, l), g = c.length - v.length;
|
|
594
|
+
for (const f of v) {
|
|
552
595
|
const b = this.createElement("div", "scheduler-month-event");
|
|
553
|
-
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);
|
|
554
597
|
}
|
|
555
|
-
if (
|
|
598
|
+
if (g > 0) {
|
|
556
599
|
const f = this.createElement("div", "scheduler-more-link");
|
|
557
|
-
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);
|
|
558
604
|
}
|
|
559
605
|
}
|
|
560
606
|
}
|
|
@@ -573,7 +619,7 @@ class T extends x {
|
|
|
573
619
|
this.dayCells.clear(), this.clearContainer();
|
|
574
620
|
}
|
|
575
621
|
}
|
|
576
|
-
class
|
|
622
|
+
class te extends A {
|
|
577
623
|
constructor() {
|
|
578
624
|
super(...arguments), this.dayColumns = [], this.eventElements = /* @__PURE__ */ new Map(), this.slotElements = /* @__PURE__ */ new Map();
|
|
579
625
|
}
|
|
@@ -590,7 +636,7 @@ class J extends x {
|
|
|
590
636
|
p.textContent = String(d.getDate()), c.appendChild(u), c.appendChild(p), n.appendChild(c);
|
|
591
637
|
}
|
|
592
638
|
this.container.appendChild(n);
|
|
593
|
-
const
|
|
639
|
+
const r = this.createElement("div", "scheduler-time-grid"), o = this.createElement("div", "scheduler-time-gutter"), a = h.getTimeSlots(
|
|
594
640
|
s[0],
|
|
595
641
|
t.slotDuration,
|
|
596
642
|
t.slotMinTime,
|
|
@@ -598,43 +644,44 @@ class J extends x {
|
|
|
598
644
|
);
|
|
599
645
|
for (const d of a) {
|
|
600
646
|
const c = this.createElement("div", "scheduler-time-slot-label");
|
|
601
|
-
c.textContent = h.formatTime(d.start, t.timeFormat),
|
|
647
|
+
c.textContent = h.formatTime(d.start, t.timeFormat), o.appendChild(c);
|
|
602
648
|
}
|
|
603
|
-
|
|
649
|
+
r.appendChild(o);
|
|
604
650
|
const l = this.createElement("div", "scheduler-days-container");
|
|
605
651
|
this.dayColumns = [];
|
|
606
652
|
for (let d = 0; d < s.length; d++) {
|
|
607
653
|
const c = s[d], u = this.createElement("div", "scheduler-day-column");
|
|
608
654
|
this.setData(u, { dayIndex: d });
|
|
609
|
-
for (let
|
|
610
|
-
const
|
|
655
|
+
for (let v = 0; v < a.length; v++) {
|
|
656
|
+
const g = a[v], f = new Date(c);
|
|
611
657
|
f.setHours(
|
|
612
|
-
|
|
613
|
-
|
|
658
|
+
g.start.getHours(),
|
|
659
|
+
g.start.getMinutes(),
|
|
614
660
|
0,
|
|
615
661
|
0
|
|
616
662
|
);
|
|
617
663
|
const b = new Date(c);
|
|
618
664
|
b.setHours(
|
|
619
|
-
|
|
620
|
-
|
|
665
|
+
g.end.getHours(),
|
|
666
|
+
g.end.getMinutes(),
|
|
621
667
|
0,
|
|
622
668
|
0
|
|
623
669
|
);
|
|
624
670
|
const y = this.createElement("div", "scheduler-time-slot");
|
|
625
|
-
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, {
|
|
626
672
|
dayIndex: d,
|
|
627
|
-
slotIndex:
|
|
673
|
+
slotIndex: v,
|
|
628
674
|
start: f.toISOString(),
|
|
629
675
|
end: b.toISOString()
|
|
630
676
|
});
|
|
631
|
-
const w = `${d}-${
|
|
677
|
+
const w = `${d}-${v}`;
|
|
632
678
|
this.slotElements.set(w, y), u.appendChild(y);
|
|
633
679
|
}
|
|
634
680
|
const p = this.createElement("div", "scheduler-events-container");
|
|
635
681
|
u.appendChild(p), this.dayColumns.push(u), l.appendChild(u);
|
|
636
682
|
}
|
|
637
|
-
|
|
683
|
+
r.appendChild(l), this.container.appendChild(r), this.renderEvents(), this.updateCellFocusAndSelection(), this.renderNowIndicator(s, a), this.applyGridRoles({
|
|
684
|
+
multiselectable: !0,
|
|
638
685
|
columnHeaderRow: ":scope > .scheduler-day-headers",
|
|
639
686
|
columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
|
|
640
687
|
presentation: [
|
|
@@ -672,11 +719,11 @@ class J extends x {
|
|
|
672
719
|
let t = !1, s = null;
|
|
673
720
|
for (const [, n] of this.slotElements) {
|
|
674
721
|
s || (s = n);
|
|
675
|
-
const i = n.dataset.start,
|
|
676
|
-
if (!i || !
|
|
677
|
-
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();
|
|
678
725
|
n.setAttribute("tabindex", a ? "0" : "-1");
|
|
679
|
-
const l =
|
|
726
|
+
const l = K(o, this.state, null);
|
|
680
727
|
n.setAttribute("aria-selected", l ? "true" : "false"), n.classList.toggle("selected", l), a && (t = !0);
|
|
681
728
|
}
|
|
682
729
|
!t && s && s.setAttribute("tabindex", "0");
|
|
@@ -685,84 +732,74 @@ class J extends x {
|
|
|
685
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;
|
|
686
733
|
}
|
|
687
734
|
renderEvents() {
|
|
688
|
-
const { date: e, events: t, options: s } = this.state, n = h.getWeekDays(e, s.firstDayOfWeek), i = n[0],
|
|
689
|
-
|
|
690
|
-
const
|
|
691
|
-
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) {
|
|
692
739
|
const { parts: u } = M.splitInParts(c);
|
|
693
740
|
a.push(...u);
|
|
694
741
|
}
|
|
695
|
-
const l = M.filterPartsByRange(a, i,
|
|
742
|
+
const l = M.filterPartsByRange(a, i, r), d = M.getTimelinedParts(l);
|
|
696
743
|
this.eventElements.forEach((c) => c.remove()), this.eventElements.clear();
|
|
697
|
-
for (const { part: c, trackIndex: u, totalTracks: p, colspan:
|
|
744
|
+
for (const { part: c, trackIndex: u, totalTracks: p, colspan: v } of d) {
|
|
698
745
|
if (!c.event) continue;
|
|
699
|
-
const
|
|
700
|
-
if (
|
|
701
|
-
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");
|
|
702
749
|
if (!b) continue;
|
|
703
750
|
const y = this.createEventElement(
|
|
704
751
|
c,
|
|
705
752
|
u,
|
|
706
753
|
p,
|
|
707
|
-
|
|
754
|
+
v,
|
|
708
755
|
s.slotDuration ?? 1800
|
|
709
756
|
);
|
|
710
757
|
b.appendChild(y), this.eventElements.set(c.id, y);
|
|
711
758
|
}
|
|
712
759
|
}
|
|
713
760
|
createEventElement(e, t, s, n, i) {
|
|
714
|
-
const
|
|
715
|
-
this.state.keyboardMoveEventId,
|
|
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(
|
|
716
763
|
"aria-label",
|
|
717
|
-
|
|
718
|
-
),
|
|
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");
|
|
719
766
|
const l = new Date(e.start);
|
|
720
767
|
l.setHours(0, 0, 0, 0);
|
|
721
|
-
const d = (e.start.getTime() - l.getTime()) / (1e3 * 60), u = (e.end.getTime() - l.getTime()) / (1e3 * 60) - d, p = i / 60,
|
|
722
|
-
|
|
723
|
-
const y = this.createElement("div", "event-title");
|
|
724
|
-
|
|
725
|
-
const
|
|
726
|
-
|
|
727
|
-
if (e.isStart) {
|
|
728
|
-
const E = this.createElement("div", "resize-handle", "top");
|
|
729
|
-
this.setData(E, { handle: "start" }), r.appendChild(E);
|
|
730
|
-
}
|
|
731
|
-
if (e.isEnd) {
|
|
732
|
-
const E = this.createElement("div", "resize-handle", "bottom");
|
|
733
|
-
this.setData(E, { handle: "end" }), r.appendChild(E);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
return r;
|
|
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);
|
|
772
|
+
const D = this.createElement("div", "event-time");
|
|
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;
|
|
737
774
|
}
|
|
738
775
|
renderPreviewEvent() {
|
|
739
776
|
const e = this.container.querySelector(".scheduler-event.preview");
|
|
740
777
|
e && e.remove();
|
|
741
778
|
const { previewEvent: t, options: s, date: n } = this.state;
|
|
742
779
|
if (!t) return;
|
|
743
|
-
const
|
|
744
|
-
if (
|
|
745
|
-
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");
|
|
746
783
|
if (!a) return;
|
|
747
784
|
const l = this.createElement("div", "scheduler-event", "preview"), d = new Date(t.start);
|
|
748
785
|
d.setHours(0, 0, 0, 0);
|
|
749
|
-
const c = (t.start.getTime() - d.getTime()) / (1e3 * 60), p = (t.end.getTime() - d.getTime()) / (1e3 * 60) - c,
|
|
750
|
-
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);
|
|
751
788
|
}
|
|
752
789
|
updateGreyedSlots() {
|
|
753
790
|
const { dragState: e, previewEvent: t, options: s, date: n } = this.state;
|
|
754
|
-
if (this.slotElements.forEach((
|
|
755
|
-
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(
|
|
756
793
|
i[0],
|
|
757
794
|
s.slotDuration,
|
|
758
795
|
s.slotMinTime,
|
|
759
796
|
s.slotMaxTime
|
|
760
797
|
);
|
|
761
|
-
for (let
|
|
762
|
-
const a = i[
|
|
798
|
+
for (let o = 0; o < i.length; o++) {
|
|
799
|
+
const a = i[o];
|
|
763
800
|
if (!(!h.isSameDay(a, t.start) && !h.isSameDay(a, t.end)))
|
|
764
|
-
for (let l = 0; l <
|
|
765
|
-
const d =
|
|
801
|
+
for (let l = 0; l < r.length; l++) {
|
|
802
|
+
const d = r[l], c = new Date(a);
|
|
766
803
|
c.setHours(
|
|
767
804
|
d.start.getHours(),
|
|
768
805
|
d.start.getMinutes(),
|
|
@@ -776,8 +813,8 @@ class J extends x {
|
|
|
776
813
|
0,
|
|
777
814
|
0
|
|
778
815
|
), c < t.end && u > t.start) {
|
|
779
|
-
const p = `${
|
|
780
|
-
|
|
816
|
+
const p = `${o}-${l}`, v = this.slotElements.get(p);
|
|
817
|
+
v && v.classList.add("greyed");
|
|
781
818
|
}
|
|
782
819
|
}
|
|
783
820
|
}
|
|
@@ -788,32 +825,32 @@ class J extends x {
|
|
|
788
825
|
if (n === -1) return;
|
|
789
826
|
const i = this.dayColumns[n];
|
|
790
827
|
if (!i) return;
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
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");
|
|
794
831
|
d.style.top = `${l}px`, i.appendChild(d);
|
|
795
832
|
}
|
|
796
833
|
updateNowIndicator() {
|
|
797
834
|
if (!this.state.options.nowIndicator) return;
|
|
798
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));
|
|
799
836
|
if (i === -1) return;
|
|
800
|
-
const
|
|
801
|
-
if (!
|
|
802
|
-
const
|
|
837
|
+
const r = this.dayColumns[i];
|
|
838
|
+
if (!r) return;
|
|
839
|
+
const o = r.querySelector(".scheduler-now-indicator"), a = new Date(n);
|
|
803
840
|
a.setHours(0, 0, 0, 0);
|
|
804
841
|
const l = (n.getTime() - a.getTime()) / (1e3 * 60), d = (t.slotDuration ?? 1800) / 60, c = l / d * 40;
|
|
805
|
-
if (
|
|
806
|
-
|
|
842
|
+
if (o)
|
|
843
|
+
o.style.top = `${c}px`;
|
|
807
844
|
else {
|
|
808
845
|
const u = this.createElement("div", "scheduler-now-indicator");
|
|
809
|
-
u.style.top = `${c}px`,
|
|
846
|
+
u.style.top = `${c}px`, r.appendChild(u);
|
|
810
847
|
}
|
|
811
848
|
}
|
|
812
849
|
destroy() {
|
|
813
850
|
this.eventElements.clear(), this.slotElements.clear(), this.dayColumns = [], this.clearContainer();
|
|
814
851
|
}
|
|
815
852
|
}
|
|
816
|
-
class
|
|
853
|
+
class se extends A {
|
|
817
854
|
constructor() {
|
|
818
855
|
super(...arguments), this.eventsContainer = null, this.slotElements = /* @__PURE__ */ new Map(), this.dayColumn = null;
|
|
819
856
|
}
|
|
@@ -823,38 +860,39 @@ class Z extends x {
|
|
|
823
860
|
n.style.width = "var(--scheduler-time-gutter-width)", s.appendChild(n);
|
|
824
861
|
const i = this.createElement("div", "scheduler-day-header");
|
|
825
862
|
h.isToday(e) && i.classList.add("today");
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
|
|
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());
|
|
830
867
|
const a = this.createElement("div", "month-year");
|
|
831
868
|
a.textContent = h.formatDate(e, t.locale, {
|
|
832
869
|
month: "long",
|
|
833
870
|
year: "numeric"
|
|
834
|
-
}), 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);
|
|
835
872
|
const l = this.createElement("div", "scheduler-time-grid"), d = this.createElement("div", "scheduler-time-gutter"), c = h.getTimeSlots(
|
|
836
873
|
e,
|
|
837
874
|
t.slotDuration,
|
|
838
875
|
t.slotMinTime,
|
|
839
876
|
t.slotMaxTime
|
|
840
877
|
);
|
|
841
|
-
for (const
|
|
842
|
-
const
|
|
843
|
-
|
|
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);
|
|
844
881
|
}
|
|
845
882
|
l.appendChild(d);
|
|
846
883
|
const u = this.createElement("div", "scheduler-days-container");
|
|
847
884
|
this.dayColumn = this.createElement("div", "scheduler-day-column");
|
|
848
885
|
const p = this.dayColumn;
|
|
849
|
-
for (let
|
|
850
|
-
const
|
|
851
|
-
f.setAttribute("role", "gridcell"), f.setAttribute("tabindex", "-1"), f.setAttribute("aria-selected", "false"), f.id = `scheduler-cell-d-${
|
|
852
|
-
slotIndex:
|
|
853
|
-
start:
|
|
854
|
-
end:
|
|
855
|
-
}), this.slotElements.set(
|
|
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);
|
|
856
893
|
}
|
|
857
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,
|
|
858
896
|
columnHeaderRow: ":scope > .scheduler-day-headers",
|
|
859
897
|
columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
|
|
860
898
|
presentation: [
|
|
@@ -881,11 +919,11 @@ class Z extends x {
|
|
|
881
919
|
let t = !1, s = null;
|
|
882
920
|
for (const [, n] of this.slotElements) {
|
|
883
921
|
s || (s = n);
|
|
884
|
-
const i = n.dataset.start,
|
|
885
|
-
if (!i || !
|
|
886
|
-
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();
|
|
887
925
|
n.setAttribute("tabindex", a ? "0" : "-1");
|
|
888
|
-
const l =
|
|
926
|
+
const l = K(o, this.state, null);
|
|
889
927
|
n.setAttribute("aria-selected", l ? "true" : "false"), n.classList.toggle("selected", l), a && (t = !0);
|
|
890
928
|
}
|
|
891
929
|
!t && s && s.setAttribute("tabindex", "0");
|
|
@@ -897,12 +935,12 @@ class Z extends x {
|
|
|
897
935
|
n.setHours(0, 0, 0, 0);
|
|
898
936
|
const i = new Date(e);
|
|
899
937
|
i.setHours(23, 59, 59, 999);
|
|
900
|
-
const
|
|
901
|
-
for (const l of
|
|
938
|
+
const r = M.filterByRange(t, n, i), o = [];
|
|
939
|
+
for (const l of r) {
|
|
902
940
|
const { parts: d } = M.splitInParts(l), c = M.filterPartsByRange(d, n, i);
|
|
903
|
-
|
|
941
|
+
o.push(...c);
|
|
904
942
|
}
|
|
905
|
-
const a = M.getTimelinedParts(
|
|
943
|
+
const a = M.getTimelinedParts(o);
|
|
906
944
|
for (const { part: l, trackIndex: d, totalTracks: c, colspan: u } of a) {
|
|
907
945
|
if (!l.event) continue;
|
|
908
946
|
const p = this.createEventElement(
|
|
@@ -916,42 +954,32 @@ class Z extends x {
|
|
|
916
954
|
}
|
|
917
955
|
}
|
|
918
956
|
createEventElement(e, t, s, n, i) {
|
|
919
|
-
const
|
|
920
|
-
this.state.keyboardMoveEventId,
|
|
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(
|
|
921
959
|
"aria-label",
|
|
922
|
-
|
|
923
|
-
),
|
|
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");
|
|
924
962
|
const l = new Date(e.start);
|
|
925
963
|
l.setHours(0, 0, 0, 0);
|
|
926
|
-
const d = (e.start.getTime() - l.getTime()) / (1e3 * 60), u = (e.end.getTime() - l.getTime()) / (1e3 * 60) - d, p = i / 60,
|
|
927
|
-
|
|
928
|
-
const y = this.createElement("div", "event-title");
|
|
929
|
-
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
-
if (e.isStart) {
|
|
933
|
-
const E = this.createElement("div", "resize-handle", "top");
|
|
934
|
-
this.setData(E, { handle: "start" }), r.appendChild(E);
|
|
935
|
-
}
|
|
936
|
-
if (e.isEnd) {
|
|
937
|
-
const E = this.createElement("div", "resize-handle", "bottom");
|
|
938
|
-
this.setData(E, { handle: "end" }), r.appendChild(E);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
return r;
|
|
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);
|
|
968
|
+
const D = this.createElement("div", "event-time");
|
|
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;
|
|
942
970
|
}
|
|
943
971
|
renderNowIndicator(e) {
|
|
944
972
|
const t = /* @__PURE__ */ new Date(), s = new Date(t);
|
|
945
973
|
s.setHours(0, 0, 0, 0);
|
|
946
|
-
const n = (t.getTime() - s.getTime()) / (1e3 * 60), i = (this.state.options.slotDuration ?? 1800) / 60,
|
|
947
|
-
|
|
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);
|
|
948
976
|
}
|
|
949
977
|
updateNowIndicator() {
|
|
950
978
|
if (!this.dayColumn || !this.state.options.nowIndicator || !h.isToday(this.state.date)) return;
|
|
951
979
|
const e = this.dayColumn.querySelector(".scheduler-now-indicator"), t = /* @__PURE__ */ new Date(), s = new Date(t);
|
|
952
980
|
s.setHours(0, 0, 0, 0);
|
|
953
|
-
const n = (t.getTime() - s.getTime()) / (1e3 * 60), i = (this.state.options.slotDuration ?? 1800) / 60,
|
|
954
|
-
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);
|
|
955
983
|
}
|
|
956
984
|
update(e) {
|
|
957
985
|
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options);
|
|
@@ -966,17 +994,17 @@ class Z extends x {
|
|
|
966
994
|
}
|
|
967
995
|
updateGreyedSlots() {
|
|
968
996
|
const { dragState: e, previewEvent: t, options: s, date: n } = this.state;
|
|
969
|
-
if (this.slotElements.forEach((
|
|
997
|
+
if (this.slotElements.forEach((r) => r.classList.remove("greyed")), !e || !t || !h.isSameDay(n, t.start)) return;
|
|
970
998
|
const i = h.getTimeSlots(
|
|
971
999
|
n,
|
|
972
1000
|
s.slotDuration,
|
|
973
1001
|
s.slotMinTime,
|
|
974
1002
|
s.slotMaxTime
|
|
975
1003
|
);
|
|
976
|
-
for (let
|
|
977
|
-
const
|
|
978
|
-
if (
|
|
979
|
-
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);
|
|
980
1008
|
a && a.classList.add("greyed");
|
|
981
1009
|
}
|
|
982
1010
|
}
|
|
@@ -987,44 +1015,46 @@ class Z extends x {
|
|
|
987
1015
|
e && e.remove();
|
|
988
1016
|
const { previewEvent: t, options: s, date: n } = this.state;
|
|
989
1017
|
if (!t || !h.isSameDay(n, t.start)) return;
|
|
990
|
-
const i = this.createElement("div", "scheduler-event", "preview"),
|
|
991
|
-
|
|
992
|
-
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);
|
|
993
1021
|
i.style.top = `${c}px`, i.style.height = `${u}px`, i.style.left = "0", i.style.width = "100%", this.eventsContainer.appendChild(i);
|
|
994
1022
|
}
|
|
995
1023
|
destroy() {
|
|
996
1024
|
this.eventsContainer = null, this.dayColumn = null, this.slotElements.clear(), this.clearContainer();
|
|
997
1025
|
}
|
|
998
1026
|
}
|
|
999
|
-
class
|
|
1027
|
+
class ne extends A {
|
|
1000
1028
|
constructor() {
|
|
1001
1029
|
super(...arguments), this.rowElements = /* @__PURE__ */ new Map(), this.slotWidth = 50;
|
|
1002
1030
|
}
|
|
1003
1031
|
render() {
|
|
1004
1032
|
this.clearContainer(), this.container.classList.add("scheduler-timeline-view");
|
|
1005
|
-
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");
|
|
1006
1034
|
a.setAttribute("role", "grid"), a.setAttribute(
|
|
1007
1035
|
"aria-label",
|
|
1008
|
-
|
|
1009
|
-
|
|
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");
|
|
1010
1040
|
const l = this.createElement("div", "scheduler-timeline-header");
|
|
1011
1041
|
l.setAttribute("role", "row"), l.setAttribute("aria-rowindex", "1");
|
|
1012
1042
|
const d = this.createElement("div", "scheduler-resource-header");
|
|
1013
|
-
d.setAttribute("role", "columnheader"), d.textContent =
|
|
1043
|
+
d.setAttribute("role", "columnheader"), d.textContent = S(this.state.options.messages).resourcesHeader, l.appendChild(d);
|
|
1014
1044
|
const c = this.createElement("div", "scheduler-timeline-slots-header");
|
|
1015
1045
|
for (const y of i) {
|
|
1016
|
-
const
|
|
1046
|
+
const D = h.getTimeSlots(
|
|
1017
1047
|
y,
|
|
1018
1048
|
t.slotDuration,
|
|
1019
1049
|
t.slotMinTime,
|
|
1020
1050
|
t.slotMaxTime
|
|
1021
|
-
).length,
|
|
1022
|
-
|
|
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);
|
|
1023
1053
|
}
|
|
1024
1054
|
l.appendChild(c), a.appendChild(l);
|
|
1025
1055
|
const u = this.createElement("div", "scheduler-timeline-header"), p = this.createElement("div", "scheduler-resource-header");
|
|
1026
1056
|
p.style.borderBottom = "1px solid var(--scheduler-border-color)", u.appendChild(p);
|
|
1027
|
-
const
|
|
1057
|
+
const v = this.createElement("div", "scheduler-timeline-slots-header");
|
|
1028
1058
|
for (const y of i) {
|
|
1029
1059
|
const w = h.getTimeSlots(
|
|
1030
1060
|
y,
|
|
@@ -1032,20 +1062,20 @@ class Q extends x {
|
|
|
1032
1062
|
t.slotMinTime,
|
|
1033
1063
|
t.slotMaxTime
|
|
1034
1064
|
);
|
|
1035
|
-
for (const
|
|
1036
|
-
const
|
|
1037
|
-
|
|
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);
|
|
1038
1068
|
}
|
|
1039
1069
|
}
|
|
1040
|
-
u.appendChild(
|
|
1041
|
-
const
|
|
1070
|
+
u.appendChild(v), a.appendChild(u);
|
|
1071
|
+
const g = this.createElement("div", "scheduler-timeline-body"), f = C.flatten(s, n);
|
|
1042
1072
|
let b = 2;
|
|
1043
1073
|
for (const y of f) {
|
|
1044
1074
|
if (!y.visible) continue;
|
|
1045
1075
|
const w = this.createResourceRow(y, i);
|
|
1046
|
-
w.setAttribute("aria-rowindex", String(b)),
|
|
1076
|
+
w.setAttribute("aria-rowindex", String(b)), g.appendChild(w), b++;
|
|
1047
1077
|
}
|
|
1048
|
-
a.appendChild(
|
|
1078
|
+
a.appendChild(g), this.container.appendChild(a), this.renderEvents(i), this.updateCellFocusAndSelection();
|
|
1049
1079
|
}
|
|
1050
1080
|
/**
|
|
1051
1081
|
* Apply roving tabindex + aria-selected + `.selected` class to each
|
|
@@ -1055,14 +1085,14 @@ class Q extends x {
|
|
|
1055
1085
|
updateCellFocusAndSelection() {
|
|
1056
1086
|
const e = this.state.focusedCell, t = this.state.focusedResourceId, s = this.container.querySelectorAll(".scheduler-timeline-slot");
|
|
1057
1087
|
let n = !1, i = null;
|
|
1058
|
-
s.forEach((
|
|
1059
|
-
i || (i =
|
|
1060
|
-
const
|
|
1061
|
-
if (!
|
|
1062
|
-
const d = { start: new Date(
|
|
1063
|
-
|
|
1064
|
-
const u =
|
|
1065
|
-
|
|
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);
|
|
1066
1096
|
}), !n && i && i.setAttribute("tabindex", "0");
|
|
1067
1097
|
}
|
|
1068
1098
|
createResourceRow(e, t) {
|
|
@@ -1073,12 +1103,18 @@ class Q extends x {
|
|
|
1073
1103
|
const a = this.createElement("button", "expand-toggle");
|
|
1074
1104
|
a.type = "button";
|
|
1075
1105
|
const l = this.state.collapsedGroups.has(e.item.id);
|
|
1076
|
-
a.textContent = l ? "▶" : "▼", a.setAttribute("aria-expanded", String(!l)), a.setAttribute(
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
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");
|
|
1082
1118
|
for (const a of t) {
|
|
1083
1119
|
const l = h.getTimeSlots(
|
|
1084
1120
|
a,
|
|
@@ -1092,32 +1128,32 @@ class Q extends x {
|
|
|
1092
1128
|
resourceId: e.item.id,
|
|
1093
1129
|
start: d.start.toISOString(),
|
|
1094
1130
|
end: d.end.toISOString()
|
|
1095
|
-
}),
|
|
1131
|
+
}), o.appendChild(c);
|
|
1096
1132
|
}
|
|
1097
1133
|
}
|
|
1098
|
-
if (
|
|
1134
|
+
if (W(e.item)) {
|
|
1099
1135
|
const a = this.createElement("div", "scheduler-timeline-events");
|
|
1100
|
-
a.setAttribute("role", "gridcell"),
|
|
1136
|
+
a.setAttribute("role", "gridcell"), o.appendChild(a);
|
|
1101
1137
|
}
|
|
1102
|
-
return n.appendChild(
|
|
1138
|
+
return n.appendChild(o), this.rowElements.set(e.item.id, n), n;
|
|
1103
1139
|
}
|
|
1104
1140
|
renderEvents(e) {
|
|
1105
|
-
const { events: t, resources: s, options: n, collapsedGroups: i } = this.state,
|
|
1106
|
-
|
|
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);
|
|
1107
1143
|
const d = h.getTimeSlots(
|
|
1108
1144
|
e[0],
|
|
1109
1145
|
n.slotDuration,
|
|
1110
1146
|
n.slotMinTime,
|
|
1111
1147
|
n.slotMaxTime
|
|
1112
|
-
).length * 7 * this.slotWidth, c =
|
|
1148
|
+
).length * 7 * this.slotWidth, c = C.getAllResources(s);
|
|
1113
1149
|
for (const u of c) {
|
|
1114
1150
|
const p = this.rowElements.get(u.id);
|
|
1115
1151
|
if (!p) continue;
|
|
1116
|
-
const
|
|
1117
|
-
if (!
|
|
1118
|
-
|
|
1152
|
+
const v = p.querySelector(".scheduler-timeline-events");
|
|
1153
|
+
if (!v) continue;
|
|
1154
|
+
v.innerHTML = "";
|
|
1119
1155
|
const f = (u.events ?? []).filter(
|
|
1120
|
-
(y) => y.start <
|
|
1156
|
+
(y) => y.start < o && y.end > r
|
|
1121
1157
|
).map((y) => ({
|
|
1122
1158
|
id: y.id,
|
|
1123
1159
|
event: y,
|
|
@@ -1128,30 +1164,64 @@ class Q extends x {
|
|
|
1128
1164
|
dayIndex: 0,
|
|
1129
1165
|
totalDays: 1
|
|
1130
1166
|
})), b = M.getTimelinedParts(f);
|
|
1131
|
-
for (const { part: y, trackIndex: w, totalTracks:
|
|
1167
|
+
for (const { part: y, trackIndex: w, totalTracks: D, colspan: E } of b) {
|
|
1132
1168
|
if (!y.event) continue;
|
|
1133
|
-
const
|
|
1169
|
+
const I = this.createEventElement(
|
|
1134
1170
|
y.event,
|
|
1135
1171
|
w,
|
|
1136
|
-
E,
|
|
1137
1172
|
D,
|
|
1138
|
-
|
|
1173
|
+
E,
|
|
1174
|
+
r,
|
|
1139
1175
|
d,
|
|
1140
1176
|
n.slotDuration ?? 1800,
|
|
1141
1177
|
u.title
|
|
1142
1178
|
);
|
|
1143
|
-
|
|
1179
|
+
v.appendChild(I);
|
|
1144
1180
|
}
|
|
1145
1181
|
}
|
|
1146
1182
|
}
|
|
1147
|
-
createEventElement(e, t, s, n, i,
|
|
1183
|
+
createEventElement(e, t, s, n, i, r, o, a = null) {
|
|
1148
1184
|
const l = this.createElement("div", "scheduler-timeline-event"), d = this.state.selectedEvent?.id === e.id;
|
|
1149
1185
|
this.state.keyboardMoveEventId, e.id, l.setAttribute("role", "button"), l.setAttribute("tabindex", "0"), l.setAttribute(
|
|
1150
1186
|
"aria-label",
|
|
1151
|
-
|
|
1152
|
-
), l.setAttribute("aria-pressed", d ? "true" : "false"), d && l.classList.add("selected");
|
|
1153
|
-
const c = Math.max(e.start.getTime(), i.getTime()), u = i.getTime() + 10080 * 60 * 1e3, p = Math.min(e.end.getTime(), u),
|
|
1154
|
-
|
|
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);
|
|
1155
1225
|
}
|
|
1156
1226
|
update(e) {
|
|
1157
1227
|
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options);
|
|
@@ -1161,7 +1231,7 @@ class Q extends x {
|
|
|
1161
1231
|
}
|
|
1162
1232
|
this.updateGreyedSlots();
|
|
1163
1233
|
const n = h.getWeekDays(e.date, e.options.firstDayOfWeek);
|
|
1164
|
-
this.renderEvents(n), this.updateCellFocusAndSelection();
|
|
1234
|
+
this.renderEvents(n), this.renderPreviewEvent(n), this.updateCellFocusAndSelection();
|
|
1165
1235
|
}
|
|
1166
1236
|
optionsRequireRerender(e, t) {
|
|
1167
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;
|
|
@@ -1169,15 +1239,16 @@ class Q extends x {
|
|
|
1169
1239
|
updateGreyedSlots() {
|
|
1170
1240
|
const { dragState: e, previewEvent: t } = this.state, s = this.container.querySelectorAll(".scheduler-timeline-slot");
|
|
1171
1241
|
s.forEach((n) => n.classList.remove("greyed")), !(!e || !t) && s.forEach((n) => {
|
|
1172
|
-
const i = new Date(n.dataset.start ?? ""),
|
|
1173
|
-
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");
|
|
1174
1244
|
});
|
|
1175
1245
|
}
|
|
1176
1246
|
destroy() {
|
|
1177
1247
|
this.rowElements.clear(), this.clearContainer();
|
|
1178
1248
|
}
|
|
1179
1249
|
}
|
|
1180
|
-
const
|
|
1250
|
+
const ie = N(`@charset "UTF-8";
|
|
1251
|
+
:host {
|
|
1181
1252
|
display: block;
|
|
1182
1253
|
height: 100%;
|
|
1183
1254
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
|
|
@@ -1193,12 +1264,29 @@ const ee = W(`:host {
|
|
|
1193
1264
|
--scheduler-greyed-slot-bg: rgba(0, 0, 0, 0.1);
|
|
1194
1265
|
--scheduler-column-min-width: 120px;
|
|
1195
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);
|
|
1196
1270
|
}
|
|
1197
1271
|
|
|
1198
1272
|
* {
|
|
1199
1273
|
box-sizing: border-box;
|
|
1200
1274
|
}
|
|
1201
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
|
+
|
|
1202
1290
|
.scheduler-container {
|
|
1203
1291
|
display: flex;
|
|
1204
1292
|
flex-direction: column;
|
|
@@ -1209,17 +1297,44 @@ const ee = W(`:host {
|
|
|
1209
1297
|
background: var(--bs-body-bg);
|
|
1210
1298
|
}
|
|
1211
1299
|
|
|
1212
|
-
/* 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). */
|
|
1213
1304
|
.scheduler-header {
|
|
1214
1305
|
display: flex;
|
|
1215
1306
|
align-items: center;
|
|
1216
1307
|
justify-content: space-between;
|
|
1308
|
+
flex-wrap: wrap;
|
|
1309
|
+
gap: 8px;
|
|
1217
1310
|
padding: 8px 12px;
|
|
1218
1311
|
background: var(--scheduler-header-bg);
|
|
1219
1312
|
border-bottom: 1px solid var(--scheduler-border-color);
|
|
1220
1313
|
flex-shrink: 0;
|
|
1221
1314
|
}
|
|
1222
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
|
+
|
|
1223
1338
|
.scheduler-nav {
|
|
1224
1339
|
display: flex;
|
|
1225
1340
|
align-items: center;
|
|
@@ -1242,6 +1357,9 @@ const ee = W(`:host {
|
|
|
1242
1357
|
.scheduler-title {
|
|
1243
1358
|
font-size: 18px;
|
|
1244
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;
|
|
1245
1363
|
}
|
|
1246
1364
|
|
|
1247
1365
|
.scheduler-view-switcher {
|
|
@@ -1415,14 +1533,29 @@ const ee = W(`:host {
|
|
|
1415
1533
|
border-radius: var(--scheduler-event-border-radius);
|
|
1416
1534
|
padding: 2px 4px;
|
|
1417
1535
|
font-size: 12px;
|
|
1418
|
-
|
|
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;
|
|
1419
1539
|
cursor: pointer;
|
|
1420
1540
|
pointer-events: auto;
|
|
1421
1541
|
border-left: 3px solid rgba(0, 0, 0, 0.2);
|
|
1422
1542
|
}
|
|
1423
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
|
+
|
|
1424
1556
|
/* Prevent browser from handling touch gestures on events (enables drag) */
|
|
1425
|
-
.scheduler-event:not(.preview)
|
|
1557
|
+
.scheduler-event:not(.preview),
|
|
1558
|
+
.scheduler-timeline-event:not(.preview) {
|
|
1426
1559
|
touch-action: none;
|
|
1427
1560
|
-ms-touch-action: none;
|
|
1428
1561
|
}
|
|
@@ -1431,8 +1564,24 @@ const ee = W(`:host {
|
|
|
1431
1564
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
1432
1565
|
}
|
|
1433
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
|
+
|
|
1434
1579
|
.scheduler-event.selected {
|
|
1435
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;
|
|
1436
1585
|
}
|
|
1437
1586
|
|
|
1438
1587
|
.scheduler-event .event-title {
|
|
@@ -1453,13 +1602,18 @@ const ee = W(`:host {
|
|
|
1453
1602
|
pointer-events: none;
|
|
1454
1603
|
}
|
|
1455
1604
|
|
|
1456
|
-
/* 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. */
|
|
1457
1609
|
.scheduler-event .resize-handle {
|
|
1458
1610
|
position: absolute;
|
|
1459
1611
|
left: 0;
|
|
1460
1612
|
right: 0;
|
|
1461
1613
|
height: 8px;
|
|
1462
1614
|
cursor: ns-resize;
|
|
1615
|
+
touch-action: none;
|
|
1616
|
+
-ms-touch-action: none;
|
|
1463
1617
|
}
|
|
1464
1618
|
|
|
1465
1619
|
.scheduler-event .resize-handle.top {
|
|
@@ -1470,6 +1624,55 @@ const ee = W(`:host {
|
|
|
1470
1624
|
bottom: 0;
|
|
1471
1625
|
}
|
|
1472
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
|
+
|
|
1473
1676
|
/* Now indicator */
|
|
1474
1677
|
.scheduler-now-indicator {
|
|
1475
1678
|
position: absolute;
|
|
@@ -1739,15 +1942,66 @@ const ee = W(`:host {
|
|
|
1739
1942
|
border-radius: var(--scheduler-event-border-radius);
|
|
1740
1943
|
padding: 2px 6px;
|
|
1741
1944
|
font-size: 12px;
|
|
1742
|
-
|
|
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;
|
|
1743
1948
|
cursor: pointer;
|
|
1744
1949
|
pointer-events: auto;
|
|
1745
1950
|
}
|
|
1746
1951
|
|
|
1747
1952
|
.scheduler-timeline-event.selected {
|
|
1748
1953
|
box-shadow: 0 0 0 3px var(--bs-body-color);
|
|
1954
|
+
z-index: 2;
|
|
1749
1955
|
}
|
|
1750
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;
|
|
1980
|
+
}
|
|
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
|
+
}
|
|
1751
2005
|
/* Loading state */
|
|
1752
2006
|
.scheduler-loading {
|
|
1753
2007
|
display: flex;
|
|
@@ -1850,18 +2104,19 @@ const ee = W(`:host {
|
|
|
1850
2104
|
|
|
1851
2105
|
@media (prefers-reduced-motion: reduce) {
|
|
1852
2106
|
.scheduler-event,
|
|
1853
|
-
.scheduler-timeline-event
|
|
2107
|
+
.scheduler-timeline-event,
|
|
2108
|
+
.resize-glyph {
|
|
1854
2109
|
animation: none !important;
|
|
1855
2110
|
transition: none !important;
|
|
1856
2111
|
}
|
|
1857
|
-
}`),
|
|
2112
|
+
}`), O = {
|
|
1858
2113
|
dragThreshold: 5,
|
|
1859
2114
|
minDurationMs: 1800 * 1e3
|
|
1860
2115
|
// 30 minutes
|
|
1861
2116
|
};
|
|
1862
|
-
class
|
|
2117
|
+
class re {
|
|
1863
2118
|
constructor(e = {}) {
|
|
1864
|
-
this.config = { ...
|
|
2119
|
+
this.config = { ...O, ...e };
|
|
1865
2120
|
}
|
|
1866
2121
|
/**
|
|
1867
2122
|
* Calculate the preview event position based on drag state.
|
|
@@ -1903,8 +2158,8 @@ class te {
|
|
|
1903
2158
|
* Preserves event duration, applies offset from drag start.
|
|
1904
2159
|
*/
|
|
1905
2160
|
calculateMovePreview(e, t, s) {
|
|
1906
|
-
const n = t.start.getTime() - e.start.getTime(), i = s.end.getTime() - s.start.getTime(),
|
|
1907
|
-
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 };
|
|
1908
2163
|
}
|
|
1909
2164
|
/**
|
|
1910
2165
|
* Calculate preview for resizing event start.
|
|
@@ -1929,36 +2184,36 @@ class te {
|
|
|
1929
2184
|
return { start: t.start, end: n };
|
|
1930
2185
|
}
|
|
1931
2186
|
}
|
|
1932
|
-
function
|
|
2187
|
+
function T(m) {
|
|
1933
2188
|
return {
|
|
1934
2189
|
pointerId: 0,
|
|
1935
2190
|
pointerType: "mouse",
|
|
1936
|
-
clientX:
|
|
1937
|
-
clientY:
|
|
1938
|
-
originalEvent:
|
|
1939
|
-
target:
|
|
2191
|
+
clientX: m.clientX,
|
|
2192
|
+
clientY: m.clientY,
|
|
2193
|
+
originalEvent: m,
|
|
2194
|
+
target: m.target,
|
|
1940
2195
|
isPrimary: !0
|
|
1941
2196
|
};
|
|
1942
2197
|
}
|
|
1943
|
-
function
|
|
1944
|
-
const e =
|
|
2198
|
+
function z(m) {
|
|
2199
|
+
const e = m.touches[0] || m.changedTouches[0];
|
|
1945
2200
|
return e ? {
|
|
1946
2201
|
pointerId: e.identifier,
|
|
1947
2202
|
pointerType: "touch",
|
|
1948
2203
|
clientX: e.clientX,
|
|
1949
2204
|
clientY: e.clientY,
|
|
1950
|
-
originalEvent:
|
|
2205
|
+
originalEvent: m,
|
|
1951
2206
|
target: e.target,
|
|
1952
2207
|
isPrimary: e.identifier === 0
|
|
1953
2208
|
} : null;
|
|
1954
2209
|
}
|
|
1955
|
-
function
|
|
1956
|
-
const t = e.x -
|
|
2210
|
+
function U(m, e) {
|
|
2211
|
+
const t = e.x - m.x, s = e.y - m.y;
|
|
1957
2212
|
return Math.sqrt(t * t + s * s);
|
|
1958
2213
|
}
|
|
1959
|
-
class
|
|
2214
|
+
class oe {
|
|
1960
2215
|
constructor(e = {}) {
|
|
1961
|
-
this.state = { phase: "idle" }, this.config = { ...
|
|
2216
|
+
this.state = { phase: "idle" }, this.config = { ...O, ...e }, this.previewCalculator = new re(this.config);
|
|
1962
2217
|
}
|
|
1963
2218
|
/**
|
|
1964
2219
|
* Get current state (read-only).
|
|
@@ -2051,20 +2306,20 @@ class se {
|
|
|
2051
2306
|
transitionFromIdle(e) {
|
|
2052
2307
|
if (e.type !== "POINTER_DOWN")
|
|
2053
2308
|
return this.state;
|
|
2054
|
-
const { target: t, position: s, slot: n, slotElement: i, immediate:
|
|
2055
|
-
if (!
|
|
2309
|
+
const { target: t, position: s, slot: n, slotElement: i, immediate: r } = e, o = this.getOperationType(t);
|
|
2310
|
+
if (!o)
|
|
2056
2311
|
return this.state;
|
|
2057
2312
|
const a = t.event ?? null;
|
|
2058
2313
|
if (a && a.draggable === !1)
|
|
2059
2314
|
return this.state;
|
|
2060
|
-
if (
|
|
2315
|
+
if (r) {
|
|
2061
2316
|
let l = n;
|
|
2062
|
-
if (!l && a &&
|
|
2317
|
+
if (!l && a && (l = {
|
|
2063
2318
|
start: a.start,
|
|
2064
2319
|
end: a.end
|
|
2065
2320
|
}), l) {
|
|
2066
2321
|
const d = this.previewCalculator.calculatePreview(
|
|
2067
|
-
|
|
2322
|
+
o,
|
|
2068
2323
|
l,
|
|
2069
2324
|
l,
|
|
2070
2325
|
a
|
|
@@ -2072,7 +2327,7 @@ class se {
|
|
|
2072
2327
|
if (d)
|
|
2073
2328
|
return {
|
|
2074
2329
|
phase: "active",
|
|
2075
|
-
operationType:
|
|
2330
|
+
operationType: o,
|
|
2076
2331
|
event: a,
|
|
2077
2332
|
startSlot: l,
|
|
2078
2333
|
currentSlot: l,
|
|
@@ -2083,7 +2338,7 @@ class se {
|
|
|
2083
2338
|
}
|
|
2084
2339
|
return {
|
|
2085
2340
|
phase: "pending",
|
|
2086
|
-
operationType:
|
|
2341
|
+
operationType: o,
|
|
2087
2342
|
event: a,
|
|
2088
2343
|
startPosition: s,
|
|
2089
2344
|
startSlot: n,
|
|
@@ -2097,7 +2352,7 @@ class se {
|
|
|
2097
2352
|
if (this.state.phase !== "pending") return this.state;
|
|
2098
2353
|
switch (e.type) {
|
|
2099
2354
|
case "POINTER_MOVE":
|
|
2100
|
-
return
|
|
2355
|
+
return U(
|
|
2101
2356
|
this.state.startPosition,
|
|
2102
2357
|
e.position
|
|
2103
2358
|
) < this.config.dragThreshold ? this.state : this.activateDrag(e.slot);
|
|
@@ -2215,9 +2470,9 @@ class se {
|
|
|
2215
2470
|
} : { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date() };
|
|
2216
2471
|
}
|
|
2217
2472
|
}
|
|
2218
|
-
class
|
|
2473
|
+
class ae {
|
|
2219
2474
|
constructor(e, t = {}) {
|
|
2220
|
-
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);
|
|
2221
2476
|
}
|
|
2222
2477
|
/**
|
|
2223
2478
|
* Set the function used to get a slot at a position.
|
|
@@ -2308,7 +2563,7 @@ class ne {
|
|
|
2308
2563
|
*/
|
|
2309
2564
|
createEventFromResult(e) {
|
|
2310
2565
|
return {
|
|
2311
|
-
id:
|
|
2566
|
+
id: _(),
|
|
2312
2567
|
title: "New Event",
|
|
2313
2568
|
start: e.preview.start,
|
|
2314
2569
|
end: e.preview.end,
|
|
@@ -2361,8 +2616,8 @@ class ne {
|
|
|
2361
2616
|
this.pendingUpdate !== null && (cancelAnimationFrame(this.pendingUpdate), this.pendingUpdate = null), this.latestPointer = null;
|
|
2362
2617
|
}
|
|
2363
2618
|
}
|
|
2364
|
-
const
|
|
2365
|
-
class
|
|
2619
|
+
const le = 600, de = 10;
|
|
2620
|
+
class ce {
|
|
2366
2621
|
constructor(e, t) {
|
|
2367
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);
|
|
2368
2623
|
}
|
|
@@ -2396,19 +2651,23 @@ class re {
|
|
|
2396
2651
|
analyzeTarget(e) {
|
|
2397
2652
|
const t = e.closest(".resize-handle");
|
|
2398
2653
|
if (t) {
|
|
2399
|
-
const
|
|
2400
|
-
|
|
2654
|
+
const r = t.closest(
|
|
2655
|
+
".scheduler-event, .scheduler-timeline-event"
|
|
2656
|
+
)?.dataset.eventId, o = r ? this.config.getEventById(r) : null;
|
|
2657
|
+
if (o)
|
|
2401
2658
|
return {
|
|
2402
2659
|
type: "resize-handle",
|
|
2403
|
-
event:
|
|
2660
|
+
event: o,
|
|
2404
2661
|
resizeHandle: t.dataset.handle
|
|
2405
2662
|
};
|
|
2406
2663
|
}
|
|
2407
|
-
const s = e.closest(
|
|
2664
|
+
const s = e.closest(
|
|
2665
|
+
".scheduler-event:not(.preview), .scheduler-timeline-event:not(.preview)"
|
|
2666
|
+
);
|
|
2408
2667
|
if (s) {
|
|
2409
|
-
const i = s.dataset.eventId,
|
|
2410
|
-
if (
|
|
2411
|
-
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 };
|
|
2412
2671
|
}
|
|
2413
2672
|
const n = e.closest(
|
|
2414
2673
|
".scheduler-time-slot, .scheduler-timeline-slot"
|
|
@@ -2418,23 +2677,23 @@ class re {
|
|
|
2418
2677
|
// Mouse event handlers
|
|
2419
2678
|
handleMouseDown(e) {
|
|
2420
2679
|
if (!this.config.isEditable()) return;
|
|
2421
|
-
const t =
|
|
2680
|
+
const t = T(e), s = this.analyzeTarget(t.target);
|
|
2422
2681
|
s.type !== "none" && (s.type === "slot" && !this.config.isSelectable() || (e.preventDefault(), this.callbacks.onPointerDown(t, s)));
|
|
2423
2682
|
}
|
|
2424
2683
|
handleMouseMove(e) {
|
|
2425
|
-
const t =
|
|
2684
|
+
const t = T(e);
|
|
2426
2685
|
this.callbacks.onPointerMove(t);
|
|
2427
2686
|
}
|
|
2428
2687
|
handleMouseUp(e) {
|
|
2429
|
-
const t =
|
|
2688
|
+
const t = T(e);
|
|
2430
2689
|
this.callbacks.onPointerUp(t);
|
|
2431
2690
|
}
|
|
2432
2691
|
handleClick(e) {
|
|
2433
|
-
const t =
|
|
2692
|
+
const t = T(e), s = this.analyzeTarget(t.target);
|
|
2434
2693
|
s.type === "event" || s.type === "resize-handle" || this.callbacks.onClick(t, s);
|
|
2435
2694
|
}
|
|
2436
2695
|
handleDblClick(e) {
|
|
2437
|
-
const t =
|
|
2696
|
+
const t = T(e), s = this.analyzeTarget(t.target);
|
|
2438
2697
|
this.callbacks.onDoubleClick(t, s);
|
|
2439
2698
|
}
|
|
2440
2699
|
// Touch event handlers
|
|
@@ -2444,38 +2703,42 @@ class re {
|
|
|
2444
2703
|
this.cancelTouchHold();
|
|
2445
2704
|
return;
|
|
2446
2705
|
}
|
|
2447
|
-
const t =
|
|
2706
|
+
const t = z(e);
|
|
2448
2707
|
if (!t) return;
|
|
2449
2708
|
const s = this.analyzeTarget(t.target);
|
|
2450
2709
|
if (s.type === "none" || s.type === "slot" && !this.config.isSelectable()) return;
|
|
2451
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";
|
|
2452
2711
|
const n = this, i = e.target;
|
|
2453
|
-
i.addEventListener("touchmove", function(
|
|
2454
|
-
n.handleTouchMove(
|
|
2455
|
-
}, { passive: !1 }), i.addEventListener("touchend", function(
|
|
2456
|
-
n.handleTouchEnd(
|
|
2457
|
-
}), i.addEventListener("touchcancel", function(
|
|
2458
|
-
n.handleTouchCancel(
|
|
2459
|
-
}), this.
|
|
2460
|
-
|
|
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;
|
|
2461
2724
|
this.touchHoldTimer = setTimeout(() => {
|
|
2462
2725
|
this.activateTouchDragMode(t, s);
|
|
2463
|
-
},
|
|
2726
|
+
}, r);
|
|
2464
2727
|
}
|
|
2465
2728
|
handleTouchMove(e) {
|
|
2466
2729
|
if (e.touches.length !== 1) {
|
|
2467
2730
|
this.cancelTouchHold(), this.exitPanMode();
|
|
2468
2731
|
return;
|
|
2469
2732
|
}
|
|
2470
|
-
const t =
|
|
2733
|
+
const t = z(e);
|
|
2471
2734
|
if (t) {
|
|
2472
2735
|
if (this.isPanMode) {
|
|
2473
2736
|
e.preventDefault(), this.performPan(t.clientX, t.clientY);
|
|
2474
2737
|
return;
|
|
2475
2738
|
}
|
|
2476
2739
|
if (this.touchHoldTimer && this.touchStartPosition) {
|
|
2477
|
-
const s = this.config.touchMoveThreshold ??
|
|
2478
|
-
if (
|
|
2740
|
+
const s = this.config.touchMoveThreshold ?? de;
|
|
2741
|
+
if (U(this.touchStartPosition, {
|
|
2479
2742
|
x: t.clientX,
|
|
2480
2743
|
y: t.clientY
|
|
2481
2744
|
}) > s) {
|
|
@@ -2489,7 +2752,7 @@ class re {
|
|
|
2489
2752
|
}
|
|
2490
2753
|
}
|
|
2491
2754
|
handleTouchEnd(e) {
|
|
2492
|
-
const t =
|
|
2755
|
+
const t = z(e);
|
|
2493
2756
|
if (this.isPanMode) {
|
|
2494
2757
|
this.exitPanMode();
|
|
2495
2758
|
return;
|
|
@@ -2570,7 +2833,7 @@ class re {
|
|
|
2570
2833
|
e && e.classList.remove("scroll-blocked");
|
|
2571
2834
|
}
|
|
2572
2835
|
}
|
|
2573
|
-
class
|
|
2836
|
+
class he {
|
|
2574
2837
|
constructor(e) {
|
|
2575
2838
|
this.host = e;
|
|
2576
2839
|
}
|
|
@@ -2641,12 +2904,12 @@ class ae {
|
|
|
2641
2904
|
this.emit({ type: "selection-change", selectedEvent: e, range: t, view: s, resourceId: n });
|
|
2642
2905
|
}
|
|
2643
2906
|
}
|
|
2644
|
-
class
|
|
2907
|
+
class F extends V {
|
|
2645
2908
|
constructor() {
|
|
2646
|
-
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));
|
|
2647
2910
|
}
|
|
2648
2911
|
static {
|
|
2649
|
-
this.styles = [
|
|
2912
|
+
this.styles = [ie];
|
|
2650
2913
|
}
|
|
2651
2914
|
static get observedAttributes() {
|
|
2652
2915
|
return [
|
|
@@ -2665,7 +2928,7 @@ class le extends B {
|
|
|
2665
2928
|
super.connectedCallback(), this.inputHandler && this.inputHandler.attach(), this.addEventListener("keydown", this.boundHandleKeyDown), this.startNowIndicatorTimer();
|
|
2666
2929
|
}
|
|
2667
2930
|
disconnectedCallback() {
|
|
2668
|
-
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();
|
|
2669
2932
|
}
|
|
2670
2933
|
attributeChangedCallback(e, t, s) {
|
|
2671
2934
|
if (super.attributeChangedCallback(e, t, s), t !== s)
|
|
@@ -2757,7 +3020,18 @@ class le extends B {
|
|
|
2757
3020
|
this.stateManager.gotoDate(e);
|
|
2758
3021
|
}
|
|
2759
3022
|
changeView(e) {
|
|
2760
|
-
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]);
|
|
2761
3035
|
}
|
|
2762
3036
|
/**
|
|
2763
3037
|
* Clear the time-range selection and the focused-cell selection. Public
|
|
@@ -2769,41 +3043,54 @@ class le extends B {
|
|
|
2769
3043
|
this.stateManager.clearSelection();
|
|
2770
3044
|
}
|
|
2771
3045
|
addEvent(e) {
|
|
2772
|
-
this.stateManager.addEvent(e), this.liveAnnouncer.announce(
|
|
3046
|
+
this.stateManager.addEvent(e), this.liveAnnouncer.announce(this.msg("eventAdded", { title: e.title }));
|
|
2773
3047
|
}
|
|
2774
3048
|
updateEvent(e) {
|
|
2775
|
-
this.stateManager.updateEvent(e), this.liveAnnouncer.announce(
|
|
3049
|
+
this.stateManager.updateEvent(e), this.liveAnnouncer.announce(this.msg("eventUpdated", { title: e.title }));
|
|
2776
3050
|
}
|
|
2777
3051
|
removeEvent(e) {
|
|
2778
3052
|
const t = this.getEventById(e);
|
|
2779
|
-
this.stateManager.removeEvent(e), t && this.liveAnnouncer.announce(
|
|
3053
|
+
this.stateManager.removeEvent(e), t && this.liveAnnouncer.announce(this.msg("eventRemoved", { title: t.title }));
|
|
2780
3054
|
}
|
|
2781
3055
|
getEventById(e) {
|
|
2782
|
-
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;
|
|
2783
3057
|
}
|
|
2784
3058
|
refetchEvents() {
|
|
2785
3059
|
this.currentView?.update(this.stateManager.getState());
|
|
2786
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
|
+
}
|
|
2787
3071
|
// ============================================
|
|
2788
3072
|
// Rendering
|
|
2789
3073
|
// ============================================
|
|
2790
3074
|
render() {
|
|
2791
|
-
return
|
|
3075
|
+
return q`
|
|
2792
3076
|
<div class="scheduler-container">
|
|
2793
3077
|
<header class="scheduler-header"></header>
|
|
2794
3078
|
<div class="scheduler-content"></div>
|
|
2795
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>
|
|
2796
3082
|
${this.liveAnnouncer.template()}
|
|
2797
3083
|
`;
|
|
2798
3084
|
}
|
|
2799
3085
|
firstUpdated() {
|
|
2800
3086
|
const e = this.shadowRoot.querySelector(".scheduler-header");
|
|
2801
|
-
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(
|
|
2802
3088
|
{
|
|
2803
3089
|
shadowRoot: this.shadowRoot,
|
|
2804
3090
|
getEventById: (t) => this.getEventById(t),
|
|
2805
3091
|
isEditable: () => this.stateManager.getState().options.editable ?? !0,
|
|
2806
|
-
isSelectable: () => this.stateManager.getState().options.selectable ?? !0
|
|
3092
|
+
isSelectable: () => this.stateManager.getState().options.selectable ?? !0,
|
|
3093
|
+
isEventSelected: (t) => this.stateManager.getState().selectedEvent?.id === t
|
|
2807
3094
|
},
|
|
2808
3095
|
{
|
|
2809
3096
|
onPointerDown: (t, s, n) => this.handlePointerDown(t, s, n),
|
|
@@ -2817,54 +3104,48 @@ class le extends B {
|
|
|
2817
3104
|
}
|
|
2818
3105
|
populateHeader(e) {
|
|
2819
3106
|
const t = document.createElement("nav");
|
|
2820
|
-
t.className = "scheduler-nav", t.setAttribute("aria-label", "
|
|
3107
|
+
t.className = "scheduler-nav", t.setAttribute("aria-label", this.msg("navLabel"));
|
|
2821
3108
|
const s = document.createElement("button");
|
|
2822
|
-
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());
|
|
2823
3110
|
const n = document.createElement("button");
|
|
2824
|
-
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());
|
|
2825
3112
|
const i = document.createElement("button");
|
|
2826
|
-
i.type = "button", i.textContent = "
|
|
2827
|
-
const o = document.createElement("div");
|
|
2828
|
-
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);
|
|
2829
3114
|
const r = document.createElement("div");
|
|
2830
|
-
r.className = "scheduler-
|
|
2831
|
-
const
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
const c = document.createElement("button");
|
|
2840
|
-
c.type = "button", c.textContent = d, c.dataset.view = l;
|
|
2841
|
-
const u = l === this.view;
|
|
2842
|
-
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);
|
|
2843
3124
|
}
|
|
2844
|
-
e.appendChild(t), e.appendChild(
|
|
3125
|
+
e.appendChild(t), e.appendChild(r), e.appendChild(o);
|
|
2845
3126
|
}
|
|
2846
3127
|
updateTitle(e) {
|
|
2847
3128
|
const t = e ?? this.shadowRoot.querySelector(".scheduler-title");
|
|
2848
3129
|
if (!t) return;
|
|
2849
|
-
const s = this.stateManager.getState(), { date: n, view: i, options:
|
|
2850
|
-
let
|
|
3130
|
+
const s = this.stateManager.getState(), { date: n, view: i, options: r } = s;
|
|
3131
|
+
let o = "";
|
|
2851
3132
|
switch (i) {
|
|
2852
3133
|
case "year":
|
|
2853
|
-
|
|
3134
|
+
o = n.getFullYear().toString();
|
|
2854
3135
|
break;
|
|
2855
3136
|
case "month":
|
|
2856
|
-
|
|
3137
|
+
o = h.formatDate(n, r.locale, {
|
|
2857
3138
|
month: "long",
|
|
2858
3139
|
year: "numeric"
|
|
2859
3140
|
});
|
|
2860
3141
|
break;
|
|
2861
3142
|
case "week":
|
|
2862
3143
|
case "timeline": {
|
|
2863
|
-
const a = h.getWeekStart(n,
|
|
2864
|
-
|
|
3144
|
+
const a = h.getWeekStart(n, r.firstDayOfWeek), l = h.addDays(a, 6);
|
|
3145
|
+
o = `${h.formatDate(a, r.locale, {
|
|
2865
3146
|
month: "short",
|
|
2866
3147
|
day: "numeric"
|
|
2867
|
-
})} - ${h.formatDate(l,
|
|
3148
|
+
})} - ${h.formatDate(l, r.locale, {
|
|
2868
3149
|
month: "short",
|
|
2869
3150
|
day: "numeric",
|
|
2870
3151
|
year: "numeric"
|
|
@@ -2872,7 +3153,7 @@ class le extends B {
|
|
|
2872
3153
|
break;
|
|
2873
3154
|
}
|
|
2874
3155
|
case "day":
|
|
2875
|
-
|
|
3156
|
+
o = h.formatDate(n, r.locale, {
|
|
2876
3157
|
weekday: "long",
|
|
2877
3158
|
month: "long",
|
|
2878
3159
|
day: "numeric",
|
|
@@ -2880,7 +3161,23 @@ class le extends B {
|
|
|
2880
3161
|
});
|
|
2881
3162
|
break;
|
|
2882
3163
|
}
|
|
2883
|
-
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));
|
|
2884
3181
|
}
|
|
2885
3182
|
renderView() {
|
|
2886
3183
|
if (!this.contentContainer) return;
|
|
@@ -2888,19 +3185,19 @@ class le extends B {
|
|
|
2888
3185
|
const e = this.stateManager.getState();
|
|
2889
3186
|
switch (e.view) {
|
|
2890
3187
|
case "year":
|
|
2891
|
-
this.currentView = new
|
|
3188
|
+
this.currentView = new R(this.contentContainer, e), this.currentViewType = "year";
|
|
2892
3189
|
break;
|
|
2893
3190
|
case "month":
|
|
2894
|
-
this.currentView = new
|
|
3191
|
+
this.currentView = new k(this.contentContainer, e), this.currentViewType = "month";
|
|
2895
3192
|
break;
|
|
2896
3193
|
case "week":
|
|
2897
|
-
this.currentView = new
|
|
3194
|
+
this.currentView = new te(this.contentContainer, e), this.currentViewType = "week";
|
|
2898
3195
|
break;
|
|
2899
3196
|
case "day":
|
|
2900
|
-
this.currentView = new
|
|
3197
|
+
this.currentView = new se(this.contentContainer, e), this.currentViewType = "day";
|
|
2901
3198
|
break;
|
|
2902
3199
|
case "timeline":
|
|
2903
|
-
this.currentView = new
|
|
3200
|
+
this.currentView = new ne(this.contentContainer, e), this.currentViewType = "timeline";
|
|
2904
3201
|
break;
|
|
2905
3202
|
}
|
|
2906
3203
|
this.currentView?.render();
|
|
@@ -2909,16 +3206,16 @@ class le extends B {
|
|
|
2909
3206
|
// State Change Handling
|
|
2910
3207
|
// ============================================
|
|
2911
3208
|
onStateChange(e) {
|
|
2912
|
-
e.isLoading !== this.previousIsLoading && (this.previousIsLoading !== null && this.liveAnnouncer.announce(e.isLoading ? "
|
|
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);
|
|
2913
3210
|
}
|
|
2914
3211
|
detectAndEmitChanges(e) {
|
|
2915
|
-
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 =
|
|
2916
|
-
(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(
|
|
2917
3214
|
e.selectedEvent,
|
|
2918
3215
|
i,
|
|
2919
3216
|
e.view,
|
|
2920
3217
|
e.selectionResourceId ?? void 0
|
|
2921
|
-
), 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;
|
|
2922
3219
|
}
|
|
2923
3220
|
updateUI(e) {
|
|
2924
3221
|
this.updateTitle(), this.shadowRoot.querySelectorAll(".scheduler-view-switcher button").forEach((s) => {
|
|
@@ -2946,9 +3243,16 @@ class le extends B {
|
|
|
2946
3243
|
const t = this.dragManager.handlePointerUp(e);
|
|
2947
3244
|
t && this.handleDragComplete(t, e.originalEvent);
|
|
2948
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
|
+
}
|
|
2949
3253
|
handleDragComplete(e, t) {
|
|
2950
3254
|
if (e.wasClick) {
|
|
2951
|
-
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));
|
|
2952
3256
|
return;
|
|
2953
3257
|
}
|
|
2954
3258
|
switch (e.type) {
|
|
@@ -2995,19 +3299,19 @@ class le extends B {
|
|
|
2995
3299
|
const a = i.dataset.date;
|
|
2996
3300
|
a && this.eventEmitter.emitDateClick(new Date(a), e.originalEvent);
|
|
2997
3301
|
}
|
|
2998
|
-
const
|
|
3302
|
+
const r = s.closest(
|
|
2999
3303
|
".scheduler-year-month-header"
|
|
3000
3304
|
);
|
|
3001
|
-
if (
|
|
3002
|
-
const a =
|
|
3305
|
+
if (r) {
|
|
3306
|
+
const a = r.dataset.month;
|
|
3003
3307
|
a && (this.stateManager.setDate(new Date(a)), this.stateManager.setView("month"));
|
|
3004
3308
|
}
|
|
3005
|
-
const
|
|
3006
|
-
if (
|
|
3007
|
-
const a =
|
|
3309
|
+
const o = s.closest(".scheduler-more-link");
|
|
3310
|
+
if (o) {
|
|
3311
|
+
const a = o.dataset.date;
|
|
3008
3312
|
a && (this.stateManager.setDate(new Date(a)), this.stateManager.setView("day"));
|
|
3009
3313
|
}
|
|
3010
|
-
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));
|
|
3011
3315
|
}
|
|
3012
3316
|
handleDoubleClick(e, t) {
|
|
3013
3317
|
t.type === "event" && t.event && this.eventEmitter.emitEventDblClick(t.event, e.originalEvent);
|
|
@@ -3029,8 +3333,8 @@ class le extends B {
|
|
|
3029
3333
|
return;
|
|
3030
3334
|
const i = this.getEventById(n);
|
|
3031
3335
|
i && this.stateManager.getState().selectedEvent?.id !== i.id && (this.stateManager.setSelectedEvent(i), this.eventEmitter.emitEventSelected(i, e), requestAnimationFrame(() => {
|
|
3032
|
-
const
|
|
3033
|
-
this.shadowRoot?.querySelector(
|
|
3336
|
+
const r = `[data-event-id="${this.cssEscape(i.id)}"]`;
|
|
3337
|
+
this.shadowRoot?.querySelector(r)?.focus({ preventScroll: !0 });
|
|
3034
3338
|
}));
|
|
3035
3339
|
}
|
|
3036
3340
|
handleKeyDown(e) {
|
|
@@ -3088,6 +3392,13 @@ class le extends B {
|
|
|
3088
3392
|
const s = this.stateManager.getState().selectedEvent;
|
|
3089
3393
|
if (s)
|
|
3090
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;
|
|
3091
3402
|
case "Enter":
|
|
3092
3403
|
e.preventDefault(), this.enterEventMoveMode(s);
|
|
3093
3404
|
return;
|
|
@@ -3117,12 +3428,12 @@ class le extends B {
|
|
|
3117
3428
|
return c !== 0 ? c : l.id.localeCompare(d.id);
|
|
3118
3429
|
}), i = n.findIndex((l) => l.id === e.id);
|
|
3119
3430
|
if (i < 0) return;
|
|
3120
|
-
const
|
|
3121
|
-
if (!o) return;
|
|
3122
|
-
const r = this.shadowRoot;
|
|
3431
|
+
const r = n[i + t];
|
|
3123
3432
|
if (!r) return;
|
|
3124
|
-
|
|
3125
|
-
|
|
3433
|
+
const o = this.shadowRoot;
|
|
3434
|
+
if (!o) return;
|
|
3435
|
+
o.querySelector(
|
|
3436
|
+
`[data-event-id="${this.cssEscape(r.id)}"]`
|
|
3126
3437
|
)?.focus({ preventScroll: !1 });
|
|
3127
3438
|
}
|
|
3128
3439
|
handleCellKeyDown(e) {
|
|
@@ -3273,8 +3584,8 @@ class le extends B {
|
|
|
3273
3584
|
scrollAndFocusDateCell(e) {
|
|
3274
3585
|
const t = this.stateManager.getState(), s = this.shadowRoot;
|
|
3275
3586
|
if (!s) return;
|
|
3276
|
-
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")}`,
|
|
3277
|
-
|
|
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" }));
|
|
3278
3589
|
}
|
|
3279
3590
|
/**
|
|
3280
3591
|
* Emit `event-create` covering the focused day (month view) or focused
|
|
@@ -3286,9 +3597,9 @@ class le extends B {
|
|
|
3286
3597
|
if (!n) return;
|
|
3287
3598
|
const i = new Date(n);
|
|
3288
3599
|
i.setHours(0, 0, 0, 0);
|
|
3289
|
-
const
|
|
3290
|
-
t === "day" ?
|
|
3291
|
-
{ 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 },
|
|
3292
3603
|
s.view,
|
|
3293
3604
|
e
|
|
3294
3605
|
);
|
|
@@ -3296,17 +3607,17 @@ class le extends B {
|
|
|
3296
3607
|
moveCellByTime(e, t) {
|
|
3297
3608
|
const s = this.stateManager.getState(), n = s.focusedCell;
|
|
3298
3609
|
if (!n) return;
|
|
3299
|
-
const i = (s.options.slotDuration ?? 1800) * 1e3,
|
|
3300
|
-
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);
|
|
3301
3612
|
}
|
|
3302
3613
|
/** Week view ArrowLeft/Right: ±1 day, same time-of-day. No-op on day view. */
|
|
3303
3614
|
moveCellByDay(e, t) {
|
|
3304
3615
|
const s = this.stateManager.getState(), n = s.focusedCell;
|
|
3305
3616
|
if (!n || s.view !== "week") return;
|
|
3306
|
-
const i = (s.options.slotDuration ?? 1800) * 1e3,
|
|
3307
|
-
|
|
3308
|
-
const
|
|
3309
|
-
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);
|
|
3310
3621
|
}
|
|
3311
3622
|
/** Timeline ArrowUp/Down: ±1 resource, same time-of-day. PRD D1: cross-resource
|
|
3312
3623
|
* Shift+Arrow is intentionally ignored (resource is categorical). */
|
|
@@ -3321,32 +3632,32 @@ class le extends B {
|
|
|
3321
3632
|
if (!n) return;
|
|
3322
3633
|
const i = new Date(n.start);
|
|
3323
3634
|
i.setHours(0, 0, 0, 0);
|
|
3324
|
-
const
|
|
3635
|
+
const r = h.getTimeSlots(
|
|
3325
3636
|
i,
|
|
3326
3637
|
s.options.slotDuration,
|
|
3327
3638
|
s.options.slotMinTime,
|
|
3328
3639
|
s.options.slotMaxTime
|
|
3329
|
-
),
|
|
3330
|
-
|
|
3640
|
+
), o = e === "start" ? r[0] : r[r.length - 1];
|
|
3641
|
+
o && this.commitFocusMove(o, s.focusedResourceId, t);
|
|
3331
3642
|
}
|
|
3332
3643
|
moveCellToViewExtreme(e, t) {
|
|
3333
3644
|
const s = this.stateManager.getState();
|
|
3334
3645
|
let n = null, i = s.focusedResourceId;
|
|
3335
3646
|
switch (s.view) {
|
|
3336
3647
|
case "day": {
|
|
3337
|
-
const
|
|
3338
|
-
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];
|
|
3339
3650
|
break;
|
|
3340
3651
|
}
|
|
3341
3652
|
case "week": {
|
|
3342
|
-
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);
|
|
3343
3654
|
n = e === "start" ? a[0] : a[a.length - 1];
|
|
3344
3655
|
break;
|
|
3345
3656
|
}
|
|
3346
3657
|
case "timeline": {
|
|
3347
|
-
const
|
|
3348
|
-
if (
|
|
3349
|
-
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;
|
|
3350
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);
|
|
3351
3662
|
n = e === "start" ? d[0] : d[d.length - 1];
|
|
3352
3663
|
break;
|
|
@@ -3363,14 +3674,14 @@ class le extends B {
|
|
|
3363
3674
|
const t = this.stateManager.getState(), s = t.focusedCell, n = t.date;
|
|
3364
3675
|
if (e > 0 ? this.next() : this.prev(), !s) return;
|
|
3365
3676
|
const i = this.stateManager.getState();
|
|
3366
|
-
let
|
|
3677
|
+
let r;
|
|
3367
3678
|
if (i.view === "day")
|
|
3368
|
-
|
|
3679
|
+
r = new Date(i.date), r.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
|
|
3369
3680
|
else {
|
|
3370
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];
|
|
3371
|
-
|
|
3682
|
+
r = new Date(u), r.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
|
|
3372
3683
|
}
|
|
3373
|
-
const
|
|
3684
|
+
const o = (i.options.slotDuration ?? 1800) * 1e3, a = { start: r, end: new Date(r.getTime() + o) };
|
|
3374
3685
|
this.commitFocusMove(a, t.focusedResourceId, !1);
|
|
3375
3686
|
}
|
|
3376
3687
|
/**
|
|
@@ -3382,12 +3693,12 @@ class le extends B {
|
|
|
3382
3693
|
const n = this.stateManager.getState(), i = n.options.slotDuration ?? 1800;
|
|
3383
3694
|
if (s) {
|
|
3384
3695
|
this.stateManager.extendSelection(e, t), this.stateManager.setFocusedCell(e, t, !1);
|
|
3385
|
-
const
|
|
3386
|
-
this.liveAnnouncer.announce(
|
|
3696
|
+
const r = this.stateManager.getState();
|
|
3697
|
+
this.liveAnnouncer.announce(Z(r, i));
|
|
3387
3698
|
} else {
|
|
3388
3699
|
this.stateManager.setFocusedCell(e, t, !0);
|
|
3389
|
-
const
|
|
3390
|
-
this.liveAnnouncer.announce(
|
|
3700
|
+
const r = this.getResourceTitle(t);
|
|
3701
|
+
this.liveAnnouncer.announce(J(e, n.options, r));
|
|
3391
3702
|
}
|
|
3392
3703
|
this.scrollAndFocusCell(e, t);
|
|
3393
3704
|
}
|
|
@@ -3407,21 +3718,21 @@ class le extends B {
|
|
|
3407
3718
|
}
|
|
3408
3719
|
}
|
|
3409
3720
|
parseTimeOnDay(e, t) {
|
|
3410
|
-
const [s, n, i] = (t ?? "00:00:00").split(":").map(Number),
|
|
3411
|
-
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;
|
|
3412
3723
|
}
|
|
3413
3724
|
adjacentResource(e, t, s) {
|
|
3414
|
-
const i =
|
|
3725
|
+
const i = C.flatten(s.resources, s.collapsedGroups).filter((a) => a.visible && W(a.item));
|
|
3415
3726
|
if (i.length === 0) return null;
|
|
3416
3727
|
if (!e) return i[0].item.id;
|
|
3417
|
-
const
|
|
3418
|
-
if (
|
|
3419
|
-
const
|
|
3420
|
-
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;
|
|
3421
3732
|
}
|
|
3422
3733
|
getResourceTitle(e) {
|
|
3423
3734
|
if (!e) return null;
|
|
3424
|
-
for (const t of
|
|
3735
|
+
for (const t of C.getAllResources(this.stateManager.getState().resources))
|
|
3425
3736
|
if (t.id === e) return t.title;
|
|
3426
3737
|
return null;
|
|
3427
3738
|
}
|
|
@@ -3433,8 +3744,8 @@ class le extends B {
|
|
|
3433
3744
|
scrollAndFocusCell(e, t) {
|
|
3434
3745
|
const s = e.start.toISOString(), n = this.shadowRoot;
|
|
3435
3746
|
if (!n) return;
|
|
3436
|
-
const i = t ? `.scheduler-timeline-slot[data-resource-id="${this.cssEscape(t)}"][data-start="${s}"]` : `.scheduler-time-slot[data-start="${s}"]`,
|
|
3437
|
-
|
|
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" }));
|
|
3438
3749
|
}
|
|
3439
3750
|
/** Re-focus whatever cell the keyboard model currently considers focused. */
|
|
3440
3751
|
focusFocusedCell() {
|
|
@@ -3452,22 +3763,23 @@ class le extends B {
|
|
|
3452
3763
|
* whether/when to clear the selection.
|
|
3453
3764
|
*/
|
|
3454
3765
|
createEventFromCellOrSelection(e) {
|
|
3455
|
-
const t = this.stateManager.getState(), s =
|
|
3456
|
-
let n, i,
|
|
3766
|
+
const t = this.stateManager.getState(), s = P(t);
|
|
3767
|
+
let n, i, r;
|
|
3457
3768
|
if (s)
|
|
3458
|
-
n = s.start, i = s.end,
|
|
3769
|
+
n = s.start, i = s.end, r = t.selectionResourceId ?? void 0;
|
|
3459
3770
|
else if (t.focusedCell)
|
|
3460
|
-
n = t.focusedCell.start, i = t.focusedCell.end,
|
|
3771
|
+
n = t.focusedCell.start, i = t.focusedCell.end, r = t.focusedResourceId ?? void 0;
|
|
3461
3772
|
else
|
|
3462
3773
|
return;
|
|
3463
3774
|
this.eventEmitter.emitEventCreate(
|
|
3464
3775
|
{ start: n, end: i },
|
|
3465
3776
|
t.view,
|
|
3466
3777
|
e,
|
|
3467
|
-
|
|
3468
|
-
), this.liveAnnouncer.announce(
|
|
3469
|
-
|
|
3470
|
-
|
|
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
|
+
}));
|
|
3471
3783
|
}
|
|
3472
3784
|
/**
|
|
3473
3785
|
* Enter keyboard event-move mode. Captures the working copy and a snapshot
|
|
@@ -3495,7 +3807,7 @@ class le extends B {
|
|
|
3495
3807
|
});
|
|
3496
3808
|
const s = this.minutesPerSlot();
|
|
3497
3809
|
this.liveAnnouncer.announce(
|
|
3498
|
-
|
|
3810
|
+
this.msg("moveModeEntered", { title: e.title, minutes: s })
|
|
3499
3811
|
), requestAnimationFrame(() => {
|
|
3500
3812
|
const n = `[data-event-id="${this.cssEscape(e.id)}"]`;
|
|
3501
3813
|
this.shadowRoot?.querySelector(n)?.focus({ preventScroll: !0 });
|
|
@@ -3520,19 +3832,19 @@ class le extends B {
|
|
|
3520
3832
|
e.preventDefault(), this.commitEventMoveMode();
|
|
3521
3833
|
return;
|
|
3522
3834
|
}
|
|
3523
|
-
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;
|
|
3524
3836
|
switch (e.key) {
|
|
3525
3837
|
case "ArrowUp":
|
|
3526
|
-
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);
|
|
3527
3839
|
return;
|
|
3528
3840
|
case "ArrowDown":
|
|
3529
|
-
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);
|
|
3530
3842
|
return;
|
|
3531
3843
|
case "ArrowLeft":
|
|
3532
|
-
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));
|
|
3533
3845
|
return;
|
|
3534
3846
|
case "ArrowRight":
|
|
3535
|
-
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));
|
|
3536
3848
|
return;
|
|
3537
3849
|
}
|
|
3538
3850
|
}
|
|
@@ -3544,7 +3856,7 @@ class le extends B {
|
|
|
3544
3856
|
nudgeKeyboardMove(e) {
|
|
3545
3857
|
if (!this.keyboardMove) return;
|
|
3546
3858
|
const t = new Date(this.keyboardMove.workingStart.getTime() + e), s = new Date(this.keyboardMove.workingEnd.getTime() + e);
|
|
3547
|
-
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));
|
|
3548
3860
|
}
|
|
3549
3861
|
/** Walk to the next/previous resource (timeline only). Updates the preview's resourceId. */
|
|
3550
3862
|
nudgeKeyboardMoveResource(e) {
|
|
@@ -3553,7 +3865,7 @@ class le extends B {
|
|
|
3553
3865
|
if (!t) return;
|
|
3554
3866
|
this.keyboardMove.workingResourceId = t, this.applyKeyboardMovePreview();
|
|
3555
3867
|
const s = this.getResourceTitle(t) ?? t;
|
|
3556
|
-
this.liveAnnouncer.announce(
|
|
3868
|
+
this.liveAnnouncer.announce(this.msg("movedToResource", { resource: s }));
|
|
3557
3869
|
}
|
|
3558
3870
|
/**
|
|
3559
3871
|
* Resize one edge of the working event. Clamps to a minimum duration of
|
|
@@ -3566,7 +3878,7 @@ class le extends B {
|
|
|
3566
3878
|
if (e === "end") {
|
|
3567
3879
|
if (i = new Date(i.getTime() + t), i.getTime() - n.getTime() < s) return;
|
|
3568
3880
|
} else if (n = new Date(n.getTime() + t), i.getTime() - n.getTime() < s) return;
|
|
3569
|
-
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));
|
|
3570
3882
|
}
|
|
3571
3883
|
/** Mirror keyboardMove.working* into state.previewEvent so views render the destination,
|
|
3572
3884
|
* then scroll the destination into view so the sighted-keyboard user can see it (PRD D6). */
|
|
@@ -3583,7 +3895,7 @@ class le extends B {
|
|
|
3583
3895
|
const i = this.shadowRoot;
|
|
3584
3896
|
if (!i) return;
|
|
3585
3897
|
i.querySelector(`[data-event-id="${this.cssEscape(e)}"]`)?.focus({ preventScroll: !0 });
|
|
3586
|
-
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);
|
|
3587
3899
|
l && typeof l.scrollIntoView == "function" && l.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
3588
3900
|
});
|
|
3589
3901
|
}
|
|
@@ -3597,7 +3909,7 @@ class le extends B {
|
|
|
3597
3909
|
end: this.keyboardMove.workingEnd,
|
|
3598
3910
|
...this.keyboardMove.workingResourceId ? { resourceId: this.keyboardMove.workingResourceId } : {}
|
|
3599
3911
|
};
|
|
3600
|
-
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"));
|
|
3601
3913
|
}
|
|
3602
3914
|
this.keyboardMove = null, this.stateManager.setState({ keyboardMoveEventId: null, previewEvent: null }), requestAnimationFrame(() => {
|
|
3603
3915
|
const t = `[data-event-id="${this.cssEscape(e?.id ?? "")}"]`;
|
|
@@ -3606,7 +3918,7 @@ class le extends B {
|
|
|
3606
3918
|
}
|
|
3607
3919
|
cancelEventMoveMode() {
|
|
3608
3920
|
const e = this.keyboardMove?.eventId ?? null;
|
|
3609
|
-
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(() => {
|
|
3610
3922
|
const t = `[data-event-id="${this.cssEscape(e)}"]`;
|
|
3611
3923
|
this.shadowRoot?.querySelector(t)?.focus({ preventScroll: !1 });
|
|
3612
3924
|
});
|
|
@@ -3639,16 +3951,16 @@ class le extends B {
|
|
|
3639
3951
|
};
|
|
3640
3952
|
}
|
|
3641
3953
|
}
|
|
3642
|
-
typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler",
|
|
3954
|
+
typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler", F);
|
|
3643
3955
|
export {
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
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
|
|
3654
3966
|
};
|