@mintplayer/web-components 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +19 -1
- package/chunks/{id-BstjfRrz.mjs → id-DNZVAnGC.mjs} +267 -162
- package/chunks/{mp-calendar.element-u6uS31_j.mjs → mp-calendar.element-CJ8-t-Zn.mjs} +71 -39
- package/chunks/{mp-datetime-picker.element-MPTRHwyc.mjs → mp-datetime-picker.element-D1CiLbHm.mjs} +1 -1
- package/datepicker/index.mjs +1 -1
- package/datetime-picker/index.mjs +1 -1
- package/package.json +1 -1
- package/scheduler/index.mjs +1332 -765
- package/scheduler/src/components/mp-scheduler.d.ts +186 -1
- package/scheduler/src/input/input-handler.d.ts +22 -0
- package/scheduler/src/views/base-view.d.ts +30 -1
- package/scheduler/src/views/index.d.ts +1 -1
- package/scheduler/src/views/timeline-view.d.ts +39 -15
- package/scheduler/src/views/year-view.d.ts +7 -0
- package/scheduler-core/index.mjs +42 -40
- package/scheduler-core/src/models/messages.d.ts +29 -0
- package/scheduler-core/src/models/options.d.ts +24 -7
- package/scheduler-core/src/services/date.service.d.ts +64 -10
- package/scheduler-core/src/utils/color.d.ts +19 -0
|
@@ -58,6 +58,27 @@ export declare class MpScheduler extends LitElement {
|
|
|
58
58
|
* silently behind the user's focus.
|
|
59
59
|
*/
|
|
60
60
|
private readonly dayPopover;
|
|
61
|
+
/** Resource/group whose actions panel is open, or null when it is closed. */
|
|
62
|
+
private rowMenuResourceId;
|
|
63
|
+
/**
|
|
64
|
+
* The row-actions panel (R1/R3/R4): the four controls that used to sit inline
|
|
65
|
+
* in the pinned resource column, moved behind one 24px trigger so the column
|
|
66
|
+
* can be narrow enough to use on a phone.
|
|
67
|
+
*
|
|
68
|
+
* A `role="dialog"`, deliberately NOT a `role="menu"`. A menu owns only
|
|
69
|
+
* `menuitem`-family children, and this panel contains a native
|
|
70
|
+
* `<input type="color">` — a form control inside a menu is an invalid owned
|
|
71
|
+
* child, and "a menu that is really a dialog" is the shape to avoid. Keeping
|
|
72
|
+
* the native input is worth the distinction: it is keyboard-operable,
|
|
73
|
+
* localized and screen-reader labelled by the platform for free.
|
|
74
|
+
*
|
|
75
|
+
* Same mechanics as the two overlays above, including the two traps: the
|
|
76
|
+
* anchor resolves LAZILY by id (the timeline rebuilds its DOM on every state
|
|
77
|
+
* change, so a captured element detaches under the open panel), and `onClose`
|
|
78
|
+
* mirrors dismissal back into state or the panel stays rendered after an
|
|
79
|
+
* outside-click.
|
|
80
|
+
*/
|
|
81
|
+
private readonly rowMenuOverlay;
|
|
61
82
|
/** Event the built-in editor is open for, or null when it is closed. */
|
|
62
83
|
private editorEventId;
|
|
63
84
|
/**
|
|
@@ -137,6 +158,14 @@ export declare class MpScheduler extends LitElement {
|
|
|
137
158
|
* Localized string lookup: options.messages overrides merged onto the
|
|
138
159
|
* English defaults, with {placeholder} interpolation.
|
|
139
160
|
*/
|
|
161
|
+
/**
|
|
162
|
+
* Which keymap the grid advertises (audit M6). The keys genuinely differ per
|
|
163
|
+
* view, so the single global string was not merely vague — it was false: it
|
|
164
|
+
* promised that Enter creates an event, which in year view opens the month
|
|
165
|
+
* instead, and it never mentioned Space, the only way to reach the popover
|
|
166
|
+
* in month or year.
|
|
167
|
+
*/
|
|
168
|
+
private gridInstructionsKey;
|
|
140
169
|
private msg;
|
|
141
170
|
render(): TemplateResult;
|
|
142
171
|
/**
|
|
@@ -154,6 +183,53 @@ export declare class MpScheduler extends LitElement {
|
|
|
154
183
|
* is `event-selected`, "New event" is `event-create`, "Show day" is the same
|
|
155
184
|
* drill the "+N more" link used to do.
|
|
156
185
|
*/
|
|
186
|
+
/**
|
|
187
|
+
* The open panel's trigger, resolved by id because the timeline rebuilds its
|
|
188
|
+
* DOM on every state change.
|
|
189
|
+
*
|
|
190
|
+
* Matched by reading `dataset` rather than by building an attribute selector:
|
|
191
|
+
* a resource id is consumer data and may contain quotes or brackets, and
|
|
192
|
+
* `CSS.escape` is not available everywhere (jsdom has no `CSS` global at all,
|
|
193
|
+
* which threw here). Scanning a handful of buttons costs nothing.
|
|
194
|
+
*/
|
|
195
|
+
private rowMenuTriggerById;
|
|
196
|
+
/**
|
|
197
|
+
* `aria-expanded` belongs on the trigger and must change in the same beat as
|
|
198
|
+
* the visual state. The trigger is imperative DOM (the timeline builds it), so
|
|
199
|
+
* it cannot ride Lit's render — it is written here and re-asserted after every
|
|
200
|
+
* rebuild.
|
|
201
|
+
*/
|
|
202
|
+
private syncRowMenuTriggerState;
|
|
203
|
+
/** Move focus from the focused cell onto its row's actions trigger. */
|
|
204
|
+
private focusRowTrigger;
|
|
205
|
+
/**
|
|
206
|
+
* Keys while the row's trigger has focus. It sits outside the roving cell
|
|
207
|
+
* model, so it needs its own small map: open, or hand focus back to the grid.
|
|
208
|
+
*/
|
|
209
|
+
private handleRowTriggerKeyDown;
|
|
210
|
+
/**
|
|
211
|
+
* Open the actions panel for a row, or re-target it if another row's is open.
|
|
212
|
+
*
|
|
213
|
+
* `OverlayController.open()` is a no-op while already open, and the anchor is
|
|
214
|
+
* resolved lazily by id — so simply changing the id repainted the panel's
|
|
215
|
+
* CONTENTS for the new row while leaving it positioned under the previous
|
|
216
|
+
* row's trigger. The outside-mousedown dismissal cannot break the tie either:
|
|
217
|
+
* it ignores any press whose composed path includes the host, and every
|
|
218
|
+
* trigger is inside the host. Nothing was going to close it.
|
|
219
|
+
*
|
|
220
|
+
* So a different row is treated as what it is — a different dialog: close,
|
|
221
|
+
* then open. `close(false)` deliberately does NOT return focus, because the
|
|
222
|
+
* user's focus is already on the new trigger; handing it back to the old one
|
|
223
|
+
* would flicker, and would make the following `open()` capture the wrong
|
|
224
|
+
* element as its Escape target.
|
|
225
|
+
*/
|
|
226
|
+
private openRowMenu;
|
|
227
|
+
private closeRowMenu;
|
|
228
|
+
/**
|
|
229
|
+
* The row-actions panel. Built from the SAME permission list the trigger
|
|
230
|
+
* consults, so a button never promises a panel that turns out to be empty.
|
|
231
|
+
*/
|
|
232
|
+
private renderRowMenu;
|
|
157
233
|
private renderDayPopover;
|
|
158
234
|
private renderPopoverEvent;
|
|
159
235
|
/**
|
|
@@ -242,8 +318,51 @@ export declare class MpScheduler extends LitElement {
|
|
|
242
318
|
private editorTimeFields;
|
|
243
319
|
private tryOpenEventEditor;
|
|
244
320
|
private closeEventEditor;
|
|
245
|
-
/**
|
|
321
|
+
/**
|
|
322
|
+
* Right-click on an event box opens the editor (D12.8b) — on a POINTING device
|
|
323
|
+
* only.
|
|
324
|
+
*
|
|
325
|
+
* On touch the browser synthesizes `contextmenu` from a long-press at roughly
|
|
326
|
+
* 500ms, which lands ~100ms before our own 600ms hold-to-drag arms. Acting on
|
|
327
|
+
* it made dragging unreachable on a phone (R9): the editor opened every time
|
|
328
|
+
* and the drag never started. So a touch-originated `contextmenu` is consumed
|
|
329
|
+
* and discarded here, leaving the gesture to the hold timer.
|
|
330
|
+
*
|
|
331
|
+
* `preventDefault` on the touch path is what stops the *platform* menu from
|
|
332
|
+
* appearing over an arming drag. It is called for every touch target, not just
|
|
333
|
+
* events, because the hold timer arms on every target — a long-press on empty
|
|
334
|
+
* grid arms drag-to-create, and used to do so underneath Android's own menu.
|
|
335
|
+
*/
|
|
246
336
|
private handleContextMenu;
|
|
337
|
+
/**
|
|
338
|
+
* Did this `contextmenu` come from a finger?
|
|
339
|
+
*
|
|
340
|
+
* Two signals, because no single one is portable. Chromium delivers
|
|
341
|
+
* `contextmenu` as a `PointerEvent` and its `pointerType` is authoritative when
|
|
342
|
+
* present; Firefox and WebKit deliver a bare `MouseEvent` with no such field,
|
|
343
|
+
* so those fall back to the device recorded at `touchstart`/`mousedown`.
|
|
344
|
+
*
|
|
345
|
+
* Measured, not assumed — see the spike in the PRD (§14.3). The browser's
|
|
346
|
+
* long-press gesture cannot be synthesized through CDP, so this decision is the
|
|
347
|
+
* only part of the touch story an automated test can reach.
|
|
348
|
+
*/
|
|
349
|
+
private isTouchContextMenu;
|
|
350
|
+
/**
|
|
351
|
+
* Does the editor's time list use a 12-hour clock?
|
|
352
|
+
*
|
|
353
|
+
* `mp-datetime-picker.hour12` is a boolean, so an unset `timeFormat` has to be
|
|
354
|
+
* resolved rather than read as false — otherwise a US user gets a 24-hour
|
|
355
|
+
* picker inside a scheduler that renders 12-hour times everywhere else.
|
|
356
|
+
* `detectTimeFormat` is the `Intl` probe written for this and, until now,
|
|
357
|
+
* never called from the component.
|
|
358
|
+
*/
|
|
359
|
+
/**
|
|
360
|
+
* The week's first day: the consumer's choice, else the locale's convention.
|
|
361
|
+
* Mirrors `BaseView.firstDayOfWeek` — resolved at the point of use so a later
|
|
362
|
+
* locale change is picked up, never written back into `options`.
|
|
363
|
+
*/
|
|
364
|
+
private firstDayOfWeek;
|
|
365
|
+
private resolvedHour12;
|
|
247
366
|
/**
|
|
248
367
|
* Minute granularity for the editor's time lists, derived from the grid's own
|
|
249
368
|
* `slotDuration` so the two agree — picking a time the grid cannot represent
|
|
@@ -386,8 +505,20 @@ export declare class MpScheduler extends LitElement {
|
|
|
386
505
|
private observeHeaderWidth;
|
|
387
506
|
private renderView;
|
|
388
507
|
private onStateChange;
|
|
508
|
+
/** The view the `scheduler-kbd-grid` description was last rendered for. */
|
|
509
|
+
private keymapView;
|
|
389
510
|
private previousIsLoading;
|
|
390
511
|
private detectAndEmitChanges;
|
|
512
|
+
/**
|
|
513
|
+
* Re-apply the header's localized labels.
|
|
514
|
+
*
|
|
515
|
+
* The chrome is built imperatively once, in `firstUpdated`, so its button text
|
|
516
|
+
* froze at whatever `options.messages` held at that moment. The TITLE updated
|
|
517
|
+
* on every state change and the buttons did not, so switching language at
|
|
518
|
+
* runtime produced a half-translated header — Dutch dates over English
|
|
519
|
+
* buttons. Cheap enough to redo unconditionally: eight string assignments.
|
|
520
|
+
*/
|
|
521
|
+
private applyHeaderLabels;
|
|
391
522
|
private updateUI;
|
|
392
523
|
private scheduleDragUpdate;
|
|
393
524
|
private handlePointerDown;
|
|
@@ -460,9 +591,32 @@ export declare class MpScheduler extends LitElement {
|
|
|
460
591
|
* to the host. Use composedPath()[0] for the actual focused element.
|
|
461
592
|
*/
|
|
462
593
|
private handleFocusIn;
|
|
594
|
+
/**
|
|
595
|
+
* Is this key event coming from inside one of the open panels?
|
|
596
|
+
*
|
|
597
|
+
* The dialogs are deliberately NON-modal, which invites the user to Shift+Tab
|
|
598
|
+
* back to the grid while one is open. The guards below used to return
|
|
599
|
+
* unconditionally on `isOpen`, so every arrow, Enter and Escape in the grid
|
|
600
|
+
* was swallowed and the widget read as broken (audit M12). Claiming keys only
|
|
601
|
+
* when focus is actually inside the panel fixes that without weakening the
|
|
602
|
+
* Escape arbitration, which is the reason the guards exist.
|
|
603
|
+
*/
|
|
604
|
+
private eventInsidePanel;
|
|
463
605
|
private handleKeyDown;
|
|
464
606
|
/** Keyboard face of the more-link / year-month-header click delegation. */
|
|
465
607
|
private activateFocusedDrillControl;
|
|
608
|
+
/**
|
|
609
|
+
* Drill into `view` at `date` from a control that the resulting rebuild will
|
|
610
|
+
* destroy — which is every drill-down control, by definition.
|
|
611
|
+
*
|
|
612
|
+
* The focus restore has to happen HERE rather than being left to the view
|
|
613
|
+
* switch. `setDate` rebuilds the current view first, and that rebuild already
|
|
614
|
+
* drops focus to `<body>`; by the time the switch looks for something worth
|
|
615
|
+
* restoring, there is nothing focused inside the widget and it correctly
|
|
616
|
+
* declines to steal focus from wherever it went. So the switch's own
|
|
617
|
+
* restoration can never cover this path.
|
|
618
|
+
*/
|
|
619
|
+
private drillTo;
|
|
466
620
|
private getFocusedKind;
|
|
467
621
|
private handleAltShortcut;
|
|
468
622
|
/**
|
|
@@ -593,6 +747,23 @@ export declare class MpScheduler extends LitElement {
|
|
|
593
747
|
* why the bucket was unreachable by keyboard.
|
|
594
748
|
*/
|
|
595
749
|
private adjacentRow;
|
|
750
|
+
/**
|
|
751
|
+
* The rows a keyboard user can land on, in the order the timeline draws them.
|
|
752
|
+
*
|
|
753
|
+
* `includeGroups` is the whole difference between navigating and moving.
|
|
754
|
+
* Arrow keys navigate, and a group row is a real row with real gridcells that
|
|
755
|
+
* can even hold the grid's only tab stop — skipping it is what made the first
|
|
756
|
+
* arrow press teleport the user to an unrelated row (audit M10). Move-mode
|
|
757
|
+
* carries an event with it, and a group row renders no events container, so a
|
|
758
|
+
* group must never be offered as a destination there.
|
|
759
|
+
*/
|
|
760
|
+
private navigableRows;
|
|
761
|
+
/**
|
|
762
|
+
* Title of any row, group rows included. `getAllResources` returns leaves
|
|
763
|
+
* only by design, so while that was the lookup, arrowing onto a group row
|
|
764
|
+
* announced the time with no row name at all — swapping M10's teleport for a
|
|
765
|
+
* silent row rather than fixing it.
|
|
766
|
+
*/
|
|
596
767
|
private getResourceTitle;
|
|
597
768
|
/**
|
|
598
769
|
* Find the cell DOM element for a (slot, resource) pair and call .focus()
|
|
@@ -609,6 +780,20 @@ export declare class MpScheduler extends LitElement {
|
|
|
609
780
|
*/
|
|
610
781
|
private timeCellElement;
|
|
611
782
|
/** Re-focus whatever cell the keyboard model currently considers focused. */
|
|
783
|
+
/**
|
|
784
|
+
* Put focus back inside the grid after a rebuild or a view switch.
|
|
785
|
+
*
|
|
786
|
+
* The fallback is the point. `focusedCell` is null whenever the user never
|
|
787
|
+
* entered the grid, and after a view switch it can name a cell the new view
|
|
788
|
+
* does not render — in both cases this used to do nothing at all and focus
|
|
789
|
+
* stayed on `<body>`. That is reachable from every drill-down control (the
|
|
790
|
+
* week day-number, the more-link, the year month-header): activating one
|
|
791
|
+
* destroys the element the user is standing on by definition, since it
|
|
792
|
+
* rebuilds the view underneath them.
|
|
793
|
+
*
|
|
794
|
+
* Every view promotes exactly one cell to `tabindex="0"` as its roving tab
|
|
795
|
+
* stop, so that cell is the correct "wherever this view considers current".
|
|
796
|
+
*/
|
|
612
797
|
private focusFocusedCell;
|
|
613
798
|
/**
|
|
614
799
|
* Parse a `YYYY-MM-DD` day key as a LOCAL date.
|
|
@@ -48,6 +48,20 @@ export interface InputHandlerConfig {
|
|
|
48
48
|
export declare class InputHandler {
|
|
49
49
|
private readonly config;
|
|
50
50
|
private readonly callbacks;
|
|
51
|
+
/**
|
|
52
|
+
* Which device produced the gesture in progress.
|
|
53
|
+
*
|
|
54
|
+
* `contextmenu` cannot be trusted to say so itself: Chromium delivers it as a
|
|
55
|
+
* `PointerEvent` carrying `pointerType`, but Firefox and WebKit send a bare
|
|
56
|
+
* `MouseEvent` with no such field. Recording it where the gesture actually
|
|
57
|
+
* starts is the only engine-independent answer, and the scheduler needs one —
|
|
58
|
+
* a touch `contextmenu` must yield to hold-to-drag rather than open the editor.
|
|
59
|
+
*
|
|
60
|
+
* Pen is deliberately NOT tracked as touch: a stylus drives the mouse path
|
|
61
|
+
* (`mousedown`/`mousemove` with its 5px threshold), never the hold, so it wants
|
|
62
|
+
* the desktop context menu.
|
|
63
|
+
*/
|
|
64
|
+
private lastPointerType;
|
|
51
65
|
private touchHoldTimer;
|
|
52
66
|
private touchStartPosition;
|
|
53
67
|
private isTouchDragMode;
|
|
@@ -68,6 +82,14 @@ export declare class InputHandler {
|
|
|
68
82
|
private readonly boundHandleTouchEnd;
|
|
69
83
|
private readonly boundHandleTouchCancel;
|
|
70
84
|
constructor(config: InputHandlerConfig, callbacks: InputHandlerCallbacks);
|
|
85
|
+
/**
|
|
86
|
+
* True when the gesture in progress came from a finger.
|
|
87
|
+
*
|
|
88
|
+
* The caller is `contextmenu` arbitration: on touch the browser fires that
|
|
89
|
+
* event ~100ms before our 600ms hold arms, so acting on it would make
|
|
90
|
+
* hold-to-drag unreachable.
|
|
91
|
+
*/
|
|
92
|
+
isTouchGesture(): boolean;
|
|
71
93
|
/**
|
|
72
94
|
* Attach all event listeners.
|
|
73
95
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SchedulerEvent, SchedulerEventPart, SchedulerOptions, TimeSlot } from '@mintplayer/web-components/scheduler-core';
|
|
1
|
+
import { SchedulerEvent, SchedulerEventPart, DayOfWeek, 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.
|
|
@@ -6,6 +6,12 @@ import { SchedulerState } from '../state/scheduler-state';
|
|
|
6
6
|
* the event has no resource or the caller doesn't have it (week/day views).
|
|
7
7
|
* Strings and date formatting follow options.messages / options.locale.
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* `YYYY-MM-DD` in LOCAL components — the wire format `parseDayKey` round-trips
|
|
11
|
+
* without a timezone shift. Deliberately not `toISOString()`, which is UTC and
|
|
12
|
+
* names the wrong day either side of midnight for most of the world.
|
|
13
|
+
*/
|
|
14
|
+
export declare function toDayKey(d: Date): string;
|
|
9
15
|
export declare function formatEventAriaLabel(event: SchedulerEvent, resourceTitle: string | null, options: SchedulerOptions): string;
|
|
10
16
|
/**
|
|
11
17
|
* Normalised selection range — covers anchor.start through extent.end (or
|
|
@@ -52,6 +58,16 @@ export declare abstract class BaseView {
|
|
|
52
58
|
protected container: HTMLElement;
|
|
53
59
|
protected state: SchedulerState;
|
|
54
60
|
constructor(container: HTMLElement, state: SchedulerState);
|
|
61
|
+
/**
|
|
62
|
+
* The week's first day for the current options — the consumer's choice if they
|
|
63
|
+
* made one, otherwise the locale's own convention (Sunday for en-US and ja-JP,
|
|
64
|
+
* Monday across most of Europe).
|
|
65
|
+
*
|
|
66
|
+
* Resolved at the point of use rather than written back into `options`:
|
|
67
|
+
* `setOptions` merges cumulatively, so a stored derivation would freeze at the
|
|
68
|
+
* locale that produced it and quietly ignore a later locale change.
|
|
69
|
+
*/
|
|
70
|
+
protected get firstDayOfWeek(): DayOfWeek;
|
|
55
71
|
/**
|
|
56
72
|
* Update the view with new state
|
|
57
73
|
*/
|
|
@@ -113,6 +129,11 @@ export declare abstract class BaseView {
|
|
|
113
129
|
/**
|
|
114
130
|
* Helper to clear container
|
|
115
131
|
*/
|
|
132
|
+
/**
|
|
133
|
+
* Scroll offsets captured by `clearContainer`, awaiting the rAF that puts them
|
|
134
|
+
* back. Null when no restore is in flight.
|
|
135
|
+
*/
|
|
136
|
+
private pendingScroll;
|
|
116
137
|
protected clearContainer(): void;
|
|
117
138
|
/**
|
|
118
139
|
* Append the start/end resize handles for an event part. The handle strip
|
|
@@ -147,6 +168,14 @@ export declare abstract class BaseView {
|
|
|
147
168
|
cells?: string;
|
|
148
169
|
/** Grids where Shift+Arrow extends a multi-cell range (week/day). */
|
|
149
170
|
multiselectable?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Accessible name for the grid. REQUIRED in practice: without it a screen
|
|
173
|
+
* reader announces "grid" over hundreds of unnamed cells with no indication
|
|
174
|
+
* of what it is, and two schedulers on a page are indistinguishable.
|
|
175
|
+
* A consumer's own `aria-label` on the host wins — the host has no role, so
|
|
176
|
+
* that attribute reaches nothing on its own.
|
|
177
|
+
*/
|
|
178
|
+
label?: string;
|
|
150
179
|
}): void;
|
|
151
180
|
/** aria-current="date" on every element the views styled `.today`. */
|
|
152
181
|
protected markToday(): void;
|
|
@@ -3,4 +3,4 @@ export { YearView } from './year-view';
|
|
|
3
3
|
export { MonthView } from './month-view';
|
|
4
4
|
export { WeekView } from './week-view';
|
|
5
5
|
export { DayView } from './day-view';
|
|
6
|
-
export { TimelineView } from './timeline-view';
|
|
6
|
+
export { TimelineView, type RowAction } from './timeline-view';
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { Resource, ResourceGroup } from '@mintplayer/web-components/scheduler-core';
|
|
1
2
|
import { BaseView } from './base-view';
|
|
2
3
|
import { SchedulerState } from '../state/scheduler-state';
|
|
4
|
+
/**
|
|
5
|
+
* The actions a resource row can offer, in the order they are presented.
|
|
6
|
+
* Mirrors the `data-action` values the component's handler already switches on,
|
|
7
|
+
* so moving them into a panel changed no behaviour.
|
|
8
|
+
*/
|
|
9
|
+
export type RowAction = 'rename-resource' | 'add-resource' | 'add-group' | 'set-resource-color' | 'delete-resource';
|
|
3
10
|
/**
|
|
4
11
|
* Timeline view renderer
|
|
5
12
|
*/
|
|
@@ -65,9 +72,16 @@ export declare class TimelineView extends BaseView {
|
|
|
65
72
|
* strips classes and ARIA, not inline style), which is what makes the
|
|
66
73
|
* user's chosen width sticky.
|
|
67
74
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
75
|
+
* On its placement (audit M11): it lives inside the corner columnheader,
|
|
76
|
+
* which IS inside the `role="grid"` subtree — an earlier comment here claimed
|
|
77
|
+
* the opposite. That is fine, but not for the reason the old comment gave.
|
|
78
|
+
* `columnheader` places no restriction on its own descendants, so the
|
|
79
|
+
* separator breaks no owned-children rule; and it is a deliberate second Tab
|
|
80
|
+
* stop rather than a trap, because `getFocusedKind()` matches on the cell and
|
|
81
|
+
* event classes and returns `'other'` here, so the grid's arrow handling
|
|
82
|
+
* declines the key and only this element's own listener resizes. Moving it out
|
|
83
|
+
* of the grid would mean rebuilding the containing block it positions against
|
|
84
|
+
* — the sticky corner cell — for no accessibility gain.
|
|
71
85
|
*/
|
|
72
86
|
private createColumnResizer;
|
|
73
87
|
private currentColumnWidth;
|
|
@@ -94,23 +108,33 @@ export declare class TimelineView extends BaseView {
|
|
|
94
108
|
* it entirely — `aria-level` is invalid on these roles, so nesting is conveyed
|
|
95
109
|
* by the name and the indent, not by an attribute axe flags.
|
|
96
110
|
*/
|
|
97
|
-
private appendResourceActions;
|
|
98
111
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
112
|
+
* Which actions this row offers. One list, consulted twice: here to decide
|
|
113
|
+
* whether the row deserves a trigger at all, and by the component to build the
|
|
114
|
+
* panel's contents. Keeping it in one place is what stops the button from
|
|
115
|
+
* promising a menu that turns out to be empty.
|
|
101
116
|
*/
|
|
102
|
-
|
|
117
|
+
rowActions(item: Resource | ResourceGroup): RowAction[];
|
|
103
118
|
/**
|
|
104
|
-
*
|
|
105
|
-
* of R7. Native because it is keyboard-operable, localized and screen-reader
|
|
106
|
-
* labelled by the platform for free; a custom swatch grid would have to
|
|
107
|
-
* re-earn all three.
|
|
119
|
+
* The row's actions trigger — one 24px button where four controls used to sit.
|
|
108
120
|
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
121
|
+
* Those four (add resource, add subgroup, a colour input, delete) took 102px of
|
|
122
|
+
* a 200px column, leaving roughly 50px for the resource title: five characters,
|
|
123
|
+
* silently ellipsised. #395 shipped them inline and #396's D12.1c predicted
|
|
124
|
+
* this exact complaint; §11.2 named the trigger for revisiting it. The
|
|
125
|
+
* behaviour is unchanged — every action keeps its `data-action`, its permission
|
|
126
|
+
* gate and its emitted event — only the layout is reverted.
|
|
127
|
+
*
|
|
128
|
+
* The button doubles as the row's colour chip. A group's `color` is stored and
|
|
129
|
+
* editable but was painted nowhere in this column, so this is the first place
|
|
130
|
+
* it becomes visible where it is set.
|
|
131
|
+
*
|
|
132
|
+
* `data-action` + `data-resource-id` are load-bearing, not decoration: the
|
|
133
|
+
* timeline rebuilds its DOM on every state change, and
|
|
134
|
+
* captureActionFocus/restoreActionFocus restores focus by exactly that key.
|
|
135
|
+
* Omitting it reproduces the expand toggle's bug, where focus falls to <body>.
|
|
112
136
|
*/
|
|
113
|
-
private
|
|
137
|
+
private appendResourceActions;
|
|
114
138
|
/**
|
|
115
139
|
* Root-level "Add resource" / "Add group" bar, pinned to the bottom of the
|
|
116
140
|
* frozen resource column (the spreadsheet/Jira idiom: creation lives at the
|
|
@@ -23,5 +23,12 @@ export declare class YearView extends BaseView {
|
|
|
23
23
|
*/
|
|
24
24
|
private updateMonthCardFocus;
|
|
25
25
|
update(state: SchedulerState): void;
|
|
26
|
+
/**
|
|
27
|
+
* The check the other three views already had, and this one did not: without it
|
|
28
|
+
* a runtime `locale` or `firstDayOfWeek` change left all twelve mini-calendars
|
|
29
|
+
* frozen at the previous locale, so a language switch appeared to do nothing
|
|
30
|
+
* while the year view was showing.
|
|
31
|
+
*/
|
|
32
|
+
private optionsRequireRerender;
|
|
26
33
|
destroy(): void;
|
|
27
34
|
}
|
package/scheduler-core/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import { a as U, b as V, c as j, e as G, f as X, R as Y, T as q, g as J, h as K, i as Q, j as Z, k as tt, l as et, m as ot, n as st, o as nt, p as it, q as ct, r as rt, s as at, t as lt, u as dt, v as gt, w as ht, x as ut } from "../chunks/id-
|
|
3
|
-
class
|
|
1
|
+
import { D as C, d as $ } from "../chunks/id-DNZVAnGC.mjs";
|
|
2
|
+
import { a as U, b as V, c as j, e as G, f as X, R as Y, T as q, g as J, h as K, i as Q, j as Z, k as tt, l as et, m as ot, n as st, o as nt, p as it, q as ct, r as rt, s as at, t as lt, u as dt, v as gt, w as ht, x as ut, y as ft, z as mt } from "../chunks/id-DNZVAnGC.mjs";
|
|
3
|
+
class x {
|
|
4
4
|
/**
|
|
5
5
|
* Calculate position for an event part in week/day view
|
|
6
6
|
*/
|
|
7
7
|
calculateWeekPosition(t, e, s, n, i, l = {}) {
|
|
8
|
-
const c = {
|
|
8
|
+
const c = { ...C, ...l };
|
|
9
9
|
new Date(t.start).setHours(0, 0, 0, 0);
|
|
10
|
-
const a =
|
|
10
|
+
const a = $.getSecondsFromMidnight(t.start), u = $.getSecondsFromMidnight(t.end) - a, [d] = c.slotMinTime.split(":").map(Number), [f] = c.slotMaxTime.split(":").map(Number), g = (f - d) * 3600, m = (a - d * 3600) / g * 100, v = u / g * 100, S = 10, p = (100 - S) / i, T = p / s, b = S + n * p + e * T;
|
|
11
11
|
return {
|
|
12
12
|
top: m,
|
|
13
13
|
left: b,
|
|
14
14
|
width: T,
|
|
15
|
-
height:
|
|
15
|
+
height: v,
|
|
16
16
|
zIndex: e + 1
|
|
17
17
|
};
|
|
18
18
|
}
|
|
@@ -20,7 +20,7 @@ class w {
|
|
|
20
20
|
* Calculate position for an event in timeline view
|
|
21
21
|
*/
|
|
22
22
|
calculateTimelinePosition(t, e, s, n, i, l = {}) {
|
|
23
|
-
({
|
|
23
|
+
({ ...C, ...l });
|
|
24
24
|
const c = i.getTime() - n.getTime(), r = Math.max(t.start.getTime(), n.getTime()), a = Math.min(t.end.getTime(), i.getTime()), h = r - n.getTime(), u = a - r, d = h / c * 100, f = u / c * 100, g = 100 / s;
|
|
25
25
|
return {
|
|
26
26
|
top: e * g,
|
|
@@ -82,12 +82,12 @@ class w {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
const I = new
|
|
85
|
+
const I = new x();
|
|
86
86
|
function P(o, t) {
|
|
87
87
|
const e = Object.entries(t).map(([s, n]) => `[data-${s}="${n}"]`).join("");
|
|
88
88
|
return o.querySelector(e);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function z(o) {
|
|
91
91
|
const t = o.dataset, e = {};
|
|
92
92
|
for (const s in t) {
|
|
93
93
|
const n = t[s];
|
|
@@ -95,16 +95,16 @@ function D(o) {
|
|
|
95
95
|
}
|
|
96
96
|
return e;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function D(o, t) {
|
|
99
99
|
return o.closest(`[data-${t}]`);
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function L(o) {
|
|
102
102
|
return {
|
|
103
103
|
top: o.scrollTop,
|
|
104
104
|
left: o.scrollLeft
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function M(o, t, e = "smooth") {
|
|
108
108
|
const s = o.getBoundingClientRect(), i = t.getBoundingClientRect().top - s.top + o.scrollTop;
|
|
109
109
|
o.scrollTo({
|
|
110
110
|
top: i,
|
|
@@ -122,10 +122,10 @@ function B(o, t) {
|
|
|
122
122
|
y: n - e.top
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function W(o, t, e) {
|
|
126
126
|
o.style.setProperty(`--${t}`, e);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function A(o, t) {
|
|
129
129
|
return getComputedStyle(o).getPropertyValue(`--${t}`).trim();
|
|
130
130
|
}
|
|
131
131
|
function F(o, ...t) {
|
|
@@ -141,42 +141,44 @@ export {
|
|
|
141
141
|
U as DEFAULT_COLORS,
|
|
142
142
|
V as DEFAULT_EVENT_COLOR,
|
|
143
143
|
j as DEFAULT_MESSAGES,
|
|
144
|
-
|
|
144
|
+
C as DEFAULT_OPTIONS,
|
|
145
145
|
G as DEFAULT_PERMISSIONS,
|
|
146
146
|
X as DateService,
|
|
147
|
-
|
|
147
|
+
x as PositionService,
|
|
148
148
|
Y as ResourceService,
|
|
149
149
|
q as TimelineService,
|
|
150
150
|
J as addAlpha,
|
|
151
151
|
F as addClasses,
|
|
152
|
-
K as
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
Z as
|
|
157
|
-
tt as
|
|
158
|
-
et as
|
|
159
|
-
ot as
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
nt as
|
|
163
|
-
|
|
152
|
+
K as contrastRatioWith,
|
|
153
|
+
Q as darkenColor,
|
|
154
|
+
$ as dateService,
|
|
155
|
+
D as findClosestWithData,
|
|
156
|
+
Z as formatMessage,
|
|
157
|
+
tt as generateEventId,
|
|
158
|
+
et as generateGroupId,
|
|
159
|
+
ot as generateId,
|
|
160
|
+
st as generateResourceId,
|
|
161
|
+
A as getCSSVariable,
|
|
162
|
+
nt as getColorByIndex,
|
|
163
|
+
it as getContrastColor,
|
|
164
|
+
z as getDataAttributes,
|
|
164
165
|
P as getElementByData,
|
|
166
|
+
ct as getReadableTextColor,
|
|
165
167
|
B as getRelativePosition,
|
|
166
|
-
|
|
168
|
+
L as getScrollPosition,
|
|
167
169
|
O as isInViewport,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
rt as isResource,
|
|
171
|
+
at as isResourceGroup,
|
|
172
|
+
lt as lightenColor,
|
|
171
173
|
I as positionService,
|
|
172
174
|
_ as removeClasses,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
dt as resolveCapability,
|
|
176
|
+
gt as resolveEventColor,
|
|
177
|
+
ht as resolveMessages,
|
|
178
|
+
ut as resolveResizeEdge,
|
|
179
|
+
ft as resourceService,
|
|
180
|
+
M as scrollToTime,
|
|
181
|
+
W as setCSSVariable,
|
|
182
|
+
mt as timelineService,
|
|
181
183
|
k as toggleClass
|
|
182
184
|
};
|
|
@@ -24,6 +24,14 @@ export interface SchedulerMessages {
|
|
|
24
24
|
noResources: string;
|
|
25
25
|
/** {date} — formatted first day of the visible week */
|
|
26
26
|
timelineGridLabel: string;
|
|
27
|
+
/** {date} — the visible period. Accessible name of the week grid. */
|
|
28
|
+
weekGridLabel: string;
|
|
29
|
+
/** {date} — the visible day. */
|
|
30
|
+
dayGridLabel: string;
|
|
31
|
+
/** {date} — the visible month. */
|
|
32
|
+
monthGridLabel: string;
|
|
33
|
+
/** {date} — the visible year. */
|
|
34
|
+
yearGridLabel: string;
|
|
27
35
|
/** {title} — resource group title */
|
|
28
36
|
expandGroup: string;
|
|
29
37
|
/** {title} — resource group title */
|
|
@@ -32,6 +40,10 @@ export interface SchedulerMessages {
|
|
|
32
40
|
addResourceBarLabel: string;
|
|
33
41
|
addResource: string;
|
|
34
42
|
addGroup: string;
|
|
43
|
+
/** {title} — accessible name of the row's actions button. */
|
|
44
|
+
rowMenuLabel: string;
|
|
45
|
+
/** Accessible name of the row-actions dialog itself. {title} — the row. */
|
|
46
|
+
rowMenuDialogLabel: string;
|
|
35
47
|
/** {title} — every per-row action names its row, so N buttons aren't all "Add". */
|
|
36
48
|
addResourceToGroup: string;
|
|
37
49
|
/** {title} */
|
|
@@ -42,6 +54,8 @@ export interface SchedulerMessages {
|
|
|
42
54
|
resourceColor: string;
|
|
43
55
|
/** Accessible name of the resource-column resize separator. */
|
|
44
56
|
resizeResourceColumn: string;
|
|
57
|
+
/** {title} — the row-panel entry that starts a rename. */
|
|
58
|
+
renameResource: string;
|
|
45
59
|
/** {title} — accessible name of the inline rename input. */
|
|
46
60
|
renameResourceLabel: string;
|
|
47
61
|
/** {from} {to} — announced after a rename commits. */
|
|
@@ -141,12 +155,27 @@ export interface SchedulerMessages {
|
|
|
141
155
|
slotPlural: string;
|
|
142
156
|
/** {start} {end} */
|
|
143
157
|
selectionCommitted: string;
|
|
158
|
+
/**
|
|
159
|
+
* {date} — accessible name of the day-number drill-down. The visible text is
|
|
160
|
+
* a bare number, which says nothing about what activating it does.
|
|
161
|
+
*/
|
|
162
|
+
openDayView: string;
|
|
163
|
+
/** Week, day and timeline — the views whose focus unit is a time slot. */
|
|
144
164
|
gridInstructions: string;
|
|
165
|
+
/**
|
|
166
|
+
* Month and year keymaps differ enough that the general string was wrong
|
|
167
|
+
* rather than merely vague: in year, Enter drills into the month instead of
|
|
168
|
+
* creating anything, and in both views Space is the only route to the
|
|
169
|
+
* popover — the one place a keyboard user gets day-level detail.
|
|
170
|
+
*/
|
|
171
|
+
gridInstructionsMonth: string;
|
|
172
|
+
gridInstructionsYear: string;
|
|
145
173
|
eventInstructions: string;
|
|
146
174
|
/** The eventInstructions variant used while the built-in editor is enabled. */
|
|
147
175
|
eventInstructionsWithEditor: string;
|
|
148
176
|
/** Read-only variants: no create/move/resize/delete promises. */
|
|
149
177
|
gridInstructionsReadOnly: string;
|
|
178
|
+
gridInstructionsMonthReadOnly: string;
|
|
150
179
|
eventInstructionsReadOnly: string;
|
|
151
180
|
/** Announced when a command is refused by permissions. */
|
|
152
181
|
actionNotAllowed: string;
|