@sprucelabs/spruce-calendar-components 22.1.15 → 22.3.1
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/build/esm/skillViewControllers/Root.svc.js +1 -1
- package/build/esm/toolBelt/CalendarToolTestFactory.js +2 -2
- package/build/esm/toolBelt/states/AbstractCalendarEventToolBeltState.d.ts +2 -2
- package/build/esm/toolBelt/states/AbstractCalendarEventToolBeltState.js +2 -2
- package/build/esm/utilities/CalendarEventManager.d.ts +6 -1
- package/build/esm/utilities/CalendarEventManager.js +12 -2
- package/build/skillViewControllers/Root.svc.js +1 -1
- package/build/toolBelt/CalendarToolTestFactory.js +2 -2
- package/build/toolBelt/states/AbstractCalendarEventToolBeltState.d.ts +2 -2
- package/build/toolBelt/states/AbstractCalendarEventToolBeltState.js +2 -2
- package/build/utilities/CalendarEventManager.d.ts +6 -1
- package/build/utilities/CalendarEventManager.js +12 -2
- package/package.json +1 -1
|
@@ -375,7 +375,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
375
375
|
const end = this.dates.getEndOfDay(this.calendarVc.getStartDate());
|
|
376
376
|
const start = this.dates.getStartOfDay(this.calendarVc.getStartDate());
|
|
377
377
|
const events = this.events
|
|
378
|
-
.
|
|
378
|
+
.getEvents()
|
|
379
379
|
.filter((e) => e.startDateTimeMs <= end && e.startDateTimeMs >= start);
|
|
380
380
|
return events;
|
|
381
381
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertOptions, SchemaError } from '@sprucelabs/schema';
|
|
2
2
|
import { assert } from '@sprucelabs/test';
|
|
3
|
-
import
|
|
3
|
+
import clone from 'just-clone';
|
|
4
4
|
export default class CalendarToolTestFactory {
|
|
5
5
|
static Tool(stateMachine, vcId, options) {
|
|
6
6
|
assertOptions({ stateMachine, vcId }, ['stateMachine', 'vcId']);
|
|
@@ -18,7 +18,7 @@ export default class CalendarToolTestFactory {
|
|
|
18
18
|
parameters: ['getHasPendingContextChanges'],
|
|
19
19
|
friendlyMessage: `You need to pass 'getHasPendingContextChanges: () => boolean' or similar to CalendarToolTestFactory.Tool(....)`,
|
|
20
20
|
});
|
|
21
|
-
} },
|
|
21
|
+
} }, clone(options !== null && options !== void 0 ? options : {})));
|
|
22
22
|
void stateMachine.on('did-update-context', () => {
|
|
23
23
|
return vc.handleUpdateContext(stateMachine.getContext());
|
|
24
24
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpruceSchemas, ToolBeltState, ViewControllerId } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
-
import { CalendarTool, CalendarToolBeltContext, CalendarToolBeltStateMachine, GetPersonFromEventHandler } from '../../types/calendar.types';
|
|
2
|
+
import { CalendarTool, CalendarToolBeltContext, CalendarToolBeltStateMachine, CalendarToolOptions, GetPersonFromEventHandler } from '../../types/calendar.types';
|
|
3
3
|
import EventControlsCardViewController from '../../viewControllers/EventControlsCard.vc';
|
|
4
4
|
declare type Tool = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.ToolBeltTool;
|
|
5
5
|
export declare type AddToolOptions = Omit<Tool, 'card'> & {
|
|
@@ -20,7 +20,7 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
|
|
|
20
20
|
private getContext;
|
|
21
21
|
clearPendingContextChanges(): Promise<void>;
|
|
22
22
|
addTool(options: AddToolOptions): Promise<CalendarTool>;
|
|
23
|
-
|
|
23
|
+
protected buildVcConstructorOptions(id: string): CalendarToolOptions;
|
|
24
24
|
private addVc;
|
|
25
25
|
protected getPersonFromEvent(): ReturnType<GetPersonFromEventHandler>;
|
|
26
26
|
private handleUpdateContextFromTool;
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { assertOptions } from '@sprucelabs/schema';
|
|
11
|
-
import
|
|
11
|
+
import compare from 'just-compare';
|
|
12
12
|
import CalendarToolRegistrar from '../CalendarToolRegistrar.js';
|
|
13
13
|
export default class AbstractCalendarEventToolBeltState {
|
|
14
14
|
constructor() {
|
|
@@ -125,7 +125,7 @@ export default class AbstractCalendarEventToolBeltState {
|
|
|
125
125
|
handleUpdateContextFromTool(updates, fromToolId, options) {
|
|
126
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
127
|
const pendingUpdates = Object.assign(Object.assign({}, this.pendingContextUpdates), updates);
|
|
128
|
-
if (
|
|
128
|
+
if (compare(this.pendingContextUpdates, pendingUpdates)) {
|
|
129
129
|
return false;
|
|
130
130
|
}
|
|
131
131
|
this.pendingContextUpdates = pendingUpdates;
|
|
@@ -30,7 +30,12 @@ export declare class CalendarEventManager {
|
|
|
30
30
|
private refreshShifts;
|
|
31
31
|
private isCalendarSelected;
|
|
32
32
|
private doesCalenderExist;
|
|
33
|
-
|
|
33
|
+
getEvents(): CalendarEvent[];
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated events.getAllEvents() => events.getEvents()
|
|
36
|
+
*/
|
|
37
|
+
getAllEvents(): import("@sprucelabs/calendar-utils").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent[];
|
|
38
|
+
getEventsByGroupId(groupId: string): import("@sprucelabs/calendar-utils").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent[];
|
|
34
39
|
getCalendars(): import("@sprucelabs/calendar-utils").SpruceSchemas.Calendar.v2021_05_19.Calendar[];
|
|
35
40
|
addDraftEvent(event: CalendarEvent): Promise<void>;
|
|
36
41
|
silentlySwapEvent(oldId: string, event: CalendarEvent): Promise<void>;
|
|
@@ -64,9 +64,19 @@ export class CalendarEventManager {
|
|
|
64
64
|
doesCalenderExist(calendarId) {
|
|
65
65
|
return this.calendars.findIndex((c) => c.id === calendarId) > -1;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
getEvents() {
|
|
68
68
|
return this.allEvents;
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated events.getAllEvents() => events.getEvents()
|
|
72
|
+
*/
|
|
73
|
+
getAllEvents() {
|
|
74
|
+
return this.getEvents();
|
|
75
|
+
}
|
|
76
|
+
getEventsByGroupId(groupId) {
|
|
77
|
+
const events = this.getEvents().filter((match) => match.groupId === groupId);
|
|
78
|
+
return events;
|
|
79
|
+
}
|
|
70
80
|
getCalendars() {
|
|
71
81
|
return this.calendars;
|
|
72
82
|
}
|
|
@@ -79,7 +89,7 @@ export class CalendarEventManager {
|
|
|
79
89
|
}
|
|
80
90
|
silentlySwapEvent(oldId, event) {
|
|
81
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
const events = this.
|
|
92
|
+
const events = this.getEvents().filter((e) => e.id !== oldId);
|
|
83
93
|
this.allEvents = [...events, event];
|
|
84
94
|
yield this.updateEventInContext(event);
|
|
85
95
|
});
|
|
@@ -329,7 +329,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
329
329
|
const end = this.dates.getEndOfDay(this.calendarVc.getStartDate());
|
|
330
330
|
const start = this.dates.getStartOfDay(this.calendarVc.getStartDate());
|
|
331
331
|
const events = this.events
|
|
332
|
-
.
|
|
332
|
+
.getEvents()
|
|
333
333
|
.filter((e) => e.startDateTimeMs <= end && e.startDateTimeMs >= start);
|
|
334
334
|
return events;
|
|
335
335
|
}
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const schema_1 = require("@sprucelabs/schema");
|
|
7
7
|
const test_1 = require("@sprucelabs/test");
|
|
8
|
-
const
|
|
8
|
+
const just_clone_1 = __importDefault(require("just-clone"));
|
|
9
9
|
class CalendarToolTestFactory {
|
|
10
10
|
static Tool(stateMachine, vcId, options) {
|
|
11
11
|
(0, schema_1.assertOptions)({ stateMachine, vcId }, ['stateMachine', 'vcId']);
|
|
@@ -23,7 +23,7 @@ class CalendarToolTestFactory {
|
|
|
23
23
|
parameters: ['getHasPendingContextChanges'],
|
|
24
24
|
friendlyMessage: `You need to pass 'getHasPendingContextChanges: () => boolean' or similar to CalendarToolTestFactory.Tool(....)`,
|
|
25
25
|
});
|
|
26
|
-
} }, (0,
|
|
26
|
+
} }, (0, just_clone_1.default)(options !== null && options !== void 0 ? options : {})));
|
|
27
27
|
void stateMachine.on('did-update-context', () => {
|
|
28
28
|
return vc.handleUpdateContext(stateMachine.getContext());
|
|
29
29
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpruceSchemas, ToolBeltState, ViewControllerId } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
-
import { CalendarTool, CalendarToolBeltContext, CalendarToolBeltStateMachine, GetPersonFromEventHandler } from '../../types/calendar.types';
|
|
2
|
+
import { CalendarTool, CalendarToolBeltContext, CalendarToolBeltStateMachine, CalendarToolOptions, GetPersonFromEventHandler } from '../../types/calendar.types';
|
|
3
3
|
import EventControlsCardViewController from '../../viewControllers/EventControlsCard.vc';
|
|
4
4
|
declare type Tool = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.ToolBeltTool;
|
|
5
5
|
export declare type AddToolOptions = Omit<Tool, 'card'> & {
|
|
@@ -20,7 +20,7 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
|
|
|
20
20
|
private getContext;
|
|
21
21
|
clearPendingContextChanges(): Promise<void>;
|
|
22
22
|
addTool(options: AddToolOptions): Promise<CalendarTool>;
|
|
23
|
-
|
|
23
|
+
protected buildVcConstructorOptions(id: string): CalendarToolOptions;
|
|
24
24
|
private addVc;
|
|
25
25
|
protected getPersonFromEvent(): ReturnType<GetPersonFromEventHandler>;
|
|
26
26
|
private handleUpdateContextFromTool;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const schema_1 = require("@sprucelabs/schema");
|
|
7
|
-
const
|
|
7
|
+
const just_compare_1 = __importDefault(require("just-compare"));
|
|
8
8
|
const CalendarToolRegistrar_1 = __importDefault(require("../CalendarToolRegistrar"));
|
|
9
9
|
class AbstractCalendarEventToolBeltState {
|
|
10
10
|
constructor() {
|
|
@@ -104,7 +104,7 @@ class AbstractCalendarEventToolBeltState {
|
|
|
104
104
|
}
|
|
105
105
|
async handleUpdateContextFromTool(updates, fromToolId, options) {
|
|
106
106
|
const pendingUpdates = Object.assign(Object.assign({}, this.pendingContextUpdates), updates);
|
|
107
|
-
if ((0,
|
|
107
|
+
if ((0, just_compare_1.default)(this.pendingContextUpdates, pendingUpdates)) {
|
|
108
108
|
return false;
|
|
109
109
|
}
|
|
110
110
|
this.pendingContextUpdates = pendingUpdates;
|
|
@@ -30,7 +30,12 @@ export declare class CalendarEventManager {
|
|
|
30
30
|
private refreshShifts;
|
|
31
31
|
private isCalendarSelected;
|
|
32
32
|
private doesCalenderExist;
|
|
33
|
-
|
|
33
|
+
getEvents(): CalendarEvent[];
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated events.getAllEvents() => events.getEvents()
|
|
36
|
+
*/
|
|
37
|
+
getAllEvents(): import("@sprucelabs/calendar-utils").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent[];
|
|
38
|
+
getEventsByGroupId(groupId: string): import("@sprucelabs/calendar-utils").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent[];
|
|
34
39
|
getCalendars(): import("@sprucelabs/calendar-utils").SpruceSchemas.Calendar.v2021_05_19.Calendar[];
|
|
35
40
|
addDraftEvent(event: CalendarEvent): Promise<void>;
|
|
36
41
|
silentlySwapEvent(oldId: string, event: CalendarEvent): Promise<void>;
|
|
@@ -61,9 +61,19 @@ class CalendarEventManager {
|
|
|
61
61
|
doesCalenderExist(calendarId) {
|
|
62
62
|
return this.calendars.findIndex((c) => c.id === calendarId) > -1;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
getEvents() {
|
|
65
65
|
return this.allEvents;
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated events.getAllEvents() => events.getEvents()
|
|
69
|
+
*/
|
|
70
|
+
getAllEvents() {
|
|
71
|
+
return this.getEvents();
|
|
72
|
+
}
|
|
73
|
+
getEventsByGroupId(groupId) {
|
|
74
|
+
const events = this.getEvents().filter((match) => match.groupId === groupId);
|
|
75
|
+
return events;
|
|
76
|
+
}
|
|
67
77
|
getCalendars() {
|
|
68
78
|
return this.calendars;
|
|
69
79
|
}
|
|
@@ -73,7 +83,7 @@ class CalendarEventManager {
|
|
|
73
83
|
await this.updateEventInContext(event);
|
|
74
84
|
}
|
|
75
85
|
async silentlySwapEvent(oldId, event) {
|
|
76
|
-
const events = this.
|
|
86
|
+
const events = this.getEvents().filter((e) => e.id !== oldId);
|
|
77
87
|
this.allEvents = [...events, event];
|
|
78
88
|
await this.updateEventInContext(event);
|
|
79
89
|
}
|