@sprucelabs/spruce-calendar-components 23.0.1 → 23.0.2
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/calendar/CalendarPeopleManager.d.ts +1 -1
- package/build/esm/calendar/CalendarPeopleManager.d.ts +1 -1
- package/build/esm/skillViewControllers/Root.svc.d.ts +1 -0
- package/build/esm/skillViewControllers/Root.svc.js +7 -3
- package/build/esm/toolBelt/states/RootToolBeltState.d.ts +3 -0
- package/build/esm/toolBelt/states/RootToolBeltState.js +7 -3
- package/build/esm/tools/EventDateTimeTool.vc.js +3 -4
- package/build/skillViewControllers/Root.svc.d.ts +1 -0
- package/build/skillViewControllers/Root.svc.js +7 -3
- package/build/toolBelt/states/RootToolBeltState.d.ts +3 -0
- package/build/toolBelt/states/RootToolBeltState.js +7 -3
- package/build/tools/EventDateTimeTool.vc.js +3 -4
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ export default class CalendarPeopleManager extends AbstractEventEmitter<PeopleCo
|
|
|
35
35
|
private getWorkingPeople;
|
|
36
36
|
setVisiblePeopleIds(visible: string[], options?: SetVisiblePeolpeOptions): Promise<void>;
|
|
37
37
|
setPersonVisibility(id: string, shouldBeVisible: boolean): Promise<void>;
|
|
38
|
-
|
|
38
|
+
emitDidUpdate(): Promise<void>;
|
|
39
39
|
}
|
|
40
40
|
export interface PeopleManagerOptions {
|
|
41
41
|
connectToApi: () => Promise<MercuryClient>;
|
|
@@ -35,7 +35,7 @@ export default class CalendarPeopleManager extends AbstractEventEmitter<PeopleCo
|
|
|
35
35
|
private getWorkingPeople;
|
|
36
36
|
setVisiblePeopleIds(visible: string[], options?: SetVisiblePeolpeOptions): Promise<void>;
|
|
37
37
|
setPersonVisibility(id: string, shouldBeVisible: boolean): Promise<void>;
|
|
38
|
-
|
|
38
|
+
emitDidUpdate(): Promise<void>;
|
|
39
39
|
}
|
|
40
40
|
export interface PeopleManagerOptions {
|
|
41
41
|
connectToApi: () => Promise<MercuryClient>;
|
|
@@ -70,6 +70,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
70
70
|
protected transitionToRoot(): Promise<void>;
|
|
71
71
|
private loadLoggedInPerson;
|
|
72
72
|
private getVisibleEvents;
|
|
73
|
+
private get rootToolBeltState();
|
|
73
74
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.SkillView;
|
|
74
75
|
}
|
|
75
76
|
export type CalendarPerson = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson;
|
|
@@ -54,6 +54,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
54
54
|
root: new RootToolBeltState({
|
|
55
55
|
people: this.people,
|
|
56
56
|
events: this.events,
|
|
57
|
+
dates: this.dates,
|
|
57
58
|
}),
|
|
58
59
|
prerequisites: new PrerequisitesToolBeltState({
|
|
59
60
|
onSelectCalendar: this.handleSelectCalendar.bind(this),
|
|
@@ -205,7 +206,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
205
206
|
}
|
|
206
207
|
setSelectedDateInDateSelectVc(date) {
|
|
207
208
|
const { year, month, day } = this.dates.splitDate(date);
|
|
208
|
-
this.
|
|
209
|
+
this.rootToolBeltState.setSelectedDate(year, month, day);
|
|
209
210
|
}
|
|
210
211
|
getStartDate() {
|
|
211
212
|
var _a;
|
|
@@ -322,7 +323,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
322
323
|
yield this.transitionToRoot();
|
|
323
324
|
this.setSelectedDateInDateSelectVc(startDate);
|
|
324
325
|
if (visiblePeopleIds) {
|
|
325
|
-
yield this.
|
|
326
|
+
yield this.people.setVisibilityMode('custom');
|
|
326
327
|
yield this.people.setVisiblePeopleIds(visiblePeopleIds);
|
|
327
328
|
}
|
|
328
329
|
yield this.waitUntilDoneSaving();
|
|
@@ -413,7 +414,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
413
414
|
const startDate = this.dates.getStartOfDay(date);
|
|
414
415
|
const endDate = this.dates.getEndOfDay(date);
|
|
415
416
|
yield this.events.loadEvents(startDate, endDate, this.people.getTeam().map((t) => t.id));
|
|
416
|
-
yield this.people.
|
|
417
|
+
yield this.people.emitDidUpdate();
|
|
417
418
|
}
|
|
418
419
|
}
|
|
419
420
|
catch (err) {
|
|
@@ -443,6 +444,9 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
443
444
|
.filter((e) => e.startDateTimeMs <= end && e.startDateTimeMs >= start);
|
|
444
445
|
return events;
|
|
445
446
|
}
|
|
447
|
+
get rootToolBeltState() {
|
|
448
|
+
return this.toolBeltStates.root;
|
|
449
|
+
}
|
|
446
450
|
render() {
|
|
447
451
|
return {
|
|
448
452
|
isFullScreen: true,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DateUtil } from '@sprucelabs/calendar-utils';
|
|
1
2
|
import { SpruceSchemas, ToolBeltState } from '@sprucelabs/heartwood-view-controllers';
|
|
2
3
|
import CalendarEventManager from '../../calendar/CalendarEventManager';
|
|
3
4
|
import CalendarPeopleManager from '../../calendar/CalendarPeopleManager';
|
|
@@ -16,9 +17,11 @@ export declare class RootToolBeltState implements ToolBeltState {
|
|
|
16
17
|
private lastSelectedDate?;
|
|
17
18
|
private people;
|
|
18
19
|
private events;
|
|
20
|
+
private dates;
|
|
19
21
|
constructor(options: {
|
|
20
22
|
people: CalendarPeopleManager;
|
|
21
23
|
events: CalendarEventManager;
|
|
24
|
+
dates: DateUtil;
|
|
22
25
|
});
|
|
23
26
|
getCalendarSelectCardVc(): CalendarSelectCardViewController | undefined;
|
|
24
27
|
private CalendarSelectVc;
|
|
@@ -7,14 +7,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { dateUtil } from '@sprucelabs/calendar-utils';
|
|
11
10
|
import { assertOptions } from '@sprucelabs/schema';
|
|
12
11
|
export class RootToolBeltState {
|
|
13
12
|
constructor(options) {
|
|
14
13
|
this.id = 'root';
|
|
15
|
-
const { people, events } = assertOptions(options, [
|
|
14
|
+
const { people, events, dates } = assertOptions(options, [
|
|
15
|
+
'people',
|
|
16
|
+
'events',
|
|
17
|
+
'dates',
|
|
18
|
+
]);
|
|
16
19
|
this.people = people;
|
|
17
20
|
this.events = events;
|
|
21
|
+
this.dates = dates;
|
|
18
22
|
}
|
|
19
23
|
getCalendarSelectCardVc() {
|
|
20
24
|
return this.calendarSelectCardVc;
|
|
@@ -32,7 +36,7 @@ export class RootToolBeltState {
|
|
|
32
36
|
this.resetToolBelt();
|
|
33
37
|
this.dateSelectVc = this.sm.Controller('calendar.date-select-card', {
|
|
34
38
|
onSelectDate: (date) => this.handleSelectDate(date),
|
|
35
|
-
startDate:
|
|
39
|
+
startDate: this.dates.getStartOfDay(),
|
|
36
40
|
selectedDate: this.lastSelectedDate,
|
|
37
41
|
});
|
|
38
42
|
this.toolBeltVc.addTool({
|
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { dateUtil } from '@sprucelabs/calendar-utils';
|
|
11
10
|
import { AbstractViewController, buildForm, } from '@sprucelabs/heartwood-view-controllers';
|
|
12
11
|
import { buildSchema } from '@sprucelabs/schema';
|
|
13
12
|
export default class EventDateTimeToolViewController extends AbstractViewController {
|
|
@@ -30,15 +29,15 @@ export default class EventDateTimeToolViewController extends AbstractViewControl
|
|
|
30
29
|
if (shouldBail) {
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
|
-
const { hour, minute } =
|
|
34
|
-
yield this.formVc.setValue('startDateTime',
|
|
32
|
+
const { hour, minute } = this.dates.splitDate(this.getContext().event.startDateTimeMs);
|
|
33
|
+
yield this.formVc.setValue('startDateTime', this.dates.setTimeOfDay(dateTimeMs, hour, minute, 0, 0));
|
|
35
34
|
this.calendarVc.setSelectedDates([this.getSelectedDate(dateTimeMs)]);
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
37
|
promptForNavigationPreference(dateTimeMs) {
|
|
39
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
39
|
let shouldBail = false;
|
|
41
|
-
const formattedDestination =
|
|
40
|
+
const formattedDestination = this.dates.format(dateTimeMs, 'MMM do');
|
|
42
41
|
const dlg = this.renderInDialog({
|
|
43
42
|
shouldShowCloseButton: false,
|
|
44
43
|
header: {
|
|
@@ -70,6 +70,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
70
70
|
protected transitionToRoot(): Promise<void>;
|
|
71
71
|
private loadLoggedInPerson;
|
|
72
72
|
private getVisibleEvents;
|
|
73
|
+
private get rootToolBeltState();
|
|
73
74
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.SkillView;
|
|
74
75
|
}
|
|
75
76
|
export type CalendarPerson = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson;
|
|
@@ -50,6 +50,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
50
50
|
root: new RootToolBeltState_1.RootToolBeltState({
|
|
51
51
|
people: this.people,
|
|
52
52
|
events: this.events,
|
|
53
|
+
dates: this.dates,
|
|
53
54
|
}),
|
|
54
55
|
prerequisites: new PrerequisitesToolBeltState_1.PrerequisitesToolBeltState({
|
|
55
56
|
onSelectCalendar: this.handleSelectCalendar.bind(this),
|
|
@@ -181,7 +182,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
181
182
|
}
|
|
182
183
|
setSelectedDateInDateSelectVc(date) {
|
|
183
184
|
const { year, month, day } = this.dates.splitDate(date);
|
|
184
|
-
this.
|
|
185
|
+
this.rootToolBeltState.setSelectedDate(year, month, day);
|
|
185
186
|
}
|
|
186
187
|
getStartDate() {
|
|
187
188
|
var _a;
|
|
@@ -283,7 +284,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
283
284
|
await this.transitionToRoot();
|
|
284
285
|
this.setSelectedDateInDateSelectVc(startDate);
|
|
285
286
|
if (visiblePeopleIds) {
|
|
286
|
-
await this.
|
|
287
|
+
await this.people.setVisibilityMode('custom');
|
|
287
288
|
await this.people.setVisiblePeopleIds(visiblePeopleIds);
|
|
288
289
|
}
|
|
289
290
|
await this.waitUntilDoneSaving();
|
|
@@ -358,7 +359,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
358
359
|
const startDate = this.dates.getStartOfDay(date);
|
|
359
360
|
const endDate = this.dates.getEndOfDay(date);
|
|
360
361
|
await this.events.loadEvents(startDate, endDate, this.people.getTeam().map((t) => t.id));
|
|
361
|
-
await this.people.
|
|
362
|
+
await this.people.emitDidUpdate();
|
|
362
363
|
}
|
|
363
364
|
}
|
|
364
365
|
catch (err) {
|
|
@@ -383,6 +384,9 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
383
384
|
.filter((e) => e.startDateTimeMs <= end && e.startDateTimeMs >= start);
|
|
384
385
|
return events;
|
|
385
386
|
}
|
|
387
|
+
get rootToolBeltState() {
|
|
388
|
+
return this.toolBeltStates.root;
|
|
389
|
+
}
|
|
386
390
|
render() {
|
|
387
391
|
return {
|
|
388
392
|
isFullScreen: true,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DateUtil } from '@sprucelabs/calendar-utils';
|
|
1
2
|
import { SpruceSchemas, ToolBeltState } from '@sprucelabs/heartwood-view-controllers';
|
|
2
3
|
import CalendarEventManager from '../../calendar/CalendarEventManager';
|
|
3
4
|
import CalendarPeopleManager from '../../calendar/CalendarPeopleManager';
|
|
@@ -16,9 +17,11 @@ export declare class RootToolBeltState implements ToolBeltState {
|
|
|
16
17
|
private lastSelectedDate?;
|
|
17
18
|
private people;
|
|
18
19
|
private events;
|
|
20
|
+
private dates;
|
|
19
21
|
constructor(options: {
|
|
20
22
|
people: CalendarPeopleManager;
|
|
21
23
|
events: CalendarEventManager;
|
|
24
|
+
dates: DateUtil;
|
|
22
25
|
});
|
|
23
26
|
getCalendarSelectCardVc(): CalendarSelectCardViewController | undefined;
|
|
24
27
|
private CalendarSelectVc;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RootToolBeltState = void 0;
|
|
4
|
-
const calendar_utils_1 = require("@sprucelabs/calendar-utils");
|
|
5
4
|
const schema_1 = require("@sprucelabs/schema");
|
|
6
5
|
class RootToolBeltState {
|
|
7
6
|
constructor(options) {
|
|
8
7
|
this.id = 'root';
|
|
9
|
-
const { people, events } = (0, schema_1.assertOptions)(options, [
|
|
8
|
+
const { people, events, dates } = (0, schema_1.assertOptions)(options, [
|
|
9
|
+
'people',
|
|
10
|
+
'events',
|
|
11
|
+
'dates',
|
|
12
|
+
]);
|
|
10
13
|
this.people = people;
|
|
11
14
|
this.events = events;
|
|
15
|
+
this.dates = dates;
|
|
12
16
|
}
|
|
13
17
|
getCalendarSelectCardVc() {
|
|
14
18
|
return this.calendarSelectCardVc;
|
|
@@ -25,7 +29,7 @@ class RootToolBeltState {
|
|
|
25
29
|
this.resetToolBelt();
|
|
26
30
|
this.dateSelectVc = this.sm.Controller('calendar.date-select-card', {
|
|
27
31
|
onSelectDate: (date) => this.handleSelectDate(date),
|
|
28
|
-
startDate:
|
|
32
|
+
startDate: this.dates.getStartOfDay(),
|
|
29
33
|
selectedDate: this.lastSelectedDate,
|
|
30
34
|
});
|
|
31
35
|
this.toolBeltVc.addTool({
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const calendar_utils_1 = require("@sprucelabs/calendar-utils");
|
|
4
3
|
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
|
5
4
|
const schema_1 = require("@sprucelabs/schema");
|
|
6
5
|
class EventDateTimeToolViewController extends heartwood_view_controllers_1.AbstractViewController {
|
|
@@ -22,13 +21,13 @@ class EventDateTimeToolViewController extends heartwood_view_controllers_1.Abstr
|
|
|
22
21
|
if (shouldBail) {
|
|
23
22
|
return;
|
|
24
23
|
}
|
|
25
|
-
const { hour, minute } =
|
|
26
|
-
await this.formVc.setValue('startDateTime',
|
|
24
|
+
const { hour, minute } = this.dates.splitDate(this.getContext().event.startDateTimeMs);
|
|
25
|
+
await this.formVc.setValue('startDateTime', this.dates.setTimeOfDay(dateTimeMs, hour, minute, 0, 0));
|
|
27
26
|
this.calendarVc.setSelectedDates([this.getSelectedDate(dateTimeMs)]);
|
|
28
27
|
}
|
|
29
28
|
async promptForNavigationPreference(dateTimeMs) {
|
|
30
29
|
let shouldBail = false;
|
|
31
|
-
const formattedDestination =
|
|
30
|
+
const formattedDestination = this.dates.format(dateTimeMs, 'MMM do');
|
|
32
31
|
const dlg = this.renderInDialog({
|
|
33
32
|
shouldShowCloseButton: false,
|
|
34
33
|
header: {
|