@mintplayer/web-components 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/{color-CpFtrIoX.mjs → id-D5QCG603.mjs} +346 -305
- package/package.json +1 -1
- package/scheduler/index.mjs +1656 -478
- package/scheduler/src/components/mp-scheduler.d.ts +150 -0
- package/scheduler/src/events/index.d.ts +0 -1
- package/scheduler/src/events/scheduler-event-emitter.d.ts +20 -4
- package/scheduler/src/state/scheduler-state.d.ts +49 -7
- package/scheduler/src/views/base-view.d.ts +29 -0
- package/scheduler/src/views/day-view.d.ts +6 -0
- package/scheduler/src/views/timeline-view.d.ts +95 -4
- package/scheduler/src/views/week-view.d.ts +6 -0
- package/scheduler-core/index.mjs +62 -58
- package/scheduler-core/src/models/events.d.ts +76 -90
- package/scheduler-core/src/models/index.d.ts +1 -0
- package/scheduler-core/src/models/messages.d.ts +34 -0
- package/scheduler-core/src/models/options.d.ts +56 -16
- package/scheduler-core/src/models/permissions.d.ts +83 -0
- package/scheduler-core/src/models/time-slot.d.ts +10 -0
- package/scheduler-core/src/services/resource.service.d.ts +25 -11
- package/scheduler-core/src/utils/color.d.ts +22 -0
- package/scheduler/src/events/event-types.d.ts +0 -58
package/scheduler/index.mjs
CHANGED
|
@@ -1,22 +1,59 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import { L as
|
|
3
|
-
import { D as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { unsafeCSS as Q, LitElement as ee, html as A, nothing as G } from "lit";
|
|
2
|
+
import { L as te } from "../chunks/live-announcer-Bi0orG4n.mjs";
|
|
3
|
+
import { D as se, q as R, d as h, u as x, i as S, t as j, o as ne, s as O, w as D, v as T, p as W, j as ie } from "../chunks/id-D5QCG603.mjs";
|
|
4
|
+
import { O as re } from "../chunks/overlay-controller-DPt13i8p.mjs";
|
|
5
|
+
function X(u, e = []) {
|
|
6
|
+
for (const t of u) {
|
|
7
|
+
if (R(t)) {
|
|
8
|
+
X(t.children, e);
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
for (const s of t.events ?? [])
|
|
12
|
+
e.push(s.resourceId ? s : { ...s, resourceId: t.id });
|
|
13
|
+
}
|
|
14
|
+
return e;
|
|
15
|
+
}
|
|
16
|
+
function q(u, e) {
|
|
17
|
+
const t = X(e);
|
|
18
|
+
if (t.length === 0) return u;
|
|
19
|
+
const s = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const i of t) s.set(i.id, i);
|
|
21
|
+
const n = [];
|
|
22
|
+
for (const i of u)
|
|
23
|
+
s.has(i.id) && n.push(i.id), s.set(i.id, i);
|
|
24
|
+
return n.length > 0 && console.warn(
|
|
25
|
+
`[mp-scheduler] ${n.length} event id(s) appear in both the "events" input and under a resource; the "events" entry wins. Ids: ${n.join(", ")}`
|
|
26
|
+
), [...s.values()];
|
|
27
|
+
}
|
|
28
|
+
function oe(u, e, t) {
|
|
29
|
+
const s = new Set(e), n = (i) => {
|
|
30
|
+
for (const r of i)
|
|
31
|
+
R(r) && (t.has(r.id) || (t.add(r.id), r.collapsed && s.add(r.id)), n(r.children));
|
|
32
|
+
};
|
|
33
|
+
return n(u), s;
|
|
34
|
+
}
|
|
35
|
+
function Z(u, e = /* @__PURE__ */ new Map()) {
|
|
36
|
+
for (const t of u)
|
|
37
|
+
R(t) ? Z(t.children, e) : e.set(t.id, t);
|
|
38
|
+
return e;
|
|
39
|
+
}
|
|
40
|
+
function ae(u) {
|
|
41
|
+
const e = /* @__PURE__ */ new Map();
|
|
42
|
+
for (const t of u) {
|
|
43
|
+
const s = t.resourceId ?? null, n = e.get(s);
|
|
44
|
+
n ? n.push(t) : e.set(s, [t]);
|
|
45
|
+
}
|
|
46
|
+
return e;
|
|
47
|
+
}
|
|
48
|
+
function le(u = {}) {
|
|
49
|
+
const e = { ...se, ...u };
|
|
16
50
|
return {
|
|
17
51
|
view: e.initialView,
|
|
18
52
|
date: e.initialDate,
|
|
19
53
|
events: [],
|
|
54
|
+
eventsByResource: /* @__PURE__ */ new Map(),
|
|
55
|
+
resourceById: /* @__PURE__ */ new Map(),
|
|
56
|
+
resolvedPermissions: {},
|
|
20
57
|
resources: [],
|
|
21
58
|
options: e,
|
|
22
59
|
selectedEvent: null,
|
|
@@ -36,9 +73,9 @@ function j(m = {}) {
|
|
|
36
73
|
focusedDate: null
|
|
37
74
|
};
|
|
38
75
|
}
|
|
39
|
-
class
|
|
76
|
+
class de {
|
|
40
77
|
constructor(e = {}) {
|
|
41
|
-
this.listeners = /* @__PURE__ */ new Set(), this.state =
|
|
78
|
+
this.listeners = /* @__PURE__ */ new Set(), this.warnedUnassignedIds = /* @__PURE__ */ new Set(), this.flatEventsInput = [], this.seededGroupIds = /* @__PURE__ */ new Set(), this.state = le(e);
|
|
42
79
|
}
|
|
43
80
|
/**
|
|
44
81
|
* Get current state
|
|
@@ -50,8 +87,26 @@ class X {
|
|
|
50
87
|
* Update state with partial update or updater function
|
|
51
88
|
*/
|
|
52
89
|
setState(e) {
|
|
53
|
-
const t = typeof e == "function" ? e(this.state) : e;
|
|
54
|
-
this.state =
|
|
90
|
+
const t = typeof e == "function" ? e(this.state) : e, s = { ...this.state, ...t };
|
|
91
|
+
(s.events !== this.state.events || !this.state.eventsByResource) && (s.eventsByResource = ae(s.events)), (s.resources !== this.state.resources || !this.state.resourceById) && (s.resourceById = Z(s.resources)), this.state = s, this.warnUnassignedEvents(), this.notifyListeners();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* `options.requireEventResource` is a DEVELOPMENT signal, not a filter: the
|
|
95
|
+
* event still renders in the bucket row, because hiding data a consumer handed
|
|
96
|
+
* us is the trap this whole area exists to avoid. One warning per id, so a
|
|
97
|
+
* drag that re-renders sixty times a second cannot flood the console.
|
|
98
|
+
*/
|
|
99
|
+
warnUnassignedEvents() {
|
|
100
|
+
if (!this.state.options.requireEventResource) return;
|
|
101
|
+
const e = (this.state.eventsByResource?.get(null) ?? []).filter(
|
|
102
|
+
(t) => !this.warnedUnassignedIds.has(t.id)
|
|
103
|
+
);
|
|
104
|
+
if (e.length !== 0) {
|
|
105
|
+
for (const t of e) this.warnedUnassignedIds.add(t.id);
|
|
106
|
+
console.warn(
|
|
107
|
+
`[mp-scheduler] requireEventResource is set, but ${e.length} event(s) have no resourceId. They render in the "(No resource)" row. Ids: ` + e.map((t) => t.id).join(", ")
|
|
108
|
+
);
|
|
109
|
+
}
|
|
55
110
|
}
|
|
56
111
|
/**
|
|
57
112
|
* Subscribe to state changes
|
|
@@ -80,41 +135,58 @@ class X {
|
|
|
80
135
|
this.setState({ date: e });
|
|
81
136
|
}
|
|
82
137
|
/**
|
|
83
|
-
* Set events
|
|
138
|
+
* Set events. The stored `events` is the MERGE of this input and any events
|
|
139
|
+
* authored under resources — every view reads that one list.
|
|
84
140
|
*/
|
|
85
141
|
setEvents(e) {
|
|
86
|
-
this.
|
|
142
|
+
this.flatEventsInput = e, this.setState((t) => ({
|
|
143
|
+
events: q(e, t.resources)
|
|
144
|
+
}));
|
|
87
145
|
}
|
|
88
146
|
/**
|
|
89
|
-
* Add an event
|
|
147
|
+
* Add an event. Lands in the single store regardless of whether it carries a
|
|
148
|
+
* `resourceId`, so a timeline-created event is no longer invisible.
|
|
90
149
|
*/
|
|
91
150
|
addEvent(e) {
|
|
92
|
-
this.setState((t) => ({
|
|
151
|
+
this.flatEventsInput = [...this.flatEventsInput, e], this.setState((t) => ({
|
|
93
152
|
events: [...t.events, e]
|
|
94
153
|
}));
|
|
95
154
|
}
|
|
96
155
|
/**
|
|
97
|
-
* Update an event
|
|
156
|
+
* Update an event. One store, so no double-write: a move across resource rows
|
|
157
|
+
* is now a `resourceId` reassignment rather than a splice between two arrays.
|
|
98
158
|
*/
|
|
99
159
|
updateEvent(e) {
|
|
100
|
-
this.
|
|
101
|
-
|
|
102
|
-
|
|
160
|
+
this.flatEventsInput = this.flatEventsInput.map(
|
|
161
|
+
(t) => t.id === e.id ? e : t
|
|
162
|
+
), this.setState((t) => ({
|
|
163
|
+
events: t.events.map((s) => s.id === e.id ? e : s)
|
|
103
164
|
}));
|
|
104
165
|
}
|
|
105
166
|
/**
|
|
106
|
-
* Remove an event
|
|
167
|
+
* Remove an event. Previously filtered the flat list only, so a
|
|
168
|
+
* resource-nested event removed through the public API kept rendering.
|
|
107
169
|
*/
|
|
108
170
|
removeEvent(e) {
|
|
109
|
-
this.setState((t) => ({
|
|
171
|
+
this.flatEventsInput = this.flatEventsInput.filter((t) => t.id !== e), this.setState((t) => ({
|
|
110
172
|
events: t.events.filter((s) => s.id !== e)
|
|
111
173
|
}));
|
|
112
174
|
}
|
|
113
175
|
/**
|
|
114
|
-
* Set resources
|
|
176
|
+
* Set resources. Re-merges so events authored under the new tree become
|
|
177
|
+
* visible in every view, and honours each group's authored `collapsed` flag
|
|
178
|
+
* (previously declared on the model and read by nothing).
|
|
115
179
|
*/
|
|
116
180
|
setResources(e) {
|
|
117
|
-
this.setState(
|
|
181
|
+
this.setState((t) => ({
|
|
182
|
+
resources: e,
|
|
183
|
+
events: q(this.flatEventsInput, e),
|
|
184
|
+
collapsedGroups: oe(
|
|
185
|
+
e,
|
|
186
|
+
t.collapsedGroups,
|
|
187
|
+
this.seededGroupIds
|
|
188
|
+
)
|
|
189
|
+
}));
|
|
118
190
|
}
|
|
119
191
|
/**
|
|
120
192
|
* Toggle resource group collapse
|
|
@@ -302,12 +374,12 @@ class X {
|
|
|
302
374
|
this.setState({ focusedDate: e });
|
|
303
375
|
}
|
|
304
376
|
}
|
|
305
|
-
function
|
|
306
|
-
const s = t.timeFormat ?? "24h", n = h.formatTime(
|
|
307
|
-
return e && o.push(x(
|
|
377
|
+
function z(u, e, t) {
|
|
378
|
+
const s = t.timeFormat ?? "24h", n = h.formatTime(u.start, s), i = h.formatTime(u.end, s), r = u.start.toLocaleDateString(t.locale, { weekday: "long", month: "short", day: "numeric" }), o = [`${u.title}, ${n}–${i}`, r];
|
|
379
|
+
return e && o.push(S(x(t.messages).eventOnResource, { resource: e })), o.join(", ");
|
|
308
380
|
}
|
|
309
|
-
function
|
|
310
|
-
const { selectionAnchor: e, selectionExtent: t, selectionResourceId: s } =
|
|
381
|
+
function K(u) {
|
|
382
|
+
const { selectionAnchor: e, selectionExtent: t, selectionResourceId: s } = u;
|
|
311
383
|
if (!e || !t) return null;
|
|
312
384
|
const n = Math.min(e.start.getTime(), t.start.getTime()), i = Math.max(e.end.getTime(), t.end.getTime());
|
|
313
385
|
return {
|
|
@@ -316,46 +388,51 @@ function P(m) {
|
|
|
316
388
|
resourceId: s
|
|
317
389
|
};
|
|
318
390
|
}
|
|
319
|
-
function
|
|
320
|
-
const s =
|
|
321
|
-
return !s || s.resourceId && t && s.resourceId !== t ? !1 :
|
|
391
|
+
function U(u, e, t = null) {
|
|
392
|
+
const s = K(e);
|
|
393
|
+
return !s || s.resourceId && t && s.resourceId !== t ? !1 : u.start.getTime() < s.end.getTime() && u.end.getTime() > s.start.getTime();
|
|
322
394
|
}
|
|
323
|
-
function
|
|
324
|
-
const s =
|
|
395
|
+
function ce(u, e, t = null) {
|
|
396
|
+
const s = u.start.toLocaleDateString(e.locale, {
|
|
325
397
|
weekday: "long",
|
|
326
398
|
month: "short",
|
|
327
399
|
day: "numeric"
|
|
328
|
-
}), n = h.formatTime(
|
|
400
|
+
}), n = h.formatTime(u.start, e.timeFormat ?? "24h"), i = [`${s}, ${n}`];
|
|
329
401
|
return t && i.push(t), i.join(", ");
|
|
330
402
|
}
|
|
331
|
-
function
|
|
332
|
-
const t =
|
|
403
|
+
function he(u, e) {
|
|
404
|
+
const t = K(u);
|
|
333
405
|
if (!t) return "";
|
|
334
|
-
const { options: s } =
|
|
335
|
-
return
|
|
406
|
+
const { options: s } = u, n = s.timeFormat ?? "24h", i = { weekday: "short", month: "short", day: "numeric" }, r = `${h.formatTime(t.start, n)} ${t.start.toLocaleDateString(s.locale, i)}`, o = `${h.formatTime(t.end, n)} ${t.end.toLocaleDateString(s.locale, i)}`, a = e * 1e3, l = Math.max(1, Math.round((t.end.getTime() - t.start.getTime()) / a)), d = x(s.messages);
|
|
407
|
+
return S(d.selection, {
|
|
336
408
|
start: r,
|
|
337
409
|
end: o,
|
|
338
410
|
count: l,
|
|
339
411
|
slots: l === 1 ? d.slotSingular : d.slotPlural
|
|
340
412
|
});
|
|
341
413
|
}
|
|
342
|
-
function
|
|
343
|
-
const s = t.timeFormat ?? "24h", n =
|
|
344
|
-
return x(
|
|
345
|
-
start: h.formatTime(
|
|
414
|
+
function ue(u, e, t) {
|
|
415
|
+
const s = t.timeFormat ?? "24h", n = u.toLocaleDateString(t.locale, { weekday: "short", month: "short", day: "numeric" });
|
|
416
|
+
return S(x(t.messages).movedTo, {
|
|
417
|
+
start: h.formatTime(u, s),
|
|
346
418
|
end: h.formatTime(e, s),
|
|
347
419
|
day: n
|
|
348
420
|
});
|
|
349
421
|
}
|
|
350
|
-
function
|
|
351
|
-
const n = s.timeFormat ?? "24h", i =
|
|
352
|
-
return
|
|
422
|
+
function pe(u, e, t, s) {
|
|
423
|
+
const n = s.timeFormat ?? "24h", i = x(s.messages);
|
|
424
|
+
return S(i.resizedEdge, {
|
|
353
425
|
edge: t === "start" ? i.startEdge : i.endEdge,
|
|
354
|
-
start: h.formatTime(
|
|
426
|
+
start: h.formatTime(u, n),
|
|
355
427
|
end: h.formatTime(e, n)
|
|
356
428
|
});
|
|
357
429
|
}
|
|
358
|
-
|
|
430
|
+
const ve = 40, me = 20;
|
|
431
|
+
function _(u, e) {
|
|
432
|
+
const [t = 0, s = 0, n = 0] = e.split(":").map(Number), i = new Date(u);
|
|
433
|
+
return i.setHours(0, 0, 0, 0), i.setSeconds(t * 3600 + s * 60 + n), i;
|
|
434
|
+
}
|
|
435
|
+
class $ {
|
|
359
436
|
constructor(e, t) {
|
|
360
437
|
this.container = e, this.state = t;
|
|
361
438
|
}
|
|
@@ -374,6 +451,47 @@ class A {
|
|
|
374
451
|
/**
|
|
375
452
|
* Helper to create an element with classes
|
|
376
453
|
*/
|
|
454
|
+
/**
|
|
455
|
+
* Vertical geometry for one day-part in a time-grid column, in px.
|
|
456
|
+
*
|
|
457
|
+
* The single source of truth for BOTH committed event boxes and drag ghosts —
|
|
458
|
+
* they drifted apart before, which is how the ghost ended up measuring from a
|
|
459
|
+
* different origin than the box it was previewing.
|
|
460
|
+
*
|
|
461
|
+
* Measures from `slotMinTime`, NOT from midnight: the column's first row is
|
|
462
|
+
* the `slotMinTime` slot, so a midnight origin displaced every box by the
|
|
463
|
+
* whole hidden window (with `slotMinTime: '08:00'` a 09:00 event landed ~640px
|
|
464
|
+
* too low). The part is also clipped to `[slotMinTime, slotMaxTime]` on its own
|
|
465
|
+
* day, so a middle part of a multi-day span renders as the full visible window
|
|
466
|
+
* rather than 24h worth of pixels.
|
|
467
|
+
*
|
|
468
|
+
* Returns `null` when the part falls entirely outside the visible window —
|
|
469
|
+
* callers skip it rather than drawing a zero-height box.
|
|
470
|
+
*/
|
|
471
|
+
/**
|
|
472
|
+
* Apply an event's fill + contrast text colour to its box.
|
|
473
|
+
*
|
|
474
|
+
* One place, so a resource's colour reaches EVERY view — week/day/month/year
|
|
475
|
+
* previously had no route from an event to its resource, which is why
|
|
476
|
+
* `Resource.color`/`eventColor` sat in the model unread.
|
|
477
|
+
*/
|
|
478
|
+
applyEventColors(e, t) {
|
|
479
|
+
const s = j(
|
|
480
|
+
t,
|
|
481
|
+
this.state.resourceById,
|
|
482
|
+
this.state.options.defaultEventColor
|
|
483
|
+
);
|
|
484
|
+
e.style.backgroundColor = s, e.style.color = t.textColor ?? ne(s);
|
|
485
|
+
}
|
|
486
|
+
partGeometry(e, t, s) {
|
|
487
|
+
const n = s.slotDuration ?? 1800, i = _(e, s.slotMinTime ?? "00:00:00"), r = _(e, s.slotMaxTime ?? "24:00:00"), o = Math.max(e.getTime(), i.getTime()), a = Math.min(t.getTime(), r.getTime());
|
|
488
|
+
if (a <= o) return null;
|
|
489
|
+
const l = ve / (n * 1e3);
|
|
490
|
+
return {
|
|
491
|
+
top: (o - i.getTime()) * l,
|
|
492
|
+
height: Math.max((a - o) * l, me)
|
|
493
|
+
};
|
|
494
|
+
}
|
|
377
495
|
createElement(e, ...t) {
|
|
378
496
|
const s = document.createElement(e);
|
|
379
497
|
return t.length > 0 && s.classList.add(...t), s;
|
|
@@ -390,6 +508,21 @@ class A {
|
|
|
390
508
|
*/
|
|
391
509
|
clearContainer() {
|
|
392
510
|
this.container.innerHTML = "";
|
|
511
|
+
for (const e of [
|
|
512
|
+
"role",
|
|
513
|
+
"aria-label",
|
|
514
|
+
"aria-describedby",
|
|
515
|
+
"aria-multiselectable",
|
|
516
|
+
"aria-rowcount"
|
|
517
|
+
])
|
|
518
|
+
this.container.removeAttribute(e);
|
|
519
|
+
this.container.classList.remove(
|
|
520
|
+
"scheduler-week-view",
|
|
521
|
+
"scheduler-day-view",
|
|
522
|
+
"scheduler-month-view",
|
|
523
|
+
"scheduler-year-view",
|
|
524
|
+
"scheduler-timeline-view"
|
|
525
|
+
);
|
|
393
526
|
}
|
|
394
527
|
/**
|
|
395
528
|
* Append the start/end resize handles for an event part. The handle strip
|
|
@@ -401,7 +534,8 @@ class A {
|
|
|
401
534
|
* ['left','right'] for the timeline.
|
|
402
535
|
*/
|
|
403
536
|
appendResizeHandles(e, t, [s, n] = ["top", "bottom"]) {
|
|
404
|
-
|
|
537
|
+
const i = this.state.resolvedPermissions;
|
|
538
|
+
t.isStart && O("resizeEventStart", { permissions: i, event: t.event }) && e.appendChild(this.createResizeHandle(s, "start")), t.isEnd && O("resizeEventEnd", { permissions: i, event: t.event }) && e.appendChild(this.createResizeHandle(n, "end"));
|
|
405
539
|
}
|
|
406
540
|
createResizeHandle(e, t) {
|
|
407
541
|
const s = this.createElement("div", "resize-handle", e);
|
|
@@ -434,7 +568,7 @@ class A {
|
|
|
434
568
|
this.container.querySelectorAll(".today").forEach((e) => e.setAttribute("aria-current", "date"));
|
|
435
569
|
}
|
|
436
570
|
}
|
|
437
|
-
class
|
|
571
|
+
class N extends $ {
|
|
438
572
|
constructor() {
|
|
439
573
|
super(...arguments), this.monthCards = /* @__PURE__ */ new Map();
|
|
440
574
|
}
|
|
@@ -457,27 +591,27 @@ class R extends A {
|
|
|
457
591
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
|
|
458
592
|
}
|
|
459
593
|
createMonthCard(e) {
|
|
460
|
-
const { events: t, options: s } = this.state, n = this.createElement("div", "scheduler-year-month"), i =
|
|
594
|
+
const { events: t, options: s } = this.state, n = this.createElement("div", "scheduler-year-month"), i = N.monthKey(e);
|
|
461
595
|
n.setAttribute("role", "gridcell"), n.setAttribute("tabindex", "-1"), n.id = `scheduler-cell-y-${i}`, this.setData(n, { month: e.toISOString() }), this.monthCards.set(i, n);
|
|
462
596
|
const r = this.createElement("div", "scheduler-year-month-header");
|
|
463
597
|
r.textContent = h.getMonthName(e, s.locale), r.setAttribute("role", "button"), r.setAttribute("tabindex", "0"), this.setData(r, { month: e.toISOString() }), n.appendChild(r);
|
|
464
598
|
const o = this.createElement("div", "scheduler-mini-month"), a = h.getMonthWeeks(e, s.firstDayOfWeek), l = a[0];
|
|
465
599
|
for (const v of l) {
|
|
466
|
-
const
|
|
467
|
-
|
|
600
|
+
const f = this.createElement("div", "scheduler-mini-day", "header");
|
|
601
|
+
f.textContent = h.getDayName(v, s.locale, "narrow"), f.style.fontWeight = "600", f.style.color = "#666", o.appendChild(f);
|
|
468
602
|
}
|
|
469
|
-
const d = h.getMonthStart(e), c = h.getMonthEnd(e),
|
|
470
|
-
for (const v of
|
|
471
|
-
const
|
|
472
|
-
for (
|
|
473
|
-
|
|
603
|
+
const d = h.getMonthStart(e), c = h.getMonthEnd(e), p = D.filterByRange(t, d, c), m = /* @__PURE__ */ new Set();
|
|
604
|
+
for (const v of p) {
|
|
605
|
+
const f = new Date(v.start);
|
|
606
|
+
for (f.setHours(0, 0, 0, 0); f <= v.end; )
|
|
607
|
+
m.add(f.toISOString().split("T")[0]), f.setDate(f.getDate() + 1);
|
|
474
608
|
}
|
|
475
609
|
for (const v of a)
|
|
476
|
-
for (const
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
const
|
|
480
|
-
|
|
610
|
+
for (const f of v) {
|
|
611
|
+
const g = this.createElement("div", "scheduler-mini-day");
|
|
612
|
+
g.textContent = String(f.getDate()), this.setData(g, { date: f.toISOString() }), h.isSameMonth(f, e) || g.classList.add("other-month"), h.isToday(f) && g.classList.add("today");
|
|
613
|
+
const y = f.toISOString().split("T")[0];
|
|
614
|
+
m.has(y) && g.classList.add("has-events"), o.appendChild(g);
|
|
481
615
|
}
|
|
482
616
|
return n.appendChild(o), n;
|
|
483
617
|
}
|
|
@@ -489,7 +623,7 @@ class R extends A {
|
|
|
489
623
|
updateMonthCardFocus() {
|
|
490
624
|
const e = this.state.focusedDate;
|
|
491
625
|
let t = !1;
|
|
492
|
-
const s = e ?
|
|
626
|
+
const s = e ? N.monthKey(e) : null;
|
|
493
627
|
for (const [n, i] of this.monthCards) {
|
|
494
628
|
const r = n === s;
|
|
495
629
|
i.setAttribute("tabindex", r ? "0" : "-1"), i.removeAttribute("aria-selected"), r && (t = !0);
|
|
@@ -508,7 +642,7 @@ class R extends A {
|
|
|
508
642
|
this.monthCards.clear(), this.clearContainer();
|
|
509
643
|
}
|
|
510
644
|
}
|
|
511
|
-
class
|
|
645
|
+
class P extends $ {
|
|
512
646
|
constructor() {
|
|
513
647
|
super(...arguments), this.dayCells = /* @__PURE__ */ new Map();
|
|
514
648
|
}
|
|
@@ -548,7 +682,7 @@ class k extends A {
|
|
|
548
682
|
createDayCell(e) {
|
|
549
683
|
const { date: t } = this.state, s = this.createElement("div", "scheduler-month-day");
|
|
550
684
|
h.isSameMonth(e, t) || s.classList.add("other-month"), h.isToday(e) && s.classList.add("today");
|
|
551
|
-
const n =
|
|
685
|
+
const n = P.dayKey(e);
|
|
552
686
|
s.setAttribute("role", "gridcell"), s.setAttribute("tabindex", "-1"), s.id = `scheduler-cell-m-${n}`;
|
|
553
687
|
const i = this.createElement("div", "day-number");
|
|
554
688
|
i.textContent = String(e.getDate()), s.appendChild(i);
|
|
@@ -563,7 +697,7 @@ class k extends A {
|
|
|
563
697
|
updateDayCellFocus() {
|
|
564
698
|
const e = this.state.focusedDate;
|
|
565
699
|
let t = !1;
|
|
566
|
-
const s = e ?
|
|
700
|
+
const s = e ? P.dayKey(e) : null;
|
|
567
701
|
for (const [n, i] of this.dayCells) {
|
|
568
702
|
const r = n === s;
|
|
569
703
|
i.setAttribute("tabindex", r ? "0" : "-1"), i.removeAttribute("aria-selected"), r && (t = !0);
|
|
@@ -575,32 +709,32 @@ class k extends A {
|
|
|
575
709
|
h.getMonthStart(e), h.getMonthEnd(e);
|
|
576
710
|
const n = h.getMonthWeeks(e, s.firstDayOfWeek), i = n[0][0], r = n[n.length - 1][6];
|
|
577
711
|
r.setHours(23, 59, 59, 999);
|
|
578
|
-
const o =
|
|
712
|
+
const o = D.filterByRange(t, i, r), a = /* @__PURE__ */ new Map();
|
|
579
713
|
for (const d of o) {
|
|
580
|
-
const c = new Date(d.start),
|
|
581
|
-
for (
|
|
582
|
-
const v =
|
|
583
|
-
a.has(v) || a.set(v, []), a.get(v).push(d),
|
|
714
|
+
const c = new Date(d.start), p = new Date(d.end), m = new Date(c);
|
|
715
|
+
for (m.setHours(0, 0, 0, 0); m <= p; ) {
|
|
716
|
+
const v = P.dayKey(m);
|
|
717
|
+
a.has(v) || a.set(v, []), a.get(v).push(d), m.setDate(m.getDate() + 1);
|
|
584
718
|
}
|
|
585
719
|
}
|
|
586
|
-
const l = typeof s.dayMaxEvents == "number" ? s.dayMaxEvents : 3;
|
|
720
|
+
const l = typeof s.dayMaxEvents == "number" ? s.dayMaxEvents : s.dayMaxEvents === !1 ? Number.POSITIVE_INFINITY : 3;
|
|
587
721
|
for (const [d, c] of a) {
|
|
588
|
-
const
|
|
589
|
-
if (!u) continue;
|
|
590
|
-
const p = u.querySelector(".month-events");
|
|
722
|
+
const p = this.dayCells.get(d);
|
|
591
723
|
if (!p) continue;
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
724
|
+
const m = p.querySelector(".month-events");
|
|
725
|
+
if (!m) continue;
|
|
726
|
+
m.innerHTML = "";
|
|
727
|
+
const v = c.slice(0, l), f = c.length - v.length;
|
|
728
|
+
for (const g of v) {
|
|
729
|
+
const y = this.createElement("div", "scheduler-month-event");
|
|
730
|
+
y.textContent = g.title, this.applyEventColors(y, g), y.setAttribute("role", "button"), y.setAttribute("tabindex", "0"), y.setAttribute("aria-label", z(g, null, this.state.options)), this.setData(y, { eventId: g.id }), m.appendChild(y);
|
|
597
731
|
}
|
|
598
|
-
if (
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
{ count:
|
|
603
|
-
),
|
|
732
|
+
if (f > 0) {
|
|
733
|
+
const g = this.createElement("div", "scheduler-more-link");
|
|
734
|
+
g.textContent = S(
|
|
735
|
+
x(this.state.options.messages).moreEvents,
|
|
736
|
+
{ count: f }
|
|
737
|
+
), g.setAttribute("role", "button"), g.setAttribute("tabindex", "0"), this.setData(g, { date: d }), m.appendChild(g);
|
|
604
738
|
}
|
|
605
739
|
}
|
|
606
740
|
}
|
|
@@ -619,7 +753,15 @@ class k extends A {
|
|
|
619
753
|
this.dayCells.clear(), this.clearContainer();
|
|
620
754
|
}
|
|
621
755
|
}
|
|
622
|
-
|
|
756
|
+
function Y(u, e) {
|
|
757
|
+
const t = new Date(u.start);
|
|
758
|
+
t.setHours(0, 0, 0, 0);
|
|
759
|
+
const s = u.start.getTime() - t.getTime(), n = u.end.getTime() - u.start.getTime(), i = new Date(e);
|
|
760
|
+
i.setHours(0, 0, 0, 0);
|
|
761
|
+
const r = i.getTime() + s;
|
|
762
|
+
return { start: new Date(r), end: new Date(r + n) };
|
|
763
|
+
}
|
|
764
|
+
class ge extends $ {
|
|
623
765
|
constructor() {
|
|
624
766
|
super(...arguments), this.dayColumns = [], this.eventElements = /* @__PURE__ */ new Map(), this.slotElements = /* @__PURE__ */ new Map();
|
|
625
767
|
}
|
|
@@ -630,10 +772,10 @@ class te extends A {
|
|
|
630
772
|
for (const d of s) {
|
|
631
773
|
const c = this.createElement("div", "scheduler-day-header");
|
|
632
774
|
h.isToday(d) && c.classList.add("today");
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
const
|
|
636
|
-
|
|
775
|
+
const p = this.createElement("div", "day-name");
|
|
776
|
+
p.textContent = h.getDayName(d, t.locale);
|
|
777
|
+
const m = this.createElement("div", "day-number");
|
|
778
|
+
m.textContent = String(d.getDate()), c.appendChild(p), c.appendChild(m), n.appendChild(c);
|
|
637
779
|
}
|
|
638
780
|
this.container.appendChild(n);
|
|
639
781
|
const r = this.createElement("div", "scheduler-time-grid"), o = this.createElement("div", "scheduler-time-gutter"), a = h.getTimeSlots(
|
|
@@ -650,35 +792,21 @@ class te extends A {
|
|
|
650
792
|
const l = this.createElement("div", "scheduler-days-container");
|
|
651
793
|
this.dayColumns = [];
|
|
652
794
|
for (let d = 0; d < s.length; d++) {
|
|
653
|
-
const c = s[d],
|
|
654
|
-
this.setData(
|
|
795
|
+
const c = s[d], p = this.createElement("div", "scheduler-day-column");
|
|
796
|
+
this.setData(p, { dayIndex: d });
|
|
655
797
|
for (let v = 0; v < a.length; v++) {
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
g.start.getHours(),
|
|
659
|
-
g.start.getMinutes(),
|
|
660
|
-
0,
|
|
661
|
-
0
|
|
662
|
-
);
|
|
663
|
-
const b = new Date(c);
|
|
664
|
-
b.setHours(
|
|
665
|
-
g.end.getHours(),
|
|
666
|
-
g.end.getMinutes(),
|
|
667
|
-
0,
|
|
668
|
-
0
|
|
669
|
-
);
|
|
670
|
-
const y = this.createElement("div", "scheduler-time-slot");
|
|
671
|
-
y.setAttribute("role", "gridcell"), y.setAttribute("tabindex", "-1"), y.setAttribute("aria-selected", "false"), y.id = `scheduler-cell-w-${d}-${v}`, this.setData(y, {
|
|
798
|
+
const f = a[v], { start: g, end: y } = Y(f, c), w = this.createElement("div", "scheduler-time-slot");
|
|
799
|
+
w.setAttribute("role", "gridcell"), w.setAttribute("tabindex", "-1"), w.setAttribute("aria-selected", "false"), w.id = `scheduler-cell-w-${d}-${v}`, this.setData(w, {
|
|
672
800
|
dayIndex: d,
|
|
673
801
|
slotIndex: v,
|
|
674
|
-
start:
|
|
675
|
-
end:
|
|
802
|
+
start: g.toISOString(),
|
|
803
|
+
end: y.toISOString()
|
|
676
804
|
});
|
|
677
|
-
const
|
|
678
|
-
this.slotElements.set(
|
|
805
|
+
const E = `${d}-${v}`;
|
|
806
|
+
this.slotElements.set(E, w), p.appendChild(w);
|
|
679
807
|
}
|
|
680
|
-
const
|
|
681
|
-
|
|
808
|
+
const m = this.createElement("div", "scheduler-events-container");
|
|
809
|
+
p.appendChild(m), this.dayColumns.push(p), l.appendChild(p);
|
|
682
810
|
}
|
|
683
811
|
r.appendChild(l), this.container.appendChild(r), this.renderEvents(), this.updateCellFocusAndSelection(), this.renderNowIndicator(s, a), this.applyGridRoles({
|
|
684
812
|
multiselectable: !0,
|
|
@@ -723,7 +851,7 @@ class te extends A {
|
|
|
723
851
|
if (!i || !r) continue;
|
|
724
852
|
const o = { start: new Date(i), end: new Date(r) }, a = !!e && o.start.getTime() === e.start.getTime();
|
|
725
853
|
n.setAttribute("tabindex", a ? "0" : "-1");
|
|
726
|
-
const l =
|
|
854
|
+
const l = U(o, this.state, null);
|
|
727
855
|
n.setAttribute("aria-selected", l ? "true" : "false"), n.classList.toggle("selected", l), a && (t = !0);
|
|
728
856
|
}
|
|
729
857
|
!t && s && s.setAttribute("tabindex", "0");
|
|
@@ -734,57 +862,66 @@ class te extends A {
|
|
|
734
862
|
renderEvents() {
|
|
735
863
|
const { date: e, events: t, options: s } = this.state, n = h.getWeekDays(e, s.firstDayOfWeek), i = n[0], r = new Date(n[6]);
|
|
736
864
|
r.setHours(23, 59, 59, 999);
|
|
737
|
-
const o =
|
|
865
|
+
const o = D.filterByRange(t, i, r), a = [];
|
|
738
866
|
for (const c of o) {
|
|
739
|
-
const { parts:
|
|
740
|
-
a.push(...
|
|
867
|
+
const { parts: p } = D.splitInParts(c);
|
|
868
|
+
a.push(...p);
|
|
741
869
|
}
|
|
742
|
-
const l =
|
|
870
|
+
const l = D.filterPartsByRange(a, i, r), d = D.getTimelinedParts(l);
|
|
743
871
|
this.eventElements.forEach((c) => c.remove()), this.eventElements.clear();
|
|
744
|
-
for (const { part: c, trackIndex:
|
|
872
|
+
for (const { part: c, trackIndex: p, totalTracks: m, colspan: v } of d) {
|
|
745
873
|
if (!c.event) continue;
|
|
746
|
-
const
|
|
747
|
-
if (
|
|
748
|
-
const
|
|
749
|
-
if (!
|
|
750
|
-
const
|
|
874
|
+
const f = n.findIndex((E) => h.isSameDay(E, c.start));
|
|
875
|
+
if (f === -1) continue;
|
|
876
|
+
const y = this.dayColumns[f].querySelector(".scheduler-events-container");
|
|
877
|
+
if (!y) continue;
|
|
878
|
+
const w = this.createEventElement(
|
|
751
879
|
c,
|
|
752
|
-
u,
|
|
753
880
|
p,
|
|
881
|
+
m,
|
|
754
882
|
v,
|
|
755
883
|
s.slotDuration ?? 1800
|
|
756
884
|
);
|
|
757
|
-
|
|
885
|
+
y.appendChild(w), this.eventElements.set(c.id, w);
|
|
758
886
|
}
|
|
759
887
|
}
|
|
760
888
|
createEventElement(e, t, s, n, i) {
|
|
761
889
|
const r = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === r.id;
|
|
762
890
|
this.state.keyboardMoveEventId, r.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
|
|
763
891
|
"aria-label",
|
|
764
|
-
|
|
892
|
+
z(r, null, this.state.options)
|
|
765
893
|
), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
|
|
766
|
-
const l =
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
894
|
+
const l = this.partGeometry(e.start, e.end, {
|
|
895
|
+
...this.state.options,
|
|
896
|
+
slotDuration: i
|
|
897
|
+
}), { top: d, height: c } = l ?? { top: 0, height: 0 }, p = t / s * 100, m = n / s * 100;
|
|
898
|
+
o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${p}%`, o.style.width = `calc(${m}% - 2px)`, this.applyEventColors(o, r), this.setData(o, { eventId: r.id });
|
|
899
|
+
const v = this.createElement("div", "event-content"), f = this.createElement("div", "event-title");
|
|
900
|
+
f.textContent = r.title, v.appendChild(f);
|
|
901
|
+
const g = this.createElement("div", "event-time");
|
|
902
|
+
return g.textContent = `${h.formatTime(e.start, this.state.options.timeFormat)} - ${h.formatTime(e.end, this.state.options.timeFormat)}`, v.appendChild(g), o.appendChild(v), this.appendResizeHandles(o, e), o;
|
|
774
903
|
}
|
|
904
|
+
/**
|
|
905
|
+
* Dashed ghost showing where the dragged/created range will land — ONE box per
|
|
906
|
+
* day it spans, mirroring how a committed multi-day event splits into parts.
|
|
907
|
+
* A single box measured from the start day's midnight produced a ~2900px-tall
|
|
908
|
+
* box hanging out of the first column for a 3-day range.
|
|
909
|
+
*/
|
|
775
910
|
renderPreviewEvent() {
|
|
776
|
-
|
|
777
|
-
e
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
const r
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
911
|
+
this.container.querySelectorAll(".scheduler-event.preview").forEach((r) => r.remove());
|
|
912
|
+
const { previewEvent: e, options: t, date: s } = this.state;
|
|
913
|
+
if (!e) return;
|
|
914
|
+
const n = h.getWeekDays(s, t.firstDayOfWeek), { parts: i } = D.splitInParts(e);
|
|
915
|
+
for (const r of i) {
|
|
916
|
+
const o = n.findIndex((c) => h.isSameDay(c, r.start));
|
|
917
|
+
if (o === -1) continue;
|
|
918
|
+
const a = this.dayColumns[o]?.querySelector(".scheduler-events-container");
|
|
919
|
+
if (!a) continue;
|
|
920
|
+
const l = this.partGeometry(r.start, r.end, t);
|
|
921
|
+
if (!l) continue;
|
|
922
|
+
const d = this.createElement("div", "scheduler-event", "preview");
|
|
923
|
+
r.isStart || d.classList.add("preview-continues-before"), r.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
|
+
}
|
|
788
925
|
}
|
|
789
926
|
updateGreyedSlots() {
|
|
790
927
|
const { dragState: e, previewEvent: t, options: s, date: n } = this.state;
|
|
@@ -797,26 +934,13 @@ class te extends A {
|
|
|
797
934
|
);
|
|
798
935
|
for (let o = 0; o < i.length; o++) {
|
|
799
936
|
const a = i[o];
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
d.start.getMinutes(),
|
|
806
|
-
0,
|
|
807
|
-
0
|
|
808
|
-
);
|
|
809
|
-
const u = new Date(a);
|
|
810
|
-
if (u.setHours(
|
|
811
|
-
d.end.getHours(),
|
|
812
|
-
d.end.getMinutes(),
|
|
813
|
-
0,
|
|
814
|
-
0
|
|
815
|
-
), c < t.end && u > t.start) {
|
|
816
|
-
const p = `${o}-${l}`, v = this.slotElements.get(p);
|
|
817
|
-
v && v.classList.add("greyed");
|
|
818
|
-
}
|
|
937
|
+
for (let l = 0; l < r.length; l++) {
|
|
938
|
+
const d = r[l], { start: c, end: p } = Y(d, a);
|
|
939
|
+
if (c < t.end && p > t.start) {
|
|
940
|
+
const m = `${o}-${l}`, v = this.slotElements.get(m);
|
|
941
|
+
v && v.classList.add("greyed");
|
|
819
942
|
}
|
|
943
|
+
}
|
|
820
944
|
}
|
|
821
945
|
}
|
|
822
946
|
renderNowIndicator(e, t) {
|
|
@@ -832,7 +956,7 @@ class te extends A {
|
|
|
832
956
|
}
|
|
833
957
|
updateNowIndicator() {
|
|
834
958
|
if (!this.state.options.nowIndicator) return;
|
|
835
|
-
const { date: e, options: t } = this.state, s = h.getWeekDays(e, t.firstDayOfWeek), n = /* @__PURE__ */ new Date(), i = s.findIndex((
|
|
959
|
+
const { date: e, options: t } = this.state, s = h.getWeekDays(e, t.firstDayOfWeek), n = /* @__PURE__ */ new Date(), i = s.findIndex((p) => h.isSameDay(p, n));
|
|
836
960
|
if (i === -1) return;
|
|
837
961
|
const r = this.dayColumns[i];
|
|
838
962
|
if (!r) return;
|
|
@@ -842,15 +966,15 @@ class te extends A {
|
|
|
842
966
|
if (o)
|
|
843
967
|
o.style.top = `${c}px`;
|
|
844
968
|
else {
|
|
845
|
-
const
|
|
846
|
-
|
|
969
|
+
const p = this.createElement("div", "scheduler-now-indicator");
|
|
970
|
+
p.style.top = `${c}px`, r.appendChild(p);
|
|
847
971
|
}
|
|
848
972
|
}
|
|
849
973
|
destroy() {
|
|
850
974
|
this.eventElements.clear(), this.slotElements.clear(), this.dayColumns = [], this.clearContainer();
|
|
851
975
|
}
|
|
852
976
|
}
|
|
853
|
-
class
|
|
977
|
+
class fe extends $ {
|
|
854
978
|
constructor() {
|
|
855
979
|
super(...arguments), this.eventsContainer = null, this.slotElements = /* @__PURE__ */ new Map(), this.dayColumn = null;
|
|
856
980
|
}
|
|
@@ -876,22 +1000,22 @@ class se extends A {
|
|
|
876
1000
|
t.slotMaxTime
|
|
877
1001
|
);
|
|
878
1002
|
for (const v of c) {
|
|
879
|
-
const
|
|
880
|
-
|
|
1003
|
+
const f = this.createElement("div", "scheduler-time-slot-label");
|
|
1004
|
+
f.textContent = h.formatTime(v.start, t.timeFormat), d.appendChild(f);
|
|
881
1005
|
}
|
|
882
1006
|
l.appendChild(d);
|
|
883
|
-
const
|
|
1007
|
+
const p = this.createElement("div", "scheduler-days-container");
|
|
884
1008
|
this.dayColumn = this.createElement("div", "scheduler-day-column");
|
|
885
|
-
const
|
|
1009
|
+
const m = this.dayColumn;
|
|
886
1010
|
for (let v = 0; v < c.length; v++) {
|
|
887
|
-
const
|
|
888
|
-
|
|
1011
|
+
const f = c[v], g = this.createElement("div", "scheduler-time-slot");
|
|
1012
|
+
g.setAttribute("role", "gridcell"), g.setAttribute("tabindex", "-1"), g.setAttribute("aria-selected", "false"), g.id = `scheduler-cell-d-${v}`, this.setData(g, {
|
|
889
1013
|
slotIndex: v,
|
|
890
|
-
start:
|
|
891
|
-
end:
|
|
892
|
-
}), this.slotElements.set(v,
|
|
1014
|
+
start: f.start.toISOString(),
|
|
1015
|
+
end: f.end.toISOString()
|
|
1016
|
+
}), this.slotElements.set(v, g), m.appendChild(g);
|
|
893
1017
|
}
|
|
894
|
-
this.eventsContainer = this.createElement("div", "scheduler-events-container"),
|
|
1018
|
+
this.eventsContainer = this.createElement("div", "scheduler-events-container"), m.appendChild(this.eventsContainer), p.appendChild(m), l.appendChild(p), this.container.appendChild(l), this.renderEvents(), this.updateCellFocusAndSelection(), h.isToday(e) && t.nowIndicator && this.renderNowIndicator(m), this.applyGridRoles({
|
|
895
1019
|
multiselectable: !0,
|
|
896
1020
|
columnHeaderRow: ":scope > .scheduler-day-headers",
|
|
897
1021
|
columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
|
|
@@ -923,7 +1047,7 @@ class se extends A {
|
|
|
923
1047
|
if (!i || !r) continue;
|
|
924
1048
|
const o = { start: new Date(i), end: new Date(r) }, a = !!e && o.start.getTime() === e.start.getTime();
|
|
925
1049
|
n.setAttribute("tabindex", a ? "0" : "-1");
|
|
926
|
-
const l =
|
|
1050
|
+
const l = U(o, this.state, null);
|
|
927
1051
|
n.setAttribute("aria-selected", l ? "true" : "false"), n.classList.toggle("selected", l), a && (t = !0);
|
|
928
1052
|
}
|
|
929
1053
|
!t && s && s.setAttribute("tabindex", "0");
|
|
@@ -935,38 +1059,39 @@ class se extends A {
|
|
|
935
1059
|
n.setHours(0, 0, 0, 0);
|
|
936
1060
|
const i = new Date(e);
|
|
937
1061
|
i.setHours(23, 59, 59, 999);
|
|
938
|
-
const r =
|
|
1062
|
+
const r = D.filterByRange(t, n, i), o = [];
|
|
939
1063
|
for (const l of r) {
|
|
940
|
-
const { parts: d } =
|
|
1064
|
+
const { parts: d } = D.splitInParts(l), c = D.filterPartsByRange(d, n, i);
|
|
941
1065
|
o.push(...c);
|
|
942
1066
|
}
|
|
943
|
-
const a =
|
|
944
|
-
for (const { part: l, trackIndex: d, totalTracks: c, colspan:
|
|
1067
|
+
const a = D.getTimelinedParts(o);
|
|
1068
|
+
for (const { part: l, trackIndex: d, totalTracks: c, colspan: p } of a) {
|
|
945
1069
|
if (!l.event) continue;
|
|
946
|
-
const
|
|
1070
|
+
const m = this.createEventElement(
|
|
947
1071
|
l,
|
|
948
1072
|
d,
|
|
949
1073
|
c,
|
|
950
|
-
|
|
1074
|
+
p,
|
|
951
1075
|
s.slotDuration ?? 1800
|
|
952
1076
|
);
|
|
953
|
-
this.eventsContainer.appendChild(
|
|
1077
|
+
this.eventsContainer.appendChild(m);
|
|
954
1078
|
}
|
|
955
1079
|
}
|
|
956
1080
|
createEventElement(e, t, s, n, i) {
|
|
957
1081
|
const r = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === r.id;
|
|
958
1082
|
this.state.keyboardMoveEventId, r.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
|
|
959
1083
|
"aria-label",
|
|
960
|
-
|
|
1084
|
+
z(r, null, this.state.options)
|
|
961
1085
|
), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
|
|
962
|
-
const l =
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1086
|
+
const l = this.partGeometry(e.start, e.end, {
|
|
1087
|
+
...this.state.options,
|
|
1088
|
+
slotDuration: i
|
|
1089
|
+
}), { top: d, height: c } = l ?? { top: 0, height: 0 }, p = t / s * 100, m = n / s * 100;
|
|
1090
|
+
o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${p}%`, o.style.width = `calc(${m}% - 2px)`, this.applyEventColors(o, r), this.setData(o, { eventId: r.id });
|
|
1091
|
+
const v = this.createElement("div", "event-content"), f = this.createElement("div", "event-title");
|
|
1092
|
+
f.textContent = r.title, v.appendChild(f);
|
|
1093
|
+
const g = this.createElement("div", "event-time");
|
|
1094
|
+
return g.textContent = `${h.formatTime(e.start, this.state.options.timeFormat)} - ${h.formatTime(e.end, this.state.options.timeFormat)}`, v.appendChild(g), o.appendChild(v), this.appendResizeHandles(o, e), o;
|
|
970
1095
|
}
|
|
971
1096
|
renderNowIndicator(e) {
|
|
972
1097
|
const t = /* @__PURE__ */ new Date(), s = new Date(t);
|
|
@@ -994,7 +1119,7 @@ class se extends A {
|
|
|
994
1119
|
}
|
|
995
1120
|
updateGreyedSlots() {
|
|
996
1121
|
const { dragState: e, previewEvent: t, options: s, date: n } = this.state;
|
|
997
|
-
if (this.slotElements.forEach((r) => r.classList.remove("greyed")), !e || !t
|
|
1122
|
+
if (this.slotElements.forEach((r) => r.classList.remove("greyed")), !e || !t) return;
|
|
998
1123
|
const i = h.getTimeSlots(
|
|
999
1124
|
n,
|
|
1000
1125
|
s.slotDuration,
|
|
@@ -1009,73 +1134,149 @@ class se extends A {
|
|
|
1009
1134
|
}
|
|
1010
1135
|
}
|
|
1011
1136
|
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Dashed ghost for the day currently shown. A multi-day range contributes at
|
|
1139
|
+
* most one part here, but it must still be CLIPPED to this day rather than
|
|
1140
|
+
* skipped: bailing unless the range *started* today meant dragging in from
|
|
1141
|
+
* yesterday drew no feedback at all.
|
|
1142
|
+
*/
|
|
1012
1143
|
renderPreviewEvent() {
|
|
1013
1144
|
if (!this.eventsContainer) return;
|
|
1014
|
-
|
|
1015
|
-
e
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
r.
|
|
1020
|
-
|
|
1021
|
-
|
|
1145
|
+
this.eventsContainer.querySelectorAll(".scheduler-event.preview").forEach((a) => a.remove());
|
|
1146
|
+
const { previewEvent: e, options: t, date: s } = this.state;
|
|
1147
|
+
if (!e) return;
|
|
1148
|
+
const { parts: n } = D.splitInParts(e), i = n.find((a) => h.isSameDay(s, a.start));
|
|
1149
|
+
if (!i) return;
|
|
1150
|
+
const r = this.partGeometry(i.start, i.end, t);
|
|
1151
|
+
if (!r) return;
|
|
1152
|
+
const o = this.createElement("div", "scheduler-event", "preview");
|
|
1153
|
+
i.isStart || o.classList.add("preview-continues-before"), i.isEnd || o.classList.add("preview-continues-after"), o.style.top = `${r.top}px`, o.style.height = `${r.height}px`, o.style.left = "0", o.style.width = "100%", this.eventsContainer.appendChild(o);
|
|
1022
1154
|
}
|
|
1023
1155
|
destroy() {
|
|
1024
1156
|
this.eventsContainer = null, this.dayColumn = null, this.slotElements.clear(), this.clearContainer();
|
|
1025
1157
|
}
|
|
1026
1158
|
}
|
|
1027
|
-
|
|
1159
|
+
const L = "__mp-unassigned__";
|
|
1160
|
+
class ye extends $ {
|
|
1028
1161
|
constructor() {
|
|
1029
|
-
super(...arguments), this.rowElements = /* @__PURE__ */ new Map(), this.
|
|
1162
|
+
super(...arguments), this.rowElements = /* @__PURE__ */ new Map(), this.pendingFocusKey = null;
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Slot width in px. Read from `--scheduler-slot-width` so consumers can shorten
|
|
1166
|
+
* a default week (48 slots x 7 days x 50px = 16,800px); falls back to 50.
|
|
1167
|
+
*/
|
|
1168
|
+
get slotWidth() {
|
|
1169
|
+
const e = getComputedStyle(this.container).getPropertyValue("--scheduler-slot-width").trim(), t = Number.parseFloat(e);
|
|
1170
|
+
return Number.isFinite(t) && t > 0 ? t : 50;
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Track geometry for the timeline, in px, from the CSS custom properties so a
|
|
1174
|
+
* consumer can retune density without forking the view.
|
|
1175
|
+
*
|
|
1176
|
+
* The timeline is the one view where vertical space is NOT the time axis —
|
|
1177
|
+
* time runs horizontally and the panel scrolls — so an event's height carries
|
|
1178
|
+
* no information. Overlapping events therefore STACK at a constant height and
|
|
1179
|
+
* grow their resource row, instead of dividing a fixed 40px row between them
|
|
1180
|
+
* the way week/day must (there, height IS duration).
|
|
1181
|
+
*/
|
|
1182
|
+
get trackMetrics() {
|
|
1183
|
+
const e = getComputedStyle(this.container), t = (s, n) => {
|
|
1184
|
+
const i = Number.parseFloat(e.getPropertyValue(s).trim());
|
|
1185
|
+
return Number.isFinite(i) && i >= 0 ? i : n;
|
|
1186
|
+
};
|
|
1187
|
+
return {
|
|
1188
|
+
height: t("--scheduler-timeline-event-height", 28),
|
|
1189
|
+
gap: t("--scheduler-timeline-track-gap", 2),
|
|
1190
|
+
padding: t("--scheduler-timeline-row-padding", 2)
|
|
1191
|
+
};
|
|
1030
1192
|
}
|
|
1031
1193
|
render() {
|
|
1032
|
-
this.clearContainer(), this.container.classList.add("scheduler-timeline-view");
|
|
1033
|
-
const { date: e, options: t, resources: s, collapsedGroups: n } = this.state, i = h.getWeekDays(e, t.firstDayOfWeek),
|
|
1034
|
-
|
|
1194
|
+
this.captureActionFocus(), this.clearContainer(), this.container.classList.add("scheduler-timeline-view");
|
|
1195
|
+
const { date: e, options: t, resources: s, collapsedGroups: n } = this.state, i = h.getWeekDays(e, t.firstDayOfWeek), r = T.flatten(s, n), o = this.hasUnassignedRow(this.state), a = r.filter((b) => b.visible).length + 2 + (o ? 1 : 0), l = this.createElement("div", "scheduler-timeline");
|
|
1196
|
+
l.setAttribute("role", "grid"), l.setAttribute(
|
|
1035
1197
|
"aria-label",
|
|
1036
|
-
x(
|
|
1198
|
+
S(x(t.messages).timelineGridLabel, {
|
|
1037
1199
|
date: h.formatDateWithWeekday(i[0], t.locale)
|
|
1038
1200
|
})
|
|
1039
|
-
),
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1044
|
-
const
|
|
1045
|
-
for (const
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1201
|
+
), l.setAttribute("aria-rowcount", String(a)), l.setAttribute("aria-describedby", "scheduler-kbd-grid"), l.setAttribute("aria-multiselectable", "true");
|
|
1202
|
+
const d = this.createElement("div", "scheduler-timeline-header");
|
|
1203
|
+
d.setAttribute("role", "row"), d.setAttribute("aria-rowindex", "1");
|
|
1204
|
+
const c = this.createElement("div", "scheduler-resource-header");
|
|
1205
|
+
c.setAttribute("role", "columnheader"), c.textContent = x(this.state.options.messages).resourcesHeader, d.appendChild(c);
|
|
1206
|
+
const p = this.createElement("div", "scheduler-timeline-slots-header");
|
|
1207
|
+
for (const b of i) {
|
|
1208
|
+
const F = h.getTimeSlots(
|
|
1209
|
+
b,
|
|
1048
1210
|
t.slotDuration,
|
|
1049
1211
|
t.slotMinTime,
|
|
1050
1212
|
t.slotMaxTime
|
|
1051
|
-
).length,
|
|
1052
|
-
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
-
const v = this.createElement("div", "scheduler-timeline-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1213
|
+
).length, C = this.createElement("div", "scheduler-timeline-slot-header");
|
|
1214
|
+
C.setAttribute("role", "columnheader"), C.style.width = `${F * this.slotWidth}px`, C.textContent = h.formatDateWithWeekday(b, t.locale), C.style.borderBottom = "1px solid var(--scheduler-border-color)", p.appendChild(C);
|
|
1215
|
+
}
|
|
1216
|
+
d.appendChild(p);
|
|
1217
|
+
const m = this.createElement("div", "scheduler-timeline-head");
|
|
1218
|
+
m.appendChild(d), l.appendChild(m);
|
|
1219
|
+
const v = this.createElement("div", "scheduler-timeline-header");
|
|
1220
|
+
v.setAttribute("role", "row");
|
|
1221
|
+
const f = this.createElement("div", "scheduler-resource-header");
|
|
1222
|
+
f.style.borderBottom = "1px solid var(--scheduler-border-color)", v.appendChild(f);
|
|
1223
|
+
const g = this.createElement("div", "scheduler-timeline-slots-header");
|
|
1224
|
+
g.setAttribute("role", "presentation");
|
|
1225
|
+
for (const b of i) {
|
|
1226
|
+
const M = h.getTimeSlots(
|
|
1227
|
+
b,
|
|
1061
1228
|
t.slotDuration,
|
|
1062
1229
|
t.slotMinTime,
|
|
1063
1230
|
t.slotMaxTime
|
|
1064
1231
|
);
|
|
1065
|
-
for (const
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1232
|
+
for (const F of M) {
|
|
1233
|
+
const C = this.createElement("div", "scheduler-timeline-slot-header");
|
|
1234
|
+
C.setAttribute("role", "columnheader"), C.style.width = `${this.slotWidth}px`, C.textContent = h.formatTime(F.start, t.timeFormat), C.style.fontSize = "10px", g.appendChild(C);
|
|
1068
1235
|
}
|
|
1069
1236
|
}
|
|
1070
|
-
|
|
1071
|
-
const
|
|
1072
|
-
let
|
|
1073
|
-
for (const
|
|
1074
|
-
if (!
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1237
|
+
v.appendChild(g), m.appendChild(v);
|
|
1238
|
+
const y = this.createElement("div", "scheduler-timeline-body"), w = T.flatten(s, n);
|
|
1239
|
+
let E = 2;
|
|
1240
|
+
for (const b of w) {
|
|
1241
|
+
if (!b.visible) continue;
|
|
1242
|
+
const M = this.createResourceRow(b, i);
|
|
1243
|
+
M.setAttribute("aria-rowindex", String(E)), y.appendChild(M), E++;
|
|
1244
|
+
}
|
|
1245
|
+
if (o) {
|
|
1246
|
+
const b = this.createUnassignedRow(i);
|
|
1247
|
+
b.setAttribute("aria-rowindex", String(E)), y.appendChild(b), E++;
|
|
1248
|
+
}
|
|
1249
|
+
if (l.appendChild(y), this.container.appendChild(l), w.length === 0 && !o) {
|
|
1250
|
+
const b = this.createElement("div", "scheduler-timeline-empty");
|
|
1251
|
+
b.textContent = x(t.messages).noResources, y.appendChild(b);
|
|
1077
1252
|
}
|
|
1078
|
-
|
|
1253
|
+
const k = this.createAddBar();
|
|
1254
|
+
k && this.container.appendChild(k), this.renderEvents(i), this.updateCellFocusAndSelection(), this.restoreActionFocus();
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Focus key of an action control: what it does plus which row it belongs to.
|
|
1258
|
+
* Stable across a rebuild (unlike DOM position), and unique per control.
|
|
1259
|
+
*/
|
|
1260
|
+
actionFocusKey(e) {
|
|
1261
|
+
const t = e.dataset.action;
|
|
1262
|
+
return t ? [t, e.dataset.parentId ?? "", e.dataset.resourceId ?? ""].join("|") : null;
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Remember which action control the user was on, if any, before a rebuild.
|
|
1266
|
+
* `activeElement` of the shadow root — the host's `document.activeElement` is
|
|
1267
|
+
* the `<mp-scheduler>` element itself, not the button inside it.
|
|
1268
|
+
*/
|
|
1269
|
+
captureActionFocus() {
|
|
1270
|
+
const t = this.container.getRootNode().activeElement;
|
|
1271
|
+
this.pendingFocusKey = t && this.container.contains(t) ? this.actionFocusKey(t) : null;
|
|
1272
|
+
}
|
|
1273
|
+
restoreActionFocus() {
|
|
1274
|
+
const e = this.pendingFocusKey;
|
|
1275
|
+
if (this.pendingFocusKey = null, !e) return;
|
|
1276
|
+
const t = Array.from(
|
|
1277
|
+
this.container.querySelectorAll("[data-action]")
|
|
1278
|
+
).find((n) => this.actionFocusKey(n) === e), s = this.container.querySelector(".scheduler-add-button");
|
|
1279
|
+
(t ?? s)?.focus();
|
|
1079
1280
|
}
|
|
1080
1281
|
/**
|
|
1081
1282
|
* Apply roving tabindex + aria-selected + `.selected` class to each
|
|
@@ -1091,28 +1292,28 @@ class ne extends A {
|
|
|
1091
1292
|
if (!o || !a) return;
|
|
1092
1293
|
const d = { start: new Date(o), end: new Date(a) }, c = !!e && d.start.getTime() === e.start.getTime() && t === l;
|
|
1093
1294
|
r.setAttribute("tabindex", c ? "0" : "-1");
|
|
1094
|
-
const
|
|
1095
|
-
r.setAttribute("aria-selected",
|
|
1295
|
+
const p = U(d, this.state, l);
|
|
1296
|
+
r.setAttribute("aria-selected", p ? "true" : "false"), r.classList.toggle("selected", p), c && (n = !0);
|
|
1096
1297
|
}), !n && i && i.setAttribute("tabindex", "0");
|
|
1097
1298
|
}
|
|
1098
1299
|
createResourceRow(e, t) {
|
|
1099
1300
|
const { options: s } = this.state, n = this.createElement("div", "scheduler-timeline-row");
|
|
1100
|
-
n.setAttribute("role", "row"),
|
|
1301
|
+
n.setAttribute("role", "row"), R(e.item) && n.classList.add("group");
|
|
1101
1302
|
const i = this.createElement("div", "scheduler-resource-cell");
|
|
1102
|
-
if (i.setAttribute("role", "rowheader"), i.style.paddingLeft = `${8 + e.depth * 16}px`,
|
|
1303
|
+
if (i.setAttribute("role", "rowheader"), i.style.paddingLeft = `${8 + e.depth * 16}px`, R(e.item)) {
|
|
1103
1304
|
const a = this.createElement("button", "expand-toggle");
|
|
1104
1305
|
a.type = "button";
|
|
1105
1306
|
const l = this.state.collapsedGroups.has(e.item.id);
|
|
1106
1307
|
a.textContent = l ? "▶" : "▼", a.setAttribute("aria-expanded", String(!l)), a.setAttribute(
|
|
1107
1308
|
"aria-label",
|
|
1108
|
-
|
|
1109
|
-
|
|
1309
|
+
S(
|
|
1310
|
+
x(this.state.options.messages)[l ? "expandGroup" : "collapseGroup"],
|
|
1110
1311
|
{ title: e.item.title }
|
|
1111
1312
|
)
|
|
1112
1313
|
), this.setData(a, { groupId: e.item.id }), i.appendChild(a);
|
|
1113
1314
|
}
|
|
1114
|
-
const r = this.createElement("span");
|
|
1115
|
-
r.textContent = e.item.title, i.appendChild(r), n.appendChild(i);
|
|
1315
|
+
const r = this.createElement("span", "resource-title");
|
|
1316
|
+
r.textContent = e.item.title, i.appendChild(r), this.appendResourceActions(i, e.item), n.appendChild(i);
|
|
1116
1317
|
const o = this.createElement("div", "scheduler-timeline-slots");
|
|
1117
1318
|
o.setAttribute("role", "presentation");
|
|
1118
1319
|
for (const a of t) {
|
|
@@ -1137,101 +1338,261 @@ class ne extends A {
|
|
|
1137
1338
|
}
|
|
1138
1339
|
return n.appendChild(o), this.rowElements.set(e.item.id, n), n;
|
|
1139
1340
|
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Whether the synthetic bucket row renders: only when something is actually
|
|
1343
|
+
* unassigned, so a fully-assigned timeline shows no phantom row.
|
|
1344
|
+
*/
|
|
1345
|
+
hasUnassignedRow(e) {
|
|
1346
|
+
return (e.eventsByResource.get(null) ?? []).length > 0;
|
|
1347
|
+
}
|
|
1348
|
+
/** True when the capability is granted for the whole scheduler. */
|
|
1349
|
+
can(e) {
|
|
1350
|
+
return O(e, { permissions: this.state.resolvedPermissions });
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Per-row resource actions, rendered into the pinned rowheader cell.
|
|
1354
|
+
*
|
|
1355
|
+
* A denied action is ABSENT, not disabled: `createResource`/`createGroup`/
|
|
1356
|
+
* `updateResource`/`deleteResource` are all off by default, so the ordinary
|
|
1357
|
+
* scheduler shows none of this and only an app that manages its own resource
|
|
1358
|
+
* tree opts in. (A permanently-disabled button is noise for sighted users and
|
|
1359
|
+
* a broken promise for AT — the same rule mp-file-manager follows.)
|
|
1360
|
+
*
|
|
1361
|
+
* Every name carries the row title. N buttons all called "Add" is the classic
|
|
1362
|
+
* failure of a tree like this: a screen-reader user hears the same name on
|
|
1363
|
+
* every row and cannot tell which group they are adding to. Depth stays out of
|
|
1364
|
+
* it entirely — `aria-level` is invalid on these roles, so nesting is conveyed
|
|
1365
|
+
* by the name and the indent, not by an attribute axe flags.
|
|
1366
|
+
*/
|
|
1367
|
+
appendResourceActions(e, t) {
|
|
1368
|
+
const s = x(this.state.options.messages), n = this.createElement("div", "scheduler-resource-actions");
|
|
1369
|
+
R(t) && (this.can("createResource") && n.appendChild(
|
|
1370
|
+
this.createResourceAction(
|
|
1371
|
+
"add-resource",
|
|
1372
|
+
"+",
|
|
1373
|
+
S(s.addResourceToGroup, { title: t.title }),
|
|
1374
|
+
{ parentId: t.id }
|
|
1375
|
+
)
|
|
1376
|
+
), this.can("createGroup") && n.appendChild(
|
|
1377
|
+
this.createResourceAction(
|
|
1378
|
+
"add-group",
|
|
1379
|
+
"⊞",
|
|
1380
|
+
S(s.addGroupToGroup, { title: t.title }),
|
|
1381
|
+
{ parentId: t.id }
|
|
1382
|
+
)
|
|
1383
|
+
)), this.can("updateResource") && n.appendChild(this.createColorSwatch(t, s.resourceColor)), this.can("deleteResource") && n.appendChild(
|
|
1384
|
+
this.createResourceAction(
|
|
1385
|
+
"delete-resource",
|
|
1386
|
+
"×",
|
|
1387
|
+
S(s.removeResource, { title: t.title }),
|
|
1388
|
+
{ resourceId: t.id }
|
|
1389
|
+
)
|
|
1390
|
+
), n.childElementCount > 0 && e.appendChild(n);
|
|
1391
|
+
}
|
|
1392
|
+
/**
|
|
1393
|
+
* One icon button. The glyph is `aria-hidden` and the name lives on the
|
|
1394
|
+
* button, so the accessible name is the localized sentence rather than "+".
|
|
1395
|
+
*/
|
|
1396
|
+
createResourceAction(e, t, s, n) {
|
|
1397
|
+
const i = this.createElement("button", "scheduler-resource-action");
|
|
1398
|
+
i.type = "button", i.setAttribute("aria-label", s), i.title = s, this.setData(i, { action: e, ...n });
|
|
1399
|
+
const r = this.createElement("span", "action-glyph");
|
|
1400
|
+
return r.setAttribute("aria-hidden", "true"), r.textContent = t, i.appendChild(r), i;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Native `<input type="color">` for the resource's colour — the recolour half
|
|
1404
|
+
* of R7. Native because it is keyboard-operable, localized and screen-reader
|
|
1405
|
+
* labelled by the platform for free; a custom swatch grid would have to
|
|
1406
|
+
* re-earn all three.
|
|
1407
|
+
*
|
|
1408
|
+
* It edits whichever field actually drives the rendered events: `eventColor`
|
|
1409
|
+
* wins over `color` in `resolveEventColor`, so writing `color` on a resource
|
|
1410
|
+
* that has an `eventColor` would look like the control did nothing.
|
|
1411
|
+
*/
|
|
1412
|
+
createColorSwatch(e, t) {
|
|
1413
|
+
const s = e, n = s.eventColor ? "eventColor" : "color", i = s.eventColor ?? e.color, r = this.createElement("input", "scheduler-resource-color");
|
|
1414
|
+
return r.type = "color", r.setAttribute("aria-label", S(t, { title: e.title })), r.title = r.getAttribute("aria-label") ?? "", i && /^#[0-9a-f]{6}$/i.test(i) && (r.value = i), this.setData(r, { action: "set-resource-color", resourceId: e.id, field: n }), r;
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Root-level "Add resource" / "Add group" bar, pinned to the bottom of the
|
|
1418
|
+
* frozen resource column (the spreadsheet/Jira idiom: creation lives at the
|
|
1419
|
+
* end of the list, in the column the new row will appear in).
|
|
1420
|
+
*
|
|
1421
|
+
* Deliberately a sibling of the grid, not a row inside it: a row whose only
|
|
1422
|
+
* content is buttons has to fake a rowheader, inflates `aria-rowcount`, and
|
|
1423
|
+
* puts Tab stops inside a roving-tabindex grid. Outside, it is just a toolbar.
|
|
1424
|
+
*/
|
|
1425
|
+
createAddBar() {
|
|
1426
|
+
const e = this.can("createResource"), t = this.can("createGroup");
|
|
1427
|
+
if (!e && !t) return null;
|
|
1428
|
+
const s = x(this.state.options.messages), n = this.createElement("div", "scheduler-timeline-addbar");
|
|
1429
|
+
if (n.setAttribute("role", "toolbar"), n.setAttribute("aria-label", s.addResourceBarLabel), e) {
|
|
1430
|
+
const i = this.createElement("button", "scheduler-add-button");
|
|
1431
|
+
i.type = "button", i.textContent = s.addResource, this.setData(i, { action: "add-resource" }), n.appendChild(i);
|
|
1432
|
+
}
|
|
1433
|
+
if (t) {
|
|
1434
|
+
const i = this.createElement("button", "scheduler-add-button");
|
|
1435
|
+
i.type = "button", i.textContent = s.addGroup, this.setData(i, { action: "add-group" }), n.appendChild(i);
|
|
1436
|
+
}
|
|
1437
|
+
return n;
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* The "(No resource)" bucket row.
|
|
1441
|
+
*
|
|
1442
|
+
* 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 NO
|
|
1444
|
+
* `data-resource-id`, so a create-drag started here produces an unassigned
|
|
1445
|
+
* event rather than inventing membership of a resource that doesn't exist.
|
|
1446
|
+
*/
|
|
1447
|
+
createUnassignedRow(e) {
|
|
1448
|
+
const { options: t } = this.state, s = this.createElement("div", "scheduler-timeline-row", "unassigned");
|
|
1449
|
+
s.setAttribute("role", "row");
|
|
1450
|
+
const n = this.createElement("div", "scheduler-resource-cell");
|
|
1451
|
+
n.setAttribute("role", "rowheader"), n.style.paddingLeft = "8px";
|
|
1452
|
+
const i = this.createElement("span");
|
|
1453
|
+
i.textContent = x(t.messages).unassignedResource, n.appendChild(i), s.appendChild(n);
|
|
1454
|
+
const r = this.createElement("div", "scheduler-timeline-slots");
|
|
1455
|
+
r.setAttribute("role", "presentation");
|
|
1456
|
+
for (const a of e) {
|
|
1457
|
+
const l = h.getTimeSlots(
|
|
1458
|
+
a,
|
|
1459
|
+
t.slotDuration,
|
|
1460
|
+
t.slotMinTime,
|
|
1461
|
+
t.slotMaxTime
|
|
1462
|
+
);
|
|
1463
|
+
for (const d of l) {
|
|
1464
|
+
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-${L}-${d.start.getTime()}`, c.style.width = `${this.slotWidth}px`, this.setData(c, {
|
|
1466
|
+
start: d.start.toISOString(),
|
|
1467
|
+
end: d.end.toISOString()
|
|
1468
|
+
}), r.appendChild(c);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
const o = this.createElement("div", "scheduler-timeline-events");
|
|
1472
|
+
return o.setAttribute("role", "gridcell"), r.appendChild(o), s.appendChild(r), this.rowElements.set(L, s), s;
|
|
1473
|
+
}
|
|
1140
1474
|
renderEvents(e) {
|
|
1141
|
-
const {
|
|
1142
|
-
|
|
1143
|
-
const
|
|
1475
|
+
const { resources: t, options: s } = this.state, n = e[0], i = new Date(e[6]);
|
|
1476
|
+
i.setHours(23, 59, 59, 999);
|
|
1477
|
+
const a = h.getTimeSlots(
|
|
1144
1478
|
e[0],
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
).length * 7 * this.slotWidth,
|
|
1149
|
-
|
|
1150
|
-
|
|
1479
|
+
s.slotDuration,
|
|
1480
|
+
s.slotMinTime,
|
|
1481
|
+
s.slotMaxTime
|
|
1482
|
+
).length * 7 * this.slotWidth, l = [
|
|
1483
|
+
...T.getAllResources(t).map((d) => ({
|
|
1484
|
+
resourceId: d.id,
|
|
1485
|
+
title: d.title
|
|
1486
|
+
})),
|
|
1487
|
+
...this.rowElements.has(L) ? [
|
|
1488
|
+
{
|
|
1489
|
+
resourceId: null,
|
|
1490
|
+
title: x(s.messages).unassignedResource
|
|
1491
|
+
}
|
|
1492
|
+
] : []
|
|
1493
|
+
];
|
|
1494
|
+
for (const { resourceId: d, title: c } of l) {
|
|
1495
|
+
const p = this.rowElements.get(d ?? L);
|
|
1151
1496
|
if (!p) continue;
|
|
1152
|
-
const
|
|
1153
|
-
if (!
|
|
1154
|
-
|
|
1155
|
-
const f = (
|
|
1156
|
-
(
|
|
1157
|
-
).map((
|
|
1158
|
-
id:
|
|
1159
|
-
event:
|
|
1160
|
-
start:
|
|
1161
|
-
end:
|
|
1497
|
+
const m = p.querySelector(".scheduler-timeline-events");
|
|
1498
|
+
if (!m) continue;
|
|
1499
|
+
m.innerHTML = "";
|
|
1500
|
+
const f = (this.state.eventsByResource.get(d) ?? []).filter(
|
|
1501
|
+
(b) => b.start < i && b.end > n
|
|
1502
|
+
).map((b) => ({
|
|
1503
|
+
id: b.id,
|
|
1504
|
+
event: b,
|
|
1505
|
+
start: b.start,
|
|
1506
|
+
end: b.end,
|
|
1162
1507
|
isStart: !0,
|
|
1163
1508
|
isEnd: !0,
|
|
1164
1509
|
dayIndex: 0,
|
|
1165
1510
|
totalDays: 1
|
|
1166
|
-
})),
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
u.title
|
|
1511
|
+
})), g = D.getTimelinedParts(f), y = g.reduce((b, M) => Math.max(b, M.totalTracks), 1), { height: w, gap: E, padding: k } = this.trackMetrics;
|
|
1512
|
+
p.style.minHeight = `${y * w + (y - 1) * E + 2 * k}px`;
|
|
1513
|
+
for (const { part: b, trackIndex: M } of g) {
|
|
1514
|
+
if (!b.event) continue;
|
|
1515
|
+
const F = this.createEventElement(
|
|
1516
|
+
b.event,
|
|
1517
|
+
M,
|
|
1518
|
+
n,
|
|
1519
|
+
a,
|
|
1520
|
+
s.slotDuration ?? 1800,
|
|
1521
|
+
c
|
|
1178
1522
|
);
|
|
1179
|
-
|
|
1523
|
+
m.appendChild(F);
|
|
1180
1524
|
}
|
|
1181
1525
|
}
|
|
1182
1526
|
}
|
|
1183
|
-
createEventElement(e, t, s, n, i, r
|
|
1184
|
-
const
|
|
1185
|
-
this.state.keyboardMoveEventId, e.id,
|
|
1527
|
+
createEventElement(e, t, s, n, i, r = null) {
|
|
1528
|
+
const o = this.createElement("div", "scheduler-timeline-event"), a = this.state.selectedEvent?.id === e.id;
|
|
1529
|
+
this.state.keyboardMoveEventId, e.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
|
|
1186
1530
|
"aria-label",
|
|
1187
|
-
|
|
1188
|
-
),
|
|
1189
|
-
const
|
|
1190
|
-
|
|
1191
|
-
const
|
|
1192
|
-
return
|
|
1193
|
-
|
|
1531
|
+
z(e, r, this.state.options)
|
|
1532
|
+
), 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), p = l - s.getTime(), m = c - l, v = d - s.getTime(), f = p / v * n, g = Math.max(m / v * n, 20), { height: y, gap: w, padding: E } = this.trackMetrics;
|
|
1534
|
+
o.style.left = `${f}px`, o.style.width = `${g}px`, o.style.top = `${E + t * (y + w)}px`, o.style.height = `${y}px`, this.applyEventColors(o, e), this.setData(o, { eventId: e.id });
|
|
1535
|
+
const k = this.createElement("div", "event-content"), b = this.createElement("div", "event-title");
|
|
1536
|
+
return b.textContent = e.title, k.appendChild(b), o.appendChild(k), this.appendResizeHandles(
|
|
1537
|
+
o,
|
|
1194
1538
|
{
|
|
1195
1539
|
id: e.id,
|
|
1196
1540
|
event: e,
|
|
1197
1541
|
start: e.start,
|
|
1198
1542
|
end: e.end,
|
|
1199
|
-
isStart: e.start.getTime() >=
|
|
1200
|
-
isEnd: e.end.getTime() <=
|
|
1543
|
+
isStart: e.start.getTime() >= s.getTime(),
|
|
1544
|
+
isEnd: e.end.getTime() <= d,
|
|
1201
1545
|
dayIndex: 0,
|
|
1202
1546
|
totalDays: 1
|
|
1203
1547
|
},
|
|
1204
1548
|
["left", "right"]
|
|
1205
|
-
),
|
|
1549
|
+
), o;
|
|
1206
1550
|
}
|
|
1207
1551
|
/**
|
|
1208
|
-
* Dashed ghost showing where the
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1552
|
+
* Dashed ghost showing where the event will land. Mirrors
|
|
1553
|
+
* week-view.renderPreviewEvent for the horizontal axis.
|
|
1554
|
+
*
|
|
1555
|
+
* Gated on `previewEvent` alone — NOT on `dragState`, which only the pointer
|
|
1556
|
+
* drag path writes. Keyboard move-mode sets `previewEvent` with no
|
|
1557
|
+
* `dragState`, so requiring it hid the ghost from keyboard users on this
|
|
1558
|
+
* view while week/day showed it.
|
|
1211
1559
|
*/
|
|
1212
1560
|
renderPreviewEvent(e) {
|
|
1213
1561
|
this.container.querySelector(".scheduler-timeline-event.preview")?.remove();
|
|
1214
|
-
const { dragState: t, previewEvent: s,
|
|
1215
|
-
if (!
|
|
1216
|
-
const
|
|
1562
|
+
const { dragState: t, previewEvent: s, options: n } = this.state;
|
|
1563
|
+
if (!s) return;
|
|
1564
|
+
const i = t?.event?.id ?? this.state.keyboardMoveEventId, r = i ? this.state.events.find((w) => w.id === i) : void 0, o = s.resourceId ?? // `?? UNASSIGNED_ROW_ID`, not `?? undefined`: an event in the bucket row is
|
|
1565
|
+
// legitimately resource-less and still deserves a ghost.
|
|
1566
|
+
(r ? r.resourceId ?? L : void 0) ?? // A CREATE drag has no source event and no resource on the preview either,
|
|
1567
|
+
// so fall back to the row the gesture is happening in. Without this a
|
|
1568
|
+
// create-drag on a timeline row showed no ghost at all.
|
|
1569
|
+
this.state.selectionResourceId ?? this.state.focusedResourceId ?? void 0;
|
|
1570
|
+
if (!o) return;
|
|
1571
|
+
const l = this.rowElements.get(o)?.querySelector(".scheduler-timeline-events");
|
|
1217
1572
|
if (!l) return;
|
|
1218
1573
|
const c = h.getTimeSlots(
|
|
1219
1574
|
e[0],
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
).length * 7 * this.slotWidth,
|
|
1224
|
-
|
|
1575
|
+
n.slotDuration,
|
|
1576
|
+
n.slotMinTime,
|
|
1577
|
+
n.slotMaxTime
|
|
1578
|
+
).length * 7 * this.slotWidth, p = e[0], m = p.getTime() + 10080 * 60 * 1e3, v = Math.max(s.start.getTime(), p.getTime()), f = Math.min(s.end.getTime(), m), g = m - p.getTime(), y = this.createElement("div", "scheduler-timeline-event", "preview");
|
|
1579
|
+
if (y.style.left = `${(v - p.getTime()) / g * c}px`, y.style.width = `${Math.max((f - v) / g * c, 20)}px`, i) {
|
|
1580
|
+
const w = Array.from(
|
|
1581
|
+
l.querySelectorAll(".scheduler-timeline-event:not(.preview)")
|
|
1582
|
+
).find((E) => E.dataset.eventId === i);
|
|
1583
|
+
w && (y.style.top = w.style.top, y.style.height = w.style.height);
|
|
1584
|
+
}
|
|
1585
|
+
l.appendChild(y);
|
|
1225
1586
|
}
|
|
1226
1587
|
update(e) {
|
|
1227
|
-
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options);
|
|
1228
|
-
if (this.state = e, t || s) {
|
|
1588
|
+
const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options), n = this.state.resources !== e.resources || this.state.collapsedGroups !== e.collapsedGroups || this.state.resolvedPermissions !== e.resolvedPermissions || this.hasUnassignedRow(this.state) !== this.hasUnassignedRow(e);
|
|
1589
|
+
if (this.state = e, t || s || n) {
|
|
1229
1590
|
this.render();
|
|
1230
1591
|
return;
|
|
1231
1592
|
}
|
|
1232
1593
|
this.updateGreyedSlots();
|
|
1233
|
-
const
|
|
1234
|
-
this.renderEvents(
|
|
1594
|
+
const i = h.getWeekDays(e.date, e.options.firstDayOfWeek);
|
|
1595
|
+
this.renderEvents(i), this.renderPreviewEvent(i), this.updateCellFocusAndSelection();
|
|
1235
1596
|
}
|
|
1236
1597
|
optionsRequireRerender(e, t) {
|
|
1237
1598
|
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;
|
|
@@ -1247,7 +1608,16 @@ class ne extends A {
|
|
|
1247
1608
|
this.rowElements.clear(), this.clearContainer();
|
|
1248
1609
|
}
|
|
1249
1610
|
}
|
|
1250
|
-
const
|
|
1611
|
+
const be = Q(`@charset "UTF-8";
|
|
1612
|
+
/* Layering ladder. Nothing between :host and the events establishes a
|
|
1613
|
+
stacking context, so every one of these competes in ONE shared context
|
|
1614
|
+
across the whole shadow root — a selected event in one day column is
|
|
1615
|
+
compared directly against the now-indicator in another, and against the
|
|
1616
|
+
sticky header. Keep them here, in order, rather than scattering magic
|
|
1617
|
+
numbers: the preview ghost silently disappearing behind a selected event
|
|
1618
|
+
is exactly what an undocumented ladder buys you.
|
|
1619
|
+
SCSS vars (not custom properties) on purpose — these compile away, so the
|
|
1620
|
+
ladder stays internal instead of becoming consumer-overridable API. */
|
|
1251
1621
|
:host {
|
|
1252
1622
|
display: block;
|
|
1253
1623
|
height: 100%;
|
|
@@ -1264,6 +1634,18 @@ const ie = N(`@charset "UTF-8";
|
|
|
1264
1634
|
--scheduler-greyed-slot-bg: rgba(0, 0, 0, 0.1);
|
|
1265
1635
|
--scheduler-column-min-width: 120px;
|
|
1266
1636
|
--scheduler-touch-hold-duration: 500ms;
|
|
1637
|
+
/* Timeline slot width. Was hard-coded at 50px in TS, which made a default week
|
|
1638
|
+
16,800px wide; consumers can now shorten it. */
|
|
1639
|
+
--scheduler-slot-width: 50px;
|
|
1640
|
+
/* Timeline track geometry. Time runs horizontally there, so an event's height
|
|
1641
|
+
is free to be constant and overlapping events stack downwards, growing the
|
|
1642
|
+
resource row — see TimelineView.trackMetrics. */
|
|
1643
|
+
--scheduler-timeline-event-height: 28px;
|
|
1644
|
+
--scheduler-timeline-track-gap: 2px;
|
|
1645
|
+
--scheduler-timeline-row-padding: 2px;
|
|
1646
|
+
/* Pinned resource column. Capped so it can never swallow the grid on a narrow
|
|
1647
|
+
viewport (AG Grid applies the same guard by auto-unpinning). */
|
|
1648
|
+
--scheduler-resource-column-width: min(200px, calc(100% - 50px));
|
|
1267
1649
|
--scheduler-resize-glyph-size: 14px;
|
|
1268
1650
|
--scheduler-resize-glyph-color: var(--bs-body-color, #212529);
|
|
1269
1651
|
--scheduler-resize-glyph-bg: var(--bs-body-bg, #fff);
|
|
@@ -1386,20 +1768,9 @@ const ie = N(`@charset "UTF-8";
|
|
|
1386
1768
|
border-color: var(--bs-primary);
|
|
1387
1769
|
}
|
|
1388
1770
|
|
|
1389
|
-
/* Main content area
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
flex: 1;
|
|
1393
|
-
overflow: hidden;
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
.scheduler-sidebar {
|
|
1397
|
-
width: var(--scheduler-time-gutter-width);
|
|
1398
|
-
flex-shrink: 0;
|
|
1399
|
-
border-right: 1px solid var(--scheduler-border-color);
|
|
1400
|
-
background: var(--scheduler-header-bg);
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1771
|
+
/* Main content area — the single scroller for every view.
|
|
1772
|
+
(\`.scheduler-body\` / \`.scheduler-sidebar\` / \`.scheduler-grid\` rules lived here
|
|
1773
|
+
with no producer in any view; removed rather than left to mislead.) */
|
|
1403
1774
|
.scheduler-content {
|
|
1404
1775
|
flex: 1;
|
|
1405
1776
|
overflow: auto;
|
|
@@ -1407,11 +1778,6 @@ const ie = N(`@charset "UTF-8";
|
|
|
1407
1778
|
}
|
|
1408
1779
|
|
|
1409
1780
|
/* Week/Day View Grid */
|
|
1410
|
-
.scheduler-grid {
|
|
1411
|
-
display: grid;
|
|
1412
|
-
min-width: 100%;
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
1781
|
.scheduler-day-headers {
|
|
1416
1782
|
display: flex;
|
|
1417
1783
|
border-bottom: 1px solid var(--scheduler-border-color);
|
|
@@ -1462,6 +1828,11 @@ const ie = N(`@charset "UTF-8";
|
|
|
1462
1828
|
flex-shrink: 0;
|
|
1463
1829
|
border-right: 1px solid var(--scheduler-border-color);
|
|
1464
1830
|
background: var(--scheduler-header-bg);
|
|
1831
|
+
/* Pin the time labels while the week scrolls horizontally — same defect the
|
|
1832
|
+
timeline's resource column had. Background is already opaque. */
|
|
1833
|
+
position: sticky;
|
|
1834
|
+
left: 0;
|
|
1835
|
+
z-index: 7;
|
|
1465
1836
|
}
|
|
1466
1837
|
|
|
1467
1838
|
.scheduler-time-slot-label {
|
|
@@ -1515,7 +1886,9 @@ const ie = N(`@charset "UTF-8";
|
|
|
1515
1886
|
.scheduler-time-slot:focus {
|
|
1516
1887
|
outline: 2px solid var(--bs-primary);
|
|
1517
1888
|
outline-offset: -2px;
|
|
1518
|
-
|
|
1889
|
+
/* Above the events overlay — including a SELECTED event, which would
|
|
1890
|
+
otherwise hide the focus ring of the slot beneath it. */
|
|
1891
|
+
z-index: 6;
|
|
1519
1892
|
}
|
|
1520
1893
|
|
|
1521
1894
|
/* Events */
|
|
@@ -1579,8 +1952,7 @@ const ie = N(`@charset "UTF-8";
|
|
|
1579
1952
|
.scheduler-event.selected {
|
|
1580
1953
|
box-shadow: 0 0 0 3px var(--bs-body-color);
|
|
1581
1954
|
/* Raise above sibling events so the straddling handles win pointer hits.
|
|
1582
|
-
At most one event is selected
|
|
1583
|
-
but is pointer-events: none. */
|
|
1955
|
+
At most one event is selected. See the ladder at the top of this file. */
|
|
1584
1956
|
z-index: 2;
|
|
1585
1957
|
}
|
|
1586
1958
|
|
|
@@ -1596,10 +1968,26 @@ const ie = N(`@charset "UTF-8";
|
|
|
1596
1968
|
opacity: 0.8;
|
|
1597
1969
|
}
|
|
1598
1970
|
|
|
1971
|
+
/* A range spanning several days renders one ghost per day. Drop the border on
|
|
1972
|
+
the midnight seams so the set reads as ONE range instead of N events. */
|
|
1973
|
+
.scheduler-event.preview.preview-continues-before,
|
|
1974
|
+
.scheduler-timeline-event.preview.preview-continues-before {
|
|
1975
|
+
border-top-color: transparent;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
.scheduler-event.preview.preview-continues-after,
|
|
1979
|
+
.scheduler-timeline-event.preview.preview-continues-after {
|
|
1980
|
+
border-bottom-color: transparent;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1599
1983
|
.scheduler-event.preview {
|
|
1600
1984
|
background: var(--scheduler-preview-bg);
|
|
1601
1985
|
border: 2px dashed var(--bs-primary);
|
|
1602
1986
|
pointer-events: none;
|
|
1987
|
+
/* MUST out-rank the source event in every state (normal, selected,
|
|
1988
|
+
dragging) — an equal z-index would leave it relying on the preview being
|
|
1989
|
+
appended last, which breaks the moment a view reorders its update(). */
|
|
1990
|
+
z-index: 4;
|
|
1603
1991
|
}
|
|
1604
1992
|
|
|
1605
1993
|
/* Resize handles — invisible 8px strips on every resizable event (the
|
|
@@ -1702,8 +2090,20 @@ const ie = N(`@charset "UTF-8";
|
|
|
1702
2090
|
|
|
1703
2091
|
.scheduler-month-grid {
|
|
1704
2092
|
display: grid;
|
|
1705
|
-
|
|
1706
|
-
|
|
2093
|
+
/* \`minmax(min, 1fr)\` + \`min-width: fit-content\`, NOT a bare \`1fr\`.
|
|
2094
|
+
The day-name header row is the same \`.scheduler-day-headers\` week view uses,
|
|
2095
|
+
whose cells are \`flex: 1 0 var(--scheduler-column-min-width)\` — so below
|
|
2096
|
+
7 x that width the header row grows past the panel while a \`1fr\` grid kept
|
|
2097
|
+
shrinking, and the two column sets visibly disagreed (at 900px: 120px
|
|
2098
|
+
headers over 75px cells). Both now share one minimum and overflow together,
|
|
2099
|
+
which is also what makes the month view horizontally scrollable instead of
|
|
2100
|
+
illegibly narrow on a phone. */
|
|
2101
|
+
grid-template-columns: repeat(7, minmax(var(--scheduler-column-min-width), 1fr));
|
|
2102
|
+
min-width: fit-content;
|
|
2103
|
+
/* 120px, not 100px: a day number plus three 24px chips and the "+N more" link
|
|
2104
|
+
needs the room, and a chip clipped by \`overflow: hidden\` is a target the
|
|
2105
|
+
user cannot hit at all. */
|
|
2106
|
+
grid-auto-rows: minmax(120px, 1fr);
|
|
1707
2107
|
height: 100%;
|
|
1708
2108
|
}
|
|
1709
2109
|
|
|
@@ -1738,7 +2138,16 @@ const ie = N(`@charset "UTF-8";
|
|
|
1738
2138
|
gap: 2px;
|
|
1739
2139
|
}
|
|
1740
2140
|
|
|
2141
|
+
/* 24px tall with 24px of clear spacing between chips: WCAG 2.2 SC 2.5.8. These
|
|
2142
|
+
were 20.5px with a 20.6px safe-click diameter, which axe reports as a serious
|
|
2143
|
+
target-size failure — it only surfaces on the month view, so the page-load
|
|
2144
|
+
audit (week view) never saw it. The month row grows to fit (grid-auto-rows
|
|
2145
|
+
below), so three chips plus the "+N more" link still fit a cell. */
|
|
1741
2146
|
.scheduler-month-event {
|
|
2147
|
+
display: flex;
|
|
2148
|
+
align-items: center;
|
|
2149
|
+
min-height: 24px;
|
|
2150
|
+
margin-bottom: 2px;
|
|
1742
2151
|
padding: 2px 4px;
|
|
1743
2152
|
border-radius: 2px;
|
|
1744
2153
|
font-size: 11px;
|
|
@@ -1749,12 +2158,149 @@ const ie = N(`@charset "UTF-8";
|
|
|
1749
2158
|
}
|
|
1750
2159
|
|
|
1751
2160
|
.scheduler-more-link {
|
|
2161
|
+
display: flex;
|
|
2162
|
+
align-items: center;
|
|
2163
|
+
min-height: 24px;
|
|
1752
2164
|
font-size: 11px;
|
|
1753
2165
|
color: var(--bs-primary);
|
|
1754
2166
|
cursor: pointer;
|
|
1755
2167
|
margin-top: 2px;
|
|
1756
2168
|
}
|
|
1757
2169
|
|
|
2170
|
+
.scheduler-more-link:focus-visible {
|
|
2171
|
+
outline: 2px solid var(--bs-primary);
|
|
2172
|
+
outline-offset: 1px;
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
/* Day popover (month view). \`position: fixed\` coordinates are written by the
|
|
2176
|
+
OverlayController, so this element must stay a top-level child of the shadow
|
|
2177
|
+
root — nothing above it may introduce transform/filter/contain, which would
|
|
2178
|
+
make that ancestor the containing block and shift the panel. */
|
|
2179
|
+
.scheduler-day-popover {
|
|
2180
|
+
position: fixed;
|
|
2181
|
+
z-index: 20;
|
|
2182
|
+
min-width: 220px;
|
|
2183
|
+
max-width: min(320px, 90vw);
|
|
2184
|
+
max-height: 60vh;
|
|
2185
|
+
overflow-y: auto;
|
|
2186
|
+
padding: 8px;
|
|
2187
|
+
border: 1px solid var(--scheduler-border-color);
|
|
2188
|
+
border-radius: 6px;
|
|
2189
|
+
background: var(--bs-body-bg, #fff);
|
|
2190
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
.scheduler-day-popover .popover-head {
|
|
2194
|
+
display: flex;
|
|
2195
|
+
align-items: flex-start;
|
|
2196
|
+
justify-content: space-between;
|
|
2197
|
+
gap: 8px;
|
|
2198
|
+
margin-bottom: 6px;
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
.scheduler-day-popover .popover-date {
|
|
2202
|
+
font-weight: 600;
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
.scheduler-day-popover .popover-count,
|
|
2206
|
+
.scheduler-day-popover .popover-empty {
|
|
2207
|
+
font-size: 12px;
|
|
2208
|
+
color: var(--bs-secondary-color, #6c757d);
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
.scheduler-day-popover .popover-empty {
|
|
2212
|
+
margin: 4px 0 8px;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
.scheduler-day-popover .popover-close {
|
|
2216
|
+
width: 24px;
|
|
2217
|
+
height: 24px;
|
|
2218
|
+
flex: 0 0 auto;
|
|
2219
|
+
display: flex;
|
|
2220
|
+
align-items: center;
|
|
2221
|
+
justify-content: center;
|
|
2222
|
+
padding: 0;
|
|
2223
|
+
border: 1px solid transparent;
|
|
2224
|
+
border-radius: 4px;
|
|
2225
|
+
background: transparent;
|
|
2226
|
+
color: inherit;
|
|
2227
|
+
font: inherit;
|
|
2228
|
+
cursor: pointer;
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
.scheduler-day-popover .popover-events {
|
|
2232
|
+
list-style: none;
|
|
2233
|
+
margin: 0 0 8px;
|
|
2234
|
+
padding: 0;
|
|
2235
|
+
display: flex;
|
|
2236
|
+
flex-direction: column;
|
|
2237
|
+
gap: 2px;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
.scheduler-day-popover .popover-event {
|
|
2241
|
+
display: flex;
|
|
2242
|
+
align-items: center;
|
|
2243
|
+
gap: 8px;
|
|
2244
|
+
width: 100%;
|
|
2245
|
+
min-height: 28px;
|
|
2246
|
+
padding: 4px 6px;
|
|
2247
|
+
border: 1px solid transparent;
|
|
2248
|
+
border-radius: 4px;
|
|
2249
|
+
background: transparent;
|
|
2250
|
+
color: inherit;
|
|
2251
|
+
font: inherit;
|
|
2252
|
+
text-align: left;
|
|
2253
|
+
cursor: pointer;
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
.scheduler-day-popover .popover-event:hover {
|
|
2257
|
+
background: var(--bs-secondary-bg, rgba(0, 0, 0, 0.08));
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
/* A colour chip, NOT the only carrier of identity — the title next to it says
|
|
2261
|
+
which event this is (WCAG 1.4.1). */
|
|
2262
|
+
.scheduler-day-popover .popover-event-swatch {
|
|
2263
|
+
width: 10px;
|
|
2264
|
+
height: 10px;
|
|
2265
|
+
flex: 0 0 auto;
|
|
2266
|
+
border-radius: 2px;
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
.scheduler-day-popover .popover-event-title {
|
|
2270
|
+
overflow: hidden;
|
|
2271
|
+
text-overflow: ellipsis;
|
|
2272
|
+
white-space: nowrap;
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
.scheduler-day-popover .popover-actions {
|
|
2276
|
+
display: flex;
|
|
2277
|
+
flex-wrap: wrap;
|
|
2278
|
+
gap: 4px;
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
.scheduler-day-popover .popover-action {
|
|
2282
|
+
min-height: 28px;
|
|
2283
|
+
padding: 4px 10px;
|
|
2284
|
+
border: 1px solid var(--scheduler-border-color);
|
|
2285
|
+
border-radius: 4px;
|
|
2286
|
+
background: var(--bs-body-bg);
|
|
2287
|
+
color: inherit;
|
|
2288
|
+
font: inherit;
|
|
2289
|
+
font-size: 12px;
|
|
2290
|
+
cursor: pointer;
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
.scheduler-day-popover .popover-action.primary {
|
|
2294
|
+
background: var(--bs-primary);
|
|
2295
|
+
border-color: var(--bs-primary);
|
|
2296
|
+
color: #fff;
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
.scheduler-day-popover button:focus-visible {
|
|
2300
|
+
outline: 2px solid var(--bs-primary);
|
|
2301
|
+
outline-offset: 1px;
|
|
2302
|
+
}
|
|
2303
|
+
|
|
1758
2304
|
/* Year View */
|
|
1759
2305
|
.scheduler-year-grid {
|
|
1760
2306
|
display: grid;
|
|
@@ -1824,34 +2370,64 @@ const ie = N(`@charset "UTF-8";
|
|
|
1824
2370
|
color: var(--bs-secondary-color);
|
|
1825
2371
|
}
|
|
1826
2372
|
|
|
1827
|
-
/* Timeline View
|
|
2373
|
+
/* Timeline View
|
|
2374
|
+
ONE scroller: \`.scheduler-content\` (same as week view). The timeline grows to
|
|
2375
|
+
its content width via \`min-width: fit-content\` and the header/column pin with
|
|
2376
|
+
\`position: sticky\`, so horizontal and vertical scrolling both happen on the
|
|
2377
|
+
element the component already treats as its scroller — which is what makes
|
|
2378
|
+
touch-pan, \`.scroll-blocked\` and the styled scrollbars work here at all.
|
|
2379
|
+
Previously \`.scheduler-timeline-body\` had its own \`overflow: auto\`, trapping
|
|
2380
|
+
the overflow in a nested scroller nothing knew about, while the header strip
|
|
2381
|
+
clipped ~16,800px of labels with no scroll sync. */
|
|
1828
2382
|
.scheduler-timeline {
|
|
1829
2383
|
display: flex;
|
|
1830
2384
|
flex-direction: column;
|
|
1831
|
-
height: 100%;
|
|
2385
|
+
min-height: 100%;
|
|
2386
|
+
min-width: fit-content;
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
/* The grid claims the full scrollport height so its rows fill the panel. With
|
|
2390
|
+
the add bar below it that sums to more than 100% and every timeline gets a
|
|
2391
|
+
permanent vertical scrollbar, so drop the claim when the bar is present. */
|
|
2392
|
+
.scheduler-timeline:has(+ .scheduler-timeline-addbar) {
|
|
2393
|
+
min-height: auto;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
.scheduler-timeline-head {
|
|
2397
|
+
position: sticky;
|
|
2398
|
+
top: 0;
|
|
2399
|
+
z-index: 10;
|
|
2400
|
+
min-width: fit-content;
|
|
2401
|
+
background: var(--scheduler-header-bg);
|
|
1832
2402
|
}
|
|
1833
2403
|
|
|
1834
2404
|
.scheduler-timeline-header {
|
|
1835
2405
|
display: flex;
|
|
1836
2406
|
border-bottom: 1px solid var(--scheduler-border-color);
|
|
1837
2407
|
background: var(--scheduler-header-bg);
|
|
1838
|
-
|
|
1839
|
-
top: 0;
|
|
1840
|
-
z-index: 10;
|
|
2408
|
+
min-width: fit-content;
|
|
1841
2409
|
}
|
|
1842
2410
|
|
|
1843
2411
|
.scheduler-resource-header {
|
|
1844
|
-
width:
|
|
2412
|
+
width: var(--scheduler-resource-column-width);
|
|
2413
|
+
max-width: var(--scheduler-resource-column-width);
|
|
1845
2414
|
flex-shrink: 0;
|
|
1846
2415
|
padding: 8px;
|
|
1847
2416
|
border-right: 1px solid var(--scheduler-border-color);
|
|
1848
2417
|
font-weight: 600;
|
|
2418
|
+
/* Pinned on BOTH axes: inside the sticky header block, so it stays put
|
|
2419
|
+
horizontally as the grid scrolls and vertically with the header. */
|
|
2420
|
+
position: sticky;
|
|
2421
|
+
left: 0;
|
|
2422
|
+
z-index: 7;
|
|
2423
|
+
background: var(--scheduler-header-bg);
|
|
1849
2424
|
}
|
|
1850
2425
|
|
|
1851
2426
|
.scheduler-timeline-slots-header {
|
|
1852
2427
|
display: flex;
|
|
1853
|
-
flex: 1
|
|
1854
|
-
|
|
2428
|
+
/* NOT flex: 1 — it must size to its content so the header travels with the
|
|
2429
|
+
grid instead of shrinking and clipping it. */
|
|
2430
|
+
flex: 0 0 auto;
|
|
1855
2431
|
}
|
|
1856
2432
|
|
|
1857
2433
|
.scheduler-timeline-slot-header {
|
|
@@ -1865,14 +2441,30 @@ const ie = N(`@charset "UTF-8";
|
|
|
1865
2441
|
.scheduler-timeline-body {
|
|
1866
2442
|
display: flex;
|
|
1867
2443
|
flex-direction: column;
|
|
1868
|
-
flex: 1
|
|
1869
|
-
|
|
2444
|
+
/* No \`overflow: auto\` and no \`flex: 1\`: this must NOT be a scroller, or the
|
|
2445
|
+
horizontal overflow is trapped here instead of reaching .scheduler-content. */
|
|
2446
|
+
flex: 0 0 auto;
|
|
2447
|
+
min-width: fit-content;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
.scheduler-timeline-empty {
|
|
2451
|
+
padding: 16px;
|
|
2452
|
+
color: var(--bs-secondary-color, #6c757d);
|
|
2453
|
+
/* Sticky-left so the message stays readable while the grid scrolls, and
|
|
2454
|
+
narrow enough not to stretch the (already very wide) timeline. */
|
|
2455
|
+
position: sticky;
|
|
2456
|
+
left: 0;
|
|
2457
|
+
width: var(--scheduler-resource-column-width);
|
|
1870
2458
|
}
|
|
1871
2459
|
|
|
1872
2460
|
.scheduler-timeline-row {
|
|
1873
2461
|
display: flex;
|
|
1874
2462
|
border-bottom: 1px solid var(--scheduler-border-color);
|
|
1875
2463
|
min-height: 40px;
|
|
2464
|
+
/* Required: this is the sticky resource cell's containing block, so without it
|
|
2465
|
+
the pinned column only travels one viewport-width. Also stops row borders,
|
|
2466
|
+
.group backgrounds and .selected highlights ending at the viewport edge. */
|
|
2467
|
+
min-width: fit-content;
|
|
1876
2468
|
}
|
|
1877
2469
|
|
|
1878
2470
|
.scheduler-timeline-row.group {
|
|
@@ -1880,14 +2472,37 @@ const ie = N(`@charset "UTF-8";
|
|
|
1880
2472
|
font-weight: 600;
|
|
1881
2473
|
}
|
|
1882
2474
|
|
|
2475
|
+
.scheduler-timeline-row.group .scheduler-resource-cell {
|
|
2476
|
+
/* Sticky cells are transparent by default — a group row must keep its own
|
|
2477
|
+
tint or slots slide visibly underneath the pinned column. */
|
|
2478
|
+
background: var(--scheduler-header-bg);
|
|
2479
|
+
}
|
|
2480
|
+
|
|
1883
2481
|
.scheduler-resource-cell {
|
|
1884
|
-
width:
|
|
2482
|
+
width: var(--scheduler-resource-column-width);
|
|
2483
|
+
max-width: var(--scheduler-resource-column-width);
|
|
1885
2484
|
flex-shrink: 0;
|
|
1886
2485
|
padding: 8px;
|
|
1887
2486
|
border-right: 1px solid var(--scheduler-border-color);
|
|
1888
2487
|
display: flex;
|
|
1889
2488
|
align-items: center;
|
|
1890
2489
|
gap: 8px;
|
|
2490
|
+
/* Pinned left while the grid scrolls horizontally. Needs an opaque background
|
|
2491
|
+
for the same reason as above. */
|
|
2492
|
+
position: sticky;
|
|
2493
|
+
left: 0;
|
|
2494
|
+
z-index: 7;
|
|
2495
|
+
background: var(--bs-body-bg);
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
.scheduler-resource-cell .resource-title {
|
|
2499
|
+
/* Ellipsis rather than wrap: the row is a fixed 40px and the action buttons
|
|
2500
|
+
must not be pushed out of the pinned column by a long title. */
|
|
2501
|
+
flex: 1 1 auto;
|
|
2502
|
+
min-width: 0;
|
|
2503
|
+
overflow: hidden;
|
|
2504
|
+
text-overflow: ellipsis;
|
|
2505
|
+
white-space: nowrap;
|
|
1891
2506
|
}
|
|
1892
2507
|
|
|
1893
2508
|
.scheduler-resource-cell .expand-toggle {
|
|
@@ -1897,11 +2512,106 @@ const ie = N(`@charset "UTF-8";
|
|
|
1897
2512
|
display: flex;
|
|
1898
2513
|
align-items: center;
|
|
1899
2514
|
justify-content: center;
|
|
2515
|
+
flex: 0 0 auto;
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
/* Row actions. Hidden affordances were rejected: revealing these on hover only
|
|
2519
|
+
would leave them undiscoverable on touch, where there is no hover. */
|
|
2520
|
+
.scheduler-resource-actions {
|
|
2521
|
+
display: flex;
|
|
2522
|
+
align-items: center;
|
|
2523
|
+
gap: 2px;
|
|
2524
|
+
flex: 0 0 auto;
|
|
2525
|
+
margin-left: auto;
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
.scheduler-resource-action {
|
|
2529
|
+
/* 24x24 = WCAG 2.2 SC 2.5.8 minimum target size. The glyph is smaller; the
|
|
2530
|
+
button is not. */
|
|
2531
|
+
width: 24px;
|
|
2532
|
+
height: 24px;
|
|
2533
|
+
display: flex;
|
|
2534
|
+
align-items: center;
|
|
2535
|
+
justify-content: center;
|
|
2536
|
+
padding: 0;
|
|
2537
|
+
cursor: pointer;
|
|
2538
|
+
border: 1px solid transparent;
|
|
2539
|
+
border-radius: 4px;
|
|
2540
|
+
background: transparent;
|
|
2541
|
+
color: inherit;
|
|
2542
|
+
font: inherit;
|
|
2543
|
+
line-height: 1;
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
.scheduler-resource-action:hover {
|
|
2547
|
+
background: var(--bs-secondary-bg, rgba(0, 0, 0, 0.08));
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
.scheduler-resource-action .action-glyph {
|
|
2551
|
+
font-size: 14px;
|
|
2552
|
+
pointer-events: none;
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
.scheduler-resource-color {
|
|
2556
|
+
/* A native colour input is ~44px wide by default and would eat the column. */
|
|
2557
|
+
width: 24px;
|
|
2558
|
+
height: 24px;
|
|
2559
|
+
padding: 0;
|
|
2560
|
+
border: 1px solid var(--scheduler-border-color);
|
|
2561
|
+
border-radius: 4px;
|
|
2562
|
+
background: transparent;
|
|
2563
|
+
cursor: pointer;
|
|
2564
|
+
flex: 0 0 auto;
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
/* Root-level creation bar, pinned to the foot of the frozen resource column.
|
|
2568
|
+
\`left: 0\` as well as \`bottom: 0\` so it tracks the column, not the grid, while
|
|
2569
|
+
the timeline scrolls horizontally. */
|
|
2570
|
+
.scheduler-timeline-addbar {
|
|
2571
|
+
position: sticky;
|
|
2572
|
+
bottom: 0;
|
|
2573
|
+
left: 0;
|
|
2574
|
+
z-index: 7;
|
|
2575
|
+
display: flex;
|
|
2576
|
+
flex-wrap: wrap;
|
|
2577
|
+
gap: 4px;
|
|
2578
|
+
width: var(--scheduler-resource-column-width);
|
|
2579
|
+
padding: 4px 8px;
|
|
2580
|
+
border-top: 1px solid var(--scheduler-border-color);
|
|
2581
|
+
background: var(--scheduler-header-bg);
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
.scheduler-add-button {
|
|
2585
|
+
min-height: 24px;
|
|
2586
|
+
padding: 2px 8px;
|
|
2587
|
+
cursor: pointer;
|
|
2588
|
+
border: 1px solid var(--scheduler-border-color);
|
|
2589
|
+
border-radius: 4px;
|
|
2590
|
+
background: var(--bs-body-bg);
|
|
2591
|
+
color: inherit;
|
|
2592
|
+
font: inherit;
|
|
2593
|
+
font-size: 12px;
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
.scheduler-add-button:hover {
|
|
2597
|
+
background: var(--bs-secondary-bg, rgba(0, 0, 0, 0.08));
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
/* One focus ring for every control in the resource column. \`.expand-toggle\` had
|
|
2601
|
+
none at all — Bootstrap's focus-ring utilities do not cross the shadow
|
|
2602
|
+
boundary, so a keyboard user tabbing onto it saw nothing. */
|
|
2603
|
+
.scheduler-resource-cell .expand-toggle:focus-visible,
|
|
2604
|
+
.scheduler-resource-action:focus-visible,
|
|
2605
|
+
.scheduler-resource-color:focus-visible,
|
|
2606
|
+
.scheduler-add-button:focus-visible {
|
|
2607
|
+
outline: 2px solid var(--bs-primary);
|
|
2608
|
+
outline-offset: 1px;
|
|
1900
2609
|
}
|
|
1901
2610
|
|
|
1902
2611
|
.scheduler-timeline-slots {
|
|
1903
2612
|
display: flex;
|
|
1904
|
-
|
|
2613
|
+
/* Explicit rather than relying on \`min-width: auto\` to push past the row box. */
|
|
2614
|
+
flex: 0 0 auto;
|
|
1905
2615
|
position: relative;
|
|
1906
2616
|
}
|
|
1907
2617
|
|
|
@@ -1923,7 +2633,7 @@ const ie = N(`@charset "UTF-8";
|
|
|
1923
2633
|
.scheduler-timeline-slot:focus {
|
|
1924
2634
|
outline: 2px solid var(--bs-primary);
|
|
1925
2635
|
outline-offset: -2px;
|
|
1926
|
-
z-index:
|
|
2636
|
+
z-index: 6;
|
|
1927
2637
|
}
|
|
1928
2638
|
|
|
1929
2639
|
.scheduler-timeline-events {
|
|
@@ -1937,8 +2647,10 @@ const ie = N(`@charset "UTF-8";
|
|
|
1937
2647
|
|
|
1938
2648
|
.scheduler-timeline-event {
|
|
1939
2649
|
position: absolute;
|
|
1940
|
-
height
|
|
1941
|
-
|
|
2650
|
+
/* top/height come from the track stack (set inline per event); the fallbacks
|
|
2651
|
+
here only apply to the drag ghost before it copies its source's band. */
|
|
2652
|
+
height: var(--scheduler-timeline-event-height);
|
|
2653
|
+
top: var(--scheduler-timeline-row-padding);
|
|
1942
2654
|
border-radius: var(--scheduler-event-border-radius);
|
|
1943
2655
|
padding: 2px 6px;
|
|
1944
2656
|
font-size: 12px;
|
|
@@ -1958,6 +2670,7 @@ const ie = N(`@charset "UTF-8";
|
|
|
1958
2670
|
background: var(--scheduler-preview-bg);
|
|
1959
2671
|
border: 2px dashed var(--bs-primary);
|
|
1960
2672
|
pointer-events: none;
|
|
2673
|
+
z-index: 4;
|
|
1961
2674
|
}
|
|
1962
2675
|
|
|
1963
2676
|
/* Horizontal resize handles — timeline counterpart of the week/day strips. */
|
|
@@ -2045,7 +2758,10 @@ const ie = N(`@charset "UTF-8";
|
|
|
2045
2758
|
.scheduler-event.touch-hold-active {
|
|
2046
2759
|
transform: scale(1.02);
|
|
2047
2760
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
2048
|
-
|
|
2761
|
+
/* Was 100, which painted a held event over the sticky day-header row (they
|
|
2762
|
+
share one scroller and one stacking context). It only needs to out-rank
|
|
2763
|
+
other events; the preview still goes above it. */
|
|
2764
|
+
z-index: 3;
|
|
2049
2765
|
touch-action: none;
|
|
2050
2766
|
-ms-touch-action: none;
|
|
2051
2767
|
}
|
|
@@ -2109,14 +2825,14 @@ const ie = N(`@charset "UTF-8";
|
|
|
2109
2825
|
animation: none !important;
|
|
2110
2826
|
transition: none !important;
|
|
2111
2827
|
}
|
|
2112
|
-
}`),
|
|
2828
|
+
}`), V = {
|
|
2113
2829
|
dragThreshold: 5,
|
|
2114
2830
|
minDurationMs: 1800 * 1e3
|
|
2115
2831
|
// 30 minutes
|
|
2116
2832
|
};
|
|
2117
|
-
class
|
|
2833
|
+
class we {
|
|
2118
2834
|
constructor(e = {}) {
|
|
2119
|
-
this.config = { ...
|
|
2835
|
+
this.config = { ...V, ...e };
|
|
2120
2836
|
}
|
|
2121
2837
|
/**
|
|
2122
2838
|
* Calculate the preview event position based on drag state.
|
|
@@ -2151,7 +2867,11 @@ class re {
|
|
|
2151
2867
|
), n = new Date(
|
|
2152
2868
|
Math.max(e.end.getTime(), t.end.getTime())
|
|
2153
2869
|
);
|
|
2154
|
-
return {
|
|
2870
|
+
return {
|
|
2871
|
+
start: s,
|
|
2872
|
+
end: n,
|
|
2873
|
+
...e.resourceId ? { resourceId: e.resourceId } : {}
|
|
2874
|
+
};
|
|
2155
2875
|
}
|
|
2156
2876
|
/**
|
|
2157
2877
|
* Calculate preview for moving an existing event.
|
|
@@ -2184,36 +2904,36 @@ class re {
|
|
|
2184
2904
|
return { start: t.start, end: n };
|
|
2185
2905
|
}
|
|
2186
2906
|
}
|
|
2187
|
-
function
|
|
2907
|
+
function H(u) {
|
|
2188
2908
|
return {
|
|
2189
2909
|
pointerId: 0,
|
|
2190
2910
|
pointerType: "mouse",
|
|
2191
|
-
clientX:
|
|
2192
|
-
clientY:
|
|
2193
|
-
originalEvent:
|
|
2194
|
-
target:
|
|
2911
|
+
clientX: u.clientX,
|
|
2912
|
+
clientY: u.clientY,
|
|
2913
|
+
originalEvent: u,
|
|
2914
|
+
target: u.target,
|
|
2195
2915
|
isPrimary: !0
|
|
2196
2916
|
};
|
|
2197
2917
|
}
|
|
2198
|
-
function
|
|
2199
|
-
const e =
|
|
2918
|
+
function B(u) {
|
|
2919
|
+
const e = u.touches[0] || u.changedTouches[0];
|
|
2200
2920
|
return e ? {
|
|
2201
2921
|
pointerId: e.identifier,
|
|
2202
2922
|
pointerType: "touch",
|
|
2203
2923
|
clientX: e.clientX,
|
|
2204
2924
|
clientY: e.clientY,
|
|
2205
|
-
originalEvent:
|
|
2925
|
+
originalEvent: u,
|
|
2206
2926
|
target: e.target,
|
|
2207
2927
|
isPrimary: e.identifier === 0
|
|
2208
2928
|
} : null;
|
|
2209
2929
|
}
|
|
2210
|
-
function
|
|
2211
|
-
const t = e.x -
|
|
2930
|
+
function J(u, e) {
|
|
2931
|
+
const t = e.x - u.x, s = e.y - u.y;
|
|
2212
2932
|
return Math.sqrt(t * t + s * s);
|
|
2213
2933
|
}
|
|
2214
|
-
class
|
|
2934
|
+
class Ee {
|
|
2215
2935
|
constructor(e = {}) {
|
|
2216
|
-
this.state = { phase: "idle" }, this.config = { ...
|
|
2936
|
+
this.state = { phase: "idle" }, this.config = { ...V, ...e }, this.previewCalculator = new we(this.config);
|
|
2217
2937
|
}
|
|
2218
2938
|
/**
|
|
2219
2939
|
* Get current state (read-only).
|
|
@@ -2352,7 +3072,7 @@ class oe {
|
|
|
2352
3072
|
if (this.state.phase !== "pending") return this.state;
|
|
2353
3073
|
switch (e.type) {
|
|
2354
3074
|
case "POINTER_MOVE":
|
|
2355
|
-
return
|
|
3075
|
+
return J(
|
|
2356
3076
|
this.state.startPosition,
|
|
2357
3077
|
e.position
|
|
2358
3078
|
) < this.config.dragThreshold ? this.state : this.activateDrag(e.slot);
|
|
@@ -2470,9 +3190,9 @@ class oe {
|
|
|
2470
3190
|
} : { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date() };
|
|
2471
3191
|
}
|
|
2472
3192
|
}
|
|
2473
|
-
class
|
|
3193
|
+
class xe {
|
|
2474
3194
|
constructor(e, t = {}) {
|
|
2475
|
-
this.pendingUpdate = null, this.latestPointer = null, this.getSlotAtPosition = null, this.stateManager = e, this.config = { ...
|
|
3195
|
+
this.pendingUpdate = null, this.latestPointer = null, this.getSlotAtPosition = null, this.stateManager = e, this.config = { ...V, ...t }, this.stateMachine = new Ee(this.config);
|
|
2476
3196
|
}
|
|
2477
3197
|
/**
|
|
2478
3198
|
* Set the function used to get a slot at a position.
|
|
@@ -2563,7 +3283,7 @@ class ae {
|
|
|
2563
3283
|
*/
|
|
2564
3284
|
createEventFromResult(e) {
|
|
2565
3285
|
return {
|
|
2566
|
-
id:
|
|
3286
|
+
id: ie(),
|
|
2567
3287
|
title: "New Event",
|
|
2568
3288
|
start: e.preview.start,
|
|
2569
3289
|
end: e.preview.end,
|
|
@@ -2616,8 +3336,8 @@ class ae {
|
|
|
2616
3336
|
this.pendingUpdate !== null && (cancelAnimationFrame(this.pendingUpdate), this.pendingUpdate = null), this.latestPointer = null;
|
|
2617
3337
|
}
|
|
2618
3338
|
}
|
|
2619
|
-
const
|
|
2620
|
-
class
|
|
3339
|
+
const De = 600, Se = 10;
|
|
3340
|
+
class Ce {
|
|
2621
3341
|
constructor(e, t) {
|
|
2622
3342
|
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);
|
|
2623
3343
|
}
|
|
@@ -2677,23 +3397,23 @@ class ce {
|
|
|
2677
3397
|
// Mouse event handlers
|
|
2678
3398
|
handleMouseDown(e) {
|
|
2679
3399
|
if (!this.config.isEditable()) return;
|
|
2680
|
-
const t =
|
|
3400
|
+
const t = H(e), s = this.analyzeTarget(t.target);
|
|
2681
3401
|
s.type !== "none" && (s.type === "slot" && !this.config.isSelectable() || (e.preventDefault(), this.callbacks.onPointerDown(t, s)));
|
|
2682
3402
|
}
|
|
2683
3403
|
handleMouseMove(e) {
|
|
2684
|
-
const t =
|
|
3404
|
+
const t = H(e);
|
|
2685
3405
|
this.callbacks.onPointerMove(t);
|
|
2686
3406
|
}
|
|
2687
3407
|
handleMouseUp(e) {
|
|
2688
|
-
const t =
|
|
3408
|
+
const t = H(e);
|
|
2689
3409
|
this.callbacks.onPointerUp(t);
|
|
2690
3410
|
}
|
|
2691
3411
|
handleClick(e) {
|
|
2692
|
-
const t =
|
|
3412
|
+
const t = H(e), s = this.analyzeTarget(t.target);
|
|
2693
3413
|
s.type === "event" || s.type === "resize-handle" || this.callbacks.onClick(t, s);
|
|
2694
3414
|
}
|
|
2695
3415
|
handleDblClick(e) {
|
|
2696
|
-
const t =
|
|
3416
|
+
const t = H(e), s = this.analyzeTarget(t.target);
|
|
2697
3417
|
this.callbacks.onDoubleClick(t, s);
|
|
2698
3418
|
}
|
|
2699
3419
|
// Touch event handlers
|
|
@@ -2703,7 +3423,7 @@ class ce {
|
|
|
2703
3423
|
this.cancelTouchHold();
|
|
2704
3424
|
return;
|
|
2705
3425
|
}
|
|
2706
|
-
const t =
|
|
3426
|
+
const t = B(e);
|
|
2707
3427
|
if (!t) return;
|
|
2708
3428
|
const s = this.analyzeTarget(t.target);
|
|
2709
3429
|
if (s.type === "none" || s.type === "slot" && !this.config.isSelectable()) return;
|
|
@@ -2720,7 +3440,7 @@ class ce {
|
|
|
2720
3440
|
return;
|
|
2721
3441
|
}
|
|
2722
3442
|
this.addTouchFeedback(t.target, "pending");
|
|
2723
|
-
const r = this.config.touchHoldDuration ??
|
|
3443
|
+
const r = this.config.touchHoldDuration ?? De;
|
|
2724
3444
|
this.touchHoldTimer = setTimeout(() => {
|
|
2725
3445
|
this.activateTouchDragMode(t, s);
|
|
2726
3446
|
}, r);
|
|
@@ -2730,15 +3450,15 @@ class ce {
|
|
|
2730
3450
|
this.cancelTouchHold(), this.exitPanMode();
|
|
2731
3451
|
return;
|
|
2732
3452
|
}
|
|
2733
|
-
const t =
|
|
3453
|
+
const t = B(e);
|
|
2734
3454
|
if (t) {
|
|
2735
3455
|
if (this.isPanMode) {
|
|
2736
3456
|
e.preventDefault(), this.performPan(t.clientX, t.clientY);
|
|
2737
3457
|
return;
|
|
2738
3458
|
}
|
|
2739
3459
|
if (this.touchHoldTimer && this.touchStartPosition) {
|
|
2740
|
-
const s = this.config.touchMoveThreshold ??
|
|
2741
|
-
if (
|
|
3460
|
+
const s = this.config.touchMoveThreshold ?? Se;
|
|
3461
|
+
if (J(this.touchStartPosition, {
|
|
2742
3462
|
x: t.clientX,
|
|
2743
3463
|
y: t.clientY
|
|
2744
3464
|
}) > s) {
|
|
@@ -2752,7 +3472,7 @@ class ce {
|
|
|
2752
3472
|
}
|
|
2753
3473
|
}
|
|
2754
3474
|
handleTouchEnd(e) {
|
|
2755
|
-
const t =
|
|
3475
|
+
const t = B(e);
|
|
2756
3476
|
if (this.isPanMode) {
|
|
2757
3477
|
this.exitPanMode();
|
|
2758
3478
|
return;
|
|
@@ -2833,20 +3553,22 @@ class ce {
|
|
|
2833
3553
|
e && e.classList.remove("scroll-blocked");
|
|
2834
3554
|
}
|
|
2835
3555
|
}
|
|
2836
|
-
class
|
|
3556
|
+
class Me {
|
|
2837
3557
|
constructor(e) {
|
|
2838
3558
|
this.host = e;
|
|
2839
3559
|
}
|
|
2840
3560
|
/**
|
|
2841
|
-
* Emit a scheduler custom event.
|
|
2842
|
-
*
|
|
3561
|
+
* Emit a scheduler custom event. `composed` as well as `bubbles`: without it
|
|
3562
|
+
* the event stops at the shadow boundary of any component the scheduler is
|
|
3563
|
+
* nested inside, so a wrapper-of-a-wrapper never sees it.
|
|
2843
3564
|
*/
|
|
2844
3565
|
emit(e) {
|
|
2845
3566
|
const { type: t, ...s } = e;
|
|
2846
3567
|
this.host.dispatchEvent(
|
|
2847
3568
|
new CustomEvent(t, {
|
|
2848
3569
|
detail: s,
|
|
2849
|
-
bubbles: !0
|
|
3570
|
+
bubbles: !0,
|
|
3571
|
+
composed: !0
|
|
2850
3572
|
})
|
|
2851
3573
|
);
|
|
2852
3574
|
}
|
|
@@ -2903,13 +3625,61 @@ class he {
|
|
|
2903
3625
|
emitSelectionChange(e, t, s, n) {
|
|
2904
3626
|
this.emit({ type: "selection-change", selectedEvent: e, range: t, view: s, resourceId: n });
|
|
2905
3627
|
}
|
|
3628
|
+
/**
|
|
3629
|
+
* Emit a `resource-create` or `group-create` *request*. Same controlled
|
|
3630
|
+
* contract as `event-create`: the scheduler never edits its own `resources`
|
|
3631
|
+
* input, so the consumer decides the id, title and placement. `parentId` is
|
|
3632
|
+
* the group to insert into — absent means root level.
|
|
3633
|
+
*/
|
|
3634
|
+
emitResourceCreate(e, t, s, n) {
|
|
3635
|
+
this.emit({
|
|
3636
|
+
type: e === "group" ? "group-create" : "resource-create",
|
|
3637
|
+
parentId: n,
|
|
3638
|
+
view: t,
|
|
3639
|
+
originalEvent: s
|
|
3640
|
+
});
|
|
3641
|
+
}
|
|
3642
|
+
/**
|
|
3643
|
+
* Emit a `resource-update` request carrying only the changed fields, so the
|
|
3644
|
+
* consumer can apply them without diffing.
|
|
3645
|
+
*/
|
|
3646
|
+
emitResourceUpdate(e, t, s) {
|
|
3647
|
+
this.emit({ type: "resource-update", resource: e, changes: t, originalEvent: s });
|
|
3648
|
+
}
|
|
3649
|
+
/**
|
|
3650
|
+
* Emit a `resource-delete` request.
|
|
3651
|
+
*/
|
|
3652
|
+
emitResourceDelete(e, t) {
|
|
3653
|
+
this.emit({ type: "resource-delete", resource: e, originalEvent: t });
|
|
3654
|
+
}
|
|
2906
3655
|
}
|
|
2907
|
-
class
|
|
3656
|
+
class I extends ee {
|
|
2908
3657
|
constructor() {
|
|
2909
|
-
super(), this.currentView = null, this.currentViewType = null, this.contentContainer = null, this.inputHandler = null, this.previousView = null, this.previousDate = null, this.previousSelectedEventId = null, this.previousRangeKey = "__init__", this.pendingDragUpdate = null, this.latestDragState = null, this.nowIndicatorTimer = null, this.liveAnnouncer = new
|
|
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 te(this), this.popoverDate = null, this.popoverAnchorKey = null, this.dayPopover = new re(this, {
|
|
3659
|
+
anchor: () => this.popoverAnchorCell(),
|
|
3660
|
+
// Same element as the anchor: the day cell IS the trigger. Spelling it out
|
|
3661
|
+
// means focus returns to the day even when the popover was opened without
|
|
3662
|
+
// anything focused (a programmatic open, or a click on a `tabindex="-1"`
|
|
3663
|
+
// cell that some paths do not focus) instead of falling to <body>.
|
|
3664
|
+
trigger: () => this.popoverAnchorCell(),
|
|
3665
|
+
panel: () => this.shadowRoot?.querySelector(".scheduler-day-popover") ?? null,
|
|
3666
|
+
// The first EVENT, or failing that the first action — not `'first'`, which
|
|
3667
|
+
// is the close button in the header: opening a dialog with focus on "close"
|
|
3668
|
+
// means the user's first Enter dismisses what they just asked to see.
|
|
3669
|
+
initialFocus: () => {
|
|
3670
|
+
const e = this.shadowRoot?.querySelector(".scheduler-day-popover");
|
|
3671
|
+
return e?.querySelector(".popover-event") ?? e?.querySelector(".popover-action") ?? null;
|
|
3672
|
+
},
|
|
3673
|
+
modal: !1,
|
|
3674
|
+
// Dismissal comes from the controller (Escape via the dismiss stack, outside
|
|
3675
|
+
// mousedown), so mirror it into our own state or the panel stays rendered.
|
|
3676
|
+
onClose: () => {
|
|
3677
|
+
this.popoverDate = null, this.popoverAnchorKey = null, this.requestUpdate();
|
|
3678
|
+
}
|
|
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 de(), this.eventEmitter = new Me(this), this.dragManager = new xe(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.boundRepositionPopover = () => this.dayPopover.position(), this.stateManager.subscribe((e) => this.onStateChange(e));
|
|
2910
3680
|
}
|
|
2911
3681
|
static {
|
|
2912
|
-
this.styles = [
|
|
3682
|
+
this.styles = [be];
|
|
2913
3683
|
}
|
|
2914
3684
|
static get observedAttributes() {
|
|
2915
3685
|
return [
|
|
@@ -2920,15 +3690,14 @@ class F extends V {
|
|
|
2920
3690
|
"first-day-of-week",
|
|
2921
3691
|
"slot-duration",
|
|
2922
3692
|
"time-format",
|
|
2923
|
-
"
|
|
2924
|
-
"selectable"
|
|
3693
|
+
"readonly"
|
|
2925
3694
|
];
|
|
2926
3695
|
}
|
|
2927
3696
|
connectedCallback() {
|
|
2928
|
-
super.connectedCallback(), this.inputHandler && this.inputHandler.attach(), this.addEventListener("keydown", this.boundHandleKeyDown), this.startNowIndicatorTimer();
|
|
3697
|
+
super.connectedCallback(), this.inputHandler && this.inputHandler.attach(), this.syncPermissions(), this.addEventListener("keydown", this.boundHandleKeyDown), this.startNowIndicatorTimer();
|
|
2929
3698
|
}
|
|
2930
3699
|
disconnectedCallback() {
|
|
2931
|
-
this.inputHandler?.detach(), this.removeEventListener("keydown", this.boundHandleKeyDown), this.shadowRoot?.removeEventListener("focusin", this.boundHandleFocusIn), this.currentView?.destroy(), this.dragManager.destroy(), this.stopNowIndicatorTimer(), this.headerResizeObserver?.disconnect(), this.headerResizeObserver = null, this.pendingDragUpdate !== null && (cancelAnimationFrame(this.pendingDragUpdate), this.pendingDragUpdate = null), this.latestDragState = null, super.disconnectedCallback();
|
|
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();
|
|
2932
3701
|
}
|
|
2933
3702
|
attributeChangedCallback(e, t, s) {
|
|
2934
3703
|
if (super.attributeChangedCallback(e, t, s), t !== s)
|
|
@@ -2956,11 +3725,8 @@ class F extends V {
|
|
|
2956
3725
|
case "time-format":
|
|
2957
3726
|
s && (s === "12h" || s === "24h") && this.stateManager.setOptions({ timeFormat: s });
|
|
2958
3727
|
break;
|
|
2959
|
-
case "
|
|
2960
|
-
this.
|
|
2961
|
-
break;
|
|
2962
|
-
case "selectable":
|
|
2963
|
-
this.stateManager.setOptions({ selectable: s !== "false" });
|
|
3728
|
+
case "readonly":
|
|
3729
|
+
this.syncPermissions();
|
|
2964
3730
|
break;
|
|
2965
3731
|
}
|
|
2966
3732
|
}
|
|
@@ -2979,6 +3745,21 @@ class F extends V {
|
|
|
2979
3745
|
set date(e) {
|
|
2980
3746
|
this.stateManager.setDate(e);
|
|
2981
3747
|
}
|
|
3748
|
+
/**
|
|
3749
|
+
* Coarse read-only switch, outranking `options.permissions` entirely.
|
|
3750
|
+
*
|
|
3751
|
+
* Property and attribute are the same state, deliberately: a JS consumer
|
|
3752
|
+
* writes `el.readonly = true`, a plain-HTML or SSR consumer writes the
|
|
3753
|
+
* attribute, and a framework wrapper can bridge whichever it has. Absence is
|
|
3754
|
+
* editable; `readonly="false"` opts back out so the attribute can be rendered
|
|
3755
|
+
* unconditionally with a computed value.
|
|
3756
|
+
*/
|
|
3757
|
+
get readonly() {
|
|
3758
|
+
return this.hasAttribute("readonly") && this.getAttribute("readonly") !== "false";
|
|
3759
|
+
}
|
|
3760
|
+
set readonly(e) {
|
|
3761
|
+
e ? this.setAttribute("readonly", "") : this.removeAttribute("readonly");
|
|
3762
|
+
}
|
|
2982
3763
|
get events() {
|
|
2983
3764
|
return this.stateManager.getState().events;
|
|
2984
3765
|
}
|
|
@@ -2995,7 +3776,7 @@ class F extends V {
|
|
|
2995
3776
|
return this.stateManager.getState().options;
|
|
2996
3777
|
}
|
|
2997
3778
|
set options(e) {
|
|
2998
|
-
this.stateManager.setOptions(e);
|
|
3779
|
+
this.stateManager.setOptions(e), this.syncPermissions();
|
|
2999
3780
|
}
|
|
3000
3781
|
get selectedEvent() {
|
|
3001
3782
|
return this.stateManager.getState().selectedEvent;
|
|
@@ -3053,7 +3834,7 @@ class F extends V {
|
|
|
3053
3834
|
this.stateManager.removeEvent(e), t && this.liveAnnouncer.announce(this.msg("eventRemoved", { title: t.title }));
|
|
3054
3835
|
}
|
|
3055
3836
|
getEventById(e) {
|
|
3056
|
-
return this.
|
|
3837
|
+
return this.stateManager.getState().events.find((t) => t.id === e) ?? null;
|
|
3057
3838
|
}
|
|
3058
3839
|
refetchEvents() {
|
|
3059
3840
|
this.currentView?.update(this.stateManager.getState());
|
|
@@ -3063,8 +3844,8 @@ class F extends V {
|
|
|
3063
3844
|
* English defaults, with {placeholder} interpolation.
|
|
3064
3845
|
*/
|
|
3065
3846
|
msg(e, t) {
|
|
3066
|
-
return
|
|
3067
|
-
|
|
3847
|
+
return S(
|
|
3848
|
+
x(this.stateManager.getState().options.messages)[e],
|
|
3068
3849
|
t
|
|
3069
3850
|
);
|
|
3070
3851
|
}
|
|
@@ -3072,24 +3853,193 @@ class F extends V {
|
|
|
3072
3853
|
// Rendering
|
|
3073
3854
|
// ============================================
|
|
3074
3855
|
render() {
|
|
3075
|
-
return
|
|
3856
|
+
return A`
|
|
3076
3857
|
<div class="scheduler-container">
|
|
3077
3858
|
<header class="scheduler-header"></header>
|
|
3078
3859
|
<div class="scheduler-content"></div>
|
|
3079
3860
|
</div>
|
|
3080
|
-
<div id="scheduler-kbd-grid" class="visually-hidden"
|
|
3081
|
-
|
|
3861
|
+
<div id="scheduler-kbd-grid" class="visually-hidden">
|
|
3862
|
+
${this.msg(this.can("createEvent") || this.can("selectRange") ? "gridInstructions" : "gridInstructionsReadOnly")}
|
|
3863
|
+
</div>
|
|
3864
|
+
<div id="scheduler-kbd-event" class="visually-hidden">
|
|
3865
|
+
${this.msg(
|
|
3866
|
+
this.can("moveEvent") || this.can("resizeEventStart") || this.can("resizeEventEnd") || this.can("deleteEvent") ? "eventInstructions" : "eventInstructionsReadOnly"
|
|
3867
|
+
)}
|
|
3868
|
+
</div>
|
|
3869
|
+
${this.renderDayPopover()}
|
|
3082
3870
|
${this.liveAnnouncer.template()}
|
|
3083
3871
|
`;
|
|
3084
3872
|
}
|
|
3873
|
+
/**
|
|
3874
|
+
* Day popover for the month view: the day's events plus the two things a user
|
|
3875
|
+
* wants from a date they just clicked — create here, or open the day.
|
|
3876
|
+
*
|
|
3877
|
+
* A sibling of `.scheduler-container`, NOT a child of `.scheduler-content`:
|
|
3878
|
+
* the panel is `position: fixed`, so any ancestor with `transform`, `filter`
|
|
3879
|
+
* or `contain` would silently become its containing block and the coordinates
|
|
3880
|
+
* the OverlayController computes would be wrong. Keep it out here.
|
|
3881
|
+
*
|
|
3882
|
+
* `role="dialog"` with `modal: false` and no `aria-modal`: the month grid
|
|
3883
|
+
* behind it stays perfectly usable, and claiming modality would hide a page
|
|
3884
|
+
* that is still visible. It emits NO new event types — activating an entry
|
|
3885
|
+
* is `event-selected`, "New event" is `event-create`, "Show day" is the same
|
|
3886
|
+
* drill the "+N more" link used to do.
|
|
3887
|
+
*/
|
|
3888
|
+
renderDayPopover() {
|
|
3889
|
+
const e = this.popoverDate;
|
|
3890
|
+
if (!e) return G;
|
|
3891
|
+
const { options: t } = this.stateManager.getState(), s = this.eventsOnDay(e), n = h.formatDateWithWeekday(e, t.locale);
|
|
3892
|
+
return A`
|
|
3893
|
+
<div
|
|
3894
|
+
class="scheduler-day-popover"
|
|
3895
|
+
role="dialog"
|
|
3896
|
+
aria-label=${this.msg("dayPopoverLabel", { date: n })}
|
|
3897
|
+
>
|
|
3898
|
+
<div class="popover-head">
|
|
3899
|
+
<div>
|
|
3900
|
+
<div class="popover-date">${n}</div>
|
|
3901
|
+
<div class="popover-count">
|
|
3902
|
+
${this.msg("dayPopoverCount", {
|
|
3903
|
+
count: s.length,
|
|
3904
|
+
events: this.msg(s.length === 1 ? "eventSingular" : "eventPlural")
|
|
3905
|
+
})}
|
|
3906
|
+
</div>
|
|
3907
|
+
</div>
|
|
3908
|
+
<button
|
|
3909
|
+
type="button"
|
|
3910
|
+
class="popover-close"
|
|
3911
|
+
aria-label=${this.msg("closePopover")}
|
|
3912
|
+
@click=${() => this.closeDayPopover()}
|
|
3913
|
+
>
|
|
3914
|
+
<span aria-hidden="true">×</span>
|
|
3915
|
+
</button>
|
|
3916
|
+
</div>
|
|
3917
|
+
${s.length === 0 ? A`<p class="popover-empty">${this.msg("dayPopoverEmpty")}</p>` : A`
|
|
3918
|
+
<ul class="popover-events">
|
|
3919
|
+
${s.map(
|
|
3920
|
+
(i) => A`
|
|
3921
|
+
<li>
|
|
3922
|
+
<button
|
|
3923
|
+
type="button"
|
|
3924
|
+
class="popover-event"
|
|
3925
|
+
aria-label=${z(i, null, t)}
|
|
3926
|
+
@click=${(r) => this.selectFromPopover(i, r)}
|
|
3927
|
+
>
|
|
3928
|
+
<span
|
|
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
|
+
`
|
|
3941
|
+
)}
|
|
3942
|
+
</ul>
|
|
3943
|
+
`}
|
|
3944
|
+
<div class="popover-actions">
|
|
3945
|
+
${this.can("createEvent") ? A`<button
|
|
3946
|
+
type="button"
|
|
3947
|
+
class="popover-action primary"
|
|
3948
|
+
@click=${(i) => this.createFromPopover(i)}
|
|
3949
|
+
>
|
|
3950
|
+
${this.msg("newEvent")}
|
|
3951
|
+
</button>` : G}
|
|
3952
|
+
<button
|
|
3953
|
+
type="button"
|
|
3954
|
+
class="popover-action"
|
|
3955
|
+
@click=${() => this.showDayFromPopover()}
|
|
3956
|
+
>
|
|
3957
|
+
${this.msg("showDay")}
|
|
3958
|
+
</button>
|
|
3959
|
+
</div>
|
|
3960
|
+
</div>
|
|
3961
|
+
`;
|
|
3962
|
+
}
|
|
3963
|
+
/**
|
|
3964
|
+
* The day cell the popover hangs off, resolved by date key on every call.
|
|
3965
|
+
* The month view rebuilds its cells imperatively, so a cached element would
|
|
3966
|
+
* be detached the moment anything re-renders while the popover is open.
|
|
3967
|
+
*/
|
|
3968
|
+
popoverAnchorCell() {
|
|
3969
|
+
return this.popoverAnchorKey ? this.shadowRoot?.querySelector(
|
|
3970
|
+
`#scheduler-cell-m-${this.popoverAnchorKey}`
|
|
3971
|
+
) ?? null : null;
|
|
3972
|
+
}
|
|
3973
|
+
/** Every event overlapping the given local day, in start order. */
|
|
3974
|
+
eventsOnDay(e) {
|
|
3975
|
+
const t = new Date(e);
|
|
3976
|
+
t.setHours(0, 0, 0, 0);
|
|
3977
|
+
const s = new Date(t);
|
|
3978
|
+
return s.setDate(s.getDate() + 1), this.stateManager.getState().events.filter((n) => n.start < s && n.end > t).sort((n, i) => n.start.getTime() - i.start.getTime());
|
|
3979
|
+
}
|
|
3980
|
+
/**
|
|
3981
|
+
* Open the day popover for `day`. Anchored on the day cell resolved LAZILY by
|
|
3982
|
+
* date key: the views rebuild their DOM imperatively, so a captured element
|
|
3983
|
+
* reference would be detached by the next render while the popover is open.
|
|
3984
|
+
*/
|
|
3985
|
+
async openDayPopover(e) {
|
|
3986
|
+
this.popoverDate = new Date(e), this.popoverAnchorKey = P.dayKey(this.popoverDate), this.requestUpdate(), await this.dayPopover.open(), this.contentContainer?.addEventListener("scroll", this.boundRepositionPopover, {
|
|
3987
|
+
passive: !0
|
|
3988
|
+
});
|
|
3989
|
+
}
|
|
3990
|
+
closeDayPopover() {
|
|
3991
|
+
this.contentContainer?.removeEventListener("scroll", this.boundRepositionPopover), this.dayPopover.close(), this.popoverDate = null, this.popoverAnchorKey = null, this.requestUpdate();
|
|
3992
|
+
}
|
|
3993
|
+
selectFromPopover(e, t) {
|
|
3994
|
+
this.closeDayPopover(), this.stateManager.setSelectedEvent(e), this.eventEmitter.emitEventSelected(e, t);
|
|
3995
|
+
}
|
|
3996
|
+
createFromPopover(e) {
|
|
3997
|
+
const t = this.popoverDate;
|
|
3998
|
+
if (!t) return;
|
|
3999
|
+
const s = new Date(t);
|
|
4000
|
+
s.setHours(0, 0, 0, 0);
|
|
4001
|
+
const n = new Date(s);
|
|
4002
|
+
if (n.setDate(n.getDate() + 1), this.closeDayPopover(), !this.can("createEvent") || !this.allowsCreateAt({ start: s, end: n })) {
|
|
4003
|
+
this.announceDenied();
|
|
4004
|
+
return;
|
|
4005
|
+
}
|
|
4006
|
+
this.eventEmitter.emitEventCreate(
|
|
4007
|
+
{ start: s, end: n },
|
|
4008
|
+
this.stateManager.getState().view,
|
|
4009
|
+
e
|
|
4010
|
+
);
|
|
4011
|
+
}
|
|
4012
|
+
showDayFromPopover() {
|
|
4013
|
+
const e = this.popoverDate;
|
|
4014
|
+
e && (this.closeDayPopover(), this.stateManager.setDate(new Date(e)), this.stateManager.setView("day"));
|
|
4015
|
+
}
|
|
4016
|
+
/**
|
|
4017
|
+
* Route a "+N more" activation through `options.moreLinkBehavior`. Returns the
|
|
4018
|
+
* date to drill to when the caller should navigate, or null when the behaviour
|
|
4019
|
+
* has already been handled here.
|
|
4020
|
+
*/
|
|
4021
|
+
handleMoreLink(e) {
|
|
4022
|
+
const t = this.parseDayKey(e), s = this.stateManager.getState().options.moreLinkBehavior ?? "popover";
|
|
4023
|
+
if (typeof s == "function") {
|
|
4024
|
+
s({ date: t, events: this.eventsOnDay(t) });
|
|
4025
|
+
return;
|
|
4026
|
+
}
|
|
4027
|
+
if (s === "popover") {
|
|
4028
|
+
this.openDayPopover(t);
|
|
4029
|
+
return;
|
|
4030
|
+
}
|
|
4031
|
+
this.stateManager.setDate(t), this.stateManager.setView("day");
|
|
4032
|
+
}
|
|
3085
4033
|
firstUpdated() {
|
|
3086
4034
|
const e = this.shadowRoot.querySelector(".scheduler-header");
|
|
3087
|
-
this.contentContainer = this.shadowRoot.querySelector(".scheduler-content"), this.populateHeader(e), this.observeHeaderWidth(e), this.inputHandler = new
|
|
4035
|
+
this.contentContainer = this.shadowRoot.querySelector(".scheduler-content"), this.populateHeader(e), this.observeHeaderWidth(e), this.inputHandler = new Ce(
|
|
3088
4036
|
{
|
|
3089
4037
|
shadowRoot: this.shadowRoot,
|
|
3090
4038
|
getEventById: (t) => this.getEventById(t),
|
|
3091
|
-
|
|
3092
|
-
|
|
4039
|
+
// Pointer gestures ask the same resolver the keyboard paths and the
|
|
4040
|
+
// affordance rendering use, so all three can never disagree.
|
|
4041
|
+
isEditable: () => this.can("createEvent") || this.can("moveEvent") || this.can("resizeEventStart") || this.can("resizeEventEnd"),
|
|
4042
|
+
isSelectable: () => this.can("selectRange") || this.can("createEvent"),
|
|
3093
4043
|
isEventSelected: (t) => this.stateManager.getState().selectedEvent?.id === t
|
|
3094
4044
|
},
|
|
3095
4045
|
{
|
|
@@ -3100,7 +4050,7 @@ class F extends V {
|
|
|
3100
4050
|
onDoubleClick: (t, s) => this.handleDoubleClick(t, s),
|
|
3101
4051
|
getScrollContainer: () => this.contentContainer
|
|
3102
4052
|
}
|
|
3103
|
-
), this.inputHandler.attach(), this.shadowRoot.addEventListener("focusin", this.boundHandleFocusIn), this.renderView();
|
|
4053
|
+
), this.inputHandler.attach(), this.shadowRoot.addEventListener("focusin", this.boundHandleFocusIn), this.shadowRoot.addEventListener("change", this.boundHandleValueChange), this.renderView();
|
|
3104
4054
|
}
|
|
3105
4055
|
populateHeader(e) {
|
|
3106
4056
|
const t = document.createElement("nav");
|
|
@@ -3173,7 +4123,7 @@ class F extends V {
|
|
|
3173
4123
|
*/
|
|
3174
4124
|
observeHeaderWidth(e) {
|
|
3175
4125
|
typeof ResizeObserver > "u" || (this.headerResizeObserver = new ResizeObserver((t) => {
|
|
3176
|
-
const n = (t[0]?.contentRect.width ?? e.clientWidth) <
|
|
4126
|
+
const n = (t[0]?.contentRect.width ?? e.clientWidth) < I.NARROW_HEADER_WIDTH;
|
|
3177
4127
|
n !== this.headerIsNarrow && (this.headerIsNarrow = n, requestAnimationFrame(() => {
|
|
3178
4128
|
e.toggleAttribute("data-narrow", n);
|
|
3179
4129
|
}));
|
|
@@ -3185,19 +4135,19 @@ class F extends V {
|
|
|
3185
4135
|
const e = this.stateManager.getState();
|
|
3186
4136
|
switch (e.view) {
|
|
3187
4137
|
case "year":
|
|
3188
|
-
this.currentView = new
|
|
4138
|
+
this.currentView = new N(this.contentContainer, e), this.currentViewType = "year";
|
|
3189
4139
|
break;
|
|
3190
4140
|
case "month":
|
|
3191
|
-
this.currentView = new
|
|
4141
|
+
this.currentView = new P(this.contentContainer, e), this.currentViewType = "month";
|
|
3192
4142
|
break;
|
|
3193
4143
|
case "week":
|
|
3194
|
-
this.currentView = new
|
|
4144
|
+
this.currentView = new ge(this.contentContainer, e), this.currentViewType = "week";
|
|
3195
4145
|
break;
|
|
3196
4146
|
case "day":
|
|
3197
|
-
this.currentView = new
|
|
4147
|
+
this.currentView = new fe(this.contentContainer, e), this.currentViewType = "day";
|
|
3198
4148
|
break;
|
|
3199
4149
|
case "timeline":
|
|
3200
|
-
this.currentView = new
|
|
4150
|
+
this.currentView = new ye(this.contentContainer, e), this.currentViewType = "timeline";
|
|
3201
4151
|
break;
|
|
3202
4152
|
}
|
|
3203
4153
|
this.currentView?.render();
|
|
@@ -3209,7 +4159,7 @@ class F extends V {
|
|
|
3209
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);
|
|
3210
4160
|
}
|
|
3211
4161
|
detectAndEmitChanges(e) {
|
|
3212
|
-
const t = this.previousView !== null && this.previousView !== e.view, s = this.previousDate !== null && this.previousDate.getTime() !== e.date.getTime(), n = e.selectedEvent?.id ?? null, i =
|
|
4162
|
+
const t = this.previousView !== null && this.previousView !== e.view, s = this.previousDate !== null && this.previousDate.getTime() !== e.date.getTime(), n = e.selectedEvent?.id ?? null, i = K(e), r = i ? `${i.start.getTime()}-${i.end.getTime()}-${e.selectionResourceId ?? ""}` : null, o = this.previousSelectedEventId !== n || this.previousRangeKey !== r;
|
|
3213
4163
|
(t || s) && this.eventEmitter.emitViewChange(e.view, e.date), o && this.eventEmitter.emitSelectionChange(
|
|
3214
4164
|
e.selectedEvent,
|
|
3215
4165
|
i,
|
|
@@ -3237,18 +4187,68 @@ class F extends V {
|
|
|
3237
4187
|
this.dragManager.handlePointerDown(e, t, s);
|
|
3238
4188
|
}
|
|
3239
4189
|
handlePointerMove(e) {
|
|
3240
|
-
this.dragManager.handlePointerMove(e);
|
|
4190
|
+
this.dragManager.handlePointerMove(e), this.updateEdgeScroll(e);
|
|
3241
4191
|
}
|
|
3242
4192
|
handlePointerUp(e) {
|
|
4193
|
+
this.stopEdgeScroll();
|
|
3243
4194
|
const t = this.dragManager.handlePointerUp(e);
|
|
3244
4195
|
t && this.handleDragComplete(t, e.originalEvent);
|
|
3245
4196
|
}
|
|
4197
|
+
static {
|
|
4198
|
+
this.EDGE_SCROLL_ZONE_PX = 40;
|
|
4199
|
+
}
|
|
4200
|
+
static {
|
|
4201
|
+
this.EDGE_SCROLL_MAX_PX = 18;
|
|
4202
|
+
}
|
|
4203
|
+
/**
|
|
4204
|
+
* Scroll the grid when a drag reaches the edge of the viewport.
|
|
4205
|
+
*
|
|
4206
|
+
* Without this, a drag can only ever reach what is already on screen — and
|
|
4207
|
+
* since the timeline is now genuinely wider than the viewport (7 days x 48
|
|
4208
|
+
* slots), "drag an event to next Thursday" became impossible rather than
|
|
4209
|
+
* merely awkward. Both axes, because the timeline scrolls horizontally and the
|
|
4210
|
+
* time grids vertically.
|
|
4211
|
+
*
|
|
4212
|
+
* Speed ramps with how deep into the edge zone the pointer is, the way every
|
|
4213
|
+
* drag-and-drop implementation does it: a constant rate is either too slow to
|
|
4214
|
+
* be useful or too fast to aim. Each frame re-feeds the pointer to the drag
|
|
4215
|
+
* machine so the preview keeps tracking the slot under the cursor while the
|
|
4216
|
+
* grid moves beneath it.
|
|
4217
|
+
*/
|
|
4218
|
+
updateEdgeScroll(e) {
|
|
4219
|
+
const t = this.contentContainer;
|
|
4220
|
+
if (!t || !this.dragManager.isDragging()) {
|
|
4221
|
+
this.stopEdgeScroll();
|
|
4222
|
+
return;
|
|
4223
|
+
}
|
|
4224
|
+
const s = t.getBoundingClientRect(), n = I.EDGE_SCROLL_ZONE_PX, i = I.EDGE_SCROLL_MAX_PX, r = (o, a, l) => o < a + n ? -Math.min(1, (a + n - o) / n) * i : o > l - n ? Math.min(1, (o - (l - n)) / n) * i : 0;
|
|
4225
|
+
if (this.edgeScrollVector = {
|
|
4226
|
+
x: r(e.clientX, s.left, s.right),
|
|
4227
|
+
y: r(e.clientY, s.top, s.bottom)
|
|
4228
|
+
}, this.edgeScrollPointer = e, this.edgeScrollVector.x === 0 && this.edgeScrollVector.y === 0) {
|
|
4229
|
+
this.stopEdgeScroll();
|
|
4230
|
+
return;
|
|
4231
|
+
}
|
|
4232
|
+
this.edgeScrollFrame === null && this.scheduleEdgeScroll();
|
|
4233
|
+
}
|
|
4234
|
+
scheduleEdgeScroll() {
|
|
4235
|
+
this.edgeScrollFrame = requestAnimationFrame(() => {
|
|
4236
|
+
this.edgeScrollFrame = null;
|
|
4237
|
+
const e = this.contentContainer, t = this.edgeScrollPointer;
|
|
4238
|
+
if (!e || !t || !this.dragManager.isDragging()) return;
|
|
4239
|
+
const s = e.scrollLeft, n = e.scrollTop;
|
|
4240
|
+
e.scrollLeft = s + this.edgeScrollVector.x, e.scrollTop = n + this.edgeScrollVector.y, !(e.scrollLeft === s && e.scrollTop === n) && (this.dragManager.handlePointerMove(t), this.scheduleEdgeScroll());
|
|
4241
|
+
});
|
|
4242
|
+
}
|
|
4243
|
+
stopEdgeScroll() {
|
|
4244
|
+
this.edgeScrollFrame !== null && (cancelAnimationFrame(this.edgeScrollFrame), this.edgeScrollFrame = null), this.edgeScrollVector = { x: 0, y: 0 }, this.edgeScrollPointer = null;
|
|
4245
|
+
}
|
|
3246
4246
|
static {
|
|
3247
4247
|
this.DBLCLICK_WINDOW_MS = 500;
|
|
3248
4248
|
}
|
|
3249
4249
|
registerEventActivation(e, t) {
|
|
3250
4250
|
const s = Date.now(), n = this.lastEventActivation;
|
|
3251
|
-
this.lastEventActivation = { eventId: e.id, time: s }, n && n.eventId === e.id && s - n.time <
|
|
4251
|
+
this.lastEventActivation = { eventId: e.id, time: s }, n && n.eventId === e.id && s - n.time < I.DBLCLICK_WINDOW_MS && (this.lastEventActivation = null, this.eventEmitter.emitEventDblClick(e, t));
|
|
3252
4252
|
}
|
|
3253
4253
|
handleDragComplete(e, t) {
|
|
3254
4254
|
if (e.wasClick) {
|
|
@@ -3286,7 +4286,9 @@ class F extends V {
|
|
|
3286
4286
|
}
|
|
3287
4287
|
}
|
|
3288
4288
|
handleClick(e, t) {
|
|
3289
|
-
const s = e.target
|
|
4289
|
+
const s = e.target;
|
|
4290
|
+
if (this.handleResourceAction(s, e.originalEvent)) return;
|
|
4291
|
+
const n = s.closest(".expand-toggle");
|
|
3290
4292
|
if (n) {
|
|
3291
4293
|
const a = n.dataset.groupId;
|
|
3292
4294
|
if (a) {
|
|
@@ -3294,25 +4296,89 @@ class F extends V {
|
|
|
3294
4296
|
return;
|
|
3295
4297
|
}
|
|
3296
4298
|
}
|
|
3297
|
-
const i = s.closest("
|
|
4299
|
+
const i = s.closest(".scheduler-more-link");
|
|
3298
4300
|
if (i) {
|
|
3299
4301
|
const a = i.dataset.date;
|
|
3300
|
-
|
|
4302
|
+
if (a) {
|
|
4303
|
+
this.handleMoreLink(a);
|
|
4304
|
+
return;
|
|
4305
|
+
}
|
|
3301
4306
|
}
|
|
3302
|
-
const r = s.closest(
|
|
3303
|
-
".scheduler-year-month-header"
|
|
3304
|
-
);
|
|
4307
|
+
const r = s.closest("[data-date]");
|
|
3305
4308
|
if (r) {
|
|
3306
|
-
const a = r.dataset.
|
|
3307
|
-
|
|
4309
|
+
const a = r.dataset.date;
|
|
4310
|
+
if (a) {
|
|
4311
|
+
const l = this.parseDayKey(a);
|
|
4312
|
+
if (this.eventEmitter.emitDateClick(l, e.originalEvent), s.closest(".day-number")) {
|
|
4313
|
+
this.stateManager.setDate(l), this.stateManager.setView("day");
|
|
4314
|
+
return;
|
|
4315
|
+
}
|
|
4316
|
+
if (this.stateManager.getState().options.dayClickAction === "popover") {
|
|
4317
|
+
this.openDayPopover(l);
|
|
4318
|
+
return;
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
3308
4321
|
}
|
|
3309
|
-
const o = s.closest(
|
|
4322
|
+
const o = s.closest(
|
|
4323
|
+
".scheduler-year-month-header"
|
|
4324
|
+
);
|
|
3310
4325
|
if (o) {
|
|
3311
|
-
const a = o.dataset.
|
|
3312
|
-
a && (this.stateManager.setDate(
|
|
4326
|
+
const a = o.dataset.month;
|
|
4327
|
+
a && (this.stateManager.setDate(this.parseDayKey(a)), this.stateManager.setView("month"));
|
|
3313
4328
|
}
|
|
3314
4329
|
t.type === "event" && t.event && (this.stateManager.setSelectedEvent(t.event), this.registerEventActivation(t.event, e.originalEvent));
|
|
3315
4330
|
}
|
|
4331
|
+
/**
|
|
4332
|
+
* Route a click on a resource-tree action button to its request event.
|
|
4333
|
+
* Returns true when the click was one of ours and must not fall through.
|
|
4334
|
+
*
|
|
4335
|
+
* Every branch re-checks the capability rather than trusting that the button
|
|
4336
|
+
* exists: state can change between render and click, and a request the
|
|
4337
|
+
* consumer has switched off must not reach them.
|
|
4338
|
+
*/
|
|
4339
|
+
handleResourceAction(e, t) {
|
|
4340
|
+
const s = e.closest("[data-action]");
|
|
4341
|
+
if (!s) return !1;
|
|
4342
|
+
const { action: n, parentId: i, resourceId: r } = s.dataset, o = this.stateManager.getState().view;
|
|
4343
|
+
switch (n) {
|
|
4344
|
+
case "add-resource":
|
|
4345
|
+
return this.can("createResource") && this.eventEmitter.emitResourceCreate("resource", o, t, i), !0;
|
|
4346
|
+
case "add-group":
|
|
4347
|
+
return this.can("createGroup") && this.eventEmitter.emitResourceCreate("group", o, t, i), !0;
|
|
4348
|
+
case "delete-resource": {
|
|
4349
|
+
const a = r ? this.findResourceOrGroup(r) : null;
|
|
4350
|
+
return a && this.can("deleteResource") && this.eventEmitter.emitResourceDelete(a, t), !0;
|
|
4351
|
+
}
|
|
4352
|
+
// The colour input reports through `change`, not `click` — a click merely
|
|
4353
|
+
// opens the platform picker, so swallow it here and let handleValueChange
|
|
4354
|
+
// emit once the user has actually chosen.
|
|
4355
|
+
case "set-resource-color":
|
|
4356
|
+
return !0;
|
|
4357
|
+
}
|
|
4358
|
+
return !1;
|
|
4359
|
+
}
|
|
4360
|
+
/**
|
|
4361
|
+
* `change` from a resource control. Delegated on the shadow root because the
|
|
4362
|
+
* views build their DOM imperatively and are rebuilt on every render — a
|
|
4363
|
+
* per-element listener would have to be re-attached each time. `change` does
|
|
4364
|
+
* not compose, so this listener is the only one that can see it.
|
|
4365
|
+
*/
|
|
4366
|
+
handleValueChange(e) {
|
|
4367
|
+
const t = e.composedPath?.()[0] ?? e.target;
|
|
4368
|
+
if (!t || t.dataset.action !== "set-resource-color" || !this.can("updateResource")) return;
|
|
4369
|
+
const { resourceId: s, field: n } = t.dataset, i = s ? this.findResourceOrGroup(s) : null;
|
|
4370
|
+
if (!i) return;
|
|
4371
|
+
const r = t.value;
|
|
4372
|
+
this.eventEmitter.emitResourceUpdate(
|
|
4373
|
+
i,
|
|
4374
|
+
n === "eventColor" ? { eventColor: r } : { color: r },
|
|
4375
|
+
e
|
|
4376
|
+
);
|
|
4377
|
+
}
|
|
4378
|
+
/** Resolve a resource or group by id from the current `resources` input. */
|
|
4379
|
+
findResourceOrGroup(e) {
|
|
4380
|
+
return T.findById(this.stateManager.getState().resources, e) ?? null;
|
|
4381
|
+
}
|
|
3316
4382
|
handleDoubleClick(e, t) {
|
|
3317
4383
|
t.type === "event" && t.event && this.eventEmitter.emitEventDblClick(t.event, e.originalEvent);
|
|
3318
4384
|
}
|
|
@@ -3338,6 +4404,10 @@ class F extends V {
|
|
|
3338
4404
|
}));
|
|
3339
4405
|
}
|
|
3340
4406
|
handleKeyDown(e) {
|
|
4407
|
+
if (this.dayPopover.isOpen) {
|
|
4408
|
+
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.closeDayPopover());
|
|
4409
|
+
return;
|
|
4410
|
+
}
|
|
3341
4411
|
if (this.keyboardMove) {
|
|
3342
4412
|
this.handleKeyboardMove(e);
|
|
3343
4413
|
return;
|
|
@@ -3361,11 +4431,11 @@ class F extends V {
|
|
|
3361
4431
|
if (!e) return !1;
|
|
3362
4432
|
if (e.classList.contains("scheduler-more-link")) {
|
|
3363
4433
|
const t = e.dataset.date;
|
|
3364
|
-
return t ? (this.
|
|
4434
|
+
return t ? (this.handleMoreLink(t), !0) : !1;
|
|
3365
4435
|
}
|
|
3366
4436
|
if (e.classList.contains("scheduler-year-month-header")) {
|
|
3367
4437
|
const t = e.dataset.month;
|
|
3368
|
-
return t ? (this.stateManager.setDate(
|
|
4438
|
+
return t ? (this.stateManager.setDate(this.parseDayKey(t)), this.stateManager.setView("month"), !0) : !1;
|
|
3369
4439
|
}
|
|
3370
4440
|
return !1;
|
|
3371
4441
|
}
|
|
@@ -3388,6 +4458,65 @@ class F extends V {
|
|
|
3388
4458
|
}
|
|
3389
4459
|
return !1;
|
|
3390
4460
|
}
|
|
4461
|
+
/**
|
|
4462
|
+
* Resolve a capability against `readonly`, `options.permissions` and any
|
|
4463
|
+
* per-event override.
|
|
4464
|
+
*
|
|
4465
|
+
* A boolean lookup, deliberately: it runs on every pointer-down and on every
|
|
4466
|
+
* render that decides whether to draw an affordance.
|
|
4467
|
+
*/
|
|
4468
|
+
can(e, t) {
|
|
4469
|
+
const { options: s } = this.stateManager.getState();
|
|
4470
|
+
return O(e, {
|
|
4471
|
+
permissions: this.effectivePermissions(s),
|
|
4472
|
+
event: t ?? null
|
|
4473
|
+
});
|
|
4474
|
+
}
|
|
4475
|
+
/** Recompute the resolved table onto state so views can gate affordances. */
|
|
4476
|
+
syncPermissions() {
|
|
4477
|
+
const { options: e } = this.stateManager.getState();
|
|
4478
|
+
this.stateManager.setState({
|
|
4479
|
+
resolvedPermissions: this.effectivePermissions(e)
|
|
4480
|
+
});
|
|
4481
|
+
}
|
|
4482
|
+
/**
|
|
4483
|
+
* The effective permission table: the `readonly` host attribute outranks
|
|
4484
|
+
* everything, then `options.permissions`. Per-capability defaults are applied
|
|
4485
|
+
* inside `resolveCapability`, so an unspecified capability keeps its documented
|
|
4486
|
+
* default rather than being treated as denied.
|
|
4487
|
+
*/
|
|
4488
|
+
effectivePermissions(e) {
|
|
4489
|
+
if (this.readonly) return !1;
|
|
4490
|
+
const t = e.permissions;
|
|
4491
|
+
return t === !1 ? !1 : typeof t == "object" && t !== null ? t : {};
|
|
4492
|
+
}
|
|
4493
|
+
/**
|
|
4494
|
+
* The one optional consumer predicate, for data-dependent create rules.
|
|
4495
|
+
*
|
|
4496
|
+
* Evaluated ONLY at commit points (this call site, drag completion, Enter) —
|
|
4497
|
+
* never per cell and never per pointer-move, so a consumer callback can't land
|
|
4498
|
+
* on the render path. Slot greying is deliberately not driven by it.
|
|
4499
|
+
*/
|
|
4500
|
+
allowsCreateAt(e, t) {
|
|
4501
|
+
const { permissions: s } = this.stateManager.getState().options;
|
|
4502
|
+
return typeof s != "object" || s === null ? !0 : s.canCreateAt?.(e, t) ?? !0;
|
|
4503
|
+
}
|
|
4504
|
+
/** Enter move mode only if the event may actually be moved or resized. */
|
|
4505
|
+
tryEnterEventMoveMode(e) {
|
|
4506
|
+
const t = this.can("moveEvent", e), s = this.can("resizeEventStart", e) || this.can("resizeEventEnd", e);
|
|
4507
|
+
if (!t && !s) {
|
|
4508
|
+
this.announceDenied();
|
|
4509
|
+
return;
|
|
4510
|
+
}
|
|
4511
|
+
this.enterEventMoveMode(e);
|
|
4512
|
+
}
|
|
4513
|
+
/**
|
|
4514
|
+
* Announce a refused command. Silence on a keypress reads as a broken widget,
|
|
4515
|
+
* so denial gets its own polite message rather than nothing.
|
|
4516
|
+
*/
|
|
4517
|
+
announceDenied() {
|
|
4518
|
+
this.liveAnnouncer.announce(this.msg("actionNotAllowed"));
|
|
4519
|
+
}
|
|
3391
4520
|
handleEventKeyDown(e) {
|
|
3392
4521
|
const s = this.stateManager.getState().selectedEvent;
|
|
3393
4522
|
if (s)
|
|
@@ -3395,16 +4524,21 @@ class F extends V {
|
|
|
3395
4524
|
// M is the canonical move-mode key across the workspace (tile-manager,
|
|
3396
4525
|
// dock); Enter is kept for back-compat (screen-reader programme D4).
|
|
3397
4526
|
case "m":
|
|
3398
|
-
case "M":
|
|
4527
|
+
case "M": {
|
|
3399
4528
|
if (e.altKey || e.ctrlKey || e.metaKey) break;
|
|
3400
|
-
e.preventDefault(), this.
|
|
4529
|
+
e.preventDefault(), this.tryEnterEventMoveMode(s);
|
|
3401
4530
|
return;
|
|
4531
|
+
}
|
|
3402
4532
|
case "Enter":
|
|
3403
|
-
e.preventDefault(), this.
|
|
4533
|
+
e.preventDefault(), this.tryEnterEventMoveMode(s);
|
|
3404
4534
|
return;
|
|
3405
4535
|
case "Delete":
|
|
3406
4536
|
case "Backspace":
|
|
3407
|
-
e.preventDefault(), this.
|
|
4537
|
+
if (e.preventDefault(), !this.can("deleteEvent", s)) {
|
|
4538
|
+
this.announceDenied();
|
|
4539
|
+
return;
|
|
4540
|
+
}
|
|
4541
|
+
this.eventEmitter.emitEventDelete(s);
|
|
3408
4542
|
return;
|
|
3409
4543
|
case "Escape":
|
|
3410
4544
|
e.preventDefault(), this.focusFocusedCell();
|
|
@@ -3517,6 +4651,14 @@ class F extends V {
|
|
|
3517
4651
|
case "Enter":
|
|
3518
4652
|
e.preventDefault(), this.commitFocusedDateAsCreate(e, "day");
|
|
3519
4653
|
return;
|
|
4654
|
+
// Space, not Enter: Enter already means "create for this day" and taking
|
|
4655
|
+
// it would remove the only keyboard create path in this view.
|
|
4656
|
+
case " ": {
|
|
4657
|
+
e.preventDefault();
|
|
4658
|
+
const t = this.stateManager.getState().focusedDate;
|
|
4659
|
+
t && this.openDayPopover(t);
|
|
4660
|
+
return;
|
|
4661
|
+
}
|
|
3520
4662
|
}
|
|
3521
4663
|
}
|
|
3522
4664
|
/**
|
|
@@ -3539,9 +4681,15 @@ class F extends V {
|
|
|
3539
4681
|
case "ArrowDown":
|
|
3540
4682
|
e.preventDefault(), this.moveFocusedDateByMonths(3);
|
|
3541
4683
|
return;
|
|
3542
|
-
|
|
3543
|
-
|
|
4684
|
+
// Drill into the month, matching what clicking the month header does.
|
|
4685
|
+
// Enter used to emit a MONTH-SPANNING event-create here, which no consumer
|
|
4686
|
+
// could reasonably want from a year overview.
|
|
4687
|
+
case "Enter": {
|
|
4688
|
+
e.preventDefault();
|
|
4689
|
+
const t = this.stateManager.getState().focusedDate;
|
|
4690
|
+
t && (this.stateManager.setDate(new Date(t)), this.stateManager.setView("month"));
|
|
3544
4691
|
return;
|
|
4692
|
+
}
|
|
3545
4693
|
}
|
|
3546
4694
|
}
|
|
3547
4695
|
/**
|
|
@@ -3553,7 +4701,7 @@ class F extends V {
|
|
|
3553
4701
|
const e = this.shadowRoot?.activeElement;
|
|
3554
4702
|
if (!e) return;
|
|
3555
4703
|
const t = e.dataset.date ?? e.dataset.month;
|
|
3556
|
-
t && this.stateManager.setFocusedDate(
|
|
4704
|
+
t && this.stateManager.setFocusedDate(this.parseDayKey(t));
|
|
3557
4705
|
}
|
|
3558
4706
|
moveFocusedDateByDays(e) {
|
|
3559
4707
|
const t = this.stateManager.getState(), s = t.focusedDate ?? t.date, n = new Date(s);
|
|
@@ -3598,7 +4746,11 @@ class F extends V {
|
|
|
3598
4746
|
const i = new Date(n);
|
|
3599
4747
|
i.setHours(0, 0, 0, 0);
|
|
3600
4748
|
const r = new Date(i);
|
|
3601
|
-
t === "day" ? r.setDate(r.getDate() + 1) : r.setMonth(r.getMonth() + 1), this.
|
|
4749
|
+
if (t === "day" ? r.setDate(r.getDate() + 1) : r.setMonth(r.getMonth() + 1), !this.can("createEvent") || !this.allowsCreateAt({ start: i, end: r })) {
|
|
4750
|
+
this.announceDenied();
|
|
4751
|
+
return;
|
|
4752
|
+
}
|
|
4753
|
+
this.eventEmitter.emitEventCreate(
|
|
3602
4754
|
{ start: i, end: r },
|
|
3603
4755
|
s.view,
|
|
3604
4756
|
e
|
|
@@ -3655,7 +4807,7 @@ class F extends V {
|
|
|
3655
4807
|
break;
|
|
3656
4808
|
}
|
|
3657
4809
|
case "timeline": {
|
|
3658
|
-
const o =
|
|
4810
|
+
const o = T.flatten(s.resources, s.collapsedGroups).filter((c) => c.visible && W(c.item));
|
|
3659
4811
|
if (o.length === 0) return;
|
|
3660
4812
|
i = e === "start" ? o[0].item.id : o[o.length - 1].item.id;
|
|
3661
4813
|
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);
|
|
@@ -3678,8 +4830,8 @@ class F extends V {
|
|
|
3678
4830
|
if (i.view === "day")
|
|
3679
4831
|
r = new Date(i.date), r.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
|
|
3680
4832
|
else {
|
|
3681
|
-
const l = h.getWeekDays(n, t.options.firstDayOfWeek), d = h.getWeekDays(i.date, i.options.firstDayOfWeek), c = l.findIndex((
|
|
3682
|
-
r = new Date(
|
|
4833
|
+
const l = h.getWeekDays(n, t.options.firstDayOfWeek), d = h.getWeekDays(i.date, i.options.firstDayOfWeek), c = l.findIndex((m) => h.isSameDay(m, s.start)), p = d[Math.max(0, c)] ?? d[0];
|
|
4834
|
+
r = new Date(p), r.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
|
|
3683
4835
|
}
|
|
3684
4836
|
const o = (i.options.slotDuration ?? 1800) * 1e3, a = { start: r, end: new Date(r.getTime() + o) };
|
|
3685
4837
|
this.commitFocusMove(a, t.focusedResourceId, !1);
|
|
@@ -3694,11 +4846,11 @@ class F extends V {
|
|
|
3694
4846
|
if (s) {
|
|
3695
4847
|
this.stateManager.extendSelection(e, t), this.stateManager.setFocusedCell(e, t, !1);
|
|
3696
4848
|
const r = this.stateManager.getState();
|
|
3697
|
-
this.liveAnnouncer.announce(
|
|
4849
|
+
this.liveAnnouncer.announce(he(r, i));
|
|
3698
4850
|
} else {
|
|
3699
4851
|
this.stateManager.setFocusedCell(e, t, !0);
|
|
3700
4852
|
const r = this.getResourceTitle(t);
|
|
3701
|
-
this.liveAnnouncer.announce(
|
|
4853
|
+
this.liveAnnouncer.announce(ce(e, n.options, r));
|
|
3702
4854
|
}
|
|
3703
4855
|
this.scrollAndFocusCell(e, t);
|
|
3704
4856
|
}
|
|
@@ -3722,7 +4874,7 @@ class F extends V {
|
|
|
3722
4874
|
return r.setHours(0, 0, 0, 0), r.setSeconds((s ?? 0) * 3600 + (n ?? 0) * 60 + (i ?? 0)), r;
|
|
3723
4875
|
}
|
|
3724
4876
|
adjacentResource(e, t, s) {
|
|
3725
|
-
const i =
|
|
4877
|
+
const i = T.flatten(s.resources, s.collapsedGroups).filter((a) => a.visible && W(a.item));
|
|
3726
4878
|
if (i.length === 0) return null;
|
|
3727
4879
|
if (!e) return i[0].item.id;
|
|
3728
4880
|
const r = i.findIndex((a) => a.item.id === e);
|
|
@@ -3732,7 +4884,7 @@ class F extends V {
|
|
|
3732
4884
|
}
|
|
3733
4885
|
getResourceTitle(e) {
|
|
3734
4886
|
if (!e) return null;
|
|
3735
|
-
for (const t of
|
|
4887
|
+
for (const t of T.getAllResources(this.stateManager.getState().resources))
|
|
3736
4888
|
if (t.id === e) return t.title;
|
|
3737
4889
|
return null;
|
|
3738
4890
|
}
|
|
@@ -3752,6 +4904,20 @@ class F extends V {
|
|
|
3752
4904
|
const e = this.stateManager.getState();
|
|
3753
4905
|
e.focusedCell && this.scrollAndFocusCell(e.focusedCell, e.focusedResourceId);
|
|
3754
4906
|
}
|
|
4907
|
+
/**
|
|
4908
|
+
* Parse a `YYYY-MM-DD` day key as a LOCAL date.
|
|
4909
|
+
*
|
|
4910
|
+
* `new Date('2026-07-31')` is parsed per spec as UTC midnight, so in every
|
|
4911
|
+
* timezone west of UTC it lands on the previous local day — month view writes
|
|
4912
|
+
* these keys from local components, so Enter on Jul 31 in New York emitted
|
|
4913
|
+
* `event-create` for Jul 30 and focus restoration missed the cell entirely.
|
|
4914
|
+
* Full ISO strings (year view's `data-month`) round-trip fine and still work
|
|
4915
|
+
* through this function.
|
|
4916
|
+
*/
|
|
4917
|
+
parseDayKey(e) {
|
|
4918
|
+
const t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
4919
|
+
return t ? new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3])) : new Date(e);
|
|
4920
|
+
}
|
|
3755
4921
|
cssEscape(e) {
|
|
3756
4922
|
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (t) => `\\${t}`);
|
|
3757
4923
|
}
|
|
@@ -3763,7 +4929,7 @@ class F extends V {
|
|
|
3763
4929
|
* whether/when to clear the selection.
|
|
3764
4930
|
*/
|
|
3765
4931
|
createEventFromCellOrSelection(e) {
|
|
3766
|
-
const t = this.stateManager.getState(), s =
|
|
4932
|
+
const t = this.stateManager.getState(), s = K(t);
|
|
3767
4933
|
let n, i, r;
|
|
3768
4934
|
if (s)
|
|
3769
4935
|
n = s.start, i = s.end, r = t.selectionResourceId ?? void 0;
|
|
@@ -3771,6 +4937,10 @@ class F extends V {
|
|
|
3771
4937
|
n = t.focusedCell.start, i = t.focusedCell.end, r = t.focusedResourceId ?? void 0;
|
|
3772
4938
|
else
|
|
3773
4939
|
return;
|
|
4940
|
+
if (!this.can("createEvent") || !this.allowsCreateAt({ start: n, end: i }, r)) {
|
|
4941
|
+
this.announceDenied();
|
|
4942
|
+
return;
|
|
4943
|
+
}
|
|
3774
4944
|
this.eventEmitter.emitEventCreate(
|
|
3775
4945
|
{ start: n, end: i },
|
|
3776
4946
|
t.view,
|
|
@@ -3856,7 +5026,7 @@ class F extends V {
|
|
|
3856
5026
|
nudgeKeyboardMove(e) {
|
|
3857
5027
|
if (!this.keyboardMove) return;
|
|
3858
5028
|
const t = new Date(this.keyboardMove.workingStart.getTime() + e), s = new Date(this.keyboardMove.workingEnd.getTime() + e);
|
|
3859
|
-
this.keyboardMove.workingStart = t, this.keyboardMove.workingEnd = s, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(
|
|
5029
|
+
this.keyboardMove.workingStart = t, this.keyboardMove.workingEnd = s, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(ue(t, s, this.stateManager.getState().options));
|
|
3860
5030
|
}
|
|
3861
5031
|
/** Walk to the next/previous resource (timeline only). Updates the preview's resourceId. */
|
|
3862
5032
|
nudgeKeyboardMoveResource(e) {
|
|
@@ -3873,12 +5043,17 @@ class F extends V {
|
|
|
3873
5043
|
*/
|
|
3874
5044
|
resizeKeyboardMoveEdge(e, t) {
|
|
3875
5045
|
if (!this.keyboardMove) return;
|
|
3876
|
-
const s = this.
|
|
3877
|
-
|
|
5046
|
+
const s = this.getEventById(this.keyboardMove.eventId);
|
|
5047
|
+
if (!this.can(e === "start" ? "resizeEventStart" : "resizeEventEnd", s)) {
|
|
5048
|
+
this.announceDenied();
|
|
5049
|
+
return;
|
|
5050
|
+
}
|
|
5051
|
+
const n = this.minutesPerSlot() * 60 * 1e3;
|
|
5052
|
+
let i = this.keyboardMove.workingStart, r = this.keyboardMove.workingEnd;
|
|
3878
5053
|
if (e === "end") {
|
|
3879
|
-
if (
|
|
3880
|
-
} else if (
|
|
3881
|
-
this.keyboardMove.workingStart =
|
|
5054
|
+
if (r = new Date(r.getTime() + t), r.getTime() - i.getTime() < n) return;
|
|
5055
|
+
} else if (i = new Date(i.getTime() + t), r.getTime() - i.getTime() < n) return;
|
|
5056
|
+
this.keyboardMove.workingStart = i, this.keyboardMove.workingEnd = r, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(pe(i, r, e, this.stateManager.getState().options));
|
|
3882
5057
|
}
|
|
3883
5058
|
/** Mirror keyboardMove.working* into state.previewEvent so views render the destination,
|
|
3884
5059
|
* then scroll the destination into view so the sighted-keyboard user can see it (PRD D6). */
|
|
@@ -3945,22 +5120,25 @@ class F extends V {
|
|
|
3945
5120
|
}
|
|
3946
5121
|
getSlotFromElement(e) {
|
|
3947
5122
|
const t = e.dataset.start, s = e.dataset.end;
|
|
3948
|
-
|
|
5123
|
+
if (!t || !s) return null;
|
|
5124
|
+
const n = e.dataset.resourceId;
|
|
5125
|
+
return {
|
|
3949
5126
|
start: new Date(t),
|
|
3950
|
-
end: new Date(s)
|
|
5127
|
+
end: new Date(s),
|
|
5128
|
+
...n ? { resourceId: n } : {}
|
|
3951
5129
|
};
|
|
3952
5130
|
}
|
|
3953
5131
|
}
|
|
3954
|
-
typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler",
|
|
5132
|
+
typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler", I);
|
|
3955
5133
|
export {
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
5134
|
+
$ as BaseView,
|
|
5135
|
+
fe as DayView,
|
|
5136
|
+
P as MonthView,
|
|
5137
|
+
I as MpScheduler,
|
|
5138
|
+
de as SchedulerStateManager,
|
|
5139
|
+
ye as TimelineView,
|
|
5140
|
+
ge as WeekView,
|
|
5141
|
+
N as YearView,
|
|
5142
|
+
le as createInitialState,
|
|
5143
|
+
be as schedulerStyles
|
|
3966
5144
|
};
|