@mintplayer/web-components 2.5.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/index.mjs +9 -8
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +19 -1
- package/checkbox/index.mjs +1 -1
- package/chunks/error-text-B45eDAt1.mjs +17 -0
- package/chunks/{form-associated-axmc5sY0.mjs → form-associated-BR-fUvZ1.mjs} +11 -26
- package/chunks/{id-D5QCG603.mjs → id-DNZVAnGC.mjs} +290 -160
- package/chunks/{mp-calendar.element-u6uS31_j.mjs → mp-calendar.element-CJ8-t-Zn.mjs} +71 -39
- package/chunks/{mp-checkbox-Ph2mMRGz.mjs → mp-checkbox-6EJwdUIn.mjs} +6 -5
- package/chunks/{mp-datatable-BwTlh9A_.mjs → mp-datatable-25O1GtvU.mjs} +1 -1
- package/chunks/mp-datetime-picker.element-D1CiLbHm.mjs +530 -0
- package/chunks/{mp-radio-BjW1HNSc.mjs → mp-radio-DvKgrTFL.mjs} +2 -2
- package/chunks/{mp-select-Ctu-v1-p.mjs → mp-select-CKX0eM5C.mjs} +5 -4
- package/chunks/{mp-timepicker.element-Bz393NDQ.mjs → mp-timepicker.element-COZEUIoE.mjs} +56 -52
- package/chunks/{mp-toggle-button-Kz6sIgBJ.mjs → mp-toggle-button-C4Loq_p4.mjs} +5 -4
- package/chunks/{overlay-controller-DPt13i8p.mjs → overlay-controller-D6agzzOI.mjs} +19 -4
- package/datatable/index.mjs +1 -1
- package/datepicker/index.mjs +2 -2
- package/datetime-picker/index.mjs +2 -431
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +66 -0
- package/file-manager/index.mjs +1 -1
- package/navbar/index.mjs +1 -1
- package/otp-input/index.mjs +4 -3
- package/overlay/index.mjs +1 -1
- package/overlay/src/overlay-controller.d.ts +13 -0
- package/package.json +1 -1
- package/query-builder/index.mjs +2 -2
- package/radio/index.mjs +1 -1
- package/radio-group/index.mjs +2 -2
- package/ribbon/index.mjs +1 -1
- package/scheduler/index.mjs +2775 -1025
- package/scheduler/src/components/mp-scheduler.d.ts +454 -11
- package/scheduler/src/input/input-handler.d.ts +22 -0
- package/scheduler/src/state/scheduler-state.d.ts +10 -0
- package/scheduler/src/views/base-view.d.ts +30 -1
- package/scheduler/src/views/index.d.ts +1 -1
- package/scheduler/src/views/timeline-view.d.ts +87 -15
- package/scheduler/src/views/year-view.d.ts +11 -2
- package/scheduler-core/index.mjs +44 -41
- package/scheduler-core/src/models/event.d.ts +6 -2
- package/scheduler-core/src/models/messages.d.ts +89 -0
- package/scheduler-core/src/models/options.d.ts +46 -13
- package/scheduler-core/src/models/permissions.d.ts +35 -4
- package/scheduler-core/src/models/time-slot.d.ts +11 -6
- package/scheduler-core/src/services/date.service.d.ts +64 -10
- package/scheduler-core/src/utils/color.d.ts +19 -0
- package/select/index.mjs +1 -1
- package/timepicker/index.mjs +4 -3
- package/timepicker/src/mp-time-list.element.d.ts +44 -7
- package/timepicker/src/mp-timepicker.element.d.ts +5 -0
- package/toggle-button/index.mjs +1 -1
- package/tree-select/index.mjs +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
function p(
|
|
2
|
-
return !("children" in
|
|
1
|
+
function p(a) {
|
|
2
|
+
return !("children" in a);
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
return "children" in
|
|
4
|
+
function g(a) {
|
|
5
|
+
return "children" in a;
|
|
6
6
|
}
|
|
7
7
|
const w = {
|
|
8
8
|
navLabel: "Scheduler navigation",
|
|
@@ -20,15 +20,25 @@ const w = {
|
|
|
20
20
|
unassignedResource: "(No resource)",
|
|
21
21
|
noResources: "No resources to show.",
|
|
22
22
|
timelineGridLabel: "Resource timeline for week starting {date}",
|
|
23
|
+
weekGridLabel: "Week of {date}",
|
|
24
|
+
dayGridLabel: "Schedule for {date}",
|
|
25
|
+
monthGridLabel: "Month of {date}",
|
|
26
|
+
yearGridLabel: "Year {date}",
|
|
23
27
|
expandGroup: "Expand {title}",
|
|
24
28
|
collapseGroup: "Collapse {title}",
|
|
25
29
|
addResourceBarLabel: "Add to the resource list",
|
|
26
30
|
addResource: "Add resource",
|
|
27
31
|
addGroup: "Add group",
|
|
32
|
+
rowMenuLabel: "Actions for {title}",
|
|
33
|
+
rowMenuDialogLabel: "Actions for {title}",
|
|
28
34
|
addResourceToGroup: "Add resource to {title}",
|
|
29
35
|
addGroupToGroup: "Add subgroup to {title}",
|
|
30
36
|
removeResource: "Remove {title}",
|
|
31
37
|
resourceColor: "Colour for {title}",
|
|
38
|
+
resizeResourceColumn: "Resize the resource column",
|
|
39
|
+
renameResource: "Rename {title}",
|
|
40
|
+
renameResourceLabel: "New name for {title}",
|
|
41
|
+
resourceRenamed: "{from} renamed to {to}.",
|
|
32
42
|
moreEvents: "+{count} more",
|
|
33
43
|
dayPopoverLabel: "Events on {date}",
|
|
34
44
|
dayPopoverCount: "{count} {events}",
|
|
@@ -37,7 +47,24 @@ const w = {
|
|
|
37
47
|
dayPopoverEmpty: "No events.",
|
|
38
48
|
newEvent: "New event",
|
|
39
49
|
showDay: "Show day",
|
|
50
|
+
showMonth: "Show month",
|
|
40
51
|
closePopover: "Close",
|
|
52
|
+
newEventResource: "Resource",
|
|
53
|
+
deleteEventLabel: "Delete {title}",
|
|
54
|
+
eventEditorLabel: "Edit {title}",
|
|
55
|
+
editorTitleLabel: "Title",
|
|
56
|
+
editorStartLabel: "Start",
|
|
57
|
+
editorEndLabel: "End",
|
|
58
|
+
editorColorLabel: "Colour",
|
|
59
|
+
editorInheritColor: "Inherit from resource",
|
|
60
|
+
editorSave: "Save",
|
|
61
|
+
editorCancel: "Cancel",
|
|
62
|
+
editorDelete: "Delete",
|
|
63
|
+
editorInvalidRange: "End must be after start.",
|
|
64
|
+
editorTitleRequired: "Title is required.",
|
|
65
|
+
editorEndClamped: "End adjusted to {end}, the earliest allowed.",
|
|
66
|
+
editorStartClamped: "Start adjusted to {start}, the latest allowed.",
|
|
67
|
+
yearMonthCardLabel: "{month}, {count} {events}",
|
|
41
68
|
viewChanged: "View changed to {view}.",
|
|
42
69
|
eventAdded: "Event {title} added.",
|
|
43
70
|
eventUpdated: "Event {title} updated.",
|
|
@@ -45,6 +72,7 @@ const w = {
|
|
|
45
72
|
loadingEvents: "Loading events.",
|
|
46
73
|
eventsLoaded: "Events loaded.",
|
|
47
74
|
moveModeEntered: "Move mode for {title}. Arrow keys nudge by {minutes} minutes; Shift with arrow keys resizes the end edge; Alt with Shift resizes the start edge; Enter commits, Escape cancels.",
|
|
75
|
+
moveModeEnteredTimeline: "Move mode for {title}. Left and Right arrows nudge by {minutes} minutes; Up and Down arrows change the resource; Shift with arrow keys resizes the end edge; Alt with Shift resizes the start edge; Enter commits, Escape cancels.",
|
|
48
76
|
movedTo: "Moved to {start}–{end}, {day}",
|
|
49
77
|
movedToResource: "Moved to resource {resource}.",
|
|
50
78
|
resizedEdge: "Resized {edge} edge to {start}–{end}",
|
|
@@ -59,20 +87,28 @@ const w = {
|
|
|
59
87
|
gridInstructionsReadOnly: "Use the arrow keys to move between cells. Page Up and Page Down change the period. Alt with T, Y, M, W or D switches to today, year, month, week or day view.",
|
|
60
88
|
eventInstructionsReadOnly: "Left and Right arrows move between events.",
|
|
61
89
|
actionNotAllowed: "That action is not allowed here.",
|
|
90
|
+
openDayView: "Open {date}",
|
|
62
91
|
gridInstructions: "Use the arrow keys to move between cells. Hold Shift with the arrow keys to extend the selection, and press Enter to request a new event for the selection. Page Up and Page Down change the period. Alt with T, Y, M, W or D switches to today, year, month, week or day view.",
|
|
92
|
+
gridInstructionsMonth: "Use the arrow keys to move between days. Press Enter to request a new event on the focused day, and Space to list that day’s events. Page Up and Page Down change the month. Alt with T, Y, M, W or D switches to today, year, month, week or day view.",
|
|
93
|
+
gridInstructionsMonthReadOnly: "Use the arrow keys to move between days. Press Space to list the focused day’s events. Page Up and Page Down change the month. Alt with T, Y, M, W or D switches to today, year, month, week or day view.",
|
|
94
|
+
// No read-only variant: neither of this view’s commands creates anything.
|
|
95
|
+
// Enter drills into the focused month and Space lists its events, so the
|
|
96
|
+
// text is already true under every capability set.
|
|
97
|
+
gridInstructionsYear: "Use the arrow keys to move between months. Press Enter to open the focused month, and Space to list its events. Page Up and Page Down change the year. Alt with T, Y, M, W or D switches to today, year, month, week or day view.",
|
|
63
98
|
eventInstructions: "Press Enter or M to move or resize the event with the arrow keys. Delete removes the event. Left and Right arrows move between events.",
|
|
99
|
+
eventInstructionsWithEditor: "Press Enter or M to move or resize the event with the arrow keys. F2 opens the event editor. Delete removes the event. Left and Right arrows move between events.",
|
|
64
100
|
eventOnResource: "on {resource}"
|
|
65
101
|
};
|
|
66
|
-
function
|
|
67
|
-
return e ?
|
|
102
|
+
function G(a, e) {
|
|
103
|
+
return e ? a.replace(
|
|
68
104
|
/\{(\w+)\}/g,
|
|
69
105
|
(t, n) => n in e ? String(e[n]) : t
|
|
70
|
-
) :
|
|
106
|
+
) : a;
|
|
71
107
|
}
|
|
72
|
-
function
|
|
73
|
-
return
|
|
108
|
+
function P(a) {
|
|
109
|
+
return a ? { ...w, ...a } : w;
|
|
74
110
|
}
|
|
75
|
-
const
|
|
111
|
+
const b = [
|
|
76
112
|
"#3788d8",
|
|
77
113
|
// Blue
|
|
78
114
|
"#28a745",
|
|
@@ -94,50 +130,76 @@ const y = [
|
|
|
94
130
|
"#6c757d"
|
|
95
131
|
// Gray
|
|
96
132
|
];
|
|
97
|
-
function
|
|
98
|
-
return
|
|
133
|
+
function A(a) {
|
|
134
|
+
return b[a % b.length];
|
|
99
135
|
}
|
|
100
|
-
function
|
|
101
|
-
let e =
|
|
136
|
+
function H(a) {
|
|
137
|
+
let e = a.replace("#", "");
|
|
102
138
|
e.length === 3 && (e = e.split("").map((s) => s + s).join(""));
|
|
103
139
|
const t = parseInt(e.substring(0, 2), 16), n = parseInt(e.substring(2, 4), 16), r = parseInt(e.substring(4, 6), 16);
|
|
104
140
|
return (0.299 * t + 0.587 * n + 0.114 * r) / 255 > 0.5 ? "#000000" : "#ffffff";
|
|
105
141
|
}
|
|
106
|
-
function
|
|
107
|
-
|
|
142
|
+
function v(a) {
|
|
143
|
+
const e = a.trim().replace("#", ""), t = e.length === 3 ? e.split("").map((n) => n + n).join("") : e;
|
|
144
|
+
return /^[0-9a-f]{6}$/i.test(t) ? {
|
|
145
|
+
r: parseInt(t.substring(0, 2), 16),
|
|
146
|
+
g: parseInt(t.substring(2, 4), 16),
|
|
147
|
+
b: parseInt(t.substring(4, 6), 16)
|
|
148
|
+
} : null;
|
|
149
|
+
}
|
|
150
|
+
function y({ r: a, g: e, b: t }) {
|
|
151
|
+
const n = (r) => {
|
|
152
|
+
const o = r / 255;
|
|
153
|
+
return o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4);
|
|
154
|
+
};
|
|
155
|
+
return 0.2126 * n(a) + 0.7152 * n(e) + 0.0722 * n(t);
|
|
156
|
+
}
|
|
157
|
+
function D(a, e) {
|
|
158
|
+
const [t, n] = a >= e ? [a, e] : [e, a];
|
|
159
|
+
return (t + 0.05) / (n + 0.05);
|
|
160
|
+
}
|
|
161
|
+
function $(a) {
|
|
162
|
+
const e = v(a);
|
|
163
|
+
if (!e) return null;
|
|
164
|
+
const t = y(e), n = D(t, 1);
|
|
165
|
+
return D(t, 0) >= n ? "#000000" : "#ffffff";
|
|
166
|
+
}
|
|
167
|
+
function O(a, e) {
|
|
168
|
+
const t = v(a), n = v(e);
|
|
169
|
+
return !t || !n ? null : D(y(t), y(n));
|
|
170
|
+
}
|
|
171
|
+
function W(a, e) {
|
|
172
|
+
let t = a.replace("#", "");
|
|
108
173
|
t.length === 3 && (t = t.split("").map((l) => l + l).join(""));
|
|
109
|
-
const n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16), s = Math.min(255, Math.round(n + (255 - n) * (e / 100))),
|
|
110
|
-
return `#${s.toString(16).padStart(2, "0")}${
|
|
174
|
+
const n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16), s = Math.min(255, Math.round(n + (255 - n) * (e / 100))), i = Math.min(255, Math.round(r + (255 - r) * (e / 100))), u = Math.min(255, Math.round(o + (255 - o) * (e / 100)));
|
|
175
|
+
return `#${s.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}${u.toString(16).padStart(2, "0")}`;
|
|
111
176
|
}
|
|
112
|
-
function
|
|
113
|
-
let t =
|
|
177
|
+
function Y(a, e) {
|
|
178
|
+
let t = a.replace("#", "");
|
|
114
179
|
t.length === 3 && (t = t.split("").map((l) => l + l).join(""));
|
|
115
|
-
const n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16), s = Math.max(0, Math.round(n * (1 - e / 100))),
|
|
116
|
-
return `#${s.toString(16).padStart(2, "0")}${
|
|
180
|
+
const n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16), s = Math.max(0, Math.round(n * (1 - e / 100))), i = Math.max(0, Math.round(r * (1 - e / 100))), u = Math.max(0, Math.round(o * (1 - e / 100)));
|
|
181
|
+
return `#${s.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}${u.toString(16).padStart(2, "0")}`;
|
|
117
182
|
}
|
|
118
|
-
function
|
|
119
|
-
let t =
|
|
183
|
+
function U(a, e) {
|
|
184
|
+
let t = a.replace("#", "");
|
|
120
185
|
t.length === 3 && (t = t.split("").map((s) => s + s).join(""));
|
|
121
186
|
const n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16);
|
|
122
187
|
return `rgba(${n}, ${r}, ${o}, ${e})`;
|
|
123
188
|
}
|
|
124
|
-
const
|
|
125
|
-
function
|
|
126
|
-
if (
|
|
127
|
-
const n =
|
|
189
|
+
const k = "#3788d8";
|
|
190
|
+
function B(a, e, t = k) {
|
|
191
|
+
if (a.color) return a.color;
|
|
192
|
+
const n = a.resourceId ? e.get(a.resourceId) : void 0;
|
|
128
193
|
return n?.eventColor ?? n?.color ?? t;
|
|
129
194
|
}
|
|
130
|
-
const
|
|
195
|
+
const z = {
|
|
131
196
|
initialView: "week",
|
|
132
197
|
initialDate: /* @__PURE__ */ new Date(),
|
|
133
|
-
locale: "en-US",
|
|
134
|
-
firstDayOfWeek: 1,
|
|
135
198
|
timeZone: "local",
|
|
136
199
|
slotDuration: 1800,
|
|
137
200
|
slotLabelInterval: 3600,
|
|
138
201
|
slotMinTime: "00:00:00",
|
|
139
202
|
slotMaxTime: "24:00:00",
|
|
140
|
-
timeFormat: "24h",
|
|
141
203
|
businessHours: {
|
|
142
204
|
daysOfWeek: [1, 2, 3, 4, 5],
|
|
143
205
|
startTime: "09:00",
|
|
@@ -156,46 +218,49 @@ const L = {
|
|
|
156
218
|
// Empty table, NOT DEFAULT_PERMISSIONS: per-capability fallback happens inside
|
|
157
219
|
// resolveCapability, so an unspecified capability keeps its documented default.
|
|
158
220
|
permissions: {},
|
|
159
|
-
defaultEventColor:
|
|
221
|
+
defaultEventColor: k,
|
|
160
222
|
nowIndicator: !0,
|
|
161
|
-
weekNumbers: !1,
|
|
162
|
-
weekText: "W",
|
|
163
223
|
dayMaxEvents: !0,
|
|
164
224
|
moreLinkBehavior: "popover",
|
|
165
|
-
dayClickAction: "
|
|
225
|
+
dayClickAction: "popover",
|
|
226
|
+
eventEditor: !0,
|
|
166
227
|
requireEventResource: !1
|
|
167
|
-
},
|
|
228
|
+
}, I = {
|
|
168
229
|
createEvent: !0,
|
|
169
230
|
moveEvent: !0,
|
|
170
|
-
|
|
171
|
-
resizeEventEnd: !0,
|
|
231
|
+
resizeEvent: !0,
|
|
172
232
|
deleteEvent: !0,
|
|
233
|
+
editEvent: !0,
|
|
173
234
|
selectRange: !0,
|
|
174
235
|
createResource: !1,
|
|
175
236
|
updateResource: !1,
|
|
176
237
|
deleteResource: !1,
|
|
177
238
|
createGroup: !1
|
|
178
239
|
};
|
|
179
|
-
function
|
|
180
|
-
if (e.readonly || e.permissions === !1 || !((typeof e.permissions == "object" && e.permissions !== null ? e.permissions : void 0)?.[
|
|
240
|
+
function C(a, e) {
|
|
241
|
+
if (e.readonly || e.permissions === !1 || !((typeof e.permissions == "object" && e.permissions !== null ? e.permissions : void 0)?.[a] ?? I[a])) return !1;
|
|
181
242
|
const r = e.event;
|
|
182
243
|
if (!r) return !0;
|
|
183
244
|
if (r.editable === !1) return !1;
|
|
184
|
-
switch (
|
|
245
|
+
switch (a) {
|
|
185
246
|
case "moveEvent":
|
|
186
247
|
return r.draggable !== !1;
|
|
187
|
-
case "
|
|
188
|
-
return
|
|
189
|
-
case "resizeEventEnd":
|
|
190
|
-
return M(r.resizable, "end");
|
|
248
|
+
case "resizeEvent":
|
|
249
|
+
return S(r.resizable, "start") || S(r.resizable, "end");
|
|
191
250
|
default:
|
|
192
251
|
return !0;
|
|
193
252
|
}
|
|
194
253
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
254
|
+
function N(a, e) {
|
|
255
|
+
return C("resizeEvent", e) ? S(e.event?.resizable, a) : !1;
|
|
256
|
+
}
|
|
257
|
+
function S(a, e) {
|
|
258
|
+
return a === !1 ? !1 : a && typeof a == "object" ? a[e] !== !1 : !0;
|
|
197
259
|
}
|
|
198
|
-
class
|
|
260
|
+
class L {
|
|
261
|
+
constructor() {
|
|
262
|
+
this.weekStarts = /* @__PURE__ */ new Map(), this.timeFormatters = /* @__PURE__ */ new Map();
|
|
263
|
+
}
|
|
199
264
|
/**
|
|
200
265
|
* Get the start of the week for a given date
|
|
201
266
|
*/
|
|
@@ -240,12 +305,12 @@ class b {
|
|
|
240
305
|
*/
|
|
241
306
|
getMonthWeeks(e, t = 1) {
|
|
242
307
|
const n = this.getMonthStart(e), r = this.getMonthEnd(e), o = this.getWeekStart(n, t), s = [];
|
|
243
|
-
let
|
|
308
|
+
let i = new Date(o);
|
|
244
309
|
for (let u = 0; u < 6; u++) {
|
|
245
310
|
const l = [];
|
|
246
311
|
for (let d = 0; d < 7; d++)
|
|
247
|
-
l.push(new Date(
|
|
248
|
-
if (s.push(l),
|
|
312
|
+
l.push(new Date(i)), i.setDate(i.getDate() + 1);
|
|
313
|
+
if (s.push(l), i > r && s.length >= 4)
|
|
249
314
|
break;
|
|
250
315
|
}
|
|
251
316
|
return s;
|
|
@@ -269,12 +334,12 @@ class b {
|
|
|
269
334
|
* Get time slots for a day
|
|
270
335
|
*/
|
|
271
336
|
getTimeSlots(e, t = 1800, n = "00:00:00", r = "24:00:00") {
|
|
272
|
-
const o = [], [s,
|
|
273
|
-
for (let
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
const m = new Date(
|
|
277
|
-
m.setSeconds(
|
|
337
|
+
const o = [], [s, i] = n.split(":").map(Number), [u, l] = r.split(":").map(Number), d = s * 3600 + i * 60, c = u * 3600 + l * 60;
|
|
338
|
+
for (let f = d; f < c; f += t) {
|
|
339
|
+
const h = new Date(e);
|
|
340
|
+
h.setHours(0, 0, 0, 0), h.setSeconds(f);
|
|
341
|
+
const m = new Date(h);
|
|
342
|
+
m.setSeconds(h.getSeconds() + t), o.push({ start: h, end: m });
|
|
278
343
|
}
|
|
279
344
|
return o;
|
|
280
345
|
}
|
|
@@ -282,24 +347,24 @@ class b {
|
|
|
282
347
|
* Generate a scheduler grid for week view
|
|
283
348
|
*/
|
|
284
349
|
getWeekGrid(e, t = 1, n = 1800, r = "00:00:00", o = "24:00:00", s = "24h") {
|
|
285
|
-
const
|
|
350
|
+
const i = this.getWeekDays(e, t), u = [], l = [], d = this.getTimeSlots(i[0], n, r, o);
|
|
286
351
|
for (const c of d) {
|
|
287
|
-
const
|
|
288
|
-
for (const
|
|
289
|
-
const m = new Date(
|
|
352
|
+
const f = [];
|
|
353
|
+
for (const h of i) {
|
|
354
|
+
const m = new Date(h);
|
|
290
355
|
m.setHours(c.start.getHours(), c.start.getMinutes(), 0, 0);
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
|
|
356
|
+
const T = new Date(h);
|
|
357
|
+
T.setHours(c.end.getHours(), c.end.getMinutes(), 0, 0);
|
|
358
|
+
const E = { start: m, end: T };
|
|
359
|
+
f.push(E), l.push(E);
|
|
295
360
|
}
|
|
296
361
|
u.push({
|
|
297
362
|
time: c.start,
|
|
298
363
|
label: this.formatTime(c.start, s),
|
|
299
|
-
slots:
|
|
364
|
+
slots: f
|
|
300
365
|
});
|
|
301
366
|
}
|
|
302
|
-
return { columns:
|
|
367
|
+
return { columns: i, rows: u, allSlots: l };
|
|
303
368
|
}
|
|
304
369
|
/**
|
|
305
370
|
* Round a date to the nearest slot
|
|
@@ -335,38 +400,109 @@ class b {
|
|
|
335
400
|
}
|
|
336
401
|
}
|
|
337
402
|
/**
|
|
338
|
-
*
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
403
|
+
* Which day the week starts on: the caller's explicit choice, else the
|
|
404
|
+
* locale's own convention, else Monday.
|
|
405
|
+
*
|
|
406
|
+
* Two numbering systems meet here and they disagree about Sunday.
|
|
407
|
+
* `Date.prototype.getDay()` — which every calculation in this file speaks — is
|
|
408
|
+
* 0-6 with **Sunday = 0**. `Intl.Locale…getWeekInfo().firstDay` is 1-7 with
|
|
409
|
+
* **Sunday = 7**. The `% 7` is that conversion, and it is the only place the
|
|
410
|
+
* 1-7 domain is allowed to exist: `DayOfWeek` stays 0-6 because it is also the
|
|
411
|
+
* type of `BusinessHours.daysOfWeek`, which is `getDay()`-based and would
|
|
412
|
+
* silently accept a meaningless 7 if the type were widened.
|
|
413
|
+
*
|
|
414
|
+
* Resolved from the locale the CALLER passes, never from a stored default. A
|
|
415
|
+
* derivation reading `DEFAULT_OPTIONS.locale` would have read the old 'en-US'
|
|
416
|
+
* literal and handed every user on earth a Sunday start, Europe included.
|
|
417
|
+
*
|
|
418
|
+
* `getWeekInfo` is absent in Firefox, and is a getter on some engines and a
|
|
419
|
+
* method on others; both shapes and neither are handled.
|
|
420
|
+
*/
|
|
421
|
+
resolveFirstDayOfWeek(e, t) {
|
|
422
|
+
if (e !== void 0) return e;
|
|
423
|
+
const n = t ?? "", r = this.weekStarts.get(n);
|
|
424
|
+
if (r !== void 0) return r;
|
|
425
|
+
let o = 1;
|
|
426
|
+
try {
|
|
427
|
+
const s = t || (typeof navigator < "u" ? navigator.language : void 0), i = new Intl.Locale(s ?? "en-US"), u = typeof i.getWeekInfo == "function" ? i.getWeekInfo()?.firstDay : i.weekInfo?.firstDay;
|
|
428
|
+
typeof u == "number" && (o = u % 7);
|
|
429
|
+
} catch {
|
|
345
430
|
}
|
|
346
|
-
return
|
|
431
|
+
return this.weekStarts.set(n, o), o;
|
|
347
432
|
}
|
|
348
433
|
/**
|
|
349
|
-
* Format
|
|
434
|
+
* Format a time of day.
|
|
435
|
+
*
|
|
436
|
+
* Was hand-rolled — `${hours}:${minutes}` with hardcoded 'AM'/'PM' literals —
|
|
437
|
+
* which no locale could reach: nl wants "a.m.", ja "午前", and several locales
|
|
438
|
+
* separate with something other than a colon.
|
|
439
|
+
*
|
|
440
|
+
* `format` is an explicit override. Leave it undefined and `hour12` is not
|
|
441
|
+
* passed at all, so `Intl` applies whatever the locale itself does — which is
|
|
442
|
+
* the behaviour the scheduler wants by default and the reason
|
|
443
|
+
* `detectTimeFormat` is not needed on this path.
|
|
350
444
|
*/
|
|
351
|
-
|
|
445
|
+
formatTime(e, t, n) {
|
|
446
|
+
return this.timeFormatter(t, n).format(e);
|
|
447
|
+
}
|
|
448
|
+
timeFormatter(e, t) {
|
|
449
|
+
const n = `${t ?? ""}|${e ?? ""}`, r = this.timeFormatters.get(n);
|
|
450
|
+
if (r) return r;
|
|
451
|
+
const o = e === "12h" ? (
|
|
452
|
+
// 'numeric', not '2-digit': a 12-hour clock reads "9:05 AM", never
|
|
453
|
+
// "09:05 AM". The distinction is what makes it look native.
|
|
454
|
+
{ hour: "numeric", minute: "2-digit", hour12: !0 }
|
|
455
|
+
) : e === "24h" ? { hour: "2-digit", minute: "2-digit", hour12: !1 } : { hour: "numeric", minute: "2-digit" }, s = new Intl.DateTimeFormat(t, o);
|
|
456
|
+
return this.timeFormatters.set(n, s), s;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Format date for display.
|
|
460
|
+
*
|
|
461
|
+
* `locale` is optional and stays optional all the way down: `undefined` tells
|
|
462
|
+
* `Intl` to use the runtime's own locale. It used to default to `'en-US'`,
|
|
463
|
+
* which is not a neutral fallback but an instruction to render US English.
|
|
464
|
+
*/
|
|
465
|
+
formatDate(e, t, n) {
|
|
352
466
|
return e.toLocaleDateString(t, n);
|
|
353
467
|
}
|
|
354
468
|
/**
|
|
355
|
-
* Format date with weekday
|
|
469
|
+
* Format date with weekday — "Mon, Jul 27" in en-US, "ma 27 jul" in nl-BE,
|
|
470
|
+
* "7月27日(月)" in ja-JP. The field order is the locale's business, not ours.
|
|
356
471
|
*/
|
|
357
|
-
formatDateWithWeekday(e, t
|
|
472
|
+
formatDateWithWeekday(e, t) {
|
|
358
473
|
return this.formatDate(e, t, { weekday: "short", month: "short", day: "numeric" });
|
|
359
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* Format a date RANGE, letting the locale place the separator and elide the
|
|
477
|
+
* shared parts ("Jul 27 – Aug 2, 2026"). Falls back to a plain join where
|
|
478
|
+
* `formatRange` is unavailable.
|
|
479
|
+
*/
|
|
480
|
+
formatDateRange(e, t, n, r) {
|
|
481
|
+
const o = new Intl.DateTimeFormat(n, r);
|
|
482
|
+
return typeof o.formatRange == "function" ? o.formatRange(e, t) : `${o.format(e)} – ${o.format(t)}`;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Format a start–end time pair as one range.
|
|
486
|
+
*
|
|
487
|
+
* Beats joining two `formatTime` results with a literal separator: the locale
|
|
488
|
+
* chooses the dash AND elides what the ends share, so en-US reads
|
|
489
|
+
* "9:00 – 10:00 AM" rather than "9:00 AM - 10:00 AM". The event chips used a
|
|
490
|
+
* hyphen while the announcements used an en-dash; now neither hardcodes one.
|
|
491
|
+
*/
|
|
492
|
+
formatTimeRange(e, t, n, r) {
|
|
493
|
+
const o = this.timeFormatter(n, r);
|
|
494
|
+
return typeof o.formatRange == "function" ? o.formatRange(e, t) : `${o.format(e)} – ${o.format(t)}`;
|
|
495
|
+
}
|
|
360
496
|
/**
|
|
361
497
|
* Get month name
|
|
362
498
|
*/
|
|
363
|
-
getMonthName(e, t
|
|
499
|
+
getMonthName(e, t, n = "long") {
|
|
364
500
|
return e.toLocaleDateString(t, { month: n });
|
|
365
501
|
}
|
|
366
502
|
/**
|
|
367
503
|
* Get day name
|
|
368
504
|
*/
|
|
369
|
-
getDayName(e, t
|
|
505
|
+
getDayName(e, t, n = "short") {
|
|
370
506
|
return e.toLocaleDateString(t, { weekday: n });
|
|
371
507
|
}
|
|
372
508
|
/**
|
|
@@ -438,15 +574,6 @@ class b {
|
|
|
438
574
|
const n = new Date(e);
|
|
439
575
|
return n.setFullYear(n.getFullYear() + t), n;
|
|
440
576
|
}
|
|
441
|
-
/**
|
|
442
|
-
* Get week number of the year
|
|
443
|
-
*/
|
|
444
|
-
getWeekNumber(e) {
|
|
445
|
-
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())), n = t.getUTCDay() || 7;
|
|
446
|
-
t.setUTCDate(t.getUTCDate() + 4 - n);
|
|
447
|
-
const r = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
|
|
448
|
-
return Math.ceil(((t.getTime() - r.getTime()) / 864e5 + 1) / 7);
|
|
449
|
-
}
|
|
450
577
|
/**
|
|
451
578
|
* Get seconds from midnight for a date
|
|
452
579
|
*/
|
|
@@ -460,8 +587,8 @@ class b {
|
|
|
460
587
|
return Math.round((t.getTime() - e.getTime()) / 1e3);
|
|
461
588
|
}
|
|
462
589
|
}
|
|
463
|
-
const
|
|
464
|
-
class
|
|
590
|
+
const R = new L();
|
|
591
|
+
class F {
|
|
465
592
|
/**
|
|
466
593
|
* Split an event into daily parts
|
|
467
594
|
* Each part represents one day of a multi-day event
|
|
@@ -470,7 +597,7 @@ class I {
|
|
|
470
597
|
const t = [];
|
|
471
598
|
let n = new Date(e.start), r = 0;
|
|
472
599
|
const o = this.getTotalDays(e.start, e.end);
|
|
473
|
-
if (
|
|
600
|
+
if (R.isSameDay(e.start, e.end)) {
|
|
474
601
|
const s = "id" in e;
|
|
475
602
|
return t.push({
|
|
476
603
|
id: s ? `${e.id}-0` : "preview-0",
|
|
@@ -486,13 +613,13 @@ class I {
|
|
|
486
613
|
parts: t
|
|
487
614
|
};
|
|
488
615
|
}
|
|
489
|
-
for (; !
|
|
616
|
+
for (; !R.isSameDay(n, e.end); ) {
|
|
490
617
|
const s = new Date(n);
|
|
491
618
|
s.setDate(s.getDate() + 1), s.setHours(0, 0, 0, 0);
|
|
492
|
-
const
|
|
619
|
+
const i = "id" in e;
|
|
493
620
|
t.push({
|
|
494
|
-
id:
|
|
495
|
-
event:
|
|
621
|
+
id: i ? `${e.id}-${r}` : `preview-${r}`,
|
|
622
|
+
event: i ? e : null,
|
|
496
623
|
start: new Date(n),
|
|
497
624
|
end: s,
|
|
498
625
|
isStart: r === 0,
|
|
@@ -541,8 +668,8 @@ class I {
|
|
|
541
668
|
for (const r of t) {
|
|
542
669
|
const o = e.filter((s) => s.start.getTime() === r.getTime());
|
|
543
670
|
for (const s of o) {
|
|
544
|
-
const
|
|
545
|
-
|
|
671
|
+
const i = n.find((u) => this.isTrackFreeForEvent(u, s));
|
|
672
|
+
i ? i.events.push(s) : n.push({
|
|
546
673
|
index: n.length,
|
|
547
674
|
events: [s]
|
|
548
675
|
});
|
|
@@ -594,9 +721,9 @@ class I {
|
|
|
594
721
|
const n = this.buildOverlapGroups(e);
|
|
595
722
|
for (const r of n) {
|
|
596
723
|
const { assignments: o, columnCount: s } = this.assignColumns(r);
|
|
597
|
-
for (const
|
|
598
|
-
const u = o.get(
|
|
599
|
-
t.set(
|
|
724
|
+
for (const i of r) {
|
|
725
|
+
const u = o.get(i.id) ?? 0, l = this.computeColspan(i, u, r, o, s);
|
|
726
|
+
t.set(i.id, {
|
|
600
727
|
col: u,
|
|
601
728
|
colspan: l,
|
|
602
729
|
columnCount: s
|
|
@@ -617,17 +744,17 @@ class I {
|
|
|
617
744
|
const t = [], n = /* @__PURE__ */ new Set(), r = [...e].sort((o, s) => o.start.getTime() - s.start.getTime());
|
|
618
745
|
for (const o of r) {
|
|
619
746
|
if (n.has(o.id)) continue;
|
|
620
|
-
const s = [],
|
|
747
|
+
const s = [], i = [o];
|
|
621
748
|
let u = 0;
|
|
622
|
-
for (; u <
|
|
623
|
-
const l =
|
|
749
|
+
for (; u < i.length; ) {
|
|
750
|
+
const l = i[u++];
|
|
624
751
|
if (n.has(l.id)) continue;
|
|
625
752
|
n.add(l.id), s.push(l);
|
|
626
753
|
const d = l.end.getTime();
|
|
627
754
|
for (const c of r)
|
|
628
755
|
if (!n.has(c.id)) {
|
|
629
756
|
if (c.start.getTime() >= d) break;
|
|
630
|
-
this.eventsOverlap(l, c) &&
|
|
757
|
+
this.eventsOverlap(l, c) && i.push(c);
|
|
631
758
|
}
|
|
632
759
|
}
|
|
633
760
|
t.push(s);
|
|
@@ -645,9 +772,9 @@ class I {
|
|
|
645
772
|
), r = [];
|
|
646
773
|
for (const o of n) {
|
|
647
774
|
let s = -1;
|
|
648
|
-
for (let
|
|
649
|
-
if (r[
|
|
650
|
-
s =
|
|
775
|
+
for (let i = 0; i < r.length; i++)
|
|
776
|
+
if (r[i] <= o.start.getTime()) {
|
|
777
|
+
s = i;
|
|
651
778
|
break;
|
|
652
779
|
}
|
|
653
780
|
s === -1 ? (s = r.length, r.push(o.end.getTime())) : r[s] = o.end.getTime(), t.set(o.id, s);
|
|
@@ -660,9 +787,9 @@ class I {
|
|
|
660
787
|
*/
|
|
661
788
|
computeColspan(e, t, n, r, o) {
|
|
662
789
|
let s = 1 / 0;
|
|
663
|
-
for (const
|
|
664
|
-
if (
|
|
665
|
-
const u = r.get(
|
|
790
|
+
for (const i of n) {
|
|
791
|
+
if (i.id === e.id || !this.eventsOverlap(e, i)) continue;
|
|
792
|
+
const u = r.get(i.id) ?? 0;
|
|
666
793
|
u > t && (s = Math.min(s, u));
|
|
667
794
|
}
|
|
668
795
|
return s !== 1 / 0 ? s - t : o - t;
|
|
@@ -683,7 +810,7 @@ class I {
|
|
|
683
810
|
s.events.some(
|
|
684
811
|
(u) => u.start < t.end && u.end > t.start
|
|
685
812
|
) && r.push(s.index);
|
|
686
|
-
r.sort((s,
|
|
813
|
+
r.sort((s, i) => s - i);
|
|
687
814
|
const o = r.indexOf(n);
|
|
688
815
|
return {
|
|
689
816
|
relativeIndex: o >= 0 ? o : 0,
|
|
@@ -736,21 +863,21 @@ class I {
|
|
|
736
863
|
return r.setHours(23, 59, 59, 999), this.filterPartsByRange(e, n, r);
|
|
737
864
|
}
|
|
738
865
|
}
|
|
739
|
-
const
|
|
740
|
-
class
|
|
866
|
+
const j = new F();
|
|
867
|
+
class x {
|
|
741
868
|
/**
|
|
742
869
|
* Flatten a hierarchical resource structure for rendering
|
|
743
870
|
*/
|
|
744
871
|
flatten(e, t = /* @__PURE__ */ new Set(), n = 0, r, o = !1) {
|
|
745
872
|
const s = [];
|
|
746
|
-
for (const
|
|
873
|
+
for (const i of e) {
|
|
747
874
|
const u = !o;
|
|
748
|
-
if (s.push({ item:
|
|
749
|
-
const l = t.has(
|
|
750
|
-
|
|
875
|
+
if (s.push({ item: i, depth: n, visible: u, parentId: r }), g(i)) {
|
|
876
|
+
const l = t.has(i.id), d = this.flatten(
|
|
877
|
+
i.children,
|
|
751
878
|
t,
|
|
752
879
|
n + 1,
|
|
753
|
-
|
|
880
|
+
i.id,
|
|
754
881
|
o || l
|
|
755
882
|
);
|
|
756
883
|
s.push(...d);
|
|
@@ -764,7 +891,7 @@ class R {
|
|
|
764
891
|
getAllResources(e) {
|
|
765
892
|
const t = [];
|
|
766
893
|
for (const n of e)
|
|
767
|
-
p(n) ? t.push(n) :
|
|
894
|
+
p(n) ? t.push(n) : g(n) && t.push(...this.getAllResources(n.children));
|
|
768
895
|
return t;
|
|
769
896
|
}
|
|
770
897
|
/**
|
|
@@ -781,7 +908,7 @@ class R {
|
|
|
781
908
|
for (const n of e) {
|
|
782
909
|
if (p(n) && n.id === t)
|
|
783
910
|
return n;
|
|
784
|
-
if (
|
|
911
|
+
if (g(n)) {
|
|
785
912
|
const r = this.findResourceById(n.children, t);
|
|
786
913
|
if (r) return r;
|
|
787
914
|
}
|
|
@@ -792,7 +919,7 @@ class R {
|
|
|
792
919
|
*/
|
|
793
920
|
findGroupById(e, t) {
|
|
794
921
|
for (const n of e)
|
|
795
|
-
if (
|
|
922
|
+
if (g(n)) {
|
|
796
923
|
if (n.id === t) return n;
|
|
797
924
|
const r = this.findGroupById(n.children, t);
|
|
798
925
|
if (r) return r;
|
|
@@ -870,7 +997,7 @@ class R {
|
|
|
870
997
|
*/
|
|
871
998
|
mapGroups(e, t) {
|
|
872
999
|
return e.map((n) => {
|
|
873
|
-
if (
|
|
1000
|
+
if (g(n)) {
|
|
874
1001
|
const r = t(n);
|
|
875
1002
|
return {
|
|
876
1003
|
...r,
|
|
@@ -890,51 +1017,54 @@ class R {
|
|
|
890
1017
|
* Sort resources by order property
|
|
891
1018
|
*/
|
|
892
1019
|
sortByOrder(e) {
|
|
893
|
-
return [...e].sort((n, r) => (n.order ?? 0) - (r.order ?? 0)).map((n) =>
|
|
1020
|
+
return [...e].sort((n, r) => (n.order ?? 0) - (r.order ?? 0)).map((n) => g(n) ? {
|
|
894
1021
|
...n,
|
|
895
1022
|
children: this.sortByOrder(n.children)
|
|
896
1023
|
} : n);
|
|
897
1024
|
}
|
|
898
1025
|
}
|
|
899
|
-
const
|
|
900
|
-
function
|
|
1026
|
+
const q = new x();
|
|
1027
|
+
function M(a = "evt") {
|
|
901
1028
|
const e = Date.now().toString(36), t = Math.random().toString(36).substring(2, 9);
|
|
902
|
-
return `${
|
|
1029
|
+
return `${a}-${e}-${t}`;
|
|
903
1030
|
}
|
|
904
|
-
function
|
|
905
|
-
return
|
|
1031
|
+
function V() {
|
|
1032
|
+
return M("evt");
|
|
906
1033
|
}
|
|
907
|
-
function
|
|
908
|
-
return
|
|
1034
|
+
function _() {
|
|
1035
|
+
return M("res");
|
|
909
1036
|
}
|
|
910
|
-
function
|
|
911
|
-
return
|
|
1037
|
+
function J() {
|
|
1038
|
+
return M("grp");
|
|
912
1039
|
}
|
|
913
1040
|
export {
|
|
914
|
-
|
|
915
|
-
R,
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1041
|
+
z as D,
|
|
1042
|
+
x as R,
|
|
1043
|
+
F as T,
|
|
1044
|
+
b as a,
|
|
1045
|
+
k as b,
|
|
919
1046
|
w as c,
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
p,
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1047
|
+
R as d,
|
|
1048
|
+
I as e,
|
|
1049
|
+
L as f,
|
|
1050
|
+
U as g,
|
|
1051
|
+
O as h,
|
|
1052
|
+
Y as i,
|
|
1053
|
+
G as j,
|
|
1054
|
+
V as k,
|
|
1055
|
+
J as l,
|
|
1056
|
+
M as m,
|
|
1057
|
+
_ as n,
|
|
1058
|
+
A as o,
|
|
1059
|
+
H as p,
|
|
1060
|
+
$ as q,
|
|
1061
|
+
p as r,
|
|
1062
|
+
g as s,
|
|
1063
|
+
W as t,
|
|
1064
|
+
C as u,
|
|
1065
|
+
B as v,
|
|
1066
|
+
P as w,
|
|
1067
|
+
N as x,
|
|
1068
|
+
q as y,
|
|
1069
|
+
j as z
|
|
940
1070
|
};
|