@sprucelabs/spruce-calendar-components 22.3.4 → 22.3.7
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 +342 -342
- package/build/esm/.spruce/schemas/schemas.types.d.ts +342 -342
- package/build/esm/toolBelt/states/AbstractCalendarEventToolBeltState.d.ts +2 -2
- package/build/esm/toolBelt/states/AbstractCalendarEventToolBeltState.js +13 -7
- package/build/toolBelt/states/AbstractCalendarEventToolBeltState.d.ts +2 -2
- package/build/toolBelt/states/AbstractCalendarEventToolBeltState.js +13 -7
- package/package.json +1 -1
|
@@ -15,10 +15,10 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
|
|
|
15
15
|
private _isLoaded;
|
|
16
16
|
load(sm: CalendarToolBeltStateMachine): Promise<void>;
|
|
17
17
|
protected loadRemoteCards(): Promise<void>;
|
|
18
|
-
|
|
18
|
+
protected handleClickSave(): Promise<void>;
|
|
19
19
|
private handleDidUpdateContext;
|
|
20
20
|
private getContext;
|
|
21
|
-
clearPendingContextChanges(): Promise<void>;
|
|
21
|
+
clearPendingContextChanges(shouldEmitDidUpdate?: boolean): Promise<void>;
|
|
22
22
|
addTool(options: AddToolOptions): Promise<CalendarTool>;
|
|
23
23
|
protected buildVcConstructorOptions(id: string): CalendarToolOptions;
|
|
24
24
|
private addVc;
|
|
@@ -44,8 +44,9 @@ export default class AbstractCalendarEventToolBeltState {
|
|
|
44
44
|
}
|
|
45
45
|
handleClickSave() {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
|
|
48
|
-
yield this.clearPendingContextChanges();
|
|
47
|
+
const updates = this.pendingContextUpdates;
|
|
48
|
+
yield this.clearPendingContextChanges(false);
|
|
49
|
+
yield this.sm.updateContext(Object.assign({}, updates));
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
handleDidUpdateContext(skipToolWithId) {
|
|
@@ -61,10 +62,12 @@ export default class AbstractCalendarEventToolBeltState {
|
|
|
61
62
|
getContext() {
|
|
62
63
|
return Object.assign(Object.assign({}, this.sm.getContext()), this.pendingContextUpdates);
|
|
63
64
|
}
|
|
64
|
-
clearPendingContextChanges() {
|
|
65
|
+
clearPendingContextChanges(shouldEmitDidUpdate = true) {
|
|
65
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
67
|
this.pendingContextUpdates = {};
|
|
67
|
-
|
|
68
|
+
if (shouldEmitDidUpdate) {
|
|
69
|
+
yield this.handleDidUpdateContext();
|
|
70
|
+
}
|
|
68
71
|
});
|
|
69
72
|
}
|
|
70
73
|
addTool(options) {
|
|
@@ -129,12 +132,15 @@ export default class AbstractCalendarEventToolBeltState {
|
|
|
129
132
|
return false;
|
|
130
133
|
}
|
|
131
134
|
this.pendingContextUpdates = pendingUpdates;
|
|
132
|
-
yield this.handleDidUpdateContext(fromToolId);
|
|
133
135
|
const vc = this.getVcForTool(fromToolId);
|
|
134
|
-
|
|
135
|
-
(options === null || options === void 0 ? void 0 : options.shouldPersistContextChangesImmediately)
|
|
136
|
+
const shouldPersistChanges = (vc === null || vc === void 0 ? void 0 : vc.shouldPersistContextChangesImmediately) ||
|
|
137
|
+
(options === null || options === void 0 ? void 0 : options.shouldPersistContextChangesImmediately);
|
|
138
|
+
if (shouldPersistChanges) {
|
|
136
139
|
return this.sm.updateContext(Object.assign({}, updates));
|
|
137
140
|
}
|
|
141
|
+
else {
|
|
142
|
+
yield this.handleDidUpdateContext(fromToolId);
|
|
143
|
+
}
|
|
138
144
|
return false;
|
|
139
145
|
});
|
|
140
146
|
}
|
|
@@ -15,10 +15,10 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
|
|
|
15
15
|
private _isLoaded;
|
|
16
16
|
load(sm: CalendarToolBeltStateMachine): Promise<void>;
|
|
17
17
|
protected loadRemoteCards(): Promise<void>;
|
|
18
|
-
|
|
18
|
+
protected handleClickSave(): Promise<void>;
|
|
19
19
|
private handleDidUpdateContext;
|
|
20
20
|
private getContext;
|
|
21
|
-
clearPendingContextChanges(): Promise<void>;
|
|
21
|
+
clearPendingContextChanges(shouldEmitDidUpdate?: boolean): Promise<void>;
|
|
22
22
|
addTool(options: AddToolOptions): Promise<CalendarTool>;
|
|
23
23
|
protected buildVcConstructorOptions(id: string): CalendarToolOptions;
|
|
24
24
|
private addVc;
|
|
@@ -35,8 +35,9 @@ class AbstractCalendarEventToolBeltState {
|
|
|
35
35
|
await registrar.fetchAndAddCards((id) => this.buildVcConstructorOptions(id));
|
|
36
36
|
}
|
|
37
37
|
async handleClickSave() {
|
|
38
|
-
|
|
39
|
-
await this.clearPendingContextChanges();
|
|
38
|
+
const updates = this.pendingContextUpdates;
|
|
39
|
+
await this.clearPendingContextChanges(false);
|
|
40
|
+
await this.sm.updateContext(Object.assign({}, updates));
|
|
40
41
|
}
|
|
41
42
|
async handleDidUpdateContext(skipToolWithId) {
|
|
42
43
|
await Promise.all(this.vcs.map(async ({ vc, toolId }) => {
|
|
@@ -49,9 +50,11 @@ class AbstractCalendarEventToolBeltState {
|
|
|
49
50
|
getContext() {
|
|
50
51
|
return Object.assign(Object.assign({}, this.sm.getContext()), this.pendingContextUpdates);
|
|
51
52
|
}
|
|
52
|
-
async clearPendingContextChanges() {
|
|
53
|
+
async clearPendingContextChanges(shouldEmitDidUpdate = true) {
|
|
53
54
|
this.pendingContextUpdates = {};
|
|
54
|
-
|
|
55
|
+
if (shouldEmitDidUpdate) {
|
|
56
|
+
await this.handleDidUpdateContext();
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
async addTool(options) {
|
|
57
60
|
(0, schema_1.assertOptions)(options, ['id', 'lineIcon', 'cardVcId']);
|
|
@@ -108,12 +111,15 @@ class AbstractCalendarEventToolBeltState {
|
|
|
108
111
|
return false;
|
|
109
112
|
}
|
|
110
113
|
this.pendingContextUpdates = pendingUpdates;
|
|
111
|
-
await this.handleDidUpdateContext(fromToolId);
|
|
112
114
|
const vc = this.getVcForTool(fromToolId);
|
|
113
|
-
|
|
114
|
-
(options === null || options === void 0 ? void 0 : options.shouldPersistContextChangesImmediately)
|
|
115
|
+
const shouldPersistChanges = (vc === null || vc === void 0 ? void 0 : vc.shouldPersistContextChangesImmediately) ||
|
|
116
|
+
(options === null || options === void 0 ? void 0 : options.shouldPersistContextChangesImmediately);
|
|
117
|
+
if (shouldPersistChanges) {
|
|
115
118
|
return this.sm.updateContext(Object.assign({}, updates));
|
|
116
119
|
}
|
|
120
|
+
else {
|
|
121
|
+
await this.handleDidUpdateContext(fromToolId);
|
|
122
|
+
}
|
|
117
123
|
return false;
|
|
118
124
|
}
|
|
119
125
|
removeTool(id) {
|