@mintplayer/web-components 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/id-D5QCG603.mjs +940 -0
- package/package.json +1 -1
- package/scheduler/index.mjs +2157 -667
- package/scheduler/src/components/mp-scheduler.d.ts +177 -0
- package/scheduler/src/events/index.d.ts +0 -1
- package/scheduler/src/events/scheduler-event-emitter.d.ts +20 -4
- package/scheduler/src/input/input-handler.d.ts +2 -0
- package/scheduler/src/state/scheduler-state.d.ts +49 -7
- package/scheduler/src/views/base-view.d.ts +49 -6
- package/scheduler/src/views/day-view.d.ts +6 -0
- package/scheduler/src/views/timeline-view.d.ts +98 -1
- package/scheduler/src/views/week-view.d.ts +6 -0
- package/scheduler-core/index.mjs +77 -70
- package/scheduler-core/src/models/events.d.ts +76 -90
- package/scheduler-core/src/models/index.d.ts +2 -0
- package/scheduler-core/src/models/messages.d.ts +103 -0
- package/scheduler-core/src/models/options.d.ts +60 -16
- package/scheduler-core/src/models/permissions.d.ts +83 -0
- package/scheduler-core/src/models/time-slot.d.ts +10 -0
- package/scheduler-core/src/services/resource.service.d.ts +25 -11
- package/scheduler-core/src/utils/color.d.ts +22 -0
- package/chunks/color-CyamnJnn.mjs +0 -847
- package/scheduler/src/events/event-types.d.ts +0 -58
|
@@ -27,8 +27,21 @@ export declare class MpScheduler extends LitElement {
|
|
|
27
27
|
private latestDragState;
|
|
28
28
|
private boundHandleKeyDown;
|
|
29
29
|
private boundHandleFocusIn;
|
|
30
|
+
private boundHandleValueChange;
|
|
30
31
|
private nowIndicatorTimer;
|
|
31
32
|
private readonly liveAnnouncer;
|
|
33
|
+
/** Day the month-view popover is open for, or null when it is closed. */
|
|
34
|
+
private popoverDate;
|
|
35
|
+
/** Date key of the anchor cell — resolved lazily, see `openDayPopover`. */
|
|
36
|
+
private popoverAnchorKey;
|
|
37
|
+
private boundRepositionPopover;
|
|
38
|
+
/**
|
|
39
|
+
* The month day popover. Not modal: the grid behind stays operable, Escape and
|
|
40
|
+
* outside clicks dismiss through the shared dismiss stack, and focus lands on
|
|
41
|
+
* the first control inside so the dialog is announced instead of opening
|
|
42
|
+
* silently behind the user's focus.
|
|
43
|
+
*/
|
|
44
|
+
private readonly dayPopover;
|
|
32
45
|
constructor();
|
|
33
46
|
connectedCallback(): void;
|
|
34
47
|
disconnectedCallback(): void;
|
|
@@ -37,6 +50,17 @@ export declare class MpScheduler extends LitElement {
|
|
|
37
50
|
set view(value: ViewType);
|
|
38
51
|
get date(): Date;
|
|
39
52
|
set date(value: Date);
|
|
53
|
+
/**
|
|
54
|
+
* Coarse read-only switch, outranking `options.permissions` entirely.
|
|
55
|
+
*
|
|
56
|
+
* Property and attribute are the same state, deliberately: a JS consumer
|
|
57
|
+
* writes `el.readonly = true`, a plain-HTML or SSR consumer writes the
|
|
58
|
+
* attribute, and a framework wrapper can bridge whichever it has. Absence is
|
|
59
|
+
* editable; `readonly="false"` opts back out so the attribute can be rendered
|
|
60
|
+
* unconditionally with a computed value.
|
|
61
|
+
*/
|
|
62
|
+
get readonly(): boolean;
|
|
63
|
+
set readonly(value: boolean);
|
|
40
64
|
get events(): SchedulerEvent[];
|
|
41
65
|
set events(value: SchedulerEvent[]);
|
|
42
66
|
get resources(): (Resource | ResourceGroup)[];
|
|
@@ -54,6 +78,8 @@ export declare class MpScheduler extends LitElement {
|
|
|
54
78
|
today(): void;
|
|
55
79
|
gotoDate(date: Date): void;
|
|
56
80
|
changeView(view: ViewType): void;
|
|
81
|
+
/** Localized display name of a view (also the view-switcher button text). */
|
|
82
|
+
private viewLabel;
|
|
57
83
|
/**
|
|
58
84
|
* Clear the time-range selection and the focused-cell selection. Public
|
|
59
85
|
* because — per PRD scheduler-controlled-selection — the WC no longer
|
|
@@ -66,10 +92,65 @@ export declare class MpScheduler extends LitElement {
|
|
|
66
92
|
removeEvent(eventId: string): void;
|
|
67
93
|
getEventById(eventId: string): SchedulerEvent | null;
|
|
68
94
|
refetchEvents(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Localized string lookup: options.messages overrides merged onto the
|
|
97
|
+
* English defaults, with {placeholder} interpolation.
|
|
98
|
+
*/
|
|
99
|
+
private msg;
|
|
69
100
|
render(): TemplateResult;
|
|
101
|
+
/**
|
|
102
|
+
* Day popover for the month view: the day's events plus the two things a user
|
|
103
|
+
* wants from a date they just clicked — create here, or open the day.
|
|
104
|
+
*
|
|
105
|
+
* A sibling of `.scheduler-container`, NOT a child of `.scheduler-content`:
|
|
106
|
+
* the panel is `position: fixed`, so any ancestor with `transform`, `filter`
|
|
107
|
+
* or `contain` would silently become its containing block and the coordinates
|
|
108
|
+
* the OverlayController computes would be wrong. Keep it out here.
|
|
109
|
+
*
|
|
110
|
+
* `role="dialog"` with `modal: false` and no `aria-modal`: the month grid
|
|
111
|
+
* behind it stays perfectly usable, and claiming modality would hide a page
|
|
112
|
+
* that is still visible. It emits NO new event types — activating an entry
|
|
113
|
+
* is `event-selected`, "New event" is `event-create`, "Show day" is the same
|
|
114
|
+
* drill the "+N more" link used to do.
|
|
115
|
+
*/
|
|
116
|
+
private renderDayPopover;
|
|
117
|
+
/**
|
|
118
|
+
* The day cell the popover hangs off, resolved by date key on every call.
|
|
119
|
+
* The month view rebuilds its cells imperatively, so a cached element would
|
|
120
|
+
* be detached the moment anything re-renders while the popover is open.
|
|
121
|
+
*/
|
|
122
|
+
private popoverAnchorCell;
|
|
123
|
+
/** Every event overlapping the given local day, in start order. */
|
|
124
|
+
private eventsOnDay;
|
|
125
|
+
/**
|
|
126
|
+
* Open the day popover for `day`. Anchored on the day cell resolved LAZILY by
|
|
127
|
+
* date key: the views rebuild their DOM imperatively, so a captured element
|
|
128
|
+
* reference would be detached by the next render while the popover is open.
|
|
129
|
+
*/
|
|
130
|
+
private openDayPopover;
|
|
131
|
+
private closeDayPopover;
|
|
132
|
+
private selectFromPopover;
|
|
133
|
+
private createFromPopover;
|
|
134
|
+
private showDayFromPopover;
|
|
135
|
+
/**
|
|
136
|
+
* Route a "+N more" activation through `options.moreLinkBehavior`. Returns the
|
|
137
|
+
* date to drill to when the caller should navigate, or null when the behaviour
|
|
138
|
+
* has already been handled here.
|
|
139
|
+
*/
|
|
140
|
+
private handleMoreLink;
|
|
70
141
|
protected firstUpdated(): void;
|
|
71
142
|
private populateHeader;
|
|
72
143
|
private updateTitle;
|
|
144
|
+
/** Header width below which the layout wraps and the title compacts (D9). */
|
|
145
|
+
private static readonly NARROW_HEADER_WIDTH;
|
|
146
|
+
private headerResizeObserver;
|
|
147
|
+
private headerIsNarrow;
|
|
148
|
+
/**
|
|
149
|
+
* Component-width (not viewport) driven narrow mode — the scheduler can sit
|
|
150
|
+
* in a pane far narrower than the screen (splitter/dock). CSS keys the
|
|
151
|
+
* wrapped layout off [data-narrow]; the title text swap needs JS anyway.
|
|
152
|
+
*/
|
|
153
|
+
private observeHeaderWidth;
|
|
73
154
|
private renderView;
|
|
74
155
|
private onStateChange;
|
|
75
156
|
private previousIsLoading;
|
|
@@ -79,8 +160,61 @@ export declare class MpScheduler extends LitElement {
|
|
|
79
160
|
private handlePointerDown;
|
|
80
161
|
private handlePointerMove;
|
|
81
162
|
private handlePointerUp;
|
|
163
|
+
/** Distance from a scroller edge at which auto-scroll engages. */
|
|
164
|
+
private static readonly EDGE_SCROLL_ZONE_PX;
|
|
165
|
+
/** Fastest scroll step, in px per frame, reached at the very edge. */
|
|
166
|
+
private static readonly EDGE_SCROLL_MAX_PX;
|
|
167
|
+
private edgeScrollFrame;
|
|
168
|
+
private edgeScrollVector;
|
|
169
|
+
private edgeScrollPointer;
|
|
170
|
+
/**
|
|
171
|
+
* Scroll the grid when a drag reaches the edge of the viewport.
|
|
172
|
+
*
|
|
173
|
+
* Without this, a drag can only ever reach what is already on screen — and
|
|
174
|
+
* since the timeline is now genuinely wider than the viewport (7 days x 48
|
|
175
|
+
* slots), "drag an event to next Thursday" became impossible rather than
|
|
176
|
+
* merely awkward. Both axes, because the timeline scrolls horizontally and the
|
|
177
|
+
* time grids vertically.
|
|
178
|
+
*
|
|
179
|
+
* Speed ramps with how deep into the edge zone the pointer is, the way every
|
|
180
|
+
* drag-and-drop implementation does it: a constant rate is either too slow to
|
|
181
|
+
* be useful or too fast to aim. Each frame re-feeds the pointer to the drag
|
|
182
|
+
* machine so the preview keeps tracking the slot under the cursor while the
|
|
183
|
+
* grid moves beneath it.
|
|
184
|
+
*/
|
|
185
|
+
private updateEdgeScroll;
|
|
186
|
+
private scheduleEdgeScroll;
|
|
187
|
+
private stopEdgeScroll;
|
|
188
|
+
/**
|
|
189
|
+
* Two activations of the same event within this window = a double
|
|
190
|
+
* click/tap. Native dblclick cannot be relied on here: the first click's
|
|
191
|
+
* selection re-render replaces the event node, which resets the browser's
|
|
192
|
+
* double-click tracking — so `event-dblclick` is synthesized from
|
|
193
|
+
* consecutive activations instead (and works for touch double-tap too).
|
|
194
|
+
*/
|
|
195
|
+
private static readonly DBLCLICK_WINDOW_MS;
|
|
196
|
+
private lastEventActivation;
|
|
197
|
+
private registerEventActivation;
|
|
82
198
|
private handleDragComplete;
|
|
83
199
|
private handleClick;
|
|
200
|
+
/**
|
|
201
|
+
* Route a click on a resource-tree action button to its request event.
|
|
202
|
+
* Returns true when the click was one of ours and must not fall through.
|
|
203
|
+
*
|
|
204
|
+
* Every branch re-checks the capability rather than trusting that the button
|
|
205
|
+
* exists: state can change between render and click, and a request the
|
|
206
|
+
* consumer has switched off must not reach them.
|
|
207
|
+
*/
|
|
208
|
+
private handleResourceAction;
|
|
209
|
+
/**
|
|
210
|
+
* `change` from a resource control. Delegated on the shadow root because the
|
|
211
|
+
* views build their DOM imperatively and are rebuilt on every render — a
|
|
212
|
+
* per-element listener would have to be re-attached each time. `change` does
|
|
213
|
+
* not compose, so this listener is the only one that can see it.
|
|
214
|
+
*/
|
|
215
|
+
private handleValueChange;
|
|
216
|
+
/** Resolve a resource or group by id from the current `resources` input. */
|
|
217
|
+
private findResourceOrGroup;
|
|
84
218
|
private handleDoubleClick;
|
|
85
219
|
/**
|
|
86
220
|
* When focus lands on an event block (Tab, programmatic, or click), select
|
|
@@ -97,6 +231,38 @@ export declare class MpScheduler extends LitElement {
|
|
|
97
231
|
private activateFocusedDrillControl;
|
|
98
232
|
private getFocusedKind;
|
|
99
233
|
private handleAltShortcut;
|
|
234
|
+
/**
|
|
235
|
+
* Resolve a capability against `readonly`, `options.permissions` and any
|
|
236
|
+
* per-event override.
|
|
237
|
+
*
|
|
238
|
+
* A boolean lookup, deliberately: it runs on every pointer-down and on every
|
|
239
|
+
* render that decides whether to draw an affordance.
|
|
240
|
+
*/
|
|
241
|
+
private can;
|
|
242
|
+
/** Recompute the resolved table onto state so views can gate affordances. */
|
|
243
|
+
private syncPermissions;
|
|
244
|
+
/**
|
|
245
|
+
* The effective permission table: the `readonly` host attribute outranks
|
|
246
|
+
* everything, then `options.permissions`. Per-capability defaults are applied
|
|
247
|
+
* inside `resolveCapability`, so an unspecified capability keeps its documented
|
|
248
|
+
* default rather than being treated as denied.
|
|
249
|
+
*/
|
|
250
|
+
private effectivePermissions;
|
|
251
|
+
/**
|
|
252
|
+
* The one optional consumer predicate, for data-dependent create rules.
|
|
253
|
+
*
|
|
254
|
+
* Evaluated ONLY at commit points (this call site, drag completion, Enter) —
|
|
255
|
+
* never per cell and never per pointer-move, so a consumer callback can't land
|
|
256
|
+
* on the render path. Slot greying is deliberately not driven by it.
|
|
257
|
+
*/
|
|
258
|
+
private allowsCreateAt;
|
|
259
|
+
/** Enter move mode only if the event may actually be moved or resized. */
|
|
260
|
+
private tryEnterEventMoveMode;
|
|
261
|
+
/**
|
|
262
|
+
* Announce a refused command. Silence on a keypress reads as a broken widget,
|
|
263
|
+
* so denial gets its own polite message rather than nothing.
|
|
264
|
+
*/
|
|
265
|
+
private announceDenied;
|
|
100
266
|
private handleEventKeyDown;
|
|
101
267
|
/**
|
|
102
268
|
* Inter-event arrow nav (PRD scheduler-controlled-selection §5.3): walk
|
|
@@ -186,6 +352,17 @@ export declare class MpScheduler extends LitElement {
|
|
|
186
352
|
private scrollAndFocusCell;
|
|
187
353
|
/** Re-focus whatever cell the keyboard model currently considers focused. */
|
|
188
354
|
private focusFocusedCell;
|
|
355
|
+
/**
|
|
356
|
+
* Parse a `YYYY-MM-DD` day key as a LOCAL date.
|
|
357
|
+
*
|
|
358
|
+
* `new Date('2026-07-31')` is parsed per spec as UTC midnight, so in every
|
|
359
|
+
* timezone west of UTC it lands on the previous local day — month view writes
|
|
360
|
+
* these keys from local components, so Enter on Jul 31 in New York emitted
|
|
361
|
+
* `event-create` for Jul 30 and focus restoration missed the cell entirely.
|
|
362
|
+
* Full ISO strings (year view's `data-month`) round-trip fine and still work
|
|
363
|
+
* through this function.
|
|
364
|
+
*/
|
|
365
|
+
private parseDayKey;
|
|
189
366
|
private cssEscape;
|
|
190
367
|
/**
|
|
191
368
|
* Emit `event-create` covering the active selection range, or a single
|
|
@@ -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
|
}
|
|
@@ -34,6 +34,8 @@ export interface InputHandlerConfig {
|
|
|
34
34
|
isEditable: () => boolean;
|
|
35
35
|
/** Whether selection is enabled */
|
|
36
36
|
isSelectable: () => boolean;
|
|
37
|
+
/** Whether the given event is the currently-selected one */
|
|
38
|
+
isEventSelected?: (eventId: string) => boolean;
|
|
37
39
|
/** Touch hold duration in ms before drag activates (default: 500) */
|
|
38
40
|
touchHoldDuration?: number;
|
|
39
41
|
/** Movement threshold before touch hold is cancelled (default: 10) */
|
|
@@ -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,15 @@ 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;
|
|
76
105
|
/**
|
|
77
106
|
* Subscribe to state changes
|
|
78
107
|
*/
|
|
@@ -90,25 +119,38 @@ export declare class SchedulerStateManager {
|
|
|
90
119
|
*/
|
|
91
120
|
setDate(date: Date): void;
|
|
92
121
|
/**
|
|
93
|
-
*
|
|
122
|
+
* The consumer's flat `events` input, kept verbatim so re-merging on a
|
|
123
|
+
* `resources` change doesn't fold previously-nested events into it.
|
|
124
|
+
*/
|
|
125
|
+
private flatEventsInput;
|
|
126
|
+
/**
|
|
127
|
+
* Set events. The stored `events` is the MERGE of this input and any events
|
|
128
|
+
* authored under resources — every view reads that one list.
|
|
94
129
|
*/
|
|
95
130
|
setEvents(events: SchedulerEvent[]): void;
|
|
96
131
|
/**
|
|
97
|
-
* Add an event
|
|
132
|
+
* Add an event. Lands in the single store regardless of whether it carries a
|
|
133
|
+
* `resourceId`, so a timeline-created event is no longer invisible.
|
|
98
134
|
*/
|
|
99
135
|
addEvent(event: SchedulerEvent): void;
|
|
100
136
|
/**
|
|
101
|
-
* Update an event
|
|
137
|
+
* Update an event. One store, so no double-write: a move across resource rows
|
|
138
|
+
* is now a `resourceId` reassignment rather than a splice between two arrays.
|
|
102
139
|
*/
|
|
103
140
|
updateEvent(event: SchedulerEvent): void;
|
|
104
141
|
/**
|
|
105
|
-
* Remove an event
|
|
142
|
+
* Remove an event. Previously filtered the flat list only, so a
|
|
143
|
+
* resource-nested event removed through the public API kept rendering.
|
|
106
144
|
*/
|
|
107
145
|
removeEvent(eventId: string): void;
|
|
108
146
|
/**
|
|
109
|
-
* Set resources
|
|
147
|
+
* Set resources. Re-merges so events authored under the new tree become
|
|
148
|
+
* visible in every view, and honours each group's authored `collapsed` flag
|
|
149
|
+
* (previously declared on the model and read by nothing).
|
|
110
150
|
*/
|
|
111
151
|
setResources(resources: (Resource | ResourceGroup)[]): void;
|
|
152
|
+
/** Per-instance: group ids already seeded from their authored `collapsed`. */
|
|
153
|
+
private readonly seededGroupIds;
|
|
112
154
|
/**
|
|
113
155
|
* Toggle resource group collapse
|
|
114
156
|
*/
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { SchedulerEvent, TimeSlot } from '@mintplayer/web-components/scheduler-core';
|
|
1
|
+
import { SchedulerEvent, SchedulerEventPart, SchedulerOptions, TimeSlot } from '@mintplayer/web-components/scheduler-core';
|
|
2
2
|
import { SchedulerState } from '../state/scheduler-state';
|
|
3
3
|
/**
|
|
4
4
|
* Build the descriptive aria-label for an event block. Used by every view.
|
|
5
5
|
* Format: "{title}, {start}–{end} on {resource}". Resource is omitted when
|
|
6
6
|
* the event has no resource or the caller doesn't have it (week/day views).
|
|
7
|
+
* Strings and date formatting follow options.messages / options.locale.
|
|
7
8
|
*/
|
|
8
|
-
export declare function formatEventAriaLabel(event: SchedulerEvent, resourceTitle: string | null,
|
|
9
|
+
export declare function formatEventAriaLabel(event: SchedulerEvent, resourceTitle: string | null, options: SchedulerOptions): string;
|
|
9
10
|
/**
|
|
10
11
|
* Normalised selection range — covers anchor.start through extent.end (or
|
|
11
12
|
* the reverse if the user shift-arrowed backwards), with the resource pinned
|
|
@@ -28,22 +29,22 @@ export declare function isSlotInSelection(slot: TimeSlot, state: SchedulerState,
|
|
|
28
29
|
* Includes weekday + date so screen readers don't lose the user across
|
|
29
30
|
* cross-day moves.
|
|
30
31
|
*/
|
|
31
|
-
export declare function formatCellAnnouncement(slot: TimeSlot,
|
|
32
|
+
export declare function formatCellAnnouncement(slot: TimeSlot, options: SchedulerOptions, resourceTitle?: string | null): string;
|
|
32
33
|
/**
|
|
33
34
|
* Live-region announcement after Shift+Arrow grows or shrinks the range.
|
|
34
35
|
* Reads "Selection: {start time, day} to {end time, day}, {N} slots".
|
|
35
36
|
*/
|
|
36
|
-
export declare function formatSelectionAnnouncement(state: SchedulerState, slotDuration: number
|
|
37
|
+
export declare function formatSelectionAnnouncement(state: SchedulerState, slotDuration: number): string;
|
|
37
38
|
/**
|
|
38
39
|
* Live-region announcement for an in-progress keyboard event move.
|
|
39
40
|
*/
|
|
40
|
-
export declare function formatMoveAnnouncement(start: Date, end: Date,
|
|
41
|
+
export declare function formatMoveAnnouncement(start: Date, end: Date, options: SchedulerOptions): string;
|
|
41
42
|
/**
|
|
42
43
|
* Live-region announcement for an in-progress keyboard event resize. The
|
|
43
44
|
* `edge` field tells the user which side they're stretching, so they can
|
|
44
45
|
* tell Shift+ArrowDown (end edge) from Alt+Shift+ArrowDown (start edge).
|
|
45
46
|
*/
|
|
46
|
-
export declare function formatResizeAnnouncement(start: Date, end: Date, edge: 'start' | 'end',
|
|
47
|
+
export declare function formatResizeAnnouncement(start: Date, end: Date, edge: 'start' | 'end', options: SchedulerOptions): string;
|
|
47
48
|
/**
|
|
48
49
|
* Base class for scheduler views
|
|
49
50
|
*/
|
|
@@ -75,6 +76,35 @@ export declare abstract class BaseView {
|
|
|
75
76
|
/**
|
|
76
77
|
* Helper to create an element with classes
|
|
77
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;
|
|
78
108
|
protected createElement<K extends keyof HTMLElementTagNameMap>(tag: K, ...classes: string[]): HTMLElementTagNameMap[K];
|
|
79
109
|
/**
|
|
80
110
|
* Helper to set data attributes
|
|
@@ -84,6 +114,17 @@ export declare abstract class BaseView {
|
|
|
84
114
|
* Helper to clear container
|
|
85
115
|
*/
|
|
86
116
|
protected clearContainer(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Append the start/end resize handles for an event part. The handle strip
|
|
119
|
+
* is the pointer hit zone the drag machine targets via
|
|
120
|
+
* closest('.resize-handle'); the glyph inside it is a purely decorative
|
|
121
|
+
* affordance revealed by the .selected class — never focusable, the
|
|
122
|
+
* keyboard resize path lives on the event element (move-mode).
|
|
123
|
+
* Position classes are per-view: ['top','bottom'] for time grids,
|
|
124
|
+
* ['left','right'] for the timeline.
|
|
125
|
+
*/
|
|
126
|
+
protected appendResizeHandles(eventEl: HTMLElement, part: SchedulerEventPart, [startClass, endClass]?: [string, string]): void;
|
|
127
|
+
private createResizeHandle;
|
|
87
128
|
/**
|
|
88
129
|
* Retrofit the ARIA grid chain onto a rendered view (wc-aria PRD step 5.7):
|
|
89
130
|
* the container claims `grid`, layout-only wrappers become `presentation`
|
|
@@ -104,6 +145,8 @@ export declare abstract class BaseView {
|
|
|
104
145
|
/** Extra gridcells (e.g. a per-row events overlay whose buttons need a
|
|
105
146
|
* cell to live in — rows may not own buttons directly). */
|
|
106
147
|
cells?: string;
|
|
148
|
+
/** Grids where Shift+Arrow extends a multi-cell range (week/day). */
|
|
149
|
+
multiselectable?: boolean;
|
|
107
150
|
}): void;
|
|
108
151
|
/** aria-current="date" on every element the views styled `.today`. */
|
|
109
152
|
protected markToday(): void;
|
|
@@ -20,6 +20,12 @@ export declare class DayView extends BaseView {
|
|
|
20
20
|
update(state: SchedulerState): void;
|
|
21
21
|
private optionsRequireRerender;
|
|
22
22
|
private updateGreyedSlots;
|
|
23
|
+
/**
|
|
24
|
+
* Dashed ghost for the day currently shown. A multi-day range contributes at
|
|
25
|
+
* most one part here, but it must still be CLIPPED to this day rather than
|
|
26
|
+
* skipped: bailing unless the range *started* today meant dragging in from
|
|
27
|
+
* yesterday drew no feedback at all.
|
|
28
|
+
*/
|
|
23
29
|
private renderPreviewEvent;
|
|
24
30
|
destroy(): void;
|
|
25
31
|
}
|
|
@@ -5,8 +5,37 @@ import { SchedulerState } from '../state/scheduler-state';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class TimelineView extends BaseView {
|
|
7
7
|
private rowElements;
|
|
8
|
-
|
|
8
|
+
/** Focus key captured just before a rebuild; see `restoreActionFocus`. */
|
|
9
|
+
private pendingFocusKey;
|
|
10
|
+
/**
|
|
11
|
+
* Slot width in px. Read from `--scheduler-slot-width` so consumers can shorten
|
|
12
|
+
* a default week (48 slots x 7 days x 50px = 16,800px); falls back to 50.
|
|
13
|
+
*/
|
|
14
|
+
private get slotWidth();
|
|
15
|
+
/**
|
|
16
|
+
* Track geometry for the timeline, in px, from the CSS custom properties so a
|
|
17
|
+
* consumer can retune density without forking the view.
|
|
18
|
+
*
|
|
19
|
+
* The timeline is the one view where vertical space is NOT the time axis —
|
|
20
|
+
* time runs horizontally and the panel scrolls — so an event's height carries
|
|
21
|
+
* no information. Overlapping events therefore STACK at a constant height and
|
|
22
|
+
* grow their resource row, instead of dividing a fixed 40px row between them
|
|
23
|
+
* the way week/day must (there, height IS duration).
|
|
24
|
+
*/
|
|
25
|
+
private get trackMetrics();
|
|
9
26
|
render(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Focus key of an action control: what it does plus which row it belongs to.
|
|
29
|
+
* Stable across a rebuild (unlike DOM position), and unique per control.
|
|
30
|
+
*/
|
|
31
|
+
private actionFocusKey;
|
|
32
|
+
/**
|
|
33
|
+
* Remember which action control the user was on, if any, before a rebuild.
|
|
34
|
+
* `activeElement` of the shadow root — the host's `document.activeElement` is
|
|
35
|
+
* the `<mp-scheduler>` element itself, not the button inside it.
|
|
36
|
+
*/
|
|
37
|
+
private captureActionFocus;
|
|
38
|
+
private restoreActionFocus;
|
|
10
39
|
/**
|
|
11
40
|
* Apply roving tabindex + aria-selected + `.selected` class to each
|
|
12
41
|
* timeline-slot element. Selection is constrained to the resource pinned
|
|
@@ -14,8 +43,76 @@ export declare class TimelineView extends BaseView {
|
|
|
14
43
|
*/
|
|
15
44
|
private updateCellFocusAndSelection;
|
|
16
45
|
private createResourceRow;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the synthetic bucket row renders: only when something is actually
|
|
48
|
+
* unassigned, so a fully-assigned timeline shows no phantom row.
|
|
49
|
+
*/
|
|
50
|
+
private hasUnassignedRow;
|
|
51
|
+
/** True when the capability is granted for the whole scheduler. */
|
|
52
|
+
private can;
|
|
53
|
+
/**
|
|
54
|
+
* Per-row resource actions, rendered into the pinned rowheader cell.
|
|
55
|
+
*
|
|
56
|
+
* A denied action is ABSENT, not disabled: `createResource`/`createGroup`/
|
|
57
|
+
* `updateResource`/`deleteResource` are all off by default, so the ordinary
|
|
58
|
+
* scheduler shows none of this and only an app that manages its own resource
|
|
59
|
+
* tree opts in. (A permanently-disabled button is noise for sighted users and
|
|
60
|
+
* a broken promise for AT — the same rule mp-file-manager follows.)
|
|
61
|
+
*
|
|
62
|
+
* Every name carries the row title. N buttons all called "Add" is the classic
|
|
63
|
+
* failure of a tree like this: a screen-reader user hears the same name on
|
|
64
|
+
* every row and cannot tell which group they are adding to. Depth stays out of
|
|
65
|
+
* it entirely — `aria-level` is invalid on these roles, so nesting is conveyed
|
|
66
|
+
* by the name and the indent, not by an attribute axe flags.
|
|
67
|
+
*/
|
|
68
|
+
private appendResourceActions;
|
|
69
|
+
/**
|
|
70
|
+
* One icon button. The glyph is `aria-hidden` and the name lives on the
|
|
71
|
+
* button, so the accessible name is the localized sentence rather than "+".
|
|
72
|
+
*/
|
|
73
|
+
private createResourceAction;
|
|
74
|
+
/**
|
|
75
|
+
* Native `<input type="color">` for the resource's colour — the recolour half
|
|
76
|
+
* of R7. Native because it is keyboard-operable, localized and screen-reader
|
|
77
|
+
* labelled by the platform for free; a custom swatch grid would have to
|
|
78
|
+
* re-earn all three.
|
|
79
|
+
*
|
|
80
|
+
* It edits whichever field actually drives the rendered events: `eventColor`
|
|
81
|
+
* wins over `color` in `resolveEventColor`, so writing `color` on a resource
|
|
82
|
+
* that has an `eventColor` would look like the control did nothing.
|
|
83
|
+
*/
|
|
84
|
+
private createColorSwatch;
|
|
85
|
+
/**
|
|
86
|
+
* Root-level "Add resource" / "Add group" bar, pinned to the bottom of the
|
|
87
|
+
* frozen resource column (the spreadsheet/Jira idiom: creation lives at the
|
|
88
|
+
* end of the list, in the column the new row will appear in).
|
|
89
|
+
*
|
|
90
|
+
* Deliberately a sibling of the grid, not a row inside it: a row whose only
|
|
91
|
+
* content is buttons has to fake a rowheader, inflates `aria-rowcount`, and
|
|
92
|
+
* puts Tab stops inside a roving-tabindex grid. Outside, it is just a toolbar.
|
|
93
|
+
*/
|
|
94
|
+
private createAddBar;
|
|
95
|
+
/**
|
|
96
|
+
* The "(No resource)" bucket row.
|
|
97
|
+
*
|
|
98
|
+
* Structurally identical to a resource row so keyboard nav, roving tabindex and
|
|
99
|
+
* the grid ARIA chain all treat it as one more row — but its slots carry NO
|
|
100
|
+
* `data-resource-id`, so a create-drag started here produces an unassigned
|
|
101
|
+
* event rather than inventing membership of a resource that doesn't exist.
|
|
102
|
+
*/
|
|
103
|
+
private createUnassignedRow;
|
|
17
104
|
private renderEvents;
|
|
18
105
|
private createEventElement;
|
|
106
|
+
/**
|
|
107
|
+
* Dashed ghost showing where the event will land. Mirrors
|
|
108
|
+
* week-view.renderPreviewEvent for the horizontal axis.
|
|
109
|
+
*
|
|
110
|
+
* Gated on `previewEvent` alone — NOT on `dragState`, which only the pointer
|
|
111
|
+
* drag path writes. Keyboard move-mode sets `previewEvent` with no
|
|
112
|
+
* `dragState`, so requiring it hid the ghost from keyboard users on this
|
|
113
|
+
* view while week/day showed it.
|
|
114
|
+
*/
|
|
115
|
+
private renderPreviewEvent;
|
|
19
116
|
update(state: SchedulerState): void;
|
|
20
117
|
private optionsRequireRerender;
|
|
21
118
|
private updateGreyedSlots;
|
|
@@ -20,6 +20,12 @@ export declare class WeekView extends BaseView {
|
|
|
20
20
|
private optionsRequireRerender;
|
|
21
21
|
private renderEvents;
|
|
22
22
|
private createEventElement;
|
|
23
|
+
/**
|
|
24
|
+
* Dashed ghost showing where the dragged/created range will land — ONE box per
|
|
25
|
+
* day it spans, mirroring how a committed multi-day event splits into parts.
|
|
26
|
+
* A single box measured from the start day's midnight produced a ~2900px-tall
|
|
27
|
+
* box hanging out of the first column for a 3-day range.
|
|
28
|
+
*/
|
|
23
29
|
private renderPreviewEvent;
|
|
24
30
|
private updateGreyedSlots;
|
|
25
31
|
private renderNowIndicator;
|