@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.
Files changed (54) hide show
  1. package/a11y/index.mjs +9 -8
  2. package/checkbox/index.mjs +1 -1
  3. package/chunks/error-text-B45eDAt1.mjs +17 -0
  4. package/chunks/{form-associated-axmc5sY0.mjs → form-associated-BR-fUvZ1.mjs} +11 -26
  5. package/chunks/{color-CpFtrIoX.mjs → id-BstjfRrz.mjs} +383 -317
  6. package/chunks/{mp-checkbox-Ph2mMRGz.mjs → mp-checkbox-6EJwdUIn.mjs} +6 -5
  7. package/chunks/{mp-datatable-BwTlh9A_.mjs → mp-datatable-25O1GtvU.mjs} +1 -1
  8. package/chunks/mp-datetime-picker.element-MPTRHwyc.mjs +530 -0
  9. package/chunks/{mp-radio-BjW1HNSc.mjs → mp-radio-DvKgrTFL.mjs} +2 -2
  10. package/chunks/{mp-select-Ctu-v1-p.mjs → mp-select-CKX0eM5C.mjs} +5 -4
  11. package/chunks/{mp-timepicker.element-Bz393NDQ.mjs → mp-timepicker.element-COZEUIoE.mjs} +56 -52
  12. package/chunks/{mp-toggle-button-Kz6sIgBJ.mjs → mp-toggle-button-C4Loq_p4.mjs} +5 -4
  13. package/chunks/{overlay-controller-DPt13i8p.mjs → overlay-controller-D6agzzOI.mjs} +19 -4
  14. package/datatable/index.mjs +1 -1
  15. package/datepicker/index.mjs +1 -1
  16. package/datetime-picker/index.mjs +2 -431
  17. package/datetime-picker/src/mp-datetime-picker.element.d.ts +66 -0
  18. package/file-manager/index.mjs +1 -1
  19. package/navbar/index.mjs +1 -1
  20. package/otp-input/index.mjs +4 -3
  21. package/overlay/index.mjs +1 -1
  22. package/overlay/src/overlay-controller.d.ts +13 -0
  23. package/package.json +1 -1
  24. package/query-builder/index.mjs +2 -2
  25. package/radio/index.mjs +1 -1
  26. package/radio-group/index.mjs +2 -2
  27. package/ribbon/index.mjs +1 -1
  28. package/scheduler/index.mjs +3243 -882
  29. package/scheduler/src/components/mp-scheduler.d.ts +410 -2
  30. package/scheduler/src/events/index.d.ts +0 -1
  31. package/scheduler/src/events/scheduler-event-emitter.d.ts +20 -4
  32. package/scheduler/src/state/scheduler-state.d.ts +59 -7
  33. package/scheduler/src/views/base-view.d.ts +29 -0
  34. package/scheduler/src/views/day-view.d.ts +6 -0
  35. package/scheduler/src/views/timeline-view.d.ts +143 -4
  36. package/scheduler/src/views/week-view.d.ts +6 -0
  37. package/scheduler/src/views/year-view.d.ts +4 -2
  38. package/scheduler-core/index.mjs +63 -58
  39. package/scheduler-core/src/models/event.d.ts +6 -2
  40. package/scheduler-core/src/models/events.d.ts +76 -90
  41. package/scheduler-core/src/models/index.d.ts +1 -0
  42. package/scheduler-core/src/models/messages.d.ts +94 -0
  43. package/scheduler-core/src/models/options.d.ts +72 -16
  44. package/scheduler-core/src/models/permissions.d.ts +114 -0
  45. package/scheduler-core/src/models/time-slot.d.ts +15 -0
  46. package/scheduler-core/src/services/resource.service.d.ts +25 -11
  47. package/scheduler-core/src/utils/color.d.ts +22 -0
  48. package/select/index.mjs +1 -1
  49. package/timepicker/index.mjs +4 -3
  50. package/timepicker/src/mp-time-list.element.d.ts +44 -7
  51. package/timepicker/src/mp-timepicker.element.d.ts +5 -0
  52. package/toggle-button/index.mjs +1 -1
  53. package/tree-select/index.mjs +1 -1
  54. package/scheduler/src/events/event-types.d.ts +0 -58
