@sprucelabs/spruce-calendar-components 22.3.21 → 22.4.0
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/toolBelt/states/AbstractCalendarEventToolBeltState.d.ts +1 -1
- package/build/esm/viewControllers/EventControlsCard.vc.d.ts +6 -1
- package/build/esm/viewControllers/EventControlsCard.vc.js +17 -2
- package/build/toolBelt/states/AbstractCalendarEventToolBeltState.d.ts +1 -1
- package/build/viewControllers/EventControlsCard.vc.d.ts +6 -1
- package/build/viewControllers/EventControlsCard.vc.js +17 -2
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
|
|
|
11
11
|
private toolBeltVc;
|
|
12
12
|
private vcs;
|
|
13
13
|
private pendingContextUpdates;
|
|
14
|
-
|
|
14
|
+
protected controlsVc: EventControlsCardViewController;
|
|
15
15
|
private isLoaded;
|
|
16
16
|
private events;
|
|
17
17
|
load(sm: CalendarToolBeltStateMachine): Promise<void>;
|
|
@@ -11,14 +11,19 @@ export default class EventControlsCardViewController extends AbstractViewControl
|
|
|
11
11
|
private cardVc;
|
|
12
12
|
private saveHandler;
|
|
13
13
|
private cancelHandler;
|
|
14
|
-
private
|
|
14
|
+
private getHasPendingContextChanges;
|
|
15
15
|
private getContext;
|
|
16
16
|
private cancelEventHandler;
|
|
17
|
+
private isEnableLocked;
|
|
17
18
|
constructor(options: ViewControllerOptions & EventControlsCardOptions);
|
|
18
19
|
private CardVc;
|
|
19
20
|
private handleClickCancel;
|
|
20
21
|
private handleClickSave;
|
|
22
|
+
lockEnabled(): void;
|
|
23
|
+
unlockEnabled(): void;
|
|
24
|
+
getIsEnableLocked(): boolean;
|
|
21
25
|
handleUpdateContext(): void;
|
|
26
|
+
private shouldFooterBeEnabled;
|
|
22
27
|
private optionallyDropInCancelButton;
|
|
23
28
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
24
29
|
}
|
|
@@ -13,6 +13,7 @@ import draftEventGenerator from '../utilities/draftGenerator.js';
|
|
|
13
13
|
export default class EventControlsCardViewController extends AbstractViewController {
|
|
14
14
|
constructor(options) {
|
|
15
15
|
super(options);
|
|
16
|
+
this.isEnableLocked = false;
|
|
16
17
|
const { onSave, onCancel, getHasPendingContextChanges, getContext, onCancelEvent, } = assertOptions(options, [
|
|
17
18
|
'onCancel',
|
|
18
19
|
'onSave',
|
|
@@ -23,7 +24,7 @@ export default class EventControlsCardViewController extends AbstractViewControl
|
|
|
23
24
|
this.saveHandler = onSave;
|
|
24
25
|
this.cancelHandler = onCancel;
|
|
25
26
|
this.cancelEventHandler = onCancelEvent;
|
|
26
|
-
this.
|
|
27
|
+
this.getHasPendingContextChanges = getHasPendingContextChanges;
|
|
27
28
|
this.getContext = getContext;
|
|
28
29
|
this.cardVc = this.CardVc();
|
|
29
30
|
this.optionallyDropInCancelButton();
|
|
@@ -63,8 +64,19 @@ export default class EventControlsCardViewController extends AbstractViewControl
|
|
|
63
64
|
this.cardVc.disableFooter();
|
|
64
65
|
});
|
|
65
66
|
}
|
|
67
|
+
lockEnabled() {
|
|
68
|
+
this.isEnableLocked = true;
|
|
69
|
+
this.handleUpdateContext();
|
|
70
|
+
}
|
|
71
|
+
unlockEnabled() {
|
|
72
|
+
this.isEnableLocked = false;
|
|
73
|
+
this.handleUpdateContext();
|
|
74
|
+
}
|
|
75
|
+
getIsEnableLocked() {
|
|
76
|
+
return this.isEnableLocked;
|
|
77
|
+
}
|
|
66
78
|
handleUpdateContext() {
|
|
67
|
-
if (this.
|
|
79
|
+
if (this.shouldFooterBeEnabled()) {
|
|
68
80
|
this.cardVc.enableFooter();
|
|
69
81
|
}
|
|
70
82
|
else {
|
|
@@ -72,6 +84,9 @@ export default class EventControlsCardViewController extends AbstractViewControl
|
|
|
72
84
|
}
|
|
73
85
|
this.optionallyDropInCancelButton();
|
|
74
86
|
}
|
|
87
|
+
shouldFooterBeEnabled() {
|
|
88
|
+
return this.getHasPendingContextChanges() || this.isEnableLocked;
|
|
89
|
+
}
|
|
75
90
|
optionallyDropInCancelButton() {
|
|
76
91
|
var _a;
|
|
77
92
|
const { event } = this.getContext();
|
|
@@ -11,7 +11,7 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
|
|
|
11
11
|
private toolBeltVc;
|
|
12
12
|
private vcs;
|
|
13
13
|
private pendingContextUpdates;
|
|
14
|
-
|
|
14
|
+
protected controlsVc: EventControlsCardViewController;
|
|
15
15
|
private isLoaded;
|
|
16
16
|
private events;
|
|
17
17
|
load(sm: CalendarToolBeltStateMachine): Promise<void>;
|
|
@@ -11,14 +11,19 @@ export default class EventControlsCardViewController extends AbstractViewControl
|
|
|
11
11
|
private cardVc;
|
|
12
12
|
private saveHandler;
|
|
13
13
|
private cancelHandler;
|
|
14
|
-
private
|
|
14
|
+
private getHasPendingContextChanges;
|
|
15
15
|
private getContext;
|
|
16
16
|
private cancelEventHandler;
|
|
17
|
+
private isEnableLocked;
|
|
17
18
|
constructor(options: ViewControllerOptions & EventControlsCardOptions);
|
|
18
19
|
private CardVc;
|
|
19
20
|
private handleClickCancel;
|
|
20
21
|
private handleClickSave;
|
|
22
|
+
lockEnabled(): void;
|
|
23
|
+
unlockEnabled(): void;
|
|
24
|
+
getIsEnableLocked(): boolean;
|
|
21
25
|
handleUpdateContext(): void;
|
|
26
|
+
private shouldFooterBeEnabled;
|
|
22
27
|
private optionallyDropInCancelButton;
|
|
23
28
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
24
29
|
}
|
|
@@ -9,6 +9,7 @@ const draftGenerator_1 = __importDefault(require("../utilities/draftGenerator"))
|
|
|
9
9
|
class EventControlsCardViewController extends heartwood_view_controllers_1.AbstractViewController {
|
|
10
10
|
constructor(options) {
|
|
11
11
|
super(options);
|
|
12
|
+
this.isEnableLocked = false;
|
|
12
13
|
const { onSave, onCancel, getHasPendingContextChanges, getContext, onCancelEvent, } = (0, schema_1.assertOptions)(options, [
|
|
13
14
|
'onCancel',
|
|
14
15
|
'onSave',
|
|
@@ -19,7 +20,7 @@ class EventControlsCardViewController extends heartwood_view_controllers_1.Abstr
|
|
|
19
20
|
this.saveHandler = onSave;
|
|
20
21
|
this.cancelHandler = onCancel;
|
|
21
22
|
this.cancelEventHandler = onCancelEvent;
|
|
22
|
-
this.
|
|
23
|
+
this.getHasPendingContextChanges = getHasPendingContextChanges;
|
|
23
24
|
this.getContext = getContext;
|
|
24
25
|
this.cardVc = this.CardVc();
|
|
25
26
|
this.optionallyDropInCancelButton();
|
|
@@ -55,8 +56,19 @@ class EventControlsCardViewController extends heartwood_view_controllers_1.Abstr
|
|
|
55
56
|
this.cardVc.setFooterIsBusy(false);
|
|
56
57
|
this.cardVc.disableFooter();
|
|
57
58
|
}
|
|
59
|
+
lockEnabled() {
|
|
60
|
+
this.isEnableLocked = true;
|
|
61
|
+
this.handleUpdateContext();
|
|
62
|
+
}
|
|
63
|
+
unlockEnabled() {
|
|
64
|
+
this.isEnableLocked = false;
|
|
65
|
+
this.handleUpdateContext();
|
|
66
|
+
}
|
|
67
|
+
getIsEnableLocked() {
|
|
68
|
+
return this.isEnableLocked;
|
|
69
|
+
}
|
|
58
70
|
handleUpdateContext() {
|
|
59
|
-
if (this.
|
|
71
|
+
if (this.shouldFooterBeEnabled()) {
|
|
60
72
|
this.cardVc.enableFooter();
|
|
61
73
|
}
|
|
62
74
|
else {
|
|
@@ -64,6 +76,9 @@ class EventControlsCardViewController extends heartwood_view_controllers_1.Abstr
|
|
|
64
76
|
}
|
|
65
77
|
this.optionallyDropInCancelButton();
|
|
66
78
|
}
|
|
79
|
+
shouldFooterBeEnabled() {
|
|
80
|
+
return this.getHasPendingContextChanges() || this.isEnableLocked;
|
|
81
|
+
}
|
|
67
82
|
optionallyDropInCancelButton() {
|
|
68
83
|
var _a;
|
|
69
84
|
const { event } = this.getContext();
|