@cratis/components 1.0.3 → 1.0.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.
Files changed (30) hide show
  1. package/dist/cjs/CommandDialog/CommandDialog.js +26 -4
  2. package/dist/cjs/CommandDialog/CommandDialog.js.map +1 -1
  3. package/dist/cjs/Dialogs/BusyIndicatorDialog.js +1 -1
  4. package/dist/cjs/Dialogs/BusyIndicatorDialog.js.map +1 -1
  5. package/dist/esm/CommandDialog/CommandDialog.d.ts +21 -0
  6. package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
  7. package/dist/esm/CommandDialog/CommandDialog.js +28 -6
  8. package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
  9. package/dist/esm/CommandDialog/CommandDialog.stories.d.ts +10 -0
  10. package/dist/esm/CommandDialog/CommandDialog.stories.d.ts.map +1 -1
  11. package/dist/esm/CommandDialog/CommandDialog.stories.js +152 -1
  12. package/dist/esm/CommandDialog/CommandDialog.stories.js.map +1 -1
  13. package/dist/esm/DataPage/DataPage.stories.d.ts.map +1 -1
  14. package/dist/esm/DataPage/DataPage.stories.js +25 -2
  15. package/dist/esm/DataPage/DataPage.stories.js.map +1 -1
  16. package/dist/esm/DataTables/DataTableForObservableQuery.stories.d.ts.map +1 -1
  17. package/dist/esm/DataTables/DataTableForObservableQuery.stories.js +25 -2
  18. package/dist/esm/DataTables/DataTableForObservableQuery.stories.js.map +1 -1
  19. package/dist/esm/DataTables/DataTableForQuery.stories.d.ts.map +1 -1
  20. package/dist/esm/DataTables/DataTableForQuery.stories.js +25 -3
  21. package/dist/esm/DataTables/DataTableForQuery.stories.js.map +1 -1
  22. package/dist/esm/Dialogs/BusyIndicatorDialog.d.ts.map +1 -1
  23. package/dist/esm/Dialogs/BusyIndicatorDialog.js +2 -2
  24. package/dist/esm/Dialogs/BusyIndicatorDialog.js.map +1 -1
  25. package/dist/esm/Dialogs/Dialog.stories.d.ts +12 -0
  26. package/dist/esm/Dialogs/Dialog.stories.d.ts.map +1 -0
  27. package/dist/esm/Dialogs/Dialog.stories.js +44 -0
  28. package/dist/esm/Dialogs/Dialog.stories.js.map +1 -0
  29. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +7 -7
@@ -15,8 +15,9 @@ const useCommandDialogContext = () => {
15
15
  return context;
16
16
  };
