mvvm-mobx 1.3.0 → 1.3.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/dist/commands/index.d.ts
CHANGED
package/dist/commands/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./RelayCommand"), exports);
|
|
18
18
|
__exportStar(require("./prop-helpers"), exports);
|
|
19
|
+
__exportStar(require("./Command"), exports);
|
|
@@ -70,14 +70,19 @@ class Interact {
|
|
|
70
70
|
if (action.command && !('onOperationFinished' in content)) {
|
|
71
71
|
throw Error('Missing onOperationFinished property on the content when using command in responses. Do not forget a default assignment to undefined.');
|
|
72
72
|
}
|
|
73
|
+
// Adding the Cancel response as a command will allow up to get a beter UX by disabling it while the custom action is executing.
|
|
74
|
+
// But it can be achieved only if the main action is a command and the content supports reporting operation finished (otherwise we won't know how to manually execute the cancellation response).
|
|
75
|
+
const addCancelAsCommand = action.command && ('onOperationFinished' in content);
|
|
73
76
|
return (await interactionManager.requestInteraction({
|
|
74
77
|
title,
|
|
75
78
|
content,
|
|
76
79
|
responses: [
|
|
77
80
|
action,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
addCancelAsCommand ?
|
|
82
|
+
new InteractionResponse_1.InteractionResponse(CommonInteractionResponses_1.CommonInteractionResponses.cancel.id, CommonInteractionResponses_1.CommonInteractionResponses.cancel.response.title,
|
|
83
|
+
// A Cancel action that becomes disabled when the OK command (if exists) is active:
|
|
84
|
+
new commands_1.RelayCommand(() => content?.onOperationFinished?.call(CommonInteractionResponses_1.CommonInteractionResponses.cancel.id), () => action.command?.workingFlag?.isActive !== true))
|
|
85
|
+
: CommonInteractionResponses_1.CommonInteractionResponses.cancel.response,
|
|
81
86
|
],
|
|
82
87
|
defaultActionId: action.id,
|
|
83
88
|
cancelActionId: CommonInteractionResponses_1.CommonInteractionResponses.cancel.id,
|