@mintplayer/web-components 2.7.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/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +19 -1
- package/chunks/{id-BstjfRrz.mjs → id-DNZVAnGC.mjs} +267 -162
- package/chunks/{mp-calendar.element-u6uS31_j.mjs → mp-calendar.element-CJ8-t-Zn.mjs} +71 -39
- package/chunks/{mp-datetime-picker.element-MPTRHwyc.mjs → mp-datetime-picker.element-D1CiLbHm.mjs} +1 -1
- package/datepicker/index.mjs +1 -1
- package/datetime-picker/index.mjs +1 -1
- package/package.json +1 -1
- package/scheduler/index.mjs +1332 -765
- package/scheduler/src/components/mp-scheduler.d.ts +186 -1
- package/scheduler/src/input/input-handler.d.ts +22 -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 +39 -15
- package/scheduler/src/views/year-view.d.ts +7 -0
- package/scheduler-core/index.mjs +42 -40
- package/scheduler-core/src/models/messages.d.ts +29 -0
- package/scheduler-core/src/models/options.d.ts +24 -7
- package/scheduler-core/src/services/date.service.d.ts +64 -10
- package/scheduler-core/src/utils/color.d.ts +19 -0
|
@@ -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,16 +20,23 @@ 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}",
|
|
32
38
|
resizeResourceColumn: "Resize the resource column",
|
|
39
|
+
renameResource: "Rename {title}",
|
|
33
40
|
renameResourceLabel: "New name for {title}",
|
|
34
41
|
resourceRenamed: "{from} renamed to {to}.",
|
|
35
42
|
moreEvents: "+{count} more",
|
|
@@ -80,21 +87,28 @@ const w = {
|
|
|
80
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.",
|
|
81
88
|
eventInstructionsReadOnly: "Left and Right arrows move between events.",
|
|
82
89
|
actionNotAllowed: "That action is not allowed here.",
|
|
90
|
+
openDayView: "Open {date}",
|
|
83
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.",
|
|
84
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.",
|
|
85
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.",
|
|
86
100
|
eventOnResource: "on {resource}"
|
|
87
101
|
};
|
|
88
|
-
function
|
|
89
|
-
return e ?
|
|
102
|
+
function G(a, e) {
|
|
103
|
+
return e ? a.replace(
|
|
90
104
|
/\{(\w+)\}/g,
|
|
91
105
|
(t, n) => n in e ? String(e[n]) : t
|
|
92
|
-
) :
|
|
106
|
+
) : a;
|
|
93
107
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
108
|
+
function P(a) {
|
|
109
|
+
return a ? { ...w, ...a } : w;
|
|
96
110
|
}
|
|
97
|
-
const
|
|
111
|
+
const b = [
|
|
98
112
|
"#3788d8",
|
|
99
113
|
// Blue
|
|
100
114
|
"#28a745",
|
|
@@ -116,50 +130,76 @@ const M = [
|
|
|
116
130
|
"#6c757d"
|
|
117
131
|
// Gray
|
|
118
132
|
];
|
|
119
|
-
function
|
|
120
|
-
return
|
|
133
|
+
function A(a) {
|
|
134
|
+
return b[a % b.length];
|
|
121
135
|
}
|
|
122
|
-
function
|
|
123
|
-
let e =
|
|
136
|
+
function H(a) {
|
|
137
|
+
let e = a.replace("#", "");
|
|
124
138
|
e.length === 3 && (e = e.split("").map((s) => s + s).join(""));
|
|
125
139
|
const t = parseInt(e.substring(0, 2), 16), n = parseInt(e.substring(2, 4), 16), r = parseInt(e.substring(4, 6), 16);
|
|
126
140
|
return (0.299 * t + 0.587 * n + 0.114 * r) / 255 > 0.5 ? "#000000" : "#ffffff";
|
|
127
141
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
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("#", "");
|
|
130
173
|
t.length === 3 && (t = t.split("").map((l) => l + l).join(""));
|
|
131
|
-
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))),
|
|
132
|
-
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")}`;
|
|
133
176
|
}
|
|
134
|
-
function
|
|
135
|
-
let t =
|
|
177
|
+
function Y(a, e) {
|
|
178
|
+
let t = a.replace("#", "");
|
|
136
179
|
t.length === 3 && (t = t.split("").map((l) => l + l).join(""));
|
|
137
|
-
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))),
|
|
138
|
-
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")}`;
|
|
139
182
|
}
|
|
140
|
-
function U(
|
|
141
|
-
let t =
|
|
183
|
+
function U(a, e) {
|
|
184
|
+
let t = a.replace("#", "");
|
|
142
185
|
t.length === 3 && (t = t.split("").map((s) => s + s).join(""));
|
|
143
186
|
const n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16);
|
|
144
187
|
return `rgba(${n}, ${r}, ${o}, ${e})`;
|
|
145
188
|
}
|
|
146
|
-
const
|
|
147
|
-
function
|
|
148
|
-
if (
|
|
149
|
-
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;
|
|
150
193
|
return n?.eventColor ?? n?.color ?? t;
|
|
151
194
|
}
|
|
152
|
-
const
|
|
195
|
+
const z = {
|
|
153
196
|
initialView: "week",
|
|
154
197
|
initialDate: /* @__PURE__ */ new Date(),
|
|
155
|
-
locale: "en-US",
|
|
156
|
-
firstDayOfWeek: 1,
|
|
157
198
|
timeZone: "local",
|
|
158
199
|
slotDuration: 1800,
|
|
159
200
|
slotLabelInterval: 3600,
|
|
160
201
|
slotMinTime: "00:00:00",
|
|
161
202
|
slotMaxTime: "24:00:00",
|
|
162
|
-
timeFormat: "24h",
|
|
163
203
|
businessHours: {
|
|
164
204
|
daysOfWeek: [1, 2, 3, 4, 5],
|
|
165
205
|
startTime: "09:00",
|
|
@@ -178,16 +218,14 @@ const P = {
|
|
|
178
218
|
// Empty table, NOT DEFAULT_PERMISSIONS: per-capability fallback happens inside
|
|
179
219
|
// resolveCapability, so an unspecified capability keeps its documented default.
|
|
180
220
|
permissions: {},
|
|
181
|
-
defaultEventColor:
|
|
221
|
+
defaultEventColor: k,
|
|
182
222
|
nowIndicator: !0,
|
|
183
|
-
weekNumbers: !1,
|
|
184
|
-
weekText: "W",
|
|
185
223
|
dayMaxEvents: !0,
|
|
186
224
|
moreLinkBehavior: "popover",
|
|
187
225
|
dayClickAction: "popover",
|
|
188
226
|
eventEditor: !0,
|
|
189
227
|
requireEventResource: !1
|
|
190
|
-
},
|
|
228
|
+
}, I = {
|
|
191
229
|
createEvent: !0,
|
|
192
230
|
moveEvent: !0,
|
|
193
231
|
resizeEvent: !0,
|
|
@@ -199,27 +237,30 @@ const P = {
|
|
|
199
237
|
deleteResource: !1,
|
|
200
238
|
createGroup: !1
|
|
201
239
|
};
|
|
202
|
-
function
|
|
203
|
-
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;
|
|
204
242
|
const r = e.event;
|
|
205
243
|
if (!r) return !0;
|
|
206
244
|
if (r.editable === !1) return !1;
|
|
207
|
-
switch (
|
|
245
|
+
switch (a) {
|
|
208
246
|
case "moveEvent":
|
|
209
247
|
return r.draggable !== !1;
|
|
210
248
|
case "resizeEvent":
|
|
211
|
-
return
|
|
249
|
+
return S(r.resizable, "start") || S(r.resizable, "end");
|
|
212
250
|
default:
|
|
213
251
|
return !0;
|
|
214
252
|
}
|
|
215
253
|
}
|
|
216
|
-
function
|
|
217
|
-
return
|
|
254
|
+
function N(a, e) {
|
|
255
|
+
return C("resizeEvent", e) ? S(e.event?.resizable, a) : !1;
|
|
218
256
|
}
|
|
219
|
-
function
|
|
220
|
-
return
|
|
257
|
+
function S(a, e) {
|
|
258
|
+
return a === !1 ? !1 : a && typeof a == "object" ? a[e] !== !1 : !0;
|
|
221
259
|
}
|
|
222
|
-
class
|
|
260
|
+
class L {
|
|
261
|
+
constructor() {
|
|
262
|
+
this.weekStarts = /* @__PURE__ */ new Map(), this.timeFormatters = /* @__PURE__ */ new Map();
|
|
263
|
+
}
|
|
223
264
|
/**
|
|
224
265
|
* Get the start of the week for a given date
|
|
225
266
|
*/
|
|
@@ -264,12 +305,12 @@ class k {
|
|
|
264
305
|
*/
|
|
265
306
|
getMonthWeeks(e, t = 1) {
|
|
266
307
|
const n = this.getMonthStart(e), r = this.getMonthEnd(e), o = this.getWeekStart(n, t), s = [];
|
|
267
|
-
let
|
|
308
|
+
let i = new Date(o);
|
|
268
309
|
for (let u = 0; u < 6; u++) {
|
|
269
310
|
const l = [];
|
|
270
|
-
for (let
|
|
271
|
-
l.push(new Date(
|
|
272
|
-
if (s.push(l),
|
|
311
|
+
for (let d = 0; d < 7; d++)
|
|
312
|
+
l.push(new Date(i)), i.setDate(i.getDate() + 1);
|
|
313
|
+
if (s.push(l), i > r && s.length >= 4)
|
|
273
314
|
break;
|
|
274
315
|
}
|
|
275
316
|
return s;
|
|
@@ -293,10 +334,10 @@ class k {
|
|
|
293
334
|
* Get time slots for a day
|
|
294
335
|
*/
|
|
295
336
|
getTimeSlots(e, t = 1800, n = "00:00:00", r = "24:00:00") {
|
|
296
|
-
const o = [], [s,
|
|
297
|
-
for (let
|
|
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) {
|
|
298
339
|
const h = new Date(e);
|
|
299
|
-
h.setHours(0, 0, 0, 0), h.setSeconds(
|
|
340
|
+
h.setHours(0, 0, 0, 0), h.setSeconds(f);
|
|
300
341
|
const m = new Date(h);
|
|
301
342
|
m.setSeconds(h.getSeconds() + t), o.push({ start: h, end: m });
|
|
302
343
|
}
|
|
@@ -306,24 +347,24 @@ class k {
|
|
|
306
347
|
* Generate a scheduler grid for week view
|
|
307
348
|
*/
|
|
308
349
|
getWeekGrid(e, t = 1, n = 1800, r = "00:00:00", o = "24:00:00", s = "24h") {
|
|
309
|
-
const
|
|
310
|
-
for (const
|
|
311
|
-
const
|
|
312
|
-
for (const h of
|
|
350
|
+
const i = this.getWeekDays(e, t), u = [], l = [], d = this.getTimeSlots(i[0], n, r, o);
|
|
351
|
+
for (const c of d) {
|
|
352
|
+
const f = [];
|
|
353
|
+
for (const h of i) {
|
|
313
354
|
const m = new Date(h);
|
|
314
|
-
m.setHours(
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
const
|
|
318
|
-
|
|
355
|
+
m.setHours(c.start.getHours(), c.start.getMinutes(), 0, 0);
|
|
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);
|
|
319
360
|
}
|
|
320
361
|
u.push({
|
|
321
|
-
time:
|
|
322
|
-
label: this.formatTime(
|
|
323
|
-
slots:
|
|
362
|
+
time: c.start,
|
|
363
|
+
label: this.formatTime(c.start, s),
|
|
364
|
+
slots: f
|
|
324
365
|
});
|
|
325
366
|
}
|
|
326
|
-
return { columns:
|
|
367
|
+
return { columns: i, rows: u, allSlots: l };
|
|
327
368
|
}
|
|
328
369
|
/**
|
|
329
370
|
* Round a date to the nearest slot
|
|
@@ -359,38 +400,109 @@ class k {
|
|
|
359
400
|
}
|
|
360
401
|
}
|
|
361
402
|
/**
|
|
362
|
-
*
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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 {
|
|
369
430
|
}
|
|
370
|
-
return
|
|
431
|
+
return this.weekStarts.set(n, o), o;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
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.
|
|
444
|
+
*/
|
|
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;
|
|
371
457
|
}
|
|
372
458
|
/**
|
|
373
|
-
* Format date for display
|
|
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.
|
|
374
464
|
*/
|
|
375
|
-
formatDate(e, t
|
|
465
|
+
formatDate(e, t, n) {
|
|
376
466
|
return e.toLocaleDateString(t, n);
|
|
377
467
|
}
|
|
378
468
|
/**
|
|
379
|
-
* 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.
|
|
380
471
|
*/
|
|
381
|
-
formatDateWithWeekday(e, t
|
|
472
|
+
formatDateWithWeekday(e, t) {
|
|
382
473
|
return this.formatDate(e, t, { weekday: "short", month: "short", day: "numeric" });
|
|
383
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
|
+
}
|
|
384
496
|
/**
|
|
385
497
|
* Get month name
|
|
386
498
|
*/
|
|
387
|
-
getMonthName(e, t
|
|
499
|
+
getMonthName(e, t, n = "long") {
|
|
388
500
|
return e.toLocaleDateString(t, { month: n });
|
|
389
501
|
}
|
|
390
502
|
/**
|
|
391
503
|
* Get day name
|
|
392
504
|
*/
|
|
393
|
-
getDayName(e, t
|
|
505
|
+
getDayName(e, t, n = "short") {
|
|
394
506
|
return e.toLocaleDateString(t, { weekday: n });
|
|
395
507
|
}
|
|
396
508
|
/**
|
|
@@ -462,15 +574,6 @@ class k {
|
|
|
462
574
|
const n = new Date(e);
|
|
463
575
|
return n.setFullYear(n.getFullYear() + t), n;
|
|
464
576
|
}
|
|
465
|
-
/**
|
|
466
|
-
* Get week number of the year
|
|
467
|
-
*/
|
|
468
|
-
getWeekNumber(e) {
|
|
469
|
-
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())), n = t.getUTCDay() || 7;
|
|
470
|
-
t.setUTCDate(t.getUTCDate() + 4 - n);
|
|
471
|
-
const r = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
|
|
472
|
-
return Math.ceil(((t.getTime() - r.getTime()) / 864e5 + 1) / 7);
|
|
473
|
-
}
|
|
474
577
|
/**
|
|
475
578
|
* Get seconds from midnight for a date
|
|
476
579
|
*/
|
|
@@ -484,8 +587,8 @@ class k {
|
|
|
484
587
|
return Math.round((t.getTime() - e.getTime()) / 1e3);
|
|
485
588
|
}
|
|
486
589
|
}
|
|
487
|
-
const
|
|
488
|
-
class
|
|
590
|
+
const R = new L();
|
|
591
|
+
class F {
|
|
489
592
|
/**
|
|
490
593
|
* Split an event into daily parts
|
|
491
594
|
* Each part represents one day of a multi-day event
|
|
@@ -494,7 +597,7 @@ class I {
|
|
|
494
597
|
const t = [];
|
|
495
598
|
let n = new Date(e.start), r = 0;
|
|
496
599
|
const o = this.getTotalDays(e.start, e.end);
|
|
497
|
-
if (
|
|
600
|
+
if (R.isSameDay(e.start, e.end)) {
|
|
498
601
|
const s = "id" in e;
|
|
499
602
|
return t.push({
|
|
500
603
|
id: s ? `${e.id}-0` : "preview-0",
|
|
@@ -510,13 +613,13 @@ class I {
|
|
|
510
613
|
parts: t
|
|
511
614
|
};
|
|
512
615
|
}
|
|
513
|
-
for (; !
|
|
616
|
+
for (; !R.isSameDay(n, e.end); ) {
|
|
514
617
|
const s = new Date(n);
|
|
515
618
|
s.setDate(s.getDate() + 1), s.setHours(0, 0, 0, 0);
|
|
516
|
-
const
|
|
619
|
+
const i = "id" in e;
|
|
517
620
|
t.push({
|
|
518
|
-
id:
|
|
519
|
-
event:
|
|
621
|
+
id: i ? `${e.id}-${r}` : `preview-${r}`,
|
|
622
|
+
event: i ? e : null,
|
|
520
623
|
start: new Date(n),
|
|
521
624
|
end: s,
|
|
522
625
|
isStart: r === 0,
|
|
@@ -565,8 +668,8 @@ class I {
|
|
|
565
668
|
for (const r of t) {
|
|
566
669
|
const o = e.filter((s) => s.start.getTime() === r.getTime());
|
|
567
670
|
for (const s of o) {
|
|
568
|
-
const
|
|
569
|
-
|
|
671
|
+
const i = n.find((u) => this.isTrackFreeForEvent(u, s));
|
|
672
|
+
i ? i.events.push(s) : n.push({
|
|
570
673
|
index: n.length,
|
|
571
674
|
events: [s]
|
|
572
675
|
});
|
|
@@ -618,9 +721,9 @@ class I {
|
|
|
618
721
|
const n = this.buildOverlapGroups(e);
|
|
619
722
|
for (const r of n) {
|
|
620
723
|
const { assignments: o, columnCount: s } = this.assignColumns(r);
|
|
621
|
-
for (const
|
|
622
|
-
const u = o.get(
|
|
623
|
-
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, {
|
|
624
727
|
col: u,
|
|
625
728
|
colspan: l,
|
|
626
729
|
columnCount: s
|
|
@@ -641,17 +744,17 @@ class I {
|
|
|
641
744
|
const t = [], n = /* @__PURE__ */ new Set(), r = [...e].sort((o, s) => o.start.getTime() - s.start.getTime());
|
|
642
745
|
for (const o of r) {
|
|
643
746
|
if (n.has(o.id)) continue;
|
|
644
|
-
const s = [],
|
|
747
|
+
const s = [], i = [o];
|
|
645
748
|
let u = 0;
|
|
646
|
-
for (; u <
|
|
647
|
-
const l =
|
|
749
|
+
for (; u < i.length; ) {
|
|
750
|
+
const l = i[u++];
|
|
648
751
|
if (n.has(l.id)) continue;
|
|
649
752
|
n.add(l.id), s.push(l);
|
|
650
|
-
const
|
|
651
|
-
for (const
|
|
652
|
-
if (!n.has(
|
|
653
|
-
if (
|
|
654
|
-
this.eventsOverlap(l,
|
|
753
|
+
const d = l.end.getTime();
|
|
754
|
+
for (const c of r)
|
|
755
|
+
if (!n.has(c.id)) {
|
|
756
|
+
if (c.start.getTime() >= d) break;
|
|
757
|
+
this.eventsOverlap(l, c) && i.push(c);
|
|
655
758
|
}
|
|
656
759
|
}
|
|
657
760
|
t.push(s);
|
|
@@ -669,9 +772,9 @@ class I {
|
|
|
669
772
|
), r = [];
|
|
670
773
|
for (const o of n) {
|
|
671
774
|
let s = -1;
|
|
672
|
-
for (let
|
|
673
|
-
if (r[
|
|
674
|
-
s =
|
|
775
|
+
for (let i = 0; i < r.length; i++)
|
|
776
|
+
if (r[i] <= o.start.getTime()) {
|
|
777
|
+
s = i;
|
|
675
778
|
break;
|
|
676
779
|
}
|
|
677
780
|
s === -1 ? (s = r.length, r.push(o.end.getTime())) : r[s] = o.end.getTime(), t.set(o.id, s);
|
|
@@ -684,9 +787,9 @@ class I {
|
|
|
684
787
|
*/
|
|
685
788
|
computeColspan(e, t, n, r, o) {
|
|
686
789
|
let s = 1 / 0;
|
|
687
|
-
for (const
|
|
688
|
-
if (
|
|
689
|
-
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;
|
|
690
793
|
u > t && (s = Math.min(s, u));
|
|
691
794
|
}
|
|
692
795
|
return s !== 1 / 0 ? s - t : o - t;
|
|
@@ -707,7 +810,7 @@ class I {
|
|
|
707
810
|
s.events.some(
|
|
708
811
|
(u) => u.start < t.end && u.end > t.start
|
|
709
812
|
) && r.push(s.index);
|
|
710
|
-
r.sort((s,
|
|
813
|
+
r.sort((s, i) => s - i);
|
|
711
814
|
const o = r.indexOf(n);
|
|
712
815
|
return {
|
|
713
816
|
relativeIndex: o >= 0 ? o : 0,
|
|
@@ -760,24 +863,24 @@ class I {
|
|
|
760
863
|
return r.setHours(23, 59, 59, 999), this.filterPartsByRange(e, n, r);
|
|
761
864
|
}
|
|
762
865
|
}
|
|
763
|
-
const
|
|
764
|
-
class
|
|
866
|
+
const j = new F();
|
|
867
|
+
class x {
|
|
765
868
|
/**
|
|
766
869
|
* Flatten a hierarchical resource structure for rendering
|
|
767
870
|
*/
|
|
768
871
|
flatten(e, t = /* @__PURE__ */ new Set(), n = 0, r, o = !1) {
|
|
769
872
|
const s = [];
|
|
770
|
-
for (const
|
|
873
|
+
for (const i of e) {
|
|
771
874
|
const u = !o;
|
|
772
|
-
if (s.push({ item:
|
|
773
|
-
const l = t.has(
|
|
774
|
-
|
|
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,
|
|
775
878
|
t,
|
|
776
879
|
n + 1,
|
|
777
|
-
|
|
880
|
+
i.id,
|
|
778
881
|
o || l
|
|
779
882
|
);
|
|
780
|
-
s.push(...
|
|
883
|
+
s.push(...d);
|
|
781
884
|
}
|
|
782
885
|
}
|
|
783
886
|
return s;
|
|
@@ -788,7 +891,7 @@ class C {
|
|
|
788
891
|
getAllResources(e) {
|
|
789
892
|
const t = [];
|
|
790
893
|
for (const n of e)
|
|
791
|
-
p(n) ? t.push(n) :
|
|
894
|
+
p(n) ? t.push(n) : g(n) && t.push(...this.getAllResources(n.children));
|
|
792
895
|
return t;
|
|
793
896
|
}
|
|
794
897
|
/**
|
|
@@ -805,7 +908,7 @@ class C {
|
|
|
805
908
|
for (const n of e) {
|
|
806
909
|
if (p(n) && n.id === t)
|
|
807
910
|
return n;
|
|
808
|
-
if (
|
|
911
|
+
if (g(n)) {
|
|
809
912
|
const r = this.findResourceById(n.children, t);
|
|
810
913
|
if (r) return r;
|
|
811
914
|
}
|
|
@@ -816,7 +919,7 @@ class C {
|
|
|
816
919
|
*/
|
|
817
920
|
findGroupById(e, t) {
|
|
818
921
|
for (const n of e)
|
|
819
|
-
if (
|
|
922
|
+
if (g(n)) {
|
|
820
923
|
if (n.id === t) return n;
|
|
821
924
|
const r = this.findGroupById(n.children, t);
|
|
822
925
|
if (r) return r;
|
|
@@ -894,7 +997,7 @@ class C {
|
|
|
894
997
|
*/
|
|
895
998
|
mapGroups(e, t) {
|
|
896
999
|
return e.map((n) => {
|
|
897
|
-
if (
|
|
1000
|
+
if (g(n)) {
|
|
898
1001
|
const r = t(n);
|
|
899
1002
|
return {
|
|
900
1003
|
...r,
|
|
@@ -914,52 +1017,54 @@ class C {
|
|
|
914
1017
|
* Sort resources by order property
|
|
915
1018
|
*/
|
|
916
1019
|
sortByOrder(e) {
|
|
917
|
-
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) ? {
|
|
918
1021
|
...n,
|
|
919
1022
|
children: this.sortByOrder(n.children)
|
|
920
1023
|
} : n);
|
|
921
1024
|
}
|
|
922
1025
|
}
|
|
923
|
-
const
|
|
924
|
-
function
|
|
1026
|
+
const q = new x();
|
|
1027
|
+
function M(a = "evt") {
|
|
925
1028
|
const e = Date.now().toString(36), t = Math.random().toString(36).substring(2, 9);
|
|
926
|
-
return `${
|
|
1029
|
+
return `${a}-${e}-${t}`;
|
|
927
1030
|
}
|
|
928
|
-
function
|
|
929
|
-
return
|
|
1031
|
+
function V() {
|
|
1032
|
+
return M("evt");
|
|
930
1033
|
}
|
|
931
|
-
function
|
|
932
|
-
return
|
|
1034
|
+
function _() {
|
|
1035
|
+
return M("res");
|
|
933
1036
|
}
|
|
934
|
-
function
|
|
935
|
-
return
|
|
1037
|
+
function J() {
|
|
1038
|
+
return M("grp");
|
|
936
1039
|
}
|
|
937
1040
|
export {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1041
|
+
z as D,
|
|
1042
|
+
x as R,
|
|
1043
|
+
F as T,
|
|
1044
|
+
b as a,
|
|
1045
|
+
k as b,
|
|
943
1046
|
w as c,
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1047
|
+
R as d,
|
|
1048
|
+
I as e,
|
|
1049
|
+
L as f,
|
|
947
1050
|
U as g,
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
p,
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
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
|
|
965
1070
|
};
|