@sprucelabs/spruce-calendar-components 20.5.3 → 20.5.6
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.
|
@@ -35,6 +35,52 @@ export default class EventDateTimeToolViewController extends AbstractViewControl
|
|
|
35
35
|
}
|
|
36
36
|
handleSelectDateFromCalendar({ dateTimeMs, }) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
let shouldBail = false;
|
|
39
|
+
const formattedDestination = dateUtil.format(dateTimeMs, 'MMM do');
|
|
40
|
+
const dlg = this.renderInDialog({
|
|
41
|
+
shouldShowCloseButton: false,
|
|
42
|
+
header: {
|
|
43
|
+
title: 'Which would you like to do?',
|
|
44
|
+
},
|
|
45
|
+
body: {
|
|
46
|
+
sections: [
|
|
47
|
+
{
|
|
48
|
+
buttons: [
|
|
49
|
+
{
|
|
50
|
+
id: 'move',
|
|
51
|
+
label: `Move this event to ${formattedDestination}.`,
|
|
52
|
+
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
yield dlg.hide();
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'navigate',
|
|
58
|
+
label: `Deselect event and navigate to ${formattedDestination}.`,
|
|
59
|
+
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
shouldBail = true;
|
|
61
|
+
const { calendarVc } = this.getContext();
|
|
62
|
+
calendarVc.setStartDate(dateTimeMs);
|
|
63
|
+
calendarVc.deselectEvent();
|
|
64
|
+
yield dlg.hide();
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 'cancel',
|
|
69
|
+
label: 'Nevermind',
|
|
70
|
+
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
shouldBail = true;
|
|
72
|
+
yield dlg.hide();
|
|
73
|
+
}),
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
yield dlg.wait();
|
|
81
|
+
if (shouldBail) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
38
84
|
const { hour, minute } = dateUtil.splitDate(this.getContext().event.startDateTimeMs);
|
|
39
85
|
yield this.formVc.setValue('startDateTime', dateUtil.setTimeOfDay(dateTimeMs, hour, minute, 0, 0));
|
|
40
86
|
this.calendarVc.setSelectedDates([this.getSelectedDate(dateTimeMs)]);
|
|
@@ -27,6 +27,52 @@ class EventDateTimeToolViewController extends heartwood_view_controllers_1.Abstr
|
|
|
27
27
|
this.cardVc = this.CardVc();
|
|
28
28
|
}
|
|
29
29
|
async handleSelectDateFromCalendar({ dateTimeMs, }) {
|
|
30
|
+
let shouldBail = false;
|
|
31
|
+
const formattedDestination = calendar_utils_1.dateUtil.format(dateTimeMs, 'MMM do');
|
|
32
|
+
const dlg = this.renderInDialog({
|
|
33
|
+
shouldShowCloseButton: false,
|
|
34
|
+
header: {
|
|
35
|
+
title: 'Which would you like to do?',
|
|
36
|
+
},
|
|
37
|
+
body: {
|
|
38
|
+
sections: [
|
|
39
|
+
{
|
|
40
|
+
buttons: [
|
|
41
|
+
{
|
|
42
|
+
id: 'move',
|
|
43
|
+
label: `Move this event to ${formattedDestination}.`,
|
|
44
|
+
onClick: async () => {
|
|
45
|
+
await dlg.hide();
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'navigate',
|
|
50
|
+
label: `Deselect event and navigate to ${formattedDestination}.`,
|
|
51
|
+
onClick: async () => {
|
|
52
|
+
shouldBail = true;
|
|
53
|
+
const { calendarVc } = this.getContext();
|
|
54
|
+
calendarVc.setStartDate(dateTimeMs);
|
|
55
|
+
calendarVc.deselectEvent();
|
|
56
|
+
await dlg.hide();
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'cancel',
|
|
61
|
+
label: 'Nevermind',
|
|
62
|
+
onClick: async () => {
|
|
63
|
+
shouldBail = true;
|
|
64
|
+
await dlg.hide();
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
await dlg.wait();
|
|
73
|
+
if (shouldBail) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
30
76
|
const { hour, minute } = calendar_utils_1.dateUtil.splitDate(this.getContext().event.startDateTimeMs);
|
|
31
77
|
await this.formVc.setValue('startDateTime', calendar_utils_1.dateUtil.setTimeOfDay(dateTimeMs, hour, minute, 0, 0));
|
|
32
78
|
this.calendarVc.setSelectedDates([this.getSelectedDate(dateTimeMs)]);
|