@sprucelabs/spruce-calendar-components 22.8.26 → 22.9.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/build/__tests__/support/SpyPeopleManager.d.ts +1 -1
- package/build/esm/__tests__/support/SpyPeopleManager.d.ts +1 -1
- package/build/esm/skillViewControllers/Root.svc.d.ts +2 -2
- package/build/esm/skillViewControllers/Root.svc.js +3 -2
- package/build/esm/utilities/CalendarPeopleManager.d.ts +1 -1
- package/build/esm/utilities/CalendarPeopleManager.js +3 -2
- package/build/esm/viewControllers/Calendar.vc.d.ts +1 -2
- package/build/esm/viewControllers/Calendar.vc.js +21 -14
- package/build/esm/viewControllers/PersonSelectTool.vc.js +1 -1
- package/build/skillViewControllers/Root.svc.d.ts +2 -2
- package/build/skillViewControllers/Root.svc.js +3 -2
- package/build/utilities/CalendarPeopleManager.d.ts +1 -1
- package/build/utilities/CalendarPeopleManager.js +3 -2
- package/build/viewControllers/Calendar.vc.d.ts +1 -2
- package/build/viewControllers/Calendar.vc.js +21 -14
- package/build/viewControllers/PersonSelectTool.vc.js +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ export default class SpyPeopleManager extends CalendarPeopleManager {
|
|
|
4
4
|
visiblePeopleIds?: string[];
|
|
5
5
|
peopleVisibilityMode?: PersonMode;
|
|
6
6
|
constructor(options: PeopleManagerOptions);
|
|
7
|
-
|
|
7
|
+
getVisiblePeopleIds(): string[];
|
|
8
8
|
getVisibilityMode(): PersonMode;
|
|
9
9
|
setVisiblePeopleIds(ids: string[], options?: SetVisiblePeolpeOptions): Promise<void>;
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ export default class SpyPeopleManager extends CalendarPeopleManager {
|
|
|
4
4
|
visiblePeopleIds?: string[];
|
|
5
5
|
peopleVisibilityMode?: PersonMode;
|
|
6
6
|
constructor(options: PeopleManagerOptions);
|
|
7
|
-
|
|
7
|
+
getVisiblePeopleIds(): string[];
|
|
8
8
|
getVisibilityMode(): PersonMode;
|
|
9
9
|
setVisiblePeopleIds(ids: string[], options?: SetVisiblePeolpeOptions): Promise<void>;
|
|
10
10
|
}
|
|
@@ -57,13 +57,13 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
57
57
|
getCalendarSelectVc(): import("../viewControllers/CalendarSelectTool.vc").default | undefined;
|
|
58
58
|
getCalendarVc(): CalendarViewController;
|
|
59
59
|
load(options: SkillViewControllerLoadOptions<RootArgs>): Promise<void>;
|
|
60
|
-
private
|
|
60
|
+
private setupCalendarEventListeners;
|
|
61
61
|
private handleDidCancelEvent;
|
|
62
62
|
private handleDidCreateOrUpdate;
|
|
63
63
|
private loadEventStore;
|
|
64
64
|
private loadPeople;
|
|
65
65
|
private loadScope;
|
|
66
|
-
|
|
66
|
+
protected syncPeopleOnCalendar(): void;
|
|
67
67
|
private syncOffsetWithLocale;
|
|
68
68
|
private loadEvents;
|
|
69
69
|
private _loadEvents;
|
|
@@ -222,6 +222,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
222
222
|
yield this.transitionPromise;
|
|
223
223
|
yield this.events.reset();
|
|
224
224
|
this.makeDateSelectMatchSelectedDateFromCalendar();
|
|
225
|
+
this.syncPeopleOnCalendar();
|
|
225
226
|
});
|
|
226
227
|
}
|
|
227
228
|
ToolBeltVc() {
|
|
@@ -293,7 +294,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
293
294
|
this.client = yield this.connectToApi();
|
|
294
295
|
const { scope, locale, args, router } = options;
|
|
295
296
|
yield Promise.all([
|
|
296
|
-
this.
|
|
297
|
+
this.setupCalendarEventListeners(),
|
|
297
298
|
locale.on('did-change-timezones', () => {
|
|
298
299
|
return this.syncOffsetWithLocale(locale);
|
|
299
300
|
}),
|
|
@@ -323,7 +324,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
323
324
|
yield this.waitUntilDoneSaving();
|
|
324
325
|
});
|
|
325
326
|
}
|
|
326
|
-
|
|
327
|
+
setupCalendarEventListeners() {
|
|
327
328
|
return __awaiter(this, void 0, void 0, function* () {
|
|
328
329
|
yield Promise.all([
|
|
329
330
|
this.client.on('calendar.did-create-calendar-event::v2021_05_19', this.handleDidCreateOrUpdate.bind(this)),
|
|
@@ -25,7 +25,7 @@ export default class CalendarPeopleManager extends AbstractEventEmitter<PeopleCo
|
|
|
25
25
|
private teammateById;
|
|
26
26
|
getTeam(): import("@sprucelabs/mercury-types").SpruceSchemas.Spruce.v2020_07_22.Person[];
|
|
27
27
|
getLoggedInPerson(): import("@sprucelabs/mercury-types").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson | undefined;
|
|
28
|
-
|
|
28
|
+
getVisiblePeopleIds(): string[];
|
|
29
29
|
private getSavedVisiblePeopleIds;
|
|
30
30
|
getVisibilityMode(): PersonMode;
|
|
31
31
|
setVisibilityMode(mode: PersonMode): Promise<void>;
|
|
@@ -29,7 +29,7 @@ export default class CalendarPeopleManager extends AbstractEventEmitter {
|
|
|
29
29
|
this.organizationId = organizationId;
|
|
30
30
|
this.locationId = locationId;
|
|
31
31
|
yield this.loadTeam();
|
|
32
|
-
if (this.
|
|
32
|
+
if (this.getVisiblePeopleIds().length === 0 && this.loggedInPerson) {
|
|
33
33
|
yield this.setVisiblePeopleIds([this.loggedInPerson.id]);
|
|
34
34
|
}
|
|
35
35
|
});
|
|
@@ -49,7 +49,7 @@ export default class CalendarPeopleManager extends AbstractEventEmitter {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
getVisiblePeople() {
|
|
52
|
-
|
|
52
|
+
const people = this.getVisiblePeopleIds()
|
|
53
53
|
.map((i) => {
|
|
54
54
|
try {
|
|
55
55
|
return this.teammateById(i);
|
|
@@ -59,6 +59,7 @@ export default class CalendarPeopleManager extends AbstractEventEmitter {
|
|
|
59
59
|
return null;
|
|
60
60
|
})
|
|
61
61
|
.filter((t) => !!t);
|
|
62
|
+
return people;
|
|
62
63
|
}
|
|
63
64
|
teammateById(id) {
|
|
64
65
|
var _a;
|
|
@@ -13,7 +13,6 @@ export interface CalendarViewControllerOptions {
|
|
|
13
13
|
onDeselectEvent?: DeselectEventHandler;
|
|
14
14
|
}
|
|
15
15
|
export default class CalendarViewController extends CoreCalendarViewController {
|
|
16
|
-
static shouldDelayStartingAnimationOnSwap: boolean;
|
|
17
16
|
static id: string;
|
|
18
17
|
private remoteEventStore?;
|
|
19
18
|
private draftAddedHandler;
|
|
@@ -43,8 +42,8 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
43
42
|
}): any;
|
|
44
43
|
private persist;
|
|
45
44
|
waitForPendingSaves(): Promise<void>;
|
|
46
|
-
private _persist;
|
|
47
45
|
getPeople(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson[];
|
|
46
|
+
private _persist;
|
|
48
47
|
render(): {
|
|
49
48
|
people: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson[];
|
|
50
49
|
controller?: import("@sprucelabs/heartwood-view-controllers").ViewController<SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Calendar> | null | undefined;
|
|
@@ -154,7 +154,6 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
154
154
|
_super.updateEvent.call(this, to.id, { isBusy: false });
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
this.disableAnimations();
|
|
158
157
|
this.isSwapping = true;
|
|
159
158
|
try {
|
|
160
159
|
yield this.renderOnce(() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -170,10 +169,6 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
170
169
|
}
|
|
171
170
|
catch (_a) { }
|
|
172
171
|
this.isSwapping = false;
|
|
173
|
-
if (CalendarViewController.shouldDelayStartingAnimationOnSwap) {
|
|
174
|
-
yield new Promise((r) => setTimeout(r, 100));
|
|
175
|
-
}
|
|
176
|
-
this.enableAnimation();
|
|
177
172
|
});
|
|
178
173
|
}
|
|
179
174
|
updateEvent(id, updates) {
|
|
@@ -200,6 +195,27 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
200
195
|
yield this.persistPromise;
|
|
201
196
|
});
|
|
202
197
|
}
|
|
198
|
+
getPeople() {
|
|
199
|
+
const people = super.getPeople();
|
|
200
|
+
this.sorter.setPeople(people !== null && people !== void 0 ? people : []);
|
|
201
|
+
this.sorter.setEvents(this.getEvents().map((e) => {
|
|
202
|
+
var _a;
|
|
203
|
+
return ({
|
|
204
|
+
id: e.id,
|
|
205
|
+
groupId: (_a = e.groupId) !== null && _a !== void 0 ? _a : undefined,
|
|
206
|
+
personId: e.target.personId,
|
|
207
|
+
startDateTimeMs: e.startDateTimeMs,
|
|
208
|
+
});
|
|
209
|
+
}));
|
|
210
|
+
const selectedEvent = this.getSelectedEvent();
|
|
211
|
+
if (selectedEvent && !draftEventGenerator.isDraftId(selectedEvent.id)) {
|
|
212
|
+
this.sorter.setSelectedEvents([selectedEvent.id]);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
this.sorter.setSelectedEvents([]);
|
|
216
|
+
}
|
|
217
|
+
return this.sorter.sort();
|
|
218
|
+
}
|
|
203
219
|
_persist(event) {
|
|
204
220
|
const _super = Object.create(null, {
|
|
205
221
|
updateEvent: { get: () => super.updateEvent }
|
|
@@ -245,17 +261,8 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
245
261
|
return event;
|
|
246
262
|
});
|
|
247
263
|
}
|
|
248
|
-
getPeople() {
|
|
249
|
-
const people = super.getPeople();
|
|
250
|
-
if (people.length > 0) {
|
|
251
|
-
this.sorter.setPeople(people !== null && people !== void 0 ? people : []);
|
|
252
|
-
return this.sorter.sort();
|
|
253
|
-
}
|
|
254
|
-
return people;
|
|
255
|
-
}
|
|
256
264
|
render() {
|
|
257
265
|
return Object.assign(Object.assign({}, super.render()), { people: this.getPeople() });
|
|
258
266
|
}
|
|
259
267
|
}
|
|
260
|
-
CalendarViewController.shouldDelayStartingAnimationOnSwap = true;
|
|
261
268
|
CalendarViewController.id = 'calendar';
|
|
@@ -21,7 +21,7 @@ export default class PersonSelectToolViewController extends AbstractViewControll
|
|
|
21
21
|
this.cardVc = this.CardVc();
|
|
22
22
|
}
|
|
23
23
|
get visiblePeopleIds() {
|
|
24
|
-
return this.people.
|
|
24
|
+
return this.people.getVisiblePeopleIds();
|
|
25
25
|
}
|
|
26
26
|
get loggedInPersonId() {
|
|
27
27
|
var _a;
|
|
@@ -57,13 +57,13 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
57
57
|
getCalendarSelectVc(): import("../viewControllers/CalendarSelectTool.vc").default | undefined;
|
|
58
58
|
getCalendarVc(): CalendarViewController;
|
|
59
59
|
load(options: SkillViewControllerLoadOptions<RootArgs>): Promise<void>;
|
|
60
|
-
private
|
|
60
|
+
private setupCalendarEventListeners;
|
|
61
61
|
private handleDidCancelEvent;
|
|
62
62
|
private handleDidCreateOrUpdate;
|
|
63
63
|
private loadEventStore;
|
|
64
64
|
private loadPeople;
|
|
65
65
|
private loadScope;
|
|
66
|
-
|
|
66
|
+
protected syncPeopleOnCalendar(): void;
|
|
67
67
|
private syncOffsetWithLocale;
|
|
68
68
|
private loadEvents;
|
|
69
69
|
private _loadEvents;
|
|
@@ -195,6 +195,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
195
195
|
await this.transitionPromise;
|
|
196
196
|
await this.events.reset();
|
|
197
197
|
this.makeDateSelectMatchSelectedDateFromCalendar();
|
|
198
|
+
this.syncPeopleOnCalendar();
|
|
198
199
|
}
|
|
199
200
|
ToolBeltVc() {
|
|
200
201
|
return this.Controller('toolBelt', {
|
|
@@ -254,7 +255,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
254
255
|
this.client = await this.connectToApi();
|
|
255
256
|
const { scope, locale, args, router } = options;
|
|
256
257
|
await Promise.all([
|
|
257
|
-
this.
|
|
258
|
+
this.setupCalendarEventListeners(),
|
|
258
259
|
locale.on('did-change-timezones', () => {
|
|
259
260
|
return this.syncOffsetWithLocale(locale);
|
|
260
261
|
}),
|
|
@@ -283,7 +284,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
283
284
|
}
|
|
284
285
|
await this.waitUntilDoneSaving();
|
|
285
286
|
}
|
|
286
|
-
async
|
|
287
|
+
async setupCalendarEventListeners() {
|
|
287
288
|
await Promise.all([
|
|
288
289
|
this.client.on('calendar.did-create-calendar-event::v2021_05_19', this.handleDidCreateOrUpdate.bind(this)),
|
|
289
290
|
this.client.on('calendar.did-update-calendar-event::v2021_05_19', this.handleDidCreateOrUpdate.bind(this)),
|
|
@@ -25,7 +25,7 @@ export default class CalendarPeopleManager extends AbstractEventEmitter<PeopleCo
|
|
|
25
25
|
private teammateById;
|
|
26
26
|
getTeam(): import("@sprucelabs/mercury-types").SpruceSchemas.Spruce.v2020_07_22.Person[];
|
|
27
27
|
getLoggedInPerson(): import("@sprucelabs/mercury-types").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson | undefined;
|
|
28
|
-
|
|
28
|
+
getVisiblePeopleIds(): string[];
|
|
29
29
|
private getSavedVisiblePeopleIds;
|
|
30
30
|
getVisibilityMode(): PersonMode;
|
|
31
31
|
setVisibilityMode(mode: PersonMode): Promise<void>;
|
|
@@ -24,7 +24,7 @@ class CalendarPeopleManager extends mercury_event_emitter_1.AbstractEventEmitter
|
|
|
24
24
|
this.organizationId = organizationId;
|
|
25
25
|
this.locationId = locationId;
|
|
26
26
|
await this.loadTeam();
|
|
27
|
-
if (this.
|
|
27
|
+
if (this.getVisiblePeopleIds().length === 0 && this.loggedInPerson) {
|
|
28
28
|
await this.setVisiblePeopleIds([this.loggedInPerson.id]);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -41,7 +41,7 @@ class CalendarPeopleManager extends mercury_event_emitter_1.AbstractEventEmitter
|
|
|
41
41
|
this.team = people;
|
|
42
42
|
}
|
|
43
43
|
getVisiblePeople() {
|
|
44
|
-
|
|
44
|
+
const people = this.getVisiblePeopleIds()
|
|
45
45
|
.map((i) => {
|
|
46
46
|
try {
|
|
47
47
|
return this.teammateById(i);
|
|
@@ -51,6 +51,7 @@ class CalendarPeopleManager extends mercury_event_emitter_1.AbstractEventEmitter
|
|
|
51
51
|
return null;
|
|
52
52
|
})
|
|
53
53
|
.filter((t) => !!t);
|
|
54
|
+
return people;
|
|
54
55
|
}
|
|
55
56
|
teammateById(id) {
|
|
56
57
|
var _a;
|
|
@@ -13,7 +13,6 @@ export interface CalendarViewControllerOptions {
|
|
|
13
13
|
onDeselectEvent?: DeselectEventHandler;
|
|
14
14
|
}
|
|
15
15
|
export default class CalendarViewController extends CoreCalendarViewController {
|
|
16
|
-
static shouldDelayStartingAnimationOnSwap: boolean;
|
|
17
16
|
static id: string;
|
|
18
17
|
private remoteEventStore?;
|
|
19
18
|
private draftAddedHandler;
|
|
@@ -43,8 +42,8 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
43
42
|
}): any;
|
|
44
43
|
private persist;
|
|
45
44
|
waitForPendingSaves(): Promise<void>;
|
|
46
|
-
private _persist;
|
|
47
45
|
getPeople(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson[];
|
|
46
|
+
private _persist;
|
|
48
47
|
render(): {
|
|
49
48
|
people: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson[];
|
|
50
49
|
controller?: import("@sprucelabs/heartwood-view-controllers").ViewController<SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Calendar> | null | undefined;
|
|
@@ -136,7 +136,6 @@ class CalendarViewController extends heartwood_view_controllers_1.CalendarViewCo
|
|
|
136
136
|
super.updateEvent(to.id, { isBusy: false });
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
this.disableAnimations();
|
|
140
139
|
this.isSwapping = true;
|
|
141
140
|
try {
|
|
142
141
|
await this.renderOnce(async () => {
|
|
@@ -152,10 +151,6 @@ class CalendarViewController extends heartwood_view_controllers_1.CalendarViewCo
|
|
|
152
151
|
}
|
|
153
152
|
catch (_a) { }
|
|
154
153
|
this.isSwapping = false;
|
|
155
|
-
if (CalendarViewController.shouldDelayStartingAnimationOnSwap) {
|
|
156
|
-
await new Promise((r) => setTimeout(r, 100));
|
|
157
|
-
}
|
|
158
|
-
this.enableAnimation();
|
|
159
154
|
}
|
|
160
155
|
updateEvent(id, updates) {
|
|
161
156
|
const { shouldPersist = true } = updates, rest = __rest(updates, ["shouldPersist"]);
|
|
@@ -177,6 +172,27 @@ class CalendarViewController extends heartwood_view_controllers_1.CalendarViewCo
|
|
|
177
172
|
async waitForPendingSaves() {
|
|
178
173
|
await this.persistPromise;
|
|
179
174
|
}
|
|
175
|
+
getPeople() {
|
|
176
|
+
const people = super.getPeople();
|
|
177
|
+
this.sorter.setPeople(people !== null && people !== void 0 ? people : []);
|
|
178
|
+
this.sorter.setEvents(this.getEvents().map((e) => {
|
|
179
|
+
var _a;
|
|
180
|
+
return ({
|
|
181
|
+
id: e.id,
|
|
182
|
+
groupId: (_a = e.groupId) !== null && _a !== void 0 ? _a : undefined,
|
|
183
|
+
personId: e.target.personId,
|
|
184
|
+
startDateTimeMs: e.startDateTimeMs,
|
|
185
|
+
});
|
|
186
|
+
}));
|
|
187
|
+
const selectedEvent = this.getSelectedEvent();
|
|
188
|
+
if (selectedEvent && !draftGenerator_1.default.isDraftId(selectedEvent.id)) {
|
|
189
|
+
this.sorter.setSelectedEvents([selectedEvent.id]);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
this.sorter.setSelectedEvents([]);
|
|
193
|
+
}
|
|
194
|
+
return this.sorter.sort();
|
|
195
|
+
}
|
|
180
196
|
async _persist(event) {
|
|
181
197
|
var _a, _b;
|
|
182
198
|
let updated = event;
|
|
@@ -217,18 +233,9 @@ class CalendarViewController extends heartwood_view_controllers_1.CalendarViewCo
|
|
|
217
233
|
}
|
|
218
234
|
return event;
|
|
219
235
|
}
|
|
220
|
-
getPeople() {
|
|
221
|
-
const people = super.getPeople();
|
|
222
|
-
if (people.length > 0) {
|
|
223
|
-
this.sorter.setPeople(people !== null && people !== void 0 ? people : []);
|
|
224
|
-
return this.sorter.sort();
|
|
225
|
-
}
|
|
226
|
-
return people;
|
|
227
|
-
}
|
|
228
236
|
render() {
|
|
229
237
|
return Object.assign(Object.assign({}, super.render()), { people: this.getPeople() });
|
|
230
238
|
}
|
|
231
239
|
}
|
|
232
240
|
exports.default = CalendarViewController;
|
|
233
|
-
CalendarViewController.shouldDelayStartingAnimationOnSwap = true;
|
|
234
241
|
CalendarViewController.id = 'calendar';
|
|
@@ -14,7 +14,7 @@ class PersonSelectToolViewController extends heartwood_view_controllers_1.Abstra
|
|
|
14
14
|
this.cardVc = this.CardVc();
|
|
15
15
|
}
|
|
16
16
|
get visiblePeopleIds() {
|
|
17
|
-
return this.people.
|
|
17
|
+
return this.people.getVisiblePeopleIds();
|
|
18
18
|
}
|
|
19
19
|
get loggedInPersonId() {
|
|
20
20
|
var _a;
|