@cratis/components 2.4.0 → 2.5.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/dist/cjs/CommandDialog/CommandDialog.js +5 -4
- package/dist/cjs/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/cjs/CommandDialog/CommandStepper.js +5 -4
- package/dist/cjs/CommandDialog/CommandStepper.js.map +1 -1
- package/dist/cjs/CommandDialog/StepperCommandDialog.js +5 -4
- package/dist/cjs/CommandDialog/StepperCommandDialog.js.map +1 -1
- package/dist/cjs/CommandDialog/applyBeforeExecute.js +42 -0
- package/dist/cjs/CommandDialog/applyBeforeExecute.js.map +1 -0
- package/dist/cjs/CommandDialog/index.js +2 -0
- package/dist/cjs/CommandDialog/index.js.map +1 -1
- package/dist/cjs/Common/Icon.js +14 -3
- package/dist/cjs/Common/Icon.js.map +1 -1
- package/dist/cjs/Common/index.js +2 -0
- package/dist/cjs/Common/index.js.map +1 -1
- package/dist/cjs/Common/normalizeIconClass.js +48 -0
- package/dist/cjs/Common/normalizeIconClass.js.map +1 -0
- package/dist/cjs/tailwind-utilities.css +7 -7
- package/dist/esm/CommandDialog/CommandDialog.d.ts +3 -1
- package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.js +5 -4
- package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/esm/CommandDialog/CommandStepper.d.ts +3 -1
- package/dist/esm/CommandDialog/CommandStepper.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandStepper.js +5 -4
- package/dist/esm/CommandDialog/CommandStepper.js.map +1 -1
- package/dist/esm/CommandDialog/StepperCommandDialog.d.ts +3 -1
- package/dist/esm/CommandDialog/StepperCommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/StepperCommandDialog.js +5 -4
- package/dist/esm/CommandDialog/StepperCommandDialog.js.map +1 -1
- package/dist/esm/CommandDialog/applyBeforeExecute.d.ts +3 -0
- package/dist/esm/CommandDialog/applyBeforeExecute.d.ts.map +1 -0
- package/dist/esm/CommandDialog/applyBeforeExecute.js +40 -0
- package/dist/esm/CommandDialog/applyBeforeExecute.js.map +1 -0
- package/dist/esm/CommandDialog/index.d.ts +1 -0
- package/dist/esm/CommandDialog/index.d.ts.map +1 -1
- package/dist/esm/CommandDialog/index.js +1 -0
- package/dist/esm/CommandDialog/index.js.map +1 -1
- package/dist/esm/Common/Icon.d.ts.map +1 -1
- package/dist/esm/Common/Icon.js +14 -3
- package/dist/esm/Common/Icon.js.map +1 -1
- package/dist/esm/Common/index.d.ts +1 -0
- package/dist/esm/Common/index.d.ts.map +1 -1
- package/dist/esm/Common/index.js +1 -0
- package/dist/esm/Common/index.js.map +1 -1
- package/dist/esm/Common/normalizeIconClass.d.ts +6 -0
- package/dist/esm/Common/normalizeIconClass.d.ts.map +1 -0
- package/dist/esm/Common/normalizeIconClass.js +46 -0
- package/dist/esm/Common/normalizeIconClass.js.map +1 -0
- package/dist/esm/tailwind-utilities.css +7 -7
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -5,6 +5,7 @@ var dialogs = require('@cratis/arc.react/dialogs');
|
|
|
5
5
|
var Dialog = require('../Dialogs/Dialog.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var commands = require('@cratis/arc.react/commands');
|
|
8
|
+
var applyBeforeExecute = require('./applyBeforeExecute.js');
|
|
8
9
|
|
|
9
10
|
const CommandDialogWrapper = ({ title, visible, width, style, contentStyle, resizable, buttons, okLabel, cancelLabel, yesLabel, noLabel, isValid, onClose, onConfirm, onCancel, onSuccess, onValidationFailure, onFailed, onBeforeExecute, className, pt, ptOptions, unstyled, children }) => {
|
|
10
11
|
const { setCommandValues, setCommandResult, isValid: isCommandFormValid } = commands.useCommandFormContext();
|
|
@@ -12,8 +13,8 @@ const CommandDialogWrapper = ({ title, visible, width, style, contentStyle, resi
|
|
|
12
13
|
const [isBusy, setIsBusy] = React.useState(false);
|
|
13
14
|
const handleConfirm = async () => {
|
|
14
15
|
if (onBeforeExecute) {
|
|
15
|
-
const
|
|
16
|
-
setCommandValues(
|
|
16
|
+
const applied = applyBeforeExecute.applyBeforeExecute(onBeforeExecute, commandInstance);
|
|
17
|
+
setCommandValues(applied instanceof Promise ? await applied : applied);
|
|
17
18
|
}
|
|
18
19
|
setIsBusy(true);
|
|
19
20
|
let result;
|
|
@@ -156,8 +157,8 @@ const CommandDialogWrapper = ({ title, visible, width, style, contentStyle, resi
|
|
|
156
157
|
* @param props - {@link CommandDialogProps}.
|
|
157
158
|
*/
|
|
158
159
|
const CommandDialogComponent = (props) => {
|
|
159
|
-
const { title, visible, width, style, contentStyle, resizable, buttons = dialogs.DialogButtons.OkCancel, okLabel, cancelLabel, yesLabel, noLabel, isValid, onClose, onConfirm, onCancel, className, pt, ptOptions, unstyled, children, ...commandFormProps } = props;
|
|
160
|
-
return (jsxRuntime.jsx(commands.CommandForm, { ...commandFormProps, children: jsxRuntime.jsx(CommandDialogWrapper, { title: title, visible: visible, width: width, style: style, contentStyle: contentStyle, resizable: resizable, buttons: buttons, okLabel: okLabel, cancelLabel: cancelLabel, yesLabel: yesLabel, noLabel: noLabel, isValid: isValid, onClose: onClose, onConfirm: onConfirm, onCancel: onCancel, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onBeforeExecute:
|
|
160
|
+
const { title, visible, width, style, contentStyle, resizable, buttons = dialogs.DialogButtons.OkCancel, okLabel, cancelLabel, yesLabel, noLabel, isValid, onClose, onConfirm, onCancel, onBeforeExecute, className, pt, ptOptions, unstyled, children, ...commandFormProps } = props;
|
|
161
|
+
return (jsxRuntime.jsx(commands.CommandForm, { ...commandFormProps, children: jsxRuntime.jsx(CommandDialogWrapper, { title: title, visible: visible, width: width, style: style, contentStyle: contentStyle, resizable: resizable, buttons: buttons, okLabel: okLabel, cancelLabel: cancelLabel, yesLabel: yesLabel, noLabel: noLabel, isValid: isValid, onClose: onClose, onConfirm: onConfirm, onCancel: onCancel, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onBeforeExecute: onBeforeExecute, className: className, pt: pt, ptOptions: ptOptions, unstyled: unstyled, children: children }) }));
|
|
161
162
|
};
|
|
162
163
|
const CommandDialogColumnWrapper = ({ children }) => (jsxRuntime.jsx(commands.CommandForm.Column, { children: children }));
|
|
163
164
|
CommandDialogColumnWrapper.displayName = 'CommandFormColumn';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":[null],"names":["useCommandFormContext","useCommandInstance","useState","DialogResult","_jsx","CommandFormFieldWrapper","Dialog","DialogButtons","CommandForm"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":[null],"names":["useCommandFormContext","useCommandInstance","useState","applyBeforeExecute","DialogResult","_jsx","CommandFormFieldWrapper","Dialog","DialogButtons","CommandForm"],"mappings":";;;;;;;;;AAmDA,MAAM,oBAAoB,GAAG,CAA8C,EACvE,KAAK,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,YAAY,EACZ,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,eAAe,EACf,SAAS,EACT,EAAE,EACF,SAAS,EACT,QAAQ,EACR,QAAQ,EA0BX,KAAI;AACD,IAAA,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAGA,8BAAqB,EAAY;AAC7G,IAAA,MAAM,eAAe,GAAGC,2BAAkB,EAAY;IACtD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;AAE3C,IAA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E,QAAQ,EAAA,QAAA,EAEjB,QAAQ,EAAA,CACU,EAAA,CACb;AAEtB,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,EAAE,QAAQ,EAAiC,MAC3EA,cAAA,CAACI,oBAAW,CAAC,MAAM,cAAE,QAAQ,EAAA,CAAsB,CACtD;AACD,0BAA0B,CAAC,WAAW,GAAG,mBAAmB;AAE5D,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAEnD,MAAM,aAAa,GAAG;;;;"}
|
|
@@ -5,6 +5,7 @@ var React = require('react');
|
|
|
5
5
|
var stepper = require('primereact/stepper');
|
|
6
6
|
var button = require('primereact/button');
|
|
7
7
|
var commands = require('@cratis/arc.react/commands');
|
|
8
|
+
var applyBeforeExecute = require('./applyBeforeExecute.js');
|
|
8
9
|
require('./CommandStepper.css');
|
|
9
10
|
|
|
10
11
|
/** Extracts the property name from an accessor function like `c => c.name`. */
|
|
@@ -134,8 +135,8 @@ const CommandStepperWrapper = ({ children, onStepErrorsChange, showNavigation, s
|
|
|
134
135
|
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
135
136
|
const handleSubmit = async () => {
|
|
136
137
|
if (onBeforeExecute) {
|
|
137
|
-
const
|
|
138
|
-
setCommandValues(
|
|
138
|
+
const applied = applyBeforeExecute.applyBeforeExecute(onBeforeExecute, commandInstance);
|
|
139
|
+
setCommandValues(applied instanceof Promise ? await applied : applied);
|
|
139
140
|
}
|
|
140
141
|
setIsSubmitting(true);
|
|
141
142
|
let result;
|
|
@@ -220,8 +221,8 @@ const CommandStepperWrapper = ({ children, onStepErrorsChange, showNavigation, s
|
|
|
220
221
|
* @param props - {@link CommandStepperProps}.
|
|
221
222
|
*/
|
|
222
223
|
const CommandStepper = (props) => {
|
|
223
|
-
const { children, onStepErrorsChange, showNavigation, showSubmit, nextLabel, previousLabel, okLabel, isBusy, orientation, headerPosition, linear, onChangeStep, start, end, pt, ptOptions, unstyled, ...commandFormProps } = props;
|
|
224
|
-
return (jsxRuntime.jsx(commands.CommandForm, { ...commandFormProps, children: jsxRuntime.jsx(CommandStepperWrapper, { onStepErrorsChange: onStepErrorsChange, showNavigation: showNavigation, showSubmit: showSubmit, nextLabel: nextLabel, previousLabel: previousLabel, okLabel: okLabel, isBusy: isBusy, orientation: orientation, headerPosition: headerPosition, linear: linear, onChangeStep: onChangeStep, start: start, end: end, pt: pt, ptOptions: ptOptions, unstyled: unstyled, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onBeforeExecute:
|
|
224
|
+
const { children, onStepErrorsChange, showNavigation, showSubmit, nextLabel, previousLabel, okLabel, isBusy, orientation, headerPosition, linear, onChangeStep, start, end, pt, ptOptions, unstyled, onBeforeExecute, ...commandFormProps } = props;
|
|
225
|
+
return (jsxRuntime.jsx(commands.CommandForm, { ...commandFormProps, children: jsxRuntime.jsx(CommandStepperWrapper, { onStepErrorsChange: onStepErrorsChange, showNavigation: showNavigation, showSubmit: showSubmit, nextLabel: nextLabel, previousLabel: previousLabel, okLabel: okLabel, isBusy: isBusy, orientation: orientation, headerPosition: headerPosition, linear: linear, onChangeStep: onChangeStep, start: start, end: end, pt: pt, ptOptions: ptOptions, unstyled: unstyled, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onBeforeExecute: onBeforeExecute, children: children }) }));
|
|
225
226
|
};
|
|
226
227
|
|
|
227
228
|
exports.CommandStepper = CommandStepper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandStepper.js","sources":["../../../CommandDialog/CommandStepper.tsx"],"sourcesContent":[null],"names":["_jsx","CommandFormFieldWrapper","useMemo","useEffect","_jsxs","PrimeStepper","Button","useCommandFormContext","useCommandInstance","useState","CommandForm"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommandStepper.js","sources":["../../../CommandDialog/CommandStepper.tsx"],"sourcesContent":[null],"names":["_jsx","CommandFormFieldWrapper","useMemo","useEffect","_jsxs","PrimeStepper","Button","use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AK,CAAC,mBAAmB,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,eAAe,EAAE,eAAe,YAE/B,QAAQ,EAAA,CACW,EAAA,CACd;AAEtB;;;;;"}
|
|
@@ -7,6 +7,7 @@ var button = require('primereact/button');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var commands = require('@cratis/arc.react/commands');
|
|
9
9
|
var CommandStepper = require('./CommandStepper.js');
|
|
10
|
+
var applyBeforeExecute = require('./applyBeforeExecute.js');
|
|
10
11
|
|
|
11
12
|
const StepperCommandDialogWrapper = ({ title, visible = true, width = '600px', style, contentStyle, resizable = false, isValid, onClose, onConfirm, onCancel, onSuccess, onValidationFailure, onFailed, onBeforeExecute, okLabel = 'Submit', nextLabel = 'Next', previousLabel = 'Previous', orientation = 'horizontal', headerPosition, linear = true, onChangeStep, start, end, pt, ptOptions, unstyled, dialogClassName, dialogPt, dialogPtOptions, dialogUnstyled, children }) => {
|
|
12
13
|
const { setCommandValues, setCommandResult, isValid: isCommandFormValid, getFieldError } = commands.useCommandFormContext();
|
|
@@ -59,8 +60,8 @@ const StepperCommandDialogWrapper = ({ title, visible = true, width = '600px', s
|
|
|
59
60
|
};
|
|
60
61
|
const handleSubmit = async () => {
|
|
61
62
|
if (onBeforeExecute) {
|
|
62
|
-
const
|
|
63
|
-
setCommandValues(
|
|
63
|
+
const applied = applyBeforeExecute.applyBeforeExecute(onBeforeExecute, commandInstance);
|
|
64
|
+
setCommandValues(applied instanceof Promise ? await applied : applied);
|
|
64
65
|
}
|
|
65
66
|
setIsBusy(true);
|
|
66
67
|
let result;
|
|
@@ -177,8 +178,8 @@ const StepperCommandDialogWrapper = ({ title, visible = true, width = '600px', s
|
|
|
177
178
|
* @param props - {@link StepperCommandDialogProps}.
|
|
178
179
|
*/
|
|
179
180
|
const StepperCommandDialogComponent = (props) => {
|
|
180
|
-
const { title, visible, width, style, contentStyle, resizable, isValid, onClose, onConfirm, onCancel, okLabel, nextLabel, previousLabel, orientation, headerPosition, linear, onChangeStep, start, end, pt, ptOptions, unstyled, dialogClassName, dialogPt, dialogPtOptions, dialogUnstyled, children, ...commandFormProps } = props;
|
|
181
|
-
return (jsxRuntime.jsx(commands.CommandForm, { ...commandFormProps, children: jsxRuntime.jsx(StepperCommandDialogWrapper, { title: title, visible: visible, width: width, style: style, contentStyle: contentStyle, resizable: resizable, isValid: isValid, onClose: onClose, onConfirm: onConfirm, onCancel: onCancel, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onBeforeExecute:
|
|
181
|
+
const { title, visible, width, style, contentStyle, resizable, isValid, onClose, onConfirm, onCancel, onBeforeExecute, okLabel, nextLabel, previousLabel, orientation, headerPosition, linear, onChangeStep, start, end, pt, ptOptions, unstyled, dialogClassName, dialogPt, dialogPtOptions, dialogUnstyled, children, ...commandFormProps } = props;
|
|
182
|
+
return (jsxRuntime.jsx(commands.CommandForm, { ...commandFormProps, children: jsxRuntime.jsx(StepperCommandDialogWrapper, { title: title, visible: visible, width: width, style: style, contentStyle: contentStyle, resizable: resizable, isValid: isValid, onClose: onClose, onConfirm: onConfirm, onCancel: onCancel, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onBeforeExecute: onBeforeExecute, okLabel: okLabel, nextLabel: nextLabel, previousLabel: previousLabel, orientation: orientation, headerPosition: headerPosition, linear: linear, onChangeStep: onChangeStep, start: start, end: end, pt: pt, ptOptions: ptOptions, unstyled: unstyled, dialogClassName: dialogClassName, dialogPt: dialogPt, dialogPtOptions: dialogPtOptions, dialogUnstyled: dialogUnstyled, children: children }) }));
|
|
182
183
|
};
|
|
183
184
|
const StepperCommandDialog = StepperCommandDialogComponent;
|
|
184
185
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepperCommandDialog.js","sources":["../../../CommandDialog/StepperCommandDialog.tsx"],"sourcesContent":[null],"names":["useCommandFormContext","useCommandInstance","useState","useDialogContext","DialogResult","_jsx","_jsxs","Button","PrimeDialog","CommandStepperContent","CommandForm"],"mappings":"
|
|
1
|
+
{"version":3,"file":"StepperCommandDialog.js","sources":["../../../CommandDialog/StepperCommandDialog.tsx"],"sourcesContent":[null],"names":["useCommandFormContext","useCommandInstance","useState","useDialogContext","DialogResult","applyBeforeExecute","_jsx","_jsxs","Button","PrimeDialog","CommandStepperContent","CommandForm"],"mappings":";;;;;;;;;;;AAuFA,MAAM,2BAA2B,GAAG,CAA8C,EAC9E,KAAK,EACL,OAAO,GAAG,IAAI,EACd,KAAK,GAAG,OAAO,EACf,KAAK,EACL,YAAY,EACZ,SAAS,GAAG,KAAK,EACjB,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,eAAe,EACf,OAAO,GAAG,QAAQ,EAClB,SAAS,GAAG,MAAM,EAClB,aAAa,GAAG,UAAU,EAC1B,WAAW,GAAG,YAAY,EAC1B,cAAc,EACd,MAAM,GAAG,IAAI,EACb,YAAY,EACZ,KAAK,EACL,GAAG,EACH,EAAE,EACF,SAAS,EACT,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,eAAe,EACf,cAAc,EACd,QAAQ,EAwBiB,KAAI;AAC7B,IAAA,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,GAAGA,8BAAqB,EAAY;AAC5H,IAAA,MAAM,eAAe,GAAGC,2BAAkB,EAAY;IACtD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;IAC3C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAC,CAAC,CAAC;AAC/C,IAAA,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGA,cAAQ,CAAc,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC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EAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAAA,QAAA,EAE7B,QAAQ,EAAA,CACiB,EAAA,CACpB;AAEtB,CAAC;AAEM,MAAM,oBAAoB,GAAG;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Applies an `onBeforeExecute` transformer safely.
|
|
7
|
+
*
|
|
8
|
+
* The typed callback contract requires the transformed values to be returned, but
|
|
9
|
+
* JavaScript consumers (and mistyped call sites) can still return `undefined` by
|
|
10
|
+
* using the callback as a side-effect hook. Executing with `undefined` would wipe
|
|
11
|
+
* every command value — silent data loss at submit time. This guard treats a
|
|
12
|
+
* missing return as "keep the current values" and warns, so the command always
|
|
13
|
+
* executes with a real object.
|
|
14
|
+
*
|
|
15
|
+
* A **synchronous** callback is applied synchronously (the result is returned
|
|
16
|
+
* directly, not wrapped in a promise) so the command values are set before the same
|
|
17
|
+
* tick's execution proceeds; an **async** callback returns a promise to await.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam TCommand - The command values type.
|
|
20
|
+
* @param onBeforeExecute - The transformer to apply (sync or async).
|
|
21
|
+
* @param currentValues - The command values to transform.
|
|
22
|
+
* @returns The transformed values, or `currentValues` when the callback returned nothing.
|
|
23
|
+
*/
|
|
24
|
+
function applyBeforeExecute(onBeforeExecute, currentValues) {
|
|
25
|
+
const transformed = onBeforeExecute(currentValues);
|
|
26
|
+
if (transformed instanceof Promise) {
|
|
27
|
+
return transformed.then((resolved) => keepCurrentWhenMissing(resolved, currentValues));
|
|
28
|
+
}
|
|
29
|
+
return keepCurrentWhenMissing(transformed, currentValues);
|
|
30
|
+
}
|
|
31
|
+
function keepCurrentWhenMissing(transformed, currentValues) {
|
|
32
|
+
if (transformed === undefined) {
|
|
33
|
+
console.warn('onBeforeExecute returned no value. It is a transformer and must return the command values ' +
|
|
34
|
+
'(mutated or not). Keeping the current values so the command does not execute with undefined. ' +
|
|
35
|
+
'If you only need a side effect, return the values you received.');
|
|
36
|
+
return currentValues;
|
|
37
|
+
}
|
|
38
|
+
return transformed;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.applyBeforeExecute = applyBeforeExecute;
|
|
42
|
+
//# sourceMappingURL=applyBeforeExecute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyBeforeExecute.js","sources":["../../../CommandDialog/applyBeforeExecute.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;AAiBA;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,kBAAkB,CAC9B,eAAgD,EAChD,aAAuB,EAAA;AAEvB,IAAA,MAAM,WAAW,GAAG,eAAe,CAAC,aAAa,CAAC;AAClD,IAAA,IAAI,WAAW,YAAY,OAAO,EAAE;AAChC,QAAA,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,sBAAsB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAC1F;AACA,IAAA,OAAO,sBAAsB,CAAC,WAAW,EAAE,aAAa,CAAC;AAC7D;AAEA,SAAS,sBAAsB,CAAW,WAAiC,EAAE,aAAuB,EAAA;AAChG,IAAA,IAAI,WAAW,KAAK,SAAS,EAAE;QAC3B,OAAO,CAAC,IAAI,CACR,4FAA4F;YAC5F,+FAA+F;AAC/F,YAAA,iEAAiE,CACpE;AACD,QAAA,OAAO,aAAa;IACxB;AACA,IAAA,OAAO,WAAW;AACtB;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var applyBeforeExecute = require('./applyBeforeExecute.js');
|
|
3
4
|
var CommandDialog = require('./CommandDialog.js');
|
|
4
5
|
var CommandStepper = require('./CommandStepper.js');
|
|
5
6
|
var StepperCommandDialog = require('./StepperCommandDialog.js');
|
|
@@ -7,6 +8,7 @@ var StepperCommandDialog = require('./StepperCommandDialog.js');
|
|
|
7
8
|
// Copyright (c) Cratis. All rights reserved.
|
|
8
9
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
10
|
|
|
11
|
+
exports.applyBeforeExecute = applyBeforeExecute.applyBeforeExecute;
|
|
10
12
|
exports.CommandDialog = CommandDialog.CommandDialog;
|
|
11
13
|
exports.CommandStepper = CommandStepper.CommandStepper;
|
|
12
14
|
exports.CommandStepperContent = CommandStepper.CommandStepperContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../CommandDialog/index.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../CommandDialog/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;AACA;;;;;;;;"}
|
package/dist/cjs/Common/Icon.js
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var normalizeIconClass = require('./normalizeIconClass.js');
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Renders an {@link Icon} value.
|
|
7
8
|
*
|
|
8
9
|
* - When `icon` is a non-empty string it is treated as a PrimeIcons (or other icon-font)
|
|
9
|
-
* CSS class and rendered as `<i className={icon} />`.
|
|
10
|
+
* CSS class and rendered as `<i className={icon} />`. A lone PrimeIcons class missing its
|
|
11
|
+
* base `pi` class (`'pi-home'`) is repaired to `'pi pi-home'`, and a bare icon name
|
|
12
|
+
* (`'plus'`) that would silently render nothing logs a development warning.
|
|
10
13
|
* - Otherwise the value is rendered as-is, allowing any React node (SVG, component, etc.)
|
|
11
14
|
* to be used as an icon.
|
|
12
15
|
*/
|
|
13
16
|
const IconDisplay = ({ icon, className }) => {
|
|
14
|
-
if (typeof icon === 'string'
|
|
15
|
-
const
|
|
17
|
+
if (typeof icon === 'string') {
|
|
18
|
+
const { className: resolved, warning } = normalizeIconClass.normalizeIconClass(icon);
|
|
19
|
+
const isDevelopment = typeof process === 'undefined' || process.env.NODE_ENV !== 'production';
|
|
20
|
+
if (warning && isDevelopment) {
|
|
21
|
+
console.warn(warning);
|
|
22
|
+
}
|
|
23
|
+
if (resolved.length === 0) {
|
|
24
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
25
|
+
}
|
|
26
|
+
const combined = className ? `${resolved} ${className}` : resolved;
|
|
16
27
|
return jsxRuntime.jsx("i", { className: combined });
|
|
17
28
|
}
|
|
18
29
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: icon });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sources":["../../../Common/Icon.tsx"],"sourcesContent":[null],"names":["_jsx","_Fragment"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Icon.js","sources":["../../../Common/Icon.tsx"],"sourcesContent":[null],"names":["normalizeIconClass","_jsx","_Fragment"],"mappings":";;;;;AA0BA;;;;;;;;;AASG;AACI,MAAM,WAAW,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAAoB,KAAI;AACjE,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC1B,QAAA,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAGA,qCAAkB,CAAC,IAAI,CAAC;AACjE,QAAA,MAAM,aAAa,GAAG,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;AAC7F,QAAA,IAAI,OAAO,IAAI,aAAa,EAAE;AAC1B,YAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QACzB;AACA,QAAA,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACvB,YAAA,OAAOC,uCAAK;QAChB;AACA,QAAA,MAAM,QAAQ,GAAG,SAAS,GAAG,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,SAAS,CAAA,CAAE,GAAG,QAAQ;AAClE,QAAA,OAAOA,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,QAAQ,GAAI;IACrC;IACA,OAAOA,cAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAG,IAAI,EAAA,CAAI;AACtB;;;;"}
|
package/dist/cjs/Common/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var CratisComponentsProvider = require('./CratisComponentsProvider.js');
|
|
4
4
|
var ErrorBoundary = require('./ErrorBoundary.js');
|
|
5
5
|
var Icon = require('./Icon.js');
|
|
6
|
+
var normalizeIconClass = require('./normalizeIconClass.js');
|
|
6
7
|
var Page = require('./Page.js');
|
|
7
8
|
var FormElement = require('./FormElement.js');
|
|
8
9
|
var Tooltip = require('./Tooltip.js');
|
|
@@ -15,6 +16,7 @@ exports.cratisDefaults = CratisComponentsProvider.cratisDefaults;
|
|
|
15
16
|
exports.mergeCratisComponentsConfig = CratisComponentsProvider.mergeCratisComponentsConfig;
|
|
16
17
|
exports.ErrorBoundary = ErrorBoundary.ErrorBoundary;
|
|
17
18
|
exports.IconDisplay = Icon.IconDisplay;
|
|
19
|
+
exports.normalizeIconClass = normalizeIconClass.normalizeIconClass;
|
|
18
20
|
exports.Page = Page.Page;
|
|
19
21
|
exports.FormElement = FormElement.FormElement;
|
|
20
22
|
exports.Tooltip = Tooltip.Tooltip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../Common/index.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../Common/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAAA;AACA;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Normalizes a string icon value into a CSS class for {@link IconDisplay}.
|
|
7
|
+
*
|
|
8
|
+
* A string icon is meant to be a full icon-font CSS class such as `'pi pi-home'`. Two
|
|
9
|
+
* mistakes silently render nothing — and look like the icon "just doesn't work":
|
|
10
|
+
*
|
|
11
|
+
* - A lone PrimeIcons class (`'pi-home'`) missing its required base `pi` class. This is
|
|
12
|
+
* unambiguous, so it is repaired to `'pi pi-home'`.
|
|
13
|
+
* - A bare icon name (`'plus'`, `'home'`) that is not a CSS class at all. There is no safe
|
|
14
|
+
* way to know which icon font it belongs to, so the value is left untouched and a warning
|
|
15
|
+
* is produced pointing at the full class (`'pi pi-plus'`) or a React node.
|
|
16
|
+
*
|
|
17
|
+
* Full class strings (anything containing whitespace) and already-prefixed values pass
|
|
18
|
+
* through unchanged.
|
|
19
|
+
*
|
|
20
|
+
* @param icon - The raw string icon value.
|
|
21
|
+
* @returns The class to render and an optional developer warning.
|
|
22
|
+
*/
|
|
23
|
+
function normalizeIconClass(icon) {
|
|
24
|
+
const trimmed = icon.trim();
|
|
25
|
+
if (trimmed.length === 0) {
|
|
26
|
+
return { className: '' };
|
|
27
|
+
}
|
|
28
|
+
// A full class string (multiple tokens) is taken as-is — the caller spelled it out.
|
|
29
|
+
if (trimmed.includes(' ')) {
|
|
30
|
+
return { className: trimmed };
|
|
31
|
+
}
|
|
32
|
+
// A lone PrimeIcons icon class missing its base `pi` class — repair it.
|
|
33
|
+
if (trimmed.startsWith('pi-')) {
|
|
34
|
+
return { className: `pi pi-${trimmed.slice('pi-'.length)}` };
|
|
35
|
+
}
|
|
36
|
+
// A single plain word (no hyphen, no prefix) is almost certainly a bare icon name that
|
|
37
|
+
// will not render. Leave rendering untouched but guide the caller to the real class.
|
|
38
|
+
if (trimmed !== 'pi' && /^[a-z][a-z0-9]*$/i.test(trimmed)) {
|
|
39
|
+
return {
|
|
40
|
+
className: trimmed,
|
|
41
|
+
warning: `IconDisplay received '${trimmed}', which looks like a bare icon name rather than a CSS class, so it will not render as an icon. Use a full icon class such as 'pi pi-${trimmed}', or pass a React node.`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return { className: trimmed };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
exports.normalizeIconClass = normalizeIconClass;
|
|
48
|
+
//# sourceMappingURL=normalizeIconClass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeIconClass.js","sources":["../../../Common/normalizeIconClass.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;AAeA;;;;;;;;;;;;;;;;;AAiBG;AACG,SAAU,kBAAkB,CAAC,IAAY,EAAA;AAC3C,IAAA,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE;AAC3B,IAAA,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;AACtB,QAAA,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5B;;AAGA,IAAA,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AACvB,QAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE;IACjC;;AAGA,IAAA,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;AAC3B,QAAA,OAAO,EAAE,SAAS,EAAE,CAAA,MAAA,EAAS,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA,CAAE,EAAE;IAChE;;;IAIA,IAAI,OAAO,KAAK,IAAI,IAAI,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QACvD,OAAO;AACH,YAAA,SAAS,EAAE,OAAO;AAClB,YAAA,OAAO,EAAE,CAAA,sBAAA,EAAyB,OAAO,CAAA,qIAAA,EAAwI,OAAO,CAAA,wBAAA,CAA0B;SACrN;IACL;AAEA,IAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE;AACjC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.
|
|
1
|
+
/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
4
|
@layer theme {
|
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
.m-0 {
|
|
313
|
-
margin:
|
|
313
|
+
margin: 0;
|
|
314
314
|
}
|
|
315
315
|
.m-3 {
|
|
316
316
|
margin: calc(var(--spacing) * 3);
|
|
@@ -319,7 +319,7 @@
|
|
|
319
319
|
margin-inline: calc(var(--spacing) * 2);
|
|
320
320
|
}
|
|
321
321
|
.mt-1 {
|
|
322
|
-
margin-top:
|
|
322
|
+
margin-top: var(--spacing);
|
|
323
323
|
}
|
|
324
324
|
.mt-2 {
|
|
325
325
|
margin-top: calc(var(--spacing) * 2);
|
|
@@ -334,7 +334,7 @@
|
|
|
334
334
|
margin-right: calc(var(--spacing) * 2);
|
|
335
335
|
}
|
|
336
336
|
.mb-0 {
|
|
337
|
-
margin-bottom:
|
|
337
|
+
margin-bottom: 0;
|
|
338
338
|
}
|
|
339
339
|
.mb-2 {
|
|
340
340
|
margin-bottom: calc(var(--spacing) * 2);
|
|
@@ -459,7 +459,7 @@
|
|
|
459
459
|
justify-content: flex-start;
|
|
460
460
|
}
|
|
461
461
|
.gap-1 {
|
|
462
|
-
gap:
|
|
462
|
+
gap: var(--spacing);
|
|
463
463
|
}
|
|
464
464
|
.gap-2 {
|
|
465
465
|
gap: calc(var(--spacing) * 2);
|
|
@@ -591,7 +591,7 @@
|
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
593
|
.p-1 {
|
|
594
|
-
padding:
|
|
594
|
+
padding: var(--spacing);
|
|
595
595
|
}
|
|
596
596
|
.p-2 {
|
|
597
597
|
padding: calc(var(--spacing) * 2);
|
|
@@ -618,7 +618,7 @@
|
|
|
618
618
|
padding-inline: calc(var(--spacing) * 5);
|
|
619
619
|
}
|
|
620
620
|
.py-1 {
|
|
621
|
-
padding-block:
|
|
621
|
+
padding-block: var(--spacing);
|
|
622
622
|
}
|
|
623
623
|
.py-1\.5 {
|
|
624
624
|
padding-block: calc(var(--spacing) * 1.5);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type DialogProps } from '../Dialogs/Dialog';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { type CommandFormProps } from '@cratis/arc.react/commands';
|
|
4
|
-
|
|
4
|
+
import { type BeforeExecuteCallback } from './applyBeforeExecute';
|
|
5
|
+
export interface CommandDialogProps<TCommand extends object, TResponse = object> extends Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>, Omit<DialogProps, 'children'> {
|
|
6
|
+
onBeforeExecute?: BeforeExecuteCallback<TCommand>;
|
|
5
7
|
children?: React.ReactNode;
|
|
6
8
|
}
|
|
7
9
|
export declare const CommandDialog: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAKH,KAAK,gBAAgB,EACxB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"CommandDialog.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAKH,KAAK,gBAAgB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAsB,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAWtF,MAAM,WAAW,kBAAkB,CAAC,QAAQ,SAAS,MAAM,EAAE,SAAS,GAAG,MAAM,CAC3E,SAAQ,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,iBAAiB,CAAC,EAC/E,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC;IAcjC,eAAe,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAOlD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAkTD,eAAO,MAAM,aAAa;KAlEM,QAAQ,SAAS,MAAM,WAAW,SAAS,kBAAkB,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC;;uBA2DlF;YAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;SAAE;;;CAO5B,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { DialogButtons, DialogResult } from '@cratis/arc.react/dialogs';
|
|
|
3
3
|
import { Dialog } from '../Dialogs/Dialog.js';
|
|
4
4
|
import React, { useState } from 'react';
|
|
5
5
|
import { CommandForm, useCommandFormContext, useCommandInstance, CommandFormFieldWrapper } from '@cratis/arc.react/commands';
|
|
6
|
+
import { applyBeforeExecute } from './applyBeforeExecute.js';
|
|
6
7
|
|
|
7
8
|
const CommandDialogWrapper = ({ title, visible, width, style, contentStyle, resizable, buttons, okLabel, cancelLabel, yesLabel, noLabel, isValid, onClose, onConfirm, onCancel, onSuccess, onValidationFailure, onFailed, onBeforeExecute, className, pt, ptOptions, unstyled, children }) => {
|
|
8
9
|
const { setCommandValues, setCommandResult, isValid: isCommandFormValid } = useCommandFormContext();
|
|
@@ -10,8 +11,8 @@ const CommandDialogWrapper = ({ title, visible, width, style, contentStyle, resi
|
|
|
10
11
|
const [isBusy, setIsBusy] = useState(false);
|
|
11
12
|
const handleConfirm = async () => {
|
|
12
13
|
if (onBeforeExecute) {
|
|
13
|
-
const
|
|
14
|
-
setCommandValues(
|
|
14
|
+
const applied = applyBeforeExecute(onBeforeExecute, commandInstance);
|
|
15
|
+
setCommandValues(applied instanceof Promise ? await applied : applied);
|
|
15
16
|
}
|
|
16
17
|
setIsBusy(true);
|
|
17
18
|
let result;
|
|
@@ -154,8 +155,8 @@ const CommandDialogWrapper = ({ title, visible, width, style, contentStyle, resi
|
|
|
154
155
|
* @param props - {@link CommandDialogProps}.
|
|
155
156
|
*/
|
|
156
157
|
const CommandDialogComponent = (props) => {
|
|
157
|
-
const { title, visible, width, style, contentStyle, resizable, buttons = DialogButtons.OkCancel, okLabel, cancelLabel, yesLabel, noLabel, isValid, onClose, onConfirm, onCancel, className, pt, ptOptions, unstyled, children, ...commandFormProps } = props;
|
|
158
|
-
return (jsx(CommandForm, { ...commandFormProps, children: jsx(CommandDialogWrapper, { title: title, visible: visible, width: width, style: style, contentStyle: contentStyle, resizable: resizable, buttons: buttons, okLabel: okLabel, cancelLabel: cancelLabel, yesLabel: yesLabel, noLabel: noLabel, isValid: isValid, onClose: onClose, onConfirm: onConfirm, onCancel: onCancel, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onBeforeExecute:
|
|
158
|
+
const { title, visible, width, style, contentStyle, resizable, buttons = DialogButtons.OkCancel, okLabel, cancelLabel, yesLabel, noLabel, isValid, onClose, onConfirm, onCancel, onBeforeExecute, className, pt, ptOptions, unstyled, children, ...commandFormProps } = props;
|
|
159
|
+
return (jsx(CommandForm, { ...commandFormProps, children: jsx(CommandDialogWrapper, { title: title, visible: visible, width: width, style: style, contentStyle: contentStyle, resizable: resizable, buttons: buttons, okLabel: okLabel, cancelLabel: cancelLabel, yesLabel: yesLabel, noLabel: noLabel, isValid: isValid, onClose: onClose, onConfirm: onConfirm, onCancel: onCancel, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onBeforeExecute: onBeforeExecute, className: className, pt: pt, ptOptions: ptOptions, unstyled: unstyled, children: children }) }));
|
|
159
160
|
};
|
|
160
161
|
const CommandDialogColumnWrapper = ({ children }) => (jsx(CommandForm.Column, { children: children }));
|
|
161
162
|
CommandDialogColumnWrapper.displayName = 'CommandFormColumn';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;AAmDA,MAAM,oBAAoB,GAAG,CAA8C,EACvE,KAAK,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,YAAY,EACZ,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,eAAe,EACf,SAAS,EACT,EAAE,EACF,SAAS,EACT,QAA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,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,EACpB,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAAA,QAAA,EAEjB,QAAQ,EAAA,CACU,EAAA,CACb;AAEtB,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,EAAE,QAAQ,EAAiC,MAC3EA,GAAA,CAAC,WAAW,CAAC,MAAM,cAAE,QAAQ,EAAA,CAAsB,CACtD;AACD,0BAA0B,CAAC,WAAW,GAAG,mBAAmB;AAE5D,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAEnD,MAAM,aAAa,GAAG;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type StepperProps } from 'primereact/stepper';
|
|
3
3
|
import { type CommandFormProps } from '@cratis/arc.react/commands';
|
|
4
|
+
import { type BeforeExecuteCallback } from './applyBeforeExecute';
|
|
4
5
|
import './CommandStepper.css';
|
|
5
6
|
export type StepperCustomizationProps = Pick<StepperProps, 'orientation' | 'headerPosition' | 'linear' | 'onChangeStep' | 'start' | 'end' | 'pt' | 'ptOptions' | 'unstyled'>;
|
|
6
7
|
export interface CommandStepperContentProps extends StepperCustomizationProps {
|
|
@@ -21,7 +22,8 @@ export interface CommandStepperContentProps extends StepperCustomizationProps {
|
|
|
21
22
|
isSubmitDisabled?: boolean;
|
|
22
23
|
onSubmit?: () => void | Promise<void>;
|
|
23
24
|
}
|
|
24
|
-
export interface CommandStepperProps<TCommand extends object, TResponse = object> extends Omit<CommandFormProps<TCommand, TResponse>, 'children'>, Omit<CommandStepperContentProps, 'activeStep' | 'visitedSteps' | 'onActiveStepChange' | 'onVisitedStepsChange' | 'getFieldError' | 'isSubmitting' | 'isSubmitDisabled' | 'onSubmit'> {
|
|
25
|
+
export interface CommandStepperProps<TCommand extends object, TResponse = object> extends Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>, Omit<CommandStepperContentProps, 'activeStep' | 'visitedSteps' | 'onActiveStepChange' | 'onVisitedStepsChange' | 'getFieldError' | 'isSubmitting' | 'isSubmitDisabled' | 'onSubmit'> {
|
|
26
|
+
onBeforeExecute?: BeforeExecuteCallback<TCommand>;
|
|
25
27
|
children?: React.ReactNode;
|
|
26
28
|
}
|
|
27
29
|
export declare const CommandStepperContent: ({ activeStep, visitedSteps, children, onActiveStepChange, onVisitedStepsChange, onStepErrorsChange, getFieldError, showNavigation, showSubmit, nextLabel, previousLabel, okLabel, isBusy, isSubmitting, isSubmitDisabled, onSubmit, orientation, headerPosition, linear, onChangeStep, start, end, pt, ptOptions, unstyled, }: CommandStepperContentProps) => React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandStepper.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandStepper.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGhF,OAAO,EAKH,KAAK,gBAAgB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,sBAAsB,CAAC;AAM9B,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,YAAY,EACrD,aAAa,GAAG,gBAAgB,GAAG,QAAQ,GAAG,cAAc,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,WAAW,GAAG,UAAU,CACnH,CAAC;AAEF,MAAM,WAAW,0BAA2B,SAAQ,yBAAyB;IAEzE,UAAU,EAAE,MAAM,CAAC;IAEnB,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAE1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3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e,GAAG,cAAc,GAAG,kBAAkB,GAAG,UAAU,CAAC;IAaxL,eAAe,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAElD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAmDD,eAAO,MAAM,qBAAqB,GAAI,+TA0BnC,0BAA0B,sBAqJ5B,CAAC;AAmKF,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,MAAM,GAAG,MAAM,EAAE,SAAS,GAAG,MAAM,EAC/E,OAAO,mBAAmB,CAAC,QAAQ,EAAE,SAAS,CAAC,sBAoDlD,CAAC"}
|
|
@@ -3,6 +3,7 @@ import React, { useMemo, useEffect, useState } from 'react';
|
|
|
3
3
|
import { Stepper } from 'primereact/stepper';
|
|
4
4
|
import { Button } from 'primereact/button';
|
|
5
5
|
import { CommandForm, useCommandFormContext, useCommandInstance, CommandFormFieldWrapper } from '@cratis/arc.react/commands';
|
|
6
|
+
import { applyBeforeExecute } from './applyBeforeExecute.js';
|
|
6
7
|
import './CommandStepper.css';
|
|
7
8
|
|
|
8
9
|
/** Extracts the property name from an accessor function like `c => c.name`. */
|
|
@@ -132,8 +133,8 @@ const CommandStepperWrapper = ({ children, onStepErrorsChange, showNavigation, s
|
|
|
132
133
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
133
134
|
const handleSubmit = async () => {
|
|
134
135
|
if (onBeforeExecute) {
|
|
135
|
-
const
|
|
136
|
-
setCommandValues(
|
|
136
|
+
const applied = applyBeforeExecute(onBeforeExecute, commandInstance);
|
|
137
|
+
setCommandValues(applied instanceof Promise ? await applied : applied);
|
|
137
138
|
}
|
|
138
139
|
setIsSubmitting(true);
|
|
139
140
|
let result;
|
|
@@ -218,8 +219,8 @@ const CommandStepperWrapper = ({ children, onStepErrorsChange, showNavigation, s
|
|
|
218
219
|
* @param props - {@link CommandStepperProps}.
|
|
219
220
|
*/
|
|
220
221
|
const CommandStepper = (props) => {
|
|
221
|
-
const { children, onStepErrorsChange, showNavigation, showSubmit, nextLabel, previousLabel, okLabel, isBusy, orientation, headerPosition, linear, onChangeStep, start, end, pt, ptOptions, unstyled, ...commandFormProps } = props;
|
|
222
|
-
return (jsx(CommandForm, { ...commandFormProps, children: jsx(CommandStepperWrapper, { onStepErrorsChange: onStepErrorsChange, showNavigation: showNavigation, showSubmit: showSubmit, nextLabel: nextLabel, previousLabel: previousLabel, okLabel: okLabel, isBusy: isBusy, orientation: orientation, headerPosition: headerPosition, linear: linear, onChangeStep: onChangeStep, start: start, end: end, pt: pt, ptOptions: ptOptions, unstyled: unstyled, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onBeforeExecute:
|
|
222
|
+
const { children, onStepErrorsChange, showNavigation, showSubmit, nextLabel, previousLabel, okLabel, isBusy, orientation, headerPosition, linear, onChangeStep, start, end, pt, ptOptions, unstyled, onBeforeExecute, ...commandFormProps } = props;
|
|
223
|
+
return (jsx(CommandForm, { ...commandFormProps, children: jsx(CommandStepperWrapper, { onStepErrorsChange: onStepErrorsChange, showNavigation: showNavigation, showSubmit: showSubmit, nextLabel: nextLabel, previousLabel: previousLabel, okLabel: okLabel, isBusy: isBusy, orientation: orientation, headerPosition: headerPosition, linear: linear, onChangeStep: onChangeStep, start: start, end: end, pt: pt, ptOptions: ptOptions, unstyled: unstyled, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onBeforeExecute: onBeforeExecute, children: children }) }));
|
|
223
224
|
};
|
|
224
225
|
|
|
225
226
|
export { CommandStepper, CommandStepperContent };
|