@sprucelabs/spruce-calendar-components 22.10.2 → 22.10.4
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/skillViewControllers/Root.svc.js +2 -1
- package/build/esm/viewControllers/PersonSelectTool.vc.js +10 -2
- package/build/esm/viewControllers/SelectUpdateRepeatingStrategyCard.vc.d.ts +3 -0
- package/build/esm/viewControllers/SelectUpdateRepeatingStrategyCard.vc.js +14 -7
- package/build/skillViewControllers/Root.svc.js +2 -1
- package/build/viewControllers/PersonSelectTool.vc.js +10 -2
- package/build/viewControllers/SelectUpdateRepeatingStrategyCard.vc.d.ts +3 -0
- package/build/viewControllers/SelectUpdateRepeatingStrategyCard.vc.js +14 -7
- package/package.json +1 -1
|
@@ -85,11 +85,12 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
askForUpdateStrategy(cleaned) {
|
|
88
|
+
askForUpdateStrategy(cleaned, action = 'update') {
|
|
89
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
90
|
let strategy;
|
|
91
91
|
const dlg = this.renderInDialog(Object.assign({ shouldShowCloseButton: false }, this.Controller('calendar.select-update-repeating-strategy-card', {
|
|
92
92
|
event: cleaned,
|
|
93
|
+
action,
|
|
93
94
|
onSelectStrategy: (s) => __awaiter(this, void 0, void 0, function* () {
|
|
94
95
|
strategy = s;
|
|
95
96
|
yield dlg.hide();
|
|
@@ -77,15 +77,23 @@ export default class PersonSelectToolViewController extends AbstractViewControll
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
ListVc() {
|
|
80
|
+
const team = this.people.getTeam();
|
|
81
|
+
team.sort((a, b) => {
|
|
82
|
+
return a.casualName > b.casualName ? 1 : -1;
|
|
83
|
+
});
|
|
80
84
|
return this.Controller('list', {
|
|
81
|
-
columnWidths: ['fill'],
|
|
82
|
-
rows:
|
|
85
|
+
columnWidths: ['content', 'fill'],
|
|
86
|
+
rows: team.map((p) => this.renderRow(p)),
|
|
83
87
|
});
|
|
84
88
|
}
|
|
85
89
|
renderRow(person) {
|
|
90
|
+
var _a;
|
|
86
91
|
return {
|
|
87
92
|
id: person.id,
|
|
88
93
|
cells: [
|
|
94
|
+
{
|
|
95
|
+
avatars: ((_a = person.avatar) === null || _a === void 0 ? void 0 : _a.mUri) ? [person.avatar.mUri] : undefined,
|
|
96
|
+
},
|
|
89
97
|
{
|
|
90
98
|
text: {
|
|
91
99
|
content: person.id === this.loggedInPersonId ? 'You' : person.casualName,
|
|
@@ -5,14 +5,17 @@ export default class SelectUpdateRepeatingStrategyCardViewController extends Abs
|
|
|
5
5
|
private cardVc;
|
|
6
6
|
private event;
|
|
7
7
|
private onSelectStrategy;
|
|
8
|
+
private action;
|
|
8
9
|
constructor(options: ViewControllerOptions & SelectUpdateRepeatingStrategyOptions);
|
|
9
10
|
private CardVc;
|
|
11
|
+
private capitalizedAction;
|
|
10
12
|
getEvent(): CalendarEvent;
|
|
11
13
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
12
14
|
}
|
|
13
15
|
declare type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
14
16
|
export interface SelectUpdateRepeatingStrategyOptions {
|
|
15
17
|
event: CalendarEvent;
|
|
18
|
+
action?: 'update' | 'cancel';
|
|
16
19
|
onSelectStrategy: (strategy: UpdateRepeatingStrategyWithCancel) => Promise<void> | void;
|
|
17
20
|
}
|
|
18
21
|
export {};
|
|
@@ -4,9 +4,13 @@ import { randomUtil } from '@sprucelabs/spruce-skill-utils';
|
|
|
4
4
|
export default class SelectUpdateRepeatingStrategyCardViewController extends AbstractViewController {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super(options);
|
|
7
|
-
assertOptions(options, [
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const { event, onSelectStrategy, action } = assertOptions(options, [
|
|
8
|
+
'event',
|
|
9
|
+
'onSelectStrategy',
|
|
10
|
+
]);
|
|
11
|
+
this.onSelectStrategy = onSelectStrategy;
|
|
12
|
+
this.event = event;
|
|
13
|
+
this.action = action !== null && action !== void 0 ? action : 'update';
|
|
10
14
|
this.cardVc = this.CardVc();
|
|
11
15
|
}
|
|
12
16
|
CardVc() {
|
|
@@ -14,25 +18,25 @@ export default class SelectUpdateRepeatingStrategyCardViewController extends Abs
|
|
|
14
18
|
const buttons = [
|
|
15
19
|
{
|
|
16
20
|
id: 'only-this-one',
|
|
17
|
-
label:
|
|
21
|
+
label: `${this.capitalizedAction()} only this event`,
|
|
18
22
|
},
|
|
19
23
|
];
|
|
20
24
|
if (((_a = this.event.nthInRepeating) !== null && _a !== void 0 ? _a : 0) > 0) {
|
|
21
25
|
buttons.push({
|
|
22
26
|
id: 'all-going-forward',
|
|
23
|
-
label:
|
|
27
|
+
label: `${this.capitalizedAction()} this and all going forward`,
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
30
|
buttons.push({
|
|
27
31
|
id: 'all',
|
|
28
|
-
label:
|
|
32
|
+
label: `${this.capitalizedAction()} all events`,
|
|
29
33
|
});
|
|
30
34
|
buttons.forEach((button) => {
|
|
31
35
|
button.onClick = () => this.onSelectStrategy(button.id);
|
|
32
36
|
});
|
|
33
37
|
return this.Controller('card', {
|
|
34
38
|
header: {
|
|
35
|
-
title: `How do you want to
|
|
39
|
+
title: `How do you want to ${this.action}?`,
|
|
36
40
|
subtitle: `This is the ${this.event.nthInRepeating
|
|
37
41
|
? ordinal_suffix_of(this.event.nthInRepeating)
|
|
38
42
|
: 'first'} of ${this.event.activeUntilDate
|
|
@@ -62,6 +66,9 @@ export default class SelectUpdateRepeatingStrategyCardViewController extends Abs
|
|
|
62
66
|
},
|
|
63
67
|
});
|
|
64
68
|
}
|
|
69
|
+
capitalizedAction() {
|
|
70
|
+
return this.action === 'cancel' ? 'Cancel' : 'Update';
|
|
71
|
+
}
|
|
65
72
|
getEvent() {
|
|
66
73
|
return this.event;
|
|
67
74
|
}
|
|
@@ -79,10 +79,11 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
|
|
|
79
79
|
await this.events.cancelEvent(eventId);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
async askForUpdateStrategy(cleaned) {
|
|
82
|
+
async askForUpdateStrategy(cleaned, action = 'update') {
|
|
83
83
|
let strategy;
|
|
84
84
|
const dlg = this.renderInDialog(Object.assign({ shouldShowCloseButton: false }, this.Controller('calendar.select-update-repeating-strategy-card', {
|
|
85
85
|
event: cleaned,
|
|
86
|
+
action,
|
|
86
87
|
onSelectStrategy: async (s) => {
|
|
87
88
|
strategy = s;
|
|
88
89
|
await dlg.hide();
|
|
@@ -68,15 +68,23 @@ class PersonSelectToolViewController extends heartwood_view_controllers_1.Abstra
|
|
|
68
68
|
return this.updatePromise;
|
|
69
69
|
}
|
|
70
70
|
ListVc() {
|
|
71
|
+
const team = this.people.getTeam();
|
|
72
|
+
team.sort((a, b) => {
|
|
73
|
+
return a.casualName > b.casualName ? 1 : -1;
|
|
74
|
+
});
|
|
71
75
|
return this.Controller('list', {
|
|
72
|
-
columnWidths: ['fill'],
|
|
73
|
-
rows:
|
|
76
|
+
columnWidths: ['content', 'fill'],
|
|
77
|
+
rows: team.map((p) => this.renderRow(p)),
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
80
|
renderRow(person) {
|
|
81
|
+
var _a;
|
|
77
82
|
return {
|
|
78
83
|
id: person.id,
|
|
79
84
|
cells: [
|
|
85
|
+
{
|
|
86
|
+
avatars: ((_a = person.avatar) === null || _a === void 0 ? void 0 : _a.mUri) ? [person.avatar.mUri] : undefined,
|
|
87
|
+
},
|
|
80
88
|
{
|
|
81
89
|
text: {
|
|
82
90
|
content: person.id === this.loggedInPersonId ? 'You' : person.casualName,
|
|
@@ -5,14 +5,17 @@ export default class SelectUpdateRepeatingStrategyCardViewController extends Abs
|
|
|
5
5
|
private cardVc;
|
|
6
6
|
private event;
|
|
7
7
|
private onSelectStrategy;
|
|
8
|
+
private action;
|
|
8
9
|
constructor(options: ViewControllerOptions & SelectUpdateRepeatingStrategyOptions);
|
|
9
10
|
private CardVc;
|
|
11
|
+
private capitalizedAction;
|
|
10
12
|
getEvent(): CalendarEvent;
|
|
11
13
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
12
14
|
}
|
|
13
15
|
declare type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
14
16
|
export interface SelectUpdateRepeatingStrategyOptions {
|
|
15
17
|
event: CalendarEvent;
|
|
18
|
+
action?: 'update' | 'cancel';
|
|
16
19
|
onSelectStrategy: (strategy: UpdateRepeatingStrategyWithCancel) => Promise<void> | void;
|
|
17
20
|
}
|
|
18
21
|
export {};
|
|
@@ -6,9 +6,13 @@ const spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils");
|
|
|
6
6
|
class SelectUpdateRepeatingStrategyCardViewController extends heartwood_view_controllers_1.AbstractViewController {
|
|
7
7
|
constructor(options) {
|
|
8
8
|
super(options);
|
|
9
|
-
(0, schema_1.assertOptions)(options, [
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const { event, onSelectStrategy, action } = (0, schema_1.assertOptions)(options, [
|
|
10
|
+
'event',
|
|
11
|
+
'onSelectStrategy',
|
|
12
|
+
]);
|
|
13
|
+
this.onSelectStrategy = onSelectStrategy;
|
|
14
|
+
this.event = event;
|
|
15
|
+
this.action = action !== null && action !== void 0 ? action : 'update';
|
|
12
16
|
this.cardVc = this.CardVc();
|
|
13
17
|
}
|
|
14
18
|
CardVc() {
|
|
@@ -16,25 +20,25 @@ class SelectUpdateRepeatingStrategyCardViewController extends heartwood_view_con
|
|
|
16
20
|
const buttons = [
|
|
17
21
|
{
|
|
18
22
|
id: 'only-this-one',
|
|
19
|
-
label:
|
|
23
|
+
label: `${this.capitalizedAction()} only this event`,
|
|
20
24
|
},
|
|
21
25
|
];
|
|
22
26
|
if (((_a = this.event.nthInRepeating) !== null && _a !== void 0 ? _a : 0) > 0) {
|
|
23
27
|
buttons.push({
|
|
24
28
|
id: 'all-going-forward',
|
|
25
|
-
label:
|
|
29
|
+
label: `${this.capitalizedAction()} this and all going forward`,
|
|
26
30
|
});
|
|
27
31
|
}
|
|
28
32
|
buttons.push({
|
|
29
33
|
id: 'all',
|
|
30
|
-
label:
|
|
34
|
+
label: `${this.capitalizedAction()} all events`,
|
|
31
35
|
});
|
|
32
36
|
buttons.forEach((button) => {
|
|
33
37
|
button.onClick = () => this.onSelectStrategy(button.id);
|
|
34
38
|
});
|
|
35
39
|
return this.Controller('card', {
|
|
36
40
|
header: {
|
|
37
|
-
title: `How do you want to
|
|
41
|
+
title: `How do you want to ${this.action}?`,
|
|
38
42
|
subtitle: `This is the ${this.event.nthInRepeating
|
|
39
43
|
? ordinal_suffix_of(this.event.nthInRepeating)
|
|
40
44
|
: 'first'} of ${this.event.activeUntilDate
|
|
@@ -64,6 +68,9 @@ class SelectUpdateRepeatingStrategyCardViewController extends heartwood_view_con
|
|
|
64
68
|
},
|
|
65
69
|
});
|
|
66
70
|
}
|
|
71
|
+
capitalizedAction() {
|
|
72
|
+
return this.action === 'cancel' ? 'Cancel' : 'Update';
|
|
73
|
+
}
|
|
67
74
|
getEvent() {
|
|
68
75
|
return this.event;
|
|
69
76
|
}
|