@sprucelabs/spruce-calendar-components 22.8.19 → 22.8.21
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/.spruce/schemas/schemas.types.d.ts +312 -312
- package/build/esm/.spruce/schemas/schemas.types.d.ts +312 -312
- package/build/esm/skillViewControllers/Root.svc.d.ts +1 -1
- package/build/esm/skillViewControllers/Root.svc.js +8 -4
- package/build/esm/utilities/CalendarEventManager.d.ts +1 -1
- package/build/esm/utilities/CalendarEventManager.js +3 -7
- package/build/esm/viewControllers/Calendar.vc.d.ts +11 -10
- package/build/esm/viewControllers/Calendar.vc.js +5 -2
- package/build/esm/viewControllers/CalendarSelectTool.vc.d.ts +1 -0
- package/build/esm/viewControllers/CalendarSelectTool.vc.js +8 -3
- package/build/skillViewControllers/Root.svc.d.ts +1 -1
- package/build/skillViewControllers/Root.svc.js +6 -4
- package/build/utilities/CalendarEventManager.d.ts +1 -1
- package/build/utilities/CalendarEventManager.js +3 -7
- package/build/viewControllers/Calendar.vc.d.ts +11 -10
- package/build/viewControllers/Calendar.vc.js +5 -2
- package/build/viewControllers/CalendarSelectTool.vc.d.ts +1 -0
- package/build/viewControllers/CalendarSelectTool.vc.js +8 -3
- package/package.json +1 -1
|
@@ -45,7 +45,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
45
45
|
private setSelectedDateInDateSelectVc;
|
|
46
46
|
private getStartDate;
|
|
47
47
|
private handleDeselectEvent;
|
|
48
|
-
|
|
48
|
+
protected resetToRootState(): Promise<void>;
|
|
49
49
|
private ToolBeltVc;
|
|
50
50
|
private handleClickEvent;
|
|
51
51
|
private handleDraftEventAdded;
|
|
@@ -80,6 +80,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
80
80
|
message: `You wanna cancel this?`,
|
|
81
81
|
});
|
|
82
82
|
if (confirm) {
|
|
83
|
+
yield this.resetToRootState();
|
|
83
84
|
yield this.events.removeEvent(eventId);
|
|
84
85
|
}
|
|
85
86
|
});
|
|
@@ -166,7 +167,10 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
166
167
|
}
|
|
167
168
|
handleSelectCalendar(calendar) {
|
|
168
169
|
var _a;
|
|
169
|
-
(
|
|
170
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
(_a = this.remoteEventStore) === null || _a === void 0 ? void 0 : _a.setCalendarId(calendar.id);
|
|
172
|
+
yield this.events.makeCalendarVisible(calendar.id);
|
|
173
|
+
});
|
|
170
174
|
}
|
|
171
175
|
getToolBeltStateMachine() {
|
|
172
176
|
return this.sm;
|
|
@@ -213,11 +217,11 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
213
217
|
}
|
|
214
218
|
resetToRootState() {
|
|
215
219
|
return __awaiter(this, void 0, void 0, function* () {
|
|
216
|
-
yield this.events.reset();
|
|
217
|
-
this.makeDateSelectMatchSelectedDateFromCalendar();
|
|
218
|
-
this.transitionPromise = this.sm.transitionTo(this.toolBeltStates.root);
|
|
219
220
|
this.toolBeltVc.close();
|
|
221
|
+
this.transitionPromise = this.sm.transitionTo(this.toolBeltStates.root);
|
|
220
222
|
yield this.transitionPromise;
|
|
223
|
+
yield this.events.reset();
|
|
224
|
+
this.makeDateSelectMatchSelectedDateFromCalendar();
|
|
221
225
|
});
|
|
222
226
|
}
|
|
223
227
|
ToolBeltVc() {
|
|
@@ -100,7 +100,7 @@ export default class CalendarEventManager {
|
|
|
100
100
|
hasEvent(id: string): boolean;
|
|
101
101
|
optionallyAskForUpdateRepeatingStrategy(event: UpdateEvent): Promise<boolean>;
|
|
102
102
|
}
|
|
103
|
-
export declare type EventManagerCalendarVc = Pick<CalendarViewController, 'replaceEventsInRange' | 'mixinEvents' | 'removeEvent' | 'addEvent' | 'hasEvent' | 'updateEvent' | 'setShifts' | 'getShifts' | 'getEvent' | 'getPeople' | 'setControllerForEventType' | 'setRemoteStore' | 'getSelectedEvent' | 'selectEvent' | 'deselectEvent'>;
|
|
103
|
+
export declare type EventManagerCalendarVc = Pick<CalendarViewController, 'replaceEventsInRange' | 'mixinEvents' | 'removeEvent' | 'addEvent' | 'hasEvent' | 'updateEvent' | 'setShifts' | 'getShifts' | 'getEvent' | 'getPeople' | 'setControllerForEventType' | 'setRemoteStore' | 'getSelectedEvent' | 'selectEvent' | 'deselectEvent' | 'removeEvents'>;
|
|
104
104
|
declare type EventManagerRemoteViewControllerFactory = Pick<RemoteViewControllerFactory, 'fetchRemoteController'>;
|
|
105
105
|
export interface CalendarEventManagerOptions {
|
|
106
106
|
calendarVc: EventManagerCalendarVc;
|
|
@@ -127,7 +127,7 @@ export default class CalendarEventManager {
|
|
|
127
127
|
reset() {
|
|
128
128
|
var _a;
|
|
129
129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
|
|
130
|
+
yield this.setEventInContext(undefined);
|
|
131
131
|
(_a = this.events) === null || _a === void 0 ? void 0 : _a.clearCalendarId();
|
|
132
132
|
});
|
|
133
133
|
}
|
|
@@ -175,12 +175,8 @@ export default class CalendarEventManager {
|
|
|
175
175
|
return __awaiter(this, void 0, void 0, function* () {
|
|
176
176
|
this.assertValidCalendarId(calendarId);
|
|
177
177
|
const visibleCalendarIds = this.visibleCalendarIds.filter((id) => id !== calendarId);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
this.calendarVc.hasEvent(event.id)) {
|
|
181
|
-
yield this.calendarVc.removeEvent(event.id);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
178
|
+
const toHide = this.allEvents.filter((e) => e.calendarId === calendarId);
|
|
179
|
+
yield this.calendarVc.removeEvents(toHide.map((e) => e.id).filter((e) => this.calendarVc.hasEvent(e)));
|
|
184
180
|
yield this.prefs.setVisibleCalendarIds(visibleCalendarIds);
|
|
185
181
|
});
|
|
186
182
|
}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { SpruceSchemas, ViewControllerOptions, CalendarViewController as CoreCalendarViewController, ClickCalendarViewOptions, DropEventOptions, ClickEventOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { RemoteEventStore } from '../stores/RemoteEventStore';
|
|
3
3
|
import { UpdateEvent } from '../types/calendar.types';
|
|
4
|
-
declare type Calendar = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Calendar;
|
|
5
|
-
declare type Event = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent;
|
|
6
|
-
declare type DraftAddedHandler = (event: Event) => void | Promise<void>;
|
|
7
|
-
declare type EventSwappedHandler = (draft: Event, saved: Event) => void | Promise<void>;
|
|
8
|
-
declare type EventDroppedHandler = (id: string, updates: Partial<Event>) => boolean | Promise<boolean>;
|
|
9
|
-
declare type DraftRemovedHandler = () => void | Promise<void>;
|
|
10
|
-
declare type ClickEventHandler = (options: ClickEventOptions) => void | Promise<void>;
|
|
11
|
-
declare type StartDateTimeChangeHandler = (date: number) => void | Promise<void>;
|
|
12
|
-
declare type DeselectEventHandler = () => void | Promise<void>;
|
|
13
4
|
export interface CalendarViewControllerOptions {
|
|
14
5
|
people?: NonNullable<Calendar['people']>;
|
|
15
6
|
remoteEventStore?: RemoteEventStore;
|
|
@@ -40,7 +31,8 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
40
31
|
setRemoteStore(remoteEventStore: RemoteEventStore): void;
|
|
41
32
|
getRemoteStore(): RemoteEventStore | undefined;
|
|
42
33
|
private handleClick;
|
|
43
|
-
private
|
|
34
|
+
private isDraftEvent;
|
|
35
|
+
protected getDraftEvent(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent | undefined;
|
|
44
36
|
private removeDraftEvent;
|
|
45
37
|
private addDraftEventFromClick;
|
|
46
38
|
addDraftEvent(e: Omit<Event, 'id'>): Promise<SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent>;
|
|
@@ -77,4 +69,13 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
77
69
|
shifts?: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarShift[] | null | undefined;
|
|
78
70
|
};
|
|
79
71
|
}
|
|
72
|
+
declare type Calendar = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Calendar;
|
|
73
|
+
declare type Event = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent;
|
|
74
|
+
declare type DraftAddedHandler = (event: Event) => void | Promise<void>;
|
|
75
|
+
declare type EventSwappedHandler = (draft: Event, saved: Event) => void | Promise<void>;
|
|
76
|
+
declare type EventDroppedHandler = (id: string, updates: Partial<Event>) => boolean | Promise<boolean>;
|
|
77
|
+
declare type DraftRemovedHandler = () => void | Promise<void>;
|
|
78
|
+
declare type ClickEventHandler = (options: ClickEventOptions) => void | Promise<void>;
|
|
79
|
+
declare type StartDateTimeChangeHandler = (date: number) => void | Promise<void>;
|
|
80
|
+
declare type DeselectEventHandler = () => void | Promise<void>;
|
|
80
81
|
export {};
|
|
@@ -78,7 +78,7 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
78
78
|
'remoteEventStore',
|
|
79
79
|
]);
|
|
80
80
|
const selected = this.getSelectedEvent();
|
|
81
|
-
if (selected && selected
|
|
81
|
+
if (selected && !this.isDraftEvent(selected)) {
|
|
82
82
|
yield this.deselectEvent();
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
@@ -91,9 +91,12 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
+
isDraftEvent(event) {
|
|
95
|
+
return event.style === 'draft';
|
|
96
|
+
}
|
|
94
97
|
getDraftEvent() {
|
|
95
98
|
const events = this.getEvents();
|
|
96
|
-
const draft = events.find((e) => e
|
|
99
|
+
const draft = events.find((e) => this.isDraftEvent(e));
|
|
97
100
|
return draft;
|
|
98
101
|
}
|
|
99
102
|
removeDraftEvent(id) {
|
|
@@ -15,6 +15,7 @@ export default class CalendarSelectCardViewController extends AbstractViewContro
|
|
|
15
15
|
getListVc(): import("@sprucelabs/heartwood-view-controllers").ListViewController;
|
|
16
16
|
getIsLoaded(): boolean;
|
|
17
17
|
getSelectedCalendarIds(): string[];
|
|
18
|
+
private rowForCalendar;
|
|
18
19
|
load(options: {
|
|
19
20
|
scope: Scope;
|
|
20
21
|
}): Promise<void>;
|
|
@@ -50,8 +50,10 @@ export default class CalendarSelectCardViewController extends AbstractViewContro
|
|
|
50
50
|
name: 'isVisible',
|
|
51
51
|
value: this.selectedCalendarIds.indexOf(calendar.id) > -1,
|
|
52
52
|
onChange: (isVisible) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const calendarId = calendar.id;
|
|
54
|
+
this.changePromise = this.events.setCalendarVisibility(calendarId, isVisible);
|
|
55
|
+
const p = this.changePromise;
|
|
56
|
+
return p;
|
|
55
57
|
}),
|
|
56
58
|
},
|
|
57
59
|
},
|
|
@@ -76,12 +78,15 @@ export default class CalendarSelectCardViewController extends AbstractViewContro
|
|
|
76
78
|
const records = this.activeVc.getRecords();
|
|
77
79
|
const ids = [];
|
|
78
80
|
for (const calendar of records) {
|
|
79
|
-
if (this.
|
|
81
|
+
if (this.rowForCalendar(calendar.id).getValue('isVisible')) {
|
|
80
82
|
ids.push(calendar.id);
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
return ids;
|
|
84
86
|
}
|
|
87
|
+
rowForCalendar(calendarId) {
|
|
88
|
+
return this.getListVc().getRowVc(calendarId);
|
|
89
|
+
}
|
|
85
90
|
load(options) {
|
|
86
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
92
|
assertOptions(options, ['scope']);
|
|
@@ -45,7 +45,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
45
45
|
private setSelectedDateInDateSelectVc;
|
|
46
46
|
private getStartDate;
|
|
47
47
|
private handleDeselectEvent;
|
|
48
|
-
|
|
48
|
+
protected resetToRootState(): Promise<void>;
|
|
49
49
|
private ToolBeltVc;
|
|
50
50
|
private handleClickEvent;
|
|
51
51
|
private handleDraftEventAdded;
|
|
@@ -75,6 +75,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
75
75
|
message: `You wanna cancel this?`,
|
|
76
76
|
});
|
|
77
77
|
if (confirm) {
|
|
78
|
+
await this.resetToRootState();
|
|
78
79
|
await this.events.removeEvent(eventId);
|
|
79
80
|
}
|
|
80
81
|
}
|
|
@@ -144,9 +145,10 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
144
145
|
this.calendarVc.waitForPendingSaves(),
|
|
145
146
|
]);
|
|
146
147
|
}
|
|
147
|
-
handleSelectCalendar(calendar) {
|
|
148
|
+
async handleSelectCalendar(calendar) {
|
|
148
149
|
var _a;
|
|
149
150
|
(_a = this.remoteEventStore) === null || _a === void 0 ? void 0 : _a.setCalendarId(calendar.id);
|
|
151
|
+
await this.events.makeCalendarVisible(calendar.id);
|
|
150
152
|
}
|
|
151
153
|
getToolBeltStateMachine() {
|
|
152
154
|
return this.sm;
|
|
@@ -188,11 +190,11 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
188
190
|
await this.resetToRootState();
|
|
189
191
|
}
|
|
190
192
|
async resetToRootState() {
|
|
191
|
-
await this.events.reset();
|
|
192
|
-
this.makeDateSelectMatchSelectedDateFromCalendar();
|
|
193
|
-
this.transitionPromise = this.sm.transitionTo(this.toolBeltStates.root);
|
|
194
193
|
this.toolBeltVc.close();
|
|
194
|
+
this.transitionPromise = this.sm.transitionTo(this.toolBeltStates.root);
|
|
195
195
|
await this.transitionPromise;
|
|
196
|
+
await this.events.reset();
|
|
197
|
+
this.makeDateSelectMatchSelectedDateFromCalendar();
|
|
196
198
|
}
|
|
197
199
|
ToolBeltVc() {
|
|
198
200
|
return this.Controller('toolBelt', {
|
|
@@ -100,7 +100,7 @@ export default class CalendarEventManager {
|
|
|
100
100
|
hasEvent(id: string): boolean;
|
|
101
101
|
optionallyAskForUpdateRepeatingStrategy(event: UpdateEvent): Promise<boolean>;
|
|
102
102
|
}
|
|
103
|
-
export declare type EventManagerCalendarVc = Pick<CalendarViewController, 'replaceEventsInRange' | 'mixinEvents' | 'removeEvent' | 'addEvent' | 'hasEvent' | 'updateEvent' | 'setShifts' | 'getShifts' | 'getEvent' | 'getPeople' | 'setControllerForEventType' | 'setRemoteStore' | 'getSelectedEvent' | 'selectEvent' | 'deselectEvent'>;
|
|
103
|
+
export declare type EventManagerCalendarVc = Pick<CalendarViewController, 'replaceEventsInRange' | 'mixinEvents' | 'removeEvent' | 'addEvent' | 'hasEvent' | 'updateEvent' | 'setShifts' | 'getShifts' | 'getEvent' | 'getPeople' | 'setControllerForEventType' | 'setRemoteStore' | 'getSelectedEvent' | 'selectEvent' | 'deselectEvent' | 'removeEvents'>;
|
|
104
104
|
declare type EventManagerRemoteViewControllerFactory = Pick<RemoteViewControllerFactory, 'fetchRemoteController'>;
|
|
105
105
|
export interface CalendarEventManagerOptions {
|
|
106
106
|
calendarVc: EventManagerCalendarVc;
|
|
@@ -116,7 +116,7 @@ class CalendarEventManager {
|
|
|
116
116
|
}
|
|
117
117
|
async reset() {
|
|
118
118
|
var _a;
|
|
119
|
-
|
|
119
|
+
await this.setEventInContext(undefined);
|
|
120
120
|
(_a = this.events) === null || _a === void 0 ? void 0 : _a.clearCalendarId();
|
|
121
121
|
}
|
|
122
122
|
async restoreEventToDraftOnStateLoadError() {
|
|
@@ -156,12 +156,8 @@ class CalendarEventManager {
|
|
|
156
156
|
async makeCalendarHidden(calendarId) {
|
|
157
157
|
this.assertValidCalendarId(calendarId);
|
|
158
158
|
const visibleCalendarIds = this.visibleCalendarIds.filter((id) => id !== calendarId);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
this.calendarVc.hasEvent(event.id)) {
|
|
162
|
-
await this.calendarVc.removeEvent(event.id);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
159
|
+
const toHide = this.allEvents.filter((e) => e.calendarId === calendarId);
|
|
160
|
+
await this.calendarVc.removeEvents(toHide.map((e) => e.id).filter((e) => this.calendarVc.hasEvent(e)));
|
|
165
161
|
await this.prefs.setVisibleCalendarIds(visibleCalendarIds);
|
|
166
162
|
}
|
|
167
163
|
updateEvent(id, updates) {
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { SpruceSchemas, ViewControllerOptions, CalendarViewController as CoreCalendarViewController, ClickCalendarViewOptions, DropEventOptions, ClickEventOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { RemoteEventStore } from '../stores/RemoteEventStore';
|
|
3
3
|
import { UpdateEvent } from '../types/calendar.types';
|
|
4
|
-
declare type Calendar = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Calendar;
|
|
5
|
-
declare type Event = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent;
|
|
6
|
-
declare type DraftAddedHandler = (event: Event) => void | Promise<void>;
|
|
7
|
-
declare type EventSwappedHandler = (draft: Event, saved: Event) => void | Promise<void>;
|
|
8
|
-
declare type EventDroppedHandler = (id: string, updates: Partial<Event>) => boolean | Promise<boolean>;
|
|
9
|
-
declare type DraftRemovedHandler = () => void | Promise<void>;
|
|
10
|
-
declare type ClickEventHandler = (options: ClickEventOptions) => void | Promise<void>;
|
|
11
|
-
declare type StartDateTimeChangeHandler = (date: number) => void | Promise<void>;
|
|
12
|
-
declare type DeselectEventHandler = () => void | Promise<void>;
|
|
13
4
|
export interface CalendarViewControllerOptions {
|
|
14
5
|
people?: NonNullable<Calendar['people']>;
|
|
15
6
|
remoteEventStore?: RemoteEventStore;
|
|
@@ -40,7 +31,8 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
40
31
|
setRemoteStore(remoteEventStore: RemoteEventStore): void;
|
|
41
32
|
getRemoteStore(): RemoteEventStore | undefined;
|
|
42
33
|
private handleClick;
|
|
43
|
-
private
|
|
34
|
+
private isDraftEvent;
|
|
35
|
+
protected getDraftEvent(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent | undefined;
|
|
44
36
|
private removeDraftEvent;
|
|
45
37
|
private addDraftEventFromClick;
|
|
46
38
|
addDraftEvent(e: Omit<Event, 'id'>): Promise<SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent>;
|
|
@@ -77,4 +69,13 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
77
69
|
shifts?: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarShift[] | null | undefined;
|
|
78
70
|
};
|
|
79
71
|
}
|
|
72
|
+
declare type Calendar = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Calendar;
|
|
73
|
+
declare type Event = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent;
|
|
74
|
+
declare type DraftAddedHandler = (event: Event) => void | Promise<void>;
|
|
75
|
+
declare type EventSwappedHandler = (draft: Event, saved: Event) => void | Promise<void>;
|
|
76
|
+
declare type EventDroppedHandler = (id: string, updates: Partial<Event>) => boolean | Promise<boolean>;
|
|
77
|
+
declare type DraftRemovedHandler = () => void | Promise<void>;
|
|
78
|
+
declare type ClickEventHandler = (options: ClickEventOptions) => void | Promise<void>;
|
|
79
|
+
declare type StartDateTimeChangeHandler = (date: number) => void | Promise<void>;
|
|
80
|
+
declare type DeselectEventHandler = () => void | Promise<void>;
|
|
80
81
|
export {};
|
|
@@ -71,7 +71,7 @@ class CalendarViewController extends heartwood_view_controllers_1.CalendarViewCo
|
|
|
71
71
|
'remoteEventStore',
|
|
72
72
|
]);
|
|
73
73
|
const selected = this.getSelectedEvent();
|
|
74
|
-
if (selected && selected
|
|
74
|
+
if (selected && !this.isDraftEvent(selected)) {
|
|
75
75
|
await this.deselectEvent();
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
@@ -83,9 +83,12 @@ class CalendarViewController extends heartwood_view_controllers_1.CalendarViewCo
|
|
|
83
83
|
await this.removeDraftEvent(draft.id);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
isDraftEvent(event) {
|
|
87
|
+
return event.style === 'draft';
|
|
88
|
+
}
|
|
86
89
|
getDraftEvent() {
|
|
87
90
|
const events = this.getEvents();
|
|
88
|
-
const draft = events.find((e) => e
|
|
91
|
+
const draft = events.find((e) => this.isDraftEvent(e));
|
|
89
92
|
return draft;
|
|
90
93
|
}
|
|
91
94
|
async removeDraftEvent(id) {
|
|
@@ -15,6 +15,7 @@ export default class CalendarSelectCardViewController extends AbstractViewContro
|
|
|
15
15
|
getListVc(): import("@sprucelabs/heartwood-view-controllers").ListViewController;
|
|
16
16
|
getIsLoaded(): boolean;
|
|
17
17
|
getSelectedCalendarIds(): string[];
|
|
18
|
+
private rowForCalendar;
|
|
18
19
|
load(options: {
|
|
19
20
|
scope: Scope;
|
|
20
21
|
}): Promise<void>;
|
|
@@ -43,8 +43,10 @@ class CalendarSelectCardViewController extends heartwood_view_controllers_1.Abst
|
|
|
43
43
|
name: 'isVisible',
|
|
44
44
|
value: this.selectedCalendarIds.indexOf(calendar.id) > -1,
|
|
45
45
|
onChange: async (isVisible) => {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const calendarId = calendar.id;
|
|
47
|
+
this.changePromise = this.events.setCalendarVisibility(calendarId, isVisible);
|
|
48
|
+
const p = this.changePromise;
|
|
49
|
+
return p;
|
|
48
50
|
},
|
|
49
51
|
},
|
|
50
52
|
},
|
|
@@ -67,12 +69,15 @@ class CalendarSelectCardViewController extends heartwood_view_controllers_1.Abst
|
|
|
67
69
|
const records = this.activeVc.getRecords();
|
|
68
70
|
const ids = [];
|
|
69
71
|
for (const calendar of records) {
|
|
70
|
-
if (this.
|
|
72
|
+
if (this.rowForCalendar(calendar.id).getValue('isVisible')) {
|
|
71
73
|
ids.push(calendar.id);
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
return ids;
|
|
75
77
|
}
|
|
78
|
+
rowForCalendar(calendarId) {
|
|
79
|
+
return this.getListVc().getRowVc(calendarId);
|
|
80
|
+
}
|
|
76
81
|
async load(options) {
|
|
77
82
|
(0, schema_1.assertOptions)(options, ['scope']);
|
|
78
83
|
const { scope } = options;
|