@@ -18,14 +18,95 @@ export interface SchedulerMessages {
18
18
  viewDay: string;
19
19
  viewTimeline: string;
20
20
  resourcesHeader: string;
21
+ /** Row header for the synthetic bucket holding events with no resource. */
22
+ unassignedResource: string;
23
+ /** Shown in the timeline when there are no resources AND no events at all. */
24
+ noResources: string;
21
25
  /** {date} — formatted first day of the visible week */
22
26
  timelineGridLabel: string;
23
27
  /** {title} — resource group title */
24
28
  expandGroup: string;
25
29
  /** {title} — resource group title */
26
30
  collapseGroup: string;
31
+ /** Toolbar at the foot of the resource column. */
32
+ addResourceBarLabel: string;
33
+ addResource: string;
34
+ addGroup: string;
35
+ /** {title} — every per-row action names its row, so N buttons aren't all "Add". */
36
+ addResourceToGroup: string;
37
+ /** {title} */
38
+ addGroupToGroup: string;
39
+ /** {title} */
40
+ removeResource: string;
41
+ /** {title} */
42
+ resourceColor: string;
43
+ /** Accessible name of the resource-column resize separator. */
44
+ resizeResourceColumn: string;
45
+ /** {title} — accessible name of the inline rename input. */
46
+ renameResourceLabel: string;
47
+ /** {from} {to} — announced after a rename commits. */
48
+ resourceRenamed: string;
27
49
  /** {count} — number of hidden events */
28
50
  moreEvents: string;
51
+ /** {date} — accessible name of the day popover dialog */
52
+ dayPopoverLabel: string;
53
+ /** {count} {events} — events is eventSingular/eventPlural */
54
+ dayPopoverCount: string;
55
+ eventSingular: string;
56
+ eventPlural: string;
57
+ /** Empty-day text inside the popover. */
58
+ dayPopoverEmpty: string;
59
+ /** Primary action in the popover: request an event for this day. */
60
+ newEvent: string;
61
+ /** Secondary action: drill into the day view. */
62
+ showDay: string;
63
+ /** Secondary action of the month-scoped popover (year view): drill into the month. */
64
+ showMonth: string;
65
+ closePopover: string;
66
+ /** Label of the popover's resource picker on the create action. */
67
+ newEventResource: string;
68
+ /** {title} — accessible name of a per-event delete button. */
69
+ deleteEventLabel: string;
70
+ /** {title} — accessible name of the editor dialog. */
71
+ eventEditorLabel: string;
72
+ editorTitleLabel: string;
73
+ editorStartLabel: string;
74
+ editorEndLabel: string;
75
+ editorColorLabel: string;
76
+ /**
77
+ * Checkbox: keep the event's colour derived from its resource instead of
78
+ * pinning one on the event. Checked whenever the event carries no `color`,
79
+ * which is the state the whole precedence chain assumes.
80
+ */
81
+ editorInheritColor: string;
82
+ editorSave: string;
83
+ editorCancel: string;
84
+ editorDelete: string;
85
+ /** Inline error + announcement when the edited range is invalid. */
86
+ editorInvalidRange: string;
87
+ /** Inline error + announcement when the title is emptied. */
88
+ editorTitleRequired: string;
89
+ /**
90
+ * {end} — announced when a picked end time was pulled forward to the
91
+ * earliest the grid allows. The correction happens on the field the user
92
+ * just edited, so it must be spoken: silently changing a value the user
93
+ * chose, without saying so, is the failure mode this message exists to
94
+ * avoid (D12.12).
95
+ */
96
+ editorEndClamped: string;
97
+ /**
98
+ * {start} — the mirror of `editorEndClamped`, announced when a start change
99
+ * is a RESIZE rather than a move (the user may resize but not move, D12.13)
100
+ * and the picked start was pushed back to the latest the grid allows.
101
+ */
102
+ editorStartClamped: string;
103
+ /**
104
+ * {month} {count} {events} — accessible name of a year-view month card. The
105
+ * event count is the text equivalent of the colour-only `.has-events` dots
106
+ * (WCAG 1.4.1): without it a screen-reader user cannot tell a busy month
107
+ * from an empty one.
108
+ */
109
+ yearMonthCardLabel: string;
29
110
  /** {view} — localized view name */
30
111
  viewChanged: string;
31
112
  /** {title} */
@@ -38,6 +119,12 @@ export interface SchedulerMessages {
38
119
  eventsLoaded: string;
39
120
  /** {title} {minutes} — move-mode entry keymap announcement */
40
121
  moveModeEntered: string;
122
+ /**
123
+ * {title} {minutes} — the timeline's move-mode entry announcement. Its own
124
+ * key because the generic one promises "arrow keys nudge by N minutes",
125
+ * which is wrong there: on the timeline Up/Down changes the resource.
126
+ */
127
+ moveModeEnteredTimeline: string;
41
128
  /** {start} {end} {day} */
42
129
  movedTo: string;
43
130
  /** {resource} */
@@ -56,6 +143,13 @@ export interface SchedulerMessages {
56
143
  selectionCommitted: string;
57
144
  gridInstructions: string;
58
145
  eventInstructions: string;
146
+ /** The eventInstructions variant used while the built-in editor is enabled. */
147
+ eventInstructionsWithEditor: string;
148
+ /** Read-only variants: no create/move/resize/delete promises. */
149
+ gridInstructionsReadOnly: string;
150
+ eventInstructionsReadOnly: string;
151
+ /** Announced when a command is refused by permissions. */
152
+ actionNotAllowed: string;
59
153
  /** {resource} */
60
154
  eventOnResource: string;
61
155
  }
@@ -1,5 +1,7 @@
1
1
  import { SchedulerMessages } from './messages';
2
+ import { SchedulerPermissions } from './permissions';
2
3
  import { DayOfWeek, TimeFormat, ViewType } from './types';
4
+ import { SchedulerEvent } from './event';
3
5
  /**
4
6
  * Business hours configuration
5
7
  */
@@ -58,25 +60,24 @@ export interface SchedulerOptions {
58
60
  expandRows?: boolean;
59
61
  /** Header toolbar configuration */
60
62
  headerToolbar?: HeaderToolbar;
61
- /** Whether events can be edited */
62
- editable?: boolean;
63
- /** Whether date ranges can be selected */
64
- selectable?: boolean;
65
- /** Whether to show a mirror element during selection */
66
- selectMirror?: boolean;
67
- /** Whether event duration can be changed */
68
- eventDurationEditable?: boolean;
69
- /** Whether event start time can be changed */
70
- eventStartEditable?: boolean;
71
- /** Duration of revert animation in ms */
72
- dragRevertDuration?: number;
73
- /** Whether to scroll during drag */
74
- dragScroll?: boolean;
75
- /** Snap duration in seconds */
76
- snapDuration?: number;
77
63
  /** Override any user-facing string (labels, announcements, instructions).
78
64
  * Merged onto the English defaults — see SchedulerMessages. */
79
65
  messages?: Partial<SchedulerMessages>;
66
+ /**
67
+ * What the user may do. `false` makes the scheduler read-only; an object gives
68
+ * per-capability control. See SchedulerPermissions — it gates AFFORDANCES and
69
+ * gestures, it is not a security boundary.
70
+ *
71
+ * Replaced the old `editable` / `selectable` / `eventStartEditable` /
72
+ * `eventDurationEditable` flags, and the never-implemented `selectMirror`,
73
+ * `dragRevertDuration`, `dragScroll` and `snapDuration`.
74
+ */
75
+ permissions?: boolean | Partial<SchedulerPermissions>;
76
+ /**
77
+ * Fill colour for events that specify none and whose resource specifies none.
78
+ * Previously a `'#3788d8'` literal duplicated across five files.
79
+ */
80
+ defaultEventColor?: string;
80
81
  /** Whether to show current time indicator */
81
82
  nowIndicator?: boolean;
82
83
  /** Whether to show week numbers */
@@ -85,7 +86,62 @@ export interface SchedulerOptions {
85
86
  weekText?: string;
86
87
  /** Maximum events to show per day (true = show "+X more" link) */
87
88
  dayMaxEvents?: boolean | number;
89
+ /**
90
+ * What the month view's "+N more" link does.
91
+ *
92
+ * - `'popover'` (default, FullCalendar's default too) — open the day popover
93
+ * listing every event on that day.
94
+ * - `'day'` — the previous behaviour: navigate to the day view.
95
+ * - a function — you handle it; nothing else happens.
96
+ */
97
+ moreLinkBehavior?: MoreLinkBehavior;
98
+ /**
99
+ * What clicking a day CELL does (month view, and year-view mini-days),
100
+ * beyond emitting `date-click`.
101
+ *
102
+ * Defaults to `'popover'` — click a date to see and add its events, which
103
+ * is what the surface exists for. `date-click` still emits FIRST,
104
+ * unconditionally, so a consumer's own handler keeps working; set `'none'`
105
+ * to keep the click purely an event for the consumer. Clicking the day
106
+ * NUMBER in month view always drills into the day view (the navLinks idiom)
107
+ * and is deliberately a separate target: conflating the two would make an
108
+ * empty cell unable to mean "create here".
109
+ */
110
+ dayClickAction?: 'none' | 'popover';
111
+ /**
112
+ * The built-in event editor: a popover anchored to the event with title,
113
+ * start/end and colour fields plus Save / Delete / Cancel, opened by
114
+ * double-click (double-tap), right-click, or F2 on the selected event.
115
+ *
116
+ * Default `true`. It emits the SAME requests every other surface emits —
117
+ * Save is an `event-update`, Delete an `event-delete` — so a consumer's
118
+ * handlers keep working unchanged, and it doubles as the single-pointer
119
+ * non-drag path to change an event's times (WCAG 2.5.7). Set `false` when
120
+ * the app ships its own editor; `event-dblclick` keeps firing either way.
121
+ * Also exposed as the `event-editor` attribute / `eventEditor` property.
122
+ */
123
+ eventEditor?: boolean;
124
+ /**
125
+ * Whether every event is expected to name a resource.
126
+ *
127
+ * Default `false`: an event with no `resourceId` renders in the timeline's
128
+ * "(No resource)" bucket row, which is the only non-lossy behaviour — the two
129
+ * alternatives the industry ships are both silent data traps (hide the event,
130
+ * or duplicate it into every lane where editing one appears to edit all).
131
+ *
132
+ * Set `true` in an app where a resource is mandatory: resource-less events are
133
+ * still bucketed and still visible, but each one is reported once via a dev
134
+ * warning so the gap surfaces during development instead of as a support
135
+ * ticket. It never hides an event, and it is not a validation error — the
136
+ * component does not own the data.
137
+ */
138
+ requireEventResource?: boolean;
88
139
  }
140
+ /** See `SchedulerOptions.moreLinkBehavior`. */
141
+ export type MoreLinkBehavior = 'popover' | 'day' | ((info: {
142
+ date: Date;
143
+ events: SchedulerEvent[];
144
+ }) => void);
89
145
  /**
90
146
  * Default options for the scheduler
91
147
  */
@@ -0,0 +1,114 @@
1
+ import { SchedulerEvent } from './event';
2
+ /**
3
+ * What a user may do in the scheduler.
4
+ *
5
+ * Shape follows the dominant convention (DevExtreme `editing`, Kendo `editable`):
6
+ * a `boolean | object` union, so `permissions: false` expresses the single most
7
+ * common request — make it read-only — without spelling out ten flags, while the
8
+ * object form covers "move but don't resize".
9
+ *
10
+ * **This is an honesty API, not a security boundary.** The component never mutates
11
+ * consumer data: `event-create` is a request, `event-delete` a notification, and
12
+ * `event-update` pre-mutates only internal state so a committed drag doesn't snap
13
+ * back. A consumer already refuses anything by not acting on a request. Permissions
14
+ * exist so the UI doesn't offer, announce or document actions that cannot succeed.
15
+ * Do not rely on them to protect data — authorize on your own side.
16
+ */
17
+ export interface SchedulerPermissions {
18
+ /** Drag/keyboard-create a new event, and Enter on a cell or selection. */
19
+ createEvent: boolean;
20
+ /** Move an existing event in time (or across resources on the timeline). */
21
+ moveEvent: boolean;
22
+ /**
23
+ * Drag/keyboard either edge — one flag, not two.
24
+ *
25
+ * Supersedes `resizeEventStart` / `resizeEventEnd`, which were a misreading
26
+ * of FullCalendar: its `eventStartEditable` means "start editable **through
27
+ * dragging**" (our `moveEvent`), and `eventDurationEditable` covers resize
28
+ * as ONE flag for both edges. Splitting it globally answered a question
29
+ * nobody asks — "no user may ever resize any start edge" — while making an
30
+ * asymmetric commit constructible (B35).
31
+ *
32
+ * Per-edge locking still exists where it belongs: on the ITEM, as
33
+ * `SchedulerEvent.resizable`'s `{ start, end }` form. That is data-dependent
34
+ * ("this shift already clocked in; its start is pinned, you may still extend
35
+ * it"), which is exactly what a per-item flag is for. See `resolveResizeEdge`.
36
+ */
37
+ resizeEvent: boolean;
38
+ /** Delete/Backspace on a focused event. */
39
+ deleteEvent: boolean;
40
+ /**
41
+ * Edit an event's non-geometric fields (title, colour) through the built-in
42
+ * event editor. The editor's start/end fields follow `moveEvent` and the
43
+ * resize capabilities instead — time is time, whichever surface changes it.
44
+ */
45
+ editEvent: boolean;
46
+ /** Extend a multi-cell time range with Shift+Arrow or a slot drag. */
47
+ selectRange: boolean;
48
+ /** Add a resource row (timeline). Off by default — see the PRD. */
49
+ createResource: boolean;
50
+ /** Rename/recolour a resource (timeline). */
51
+ updateResource: boolean;
52
+ /** Remove a resource row (timeline). */
53
+ deleteResource: boolean;
54
+ /** Add a resource group / nested group (timeline). Off by default. */
55
+ createGroup: boolean;
56
+ /**
57
+ * Optional, data-dependent veto for creation only — e.g. "not in the past",
58
+ * "not on a locked resource".
59
+ *
60
+ * Deliberately narrow: it runs ONLY at pointer-down, drag completion and
61
+ * `Enter` commit — never per cell and never per pointer-move. Driving the
62
+ * greyed-slot feedback from it would mean a consumer callback per cell
63
+ * (`resources x days x slotsPerDay`) on every re-render, which is the cost
64
+ * FullCalendar documents for `selectAllow`. Slot greying is NOT driven by it.
65
+ */
66
+ canCreateAt?: (range: {
67
+ start: Date;
68
+ end: Date;
69
+ }, resourceId?: string) => boolean;
70
+ }
71
+ /** Every capability name, for iteration. */
72
+ export type SchedulerCapability = Exclude<keyof SchedulerPermissions, 'canCreateAt'>;
73
+ /**
74
+ * Defaults: everything about events is allowed (matching the component's
75
+ * behaviour before permissions existed), but creating resources and groups is
76
+ * OFF — no surveyed calendar library ships resource-creation UI, so the default
77
+ * stays "resources are data the app supplies".
78
+ */
79
+ export declare const DEFAULT_PERMISSIONS: Readonly<Record<SchedulerCapability, boolean>>;
80
+ /** Per-item overrides live on the data, tri-state so `null` means "inherit". */
81
+ export interface ItemPermissionOverrides {
82
+ editable?: boolean | null;
83
+ draggable?: boolean | null;
84
+ resizable?: boolean | {
85
+ start: boolean;
86
+ end: boolean;
87
+ } | null;
88
+ }
89
+ /**
90
+ * Resolve one capability.
91
+ *
92
+ * Precedence: `readonly` host attribute → `permissions === false` →
93
+ * `permissions[cap]` → per-item override → default. A per-item flag can only
94
+ * ever *deny*; it cannot re-enable something a global setting switched off,
95
+ * mirroring the OR-down-the-tree rule mp-query-builder uses for nested disable.
96
+ */
97
+ export declare function resolveCapability(capability: SchedulerCapability, opts: {
98
+ readonly?: boolean;
99
+ permissions?: boolean | Partial<SchedulerPermissions>;
100
+ event?: SchedulerEvent | null;
101
+ }): boolean;
102
+ /**
103
+ * May this event be resized *from this edge*?
104
+ *
105
+ * Only the three direct-manipulation surfaces ask — the resize handles, the
106
+ * pointer gesture, and Shift+Arrow vs Alt+Shift+Arrow — because there the edge
107
+ * is a property of the **gesture**, not of the permission. Everything else
108
+ * asks `resolveCapability('resizeEvent', …)`.
109
+ */
110
+ export declare function resolveResizeEdge(edge: 'start' | 'end', opts: {
111
+ readonly?: boolean;
112
+ permissions?: boolean | Partial<SchedulerPermissions>;
113
+ event?: SchedulerEvent | null;
114
+ }): boolean;
@@ -6,6 +6,21 @@ export interface TimeSlot {
6
6
  start: Date;
7
7
  /** End of the time slot */
8
8
  end: Date;
9
+ /**
10
+ * Resource the slot belongs to, for views with a resource axis (timeline).
11
+ *
12
+ * Carried so a pointer drag can report WHICH row it is happening in:
13
+ * without it `event-create` always emitted `resourceId: undefined`, and a
14
+ * move-drag could not change rows at all.
15
+ *
16
+ * TRI-STATE, deliberately: `undefined` means "this view has no resource
17
+ * axis" (week/day/month/year), `null` means "the timeline's unassigned
18
+ * bucket row". The two must stay distinguishable — collapsing them is what
19
+ * made a drop onto the bucket indistinguishable from a week-view drag, so
20
+ * an event could never be UN-assigned by pointer. Matches the idiom of
21
+ * `eventsByResource: Map<string | null, …>`.
22
+ */
23
+ resourceId?: string | null;
9
24
  }
10
25
  /**
11
26
  * A row of time slots with associated metadata
@@ -1,4 +1,3 @@
1
- import { SchedulerEvent } from '../models/event';
2
1
  import { Resource, ResourceGroup, FlattenedResource } from '../models/resource';
3
2
  /**
4
3
  * Service for resource and resource group operations
@@ -13,9 +12,12 @@ export declare class ResourceService {
13
12
  */
14
13
  getAllResources(items: (Resource | ResourceGroup)[]): Resource[];
15
14
  /**
16
- * Get all events from all resources
15
+ * @deprecated Since the scheduler normalized its event model, events are keyed
16
+ * by `resourceId` in one store — mutating a resource tree's nested `events` no
17
+ * longer drives what any view renders. Set `resourceId` on the event and update
18
+ * the `events` input instead. Unused by the component; kept to avoid a breaking
19
+ * removal, and slated for deletion in the next major.
17
20
  */
18
- getAllEvents(items: (Resource | ResourceGroup)[]): SchedulerEvent[];
19
21
  /**
20
22
  * Find a resource by ID
21
23
  */
@@ -29,21 +31,33 @@ export declare class ResourceService {
29
31
  */
30
32
  findById(items: (Resource | ResourceGroup)[], id: string): Resource | ResourceGroup | undefined;
31
33
  /**
32
- * Add an event to a resource
34
+ * @deprecated Since the scheduler normalized its event model, events are keyed
35
+ * by `resourceId` in one store — mutating a resource tree's nested `events` no
36
+ * longer drives what any view renders. Set `resourceId` on the event and update
37
+ * the `events` input instead. Unused by the component; kept to avoid a breaking
38
+ * removal, and slated for deletion in the next major.
33
39
  */
34
- addEventToResource(items: (Resource | ResourceGroup)[], resourceId: string, event: SchedulerEvent): (Resource | ResourceGroup)[];
35
40
  /**
36
- * Update an event in a resource
41
+ * @deprecated Since the scheduler normalized its event model, events are keyed
42
+ * by `resourceId` in one store — mutating a resource tree's nested `events` no
43
+ * longer drives what any view renders. Set `resourceId` on the event and update
44
+ * the `events` input instead. Unused by the component; kept to avoid a breaking
45
+ * removal, and slated for deletion in the next major.
37
46
  */
38
- updateEventInResource(items: (Resource | ResourceGroup)[], event: SchedulerEvent): (Resource | ResourceGroup)[];
39
47
  /**
40
- * Remove an event from all resources
48
+ * @deprecated Since the scheduler normalized its event model, events are keyed
49
+ * by `resourceId` in one store — mutating a resource tree's nested `events` no
50
+ * longer drives what any view renders. Set `resourceId` on the event and update
51
+ * the `events` input instead. Unused by the component; kept to avoid a breaking
52
+ * removal, and slated for deletion in the next major.
41
53
  */
42
- removeEvent(items: (Resource | ResourceGroup)[], eventId: string): (Resource | ResourceGroup)[];
43
54
  /**
44
- * Move an event from one resource to another
55
+ * @deprecated Since the scheduler normalized its event model, events are keyed
56
+ * by `resourceId` in one store — mutating a resource tree's nested `events` no
57
+ * longer drives what any view renders. Set `resourceId` on the event and update
58
+ * the `events` input instead. Unused by the component; kept to avoid a breaking
59
+ * removal, and slated for deletion in the next major.
45
60
  */
46
- moveEventToResource(items: (Resource | ResourceGroup)[], eventId: string, newResourceId: string, updatedEvent?: Partial<SchedulerEvent>): (Resource | ResourceGroup)[];
47
61
  /**
48
62
  * Toggle collapse state of a group
49
63
  */
@@ -22,3 +22,25 @@ export declare function darkenColor(color: string, percent: number): string;
22
22
  * Add alpha (opacity) to a color
23
23
  */
24
24
  export declare function addAlpha(color: string, alpha: number): string;
25
+ /** Fallback event colour when neither the event nor its resource specifies one. */
26
+ export declare const DEFAULT_EVENT_COLOR = "#3788d8";
27
+ /**
28
+ * Resolve an event's fill colour.
29
+ *
30
+ * Precedence — event → resource → component default — matches the universal
31
+ * convention (FullCalendar, Bryntum, Syncfusion, DevExtreme, Mobiscroll, MUI X all
32
+ * agree), and applying a resource's colour in NON-resource views is documented
33
+ * practice rather than an invention.
34
+ *
35
+ * `Resource.eventColor` is the event fill and `Resource.color` the row-header tint
36
+ * (mirroring `ResourceGroup.color`, whose contract is the group header), but we
37
+ * fall back `eventColor ?? color` so a consumer who sets only one still gets
38
+ * sensible behaviour. Both fields had existed in the model read by nothing.
39
+ */
40
+ export declare function resolveEventColor(event: {
41
+ color?: string;
42
+ resourceId?: string;
43
+ }, resourceById: Map<string, {
44
+ color?: string;
45
+ eventColor?: string;
46
+ }>, defaultColor?: string): string;
package/select/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { M as p } from "../chunks/mp-select-Ctu-v1-p.mjs";
1
+ import { M as p } from "../chunks/mp-select-CKX0eM5C.mjs";
2
2
  export {
3
3
  p as MpSelect
4
4
  };
@@ -1,5 +1,6 @@
1
- import { M as i, a as p } from "../chunks/mp-timepicker.element-Bz393NDQ.mjs";
1
+ import { M as a, a as i, m as s } from "../chunks/mp-timepicker.element-COZEUIoE.mjs";
2
2
  export {
3
- i as MpTimeListElement,
4
- p as MpTimepickerElement
3
+ a as MpTimeListElement,
4
+ i as MpTimepickerElement,
5
+ s as minutesOfDay
5
6
  };
@@ -1,6 +1,17 @@
1
1
  import { LitElement, TemplateResult } from 'lit';
2
2
  export type TimeStep = 1 | 5 | 10 | 15 | 30 | 60;
3
3
  export type Hour12Mode = boolean | 'auto';
4
+ /**
5
+ * A `Date`'s time-of-day as minutes from midnight, for feeding
6
+ * `mp-time-list`'s `minMinutes` / `maxMinutes`.
7
+ *
8
+ * Exported because every composite that owns a time list has to make this
9
+ * conversion, and each one has to decide FIRST whether its bound is a
10
+ * time-of-day (`mp-timepicker`: convert unconditionally) or a datetime
11
+ * (`mp-datetime-picker`: convert only on the bound's own day, `null`
12
+ * otherwise). Naming the step makes that decision visible at the call site.
13
+ */
14
+ export declare function minutesOfDay(d: Date | null | undefined): number | null;
4
15
  /**
5
16
  * mp-time-list — Bootstrap-styled time-slot listbox primitive.
6
17
  *
@@ -33,11 +44,13 @@ export declare class MpTimeListElement extends LitElement {
33
44
  type: NumberConstructor;
34
45
  reflect: boolean;
35
46
  };
36
- min: {
37
- attribute: boolean;
47
+ minMinutes: {
48
+ attribute: string;
49
+ type: NumberConstructor;
38
50
  };
39
- max: {
40
- attribute: boolean;
51
+ maxMinutes: {
52
+ attribute: string;
53
+ type: NumberConstructor;
41
54
  };
42
55
  hour12: {
43
56
  attribute: string;
@@ -53,13 +66,37 @@ export declare class MpTimeListElement extends LitElement {
53
66
  };
54
67
  selectedTime: Date | null;
55
68
  step: TimeStep;
56
- min: Date | null;
57
- max: Date | null;
69
+ /**
70
+ * Earliest / latest selectable slot, as **minutes from midnight** — this
71
+ * element is a pure time-of-day primitive and now says so in its types.
72
+ *
73
+ * They were `min`/`max: Date`, which read like datetime bounds but were
74
+ * compared time-of-day only. That ambiguity is not theoretical: a composite
75
+ * editing a range across two days would grey out the same clock range on
76
+ * *every* day, and `mp-timepicker`'s consumers legitimately pass
77
+ * `new Date(2020, 0, 1, 18, 0)` meaning simply "18:00", which any date-aware
78
+ * reading would disable outright. A `Date` can be mistaken for a datetime
79
+ * bound; `minMinutes: 480` cannot. Deriving the per-day value is the
80
+ * COMPOSITE's job — see `mp-datetime-picker`.
81
+ */
82
+ minMinutes: number | null;
83
+ maxMinutes: number | null;
58
84
  hour12: Hour12Mode;
59
85
  locale: string | undefined;
60
86
  private _focusedMinutes;
61
87
  private readonly instanceId;
62
- /** One tab stop for the whole list; arrows move focus AND the tab stop. */
88
+ /**
89
+ * One tab stop for the whole list; arrows move focus AND the tab stop.
90
+ *
91
+ * `isDisabled: () => false` keeps out-of-range slots IN the traversal —
92
+ * APG-correct (a disabled option should be discoverable, so the user learns
93
+ * the bound exists rather than watching keys do nothing) and consistent with
94
+ * `mp-calendar`, which one popup away was already doing it this way. It is
95
+ * also load-bearing: `moveTo` refuses a disabled target, so with the default
96
+ * predicate PageUp/PageDown became a swallowed keypress the moment bounds
97
+ * were passed — it `preventDefault()`s, then bails. Selection is still
98
+ * refused, in `selectMinutes`, which is where the rule belongs.
99
+ */
63
100
  private readonly roving;
64
101
  connectedCallback(): void;
65
102
  disconnectedCallback(): void;
@@ -78,6 +78,11 @@ export declare class MpTimepickerElement extends LitElement {
78
78
  };
79
79
  selectedTime: Date | null;
80
80
  step: TimeStep;
81
+ /**
82
+ * Earliest / latest selectable time. **Time-of-day only** — the date half is
83
+ * ignored, so `new Date(2020, 0, 1, 18, 0)` simply means "18:00", which is
84
+ * how this component's consumers have always used it.
85
+ */
81
86
  min: Date | null;
82
87
  max: Date | null;
83
88
  hour12: Hour12Mode;
@@ -1,4 +1,4 @@
1
- import { M as e, t as g } from "../chunks/mp-toggle-button-Kz6sIgBJ.mjs";
1
+ import { M as e, t as g } from "../chunks/mp-toggle-button-C4Loq_p4.mjs";
2
2
  export {
3
3
  e as MpToggleButton,
4
4
  g as toggleButtonStyles
@@ -1,6 +1,6 @@
1
1
  import { unsafeCSS as c, LitElement as u, html as a, nothing as o } from "lit";
2
2
  import { repeat as p } from "lit/directives/repeat.js";
3
- import { O as b } from "../chunks/overlay-controller-DPt13i8p.mjs";
3
+ import { O as b } from "../chunks/overlay-controller-D6agzzOI.mjs";
4
4
  import { L as m } from "../chunks/live-announcer-Bi0orG4n.mjs";
5
5
  import { d as _ } from "../chunks/focus-restore-DxuP1Oe2.mjs";
6
6
  import { H as f } from "../chunks/host-aria-WSGs7SPQ.mjs";
@@ -1,58 +0,0 @@
1
- import { SchedulerEvent, ViewType } from '@mintplayer/web-components/scheduler-core';
2
- /**
3
- * Time range carried by selection-change and event-create. `start` is the
4
- * inclusive lower edge, `end` is the exclusive upper edge of the last
5
- * selected slot — matching the natural slot-pair shape produced by
6
- * `selectionRange()` in `views/base-view.ts`.
7
- */
8
- export interface TimeRange {
9
- start: Date;
10
- end: Date;
11
- }
12
- /**
13
- * All custom events the scheduler can emit.
14
- * Using a discriminated union for type safety.
15
- */
16
- export type SchedulerCustomEvent = {
17
- type: 'event-selected';
18
- event: SchedulerEvent;
19
- originalEvent: Event;
20
- } | {
21
- type: 'event-dblclick';
22
- event: SchedulerEvent;
23
- originalEvent: Event;
24
- } | {
25
- type: 'event-create';
26
- range: TimeRange;
27
- view: ViewType;
28
- resourceId?: string;
29
- originalEvent: Event;
30
- } | {
31
- type: 'event-update';
32
- event: SchedulerEvent;
33
- oldEvent: SchedulerEvent;
34
- originalEvent: Event;
35
- } | {
36
- type: 'event-delete';
37
- event: SchedulerEvent;
38
- } | {
39
- type: 'date-click';
40
- date: Date;
41
- originalEvent: Event;
42
- } | {
43
- type: 'view-change';
44
- view: ViewType;
45
- date: Date;
46
- } | {
47
- type: 'selection-change';
48
- selectedEvent: SchedulerEvent | null;
49
- range: TimeRange | null;
50
- view: ViewType;
51
- resourceId?: string;
52
- };
53
- /**
54
- * Type helper to extract the detail type for a specific event.
55
- */
56
- export type EventDetail<T extends SchedulerCustomEvent['type']> = Omit<Extract<SchedulerCustomEvent, {
57
- type: T;
58
- }>, 'type'>;