@mintplayer/web-components 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/{color-CpFtrIoX.mjs → id-D5QCG603.mjs} +346 -305
- package/package.json +1 -1
- package/scheduler/index.mjs +1656 -478
- package/scheduler/src/components/mp-scheduler.d.ts +150 -0
- 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 +49 -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 +95 -4
- package/scheduler/src/views/week-view.d.ts +6 -0
- package/scheduler-core/index.mjs +62 -58
- 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 +34 -0
- package/scheduler-core/src/models/options.d.ts +56 -16
- package/scheduler-core/src/models/permissions.d.ts +83 -0
- package/scheduler-core/src/models/time-slot.d.ts +10 -0
- package/scheduler-core/src/services/resource.service.d.ts +25 -11
- package/scheduler-core/src/utils/color.d.ts +22 -0
- package/scheduler/src/events/event-types.d.ts +0 -58
|
@@ -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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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;
|
|
@@ -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'>;
|