@mintplayer/web-components 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/index.mjs +9 -8
- package/checkbox/index.mjs +1 -1
- package/chunks/error-text-B45eDAt1.mjs +17 -0
- package/chunks/{form-associated-axmc5sY0.mjs → form-associated-BR-fUvZ1.mjs} +11 -26
- package/chunks/{id-D5QCG603.mjs → id-BstjfRrz.mjs} +97 -72
- package/chunks/{mp-checkbox-Ph2mMRGz.mjs → mp-checkbox-6EJwdUIn.mjs} +6 -5
- package/chunks/{mp-datatable-BwTlh9A_.mjs → mp-datatable-25O1GtvU.mjs} +1 -1
- package/chunks/mp-datetime-picker.element-MPTRHwyc.mjs +530 -0
- package/chunks/{mp-radio-BjW1HNSc.mjs → mp-radio-DvKgrTFL.mjs} +2 -2
- package/chunks/{mp-select-Ctu-v1-p.mjs → mp-select-CKX0eM5C.mjs} +5 -4
- package/chunks/{mp-timepicker.element-Bz393NDQ.mjs → mp-timepicker.element-COZEUIoE.mjs} +56 -52
- package/chunks/{mp-toggle-button-Kz6sIgBJ.mjs → mp-toggle-button-C4Loq_p4.mjs} +5 -4
- package/chunks/{overlay-controller-DPt13i8p.mjs → overlay-controller-D6agzzOI.mjs} +19 -4
- package/datatable/index.mjs +1 -1
- package/datepicker/index.mjs +1 -1
- package/datetime-picker/index.mjs +2 -431
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +66 -0
- package/file-manager/index.mjs +1 -1
- package/navbar/index.mjs +1 -1
- package/otp-input/index.mjs +4 -3
- package/overlay/index.mjs +1 -1
- package/overlay/src/overlay-controller.d.ts +13 -0
- package/package.json +1 -1
- package/query-builder/index.mjs +2 -2
- package/radio/index.mjs +1 -1
- package/radio-group/index.mjs +2 -2
- package/ribbon/index.mjs +1 -1
- package/scheduler/index.mjs +1996 -813
- package/scheduler/src/components/mp-scheduler.d.ts +269 -11
- package/scheduler/src/state/scheduler-state.d.ts +10 -0
- package/scheduler/src/views/timeline-view.d.ts +51 -3
- package/scheduler/src/views/year-view.d.ts +4 -2
- package/scheduler-core/index.mjs +9 -8
- package/scheduler-core/src/models/event.d.ts +6 -2
- package/scheduler-core/src/models/messages.d.ts +60 -0
- package/scheduler-core/src/models/options.d.ts +22 -6
- package/scheduler-core/src/models/permissions.d.ts +35 -4
- package/scheduler-core/src/models/time-slot.d.ts +11 -6
- package/select/index.mjs +1 -1
- package/timepicker/index.mjs +4 -3
- package/timepicker/src/mp-time-list.element.d.ts +44 -7
- package/timepicker/src/mp-timepicker.element.d.ts +5 -0
- package/toggle-button/index.mjs +1 -1
- package/tree-select/index.mjs +1 -1
package/scheduler/index.mjs
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import { L as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { unsafeCSS as J, LitElement as re, html as D, nothing as T } from "lit";
|
|
2
|
+
import { L as ne } from "../chunks/live-announcer-Bi0orG4n.mjs";
|
|
3
|
+
import { e as ie } from "../chunks/error-text-B45eDAt1.mjs";
|
|
4
|
+
import { D as oe, q as L, d as h, u as E, i as S, t as U, o as ae, v as K, x as C, w as R, p as G, s as Q, j as le } from "../chunks/id-BstjfRrz.mjs";
|
|
5
|
+
import { i as de } from "../chunks/invalid-feedback.styles-he0JYrJm.mjs";
|
|
6
|
+
import { O as Y } from "../chunks/overlay-controller-D6agzzOI.mjs";
|
|
7
|
+
import "../chunks/mp-checkbox-6EJwdUIn.mjs";
|
|
8
|
+
import "../chunks/mp-select-CKX0eM5C.mjs";
|
|
9
|
+
import "../chunks/mp-datetime-picker.element-MPTRHwyc.mjs";
|
|
10
|
+
function ee(p, e = []) {
|
|
11
|
+
for (const t of p) {
|
|
12
|
+
if (L(t)) {
|
|
13
|
+
ee(t.children, e);
|
|
9
14
|
continue;
|
|
10
15
|
}
|
|
11
16
|
for (const s of t.events ?? [])
|
|
@@ -13,40 +18,40 @@ function X(u, e = []) {
|
|
|
13
18
|
}
|
|
14
19
|
return e;
|
|
15
20
|
}
|
|
16
|
-
function
|
|
17
|
-
const t =
|
|
18
|
-
if (t.length === 0) return
|
|
21
|
+
function X(p, e) {
|
|
22
|
+
const t = ee(e);
|
|
23
|
+
if (t.length === 0) return p;
|
|
19
24
|
const s = /* @__PURE__ */ new Map();
|
|
20
|
-
for (const
|
|
21
|
-
const
|
|
22
|
-
for (const
|
|
23
|
-
s.has(
|
|
24
|
-
return
|
|
25
|
-
`[mp-scheduler] ${
|
|
25
|
+
for (const n of t) s.set(n.id, n);
|
|
26
|
+
const r = [];
|
|
27
|
+
for (const n of p)
|
|
28
|
+
s.has(n.id) && r.push(n.id), s.set(n.id, n);
|
|
29
|
+
return r.length > 0 && console.warn(
|
|
30
|
+
`[mp-scheduler] ${r.length} event id(s) appear in both the "events" input and under a resource; the "events" entry wins. Ids: ${r.join(", ")}`
|
|
26
31
|
), [...s.values()];
|
|
27
32
|
}
|
|
28
|
-
function
|
|
29
|
-
const s = new Set(e),
|
|
30
|
-
for (const
|
|
31
|
-
|
|
33
|
+
function ce(p, e, t) {
|
|
34
|
+
const s = new Set(e), r = (n) => {
|
|
35
|
+
for (const i of n)
|
|
36
|
+
L(i) && (t.has(i.id) || (t.add(i.id), i.collapsed && s.add(i.id)), r(i.children));
|
|
32
37
|
};
|
|
33
|
-
return
|
|
38
|
+
return r(p), s;
|
|
34
39
|
}
|
|
35
|
-
function
|
|
36
|
-
for (const t of
|
|
37
|
-
|
|
40
|
+
function te(p, e = /* @__PURE__ */ new Map()) {
|
|
41
|
+
for (const t of p)
|
|
42
|
+
L(t) ? te(t.children, e) : e.set(t.id, t);
|
|
38
43
|
return e;
|
|
39
44
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
for (const
|
|
43
|
-
const
|
|
44
|
-
n ? n.push(
|
|
45
|
+
function he(p, e) {
|
|
46
|
+
const t = /* @__PURE__ */ new Map();
|
|
47
|
+
for (const s of p) {
|
|
48
|
+
const r = s.resourceId != null && e.has(s.resourceId) ? s.resourceId : null, n = t.get(r);
|
|
49
|
+
n ? n.push(s) : t.set(r, [s]);
|
|
45
50
|
}
|
|
46
|
-
return
|
|
51
|
+
return t;
|
|
47
52
|
}
|
|
48
|
-
function
|
|
49
|
-
const e = { ...
|
|
53
|
+
function ue(p = {}) {
|
|
54
|
+
const e = { ...oe, ...p };
|
|
50
55
|
return {
|
|
51
56
|
view: e.initialView,
|
|
52
57
|
date: e.initialDate,
|
|
@@ -73,9 +78,9 @@ function le(u = {}) {
|
|
|
73
78
|
focusedDate: null
|
|
74
79
|
};
|
|
75
80
|
}
|
|
76
|
-
class
|
|
81
|
+
class pe {
|
|
77
82
|
constructor(e = {}) {
|
|
78
|
-
this.listeners = /* @__PURE__ */ new Set(), this.warnedUnassignedIds = /* @__PURE__ */ new Set(), this.flatEventsInput = [], this.seededGroupIds = /* @__PURE__ */ new Set(), this.state =
|
|
83
|
+
this.listeners = /* @__PURE__ */ new Set(), this.warnedUnassignedIds = /* @__PURE__ */ new Set(), this.warnedDanglingIds = /* @__PURE__ */ new Set(), this.flatEventsInput = [], this.seededGroupIds = /* @__PURE__ */ new Set(), this.state = ue(e);
|
|
79
84
|
}
|
|
80
85
|
/**
|
|
81
86
|
* Get current state
|
|
@@ -87,8 +92,8 @@ class de {
|
|
|
87
92
|
* Update state with partial update or updater function
|
|
88
93
|
*/
|
|
89
94
|
setState(e) {
|
|
90
|
-
const t = typeof e == "function" ? e(this.state) : e, s = { ...this.state, ...t };
|
|
91
|
-
|
|
95
|
+
const t = typeof e == "function" ? e(this.state) : e, s = { ...this.state, ...t }, r = s.resources !== this.state.resources || !this.state.resourceById;
|
|
96
|
+
r && (s.resourceById = te(s.resources)), (s.events !== this.state.events || r || !this.state.eventsByResource) && (s.eventsByResource = he(s.events, s.resourceById)), this.state = s, this.warnUnassignedEvents(), this.warnDanglingEvents(), this.notifyListeners();
|
|
92
97
|
}
|
|
93
98
|
/**
|
|
94
99
|
* `options.requireEventResource` is a DEVELOPMENT signal, not a filter: the
|
|
@@ -108,6 +113,25 @@ class de {
|
|
|
108
113
|
);
|
|
109
114
|
}
|
|
110
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* B29's development signal: an event whose `resourceId` names no known
|
|
118
|
+
* resource renders in the bucket row rather than vanishing, and says so once.
|
|
119
|
+
* Gated on a non-empty resource tree — during input wiring the events
|
|
120
|
+
* routinely arrive before the resources, and warning about that ordering
|
|
121
|
+
* would train consumers to ignore the warning that matters.
|
|
122
|
+
*/
|
|
123
|
+
warnDanglingEvents() {
|
|
124
|
+
if (this.state.resources.length === 0) return;
|
|
125
|
+
const e = this.state.events.filter(
|
|
126
|
+
(t) => t.resourceId != null && !this.state.resourceById.has(t.resourceId) && !this.warnedDanglingIds.has(t.id)
|
|
127
|
+
);
|
|
128
|
+
if (e.length !== 0) {
|
|
129
|
+
for (const t of e) this.warnedDanglingIds.add(t.id);
|
|
130
|
+
console.warn(
|
|
131
|
+
`[mp-scheduler] ${e.length} event(s) reference a resource that does not exist. They render in the "(No resource)" row. If a resource was deleted, clear or reassign its events' resourceId. Ids: ` + e.map((t) => `${t.id} (resourceId: ${t.resourceId})`).join(", ")
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
111
135
|
/**
|
|
112
136
|
* Subscribe to state changes
|
|
113
137
|
*/
|
|
@@ -140,7 +164,7 @@ class de {
|
|
|
140
164
|
*/
|
|
141
165
|
setEvents(e) {
|
|
142
166
|
this.flatEventsInput = e, this.setState((t) => ({
|
|
143
|
-
events:
|
|
167
|
+
events: X(e, t.resources)
|
|
144
168
|
}));
|
|
145
169
|
}
|
|
146
170
|
/**
|
|
@@ -160,7 +184,13 @@ class de {
|
|
|
160
184
|
this.flatEventsInput = this.flatEventsInput.map(
|
|
161
185
|
(t) => t.id === e.id ? e : t
|
|
162
186
|
), this.setState((t) => ({
|
|
163
|
-
events: t.events.map((s) => s.id === e.id ? e : s)
|
|
187
|
+
events: t.events.map((s) => s.id === e.id ? e : s),
|
|
188
|
+
// The SELECTION has to track the record too (B32). It holds an event
|
|
189
|
+
// object, not an id, so leaving it behind left every reader of
|
|
190
|
+
// `selectedEvent` on a stale copy after any commit — the editor reopened
|
|
191
|
+
// by F2 showed the pre-edit values, and a consumer bound to
|
|
192
|
+
// `[(selectedEvent)]` was handed data it had just replaced.
|
|
193
|
+
selectedEvent: t.selectedEvent?.id === e.id ? e : t.selectedEvent
|
|
164
194
|
}));
|
|
165
195
|
}
|
|
166
196
|
/**
|
|
@@ -180,8 +210,8 @@ class de {
|
|
|
180
210
|
setResources(e) {
|
|
181
211
|
this.setState((t) => ({
|
|
182
212
|
resources: e,
|
|
183
|
-
events:
|
|
184
|
-
collapsedGroups:
|
|
213
|
+
events: X(this.flatEventsInput, e),
|
|
214
|
+
collapsedGroups: ce(
|
|
185
215
|
e,
|
|
186
216
|
t.collapsedGroups,
|
|
187
217
|
this.seededGroupIds
|
|
@@ -348,11 +378,11 @@ class de {
|
|
|
348
378
|
*/
|
|
349
379
|
extendSelection(e, t = null) {
|
|
350
380
|
this.setState((s) => {
|
|
351
|
-
const
|
|
381
|
+
const r = s.selectionAnchor ?? s.focusedCell ?? e, n = s.selectionResourceId ?? s.focusedResourceId ?? t;
|
|
352
382
|
return {
|
|
353
|
-
selectionAnchor:
|
|
383
|
+
selectionAnchor: r,
|
|
354
384
|
selectionExtent: e,
|
|
355
|
-
selectionResourceId:
|
|
385
|
+
selectionResourceId: n
|
|
356
386
|
};
|
|
357
387
|
});
|
|
358
388
|
}
|
|
@@ -374,65 +404,65 @@ class de {
|
|
|
374
404
|
this.setState({ focusedDate: e });
|
|
375
405
|
}
|
|
376
406
|
}
|
|
377
|
-
function
|
|
378
|
-
const s = t.timeFormat ?? "24h",
|
|
379
|
-
return e && o.push(S(
|
|
407
|
+
function $(p, e, t) {
|
|
408
|
+
const s = t.timeFormat ?? "24h", r = h.formatTime(p.start, s), n = h.formatTime(p.end, s), i = p.start.toLocaleDateString(t.locale, { weekday: "long", month: "short", day: "numeric" }), o = [`${p.title}, ${r}–${n}`, i];
|
|
409
|
+
return e && o.push(S(E(t.messages).eventOnResource, { resource: e })), o.join(", ");
|
|
380
410
|
}
|
|
381
|
-
function
|
|
382
|
-
const { selectionAnchor: e, selectionExtent: t, selectionResourceId: s } =
|
|
411
|
+
function W(p) {
|
|
412
|
+
const { selectionAnchor: e, selectionExtent: t, selectionResourceId: s } = p;
|
|
383
413
|
if (!e || !t) return null;
|
|
384
|
-
const
|
|
414
|
+
const r = Math.min(e.start.getTime(), t.start.getTime()), n = Math.max(e.end.getTime(), t.end.getTime());
|
|
385
415
|
return {
|
|
386
|
-
start: new Date(
|
|
387
|
-
end: new Date(
|
|
416
|
+
start: new Date(r),
|
|
417
|
+
end: new Date(n),
|
|
388
418
|
resourceId: s
|
|
389
419
|
};
|
|
390
420
|
}
|
|
391
|
-
function
|
|
392
|
-
const s =
|
|
393
|
-
return !s || s.resourceId && t && s.resourceId !== t ? !1 :
|
|
421
|
+
function V(p, e, t = null) {
|
|
422
|
+
const s = W(e);
|
|
423
|
+
return !s || s.resourceId && t && s.resourceId !== t ? !1 : p.start.getTime() < s.end.getTime() && p.end.getTime() > s.start.getTime();
|
|
394
424
|
}
|
|
395
|
-
function
|
|
396
|
-
const s =
|
|
425
|
+
function ve(p, e, t = null) {
|
|
426
|
+
const s = p.start.toLocaleDateString(e.locale, {
|
|
397
427
|
weekday: "long",
|
|
398
428
|
month: "short",
|
|
399
429
|
day: "numeric"
|
|
400
|
-
}),
|
|
401
|
-
return t &&
|
|
430
|
+
}), r = h.formatTime(p.start, e.timeFormat ?? "24h"), n = [`${s}, ${r}`];
|
|
431
|
+
return t && n.push(t), n.join(", ");
|
|
402
432
|
}
|
|
403
|
-
function
|
|
404
|
-
const t =
|
|
433
|
+
function me(p, e) {
|
|
434
|
+
const t = W(p);
|
|
405
435
|
if (!t) return "";
|
|
406
|
-
const { options: s } =
|
|
436
|
+
const { options: s } = p, r = s.timeFormat ?? "24h", n = { weekday: "short", month: "short", day: "numeric" }, i = `${h.formatTime(t.start, r)} ${t.start.toLocaleDateString(s.locale, n)}`, o = `${h.formatTime(t.end, r)} ${t.end.toLocaleDateString(s.locale, n)}`, a = e * 1e3, l = Math.max(1, Math.round((t.end.getTime() - t.start.getTime()) / a)), d = E(s.messages);
|
|
407
437
|
return S(d.selection, {
|
|
408
|
-
start:
|
|
438
|
+
start: i,
|
|
409
439
|
end: o,
|
|
410
440
|
count: l,
|
|
411
441
|
slots: l === 1 ? d.slotSingular : d.slotPlural
|
|
412
442
|
});
|
|
413
443
|
}
|
|
414
|
-
function
|
|
415
|
-
const s = t.timeFormat ?? "24h",
|
|
416
|
-
return S(
|
|
417
|
-
start: h.formatTime(
|
|
444
|
+
function ge(p, e, t) {
|
|
445
|
+
const s = t.timeFormat ?? "24h", r = p.toLocaleDateString(t.locale, { weekday: "short", month: "short", day: "numeric" });
|
|
446
|
+
return S(E(t.messages).movedTo, {
|
|
447
|
+
start: h.formatTime(p, s),
|
|
418
448
|
end: h.formatTime(e, s),
|
|
419
|
-
day:
|
|
449
|
+
day: r
|
|
420
450
|
});
|
|
421
451
|
}
|
|
422
|
-
function
|
|
423
|
-
const
|
|
424
|
-
return S(
|
|
425
|
-
edge: t === "start" ?
|
|
426
|
-
start: h.formatTime(
|
|
427
|
-
end: h.formatTime(e,
|
|
452
|
+
function fe(p, e, t, s) {
|
|
453
|
+
const r = s.timeFormat ?? "24h", n = E(s.messages);
|
|
454
|
+
return S(n.resizedEdge, {
|
|
455
|
+
edge: t === "start" ? n.startEdge : n.endEdge,
|
|
456
|
+
start: h.formatTime(p, r),
|
|
457
|
+
end: h.formatTime(e, r)
|
|
428
458
|
});
|
|
429
459
|
}
|
|
430
|
-
const
|
|
431
|
-
function
|
|
432
|
-
const [t = 0, s = 0,
|
|
433
|
-
return
|
|
460
|
+
const ye = 40, be = 20;
|
|
461
|
+
function j(p, e) {
|
|
462
|
+
const [t = 0, s = 0, r = 0] = e.split(":").map(Number), n = new Date(p);
|
|
463
|
+
return n.setHours(0, 0, 0, 0), n.setSeconds(t * 3600 + s * 60 + r), n;
|
|
434
464
|
}
|
|
435
|
-
class
|
|
465
|
+
class B {
|
|
436
466
|
constructor(e, t) {
|
|
437
467
|
this.container = e, this.state = t;
|
|
438
468
|
}
|
|
@@ -476,20 +506,20 @@ class $ {
|
|
|
476
506
|
* `Resource.color`/`eventColor` sat in the model unread.
|
|
477
507
|
*/
|
|
478
508
|
applyEventColors(e, t) {
|
|
479
|
-
const s =
|
|
509
|
+
const s = U(
|
|
480
510
|
t,
|
|
481
511
|
this.state.resourceById,
|
|
482
512
|
this.state.options.defaultEventColor
|
|
483
513
|
);
|
|
484
|
-
e.style.backgroundColor = s, e.style.color = t.textColor ??
|
|
514
|
+
e.style.backgroundColor = s, e.style.color = t.textColor ?? ae(s);
|
|
485
515
|
}
|
|
486
516
|
partGeometry(e, t, s) {
|
|
487
|
-
const
|
|
517
|
+
const r = s.slotDuration ?? 1800, n = j(e, s.slotMinTime ?? "00:00:00"), i = j(e, s.slotMaxTime ?? "24:00:00"), o = Math.max(e.getTime(), n.getTime()), a = Math.min(t.getTime(), i.getTime());
|
|
488
518
|
if (a <= o) return null;
|
|
489
|
-
const l =
|
|
519
|
+
const l = ye / (r * 1e3);
|
|
490
520
|
return {
|
|
491
|
-
top: (o -
|
|
492
|
-
height: Math.max((a - o) * l,
|
|
521
|
+
top: (o - n.getTime()) * l,
|
|
522
|
+
height: Math.max((a - o) * l, be)
|
|
493
523
|
};
|
|
494
524
|
}
|
|
495
525
|
createElement(e, ...t) {
|
|
@@ -500,8 +530,8 @@ class $ {
|
|
|
500
530
|
* Helper to set data attributes
|
|
501
531
|
*/
|
|
502
532
|
setData(e, t) {
|
|
503
|
-
for (const [s,
|
|
504
|
-
e.dataset[s] = String(
|
|
533
|
+
for (const [s, r] of Object.entries(t))
|
|
534
|
+
e.dataset[s] = String(r);
|
|
505
535
|
}
|
|
506
536
|
/**
|
|
507
537
|
* Helper to clear container
|
|
@@ -533,15 +563,15 @@ class $ {
|
|
|
533
563
|
* Position classes are per-view: ['top','bottom'] for time grids,
|
|
534
564
|
* ['left','right'] for the timeline.
|
|
535
565
|
*/
|
|
536
|
-
appendResizeHandles(e, t, [s,
|
|
537
|
-
const
|
|
538
|
-
t.isStart &&
|
|
566
|
+
appendResizeHandles(e, t, [s, r] = ["top", "bottom"]) {
|
|
567
|
+
const n = this.state.resolvedPermissions;
|
|
568
|
+
t.isStart && K("start", { permissions: n, event: t.event }) && e.appendChild(this.createResizeHandle(s, "start")), t.isEnd && K("end", { permissions: n, event: t.event }) && e.appendChild(this.createResizeHandle(r, "end"));
|
|
539
569
|
}
|
|
540
570
|
createResizeHandle(e, t) {
|
|
541
571
|
const s = this.createElement("div", "resize-handle", e);
|
|
542
572
|
this.setData(s, { handle: t });
|
|
543
|
-
const
|
|
544
|
-
return
|
|
573
|
+
const r = this.createElement("span", "resize-glyph");
|
|
574
|
+
return r.setAttribute("aria-hidden", "true"), s.appendChild(r), s;
|
|
545
575
|
}
|
|
546
576
|
/**
|
|
547
577
|
* Retrofit the ARIA grid chain onto a rendered view (wc-aria PRD step 5.7):
|
|
@@ -558,62 +588,73 @@ class $ {
|
|
|
558
588
|
applyGridRoles(e) {
|
|
559
589
|
const t = this.container;
|
|
560
590
|
t.getAttribute("role") !== "grid" && t.setAttribute("role", "grid"), t.setAttribute("aria-describedby", "scheduler-kbd-grid"), e.multiselectable && t.setAttribute("aria-multiselectable", "true");
|
|
561
|
-
const s = (
|
|
562
|
-
|
|
591
|
+
const s = (r, n) => t.querySelectorAll(r).forEach((i) => {
|
|
592
|
+
i.hasAttribute("role") || i.setAttribute("role", n);
|
|
563
593
|
});
|
|
564
|
-
e.columnHeaderRow && s(e.columnHeaderRow, "row"), e.columnHeaders && s(e.columnHeaders, "columnheader"), (e.presentation ?? []).forEach((
|
|
594
|
+
e.columnHeaderRow && s(e.columnHeaderRow, "row"), e.columnHeaders && s(e.columnHeaders, "columnheader"), (e.presentation ?? []).forEach((r) => s(r, "presentation")), e.rows && s(e.rows, "row"), e.cells && s(e.cells, "gridcell");
|
|
565
595
|
}
|
|
566
596
|
/** aria-current="date" on every element the views styled `.today`. */
|
|
567
597
|
markToday() {
|
|
568
598
|
this.container.querySelectorAll(".today").forEach((e) => e.setAttribute("aria-current", "date"));
|
|
569
599
|
}
|
|
570
600
|
}
|
|
571
|
-
class N extends
|
|
601
|
+
class N extends B {
|
|
572
602
|
constructor() {
|
|
573
603
|
super(...arguments), this.monthCards = /* @__PURE__ */ new Map();
|
|
574
604
|
}
|
|
575
605
|
render() {
|
|
576
606
|
this.clearContainer(), this.container.classList.add("scheduler-year-view");
|
|
577
|
-
const { date: e, options: t } = this.state, s = h.getYearMonths(e),
|
|
607
|
+
const { date: e, options: t } = this.state, s = h.getYearMonths(e), r = this.createElement("div", "scheduler-year-grid");
|
|
578
608
|
this.monthCards.clear();
|
|
579
|
-
for (const
|
|
580
|
-
const
|
|
581
|
-
|
|
609
|
+
for (const n of s) {
|
|
610
|
+
const i = this.createMonthCard(n);
|
|
611
|
+
r.appendChild(i);
|
|
582
612
|
}
|
|
583
|
-
this.container.appendChild(
|
|
613
|
+
this.container.appendChild(r), this.applyGridRoles({ rows: ".scheduler-year-grid" }), this.markToday(), this.updateMonthCardFocus();
|
|
584
614
|
}
|
|
585
615
|
/**
|
|
586
616
|
* Build a `YYYY-MM` key from a Date, which is the unit of focus on year
|
|
587
617
|
* view (PRD scheduler-controlled-selection §5.2 — year cells are months,
|
|
588
|
-
* not days).
|
|
618
|
+
* not days). Public because the month card's element id
|
|
619
|
+
* (`scheduler-cell-y-{key}`) is also the anchor the day popover hangs off
|
|
620
|
+
* in this view.
|
|
589
621
|
*/
|
|
590
622
|
static monthKey(e) {
|
|
591
623
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
|
|
592
624
|
}
|
|
593
625
|
createMonthCard(e) {
|
|
594
|
-
const { events: t, options: s } = this.state,
|
|
595
|
-
|
|
596
|
-
const
|
|
597
|
-
|
|
626
|
+
const { events: t, options: s } = this.state, r = this.createElement("div", "scheduler-year-month"), n = N.monthKey(e);
|
|
627
|
+
r.setAttribute("role", "gridcell"), r.setAttribute("tabindex", "-1"), r.id = `scheduler-cell-y-${n}`, this.setData(r, { month: e.toISOString() }), this.monthCards.set(n, r);
|
|
628
|
+
const i = this.createElement("div", "scheduler-year-month-header");
|
|
629
|
+
i.textContent = h.getMonthName(e, s.locale), i.setAttribute("role", "button"), i.setAttribute("tabindex", "0"), this.setData(i, { month: e.toISOString() }), r.appendChild(i);
|
|
598
630
|
const o = this.createElement("div", "scheduler-mini-month"), a = h.getMonthWeeks(e, s.firstDayOfWeek), l = a[0];
|
|
599
|
-
for (const
|
|
600
|
-
const
|
|
601
|
-
|
|
631
|
+
for (const f of l) {
|
|
632
|
+
const v = this.createElement("div", "scheduler-mini-day", "header");
|
|
633
|
+
v.textContent = h.getDayName(f, s.locale, "narrow"), v.style.fontWeight = "600", v.style.color = "#666", o.appendChild(v);
|
|
602
634
|
}
|
|
603
|
-
const d = h.getMonthStart(e), c = h.getMonthEnd(e),
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
635
|
+
const d = h.getMonthStart(e), c = h.getMonthEnd(e), u = C.filterByRange(t, d, c), m = E(s.messages);
|
|
636
|
+
r.setAttribute(
|
|
637
|
+
"aria-label",
|
|
638
|
+
S(m.yearMonthCardLabel, {
|
|
639
|
+
month: `${h.getMonthName(e, s.locale)} ${e.getFullYear()}`,
|
|
640
|
+
count: u.length,
|
|
641
|
+
events: u.length === 1 ? m.eventSingular : m.eventPlural
|
|
642
|
+
})
|
|
643
|
+
);
|
|
644
|
+
const g = /* @__PURE__ */ new Set();
|
|
645
|
+
for (const f of u) {
|
|
646
|
+
const v = new Date(f.start);
|
|
647
|
+
for (v.setHours(0, 0, 0, 0); v <= f.end; )
|
|
648
|
+
g.add(v.toISOString().split("T")[0]), v.setDate(v.getDate() + 1);
|
|
608
649
|
}
|
|
609
|
-
for (const
|
|
610
|
-
for (const
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
const
|
|
614
|
-
|
|
650
|
+
for (const f of a)
|
|
651
|
+
for (const v of f) {
|
|
652
|
+
const y = this.createElement("div", "scheduler-mini-day");
|
|
653
|
+
y.textContent = String(v.getDate()), this.setData(y, { date: v.toISOString() }), h.isSameMonth(v, e) || y.classList.add("other-month"), h.isToday(v) && y.classList.add("today");
|
|
654
|
+
const w = v.toISOString().split("T")[0];
|
|
655
|
+
g.has(w) && y.classList.add("has-events"), o.appendChild(y);
|
|
615
656
|
}
|
|
616
|
-
return
|
|
657
|
+
return r.appendChild(o), r;
|
|
617
658
|
}
|
|
618
659
|
/**
|
|
619
660
|
* Apply roving tabindex based on `state.focusedDate`'s month. Year-view's
|
|
@@ -624,9 +665,9 @@ class N extends $ {
|
|
|
624
665
|
const e = this.state.focusedDate;
|
|
625
666
|
let t = !1;
|
|
626
667
|
const s = e ? N.monthKey(e) : null;
|
|
627
|
-
for (const [
|
|
628
|
-
const
|
|
629
|
-
|
|
668
|
+
for (const [r, n] of this.monthCards) {
|
|
669
|
+
const i = r === s;
|
|
670
|
+
n.setAttribute("tabindex", i ? "0" : "-1"), n.removeAttribute("aria-selected"), i && (t = !0);
|
|
630
671
|
}
|
|
631
672
|
t || this.monthCards.values().next().value?.setAttribute("tabindex", "0");
|
|
632
673
|
}
|
|
@@ -642,28 +683,28 @@ class N extends $ {
|
|
|
642
683
|
this.monthCards.clear(), this.clearContainer();
|
|
643
684
|
}
|
|
644
685
|
}
|
|
645
|
-
class
|
|
686
|
+
class z extends B {
|
|
646
687
|
constructor() {
|
|
647
688
|
super(...arguments), this.dayCells = /* @__PURE__ */ new Map();
|
|
648
689
|
}
|
|
649
690
|
render() {
|
|
650
691
|
this.clearContainer(), this.container.classList.add("scheduler-month-view");
|
|
651
|
-
const { date: e, options: t } = this.state, s = h.getMonthWeeks(e, t.firstDayOfWeek),
|
|
652
|
-
for (const o of
|
|
692
|
+
const { date: e, options: t } = this.state, s = h.getMonthWeeks(e, t.firstDayOfWeek), r = this.createElement("div", "scheduler-day-headers"), n = s[0];
|
|
693
|
+
for (const o of n) {
|
|
653
694
|
const a = this.createElement("div", "scheduler-day-header");
|
|
654
|
-
a.textContent = h.getDayName(o, t.locale),
|
|
695
|
+
a.textContent = h.getDayName(o, t.locale), r.appendChild(a);
|
|
655
696
|
}
|
|
656
|
-
this.container.appendChild(
|
|
657
|
-
const
|
|
697
|
+
this.container.appendChild(r);
|
|
698
|
+
const i = this.createElement("div", "scheduler-month-grid");
|
|
658
699
|
for (const o of s) {
|
|
659
700
|
const a = this.createElement("div", "scheduler-month-week");
|
|
660
701
|
for (const l of o) {
|
|
661
702
|
const d = this.createDayCell(l);
|
|
662
703
|
a.appendChild(d);
|
|
663
704
|
}
|
|
664
|
-
|
|
705
|
+
i.appendChild(a);
|
|
665
706
|
}
|
|
666
|
-
this.container.appendChild(
|
|
707
|
+
this.container.appendChild(i), this.renderEvents(), this.updateDayCellFocus(), this.applyGridRoles({
|
|
667
708
|
columnHeaderRow: ":scope > .scheduler-day-headers",
|
|
668
709
|
columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
|
|
669
710
|
presentation: [".scheduler-month-grid"],
|
|
@@ -682,12 +723,12 @@ class P extends $ {
|
|
|
682
723
|
createDayCell(e) {
|
|
683
724
|
const { date: t } = this.state, s = this.createElement("div", "scheduler-month-day");
|
|
684
725
|
h.isSameMonth(e, t) || s.classList.add("other-month"), h.isToday(e) && s.classList.add("today");
|
|
685
|
-
const
|
|
686
|
-
s.setAttribute("role", "gridcell"), s.setAttribute("tabindex", "-1"), s.id = `scheduler-cell-m-${
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
const
|
|
690
|
-
return s.appendChild(
|
|
726
|
+
const r = z.dayKey(e);
|
|
727
|
+
s.setAttribute("role", "gridcell"), s.setAttribute("tabindex", "-1"), s.id = `scheduler-cell-m-${r}`;
|
|
728
|
+
const n = this.createElement("div", "day-number");
|
|
729
|
+
n.textContent = String(e.getDate()), s.appendChild(n);
|
|
730
|
+
const i = this.createElement("div", "month-events");
|
|
731
|
+
return s.appendChild(i), this.dayCells.set(r, s), this.setData(s, { date: r }), s;
|
|
691
732
|
}
|
|
692
733
|
/**
|
|
693
734
|
* Apply roving tabindex based on `state.focusedDate`. The grid must always
|
|
@@ -697,44 +738,44 @@ class P extends $ {
|
|
|
697
738
|
updateDayCellFocus() {
|
|
698
739
|
const e = this.state.focusedDate;
|
|
699
740
|
let t = !1;
|
|
700
|
-
const s = e ?
|
|
701
|
-
for (const [
|
|
702
|
-
const
|
|
703
|
-
|
|
741
|
+
const s = e ? z.dayKey(e) : null;
|
|
742
|
+
for (const [r, n] of this.dayCells) {
|
|
743
|
+
const i = r === s;
|
|
744
|
+
n.setAttribute("tabindex", i ? "0" : "-1"), n.removeAttribute("aria-selected"), i && (t = !0);
|
|
704
745
|
}
|
|
705
|
-
t || (Array.from(this.dayCells.values()).find((
|
|
746
|
+
t || (Array.from(this.dayCells.values()).find((n) => n.classList.contains("today") && !n.classList.contains("other-month")) || Array.from(this.dayCells.values()).find((n) => !n.classList.contains("other-month")) || this.dayCells.values().next().value)?.setAttribute("tabindex", "0");
|
|
706
747
|
}
|
|
707
748
|
renderEvents() {
|
|
708
749
|
const { date: e, events: t, options: s } = this.state;
|
|
709
750
|
h.getMonthStart(e), h.getMonthEnd(e);
|
|
710
|
-
const
|
|
711
|
-
|
|
712
|
-
const o =
|
|
751
|
+
const r = h.getMonthWeeks(e, s.firstDayOfWeek), n = r[0][0], i = r[r.length - 1][6];
|
|
752
|
+
i.setHours(23, 59, 59, 999);
|
|
753
|
+
const o = C.filterByRange(t, n, i), a = /* @__PURE__ */ new Map();
|
|
713
754
|
for (const d of o) {
|
|
714
|
-
const c = new Date(d.start),
|
|
715
|
-
for (m.setHours(0, 0, 0, 0); m <=
|
|
716
|
-
const
|
|
717
|
-
a.has(
|
|
755
|
+
const c = new Date(d.start), u = new Date(d.end), m = new Date(c);
|
|
756
|
+
for (m.setHours(0, 0, 0, 0); m <= u; ) {
|
|
757
|
+
const g = z.dayKey(m);
|
|
758
|
+
a.has(g) || a.set(g, []), a.get(g).push(d), m.setDate(m.getDate() + 1);
|
|
718
759
|
}
|
|
719
760
|
}
|
|
720
761
|
const l = typeof s.dayMaxEvents == "number" ? s.dayMaxEvents : s.dayMaxEvents === !1 ? Number.POSITIVE_INFINITY : 3;
|
|
721
762
|
for (const [d, c] of a) {
|
|
722
|
-
const
|
|
723
|
-
if (!
|
|
724
|
-
const m =
|
|
763
|
+
const u = this.dayCells.get(d);
|
|
764
|
+
if (!u) continue;
|
|
765
|
+
const m = u.querySelector(".month-events");
|
|
725
766
|
if (!m) continue;
|
|
726
767
|
m.innerHTML = "";
|
|
727
|
-
const
|
|
728
|
-
for (const
|
|
768
|
+
const g = c.slice(0, l), f = c.length - g.length;
|
|
769
|
+
for (const v of g) {
|
|
729
770
|
const y = this.createElement("div", "scheduler-month-event");
|
|
730
|
-
y.textContent =
|
|
771
|
+
y.textContent = v.title, this.applyEventColors(y, v), y.setAttribute("role", "button"), y.setAttribute("tabindex", "0"), y.setAttribute("aria-label", $(v, null, this.state.options)), this.setData(y, { eventId: v.id }), m.appendChild(y);
|
|
731
772
|
}
|
|
732
773
|
if (f > 0) {
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
|
|
774
|
+
const v = this.createElement("div", "scheduler-more-link");
|
|
775
|
+
v.textContent = S(
|
|
776
|
+
E(this.state.options.messages).moreEvents,
|
|
736
777
|
{ count: f }
|
|
737
|
-
),
|
|
778
|
+
), v.setAttribute("role", "button"), v.setAttribute("tabindex", "0"), this.setData(v, { date: d }), m.appendChild(v);
|
|
738
779
|
}
|
|
739
780
|
}
|
|
740
781
|
}
|
|
@@ -753,32 +794,32 @@ class P extends $ {
|
|
|
753
794
|
this.dayCells.clear(), this.clearContainer();
|
|
754
795
|
}
|
|
755
796
|
}
|
|
756
|
-
function
|
|
757
|
-
const t = new Date(
|
|
797
|
+
function Z(p, e) {
|
|
798
|
+
const t = new Date(p.start);
|
|
758
799
|
t.setHours(0, 0, 0, 0);
|
|
759
|
-
const s =
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
return { start: new Date(
|
|
800
|
+
const s = p.start.getTime() - t.getTime(), r = p.end.getTime() - p.start.getTime(), n = new Date(e);
|
|
801
|
+
n.setHours(0, 0, 0, 0);
|
|
802
|
+
const i = n.getTime() + s;
|
|
803
|
+
return { start: new Date(i), end: new Date(i + r) };
|
|
763
804
|
}
|
|
764
|
-
class
|
|
805
|
+
class we extends B {
|
|
765
806
|
constructor() {
|
|
766
807
|
super(...arguments), this.dayColumns = [], this.eventElements = /* @__PURE__ */ new Map(), this.slotElements = /* @__PURE__ */ new Map();
|
|
767
808
|
}
|
|
768
809
|
render() {
|
|
769
810
|
this.clearContainer(), this.container.classList.add("scheduler-week-view");
|
|
770
|
-
const { date: e, options: t } = this.state, s = h.getWeekDays(e, t.firstDayOfWeek),
|
|
771
|
-
|
|
811
|
+
const { date: e, options: t } = this.state, s = h.getWeekDays(e, t.firstDayOfWeek), r = this.createElement("div", "scheduler-day-headers"), n = this.createElement("div", "scheduler-time-gutter-space");
|
|
812
|
+
n.style.width = "var(--scheduler-time-gutter-width)", r.appendChild(n);
|
|
772
813
|
for (const d of s) {
|
|
773
814
|
const c = this.createElement("div", "scheduler-day-header");
|
|
774
815
|
h.isToday(d) && c.classList.add("today");
|
|
775
|
-
const
|
|
776
|
-
|
|
816
|
+
const u = this.createElement("div", "day-name");
|
|
817
|
+
u.textContent = h.getDayName(d, t.locale);
|
|
777
818
|
const m = this.createElement("div", "day-number");
|
|
778
|
-
m.textContent = String(d.getDate()), c.appendChild(
|
|
819
|
+
m.textContent = String(d.getDate()), c.appendChild(u), c.appendChild(m), r.appendChild(c);
|
|
779
820
|
}
|
|
780
|
-
this.container.appendChild(
|
|
781
|
-
const
|
|
821
|
+
this.container.appendChild(r);
|
|
822
|
+
const i = this.createElement("div", "scheduler-time-grid"), o = this.createElement("div", "scheduler-time-gutter"), a = h.getTimeSlots(
|
|
782
823
|
s[0],
|
|
783
824
|
t.slotDuration,
|
|
784
825
|
t.slotMinTime,
|
|
@@ -788,27 +829,27 @@ class ge extends $ {
|
|
|
788
829
|
const c = this.createElement("div", "scheduler-time-slot-label");
|
|
789
830
|
c.textContent = h.formatTime(d.start, t.timeFormat), o.appendChild(c);
|
|
790
831
|
}
|
|
791
|
-
|
|
832
|
+
i.appendChild(o);
|
|
792
833
|
const l = this.createElement("div", "scheduler-days-container");
|
|
793
834
|
this.dayColumns = [];
|
|
794
835
|
for (let d = 0; d < s.length; d++) {
|
|
795
|
-
const c = s[d],
|
|
796
|
-
this.setData(
|
|
797
|
-
for (let
|
|
798
|
-
const f = a[
|
|
799
|
-
w.setAttribute("role", "gridcell"), w.setAttribute("tabindex", "-1"), w.setAttribute("aria-selected", "false"), w.id = `scheduler-cell-w-${d}-${
|
|
836
|
+
const c = s[d], u = this.createElement("div", "scheduler-day-column");
|
|
837
|
+
this.setData(u, { dayIndex: d });
|
|
838
|
+
for (let g = 0; g < a.length; g++) {
|
|
839
|
+
const f = a[g], { start: v, end: y } = Z(f, c), w = this.createElement("div", "scheduler-time-slot");
|
|
840
|
+
w.setAttribute("role", "gridcell"), w.setAttribute("tabindex", "-1"), w.setAttribute("aria-selected", "false"), w.id = `scheduler-cell-w-${d}-${g}`, this.setData(w, {
|
|
800
841
|
dayIndex: d,
|
|
801
|
-
slotIndex:
|
|
802
|
-
start:
|
|
842
|
+
slotIndex: g,
|
|
843
|
+
start: v.toISOString(),
|
|
803
844
|
end: y.toISOString()
|
|
804
845
|
});
|
|
805
|
-
const
|
|
806
|
-
this.slotElements.set(
|
|
846
|
+
const x = `${d}-${g}`;
|
|
847
|
+
this.slotElements.set(x, w), u.appendChild(w);
|
|
807
848
|
}
|
|
808
849
|
const m = this.createElement("div", "scheduler-events-container");
|
|
809
|
-
|
|
850
|
+
u.appendChild(m), this.dayColumns.push(u), l.appendChild(u);
|
|
810
851
|
}
|
|
811
|
-
|
|
852
|
+
i.appendChild(l), this.container.appendChild(i), this.renderEvents(), this.updateCellFocusAndSelection(), this.renderNowIndicator(s, a), this.applyGridRoles({
|
|
812
853
|
multiselectable: !0,
|
|
813
854
|
columnHeaderRow: ":scope > .scheduler-day-headers",
|
|
814
855
|
columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
|
|
@@ -828,12 +869,12 @@ class ge extends $ {
|
|
|
828
869
|
}), this.markToday();
|
|
829
870
|
}
|
|
830
871
|
update(e) {
|
|
831
|
-
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options),
|
|
872
|
+
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options), r = this.state.selectedEvent?.id !== e.selectedEvent?.id;
|
|
832
873
|
if (this.state = e, t || s) {
|
|
833
874
|
this.render();
|
|
834
875
|
return;
|
|
835
876
|
}
|
|
836
|
-
this.updateGreyedSlots(),
|
|
877
|
+
this.updateGreyedSlots(), r ? this.renderEvents() : this.renderEvents(), this.updateCellFocusAndSelection(), this.renderPreviewEvent();
|
|
837
878
|
}
|
|
838
879
|
/**
|
|
839
880
|
* Apply roving tabindex and aria-selected to each cached slot element. Also
|
|
@@ -845,14 +886,14 @@ class ge extends $ {
|
|
|
845
886
|
updateCellFocusAndSelection() {
|
|
846
887
|
const e = this.state.focusedCell;
|
|
847
888
|
let t = !1, s = null;
|
|
848
|
-
for (const [,
|
|
849
|
-
s || (s =
|
|
850
|
-
const
|
|
851
|
-
if (!
|
|
852
|
-
const o = { start: new Date(
|
|
853
|
-
|
|
854
|
-
const l =
|
|
855
|
-
|
|
889
|
+
for (const [, r] of this.slotElements) {
|
|
890
|
+
s || (s = r);
|
|
891
|
+
const n = r.dataset.start, i = r.dataset.end;
|
|
892
|
+
if (!n || !i) continue;
|
|
893
|
+
const o = { start: new Date(n), end: new Date(i) }, a = !!e && o.start.getTime() === e.start.getTime();
|
|
894
|
+
r.setAttribute("tabindex", a ? "0" : "-1");
|
|
895
|
+
const l = V(o, this.state, null);
|
|
896
|
+
r.setAttribute("aria-selected", l ? "true" : "false"), r.classList.toggle("selected", l), a && (t = !0);
|
|
856
897
|
}
|
|
857
898
|
!t && s && s.setAttribute("tabindex", "0");
|
|
858
899
|
}
|
|
@@ -860,46 +901,46 @@ class ge extends $ {
|
|
|
860
901
|
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;
|
|
861
902
|
}
|
|
862
903
|
renderEvents() {
|
|
863
|
-
const { date: e, events: t, options: s } = this.state,
|
|
864
|
-
|
|
865
|
-
const o =
|
|
904
|
+
const { date: e, events: t, options: s } = this.state, r = h.getWeekDays(e, s.firstDayOfWeek), n = r[0], i = new Date(r[6]);
|
|
905
|
+
i.setHours(23, 59, 59, 999);
|
|
906
|
+
const o = C.filterByRange(t, n, i), a = [];
|
|
866
907
|
for (const c of o) {
|
|
867
|
-
const { parts:
|
|
868
|
-
a.push(...
|
|
908
|
+
const { parts: u } = C.splitInParts(c);
|
|
909
|
+
a.push(...u);
|
|
869
910
|
}
|
|
870
|
-
const l =
|
|
911
|
+
const l = C.filterPartsByRange(a, n, i), d = C.getTimelinedParts(l);
|
|
871
912
|
this.eventElements.forEach((c) => c.remove()), this.eventElements.clear();
|
|
872
|
-
for (const { part: c, trackIndex:
|
|
913
|
+
for (const { part: c, trackIndex: u, totalTracks: m, colspan: g } of d) {
|
|
873
914
|
if (!c.event) continue;
|
|
874
|
-
const f =
|
|
915
|
+
const f = r.findIndex((x) => h.isSameDay(x, c.start));
|
|
875
916
|
if (f === -1) continue;
|
|
876
917
|
const y = this.dayColumns[f].querySelector(".scheduler-events-container");
|
|
877
918
|
if (!y) continue;
|
|
878
919
|
const w = this.createEventElement(
|
|
879
920
|
c,
|
|
880
|
-
|
|
921
|
+
u,
|
|
881
922
|
m,
|
|
882
|
-
|
|
923
|
+
g,
|
|
883
924
|
s.slotDuration ?? 1800
|
|
884
925
|
);
|
|
885
926
|
y.appendChild(w), this.eventElements.set(c.id, w);
|
|
886
927
|
}
|
|
887
928
|
}
|
|
888
|
-
createEventElement(e, t, s,
|
|
889
|
-
const
|
|
890
|
-
this.state.keyboardMoveEventId,
|
|
929
|
+
createEventElement(e, t, s, r, n) {
|
|
930
|
+
const i = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === i.id;
|
|
931
|
+
this.state.keyboardMoveEventId, i.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
|
|
891
932
|
"aria-label",
|
|
892
|
-
|
|
933
|
+
$(i, null, this.state.options)
|
|
893
934
|
), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
|
|
894
935
|
const l = this.partGeometry(e.start, e.end, {
|
|
895
936
|
...this.state.options,
|
|
896
|
-
slotDuration:
|
|
897
|
-
}), { top: d, height: c } = l ?? { top: 0, height: 0 },
|
|
898
|
-
o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${
|
|
899
|
-
const
|
|
900
|
-
f.textContent =
|
|
901
|
-
const
|
|
902
|
-
return
|
|
937
|
+
slotDuration: n
|
|
938
|
+
}), { top: d, height: c } = l ?? { top: 0, height: 0 }, u = t / s * 100, m = r / s * 100;
|
|
939
|
+
o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${u}%`, o.style.width = `calc(${m}% - 2px)`, this.applyEventColors(o, i), this.setData(o, { eventId: i.id });
|
|
940
|
+
const g = this.createElement("div", "event-content"), f = this.createElement("div", "event-title");
|
|
941
|
+
f.textContent = i.title, g.appendChild(f);
|
|
942
|
+
const v = this.createElement("div", "event-time");
|
|
943
|
+
return v.textContent = `${h.formatTime(e.start, this.state.options.timeFormat)} - ${h.formatTime(e.end, this.state.options.timeFormat)}`, g.appendChild(v), o.appendChild(g), this.appendResizeHandles(o, e), o;
|
|
903
944
|
}
|
|
904
945
|
/**
|
|
905
946
|
* Dashed ghost showing where the dragged/created range will land — ONE box per
|
|
@@ -908,114 +949,114 @@ class ge extends $ {
|
|
|
908
949
|
* box hanging out of the first column for a 3-day range.
|
|
909
950
|
*/
|
|
910
951
|
renderPreviewEvent() {
|
|
911
|
-
this.container.querySelectorAll(".scheduler-event.preview").forEach((
|
|
952
|
+
this.container.querySelectorAll(".scheduler-event.preview").forEach((i) => i.remove());
|
|
912
953
|
const { previewEvent: e, options: t, date: s } = this.state;
|
|
913
954
|
if (!e) return;
|
|
914
|
-
const
|
|
915
|
-
for (const
|
|
916
|
-
const o =
|
|
955
|
+
const r = h.getWeekDays(s, t.firstDayOfWeek), { parts: n } = C.splitInParts(e);
|
|
956
|
+
for (const i of n) {
|
|
957
|
+
const o = r.findIndex((c) => h.isSameDay(c, i.start));
|
|
917
958
|
if (o === -1) continue;
|
|
918
959
|
const a = this.dayColumns[o]?.querySelector(".scheduler-events-container");
|
|
919
960
|
if (!a) continue;
|
|
920
|
-
const l = this.partGeometry(
|
|
961
|
+
const l = this.partGeometry(i.start, i.end, t);
|
|
921
962
|
if (!l) continue;
|
|
922
963
|
const d = this.createElement("div", "scheduler-event", "preview");
|
|
923
|
-
|
|
964
|
+
i.isStart || d.classList.add("preview-continues-before"), i.isEnd || d.classList.add("preview-continues-after"), d.style.top = `${l.top}px`, d.style.height = `${l.height}px`, d.style.left = "0", d.style.width = "100%", a.appendChild(d);
|
|
924
965
|
}
|
|
925
966
|
}
|
|
926
967
|
updateGreyedSlots() {
|
|
927
|
-
const { dragState: e, previewEvent: t, options: s, date:
|
|
968
|
+
const { dragState: e, previewEvent: t, options: s, date: r } = this.state;
|
|
928
969
|
if (this.slotElements.forEach((o) => o.classList.remove("greyed")), !e || !t) return;
|
|
929
|
-
const
|
|
930
|
-
|
|
970
|
+
const n = h.getWeekDays(r, s.firstDayOfWeek), i = h.getTimeSlots(
|
|
971
|
+
n[0],
|
|
931
972
|
s.slotDuration,
|
|
932
973
|
s.slotMinTime,
|
|
933
974
|
s.slotMaxTime
|
|
934
975
|
);
|
|
935
|
-
for (let o = 0; o <
|
|
936
|
-
const a =
|
|
937
|
-
for (let l = 0; l <
|
|
938
|
-
const d =
|
|
939
|
-
if (c < t.end &&
|
|
940
|
-
const m = `${o}-${l}`,
|
|
941
|
-
|
|
976
|
+
for (let o = 0; o < n.length; o++) {
|
|
977
|
+
const a = n[o];
|
|
978
|
+
for (let l = 0; l < i.length; l++) {
|
|
979
|
+
const d = i[l], { start: c, end: u } = Z(d, a);
|
|
980
|
+
if (c < t.end && u > t.start) {
|
|
981
|
+
const m = `${o}-${l}`, g = this.slotElements.get(m);
|
|
982
|
+
g && g.classList.add("greyed");
|
|
942
983
|
}
|
|
943
984
|
}
|
|
944
985
|
}
|
|
945
986
|
}
|
|
946
987
|
renderNowIndicator(e, t) {
|
|
947
988
|
if (!this.state.options.nowIndicator) return;
|
|
948
|
-
const s = /* @__PURE__ */ new Date(),
|
|
949
|
-
if (
|
|
950
|
-
const
|
|
951
|
-
if (!
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
const o = (s.getTime() -
|
|
955
|
-
d.style.top = `${l}px`,
|
|
989
|
+
const s = /* @__PURE__ */ new Date(), r = e.findIndex((c) => h.isSameDay(c, s));
|
|
990
|
+
if (r === -1) return;
|
|
991
|
+
const n = this.dayColumns[r];
|
|
992
|
+
if (!n) return;
|
|
993
|
+
const i = new Date(s);
|
|
994
|
+
i.setHours(0, 0, 0, 0);
|
|
995
|
+
const o = (s.getTime() - i.getTime()) / (1e3 * 60), a = (this.state.options.slotDuration ?? 1800) / 60, l = o / a * 40, d = this.createElement("div", "scheduler-now-indicator");
|
|
996
|
+
d.style.top = `${l}px`, n.appendChild(d);
|
|
956
997
|
}
|
|
957
998
|
updateNowIndicator() {
|
|
958
999
|
if (!this.state.options.nowIndicator) return;
|
|
959
|
-
const { date: e, options: t } = this.state, s = h.getWeekDays(e, t.firstDayOfWeek),
|
|
960
|
-
if (
|
|
961
|
-
const
|
|
962
|
-
if (!
|
|
963
|
-
const o =
|
|
1000
|
+
const { date: e, options: t } = this.state, s = h.getWeekDays(e, t.firstDayOfWeek), r = /* @__PURE__ */ new Date(), n = s.findIndex((u) => h.isSameDay(u, r));
|
|
1001
|
+
if (n === -1) return;
|
|
1002
|
+
const i = this.dayColumns[n];
|
|
1003
|
+
if (!i) return;
|
|
1004
|
+
const o = i.querySelector(".scheduler-now-indicator"), a = new Date(r);
|
|
964
1005
|
a.setHours(0, 0, 0, 0);
|
|
965
|
-
const l = (
|
|
1006
|
+
const l = (r.getTime() - a.getTime()) / (1e3 * 60), d = (t.slotDuration ?? 1800) / 60, c = l / d * 40;
|
|
966
1007
|
if (o)
|
|
967
1008
|
o.style.top = `${c}px`;
|
|
968
1009
|
else {
|
|
969
|
-
const
|
|
970
|
-
|
|
1010
|
+
const u = this.createElement("div", "scheduler-now-indicator");
|
|
1011
|
+
u.style.top = `${c}px`, i.appendChild(u);
|
|
971
1012
|
}
|
|
972
1013
|
}
|
|
973
1014
|
destroy() {
|
|
974
1015
|
this.eventElements.clear(), this.slotElements.clear(), this.dayColumns = [], this.clearContainer();
|
|
975
1016
|
}
|
|
976
1017
|
}
|
|
977
|
-
class
|
|
1018
|
+
class Ee extends B {
|
|
978
1019
|
constructor() {
|
|
979
1020
|
super(...arguments), this.eventsContainer = null, this.slotElements = /* @__PURE__ */ new Map(), this.dayColumn = null;
|
|
980
1021
|
}
|
|
981
1022
|
render() {
|
|
982
1023
|
this.clearContainer(), this.container.classList.add("scheduler-day-view");
|
|
983
|
-
const { date: e, options: t } = this.state, s = this.createElement("div", "scheduler-day-headers"),
|
|
984
|
-
|
|
985
|
-
const
|
|
986
|
-
h.isToday(e) &&
|
|
987
|
-
const
|
|
988
|
-
|
|
1024
|
+
const { date: e, options: t } = this.state, s = this.createElement("div", "scheduler-day-headers"), r = this.createElement("div", "scheduler-time-gutter-space");
|
|
1025
|
+
r.style.width = "var(--scheduler-time-gutter-width)", s.appendChild(r);
|
|
1026
|
+
const n = this.createElement("div", "scheduler-day-header");
|
|
1027
|
+
h.isToday(e) && n.classList.add("today");
|
|
1028
|
+
const i = this.createElement("div", "day-name");
|
|
1029
|
+
i.textContent = h.getDayName(e, t.locale);
|
|
989
1030
|
const o = this.createElement("div", "day-number");
|
|
990
1031
|
o.textContent = String(e.getDate());
|
|
991
1032
|
const a = this.createElement("div", "month-year");
|
|
992
1033
|
a.textContent = h.formatDate(e, t.locale, {
|
|
993
1034
|
month: "long",
|
|
994
1035
|
year: "numeric"
|
|
995
|
-
}), a.style.fontSize = "12px", a.style.color = "#666",
|
|
1036
|
+
}), a.style.fontSize = "12px", a.style.color = "#666", n.appendChild(i), n.appendChild(o), n.appendChild(a), s.appendChild(n), this.container.appendChild(s);
|
|
996
1037
|
const l = this.createElement("div", "scheduler-time-grid"), d = this.createElement("div", "scheduler-time-gutter"), c = h.getTimeSlots(
|
|
997
1038
|
e,
|
|
998
1039
|
t.slotDuration,
|
|
999
1040
|
t.slotMinTime,
|
|
1000
1041
|
t.slotMaxTime
|
|
1001
1042
|
);
|
|
1002
|
-
for (const
|
|
1043
|
+
for (const g of c) {
|
|
1003
1044
|
const f = this.createElement("div", "scheduler-time-slot-label");
|
|
1004
|
-
f.textContent = h.formatTime(
|
|
1045
|
+
f.textContent = h.formatTime(g.start, t.timeFormat), d.appendChild(f);
|
|
1005
1046
|
}
|
|
1006
1047
|
l.appendChild(d);
|
|
1007
|
-
const
|
|
1048
|
+
const u = this.createElement("div", "scheduler-days-container");
|
|
1008
1049
|
this.dayColumn = this.createElement("div", "scheduler-day-column");
|
|
1009
1050
|
const m = this.dayColumn;
|
|
1010
|
-
for (let
|
|
1011
|
-
const f = c[
|
|
1012
|
-
|
|
1013
|
-
slotIndex:
|
|
1051
|
+
for (let g = 0; g < c.length; g++) {
|
|
1052
|
+
const f = c[g], v = this.createElement("div", "scheduler-time-slot");
|
|
1053
|
+
v.setAttribute("role", "gridcell"), v.setAttribute("tabindex", "-1"), v.setAttribute("aria-selected", "false"), v.id = `scheduler-cell-d-${g}`, this.setData(v, {
|
|
1054
|
+
slotIndex: g,
|
|
1014
1055
|
start: f.start.toISOString(),
|
|
1015
1056
|
end: f.end.toISOString()
|
|
1016
|
-
}), this.slotElements.set(
|
|
1057
|
+
}), this.slotElements.set(g, v), m.appendChild(v);
|
|
1017
1058
|
}
|
|
1018
|
-
this.eventsContainer = this.createElement("div", "scheduler-events-container"), m.appendChild(this.eventsContainer),
|
|
1059
|
+
this.eventsContainer = this.createElement("div", "scheduler-events-container"), m.appendChild(this.eventsContainer), u.appendChild(m), l.appendChild(u), this.container.appendChild(l), this.renderEvents(), this.updateCellFocusAndSelection(), h.isToday(e) && t.nowIndicator && this.renderNowIndicator(m), this.applyGridRoles({
|
|
1019
1060
|
multiselectable: !0,
|
|
1020
1061
|
columnHeaderRow: ":scope > .scheduler-day-headers",
|
|
1021
1062
|
columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
|
|
@@ -1041,70 +1082,70 @@ class fe extends $ {
|
|
|
1041
1082
|
updateCellFocusAndSelection() {
|
|
1042
1083
|
const e = this.state.focusedCell;
|
|
1043
1084
|
let t = !1, s = null;
|
|
1044
|
-
for (const [,
|
|
1045
|
-
s || (s =
|
|
1046
|
-
const
|
|
1047
|
-
if (!
|
|
1048
|
-
const o = { start: new Date(
|
|
1049
|
-
|
|
1050
|
-
const l =
|
|
1051
|
-
|
|
1085
|
+
for (const [, r] of this.slotElements) {
|
|
1086
|
+
s || (s = r);
|
|
1087
|
+
const n = r.dataset.start, i = r.dataset.end;
|
|
1088
|
+
if (!n || !i) continue;
|
|
1089
|
+
const o = { start: new Date(n), end: new Date(i) }, a = !!e && o.start.getTime() === e.start.getTime();
|
|
1090
|
+
r.setAttribute("tabindex", a ? "0" : "-1");
|
|
1091
|
+
const l = V(o, this.state, null);
|
|
1092
|
+
r.setAttribute("aria-selected", l ? "true" : "false"), r.classList.toggle("selected", l), a && (t = !0);
|
|
1052
1093
|
}
|
|
1053
1094
|
!t && s && s.setAttribute("tabindex", "0");
|
|
1054
1095
|
}
|
|
1055
1096
|
renderEvents() {
|
|
1056
1097
|
if (!this.eventsContainer) return;
|
|
1057
1098
|
this.eventsContainer.innerHTML = "";
|
|
1058
|
-
const { date: e, events: t, options: s } = this.state,
|
|
1059
|
-
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1062
|
-
const
|
|
1063
|
-
for (const l of
|
|
1064
|
-
const { parts: d } =
|
|
1099
|
+
const { date: e, events: t, options: s } = this.state, r = new Date(e);
|
|
1100
|
+
r.setHours(0, 0, 0, 0);
|
|
1101
|
+
const n = new Date(e);
|
|
1102
|
+
n.setHours(23, 59, 59, 999);
|
|
1103
|
+
const i = C.filterByRange(t, r, n), o = [];
|
|
1104
|
+
for (const l of i) {
|
|
1105
|
+
const { parts: d } = C.splitInParts(l), c = C.filterPartsByRange(d, r, n);
|
|
1065
1106
|
o.push(...c);
|
|
1066
1107
|
}
|
|
1067
|
-
const a =
|
|
1068
|
-
for (const { part: l, trackIndex: d, totalTracks: c, colspan:
|
|
1108
|
+
const a = C.getTimelinedParts(o);
|
|
1109
|
+
for (const { part: l, trackIndex: d, totalTracks: c, colspan: u } of a) {
|
|
1069
1110
|
if (!l.event) continue;
|
|
1070
1111
|
const m = this.createEventElement(
|
|
1071
1112
|
l,
|
|
1072
1113
|
d,
|
|
1073
1114
|
c,
|
|
1074
|
-
|
|
1115
|
+
u,
|
|
1075
1116
|
s.slotDuration ?? 1800
|
|
1076
1117
|
);
|
|
1077
1118
|
this.eventsContainer.appendChild(m);
|
|
1078
1119
|
}
|
|
1079
1120
|
}
|
|
1080
|
-
createEventElement(e, t, s,
|
|
1081
|
-
const
|
|
1082
|
-
this.state.keyboardMoveEventId,
|
|
1121
|
+
createEventElement(e, t, s, r, n) {
|
|
1122
|
+
const i = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === i.id;
|
|
1123
|
+
this.state.keyboardMoveEventId, i.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
|
|
1083
1124
|
"aria-label",
|
|
1084
|
-
|
|
1125
|
+
$(i, null, this.state.options)
|
|
1085
1126
|
), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
|
|
1086
1127
|
const l = this.partGeometry(e.start, e.end, {
|
|
1087
1128
|
...this.state.options,
|
|
1088
|
-
slotDuration:
|
|
1089
|
-
}), { top: d, height: c } = l ?? { top: 0, height: 0 },
|
|
1090
|
-
o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${
|
|
1091
|
-
const
|
|
1092
|
-
f.textContent =
|
|
1093
|
-
const
|
|
1094
|
-
return
|
|
1129
|
+
slotDuration: n
|
|
1130
|
+
}), { top: d, height: c } = l ?? { top: 0, height: 0 }, u = t / s * 100, m = r / s * 100;
|
|
1131
|
+
o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${u}%`, o.style.width = `calc(${m}% - 2px)`, this.applyEventColors(o, i), this.setData(o, { eventId: i.id });
|
|
1132
|
+
const g = this.createElement("div", "event-content"), f = this.createElement("div", "event-title");
|
|
1133
|
+
f.textContent = i.title, g.appendChild(f);
|
|
1134
|
+
const v = this.createElement("div", "event-time");
|
|
1135
|
+
return v.textContent = `${h.formatTime(e.start, this.state.options.timeFormat)} - ${h.formatTime(e.end, this.state.options.timeFormat)}`, g.appendChild(v), o.appendChild(g), this.appendResizeHandles(o, e), o;
|
|
1095
1136
|
}
|
|
1096
1137
|
renderNowIndicator(e) {
|
|
1097
1138
|
const t = /* @__PURE__ */ new Date(), s = new Date(t);
|
|
1098
1139
|
s.setHours(0, 0, 0, 0);
|
|
1099
|
-
const
|
|
1100
|
-
o.style.top = `${
|
|
1140
|
+
const r = (t.getTime() - s.getTime()) / (1e3 * 60), n = (this.state.options.slotDuration ?? 1800) / 60, i = r / n * 40, o = this.createElement("div", "scheduler-now-indicator");
|
|
1141
|
+
o.style.top = `${i}px`, e.appendChild(o);
|
|
1101
1142
|
}
|
|
1102
1143
|
updateNowIndicator() {
|
|
1103
1144
|
if (!this.dayColumn || !this.state.options.nowIndicator || !h.isToday(this.state.date)) return;
|
|
1104
1145
|
const e = this.dayColumn.querySelector(".scheduler-now-indicator"), t = /* @__PURE__ */ new Date(), s = new Date(t);
|
|
1105
1146
|
s.setHours(0, 0, 0, 0);
|
|
1106
|
-
const
|
|
1107
|
-
e ? e.style.top = `${
|
|
1147
|
+
const r = (t.getTime() - s.getTime()) / (1e3 * 60), n = (this.state.options.slotDuration ?? 1800) / 60, i = r / n * 40;
|
|
1148
|
+
e ? e.style.top = `${i}px` : this.renderNowIndicator(this.dayColumn);
|
|
1108
1149
|
}
|
|
1109
1150
|
update(e) {
|
|
1110
1151
|
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options);
|
|
@@ -1118,18 +1159,18 @@ class fe extends $ {
|
|
|
1118
1159
|
return e.slotDuration !== t.slotDuration || e.timeFormat !== t.timeFormat || e.slotMinTime !== t.slotMinTime || e.slotMaxTime !== t.slotMaxTime || e.locale !== t.locale;
|
|
1119
1160
|
}
|
|
1120
1161
|
updateGreyedSlots() {
|
|
1121
|
-
const { dragState: e, previewEvent: t, options: s, date:
|
|
1122
|
-
if (this.slotElements.forEach((
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1162
|
+
const { dragState: e, previewEvent: t, options: s, date: r } = this.state;
|
|
1163
|
+
if (this.slotElements.forEach((i) => i.classList.remove("greyed")), !e || !t) return;
|
|
1164
|
+
const n = h.getTimeSlots(
|
|
1165
|
+
r,
|
|
1125
1166
|
s.slotDuration,
|
|
1126
1167
|
s.slotMinTime,
|
|
1127
1168
|
s.slotMaxTime
|
|
1128
1169
|
);
|
|
1129
|
-
for (let
|
|
1130
|
-
const o = i
|
|
1170
|
+
for (let i = 0; i < n.length; i++) {
|
|
1171
|
+
const o = n[i];
|
|
1131
1172
|
if (o.start < t.end && o.end > t.start) {
|
|
1132
|
-
const a = this.slotElements.get(
|
|
1173
|
+
const a = this.slotElements.get(i);
|
|
1133
1174
|
a && a.classList.add("greyed");
|
|
1134
1175
|
}
|
|
1135
1176
|
}
|
|
@@ -1145,21 +1186,21 @@ class fe extends $ {
|
|
|
1145
1186
|
this.eventsContainer.querySelectorAll(".scheduler-event.preview").forEach((a) => a.remove());
|
|
1146
1187
|
const { previewEvent: e, options: t, date: s } = this.state;
|
|
1147
1188
|
if (!e) return;
|
|
1148
|
-
const { parts:
|
|
1189
|
+
const { parts: r } = C.splitInParts(e), n = r.find((a) => h.isSameDay(s, a.start));
|
|
1190
|
+
if (!n) return;
|
|
1191
|
+
const i = this.partGeometry(n.start, n.end, t);
|
|
1149
1192
|
if (!i) return;
|
|
1150
|
-
const r = this.partGeometry(i.start, i.end, t);
|
|
1151
|
-
if (!r) return;
|
|
1152
1193
|
const o = this.createElement("div", "scheduler-event", "preview");
|
|
1153
|
-
|
|
1194
|
+
n.isStart || o.classList.add("preview-continues-before"), n.isEnd || o.classList.add("preview-continues-after"), o.style.top = `${i.top}px`, o.style.height = `${i.height}px`, o.style.left = "0", o.style.width = "100%", this.eventsContainer.appendChild(o);
|
|
1154
1195
|
}
|
|
1155
1196
|
destroy() {
|
|
1156
1197
|
this.eventsContainer = null, this.dayColumn = null, this.slotElements.clear(), this.clearContainer();
|
|
1157
1198
|
}
|
|
1158
1199
|
}
|
|
1159
|
-
const
|
|
1160
|
-
class
|
|
1200
|
+
const P = "__mp-unassigned__";
|
|
1201
|
+
class A extends B {
|
|
1161
1202
|
constructor() {
|
|
1162
|
-
super(...arguments), this.rowElements = /* @__PURE__ */ new Map(), this.pendingFocusKey = null;
|
|
1203
|
+
super(...arguments), this.rowElements = /* @__PURE__ */ new Map(), this.pendingFocusKey = null, this.columnDrag = null, this.boundColumnDragMove = (e) => this.onColumnDragMove(e), this.boundColumnDragEnd = () => this.onColumnDragEnd();
|
|
1163
1204
|
}
|
|
1164
1205
|
/**
|
|
1165
1206
|
* Slot width in px. Read from `--scheduler-slot-width` so consumers can shorten
|
|
@@ -1180,9 +1221,9 @@ class ye extends $ {
|
|
|
1180
1221
|
* the way week/day must (there, height IS duration).
|
|
1181
1222
|
*/
|
|
1182
1223
|
get trackMetrics() {
|
|
1183
|
-
const e = getComputedStyle(this.container), t = (s,
|
|
1184
|
-
const
|
|
1185
|
-
return Number.isFinite(
|
|
1224
|
+
const e = getComputedStyle(this.container), t = (s, r) => {
|
|
1225
|
+
const n = Number.parseFloat(e.getPropertyValue(s).trim());
|
|
1226
|
+
return Number.isFinite(n) && n >= 0 ? n : r;
|
|
1186
1227
|
};
|
|
1187
1228
|
return {
|
|
1188
1229
|
height: t("--scheduler-timeline-event-height", 28),
|
|
@@ -1192,66 +1233,66 @@ class ye extends $ {
|
|
|
1192
1233
|
}
|
|
1193
1234
|
render() {
|
|
1194
1235
|
this.captureActionFocus(), this.clearContainer(), this.container.classList.add("scheduler-timeline-view");
|
|
1195
|
-
const { date: e, options: t, resources: s, collapsedGroups:
|
|
1236
|
+
const { date: e, options: t, resources: s, collapsedGroups: r } = this.state, n = h.getWeekDays(e, t.firstDayOfWeek), i = R.flatten(s, r), o = this.hasUnassignedRow(this.state), a = i.filter((b) => b.visible).length + 2 + (o ? 1 : 0), l = this.createElement("div", "scheduler-timeline");
|
|
1196
1237
|
l.setAttribute("role", "grid"), l.setAttribute(
|
|
1197
1238
|
"aria-label",
|
|
1198
|
-
S(
|
|
1199
|
-
date: h.formatDateWithWeekday(
|
|
1239
|
+
S(E(t.messages).timelineGridLabel, {
|
|
1240
|
+
date: h.formatDateWithWeekday(n[0], t.locale)
|
|
1200
1241
|
})
|
|
1201
1242
|
), l.setAttribute("aria-rowcount", String(a)), l.setAttribute("aria-describedby", "scheduler-kbd-grid"), l.setAttribute("aria-multiselectable", "true");
|
|
1202
1243
|
const d = this.createElement("div", "scheduler-timeline-header");
|
|
1203
1244
|
d.setAttribute("role", "row"), d.setAttribute("aria-rowindex", "1");
|
|
1204
1245
|
const c = this.createElement("div", "scheduler-resource-header");
|
|
1205
|
-
c.setAttribute("role", "columnheader"), c.textContent =
|
|
1206
|
-
const
|
|
1207
|
-
for (const b of
|
|
1208
|
-
const
|
|
1246
|
+
c.setAttribute("role", "columnheader"), c.textContent = E(this.state.options.messages).resourcesHeader, c.appendChild(this.createColumnResizer()), d.appendChild(c);
|
|
1247
|
+
const u = this.createElement("div", "scheduler-timeline-slots-header");
|
|
1248
|
+
for (const b of n) {
|
|
1249
|
+
const H = h.getTimeSlots(
|
|
1209
1250
|
b,
|
|
1210
1251
|
t.slotDuration,
|
|
1211
1252
|
t.slotMinTime,
|
|
1212
1253
|
t.slotMaxTime
|
|
1213
|
-
).length,
|
|
1214
|
-
|
|
1254
|
+
).length, k = this.createElement("div", "scheduler-timeline-slot-header");
|
|
1255
|
+
k.setAttribute("role", "columnheader"), k.style.width = `${H * this.slotWidth}px`, k.textContent = h.formatDateWithWeekday(b, t.locale), k.style.borderBottom = "1px solid var(--scheduler-border-color)", u.appendChild(k);
|
|
1215
1256
|
}
|
|
1216
|
-
d.appendChild(
|
|
1257
|
+
d.appendChild(u);
|
|
1217
1258
|
const m = this.createElement("div", "scheduler-timeline-head");
|
|
1218
1259
|
m.appendChild(d), l.appendChild(m);
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1260
|
+
const g = this.createElement("div", "scheduler-timeline-header");
|
|
1261
|
+
g.setAttribute("role", "row");
|
|
1221
1262
|
const f = this.createElement("div", "scheduler-resource-header");
|
|
1222
|
-
f.style.borderBottom = "1px solid var(--scheduler-border-color)",
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1225
|
-
for (const b of
|
|
1263
|
+
f.style.borderBottom = "1px solid var(--scheduler-border-color)", g.appendChild(f);
|
|
1264
|
+
const v = this.createElement("div", "scheduler-timeline-slots-header");
|
|
1265
|
+
v.setAttribute("role", "presentation");
|
|
1266
|
+
for (const b of n) {
|
|
1226
1267
|
const M = h.getTimeSlots(
|
|
1227
1268
|
b,
|
|
1228
1269
|
t.slotDuration,
|
|
1229
1270
|
t.slotMinTime,
|
|
1230
1271
|
t.slotMaxTime
|
|
1231
1272
|
);
|
|
1232
|
-
for (const
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1273
|
+
for (const H of M) {
|
|
1274
|
+
const k = this.createElement("div", "scheduler-timeline-slot-header");
|
|
1275
|
+
k.setAttribute("role", "columnheader"), k.style.width = `${this.slotWidth}px`, k.textContent = h.formatTime(H.start, t.timeFormat), k.style.fontSize = "10px", v.appendChild(k);
|
|
1235
1276
|
}
|
|
1236
1277
|
}
|
|
1237
|
-
|
|
1238
|
-
const y = this.createElement("div", "scheduler-timeline-body"), w =
|
|
1239
|
-
let
|
|
1278
|
+
g.appendChild(v), m.appendChild(g);
|
|
1279
|
+
const y = this.createElement("div", "scheduler-timeline-body"), w = R.flatten(s, r);
|
|
1280
|
+
let x = 2;
|
|
1240
1281
|
for (const b of w) {
|
|
1241
1282
|
if (!b.visible) continue;
|
|
1242
|
-
const M = this.createResourceRow(b,
|
|
1243
|
-
M.setAttribute("aria-rowindex", String(
|
|
1283
|
+
const M = this.createResourceRow(b, n);
|
|
1284
|
+
M.setAttribute("aria-rowindex", String(x)), y.appendChild(M), x++;
|
|
1244
1285
|
}
|
|
1245
1286
|
if (o) {
|
|
1246
|
-
const b = this.createUnassignedRow(
|
|
1247
|
-
b.setAttribute("aria-rowindex", String(
|
|
1287
|
+
const b = this.createUnassignedRow(n);
|
|
1288
|
+
b.setAttribute("aria-rowindex", String(x)), y.appendChild(b), x++;
|
|
1248
1289
|
}
|
|
1249
1290
|
if (l.appendChild(y), this.container.appendChild(l), w.length === 0 && !o) {
|
|
1250
1291
|
const b = this.createElement("div", "scheduler-timeline-empty");
|
|
1251
|
-
b.textContent =
|
|
1292
|
+
b.textContent = E(t.messages).noResources, y.appendChild(b);
|
|
1252
1293
|
}
|
|
1253
|
-
const
|
|
1254
|
-
|
|
1294
|
+
const I = this.createAddBar();
|
|
1295
|
+
I && this.container.appendChild(I), this.renderEvents(n), this.updateCellFocusAndSelection(), this.restoreActionFocus();
|
|
1255
1296
|
}
|
|
1256
1297
|
/**
|
|
1257
1298
|
* Focus key of an action control: what it does plus which row it belongs to.
|
|
@@ -1275,7 +1316,7 @@ class ye extends $ {
|
|
|
1275
1316
|
if (this.pendingFocusKey = null, !e) return;
|
|
1276
1317
|
const t = Array.from(
|
|
1277
1318
|
this.container.querySelectorAll("[data-action]")
|
|
1278
|
-
).find((
|
|
1319
|
+
).find((r) => this.actionFocusKey(r) === e), s = this.container.querySelector(".scheduler-add-button");
|
|
1279
1320
|
(t ?? s)?.focus();
|
|
1280
1321
|
}
|
|
1281
1322
|
/**
|
|
@@ -1285,35 +1326,35 @@ class ye extends $ {
|
|
|
1285
1326
|
*/
|
|
1286
1327
|
updateCellFocusAndSelection() {
|
|
1287
1328
|
const e = this.state.focusedCell, t = this.state.focusedResourceId, s = this.container.querySelectorAll(".scheduler-timeline-slot");
|
|
1288
|
-
let
|
|
1289
|
-
s.forEach((
|
|
1290
|
-
|
|
1291
|
-
const o =
|
|
1329
|
+
let r = !1, n = null;
|
|
1330
|
+
s.forEach((i) => {
|
|
1331
|
+
n || (n = i);
|
|
1332
|
+
const o = i.dataset.start, a = i.dataset.end, l = i.dataset.resourceId ?? null;
|
|
1292
1333
|
if (!o || !a) return;
|
|
1293
1334
|
const d = { start: new Date(o), end: new Date(a) }, c = !!e && d.start.getTime() === e.start.getTime() && t === l;
|
|
1294
|
-
|
|
1295
|
-
const
|
|
1296
|
-
|
|
1297
|
-
}), !
|
|
1335
|
+
i.setAttribute("tabindex", c ? "0" : "-1");
|
|
1336
|
+
const u = V(d, this.state, l);
|
|
1337
|
+
i.setAttribute("aria-selected", u ? "true" : "false"), i.classList.toggle("selected", u), c && (r = !0);
|
|
1338
|
+
}), !r && n && n.setAttribute("tabindex", "0");
|
|
1298
1339
|
}
|
|
1299
1340
|
createResourceRow(e, t) {
|
|
1300
|
-
const { options: s } = this.state,
|
|
1301
|
-
|
|
1302
|
-
const
|
|
1303
|
-
if (
|
|
1341
|
+
const { options: s } = this.state, r = this.createElement("div", "scheduler-timeline-row");
|
|
1342
|
+
r.setAttribute("role", "row"), L(e.item) && r.classList.add("group");
|
|
1343
|
+
const n = this.createElement("div", "scheduler-resource-cell");
|
|
1344
|
+
if (n.setAttribute("role", "rowheader"), n.style.paddingLeft = `${8 + e.depth * 16}px`, L(e.item)) {
|
|
1304
1345
|
const a = this.createElement("button", "expand-toggle");
|
|
1305
1346
|
a.type = "button";
|
|
1306
1347
|
const l = this.state.collapsedGroups.has(e.item.id);
|
|
1307
1348
|
a.textContent = l ? "▶" : "▼", a.setAttribute("aria-expanded", String(!l)), a.setAttribute(
|
|
1308
1349
|
"aria-label",
|
|
1309
1350
|
S(
|
|
1310
|
-
|
|
1351
|
+
E(this.state.options.messages)[l ? "expandGroup" : "collapseGroup"],
|
|
1311
1352
|
{ title: e.item.title }
|
|
1312
1353
|
)
|
|
1313
|
-
), this.setData(a, { groupId: e.item.id }),
|
|
1354
|
+
), this.setData(a, { groupId: e.item.id }), n.appendChild(a);
|
|
1314
1355
|
}
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1356
|
+
const i = this.createElement("span", "resource-title");
|
|
1357
|
+
i.textContent = e.item.title, i.title = e.item.title, this.can("updateResource") && this.setData(i, { resourceId: e.item.id }), n.appendChild(i), this.appendResourceActions(n, e.item), r.appendChild(n);
|
|
1317
1358
|
const o = this.createElement("div", "scheduler-timeline-slots");
|
|
1318
1359
|
o.setAttribute("role", "presentation");
|
|
1319
1360
|
for (const a of t) {
|
|
@@ -1332,11 +1373,11 @@ class ye extends $ {
|
|
|
1332
1373
|
}), o.appendChild(c);
|
|
1333
1374
|
}
|
|
1334
1375
|
}
|
|
1335
|
-
if (
|
|
1376
|
+
if (G(e.item)) {
|
|
1336
1377
|
const a = this.createElement("div", "scheduler-timeline-events");
|
|
1337
1378
|
a.setAttribute("role", "gridcell"), o.appendChild(a);
|
|
1338
1379
|
}
|
|
1339
|
-
return
|
|
1380
|
+
return r.appendChild(o), this.rowElements.set(e.item.id, r), r;
|
|
1340
1381
|
}
|
|
1341
1382
|
/**
|
|
1342
1383
|
* Whether the synthetic bucket row renders: only when something is actually
|
|
@@ -1345,9 +1386,82 @@ class ye extends $ {
|
|
|
1345
1386
|
hasUnassignedRow(e) {
|
|
1346
1387
|
return (e.eventsByResource.get(null) ?? []).length > 0;
|
|
1347
1388
|
}
|
|
1389
|
+
static {
|
|
1390
|
+
this.MIN_COLUMN_PX = 80;
|
|
1391
|
+
}
|
|
1392
|
+
static {
|
|
1393
|
+
this.MIN_GRID_PX = 50;
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* The WAI-ARIA window-splitter on the resource column's right edge — the
|
|
1397
|
+
* same pattern as the repo's splitter. It writes
|
|
1398
|
+
* `--scheduler-resource-column-width` on the scroll container, which is the
|
|
1399
|
+
* exact channel the consumer configures, so their own value stays the
|
|
1400
|
+
* initial and every rule reading the custom property follows for free. The
|
|
1401
|
+
* inline style survives view rebuilds AND view switches (clearContainer
|
|
1402
|
+
* strips classes and ARIA, not inline style), which is what makes the
|
|
1403
|
+
* user's chosen width sticky.
|
|
1404
|
+
*
|
|
1405
|
+
* Lives inside the corner columnheader, OUTSIDE the `role="grid"` focus
|
|
1406
|
+
* model (same reasoning as the add bar, §11.2): a separator is not a grid
|
|
1407
|
+
* cell, and a Tab stop inside a roving-tabindex grid is a trap.
|
|
1408
|
+
*/
|
|
1409
|
+
createColumnResizer() {
|
|
1410
|
+
const e = E(this.state.options.messages), t = this.createElement("div", "scheduler-column-resizer");
|
|
1411
|
+
return t.setAttribute("role", "separator"), t.setAttribute("tabindex", "0"), t.setAttribute("aria-orientation", "vertical"), t.setAttribute("aria-label", e.resizeResourceColumn), this.updateResizerValue(t), t.addEventListener("pointerdown", (s) => {
|
|
1412
|
+
s.preventDefault(), s.stopPropagation(), this.columnDrag = { startX: s.clientX, startWidth: this.currentColumnWidth() }, document.addEventListener("pointermove", this.boundColumnDragMove), document.addEventListener("pointerup", this.boundColumnDragEnd);
|
|
1413
|
+
}), t.addEventListener("keydown", (s) => {
|
|
1414
|
+
const n = this.currentColumnWidth();
|
|
1415
|
+
switch (s.key) {
|
|
1416
|
+
case "ArrowLeft":
|
|
1417
|
+
s.preventDefault(), this.applyColumnWidth(n - 16);
|
|
1418
|
+
break;
|
|
1419
|
+
case "ArrowRight":
|
|
1420
|
+
s.preventDefault(), this.applyColumnWidth(n + 16);
|
|
1421
|
+
break;
|
|
1422
|
+
case "Home":
|
|
1423
|
+
s.preventDefault(), this.applyColumnWidth(A.MIN_COLUMN_PX);
|
|
1424
|
+
break;
|
|
1425
|
+
case "End":
|
|
1426
|
+
s.preventDefault(), this.applyColumnWidth(Number.MAX_SAFE_INTEGER);
|
|
1427
|
+
break;
|
|
1428
|
+
}
|
|
1429
|
+
}), t;
|
|
1430
|
+
}
|
|
1431
|
+
currentColumnWidth() {
|
|
1432
|
+
return this.container.querySelector(".scheduler-resource-header")?.getBoundingClientRect().width || 200;
|
|
1433
|
+
}
|
|
1434
|
+
maxColumnWidth() {
|
|
1435
|
+
return Math.max(
|
|
1436
|
+
A.MIN_COLUMN_PX,
|
|
1437
|
+
this.container.clientWidth - A.MIN_GRID_PX
|
|
1438
|
+
);
|
|
1439
|
+
}
|
|
1440
|
+
applyColumnWidth(e) {
|
|
1441
|
+
const t = Math.round(
|
|
1442
|
+
Math.min(Math.max(e, A.MIN_COLUMN_PX), this.maxColumnWidth())
|
|
1443
|
+
);
|
|
1444
|
+
this.container.style.setProperty(
|
|
1445
|
+
"--scheduler-resource-column-width",
|
|
1446
|
+
`min(${t}px, calc(100% - ${A.MIN_GRID_PX}px))`
|
|
1447
|
+
);
|
|
1448
|
+
const s = this.container.querySelector(".scheduler-column-resizer");
|
|
1449
|
+
s && this.updateResizerValue(s, t);
|
|
1450
|
+
}
|
|
1451
|
+
/** aria-valuenow as a percentage of the scroller, per the splitter pattern. */
|
|
1452
|
+
updateResizerValue(e, t) {
|
|
1453
|
+
const s = this.container.clientWidth || 1, r = t ?? this.currentColumnWidth();
|
|
1454
|
+
e.setAttribute("aria-valuemin", "0"), e.setAttribute("aria-valuemax", "100"), e.setAttribute("aria-valuenow", String(Math.round(r / s * 100)));
|
|
1455
|
+
}
|
|
1456
|
+
onColumnDragMove(e) {
|
|
1457
|
+
this.columnDrag && this.applyColumnWidth(this.columnDrag.startWidth + (e.clientX - this.columnDrag.startX));
|
|
1458
|
+
}
|
|
1459
|
+
onColumnDragEnd() {
|
|
1460
|
+
this.columnDrag = null, document.removeEventListener("pointermove", this.boundColumnDragMove), document.removeEventListener("pointerup", this.boundColumnDragEnd);
|
|
1461
|
+
}
|
|
1348
1462
|
/** True when the capability is granted for the whole scheduler. */
|
|
1349
1463
|
can(e) {
|
|
1350
|
-
return
|
|
1464
|
+
return Q(e, { permissions: this.state.resolvedPermissions });
|
|
1351
1465
|
}
|
|
1352
1466
|
/**
|
|
1353
1467
|
* Per-row resource actions, rendered into the pinned rowheader cell.
|
|
@@ -1365,39 +1479,39 @@ class ye extends $ {
|
|
|
1365
1479
|
* by the name and the indent, not by an attribute axe flags.
|
|
1366
1480
|
*/
|
|
1367
1481
|
appendResourceActions(e, t) {
|
|
1368
|
-
const s =
|
|
1369
|
-
|
|
1482
|
+
const s = E(this.state.options.messages), r = this.createElement("div", "scheduler-resource-actions");
|
|
1483
|
+
L(t) && (this.can("createResource") && r.appendChild(
|
|
1370
1484
|
this.createResourceAction(
|
|
1371
1485
|
"add-resource",
|
|
1372
1486
|
"+",
|
|
1373
1487
|
S(s.addResourceToGroup, { title: t.title }),
|
|
1374
1488
|
{ parentId: t.id }
|
|
1375
1489
|
)
|
|
1376
|
-
), this.can("createGroup") &&
|
|
1490
|
+
), this.can("createGroup") && r.appendChild(
|
|
1377
1491
|
this.createResourceAction(
|
|
1378
1492
|
"add-group",
|
|
1379
1493
|
"⊞",
|
|
1380
1494
|
S(s.addGroupToGroup, { title: t.title }),
|
|
1381
1495
|
{ parentId: t.id }
|
|
1382
1496
|
)
|
|
1383
|
-
)), this.can("updateResource") &&
|
|
1497
|
+
)), this.can("updateResource") && r.appendChild(this.createColorSwatch(t, s.resourceColor)), this.can("deleteResource") && r.appendChild(
|
|
1384
1498
|
this.createResourceAction(
|
|
1385
1499
|
"delete-resource",
|
|
1386
1500
|
"×",
|
|
1387
1501
|
S(s.removeResource, { title: t.title }),
|
|
1388
1502
|
{ resourceId: t.id }
|
|
1389
1503
|
)
|
|
1390
|
-
),
|
|
1504
|
+
), r.childElementCount > 0 && e.appendChild(r);
|
|
1391
1505
|
}
|
|
1392
1506
|
/**
|
|
1393
1507
|
* One icon button. The glyph is `aria-hidden` and the name lives on the
|
|
1394
1508
|
* button, so the accessible name is the localized sentence rather than "+".
|
|
1395
1509
|
*/
|
|
1396
|
-
createResourceAction(e, t, s,
|
|
1397
|
-
const
|
|
1398
|
-
|
|
1399
|
-
const
|
|
1400
|
-
return
|
|
1510
|
+
createResourceAction(e, t, s, r) {
|
|
1511
|
+
const n = this.createElement("button", "scheduler-resource-action");
|
|
1512
|
+
n.type = "button", n.setAttribute("aria-label", s), n.title = s, this.setData(n, { action: e, ...r });
|
|
1513
|
+
const i = this.createElement("span", "action-glyph");
|
|
1514
|
+
return i.setAttribute("aria-hidden", "true"), i.textContent = t, n.appendChild(i), n;
|
|
1401
1515
|
}
|
|
1402
1516
|
/**
|
|
1403
1517
|
* Native `<input type="color">` for the resource's colour — the recolour half
|
|
@@ -1410,8 +1524,8 @@ class ye extends $ {
|
|
|
1410
1524
|
* that has an `eventColor` would look like the control did nothing.
|
|
1411
1525
|
*/
|
|
1412
1526
|
createColorSwatch(e, t) {
|
|
1413
|
-
const s = e,
|
|
1414
|
-
return
|
|
1527
|
+
const s = e, r = s.eventColor ? "eventColor" : "color", n = s.eventColor ?? e.color, i = this.createElement("input", "scheduler-resource-color");
|
|
1528
|
+
return i.type = "color", i.setAttribute("aria-label", S(t, { title: e.title })), i.title = i.getAttribute("aria-label") ?? "", n && /^#[0-9a-f]{6}$/i.test(n) && (i.value = n), this.setData(i, { action: "set-resource-color", resourceId: e.id, field: r }), i;
|
|
1415
1529
|
}
|
|
1416
1530
|
/**
|
|
1417
1531
|
* Root-level "Add resource" / "Add group" bar, pinned to the bottom of the
|
|
@@ -1425,34 +1539,37 @@ class ye extends $ {
|
|
|
1425
1539
|
createAddBar() {
|
|
1426
1540
|
const e = this.can("createResource"), t = this.can("createGroup");
|
|
1427
1541
|
if (!e && !t) return null;
|
|
1428
|
-
const s =
|
|
1429
|
-
if (
|
|
1430
|
-
const
|
|
1431
|
-
|
|
1542
|
+
const s = E(this.state.options.messages), r = this.createElement("div", "scheduler-timeline-addbar");
|
|
1543
|
+
if (r.setAttribute("role", "toolbar"), r.setAttribute("aria-label", s.addResourceBarLabel), e) {
|
|
1544
|
+
const n = this.createElement("button", "scheduler-add-button");
|
|
1545
|
+
n.type = "button", n.textContent = s.addResource, this.setData(n, { action: "add-resource" }), r.appendChild(n);
|
|
1432
1546
|
}
|
|
1433
1547
|
if (t) {
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1548
|
+
const n = this.createElement("button", "scheduler-add-button");
|
|
1549
|
+
n.type = "button", n.textContent = s.addGroup, this.setData(n, { action: "add-group" }), r.appendChild(n);
|
|
1436
1550
|
}
|
|
1437
|
-
return
|
|
1551
|
+
return r;
|
|
1438
1552
|
}
|
|
1439
1553
|
/**
|
|
1440
1554
|
* The "(No resource)" bucket row.
|
|
1441
1555
|
*
|
|
1442
1556
|
* Structurally identical to a resource row so keyboard nav, roving tabindex and
|
|
1443
|
-
* the grid ARIA chain all treat it as one more row — but its slots carry
|
|
1444
|
-
* `data-resource-id`, so a
|
|
1445
|
-
*
|
|
1557
|
+
* the grid ARIA chain all treat it as one more row — but its slots carry
|
|
1558
|
+
* `data-unassigned` instead of a `data-resource-id`, so a drag addressing this
|
|
1559
|
+
* row resolves to the tri-state `resourceId: null` ("the bucket") rather than
|
|
1560
|
+
* `undefined` ("no resource axis"). An absent attribute could not carry that
|
|
1561
|
+
* distinction — it would read exactly like a week-view slot, and a drop here
|
|
1562
|
+
* could never mean "unassign".
|
|
1446
1563
|
*/
|
|
1447
1564
|
createUnassignedRow(e) {
|
|
1448
1565
|
const { options: t } = this.state, s = this.createElement("div", "scheduler-timeline-row", "unassigned");
|
|
1449
1566
|
s.setAttribute("role", "row");
|
|
1450
|
-
const
|
|
1451
|
-
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1454
|
-
const
|
|
1455
|
-
|
|
1567
|
+
const r = this.createElement("div", "scheduler-resource-cell");
|
|
1568
|
+
r.setAttribute("role", "rowheader"), r.style.paddingLeft = "8px";
|
|
1569
|
+
const n = this.createElement("span", "resource-title");
|
|
1570
|
+
n.textContent = E(t.messages).unassignedResource, n.title = n.textContent, r.appendChild(n), s.appendChild(r);
|
|
1571
|
+
const i = this.createElement("div", "scheduler-timeline-slots");
|
|
1572
|
+
i.setAttribute("role", "presentation");
|
|
1456
1573
|
for (const a of e) {
|
|
1457
1574
|
const l = h.getTimeSlots(
|
|
1458
1575
|
a,
|
|
@@ -1462,43 +1579,44 @@ class ye extends $ {
|
|
|
1462
1579
|
);
|
|
1463
1580
|
for (const d of l) {
|
|
1464
1581
|
const c = this.createElement("div", "scheduler-timeline-slot");
|
|
1465
|
-
c.setAttribute("role", "gridcell"), c.setAttribute("tabindex", "-1"), c.setAttribute("aria-selected", "false"), c.id = `scheduler-cell-t-${
|
|
1582
|
+
c.setAttribute("role", "gridcell"), c.setAttribute("tabindex", "-1"), c.setAttribute("aria-selected", "false"), c.id = `scheduler-cell-t-${P}-${d.start.getTime()}`, c.style.width = `${this.slotWidth}px`, this.setData(c, {
|
|
1466
1583
|
start: d.start.toISOString(),
|
|
1467
|
-
end: d.end.toISOString()
|
|
1468
|
-
|
|
1584
|
+
end: d.end.toISOString(),
|
|
1585
|
+
unassigned: "true"
|
|
1586
|
+
}), i.appendChild(c);
|
|
1469
1587
|
}
|
|
1470
1588
|
}
|
|
1471
1589
|
const o = this.createElement("div", "scheduler-timeline-events");
|
|
1472
|
-
return o.setAttribute("role", "gridcell"),
|
|
1590
|
+
return o.setAttribute("role", "gridcell"), i.appendChild(o), s.appendChild(i), this.rowElements.set(P, s), s;
|
|
1473
1591
|
}
|
|
1474
1592
|
renderEvents(e) {
|
|
1475
|
-
const { resources: t, options: s } = this.state,
|
|
1476
|
-
|
|
1593
|
+
const { resources: t, options: s } = this.state, r = e[0], n = new Date(e[6]);
|
|
1594
|
+
n.setHours(23, 59, 59, 999);
|
|
1477
1595
|
const a = h.getTimeSlots(
|
|
1478
1596
|
e[0],
|
|
1479
1597
|
s.slotDuration,
|
|
1480
1598
|
s.slotMinTime,
|
|
1481
1599
|
s.slotMaxTime
|
|
1482
1600
|
).length * 7 * this.slotWidth, l = [
|
|
1483
|
-
...
|
|
1601
|
+
...R.getAllResources(t).map((d) => ({
|
|
1484
1602
|
resourceId: d.id,
|
|
1485
1603
|
title: d.title
|
|
1486
1604
|
})),
|
|
1487
|
-
...this.rowElements.has(
|
|
1605
|
+
...this.rowElements.has(P) ? [
|
|
1488
1606
|
{
|
|
1489
1607
|
resourceId: null,
|
|
1490
|
-
title:
|
|
1608
|
+
title: E(s.messages).unassignedResource
|
|
1491
1609
|
}
|
|
1492
1610
|
] : []
|
|
1493
1611
|
];
|
|
1494
1612
|
for (const { resourceId: d, title: c } of l) {
|
|
1495
|
-
const
|
|
1496
|
-
if (!
|
|
1497
|
-
const m =
|
|
1613
|
+
const u = this.rowElements.get(d ?? P);
|
|
1614
|
+
if (!u) continue;
|
|
1615
|
+
const m = u.querySelector(".scheduler-timeline-events");
|
|
1498
1616
|
if (!m) continue;
|
|
1499
1617
|
m.innerHTML = "";
|
|
1500
1618
|
const f = (this.state.eventsByResource.get(d) ?? []).filter(
|
|
1501
|
-
(b) => b.start <
|
|
1619
|
+
(b) => b.start < n && b.end > r
|
|
1502
1620
|
).map((b) => ({
|
|
1503
1621
|
id: b.id,
|
|
1504
1622
|
event: b,
|
|
@@ -1508,32 +1626,32 @@ class ye extends $ {
|
|
|
1508
1626
|
isEnd: !0,
|
|
1509
1627
|
dayIndex: 0,
|
|
1510
1628
|
totalDays: 1
|
|
1511
|
-
})),
|
|
1512
|
-
|
|
1513
|
-
for (const { part: b, trackIndex: M } of
|
|
1629
|
+
})), v = C.getTimelinedParts(f), y = v.reduce((b, M) => Math.max(b, M.totalTracks), 1), { height: w, gap: x, padding: I } = this.trackMetrics;
|
|
1630
|
+
u.style.minHeight = `${y * w + (y - 1) * x + 2 * I}px`;
|
|
1631
|
+
for (const { part: b, trackIndex: M } of v) {
|
|
1514
1632
|
if (!b.event) continue;
|
|
1515
|
-
const
|
|
1633
|
+
const H = this.createEventElement(
|
|
1516
1634
|
b.event,
|
|
1517
1635
|
M,
|
|
1518
|
-
|
|
1636
|
+
r,
|
|
1519
1637
|
a,
|
|
1520
1638
|
s.slotDuration ?? 1800,
|
|
1521
1639
|
c
|
|
1522
1640
|
);
|
|
1523
|
-
m.appendChild(
|
|
1641
|
+
m.appendChild(H);
|
|
1524
1642
|
}
|
|
1525
1643
|
}
|
|
1526
1644
|
}
|
|
1527
|
-
createEventElement(e, t, s, n, i
|
|
1645
|
+
createEventElement(e, t, s, r, n, i = null) {
|
|
1528
1646
|
const o = this.createElement("div", "scheduler-timeline-event"), a = this.state.selectedEvent?.id === e.id;
|
|
1529
1647
|
this.state.keyboardMoveEventId, e.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
|
|
1530
1648
|
"aria-label",
|
|
1531
|
-
|
|
1649
|
+
$(e, i, this.state.options)
|
|
1532
1650
|
), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
|
|
1533
|
-
const l = Math.max(e.start.getTime(), s.getTime()), d = s.getTime() + 10080 * 60 * 1e3, c = Math.min(e.end.getTime(), d),
|
|
1534
|
-
o.style.left = `${f}px`, o.style.width = `${
|
|
1535
|
-
const
|
|
1536
|
-
return b.textContent = e.title,
|
|
1651
|
+
const l = Math.max(e.start.getTime(), s.getTime()), d = s.getTime() + 10080 * 60 * 1e3, c = Math.min(e.end.getTime(), d), u = l - s.getTime(), m = c - l, g = d - s.getTime(), f = u / g * r, v = Math.max(m / g * r, 20), { height: y, gap: w, padding: x } = this.trackMetrics;
|
|
1652
|
+
o.style.left = `${f}px`, o.style.width = `${v}px`, o.style.top = `${x + t * (y + w)}px`, o.style.height = `${y}px`, this.applyEventColors(o, e), this.setData(o, { eventId: e.id });
|
|
1653
|
+
const I = this.createElement("div", "event-content"), b = this.createElement("div", "event-title");
|
|
1654
|
+
return b.textContent = e.title, I.appendChild(b), o.appendChild(I), this.appendResizeHandles(
|
|
1537
1655
|
o,
|
|
1538
1656
|
{
|
|
1539
1657
|
id: e.id,
|
|
@@ -1559,56 +1677,84 @@ class ye extends $ {
|
|
|
1559
1677
|
*/
|
|
1560
1678
|
renderPreviewEvent(e) {
|
|
1561
1679
|
this.container.querySelector(".scheduler-timeline-event.preview")?.remove();
|
|
1562
|
-
const { dragState: t, previewEvent: s, options:
|
|
1680
|
+
const { dragState: t, previewEvent: s, options: r } = this.state;
|
|
1563
1681
|
if (!s) return;
|
|
1564
|
-
const
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
this.state.selectionResourceId ?? this.state.focusedResourceId ?? void 0;
|
|
1570
|
-
if (!o) return;
|
|
1571
|
-
const l = this.rowElements.get(o)?.querySelector(".scheduler-timeline-events");
|
|
1572
|
-
if (!l) return;
|
|
1573
|
-
const c = h.getTimeSlots(
|
|
1682
|
+
const n = t?.event?.id ?? this.state.keyboardMoveEventId, i = this.previewRowKey();
|
|
1683
|
+
if (!i) return;
|
|
1684
|
+
const a = this.rowElements.get(i)?.querySelector(".scheduler-timeline-events");
|
|
1685
|
+
if (!a) return;
|
|
1686
|
+
const d = h.getTimeSlots(
|
|
1574
1687
|
e[0],
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
).length * 7 * this.slotWidth,
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1688
|
+
r.slotDuration,
|
|
1689
|
+
r.slotMinTime,
|
|
1690
|
+
r.slotMaxTime
|
|
1691
|
+
).length * 7 * this.slotWidth, c = e[0], u = c.getTime() + 10080 * 60 * 1e3, m = Math.max(s.start.getTime(), c.getTime()), g = Math.min(s.end.getTime(), u), f = u - c.getTime(), v = this.createElement("div", "scheduler-timeline-event", "preview");
|
|
1692
|
+
v.style.left = `${(m - c.getTime()) / f * d}px`, v.style.width = `${Math.max((g - m) / f * d, 20)}px`;
|
|
1693
|
+
const y = n ? (
|
|
1694
|
+
// dataset match rather than an attribute selector: event ids are
|
|
1695
|
+
// consumer-supplied and would need CSS escaping.
|
|
1696
|
+
Array.from(
|
|
1697
|
+
a.querySelectorAll(".scheduler-timeline-event:not(.preview)")
|
|
1698
|
+
).find((w) => w.dataset.eventId === n)
|
|
1699
|
+
) : void 0;
|
|
1700
|
+
if (y)
|
|
1701
|
+
v.style.top = y.style.top, v.style.height = y.style.height;
|
|
1702
|
+
else {
|
|
1703
|
+
const { height: w, padding: x } = this.trackMetrics;
|
|
1704
|
+
v.style.top = `${x}px`, v.style.height = `${w}px`;
|
|
1584
1705
|
}
|
|
1585
|
-
|
|
1706
|
+
a.appendChild(v);
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Which row a drag/preview is currently addressing.
|
|
1710
|
+
*
|
|
1711
|
+
* Precedence: the preview's own row (a MOVE tracks the pointer's row; a
|
|
1712
|
+
* move-mode Up/Down nudge writes it too — `null` meaning the bucket row) →
|
|
1713
|
+
* the dragged event's own row (a resize never changes rows, and its preview
|
|
1714
|
+
* deliberately carries none) → the row the gesture is happening in (a CREATE
|
|
1715
|
+
* has no source event; without this fallback a create-drag showed no
|
|
1716
|
+
* feedback at all).
|
|
1717
|
+
*
|
|
1718
|
+
* The dragged event is resolved from the NORMALIZED store, not
|
|
1719
|
+
* `resource.events` — that nested array stopped being a live mirror when the
|
|
1720
|
+
* model was normalized, so the old lookup found nothing for any event
|
|
1721
|
+
* supplied through the `events` input.
|
|
1722
|
+
*/
|
|
1723
|
+
previewRowKey() {
|
|
1724
|
+
const { dragState: e, previewEvent: t } = this.state;
|
|
1725
|
+
if (!t) return;
|
|
1726
|
+
if (t.resourceId !== void 0)
|
|
1727
|
+
return t.resourceId ?? P;
|
|
1728
|
+
const s = e?.event?.id ?? this.state.keyboardMoveEventId, r = s ? this.state.events.find((n) => n.id === s) : void 0;
|
|
1729
|
+
return r ? r.resourceId ?? P : this.state.selectionResourceId ?? this.state.focusedResourceId ?? void 0;
|
|
1586
1730
|
}
|
|
1587
1731
|
update(e) {
|
|
1588
|
-
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options),
|
|
1589
|
-
if (this.state = e, t || s ||
|
|
1732
|
+
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options), r = this.state.resources !== e.resources || this.state.collapsedGroups !== e.collapsedGroups || this.state.resolvedPermissions !== e.resolvedPermissions || this.hasUnassignedRow(this.state) !== this.hasUnassignedRow(e);
|
|
1733
|
+
if (this.state = e, t || s || r) {
|
|
1590
1734
|
this.render();
|
|
1591
1735
|
return;
|
|
1592
1736
|
}
|
|
1593
1737
|
this.updateGreyedSlots();
|
|
1594
|
-
const
|
|
1595
|
-
this.renderEvents(
|
|
1738
|
+
const n = h.getWeekDays(e.date, e.options.firstDayOfWeek);
|
|
1739
|
+
this.renderEvents(n), this.renderPreviewEvent(n), this.updateCellFocusAndSelection();
|
|
1596
1740
|
}
|
|
1597
1741
|
optionsRequireRerender(e, t) {
|
|
1598
1742
|
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;
|
|
1599
1743
|
}
|
|
1600
1744
|
updateGreyedSlots() {
|
|
1601
|
-
const { dragState: e, previewEvent: t } = this.state
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1745
|
+
const { dragState: e, previewEvent: t } = this.state;
|
|
1746
|
+
if (this.container.querySelectorAll(".scheduler-timeline-slot").forEach((i) => i.classList.remove("greyed")), this.container.querySelectorAll(".scheduler-timeline-row.drop-target").forEach((i) => i.classList.remove("drop-target")), !e || !t) return;
|
|
1747
|
+
const r = this.previewRowKey(), n = r ? this.rowElements.get(r) : void 0;
|
|
1748
|
+
n && (n.classList.add("drop-target"), n.querySelectorAll(".scheduler-timeline-slot").forEach((i) => {
|
|
1749
|
+
const o = new Date(i.dataset.start ?? ""), a = new Date(i.dataset.end ?? "");
|
|
1750
|
+
o < t.end && a > t.start && i.classList.add("greyed");
|
|
1751
|
+
}));
|
|
1606
1752
|
}
|
|
1607
1753
|
destroy() {
|
|
1608
|
-
this.rowElements.clear(), this.clearContainer();
|
|
1754
|
+
this.onColumnDragEnd(), this.rowElements.clear(), this.clearContainer();
|
|
1609
1755
|
}
|
|
1610
1756
|
}
|
|
1611
|
-
const
|
|
1757
|
+
const xe = J(`@charset "UTF-8";
|
|
1612
1758
|
/* Layering ladder. Nothing between :host and the events establishes a
|
|
1613
1759
|
stacking context, so every one of these competes in ONE shared context
|
|
1614
1760
|
across the whole shadow root — a selected event in one day column is
|
|
@@ -2237,11 +2383,18 @@ const be = Q(`@charset "UTF-8";
|
|
|
2237
2383
|
gap: 2px;
|
|
2238
2384
|
}
|
|
2239
2385
|
|
|
2386
|
+
.scheduler-day-popover .popover-event-row {
|
|
2387
|
+
display: flex;
|
|
2388
|
+
align-items: center;
|
|
2389
|
+
gap: 2px;
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2240
2392
|
.scheduler-day-popover .popover-event {
|
|
2241
2393
|
display: flex;
|
|
2242
2394
|
align-items: center;
|
|
2243
2395
|
gap: 8px;
|
|
2244
|
-
|
|
2396
|
+
flex: 1 1 auto;
|
|
2397
|
+
min-width: 0;
|
|
2245
2398
|
min-height: 28px;
|
|
2246
2399
|
padding: 4px 6px;
|
|
2247
2400
|
border: 1px solid transparent;
|
|
@@ -2253,6 +2406,27 @@ const be = Q(`@charset "UTF-8";
|
|
|
2253
2406
|
cursor: pointer;
|
|
2254
2407
|
}
|
|
2255
2408
|
|
|
2409
|
+
/* Per-row delete — a real sibling button (the row's event entry is itself a
|
|
2410
|
+
button, so nesting is not an option). 24px min target (SC 2.5.8). */
|
|
2411
|
+
.scheduler-day-popover .popover-event-delete {
|
|
2412
|
+
flex: 0 0 auto;
|
|
2413
|
+
min-width: 24px;
|
|
2414
|
+
min-height: 24px;
|
|
2415
|
+
padding: 0;
|
|
2416
|
+
border: 1px solid transparent;
|
|
2417
|
+
border-radius: 4px;
|
|
2418
|
+
background: transparent;
|
|
2419
|
+
color: var(--bs-secondary-color, #666);
|
|
2420
|
+
font: inherit;
|
|
2421
|
+
line-height: 1;
|
|
2422
|
+
cursor: pointer;
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
.scheduler-day-popover .popover-event-delete:hover {
|
|
2426
|
+
background: var(--bs-secondary-bg, rgba(0, 0, 0, 0.08));
|
|
2427
|
+
color: var(--bs-danger, #dc3545);
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2256
2430
|
.scheduler-day-popover .popover-event:hover {
|
|
2257
2431
|
background: var(--bs-secondary-bg, rgba(0, 0, 0, 0.08));
|
|
2258
2432
|
}
|
|
@@ -2272,6 +2446,45 @@ const be = Q(`@charset "UTF-8";
|
|
|
2272
2446
|
white-space: nowrap;
|
|
2273
2447
|
}
|
|
2274
2448
|
|
|
2449
|
+
/* Month scope (opened from a year card): a group per day, each with its own
|
|
2450
|
+
sub-list. The outer list keeps .popover-events so the scroll cap applies. */
|
|
2451
|
+
.scheduler-day-popover .popover-day-groups {
|
|
2452
|
+
max-height: 40vh;
|
|
2453
|
+
overflow-y: auto;
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
.scheduler-day-popover .popover-day-group {
|
|
2457
|
+
display: flex;
|
|
2458
|
+
flex-direction: column;
|
|
2459
|
+
gap: 2px;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
.scheduler-day-popover .popover-day-label {
|
|
2463
|
+
font-size: 11px;
|
|
2464
|
+
font-weight: 600;
|
|
2465
|
+
color: var(--bs-secondary-color, #666);
|
|
2466
|
+
margin-top: 4px;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
/* The create action's resource picker — present only when resources exist. */
|
|
2470
|
+
.scheduler-day-popover .popover-resource {
|
|
2471
|
+
display: flex;
|
|
2472
|
+
align-items: center;
|
|
2473
|
+
gap: 6px;
|
|
2474
|
+
margin: 0 0 8px;
|
|
2475
|
+
font-size: 12px;
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
/* \`<mp-select>\` renders the native \`<select>\` and Bootstrap's \`.form-select\`
|
|
2479
|
+
styling inside its OWN shadow root, so all that is left out here is how much
|
|
2480
|
+
room the host takes in the row. Nothing inside it is reachable from this
|
|
2481
|
+
stylesheet — and nothing needs to be. */
|
|
2482
|
+
.scheduler-day-popover .popover-resource-select {
|
|
2483
|
+
flex: 1 1 auto;
|
|
2484
|
+
min-width: 0;
|
|
2485
|
+
font-size: 12px;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2275
2488
|
.scheduler-day-popover .popover-actions {
|
|
2276
2489
|
display: flex;
|
|
2277
2490
|
flex-wrap: wrap;
|
|
@@ -2301,6 +2514,142 @@ const be = Q(`@charset "UTF-8";
|
|
|
2301
2514
|
outline-offset: 1px;
|
|
2302
2515
|
}
|
|
2303
2516
|
|
|
2517
|
+
/* Built-in event editor (R20/D12.8). Same containing-block rule as the day
|
|
2518
|
+
popover: a top-level shadow child, position written by the OverlayController. */
|
|
2519
|
+
.scheduler-event-editor {
|
|
2520
|
+
position: fixed;
|
|
2521
|
+
z-index: 20;
|
|
2522
|
+
min-width: 240px;
|
|
2523
|
+
max-width: min(320px, 90vw);
|
|
2524
|
+
max-height: 70vh;
|
|
2525
|
+
overflow-y: auto;
|
|
2526
|
+
padding: 8px;
|
|
2527
|
+
border: 1px solid var(--scheduler-border-color);
|
|
2528
|
+
border-radius: 6px;
|
|
2529
|
+
background: var(--bs-body-bg, #fff);
|
|
2530
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
.scheduler-event-editor .editor-head {
|
|
2534
|
+
display: flex;
|
|
2535
|
+
align-items: flex-start;
|
|
2536
|
+
justify-content: space-between;
|
|
2537
|
+
gap: 8px;
|
|
2538
|
+
margin-bottom: 6px;
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
.scheduler-event-editor .editor-title {
|
|
2542
|
+
font-weight: 600;
|
|
2543
|
+
overflow: hidden;
|
|
2544
|
+
text-overflow: ellipsis;
|
|
2545
|
+
white-space: nowrap;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
.scheduler-event-editor .editor-close {
|
|
2549
|
+
flex: 0 0 auto;
|
|
2550
|
+
min-width: 24px;
|
|
2551
|
+
min-height: 24px;
|
|
2552
|
+
padding: 0;
|
|
2553
|
+
border: 1px solid transparent;
|
|
2554
|
+
border-radius: 4px;
|
|
2555
|
+
background: transparent;
|
|
2556
|
+
color: inherit;
|
|
2557
|
+
font: inherit;
|
|
2558
|
+
line-height: 1;
|
|
2559
|
+
cursor: pointer;
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
.scheduler-event-editor .editor-field {
|
|
2563
|
+
display: flex;
|
|
2564
|
+
align-items: center;
|
|
2565
|
+
gap: 6px;
|
|
2566
|
+
margin: 0 0 6px;
|
|
2567
|
+
font-size: 12px;
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
.scheduler-event-editor .editor-field > span {
|
|
2571
|
+
flex: 0 0 40px;
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
/* The inputs carry Bootstrap's \`.form-control\` (+ \`-sm\`, and \`-color\` on the
|
|
2575
|
+
swatch), whose rules reach them through \`formControlStyles\` in this shadow
|
|
2576
|
+
root's \`adoptedStyleSheets\` — Bootstrap's page stylesheet cannot. So border,
|
|
2577
|
+
background, focus ring and disabled appearance are Bootstrap's; only the
|
|
2578
|
+
layout inside this panel is ours. \`.form-control\` already sets
|
|
2579
|
+
\`width: 100%\`, hence no \`flex: 1 1 auto\` here. */
|
|
2580
|
+
.scheduler-event-editor .editor-input {
|
|
2581
|
+
min-width: 0;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
.scheduler-event-editor .editor-color-input {
|
|
2585
|
+
flex: 0 0 auto;
|
|
2586
|
+
width: 40px;
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
/* The start/end fields are \`<mp-datetime-picker>\`s: input-group, popups and
|
|
2590
|
+
Bootstrap styling all live in their own shadow roots, so only the width they
|
|
2591
|
+
take in the row is ours to set. Their popups are \`position: fixed\` and
|
|
2592
|
+
escape this panel's bounds by design — do not add overflow/transform to the
|
|
2593
|
+
editor, which would clip them or become their containing block. */
|
|
2594
|
+
.scheduler-event-editor mp-datetime-picker.editor-input {
|
|
2595
|
+
flex: 1 1 auto;
|
|
2596
|
+
display: block;
|
|
2597
|
+
}
|
|
2598
|
+
|
|
2599
|
+
/* "Inherit from resource": the checkbox owns the colour's two states, so the
|
|
2600
|
+
swatch above is disabled while it is checked. Indented under the swatch it
|
|
2601
|
+
governs — past the 40px reserved for the other fields' names.
|
|
2602
|
+
|
|
2603
|
+
\`<mp-checkbox>\` brings its own \`.form-check\` markup, indicator and label
|
|
2604
|
+
inside its shadow root, which is the point of using it here: Bootstrap's
|
|
2605
|
+
form styles do not cross a shadow boundary, so a bare \`<input>\` in this
|
|
2606
|
+
panel would render unstyled. Nothing to size from out here. */
|
|
2607
|
+
.scheduler-event-editor .editor-inherit {
|
|
2608
|
+
margin-left: 46px;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
/* Validation messages render inside their own field via \`errorFeedback()\`, so
|
|
2612
|
+
\`invalidFeedbackStyles\` draws them; the panel only needs them to sit tight
|
|
2613
|
+
under the control rather than inherit the field's own row gap. */
|
|
2614
|
+
.scheduler-event-editor .invalid-feedback {
|
|
2615
|
+
margin-top: 2px;
|
|
2616
|
+
font-size: 12px;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
.scheduler-event-editor .editor-actions {
|
|
2620
|
+
display: flex;
|
|
2621
|
+
flex-wrap: wrap;
|
|
2622
|
+
gap: 4px;
|
|
2623
|
+
}
|
|
2624
|
+
|
|
2625
|
+
.scheduler-event-editor .editor-action {
|
|
2626
|
+
min-height: 28px;
|
|
2627
|
+
padding: 4px 10px;
|
|
2628
|
+
border: 1px solid var(--scheduler-border-color);
|
|
2629
|
+
border-radius: 4px;
|
|
2630
|
+
background: var(--bs-body-bg);
|
|
2631
|
+
color: inherit;
|
|
2632
|
+
font: inherit;
|
|
2633
|
+
font-size: 12px;
|
|
2634
|
+
cursor: pointer;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
.scheduler-event-editor .editor-action.primary {
|
|
2638
|
+
background: var(--bs-primary);
|
|
2639
|
+
border-color: var(--bs-primary);
|
|
2640
|
+
color: #fff;
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
.scheduler-event-editor .editor-action.danger {
|
|
2644
|
+
border-color: var(--bs-danger, #dc3545);
|
|
2645
|
+
color: var(--bs-danger, #dc3545);
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
.scheduler-event-editor :is(button, input, select):focus-visible {
|
|
2649
|
+
outline: 2px solid var(--bs-primary);
|
|
2650
|
+
outline-offset: 1px;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2304
2653
|
/* Year View */
|
|
2305
2654
|
.scheduler-year-grid {
|
|
2306
2655
|
display: grid;
|
|
@@ -2472,6 +2821,60 @@ const be = Q(`@charset "UTF-8";
|
|
|
2472
2821
|
font-weight: 600;
|
|
2473
2822
|
}
|
|
2474
2823
|
|
|
2824
|
+
/* The row a drag is currently addressing — the cross-row move's answer to
|
|
2825
|
+
"which resource will this land on?". A tint on the whole row, not only the
|
|
2826
|
+
greyed slots, so the target reads at a glance even when the time band is
|
|
2827
|
+
scrolled out of view. */
|
|
2828
|
+
.scheduler-timeline-row.drop-target {
|
|
2829
|
+
background: var(--scheduler-drop-target-bg, rgba(13, 110, 253, 0.06));
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
/* Resource-column resize separator (R15): the WAI-ARIA window splitter on the
|
|
2833
|
+
corner header's right edge. Inside the sticky corner cell, so it pins with
|
|
2834
|
+
the column it resizes. */
|
|
2835
|
+
.scheduler-resource-header {
|
|
2836
|
+
position: relative;
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
.scheduler-column-resizer {
|
|
2840
|
+
position: absolute;
|
|
2841
|
+
top: 0;
|
|
2842
|
+
right: -4px;
|
|
2843
|
+
width: 8px;
|
|
2844
|
+
height: 100%;
|
|
2845
|
+
cursor: col-resize;
|
|
2846
|
+
/* Above the neighbouring day headers so the whole 8px strip is grabbable. */
|
|
2847
|
+
z-index: 1;
|
|
2848
|
+
touch-action: none;
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
.scheduler-column-resizer:hover,
|
|
2852
|
+
.scheduler-column-resizer:focus-visible {
|
|
2853
|
+
background: var(--bs-primary);
|
|
2854
|
+
opacity: 0.35;
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
.scheduler-column-resizer:focus-visible {
|
|
2858
|
+
outline: 2px solid var(--bs-primary);
|
|
2859
|
+
outline-offset: 1px;
|
|
2860
|
+
opacity: 0.6;
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
/* Inline rename (R17): the input takes the title's place in the pinned cell.
|
|
2864
|
+
Bootstrap's \`.form-control.form-control-sm\` supplies the chrome (via this
|
|
2865
|
+
shadow root's adopted sheets); these rules only shrink it to fit a 40px row
|
|
2866
|
+
inside a 200px column, and keep the accent border that marks it as the
|
|
2867
|
+
active edit. Higher specificity than \`.form-control\`, so they win. */
|
|
2868
|
+
.scheduler-resource-cell .rename-input {
|
|
2869
|
+
flex: 1 1 auto;
|
|
2870
|
+
min-width: 0;
|
|
2871
|
+
min-height: 24px;
|
|
2872
|
+
height: 24px;
|
|
2873
|
+
padding: 1px 4px;
|
|
2874
|
+
border-color: var(--bs-primary);
|
|
2875
|
+
font-size: inherit;
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2475
2878
|
.scheduler-timeline-row.group .scheduler-resource-cell {
|
|
2476
2879
|
/* Sticky cells are transparent by default — a group row must keep its own
|
|
2477
2880
|
tint or slots slide visibly underneath the pinned column. */
|
|
@@ -2825,14 +3228,161 @@ const be = Q(`@charset "UTF-8";
|
|
|
2825
3228
|
animation: none !important;
|
|
2826
3229
|
transition: none !important;
|
|
2827
3230
|
}
|
|
2828
|
-
}`),
|
|
3231
|
+
}`), De = J(`.form-control {
|
|
3232
|
+
display: block;
|
|
3233
|
+
width: 100%;
|
|
3234
|
+
padding: 0.375rem 0.75rem;
|
|
3235
|
+
font-size: 1rem;
|
|
3236
|
+
font-weight: 400;
|
|
3237
|
+
line-height: 1.5;
|
|
3238
|
+
color: var(--bs-body-color);
|
|
3239
|
+
appearance: none;
|
|
3240
|
+
background-color: var(--bs-body-bg);
|
|
3241
|
+
background-clip: padding-box;
|
|
3242
|
+
border: var(--bs-border-width) solid var(--bs-border-color);
|
|
3243
|
+
border-radius: var(--bs-border-radius);
|
|
3244
|
+
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
|
3245
|
+
}
|
|
3246
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3247
|
+
.form-control {
|
|
3248
|
+
transition: none;
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
.form-control[type=file] {
|
|
3252
|
+
overflow: hidden;
|
|
3253
|
+
}
|
|
3254
|
+
.form-control[type=file]:not(:disabled):not([readonly]) {
|
|
3255
|
+
cursor: pointer;
|
|
3256
|
+
}
|
|
3257
|
+
.form-control:focus {
|
|
3258
|
+
color: var(--bs-body-color);
|
|
3259
|
+
background-color: var(--bs-body-bg);
|
|
3260
|
+
border-color: rgb(134, 182.5, 254);
|
|
3261
|
+
outline: 0;
|
|
3262
|
+
box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
|
|
3263
|
+
}
|
|
3264
|
+
.form-control::-webkit-date-and-time-value {
|
|
3265
|
+
min-width: 85px;
|
|
3266
|
+
height: 1.5em;
|
|
3267
|
+
margin: 0;
|
|
3268
|
+
}
|
|
3269
|
+
.form-control::-webkit-datetime-edit {
|
|
3270
|
+
display: block;
|
|
3271
|
+
padding: 0;
|
|
3272
|
+
}
|
|
3273
|
+
.form-control::placeholder {
|
|
3274
|
+
color: var(--bs-secondary-color);
|
|
3275
|
+
opacity: 1;
|
|
3276
|
+
}
|
|
3277
|
+
.form-control:disabled {
|
|
3278
|
+
background-color: var(--bs-secondary-bg);
|
|
3279
|
+
opacity: 1;
|
|
3280
|
+
}
|
|
3281
|
+
.form-control::file-selector-button {
|
|
3282
|
+
padding: 0.375rem 0.75rem;
|
|
3283
|
+
margin: -0.375rem -0.75rem;
|
|
3284
|
+
margin-inline-end: 0.75rem;
|
|
3285
|
+
color: var(--bs-body-color);
|
|
3286
|
+
background-color: var(--bs-tertiary-bg);
|
|
3287
|
+
pointer-events: none;
|
|
3288
|
+
border-color: inherit;
|
|
3289
|
+
border-style: solid;
|
|
3290
|
+
border-width: 0;
|
|
3291
|
+
border-inline-end-width: var(--bs-border-width);
|
|
3292
|
+
border-radius: 0;
|
|
3293
|
+
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
|
3294
|
+
}
|
|
3295
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3296
|
+
.form-control::file-selector-button {
|
|
3297
|
+
transition: none;
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
|
+
.form-control:hover:not(:disabled):not([readonly])::file-selector-button {
|
|
3301
|
+
background-color: var(--bs-secondary-bg);
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3304
|
+
.form-control-plaintext {
|
|
3305
|
+
display: block;
|
|
3306
|
+
width: 100%;
|
|
3307
|
+
padding: 0.375rem 0;
|
|
3308
|
+
margin-bottom: 0;
|
|
3309
|
+
line-height: 1.5;
|
|
3310
|
+
color: var(--bs-body-color);
|
|
3311
|
+
background-color: transparent;
|
|
3312
|
+
border: solid transparent;
|
|
3313
|
+
border-width: var(--bs-border-width) 0;
|
|
3314
|
+
}
|
|
3315
|
+
.form-control-plaintext:focus {
|
|
3316
|
+
outline: 0;
|
|
3317
|
+
}
|
|
3318
|
+
.form-control-plaintext.form-control-sm, .form-control-plaintext.form-control-lg {
|
|
3319
|
+
padding-right: 0;
|
|
3320
|
+
padding-left: 0;
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
.form-control-sm {
|
|
3324
|
+
min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
|
|
3325
|
+
padding: 0.25rem 0.5rem;
|
|
3326
|
+
font-size: 0.875rem;
|
|
3327
|
+
border-radius: var(--bs-border-radius-sm);
|
|
3328
|
+
}
|
|
3329
|
+
.form-control-sm::file-selector-button {
|
|
3330
|
+
padding: 0.25rem 0.5rem;
|
|
3331
|
+
margin: -0.25rem -0.5rem;
|
|
3332
|
+
margin-inline-end: 0.5rem;
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3335
|
+
.form-control-lg {
|
|
3336
|
+
min-height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
|
|
3337
|
+
padding: 0.5rem 1rem;
|
|
3338
|
+
font-size: 1.25rem;
|
|
3339
|
+
border-radius: var(--bs-border-radius-lg);
|
|
3340
|
+
}
|
|
3341
|
+
.form-control-lg::file-selector-button {
|
|
3342
|
+
padding: 0.5rem 1rem;
|
|
3343
|
+
margin: -0.5rem -1rem;
|
|
3344
|
+
margin-inline-end: 1rem;
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
textarea.form-control {
|
|
3348
|
+
min-height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2));
|
|
3349
|
+
}
|
|
3350
|
+
textarea.form-control-sm {
|
|
3351
|
+
min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
|
|
3352
|
+
}
|
|
3353
|
+
textarea.form-control-lg {
|
|
3354
|
+
min-height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
.form-control-color {
|
|
3358
|
+
width: 3rem;
|
|
3359
|
+
height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2));
|
|
3360
|
+
padding: 0.375rem;
|
|
3361
|
+
}
|
|
3362
|
+
.form-control-color:not(:disabled):not([readonly]) {
|
|
3363
|
+
cursor: pointer;
|
|
3364
|
+
}
|
|
3365
|
+
.form-control-color::-moz-color-swatch {
|
|
3366
|
+
border: 0 !important;
|
|
3367
|
+
border-radius: var(--bs-border-radius);
|
|
3368
|
+
}
|
|
3369
|
+
.form-control-color::-webkit-color-swatch {
|
|
3370
|
+
border: 0 !important;
|
|
3371
|
+
border-radius: var(--bs-border-radius);
|
|
3372
|
+
}
|
|
3373
|
+
.form-control-color.form-control-sm {
|
|
3374
|
+
height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
|
|
3375
|
+
}
|
|
3376
|
+
.form-control-color.form-control-lg {
|
|
3377
|
+
height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
|
|
3378
|
+
}`), _ = {
|
|
2829
3379
|
dragThreshold: 5,
|
|
2830
3380
|
minDurationMs: 1800 * 1e3
|
|
2831
3381
|
// 30 minutes
|
|
2832
3382
|
};
|
|
2833
|
-
class
|
|
3383
|
+
class Se {
|
|
2834
3384
|
constructor(e = {}) {
|
|
2835
|
-
this.config = { ...
|
|
3385
|
+
this.config = { ..._, ...e };
|
|
2836
3386
|
}
|
|
2837
3387
|
/**
|
|
2838
3388
|
* Calculate the preview event position based on drag state.
|
|
@@ -2843,16 +3393,16 @@ class we {
|
|
|
2843
3393
|
* @param originalEvent - The original event being moved/resized (null for create)
|
|
2844
3394
|
* @returns The preview event with new start/end, or null if invalid
|
|
2845
3395
|
*/
|
|
2846
|
-
calculatePreview(e, t, s,
|
|
3396
|
+
calculatePreview(e, t, s, r) {
|
|
2847
3397
|
switch (e) {
|
|
2848
3398
|
case "create":
|
|
2849
3399
|
return this.calculateCreatePreview(t, s);
|
|
2850
3400
|
case "move":
|
|
2851
|
-
return
|
|
3401
|
+
return r ? this.calculateMovePreview(t, s, r) : null;
|
|
2852
3402
|
case "resize-start":
|
|
2853
|
-
return
|
|
3403
|
+
return r ? this.calculateResizeStartPreview(s, r) : null;
|
|
2854
3404
|
case "resize-end":
|
|
2855
|
-
return
|
|
3405
|
+
return r ? this.calculateResizeEndPreview(s, r) : null;
|
|
2856
3406
|
default:
|
|
2857
3407
|
return null;
|
|
2858
3408
|
}
|
|
@@ -2864,13 +3414,13 @@ class we {
|
|
|
2864
3414
|
calculateCreatePreview(e, t) {
|
|
2865
3415
|
const s = new Date(
|
|
2866
3416
|
Math.min(e.start.getTime(), t.start.getTime())
|
|
2867
|
-
),
|
|
3417
|
+
), r = new Date(
|
|
2868
3418
|
Math.max(e.end.getTime(), t.end.getTime())
|
|
2869
3419
|
);
|
|
2870
3420
|
return {
|
|
2871
3421
|
start: s,
|
|
2872
|
-
end:
|
|
2873
|
-
...e.resourceId ? { resourceId: e.resourceId } : {}
|
|
3422
|
+
end: r,
|
|
3423
|
+
...e.resourceId !== void 0 ? { resourceId: e.resourceId } : {}
|
|
2874
3424
|
};
|
|
2875
3425
|
}
|
|
2876
3426
|
/**
|
|
@@ -2878,8 +3428,12 @@ class we {
|
|
|
2878
3428
|
* Preserves event duration, applies offset from drag start.
|
|
2879
3429
|
*/
|
|
2880
3430
|
calculateMovePreview(e, t, s) {
|
|
2881
|
-
const
|
|
2882
|
-
return {
|
|
3431
|
+
const r = t.start.getTime() - e.start.getTime(), n = s.end.getTime() - s.start.getTime(), i = new Date(s.start.getTime() + r), o = new Date(i.getTime() + n), a = t.resourceId !== void 0 ? t.resourceId : s.resourceId;
|
|
3432
|
+
return {
|
|
3433
|
+
start: i,
|
|
3434
|
+
end: o,
|
|
3435
|
+
...a !== void 0 ? { resourceId: a } : {}
|
|
3436
|
+
};
|
|
2883
3437
|
}
|
|
2884
3438
|
/**
|
|
2885
3439
|
* Calculate preview for resizing event start.
|
|
@@ -2898,42 +3452,42 @@ class we {
|
|
|
2898
3452
|
* Enforces minimum duration.
|
|
2899
3453
|
*/
|
|
2900
3454
|
calculateResizeEndPreview(e, t) {
|
|
2901
|
-
const s = t.start.getTime() + this.config.minDurationMs,
|
|
3455
|
+
const s = t.start.getTime() + this.config.minDurationMs, r = new Date(
|
|
2902
3456
|
Math.max(e.end.getTime(), s)
|
|
2903
3457
|
);
|
|
2904
|
-
return { start: t.start, end:
|
|
3458
|
+
return { start: t.start, end: r };
|
|
2905
3459
|
}
|
|
2906
3460
|
}
|
|
2907
|
-
function
|
|
3461
|
+
function O(p) {
|
|
2908
3462
|
return {
|
|
2909
3463
|
pointerId: 0,
|
|
2910
3464
|
pointerType: "mouse",
|
|
2911
|
-
clientX:
|
|
2912
|
-
clientY:
|
|
2913
|
-
originalEvent:
|
|
2914
|
-
target:
|
|
3465
|
+
clientX: p.clientX,
|
|
3466
|
+
clientY: p.clientY,
|
|
3467
|
+
originalEvent: p,
|
|
3468
|
+
target: p.target,
|
|
2915
3469
|
isPrimary: !0
|
|
2916
3470
|
};
|
|
2917
3471
|
}
|
|
2918
|
-
function
|
|
2919
|
-
const e =
|
|
3472
|
+
function q(p) {
|
|
3473
|
+
const e = p.touches[0] || p.changedTouches[0];
|
|
2920
3474
|
return e ? {
|
|
2921
3475
|
pointerId: e.identifier,
|
|
2922
3476
|
pointerType: "touch",
|
|
2923
3477
|
clientX: e.clientX,
|
|
2924
3478
|
clientY: e.clientY,
|
|
2925
|
-
originalEvent:
|
|
3479
|
+
originalEvent: p,
|
|
2926
3480
|
target: e.target,
|
|
2927
3481
|
isPrimary: e.identifier === 0
|
|
2928
3482
|
} : null;
|
|
2929
3483
|
}
|
|
2930
|
-
function
|
|
2931
|
-
const t = e.x -
|
|
3484
|
+
function se(p, e) {
|
|
3485
|
+
const t = e.x - p.x, s = e.y - p.y;
|
|
2932
3486
|
return Math.sqrt(t * t + s * s);
|
|
2933
3487
|
}
|
|
2934
|
-
class
|
|
3488
|
+
class Ce {
|
|
2935
3489
|
constructor(e = {}) {
|
|
2936
|
-
this.state = { phase: "idle" }, this.config = { ...
|
|
3490
|
+
this.state = { phase: "idle" }, this.config = { ..._, ...e }, this.previewCalculator = new Se(this.config);
|
|
2937
3491
|
}
|
|
2938
3492
|
/**
|
|
2939
3493
|
* Get current state (read-only).
|
|
@@ -3026,14 +3580,14 @@ class Ee {
|
|
|
3026
3580
|
transitionFromIdle(e) {
|
|
3027
3581
|
if (e.type !== "POINTER_DOWN")
|
|
3028
3582
|
return this.state;
|
|
3029
|
-
const { target: t, position: s, slot:
|
|
3583
|
+
const { target: t, position: s, slot: r, slotElement: n, immediate: i } = e, o = this.getOperationType(t);
|
|
3030
3584
|
if (!o)
|
|
3031
3585
|
return this.state;
|
|
3032
3586
|
const a = t.event ?? null;
|
|
3033
3587
|
if (a && a.draggable === !1)
|
|
3034
3588
|
return this.state;
|
|
3035
|
-
if (
|
|
3036
|
-
let l =
|
|
3589
|
+
if (i) {
|
|
3590
|
+
let l = r;
|
|
3037
3591
|
if (!l && a && (l = {
|
|
3038
3592
|
start: a.start,
|
|
3039
3593
|
end: a.end
|
|
@@ -3061,8 +3615,8 @@ class Ee {
|
|
|
3061
3615
|
operationType: o,
|
|
3062
3616
|
event: a,
|
|
3063
3617
|
startPosition: s,
|
|
3064
|
-
startSlot:
|
|
3065
|
-
slotElement:
|
|
3618
|
+
startSlot: r,
|
|
3619
|
+
slotElement: n
|
|
3066
3620
|
};
|
|
3067
3621
|
}
|
|
3068
3622
|
/**
|
|
@@ -3072,7 +3626,7 @@ class Ee {
|
|
|
3072
3626
|
if (this.state.phase !== "pending") return this.state;
|
|
3073
3627
|
switch (e.type) {
|
|
3074
3628
|
case "POINTER_MOVE":
|
|
3075
|
-
return
|
|
3629
|
+
return se(
|
|
3076
3630
|
this.state.startPosition,
|
|
3077
3631
|
e.position
|
|
3078
3632
|
) < this.config.dragThreshold ? this.state : this.activateDrag(e.slot);
|
|
@@ -3146,19 +3700,19 @@ class Ee {
|
|
|
3146
3700
|
const t = this.state.startSlot ?? e;
|
|
3147
3701
|
if (!t)
|
|
3148
3702
|
return { phase: "idle" };
|
|
3149
|
-
const s = e ?? t,
|
|
3703
|
+
const s = e ?? t, r = this.previewCalculator.calculatePreview(
|
|
3150
3704
|
this.state.operationType,
|
|
3151
3705
|
t,
|
|
3152
3706
|
s,
|
|
3153
3707
|
this.state.event
|
|
3154
3708
|
);
|
|
3155
|
-
return
|
|
3709
|
+
return r ? {
|
|
3156
3710
|
phase: "active",
|
|
3157
3711
|
operationType: this.state.operationType,
|
|
3158
3712
|
event: this.state.event,
|
|
3159
3713
|
startSlot: t,
|
|
3160
3714
|
currentSlot: s,
|
|
3161
|
-
preview:
|
|
3715
|
+
preview: r,
|
|
3162
3716
|
originalEvent: this.state.event ?? void 0
|
|
3163
3717
|
} : { phase: "idle" };
|
|
3164
3718
|
}
|
|
@@ -3190,9 +3744,9 @@ class Ee {
|
|
|
3190
3744
|
} : { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date() };
|
|
3191
3745
|
}
|
|
3192
3746
|
}
|
|
3193
|
-
class
|
|
3747
|
+
class ke {
|
|
3194
3748
|
constructor(e, t = {}) {
|
|
3195
|
-
this.pendingUpdate = null, this.latestPointer = null, this.getSlotAtPosition = null, this.stateManager = e, this.config = { ...
|
|
3749
|
+
this.pendingUpdate = null, this.latestPointer = null, this.getSlotAtPosition = null, this.stateManager = e, this.config = { ..._, ...t }, this.stateMachine = new Ce(this.config);
|
|
3196
3750
|
}
|
|
3197
3751
|
/**
|
|
3198
3752
|
* Set the function used to get a slot at a position.
|
|
@@ -3206,12 +3760,12 @@ class xe {
|
|
|
3206
3760
|
* @param immediate If true, skip pending state (for touch-initiated drags)
|
|
3207
3761
|
*/
|
|
3208
3762
|
handlePointerDown(e, t, s = !1) {
|
|
3209
|
-
const
|
|
3763
|
+
const r = this.getSlotAtPosition?.(e.clientX, e.clientY) ?? null;
|
|
3210
3764
|
this.stateMachine.send({
|
|
3211
3765
|
type: "POINTER_DOWN",
|
|
3212
3766
|
target: t,
|
|
3213
3767
|
position: { x: e.clientX, y: e.clientY },
|
|
3214
|
-
slot:
|
|
3768
|
+
slot: r,
|
|
3215
3769
|
slotElement: t.slotElement,
|
|
3216
3770
|
immediate: s
|
|
3217
3771
|
}), this.stateMachine.isActive() && this.syncToStateManager();
|
|
@@ -3283,7 +3837,7 @@ class xe {
|
|
|
3283
3837
|
*/
|
|
3284
3838
|
createEventFromResult(e) {
|
|
3285
3839
|
return {
|
|
3286
|
-
id:
|
|
3840
|
+
id: le(),
|
|
3287
3841
|
title: "New Event",
|
|
3288
3842
|
start: e.preview.start,
|
|
3289
3843
|
end: e.preview.end,
|
|
@@ -3336,8 +3890,8 @@ class xe {
|
|
|
3336
3890
|
this.pendingUpdate !== null && (cancelAnimationFrame(this.pendingUpdate), this.pendingUpdate = null), this.latestPointer = null;
|
|
3337
3891
|
}
|
|
3338
3892
|
}
|
|
3339
|
-
const
|
|
3340
|
-
class
|
|
3893
|
+
const Me = 600, Te = 10;
|
|
3894
|
+
class Ie {
|
|
3341
3895
|
constructor(e, t) {
|
|
3342
3896
|
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);
|
|
3343
3897
|
}
|
|
@@ -3371,9 +3925,9 @@ class Ce {
|
|
|
3371
3925
|
analyzeTarget(e) {
|
|
3372
3926
|
const t = e.closest(".resize-handle");
|
|
3373
3927
|
if (t) {
|
|
3374
|
-
const
|
|
3928
|
+
const i = t.closest(
|
|
3375
3929
|
".scheduler-event, .scheduler-timeline-event"
|
|
3376
|
-
)?.dataset.eventId, o =
|
|
3930
|
+
)?.dataset.eventId, o = i ? this.config.getEventById(i) : null;
|
|
3377
3931
|
if (o)
|
|
3378
3932
|
return {
|
|
3379
3933
|
type: "resize-handle",
|
|
@@ -3385,35 +3939,35 @@ class Ce {
|
|
|
3385
3939
|
".scheduler-event:not(.preview), .scheduler-timeline-event:not(.preview)"
|
|
3386
3940
|
);
|
|
3387
3941
|
if (s) {
|
|
3388
|
-
const
|
|
3389
|
-
if (
|
|
3390
|
-
return { type: "event", event:
|
|
3942
|
+
const n = s.dataset.eventId, i = n ? this.config.getEventById(n) : null;
|
|
3943
|
+
if (i)
|
|
3944
|
+
return { type: "event", event: i };
|
|
3391
3945
|
}
|
|
3392
|
-
const
|
|
3946
|
+
const r = e.closest(
|
|
3393
3947
|
".scheduler-time-slot, .scheduler-timeline-slot"
|
|
3394
3948
|
);
|
|
3395
|
-
return
|
|
3949
|
+
return r ? { type: "slot", slotElement: r } : { type: "none" };
|
|
3396
3950
|
}
|
|
3397
3951
|
// Mouse event handlers
|
|
3398
3952
|
handleMouseDown(e) {
|
|
3399
3953
|
if (!this.config.isEditable()) return;
|
|
3400
|
-
const t =
|
|
3954
|
+
const t = O(e), s = this.analyzeTarget(t.target);
|
|
3401
3955
|
s.type !== "none" && (s.type === "slot" && !this.config.isSelectable() || (e.preventDefault(), this.callbacks.onPointerDown(t, s)));
|
|
3402
3956
|
}
|
|
3403
3957
|
handleMouseMove(e) {
|
|
3404
|
-
const t =
|
|
3958
|
+
const t = O(e);
|
|
3405
3959
|
this.callbacks.onPointerMove(t);
|
|
3406
3960
|
}
|
|
3407
3961
|
handleMouseUp(e) {
|
|
3408
|
-
const t =
|
|
3962
|
+
const t = O(e);
|
|
3409
3963
|
this.callbacks.onPointerUp(t);
|
|
3410
3964
|
}
|
|
3411
3965
|
handleClick(e) {
|
|
3412
|
-
const t =
|
|
3966
|
+
const t = O(e), s = this.analyzeTarget(t.target);
|
|
3413
3967
|
s.type === "event" || s.type === "resize-handle" || this.callbacks.onClick(t, s);
|
|
3414
3968
|
}
|
|
3415
3969
|
handleDblClick(e) {
|
|
3416
|
-
const t =
|
|
3970
|
+
const t = O(e), s = this.analyzeTarget(t.target);
|
|
3417
3971
|
this.callbacks.onDoubleClick(t, s);
|
|
3418
3972
|
}
|
|
3419
3973
|
// Touch event handlers
|
|
@@ -3423,42 +3977,42 @@ class Ce {
|
|
|
3423
3977
|
this.cancelTouchHold();
|
|
3424
3978
|
return;
|
|
3425
3979
|
}
|
|
3426
|
-
const t =
|
|
3980
|
+
const t = q(e);
|
|
3427
3981
|
if (!t) return;
|
|
3428
3982
|
const s = this.analyzeTarget(t.target);
|
|
3429
3983
|
if (s.type === "none" || s.type === "slot" && !this.config.isSelectable()) return;
|
|
3430
3984
|
this.touchStartPosition = { x: t.clientX, y: t.clientY }, this.touchHoldTarget = t.target, this.touchHoldPointer = t, this.panStartedOnEvent = s.type === "event" || s.type === "resize-handle";
|
|
3431
|
-
const
|
|
3432
|
-
if (
|
|
3433
|
-
|
|
3434
|
-
}, { passive: !1 }),
|
|
3435
|
-
|
|
3436
|
-
}),
|
|
3437
|
-
|
|
3985
|
+
const r = this, n = e.target;
|
|
3986
|
+
if (n.addEventListener("touchmove", function(o) {
|
|
3987
|
+
r.handleTouchMove(o);
|
|
3988
|
+
}, { passive: !1 }), n.addEventListener("touchend", function(o) {
|
|
3989
|
+
r.handleTouchEnd(o);
|
|
3990
|
+
}), n.addEventListener("touchcancel", function(o) {
|
|
3991
|
+
r.handleTouchCancel(o);
|
|
3438
3992
|
}), s.type === "resize-handle" && s.event && this.config.isEventSelected?.(s.event.id)) {
|
|
3439
3993
|
this.activateTouchDragMode(t, s);
|
|
3440
3994
|
return;
|
|
3441
3995
|
}
|
|
3442
3996
|
this.addTouchFeedback(t.target, "pending");
|
|
3443
|
-
const
|
|
3997
|
+
const i = this.config.touchHoldDuration ?? Me;
|
|
3444
3998
|
this.touchHoldTimer = setTimeout(() => {
|
|
3445
3999
|
this.activateTouchDragMode(t, s);
|
|
3446
|
-
},
|
|
4000
|
+
}, i);
|
|
3447
4001
|
}
|
|
3448
4002
|
handleTouchMove(e) {
|
|
3449
4003
|
if (e.touches.length !== 1) {
|
|
3450
4004
|
this.cancelTouchHold(), this.exitPanMode();
|
|
3451
4005
|
return;
|
|
3452
4006
|
}
|
|
3453
|
-
const t =
|
|
4007
|
+
const t = q(e);
|
|
3454
4008
|
if (t) {
|
|
3455
4009
|
if (this.isPanMode) {
|
|
3456
4010
|
e.preventDefault(), this.performPan(t.clientX, t.clientY);
|
|
3457
4011
|
return;
|
|
3458
4012
|
}
|
|
3459
4013
|
if (this.touchHoldTimer && this.touchStartPosition) {
|
|
3460
|
-
const s = this.config.touchMoveThreshold ??
|
|
3461
|
-
if (
|
|
4014
|
+
const s = this.config.touchMoveThreshold ?? Te;
|
|
4015
|
+
if (se(this.touchStartPosition, {
|
|
3462
4016
|
x: t.clientX,
|
|
3463
4017
|
y: t.clientY
|
|
3464
4018
|
}) > s) {
|
|
@@ -3472,7 +4026,7 @@ class Ce {
|
|
|
3472
4026
|
}
|
|
3473
4027
|
}
|
|
3474
4028
|
handleTouchEnd(e) {
|
|
3475
|
-
const t =
|
|
4029
|
+
const t = q(e);
|
|
3476
4030
|
if (this.isPanMode) {
|
|
3477
4031
|
this.exitPanMode();
|
|
3478
4032
|
return;
|
|
@@ -3535,8 +4089,8 @@ class Ce {
|
|
|
3535
4089
|
if (!this.isPanMode || !this.panStartPosition || !this.panStartScroll) return;
|
|
3536
4090
|
const s = this.callbacks.getScrollContainer?.();
|
|
3537
4091
|
if (!s) return;
|
|
3538
|
-
const
|
|
3539
|
-
s.scrollLeft = this.panStartScroll.left +
|
|
4092
|
+
const r = this.panStartPosition.x - e, n = this.panStartPosition.y - t;
|
|
4093
|
+
s.scrollLeft = this.panStartScroll.left + r, s.scrollTop = this.panStartScroll.top + n;
|
|
3540
4094
|
}
|
|
3541
4095
|
// Scroll blocking helpers
|
|
3542
4096
|
applyScrollBlock() {
|
|
@@ -3553,7 +4107,7 @@ class Ce {
|
|
|
3553
4107
|
e && e.classList.remove("scroll-blocked");
|
|
3554
4108
|
}
|
|
3555
4109
|
}
|
|
3556
|
-
class
|
|
4110
|
+
class Ae {
|
|
3557
4111
|
constructor(e) {
|
|
3558
4112
|
this.host = e;
|
|
3559
4113
|
}
|
|
@@ -3590,8 +4144,8 @@ class Me {
|
|
|
3590
4144
|
* the scheduler does not mutate its internal events list — the consumer
|
|
3591
4145
|
* receives the range and decides whether to construct an event from it.
|
|
3592
4146
|
*/
|
|
3593
|
-
emitEventCreate(e, t, s,
|
|
3594
|
-
this.emit({ type: "event-create", range: e, view: t, resourceId:
|
|
4147
|
+
emitEventCreate(e, t, s, r) {
|
|
4148
|
+
this.emit({ type: "event-create", range: e, view: t, resourceId: r, originalEvent: s });
|
|
3595
4149
|
}
|
|
3596
4150
|
/**
|
|
3597
4151
|
* Emit an event-update event.
|
|
@@ -3622,8 +4176,8 @@ class Me {
|
|
|
3622
4176
|
* the time-range selection — either may be null. Fires on every transition
|
|
3623
4177
|
* so consumers can react to the selection clearing without polling.
|
|
3624
4178
|
*/
|
|
3625
|
-
emitSelectionChange(e, t, s,
|
|
3626
|
-
this.emit({ type: "selection-change", selectedEvent: e, range: t, view: s, resourceId:
|
|
4179
|
+
emitSelectionChange(e, t, s, r) {
|
|
4180
|
+
this.emit({ type: "selection-change", selectedEvent: e, range: t, view: s, resourceId: r });
|
|
3627
4181
|
}
|
|
3628
4182
|
/**
|
|
3629
4183
|
* Emit a `resource-create` or `group-create` *request*. Same controlled
|
|
@@ -3631,10 +4185,10 @@ class Me {
|
|
|
3631
4185
|
* input, so the consumer decides the id, title and placement. `parentId` is
|
|
3632
4186
|
* the group to insert into — absent means root level.
|
|
3633
4187
|
*/
|
|
3634
|
-
emitResourceCreate(e, t, s,
|
|
4188
|
+
emitResourceCreate(e, t, s, r) {
|
|
3635
4189
|
this.emit({
|
|
3636
4190
|
type: e === "group" ? "group-create" : "resource-create",
|
|
3637
|
-
parentId:
|
|
4191
|
+
parentId: r,
|
|
3638
4192
|
view: t,
|
|
3639
4193
|
originalEvent: s
|
|
3640
4194
|
});
|
|
@@ -3653,9 +4207,10 @@ class Me {
|
|
|
3653
4207
|
this.emit({ type: "resource-delete", resource: e, originalEvent: t });
|
|
3654
4208
|
}
|
|
3655
4209
|
}
|
|
3656
|
-
|
|
4210
|
+
let Re = 0;
|
|
4211
|
+
class F extends re {
|
|
3657
4212
|
constructor() {
|
|
3658
|
-
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
|
|
4213
|
+
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 ne(this), this.popoverDate = null, this.popoverScope = "day", this.popoverAnchorId = null, this.dayPopover = new Y(this, {
|
|
3659
4214
|
anchor: () => this.popoverAnchorCell(),
|
|
3660
4215
|
// Same element as the anchor: the day cell IS the trigger. Spelling it out
|
|
3661
4216
|
// means focus returns to the day even when the popover was opened without
|
|
@@ -3674,12 +4229,23 @@ class I extends ee {
|
|
|
3674
4229
|
// Dismissal comes from the controller (Escape via the dismiss stack, outside
|
|
3675
4230
|
// mousedown), so mirror it into our own state or the panel stays rendered.
|
|
3676
4231
|
onClose: () => {
|
|
3677
|
-
this.popoverDate = null, this.
|
|
4232
|
+
this.popoverDate = null, this.popoverAnchorId = null, this.requestUpdate();
|
|
4233
|
+
}
|
|
4234
|
+
}), this.editorEventId = null, this.editorError = null, this.editorTitleErrorId = `mp-scheduler-${++Re}-editor-title-error`, this.eventEditorOverlay = new Y(this, {
|
|
4235
|
+
anchor: () => this.eventElementById(this.editorEventId),
|
|
4236
|
+
trigger: () => this.eventElementById(this.editorEventId),
|
|
4237
|
+
panel: () => this.shadowRoot?.querySelector(".scheduler-event-editor") ?? null,
|
|
4238
|
+
initialFocus: () => this.shadowRoot?.querySelector(
|
|
4239
|
+
".scheduler-event-editor input:not([disabled])"
|
|
4240
|
+
) ?? this.shadowRoot?.querySelector(".scheduler-event-editor .editor-action") ?? null,
|
|
4241
|
+
modal: !1,
|
|
4242
|
+
onClose: () => {
|
|
4243
|
+
this.editorEventId = null, this.editorError = null, this.editorDraft = null, this.requestUpdate();
|
|
3678
4244
|
}
|
|
3679
|
-
}), this.headerResizeObserver = null, this.headerIsNarrow = !1, this.previousIsLoading = null, this.edgeScrollFrame = null, this.edgeScrollVector = { x: 0, y: 0 }, this.edgeScrollPointer = null, this.lastEventActivation = null, this.keyboardMove = null, this.stateManager = new
|
|
4245
|
+
}), this.editorDraft = null, this.headerResizeObserver = null, this.headerIsNarrow = !1, this.previousIsLoading = null, this.edgeScrollFrame = null, this.edgeScrollVector = { x: 0, y: 0 }, this.edgeScrollPointer = null, this.lastEventActivation = null, this.keyboardMove = null, this.stateManager = new pe(), this.eventEmitter = new Ae(this), this.dragManager = new ke(this.stateManager), this.dragManager.setSlotResolver((e, t) => this.getSlotAtPosition(e, t)), this.boundHandleKeyDown = this.handleKeyDown.bind(this), this.boundHandleFocusIn = this.handleFocusIn.bind(this), this.boundHandleValueChange = this.handleValueChange.bind(this), this.boundHandleContextMenu = this.handleContextMenu.bind(this), this.boundHandleDblClick = this.handleNativeDblClick.bind(this), this.boundRepositionPopover = () => this.dayPopover.position(), this.boundRepositionEditor = () => this.eventEditorOverlay.position(), this.stateManager.subscribe((e) => this.onStateChange(e));
|
|
3680
4246
|
}
|
|
3681
4247
|
static {
|
|
3682
|
-
this.styles = [
|
|
4248
|
+
this.styles = [De, de, xe];
|
|
3683
4249
|
}
|
|
3684
4250
|
static get observedAttributes() {
|
|
3685
4251
|
return [
|
|
@@ -3687,6 +4253,7 @@ class I extends ee {
|
|
|
3687
4253
|
"view",
|
|
3688
4254
|
"date",
|
|
3689
4255
|
"locale",
|
|
4256
|
+
"event-editor",
|
|
3690
4257
|
"first-day-of-week",
|
|
3691
4258
|
"slot-duration",
|
|
3692
4259
|
"time-format",
|
|
@@ -3697,7 +4264,7 @@ class I extends ee {
|
|
|
3697
4264
|
super.connectedCallback(), this.inputHandler && this.inputHandler.attach(), this.syncPermissions(), this.addEventListener("keydown", this.boundHandleKeyDown), this.startNowIndicatorTimer();
|
|
3698
4265
|
}
|
|
3699
4266
|
disconnectedCallback() {
|
|
3700
|
-
this.inputHandler?.detach(), this.removeEventListener("keydown", this.boundHandleKeyDown), this.shadowRoot?.removeEventListener("focusin", this.boundHandleFocusIn), this.shadowRoot?.removeEventListener("change", this.boundHandleValueChange), this.currentView?.destroy(), this.dragManager.destroy(), this.stopNowIndicatorTimer(), this.headerResizeObserver?.disconnect(), this.headerResizeObserver = null, this.stopEdgeScroll(), this.pendingDragUpdate !== null && (cancelAnimationFrame(this.pendingDragUpdate), this.pendingDragUpdate = null), this.latestDragState = null, super.disconnectedCallback();
|
|
4267
|
+
this.inputHandler?.detach(), this.removeEventListener("keydown", this.boundHandleKeyDown), this.shadowRoot?.removeEventListener("focusin", this.boundHandleFocusIn), this.shadowRoot?.removeEventListener("change", this.boundHandleValueChange), this.shadowRoot?.removeEventListener("contextmenu", this.boundHandleContextMenu), this.shadowRoot?.removeEventListener("dblclick", this.boundHandleDblClick), this.currentView?.destroy(), this.dragManager.destroy(), this.stopNowIndicatorTimer(), this.headerResizeObserver?.disconnect(), this.headerResizeObserver = null, this.stopEdgeScroll(), this.pendingDragUpdate !== null && (cancelAnimationFrame(this.pendingDragUpdate), this.pendingDragUpdate = null), this.latestDragState = null, super.disconnectedCallback();
|
|
3701
4268
|
}
|
|
3702
4269
|
attributeChangedCallback(e, t, s) {
|
|
3703
4270
|
if (super.attributeChangedCallback(e, t, s), t !== s)
|
|
@@ -3713,9 +4280,9 @@ class I extends ee {
|
|
|
3713
4280
|
break;
|
|
3714
4281
|
case "first-day-of-week":
|
|
3715
4282
|
if (s) {
|
|
3716
|
-
const
|
|
3717
|
-
|
|
3718
|
-
firstDayOfWeek:
|
|
4283
|
+
const r = parseInt(s, 10);
|
|
4284
|
+
r >= 0 && r <= 6 && this.stateManager.setOptions({
|
|
4285
|
+
firstDayOfWeek: r
|
|
3719
4286
|
});
|
|
3720
4287
|
}
|
|
3721
4288
|
break;
|
|
@@ -3728,6 +4295,9 @@ class I extends ee {
|
|
|
3728
4295
|
case "readonly":
|
|
3729
4296
|
this.syncPermissions();
|
|
3730
4297
|
break;
|
|
4298
|
+
case "event-editor":
|
|
4299
|
+
this.requestUpdate();
|
|
4300
|
+
break;
|
|
3731
4301
|
}
|
|
3732
4302
|
}
|
|
3733
4303
|
// ============================================
|
|
@@ -3760,6 +4330,19 @@ class I extends ee {
|
|
|
3760
4330
|
set readonly(e) {
|
|
3761
4331
|
e ? this.setAttribute("readonly", "") : this.removeAttribute("readonly");
|
|
3762
4332
|
}
|
|
4333
|
+
/**
|
|
4334
|
+
* The built-in event editor's on/off switch (default ON). Attribute and
|
|
4335
|
+
* property are the same state, like `readonly`: the ATTRIBUTE (`event-editor`)
|
|
4336
|
+
* outranks `options.eventEditor`, and only the literal `"false"` disables —
|
|
4337
|
+
* so a wrapper can render the attribute unconditionally from a boolean.
|
|
4338
|
+
*/
|
|
4339
|
+
get eventEditor() {
|
|
4340
|
+
const e = this.getAttribute("event-editor");
|
|
4341
|
+
return e !== null ? e !== "false" : this.stateManager.getState().options.eventEditor !== !1;
|
|
4342
|
+
}
|
|
4343
|
+
set eventEditor(e) {
|
|
4344
|
+
this.setAttribute("event-editor", e ? "true" : "false");
|
|
4345
|
+
}
|
|
3763
4346
|
get events() {
|
|
3764
4347
|
return this.stateManager.getState().events;
|
|
3765
4348
|
}
|
|
@@ -3845,7 +4428,7 @@ class I extends ee {
|
|
|
3845
4428
|
*/
|
|
3846
4429
|
msg(e, t) {
|
|
3847
4430
|
return S(
|
|
3848
|
-
|
|
4431
|
+
E(this.stateManager.getState().options.messages)[e],
|
|
3849
4432
|
t
|
|
3850
4433
|
);
|
|
3851
4434
|
}
|
|
@@ -3853,7 +4436,7 @@ class I extends ee {
|
|
|
3853
4436
|
// Rendering
|
|
3854
4437
|
// ============================================
|
|
3855
4438
|
render() {
|
|
3856
|
-
return
|
|
4439
|
+
return D`
|
|
3857
4440
|
<div class="scheduler-container">
|
|
3858
4441
|
<header class="scheduler-header"></header>
|
|
3859
4442
|
<div class="scheduler-content"></div>
|
|
@@ -3863,10 +4446,11 @@ class I extends ee {
|
|
|
3863
4446
|
</div>
|
|
3864
4447
|
<div id="scheduler-kbd-event" class="visually-hidden">
|
|
3865
4448
|
${this.msg(
|
|
3866
|
-
this.can("moveEvent") || this.can("
|
|
4449
|
+
this.can("moveEvent") || this.can("resizeEvent") || this.can("deleteEvent") ? this.eventEditor ? "eventInstructionsWithEditor" : "eventInstructions" : "eventInstructionsReadOnly"
|
|
3867
4450
|
)}
|
|
3868
4451
|
</div>
|
|
3869
4452
|
${this.renderDayPopover()}
|
|
4453
|
+
${this.renderEventEditor()}
|
|
3870
4454
|
${this.liveAnnouncer.template()}
|
|
3871
4455
|
`;
|
|
3872
4456
|
}
|
|
@@ -3887,21 +4471,21 @@ class I extends ee {
|
|
|
3887
4471
|
*/
|
|
3888
4472
|
renderDayPopover() {
|
|
3889
4473
|
const e = this.popoverDate;
|
|
3890
|
-
if (!e) return
|
|
3891
|
-
const
|
|
3892
|
-
return
|
|
4474
|
+
if (!e) return T;
|
|
4475
|
+
const t = this.stateManager.getState(), { options: s } = t, r = this.popoverScope, n = r === "month" ? this.eventsInMonth(e) : this.eventsOnDay(e), i = r === "month" ? `${h.getMonthName(e, s.locale)} ${e.getFullYear()}` : h.formatDateWithWeekday(e, s.locale), o = [...t.resourceById.values()];
|
|
4476
|
+
return D`
|
|
3893
4477
|
<div
|
|
3894
4478
|
class="scheduler-day-popover"
|
|
3895
4479
|
role="dialog"
|
|
3896
|
-
aria-label=${this.msg("dayPopoverLabel", { date:
|
|
4480
|
+
aria-label=${this.msg("dayPopoverLabel", { date: i })}
|
|
3897
4481
|
>
|
|
3898
4482
|
<div class="popover-head">
|
|
3899
4483
|
<div>
|
|
3900
|
-
<div class="popover-date">${
|
|
4484
|
+
<div class="popover-date">${i}</div>
|
|
3901
4485
|
<div class="popover-count">
|
|
3902
4486
|
${this.msg("dayPopoverCount", {
|
|
3903
|
-
count:
|
|
3904
|
-
events: this.msg(
|
|
4487
|
+
count: n.length,
|
|
4488
|
+
events: this.msg(n.length === 1 ? "eventSingular" : "eventPlural")
|
|
3905
4489
|
})}
|
|
3906
4490
|
</div>
|
|
3907
4491
|
</div>
|
|
@@ -3914,81 +4498,171 @@ class I extends ee {
|
|
|
3914
4498
|
<span aria-hidden="true">×</span>
|
|
3915
4499
|
</button>
|
|
3916
4500
|
</div>
|
|
3917
|
-
${
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
class="popover-event-swatch"
|
|
3930
|
-
aria-hidden="true"
|
|
3931
|
-
style=${`background:${j(
|
|
3932
|
-
i,
|
|
3933
|
-
this.stateManager.getState().resourceById,
|
|
3934
|
-
t.defaultEventColor
|
|
3935
|
-
)}`}
|
|
3936
|
-
></span>
|
|
3937
|
-
<span class="popover-event-title">${i.title}</span>
|
|
3938
|
-
</button>
|
|
3939
|
-
</li>
|
|
3940
|
-
`
|
|
4501
|
+
${n.length === 0 ? D`<p class="popover-empty">${this.msg("dayPopoverEmpty")}</p>` : r === "month" ? this.renderPopoverDayGroups(n, s) : D`
|
|
4502
|
+
<ul class="popover-events">
|
|
4503
|
+
${n.map((a) => this.renderPopoverEvent(a, s))}
|
|
4504
|
+
</ul>
|
|
4505
|
+
`}
|
|
4506
|
+
${this.can("createEvent") && o.length > 0 ? D`
|
|
4507
|
+
<label class="popover-resource">
|
|
4508
|
+
<span class="popover-resource-label">${this.msg("newEventResource")}</span>
|
|
4509
|
+
<mp-select class="popover-resource-select">
|
|
4510
|
+
<option value="">${this.msg("unassignedResource")}</option>
|
|
4511
|
+
${o.map(
|
|
4512
|
+
(a) => D`<option value=${a.id}>${a.title}</option>`
|
|
3941
4513
|
)}
|
|
3942
|
-
|
|
3943
|
-
|
|
4514
|
+
</mp-select>
|
|
4515
|
+
</label>
|
|
4516
|
+
` : T}
|
|
3944
4517
|
<div class="popover-actions">
|
|
3945
|
-
${this.can("createEvent") ?
|
|
4518
|
+
${this.can("createEvent") ? D`<button
|
|
3946
4519
|
type="button"
|
|
3947
4520
|
class="popover-action primary"
|
|
3948
|
-
@click=${(
|
|
4521
|
+
@click=${(a) => this.createFromPopover(a)}
|
|
3949
4522
|
>
|
|
3950
4523
|
${this.msg("newEvent")}
|
|
3951
|
-
</button>` :
|
|
4524
|
+
</button>` : T}
|
|
3952
4525
|
<button
|
|
3953
4526
|
type="button"
|
|
3954
4527
|
class="popover-action"
|
|
3955
|
-
@click=${() => this.
|
|
4528
|
+
@click=${() => this.drillFromPopover()}
|
|
3956
4529
|
>
|
|
3957
|
-
${this.msg("showDay")}
|
|
4530
|
+
${this.msg(r === "month" ? "showMonth" : "showDay")}
|
|
3958
4531
|
</button>
|
|
3959
4532
|
</div>
|
|
3960
4533
|
</div>
|
|
3961
4534
|
`;
|
|
3962
4535
|
}
|
|
4536
|
+
renderPopoverEvent(e, t) {
|
|
4537
|
+
return D`
|
|
4538
|
+
<li class="popover-event-row">
|
|
4539
|
+
<button
|
|
4540
|
+
type="button"
|
|
4541
|
+
class="popover-event"
|
|
4542
|
+
aria-label=${$(e, null, t)}
|
|
4543
|
+
@click=${(s) => this.selectFromPopover(e, s)}
|
|
4544
|
+
>
|
|
4545
|
+
<span
|
|
4546
|
+
class="popover-event-swatch"
|
|
4547
|
+
aria-hidden="true"
|
|
4548
|
+
style=${`background:${U(
|
|
4549
|
+
e,
|
|
4550
|
+
this.stateManager.getState().resourceById,
|
|
4551
|
+
t.defaultEventColor
|
|
4552
|
+
)}`}
|
|
4553
|
+
></span>
|
|
4554
|
+
<span class="popover-event-title">${e.title}</span>
|
|
4555
|
+
</button>
|
|
4556
|
+
${this.can("deleteEvent", e) ? D`<button
|
|
4557
|
+
type="button"
|
|
4558
|
+
class="popover-event-delete"
|
|
4559
|
+
aria-label=${this.msg("deleteEventLabel", { title: e.title })}
|
|
4560
|
+
@click=${() => this.deleteFromPopover(e)}
|
|
4561
|
+
>
|
|
4562
|
+
<span aria-hidden="true">×</span>
|
|
4563
|
+
</button>` : T}
|
|
4564
|
+
</li>
|
|
4565
|
+
`;
|
|
4566
|
+
}
|
|
4567
|
+
/**
|
|
4568
|
+
* The pointer face of the Delete key (R14): before this, `event-delete` was
|
|
4569
|
+
* keyboard-only. A SIBLING of the event button — event boxes and popover
|
|
4570
|
+
* entries are buttons themselves, so a delete control inside one would be a
|
|
4571
|
+
* nested interactive.
|
|
4572
|
+
*
|
|
4573
|
+
* The popover stays open: `event-delete` is a request, and whether the row
|
|
4574
|
+
* disappears is the consumer's call (their listener owns the data, and any
|
|
4575
|
+
* confirm/undo). Focus is parked on the next row by INDEX before the list
|
|
4576
|
+
* re-renders — the deleted row's button is about to vanish, and focus falling
|
|
4577
|
+
* to <body> would dump a keyboard user out of the dialog.
|
|
4578
|
+
*/
|
|
4579
|
+
deleteFromPopover(e) {
|
|
4580
|
+
if (!this.can("deleteEvent", e)) {
|
|
4581
|
+
this.announceDenied();
|
|
4582
|
+
return;
|
|
4583
|
+
}
|
|
4584
|
+
const t = this.shadowRoot?.querySelector(".scheduler-day-popover"), r = (t ? [...t.querySelectorAll(".popover-event")] : []).findIndex(
|
|
4585
|
+
(n) => n.getAttribute("aria-label") === $(e, null, this.stateManager.getState().options)
|
|
4586
|
+
);
|
|
4587
|
+
this.eventEmitter.emitEventDelete(e), this.updateComplete.then(
|
|
4588
|
+
() => requestAnimationFrame(() => {
|
|
4589
|
+
const n = this.shadowRoot?.querySelector(".scheduler-day-popover");
|
|
4590
|
+
if (!n) return;
|
|
4591
|
+
const i = [...n.querySelectorAll(".popover-event")];
|
|
4592
|
+
(i[Math.min(Math.max(r, 0), i.length - 1)] ?? n.querySelector(".popover-action") ?? n.querySelector(".popover-close"))?.focus();
|
|
4593
|
+
})
|
|
4594
|
+
);
|
|
4595
|
+
}
|
|
4596
|
+
/**
|
|
4597
|
+
* The month-scoped list: events grouped under a heading per day, each event
|
|
4598
|
+
* listed once under the day it starts (clamped to the month, so an event
|
|
4599
|
+
* running in from last month sits under the 1st rather than vanishing).
|
|
4600
|
+
*/
|
|
4601
|
+
renderPopoverDayGroups(e, t) {
|
|
4602
|
+
const s = this.popoverDate, r = new Date(s.getFullYear(), s.getMonth(), 1), n = e.reduce((i, o) => {
|
|
4603
|
+
const a = o.start < r ? new Date(r) : new Date(o.start);
|
|
4604
|
+
a.setHours(0, 0, 0, 0);
|
|
4605
|
+
const l = a.getTime(), d = i.get(l) ?? { day: a, events: [] };
|
|
4606
|
+
return d.events.push(o), i.set(l, d);
|
|
4607
|
+
}, /* @__PURE__ */ new Map());
|
|
4608
|
+
return D`
|
|
4609
|
+
<ul class="popover-events popover-day-groups">
|
|
4610
|
+
${[...n.values()].map(
|
|
4611
|
+
(i) => D`
|
|
4612
|
+
<li class="popover-day-group">
|
|
4613
|
+
<div class="popover-day-label">
|
|
4614
|
+
${h.formatDateWithWeekday(i.day, t.locale)}
|
|
4615
|
+
</div>
|
|
4616
|
+
<ul class="popover-events">
|
|
4617
|
+
${i.events.map((o) => this.renderPopoverEvent(o, t))}
|
|
4618
|
+
</ul>
|
|
4619
|
+
</li>
|
|
4620
|
+
`
|
|
4621
|
+
)}
|
|
4622
|
+
</ul>
|
|
4623
|
+
`;
|
|
4624
|
+
}
|
|
3963
4625
|
/**
|
|
3964
|
-
* The
|
|
3965
|
-
* The
|
|
3966
|
-
*
|
|
4626
|
+
* The cell/card the popover hangs off, resolved by element id on every call.
|
|
4627
|
+
* The views rebuild their cells imperatively, so a cached element would be
|
|
4628
|
+
* detached the moment anything re-renders while the popover is open.
|
|
3967
4629
|
*/
|
|
3968
4630
|
popoverAnchorCell() {
|
|
3969
|
-
return this.
|
|
3970
|
-
|
|
4631
|
+
return this.popoverAnchorId ? this.shadowRoot?.querySelector(
|
|
4632
|
+
`#${this.cssEscape(this.popoverAnchorId)}`
|
|
3971
4633
|
) ?? null : null;
|
|
3972
4634
|
}
|
|
4635
|
+
/**
|
|
4636
|
+
* The anchor for a popover opened for `day` in the current view: the day's
|
|
4637
|
+
* own cell in month view, its month CARD in year view. Every other view has
|
|
4638
|
+
* no date-keyed cell — the popover is a month/year surface only.
|
|
4639
|
+
*/
|
|
4640
|
+
defaultPopoverAnchorId(e) {
|
|
4641
|
+
return this.stateManager.getState().view === "year" ? `scheduler-cell-y-${N.monthKey(e)}` : `scheduler-cell-m-${z.dayKey(e)}`;
|
|
4642
|
+
}
|
|
3973
4643
|
/** Every event overlapping the given local day, in start order. */
|
|
3974
4644
|
eventsOnDay(e) {
|
|
3975
4645
|
const t = new Date(e);
|
|
3976
4646
|
t.setHours(0, 0, 0, 0);
|
|
3977
4647
|
const s = new Date(t);
|
|
3978
|
-
return s.setDate(s.getDate() + 1), this.stateManager.getState().events.filter((
|
|
4648
|
+
return s.setDate(s.getDate() + 1), this.stateManager.getState().events.filter((r) => r.start < s && r.end > t).sort((r, n) => r.start.getTime() - n.start.getTime());
|
|
3979
4649
|
}
|
|
3980
4650
|
/**
|
|
3981
|
-
* Open the
|
|
3982
|
-
*
|
|
4651
|
+
* Open the date popover for `day`. Anchored on an element resolved LAZILY by
|
|
4652
|
+
* id: the views rebuild their DOM imperatively, so a captured element
|
|
3983
4653
|
* reference would be detached by the next render while the popover is open.
|
|
4654
|
+
*
|
|
4655
|
+
* `anchorId` overrides the default when the caller knows better — a year
|
|
4656
|
+
* mini-day belonging to an ADJACENT month must anchor on the card it was
|
|
4657
|
+
* clicked in, which is not the card its own month key names.
|
|
3984
4658
|
*/
|
|
3985
|
-
async openDayPopover(e) {
|
|
3986
|
-
this.popoverDate = new Date(e), this.
|
|
4659
|
+
async openDayPopover(e, t, s = "day") {
|
|
4660
|
+
this.popoverDate = new Date(e), this.popoverScope = s, this.popoverAnchorId = t ?? this.defaultPopoverAnchorId(e), this.requestUpdate(), await this.dayPopover.open(), this.contentContainer?.addEventListener("scroll", this.boundRepositionPopover, {
|
|
3987
4661
|
passive: !0
|
|
3988
4662
|
});
|
|
3989
4663
|
}
|
|
3990
4664
|
closeDayPopover() {
|
|
3991
|
-
this.contentContainer?.removeEventListener("scroll", this.boundRepositionPopover), this.dayPopover.close(), this.popoverDate = null, this.
|
|
4665
|
+
this.contentContainer?.removeEventListener("scroll", this.boundRepositionPopover), this.dayPopover.close(), this.popoverDate = null, this.popoverAnchorId = null, this.requestUpdate();
|
|
3992
4666
|
}
|
|
3993
4667
|
selectFromPopover(e, t) {
|
|
3994
4668
|
this.closeDayPopover(), this.stateManager.setSelectedEvent(e), this.eventEmitter.emitEventSelected(e, t);
|
|
@@ -3996,22 +4670,452 @@ class I extends ee {
|
|
|
3996
4670
|
createFromPopover(e) {
|
|
3997
4671
|
const t = this.popoverDate;
|
|
3998
4672
|
if (!t) return;
|
|
3999
|
-
const
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4673
|
+
const r = this.shadowRoot?.querySelector(
|
|
4674
|
+
"mp-select.popover-resource-select"
|
|
4675
|
+
)?.value || void 0, n = new Date(t);
|
|
4676
|
+
n.setHours(0, 0, 0, 0);
|
|
4677
|
+
const i = new Date(n);
|
|
4678
|
+
if (i.setDate(i.getDate() + 1), this.closeDayPopover(), !this.can("createEvent") || !this.allowsCreateAt({ start: n, end: i }, r)) {
|
|
4003
4679
|
this.announceDenied();
|
|
4004
4680
|
return;
|
|
4005
4681
|
}
|
|
4006
4682
|
this.eventEmitter.emitEventCreate(
|
|
4007
|
-
{ start:
|
|
4683
|
+
{ start: n, end: i },
|
|
4008
4684
|
this.stateManager.getState().view,
|
|
4009
|
-
e
|
|
4685
|
+
e,
|
|
4686
|
+
r
|
|
4010
4687
|
);
|
|
4011
4688
|
}
|
|
4012
|
-
|
|
4689
|
+
/** "Show day" / "Show month" — the drill that matches the popover's scope. */
|
|
4690
|
+
drillFromPopover() {
|
|
4013
4691
|
const e = this.popoverDate;
|
|
4014
|
-
|
|
4692
|
+
if (!e) return;
|
|
4693
|
+
const t = this.popoverScope;
|
|
4694
|
+
this.closeDayPopover(), this.stateManager.setDate(new Date(e)), this.stateManager.setView(t === "month" ? "month" : "day");
|
|
4695
|
+
}
|
|
4696
|
+
/** Every event overlapping `day`'s local month, in start order. */
|
|
4697
|
+
eventsInMonth(e) {
|
|
4698
|
+
const t = new Date(e.getFullYear(), e.getMonth(), 1), s = new Date(e.getFullYear(), e.getMonth() + 1, 1);
|
|
4699
|
+
return this.stateManager.getState().events.filter((r) => r.start < s && r.end > t).sort((r, n) => r.start.getTime() - n.start.getTime());
|
|
4700
|
+
}
|
|
4701
|
+
// ============================================
|
|
4702
|
+
// Built-in event editor (R20 / D12.8)
|
|
4703
|
+
// ============================================
|
|
4704
|
+
/** The rendered element of an event, by id — never the drag ghost. */
|
|
4705
|
+
eventElementById(e) {
|
|
4706
|
+
return e ? this.shadowRoot?.querySelector(
|
|
4707
|
+
`[data-event-id="${this.cssEscape(e)}"]:not(.preview)`
|
|
4708
|
+
) ?? null : null;
|
|
4709
|
+
}
|
|
4710
|
+
/**
|
|
4711
|
+
* The editor opens when ANY of its fields is permitted for this event
|
|
4712
|
+
* (D12.8c) — an all-disabled form is worse than no form. `readonly` and
|
|
4713
|
+
* per-event `editable: false` zero every capability, so they kill it
|
|
4714
|
+
* wholesale through the same resolver as everything else.
|
|
4715
|
+
*/
|
|
4716
|
+
canOpenEditor(e) {
|
|
4717
|
+
return this.can("editEvent", e) || this.can("moveEvent", e) || this.can("resizeEvent", e) || this.can("deleteEvent", e);
|
|
4718
|
+
}
|
|
4719
|
+
/**
|
|
4720
|
+
* Which of the editor's time fields are live, and what a start change MEANS
|
|
4721
|
+
* — the single place that answers both (D12.13).
|
|
4722
|
+
*
|
|
4723
|
+
* | `moveEvent` | `resizeEvent` | start | end | a start change… |
|
|
4724
|
+
* |---|---|---|---|---|
|
|
4725
|
+
* | ✓ | ✓ | on | on | shifts both (a move) |
|
|
4726
|
+
* | ✓ | ✗ | on | off | shifts both (a move) |
|
|
4727
|
+
* | ✗ | ✓ | on | on | resizes the start alone, clamped |
|
|
4728
|
+
* | ✗ | ✗ | off | off | — |
|
|
4729
|
+
*
|
|
4730
|
+
* Editing the END alone is *by definition* a resize, so that field follows
|
|
4731
|
+
* `resizeEvent`. Editing the START is a move where one is permitted and a
|
|
4732
|
+
* start-resize otherwise. Row 2 closes a leak that predates this: with
|
|
4733
|
+
* `moveEvent: true, resizable: false` the editor used to commit a pure
|
|
4734
|
+
* duration change that `resizable: false` forbids.
|
|
4735
|
+
*
|
|
4736
|
+
* `canResize` folds the per-item `{ start, end }` form as **both** edges, so
|
|
4737
|
+
* `resizable: { start: false, end: true }` locks the editor's time fields
|
|
4738
|
+
* while the end *handle* keeps working — honest, and with no way to commit a
|
|
4739
|
+
* half-applied range (B35). Both edges are therefore always writable
|
|
4740
|
+
* together or not at all, which is what makes the single `if` at save
|
|
4741
|
+
* correct rather than coincidental.
|
|
4742
|
+
*/
|
|
4743
|
+
editorTimeFields(e) {
|
|
4744
|
+
const t = this.can("moveEvent", e), s = this.canResizeEdge("start", e) && this.canResizeEdge("end", e);
|
|
4745
|
+
return {
|
|
4746
|
+
canStart: t || s,
|
|
4747
|
+
canEnd: s,
|
|
4748
|
+
canTime: t || s,
|
|
4749
|
+
startIsMove: t
|
|
4750
|
+
};
|
|
4751
|
+
}
|
|
4752
|
+
tryOpenEventEditor(e) {
|
|
4753
|
+
!this.eventEditor || !this.canOpenEditor(e) || (this.editorEventId = e.id, this.editorError = null, this.editorDraft = {
|
|
4754
|
+
title: e.title,
|
|
4755
|
+
start: new Date(e.start),
|
|
4756
|
+
end: new Date(e.end),
|
|
4757
|
+
color: e.color ?? null,
|
|
4758
|
+
inheritColor: !e.color
|
|
4759
|
+
}, this.requestUpdate(), this.eventEditorOverlay.open(), this.contentContainer?.addEventListener("scroll", this.boundRepositionEditor, {
|
|
4760
|
+
passive: !0
|
|
4761
|
+
}));
|
|
4762
|
+
}
|
|
4763
|
+
closeEventEditor() {
|
|
4764
|
+
this.editorDraft = null, this.contentContainer?.removeEventListener("scroll", this.boundRepositionEditor), this.eventEditorOverlay.close(), this.editorEventId = null, this.editorError = null, this.editorDraft = null, this.requestUpdate();
|
|
4765
|
+
}
|
|
4766
|
+
/** Right-click on an event box opens the editor (D12.8b). */
|
|
4767
|
+
handleContextMenu(e) {
|
|
4768
|
+
const s = (e.composedPath?.()[0] ?? e.target)?.closest?.(
|
|
4769
|
+
"[data-event-id]:not(.preview)"
|
|
4770
|
+
);
|
|
4771
|
+
if (!s) return;
|
|
4772
|
+
const r = this.getEventById(s.dataset.eventId ?? "");
|
|
4773
|
+
!r || !this.eventEditor || !this.canOpenEditor(r) || (e.preventDefault(), this.stateManager.setSelectedEvent(r), this.tryOpenEventEditor(r));
|
|
4774
|
+
}
|
|
4775
|
+
/**
|
|
4776
|
+
* Minute granularity for the editor's time lists, derived from the grid's own
|
|
4777
|
+
* `slotDuration` so the two agree — picking a time the grid cannot represent
|
|
4778
|
+
* would be its own small lie. Clamped to the picker's supported steps.
|
|
4779
|
+
*/
|
|
4780
|
+
pickerStep() {
|
|
4781
|
+
const e = Math.round((this.stateManager.getState().options.slotDuration ?? 1800) / 60);
|
|
4782
|
+
return [1, 5, 10, 15, 30, 60].find((s) => s >= e) ?? 60;
|
|
4783
|
+
}
|
|
4784
|
+
renderEventEditor() {
|
|
4785
|
+
const e = this.editorEventId ? this.getEventById(this.editorEventId) : null, t = this.editorDraft;
|
|
4786
|
+
if (!e || !t) return T;
|
|
4787
|
+
const { options: s } = this.stateManager.getState(), r = this.can("editEvent", e), n = this.editorError?.field === "title", i = this.editorError?.field === "end", o = ie(
|
|
4788
|
+
this.editorTitleErrorId,
|
|
4789
|
+
this.editorError?.message ?? null,
|
|
4790
|
+
n
|
|
4791
|
+
), { canStart: a, canEnd: l, startIsMove: d } = this.editorTimeFields(e), c = t.color ?? U(
|
|
4792
|
+
e,
|
|
4793
|
+
this.stateManager.getState().resourceById,
|
|
4794
|
+
this.stateManager.getState().options.defaultEventColor
|
|
4795
|
+
);
|
|
4796
|
+
return D`
|
|
4797
|
+
<div
|
|
4798
|
+
class="scheduler-event-editor"
|
|
4799
|
+
role="dialog"
|
|
4800
|
+
aria-label=${this.msg("eventEditorLabel", { title: e.title })}
|
|
4801
|
+
>
|
|
4802
|
+
<div class="editor-head">
|
|
4803
|
+
<div class="editor-title">${t.title}</div>
|
|
4804
|
+
<button
|
|
4805
|
+
type="button"
|
|
4806
|
+
class="editor-close"
|
|
4807
|
+
aria-label=${this.msg("closePopover")}
|
|
4808
|
+
@click=${() => this.closeEventEditor()}
|
|
4809
|
+
>
|
|
4810
|
+
<span aria-hidden="true">×</span>
|
|
4811
|
+
</button>
|
|
4812
|
+
</div>
|
|
4813
|
+
<label class="editor-field">
|
|
4814
|
+
<span>${this.msg("editorTitleLabel")}</span>
|
|
4815
|
+
<input
|
|
4816
|
+
type="text"
|
|
4817
|
+
class="form-control form-control-sm editor-input editor-title-input ${n ? "is-invalid" : ""}"
|
|
4818
|
+
.value=${t.title}
|
|
4819
|
+
?disabled=${!r}
|
|
4820
|
+
aria-invalid=${n ? "true" : "false"}
|
|
4821
|
+
aria-errormessage=${o.id}
|
|
4822
|
+
aria-describedby=${o.id}
|
|
4823
|
+
@input=${(u) => this.updateEditorDraft({ title: u.target.value })}
|
|
4824
|
+
/>
|
|
4825
|
+
${o.node}
|
|
4826
|
+
</label>
|
|
4827
|
+
<label class="editor-field">
|
|
4828
|
+
<span>${this.msg("editorStartLabel")}</span>
|
|
4829
|
+
<mp-datetime-picker
|
|
4830
|
+
class="editor-input editor-start-input"
|
|
4831
|
+
.value=${t.start}
|
|
4832
|
+
.max=${d ? null : t.end}
|
|
4833
|
+
?disabled=${!a}
|
|
4834
|
+
@value-change=${(u) => this.onEditorStartChange(u)}
|
|
4835
|
+
input-label=${this.msg("editorStartLabel")}
|
|
4836
|
+
locale=${s.locale ?? T}
|
|
4837
|
+
first-day-of-week=${s.firstDayOfWeek ?? 1}
|
|
4838
|
+
.hour12=${s.timeFormat === "12h"}
|
|
4839
|
+
.step=${this.pickerStep()}
|
|
4840
|
+
></mp-datetime-picker>
|
|
4841
|
+
</label>
|
|
4842
|
+
<label class="editor-field">
|
|
4843
|
+
<span>${this.msg("editorEndLabel")}</span>
|
|
4844
|
+
<mp-datetime-picker
|
|
4845
|
+
class="editor-input editor-end-input"
|
|
4846
|
+
.value=${t.end}
|
|
4847
|
+
.min=${t.start}
|
|
4848
|
+
?disabled=${!l}
|
|
4849
|
+
?invalid=${i}
|
|
4850
|
+
error-text=${i ? this.editorError.message : T}
|
|
4851
|
+
@value-change=${(u) => this.onEditorEndChange(u)}
|
|
4852
|
+
input-label=${this.msg("editorEndLabel")}
|
|
4853
|
+
locale=${s.locale ?? T}
|
|
4854
|
+
first-day-of-week=${s.firstDayOfWeek ?? 1}
|
|
4855
|
+
.hour12=${s.timeFormat === "12h"}
|
|
4856
|
+
.step=${this.pickerStep()}
|
|
4857
|
+
></mp-datetime-picker>
|
|
4858
|
+
</label>
|
|
4859
|
+
<label class="editor-field">
|
|
4860
|
+
<span>${this.msg("editorColorLabel")}</span>
|
|
4861
|
+
<input
|
|
4862
|
+
type="color"
|
|
4863
|
+
class="form-control form-control-color editor-input editor-color-input"
|
|
4864
|
+
.value=${c}
|
|
4865
|
+
?disabled=${!r || t.inheritColor}
|
|
4866
|
+
@input=${(u) => this.updateEditorDraft({ color: u.target.value })}
|
|
4867
|
+
/>
|
|
4868
|
+
</label>
|
|
4869
|
+
<div class="editor-field editor-inherit">
|
|
4870
|
+
<mp-checkbox
|
|
4871
|
+
class="editor-inherit-input"
|
|
4872
|
+
.checked=${t.inheritColor}
|
|
4873
|
+
?disabled=${!r}
|
|
4874
|
+
@change=${() => this.toggleEditorColorInherit()}
|
|
4875
|
+
>${this.msg("editorInheritColor")}</mp-checkbox>
|
|
4876
|
+
</div>
|
|
4877
|
+
<div class="editor-actions">
|
|
4878
|
+
<button
|
|
4879
|
+
type="button"
|
|
4880
|
+
class="editor-action primary"
|
|
4881
|
+
@click=${() => this.saveEventEditor()}
|
|
4882
|
+
>
|
|
4883
|
+
${this.msg("editorSave")}
|
|
4884
|
+
</button>
|
|
4885
|
+
${this.can("deleteEvent", e) ? D`<button
|
|
4886
|
+
type="button"
|
|
4887
|
+
class="editor-action danger"
|
|
4888
|
+
@click=${() => this.deleteFromEditor()}
|
|
4889
|
+
>
|
|
4890
|
+
${this.msg("editorDelete")}
|
|
4891
|
+
</button>` : T}
|
|
4892
|
+
<button
|
|
4893
|
+
type="button"
|
|
4894
|
+
class="editor-action"
|
|
4895
|
+
@click=${() => this.closeEventEditor()}
|
|
4896
|
+
>
|
|
4897
|
+
${this.msg("editorCancel")}
|
|
4898
|
+
</button>
|
|
4899
|
+
</div>
|
|
4900
|
+
</div>
|
|
4901
|
+
`;
|
|
4902
|
+
}
|
|
4903
|
+
/**
|
|
4904
|
+
* "Inherit from resource" drives the swatch's enabled state: while inheriting,
|
|
4905
|
+
* the swatch shows WHAT is inherited but cannot be committed, so there is no
|
|
4906
|
+
* gesture that silently overrides. Toggled in the DOM rather than through a
|
|
4907
|
+
* re-render on purpose — a re-render would re-run the sibling fields' value
|
|
4908
|
+
* bindings and could discard a title the user has typed but not saved.
|
|
4909
|
+
*/
|
|
4910
|
+
toggleEditorColorInherit() {
|
|
4911
|
+
const e = this.editorInheritCheckbox()?.checked ?? !0, t = this.shadowRoot?.querySelector(".editor-color-input");
|
|
4912
|
+
this.updateEditorDraft({
|
|
4913
|
+
inheritColor: e,
|
|
4914
|
+
color: e ? null : t?.value ?? this.editorDraft?.color ?? null
|
|
4915
|
+
});
|
|
4916
|
+
}
|
|
4917
|
+
/** Merge a change into the draft and re-render the panel from it. */
|
|
4918
|
+
updateEditorDraft(e) {
|
|
4919
|
+
this.editorDraft && (this.editorDraft = { ...this.editorDraft, ...e }, this.editorError && this.editorErrorFieldTouched(e) && (this.editorError = null), this.requestUpdate());
|
|
4920
|
+
}
|
|
4921
|
+
editorErrorFieldTouched(e) {
|
|
4922
|
+
return this.editorError?.field === "title" ? "title" in e : "end" in e;
|
|
4923
|
+
}
|
|
4924
|
+
/**
|
|
4925
|
+
* Changing the START moves the event: the end shifts by the same delta, so
|
|
4926
|
+
* the duration is preserved (B30/D12.10). This is the contract every other
|
|
4927
|
+
* path already implements — a pointer move-drag applies one offset to both
|
|
4928
|
+
* edges, and so does keyboard move-mode. Without it, moving an event later
|
|
4929
|
+
* in the editor hit "End must be after start" and refused to do anything,
|
|
4930
|
+
* which is a dead end on the field a user edits first.
|
|
4931
|
+
*
|
|
4932
|
+
* Changing the END is left alone: that is a resize, and the only way to
|
|
4933
|
+
* express one here.
|
|
4934
|
+
*
|
|
4935
|
+
* A corollary worth stating, because the opposite looks like an oversight:
|
|
4936
|
+
* while it is a move, the START picker carries NO `max`. Duration is an
|
|
4937
|
+
* invariant of that transform, so a valid draft stays valid after any start
|
|
4938
|
+
* change in either direction — start-after-end is unreachable, and a bound
|
|
4939
|
+
* there would only refuse legitimate picks (D12.12/F1).
|
|
4940
|
+
*
|
|
4941
|
+
* When the user may resize but NOT move (D12.13's row 3), a start change is
|
|
4942
|
+
* a start-RESIZE instead: the end holds still and the start is clamped to
|
|
4943
|
+
* one slot before it, mirroring the end field's clamp. The draft cannot
|
|
4944
|
+
* invert either way, so the two semantics differ only in what they mean.
|
|
4945
|
+
*/
|
|
4946
|
+
onEditorStartChange(e) {
|
|
4947
|
+
const t = e.detail, s = this.editorDraft;
|
|
4948
|
+
if (!t || !s) return;
|
|
4949
|
+
const r = t.getTime() - s.start.getTime();
|
|
4950
|
+
if (r === 0) return;
|
|
4951
|
+
const n = this.editorEventId ? this.getEventById(this.editorEventId) : null;
|
|
4952
|
+
if (!n || this.editorTimeFields(n).startIsMove) {
|
|
4953
|
+
this.updateEditorDraft({ start: t, end: new Date(s.end.getTime() + r) });
|
|
4954
|
+
return;
|
|
4955
|
+
}
|
|
4956
|
+
const i = new Date(s.end.getTime() - this.minutesPerSlot() * 60 * 1e3);
|
|
4957
|
+
if (t.getTime() <= i.getTime()) {
|
|
4958
|
+
this.updateEditorDraft({ start: t });
|
|
4959
|
+
return;
|
|
4960
|
+
}
|
|
4961
|
+
this.updateEditorDraft({ start: i });
|
|
4962
|
+
const { options: o } = this.stateManager.getState();
|
|
4963
|
+
this.liveAnnouncer.announce(
|
|
4964
|
+
this.msg("editorStartClamped", {
|
|
4965
|
+
start: h.formatTime(i, o.timeFormat)
|
|
4966
|
+
})
|
|
4967
|
+
);
|
|
4968
|
+
}
|
|
4969
|
+
/**
|
|
4970
|
+
* The end alone is a RESIZE — it never drags the start with it.
|
|
4971
|
+
*
|
|
4972
|
+
* It is also the only edge that can invert the range (D12.12): a start
|
|
4973
|
+
* change preserves duration, so it keeps a valid draft valid, but an end
|
|
4974
|
+
* can be picked before the start. The END picker therefore carries
|
|
4975
|
+
* `min = draft.start`, which the CALENDAR half honours date-only — exactly
|
|
4976
|
+
* the wanted semantic, since "the same day" must stay fully selectable —
|
|
4977
|
+
* and this clamp covers what a bound cannot: the same-day-earlier-time
|
|
4978
|
+
* case, and the picker's Today/Now buttons, which ignore bounds entirely.
|
|
4979
|
+
*
|
|
4980
|
+
* Clamping the field the user just edited is deliberate. Adjusting the
|
|
4981
|
+
* OTHER edge instead would change a control they are not focused on
|
|
4982
|
+
* (a WCAG 3.2.2 hazard); this corrects their own field and says so.
|
|
4983
|
+
*
|
|
4984
|
+
* The floor is one grid slot, matching keyboard resize — the editor could
|
|
4985
|
+
* otherwise commit a 1-minute event on a 30-minute grid, which no direct
|
|
4986
|
+
* gesture can produce.
|
|
4987
|
+
*/
|
|
4988
|
+
onEditorEndChange(e) {
|
|
4989
|
+
const t = e.detail, s = this.editorDraft;
|
|
4990
|
+
if (!t || !s) return;
|
|
4991
|
+
const r = new Date(s.start.getTime() + this.minutesPerSlot() * 60 * 1e3);
|
|
4992
|
+
if (t.getTime() >= r.getTime()) {
|
|
4993
|
+
this.updateEditorDraft({ end: t });
|
|
4994
|
+
return;
|
|
4995
|
+
}
|
|
4996
|
+
this.updateEditorDraft({ end: r });
|
|
4997
|
+
const { options: n } = this.stateManager.getState();
|
|
4998
|
+
this.liveAnnouncer.announce(
|
|
4999
|
+
this.msg("editorEndClamped", {
|
|
5000
|
+
end: h.formatTime(r, n.timeFormat)
|
|
5001
|
+
})
|
|
5002
|
+
);
|
|
5003
|
+
}
|
|
5004
|
+
/**
|
|
5005
|
+
* The editor's inherit checkbox. `<mp-checkbox>` rather than a bare input so
|
|
5006
|
+
* it carries Bootstrap's `.form-check` styling into this shadow root; its
|
|
5007
|
+
* `checked`/`disabled` are host properties, so it is read like a native one —
|
|
5008
|
+
* but it is NOT an `HTMLInputElement`, hence its own accessor.
|
|
5009
|
+
*/
|
|
5010
|
+
editorInheritCheckbox() {
|
|
5011
|
+
return this.shadowRoot?.querySelector(
|
|
5012
|
+
"mp-checkbox.editor-inherit-input"
|
|
5013
|
+
) ?? null;
|
|
5014
|
+
}
|
|
5015
|
+
/**
|
|
5016
|
+
* Save = the same `event-update` request a committed drag emits, so the
|
|
5017
|
+
* consumer's existing handler applies it unchanged. Only fields whose inputs
|
|
5018
|
+
* were ENABLED are read back — a disabled field keeps the event's value, so
|
|
5019
|
+
* a permission can never be bypassed by a form submit. Validation stays
|
|
5020
|
+
* minimal (end > start, non-empty title): the WC owns no data; anything
|
|
5021
|
+
* richer belongs in the consumer's listener.
|
|
5022
|
+
*/
|
|
5023
|
+
saveEventEditor() {
|
|
5024
|
+
const e = this.editorEventId ? this.getEventById(this.editorEventId) : null, t = this.editorDraft;
|
|
5025
|
+
if (!e || !t) return;
|
|
5026
|
+
const s = { ...e };
|
|
5027
|
+
if (this.can("editEvent", e)) {
|
|
5028
|
+
const r = t.title.trim();
|
|
5029
|
+
if (!r) {
|
|
5030
|
+
this.refuseSave("title", this.msg("editorTitleRequired"));
|
|
5031
|
+
return;
|
|
5032
|
+
}
|
|
5033
|
+
s.title = r, t.inheritColor ? delete s.color : t.color && (s.color = t.color);
|
|
5034
|
+
}
|
|
5035
|
+
if (this.editorTimeFields(e).canTime && (s.start = t.start, s.end = t.end), isNaN(s.start.getTime()) || isNaN(s.end.getTime()) || s.end <= s.start) {
|
|
5036
|
+
this.refuseSave("end", this.msg("editorInvalidRange"));
|
|
5037
|
+
return;
|
|
5038
|
+
}
|
|
5039
|
+
this.closeEventEditor(), this.stateManager.updateEvent(s), this.eventEmitter.emitEventUpdate(s, e, new CustomEvent("event-editor")), this.liveAnnouncer.announce(this.msg("eventUpdated", { title: s.title }));
|
|
5040
|
+
}
|
|
5041
|
+
/**
|
|
5042
|
+
* Refuse a Save, and make sure the reason is spoken EXACTLY once (D12.14).
|
|
5043
|
+
*
|
|
5044
|
+
* The message goes to one channel only — the offending control's own
|
|
5045
|
+
* accessible description — and is delivered by moving focus there. It used
|
|
5046
|
+
* to go to two (a `role="alert"` node AND the polite live announcer), which
|
|
5047
|
+
* screen readers speak twice, often at two different urgencies. The
|
|
5048
|
+
* announcer is the wrong channel here for a second reason: it self-clears
|
|
5049
|
+
* after 1.5 s, so it cannot hold a message the user may want to re-read,
|
|
5050
|
+
* which is exactly what a validation error is. It stays on the SUCCESS
|
|
5051
|
+
* path, where the message is transient by nature.
|
|
5052
|
+
*
|
|
5053
|
+
* Focus has to move for the same reason: with no live region, a description
|
|
5054
|
+
* is silent until something lands on the control it describes.
|
|
5055
|
+
*/
|
|
5056
|
+
async refuseSave(e, t) {
|
|
5057
|
+
if (this.editorError = { field: e, message: t }, this.requestUpdate(), await this.updateComplete, this.editorError?.field !== e) return;
|
|
5058
|
+
const s = e === "title" ? this.shadowRoot?.querySelector(".editor-title-input") : this.shadowRoot?.querySelector("mp-datetime-picker.editor-end-input");
|
|
5059
|
+
await s?.updateComplete, s?.focus();
|
|
5060
|
+
}
|
|
5061
|
+
// ============================================
|
|
5062
|
+
// Inline resource rename (R17 / D12.5c)
|
|
5063
|
+
// ============================================
|
|
5064
|
+
/** Mouse face of the rename: double-click the title span. */
|
|
5065
|
+
handleNativeDblClick(e) {
|
|
5066
|
+
const s = (e.composedPath?.()[0] ?? e.target)?.closest?.(
|
|
5067
|
+
".resource-title[data-resource-id]"
|
|
5068
|
+
);
|
|
5069
|
+
if (!s) return;
|
|
5070
|
+
const r = s.dataset.resourceId;
|
|
5071
|
+
r && this.beginResourceRename(r);
|
|
5072
|
+
}
|
|
5073
|
+
/**
|
|
5074
|
+
* Swap a resource/group title for an inline input — file-manager's proven
|
|
5075
|
+
* idiom, keys included: Enter commits, Escape cancels, blur commits. The
|
|
5076
|
+
* commit is a `resource-update` request carrying `{ title }`; the consumer
|
|
5077
|
+
* applies it (the same contract as the colour swatch). No re-render happens
|
|
5078
|
+
* while the input is open — nothing writes state until commit — so the input
|
|
5079
|
+
* cannot be torn down mid-word.
|
|
5080
|
+
*/
|
|
5081
|
+
beginResourceRename(e) {
|
|
5082
|
+
if (!this.can("updateResource")) return;
|
|
5083
|
+
const t = this.findResourceOrGroup(e), s = this.shadowRoot?.querySelector(
|
|
5084
|
+
`.resource-title[data-resource-id="${this.cssEscape(e)}"]`
|
|
5085
|
+
);
|
|
5086
|
+
if (!t || !s || s.querySelector("input")) return;
|
|
5087
|
+
const r = t.title, n = document.createElement("input");
|
|
5088
|
+
n.type = "text", n.className = "form-control form-control-sm rename-input", n.value = r, n.setAttribute(
|
|
5089
|
+
"aria-label",
|
|
5090
|
+
this.msg("renameResourceLabel", { title: r })
|
|
5091
|
+
);
|
|
5092
|
+
let i = !1;
|
|
5093
|
+
const o = (a) => {
|
|
5094
|
+
if (i) return;
|
|
5095
|
+
i = !0;
|
|
5096
|
+
const l = n.value.trim();
|
|
5097
|
+
s.textContent = a && l ? l : r, a && l && l !== r && (this.eventEmitter.emitResourceUpdate(t, { title: l }, new CustomEvent("rename")), this.liveAnnouncer.announce(
|
|
5098
|
+
this.msg("resourceRenamed", { from: r, to: l })
|
|
5099
|
+
)), requestAnimationFrame(() => {
|
|
5100
|
+
this.shadowRoot?.querySelector(
|
|
5101
|
+
`.scheduler-timeline-slot[data-resource-id="${this.cssEscape(e)}"]`
|
|
5102
|
+
)?.focus({ preventScroll: !0 });
|
|
5103
|
+
});
|
|
5104
|
+
};
|
|
5105
|
+
n.addEventListener("keydown", (a) => {
|
|
5106
|
+
a.stopPropagation(), a.key === "Enter" ? (a.preventDefault(), o(!0)) : a.key === "Escape" && (a.preventDefault(), o(!1));
|
|
5107
|
+
}), n.addEventListener("blur", () => o(!0)), n.addEventListener("pointerdown", (a) => a.stopPropagation()), s.textContent = "", s.appendChild(n), n.focus(), n.select();
|
|
5108
|
+
}
|
|
5109
|
+
/** The in-grid pointer delete (D12.4b's revised home). */
|
|
5110
|
+
deleteFromEditor() {
|
|
5111
|
+
const e = this.editorEventId ? this.getEventById(this.editorEventId) : null;
|
|
5112
|
+
if (e) {
|
|
5113
|
+
if (!this.can("deleteEvent", e)) {
|
|
5114
|
+
this.announceDenied();
|
|
5115
|
+
return;
|
|
5116
|
+
}
|
|
5117
|
+
this.closeEventEditor(), this.eventEmitter.emitEventDelete(e), requestAnimationFrame(() => this.focusFocusedCell());
|
|
5118
|
+
}
|
|
4015
5119
|
}
|
|
4016
5120
|
/**
|
|
4017
5121
|
* Route a "+N more" activation through `options.moreLinkBehavior`. Returns the
|
|
@@ -4032,37 +5136,37 @@ class I extends ee {
|
|
|
4032
5136
|
}
|
|
4033
5137
|
firstUpdated() {
|
|
4034
5138
|
const e = this.shadowRoot.querySelector(".scheduler-header");
|
|
4035
|
-
this.contentContainer = this.shadowRoot.querySelector(".scheduler-content"), this.populateHeader(e), this.observeHeaderWidth(e), this.inputHandler = new
|
|
5139
|
+
this.contentContainer = this.shadowRoot.querySelector(".scheduler-content"), this.populateHeader(e), this.observeHeaderWidth(e), this.inputHandler = new Ie(
|
|
4036
5140
|
{
|
|
4037
5141
|
shadowRoot: this.shadowRoot,
|
|
4038
5142
|
getEventById: (t) => this.getEventById(t),
|
|
4039
5143
|
// Pointer gestures ask the same resolver the keyboard paths and the
|
|
4040
5144
|
// affordance rendering use, so all three can never disagree.
|
|
4041
|
-
isEditable: () => this.can("createEvent") || this.can("moveEvent") || this.can("
|
|
5145
|
+
isEditable: () => this.can("createEvent") || this.can("moveEvent") || this.can("resizeEvent"),
|
|
4042
5146
|
isSelectable: () => this.can("selectRange") || this.can("createEvent"),
|
|
4043
5147
|
isEventSelected: (t) => this.stateManager.getState().selectedEvent?.id === t
|
|
4044
5148
|
},
|
|
4045
5149
|
{
|
|
4046
|
-
onPointerDown: (t, s,
|
|
5150
|
+
onPointerDown: (t, s, r) => this.handlePointerDown(t, s, r),
|
|
4047
5151
|
onPointerMove: (t) => this.handlePointerMove(t),
|
|
4048
5152
|
onPointerUp: (t) => this.handlePointerUp(t),
|
|
4049
5153
|
onClick: (t, s) => this.handleClick(t, s),
|
|
4050
5154
|
onDoubleClick: (t, s) => this.handleDoubleClick(t, s),
|
|
4051
5155
|
getScrollContainer: () => this.contentContainer
|
|
4052
5156
|
}
|
|
4053
|
-
), this.inputHandler.attach(), this.shadowRoot.addEventListener("focusin", this.boundHandleFocusIn), this.shadowRoot.addEventListener("change", this.boundHandleValueChange), this.renderView();
|
|
5157
|
+
), this.inputHandler.attach(), this.shadowRoot.addEventListener("focusin", this.boundHandleFocusIn), this.shadowRoot.addEventListener("change", this.boundHandleValueChange), this.shadowRoot.addEventListener("contextmenu", this.boundHandleContextMenu), this.shadowRoot.addEventListener("dblclick", this.boundHandleDblClick), this.renderView();
|
|
4054
5158
|
}
|
|
4055
5159
|
populateHeader(e) {
|
|
4056
5160
|
const t = document.createElement("nav");
|
|
4057
5161
|
t.className = "scheduler-nav", t.setAttribute("aria-label", this.msg("navLabel"));
|
|
4058
5162
|
const s = document.createElement("button");
|
|
4059
5163
|
s.type = "button", s.textContent = "‹", s.setAttribute("aria-label", this.msg("previousPeriod")), s.title = this.msg("previousPeriod"), s.addEventListener("click", () => this.prev());
|
|
5164
|
+
const r = document.createElement("button");
|
|
5165
|
+
r.type = "button", r.textContent = "›", r.setAttribute("aria-label", this.msg("nextPeriod")), r.title = this.msg("nextPeriod"), r.addEventListener("click", () => this.next());
|
|
4060
5166
|
const n = document.createElement("button");
|
|
4061
|
-
n.type = "button", n.textContent = "
|
|
4062
|
-
const i = document.createElement("
|
|
4063
|
-
i.
|
|
4064
|
-
const r = document.createElement("div");
|
|
4065
|
-
r.className = "scheduler-title", r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), this.updateTitle(r);
|
|
5167
|
+
n.type = "button", n.textContent = this.msg("today"), n.setAttribute("aria-label", this.msg("jumpToToday")), n.addEventListener("click", () => this.today()), t.appendChild(s), t.appendChild(r), t.appendChild(n);
|
|
5168
|
+
const i = document.createElement("div");
|
|
5169
|
+
i.className = "scheduler-title", i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true"), this.updateTitle(i);
|
|
4066
5170
|
const o = document.createElement("div");
|
|
4067
5171
|
o.className = "scheduler-view-switcher", o.setAttribute("role", "group"), o.setAttribute("aria-label", this.msg("switchView"));
|
|
4068
5172
|
const a = ["year", "month", "week", "day", "timeline"];
|
|
@@ -4072,30 +5176,30 @@ class I extends ee {
|
|
|
4072
5176
|
const c = l === this.view;
|
|
4073
5177
|
d.setAttribute("aria-pressed", String(c)), c && d.classList.add("active"), d.addEventListener("click", () => this.changeView(l)), o.appendChild(d);
|
|
4074
5178
|
}
|
|
4075
|
-
e.appendChild(t), e.appendChild(
|
|
5179
|
+
e.appendChild(t), e.appendChild(i), e.appendChild(o);
|
|
4076
5180
|
}
|
|
4077
5181
|
updateTitle(e) {
|
|
4078
5182
|
const t = e ?? this.shadowRoot.querySelector(".scheduler-title");
|
|
4079
5183
|
if (!t) return;
|
|
4080
|
-
const s = this.stateManager.getState(), { date:
|
|
5184
|
+
const s = this.stateManager.getState(), { date: r, view: n, options: i } = s;
|
|
4081
5185
|
let o = "";
|
|
4082
|
-
switch (
|
|
5186
|
+
switch (n) {
|
|
4083
5187
|
case "year":
|
|
4084
|
-
o =
|
|
5188
|
+
o = r.getFullYear().toString();
|
|
4085
5189
|
break;
|
|
4086
5190
|
case "month":
|
|
4087
|
-
o = h.formatDate(
|
|
5191
|
+
o = h.formatDate(r, i.locale, {
|
|
4088
5192
|
month: "long",
|
|
4089
5193
|
year: "numeric"
|
|
4090
5194
|
});
|
|
4091
5195
|
break;
|
|
4092
5196
|
case "week":
|
|
4093
5197
|
case "timeline": {
|
|
4094
|
-
const a = h.getWeekStart(
|
|
4095
|
-
o = `${h.formatDate(a,
|
|
5198
|
+
const a = h.getWeekStart(r, i.firstDayOfWeek), l = h.addDays(a, 6);
|
|
5199
|
+
o = `${h.formatDate(a, i.locale, {
|
|
4096
5200
|
month: "short",
|
|
4097
5201
|
day: "numeric"
|
|
4098
|
-
})} - ${h.formatDate(l,
|
|
5202
|
+
})} - ${h.formatDate(l, i.locale, {
|
|
4099
5203
|
month: "short",
|
|
4100
5204
|
day: "numeric",
|
|
4101
5205
|
year: "numeric"
|
|
@@ -4103,7 +5207,7 @@ class I extends ee {
|
|
|
4103
5207
|
break;
|
|
4104
5208
|
}
|
|
4105
5209
|
case "day":
|
|
4106
|
-
o = h.formatDate(
|
|
5210
|
+
o = h.formatDate(r, i.locale, {
|
|
4107
5211
|
weekday: "long",
|
|
4108
5212
|
month: "long",
|
|
4109
5213
|
day: "numeric",
|
|
@@ -4123,9 +5227,9 @@ class I extends ee {
|
|
|
4123
5227
|
*/
|
|
4124
5228
|
observeHeaderWidth(e) {
|
|
4125
5229
|
typeof ResizeObserver > "u" || (this.headerResizeObserver = new ResizeObserver((t) => {
|
|
4126
|
-
const
|
|
4127
|
-
|
|
4128
|
-
e.toggleAttribute("data-narrow",
|
|
5230
|
+
const r = (t[0]?.contentRect.width ?? e.clientWidth) < F.NARROW_HEADER_WIDTH;
|
|
5231
|
+
r !== this.headerIsNarrow && (this.headerIsNarrow = r, requestAnimationFrame(() => {
|
|
5232
|
+
e.toggleAttribute("data-narrow", r);
|
|
4129
5233
|
}));
|
|
4130
5234
|
}), this.headerResizeObserver.observe(e));
|
|
4131
5235
|
}
|
|
@@ -4138,16 +5242,16 @@ class I extends ee {
|
|
|
4138
5242
|
this.currentView = new N(this.contentContainer, e), this.currentViewType = "year";
|
|
4139
5243
|
break;
|
|
4140
5244
|
case "month":
|
|
4141
|
-
this.currentView = new
|
|
5245
|
+
this.currentView = new z(this.contentContainer, e), this.currentViewType = "month";
|
|
4142
5246
|
break;
|
|
4143
5247
|
case "week":
|
|
4144
|
-
this.currentView = new
|
|
5248
|
+
this.currentView = new we(this.contentContainer, e), this.currentViewType = "week";
|
|
4145
5249
|
break;
|
|
4146
5250
|
case "day":
|
|
4147
|
-
this.currentView = new
|
|
5251
|
+
this.currentView = new Ee(this.contentContainer, e), this.currentViewType = "day";
|
|
4148
5252
|
break;
|
|
4149
5253
|
case "timeline":
|
|
4150
|
-
this.currentView = new
|
|
5254
|
+
this.currentView = new A(this.contentContainer, e), this.currentViewType = "timeline";
|
|
4151
5255
|
break;
|
|
4152
5256
|
}
|
|
4153
5257
|
this.currentView?.render();
|
|
@@ -4156,21 +5260,21 @@ class I extends ee {
|
|
|
4156
5260
|
// State Change Handling
|
|
4157
5261
|
// ============================================
|
|
4158
5262
|
onStateChange(e) {
|
|
4159
|
-
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);
|
|
5263
|
+
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), (this.popoverDate || this.editorEventId) && this.requestUpdate();
|
|
4160
5264
|
}
|
|
4161
5265
|
detectAndEmitChanges(e) {
|
|
4162
|
-
const t = this.previousView !== null && this.previousView !== e.view, s = this.previousDate !== null && this.previousDate.getTime() !== e.date.getTime(),
|
|
5266
|
+
const t = this.previousView !== null && this.previousView !== e.view, s = this.previousDate !== null && this.previousDate.getTime() !== e.date.getTime(), r = e.selectedEvent?.id ?? null, n = W(e), i = n ? `${n.start.getTime()}-${n.end.getTime()}-${e.selectionResourceId ?? ""}` : null, o = this.previousSelectedEventId !== r || this.previousRangeKey !== i;
|
|
4163
5267
|
(t || s) && this.eventEmitter.emitViewChange(e.view, e.date), o && this.eventEmitter.emitSelectionChange(
|
|
4164
5268
|
e.selectedEvent,
|
|
4165
|
-
|
|
5269
|
+
n,
|
|
4166
5270
|
e.view,
|
|
4167
5271
|
e.selectionResourceId ?? void 0
|
|
4168
|
-
), this.previousView = e.view, this.previousDate = new Date(e.date), this.previousSelectedEventId =
|
|
5272
|
+
), this.previousView = e.view, this.previousDate = new Date(e.date), this.previousSelectedEventId = r, this.previousRangeKey = i;
|
|
4169
5273
|
}
|
|
4170
5274
|
updateUI(e) {
|
|
4171
5275
|
this.updateTitle(), this.shadowRoot.querySelectorAll(".scheduler-view-switcher button").forEach((s) => {
|
|
4172
|
-
const
|
|
4173
|
-
|
|
5276
|
+
const r = s, n = r.dataset.view === e.view;
|
|
5277
|
+
r.classList.toggle("active", n), r.setAttribute("aria-pressed", String(n));
|
|
4174
5278
|
}), this.currentView && (this.currentViewType !== e.view ? this.renderView() : e.dragState || e.previewEvent ? this.scheduleDragUpdate(e) : this.currentView.update(e));
|
|
4175
5279
|
}
|
|
4176
5280
|
scheduleDragUpdate(e) {
|
|
@@ -4184,7 +5288,19 @@ class I extends ee {
|
|
|
4184
5288
|
// Input Handling (Callbacks from InputHandler)
|
|
4185
5289
|
// ============================================
|
|
4186
5290
|
handlePointerDown(e, t, s) {
|
|
4187
|
-
this.dragManager.handlePointerDown(e, t, s);
|
|
5291
|
+
this.allowsGesture(t) && this.dragManager.handlePointerDown(e, t, s);
|
|
5292
|
+
}
|
|
5293
|
+
allowsGesture(e) {
|
|
5294
|
+
switch (e.type) {
|
|
5295
|
+
case "event":
|
|
5296
|
+
return this.can("moveEvent", e.event);
|
|
5297
|
+
case "resize-handle":
|
|
5298
|
+
return this.canResizeEdge(e.resizeHandle === "start" ? "start" : "end", e.event);
|
|
5299
|
+
case "slot":
|
|
5300
|
+
return this.can("createEvent") || this.can("selectRange");
|
|
5301
|
+
default:
|
|
5302
|
+
return !0;
|
|
5303
|
+
}
|
|
4188
5304
|
}
|
|
4189
5305
|
handlePointerMove(e) {
|
|
4190
5306
|
this.dragManager.handlePointerMove(e), this.updateEdgeScroll(e);
|
|
@@ -4221,10 +5337,10 @@ class I extends ee {
|
|
|
4221
5337
|
this.stopEdgeScroll();
|
|
4222
5338
|
return;
|
|
4223
5339
|
}
|
|
4224
|
-
const s = t.getBoundingClientRect(),
|
|
5340
|
+
const s = t.getBoundingClientRect(), r = F.EDGE_SCROLL_ZONE_PX, n = F.EDGE_SCROLL_MAX_PX, i = (o, a, l) => o < a + r ? -Math.min(1, (a + r - o) / r) * n : o > l - r ? Math.min(1, (o - (l - r)) / r) * n : 0;
|
|
4225
5341
|
if (this.edgeScrollVector = {
|
|
4226
|
-
x:
|
|
4227
|
-
y:
|
|
5342
|
+
x: i(e.clientX, s.left, s.right),
|
|
5343
|
+
y: i(e.clientY, s.top, s.bottom)
|
|
4228
5344
|
}, this.edgeScrollPointer = e, this.edgeScrollVector.x === 0 && this.edgeScrollVector.y === 0) {
|
|
4229
5345
|
this.stopEdgeScroll();
|
|
4230
5346
|
return;
|
|
@@ -4236,8 +5352,8 @@ class I extends ee {
|
|
|
4236
5352
|
this.edgeScrollFrame = null;
|
|
4237
5353
|
const e = this.contentContainer, t = this.edgeScrollPointer;
|
|
4238
5354
|
if (!e || !t || !this.dragManager.isDragging()) return;
|
|
4239
|
-
const s = e.scrollLeft,
|
|
4240
|
-
e.scrollLeft = s + this.edgeScrollVector.x, e.scrollTop =
|
|
5355
|
+
const s = e.scrollLeft, r = e.scrollTop;
|
|
5356
|
+
e.scrollLeft = s + this.edgeScrollVector.x, e.scrollTop = r + this.edgeScrollVector.y, !(e.scrollLeft === s && e.scrollTop === r) && (this.dragManager.handlePointerMove(t), this.scheduleEdgeScroll());
|
|
4241
5357
|
});
|
|
4242
5358
|
}
|
|
4243
5359
|
stopEdgeScroll() {
|
|
@@ -4247,8 +5363,8 @@ class I extends ee {
|
|
|
4247
5363
|
this.DBLCLICK_WINDOW_MS = 500;
|
|
4248
5364
|
}
|
|
4249
5365
|
registerEventActivation(e, t) {
|
|
4250
|
-
const s = Date.now(),
|
|
4251
|
-
this.lastEventActivation = { eventId: e.id, time: s },
|
|
5366
|
+
const s = Date.now(), r = this.lastEventActivation;
|
|
5367
|
+
this.lastEventActivation = { eventId: e.id, time: s }, r && r.eventId === e.id && s - r.time < F.DBLCLICK_WINDOW_MS && (this.lastEventActivation = null, this.eventEmitter.emitEventDblClick(e, t), this.tryOpenEventEditor(e));
|
|
4252
5368
|
}
|
|
4253
5369
|
handleDragComplete(e, t) {
|
|
4254
5370
|
if (e.wasClick) {
|
|
@@ -4262,7 +5378,9 @@ class I extends ee {
|
|
|
4262
5378
|
{ start: e.preview.start, end: e.preview.end },
|
|
4263
5379
|
s.view,
|
|
4264
5380
|
t,
|
|
4265
|
-
|
|
5381
|
+
// `null` (created in the bucket row) maps to "no resource" on the
|
|
5382
|
+
// wire — the emitted field stays `string | undefined`.
|
|
5383
|
+
e.preview.resourceId ?? void 0
|
|
4266
5384
|
);
|
|
4267
5385
|
break;
|
|
4268
5386
|
}
|
|
@@ -4275,7 +5393,7 @@ class I extends ee {
|
|
|
4275
5393
|
start: e.preview.start,
|
|
4276
5394
|
end: e.preview.end
|
|
4277
5395
|
};
|
|
4278
|
-
this.stateManager.updateEvent(s), this.eventEmitter.emitEventUpdate(
|
|
5396
|
+
e.preview.resourceId !== void 0 && (e.preview.resourceId === null ? delete s.resourceId : s.resourceId = e.preview.resourceId), this.stateManager.updateEvent(s), this.eventEmitter.emitEventUpdate(
|
|
4279
5397
|
s,
|
|
4280
5398
|
e.originalEvent,
|
|
4281
5399
|
t
|
|
@@ -4288,25 +5406,25 @@ class I extends ee {
|
|
|
4288
5406
|
handleClick(e, t) {
|
|
4289
5407
|
const s = e.target;
|
|
4290
5408
|
if (this.handleResourceAction(s, e.originalEvent)) return;
|
|
4291
|
-
const
|
|
4292
|
-
if (
|
|
4293
|
-
const a =
|
|
5409
|
+
const r = s.closest(".expand-toggle");
|
|
5410
|
+
if (r) {
|
|
5411
|
+
const a = r.dataset.groupId;
|
|
4294
5412
|
if (a) {
|
|
4295
5413
|
this.stateManager.toggleGroupCollapse(a), this.renderView();
|
|
4296
5414
|
return;
|
|
4297
5415
|
}
|
|
4298
5416
|
}
|
|
4299
|
-
const
|
|
4300
|
-
if (
|
|
4301
|
-
const a =
|
|
5417
|
+
const n = s.closest(".scheduler-more-link");
|
|
5418
|
+
if (n) {
|
|
5419
|
+
const a = n.dataset.date;
|
|
4302
5420
|
if (a) {
|
|
4303
5421
|
this.handleMoreLink(a);
|
|
4304
5422
|
return;
|
|
4305
5423
|
}
|
|
4306
5424
|
}
|
|
4307
|
-
const
|
|
4308
|
-
if (
|
|
4309
|
-
const a =
|
|
5425
|
+
const i = s.closest("[data-date]");
|
|
5426
|
+
if (i) {
|
|
5427
|
+
const a = i.dataset.date;
|
|
4310
5428
|
if (a) {
|
|
4311
5429
|
const l = this.parseDayKey(a);
|
|
4312
5430
|
if (this.eventEmitter.emitDateClick(l, e.originalEvent), s.closest(".day-number")) {
|
|
@@ -4314,7 +5432,8 @@ class I extends ee {
|
|
|
4314
5432
|
return;
|
|
4315
5433
|
}
|
|
4316
5434
|
if (this.stateManager.getState().options.dayClickAction === "popover") {
|
|
4317
|
-
|
|
5435
|
+
const d = s.closest(".scheduler-year-month");
|
|
5436
|
+
this.openDayPopover(l, d?.id);
|
|
4318
5437
|
return;
|
|
4319
5438
|
}
|
|
4320
5439
|
}
|
|
@@ -4339,14 +5458,14 @@ class I extends ee {
|
|
|
4339
5458
|
handleResourceAction(e, t) {
|
|
4340
5459
|
const s = e.closest("[data-action]");
|
|
4341
5460
|
if (!s) return !1;
|
|
4342
|
-
const { action:
|
|
4343
|
-
switch (
|
|
5461
|
+
const { action: r, parentId: n, resourceId: i } = s.dataset, o = this.stateManager.getState().view;
|
|
5462
|
+
switch (r) {
|
|
4344
5463
|
case "add-resource":
|
|
4345
|
-
return this.can("createResource") && this.eventEmitter.emitResourceCreate("resource", o, t,
|
|
5464
|
+
return this.can("createResource") && this.eventEmitter.emitResourceCreate("resource", o, t, n), !0;
|
|
4346
5465
|
case "add-group":
|
|
4347
|
-
return this.can("createGroup") && this.eventEmitter.emitResourceCreate("group", o, t,
|
|
5466
|
+
return this.can("createGroup") && this.eventEmitter.emitResourceCreate("group", o, t, n), !0;
|
|
4348
5467
|
case "delete-resource": {
|
|
4349
|
-
const a =
|
|
5468
|
+
const a = i ? this.findResourceOrGroup(i) : null;
|
|
4350
5469
|
return a && this.can("deleteResource") && this.eventEmitter.emitResourceDelete(a, t), !0;
|
|
4351
5470
|
}
|
|
4352
5471
|
// The colour input reports through `change`, not `click` — a click merely
|
|
@@ -4366,21 +5485,21 @@ class I extends ee {
|
|
|
4366
5485
|
handleValueChange(e) {
|
|
4367
5486
|
const t = e.composedPath?.()[0] ?? e.target;
|
|
4368
5487
|
if (!t || t.dataset.action !== "set-resource-color" || !this.can("updateResource")) return;
|
|
4369
|
-
const { resourceId: s, field:
|
|
4370
|
-
if (!
|
|
4371
|
-
const
|
|
5488
|
+
const { resourceId: s, field: r } = t.dataset, n = s ? this.findResourceOrGroup(s) : null;
|
|
5489
|
+
if (!n) return;
|
|
5490
|
+
const i = t.value;
|
|
4372
5491
|
this.eventEmitter.emitResourceUpdate(
|
|
4373
|
-
|
|
4374
|
-
|
|
5492
|
+
n,
|
|
5493
|
+
r === "eventColor" ? { eventColor: i } : { color: i },
|
|
4375
5494
|
e
|
|
4376
5495
|
);
|
|
4377
5496
|
}
|
|
4378
5497
|
/** Resolve a resource or group by id from the current `resources` input. */
|
|
4379
5498
|
findResourceOrGroup(e) {
|
|
4380
|
-
return
|
|
5499
|
+
return R.findById(this.stateManager.getState().resources, e) ?? null;
|
|
4381
5500
|
}
|
|
4382
5501
|
handleDoubleClick(e, t) {
|
|
4383
|
-
t.type === "event" && t.event && this.eventEmitter.emitEventDblClick(t.event, e.originalEvent);
|
|
5502
|
+
t.type === "event" && t.event && (this.eventEmitter.emitEventDblClick(t.event, e.originalEvent), this.tryOpenEventEditor(t.event));
|
|
4384
5503
|
}
|
|
4385
5504
|
/**
|
|
4386
5505
|
* When focus lands on an event block (Tab, programmatic, or click), select
|
|
@@ -4394,18 +5513,22 @@ class I extends ee {
|
|
|
4394
5513
|
handleFocusIn(e) {
|
|
4395
5514
|
const s = (e.composedPath?.() ?? [])[0] ?? e.target;
|
|
4396
5515
|
if (!s || !s.dataset) return;
|
|
4397
|
-
const
|
|
4398
|
-
if (!
|
|
5516
|
+
const r = s.dataset.eventId;
|
|
5517
|
+
if (!r || !s.classList.contains("scheduler-event") && !s.classList.contains("scheduler-timeline-event") && !s.classList.contains("scheduler-month-event"))
|
|
4399
5518
|
return;
|
|
4400
|
-
const
|
|
4401
|
-
|
|
4402
|
-
const
|
|
4403
|
-
this.shadowRoot?.querySelector(
|
|
5519
|
+
const n = this.getEventById(r);
|
|
5520
|
+
n && this.stateManager.getState().selectedEvent?.id !== n.id && (this.stateManager.setSelectedEvent(n), this.eventEmitter.emitEventSelected(n, e), requestAnimationFrame(() => {
|
|
5521
|
+
const i = `[data-event-id="${this.cssEscape(n.id)}"]`;
|
|
5522
|
+
this.shadowRoot?.querySelector(i)?.focus({ preventScroll: !0 });
|
|
4404
5523
|
}));
|
|
4405
5524
|
}
|
|
4406
5525
|
handleKeyDown(e) {
|
|
4407
5526
|
if (this.dayPopover.isOpen) {
|
|
4408
|
-
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.closeDayPopover());
|
|
5527
|
+
e.key === "Escape" && this.dayPopover.isTopmost && (e.preventDefault(), e.stopPropagation(), this.closeDayPopover());
|
|
5528
|
+
return;
|
|
5529
|
+
}
|
|
5530
|
+
if (this.eventEditorOverlay.isOpen) {
|
|
5531
|
+
e.key === "Escape" && this.eventEditorOverlay.isTopmost && (e.preventDefault(), e.stopPropagation(), this.closeEventEditor());
|
|
4409
5532
|
return;
|
|
4410
5533
|
}
|
|
4411
5534
|
if (this.keyboardMove) {
|
|
@@ -4467,7 +5590,19 @@ class I extends ee {
|
|
|
4467
5590
|
*/
|
|
4468
5591
|
can(e, t) {
|
|
4469
5592
|
const { options: s } = this.stateManager.getState();
|
|
4470
|
-
return
|
|
5593
|
+
return Q(e, {
|
|
5594
|
+
permissions: this.effectivePermissions(s),
|
|
5595
|
+
event: t ?? null
|
|
5596
|
+
});
|
|
5597
|
+
}
|
|
5598
|
+
/**
|
|
5599
|
+
* "May this edge be dragged?" — for the three DIRECT-MANIPULATION surfaces
|
|
5600
|
+
* only (resize handles, the pointer gesture, Shift/Alt+Shift+Arrow), where
|
|
5601
|
+
* the edge belongs to the gesture. Everything else asks `can('resizeEvent')`.
|
|
5602
|
+
*/
|
|
5603
|
+
canResizeEdge(e, t) {
|
|
5604
|
+
const { options: s } = this.stateManager.getState();
|
|
5605
|
+
return K(e, {
|
|
4471
5606
|
permissions: this.effectivePermissions(s),
|
|
4472
5607
|
event: t ?? null
|
|
4473
5608
|
});
|
|
@@ -4503,7 +5638,7 @@ class I extends ee {
|
|
|
4503
5638
|
}
|
|
4504
5639
|
/** Enter move mode only if the event may actually be moved or resized. */
|
|
4505
5640
|
tryEnterEventMoveMode(e) {
|
|
4506
|
-
const t = this.can("moveEvent", e), s = this.can("
|
|
5641
|
+
const t = this.can("moveEvent", e), s = this.can("resizeEvent", e);
|
|
4507
5642
|
if (!t && !s) {
|
|
4508
5643
|
this.announceDenied();
|
|
4509
5644
|
return;
|
|
@@ -4532,6 +5667,11 @@ class I extends ee {
|
|
|
4532
5667
|
case "Enter":
|
|
4533
5668
|
e.preventDefault(), this.tryEnterEventMoveMode(s);
|
|
4534
5669
|
return;
|
|
5670
|
+
// The keyboard face of double-click/right-click (D12.8b) — F2, matching
|
|
5671
|
+
// the resource rename key, and the editing convention everywhere else.
|
|
5672
|
+
case "F2":
|
|
5673
|
+
e.preventDefault(), this.tryOpenEventEditor(s);
|
|
5674
|
+
return;
|
|
4535
5675
|
case "Delete":
|
|
4536
5676
|
case "Backspace":
|
|
4537
5677
|
if (e.preventDefault(), !this.can("deleteEvent", s)) {
|
|
@@ -4557,17 +5697,17 @@ class I extends ee {
|
|
|
4557
5697
|
* No wrap at the ends — matches the APG list/feed pattern.
|
|
4558
5698
|
*/
|
|
4559
5699
|
focusAdjacentEvent(e, t) {
|
|
4560
|
-
const
|
|
5700
|
+
const r = [...this.stateManager.getState().events].sort((l, d) => {
|
|
4561
5701
|
const c = l.start.getTime() - d.start.getTime();
|
|
4562
5702
|
return c !== 0 ? c : l.id.localeCompare(d.id);
|
|
4563
|
-
}),
|
|
4564
|
-
if (
|
|
4565
|
-
const
|
|
4566
|
-
if (!
|
|
5703
|
+
}), n = r.findIndex((l) => l.id === e.id);
|
|
5704
|
+
if (n < 0) return;
|
|
5705
|
+
const i = r[n + t];
|
|
5706
|
+
if (!i) return;
|
|
4567
5707
|
const o = this.shadowRoot;
|
|
4568
5708
|
if (!o) return;
|
|
4569
5709
|
o.querySelector(
|
|
4570
|
-
`[data-event-id="${this.cssEscape(
|
|
5710
|
+
`[data-event-id="${this.cssEscape(i.id)}"]`
|
|
4571
5711
|
)?.focus({ preventScroll: !1 });
|
|
4572
5712
|
}
|
|
4573
5713
|
handleCellKeyDown(e) {
|
|
@@ -4580,26 +5720,30 @@ class I extends ee {
|
|
|
4580
5720
|
this.handleYearCellKeyDown(e);
|
|
4581
5721
|
return;
|
|
4582
5722
|
}
|
|
4583
|
-
t.focusedCell || this.initFocusedCellFromActive()
|
|
4584
|
-
|
|
5723
|
+
if (t.focusedCell || this.initFocusedCellFromActive(), e.key === "F2" && t.view === "timeline") {
|
|
5724
|
+
const i = this.stateManager.getState().focusedResourceId;
|
|
5725
|
+
i && (e.preventDefault(), this.beginResourceRename(i));
|
|
5726
|
+
return;
|
|
5727
|
+
}
|
|
5728
|
+
const s = e.shiftKey, r = e.ctrlKey || e.metaKey, n = t.view === "timeline";
|
|
4585
5729
|
switch (e.key) {
|
|
4586
5730
|
case "ArrowUp":
|
|
4587
|
-
e.preventDefault(),
|
|
5731
|
+
e.preventDefault(), n ? this.moveCellByResource(-1, s) : this.moveCellByTime(-1, s);
|
|
4588
5732
|
break;
|
|
4589
5733
|
case "ArrowDown":
|
|
4590
|
-
e.preventDefault(),
|
|
5734
|
+
e.preventDefault(), n ? this.moveCellByResource(1, s) : this.moveCellByTime(1, s);
|
|
4591
5735
|
break;
|
|
4592
5736
|
case "ArrowLeft":
|
|
4593
|
-
e.preventDefault(),
|
|
5737
|
+
e.preventDefault(), n ? this.moveCellByTime(-1, s) : this.moveCellByDay(-1, s);
|
|
4594
5738
|
break;
|
|
4595
5739
|
case "ArrowRight":
|
|
4596
|
-
e.preventDefault(),
|
|
5740
|
+
e.preventDefault(), n ? this.moveCellByTime(1, s) : this.moveCellByDay(1, s);
|
|
4597
5741
|
break;
|
|
4598
5742
|
case "Home":
|
|
4599
|
-
e.preventDefault(),
|
|
5743
|
+
e.preventDefault(), r ? this.moveCellToViewExtreme("start", s) : this.moveCellToColumnExtreme("start", s);
|
|
4600
5744
|
break;
|
|
4601
5745
|
case "End":
|
|
4602
|
-
e.preventDefault(),
|
|
5746
|
+
e.preventDefault(), r ? this.moveCellToViewExtreme("end", s) : this.moveCellToColumnExtreme("end", s);
|
|
4603
5747
|
break;
|
|
4604
5748
|
case "PageUp":
|
|
4605
5749
|
e.preventDefault(), this.moveCellByPeriod(-1);
|
|
@@ -4625,8 +5769,8 @@ class I extends ee {
|
|
|
4625
5769
|
if (!e) return;
|
|
4626
5770
|
const t = e.dataset.start, s = e.dataset.end;
|
|
4627
5771
|
if (!t || !s) return;
|
|
4628
|
-
const
|
|
4629
|
-
this.stateManager.setFocusedCell(
|
|
5772
|
+
const r = { start: new Date(t), end: new Date(s) }, n = e.dataset.resourceId ?? null;
|
|
5773
|
+
this.stateManager.setFocusedCell(r, n, !0);
|
|
4630
5774
|
}
|
|
4631
5775
|
/**
|
|
4632
5776
|
* Month-view keyboard handler (PRD scheduler-controlled-selection §5.1).
|
|
@@ -4690,6 +5834,16 @@ class I extends ee {
|
|
|
4690
5834
|
t && (this.stateManager.setDate(new Date(t)), this.stateManager.setView("month"));
|
|
4691
5835
|
return;
|
|
4692
5836
|
}
|
|
5837
|
+
// The keyboard face of clicking a mini-day, at the card's own
|
|
5838
|
+
// granularity: a MONTH-scoped popover (events grouped by day). Mini-days
|
|
5839
|
+
// stay unfocusable by design, so the panel is where a keyboard user gets
|
|
5840
|
+
// day-level detail without a ~500-cell grid.
|
|
5841
|
+
case " ": {
|
|
5842
|
+
e.preventDefault();
|
|
5843
|
+
const t = this.stateManager.getState(), s = t.focusedDate ?? t.date;
|
|
5844
|
+
this.openDayPopover(s, void 0, "month");
|
|
5845
|
+
return;
|
|
5846
|
+
}
|
|
4693
5847
|
}
|
|
4694
5848
|
}
|
|
4695
5849
|
/**
|
|
@@ -4704,12 +5858,12 @@ class I extends ee {
|
|
|
4704
5858
|
t && this.stateManager.setFocusedDate(this.parseDayKey(t));
|
|
4705
5859
|
}
|
|
4706
5860
|
moveFocusedDateByDays(e) {
|
|
4707
|
-
const t = this.stateManager.getState(), s = t.focusedDate ?? t.date,
|
|
4708
|
-
|
|
5861
|
+
const t = this.stateManager.getState(), s = t.focusedDate ?? t.date, r = new Date(s);
|
|
5862
|
+
r.setDate(r.getDate() + e), this.commitFocusedDate(r);
|
|
4709
5863
|
}
|
|
4710
5864
|
moveFocusedDateByMonths(e) {
|
|
4711
|
-
const t = this.stateManager.getState(), s = t.focusedDate ?? t.date,
|
|
4712
|
-
|
|
5865
|
+
const t = this.stateManager.getState(), s = t.focusedDate ?? t.date, r = new Date(s);
|
|
5866
|
+
r.setMonth(r.getMonth() + e), this.commitFocusedDate(r);
|
|
4713
5867
|
}
|
|
4714
5868
|
/**
|
|
4715
5869
|
* Apply a focused-date update. If the new date crosses the displayed
|
|
@@ -4732,8 +5886,8 @@ class I extends ee {
|
|
|
4732
5886
|
scrollAndFocusDateCell(e) {
|
|
4733
5887
|
const t = this.stateManager.getState(), s = this.shadowRoot;
|
|
4734
5888
|
if (!s) return;
|
|
4735
|
-
const
|
|
4736
|
-
|
|
5889
|
+
const r = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, n = t.view === "year" ? `scheduler-cell-y-${r}` : `scheduler-cell-m-${r}-${String(e.getDate()).padStart(2, "0")}`, i = s.getElementById(n);
|
|
5890
|
+
i && (i.focus({ preventScroll: !0 }), typeof i.scrollIntoView == "function" && i.scrollIntoView({ block: "nearest", inline: "nearest" }));
|
|
4737
5891
|
}
|
|
4738
5892
|
/**
|
|
4739
5893
|
* Emit `event-create` covering the focused day (month view) or focused
|
|
@@ -4741,81 +5895,81 @@ class I extends ee {
|
|
|
4741
5895
|
* scheduler-controlled-selection — consumer constructs the actual event.
|
|
4742
5896
|
*/
|
|
4743
5897
|
commitFocusedDateAsCreate(e, t) {
|
|
4744
|
-
const s = this.stateManager.getState(),
|
|
4745
|
-
if (!
|
|
5898
|
+
const s = this.stateManager.getState(), r = s.focusedDate;
|
|
5899
|
+
if (!r) return;
|
|
5900
|
+
const n = new Date(r);
|
|
5901
|
+
n.setHours(0, 0, 0, 0);
|
|
4746
5902
|
const i = new Date(n);
|
|
4747
|
-
i.
|
|
4748
|
-
const r = new Date(i);
|
|
4749
|
-
if (t === "day" ? r.setDate(r.getDate() + 1) : r.setMonth(r.getMonth() + 1), !this.can("createEvent") || !this.allowsCreateAt({ start: i, end: r })) {
|
|
5903
|
+
if (t === "day" ? i.setDate(i.getDate() + 1) : i.setMonth(i.getMonth() + 1), !this.can("createEvent") || !this.allowsCreateAt({ start: n, end: i })) {
|
|
4750
5904
|
this.announceDenied();
|
|
4751
5905
|
return;
|
|
4752
5906
|
}
|
|
4753
5907
|
this.eventEmitter.emitEventCreate(
|
|
4754
|
-
{ start:
|
|
5908
|
+
{ start: n, end: i },
|
|
4755
5909
|
s.view,
|
|
4756
5910
|
e
|
|
4757
5911
|
);
|
|
4758
5912
|
}
|
|
4759
5913
|
moveCellByTime(e, t) {
|
|
4760
|
-
const s = this.stateManager.getState(),
|
|
4761
|
-
if (!
|
|
4762
|
-
const
|
|
4763
|
-
this.cellIsWithinView(
|
|
5914
|
+
const s = this.stateManager.getState(), r = s.focusedCell;
|
|
5915
|
+
if (!r) return;
|
|
5916
|
+
const n = (s.options.slotDuration ?? 1800) * 1e3, i = new Date(r.start.getTime() + e * n), o = new Date(i.getTime() + n);
|
|
5917
|
+
this.cellIsWithinView(i, s) && this.commitFocusMove({ start: i, end: o }, s.focusedResourceId, t);
|
|
4764
5918
|
}
|
|
4765
5919
|
/** Week view ArrowLeft/Right: ±1 day, same time-of-day. No-op on day view. */
|
|
4766
5920
|
moveCellByDay(e, t) {
|
|
4767
|
-
const s = this.stateManager.getState(),
|
|
4768
|
-
if (!
|
|
4769
|
-
const
|
|
4770
|
-
|
|
4771
|
-
const o = new Date(
|
|
4772
|
-
this.cellIsWithinView(
|
|
5921
|
+
const s = this.stateManager.getState(), r = s.focusedCell;
|
|
5922
|
+
if (!r || s.view !== "week") return;
|
|
5923
|
+
const n = (s.options.slotDuration ?? 1800) * 1e3, i = new Date(r.start);
|
|
5924
|
+
i.setDate(i.getDate() + e);
|
|
5925
|
+
const o = new Date(i.getTime() + n);
|
|
5926
|
+
this.cellIsWithinView(i, s) && this.commitFocusMove({ start: i, end: o }, null, t);
|
|
4773
5927
|
}
|
|
4774
5928
|
/** Timeline ArrowUp/Down: ±1 resource, same time-of-day. PRD D1: cross-resource
|
|
4775
5929
|
* Shift+Arrow is intentionally ignored (resource is categorical). */
|
|
4776
5930
|
moveCellByResource(e, t) {
|
|
4777
|
-
const s = this.stateManager.getState(),
|
|
4778
|
-
if (!
|
|
4779
|
-
const
|
|
4780
|
-
|
|
5931
|
+
const s = this.stateManager.getState(), r = s.focusedCell;
|
|
5932
|
+
if (!r || s.view !== "timeline" || t) return;
|
|
5933
|
+
const n = this.adjacentRow(s.focusedResourceId, e, s);
|
|
5934
|
+
n !== void 0 && this.commitFocusMove(r, n, !1);
|
|
4781
5935
|
}
|
|
4782
5936
|
moveCellToColumnExtreme(e, t) {
|
|
4783
|
-
const s = this.stateManager.getState(),
|
|
4784
|
-
if (!
|
|
4785
|
-
const
|
|
4786
|
-
|
|
4787
|
-
const
|
|
4788
|
-
|
|
5937
|
+
const s = this.stateManager.getState(), r = s.focusedCell;
|
|
5938
|
+
if (!r) return;
|
|
5939
|
+
const n = new Date(r.start);
|
|
5940
|
+
n.setHours(0, 0, 0, 0);
|
|
5941
|
+
const i = h.getTimeSlots(
|
|
5942
|
+
n,
|
|
4789
5943
|
s.options.slotDuration,
|
|
4790
5944
|
s.options.slotMinTime,
|
|
4791
5945
|
s.options.slotMaxTime
|
|
4792
|
-
), o = e === "start" ?
|
|
5946
|
+
), o = e === "start" ? i[0] : i[i.length - 1];
|
|
4793
5947
|
o && this.commitFocusMove(o, s.focusedResourceId, t);
|
|
4794
5948
|
}
|
|
4795
5949
|
moveCellToViewExtreme(e, t) {
|
|
4796
5950
|
const s = this.stateManager.getState();
|
|
4797
|
-
let
|
|
5951
|
+
let r = null, n = s.focusedResourceId;
|
|
4798
5952
|
switch (s.view) {
|
|
4799
5953
|
case "day": {
|
|
4800
|
-
const
|
|
4801
|
-
|
|
5954
|
+
const i = h.getTimeSlots(s.date, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
|
|
5955
|
+
r = e === "start" ? i[0] : i[i.length - 1];
|
|
4802
5956
|
break;
|
|
4803
5957
|
}
|
|
4804
5958
|
case "week": {
|
|
4805
|
-
const
|
|
4806
|
-
|
|
5959
|
+
const i = h.getWeekDays(s.date, s.options.firstDayOfWeek), o = e === "start" ? i[0] : i[6], a = h.getTimeSlots(o, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
|
|
5960
|
+
r = e === "start" ? a[0] : a[a.length - 1];
|
|
4807
5961
|
break;
|
|
4808
5962
|
}
|
|
4809
5963
|
case "timeline": {
|
|
4810
|
-
const o =
|
|
5964
|
+
const o = R.flatten(s.resources, s.collapsedGroups).filter((c) => c.visible && G(c.item));
|
|
4811
5965
|
if (o.length === 0) return;
|
|
4812
|
-
|
|
5966
|
+
n = e === "start" ? o[0].item.id : o[o.length - 1].item.id;
|
|
4813
5967
|
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);
|
|
4814
|
-
|
|
5968
|
+
r = e === "start" ? d[0] : d[d.length - 1];
|
|
4815
5969
|
break;
|
|
4816
5970
|
}
|
|
4817
5971
|
}
|
|
4818
|
-
|
|
5972
|
+
r && this.commitFocusMove(r, n, t);
|
|
4819
5973
|
}
|
|
4820
5974
|
/**
|
|
4821
5975
|
* PageUp/PageDown — advance one period (week or day) and re-focus the same
|
|
@@ -4823,17 +5977,17 @@ class I extends ee {
|
|
|
4823
5977
|
* crossing a period boundary breaks the linear-range invariant.
|
|
4824
5978
|
*/
|
|
4825
5979
|
moveCellByPeriod(e) {
|
|
4826
|
-
const t = this.stateManager.getState(), s = t.focusedCell,
|
|
5980
|
+
const t = this.stateManager.getState(), s = t.focusedCell, r = t.date;
|
|
4827
5981
|
if (e > 0 ? this.next() : this.prev(), !s) return;
|
|
4828
|
-
const
|
|
4829
|
-
let
|
|
4830
|
-
if (
|
|
4831
|
-
|
|
5982
|
+
const n = this.stateManager.getState();
|
|
5983
|
+
let i;
|
|
5984
|
+
if (n.view === "day")
|
|
5985
|
+
i = new Date(n.date), i.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
|
|
4832
5986
|
else {
|
|
4833
|
-
const l = h.getWeekDays(
|
|
4834
|
-
|
|
5987
|
+
const l = h.getWeekDays(r, t.options.firstDayOfWeek), d = h.getWeekDays(n.date, n.options.firstDayOfWeek), c = l.findIndex((m) => h.isSameDay(m, s.start)), u = d[Math.max(0, c)] ?? d[0];
|
|
5988
|
+
i = new Date(u), i.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
|
|
4835
5989
|
}
|
|
4836
|
-
const o = (
|
|
5990
|
+
const o = (n.options.slotDuration ?? 1800) * 1e3, a = { start: i, end: new Date(i.getTime() + o) };
|
|
4837
5991
|
this.commitFocusMove(a, t.focusedResourceId, !1);
|
|
4838
5992
|
}
|
|
4839
5993
|
/**
|
|
@@ -4842,49 +5996,59 @@ class I extends ee {
|
|
|
4842
5996
|
* focused cell or selection range.
|
|
4843
5997
|
*/
|
|
4844
5998
|
commitFocusMove(e, t, s) {
|
|
4845
|
-
const
|
|
5999
|
+
const r = this.stateManager.getState(), n = r.options.slotDuration ?? 1800;
|
|
4846
6000
|
if (s) {
|
|
4847
6001
|
this.stateManager.extendSelection(e, t), this.stateManager.setFocusedCell(e, t, !1);
|
|
4848
|
-
const
|
|
4849
|
-
this.liveAnnouncer.announce(
|
|
6002
|
+
const i = this.stateManager.getState();
|
|
6003
|
+
this.liveAnnouncer.announce(me(i, n));
|
|
4850
6004
|
} else {
|
|
4851
6005
|
this.stateManager.setFocusedCell(e, t, !0);
|
|
4852
|
-
const
|
|
4853
|
-
this.liveAnnouncer.announce(
|
|
6006
|
+
const i = this.getResourceTitle(t);
|
|
6007
|
+
this.liveAnnouncer.announce(ve(e, r.options, i));
|
|
4854
6008
|
}
|
|
4855
6009
|
this.scrollAndFocusCell(e, t);
|
|
4856
6010
|
}
|
|
4857
6011
|
cellIsWithinView(e, t) {
|
|
4858
6012
|
switch (t.view) {
|
|
4859
6013
|
case "day": {
|
|
4860
|
-
const s = this.parseTimeOnDay(t.date, t.options.slotMinTime),
|
|
4861
|
-
return e.getTime() >= s.getTime() && e.getTime() <
|
|
6014
|
+
const s = this.parseTimeOnDay(t.date, t.options.slotMinTime), r = this.parseTimeOnDay(t.date, t.options.slotMaxTime);
|
|
6015
|
+
return e.getTime() >= s.getTime() && e.getTime() < r.getTime();
|
|
4862
6016
|
}
|
|
4863
6017
|
case "week":
|
|
4864
6018
|
case "timeline": {
|
|
4865
|
-
const s = h.getWeekDays(t.date, t.options.firstDayOfWeek),
|
|
4866
|
-
return e.getTime() >=
|
|
6019
|
+
const s = h.getWeekDays(t.date, t.options.firstDayOfWeek), r = this.parseTimeOnDay(s[0], t.options.slotMinTime), n = this.parseTimeOnDay(s[6], t.options.slotMaxTime);
|
|
6020
|
+
return e.getTime() >= r.getTime() && e.getTime() < n.getTime();
|
|
4867
6021
|
}
|
|
4868
6022
|
default:
|
|
4869
6023
|
return !1;
|
|
4870
6024
|
}
|
|
4871
6025
|
}
|
|
4872
6026
|
parseTimeOnDay(e, t) {
|
|
4873
|
-
const [s,
|
|
4874
|
-
return
|
|
4875
|
-
}
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
6027
|
+
const [s, r, n] = (t ?? "00:00:00").split(":").map(Number), i = new Date(e);
|
|
6028
|
+
return i.setHours(0, 0, 0, 0), i.setSeconds((s ?? 0) * 3600 + (r ?? 0) * 60 + (n ?? 0)), i;
|
|
6029
|
+
}
|
|
6030
|
+
/**
|
|
6031
|
+
* Walk the timeline's RENDERED row order: visible leaf resources, then the
|
|
6032
|
+
* bucket row when it exists — the same list the view draws, so keyboard
|
|
6033
|
+
* navigation can reach everything the eye can see (B25).
|
|
6034
|
+
*
|
|
6035
|
+
* Tri-state result: a string is the next resource row, `null` is the bucket
|
|
6036
|
+
* row, `undefined` means "no move" (already at the edge, or nothing to walk).
|
|
6037
|
+
* The old version returned `null` for BOTH of the last two, which is exactly
|
|
6038
|
+
* why the bucket was unreachable by keyboard.
|
|
6039
|
+
*/
|
|
6040
|
+
adjacentRow(e, t, s) {
|
|
6041
|
+
const n = R.flatten(s.resources, s.collapsedGroups).filter((a) => a.visible && G(a.item)).map((a) => a.item.id);
|
|
6042
|
+
if ((s.eventsByResource.get(null) ?? []).length > 0 && n.push(null), n.length === 0) return;
|
|
6043
|
+
const i = n.indexOf(e);
|
|
6044
|
+
if (i < 0) return n[0];
|
|
6045
|
+
const o = i + t;
|
|
6046
|
+
if (!(o < 0 || o >= n.length))
|
|
6047
|
+
return n[o];
|
|
4884
6048
|
}
|
|
4885
6049
|
getResourceTitle(e) {
|
|
4886
6050
|
if (!e) return null;
|
|
4887
|
-
for (const t of
|
|
6051
|
+
for (const t of R.getAllResources(this.stateManager.getState().resources))
|
|
4888
6052
|
if (t.id === e) return t.title;
|
|
4889
6053
|
return null;
|
|
4890
6054
|
}
|
|
@@ -4894,10 +6058,21 @@ class I extends ee {
|
|
|
4894
6058
|
* drag-near-edge auto-pan (PRD D6).
|
|
4895
6059
|
*/
|
|
4896
6060
|
scrollAndFocusCell(e, t) {
|
|
4897
|
-
const s = e.start
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
6061
|
+
const s = this.timeCellElement(e.start, t);
|
|
6062
|
+
s && (s.focus({ preventScroll: !0 }), typeof s.scrollIntoView == "function" && s.scrollIntoView({ block: "nearest", inline: "nearest" }));
|
|
6063
|
+
}
|
|
6064
|
+
/**
|
|
6065
|
+
* Resolve the grid cell for a (time, row) pair. Bucket-aware: on the
|
|
6066
|
+
* timeline, `null` means the unassigned row, whose slots carry
|
|
6067
|
+
* `data-unassigned` instead of a resource id — the old null branch looked up
|
|
6068
|
+
* `.scheduler-time-slot`, which belongs to week/day and found nothing there,
|
|
6069
|
+
* so keyboard focus could never land in the bucket row (B25).
|
|
6070
|
+
*/
|
|
6071
|
+
timeCellElement(e, t) {
|
|
6072
|
+
const s = this.shadowRoot;
|
|
6073
|
+
if (!s) return null;
|
|
6074
|
+
const r = e.toISOString(), i = this.stateManager.getState().view === "timeline" ? t ? `.scheduler-timeline-slot[data-resource-id="${this.cssEscape(t)}"][data-start="${r}"]` : `.scheduler-timeline-slot[data-unassigned][data-start="${r}"]` : `.scheduler-time-slot[data-start="${r}"]`;
|
|
6075
|
+
return s.querySelector(i);
|
|
4901
6076
|
}
|
|
4902
6077
|
/** Re-focus whatever cell the keyboard model currently considers focused. */
|
|
4903
6078
|
focusFocusedCell() {
|
|
@@ -4929,26 +6104,26 @@ class I extends ee {
|
|
|
4929
6104
|
* whether/when to clear the selection.
|
|
4930
6105
|
*/
|
|
4931
6106
|
createEventFromCellOrSelection(e) {
|
|
4932
|
-
const t = this.stateManager.getState(), s =
|
|
4933
|
-
let n, i
|
|
6107
|
+
const t = this.stateManager.getState(), s = W(t);
|
|
6108
|
+
let r, n, i;
|
|
4934
6109
|
if (s)
|
|
4935
|
-
|
|
6110
|
+
r = s.start, n = s.end, i = t.selectionResourceId ?? void 0;
|
|
4936
6111
|
else if (t.focusedCell)
|
|
4937
|
-
|
|
6112
|
+
r = t.focusedCell.start, n = t.focusedCell.end, i = t.focusedResourceId ?? void 0;
|
|
4938
6113
|
else
|
|
4939
6114
|
return;
|
|
4940
|
-
if (!this.can("createEvent") || !this.allowsCreateAt({ start:
|
|
6115
|
+
if (!this.can("createEvent") || !this.allowsCreateAt({ start: r, end: n }, i)) {
|
|
4941
6116
|
this.announceDenied();
|
|
4942
6117
|
return;
|
|
4943
6118
|
}
|
|
4944
6119
|
this.eventEmitter.emitEventCreate(
|
|
4945
|
-
{ start:
|
|
6120
|
+
{ start: r, end: n },
|
|
4946
6121
|
t.view,
|
|
4947
6122
|
e,
|
|
4948
|
-
|
|
6123
|
+
i
|
|
4949
6124
|
), this.liveAnnouncer.announce(this.msg("selectionCommitted", {
|
|
4950
|
-
start: h.formatTime(
|
|
4951
|
-
end: h.formatTime(
|
|
6125
|
+
start: h.formatTime(r, t.options.timeFormat),
|
|
6126
|
+
end: h.formatTime(n, t.options.timeFormat)
|
|
4952
6127
|
}));
|
|
4953
6128
|
}
|
|
4954
6129
|
/**
|
|
@@ -4972,12 +6147,18 @@ class I extends ee {
|
|
|
4972
6147
|
previewEvent: {
|
|
4973
6148
|
start: new Date(e.start),
|
|
4974
6149
|
end: new Date(e.end),
|
|
4975
|
-
|
|
6150
|
+
// Explicit, not a truthiness spread: `null` (an unassigned event) IS
|
|
6151
|
+
// the bucket row, and dropping it made the ghost render in the wrong
|
|
6152
|
+
// row the moment the user nudged rows (B26).
|
|
6153
|
+
resourceId: t
|
|
4976
6154
|
}
|
|
4977
6155
|
});
|
|
4978
|
-
const s = this.minutesPerSlot();
|
|
6156
|
+
const s = this.minutesPerSlot(), r = this.stateManager.getState().view === "timeline";
|
|
4979
6157
|
this.liveAnnouncer.announce(
|
|
4980
|
-
this.msg("
|
|
6158
|
+
this.msg(r ? "moveModeEnteredTimeline" : "moveModeEntered", {
|
|
6159
|
+
title: e.title,
|
|
6160
|
+
minutes: s
|
|
6161
|
+
})
|
|
4981
6162
|
), requestAnimationFrame(() => {
|
|
4982
6163
|
const n = `[data-event-id="${this.cssEscape(e.id)}"]`;
|
|
4983
6164
|
this.shadowRoot?.querySelector(n)?.focus({ preventScroll: !0 });
|
|
@@ -5002,19 +6183,19 @@ class I extends ee {
|
|
|
5002
6183
|
e.preventDefault(), this.commitEventMoveMode();
|
|
5003
6184
|
return;
|
|
5004
6185
|
}
|
|
5005
|
-
const t = this.stateManager.getState().view, s = t === "timeline",
|
|
6186
|
+
const t = this.stateManager.getState().view, s = t === "timeline", r = this.minutesPerSlot() * 60 * 1e3, n = e.shiftKey, i = e.altKey;
|
|
5006
6187
|
switch (e.key) {
|
|
5007
6188
|
case "ArrowUp":
|
|
5008
|
-
e.preventDefault(), s ? !
|
|
6189
|
+
e.preventDefault(), s ? !n && !i && this.nudgeKeyboardMoveResource(-1) : n && i ? this.resizeKeyboardMoveEdge("start", -r) : n ? this.resizeKeyboardMoveEdge("end", -r) : this.nudgeKeyboardMove(-r);
|
|
5009
6190
|
return;
|
|
5010
6191
|
case "ArrowDown":
|
|
5011
|
-
e.preventDefault(), s ? !
|
|
6192
|
+
e.preventDefault(), s ? !n && !i && this.nudgeKeyboardMoveResource(1) : n && i ? this.resizeKeyboardMoveEdge("start", +r) : n ? this.resizeKeyboardMoveEdge("end", +r) : this.nudgeKeyboardMove(+r);
|
|
5012
6193
|
return;
|
|
5013
6194
|
case "ArrowLeft":
|
|
5014
|
-
e.preventDefault(), s ?
|
|
6195
|
+
e.preventDefault(), s ? n && i ? this.resizeKeyboardMoveEdge("start", -r) : n ? this.resizeKeyboardMoveEdge("end", -r) : this.nudgeKeyboardMove(-r) : t === "week" && (n && i ? this.resizeKeyboardMoveEdge("start", -864e5) : n ? this.resizeKeyboardMoveEdge("end", -864e5) : this.nudgeKeyboardMove(-864e5));
|
|
5015
6196
|
return;
|
|
5016
6197
|
case "ArrowRight":
|
|
5017
|
-
e.preventDefault(), s ?
|
|
6198
|
+
e.preventDefault(), s ? n && i ? this.resizeKeyboardMoveEdge("start", +r) : n ? this.resizeKeyboardMoveEdge("end", +r) : this.nudgeKeyboardMove(+r) : t === "week" && (n && i ? this.resizeKeyboardMoveEdge("start", 864e5) : n ? this.resizeKeyboardMoveEdge("end", 864e5) : this.nudgeKeyboardMove(864e5));
|
|
5018
6199
|
return;
|
|
5019
6200
|
}
|
|
5020
6201
|
}
|
|
@@ -5026,15 +6207,15 @@ class I extends ee {
|
|
|
5026
6207
|
nudgeKeyboardMove(e) {
|
|
5027
6208
|
if (!this.keyboardMove) return;
|
|
5028
6209
|
const t = new Date(this.keyboardMove.workingStart.getTime() + e), s = new Date(this.keyboardMove.workingEnd.getTime() + e);
|
|
5029
|
-
this.keyboardMove.workingStart = t, this.keyboardMove.workingEnd = s, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(
|
|
6210
|
+
this.keyboardMove.workingStart = t, this.keyboardMove.workingEnd = s, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(ge(t, s, this.stateManager.getState().options));
|
|
5030
6211
|
}
|
|
5031
|
-
/** Walk to the next/previous
|
|
6212
|
+
/** Walk to the next/previous row (timeline only). Updates the preview's resourceId. */
|
|
5032
6213
|
nudgeKeyboardMoveResource(e) {
|
|
5033
6214
|
if (!this.keyboardMove) return;
|
|
5034
|
-
const t = this.
|
|
5035
|
-
if (
|
|
6215
|
+
const t = this.adjacentRow(this.keyboardMove.workingResourceId, e, this.stateManager.getState());
|
|
6216
|
+
if (t === void 0) return;
|
|
5036
6217
|
this.keyboardMove.workingResourceId = t, this.applyKeyboardMovePreview();
|
|
5037
|
-
const s = this.getResourceTitle(t) ?? t;
|
|
6218
|
+
const s = t === null ? this.msg("unassignedResource") : this.getResourceTitle(t) ?? t;
|
|
5038
6219
|
this.liveAnnouncer.announce(this.msg("movedToResource", { resource: s }));
|
|
5039
6220
|
}
|
|
5040
6221
|
/**
|
|
@@ -5044,34 +6225,37 @@ class I extends ee {
|
|
|
5044
6225
|
resizeKeyboardMoveEdge(e, t) {
|
|
5045
6226
|
if (!this.keyboardMove) return;
|
|
5046
6227
|
const s = this.getEventById(this.keyboardMove.eventId);
|
|
5047
|
-
if (!this.
|
|
6228
|
+
if (!this.canResizeEdge(e, s)) {
|
|
5048
6229
|
this.announceDenied();
|
|
5049
6230
|
return;
|
|
5050
6231
|
}
|
|
5051
|
-
const
|
|
5052
|
-
let
|
|
6232
|
+
const r = this.minutesPerSlot() * 60 * 1e3;
|
|
6233
|
+
let n = this.keyboardMove.workingStart, i = this.keyboardMove.workingEnd;
|
|
5053
6234
|
if (e === "end") {
|
|
5054
|
-
if (
|
|
5055
|
-
} else if (
|
|
5056
|
-
this.keyboardMove.workingStart =
|
|
6235
|
+
if (i = new Date(i.getTime() + t), i.getTime() - n.getTime() < r) return;
|
|
6236
|
+
} else if (n = new Date(n.getTime() + t), i.getTime() - n.getTime() < r) return;
|
|
6237
|
+
this.keyboardMove.workingStart = n, this.keyboardMove.workingEnd = i, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(fe(n, i, e, this.stateManager.getState().options));
|
|
5057
6238
|
}
|
|
5058
6239
|
/** Mirror keyboardMove.working* into state.previewEvent so views render the destination,
|
|
5059
6240
|
* then scroll the destination into view so the sighted-keyboard user can see it (PRD D6). */
|
|
5060
6241
|
applyKeyboardMovePreview() {
|
|
5061
6242
|
if (!this.keyboardMove) return;
|
|
5062
|
-
const { eventId: e, workingStart: t, workingEnd: s, workingResourceId:
|
|
6243
|
+
const { eventId: e, workingStart: t, workingEnd: s, workingResourceId: r } = this.keyboardMove;
|
|
5063
6244
|
this.stateManager.setState({
|
|
5064
6245
|
previewEvent: {
|
|
5065
6246
|
start: t,
|
|
5066
6247
|
end: s,
|
|
5067
|
-
|
|
6248
|
+
// Explicit: `null` = the bucket row. A truthiness spread dropped it,
|
|
6249
|
+
// so a nudge INTO the bucket rendered the ghost back in the event's
|
|
6250
|
+
// original row (B26).
|
|
6251
|
+
resourceId: r
|
|
5068
6252
|
}
|
|
5069
6253
|
}), requestAnimationFrame(() => {
|
|
5070
|
-
const
|
|
5071
|
-
if (!
|
|
5072
|
-
|
|
5073
|
-
const o =
|
|
5074
|
-
|
|
6254
|
+
const n = this.shadowRoot;
|
|
6255
|
+
if (!n) return;
|
|
6256
|
+
n.querySelector(`[data-event-id="${this.cssEscape(e)}"]`)?.focus({ preventScroll: !0 });
|
|
6257
|
+
const o = this.timeCellElement(t, r);
|
|
6258
|
+
o && typeof o.scrollIntoView == "function" && o.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
5075
6259
|
});
|
|
5076
6260
|
}
|
|
5077
6261
|
commitEventMoveMode() {
|
|
@@ -5081,10 +6265,9 @@ class I extends ee {
|
|
|
5081
6265
|
const t = {
|
|
5082
6266
|
...e,
|
|
5083
6267
|
start: this.keyboardMove.workingStart,
|
|
5084
|
-
end: this.keyboardMove.workingEnd
|
|
5085
|
-
...this.keyboardMove.workingResourceId ? { resourceId: this.keyboardMove.workingResourceId } : {}
|
|
6268
|
+
end: this.keyboardMove.workingEnd
|
|
5086
6269
|
};
|
|
5087
|
-
this.stateManager.updateEvent(t), this.eventEmitter.emitEventUpdate(t, e, new CustomEvent("keyboard-move")), this.liveAnnouncer.announce(this.msg("moveCommitted"));
|
|
6270
|
+
this.keyboardMove.workingResourceId === null ? delete t.resourceId : t.resourceId = this.keyboardMove.workingResourceId, this.stateManager.updateEvent(t), this.eventEmitter.emitEventUpdate(t, e, new CustomEvent("keyboard-move")), this.liveAnnouncer.announce(this.msg("moveCommitted"));
|
|
5088
6271
|
}
|
|
5089
6272
|
this.keyboardMove = null, this.stateManager.setState({ keyboardMoveEventId: null, previewEvent: null }), requestAnimationFrame(() => {
|
|
5090
6273
|
const t = `[data-event-id="${this.cssEscape(e?.id ?? "")}"]`;
|
|
@@ -5113,32 +6296,32 @@ class I extends ee {
|
|
|
5113
6296
|
// Slot Resolution
|
|
5114
6297
|
// ============================================
|
|
5115
6298
|
getSlotAtPosition(e, t) {
|
|
5116
|
-
const
|
|
5117
|
-
(
|
|
6299
|
+
const r = this.shadowRoot.elementsFromPoint(e, t).find(
|
|
6300
|
+
(n) => n.matches(".scheduler-time-slot, .scheduler-timeline-slot")
|
|
5118
6301
|
);
|
|
5119
|
-
return
|
|
6302
|
+
return r ? this.getSlotFromElement(r) : null;
|
|
5120
6303
|
}
|
|
5121
6304
|
getSlotFromElement(e) {
|
|
5122
6305
|
const t = e.dataset.start, s = e.dataset.end;
|
|
5123
6306
|
if (!t || !s) return null;
|
|
5124
|
-
const
|
|
6307
|
+
const r = e.dataset.resourceId ?? (e.dataset.unassigned ? null : void 0);
|
|
5125
6308
|
return {
|
|
5126
6309
|
start: new Date(t),
|
|
5127
6310
|
end: new Date(s),
|
|
5128
|
-
...
|
|
6311
|
+
...r !== void 0 ? { resourceId: r } : {}
|
|
5129
6312
|
};
|
|
5130
6313
|
}
|
|
5131
6314
|
}
|
|
5132
|
-
typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler",
|
|
6315
|
+
typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler", F);
|
|
5133
6316
|
export {
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
6317
|
+
B as BaseView,
|
|
6318
|
+
Ee as DayView,
|
|
6319
|
+
z as MonthView,
|
|
6320
|
+
F as MpScheduler,
|
|
6321
|
+
pe as SchedulerStateManager,
|
|
6322
|
+
A as TimelineView,
|
|
6323
|
+
we as WeekView,
|
|
5141
6324
|
N as YearView,
|
|
5142
|
-
|
|
5143
|
-
|
|
6325
|
+
ue as createInitialState,
|
|
6326
|
+
xe as schedulerStyles
|
|
5144
6327
|
};
|