17
17
  const CommandDialogWrapper = ({ header, visible, width, confirmLabel, cancelLabel, onConfirm, onCancel, onBeforeExecute, children }) => {
18
- const { isValid, setCommandValues, setCommandResult } = commands.useCommandFormContext();
18
+ const { setCommandValues, setCommandResult, commandResult } = commands.useCommandFormContext();
19
19
  const commandInstance = commands.useCommandInstance();
20
+ const isDialogValid = !commandResult || commandResult.isValid;
20
21
  const handleConfirm = async () => {
21
22
  if (onBeforeExecute) {
22
23
  const transformedValues = onBeforeExecute(commandInstance);
@@ -32,13 +33,31 @@ const CommandDialogWrapper = ({ header, visible, width, confirmLabel, cancelLabe
32
33
  return false;
33
34
  }
34
35
  };
35
- return (jsxRuntime.jsx(Dialog.Dialog, { title: header, visible: visible, width: width, onConfirm: handleConfirm, onCancel: onCancel, buttons: dialogs.DialogButtons.OkCancel, okLabel: confirmLabel, cancelLabel: cancelLabel, isValid: isValid, children: children }));
36
+ const processChildren = (nodes) => {
37
+ return React.Children.map(nodes, (child) => {
38
+ if (!React.isValidElement(child))
39
+ return child;
40
+ const component = child.type;
41
+ if (component.displayName === 'CommandFormField') {
42
+ return jsxRuntime.jsx(commands.CommandFormFieldWrapper, { field: child });
43
+ }
44
+ const childProps = child.props;
45
+ if (childProps.children != null) {
46
+ return React.cloneElement(child, {
47
+ children: processChildren(childProps.children)
48
+ });
49
+ }
50
+ return child;
51
+ });
52
+ };
53
+ const processedChildren = processChildren(children);
54
+ return (jsxRuntime.jsx(Dialog.Dialog, { title: header, visible: visible, width: width, onConfirm: handleConfirm, onCancel: onCancel, buttons: dialogs.DialogButtons.OkCancel, okLabel: confirmLabel, cancelLabel: cancelLabel, isValid: isDialogValid, children: jsxRuntime.jsx("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: processedChildren }) }));
36
55
  };
37
56
  const CommandDialogFieldsWrapper = (props) => {
38
57
  return (jsxRuntime.jsx(commands.CommandForm.Fields, { children: props.children }));
39
58
  };
40
59
  const CommandDialogComponent = (props) => {
41
- const { command, initialValues, currentValues, visible, header, confirmLabel = 'Confirm', cancelLabel = 'Cancel', confirmIcon = 'pi pi-check', cancelIcon = 'pi pi-times', onConfirm, onCancel, onFieldValidate, onFieldChange, onBeforeExecute, children, width = '50vw' } = props;
60
+ const { command, initialValues, currentValues, visible, header, confirmLabel = 'Confirm', cancelLabel = 'Cancel', confirmIcon = 'pi pi-check', cancelIcon = 'pi pi-times', onConfirm, onCancel, onFieldValidate, onFieldChange, onBeforeExecute, children, width = '50vw', showTitles, showErrors, validateOn, validateAllFieldsOnChange, validateOnInit, autoServerValidate, autoServerValidateThrottle, fieldContainerComponent, fieldDecoratorComponent, errorDisplayComponent, tooltipComponent, errorClassName, iconAddonClassName } = props;
42
61
  const contextValue = {
43
62
  onSuccess: onConfirm,
44
63
  onCancel,
@@ -50,9 +69,12 @@ const CommandDialogComponent = (props) => {
50
69
  onFieldChange,
51
70
  onBeforeExecute
52
71
  };
53
- return (jsxRuntime.jsx(CommandDialogContext.Provider, { value: contextValue, children: jsxRuntime.jsx(commands.CommandForm, { command: command, initialValues: initialValues, currentValues: currentValues, onFieldValidate: onFieldValidate, onFieldChange: onFieldChange, onBeforeExecute: onBeforeExecute, children: jsxRuntime.jsx(CommandDialogWrapper, { header: header, visible: visible, width: width, confirmLabel: confirmLabel, cancelLabel: cancelLabel, onConfirm: onConfirm, onCancel: onCancel, onBeforeExecute: onBeforeExecute, children: children }) }) }));
72
+ return (jsxRuntime.jsx(CommandDialogContext.Provider, { value: contextValue, children: jsxRuntime.jsx(commands.CommandForm, { command: command, initialValues: initialValues, currentValues: currentValues, onFieldValidate: onFieldValidate, onFieldChange: onFieldChange, onBeforeExecute: onBeforeExecute, showTitles: showTitles, showErrors: showErrors, validateOn: validateOn, validateAllFieldsOnChange: validateAllFieldsOnChange, validateOnInit: validateOnInit, autoServerValidate: autoServerValidate, autoServerValidateThrottle: autoServerValidateThrottle, fieldContainerComponent: fieldContainerComponent, fieldDecoratorComponent: fieldDecoratorComponent, errorDisplayComponent: errorDisplayComponent, tooltipComponent: tooltipComponent, errorClassName: errorClassName, iconAddonClassName: iconAddonClassName, children: jsxRuntime.jsx(CommandDialogWrapper, { header: header, visible: visible, width: width, confirmLabel: confirmLabel, cancelLabel: cancelLabel, onConfirm: onConfirm, onCancel: onCancel, onBeforeExecute: onBeforeExecute, children: children }) }) }));
54
73
  };
74
+ const CommandDialogColumnWrapper = ({ children }) => (jsxRuntime.jsx(commands.CommandForm.Column, { children: children }));
75
+ CommandDialogColumnWrapper.displayName = 'CommandFormColumn';
55
76
  CommandDialogComponent.Fields = CommandDialogFieldsWrapper;
77
+ CommandDialogComponent.Column = CommandDialogColumnWrapper;
56
78
  const CommandDialog = CommandDialogComponent;
57
79
 
58
80
  exports.CommandDialog = CommandDialog;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ICommandResult } from '@cratis/arc/commands';\nimport { Constructor } from '@cratis/fundamentals';\nimport { DialogButtons } from '@cratis/arc.react/dialogs';\nimport { Dialog } from '../Dialogs/Dialog';\nimport React, { createContext, useContext } from 'react';\nimport { \n CommandForm, \n useCommandFormContext, \n useCommandInstance\n} from '@cratis/arc.react/commands';\n\n// Local type definitions\nexport type BeforeExecuteCallback<TCommand> = (values: TCommand) => TCommand;\n\nexport type FieldValidator<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\nexport type FieldChangeCallback<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n\nexport interface CommandDialogProps<TCommand, TResponse = object> {\n command: Constructor<TCommand>;\n initialValues?: Partial<TCommand>;\n currentValues?: Partial<TCommand> | undefined;\n visible: boolean;\n header: string;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmIcon?: string;\n cancelIcon?: string;\n onConfirm: (result: ICommandResult<TResponse>) => void | Promise<void>;\n onCancel: () => void;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n width?: string;\n}\n\ninterface CommandDialogContextValue<TCommand = unknown> {\n onSuccess: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n confirmLabel: string;\n cancelLabel: string;\n confirmIcon: string;\n cancelIcon: string;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n}\n\nconst CommandDialogContext = createContext<CommandDialogContextValue<unknown> | undefined>(undefined);\n\nexport const useCommandDialogContext = <TCommand = unknown,>() => {\n const context = useContext(CommandDialogContext);\n if (!context) {\n throw new Error('useCommandDialogContext must be used within a CommandDialog');\n }\n return context as CommandDialogContextValue<TCommand>;\n};\n\nconst CommandDialogWrapper = <TCommand extends object>({\n header,\n visible,\n width,\n confirmLabel,\n cancelLabel,\n onConfirm,\n onCancel,\n onBeforeExecute,\n children\n}: {\n header: string;\n visible: boolean;\n width: string;\n confirmLabel: string;\n cancelLabel: string;\n onConfirm: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children: React.ReactNode;\n}) => {\n const { isValid, setCommandValues, setCommandResult } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n\n const handleConfirm = async () => {\n if (onBeforeExecute) {\n const transformedValues = onBeforeExecute(commandInstance);\n setCommandValues(transformedValues);\n }\n const result = await (commandInstance as unknown as { execute: () => Promise<ICommandResult<unknown>> }).execute();\n if (result.isSuccess) {\n await onConfirm(result);\n return true;\n } else {\n setCommandResult(result);\n return false;\n }\n };\n\n return (\n <Dialog\n title={header}\n visible={visible}\n width={width}\n onConfirm={handleConfirm}\n onCancel={onCancel}\n buttons={DialogButtons.OkCancel}\n okLabel={confirmLabel}\n cancelLabel={cancelLabel}\n isValid={isValid}\n >\n {children}\n </Dialog>\n );\n};\n\nconst CommandDialogFieldsWrapper = (props: { children: React.ReactNode }) => {\n return (\n <CommandForm.Fields>\n {props.children}\n </CommandForm.Fields>\n );\n};\n\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(props: CommandDialogProps<TCommand, TResponse>) => {\n const {\n command,\n initialValues,\n currentValues,\n visible,\n header,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n confirmIcon = 'pi pi-check',\n cancelIcon = 'pi pi-times',\n onConfirm,\n onCancel,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute,\n children,\n width = '50vw'\n } = props;\n\n const contextValue: CommandDialogContextValue<TCommand> = {\n onSuccess: onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n confirmIcon,\n cancelIcon,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute\n };\n\n return (\n <CommandDialogContext.Provider value={contextValue}>\n <CommandForm\n command={command}\n initialValues={initialValues}\n currentValues={currentValues}\n onFieldValidate={onFieldValidate}\n onFieldChange={onFieldChange}\n onBeforeExecute={onBeforeExecute}>\n <CommandDialogWrapper\n header={header}\n visible={visible}\n width={width}\n confirmLabel={confirmLabel}\n cancelLabel={cancelLabel}\n onConfirm={onConfirm}\n onCancel={onCancel}\n onBeforeExecute={onBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n </CommandDialogContext.Provider>\n );\n};\n\nCommandDialogComponent.Fields = CommandDialogFieldsWrapper;\n\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["createContext","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e,EAAA,QAAA,EAE/B,QAAQ,GACU,EAAA,CACb,EAAA,CACc;AAExC,CAAC;AAED,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAEnD,MAAM,aAAa,GAAG;;;;;"}
1
+ {"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ICommandResult } from '@cratis/arc/commands';\nimport { Constructor } from '@cratis/fundamentals';\nimport { DialogButtons } from '@cratis/arc.react/dialogs';\nimport { Dialog } from '../Dialogs/Dialog';\nimport React, { createContext, useContext } from 'react';\nimport { \n CommandForm, \n CommandFormFieldWrapper,\n useCommandFormContext, \n useCommandInstance\n} from '@cratis/arc.react/commands';\n\ntype CommandFormProps = React.ComponentProps<typeof CommandForm>;\n\n// Local type definitions\nexport type BeforeExecuteCallback<TCommand> = (values: TCommand) => TCommand;\n\nexport type FieldValidator<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\nexport type FieldChangeCallback<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n\nexport interface CommandDialogProps<TCommand, TResponse = object> {\n command: Constructor<TCommand>;\n initialValues?: Partial<TCommand>;\n currentValues?: Partial<TCommand> | undefined;\n visible: boolean;\n header: string;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmIcon?: string;\n cancelIcon?: string;\n onConfirm: (result: ICommandResult<TResponse>) => void | Promise<void>;\n onCancel: () => void;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n width?: string;\n showTitles?: boolean;\n showErrors?: boolean;\n validateOn?: CommandFormProps['validateOn'];\n validateAllFieldsOnChange?: boolean;\n validateOnInit?: boolean;\n autoServerValidate?: boolean;\n autoServerValidateThrottle?: number;\n fieldContainerComponent?: CommandFormProps['fieldContainerComponent'];\n fieldDecoratorComponent?: CommandFormProps['fieldDecoratorComponent'];\n errorDisplayComponent?: CommandFormProps['errorDisplayComponent'];\n tooltipComponent?: CommandFormProps['tooltipComponent'];\n errorClassName?: string;\n iconAddonClassName?: string;\n}\n\ninterface CommandDialogContextValue<TCommand = unknown> {\n onSuccess: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n confirmLabel: string;\n cancelLabel: string;\n confirmIcon: string;\n cancelIcon: string;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n}\n\nconst CommandDialogContext = createContext<CommandDialogContextValue<unknown> | undefined>(undefined);\n\nexport const useCommandDialogContext = <TCommand = unknown,>() => {\n const context = useContext(CommandDialogContext);\n if (!context) {\n throw new Error('useCommandDialogContext must be used within a CommandDialog');\n }\n return context as CommandDialogContextValue<TCommand>;\n};\n\nconst CommandDialogWrapper = <TCommand extends object>({\n header,\n visible,\n width,\n confirmLabel,\n cancelLabel,\n onConfirm,\n onCancel,\n onBeforeExecute,\n children\n}: {\n header: string;\n visible: boolean;\n width: string;\n confirmLabel: string;\n cancelLabel: string;\n onConfirm: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children: React.ReactNode;\n}) => {\n const { setCommandValues, setCommandResult, commandResult } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n\n // Compute real dialog validity from commandResult.\n // fieldValidities in CommandForm is never populated by field renderers, so\n // the context's isValid is always vacuously true. We derive validity from\n // the actual validation result instead:\n // - No result yet (before any validate call) → enabled (allow first submit)\n // - commandResult.isValid → reflects actual validation state\n const isDialogValid = !commandResult || commandResult.isValid;\n\n const handleConfirm = async () => {\n if (onBeforeExecute) {\n const transformedValues = onBeforeExecute(commandInstance);\n setCommandValues(transformedValues);\n }\n const result = await (commandInstance as unknown as { execute: () => Promise<ICommandResult<unknown>> }).execute();\n if (result.isSuccess) {\n await onConfirm(result);\n return true;\n } else {\n setCommandResult(result);\n return false;\n }\n };\n\n const processChildren = (nodes: React.ReactNode): React.ReactNode => {\n return React.Children.map(nodes, (child) => {\n if (!React.isValidElement(child)) return child;\n\n const component = child.type as React.ComponentType<unknown>;\n if (component.displayName === 'CommandFormField') {\n type FieldElement = Parameters<typeof CommandFormFieldWrapper>[0]['field'];\n return <CommandFormFieldWrapper field={child as unknown as FieldElement} />;\n }\n\n const childProps = child.props as Record<string, unknown>;\n if (childProps.children != null) {\n return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, {\n children: processChildren(childProps.children as React.ReactNode)\n });\n }\n\n return child;\n });\n };\n\n const processedChildren = processChildren(children);\n\n return (\n <Dialog\n title={header}\n visible={visible}\n width={width}\n onConfirm={handleConfirm}\n onCancel={onCancel}\n buttons={DialogButtons.OkCancel}\n okLabel={confirmLabel}\n cancelLabel={cancelLabel}\n isValid={isDialogValid}\n >\n <div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>\n {processedChildren}\n </div>\n </Dialog>\n );\n};\n\nconst CommandDialogFieldsWrapper = (props: { children: React.ReactNode }) => {\n return (\n <CommandForm.Fields>\n {props.children}\n </CommandForm.Fields>\n );\n};\n\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(props: CommandDialogProps<TCommand, TResponse>) => {\n const {\n command,\n initialValues,\n currentValues,\n visible,\n header,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n confirmIcon = 'pi pi-check',\n cancelIcon = 'pi pi-times',\n onConfirm,\n onCancel,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute,\n children,\n width = '50vw',\n showTitles,\n showErrors,\n validateOn,\n validateAllFieldsOnChange,\n validateOnInit,\n autoServerValidate,\n autoServerValidateThrottle,\n fieldContainerComponent,\n fieldDecoratorComponent,\n errorDisplayComponent,\n tooltipComponent,\n errorClassName,\n iconAddonClassName\n } = props;\n\n const contextValue: CommandDialogContextValue<TCommand> = {\n onSuccess: onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n confirmIcon,\n cancelIcon,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute\n };\n\n return (\n <CommandDialogContext.Provider value={contextValue}>\n <CommandForm\n command={command}\n initialValues={initialValues}\n currentValues={currentValues}\n onFieldValidate={onFieldValidate}\n onFieldChange={onFieldChange}\n onBeforeExecute={onBeforeExecute}\n showTitles={showTitles}\n showErrors={showErrors}\n validateOn={validateOn}\n validateAllFieldsOnChange={validateAllFieldsOnChange}\n validateOnInit={validateOnInit}\n autoServerValidate={autoServerValidate}\n autoServerValidateThrottle={autoServerValidateThrottle}\n fieldContainerComponent={fieldContainerComponent}\n fieldDecoratorComponent={fieldDecoratorComponent}\n errorDisplayComponent={errorDisplayComponent}\n tooltipComponent={tooltipComponent}\n errorClassName={errorClassName}\n iconAddonClassName={iconAddonClassName}>\n <CommandDialogWrapper\n header={header}\n visible={visible}\n width={width}\n confirmLabel={confirmLabel}\n cancelLabel={cancelLabel}\n onConfirm={onConfirm}\n onCancel={onCancel}\n onBeforeExecute={onBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n </CommandDialogContext.Provider>\n );\n};\n\nconst CommandDialogColumnWrapper = ({ children }: { children: React.ReactNode }) => (\n <CommandForm.Column>{children}</CommandForm.Column>\n);\nCommandDialogColumnWrapper.displayName = 'CommandFormColumn';\n\nCommandDialogComponent.Fields = CommandDialogFieldsWrapper;\nCommandDialogComponent.Column = CommandDialogColumnWrapper;\n\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["createContext","useContext","useCommandFormContext","useCommandInstance","_jsx","CommandFormFieldWrapper","Dialog","DialogButtons","CommandForm"],"mappings":";;;;;;;;AAoEA,MAAM,oBAAoB,GAAGA,mBAAa,CAAiD,SAAS,CAAC;AAE9F,MAAM,uBAAuB,GAAG,MAA0B;AAC7D,IA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ChB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAAA,QAAA,EAE/B,QAAQ,EAAA,CACU,EAAA,CACb,EAAA,CACc;AAExC,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;AAC1D,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAEnD,MAAM,aAAa,GAAG;;;;;"}
@@ -5,7 +5,7 @@ var progressspinner = require('primereact/progressspinner');
5
5
  var Dialog = require('./Dialog.js');
6
6
 
7
7
  const BusyIndicatorDialog = (props) => {
8
- return (jsxRuntime.jsxs(Dialog.Dialog, { title: props.title, visible: true, onCancel: () => undefined, buttons: null, children: [jsxRuntime.jsx(progressspinner.ProgressSpinner, {}), jsxRuntime.jsx("p", { className: "m-0", children: props.message })] }));
8
+ return (jsxRuntime.jsx(Dialog.Dialog, { title: props.title, visible: true, onCancel: () => undefined, buttons: null, children: jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center gap-4 py-4", children: [jsxRuntime.jsx(progressspinner.ProgressSpinner, {}), jsxRuntime.jsx("p", { className: "m-0 text-center", children: props.message })] }) }));
9
9
  };
10
10
 
11
11
  exports.BusyIndicatorDialog = BusyIndicatorDialog;
@@ -1 +1 @@
1
- {"version":3,"file":"BusyIndicatorDialog.js","sources":["../../../Dialogs/BusyIndicatorDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { BusyIndicatorDialogRequest } from '@cratis/arc.react/dialogs';\nimport { ProgressSpinner } from 'primereact/progressspinner';\nimport { Dialog } from './Dialog';\n\nexport const BusyIndicatorDialog = (props: BusyIndicatorDialogRequest) => {\n return (\n <Dialog \n title={props.title} \n visible={true} \n onCancel={() => undefined}\n buttons={null}\n >\n <ProgressSpinner />\n <p className=\"m-0\">\n {props.message}\n </p>\n </Dialog>\n );\n};\n"],"names":["_jsxs","Dialog","_jsx","ProgressSpinner"],"mappings":";;;;;;AAOO,MAAM,mBAAmB,GAAG,CAAC,KAAiC,KAAI;AACrE,IAAA,QACIA,eAAA,CAACC,aAAM,IACH,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,MAAM,SAAS,EACzB,OAAO,EAAE,IAAI,EAAA,QAAA,EAAA,CAEbC,eAACC,+BAAe,EAAA,EAAA,CAAG,EACnBD,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,KAAK,YACb,KAAK,CAAC,OAAO,EAAA,CACd,CAAA,EAAA,CACC;AAEjB;;;;"}
1
+ {"version":3,"file":"BusyIndicatorDialog.js","sources":["../../../Dialogs/BusyIndicatorDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { BusyIndicatorDialogRequest } from '@cratis/arc.react/dialogs';\nimport { ProgressSpinner } from 'primereact/progressspinner';\nimport { Dialog } from './Dialog';\n\nexport const BusyIndicatorDialog = (props: BusyIndicatorDialogRequest) => {\n return (\n <Dialog \n title={props.title} \n visible={true} \n onCancel={() => undefined}\n buttons={null}\n >\n <div className=\"flex flex-col items-center justify-center gap-4 py-4\">\n <ProgressSpinner />\n <p className=\"m-0 text-center\">\n {props.message}\n </p>\n </div>\n </Dialog>\n );\n};\n"],"names":["_jsx","Dialog","_jsxs","ProgressSpinner"],"mappings":";;;;;;AAOO,MAAM,mBAAmB,GAAG,CAAC,KAAiC,KAAI;IACrE,QACIA,eAACC,aAAM,EAAA,EACH,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,MAAM,SAAS,EACzB,OAAO,EAAE,IAAI,EAAA,QAAA,EAEbC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,sDAAsD,aACjEF,cAAA,CAACG,+BAAe,KAAG,EACnBH,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,iBAAiB,YACzB,KAAK,CAAC,OAAO,EAAA,CACd,CAAA,EAAA,CACF,EAAA,CACD;AAEjB;;;;"}
@@ -1,6 +1,8 @@
1
1
  import { ICommandResult } from '@cratis/arc/commands';
2
2
  import { Constructor } from '@cratis/fundamentals';
3
3
  import React from 'react';
4
+ import { CommandForm } from '@cratis/arc.react/commands';
5
+ type CommandFormProps = React.ComponentProps<typeof CommandForm>;
4
6
  export type BeforeExecuteCallback<TCommand> = (values: TCommand) => TCommand;
5
7
  export type FieldValidator<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;
6
8
  export type FieldChangeCallback<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;
@@ -22,6 +24,19 @@ export interface CommandDialogProps<TCommand, TResponse = object> {
22
24
  children?: React.ReactNode;
23
25
  style?: React.CSSProperties;
24
26
  width?: string;
27
+ showTitles?: boolean;
28
+ showErrors?: boolean;
29
+ validateOn?: CommandFormProps['validateOn'];
30
+ validateAllFieldsOnChange?: boolean;
31
+ validateOnInit?: boolean;
32
+ autoServerValidate?: boolean;
33
+ autoServerValidateThrottle?: number;
34
+ fieldContainerComponent?: CommandFormProps['fieldContainerComponent'];
35
+ fieldDecoratorComponent?: CommandFormProps['fieldDecoratorComponent'];
36
+ errorDisplayComponent?: CommandFormProps['errorDisplayComponent'];
37
+ tooltipComponent?: CommandFormProps['tooltipComponent'];
38
+ errorClassName?: string;
39
+ iconAddonClassName?: string;
25
40
  }
26
41
  interface CommandDialogContextValue<TCommand = unknown> {
27
42
  onSuccess: (result: ICommandResult<unknown>) => void | Promise<void>;
@@ -40,6 +55,12 @@ export declare const CommandDialog: {
40
55
  Fields: (props: {
41
56
  children: React.ReactNode;
42
57
  }) => import("react/jsx-runtime").JSX.Element;
58
+ Column: {
59
+ ({ children }: {
60
+ children: React.ReactNode;
61
+ }): import("react/jsx-runtime").JSX.Element;
62
+ displayName: string;
63
+ };
43
64
  };
44
65
  export {};
45
66
  //# sourceMappingURL=CommandDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommandDialog.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,KAAoC,MAAM,OAAO,CAAC;AAQzD,MAAM,MAAM,qBAAqB,CAAC,QAAQ,IAAI,CAAC,MAAM,EAAE,QAAQ,KAAK,QAAQ,CAAC;AAE7E,MAAM,MAAM,cAAc,CAAC,QAAQ,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;AAC1I,MAAM,MAAM,mBAAmB,CAAC,QAAQ,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;AAEjI,MAAM,WAAW,kBAAkB,CAAC,QAAQ,EAAE,SAAS,GAAG,MAAM;IAC5D,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM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CAAC,QAAQ,GAAG,OAAO;IAClD,SAAS,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC3C,aAAa,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC9C,eAAe,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;CACrD;AAID,eAAO,MAAM,uBAAuB,GAAI,QAAQ,GAAG,OAAO,OAKpC,yBAAyB,CAAC,QAAQ,CACvD,CAAC;AA+LF,eAAO,MAAM,aAAa;KA5FM,QAAQ,SAAS,MAAM,WAAW,SAAS,kBAAkB,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC;oBARzF;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;uBA4FtB;YAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;SAAE;;;CAQ5B,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { DialogButtons } from '@cratis/arc.react/dialogs';
3
3
  import { Dialog } from '../Dialogs/Dialog.js';
4
- import { createContext, useContext } from 'react';
5
- import { CommandForm, useCommandFormContext, useCommandInstance } from '@cratis/arc.react/commands';
4
+ import React, { createContext, useContext } from 'react';
5
+ import { CommandForm, useCommandFormContext, useCommandInstance, CommandFormFieldWrapper } from '@cratis/arc.react/commands';
6
6
 
7
7
  const CommandDialogContext = createContext(undefined);
8
8
  const useCommandDialogContext = () => {
@@ -13,8 +13,9 @@ const useCommandDialogContext = () => {
13
13
  return context;
14
14
  };
15
15
  const CommandDialogWrapper = ({ header, visible, width, confirmLabel, cancelLabel, onConfirm, onCancel, onBeforeExecute, children }) => {
16
- const { isValid, setCommandValues, setCommandResult } = useCommandFormContext();
16
+ const { setCommandValues, setCommandResult, commandResult } = useCommandFormContext();
17
17
  const commandInstance = useCommandInstance();
18
+ const isDialogValid = !commandResult || commandResult.isValid;
18
19
  const handleConfirm = async () => {
19
20
  if (onBeforeExecute) {
20
21
  const transformedValues = onBeforeExecute(commandInstance);
@@ -30,13 +31,31 @@ const CommandDialogWrapper = ({ header, visible, width, confirmLabel, cancelLabe
30
31
  return false;
31
32
  }
32
33
  };
33
- return (jsx(Dialog, { title: header, visible: visible, width: width, onConfirm: handleConfirm, onCancel: onCancel, buttons: DialogButtons.OkCancel, okLabel: confirmLabel, cancelLabel: cancelLabel, isValid: isValid, children: children }));
34
+ const processChildren = (nodes) => {
35
+ return React.Children.map(nodes, (child) => {
36
+ if (!React.isValidElement(child))
37
+ return child;
38
+ const component = child.type;
39
+ if (component.displayName === 'CommandFormField') {
40
+ return jsx(CommandFormFieldWrapper, { field: child });
41
+ }
42
+ const childProps = child.props;
43
+ if (childProps.children != null) {
44
+ return React.cloneElement(child, {
45
+ children: processChildren(childProps.children)
46
+ });
47
+ }
48
+ return child;
49
+ });
50
+ };
51
+ const processedChildren = processChildren(children);
52
+ return (jsx(Dialog, { title: header, visible: visible, width: width, onConfirm: handleConfirm, onCancel: onCancel, buttons: DialogButtons.OkCancel, okLabel: confirmLabel, cancelLabel: cancelLabel, isValid: isDialogValid, children: jsx("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: processedChildren }) }));
34
53
  };
35
54
  const CommandDialogFieldsWrapper = (props) => {
36
55
  return (jsx(CommandForm.Fields, { children: props.children }));
37
56
  };
38
57
  const CommandDialogComponent = (props) => {
39
- const { command, initialValues, currentValues, visible, header, confirmLabel = 'Confirm', cancelLabel = 'Cancel', confirmIcon = 'pi pi-check', cancelIcon = 'pi pi-times', onConfirm, onCancel, onFieldValidate, onFieldChange, onBeforeExecute, children, width = '50vw' } = props;
58
+ const { command, initialValues, currentValues, visible, header, confirmLabel = 'Confirm', cancelLabel = 'Cancel', confirmIcon = 'pi pi-check', cancelIcon = 'pi pi-times', onConfirm, onCancel, onFieldValidate, onFieldChange, onBeforeExecute, children, width = '50vw', showTitles, showErrors, validateOn, validateAllFieldsOnChange, validateOnInit, autoServerValidate, autoServerValidateThrottle, fieldContainerComponent, fieldDecoratorComponent, errorDisplayComponent, tooltipComponent, errorClassName, iconAddonClassName } = props;
40
59
  const contextValue = {
41
60
  onSuccess: onConfirm,
42
61
  onCancel,
@@ -48,9 +67,12 @@ const CommandDialogComponent = (props) => {
48
67
  onFieldChange,
49
68
  onBeforeExecute
50
69
  };
51
- return (jsx(CommandDialogContext.Provider, { value: contextValue, children: jsx(CommandForm, { command: command, initialValues: initialValues, currentValues: currentValues, onFieldValidate: onFieldValidate, onFieldChange: onFieldChange, onBeforeExecute: onBeforeExecute, children: jsx(CommandDialogWrapper, { header: header, visible: visible, width: width, confirmLabel: confirmLabel, cancelLabel: cancelLabel, onConfirm: onConfirm, onCancel: onCancel, onBeforeExecute: onBeforeExecute, children: children }) }) }));
70
+ return (jsx(CommandDialogContext.Provider, { value: contextValue, children: jsx(CommandForm, { command: command, initialValues: initialValues, currentValues: currentValues, onFieldValidate: onFieldValidate, onFieldChange: onFieldChange, onBeforeExecute: onBeforeExecute, showTitles: showTitles, showErrors: showErrors, validateOn: validateOn, validateAllFieldsOnChange: validateAllFieldsOnChange, validateOnInit: validateOnInit, autoServerValidate: autoServerValidate, autoServerValidateThrottle: autoServerValidateThrottle, fieldContainerComponent: fieldContainerComponent, fieldDecoratorComponent: fieldDecoratorComponent, errorDisplayComponent: errorDisplayComponent, tooltipComponent: tooltipComponent, errorClassName: errorClassName, iconAddonClassName: iconAddonClassName, children: jsx(CommandDialogWrapper, { header: header, visible: visible, width: width, confirmLabel: confirmLabel, cancelLabel: cancelLabel, onConfirm: onConfirm, onCancel: onCancel, onBeforeExecute: onBeforeExecute, children: children }) }) }));
52
71
  };
72
+ const CommandDialogColumnWrapper = ({ children }) => (jsx(CommandForm.Column, { children: children }));
73
+ CommandDialogColumnWrapper.displayName = 'CommandFormColumn';
53
74
  CommandDialogComponent.Fields = CommandDialogFieldsWrapper;
75
+ CommandDialogComponent.Column = CommandDialogColumnWrapper;
54
76
  const CommandDialog = CommandDialogComponent;
55
77
 
56
78
  export { CommandDialog, useCommandDialogContext };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ICommandResult } from '@cratis/arc/commands';\nimport { Constructor } from '@cratis/fundamentals';\nimport { DialogButtons } from '@cratis/arc.react/dialogs';\nimport { Dialog } from '../Dialogs/Dialog';\nimport React, { createContext, useContext } from 'react';\nimport { \n CommandForm, \n useCommandFormContext, \n useCommandInstance\n} from '@cratis/arc.react/commands';\n\n// Local type definitions\nexport type BeforeExecuteCallback<TCommand> = (values: TCommand) => TCommand;\n\nexport type FieldValidator<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\nexport type FieldChangeCallback<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n\nexport interface CommandDialogProps<TCommand, TResponse = object> {\n command: Constructor<TCommand>;\n initialValues?: Partial<TCommand>;\n currentValues?: Partial<TCommand> | undefined;\n visible: boolean;\n header: string;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmIcon?: string;\n cancelIcon?: string;\n onConfirm: (result: ICommandResult<TResponse>) => void | Promise<void>;\n onCancel: () => void;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n width?: string;\n}\n\ninterface CommandDialogContextValue<TCommand = unknown> {\n onSuccess: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n confirmLabel: string;\n cancelLabel: string;\n confirmIcon: string;\n cancelIcon: string;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n}\n\nconst CommandDialogContext = createContext<CommandDialogContextValue<unknown> | undefined>(undefined);\n\nexport const useCommandDialogContext = <TCommand = unknown,>() => {\n const context = useContext(CommandDialogContext);\n if (!context) {\n throw new Error('useCommandDialogContext must be used within a CommandDialog');\n }\n return context as CommandDialogContextValue<TCommand>;\n};\n\nconst CommandDialogWrapper = <TCommand extends object>({\n header,\n visible,\n width,\n confirmLabel,\n cancelLabel,\n onConfirm,\n onCancel,\n onBeforeExecute,\n children\n}: {\n header: string;\n visible: boolean;\n width: string;\n confirmLabel: string;\n cancelLabel: string;\n onConfirm: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children: React.ReactNode;\n}) => {\n const { isValid, setCommandValues, setCommandResult } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n\n const handleConfirm = async () => {\n if (onBeforeExecute) {\n const transformedValues = onBeforeExecute(commandInstance);\n setCommandValues(transformedValues);\n }\n const result = await (commandInstance as unknown as { execute: () => Promise<ICommandResult<unknown>> }).execute();\n if (result.isSuccess) {\n await onConfirm(result);\n return true;\n } else {\n setCommandResult(result);\n return false;\n }\n };\n\n return (\n <Dialog\n title={header}\n visible={visible}\n width={width}\n onConfirm={handleConfirm}\n onCancel={onCancel}\n buttons={DialogButtons.OkCancel}\n okLabel={confirmLabel}\n cancelLabel={cancelLabel}\n isValid={isValid}\n >\n {children}\n </Dialog>\n );\n};\n\nconst CommandDialogFieldsWrapper = (props: { children: React.ReactNode }) => {\n return (\n <CommandForm.Fields>\n {props.children}\n </CommandForm.Fields>\n );\n};\n\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(props: CommandDialogProps<TCommand, TResponse>) => {\n const {\n command,\n initialValues,\n currentValues,\n visible,\n header,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n confirmIcon = 'pi pi-check',\n cancelIcon = 'pi pi-times',\n onConfirm,\n onCancel,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute,\n children,\n width = '50vw'\n } = props;\n\n const contextValue: CommandDialogContextValue<TCommand> = {\n onSuccess: onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n confirmIcon,\n cancelIcon,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute\n };\n\n return (\n <CommandDialogContext.Provider value={contextValue}>\n <CommandForm\n command={command}\n initialValues={initialValues}\n currentValues={currentValues}\n onFieldValidate={onFieldValidate}\n onFieldChange={onFieldChange}\n onBeforeExecute={onBeforeExecute}>\n <CommandDialogWrapper\n header={header}\n visible={visible}\n width={width}\n confirmLabel={confirmLabel}\n cancelLabel={cancelLabel}\n onConfirm={onConfirm}\n onCancel={onCancel}\n onBeforeExecute={onBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n </CommandDialogContext.Provider>\n );\n};\n\nCommandDialogComponent.Fields = CommandDialogFieldsWrapper;\n\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["_jsx"],"mappings":";;;;;;AAoDA,MAAM,oBAAoB,GAAG,aAAa,CAAiD,SAAS,CAAC;AAE9F,MAAM,uBAAuB,GAAG,MAA0B;AAC7D,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE;AACV,QAAA,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC;IAClF;AACA,IAAA,OAAO,OAA8C;AACzD;AAEA,MAAM,oBAAoB,GAAG,CAA0B,EACnD,MAAM,EACN,OAAO,EACP,KAAK,EACL,YAAY,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EACR,eAAe,E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aAAa,EAC1B,SAAS,EACT,QAAQ,EACR,eAAe,EACf,aAAa,EACb,eAAe,EACf,QAAQ,EACR,KAAK,GAAG,MAAM,EACjB,GAAG,KAAK;AAET,IAAA,MAAM,YAAY,GAAwC;AACtD,QAAA,SAAS,EAAE,SAAS;QACpB,QAAQ;QACR,YAAY;QACZ,WAAW;QACX,WAAW;QACX,UAAU;QACV,eAAe;QACf,aAAa;QACb;KACH;AAED,IAAA,QACIA,GAAA,CAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,EAAA,QAAA,EAC9CA,IAAC,WAAW,EAAA,EACR,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAAA,QAAA,EAChCA,GAAA,CAAC,oBAAoB,EAAA,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAAA,QAAA,EAE/B,QAAQ,GACU,EAAA,CACb,EAAA,CACc;AAExC,CAAC;AAED,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAEnD,MAAM,aAAa,GAAG;;;;"}
1
+ {"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ICommandResult } from '@cratis/arc/commands';\nimport { Constructor } from '@cratis/fundamentals';\nimport { DialogButtons } from '@cratis/arc.react/dialogs';\nimport { Dialog } from '../Dialogs/Dialog';\nimport React, { createContext, useContext } from 'react';\nimport { \n CommandForm, \n CommandFormFieldWrapper,\n useCommandFormContext, \n useCommandInstance\n} from '@cratis/arc.react/commands';\n\ntype CommandFormProps = React.ComponentProps<typeof CommandForm>;\n\n// Local type definitions\nexport type BeforeExecuteCallback<TCommand> = (values: TCommand) => TCommand;\n\nexport type FieldValidator<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\nexport type FieldChangeCallback<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n\nexport interface CommandDialogProps<TCommand, TResponse = object> {\n command: Constructor<TCommand>;\n initialValues?: Partial<TCommand>;\n currentValues?: Partial<TCommand> | undefined;\n visible: boolean;\n header: string;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmIcon?: string;\n cancelIcon?: string;\n onConfirm: (result: ICommandResult<TResponse>) => void | Promise<void>;\n onCancel: () => void;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n width?: string;\n showTitles?: boolean;\n showErrors?: boolean;\n validateOn?: CommandFormProps['validateOn'];\n validateAllFieldsOnChange?: boolean;\n validateOnInit?: boolean;\n autoServerValidate?: boolean;\n autoServerValidateThrottle?: number;\n fieldContainerComponent?: CommandFormProps['fieldContainerComponent'];\n fieldDecoratorComponent?: CommandFormProps['fieldDecoratorComponent'];\n errorDisplayComponent?: CommandFormProps['errorDisplayComponent'];\n tooltipComponent?: CommandFormProps['tooltipComponent'];\n errorClassName?: string;\n iconAddonClassName?: string;\n}\n\ninterface CommandDialogContextValue<TCommand = unknown> {\n onSuccess: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n confirmLabel: string;\n cancelLabel: string;\n confirmIcon: string;\n cancelIcon: string;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n}\n\nconst CommandDialogContext = createContext<CommandDialogContextValue<unknown> | undefined>(undefined);\n\nexport const useCommandDialogContext = <TCommand = unknown,>() => {\n const context = useContext(CommandDialogContext);\n if (!context) {\n throw new Error('useCommandDialogContext must be used within a CommandDialog');\n }\n return context as CommandDialogContextValue<TCommand>;\n};\n\nconst CommandDialogWrapper = <TCommand extends object>({\n header,\n visible,\n width,\n confirmLabel,\n cancelLabel,\n onConfirm,\n onCancel,\n onBeforeExecute,\n children\n}: {\n header: string;\n visible: boolean;\n width: string;\n confirmLabel: string;\n cancelLabel: string;\n onConfirm: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children: React.ReactNode;\n}) => {\n const { setCommandValues, setCommandResult, commandResult } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n\n // Compute real dialog validity from commandResult.\n // fieldValidities in CommandForm is never populated by field renderers, so\n // the context's isValid is always vacuously true. We derive validity from\n // the actual validation result instead:\n // - No result yet (before any validate call) → enabled (allow first submit)\n // - commandResult.isValid → reflects actual validation state\n const isDialogValid = !commandResult || commandResult.isValid;\n\n const handleConfirm = async () => {\n if (onBeforeExecute) {\n const transformedValues = onBeforeExecute(commandInstance);\n setCommandValues(transformedValues);\n }\n const result = await (commandInstance as unknown as { execute: () => Promise<ICommandResult<unknown>> }).execute();\n if (result.isSuccess) {\n await onConfirm(result);\n return true;\n } else {\n setCommandResult(result);\n return false;\n }\n };\n\n const processChildren = (nodes: React.ReactNode): React.ReactNode => {\n return React.Children.map(nodes, (child) => {\n if (!React.isValidElement(child)) return child;\n\n const component = child.type as React.ComponentType<unknown>;\n if (component.displayName === 'CommandFormField') {\n type FieldElement = Parameters<typeof CommandFormFieldWrapper>[0]['field'];\n return <CommandFormFieldWrapper field={child as unknown as FieldElement} />;\n }\n\n const childProps = child.props as Record<string, unknown>;\n if (childProps.children != null) {\n return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, {\n children: processChildren(childProps.children as React.ReactNode)\n });\n }\n\n return child;\n });\n };\n\n const processedChildren = processChildren(children);\n\n return (\n <Dialog\n title={header}\n visible={visible}\n width={width}\n onConfirm={handleConfirm}\n onCancel={onCancel}\n buttons={DialogButtons.OkCancel}\n okLabel={confirmLabel}\n cancelLabel={cancelLabel}\n isValid={isDialogValid}\n >\n <div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>\n {processedChildren}\n </div>\n </Dialog>\n );\n};\n\nconst CommandDialogFieldsWrapper = (props: { children: React.ReactNode }) => {\n return (\n <CommandForm.Fields>\n {props.children}\n </CommandForm.Fields>\n );\n};\n\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(props: CommandDialogProps<TCommand, TResponse>) => {\n const {\n command,\n initialValues,\n currentValues,\n visible,\n header,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n confirmIcon = 'pi pi-check',\n cancelIcon = 'pi pi-times',\n onConfirm,\n onCancel,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute,\n children,\n width = '50vw',\n showTitles,\n showErrors,\n validateOn,\n validateAllFieldsOnChange,\n validateOnInit,\n autoServerValidate,\n autoServerValidateThrottle,\n fieldContainerComponent,\n fieldDecoratorComponent,\n errorDisplayComponent,\n tooltipComponent,\n errorClassName,\n iconAddonClassName\n } = props;\n\n const contextValue: CommandDialogContextValue<TCommand> = {\n onSuccess: onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n confirmIcon,\n cancelIcon,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute\n };\n\n return (\n <CommandDialogContext.Provider value={contextValue}>\n <CommandForm\n command={command}\n initialValues={initialValues}\n currentValues={currentValues}\n onFieldValidate={onFieldValidate}\n onFieldChange={onFieldChange}\n onBeforeExecute={onBeforeExecute}\n showTitles={showTitles}\n showErrors={showErrors}\n validateOn={validateOn}\n validateAllFieldsOnChange={validateAllFieldsOnChange}\n validateOnInit={validateOnInit}\n autoServerValidate={autoServerValidate}\n autoServerValidateThrottle={autoServerValidateThrottle}\n fieldContainerComponent={fieldContainerComponent}\n fieldDecoratorComponent={fieldDecoratorComponent}\n errorDisplayComponent={errorDisplayComponent}\n tooltipComponent={tooltipComponent}\n errorClassName={errorClassName}\n iconAddonClassName={iconAddonClassName}>\n <CommandDialogWrapper\n header={header}\n visible={visible}\n width={width}\n confirmLabel={confirmLabel}\n cancelLabel={cancelLabel}\n onConfirm={onConfirm}\n onCancel={onCancel}\n onBeforeExecute={onBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n </CommandDialogContext.Provider>\n );\n};\n\nconst CommandDialogColumnWrapper = ({ children }: { children: React.ReactNode }) => (\n <CommandForm.Column>{children}</CommandForm.Column>\n);\nCommandDialogColumnWrapper.displayName = 'CommandFormColumn';\n\nCommandDialogComponent.Fields = CommandDialogFieldsWrapper;\nCommandDialogComponent.Column = CommandDialogColumnWrapper;\n\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["_jsx"],"mappings":";;;;;;AAoEA,MAAM,oBAAoB,GAAG,aAAa,CAAiD,SAAS,CAAC;AAE9F,MAAM,uBAAuB,GAAG,MAA0B;AAC7D,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE;AACV,QAAA,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC;IAClF;AACA,IAAA,OAAO,OAA8C;AACzD;AAEA,MAAM,oBAAoB,GAAG,CAA0B,EACnD,MAAM,EACN,OAAO,EACP,KAAK,EACL,YAAY,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EACR,eAAe,EACf,QAAQ,EAWX,KAAI;IACD,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,GAAG,qBAAqB,EAAY;AAC/F,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAY;IAQtD,MAAM,aAAa,GAAG,CAAC,aAAa,IAAI,aAAa,CAAC,OAAO;AAE7D,IAAA,MAAM,aAAa,GAAG,YAAW;QAC7B,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;
6
6
  type Story = StoryObj<typeof CommandDialog>;
7
7
  export declare const Default: Story;
8
+ export declare const WithInitialValues: Story;
9
+ export declare const WithCustomValidation: Story;
10
+ export declare const ValidationOnBlur: Story;
11
+ export declare const ValidationOnChange: Story;
12
+ export declare const ValidateOnInit: Story;
13
+ export declare const ValidateAllFieldsOnChange: Story;
14
+ export declare const BeforeExecute: Story;
15
+ export declare const WithIcons: Story;
16
+ export declare const MultiColumnLayout: Story;
17
+ export declare const MixedChildren: Story;
8
18
  //# sourceMappingURL=CommandDialog.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommandDialog.stories.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,wBAAwB,CAAC;AAEhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAGpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAsG5C,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC"}
1
+ {"version":3,"file":"CommandDialog.stories.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,wBAAwB,CAAC;AAEhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAGpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAsG5C,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AA4DF,eAAO,MAAM,iBAAiB,EAAE,KAE/B,CAAC;AA8DF,eAAO,MAAM,oBAAoB,EAAE,KAElC,CAAC;AA4BF,eAAO,MAAM,gBAAgB,EAAE,KAE9B,CAAC;AA4BF,eAAO,MAAM,kBAAkB,EAAE,KAEhC,CAAC;AA6BF,eAAO,MAAM,cAAc,EAAE,KAE5B,CAAC;AA6BF,eAAO,MAAM,yBAAyB,EAAE,KAEvC,CAAC;AA6CF,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC;AA2CF,eAAO,MAAM,SAAS,EAAE,KAEvB,CAAC;AA6EF,eAAO,MAAM,iBAAiB,EAAE,KAE/B,CAAC;AAkCF,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC"}
@@ -3,7 +3,7 @@ import { useState } from 'react';
3
3
  import { CommandDialog } from './CommandDialog';
4
4
  import { Command, CommandValidator } from '@cratis/arc/commands';
5
5
  import { PropertyDescriptor } from '@cratis/arc/reflection';
6
- import { InputTextField, NumberField } from '../CommandForm/fields';
6
+ import { InputTextField, NumberField, TextAreaField } from '../CommandForm/fields';
7
7
  import '@cratis/arc/validation';
8
8
  const meta = {
9
9
  title: 'CommandDialog/CommandDialog',
@@ -63,4 +63,155 @@ const DialogWrapper = () => {
63
63
  export const Default = {
64
64
  render: () => _jsx(DialogWrapper, {}),
65
65
  };
66
+ const EditUserWrapper = () => {
67
+ const [visible, setVisible] = useState(false);
68
+ const [selectedUser, setSelectedUser] = useState(undefined);
69
+ const [result, setResult] = useState('');
70
+ const users = [
71
+ { name: 'Jane Doe', email: 'jane@example.com', age: 30 },
72
+ { name: 'John Smith', email: 'john@example.com', age: 45 },
73
+ ];
74
+ const handleEdit = (user) => {
75
+ setSelectedUser(user);
76
+ setResult('');
77
+ setVisible(true);
78
+ };
79
+ return (_jsxs("div", { className: "storybook-wrapper", children: [_jsx("div", { style: { display: 'flex', gap: '0.5rem', marginBottom: '1rem' }, children: users.map(user => (_jsxs("button", { className: "p-button p-component", onClick: () => handleEdit(user), children: ["Edit ", user.name] }, user.email))) }), result && (_jsxs("div", { className: "p-3 mt-3 bg-green-100 border-round", children: [_jsx("strong", { children: "Saved:" }), " ", result] })), _jsxs(CommandDialog, { command: UpdateUserCommand, initialValues: selectedUser, visible: visible, header: `Edit User: ${selectedUser?.name ?? ''}`, confirmLabel: "Save", cancelLabel: "Cancel", onConfirm: async () => {
80
+ setResult(`User "${selectedUser?.name}" updated successfully`);
81
+ setVisible(false);
82
+ }, onCancel: () => setVisible(false), children: [_jsx(InputTextField, { value: (c) => c.name, title: "Name", placeholder: "Enter name" }), _jsx(InputTextField, { value: (c) => c.email, title: "Email", placeholder: "Enter email", type: "email" }), _jsx(NumberField, { value: (c) => c.age, title: "Age", placeholder: "Enter age" })] }, selectedUser?.email ?? 'empty')] }));
83
+ };
84
+ export const WithInitialValues = {
85
+ render: () => _jsx(EditUserWrapper, {}),
86
+ };
87
+ const CustomValidationWrapper = () => {
88
+ const [visible, setVisible] = useState(true);
89
+ const [result, setResult] = useState('');
90
+ return (_jsxs("div", { className: "storybook-wrapper", children: [_jsx("button", { className: "p-button p-component mb-3", onClick: () => {
91
+ setResult('');
92
+ setVisible(true);
93
+ }, children: "Open Dialog" }), result && (_jsxs("div", { className: "p-3 mt-3 bg-green-100 border-round", children: [_jsx("strong", { children: "Saved:" }), " ", result] })), _jsxs(CommandDialog, { command: UpdateUserCommand, visible: visible, header: "Add User (with Custom Validation)", confirmLabel: "Save", cancelLabel: "Cancel", onConfirm: async () => {
94
+ setResult('User added successfully');
95
+ setVisible(false);
96
+ }, onCancel: () => setVisible(false), onFieldValidate: (_command, fieldName, _oldValue, newValue) => {
97
+ if (fieldName === 'name') {
98
+ const name = newValue;
99
+ if (name && name.toLowerCase().includes('test')) {
100
+ return 'Name cannot contain the word "test"';
101
+ }
102
+ if (name && !/^[a-zA-Z\s]+$/.test(name)) {
103
+ return 'Name can only contain letters and spaces';
104
+ }
105
+ }
106
+ if (fieldName === 'email') {
107
+ const email = newValue;
108
+ if (email && email.endsWith('@example.com')) {
109
+ return 'Please use a real email address, not @example.com';
110
+ }
111
+ }
112
+ return undefined;
113
+ }, children: [_jsx(InputTextField, { value: (c) => c.name, title: "Name", placeholder: 'Try "test123" or numbers' }), _jsx(InputTextField, { value: (c) => c.email, title: "Email", placeholder: 'Try user@example.com', type: "email" }), _jsx(NumberField, { value: (c) => c.age, title: "Age", placeholder: "Enter age (18-120)" })] })] }));
114
+ };
115
+ export const WithCustomValidation = {
116
+ render: () => _jsx(CustomValidationWrapper, {}),
117
+ };
118
+ const ValidationOnBlurWrapper = () => {
119
+ const [visible, setVisible] = useState(true);
120
+ return (_jsxs("div", { className: "storybook-wrapper", children: [_jsx("button", { className: "p-button p-component mb-3", onClick: () => setVisible(true), children: "Open Dialog" }), _jsxs(CommandDialog, { command: UpdateUserCommand, visible: visible, header: "Validation on Blur", confirmLabel: "Save", cancelLabel: "Cancel", validateOn: "blur", onConfirm: async () => setVisible(false), onCancel: () => setVisible(false), children: [_jsx(InputTextField, { value: (c) => c.name, title: "Name", placeholder: "Click away to validate" }), _jsx(InputTextField, { value: (c) => c.email, title: "Email", placeholder: "Click away to validate", type: "email" }), _jsx(NumberField, { value: (c) => c.age, title: "Age", placeholder: "Click away to validate" })] })] }));
121
+ };
122
+ export const ValidationOnBlur = {
123
+ render: () => _jsx(ValidationOnBlurWrapper, {}),
124
+ };
125
+ const ValidationOnChangeWrapper = () => {
126
+ const [visible, setVisible] = useState(true);
127
+ return (_jsxs("div", { className: "storybook-wrapper", children: [_jsx("button", { className: "p-button p-component mb-3", onClick: () => setVisible(true), children: "Open Dialog" }), _jsxs(CommandDialog, { command: UpdateUserCommand, visible: visible, header: "Validation on Change", confirmLabel: "Save", cancelLabel: "Cancel", validateOn: "change", onConfirm: async () => setVisible(false), onCancel: () => setVisible(false), children: [_jsx(InputTextField, { value: (c) => c.name, title: "Name", placeholder: "Errors appear while typing" }), _jsx(InputTextField, { value: (c) => c.email, title: "Email", placeholder: "Errors appear while typing", type: "email" }), _jsx(NumberField, { value: (c) => c.age, title: "Age", placeholder: "Errors appear while typing" })] })] }));
128
+ };
129
+ export const ValidationOnChange = {
130
+ render: () => _jsx(ValidationOnChangeWrapper, {}),
131
+ };
132
+ const ValidateOnInitWrapper = () => {
133
+ const [visible, setVisible] = useState(true);
134
+ return (_jsxs("div", { className: "storybook-wrapper", children: [_jsx("button", { className: "p-button p-component mb-3", onClick: () => setVisible(true), children: "Open Dialog" }), _jsxs(CommandDialog, { command: UpdateUserCommand, visible: visible, header: "Validate on Initialization", confirmLabel: "Save", cancelLabel: "Cancel", validateOnInit: true, initialValues: { name: 'A', email: 'invalid', age: 10 }, onConfirm: async () => setVisible(false), onCancel: () => setVisible(false), children: [_jsx(InputTextField, { value: (c) => c.name, title: "Name", placeholder: "Errors shown immediately" }), _jsx(InputTextField, { value: (c) => c.email, title: "Email", placeholder: "Errors shown immediately", type: "email" }), _jsx(NumberField, { value: (c) => c.age, title: "Age", placeholder: "Errors shown immediately" })] })] }));
135
+ };
136
+ export const ValidateOnInit = {
137
+ render: () => _jsx(ValidateOnInitWrapper, {}),
138
+ };
139
+ const ValidateAllFieldsWrapper = () => {
140
+ const [visible, setVisible] = useState(true);
141
+ return (_jsxs("div", { className: "storybook-wrapper", children: [_jsx("button", { className: "p-button p-component mb-3", onClick: () => setVisible(true), children: "Open Dialog" }), _jsxs(CommandDialog, { command: UpdateUserCommand, visible: visible, header: "Validate All Fields on Change", confirmLabel: "Save", cancelLabel: "Cancel", validateOn: "blur", validateAllFieldsOnChange: true, onConfirm: async () => setVisible(false), onCancel: () => setVisible(false), children: [_jsx(InputTextField, { value: (c) => c.name, title: "Name", placeholder: "Blur one field \u2014 all validate" }), _jsx(InputTextField, { value: (c) => c.email, title: "Email", placeholder: "Blur one field \u2014 all validate", type: "email" }), _jsx(NumberField, { value: (c) => c.age, title: "Age", placeholder: "Blur one field \u2014 all validate" })] })] }));
142
+ };
143
+ export const ValidateAllFieldsOnChange = {
144
+ render: () => _jsx(ValidateAllFieldsWrapper, {}),
145
+ };
146
+ const BeforeExecuteWrapper = () => {
147
+ const [visible, setVisible] = useState(true);
148
+ const [preprocessedData, setPreprocessedData] = useState('');
149
+ return (_jsxs("div", { className: "storybook-wrapper", children: [_jsx("button", { className: "p-button p-component mb-3", onClick: () => { setVisible(true); setPreprocessedData(''); }, children: "Open Dialog" }), preprocessedData && (_jsxs("div", { className: "p-3 mt-3 bg-green-100 border-round", children: [_jsx("strong", { children: "Preprocessed before submit:" }), _jsx("pre", { style: { marginTop: '0.5rem', fontSize: '0.875rem' }, children: preprocessedData })] })), _jsxs(CommandDialog, { command: UpdateUserCommand, visible: visible, header: "Before Execute Callback", confirmLabel: "Save", cancelLabel: "Cancel", initialValues: { name: '', email: '', age: 18 }, onBeforeExecute: (command) => {
150
+ command.name = command.name.trim().replace(/\s+/g, ' ');
151
+ command.email = command.email.toLowerCase().trim();
152
+ return command;
153
+ }, onConfirm: async (result) => {
154
+ setPreprocessedData(JSON.stringify(result, null, 2));
155
+ setVisible(false);
156
+ }, onCancel: () => setVisible(false), children: [_jsx(InputTextField, { value: (c) => c.name, title: "Name", placeholder: 'Try " Extra Spaces "' }), _jsx(InputTextField, { value: (c) => c.email, title: "Email", placeholder: "Try UPPERCASE@EMAIL.COM", type: "email" }), _jsx(NumberField, { value: (c) => c.age, title: "Age", placeholder: "Enter age (18-120)" })] })] }));
157
+ };
158
+ export const BeforeExecute = {
159
+ render: () => _jsx(BeforeExecuteWrapper, {}),
160
+ };
161
+ const WithIconsWrapper = () => {
162
+ const [visible, setVisible] = useState(true);
163
+ return (_jsxs("div", { className: "storybook-wrapper", children: [_jsx("button", { className: "p-button p-component mb-3", onClick: () => setVisible(true), children: "Open Dialog" }), _jsxs(CommandDialog, { command: UpdateUserCommand, visible: visible, header: "Fields with Icons", confirmLabel: "Save", cancelLabel: "Cancel", onConfirm: async () => setVisible(false), onCancel: () => setVisible(false), children: [_jsx(InputTextField, { value: (c) => c.name, title: "Name", placeholder: "Enter name", icon: _jsx("span", { style: { fontSize: '1.25rem' }, children: "\uD83D\uDC64" }) }), _jsx(InputTextField, { value: (c) => c.email, title: "Email", placeholder: "Enter email", type: "email", icon: _jsx("span", { style: { fontSize: '1.25rem' }, children: "\uD83D\uDCE7" }) }), _jsx(NumberField, { value: (c) => c.age, title: "Age", placeholder: "Enter age", icon: _jsx("span", { style: { fontSize: '1.25rem' }, children: "\uD83C\uDF82" }) })] })] }));
164
+ };
165
+ export const WithIcons = {
166
+ render: () => _jsx(WithIconsWrapper, {}),
167
+ };
168
+ class UpdateProfileCommandValidator extends CommandValidator {
169
+ constructor() {
170
+ super();
171
+ this.ruleFor((c) => c.firstName).notEmpty().minLength(2);
172
+ this.ruleFor((c) => c.lastName).notEmpty().minLength(2);
173
+ this.ruleFor((c) => c.email).notEmpty().emailAddress();
174
+ this.ruleFor((c) => c.phone).notEmpty();
175
+ this.ruleFor((c) => c.bio).notEmpty().minLength(10);
176
+ }
177
+ }
178
+ class UpdateProfileCommand extends Command {
179
+ route = '/api/profile/update';
180
+ validation = new UpdateProfileCommandValidator();
181
+ propertyDescriptors = [
182
+ new PropertyDescriptor('firstName', String),
183
+ new PropertyDescriptor('lastName', String),
184
+ new PropertyDescriptor('email', String),
185
+ new PropertyDescriptor('phone', String),
186
+ new PropertyDescriptor('bio', String),
187
+ ];
188
+ firstName = '';
189
+ lastName = '';
190
+ email = '';
191
+ phone = '';
192
+ bio = '';
193
+ constructor() {
194
+ super(Object, false);
195
+ }
196
+ get requestParameters() {
197
+ return [];
198
+ }
199
+ get properties() {
200
+ return ['firstName', 'lastName', 'email', 'phone', 'bio'];
201
+ }
202
+ }
203
+ const MultiColumnWrapper = () => {
204
+ const [visible, setVisible] = useState(true);
205
+ return (_jsxs("div", { className: "storybook-wrapper", children: [_jsx("button", { className: "p-button p-component mb-3", onClick: () => setVisible(true), children: "Open Dialog" }), _jsxs(CommandDialog, { command: UpdateProfileCommand, visible: visible, header: "Edit Profile", confirmLabel: "Save", cancelLabel: "Cancel", width: "70vw", onConfirm: async () => setVisible(false), onCancel: () => setVisible(false), children: [_jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1.5rem' }, children: [_jsxs(CommandDialog.Column, { children: [_jsx(InputTextField, { value: (c) => c.firstName, title: "First Name", placeholder: "Enter first name" }), _jsx(InputTextField, { value: (c) => c.email, title: "Email", placeholder: "Enter email", type: "email" })] }), _jsxs(CommandDialog.Column, { children: [_jsx(InputTextField, { value: (c) => c.lastName, title: "Last Name", placeholder: "Enter last name" }), _jsx(InputTextField, { value: (c) => c.phone, title: "Phone", placeholder: "Enter phone number" })] })] }), _jsx(TextAreaField, { value: (c) => c.bio, title: "Bio", placeholder: "Tell us about yourself", rows: 3 })] })] }));
206
+ };
207
+ export const MultiColumnLayout = {
208
+ render: () => _jsx(MultiColumnWrapper, {}),
209
+ };
210
+ const MixedChildrenWrapper = () => {
211
+ const [visible, setVisible] = useState(true);
212
+ return (_jsxs("div", { className: "storybook-wrapper", children: [_jsx("button", { className: "p-button p-component mb-3", onClick: () => setVisible(true), children: "Open Dialog" }), _jsxs(CommandDialog, { command: UpdateProfileCommand, visible: visible, header: "Edit Profile (Mixed Children)", confirmLabel: "Save", cancelLabel: "Cancel", onConfirm: async () => setVisible(false), onCancel: () => setVisible(false), children: [_jsx("h3", { style: { marginTop: 0, marginBottom: '0.75rem' }, children: "Personal Information" }), _jsx(InputTextField, { value: (c) => c.firstName, title: "First Name", placeholder: "Enter first name" }), _jsx(InputTextField, { value: (c) => c.lastName, title: "Last Name", placeholder: "Enter last name" }), _jsx("h3", { style: { marginTop: '1rem', marginBottom: '0.75rem' }, children: "Contact Details" }), _jsx(InputTextField, { value: (c) => c.email, title: "Email", placeholder: "Enter email", type: "email" }), _jsx(InputTextField, { value: (c) => c.phone, title: "Phone", placeholder: "Enter phone number" }), _jsx("h3", { style: { marginTop: '1rem', marginBottom: '0.75rem' }, children: "About You" }), _jsx(TextAreaField, { value: (c) => c.bio, title: "Bio", placeholder: "Tell us about yourself (min 10 chars)", rows: 3 })] })] }));
213
+ };
214
+ export const MixedChildren = {
215
+ render: () => _jsx(MixedChildrenWrapper, {}),
216
+ };
66
217
  //# sourceMappingURL=CommandDialog.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommandDialog.stories.js","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.stories.tsx"],"names":[],"mappings":";AAGA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,wBAAwB,CAAC;AAEhC,MAAM,IAAI,GAA+B;IACrC,KAAK,EAAE,6BAA6B;IACpC,SAAS,EAAE,aAAa;CAC3B,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,0BAA2B,SAAQ,gBAAgB;IACrD;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,CAAC,CAAC,CAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACrF,IAAI,CAAC,OAAO,CAAC,CAAC,CAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,YAAY,EAAE,CAAC;QAC1E,IAAI,CAAC,OAAO,CAAC,CAAC,CAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC9F,CAAC;CACJ;AAED,MAAM,iBA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,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAC,OAAO,EAAC,WAAW,EAAC,oBAAoB,GAAG,EAE9G,aAAI,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,0BAAgB,EACzE,KAAC,aAAa,IAAC,KAAK,EAAE,CAAC,CAAuB,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,EAAC,KAAK,EAAC,WAAW,EAAC,uCAAuC,EAAC,IAAI,EAAE,CAAC,GAAI,IACzH,IACd,CACT,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAU;IAChC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,oBAAoB,KAAG;CACzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataPage.stories.d.ts","sourceRoot":"","sources":["../../../DataPage/DataPage.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAY,MAAM,YAAY,CAAC;AAIhD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAM/B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AA8CvC,eAAO,MAAM,OAAO,EAAE,KAuCrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KA0B5B,CAAC"}
1
+ {"version":3,"file":"DataPage.stories.d.ts","sourceRoot":"","sources":["../../../DataPage/DataPage.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAY,MAAM,YAAY,CAAC;AAIhD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAM/B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAsEvC,eAAO,MAAM,OAAO,EAAE,KAuCrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KA0B5B,CAAC"}