@mintplayer/web-components 2.4.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/index.mjs +9 -8
- package/checkbox/index.mjs +1 -1
- package/chunks/error-text-B45eDAt1.mjs +17 -0
- package/chunks/{form-associated-axmc5sY0.mjs → form-associated-BR-fUvZ1.mjs} +11 -26
- package/chunks/{color-CpFtrIoX.mjs → id-BstjfRrz.mjs} +383 -317
- package/chunks/{mp-checkbox-Ph2mMRGz.mjs → mp-checkbox-6EJwdUIn.mjs} +6 -5
- package/chunks/{mp-datatable-BwTlh9A_.mjs → mp-datatable-25O1GtvU.mjs} +1 -1
- package/chunks/mp-datetime-picker.element-MPTRHwyc.mjs +530 -0
- package/chunks/{mp-radio-BjW1HNSc.mjs → mp-radio-DvKgrTFL.mjs} +2 -2
- package/chunks/{mp-select-Ctu-v1-p.mjs → mp-select-CKX0eM5C.mjs} +5 -4
- package/chunks/{mp-timepicker.element-Bz393NDQ.mjs → mp-timepicker.element-COZEUIoE.mjs} +56 -52
- package/chunks/{mp-toggle-button-Kz6sIgBJ.mjs → mp-toggle-button-C4Loq_p4.mjs} +5 -4
- package/chunks/{overlay-controller-DPt13i8p.mjs → overlay-controller-D6agzzOI.mjs} +19 -4
- package/datatable/index.mjs +1 -1
- package/datepicker/index.mjs +1 -1
- package/datetime-picker/index.mjs +2 -431
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +66 -0
- package/file-manager/index.mjs +1 -1
- package/navbar/index.mjs +1 -1
- package/otp-input/index.mjs +4 -3
- package/overlay/index.mjs +1 -1
- package/overlay/src/overlay-controller.d.ts +13 -0
- package/package.json +1 -1
- package/query-builder/index.mjs +2 -2
- package/radio/index.mjs +1 -1
- package/radio-group/index.mjs +2 -2
- package/ribbon/index.mjs +1 -1
- package/scheduler/index.mjs +3243 -882
- package/scheduler/src/components/mp-scheduler.d.ts +410 -2
- package/scheduler/src/events/index.d.ts +0 -1
- package/scheduler/src/events/scheduler-event-emitter.d.ts +20 -4
- package/scheduler/src/state/scheduler-state.d.ts +59 -7
- package/scheduler/src/views/base-view.d.ts +29 -0
- package/scheduler/src/views/day-view.d.ts +6 -0
- package/scheduler/src/views/timeline-view.d.ts +143 -4
- package/scheduler/src/views/week-view.d.ts +6 -0
- package/scheduler/src/views/year-view.d.ts +4 -2
- package/scheduler-core/index.mjs +63 -58
- package/scheduler-core/src/models/event.d.ts +6 -2
- package/scheduler-core/src/models/events.d.ts +76 -90
- package/scheduler-core/src/models/index.d.ts +1 -0
- package/scheduler-core/src/models/messages.d.ts +94 -0
- package/scheduler-core/src/models/options.d.ts +72 -16
- package/scheduler-core/src/models/permissions.d.ts +114 -0
- package/scheduler-core/src/models/time-slot.d.ts +15 -0
- package/scheduler-core/src/services/resource.service.d.ts +25 -11
- package/scheduler-core/src/utils/color.d.ts +22 -0
- package/select/index.mjs +1 -1
- package/timepicker/index.mjs +4 -3
- package/timepicker/src/mp-time-list.element.d.ts +44 -7
- package/timepicker/src/mp-timepicker.element.d.ts +5 -0
- package/toggle-button/index.mjs +1 -1
- package/tree-select/index.mjs +1 -1
- package/scheduler/src/events/event-types.d.ts +0 -58
|
@@ -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,14 +43,124 @@ 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
|
+
/** Narrowest useful column; below this the titles are gone anyway. */
|
|
52
|
+
private static readonly MIN_COLUMN_PX;
|
|
53
|
+
/** The AG-Grid guard: the frozen column may never leave less than this. */
|
|
54
|
+
private static readonly MIN_GRID_PX;
|
|
55
|
+
private columnDrag;
|
|
56
|
+
private boundColumnDragMove;
|
|
57
|
+
private boundColumnDragEnd;
|
|
58
|
+
/**
|
|
59
|
+
* The WAI-ARIA window-splitter on the resource column's right edge — the
|
|
60
|
+
* same pattern as the repo's splitter. It writes
|
|
61
|
+
* `--scheduler-resource-column-width` on the scroll container, which is the
|
|
62
|
+
* exact channel the consumer configures, so their own value stays the
|
|
63
|
+
* initial and every rule reading the custom property follows for free. The
|
|
64
|
+
* inline style survives view rebuilds AND view switches (clearContainer
|
|
65
|
+
* strips classes and ARIA, not inline style), which is what makes the
|
|
66
|
+
* user's chosen width sticky.
|
|
67
|
+
*
|
|
68
|
+
* Lives inside the corner columnheader, OUTSIDE the `role="grid"` focus
|
|
69
|
+
* model (same reasoning as the add bar, §11.2): a separator is not a grid
|
|
70
|
+
* cell, and a Tab stop inside a roving-tabindex grid is a trap.
|
|
71
|
+
*/
|
|
72
|
+
private createColumnResizer;
|
|
73
|
+
private currentColumnWidth;
|
|
74
|
+
private maxColumnWidth;
|
|
75
|
+
private applyColumnWidth;
|
|
76
|
+
/** aria-valuenow as a percentage of the scroller, per the splitter pattern. */
|
|
77
|
+
private updateResizerValue;
|
|
78
|
+
private onColumnDragMove;
|
|
79
|
+
private onColumnDragEnd;
|
|
80
|
+
/** True when the capability is granted for the whole scheduler. */
|
|
81
|
+
private can;
|
|
82
|
+
/**
|
|
83
|
+
* Per-row resource actions, rendered into the pinned rowheader cell.
|
|
84
|
+
*
|
|
85
|
+
* A denied action is ABSENT, not disabled: `createResource`/`createGroup`/
|
|
86
|
+
* `updateResource`/`deleteResource` are all off by default, so the ordinary
|
|
87
|
+
* scheduler shows none of this and only an app that manages its own resource
|
|
88
|
+
* tree opts in. (A permanently-disabled button is noise for sighted users and
|
|
89
|
+
* a broken promise for AT — the same rule mp-file-manager follows.)
|
|
90
|
+
*
|
|
91
|
+
* Every name carries the row title. N buttons all called "Add" is the classic
|
|
92
|
+
* failure of a tree like this: a screen-reader user hears the same name on
|
|
93
|
+
* every row and cannot tell which group they are adding to. Depth stays out of
|
|
94
|
+
* it entirely — `aria-level` is invalid on these roles, so nesting is conveyed
|
|
95
|
+
* by the name and the indent, not by an attribute axe flags.
|
|
96
|
+
*/
|
|
97
|
+
private appendResourceActions;
|
|
98
|
+
/**
|
|
99
|
+
* One icon button. The glyph is `aria-hidden` and the name lives on the
|
|
100
|
+
* button, so the accessible name is the localized sentence rather than "+".
|
|
101
|
+
*/
|
|
102
|
+
private createResourceAction;
|
|
103
|
+
/**
|
|
104
|
+
* Native `<input type="color">` for the resource's colour — the recolour half
|
|
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.
|
|
108
|
+
*
|
|
109
|
+
* It edits whichever field actually drives the rendered events: `eventColor`
|
|
110
|
+
* wins over `color` in `resolveEventColor`, so writing `color` on a resource
|
|
111
|
+
* that has an `eventColor` would look like the control did nothing.
|
|
112
|
+
*/
|
|
113
|
+
private createColorSwatch;
|
|
114
|
+
/**
|
|
115
|
+
* Root-level "Add resource" / "Add group" bar, pinned to the bottom of the
|
|
116
|
+
* frozen resource column (the spreadsheet/Jira idiom: creation lives at the
|
|
117
|
+
* end of the list, in the column the new row will appear in).
|
|
118
|
+
*
|
|
119
|
+
* Deliberately a sibling of the grid, not a row inside it: a row whose only
|
|
120
|
+
* content is buttons has to fake a rowheader, inflates `aria-rowcount`, and
|
|
121
|
+
* puts Tab stops inside a roving-tabindex grid. Outside, it is just a toolbar.
|
|
122
|
+
*/
|
|
123
|
+
private createAddBar;
|
|
124
|
+
/**
|
|
125
|
+
* The "(No resource)" bucket row.
|
|
126
|
+
*
|
|
127
|
+
* Structurally identical to a resource row so keyboard nav, roving tabindex and
|
|
128
|
+
* the grid ARIA chain all treat it as one more row — but its slots carry
|
|
129
|
+
* `data-unassigned` instead of a `data-resource-id`, so a drag addressing this
|
|
130
|
+
* row resolves to the tri-state `resourceId: null` ("the bucket") rather than
|
|
131
|
+
* `undefined` ("no resource axis"). An absent attribute could not carry that
|
|
132
|
+
* distinction — it would read exactly like a week-view slot, and a drop here
|
|
133
|
+
* could never mean "unassign".
|
|
134
|
+
*/
|
|
135
|
+
private createUnassignedRow;
|
|
17
136
|
private renderEvents;
|
|
18
137
|
private createEventElement;
|
|
19
138
|
/**
|
|
20
|
-
* Dashed ghost showing where the
|
|
21
|
-
*
|
|
22
|
-
*
|
|
139
|
+
* Dashed ghost showing where the event will land. Mirrors
|
|
140
|
+
* week-view.renderPreviewEvent for the horizontal axis.
|
|
141
|
+
*
|
|
142
|
+
* Gated on `previewEvent` alone — NOT on `dragState`, which only the pointer
|
|
143
|
+
* drag path writes. Keyboard move-mode sets `previewEvent` with no
|
|
144
|
+
* `dragState`, so requiring it hid the ghost from keyboard users on this
|
|
145
|
+
* view while week/day showed it.
|
|
23
146
|
*/
|
|
24
147
|
private renderPreviewEvent;
|
|
148
|
+
/**
|
|
149
|
+
* Which row a drag/preview is currently addressing.
|
|
150
|
+
*
|
|
151
|
+
* Precedence: the preview's own row (a MOVE tracks the pointer's row; a
|
|
152
|
+
* move-mode Up/Down nudge writes it too — `null` meaning the bucket row) →
|
|
153
|
+
* the dragged event's own row (a resize never changes rows, and its preview
|
|
154
|
+
* deliberately carries none) → the row the gesture is happening in (a CREATE
|
|
155
|
+
* has no source event; without this fallback a create-drag showed no
|
|
156
|
+
* feedback at all).
|
|
157
|
+
*
|
|
158
|
+
* The dragged event is resolved from the NORMALIZED store, not
|
|
159
|
+
* `resource.events` — that nested array stopped being a live mirror when the
|
|
160
|
+
* model was normalized, so the old lookup found nothing for any event
|
|
161
|
+
* supplied through the `events` input.
|
|
162
|
+
*/
|
|
163
|
+
private previewRowKey;
|
|
25
164
|
update(state: SchedulerState): void;
|
|
26
165
|
private optionsRequireRerender;
|
|
27
166
|
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;
|
|
@@ -10,9 +10,11 @@ export declare class YearView extends BaseView {
|
|
|
10
10
|
/**
|
|
11
11
|
* Build a `YYYY-MM` key from a Date, which is the unit of focus on year
|
|
12
12
|
* view (PRD scheduler-controlled-selection §5.2 — year cells are months,
|
|
13
|
-
* not days).
|
|
13
|
+
* not days). Public because the month card's element id
|
|
14
|
+
* (`scheduler-cell-y-{key}`) is also the anchor the day popover hangs off
|
|
15
|
+
* in this view.
|
|
14
16
|
*/
|
|
15
|
-
|
|
17
|
+
static monthKey(d: Date): string;
|
|
16
18
|
private createMonthCard;
|
|
17
19
|
/**
|
|
18
20
|
* Apply roving tabindex based on `state.focusedDate`'s month. Year-view's
|
package/scheduler-core/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { D as $, d as C } from "../chunks/
|
|
2
|
-
import { a as
|
|
1
|
+
import { D as $, d as C } from "../chunks/id-BstjfRrz.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 } from "../chunks/id-BstjfRrz.mjs";
|
|
3
3
|
class w {
|
|
4
4
|
/**
|
|
5
5
|
* Calculate position for an event part in week/day view
|
|
6
6
|
*/
|
|
7
|
-
calculateWeekPosition(t, e, s, n,
|
|
8
|
-
const
|
|
7
|
+
calculateWeekPosition(t, e, s, n, i, l = {}) {
|
|
8
|
+
const c = { ...$, ...l };
|
|
9
9
|
new Date(t.start).setHours(0, 0, 0, 0);
|
|
10
|
-
const a = C.getSecondsFromMidnight(t.start), u = C.getSecondsFromMidnight(t.end) - a, [d] =
|
|
10
|
+
const a = C.getSecondsFromMidnight(t.start), u = C.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, R = 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
|
-
left:
|
|
13
|
+
left: b,
|
|
14
14
|
width: T,
|
|
15
15
|
height: R,
|
|
16
16
|
zIndex: e + 1
|
|
@@ -19,9 +19,9 @@ class w {
|
|
|
19
19
|
/**
|
|
20
20
|
* Calculate position for an event in timeline view
|
|
21
21
|
*/
|
|
22
|
-
calculateTimelinePosition(t, e, s, n,
|
|
22
|
+
calculateTimelinePosition(t, e, s, n, i, l = {}) {
|
|
23
23
|
({ ...$, ...l });
|
|
24
|
-
const
|
|
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,
|
|
27
27
|
left: d,
|
|
@@ -33,8 +33,8 @@ class w {
|
|
|
33
33
|
/**
|
|
34
34
|
* Calculate position for an all-day event in month view
|
|
35
35
|
*/
|
|
36
|
-
calculateMonthEventPosition(t, e, s, n,
|
|
37
|
-
const
|
|
36
|
+
calculateMonthEventPosition(t, e, s, n, i, l = 7) {
|
|
37
|
+
const c = 100 / l, r = 100 / s, a = n * c, h = (i - n + 1) * c;
|
|
38
38
|
return {
|
|
39
39
|
top: e * r,
|
|
40
40
|
left: a,
|
|
@@ -82,12 +82,12 @@ class w {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
function
|
|
85
|
+
const I = new w();
|
|
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 D(o) {
|
|
91
91
|
const t = o.dataset, e = {};
|
|
92
92
|
for (const s in t) {
|
|
93
93
|
const n = t[s];
|
|
@@ -95,83 +95,88 @@ function z(o) {
|
|
|
95
95
|
}
|
|
96
96
|
return e;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function L(o, t) {
|
|
99
99
|
return o.closest(`[data-${t}]`);
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function M(o) {
|
|
102
102
|
return {
|
|
103
103
|
top: o.scrollTop,
|
|
104
104
|
left: o.scrollLeft
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
const s = o.getBoundingClientRect(),
|
|
107
|
+
function z(o, t, e = "smooth") {
|
|
108
|
+
const s = o.getBoundingClientRect(), i = t.getBoundingClientRect().top - s.top + o.scrollTop;
|
|
109
109
|
o.scrollTo({
|
|
110
|
-
top:
|
|
110
|
+
top: i,
|
|
111
111
|
behavior: e
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function O(o, t) {
|
|
115
115
|
const e = o.getBoundingClientRect(), s = t ? t.getBoundingClientRect() : { top: 0, left: 0, bottom: window.innerHeight, right: window.innerWidth };
|
|
116
116
|
return e.top >= s.top && e.left >= s.left && e.bottom <= s.bottom && e.right <= s.right;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function B(o, t) {
|
|
119
119
|
const e = t.getBoundingClientRect(), s = "touches" in o ? o.touches[0].clientX : o.clientX, n = "touches" in o ? o.touches[0].clientY : o.clientY;
|
|
120
120
|
return {
|
|
121
121
|
x: s - e.left,
|
|
122
122
|
y: n - e.top
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function A(o, t, e) {
|
|
126
126
|
o.style.setProperty(`--${t}`, e);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function W(o, t) {
|
|
129
129
|
return getComputedStyle(o).getPropertyValue(`--${t}`).trim();
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function F(o, ...t) {
|
|
132
132
|
o.classList.add(...t.filter(Boolean));
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function _(o, ...t) {
|
|
135
135
|
o.classList.remove(...t.filter(Boolean));
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function k(o, t, e) {
|
|
138
138
|
o.classList.toggle(t, e);
|
|
139
139
|
}
|
|
140
140
|
export {
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
U as DEFAULT_COLORS,
|
|
142
|
+
V as DEFAULT_EVENT_COLOR,
|
|
143
|
+
j as DEFAULT_MESSAGES,
|
|
143
144
|
$ as DEFAULT_OPTIONS,
|
|
144
|
-
|
|
145
|
+
G as DEFAULT_PERMISSIONS,
|
|
146
|
+
X as DateService,
|
|
145
147
|
w as PositionService,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
Y as ResourceService,
|
|
149
|
+
q as TimelineService,
|
|
150
|
+
J as addAlpha,
|
|
151
|
+
F as addClasses,
|
|
152
|
+
K as darkenColor,
|
|
151
153
|
C as dateService,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
154
|
+
L as findClosestWithData,
|
|
155
|
+
Q as formatMessage,
|
|
156
|
+
Z as generateEventId,
|
|
157
|
+
tt as generateGroupId,
|
|
158
|
+
et as generateId,
|
|
159
|
+
ot as generateResourceId,
|
|
160
|
+
W as getCSSVariable,
|
|
161
|
+
st as getColorByIndex,
|
|
162
|
+
nt as getContrastColor,
|
|
163
|
+
D as getDataAttributes,
|
|
164
|
+
P as getElementByData,
|
|
165
|
+
B as getRelativePosition,
|
|
166
|
+
M as getScrollPosition,
|
|
167
|
+
O as isInViewport,
|
|
168
|
+
it as isResource,
|
|
169
|
+
ct as isResourceGroup,
|
|
170
|
+
rt as lightenColor,
|
|
171
|
+
I as positionService,
|
|
172
|
+
_ as removeClasses,
|
|
173
|
+
at as resolveCapability,
|
|
174
|
+
lt as resolveEventColor,
|
|
175
|
+
dt as resolveMessages,
|
|
176
|
+
gt as resolveResizeEdge,
|
|
177
|
+
ht as resourceService,
|
|
178
|
+
z as scrollToTime,
|
|
179
|
+
A as setCSSVariable,
|
|
180
|
+
ut as timelineService,
|
|
181
|
+
k as toggleClass
|
|
177
182
|
};
|
|
@@ -70,8 +70,12 @@ export interface PreviewEvent {
|
|
|
70
70
|
start: Date;
|
|
71
71
|
/** End of the preview */
|
|
72
72
|
end: Date;
|
|
73
|
-
/**
|
|
74
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Row the preview belongs to. Same tri-state as `TimeSlot.resourceId`:
|
|
75
|
+
* `undefined` = no row information (no resource axis, or a resize, which
|
|
76
|
+
* never changes rows), `null` = the unassigned bucket row.
|
|
77
|
+
*/
|
|
78
|
+
resourceId?: string | null;
|
|
75
79
|
}
|
|
76
80
|
/**
|
|
77
81
|
* A track/rail containing non-overlapping events
|
|
@@ -1,108 +1,94 @@
|
|
|
1
1
|
import { SchedulerEvent } from './event';
|
|
2
|
-
import { Resource } from './resource';
|
|
2
|
+
import { Resource, ResourceGroup } from './resource';
|
|
3
3
|
import { ViewType } from './types';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Time range carried by `selection-change` and `event-create`. `start` is the
|
|
6
|
+
* inclusive lower edge, `end` is the exclusive upper edge of the last selected
|
|
7
|
+
* slot — matching the natural slot-pair shape produced by `selectionRange()`
|
|
8
|
+
* in `views/base-view.ts`.
|
|
6
9
|
*/
|
|
7
|
-
export interface
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
export interface TimeRange {
|
|
11
|
+
start: Date;
|
|
12
|
+
end: Date;
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* Every custom event `mp-scheduler` can emit, as one discriminated union.
|
|
16
|
+
*
|
|
17
|
+
* This union is the SINGLE source of truth for the event surface: the emitter
|
|
18
|
+
* accepts it, `EventDetail<T>` derives each payload from it, and
|
|
19
|
+
* `SchedulerEventMap` is a mechanical mapping of it. A second hand-written
|
|
20
|
+
* table drifts — the previous one had grown a `date-select` entry nothing
|
|
21
|
+
* emitted and a `date-click` resource field nothing sent.
|
|
22
|
+
*
|
|
23
|
+
* Every event bubbles AND is composed, so a scheduler nested inside another
|
|
24
|
+
* component's shadow root still reaches the outer consumer.
|
|
15
25
|
*/
|
|
16
|
-
export
|
|
17
|
-
|
|
26
|
+
export type SchedulerCustomEvent = {
|
|
27
|
+
type: 'event-selected';
|
|
18
28
|
event: SchedulerEvent;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
range: {
|
|
28
|
-
start: Date;
|
|
29
|
-
end: Date;
|
|
30
|
-
};
|
|
31
|
-
/** Resource the request targets (timeline view only). */
|
|
32
|
-
resourceId?: string;
|
|
33
|
-
/** View that produced the request. */
|
|
34
|
-
view: ViewType;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Selection-change detail. Fires on every transition — including the
|
|
38
|
-
* transition to an empty selection. `selectedEvent` and `range` are
|
|
39
|
-
* independent dimensions of the selection state.
|
|
40
|
-
*/
|
|
41
|
-
export interface SelectionChangeDetail {
|
|
42
|
-
selectedEvent: SchedulerEvent | null;
|
|
43
|
-
range: {
|
|
44
|
-
start: Date;
|
|
45
|
-
end: Date;
|
|
46
|
-
} | null;
|
|
29
|
+
originalEvent: Event;
|
|
30
|
+
} | {
|
|
31
|
+
type: 'event-dblclick';
|
|
32
|
+
event: SchedulerEvent;
|
|
33
|
+
originalEvent: Event;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'event-create';
|
|
36
|
+
range: TimeRange;
|
|
47
37
|
view: ViewType;
|
|
48
38
|
resourceId?: string;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*/
|
|
53
|
-
export interface EventUpdateDetail extends BaseEventDetail {
|
|
54
|
-
/** The updated event */
|
|
39
|
+
originalEvent: Event;
|
|
40
|
+
} | {
|
|
41
|
+
type: 'event-update';
|
|
55
42
|
event: SchedulerEvent;
|
|
56
|
-
/** The event before the update */
|
|
57
43
|
oldEvent: SchedulerEvent;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*/
|
|
62
|
-
export interface EventDeleteDetail extends BaseEventDetail {
|
|
63
|
-
/** The deleted event */
|
|
44
|
+
originalEvent: Event;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'event-delete';
|
|
64
47
|
event: SchedulerEvent;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
* Date click event detail
|
|
68
|
-
*/
|
|
69
|
-
export interface DateClickDetail extends BaseEventDetail {
|
|
70
|
-
/** The clicked date */
|
|
48
|
+
} | {
|
|
49
|
+
type: 'date-click';
|
|
71
50
|
date: Date;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Date select event detail
|
|
77
|
-
*/
|
|
78
|
-
export interface DateSelectDetail extends BaseEventDetail {
|
|
79
|
-
/** Start of the selected range */
|
|
80
|
-
start: Date;
|
|
81
|
-
/** End of the selected range */
|
|
82
|
-
end: Date;
|
|
83
|
-
/** Resource at the selected location (if applicable) */
|
|
84
|
-
resource?: Resource;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* View change event detail
|
|
88
|
-
*/
|
|
89
|
-
export interface ViewChangeDetail {
|
|
90
|
-
/** The new view */
|
|
51
|
+
originalEvent: Event;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'view-change';
|
|
91
54
|
view: ViewType;
|
|
92
|
-
/** The current date in the new view */
|
|
93
55
|
date: Date;
|
|
94
|
-
}
|
|
56
|
+
} | {
|
|
57
|
+
type: 'selection-change';
|
|
58
|
+
selectedEvent: SchedulerEvent | null;
|
|
59
|
+
range: TimeRange | null;
|
|
60
|
+
view: ViewType;
|
|
61
|
+
resourceId?: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'resource-create';
|
|
64
|
+
parentId?: string;
|
|
65
|
+
view: ViewType;
|
|
66
|
+
originalEvent: Event;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'group-create';
|
|
69
|
+
parentId?: string;
|
|
70
|
+
view: ViewType;
|
|
71
|
+
originalEvent: Event;
|
|
72
|
+
} | {
|
|
73
|
+
type: 'resource-update';
|
|
74
|
+
resource: Resource | ResourceGroup;
|
|
75
|
+
changes: Partial<Resource & ResourceGroup>;
|
|
76
|
+
originalEvent: Event;
|
|
77
|
+
} | {
|
|
78
|
+
type: 'resource-delete';
|
|
79
|
+
resource: Resource | ResourceGroup;
|
|
80
|
+
originalEvent: Event;
|
|
81
|
+
};
|
|
95
82
|
/**
|
|
96
|
-
*
|
|
83
|
+
* Payload of one scheduler event — the union arm minus its discriminant.
|
|
97
84
|
*/
|
|
98
|
-
export
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
'
|
|
107
|
-
|
|
108
|
-
}
|
|
85
|
+
export type EventDetail<T extends SchedulerCustomEvent['type']> = Omit<Extract<SchedulerCustomEvent, {
|
|
86
|
+
type: T;
|
|
87
|
+
}>, 'type'>;
|
|
88
|
+
/**
|
|
89
|
+
* `HTMLElementEventMap`-shaped view of the union, for `addEventListener`
|
|
90
|
+
* typing in consumer code.
|
|
91
|
+
*/
|
|
92
|
+
export type SchedulerEventMap = {
|
|
93
|
+
[T in SchedulerCustomEvent['type']]: CustomEvent<EventDetail<T>>;
|
|
94
|
+
};
|