@sprucelabs/spruce-calendar-components 25.0.1 → 25.1.1
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/esm/index-components.d.ts +2 -0
- package/build/esm/index-components.js +2 -0
- package/build/esm/toolBelt/CalendarToolTestFactory.js +1 -1
- package/build/esm/tools/EventDurationTool.vc.d.ts +39 -0
- package/build/esm/tools/EventDurationTool.vc.js +133 -0
- package/build/esm/types/calendar.types.d.ts +1 -0
- package/build/index-components.d.ts +2 -0
- package/build/index-components.js +4 -1
- package/build/toolBelt/CalendarToolTestFactory.js +1 -1
- package/build/tools/EventDurationTool.vc.d.ts +39 -0
- package/build/tools/EventDurationTool.vc.js +118 -0
- package/build/types/calendar.types.d.ts +1 -0
- package/package.json +5 -1
|
@@ -23,6 +23,8 @@ export { default as EventDateTimeToolViewController } from './tools/EventDateTim
|
|
|
23
23
|
export * from './tools/EventDateTimeTool.vc';
|
|
24
24
|
export { default as EventRepeatingToolViewController } from './tools/EventRepeatingTool.vc';
|
|
25
25
|
export * from './tools/EventRepeatingTool.vc';
|
|
26
|
+
export { default as EventDurationToolViewController } from './tools/EventDurationTool.vc';
|
|
27
|
+
export * from './tools/EventDurationTool.vc';
|
|
26
28
|
export { default as CalendarToolRegistrar } from './toolBelt/CalendarToolRegistrar';
|
|
27
29
|
export * from './toolBelt/CalendarToolRegistrar';
|
|
28
30
|
export { default as AbstractCalendarEventToolBeltState } from './toolBelt/states/AbstractCalendarEventToolBeltState';
|
|
@@ -17,6 +17,8 @@ export { default as EventDateTimeToolViewController } from './tools/EventDateTim
|
|
|
17
17
|
export * from './tools/EventDateTimeTool.vc.js';
|
|
18
18
|
export { default as EventRepeatingToolViewController } from './tools/EventRepeatingTool.vc.js';
|
|
19
19
|
export * from './tools/EventRepeatingTool.vc.js';
|
|
20
|
+
export { default as EventDurationToolViewController } from './tools/EventDurationTool.vc.js';
|
|
21
|
+
export * from './tools/EventDurationTool.vc.js';
|
|
20
22
|
export { default as CalendarToolRegistrar } from './toolBelt/CalendarToolRegistrar.js';
|
|
21
23
|
export * from './toolBelt/CalendarToolRegistrar.js';
|
|
22
24
|
export { default as AbstractCalendarEventToolBeltState } from './toolBelt/states/AbstractCalendarEventToolBeltState.js';
|
|
@@ -22,7 +22,7 @@ export default class CalendarToolTestFactory {
|
|
|
22
22
|
void stateMachine.on('did-update-context', () => {
|
|
23
23
|
return vc.handleUpdateContext(stateMachine.getContext());
|
|
24
24
|
});
|
|
25
|
-
assert.isFunction(vc.handleUpdateContext, `You need to make sure your card view controller implements the CalendarTool interface!`);
|
|
25
|
+
assert.isFunction(vc.handleUpdateContext, `You need to make sure your card view controller implements the CalendarTool interface and is rendering a CardViewController!`);
|
|
26
26
|
return vc;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -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,133 @@
|
|
|
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
|
+
return `${this.event.timeBlocks[0].durationMinutes * 60 * 1000}`;
|
|
64
|
+
}
|
|
65
|
+
handleUpdateContext() {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
yield this.setFormToMatchContext();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
setFormToMatchContext() {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const durationMs = this.getDurationMsFromEvent();
|
|
73
|
+
yield this.formVc.setValue('durationMs', durationMs);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
get event() {
|
|
77
|
+
return this.context.event;
|
|
78
|
+
}
|
|
79
|
+
get context() {
|
|
80
|
+
return this.getContextHandler();
|
|
81
|
+
}
|
|
82
|
+
load() {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
return this.cardVc.render();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
EventDurationToolViewController.id = 'event-duration-tool';
|
|
90
|
+
export default EventDurationToolViewController;
|
|
91
|
+
const labels = [
|
|
92
|
+
'15m',
|
|
93
|
+
'30m',
|
|
94
|
+
'45m',
|
|
95
|
+
'1h',
|
|
96
|
+
'1h15m',
|
|
97
|
+
'1h30m',
|
|
98
|
+
'1h45',
|
|
99
|
+
'2h',
|
|
100
|
+
'4h',
|
|
101
|
+
'6h',
|
|
102
|
+
'8h',
|
|
103
|
+
'10h',
|
|
104
|
+
];
|
|
105
|
+
const values = [
|
|
106
|
+
15 * 60 * 1000,
|
|
107
|
+
30 * 60 * 1000,
|
|
108
|
+
45 * 60 * 1000,
|
|
109
|
+
60 * 60 * 1000,
|
|
110
|
+
75 * 60 * 1000,
|
|
111
|
+
90 * 60 * 1000,
|
|
112
|
+
105 * 60 * 1000,
|
|
113
|
+
120 * 60 * 1000,
|
|
114
|
+
240 * 60 * 1000,
|
|
115
|
+
360 * 60 * 1000,
|
|
116
|
+
480 * 60 * 1000,
|
|
117
|
+
600 * 60 * 1000,
|
|
118
|
+
];
|
|
119
|
+
const eventDurationFormSchema = buildSchema({
|
|
120
|
+
id: 'durationForm',
|
|
121
|
+
fields: {
|
|
122
|
+
durationMs: {
|
|
123
|
+
type: 'select',
|
|
124
|
+
isRequired: true,
|
|
125
|
+
options: {
|
|
126
|
+
choices: labels.map((label, idx) => ({
|
|
127
|
+
label,
|
|
128
|
+
value: `${values[idx]}`,
|
|
129
|
+
})),
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
});
|
|
@@ -14,6 +14,7 @@ export interface Schedule {
|
|
|
14
14
|
}
|
|
15
15
|
export type EventForShift = Pick<CalendarEvent, 'id' | 'timeBlocks' | 'startDateTimeMs' | 'target'>;
|
|
16
16
|
export type DraftEvent = Pick<CalendarEvent, 'id' | 'startDateTimeMs' | 'style' | 'calendarId' | 'target' | 'timeBlocks' | 'isBusy'>;
|
|
17
|
+
export type EventTimeBlock = SpruceSchemas.CalendarUtils.v2021_05_19.EventTimeBlock;
|
|
17
18
|
export type CalendarEventRecord = SpruceSchemas.CalendarUtils.v2021_05_19.CalendarEvent;
|
|
18
19
|
export type CalendarEvent = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent;
|
|
19
20
|
export type UpdateEvent = SpruceSchemas.Calendar.v2021_05_19.UpdateCalendarEventEmitPayload & CalendarEvent;
|
|
@@ -23,6 +23,8 @@ export { default as EventDateTimeToolViewController } from './tools/EventDateTim
|
|
|
23
23
|
export * from './tools/EventDateTimeTool.vc';
|
|
24
24
|
export { default as EventRepeatingToolViewController } from './tools/EventRepeatingTool.vc';
|
|
25
25
|
export * from './tools/EventRepeatingTool.vc';
|
|
26
|
+
export { default as EventDurationToolViewController } from './tools/EventDurationTool.vc';
|
|
27
|
+
export * from './tools/EventDurationTool.vc';
|
|
26
28
|
export { default as CalendarToolRegistrar } from './toolBelt/CalendarToolRegistrar';
|
|
27
29
|
export * from './toolBelt/CalendarToolRegistrar';
|
|
28
30
|
export { default as AbstractCalendarEventToolBeltState } from './toolBelt/states/AbstractCalendarEventToolBeltState';
|
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.peopleToPeopleWithoutSchedules = exports.draftEventGenerator = exports.AbstractCalendarEventToolBeltState = exports.CalendarToolRegistrar = exports.EventRepeatingToolViewController = exports.EventDateTimeToolViewController = exports.EventControlsCardViewController = exports.CalendarViewController = exports.RepeatingControlsListViewController = exports.RepeatingCardViewController = exports.SpyEventManager = exports.calendarToolBeltInteractor = exports.CalendarToolTestFactory = exports.CalendarToolBeltStateMachineTestFactory = exports.calendarSkillAssert = void 0;
|
|
20
|
+
exports.peopleToPeopleWithoutSchedules = exports.draftEventGenerator = exports.AbstractCalendarEventToolBeltState = exports.CalendarToolRegistrar = exports.EventDurationToolViewController = exports.EventRepeatingToolViewController = exports.EventDateTimeToolViewController = exports.EventControlsCardViewController = exports.CalendarViewController = exports.RepeatingControlsListViewController = exports.RepeatingCardViewController = exports.SpyEventManager = exports.calendarToolBeltInteractor = exports.CalendarToolTestFactory = exports.CalendarToolBeltStateMachineTestFactory = exports.calendarSkillAssert = void 0;
|
|
21
21
|
var calendarSkillAssert_1 = require("./__tests__/support/utilities/calendarSkillAssert");
|
|
22
22
|
Object.defineProperty(exports, "calendarSkillAssert", { enumerable: true, get: function () { return __importDefault(calendarSkillAssert_1).default; } });
|
|
23
23
|
var CalendarToolBeltStateMachineTestFactory_1 = require("./__tests__/support/CalendarToolBeltStateMachineTestFactory");
|
|
@@ -48,6 +48,9 @@ __exportStar(require("./tools/EventDateTimeTool.vc"), exports);
|
|
|
48
48
|
var EventRepeatingTool_vc_2 = require("./tools/EventRepeatingTool.vc");
|
|
49
49
|
Object.defineProperty(exports, "EventRepeatingToolViewController", { enumerable: true, get: function () { return __importDefault(EventRepeatingTool_vc_2).default; } });
|
|
50
50
|
__exportStar(require("./tools/EventRepeatingTool.vc"), exports);
|
|
51
|
+
var EventDurationTool_vc_1 = require("./tools/EventDurationTool.vc");
|
|
52
|
+
Object.defineProperty(exports, "EventDurationToolViewController", { enumerable: true, get: function () { return __importDefault(EventDurationTool_vc_1).default; } });
|
|
53
|
+
__exportStar(require("./tools/EventDurationTool.vc"), exports);
|
|
51
54
|
var CalendarToolRegistrar_1 = require("./toolBelt/CalendarToolRegistrar");
|
|
52
55
|
Object.defineProperty(exports, "CalendarToolRegistrar", { enumerable: true, get: function () { return __importDefault(CalendarToolRegistrar_1).default; } });
|
|
53
56
|
__exportStar(require("./toolBelt/CalendarToolRegistrar"), exports);
|
|
@@ -27,7 +27,7 @@ class CalendarToolTestFactory {
|
|
|
27
27
|
void stateMachine.on('did-update-context', () => {
|
|
28
28
|
return vc.handleUpdateContext(stateMachine.getContext());
|
|
29
29
|
});
|
|
30
|
-
test_utils_1.assert.isFunction(vc.handleUpdateContext, `You need to make sure your card view controller implements the CalendarTool interface!`);
|
|
30
|
+
test_utils_1.assert.isFunction(vc.handleUpdateContext, `You need to make sure your card view controller implements the CalendarTool interface and is rendering a CardViewController!`);
|
|
31
31
|
return vc;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -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,118 @@
|
|
|
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
|
+
return `${this.event.timeBlocks[0].durationMinutes * 60 * 1000}`;
|
|
55
|
+
}
|
|
56
|
+
async handleUpdateContext() {
|
|
57
|
+
await this.setFormToMatchContext();
|
|
58
|
+
}
|
|
59
|
+
async setFormToMatchContext() {
|
|
60
|
+
const durationMs = this.getDurationMsFromEvent();
|
|
61
|
+
await this.formVc.setValue('durationMs', durationMs);
|
|
62
|
+
}
|
|
63
|
+
get event() {
|
|
64
|
+
return this.context.event;
|
|
65
|
+
}
|
|
66
|
+
get context() {
|
|
67
|
+
return this.getContextHandler();
|
|
68
|
+
}
|
|
69
|
+
async load() { }
|
|
70
|
+
render() {
|
|
71
|
+
return this.cardVc.render();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
EventDurationToolViewController.id = 'event-duration-tool';
|
|
75
|
+
exports.default = EventDurationToolViewController;
|
|
76
|
+
const labels = [
|
|
77
|
+
'15m',
|
|
78
|
+
'30m',
|
|
79
|
+
'45m',
|
|
80
|
+
'1h',
|
|
81
|
+
'1h15m',
|
|
82
|
+
'1h30m',
|
|
83
|
+
'1h45',
|
|
84
|
+
'2h',
|
|
85
|
+
'4h',
|
|
86
|
+
'6h',
|
|
87
|
+
'8h',
|
|
88
|
+
'10h',
|
|
89
|
+
];
|
|
90
|
+
const values = [
|
|
91
|
+
15 * 60 * 1000,
|
|
92
|
+
30 * 60 * 1000,
|
|
93
|
+
45 * 60 * 1000,
|
|
94
|
+
60 * 60 * 1000,
|
|
95
|
+
75 * 60 * 1000,
|
|
96
|
+
90 * 60 * 1000,
|
|
97
|
+
105 * 60 * 1000,
|
|
98
|
+
120 * 60 * 1000,
|
|
99
|
+
240 * 60 * 1000,
|
|
100
|
+
360 * 60 * 1000,
|
|
101
|
+
480 * 60 * 1000,
|
|
102
|
+
600 * 60 * 1000,
|
|
103
|
+
];
|
|
104
|
+
const eventDurationFormSchema = (0, schema_1.buildSchema)({
|
|
105
|
+
id: 'durationForm',
|
|
106
|
+
fields: {
|
|
107
|
+
durationMs: {
|
|
108
|
+
type: 'select',
|
|
109
|
+
isRequired: true,
|
|
110
|
+
options: {
|
|
111
|
+
choices: labels.map((label, idx) => ({
|
|
112
|
+
label,
|
|
113
|
+
value: `${values[idx]}`,
|
|
114
|
+
})),
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
});
|
|
@@ -14,6 +14,7 @@ export interface Schedule {
|
|
|
14
14
|
}
|
|
15
15
|
export type EventForShift = Pick<CalendarEvent, 'id' | 'timeBlocks' | 'startDateTimeMs' | 'target'>;
|
|
16
16
|
export type DraftEvent = Pick<CalendarEvent, 'id' | 'startDateTimeMs' | 'style' | 'calendarId' | 'target' | 'timeBlocks' | 'isBusy'>;
|
|
17
|
+
export type EventTimeBlock = SpruceSchemas.CalendarUtils.v2021_05_19.EventTimeBlock;
|
|
17
18
|
export type CalendarEventRecord = SpruceSchemas.CalendarUtils.v2021_05_19.CalendarEvent;
|
|
18
19
|
export type CalendarEvent = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent;
|
|
19
20
|
export type UpdateEvent = SpruceSchemas.Calendar.v2021_05_19.UpdateCalendarEventEmitPayload & CalendarEvent;
|
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.
|
|
4
|
+
"version": "25.1.1",
|
|
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",
|