@sprucelabs/spruce-calendar-components 24.2.19 → 24.2.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.
@@ -25,6 +25,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
25
25
  protected preferences: RemotePreferencesStore;
26
26
  protected people: CalendarPeopleManager;
27
27
  protected remoteVc: RemoteViewControllerFactory;
28
+ protected draftEvent?: CalendarEvent;
28
29
  constructor(options: ViewControllerOptions);
29
30
  getScope: () => ScopeFlag[];
30
31
  private createToolBeltStates;
@@ -48,6 +49,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
48
49
  private handleDeselectEvent;
49
50
  protected resetToRootState(): Promise<void>;
50
51
  private ToolBeltVc;
52
+ private handleCloseToolBelt;
51
53
  private handleClickEvent;
52
54
  private handleDraftEventAdded;
53
55
  private handleEventSwapped;
@@ -228,18 +228,27 @@ class RootSkillViewController extends AbstractSkillViewController {
228
228
  yield this.events.reset();
229
229
  this.makeDateSelectMatchSelectedDateFromCalendar();
230
230
  this.syncPeopleOnCalendar();
231
+ yield this.calendarVc.deselectEvent();
231
232
  });
232
233
  }
233
234
  ToolBeltVc() {
234
235
  return this.Controller('toolBelt', {
235
- onCloseToolBelt: ({ isDrawer }) => __awaiter(this, void 0, void 0, function* () {
236
- if (!isDrawer) {
237
- yield this.events.deselectEvent();
238
- }
239
- }),
236
+ onCloseToolBelt: this.handleCloseToolBelt.bind(this),
240
237
  shouldRenderAllToolsAtOnce: true,
241
238
  });
242
239
  }
240
+ handleCloseToolBelt({ isDrawer }) {
241
+ return __awaiter(this, void 0, void 0, function* () {
242
+ if (!isDrawer) {
243
+ yield this.resetToRootState();
244
+ if (this.draftEvent) {
245
+ const event = this.draftEvent;
246
+ this.draftEvent = undefined;
247
+ yield this.events.cancelEvent(event.id);
248
+ }
249
+ }
250
+ });
251
+ }
243
252
  handleClickEvent(options) {
244
253
  var _a, _b;
245
254
  return __awaiter(this, void 0, void 0, function* () {
@@ -267,6 +276,7 @@ class RootSkillViewController extends AbstractSkillViewController {
267
276
  handleDraftEventAdded(event) {
268
277
  return __awaiter(this, void 0, void 0, function* () {
269
278
  yield this.events.addDraftEvent(event, !event.eventTypeSlug);
279
+ this.draftEvent = event;
270
280
  if (!event.eventTypeSlug) {
271
281
  this.toolBeltVc.open({ shouldStayOpen: true });
272
282
  yield this.sm.transitionTo(this.toolBeltStates.prerequisites);
@@ -282,7 +292,7 @@ class RootSkillViewController extends AbstractSkillViewController {
282
292
  return __awaiter(this, void 0, void 0, function* () {
283
293
  if (RootSkillViewController.shouldConfirmDrops) {
284
294
  const pass = yield this.confirm({
285
- message: 'Did you mean to do this?',
295
+ title: 'Did you mean to drag and drop this?',
286
296
  });
287
297
  if (!pass) {
288
298
  yield this.client.emit('vote-for-feature::v2020_12_25', {
@@ -25,6 +25,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
25
25
  protected preferences: RemotePreferencesStore;
26
26
  protected people: CalendarPeopleManager;
27
27
  protected remoteVc: RemoteViewControllerFactory;
28
+ protected draftEvent?: CalendarEvent;
28
29
  constructor(options: ViewControllerOptions);
29
30
  getScope: () => ScopeFlag[];
30
31
  private createToolBeltStates;
@@ -48,6 +49,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
48
49
  private handleDeselectEvent;
49
50
  protected resetToRootState(): Promise<void>;
50
51
  private ToolBeltVc;
52
+ private handleCloseToolBelt;
51
53
  private handleClickEvent;
52
54
  private handleDraftEventAdded;
53
55
  private handleEventSwapped;
@@ -201,17 +201,24 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
201
201
  await this.events.reset();
202
202
  this.makeDateSelectMatchSelectedDateFromCalendar();
203
203
  this.syncPeopleOnCalendar();
204
+ await this.calendarVc.deselectEvent();
204
205
  }
205
206
  ToolBeltVc() {
206
207
  return this.Controller('toolBelt', {
207
- onCloseToolBelt: async ({ isDrawer }) => {
208
- if (!isDrawer) {
209
- await this.events.deselectEvent();
210
- }
211
- },
208
+ onCloseToolBelt: this.handleCloseToolBelt.bind(this),
212
209
  shouldRenderAllToolsAtOnce: true,
213
210
  });
214
211
  }
212
+ async handleCloseToolBelt({ isDrawer }) {
213
+ if (!isDrawer) {
214
+ await this.resetToRootState();
215
+ if (this.draftEvent) {
216
+ const event = this.draftEvent;
217
+ this.draftEvent = undefined;
218
+ await this.events.cancelEvent(event.id);
219
+ }
220
+ }
221
+ }
215
222
  async handleClickEvent(options) {
216
223
  var _a, _b;
217
224
  const { event } = options;
@@ -236,6 +243,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
236
243
  }
237
244
  async handleDraftEventAdded(event) {
238
245
  await this.events.addDraftEvent(event, !event.eventTypeSlug);
246
+ this.draftEvent = event;
239
247
  if (!event.eventTypeSlug) {
240
248
  this.toolBeltVc.open({ shouldStayOpen: true });
241
249
  await this.sm.transitionTo(this.toolBeltStates.prerequisites);
@@ -247,7 +255,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
247
255
  async handleDropEvent(id, updates) {
248
256
  if (RootSkillViewController.shouldConfirmDrops) {
249
257
  const pass = await this.confirm({
250
- message: 'Did you mean to do this?',
258
+ title: 'Did you mean to drag and drop this?',
251
259
  });
252
260
  if (!pass) {
253
261
  await this.client.emit('vote-for-feature::v2020_12_25', {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-calendar-components",
3
3
  "description": "Calendar components for working with calendars and Sprucebot.",
4
- "version": "24.2.19",
4
+ "version": "24.2.21",
5
5
  "skill": {
6
6
  "namespace": "calendar"
7
7
  },