@mintplayer/web-components 2.4.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/index.mjs +9 -8
- package/checkbox/index.mjs +1 -1
- package/chunks/error-text-B45eDAt1.mjs +17 -0
- package/chunks/{form-associated-axmc5sY0.mjs → form-associated-BR-fUvZ1.mjs} +11 -26
- package/chunks/{color-CpFtrIoX.mjs → id-BstjfRrz.mjs} +383 -317
- package/chunks/{mp-checkbox-Ph2mMRGz.mjs → mp-checkbox-6EJwdUIn.mjs} +6 -5
- package/chunks/{mp-datatable-BwTlh9A_.mjs → mp-datatable-25O1GtvU.mjs} +1 -1
- package/chunks/mp-datetime-picker.element-MPTRHwyc.mjs +530 -0
- package/chunks/{mp-radio-BjW1HNSc.mjs → mp-radio-DvKgrTFL.mjs} +2 -2
- package/chunks/{mp-select-Ctu-v1-p.mjs → mp-select-CKX0eM5C.mjs} +5 -4
- package/chunks/{mp-timepicker.element-Bz393NDQ.mjs → mp-timepicker.element-COZEUIoE.mjs} +56 -52
- package/chunks/{mp-toggle-button-Kz6sIgBJ.mjs → mp-toggle-button-C4Loq_p4.mjs} +5 -4
- package/chunks/{overlay-controller-DPt13i8p.mjs → overlay-controller-D6agzzOI.mjs} +19 -4
- package/datatable/index.mjs +1 -1
- package/datepicker/index.mjs +1 -1
- package/datetime-picker/index.mjs +2 -431
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +66 -0
- package/file-manager/index.mjs +1 -1
- package/navbar/index.mjs +1 -1
- package/otp-input/index.mjs +4 -3
- package/overlay/index.mjs +1 -1
- package/overlay/src/overlay-controller.d.ts +13 -0
- package/package.json +1 -1
- package/query-builder/index.mjs +2 -2
- package/radio/index.mjs +1 -1
- package/radio-group/index.mjs +2 -2
- package/ribbon/index.mjs +1 -1
- package/scheduler/index.mjs +3243 -882
- package/scheduler/src/components/mp-scheduler.d.ts +410 -2
- 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 +59 -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 +143 -4
- package/scheduler/src/views/week-view.d.ts +6 -0
- package/scheduler/src/views/year-view.d.ts +4 -2
- package/scheduler-core/index.mjs +63 -58
- package/scheduler-core/src/models/event.d.ts +6 -2
- 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 +94 -0
- package/scheduler-core/src/models/options.d.ts +72 -16
- package/scheduler-core/src/models/permissions.d.ts +114 -0
- package/scheduler-core/src/models/time-slot.d.ts +15 -0
- package/scheduler-core/src/services/resource.service.d.ts +25 -11
- package/scheduler-core/src/utils/color.d.ts +22 -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
- package/scheduler/src/events/event-types.d.ts +0 -58
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
function p(
|
|
2
|
-
return
|
|
1
|
+
function p(i) {
|
|
2
|
+
return !("children" in i);
|
|
3
3
|
}
|
|
4
|
-
function f(
|
|
5
|
-
return "children" in
|
|
4
|
+
function f(i) {
|
|
5
|
+
return "children" in i;
|
|
6
6
|
}
|
|
7
7
|
const w = {
|
|
8
8
|
navLabel: "Scheduler navigation",
|
|
@@ -17,10 +17,47 @@ const w = {
|
|
|
17
17
|
viewDay: "Day",
|
|
18
18
|
viewTimeline: "Timeline",
|
|
19
19
|
resourcesHeader: "Resources",
|
|
20
|
+
unassignedResource: "(No resource)",
|
|
21
|
+
noResources: "No resources to show.",
|
|
20
22
|
timelineGridLabel: "Resource timeline for week starting {date}",
|
|
21
23
|
expandGroup: "Expand {title}",
|
|
22
24
|
collapseGroup: "Collapse {title}",
|
|
25
|
+
addResourceBarLabel: "Add to the resource list",
|
|
26
|
+
addResource: "Add resource",
|
|
27
|
+
addGroup: "Add group",
|
|
28
|
+
addResourceToGroup: "Add resource to {title}",
|
|
29
|
+
addGroupToGroup: "Add subgroup to {title}",
|
|
30
|
+
removeResource: "Remove {title}",
|
|
31
|
+
resourceColor: "Colour for {title}",
|
|
32
|
+
resizeResourceColumn: "Resize the resource column",
|
|
33
|
+
renameResourceLabel: "New name for {title}",
|
|
34
|
+
resourceRenamed: "{from} renamed to {to}.",
|
|
23
35
|
moreEvents: "+{count} more",
|
|
36
|
+
dayPopoverLabel: "Events on {date}",
|
|
37
|
+
dayPopoverCount: "{count} {events}",
|
|
38
|
+
eventSingular: "event",
|
|
39
|
+
eventPlural: "events",
|
|
40
|
+
dayPopoverEmpty: "No events.",
|
|
41
|
+
newEvent: "New event",
|
|
42
|
+
showDay: "Show day",
|
|
43
|
+
showMonth: "Show month",
|
|
44
|
+
closePopover: "Close",
|
|
45
|
+
newEventResource: "Resource",
|
|
46
|
+
deleteEventLabel: "Delete {title}",
|
|
47
|
+
eventEditorLabel: "Edit {title}",
|
|
48
|
+
editorTitleLabel: "Title",
|
|
49
|
+
editorStartLabel: "Start",
|
|
50
|
+
editorEndLabel: "End",
|
|
51
|
+
editorColorLabel: "Colour",
|
|
52
|
+
editorInheritColor: "Inherit from resource",
|
|
53
|
+
editorSave: "Save",
|
|
54
|
+
editorCancel: "Cancel",
|
|
55
|
+
editorDelete: "Delete",
|
|
56
|
+
editorInvalidRange: "End must be after start.",
|
|
57
|
+
editorTitleRequired: "Title is required.",
|
|
58
|
+
editorEndClamped: "End adjusted to {end}, the earliest allowed.",
|
|
59
|
+
editorStartClamped: "Start adjusted to {start}, the latest allowed.",
|
|
60
|
+
yearMonthCardLabel: "{month}, {count} {events}",
|
|
24
61
|
viewChanged: "View changed to {view}.",
|
|
25
62
|
eventAdded: "Event {title} added.",
|
|
26
63
|
eventUpdated: "Event {title} updated.",
|
|
@@ -28,6 +65,7 @@ const w = {
|
|
|
28
65
|
loadingEvents: "Loading events.",
|
|
29
66
|
eventsLoaded: "Events loaded.",
|
|
30
67
|
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.",
|
|
68
|
+
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.",
|
|
31
69
|
movedTo: "Moved to {start}–{end}, {day}",
|
|
32
70
|
movedToResource: "Moved to resource {resource}.",
|
|
33
71
|
resizedEdge: "Resized {edge} edge to {start}–{end}",
|
|
@@ -39,20 +77,79 @@ const w = {
|
|
|
39
77
|
slotSingular: "slot",
|
|
40
78
|
slotPlural: "slots",
|
|
41
79
|
selectionCommitted: "Selection committed: {start}–{end}.",
|
|
80
|
+
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
|
+
eventInstructionsReadOnly: "Left and Right arrows move between events.",
|
|
82
|
+
actionNotAllowed: "That action is not allowed here.",
|
|
42
83
|
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.",
|
|
43
84
|
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
|
+
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.",
|
|
44
86
|
eventOnResource: "on {resource}"
|
|
45
87
|
};
|
|
46
|
-
function
|
|
47
|
-
return e ?
|
|
88
|
+
function x(i, e) {
|
|
89
|
+
return e ? i.replace(
|
|
48
90
|
/\{(\w+)\}/g,
|
|
49
91
|
(t, n) => n in e ? String(e[n]) : t
|
|
50
|
-
) :
|
|
92
|
+
) : i;
|
|
51
93
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
94
|
+
function L(i) {
|
|
95
|
+
return i ? { ...w, ...i } : w;
|
|
54
96
|
}
|
|
55
|
-
const
|
|
97
|
+
const M = [
|
|
98
|
+
"#3788d8",
|
|
99
|
+
// Blue
|
|
100
|
+
"#28a745",
|
|
101
|
+
// Green
|
|
102
|
+
"#dc3545",
|
|
103
|
+
// Red
|
|
104
|
+
"#ffc107",
|
|
105
|
+
// Yellow
|
|
106
|
+
"#17a2b8",
|
|
107
|
+
// Cyan
|
|
108
|
+
"#6f42c1",
|
|
109
|
+
// Purple
|
|
110
|
+
"#fd7e14",
|
|
111
|
+
// Orange
|
|
112
|
+
"#20c997",
|
|
113
|
+
// Teal
|
|
114
|
+
"#e83e8c",
|
|
115
|
+
// Pink
|
|
116
|
+
"#6c757d"
|
|
117
|
+
// Gray
|
|
118
|
+
];
|
|
119
|
+
function F(i) {
|
|
120
|
+
return M[i % M.length];
|
|
121
|
+
}
|
|
122
|
+
function G(i) {
|
|
123
|
+
let e = i.replace("#", "");
|
|
124
|
+
e.length === 3 && (e = e.split("").map((s) => s + s).join(""));
|
|
125
|
+
const t = parseInt(e.substring(0, 2), 16), n = parseInt(e.substring(2, 4), 16), r = parseInt(e.substring(4, 6), 16);
|
|
126
|
+
return (0.299 * t + 0.587 * n + 0.114 * r) / 255 > 0.5 ? "#000000" : "#ffffff";
|
|
127
|
+
}
|
|
128
|
+
function H(i, e) {
|
|
129
|
+
let t = i.replace("#", "");
|
|
130
|
+
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))), a = Math.min(255, Math.round(r + (255 - r) * (e / 100))), u = Math.min(255, Math.round(o + (255 - o) * (e / 100)));
|
|
132
|
+
return `#${s.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}${u.toString(16).padStart(2, "0")}`;
|
|
133
|
+
}
|
|
134
|
+
function A(i, e) {
|
|
135
|
+
let t = i.replace("#", "");
|
|
136
|
+
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))), a = Math.max(0, Math.round(r * (1 - e / 100))), u = Math.max(0, Math.round(o * (1 - e / 100)));
|
|
138
|
+
return `#${s.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}${u.toString(16).padStart(2, "0")}`;
|
|
139
|
+
}
|
|
140
|
+
function U(i, e) {
|
|
141
|
+
let t = i.replace("#", "");
|
|
142
|
+
t.length === 3 && (t = t.split("").map((s) => s + s).join(""));
|
|
143
|
+
const n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16);
|
|
144
|
+
return `rgba(${n}, ${r}, ${o}, ${e})`;
|
|
145
|
+
}
|
|
146
|
+
const E = "#3788d8";
|
|
147
|
+
function $(i, e, t = E) {
|
|
148
|
+
if (i.color) return i.color;
|
|
149
|
+
const n = i.resourceId ? e.get(i.resourceId) : void 0;
|
|
150
|
+
return n?.eventColor ?? n?.color ?? t;
|
|
151
|
+
}
|
|
152
|
+
const P = {
|
|
56
153
|
initialView: "week",
|
|
57
154
|
initialDate: /* @__PURE__ */ new Date(),
|
|
58
155
|
locale: "en-US",
|
|
@@ -77,38 +174,69 @@ const R = {
|
|
|
77
174
|
center: "title",
|
|
78
175
|
end: "year,month,week,day,timeline"
|
|
79
176
|
},
|
|
80
|
-
editable: !0,
|
|
81
|
-
selectable: !0,
|
|
82
|
-
selectMirror: !0,
|
|
83
|
-
eventDurationEditable: !0,
|
|
84
|
-
eventStartEditable: !0,
|
|
85
|
-
dragRevertDuration: 500,
|
|
86
|
-
dragScroll: !0,
|
|
87
|
-
snapDuration: 1800,
|
|
88
177
|
messages: w,
|
|
178
|
+
// Empty table, NOT DEFAULT_PERMISSIONS: per-capability fallback happens inside
|
|
179
|
+
// resolveCapability, so an unspecified capability keeps its documented default.
|
|
180
|
+
permissions: {},
|
|
181
|
+
defaultEventColor: E,
|
|
89
182
|
nowIndicator: !0,
|
|
90
183
|
weekNumbers: !1,
|
|
91
184
|
weekText: "W",
|
|
92
|
-
dayMaxEvents: !0
|
|
185
|
+
dayMaxEvents: !0,
|
|
186
|
+
moreLinkBehavior: "popover",
|
|
187
|
+
dayClickAction: "popover",
|
|
188
|
+
eventEditor: !0,
|
|
189
|
+
requireEventResource: !1
|
|
190
|
+
}, b = {
|
|
191
|
+
createEvent: !0,
|
|
192
|
+
moveEvent: !0,
|
|
193
|
+
resizeEvent: !0,
|
|
194
|
+
deleteEvent: !0,
|
|
195
|
+
editEvent: !0,
|
|
196
|
+
selectRange: !0,
|
|
197
|
+
createResource: !1,
|
|
198
|
+
updateResource: !1,
|
|
199
|
+
deleteResource: !1,
|
|
200
|
+
createGroup: !1
|
|
93
201
|
};
|
|
94
|
-
|
|
202
|
+
function R(i, e) {
|
|
203
|
+
if (e.readonly || e.permissions === !1 || !((typeof e.permissions == "object" && e.permissions !== null ? e.permissions : void 0)?.[i] ?? b[i])) return !1;
|
|
204
|
+
const r = e.event;
|
|
205
|
+
if (!r) return !0;
|
|
206
|
+
if (r.editable === !1) return !1;
|
|
207
|
+
switch (i) {
|
|
208
|
+
case "moveEvent":
|
|
209
|
+
return r.draggable !== !1;
|
|
210
|
+
case "resizeEvent":
|
|
211
|
+
return v(r.resizable, "start") || v(r.resizable, "end");
|
|
212
|
+
default:
|
|
213
|
+
return !0;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function O(i, e) {
|
|
217
|
+
return R("resizeEvent", e) ? v(e.event?.resizable, i) : !1;
|
|
218
|
+
}
|
|
219
|
+
function v(i, e) {
|
|
220
|
+
return i === !1 ? !1 : i && typeof i == "object" ? i[e] !== !1 : !0;
|
|
221
|
+
}
|
|
222
|
+
class k {
|
|
95
223
|
/**
|
|
96
224
|
* Get the start of the week for a given date
|
|
97
225
|
*/
|
|
98
226
|
getWeekStart(e, t = 1) {
|
|
99
|
-
const n = new Date(e),
|
|
100
|
-
return n.setDate(n.getDate() -
|
|
227
|
+
const n = new Date(e), r = n.getDay(), o = (r < t ? 7 : 0) + r - t;
|
|
228
|
+
return n.setDate(n.getDate() - o), n.setHours(0, 0, 0, 0), n;
|
|
101
229
|
}
|
|
102
230
|
/**
|
|
103
231
|
* Get all days in a week starting from a given date
|
|
104
232
|
*/
|
|
105
233
|
getWeekDays(e, t = 1) {
|
|
106
|
-
const n = this.getWeekStart(e, t),
|
|
107
|
-
for (let
|
|
108
|
-
const
|
|
109
|
-
|
|
234
|
+
const n = this.getWeekStart(e, t), r = [];
|
|
235
|
+
for (let o = 0; o < 7; o++) {
|
|
236
|
+
const s = new Date(n);
|
|
237
|
+
s.setDate(n.getDate() + o), r.push(s);
|
|
110
238
|
}
|
|
111
|
-
return
|
|
239
|
+
return r;
|
|
112
240
|
}
|
|
113
241
|
/**
|
|
114
242
|
* Get the start of the month for a given date
|
|
@@ -126,25 +254,25 @@ class T {
|
|
|
126
254
|
* Get all days in a month
|
|
127
255
|
*/
|
|
128
256
|
getMonthDays(e) {
|
|
129
|
-
const t = this.getMonthStart(e), n = this.getMonthEnd(e),
|
|
130
|
-
for (;
|
|
131
|
-
|
|
132
|
-
return
|
|
257
|
+
const t = this.getMonthStart(e), n = this.getMonthEnd(e), r = [], o = new Date(t);
|
|
258
|
+
for (; o <= n; )
|
|
259
|
+
r.push(new Date(o)), o.setDate(o.getDate() + 1);
|
|
260
|
+
return r;
|
|
133
261
|
}
|
|
134
262
|
/**
|
|
135
263
|
* Get weeks for a month view (includes days from adjacent months)
|
|
136
264
|
*/
|
|
137
265
|
getMonthWeeks(e, t = 1) {
|
|
138
|
-
const n = this.getMonthStart(e),
|
|
139
|
-
let a = new Date(
|
|
140
|
-
for (let
|
|
141
|
-
const
|
|
142
|
-
for (let
|
|
143
|
-
|
|
144
|
-
if (
|
|
266
|
+
const n = this.getMonthStart(e), r = this.getMonthEnd(e), o = this.getWeekStart(n, t), s = [];
|
|
267
|
+
let a = new Date(o);
|
|
268
|
+
for (let u = 0; u < 6; u++) {
|
|
269
|
+
const l = [];
|
|
270
|
+
for (let c = 0; c < 7; c++)
|
|
271
|
+
l.push(new Date(a)), a.setDate(a.getDate() + 1);
|
|
272
|
+
if (s.push(l), a > r && s.length >= 4)
|
|
145
273
|
break;
|
|
146
274
|
}
|
|
147
|
-
return
|
|
275
|
+
return s;
|
|
148
276
|
}
|
|
149
277
|
/**
|
|
150
278
|
* Get the start of the year for a given date
|
|
@@ -164,59 +292,59 @@ class T {
|
|
|
164
292
|
/**
|
|
165
293
|
* Get time slots for a day
|
|
166
294
|
*/
|
|
167
|
-
getTimeSlots(e, t = 1800, n = "00:00:00",
|
|
168
|
-
const
|
|
169
|
-
for (let
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
const m = new Date(
|
|
173
|
-
m.setSeconds(
|
|
295
|
+
getTimeSlots(e, t = 1800, n = "00:00:00", r = "24:00:00") {
|
|
296
|
+
const o = [], [s, a] = n.split(":").map(Number), [u, l] = r.split(":").map(Number), c = s * 3600 + a * 60, d = u * 3600 + l * 60;
|
|
297
|
+
for (let g = c; g < d; g += t) {
|
|
298
|
+
const h = new Date(e);
|
|
299
|
+
h.setHours(0, 0, 0, 0), h.setSeconds(g);
|
|
300
|
+
const m = new Date(h);
|
|
301
|
+
m.setSeconds(h.getSeconds() + t), o.push({ start: h, end: m });
|
|
174
302
|
}
|
|
175
|
-
return
|
|
303
|
+
return o;
|
|
176
304
|
}
|
|
177
305
|
/**
|
|
178
306
|
* Generate a scheduler grid for week view
|
|
179
307
|
*/
|
|
180
|
-
getWeekGrid(e, t = 1, n = 1800,
|
|
181
|
-
const a = this.getWeekDays(e, t),
|
|
182
|
-
for (const
|
|
183
|
-
const
|
|
184
|
-
for (const
|
|
185
|
-
const m = new Date(
|
|
186
|
-
m.setHours(
|
|
187
|
-
const D = new Date(
|
|
188
|
-
D.setHours(
|
|
189
|
-
const
|
|
190
|
-
|
|
308
|
+
getWeekGrid(e, t = 1, n = 1800, r = "00:00:00", o = "24:00:00", s = "24h") {
|
|
309
|
+
const a = this.getWeekDays(e, t), u = [], l = [], c = this.getTimeSlots(a[0], n, r, o);
|
|
310
|
+
for (const d of c) {
|
|
311
|
+
const g = [];
|
|
312
|
+
for (const h of a) {
|
|
313
|
+
const m = new Date(h);
|
|
314
|
+
m.setHours(d.start.getHours(), d.start.getMinutes(), 0, 0);
|
|
315
|
+
const D = new Date(h);
|
|
316
|
+
D.setHours(d.end.getHours(), d.end.getMinutes(), 0, 0);
|
|
317
|
+
const y = { start: m, end: D };
|
|
318
|
+
g.push(y), l.push(y);
|
|
191
319
|
}
|
|
192
|
-
|
|
193
|
-
time:
|
|
194
|
-
label: this.formatTime(
|
|
195
|
-
slots:
|
|
320
|
+
u.push({
|
|
321
|
+
time: d.start,
|
|
322
|
+
label: this.formatTime(d.start, s),
|
|
323
|
+
slots: g
|
|
196
324
|
});
|
|
197
325
|
}
|
|
198
|
-
return { columns: a, rows:
|
|
326
|
+
return { columns: a, rows: u, allSlots: l };
|
|
199
327
|
}
|
|
200
328
|
/**
|
|
201
329
|
* Round a date to the nearest slot
|
|
202
330
|
*/
|
|
203
331
|
roundToSlot(e, t) {
|
|
204
|
-
const n = e.getTime(),
|
|
205
|
-
return new Date(
|
|
332
|
+
const n = e.getTime(), r = t * 1e3, o = Math.round(n / r) * r;
|
|
333
|
+
return new Date(o);
|
|
206
334
|
}
|
|
207
335
|
/**
|
|
208
336
|
* Floor a date to the slot start
|
|
209
337
|
*/
|
|
210
338
|
floorToSlot(e, t) {
|
|
211
|
-
const n = e.getTime(),
|
|
212
|
-
return new Date(
|
|
339
|
+
const n = e.getTime(), r = t * 1e3, o = Math.floor(n / r) * r;
|
|
340
|
+
return new Date(o);
|
|
213
341
|
}
|
|
214
342
|
/**
|
|
215
343
|
* Ceiling a date to the slot end
|
|
216
344
|
*/
|
|
217
345
|
ceilToSlot(e, t) {
|
|
218
|
-
const n = e.getTime(),
|
|
219
|
-
return new Date(
|
|
346
|
+
const n = e.getTime(), r = t * 1e3, o = Math.ceil(n / r) * r;
|
|
347
|
+
return new Date(o);
|
|
220
348
|
}
|
|
221
349
|
/**
|
|
222
350
|
* Detect time format preference based on locale
|
|
@@ -234,12 +362,12 @@ class T {
|
|
|
234
362
|
* Format time according to format preference
|
|
235
363
|
*/
|
|
236
364
|
formatTime(e, t = "24h") {
|
|
237
|
-
const n = e.getHours(),
|
|
365
|
+
const n = e.getHours(), r = e.getMinutes();
|
|
238
366
|
if (t === "12h") {
|
|
239
|
-
const
|
|
240
|
-
return `${n % 12 || 12}:${
|
|
367
|
+
const o = n >= 12 ? "PM" : "AM";
|
|
368
|
+
return `${n % 12 || 12}:${r.toString().padStart(2, "0")} ${o}`;
|
|
241
369
|
}
|
|
242
|
-
return `${n.toString().padStart(2, "0")}:${
|
|
370
|
+
return `${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
|
|
243
371
|
}
|
|
244
372
|
/**
|
|
245
373
|
* Format date for display
|
|
@@ -304,8 +432,8 @@ class T {
|
|
|
304
432
|
getDaysDifference(e, t) {
|
|
305
433
|
const n = new Date(e);
|
|
306
434
|
n.setHours(0, 0, 0, 0);
|
|
307
|
-
const
|
|
308
|
-
return
|
|
435
|
+
const r = new Date(t);
|
|
436
|
+
return r.setHours(0, 0, 0, 0), Math.round((r.getTime() - n.getTime()) / (1e3 * 60 * 60 * 24));
|
|
309
437
|
}
|
|
310
438
|
/**
|
|
311
439
|
* Add days to a date
|
|
@@ -340,8 +468,8 @@ class T {
|
|
|
340
468
|
getWeekNumber(e) {
|
|
341
469
|
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())), n = t.getUTCDay() || 7;
|
|
342
470
|
t.setUTCDate(t.getUTCDate() + 4 - n);
|
|
343
|
-
const
|
|
344
|
-
return Math.ceil(((t.getTime() -
|
|
471
|
+
const r = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
|
|
472
|
+
return Math.ceil(((t.getTime() - r.getTime()) / 864e5 + 1) / 7);
|
|
345
473
|
}
|
|
346
474
|
/**
|
|
347
475
|
* Get seconds from midnight for a date
|
|
@@ -356,21 +484,21 @@ class T {
|
|
|
356
484
|
return Math.round((t.getTime() - e.getTime()) / 1e3);
|
|
357
485
|
}
|
|
358
486
|
}
|
|
359
|
-
const
|
|
360
|
-
class
|
|
487
|
+
const T = new k();
|
|
488
|
+
class I {
|
|
361
489
|
/**
|
|
362
490
|
* Split an event into daily parts
|
|
363
491
|
* Each part represents one day of a multi-day event
|
|
364
492
|
*/
|
|
365
493
|
splitInParts(e) {
|
|
366
494
|
const t = [];
|
|
367
|
-
let n = new Date(e.start),
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
370
|
-
const
|
|
495
|
+
let n = new Date(e.start), r = 0;
|
|
496
|
+
const o = this.getTotalDays(e.start, e.end);
|
|
497
|
+
if (T.isSameDay(e.start, e.end)) {
|
|
498
|
+
const s = "id" in e;
|
|
371
499
|
return t.push({
|
|
372
|
-
id:
|
|
373
|
-
event:
|
|
500
|
+
id: s ? `${e.id}-0` : "preview-0",
|
|
501
|
+
event: s ? e : null,
|
|
374
502
|
start: e.start,
|
|
375
503
|
end: e.end,
|
|
376
504
|
isStart: !0,
|
|
@@ -378,36 +506,36 @@ class E {
|
|
|
378
506
|
dayIndex: 0,
|
|
379
507
|
totalDays: 1
|
|
380
508
|
}), {
|
|
381
|
-
event:
|
|
509
|
+
event: s ? e : null,
|
|
382
510
|
parts: t
|
|
383
511
|
};
|
|
384
512
|
}
|
|
385
|
-
for (; !
|
|
386
|
-
const
|
|
387
|
-
|
|
513
|
+
for (; !T.isSameDay(n, e.end); ) {
|
|
514
|
+
const s = new Date(n);
|
|
515
|
+
s.setDate(s.getDate() + 1), s.setHours(0, 0, 0, 0);
|
|
388
516
|
const a = "id" in e;
|
|
389
517
|
t.push({
|
|
390
|
-
id: a ? `${e.id}-${
|
|
518
|
+
id: a ? `${e.id}-${r}` : `preview-${r}`,
|
|
391
519
|
event: a ? e : null,
|
|
392
520
|
start: new Date(n),
|
|
393
|
-
end:
|
|
394
|
-
isStart:
|
|
521
|
+
end: s,
|
|
522
|
+
isStart: r === 0,
|
|
395
523
|
isEnd: !1,
|
|
396
|
-
dayIndex:
|
|
397
|
-
totalDays:
|
|
398
|
-
}), n =
|
|
524
|
+
dayIndex: r,
|
|
525
|
+
totalDays: o
|
|
526
|
+
}), n = s, r++;
|
|
399
527
|
}
|
|
400
528
|
if (e.end.getHours() !== 0 || e.end.getMinutes() !== 0 || e.end.getSeconds() !== 0) {
|
|
401
|
-
const
|
|
529
|
+
const s = "id" in e;
|
|
402
530
|
t.push({
|
|
403
|
-
id:
|
|
404
|
-
event:
|
|
531
|
+
id: s ? `${e.id}-${r}` : `preview-${r}`,
|
|
532
|
+
event: s ? e : null,
|
|
405
533
|
start: new Date(n),
|
|
406
534
|
end: e.end,
|
|
407
535
|
isStart: !1,
|
|
408
536
|
isEnd: !0,
|
|
409
|
-
dayIndex:
|
|
410
|
-
totalDays:
|
|
537
|
+
dayIndex: r,
|
|
538
|
+
totalDays: o
|
|
411
539
|
});
|
|
412
540
|
}
|
|
413
541
|
return {
|
|
@@ -421,10 +549,10 @@ class E {
|
|
|
421
549
|
getTotalDays(e, t) {
|
|
422
550
|
const n = new Date(e);
|
|
423
551
|
n.setHours(0, 0, 0, 0);
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
const
|
|
427
|
-
return t.getHours() !== 0 || t.getMinutes() !== 0 || t.getSeconds() !== 0 ?
|
|
552
|
+
const r = new Date(t);
|
|
553
|
+
r.setHours(0, 0, 0, 0);
|
|
554
|
+
const o = r.getTime() - n.getTime(), s = Math.ceil(o / (1e3 * 60 * 60 * 24));
|
|
555
|
+
return t.getHours() !== 0 || t.getMinutes() !== 0 || t.getSeconds() !== 0 ? s + 1 : Math.max(1, s);
|
|
428
556
|
}
|
|
429
557
|
/**
|
|
430
558
|
* Assign events to tracks (rails) to minimize overlapping
|
|
@@ -434,13 +562,13 @@ class E {
|
|
|
434
562
|
if (e.length === 0)
|
|
435
563
|
return [];
|
|
436
564
|
const t = this.getUniqueTimestamps(e), n = [];
|
|
437
|
-
for (const
|
|
438
|
-
const
|
|
439
|
-
for (const
|
|
440
|
-
const a = n.find((
|
|
441
|
-
a ? a.events.push(
|
|
565
|
+
for (const r of t) {
|
|
566
|
+
const o = e.filter((s) => s.start.getTime() === r.getTime());
|
|
567
|
+
for (const s of o) {
|
|
568
|
+
const a = n.find((u) => this.isTrackFreeForEvent(u, s));
|
|
569
|
+
a ? a.events.push(s) : n.push({
|
|
442
570
|
index: n.length,
|
|
443
|
-
events: [
|
|
571
|
+
events: [s]
|
|
444
572
|
});
|
|
445
573
|
}
|
|
446
574
|
}
|
|
@@ -461,19 +589,19 @@ class E {
|
|
|
461
589
|
*/
|
|
462
590
|
getTimelinedParts(e) {
|
|
463
591
|
const t = /* @__PURE__ */ new Map();
|
|
464
|
-
for (const
|
|
465
|
-
|
|
466
|
-
const n = Array.from(t.values()),
|
|
467
|
-
return e.map((
|
|
468
|
-
if (!
|
|
469
|
-
return { part:
|
|
470
|
-
const
|
|
471
|
-
return
|
|
472
|
-
part:
|
|
473
|
-
trackIndex:
|
|
474
|
-
totalTracks:
|
|
475
|
-
colspan:
|
|
476
|
-
} : { part:
|
|
592
|
+
for (const o of e)
|
|
593
|
+
o.event && !t.has(o.event.id) && t.set(o.event.id, o.event);
|
|
594
|
+
const n = Array.from(t.values()), r = this.getColspanLayout(n);
|
|
595
|
+
return e.map((o) => {
|
|
596
|
+
if (!o.event)
|
|
597
|
+
return { part: o, trackIndex: 0, totalTracks: 1, colspan: 1 };
|
|
598
|
+
const s = r.get(o.event.id);
|
|
599
|
+
return s ? {
|
|
600
|
+
part: o,
|
|
601
|
+
trackIndex: s.col,
|
|
602
|
+
totalTracks: s.columnCount,
|
|
603
|
+
colspan: s.colspan
|
|
604
|
+
} : { part: o, trackIndex: 0, totalTracks: 1, colspan: 1 };
|
|
477
605
|
});
|
|
478
606
|
}
|
|
479
607
|
/**
|
|
@@ -488,14 +616,14 @@ class E {
|
|
|
488
616
|
if (e.length === 0)
|
|
489
617
|
return t;
|
|
490
618
|
const n = this.buildOverlapGroups(e);
|
|
491
|
-
for (const
|
|
492
|
-
const { assignments:
|
|
493
|
-
for (const a of
|
|
494
|
-
const
|
|
619
|
+
for (const r of n) {
|
|
620
|
+
const { assignments: o, columnCount: s } = this.assignColumns(r);
|
|
621
|
+
for (const a of r) {
|
|
622
|
+
const u = o.get(a.id) ?? 0, l = this.computeColspan(a, u, r, o, s);
|
|
495
623
|
t.set(a.id, {
|
|
496
|
-
col:
|
|
497
|
-
colspan:
|
|
498
|
-
columnCount:
|
|
624
|
+
col: u,
|
|
625
|
+
colspan: l,
|
|
626
|
+
columnCount: s
|
|
499
627
|
});
|
|
500
628
|
}
|
|
501
629
|
}
|
|
@@ -510,23 +638,23 @@ class E {
|
|
|
510
638
|
*/
|
|
511
639
|
buildOverlapGroups(e) {
|
|
512
640
|
if (e.length === 0) return [];
|
|
513
|
-
const t = [], n = /* @__PURE__ */ new Set(),
|
|
514
|
-
for (const
|
|
515
|
-
if (n.has(
|
|
516
|
-
const
|
|
517
|
-
let
|
|
518
|
-
for (;
|
|
519
|
-
const
|
|
520
|
-
if (n.has(
|
|
521
|
-
n.add(
|
|
522
|
-
const
|
|
523
|
-
for (const
|
|
524
|
-
if (!n.has(
|
|
525
|
-
if (
|
|
526
|
-
this.eventsOverlap(
|
|
641
|
+
const t = [], n = /* @__PURE__ */ new Set(), r = [...e].sort((o, s) => o.start.getTime() - s.start.getTime());
|
|
642
|
+
for (const o of r) {
|
|
643
|
+
if (n.has(o.id)) continue;
|
|
644
|
+
const s = [], a = [o];
|
|
645
|
+
let u = 0;
|
|
646
|
+
for (; u < a.length; ) {
|
|
647
|
+
const l = a[u++];
|
|
648
|
+
if (n.has(l.id)) continue;
|
|
649
|
+
n.add(l.id), s.push(l);
|
|
650
|
+
const c = l.end.getTime();
|
|
651
|
+
for (const d of r)
|
|
652
|
+
if (!n.has(d.id)) {
|
|
653
|
+
if (d.start.getTime() >= c) break;
|
|
654
|
+
this.eventsOverlap(l, d) && a.push(d);
|
|
527
655
|
}
|
|
528
656
|
}
|
|
529
|
-
t.push(
|
|
657
|
+
t.push(s);
|
|
530
658
|
}
|
|
531
659
|
return t;
|
|
532
660
|
}
|
|
@@ -537,31 +665,31 @@ class E {
|
|
|
537
665
|
*/
|
|
538
666
|
assignColumns(e) {
|
|
539
667
|
const t = /* @__PURE__ */ new Map(), n = [...e].sort(
|
|
540
|
-
(
|
|
541
|
-
),
|
|
542
|
-
for (const
|
|
543
|
-
let
|
|
544
|
-
for (let a = 0; a <
|
|
545
|
-
if (
|
|
546
|
-
|
|
668
|
+
(o, s) => o.start.getTime() - s.start.getTime() || o.end.getTime() - s.end.getTime() || o.id.localeCompare(s.id)
|
|
669
|
+
), r = [];
|
|
670
|
+
for (const o of n) {
|
|
671
|
+
let s = -1;
|
|
672
|
+
for (let a = 0; a < r.length; a++)
|
|
673
|
+
if (r[a] <= o.start.getTime()) {
|
|
674
|
+
s = a;
|
|
547
675
|
break;
|
|
548
676
|
}
|
|
549
|
-
|
|
677
|
+
s === -1 ? (s = r.length, r.push(o.end.getTime())) : r[s] = o.end.getTime(), t.set(o.id, s);
|
|
550
678
|
}
|
|
551
|
-
return { assignments: t, columnCount:
|
|
679
|
+
return { assignments: t, columnCount: r.length };
|
|
552
680
|
}
|
|
553
681
|
/**
|
|
554
682
|
* Compute colspan for an event
|
|
555
683
|
* An event can span multiple columns if there's no overlapping event to its right
|
|
556
684
|
*/
|
|
557
|
-
computeColspan(e, t, n,
|
|
558
|
-
let
|
|
685
|
+
computeColspan(e, t, n, r, o) {
|
|
686
|
+
let s = 1 / 0;
|
|
559
687
|
for (const a of n) {
|
|
560
688
|
if (a.id === e.id || !this.eventsOverlap(e, a)) continue;
|
|
561
|
-
const
|
|
562
|
-
|
|
689
|
+
const u = r.get(a.id) ?? 0;
|
|
690
|
+
u > t && (s = Math.min(s, u));
|
|
563
691
|
}
|
|
564
|
-
return
|
|
692
|
+
return s !== 1 / 0 ? s - t : o - t;
|
|
565
693
|
}
|
|
566
694
|
/**
|
|
567
695
|
* Check if two events overlap in time
|
|
@@ -574,29 +702,29 @@ class E {
|
|
|
574
702
|
* @deprecated Use getColspanLayout instead for better layout
|
|
575
703
|
*/
|
|
576
704
|
getRelativeTrackPosition(e, t, n) {
|
|
577
|
-
const
|
|
578
|
-
for (const
|
|
579
|
-
|
|
580
|
-
(
|
|
581
|
-
) &&
|
|
582
|
-
|
|
583
|
-
const
|
|
705
|
+
const r = [];
|
|
706
|
+
for (const s of e)
|
|
707
|
+
s.events.some(
|
|
708
|
+
(u) => u.start < t.end && u.end > t.start
|
|
709
|
+
) && r.push(s.index);
|
|
710
|
+
r.sort((s, a) => s - a);
|
|
711
|
+
const o = r.indexOf(n);
|
|
584
712
|
return {
|
|
585
|
-
relativeIndex:
|
|
586
|
-
overlappingCount: Math.max(1,
|
|
713
|
+
relativeIndex: o >= 0 ? o : 0,
|
|
714
|
+
overlappingCount: Math.max(1, r.length)
|
|
587
715
|
};
|
|
588
716
|
}
|
|
589
717
|
/**
|
|
590
718
|
* Filter events that fall within a date range
|
|
591
719
|
*/
|
|
592
720
|
filterByRange(e, t, n) {
|
|
593
|
-
return e.filter((
|
|
721
|
+
return e.filter((r) => r.start < n && r.end > t);
|
|
594
722
|
}
|
|
595
723
|
/**
|
|
596
724
|
* Filter event parts that fall within a date range
|
|
597
725
|
*/
|
|
598
726
|
filterPartsByRange(e, t, n) {
|
|
599
|
-
return e.filter((
|
|
727
|
+
return e.filter((r) => r.start < n && r.end > t);
|
|
600
728
|
}
|
|
601
729
|
/**
|
|
602
730
|
* Get all unique timestamps from events (both start and end times)
|
|
@@ -605,7 +733,7 @@ class E {
|
|
|
605
733
|
const t = /* @__PURE__ */ new Set();
|
|
606
734
|
for (const n of e)
|
|
607
735
|
t.add(n.start.getTime()), t.add(n.end.getTime());
|
|
608
|
-
return Array.from(t).sort((n,
|
|
736
|
+
return Array.from(t).sort((n, r) => n - r).map((n) => new Date(n));
|
|
609
737
|
}
|
|
610
738
|
/**
|
|
611
739
|
* Check if a track has space for an event (no overlapping)
|
|
@@ -619,8 +747,8 @@ class E {
|
|
|
619
747
|
getEventsForDay(e, t) {
|
|
620
748
|
const n = new Date(t);
|
|
621
749
|
n.setHours(0, 0, 0, 0);
|
|
622
|
-
const
|
|
623
|
-
return
|
|
750
|
+
const r = new Date(t);
|
|
751
|
+
return r.setHours(23, 59, 59, 999), this.filterByRange(e, n, r);
|
|
624
752
|
}
|
|
625
753
|
/**
|
|
626
754
|
* Get event parts for a specific day
|
|
@@ -628,31 +756,31 @@ class E {
|
|
|
628
756
|
getPartsForDay(e, t) {
|
|
629
757
|
const n = new Date(t);
|
|
630
758
|
n.setHours(0, 0, 0, 0);
|
|
631
|
-
const
|
|
632
|
-
return
|
|
759
|
+
const r = new Date(t);
|
|
760
|
+
return r.setHours(23, 59, 59, 999), this.filterPartsByRange(e, n, r);
|
|
633
761
|
}
|
|
634
762
|
}
|
|
635
|
-
const
|
|
636
|
-
class
|
|
763
|
+
const Y = new I();
|
|
764
|
+
class C {
|
|
637
765
|
/**
|
|
638
766
|
* Flatten a hierarchical resource structure for rendering
|
|
639
767
|
*/
|
|
640
|
-
flatten(e, t = /* @__PURE__ */ new Set(), n = 0,
|
|
641
|
-
const
|
|
768
|
+
flatten(e, t = /* @__PURE__ */ new Set(), n = 0, r, o = !1) {
|
|
769
|
+
const s = [];
|
|
642
770
|
for (const a of e) {
|
|
643
|
-
const
|
|
644
|
-
if (
|
|
645
|
-
const
|
|
771
|
+
const u = !o;
|
|
772
|
+
if (s.push({ item: a, depth: n, visible: u, parentId: r }), f(a)) {
|
|
773
|
+
const l = t.has(a.id), c = this.flatten(
|
|
646
774
|
a.children,
|
|
647
775
|
t,
|
|
648
776
|
n + 1,
|
|
649
777
|
a.id,
|
|
650
|
-
|
|
778
|
+
o || l
|
|
651
779
|
);
|
|
652
|
-
|
|
780
|
+
s.push(...c);
|
|
653
781
|
}
|
|
654
782
|
}
|
|
655
|
-
return
|
|
783
|
+
return s;
|
|
656
784
|
}
|
|
657
785
|
/**
|
|
658
786
|
* Get all resources (leaf nodes) from a hierarchical structure
|
|
@@ -664,11 +792,12 @@ class k {
|
|
|
664
792
|
return t;
|
|
665
793
|
}
|
|
666
794
|
/**
|
|
667
|
-
*
|
|
795
|
+
* @deprecated Since the scheduler normalized its event model, events are keyed
|
|
796
|
+
* by `resourceId` in one store — mutating a resource tree's nested `events` no
|
|
797
|
+
* longer drives what any view renders. Set `resourceId` on the event and update
|
|
798
|
+
* the `events` input instead. Unused by the component; kept to avoid a breaking
|
|
799
|
+
* removal, and slated for deletion in the next major.
|
|
668
800
|
*/
|
|
669
|
-
getAllEvents(e) {
|
|
670
|
-
return this.getAllResources(e).flatMap((n) => n.events ?? []);
|
|
671
|
-
}
|
|
672
801
|
/**
|
|
673
802
|
* Find a resource by ID
|
|
674
803
|
*/
|
|
@@ -677,8 +806,8 @@ class k {
|
|
|
677
806
|
if (p(n) && n.id === t)
|
|
678
807
|
return n;
|
|
679
808
|
if (f(n)) {
|
|
680
|
-
const
|
|
681
|
-
if (
|
|
809
|
+
const r = this.findResourceById(n.children, t);
|
|
810
|
+
if (r) return r;
|
|
682
811
|
}
|
|
683
812
|
}
|
|
684
813
|
}
|
|
@@ -689,8 +818,8 @@ class k {
|
|
|
689
818
|
for (const n of e)
|
|
690
819
|
if (f(n)) {
|
|
691
820
|
if (n.id === t) return n;
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
821
|
+
const r = this.findGroupById(n.children, t);
|
|
822
|
+
if (r) return r;
|
|
694
823
|
}
|
|
695
824
|
}
|
|
696
825
|
/**
|
|
@@ -700,52 +829,33 @@ class k {
|
|
|
700
829
|
return this.findResourceById(e, t) ?? this.findGroupById(e, t);
|
|
701
830
|
}
|
|
702
831
|
/**
|
|
703
|
-
*
|
|
832
|
+
* @deprecated Since the scheduler normalized its event model, events are keyed
|
|
833
|
+
* by `resourceId` in one store — mutating a resource tree's nested `events` no
|
|
834
|
+
* longer drives what any view renders. Set `resourceId` on the event and update
|
|
835
|
+
* the `events` input instead. Unused by the component; kept to avoid a breaking
|
|
836
|
+
* removal, and slated for deletion in the next major.
|
|
704
837
|
*/
|
|
705
|
-
addEventToResource(e, t, n) {
|
|
706
|
-
return this.mapResources(e, (s) => s.id === t ? {
|
|
707
|
-
...s,
|
|
708
|
-
events: [...s.events ?? [], n]
|
|
709
|
-
} : s);
|
|
710
|
-
}
|
|
711
838
|
/**
|
|
712
|
-
*
|
|
839
|
+
* @deprecated Since the scheduler normalized its event model, events are keyed
|
|
840
|
+
* by `resourceId` in one store — mutating a resource tree's nested `events` no
|
|
841
|
+
* longer drives what any view renders. Set `resourceId` on the event and update
|
|
842
|
+
* the `events` input instead. Unused by the component; kept to avoid a breaking
|
|
843
|
+
* removal, and slated for deletion in the next major.
|
|
713
844
|
*/
|
|
714
|
-
updateEventInResource(e, t) {
|
|
715
|
-
return this.mapResources(e, (n) => {
|
|
716
|
-
const s = n.events?.findIndex((r) => r.id === t.id);
|
|
717
|
-
if (s !== void 0 && s >= 0 && n.events) {
|
|
718
|
-
const r = [...n.events];
|
|
719
|
-
return r[s] = t, { ...n, events: r };
|
|
720
|
-
}
|
|
721
|
-
return n;
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
845
|
/**
|
|
725
|
-
*
|
|
846
|
+
* @deprecated Since the scheduler normalized its event model, events are keyed
|
|
847
|
+
* by `resourceId` in one store — mutating a resource tree's nested `events` no
|
|
848
|
+
* longer drives what any view renders. Set `resourceId` on the event and update
|
|
849
|
+
* the `events` input instead. Unused by the component; kept to avoid a breaking
|
|
850
|
+
* removal, and slated for deletion in the next major.
|
|
726
851
|
*/
|
|
727
|
-
removeEvent(e, t) {
|
|
728
|
-
return this.mapResources(e, (n) => n.events?.some((s) => s.id === t) ? {
|
|
729
|
-
...n,
|
|
730
|
-
events: n.events.filter((s) => s.id !== t)
|
|
731
|
-
} : n);
|
|
732
|
-
}
|
|
733
852
|
/**
|
|
734
|
-
*
|
|
853
|
+
* @deprecated Since the scheduler normalized its event model, events are keyed
|
|
854
|
+
* by `resourceId` in one store — mutating a resource tree's nested `events` no
|
|
855
|
+
* longer drives what any view renders. Set `resourceId` on the event and update
|
|
856
|
+
* the `events` input instead. Unused by the component; kept to avoid a breaking
|
|
857
|
+
* removal, and slated for deletion in the next major.
|
|
735
858
|
*/
|
|
736
|
-
moveEventToResource(e, t, n, s) {
|
|
737
|
-
let r;
|
|
738
|
-
for (const i of this.getAllResources(e))
|
|
739
|
-
if (r = i.events?.find((c) => c.id === t), r) break;
|
|
740
|
-
if (!r) return e;
|
|
741
|
-
const o = {
|
|
742
|
-
...r,
|
|
743
|
-
...s,
|
|
744
|
-
resourceId: n
|
|
745
|
-
};
|
|
746
|
-
let a = this.removeEvent(e, t);
|
|
747
|
-
return a = this.addEventToResource(a, n, o), a;
|
|
748
|
-
}
|
|
749
859
|
/**
|
|
750
860
|
* Toggle collapse state of a group
|
|
751
861
|
*/
|
|
@@ -756,7 +866,7 @@ class k {
|
|
|
756
866
|
* Set collapse state of a group
|
|
757
867
|
*/
|
|
758
868
|
setGroupCollapse(e, t, n) {
|
|
759
|
-
return this.mapGroups(e, (
|
|
869
|
+
return this.mapGroups(e, (r) => r.id === t ? { ...r, collapsed: n } : r);
|
|
760
870
|
}
|
|
761
871
|
/**
|
|
762
872
|
* Collapse all groups
|
|
@@ -785,10 +895,10 @@ class k {
|
|
|
785
895
|
mapGroups(e, t) {
|
|
786
896
|
return e.map((n) => {
|
|
787
897
|
if (f(n)) {
|
|
788
|
-
const
|
|
898
|
+
const r = t(n);
|
|
789
899
|
return {
|
|
790
|
-
...
|
|
791
|
-
children: this.mapGroups(
|
|
900
|
+
...r,
|
|
901
|
+
children: this.mapGroups(r.children, t)
|
|
792
902
|
};
|
|
793
903
|
}
|
|
794
904
|
return n;
|
|
@@ -798,102 +908,58 @@ class k {
|
|
|
798
908
|
* Get the total count of visible resources
|
|
799
909
|
*/
|
|
800
910
|
getVisibleResourceCount(e, t = /* @__PURE__ */ new Set()) {
|
|
801
|
-
return this.flatten(e, t).filter((
|
|
911
|
+
return this.flatten(e, t).filter((r) => r.visible && p(r.item)).length;
|
|
802
912
|
}
|
|
803
913
|
/**
|
|
804
914
|
* Sort resources by order property
|
|
805
915
|
*/
|
|
806
916
|
sortByOrder(e) {
|
|
807
|
-
return [...e].sort((n,
|
|
917
|
+
return [...e].sort((n, r) => (n.order ?? 0) - (r.order ?? 0)).map((n) => f(n) ? {
|
|
808
918
|
...n,
|
|
809
919
|
children: this.sortByOrder(n.children)
|
|
810
920
|
} : n);
|
|
811
921
|
}
|
|
812
922
|
}
|
|
813
|
-
const
|
|
814
|
-
function
|
|
923
|
+
const B = new C();
|
|
924
|
+
function S(i = "evt") {
|
|
815
925
|
const e = Date.now().toString(36), t = Math.random().toString(36).substring(2, 9);
|
|
816
|
-
return `${
|
|
817
|
-
}
|
|
818
|
-
function F() {
|
|
819
|
-
return v("evt");
|
|
820
|
-
}
|
|
821
|
-
function H() {
|
|
822
|
-
return v("res");
|
|
823
|
-
}
|
|
824
|
-
function $() {
|
|
825
|
-
return v("grp");
|
|
826
|
-
}
|
|
827
|
-
const M = [
|
|
828
|
-
"#3788d8",
|
|
829
|
-
// Blue
|
|
830
|
-
"#28a745",
|
|
831
|
-
// Green
|
|
832
|
-
"#dc3545",
|
|
833
|
-
// Red
|
|
834
|
-
"#ffc107",
|
|
835
|
-
// Yellow
|
|
836
|
-
"#17a2b8",
|
|
837
|
-
// Cyan
|
|
838
|
-
"#6f42c1",
|
|
839
|
-
// Purple
|
|
840
|
-
"#fd7e14",
|
|
841
|
-
// Orange
|
|
842
|
-
"#20c997",
|
|
843
|
-
// Teal
|
|
844
|
-
"#e83e8c",
|
|
845
|
-
// Pink
|
|
846
|
-
"#6c757d"
|
|
847
|
-
// Gray
|
|
848
|
-
];
|
|
849
|
-
function G(u) {
|
|
850
|
-
return M[u % M.length];
|
|
851
|
-
}
|
|
852
|
-
function U(u) {
|
|
853
|
-
let e = u.replace("#", "");
|
|
854
|
-
e.length === 3 && (e = e.split("").map((o) => o + o).join(""));
|
|
855
|
-
const t = parseInt(e.substring(0, 2), 16), n = parseInt(e.substring(2, 4), 16), s = parseInt(e.substring(4, 6), 16);
|
|
856
|
-
return (0.299 * t + 0.587 * n + 0.114 * s) / 255 > 0.5 ? "#000000" : "#ffffff";
|
|
926
|
+
return `${i}-${e}-${t}`;
|
|
857
927
|
}
|
|
858
|
-
function
|
|
859
|
-
|
|
860
|
-
t.length === 3 && (t = t.split("").map((c) => c + c).join(""));
|
|
861
|
-
const n = parseInt(t.substring(0, 2), 16), s = parseInt(t.substring(2, 4), 16), r = parseInt(t.substring(4, 6), 16), o = Math.min(255, Math.round(n + (255 - n) * (e / 100))), a = Math.min(255, Math.round(s + (255 - s) * (e / 100))), i = Math.min(255, Math.round(r + (255 - r) * (e / 100)));
|
|
862
|
-
return `#${o.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}`;
|
|
928
|
+
function W() {
|
|
929
|
+
return S("evt");
|
|
863
930
|
}
|
|
864
|
-
function
|
|
865
|
-
|
|
866
|
-
t.length === 3 && (t = t.split("").map((c) => c + c).join(""));
|
|
867
|
-
const n = parseInt(t.substring(0, 2), 16), s = parseInt(t.substring(2, 4), 16), r = parseInt(t.substring(4, 6), 16), o = Math.max(0, Math.round(n * (1 - e / 100))), a = Math.max(0, Math.round(s * (1 - e / 100))), i = Math.max(0, Math.round(r * (1 - e / 100)));
|
|
868
|
-
return `#${o.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}`;
|
|
931
|
+
function N() {
|
|
932
|
+
return S("res");
|
|
869
933
|
}
|
|
870
|
-
function
|
|
871
|
-
|
|
872
|
-
t.length === 3 && (t = t.split("").map((o) => o + o).join(""));
|
|
873
|
-
const n = parseInt(t.substring(0, 2), 16), s = parseInt(t.substring(2, 4), 16), r = parseInt(t.substring(4, 6), 16);
|
|
874
|
-
return `rgba(${n}, ${s}, ${r}, ${e})`;
|
|
934
|
+
function z() {
|
|
935
|
+
return S("grp");
|
|
875
936
|
}
|
|
876
937
|
export {
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
938
|
+
P as D,
|
|
939
|
+
C as R,
|
|
940
|
+
I as T,
|
|
880
941
|
M as a,
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
942
|
+
E as b,
|
|
943
|
+
w as c,
|
|
944
|
+
T as d,
|
|
945
|
+
b as e,
|
|
946
|
+
k as f,
|
|
947
|
+
U as g,
|
|
948
|
+
A as h,
|
|
949
|
+
x as i,
|
|
950
|
+
W as j,
|
|
951
|
+
z as k,
|
|
952
|
+
S as l,
|
|
953
|
+
N as m,
|
|
954
|
+
F as n,
|
|
955
|
+
G as o,
|
|
956
|
+
p,
|
|
957
|
+
f as q,
|
|
958
|
+
H as r,
|
|
959
|
+
R as s,
|
|
960
|
+
$ as t,
|
|
961
|
+
L as u,
|
|
962
|
+
O as v,
|
|
963
|
+
B as w,
|
|
964
|
+
Y as x
|
|
899
965
|
};
|