@sprucelabs/spruce-calendar-components 25.1.0 → 25.1.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/__tests__/support/utilities/calendarSkillAssert.js +3 -1
- package/build/esm/__tests__/support/utilities/calendarSkillAssert.js +3 -1
- package/build/esm/index-components.d.ts +3 -0
- package/build/esm/tools/EventDurationTool.vc.d.ts +39 -0
- package/build/esm/tools/EventDurationTool.vc.js +137 -0
- package/build/index-components.d.ts +3 -0
- package/build/tools/EventDurationTool.vc.d.ts +39 -0
- package/build/tools/EventDurationTool.vc.js +122 -0
- package/package.json +5 -1
|
@@ -12,6 +12,7 @@ const test_utils_2 = require("@sprucelabs/test-utils");
|
|
|
12
12
|
const Calendar_vc_1 = __importDefault(require("../../../calendar/Calendar.vc"));
|
|
13
13
|
const AbstractCalendarEventToolBeltState_1 = __importDefault(require("../../../toolBelt/states/AbstractCalendarEventToolBeltState"));
|
|
14
14
|
const EventDateTimeTool_vc_1 = __importDefault(require("../../../tools/EventDateTimeTool.vc"));
|
|
15
|
+
const EventDurationTool_vc_1 = __importDefault(require("../../../tools/EventDurationTool.vc"));
|
|
15
16
|
const EventRepeatingTool_vc_1 = __importDefault(require("../../../tools/EventRepeatingTool.vc"));
|
|
16
17
|
const EventTitleTool_vc_1 = __importDefault(require("../../../tools/EventTitleTool.vc"));
|
|
17
18
|
const EventControlsCard_vc_1 = __importDefault(require("../../../viewControllers/EventControlsCard.vc"));
|
|
@@ -30,9 +31,10 @@ class TestTool2 extends heartwood_view_controllers_1.CardViewControllerImpl {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
const vcs = {
|
|
34
|
+
['calendar.calendar']: Calendar_vc_1.default,
|
|
33
35
|
['calendar.repeating-controls-list']: RepeatingControlsList_vc_1.default,
|
|
34
36
|
['calendar.event-repeating-tool']: EventRepeatingTool_vc_1.default,
|
|
35
|
-
['calendar.
|
|
37
|
+
['calendar.event-duration-tool']: EventDurationTool_vc_1.default,
|
|
36
38
|
['calendar.event-date-time-tool']: EventDateTimeTool_vc_1.default,
|
|
37
39
|
['calendar.event-title-tool']: EventTitleTool_vc_1.default,
|
|
38
40
|
['calendar.event-controls-card']: EventControlsCard_vc_1.default,
|
|
@@ -16,6 +16,7 @@ import { generateId } from '@sprucelabs/test-utils';
|
|
|
16
16
|
import CalendarViewController from '../../../calendar/Calendar.vc.js';
|
|
17
17
|
import AbstractCalendarEventToolBeltState from '../../../toolBelt/states/AbstractCalendarEventToolBeltState.js';
|
|
18
18
|
import EventDateTimeToolViewController from '../../../tools/EventDateTimeTool.vc.js';
|
|
19
|
+
import EventDurationToolViewController from '../../../tools/EventDurationTool.vc.js';
|
|
19
20
|
import EventRepeatingToolViewController from '../../../tools/EventRepeatingTool.vc.js';
|
|
20
21
|
import EventTitleToolViewController from '../../../tools/EventTitleTool.vc.js';
|
|
21
22
|
import EventControlsCardViewController from '../../../viewControllers/EventControlsCard.vc.js';
|
|
@@ -36,9 +37,10 @@ class TestTool2 extends CardViewControllerImpl {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
const vcs = {
|
|
40
|
+
['calendar.calendar']: CalendarViewController,
|
|
39
41
|
['calendar.repeating-controls-list']: RepeatingControlsListViewController,
|
|
40
42
|
['calendar.event-repeating-tool']: EventRepeatingToolViewController,
|
|
41
|
-
['calendar.
|
|
43
|
+
['calendar.event-duration-tool']: EventDurationToolViewController,
|
|
42
44
|
['calendar.event-date-time-tool']: EventDateTimeToolViewController,
|
|
43
45
|
['calendar.event-title-tool']: EventTitleToolViewController,
|
|
44
46
|
['calendar.event-controls-card']: EventControlsCardViewController,
|
|
@@ -6,6 +6,7 @@ export { default as calendarToolBeltInteractor } from './__tests__/support/utili
|
|
|
6
6
|
export { default as SpyEventManager } from './__tests__/support/SpyEventManager';
|
|
7
7
|
import CalendarViewController from './calendar/Calendar.vc';
|
|
8
8
|
import EventDateTimeToolViewController from './tools/EventDateTimeTool.vc';
|
|
9
|
+
import EventDurationToolViewController from './tools/EventDurationTool.vc';
|
|
9
10
|
import EventRepeatingToolViewController from './tools/EventRepeatingTool.vc';
|
|
10
11
|
import EventTitleToolViewController from './tools/EventTitleTool.vc';
|
|
11
12
|
import EventControlsCardViewController from './viewControllers/EventControlsCard.vc';
|
|
@@ -38,6 +39,7 @@ declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.typ
|
|
|
38
39
|
'calendar.repeating-controls-list': RepeatingControlsListViewController;
|
|
39
40
|
'calendar.calendar': CalendarViewController;
|
|
40
41
|
'calendar.event-date-time-tool': EventDateTimeToolViewController;
|
|
42
|
+
'calendar.event-duration-tool': EventDurationToolViewController;
|
|
41
43
|
'calendar.event-repeating-tool': EventRepeatingToolViewController;
|
|
42
44
|
'calendar.event-title-tool': EventTitleToolViewController;
|
|
43
45
|
'calendar.event-controls-card': EventControlsCardViewController;
|
|
@@ -46,6 +48,7 @@ declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.typ
|
|
|
46
48
|
'calendar.repeating-controls-list': ConstructorParameters<typeof RepeatingControlsListViewController>[0];
|
|
47
49
|
'calendar.calendar': ConstructorParameters<typeof CalendarViewController>[0];
|
|
48
50
|
'calendar.event-date-time-tool': ConstructorParameters<typeof EventDateTimeToolViewController>[0];
|
|
51
|
+
'calendar.event-duration-tool': ConstructorParameters<typeof EventDurationToolViewController>[0];
|
|
49
52
|
'calendar.event-repeating-tool': ConstructorParameters<typeof EventRepeatingToolViewController>[0];
|
|
50
53
|
'calendar.event-title-tool': ConstructorParameters<typeof EventTitleToolViewController>[0];
|
|
51
54
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AbstractViewController, Card, FormViewController, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import { CalendarTool, CalendarToolOptions } from '../types/calendar.types';
|
|
3
|
+
export default class EventDurationToolViewController extends AbstractViewController<Card> implements CalendarTool {
|
|
4
|
+
static id: string;
|
|
5
|
+
shouldPersistContextChangesImmediately?: boolean | undefined;
|
|
6
|
+
private cardVc;
|
|
7
|
+
protected formVc: EventDurationFormVc;
|
|
8
|
+
private getContextHandler;
|
|
9
|
+
private updateContextHandler;
|
|
10
|
+
constructor(options: ViewControllerOptions & CalendarToolOptions);
|
|
11
|
+
private CardVc;
|
|
12
|
+
private FormVc;
|
|
13
|
+
private handleChangeForm;
|
|
14
|
+
private getDurationMsFromEvent;
|
|
15
|
+
handleUpdateContext(): Promise<void>;
|
|
16
|
+
private setFormToMatchContext;
|
|
17
|
+
private get event();
|
|
18
|
+
private get context();
|
|
19
|
+
load(): Promise<void>;
|
|
20
|
+
render(): import("@sprucelabs/heartwood-view-controllers").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
21
|
+
}
|
|
22
|
+
declare const eventDurationFormSchema: {
|
|
23
|
+
id: string;
|
|
24
|
+
fields: {
|
|
25
|
+
durationMs: {
|
|
26
|
+
type: "select";
|
|
27
|
+
isRequired: true;
|
|
28
|
+
options: {
|
|
29
|
+
choices: {
|
|
30
|
+
label: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
type EventDurationFormSchema = typeof eventDurationFormSchema;
|
|
38
|
+
export type EventDurationFormVc = FormViewController<EventDurationFormSchema>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { AbstractViewController, buildForm, } from '@sprucelabs/heartwood-view-controllers';
|
|
11
|
+
import { buildSchema } from '@sprucelabs/schema';
|
|
12
|
+
class EventDurationToolViewController extends AbstractViewController {
|
|
13
|
+
constructor(options) {
|
|
14
|
+
super(options);
|
|
15
|
+
this.shouldPersistContextChangesImmediately = false;
|
|
16
|
+
const { getContext, updateContext } = options;
|
|
17
|
+
this.getContextHandler = getContext;
|
|
18
|
+
this.updateContextHandler = updateContext;
|
|
19
|
+
this.formVc = this.FormVc();
|
|
20
|
+
this.cardVc = this.CardVc();
|
|
21
|
+
}
|
|
22
|
+
CardVc() {
|
|
23
|
+
return this.Controller('card', {
|
|
24
|
+
body: {
|
|
25
|
+
sections: [
|
|
26
|
+
{
|
|
27
|
+
form: this.formVc.render(),
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
FormVc() {
|
|
34
|
+
return this.Controller('form', buildForm({
|
|
35
|
+
values: { durationMs: this.getDurationMsFromEvent() },
|
|
36
|
+
onChange: this.handleChangeForm.bind(this),
|
|
37
|
+
sections: [
|
|
38
|
+
{
|
|
39
|
+
fields: [
|
|
40
|
+
{
|
|
41
|
+
name: 'durationMs',
|
|
42
|
+
renderAs: 'tags',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
schema: eventDurationFormSchema,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
handleChangeForm() {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const durationMs = this.formVc.getValue('durationMs');
|
|
53
|
+
const duration = parseInt(durationMs, 10) / 1000 / 60;
|
|
54
|
+
const timeBlocks = this.event.timeBlocks.map((tb) => (Object.assign({}, tb)));
|
|
55
|
+
timeBlocks[0].durationMinutes = duration;
|
|
56
|
+
yield this.updateContextHandler({
|
|
57
|
+
//@ts-ignore
|
|
58
|
+
'event.timeBlocks': timeBlocks,
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
getDurationMsFromEvent() {
|
|
63
|
+
var _a;
|
|
64
|
+
if ((_a = this.event.timeBlocks) === null || _a === void 0 ? void 0 : _a[0]) {
|
|
65
|
+
return `${this.event.timeBlocks[0].durationMinutes * 60 * 1000}`;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
handleUpdateContext() {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
yield this.setFormToMatchContext();
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
setFormToMatchContext() {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const durationMs = this.getDurationMsFromEvent();
|
|
77
|
+
yield this.formVc.setValue('durationMs', durationMs);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
get event() {
|
|
81
|
+
return this.context.event;
|
|
82
|
+
}
|
|
83
|
+
get context() {
|
|
84
|
+
return this.getContextHandler();
|
|
85
|
+
}
|
|
86
|
+
load() {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
88
|
+
}
|
|
89
|
+
render() {
|
|
90
|
+
return this.cardVc.render();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
EventDurationToolViewController.id = 'event-duration-tool';
|
|
94
|
+
export default EventDurationToolViewController;
|
|
95
|
+
const labels = [
|
|
96
|
+
'15m',
|
|
97
|
+
'30m',
|
|
98
|
+
'45m',
|
|
99
|
+
'1h',
|
|
100
|
+
'1h15m',
|
|
101
|
+
'1h30m',
|
|
102
|
+
'1h45',
|
|
103
|
+
'2h',
|
|
104
|
+
'4h',
|
|
105
|
+
'6h',
|
|
106
|
+
'8h',
|
|
107
|
+
'10h',
|
|
108
|
+
];
|
|
109
|
+
const values = [
|
|
110
|
+
15 * 60 * 1000,
|
|
111
|
+
30 * 60 * 1000,
|
|
112
|
+
45 * 60 * 1000,
|
|
113
|
+
60 * 60 * 1000,
|
|
114
|
+
75 * 60 * 1000,
|
|
115
|
+
90 * 60 * 1000,
|
|
116
|
+
105 * 60 * 1000,
|
|
117
|
+
120 * 60 * 1000,
|
|
118
|
+
240 * 60 * 1000,
|
|
119
|
+
360 * 60 * 1000,
|
|
120
|
+
480 * 60 * 1000,
|
|
121
|
+
600 * 60 * 1000,
|
|
122
|
+
];
|
|
123
|
+
const eventDurationFormSchema = buildSchema({
|
|
124
|
+
id: 'durationForm',
|
|
125
|
+
fields: {
|
|
126
|
+
durationMs: {
|
|
127
|
+
type: 'select',
|
|
128
|
+
isRequired: true,
|
|
129
|
+
options: {
|
|
130
|
+
choices: labels.map((label, idx) => ({
|
|
131
|
+
label,
|
|
132
|
+
value: `${values[idx]}`,
|
|
133
|
+
})),
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
});
|
|
@@ -6,6 +6,7 @@ export { default as calendarToolBeltInteractor } from './__tests__/support/utili
|
|
|
6
6
|
export { default as SpyEventManager } from './__tests__/support/SpyEventManager';
|
|
7
7
|
import CalendarViewController from './calendar/Calendar.vc';
|
|
8
8
|
import EventDateTimeToolViewController from './tools/EventDateTimeTool.vc';
|
|
9
|
+
import EventDurationToolViewController from './tools/EventDurationTool.vc';
|
|
9
10
|
import EventRepeatingToolViewController from './tools/EventRepeatingTool.vc';
|
|
10
11
|
import EventTitleToolViewController from './tools/EventTitleTool.vc';
|
|
11
12
|
import EventControlsCardViewController from './viewControllers/EventControlsCard.vc';
|
|
@@ -38,6 +39,7 @@ declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.typ
|
|
|
38
39
|
'calendar.repeating-controls-list': RepeatingControlsListViewController;
|
|
39
40
|
'calendar.calendar': CalendarViewController;
|
|
40
41
|
'calendar.event-date-time-tool': EventDateTimeToolViewController;
|
|
42
|
+
'calendar.event-duration-tool': EventDurationToolViewController;
|
|
41
43
|
'calendar.event-repeating-tool': EventRepeatingToolViewController;
|
|
42
44
|
'calendar.event-title-tool': EventTitleToolViewController;
|
|
43
45
|
'calendar.event-controls-card': EventControlsCardViewController;
|
|
@@ -46,6 +48,7 @@ declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.typ
|
|
|
46
48
|
'calendar.repeating-controls-list': ConstructorParameters<typeof RepeatingControlsListViewController>[0];
|
|
47
49
|
'calendar.calendar': ConstructorParameters<typeof CalendarViewController>[0];
|
|
48
50
|
'calendar.event-date-time-tool': ConstructorParameters<typeof EventDateTimeToolViewController>[0];
|
|
51
|
+
'calendar.event-duration-tool': ConstructorParameters<typeof EventDurationToolViewController>[0];
|
|
49
52
|
'calendar.event-repeating-tool': ConstructorParameters<typeof EventRepeatingToolViewController>[0];
|
|
50
53
|
'calendar.event-title-tool': ConstructorParameters<typeof EventTitleToolViewController>[0];
|
|
51
54
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AbstractViewController, Card, FormViewController, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import { CalendarTool, CalendarToolOptions } from '../types/calendar.types';
|
|
3
|
+
export default class EventDurationToolViewController extends AbstractViewController<Card> implements CalendarTool {
|
|
4
|
+
static id: string;
|
|
5
|
+
shouldPersistContextChangesImmediately?: boolean | undefined;
|
|
6
|
+
private cardVc;
|
|
7
|
+
protected formVc: EventDurationFormVc;
|
|
8
|
+
private getContextHandler;
|
|
9
|
+
private updateContextHandler;
|
|
10
|
+
constructor(options: ViewControllerOptions & CalendarToolOptions);
|
|
11
|
+
private CardVc;
|
|
12
|
+
private FormVc;
|
|
13
|
+
private handleChangeForm;
|
|
14
|
+
private getDurationMsFromEvent;
|
|
15
|
+
handleUpdateContext(): Promise<void>;
|
|
16
|
+
private setFormToMatchContext;
|
|
17
|
+
private get event();
|
|
18
|
+
private get context();
|
|
19
|
+
load(): Promise<void>;
|
|
20
|
+
render(): import("@sprucelabs/heartwood-view-controllers").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
21
|
+
}
|
|
22
|
+
declare const eventDurationFormSchema: {
|
|
23
|
+
id: string;
|
|
24
|
+
fields: {
|
|
25
|
+
durationMs: {
|
|
26
|
+
type: "select";
|
|
27
|
+
isRequired: true;
|
|
28
|
+
options: {
|
|
29
|
+
choices: {
|
|
30
|
+
label: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
type EventDurationFormSchema = typeof eventDurationFormSchema;
|
|
38
|
+
export type EventDurationFormVc = FormViewController<EventDurationFormSchema>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
|
4
|
+
const schema_1 = require("@sprucelabs/schema");
|
|
5
|
+
class EventDurationToolViewController extends heartwood_view_controllers_1.AbstractViewController {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super(options);
|
|
8
|
+
this.shouldPersistContextChangesImmediately = false;
|
|
9
|
+
const { getContext, updateContext } = options;
|
|
10
|
+
this.getContextHandler = getContext;
|
|
11
|
+
this.updateContextHandler = updateContext;
|
|
12
|
+
this.formVc = this.FormVc();
|
|
13
|
+
this.cardVc = this.CardVc();
|
|
14
|
+
}
|
|
15
|
+
CardVc() {
|
|
16
|
+
return this.Controller('card', {
|
|
17
|
+
body: {
|
|
18
|
+
sections: [
|
|
19
|
+
{
|
|
20
|
+
form: this.formVc.render(),
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
FormVc() {
|
|
27
|
+
return this.Controller('form', (0, heartwood_view_controllers_1.buildForm)({
|
|
28
|
+
values: { durationMs: this.getDurationMsFromEvent() },
|
|
29
|
+
onChange: this.handleChangeForm.bind(this),
|
|
30
|
+
sections: [
|
|
31
|
+
{
|
|
32
|
+
fields: [
|
|
33
|
+
{
|
|
34
|
+
name: 'durationMs',
|
|
35
|
+
renderAs: 'tags',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
schema: eventDurationFormSchema,
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
async handleChangeForm() {
|
|
44
|
+
const durationMs = this.formVc.getValue('durationMs');
|
|
45
|
+
const duration = parseInt(durationMs, 10) / 1000 / 60;
|
|
46
|
+
const timeBlocks = this.event.timeBlocks.map((tb) => (Object.assign({}, tb)));
|
|
47
|
+
timeBlocks[0].durationMinutes = duration;
|
|
48
|
+
await this.updateContextHandler({
|
|
49
|
+
//@ts-ignore
|
|
50
|
+
'event.timeBlocks': timeBlocks,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
getDurationMsFromEvent() {
|
|
54
|
+
var _a;
|
|
55
|
+
if ((_a = this.event.timeBlocks) === null || _a === void 0 ? void 0 : _a[0]) {
|
|
56
|
+
return `${this.event.timeBlocks[0].durationMinutes * 60 * 1000}`;
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
async handleUpdateContext() {
|
|
61
|
+
await this.setFormToMatchContext();
|
|
62
|
+
}
|
|
63
|
+
async setFormToMatchContext() {
|
|
64
|
+
const durationMs = this.getDurationMsFromEvent();
|
|
65
|
+
await this.formVc.setValue('durationMs', durationMs);
|
|
66
|
+
}
|
|
67
|
+
get event() {
|
|
68
|
+
return this.context.event;
|
|
69
|
+
}
|
|
70
|
+
get context() {
|
|
71
|
+
return this.getContextHandler();
|
|
72
|
+
}
|
|
73
|
+
async load() { }
|
|
74
|
+
render() {
|
|
75
|
+
return this.cardVc.render();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
EventDurationToolViewController.id = 'event-duration-tool';
|
|
79
|
+
exports.default = EventDurationToolViewController;
|
|
80
|
+
const labels = [
|
|
81
|
+
'15m',
|
|
82
|
+
'30m',
|
|
83
|
+
'45m',
|
|
84
|
+
'1h',
|
|
85
|
+
'1h15m',
|
|
86
|
+
'1h30m',
|
|
87
|
+
'1h45',
|
|
88
|
+
'2h',
|
|
89
|
+
'4h',
|
|
90
|
+
'6h',
|
|
91
|
+
'8h',
|
|
92
|
+
'10h',
|
|
93
|
+
];
|
|
94
|
+
const values = [
|
|
95
|
+
15 * 60 * 1000,
|
|
96
|
+
30 * 60 * 1000,
|
|
97
|
+
45 * 60 * 1000,
|
|
98
|
+
60 * 60 * 1000,
|
|
99
|
+
75 * 60 * 1000,
|
|
100
|
+
90 * 60 * 1000,
|
|
101
|
+
105 * 60 * 1000,
|
|
102
|
+
120 * 60 * 1000,
|
|
103
|
+
240 * 60 * 1000,
|
|
104
|
+
360 * 60 * 1000,
|
|
105
|
+
480 * 60 * 1000,
|
|
106
|
+
600 * 60 * 1000,
|
|
107
|
+
];
|
|
108
|
+
const eventDurationFormSchema = (0, schema_1.buildSchema)({
|
|
109
|
+
id: 'durationForm',
|
|
110
|
+
fields: {
|
|
111
|
+
durationMs: {
|
|
112
|
+
type: 'select',
|
|
113
|
+
isRequired: true,
|
|
114
|
+
options: {
|
|
115
|
+
choices: labels.map((label, idx) => ({
|
|
116
|
+
label,
|
|
117
|
+
value: `${values[idx]}`,
|
|
118
|
+
})),
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
});
|
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": "25.1.
|
|
4
|
+
"version": "25.1.2",
|
|
5
5
|
"skill": {
|
|
6
6
|
"namespace": "calendar"
|
|
7
7
|
},
|
|
@@ -138,6 +138,10 @@
|
|
|
138
138
|
"build/tools/CalendarSelectTool.vc.d.ts",
|
|
139
139
|
"build/esm/tools/CalendarSelectTool.vc.js",
|
|
140
140
|
"build/esm/tools/CalendarSelectTool.vc.d.ts",
|
|
141
|
+
"build/tools/EventDurationTool.vc.js",
|
|
142
|
+
"build/tools/EventDurationTool.vc.d.ts",
|
|
143
|
+
"build/esm/tools/EventDurationTool.vc.js",
|
|
144
|
+
"build/esm/tools/EventDurationTool.vc.d.ts",
|
|
141
145
|
"build/viewControllers/DateSelectCard.vc.js",
|
|
142
146
|
"build/viewControllers/DateSelectCard.vc.d.ts",
|
|
143
147
|
"build/esm/viewControllers/DateSelectCard.vc.js",
|