@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
|
@@ -27,8 +27,54 @@ export declare class MpScheduler extends LitElement {
|
|
|
27
27
|
private latestDragState;
|
|
28
28
|
private boundHandleKeyDown;
|
|
29
29
|
private boundHandleFocusIn;
|
|
30
|
+
private boundHandleValueChange;
|
|
31
|
+
private boundHandleContextMenu;
|
|
32
|
+
private boundHandleDblClick;
|
|
33
|
+
private boundRepositionEditor;
|
|
30
34
|
private nowIndicatorTimer;
|
|
31
35
|
private readonly liveAnnouncer;
|
|
36
|
+
/** Day the date popover is open for, or null when it is closed. */
|
|
37
|
+
private popoverDate;
|
|
38
|
+
/**
|
|
39
|
+
* What the popover lists: one day (month view, or a year mini-day click) or
|
|
40
|
+
* a whole month grouped by day (Space on a year month card, whose focus unit
|
|
41
|
+
* IS the month).
|
|
42
|
+
*/
|
|
43
|
+
private popoverScope;
|
|
44
|
+
/**
|
|
45
|
+
* Element id of the anchor — resolved lazily on every positioning pass, see
|
|
46
|
+
* `openDayPopover`. A full id rather than a date key because the anchor is
|
|
47
|
+
* view-specific: a month day cell (`scheduler-cell-m-…`) or a year month
|
|
48
|
+
* card (`scheduler-cell-y-…`). Year mini-days are deliberately not focusable
|
|
49
|
+
* (screen readers describe months, not days), so in year view the CARD is
|
|
50
|
+
* the anchor and the focus-return target.
|
|
51
|
+
*/
|
|
52
|
+
private popoverAnchorId;
|
|
53
|
+
private boundRepositionPopover;
|
|
54
|
+
/**
|
|
55
|
+
* The month day popover. Not modal: the grid behind stays operable, Escape and
|
|
56
|
+
* outside clicks dismiss through the shared dismiss stack, and focus lands on
|
|
57
|
+
* the first control inside so the dialog is announced instead of opening
|
|
58
|
+
* silently behind the user's focus.
|
|
59
|
+
*/
|
|
60
|
+
private readonly dayPopover;
|
|
61
|
+
/** Event the built-in editor is open for, or null when it is closed. */
|
|
62
|
+
private editorEventId;
|
|
63
|
+
/**
|
|
64
|
+
* Inline validation message currently shown in the editor, and WHICH field
|
|
65
|
+
* it is about (D12.14). The field matters: the message is spoken by moving
|
|
66
|
+
* focus to the offending control, whose own description carries it — there
|
|
67
|
+
* is no live region involved, so an unattributed message would be silent.
|
|
68
|
+
*/
|
|
69
|
+
private editorError;
|
|
70
|
+
private readonly editorTitleErrorId;
|
|
71
|
+
/**
|
|
72
|
+
* The built-in event editor (R20/D12.8): a non-modal dialog anchored to the
|
|
73
|
+
* event's own element, resolved lazily by event id — the views rebuild their
|
|
74
|
+
* DOM imperatively, so a captured element would detach under the panel.
|
|
75
|
+
* Same mechanics and traps as the day popover above.
|
|
76
|
+
*/
|
|
77
|
+
private readonly eventEditorOverlay;
|
|
32
78
|
constructor();
|
|
33
79
|
connectedCallback(): void;
|
|
34
80
|
disconnectedCallback(): void;
|
|
@@ -37,6 +83,25 @@ export declare class MpScheduler extends LitElement {
|
|
|
37
83
|
set view(value: ViewType);
|
|
38
84
|
get date(): Date;
|
|
39
85
|
set date(value: Date);
|
|
86
|
+
/**
|
|
87
|
+
* Coarse read-only switch, outranking `options.permissions` entirely.
|
|
88
|
+
*
|
|
89
|
+
* Property and attribute are the same state, deliberately: a JS consumer
|
|
90
|
+
* writes `el.readonly = true`, a plain-HTML or SSR consumer writes the
|
|
91
|
+
* attribute, and a framework wrapper can bridge whichever it has. Absence is
|
|
92
|
+
* editable; `readonly="false"` opts back out so the attribute can be rendered
|
|
93
|
+
* unconditionally with a computed value.
|
|
94
|
+
*/
|
|
95
|
+
get readonly(): boolean;
|
|
96
|
+
set readonly(value: boolean);
|
|
97
|
+
/**
|
|
98
|
+
* The built-in event editor's on/off switch (default ON). Attribute and
|
|
99
|
+
* property are the same state, like `readonly`: the ATTRIBUTE (`event-editor`)
|
|
100
|
+
* outranks `options.eventEditor`, and only the literal `"false"` disables —
|
|
101
|
+
* so a wrapper can render the attribute unconditionally from a boolean.
|
|
102
|
+
*/
|
|
103
|
+
get eventEditor(): boolean;
|
|
104
|
+
set eventEditor(value: boolean);
|
|
40
105
|
get events(): SchedulerEvent[];
|
|
41
106
|
set events(value: SchedulerEvent[]);
|
|
42
107
|
get resources(): (Resource | ResourceGroup)[];
|
|
@@ -74,6 +139,238 @@ export declare class MpScheduler extends LitElement {
|
|
|
74
139
|
*/
|
|
75
140
|
private msg;
|
|
76
141
|
render(): TemplateResult;
|
|
142
|
+
/**
|
|
143
|
+
* Day popover for the month view: the day's events plus the two things a user
|
|
144
|
+
* wants from a date they just clicked — create here, or open the day.
|
|
145
|
+
*
|
|
146
|
+
* A sibling of `.scheduler-container`, NOT a child of `.scheduler-content`:
|
|
147
|
+
* the panel is `position: fixed`, so any ancestor with `transform`, `filter`
|
|
148
|
+
* or `contain` would silently become its containing block and the coordinates
|
|
149
|
+
* the OverlayController computes would be wrong. Keep it out here.
|
|
150
|
+
*
|
|
151
|
+
* `role="dialog"` with `modal: false` and no `aria-modal`: the month grid
|
|
152
|
+
* behind it stays perfectly usable, and claiming modality would hide a page
|
|
153
|
+
* that is still visible. It emits NO new event types — activating an entry
|
|
154
|
+
* is `event-selected`, "New event" is `event-create`, "Show day" is the same
|
|
155
|
+
* drill the "+N more" link used to do.
|
|
156
|
+
*/
|
|
157
|
+
private renderDayPopover;
|
|
158
|
+
private renderPopoverEvent;
|
|
159
|
+
/**
|
|
160
|
+
* The pointer face of the Delete key (R14): before this, `event-delete` was
|
|
161
|
+
* keyboard-only. A SIBLING of the event button — event boxes and popover
|
|
162
|
+
* entries are buttons themselves, so a delete control inside one would be a
|
|
163
|
+
* nested interactive.
|
|
164
|
+
*
|
|
165
|
+
* The popover stays open: `event-delete` is a request, and whether the row
|
|
166
|
+
* disappears is the consumer's call (their listener owns the data, and any
|
|
167
|
+
* confirm/undo). Focus is parked on the next row by INDEX before the list
|
|
168
|
+
* re-renders — the deleted row's button is about to vanish, and focus falling
|
|
169
|
+
* to <body> would dump a keyboard user out of the dialog.
|
|
170
|
+
*/
|
|
171
|
+
private deleteFromPopover;
|
|
172
|
+
/**
|
|
173
|
+
* The month-scoped list: events grouped under a heading per day, each event
|
|
174
|
+
* listed once under the day it starts (clamped to the month, so an event
|
|
175
|
+
* running in from last month sits under the 1st rather than vanishing).
|
|
176
|
+
*/
|
|
177
|
+
private renderPopoverDayGroups;
|
|
178
|
+
/**
|
|
179
|
+
* The cell/card the popover hangs off, resolved by element id on every call.
|
|
180
|
+
* The views rebuild their cells imperatively, so a cached element would be
|
|
181
|
+
* detached the moment anything re-renders while the popover is open.
|
|
182
|
+
*/
|
|
183
|
+
private popoverAnchorCell;
|
|
184
|
+
/**
|
|
185
|
+
* The anchor for a popover opened for `day` in the current view: the day's
|
|
186
|
+
* own cell in month view, its month CARD in year view. Every other view has
|
|
187
|
+
* no date-keyed cell — the popover is a month/year surface only.
|
|
188
|
+
*/
|
|
189
|
+
private defaultPopoverAnchorId;
|
|
190
|
+
/** Every event overlapping the given local day, in start order. */
|
|
191
|
+
private eventsOnDay;
|
|
192
|
+
/**
|
|
193
|
+
* Open the date popover for `day`. Anchored on an element resolved LAZILY by
|
|
194
|
+
* id: the views rebuild their DOM imperatively, so a captured element
|
|
195
|
+
* reference would be detached by the next render while the popover is open.
|
|
196
|
+
*
|
|
197
|
+
* `anchorId` overrides the default when the caller knows better — a year
|
|
198
|
+
* mini-day belonging to an ADJACENT month must anchor on the card it was
|
|
199
|
+
* clicked in, which is not the card its own month key names.
|
|
200
|
+
*/
|
|
201
|
+
private openDayPopover;
|
|
202
|
+
private closeDayPopover;
|
|
203
|
+
private selectFromPopover;
|
|
204
|
+
private createFromPopover;
|
|
205
|
+
/** "Show day" / "Show month" — the drill that matches the popover's scope. */
|
|
206
|
+
private drillFromPopover;
|
|
207
|
+
/** Every event overlapping `day`'s local month, in start order. */
|
|
208
|
+
private eventsInMonth;
|
|
209
|
+
/** The rendered element of an event, by id — never the drag ghost. */
|
|
210
|
+
private eventElementById;
|
|
211
|
+
/**
|
|
212
|
+
* The editor opens when ANY of its fields is permitted for this event
|
|
213
|
+
* (D12.8c) — an all-disabled form is worse than no form. `readonly` and
|
|
214
|
+
* per-event `editable: false` zero every capability, so they kill it
|
|
215
|
+
* wholesale through the same resolver as everything else.
|
|
216
|
+
*/
|
|
217
|
+
private canOpenEditor;
|
|
218
|
+
/**
|
|
219
|
+
* Which of the editor's time fields are live, and what a start change MEANS
|
|
220
|
+
* — the single place that answers both (D12.13).
|
|
221
|
+
*
|
|
222
|
+
* | `moveEvent` | `resizeEvent` | start | end | a start change… |
|
|
223
|
+
* |---|---|---|---|---|
|
|
224
|
+
* | ✓ | ✓ | on | on | shifts both (a move) |
|
|
225
|
+
* | ✓ | ✗ | on | off | shifts both (a move) |
|
|
226
|
+
* | ✗ | ✓ | on | on | resizes the start alone, clamped |
|
|
227
|
+
* | ✗ | ✗ | off | off | — |
|
|
228
|
+
*
|
|
229
|
+
* Editing the END alone is *by definition* a resize, so that field follows
|
|
230
|
+
* `resizeEvent`. Editing the START is a move where one is permitted and a
|
|
231
|
+
* start-resize otherwise. Row 2 closes a leak that predates this: with
|
|
232
|
+
* `moveEvent: true, resizable: false` the editor used to commit a pure
|
|
233
|
+
* duration change that `resizable: false` forbids.
|
|
234
|
+
*
|
|
235
|
+
* `canResize` folds the per-item `{ start, end }` form as **both** edges, so
|
|
236
|
+
* `resizable: { start: false, end: true }` locks the editor's time fields
|
|
237
|
+
* while the end *handle* keeps working — honest, and with no way to commit a
|
|
238
|
+
* half-applied range (B35). Both edges are therefore always writable
|
|
239
|
+
* together or not at all, which is what makes the single `if` at save
|
|
240
|
+
* correct rather than coincidental.
|
|
241
|
+
*/
|
|
242
|
+
private editorTimeFields;
|
|
243
|
+
private tryOpenEventEditor;
|
|
244
|
+
private closeEventEditor;
|
|
245
|
+
/** Right-click on an event box opens the editor (D12.8b). */
|
|
246
|
+
private handleContextMenu;
|
|
247
|
+
/**
|
|
248
|
+
* Minute granularity for the editor's time lists, derived from the grid's own
|
|
249
|
+
* `slotDuration` so the two agree — picking a time the grid cannot represent
|
|
250
|
+
* would be its own small lie. Clamped to the picker's supported steps.
|
|
251
|
+
*/
|
|
252
|
+
private pickerStep;
|
|
253
|
+
private renderEventEditor;
|
|
254
|
+
/**
|
|
255
|
+
* "Inherit from resource" drives the swatch's enabled state: while inheriting,
|
|
256
|
+
* the swatch shows WHAT is inherited but cannot be committed, so there is no
|
|
257
|
+
* gesture that silently overrides. Toggled in the DOM rather than through a
|
|
258
|
+
* re-render on purpose — a re-render would re-run the sibling fields' value
|
|
259
|
+
* bindings and could discard a title the user has typed but not saved.
|
|
260
|
+
*/
|
|
261
|
+
private toggleEditorColorInherit;
|
|
262
|
+
/**
|
|
263
|
+
* The editor's WORKING COPY — what the user has typed and picked so far,
|
|
264
|
+
* held in component state instead of being read back out of the DOM when
|
|
265
|
+
* Save runs.
|
|
266
|
+
*
|
|
267
|
+
* This is the fix for B31, not a tidiness exercise. The panel's controls are
|
|
268
|
+
* Lit bindings fed from the STORED event, and the scheduler re-renders on any
|
|
269
|
+
* state change — including the one that a mousedown on Save itself provokes.
|
|
270
|
+
* The controls were therefore reset to the stored values *between mousedown
|
|
271
|
+
* and click*, and Save, which scraped the DOM, committed those stale values
|
|
272
|
+
* and silently discarded the edit. With the draft as the single authority for
|
|
273
|
+
* both the render and the commit, a re-render can no longer lose an edit.
|
|
274
|
+
* Keyboard move-mode has always worked this way (`keyboardMove`).
|
|
275
|
+
*/
|
|
276
|
+
private editorDraft;
|
|
277
|
+
/** Merge a change into the draft and re-render the panel from it. */
|
|
278
|
+
private updateEditorDraft;
|
|
279
|
+
private editorErrorFieldTouched;
|
|
280
|
+
/**
|
|
281
|
+
* Changing the START moves the event: the end shifts by the same delta, so
|
|
282
|
+
* the duration is preserved (B30/D12.10). This is the contract every other
|
|
283
|
+
* path already implements — a pointer move-drag applies one offset to both
|
|
284
|
+
* edges, and so does keyboard move-mode. Without it, moving an event later
|
|
285
|
+
* in the editor hit "End must be after start" and refused to do anything,
|
|
286
|
+
* which is a dead end on the field a user edits first.
|
|
287
|
+
*
|
|
288
|
+
* Changing the END is left alone: that is a resize, and the only way to
|
|
289
|
+
* express one here.
|
|
290
|
+
*
|
|
291
|
+
* A corollary worth stating, because the opposite looks like an oversight:
|
|
292
|
+
* while it is a move, the START picker carries NO `max`. Duration is an
|
|
293
|
+
* invariant of that transform, so a valid draft stays valid after any start
|
|
294
|
+
* change in either direction — start-after-end is unreachable, and a bound
|
|
295
|
+
* there would only refuse legitimate picks (D12.12/F1).
|
|
296
|
+
*
|
|
297
|
+
* When the user may resize but NOT move (D12.13's row 3), a start change is
|
|
298
|
+
* a start-RESIZE instead: the end holds still and the start is clamped to
|
|
299
|
+
* one slot before it, mirroring the end field's clamp. The draft cannot
|
|
300
|
+
* invert either way, so the two semantics differ only in what they mean.
|
|
301
|
+
*/
|
|
302
|
+
private onEditorStartChange;
|
|
303
|
+
/**
|
|
304
|
+
* The end alone is a RESIZE — it never drags the start with it.
|
|
305
|
+
*
|
|
306
|
+
* It is also the only edge that can invert the range (D12.12): a start
|
|
307
|
+
* change preserves duration, so it keeps a valid draft valid, but an end
|
|
308
|
+
* can be picked before the start. The END picker therefore carries
|
|
309
|
+
* `min = draft.start`, which the CALENDAR half honours date-only — exactly
|
|
310
|
+
* the wanted semantic, since "the same day" must stay fully selectable —
|
|
311
|
+
* and this clamp covers what a bound cannot: the same-day-earlier-time
|
|
312
|
+
* case, and the picker's Today/Now buttons, which ignore bounds entirely.
|
|
313
|
+
*
|
|
314
|
+
* Clamping the field the user just edited is deliberate. Adjusting the
|
|
315
|
+
* OTHER edge instead would change a control they are not focused on
|
|
316
|
+
* (a WCAG 3.2.2 hazard); this corrects their own field and says so.
|
|
317
|
+
*
|
|
318
|
+
* The floor is one grid slot, matching keyboard resize — the editor could
|
|
319
|
+
* otherwise commit a 1-minute event on a 30-minute grid, which no direct
|
|
320
|
+
* gesture can produce.
|
|
321
|
+
*/
|
|
322
|
+
private onEditorEndChange;
|
|
323
|
+
/**
|
|
324
|
+
* The editor's inherit checkbox. `<mp-checkbox>` rather than a bare input so
|
|
325
|
+
* it carries Bootstrap's `.form-check` styling into this shadow root; its
|
|
326
|
+
* `checked`/`disabled` are host properties, so it is read like a native one —
|
|
327
|
+
* but it is NOT an `HTMLInputElement`, hence its own accessor.
|
|
328
|
+
*/
|
|
329
|
+
private editorInheritCheckbox;
|
|
330
|
+
/**
|
|
331
|
+
* Save = the same `event-update` request a committed drag emits, so the
|
|
332
|
+
* consumer's existing handler applies it unchanged. Only fields whose inputs
|
|
333
|
+
* were ENABLED are read back — a disabled field keeps the event's value, so
|
|
334
|
+
* a permission can never be bypassed by a form submit. Validation stays
|
|
335
|
+
* minimal (end > start, non-empty title): the WC owns no data; anything
|
|
336
|
+
* richer belongs in the consumer's listener.
|
|
337
|
+
*/
|
|
338
|
+
private saveEventEditor;
|
|
339
|
+
/**
|
|
340
|
+
* Refuse a Save, and make sure the reason is spoken EXACTLY once (D12.14).
|
|
341
|
+
*
|
|
342
|
+
* The message goes to one channel only — the offending control's own
|
|
343
|
+
* accessible description — and is delivered by moving focus there. It used
|
|
344
|
+
* to go to two (a `role="alert"` node AND the polite live announcer), which
|
|
345
|
+
* screen readers speak twice, often at two different urgencies. The
|
|
346
|
+
* announcer is the wrong channel here for a second reason: it self-clears
|
|
347
|
+
* after 1.5 s, so it cannot hold a message the user may want to re-read,
|
|
348
|
+
* which is exactly what a validation error is. It stays on the SUCCESS
|
|
349
|
+
* path, where the message is transient by nature.
|
|
350
|
+
*
|
|
351
|
+
* Focus has to move for the same reason: with no live region, a description
|
|
352
|
+
* is silent until something lands on the control it describes.
|
|
353
|
+
*/
|
|
354
|
+
private refuseSave;
|
|
355
|
+
/** Mouse face of the rename: double-click the title span. */
|
|
356
|
+
private handleNativeDblClick;
|
|
357
|
+
/**
|
|
358
|
+
* Swap a resource/group title for an inline input — file-manager's proven
|
|
359
|
+
* idiom, keys included: Enter commits, Escape cancels, blur commits. The
|
|
360
|
+
* commit is a `resource-update` request carrying `{ title }`; the consumer
|
|
361
|
+
* applies it (the same contract as the colour swatch). No re-render happens
|
|
362
|
+
* while the input is open — nothing writes state until commit — so the input
|
|
363
|
+
* cannot be torn down mid-word.
|
|
364
|
+
*/
|
|
365
|
+
private beginResourceRename;
|
|
366
|
+
/** The in-grid pointer delete (D12.4b's revised home). */
|
|
367
|
+
private deleteFromEditor;
|
|
368
|
+
/**
|
|
369
|
+
* Route a "+N more" activation through `options.moreLinkBehavior`. Returns the
|
|
370
|
+
* date to drill to when the caller should navigate, or null when the behaviour
|
|
371
|
+
* has already been handled here.
|
|
372
|
+
*/
|
|
373
|
+
private handleMoreLink;
|
|
77
374
|
protected firstUpdated(): void;
|
|
78
375
|
private populateHeader;
|
|
79
376
|
private updateTitle;
|
|
@@ -94,8 +391,34 @@ export declare class MpScheduler extends LitElement {
|
|
|
94
391
|
private updateUI;
|
|
95
392
|
private scheduleDragUpdate;
|
|
96
393
|
private handlePointerDown;
|
|
394
|
+
private allowsGesture;
|
|
97
395
|
private handlePointerMove;
|
|
98
396
|
private handlePointerUp;
|
|
397
|
+
/** Distance from a scroller edge at which auto-scroll engages. */
|
|
398
|
+
private static readonly EDGE_SCROLL_ZONE_PX;
|
|
399
|
+
/** Fastest scroll step, in px per frame, reached at the very edge. */
|
|
400
|
+
private static readonly EDGE_SCROLL_MAX_PX;
|
|
401
|
+
private edgeScrollFrame;
|
|
402
|
+
private edgeScrollVector;
|
|
403
|
+
private edgeScrollPointer;
|
|
404
|
+
/**
|
|
405
|
+
* Scroll the grid when a drag reaches the edge of the viewport.
|
|
406
|
+
*
|
|
407
|
+
* Without this, a drag can only ever reach what is already on screen — and
|
|
408
|
+
* since the timeline is now genuinely wider than the viewport (7 days x 48
|
|
409
|
+
* slots), "drag an event to next Thursday" became impossible rather than
|
|
410
|
+
* merely awkward. Both axes, because the timeline scrolls horizontally and the
|
|
411
|
+
* time grids vertically.
|
|
412
|
+
*
|
|
413
|
+
* Speed ramps with how deep into the edge zone the pointer is, the way every
|
|
414
|
+
* drag-and-drop implementation does it: a constant rate is either too slow to
|
|
415
|
+
* be useful or too fast to aim. Each frame re-feeds the pointer to the drag
|
|
416
|
+
* machine so the preview keeps tracking the slot under the cursor while the
|
|
417
|
+
* grid moves beneath it.
|
|
418
|
+
*/
|
|
419
|
+
private updateEdgeScroll;
|
|
420
|
+
private scheduleEdgeScroll;
|
|
421
|
+
private stopEdgeScroll;
|
|
99
422
|
/**
|
|
100
423
|
* Two activations of the same event within this window = a double
|
|
101
424
|
* click/tap. Native dblclick cannot be relied on here: the first click's
|
|
@@ -108,6 +431,24 @@ export declare class MpScheduler extends LitElement {
|
|
|
108
431
|
private registerEventActivation;
|
|
109
432
|
private handleDragComplete;
|
|
110
433
|
private handleClick;
|
|
434
|
+
/**
|
|
435
|
+
* Route a click on a resource-tree action button to its request event.
|
|
436
|
+
* Returns true when the click was one of ours and must not fall through.
|
|
437
|
+
*
|
|
438
|
+
* Every branch re-checks the capability rather than trusting that the button
|
|
439
|
+
* exists: state can change between render and click, and a request the
|
|
440
|
+
* consumer has switched off must not reach them.
|
|
441
|
+
*/
|
|
442
|
+
private handleResourceAction;
|
|
443
|
+
/**
|
|
444
|
+
* `change` from a resource control. Delegated on the shadow root because the
|
|
445
|
+
* views build their DOM imperatively and are rebuilt on every render — a
|
|
446
|
+
* per-element listener would have to be re-attached each time. `change` does
|
|
447
|
+
* not compose, so this listener is the only one that can see it.
|
|
448
|
+
*/
|
|
449
|
+
private handleValueChange;
|
|
450
|
+
/** Resolve a resource or group by id from the current `resources` input. */
|
|
451
|
+
private findResourceOrGroup;
|
|
111
452
|
private handleDoubleClick;
|
|
112
453
|
/**
|
|
113
454
|
* When focus lands on an event block (Tab, programmatic, or click), select
|
|
@@ -124,6 +465,44 @@ export declare class MpScheduler extends LitElement {
|
|
|
124
465
|
private activateFocusedDrillControl;
|
|
125
466
|
private getFocusedKind;
|
|
126
467
|
private handleAltShortcut;
|
|
468
|
+
/**
|
|
469
|
+
* Resolve a capability against `readonly`, `options.permissions` and any
|
|
470
|
+
* per-event override.
|
|
471
|
+
*
|
|
472
|
+
* A boolean lookup, deliberately: it runs on every pointer-down and on every
|
|
473
|
+
* render that decides whether to draw an affordance.
|
|
474
|
+
*/
|
|
475
|
+
private can;
|
|
476
|
+
/**
|
|
477
|
+
* "May this edge be dragged?" — for the three DIRECT-MANIPULATION surfaces
|
|
478
|
+
* only (resize handles, the pointer gesture, Shift/Alt+Shift+Arrow), where
|
|
479
|
+
* the edge belongs to the gesture. Everything else asks `can('resizeEvent')`.
|
|
480
|
+
*/
|
|
481
|
+
private canResizeEdge;
|
|
482
|
+
/** Recompute the resolved table onto state so views can gate affordances. */
|
|
483
|
+
private syncPermissions;
|
|
484
|
+
/**
|
|
485
|
+
* The effective permission table: the `readonly` host attribute outranks
|
|
486
|
+
* everything, then `options.permissions`. Per-capability defaults are applied
|
|
487
|
+
* inside `resolveCapability`, so an unspecified capability keeps its documented
|
|
488
|
+
* default rather than being treated as denied.
|
|
489
|
+
*/
|
|
490
|
+
private effectivePermissions;
|
|
491
|
+
/**
|
|
492
|
+
* The one optional consumer predicate, for data-dependent create rules.
|
|
493
|
+
*
|
|
494
|
+
* Evaluated ONLY at commit points (this call site, drag completion, Enter) —
|
|
495
|
+
* never per cell and never per pointer-move, so a consumer callback can't land
|
|
496
|
+
* on the render path. Slot greying is deliberately not driven by it.
|
|
497
|
+
*/
|
|
498
|
+
private allowsCreateAt;
|
|
499
|
+
/** Enter move mode only if the event may actually be moved or resized. */
|
|
500
|
+
private tryEnterEventMoveMode;
|
|
501
|
+
/**
|
|
502
|
+
* Announce a refused command. Silence on a keypress reads as a broken widget,
|
|
503
|
+
* so denial gets its own polite message rather than nothing.
|
|
504
|
+
*/
|
|
505
|
+
private announceDenied;
|
|
127
506
|
private handleEventKeyDown;
|
|
128
507
|
/**
|
|
129
508
|
* Inter-event arrow nav (PRD scheduler-controlled-selection §5.3): walk
|
|
@@ -203,7 +582,17 @@ export declare class MpScheduler extends LitElement {
|
|
|
203
582
|
private commitFocusMove;
|
|
204
583
|
private cellIsWithinView;
|
|
205
584
|
private parseTimeOnDay;
|
|
206
|
-
|
|
585
|
+
/**
|
|
586
|
+
* Walk the timeline's RENDERED row order: visible leaf resources, then the
|
|
587
|
+
* bucket row when it exists — the same list the view draws, so keyboard
|
|
588
|
+
* navigation can reach everything the eye can see (B25).
|
|
589
|
+
*
|
|
590
|
+
* Tri-state result: a string is the next resource row, `null` is the bucket
|
|
591
|
+
* row, `undefined` means "no move" (already at the edge, or nothing to walk).
|
|
592
|
+
* The old version returned `null` for BOTH of the last two, which is exactly
|
|
593
|
+
* why the bucket was unreachable by keyboard.
|
|
594
|
+
*/
|
|
595
|
+
private adjacentRow;
|
|
207
596
|
private getResourceTitle;
|
|
208
597
|
/**
|
|
209
598
|
* Find the cell DOM element for a (slot, resource) pair and call .focus()
|
|
@@ -211,8 +600,27 @@ export declare class MpScheduler extends LitElement {
|
|
|
211
600
|
* drag-near-edge auto-pan (PRD D6).
|
|
212
601
|
*/
|
|
213
602
|
private scrollAndFocusCell;
|
|
603
|
+
/**
|
|
604
|
+
* Resolve the grid cell for a (time, row) pair. Bucket-aware: on the
|
|
605
|
+
* timeline, `null` means the unassigned row, whose slots carry
|
|
606
|
+
* `data-unassigned` instead of a resource id — the old null branch looked up
|
|
607
|
+
* `.scheduler-time-slot`, which belongs to week/day and found nothing there,
|
|
608
|
+
* so keyboard focus could never land in the bucket row (B25).
|
|
609
|
+
*/
|
|
610
|
+
private timeCellElement;
|
|
214
611
|
/** Re-focus whatever cell the keyboard model currently considers focused. */
|
|
215
612
|
private focusFocusedCell;
|
|
613
|
+
/**
|
|
614
|
+
* Parse a `YYYY-MM-DD` day key as a LOCAL date.
|
|
615
|
+
*
|
|
616
|
+
* `new Date('2026-07-31')` is parsed per spec as UTC midnight, so in every
|
|
617
|
+
* timezone west of UTC it lands on the previous local day — month view writes
|
|
618
|
+
* these keys from local components, so Enter on Jul 31 in New York emitted
|
|
619
|
+
* `event-create` for Jul 30 and focus restoration missed the cell entirely.
|
|
620
|
+
* Full ISO strings (year view's `data-month`) round-trip fine and still work
|
|
621
|
+
* through this function.
|
|
622
|
+
*/
|
|
623
|
+
private parseDayKey;
|
|
216
624
|
private cssEscape;
|
|
217
625
|
/**
|
|
218
626
|
* Emit `event-create` covering the active selection range, or a single
|
|
@@ -249,7 +657,7 @@ export declare class MpScheduler extends LitElement {
|
|
|
249
657
|
private minutesPerSlot;
|
|
250
658
|
/** Shift the working event by `deltaMs` along the time axis (preserves duration). */
|
|
251
659
|
private nudgeKeyboardMove;
|
|
252
|
-
/** Walk to the next/previous
|
|
660
|
+
/** Walk to the next/previous row (timeline only). Updates the preview's resourceId. */
|
|
253
661
|
private nudgeKeyboardMoveResource;
|
|
254
662
|
/**
|
|
255
663
|
* Resize one edge of the working event. Clamps to a minimum duration of
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { SchedulerCustomEvent, EventDetail, TimeRange } from '
|
|
2
|
-
import { ViewType } from '@mintplayer/web-components/scheduler-core';
|
|
1
|
+
import { SchedulerCustomEvent, EventDetail, TimeRange, ViewType, Resource, ResourceGroup } from '@mintplayer/web-components/scheduler-core';
|
|
3
2
|
/**
|
|
4
3
|
* Handles dispatching custom events from the scheduler.
|
|
5
4
|
* Centralizes event emission logic for consistency.
|
|
@@ -8,8 +7,9 @@ export declare class SchedulerEventEmitter {
|
|
|
8
7
|
private readonly host;
|
|
9
8
|
constructor(host: HTMLElement);
|
|
10
9
|
/**
|
|
11
|
-
* Emit a scheduler custom event.
|
|
12
|
-
*
|
|
10
|
+
* Emit a scheduler custom event. `composed` as well as `bubbles`: without it
|
|
11
|
+
* the event stops at the shadow boundary of any component the scheduler is
|
|
12
|
+
* nested inside, so a wrapper-of-a-wrapper never sees it.
|
|
13
13
|
*/
|
|
14
14
|
emit(event: SchedulerCustomEvent): void;
|
|
15
15
|
/**
|
|
@@ -49,4 +49,20 @@ export declare class SchedulerEventEmitter {
|
|
|
49
49
|
* so consumers can react to the selection clearing without polling.
|
|
50
50
|
*/
|
|
51
51
|
emitSelectionChange(selectedEvent: EventDetail<'selection-change'>['selectedEvent'], range: TimeRange | null, view: ViewType, resourceId?: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Emit a `resource-create` or `group-create` *request*. Same controlled
|
|
54
|
+
* contract as `event-create`: the scheduler never edits its own `resources`
|
|
55
|
+
* input, so the consumer decides the id, title and placement. `parentId` is
|
|
56
|
+
* the group to insert into — absent means root level.
|
|
57
|
+
*/
|
|
58
|
+
emitResourceCreate(kind: 'resource' | 'group', view: ViewType, originalEvent: Event, parentId?: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Emit a `resource-update` request carrying only the changed fields, so the
|
|
61
|
+
* consumer can apply them without diffing.
|
|
62
|
+
*/
|
|
63
|
+
emitResourceUpdate(resource: Resource | ResourceGroup, changes: EventDetail<'resource-update'>['changes'], originalEvent: Event): void;
|
|
64
|
+
/**
|
|
65
|
+
* Emit a `resource-delete` request.
|
|
66
|
+
*/
|
|
67
|
+
emitResourceDelete(resource: Resource | ResourceGroup, originalEvent: Event): void;
|
|
52
68
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ViewType, SchedulerEvent, Resource, ResourceGroup, SchedulerOptions, PreviewEvent, DragState, TimeSlot } from '@mintplayer/web-components/scheduler-core';
|
|
1
|
+
import { ViewType, SchedulerEvent, Resource, ResourceGroup, SchedulerOptions, PreviewEvent, DragState, TimeSlot, SchedulerPermissions } from '@mintplayer/web-components/scheduler-core';
|
|
2
2
|
/**
|
|
3
3
|
* Internal state for the scheduler web component
|
|
4
4
|
*/
|
|
@@ -7,12 +7,32 @@ export interface SchedulerState {
|
|
|
7
7
|
view: ViewType;
|
|
8
8
|
/** Current date (the date shown in the view) */
|
|
9
9
|
date: Date;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* All events — the single store every view reads. This is the merge of the
|
|
12
|
+
* consumer's flat `events` input and any events authored under `resources`,
|
|
13
|
+
* each stamped with its owning `resourceId`.
|
|
14
|
+
*/
|
|
11
15
|
events: SchedulerEvent[];
|
|
16
|
+
/**
|
|
17
|
+
* `events` grouped by `resourceId`, rebuilt whenever `events` changes. The
|
|
18
|
+
* `null` key holds events with no resource (timeline's unassigned bucket).
|
|
19
|
+
*/
|
|
20
|
+
eventsByResource: Map<string | null, SchedulerEvent[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Flat resource lookup by id, rebuilt with `resources`. Lets every view — not
|
|
23
|
+
* just timeline — resolve an event's resource colour in O(1).
|
|
24
|
+
*/
|
|
25
|
+
resourceById: Map<string, Resource>;
|
|
12
26
|
/** Resources and resource groups */
|
|
13
27
|
resources: (Resource | ResourceGroup)[];
|
|
14
28
|
/** Configuration options */
|
|
15
29
|
options: SchedulerOptions;
|
|
30
|
+
/**
|
|
31
|
+
* Permission table with the `readonly` host attribute already folded in, so
|
|
32
|
+
* views can gate affordances without re-deriving the precedence. `false` means
|
|
33
|
+
* fully read-only.
|
|
34
|
+
*/
|
|
35
|
+
resolvedPermissions: boolean | Partial<SchedulerPermissions>;
|
|
16
36
|
/** Currently selected event */
|
|
17
37
|
selectedEvent: SchedulerEvent | null;
|
|
18
38
|
/** Currently hovered event */
|
|
@@ -73,6 +93,25 @@ export declare class SchedulerStateManager {
|
|
|
73
93
|
* Update state with partial update or updater function
|
|
74
94
|
*/
|
|
75
95
|
setState(update: Partial<SchedulerState> | StateUpdater): void;
|
|
96
|
+
/** Events already reported under `requireEventResource`; warn once each. */
|
|
97
|
+
private readonly warnedUnassignedIds;
|
|
98
|
+
/**
|
|
99
|
+
* `options.requireEventResource` is a DEVELOPMENT signal, not a filter: the
|
|
100
|
+
* event still renders in the bucket row, because hiding data a consumer handed
|
|
101
|
+
* us is the trap this whole area exists to avoid. One warning per id, so a
|
|
102
|
+
* drag that re-renders sixty times a second cannot flood the console.
|
|
103
|
+
*/
|
|
104
|
+
private warnUnassignedEvents;
|
|
105
|
+
/** Dangling resource ids already reported; warn once per event id. */
|
|
106
|
+
private readonly warnedDanglingIds;
|
|
107
|
+
/**
|
|
108
|
+
* B29's development signal: an event whose `resourceId` names no known
|
|
109
|
+
* resource renders in the bucket row rather than vanishing, and says so once.
|
|
110
|
+
* Gated on a non-empty resource tree — during input wiring the events
|
|
111
|
+
* routinely arrive before the resources, and warning about that ordering
|
|
112
|
+
* would train consumers to ignore the warning that matters.
|
|
113
|
+
*/
|
|
114
|
+
private warnDanglingEvents;
|
|
76
115
|
/**
|
|
77
116
|
* Subscribe to state changes
|
|
78
117
|
*/
|
|
@@ -90,25 +129,38 @@ export declare class SchedulerStateManager {
|
|
|
90
129
|
*/
|
|
91
130
|
setDate(date: Date): void;
|
|
92
131
|
/**
|
|
93
|
-
*
|
|
132
|
+
* The consumer's flat `events` input, kept verbatim so re-merging on a
|
|
133
|
+
* `resources` change doesn't fold previously-nested events into it.
|
|
134
|
+
*/
|
|
135
|
+
private flatEventsInput;
|
|
136
|
+
/**
|
|
137
|
+
* Set events. The stored `events` is the MERGE of this input and any events
|
|
138
|
+
* authored under resources — every view reads that one list.
|
|
94
139
|
*/
|
|
95
140
|
setEvents(events: SchedulerEvent[]): void;
|
|
96
141
|
/**
|
|
97
|
-
* Add an event
|
|
142
|
+
* Add an event. Lands in the single store regardless of whether it carries a
|
|
143
|
+
* `resourceId`, so a timeline-created event is no longer invisible.
|
|
98
144
|
*/
|
|
99
145
|
addEvent(event: SchedulerEvent): void;
|
|
100
146
|
/**
|
|
101
|
-
* Update an event
|
|
147
|
+
* Update an event. One store, so no double-write: a move across resource rows
|
|
148
|
+
* is now a `resourceId` reassignment rather than a splice between two arrays.
|
|
102
149
|
*/
|
|
103
150
|
updateEvent(event: SchedulerEvent): void;
|
|
104
151
|
/**
|
|
105
|
-
* Remove an event
|
|
152
|
+
* Remove an event. Previously filtered the flat list only, so a
|
|
153
|
+
* resource-nested event removed through the public API kept rendering.
|
|
106
154
|
*/
|
|
107
155
|
removeEvent(eventId: string): void;
|
|
108
156
|
/**
|
|
109
|
-
* Set resources
|
|
157
|
+
* Set resources. Re-merges so events authored under the new tree become
|
|
158
|
+
* visible in every view, and honours each group's authored `collapsed` flag
|
|
159
|
+
* (previously declared on the model and read by nothing).
|
|
110
160
|
*/
|
|
111
161
|
setResources(resources: (Resource | ResourceGroup)[]): void;
|
|
162
|
+
/** Per-instance: group ids already seeded from their authored `collapsed`. */
|
|
163
|
+
private readonly seededGroupIds;
|
|
112
164
|
/**
|
|
113
165
|
* Toggle resource group collapse
|
|
114
166
|
*/
|
|
@@ -76,6 +76,35 @@ export declare abstract class BaseView {
|
|
|
76
76
|
/**
|
|
77
77
|
* Helper to create an element with classes
|
|
78
78
|
*/
|
|
79
|
+
/**
|
|
80
|
+
* Vertical geometry for one day-part in a time-grid column, in px.
|
|
81
|
+
*
|
|
82
|
+
* The single source of truth for BOTH committed event boxes and drag ghosts —
|
|
83
|
+
* they drifted apart before, which is how the ghost ended up measuring from a
|
|
84
|
+
* different origin than the box it was previewing.
|
|
85
|
+
*
|
|
86
|
+
* Measures from `slotMinTime`, NOT from midnight: the column's first row is
|
|
87
|
+
* the `slotMinTime` slot, so a midnight origin displaced every box by the
|
|
88
|
+
* whole hidden window (with `slotMinTime: '08:00'` a 09:00 event landed ~640px
|
|
89
|
+
* too low). The part is also clipped to `[slotMinTime, slotMaxTime]` on its own
|
|
90
|
+
* day, so a middle part of a multi-day span renders as the full visible window
|
|
91
|
+
* rather than 24h worth of pixels.
|
|
92
|
+
*
|
|
93
|
+
* Returns `null` when the part falls entirely outside the visible window —
|
|
94
|
+
* callers skip it rather than drawing a zero-height box.
|
|
95
|
+
*/
|
|
96
|
+
/**
|
|
97
|
+
* Apply an event's fill + contrast text colour to its box.
|
|
98
|
+
*
|
|
99
|
+
* One place, so a resource's colour reaches EVERY view — week/day/month/year
|
|
100
|
+
* previously had no route from an event to its resource, which is why
|
|
101
|
+
* `Resource.color`/`eventColor` sat in the model unread.
|
|
102
|
+
*/
|
|
103
|
+
protected applyEventColors(el: HTMLElement, event: SchedulerEvent): void;
|
|
104
|
+
protected partGeometry(start: Date, end: Date, options: SchedulerOptions): {
|
|
105
|
+
top: number;
|
|
106
|
+
height: number;
|
|
107
|
+
} | null;
|
|
79
108
|
protected createElement<K extends keyof HTMLElementTagNameMap>(tag: K, ...classes: string[]): HTMLElementTagNameMap[K];
|
|
80
109
|
/**
|
|
81
110
|
* Helper to set data attributes
|