@cratis/components 0.1.9 → 0.1.12
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/CommandForm/CommandFormFields.js +9 -3
- package/dist/cjs/CommandForm/CommandFormFields.js.map +1 -1
- package/dist/cjs/CommandForm/ValidationMessage.js +24 -0
- package/dist/cjs/CommandForm/ValidationMessage.js.map +1 -0
- package/dist/cjs/CommandForm/asCommandFormField.js +47 -0
- package/dist/cjs/CommandForm/asCommandFormField.js.map +1 -0
- package/dist/cjs/CommandForm/fields/CheckboxField.js +13 -0
- package/dist/cjs/CommandForm/fields/CheckboxField.js.map +1 -0
- package/dist/cjs/CommandForm/fields/DropdownField.js +13 -0
- package/dist/cjs/CommandForm/fields/DropdownField.js.map +1 -0
- package/dist/cjs/CommandForm/fields/InputTextField.js +13 -0
- package/dist/cjs/CommandForm/fields/InputTextField.js.map +1 -0
- package/dist/cjs/CommandForm/fields/NumberField.js +13 -0
- package/dist/cjs/CommandForm/fields/NumberField.js.map +1 -0
- package/dist/cjs/CommandForm/fields/SliderField.js +17 -0
- package/dist/cjs/CommandForm/fields/SliderField.js.map +1 -0
- package/dist/cjs/CommandForm/fields/TextAreaField.js +13 -0
- package/dist/cjs/CommandForm/fields/TextAreaField.js.map +1 -0
- package/dist/cjs/CommandForm/index.js +15 -7
- package/dist/cjs/CommandForm/index.js.map +1 -1
- package/dist/cjs/PivotViewer/PivotViewer.css +1258 -0
- package/dist/cjs/PivotViewer/PivotViewer.js +14 -0
- package/dist/cjs/PivotViewer/PivotViewer.js.map +1 -1
- package/dist/cjs/PivotViewer/components/PivotCanvas.js +33 -10
- package/dist/cjs/PivotViewer/components/PivotCanvas.js.map +1 -1
- package/dist/cjs/PivotViewer/components/PivotViewerMain.js +1 -1
- package/dist/cjs/PivotViewer/components/PivotViewerMain.js.map +1 -1
- package/dist/cjs/PivotViewer/components/Spinner.css +77 -0
- package/dist/cjs/PivotViewer/components/pivot/sprites.js +79 -15
- package/dist/cjs/PivotViewer/components/pivot/sprites.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/visibility.js +36 -10
- package/dist/cjs/PivotViewer/components/pivot/visibility.js.map +1 -1
- package/dist/cjs/PivotViewer/engine/layout.js +2 -1
- package/dist/cjs/PivotViewer/engine/layout.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/usePivotEngine.js +37 -2
- package/dist/cjs/PivotViewer/hooks/usePivotEngine.js.map +1 -1
- package/dist/cjs/PivotViewer/index.js +3 -0
- package/dist/cjs/PivotViewer/index.js.map +1 -1
- package/dist/cjs/PivotViewer/types.js +22 -0
- package/dist/cjs/PivotViewer/types.js.map +1 -0
- package/dist/cjs/TimeMachine/EventsView.css +213 -0
- package/dist/cjs/TimeMachine/TimeMachine.css +567 -0
- package/dist/cjs/TimeMachine/TimeMachine.js +8 -3
- package/dist/cjs/TimeMachine/TimeMachine.js.map +1 -1
- package/dist/esm/CommandForm/CommandForm.stories.d.ts +1 -0
- package/dist/esm/CommandForm/CommandForm.stories.d.ts.map +1 -1
- package/dist/esm/CommandForm/CommandForm.stories.js +34 -1
- package/dist/esm/CommandForm/CommandForm.stories.js.map +1 -1
- package/dist/esm/CommandForm/CommandFormFields.d.ts.map +1 -1
- package/dist/esm/CommandForm/CommandFormFields.js +9 -3
- package/dist/esm/CommandForm/CommandFormFields.js.map +1 -1
- package/dist/esm/CommandForm/UserRegistrationCommand.d.ts +63 -0
- package/dist/esm/CommandForm/UserRegistrationCommand.d.ts.map +1 -0
- package/dist/esm/CommandForm/UserRegistrationCommand.js +143 -0
- package/dist/esm/CommandForm/UserRegistrationCommand.js.map +1 -0
- package/dist/esm/CommandForm/ValidationMessage.d.ts +8 -0
- package/dist/esm/CommandForm/ValidationMessage.d.ts.map +1 -0
- package/dist/esm/CommandForm/ValidationMessage.js +22 -0
- package/dist/esm/CommandForm/ValidationMessage.js.map +1 -0
- package/dist/esm/CommandForm/asCommandFormField.d.ts +32 -0
- package/dist/esm/CommandForm/asCommandFormField.d.ts.map +1 -0
- package/dist/esm/CommandForm/asCommandFormField.js +45 -0
- package/dist/esm/CommandForm/asCommandFormField.js.map +1 -0
- package/dist/esm/CommandForm/fields/CheckboxField.d.ts +10 -0
- package/dist/esm/CommandForm/fields/CheckboxField.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/CheckboxField.js +11 -0
- package/dist/esm/CommandForm/fields/CheckboxField.js.map +1 -0
- package/dist/esm/CommandForm/fields/DropdownField.d.ts +15 -0
- package/dist/esm/CommandForm/fields/DropdownField.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/DropdownField.js +11 -0
- package/dist/esm/CommandForm/fields/DropdownField.js.map +1 -0
- package/dist/esm/CommandForm/fields/InputTextField.d.ts +11 -0
- package/dist/esm/CommandForm/fields/InputTextField.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/InputTextField.js +11 -0
- package/dist/esm/CommandForm/fields/InputTextField.js.map +1 -0
- package/dist/esm/CommandForm/fields/NumberField.d.ts +13 -0
- package/dist/esm/CommandForm/fields/NumberField.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/NumberField.js +11 -0
- package/dist/esm/CommandForm/fields/NumberField.js.map +1 -0
- package/dist/esm/CommandForm/fields/SliderField.d.ts +12 -0
- package/dist/esm/CommandForm/fields/SliderField.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/SliderField.js +15 -0
- package/dist/esm/CommandForm/fields/SliderField.js.map +1 -0
- package/dist/esm/CommandForm/fields/TextAreaField.d.ts +12 -0
- package/dist/esm/CommandForm/fields/TextAreaField.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/TextAreaField.js +11 -0
- package/dist/esm/CommandForm/fields/TextAreaField.js.map +1 -0
- package/dist/esm/CommandForm/fields/index.d.ts +7 -0
- package/dist/esm/CommandForm/fields/index.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/index.js +7 -0
- package/dist/esm/CommandForm/fields/index.js.map +1 -0
- package/dist/esm/CommandForm/index.d.ts +3 -4
- package/dist/esm/CommandForm/index.d.ts.map +1 -1
- package/dist/esm/CommandForm/index.js +8 -4
- package/dist/esm/CommandForm/index.js.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.css +1258 -0
- package/dist/esm/PivotViewer/PivotViewer.d.ts.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.js +14 -0
- package/dist/esm/PivotViewer/PivotViewer.js.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.stories.d.ts +1 -0
- package/dist/esm/PivotViewer/PivotViewer.stories.d.ts.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.stories.js +43 -3
- package/dist/esm/PivotViewer/PivotViewer.stories.js.map +1 -1
- package/dist/esm/PivotViewer/components/PivotCanvas.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/PivotCanvas.js +33 -10
- package/dist/esm/PivotViewer/components/PivotCanvas.js.map +1 -1
- package/dist/esm/PivotViewer/components/PivotViewerMain.js +1 -1
- package/dist/esm/PivotViewer/components/PivotViewerMain.js.map +1 -1
- package/dist/esm/PivotViewer/components/Spinner.css +77 -0
- package/dist/esm/PivotViewer/components/pivot/sprites.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/sprites.js +79 -15
- package/dist/esm/PivotViewer/components/pivot/sprites.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/visibility.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/visibility.js +36 -10
- package/dist/esm/PivotViewer/components/pivot/visibility.js.map +1 -1
- package/dist/esm/PivotViewer/engine/layout.js +2 -1
- package/dist/esm/PivotViewer/engine/layout.js.map +1 -1
- package/dist/esm/PivotViewer/engine/pivot.worker.d.ts.map +1 -1
- package/dist/esm/PivotViewer/engine/pivot.worker.js +22 -7
- package/dist/esm/PivotViewer/engine/pivot.worker.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/useFilteredData.d.ts +2 -2
- package/dist/esm/PivotViewer/hooks/useFilteredData.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/useFilteredData.js +4 -2
- package/dist/esm/PivotViewer/hooks/useFilteredData.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/usePivotEngine.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/usePivotEngine.js +37 -2
- package/dist/esm/PivotViewer/hooks/usePivotEngine.js.map +1 -1
- package/dist/esm/PivotViewer/index.d.ts +2 -1
- package/dist/esm/PivotViewer/index.d.ts.map +1 -1
- package/dist/esm/PivotViewer/index.js +1 -0
- package/dist/esm/PivotViewer/index.js.map +1 -1
- package/dist/esm/PivotViewer/types.d.ts +4 -1
- package/dist/esm/PivotViewer/types.d.ts.map +1 -1
- package/dist/esm/PivotViewer/types.js +19 -2
- package/dist/esm/PivotViewer/types.js.map +1 -1
- package/dist/esm/TimeMachine/EventsView.css +213 -0
- package/dist/esm/TimeMachine/TimeMachine.css +567 -0
- package/dist/esm/TimeMachine/TimeMachine.d.ts.map +1 -1
- package/dist/esm/TimeMachine/TimeMachine.js +8 -3
- package/dist/esm/TimeMachine/TimeMachine.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +31 -32
- package/.storybook/main.ts +0 -24
- package/CommandDialog/CommandDialog.stories.tsx +0 -25
- package/CommandDialog/CommandDialog.tsx +0 -161
- package/CommandDialog/index.ts +0 -4
- package/CommandForm/CommandForm.stories.tsx +0 -24
- package/CommandForm/CommandForm.tsx +0 -266
- package/CommandForm/CommandFormField.tsx +0 -27
- package/CommandForm/CommandFormFields.tsx +0 -142
- package/CommandForm/DatePickerField.tsx +0 -57
- package/CommandForm/DropdownField.tsx +0 -65
- package/CommandForm/InputTextField.tsx +0 -62
- package/CommandForm/SliderField.tsx +0 -68
- package/CommandForm/index.ts +0 -10
- package/Common/ErrorBoundary.stories.tsx +0 -10
- package/Common/ErrorBoundary.tsx +0 -41
- package/Common/FormElement.stories.tsx +0 -10
- package/Common/FormElement.tsx +0 -20
- package/Common/Page.stories.tsx +0 -10
- package/Common/Page.tsx +0 -21
- package/Common/index.ts +0 -6
- package/DataPage/DataPage.stories.tsx +0 -10
- package/DataPage/DataPage.tsx +0 -191
- package/DataPage/index.ts +0 -4
- package/DataTables/DataTableForObservableQuery.stories.tsx +0 -10
- package/DataTables/DataTableForObservableQuery.tsx +0 -97
- package/DataTables/DataTableForQuery.stories.tsx +0 -10
- package/DataTables/DataTableForQuery.tsx +0 -97
- package/DataTables/index.ts +0 -5
- package/Dialogs/BusyIndicatorDialog.stories.tsx +0 -26
- package/Dialogs/BusyIndicatorDialog.tsx +0 -26
- package/Dialogs/ConfirmationDialog.stories.tsx +0 -36
- package/Dialogs/ConfirmationDialog.tsx +0 -75
- package/Dialogs/index.ts +0 -5
- package/Dropdown/Dropdown.tsx +0 -23
- package/Dropdown/index.ts +0 -4
- package/PivotViewer/PivotViewer.stories.tsx +0 -24
- package/PivotViewer/PivotViewer.tsx +0 -791
- package/PivotViewer/components/AxisLabels.tsx +0 -69
- package/PivotViewer/components/DetailPanel.tsx +0 -108
- package/PivotViewer/components/FilterPanel.tsx +0 -189
- package/PivotViewer/components/FilterPanelContainer.tsx +0 -10
- package/PivotViewer/components/PivotCanvas.tsx +0 -660
- package/PivotViewer/components/PivotViewerMain.tsx +0 -229
- package/PivotViewer/components/RangeHistogramFilter.tsx +0 -220
- package/PivotViewer/components/Spinner.tsx +0 -21
- package/PivotViewer/components/Toolbar.tsx +0 -130
- package/PivotViewer/components/ToolbarContainer.tsx +0 -10
- package/PivotViewer/components/index.ts +0 -12
- package/PivotViewer/components/pivot/animation.ts +0 -108
- package/PivotViewer/components/pivot/buckets.ts +0 -152
- package/PivotViewer/components/pivot/colorResolver.ts +0 -67
- package/PivotViewer/components/pivot/constants.ts +0 -46
- package/PivotViewer/components/pivot/sprites.ts +0 -265
- package/PivotViewer/components/pivot/visibility.ts +0 -319
- package/PivotViewer/constants.ts +0 -9
- package/PivotViewer/engine/layout.ts +0 -149
- package/PivotViewer/engine/pivot.worker.ts +0 -86
- package/PivotViewer/engine/store.ts +0 -437
- package/PivotViewer/engine/types.ts +0 -255
- package/PivotViewer/hooks/index.ts +0 -13
- package/PivotViewer/hooks/useContainerDimensions.ts +0 -45
- package/PivotViewer/hooks/useDimensionState.ts +0 -53
- package/PivotViewer/hooks/useFilterOptions.ts +0 -36
- package/PivotViewer/hooks/useFilterPanelDrag.ts +0 -49
- package/PivotViewer/hooks/useFilterState.ts +0 -106
- package/PivotViewer/hooks/useFilteredData.ts +0 -119
- package/PivotViewer/hooks/usePanning.ts +0 -163
- package/PivotViewer/hooks/usePivotEngine.ts +0 -252
- package/PivotViewer/hooks/useSelectedItem.ts +0 -402
- package/PivotViewer/hooks/useWheelZoom.ts +0 -114
- package/PivotViewer/hooks/useZoomState.ts +0 -34
- package/PivotViewer/index.ts +0 -7
- package/PivotViewer/types.ts +0 -59
- package/PivotViewer/utils/animations.ts +0 -249
- package/PivotViewer/utils/constants.ts +0 -20
- package/PivotViewer/utils/index.ts +0 -6
- package/PivotViewer/utils/selection.ts +0 -292
- package/PivotViewer/utils/utils.ts +0 -259
- package/TimeMachine/EventsView.stories.tsx +0 -10
- package/TimeMachine/EventsView.tsx +0 -119
- package/TimeMachine/Properties.stories.tsx +0 -10
- package/TimeMachine/Properties.tsx +0 -98
- package/TimeMachine/ReadModelView.stories.tsx +0 -10
- package/TimeMachine/ReadModelView.tsx +0 -143
- package/TimeMachine/TimeMachine.stories.tsx +0 -10
- package/TimeMachine/TimeMachine.tsx +0 -244
- package/TimeMachine/index.ts +0 -8
- package/TimeMachine/types.ts +0 -23
- package/dist/cjs/CommandForm/DatePickerField.js +0 -31
- package/dist/cjs/CommandForm/DatePickerField.js.map +0 -1
- package/dist/cjs/CommandForm/DropdownField.js +0 -31
- package/dist/cjs/CommandForm/DropdownField.js.map +0 -1
- package/dist/cjs/CommandForm/InputTextField.js +0 -32
- package/dist/cjs/CommandForm/InputTextField.js.map +0 -1
- package/dist/cjs/CommandForm/SliderField.js +0 -34
- package/dist/cjs/CommandForm/SliderField.js.map +0 -1
- package/dist/esm/CommandForm/DatePickerField.d.ts +0 -20
- package/dist/esm/CommandForm/DatePickerField.d.ts.map +0 -1
- package/dist/esm/CommandForm/DatePickerField.js +0 -29
- package/dist/esm/CommandForm/DatePickerField.js.map +0 -1
- package/dist/esm/CommandForm/DropdownField.d.ts +0 -24
- package/dist/esm/CommandForm/DropdownField.d.ts.map +0 -1
- package/dist/esm/CommandForm/DropdownField.js +0 -29
- package/dist/esm/CommandForm/DropdownField.js.map +0 -1
- package/dist/esm/CommandForm/InputTextField.d.ts +0 -20
- package/dist/esm/CommandForm/InputTextField.d.ts.map +0 -1
- package/dist/esm/CommandForm/InputTextField.js +0 -30
- package/dist/esm/CommandForm/InputTextField.js.map +0 -1
- package/dist/esm/CommandForm/SliderField.d.ts +0 -23
- package/dist/esm/CommandForm/SliderField.d.ts.map +0 -1
- package/dist/esm/CommandForm/SliderField.js +0 -32
- package/dist/esm/CommandForm/SliderField.js.map +0 -1
- package/global.d.ts +0 -11
- package/index.ts +0 -22
- package/useOverlayZIndex.ts +0 -32
- package/vite.config.ts +0 -80
|
@@ -1,12 +1,45 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { CommandForm } from './CommandForm';
|
|
4
|
+
import { ValidationMessage } from './ValidationMessage';
|
|
5
|
+
import { UserRegistrationCommand } from './UserRegistrationCommand';
|
|
6
|
+
import { InputTextField, NumberField, TextAreaField, CheckboxField, RangeField, SelectField } from './fields';
|
|
7
|
+
import { Button } from 'primereact/button';
|
|
3
8
|
const meta = {
|
|
4
9
|
title: 'CommandForm/CommandForm',
|
|
5
10
|
component: CommandForm,
|
|
6
11
|
};
|
|
7
12
|
export default meta;
|
|
13
|
+
const roleOptions = [
|
|
14
|
+
{ id: 'user', name: 'User' },
|
|
15
|
+
{ id: 'admin', name: 'Administrator' },
|
|
16
|
+
{ id: 'moderator', name: 'Moderator' }
|
|
17
|
+
];
|
|
8
18
|
export const Default = {
|
|
9
19
|
args: {},
|
|
10
20
|
render: (args) => (_jsx("div", { className: "storybook-wrapper", children: _jsx(CommandForm, { ...args }) }))
|
|
11
21
|
};
|
|
22
|
+
export const UserRegistration = {
|
|
23
|
+
render: () => {
|
|
24
|
+
const [result, setResult] = useState('');
|
|
25
|
+
const handleSubmit = () => {
|
|
26
|
+
setResult('Form submitted successfully!');
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs("div", { className: "p-8 w-[800px] mx-auto", children: [_jsx("h2", { className: "text-2xl font-bold mb-6", children: "User Registration Form" }), _jsx("h3", { className: "text-xl font-semibold mb-4 mt-6", children: "Account Information" }), _jsxs(CommandForm, { command: UserRegistrationCommand, initialValues: {
|
|
29
|
+
username: '',
|
|
30
|
+
email: '',
|
|
31
|
+
password: '',
|
|
32
|
+
confirmPassword: '',
|
|
33
|
+
age: 18,
|
|
34
|
+
bio: '',
|
|
35
|
+
favoriteColor: '#3b82f6',
|
|
36
|
+
birthDate: '',
|
|
37
|
+
agreeToTerms: false,
|
|
38
|
+
experienceLevel: 50,
|
|
39
|
+
role: ''
|
|
40
|
+
}, onFieldChange: (cmd, fieldName, oldValue, newValue) => {
|
|
41
|
+
console.log(`Field ${fieldName} changed from`, oldValue, 'to', newValue);
|
|
42
|
+
}, children: [_jsx(InputTextField, { value: c => c.username, title: "Username", placeholder: "Enter username" }), _jsx(ValidationMessage, { value: c => c.username }), _jsx(InputTextField, { value: c => c.email, title: "Email Address", type: "email", placeholder: "Enter email" }), _jsx(ValidationMessage, { value: c => c.email }), _jsx(InputTextField, { value: c => c.password, title: "Password", type: "password", placeholder: "Enter password" }), _jsx(ValidationMessage, { value: c => c.password }), _jsx(InputTextField, { value: c => c.confirmPassword, title: "Confirm Password", type: "password", placeholder: "Confirm password" }), _jsx(ValidationMessage, { value: c => c.confirmPassword }), _jsx("h3", { className: "text-xl font-semibold mb-0 mt-6", children: "Personal Information" }), _jsx(NumberField, { value: c => c.age, title: "Age", placeholder: "Enter age", min: 13, max: 120 }), _jsx(ValidationMessage, { value: c => c.age }), _jsx(InputTextField, { value: c => c.birthDate, title: "Birth Date", type: "date", placeholder: "Select birth date" }), _jsx(ValidationMessage, { value: c => c.birthDate }), _jsx(TextAreaField, { value: c => c.bio, title: "Bio", placeholder: "Tell us about yourself", rows: 4, required: false }), _jsx(ValidationMessage, { value: c => c.bio }), _jsx(InputTextField, { value: c => c.favoriteColor, title: "Favorite Color", type: "color" }), _jsx(ValidationMessage, { value: c => c.favoriteColor }), _jsx("h3", { className: "text-xl font-semibold mb-0 mt-6", children: "Preferences" }), _jsx(SelectField, { value: c => c.role, title: "Role", options: roleOptions, optionIdField: "id", optionLabelField: "name", placeholder: "Select a role" }), _jsx(ValidationMessage, { value: c => c.role }), _jsx(RangeField, { value: c => c.experienceLevel, title: "Experience Level", min: 0, max: 100, step: 10 }), _jsx(ValidationMessage, { value: c => c.experienceLevel }), _jsx(CheckboxField, { value: c => c.agreeToTerms, title: "Terms & Conditions", label: "I agree to the terms and conditions" }), _jsx(ValidationMessage, { value: c => c.agreeToTerms })] }), _jsxs("div", { className: "flex gap-2 mt-6", children: [_jsx(Button, { label: "Submit", onClick: handleSubmit, severity: "success" }), _jsx(Button, { label: "Cancel", onClick: () => setResult(''), severity: "secondary" })] }), result && (_jsx("div", { className: "bg-green-100 p-4 rounded-lg mt-4 border border-green-300", children: _jsx("p", { className: "text-green-800 font-semibold m-0", children: result }) }))] }));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
12
45
|
//# sourceMappingURL=CommandForm.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandForm.stories.js","sourceRoot":"","sources":["../../../CommandForm/CommandForm.stories.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CommandForm.stories.js","sourceRoot":"","sources":["../../../CommandForm/CommandForm.stories.tsx"],"names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Q,EAAC,WAAW,GAAG,IAC1E,EAEL,MAAM,IAAI,CACP,cAAK,SAAS,EAAC,0DAA0D,YACrE,YAAG,SAAS,EAAC,kCAAkC,YAAE,MAAM,GAAK,GAC1D,CACT,IACC,CACT,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandFormFields.d.ts","sourceRoot":"","sources":["../../../CommandForm/CommandFormFields.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,MAAM,WAAW,UAAU;IACvB,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;CAC5D;AAED,MAAM,WAAW,sBAAsB;IACnC,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IAC1D,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CAC1B;
|
|
1
|
+
{"version":3,"file":"CommandFormFields.d.ts","sourceRoot":"","sources":["../../../CommandForm/CommandFormFields.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,MAAM,WAAW,UAAU;IACvB,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;CAC5D;AAED,MAAM,WAAW,sBAAsB;IACnC,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IAC1D,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CAC1B;AAkFD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CA8C9D,CAAC"}
|
|
@@ -21,11 +21,17 @@ const CommandFormFieldWrapper = ({ field, index }) => {
|
|
|
21
21
|
onValueChange: (value) => {
|
|
22
22
|
if (propertyName) {
|
|
23
23
|
const oldValue = currentValue;
|
|
24
|
+
context.setCommandValues({ [propertyName]: value });
|
|
25
|
+
if (context.commandInstance && typeof context.commandInstance.validate === 'function') {
|
|
26
|
+
const validationResult = context.commandInstance.validate();
|
|
27
|
+
if (validationResult) {
|
|
28
|
+
context.setCommandResult(validationResult);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
24
31
|
if (context.onFieldValidate) {
|
|
25
32
|
const validationError = context.onFieldValidate(context.commandInstance, propertyName, oldValue, value);
|
|
26
33
|
context.setCustomFieldError(propertyName, validationError);
|
|
27
34
|
}
|
|
28
|
-
context.setCommandValues({ [propertyName]: value });
|
|
29
35
|
if (context.onFieldChange) {
|
|
30
36
|
context.onFieldChange(context.commandInstance, propertyName, oldValue, value);
|
|
31
37
|
}
|
|
@@ -36,7 +42,7 @@ const CommandFormFieldWrapper = ({ field, index }) => {
|
|
|
36
42
|
invalid: !!errorMessage
|
|
37
43
|
});
|
|
38
44
|
const tooltipId = fieldProps.description ? `tooltip-${propertyName}-${index}` : undefined;
|
|
39
|
-
return (jsxs("div", {
|
|
45
|
+
return (jsxs("div", { className: "w-full", children: [jsxs("div", { className: "p-inputgroup w-full", children: [fieldProps.description && (jsx(Tooltip, { target: `.${tooltipId}`, content: fieldProps.description })), fieldProps.icon && (jsx("span", { className: `p-inputgroup-addon ${tooltipId || ''}`, children: fieldProps.icon })), clonedField] }), errorMessage && (jsx("small", { className: "p-error block mt-1", children: errorMessage }))] }));
|
|
40
46
|
};
|
|
41
47
|
const CommandFormFields = (props) => {
|
|
42
48
|
const { fields, columns } = props;
|
|
@@ -48,7 +54,7 @@ const CommandFormFields = (props) => {
|
|
|
48
54
|
return (jsx(CommandFormFieldWrapper, { field: field, index: index }, propertyName));
|
|
49
55
|
}) }, `column-${columnIndex}`))) }));
|
|
50
56
|
}
|
|
51
|
-
return (jsx("div", {
|
|
57
|
+
return (jsx("div", { className: "flex flex-col gap-4 w-full", children: (fields || []).map((field, index) => {
|
|
52
58
|
const fieldProps = field.props;
|
|
53
59
|
const propertyAccessor = fieldProps.value;
|
|
54
60
|
const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : `field-${index}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandFormFields.js","sources":["../../../CommandForm/CommandFormFields.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 { useCommandFormContext } from './CommandForm';\nimport React from 'react';\nimport { Tooltip } from 'primereact/tooltip';\nimport type { CommandFormFieldProps } from './CommandFormField';\n\nexport interface ColumnInfo {\n fields: React.ReactElement<CommandFormFieldProps<any>>[];\n}\n\nexport interface CommandFormFieldsProps {\n fields?: React.ReactElement<CommandFormFieldProps<any>>[];\n columns?: ColumnInfo[];\n}\n\n// Separate component for each field to prevent re-rendering all fields\nconst CommandFormFieldWrapper = ({ field, index }: { field: React.ReactElement<CommandFormFieldProps<any>>; index: number }) => {\n const context = useCommandFormContext<any>();\n const fieldProps = field.props as CommandFormFieldProps<any>;\n const propertyAccessor = fieldProps.value;\n\n // Get the property name from the accessor function\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : '';\n\n // Get the current value from the command instance\n const currentValue = propertyName ? (context.commandInstance as any)?.[propertyName] : undefined;\n\n // Get the error message for this field, if any\n const errorMessage = propertyName ? context.getFieldError(propertyName) : undefined;\n\n // Get the property descriptor for this field from the command instance\n const propertyDescriptor = propertyName && (context.commandInstance as any)?.propertyDescriptors\n ? (context.commandInstance as any).propertyDescriptors.find((pd: any) => pd.name === propertyName)\n : undefined;\n\n // Clone the field element with the current value and onChange handler\n const clonedField = React.cloneElement(field as React.ReactElement, {\n ...fieldProps,\n currentValue,\n propertyDescriptor,\n fieldName: propertyName,\n onValueChange: (value: unknown) => {\n if (propertyName) {\n const oldValue = currentValue;\n\n // Call custom field validator if provided\n if (context.onFieldValidate) {\n const validationError = context.onFieldValidate(context.commandInstance as any, propertyName, oldValue, value);\n context.setCustomFieldError(propertyName, validationError);\n }\n\n context.setCommandValues({ [propertyName]: value } as any);\n\n // Call field change callback if provided\n if (context.onFieldChange) {\n context.onFieldChange(context.commandInstance as any, propertyName, oldValue, value);\n }\n }\n fieldProps.onChange?.(value as any);\n },\n required: fieldProps.required ?? true,\n invalid: !!errorMessage\n } as any);\n\n const tooltipId = fieldProps.description ? `tooltip-${propertyName}-${index}` : undefined;\n\n return (\n <div style={{ width: '100%' }}>\n <div className=\"p-inputgroup\" style={{ width: '100%' }}>\n {fieldProps.description && (\n <Tooltip target={`.${tooltipId}`} content={fieldProps.description} />\n )}\n {fieldProps.icon && (\n <span className={`p-inputgroup-addon ${tooltipId || ''}`}>\n {fieldProps.icon}\n </span>\n )}\n {clonedField}\n </div>\n {errorMessage && (\n <small className=\"p-error block mt-1\">{errorMessage}</small>\n )}\n </div>\n );\n};\n\nexport const CommandFormFields = (props: CommandFormFieldsProps) => {\n const { fields, columns } = props;\n\n // Render columns if provided\n if (columns && columns.length > 0) {\n return (\n <div className=\"card flex flex-column md:flex-row gap-3\">\n {columns.map((column, columnIndex) => (\n <div key={`column-${columnIndex}`} className=\"flex flex-column gap-3 flex-1\">\n {column.fields.map((field, index) => {\n const fieldProps = field.props as CommandFormFieldProps<any>;\n const propertyAccessor = fieldProps.value;\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : `field-${columnIndex}-${index}`;\n\n return (\n <CommandFormFieldWrapper\n key={propertyName}\n field={field}\n index={index}\n />\n );\n })}\n </div>\n ))}\n </div>\n );\n }\n\n // Render fields (single column layout)\n return (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '1rem', width: '100%' }}>\n {(fields || []).map((field, index) => {\n const fieldProps = field.props as CommandFormFieldProps<any>;\n const propertyAccessor = fieldProps.value;\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : `field-${index}`;\n\n return (\n <CommandFormFieldWrapper\n key={propertyName}\n field={field}\n index={index}\n />\n );\n })}\n </div>\n );\n};\n\n// Helper function to extract property name from accessor function\nfunction getPropertyName<T>(accessor: (obj: T) => unknown): string {\n const fnStr = accessor.toString();\n const match = fnStr.match(/\\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);\n return match ? match[1] : '';\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;AAkBA,MAAM,uBAAuB,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAA4E,KAAI;AAC3H,IAAA,MAAM,OAAO,GAAG,qBAAqB,EAAO;AAC5C,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,KAAmC;AAC5D,IAAA,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK;AAGzC,IAAA,MAAM,YAAY,GAAG,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,CAAC,GAAG,EAAE;AAG9E,IAAA,MAAM,YAAY,GAAG,YAAY,GAAI,OAAO,CAAC,eAAuB,GAAG,YAAY,CAAC,GAAG,SAAS;AAGhG,IAAA,MAAM,YAAY,GAAG,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS;IAGnF,MAAM,kBAAkB,GAAG,YAAY,IAAK,OAAO,CAAC,eAAuB,EAAE;AACzE,UAAG,OAAO,CAAC,eAAuB,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,EAAO,KAAK,EAAE,CAAC,IAAI,KAAK,YAAY;UAC/F,SAAS;AAGf,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC,KAA2B,EAAE;AAChE,QAAA,GAAG,UAAU;QACb,YAAY;QACZ,kBAAkB;AAClB,QAAA,SAAS,EAAE,YAAY;AACvB,QAAA,aAAa,EAAE,CAAC,KAAc,KAAI;YAC9B,IAAI,YAAY,EAAE;gBACd,MAAM,QAAQ,GAAG,YAAY;AAG7B,gBAAA,IAAI,O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EAAE,EAAA,QAAA,EAC/E,CAAC,MAAM,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAI;AACjC,YAAA,MAAM,UAAU,GAAG,KAAK,CAAC,KAAmC;AAC5D,YAAA,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK;AACzC,YAAA,MAAM,YAAY,GAAG,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,CAAC,GAAG,CAAA,MAAA,EAAS,KAAK,EAAE;AAE5F,YAAA,QACIA,GAAA,CAAC,uBAAuB,EAAA,EAEpB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EAAA,EAFP,YAAY,CAGnB;QAEV,CAAC,CAAC,EAAA,CACA;AAEd;AAGA,SAAS,eAAe,CAAI,QAA6B,EAAA;AACrD,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,EAAE;IACjC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC;AACzD,IAAA,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE;AAChC;;;;"}
|
|
1
|
+
{"version":3,"file":"CommandFormFields.js","sources":["../../../CommandForm/CommandFormFields.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 { useCommandFormContext } from './CommandForm';\nimport React from 'react';\nimport { Tooltip } from 'primereact/tooltip';\nimport type { CommandFormFieldProps } from './CommandFormField';\n\nexport interface ColumnInfo {\n fields: React.ReactElement<CommandFormFieldProps<any>>[];\n}\n\nexport interface CommandFormFieldsProps {\n fields?: React.ReactElement<CommandFormFieldProps<any>>[];\n columns?: ColumnInfo[];\n}\n\n// Separate component for each field to prevent re-rendering all fields\nconst CommandFormFieldWrapper = ({ field, index }: { field: React.ReactElement<CommandFormFieldProps<any>>; index: number }) => {\n const context = useCommandFormContext<any>();\n const fieldProps = field.props as CommandFormFieldProps<any>;\n const propertyAccessor = fieldProps.value;\n\n // Get the property name from the accessor function\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : '';\n\n // Get the current value from the command instance\n const currentValue = propertyName ? (context.commandInstance as any)?.[propertyName] : undefined;\n\n // Get the error message for this field, if any\n const errorMessage = propertyName ? context.getFieldError(propertyName) : undefined;\n\n // Get the property descriptor for this field from the command instance\n const propertyDescriptor = propertyName && (context.commandInstance as any)?.propertyDescriptors\n ? (context.commandInstance as any).propertyDescriptors.find((pd: any) => pd.name === propertyName)\n : undefined;\n\n // Clone the field element with the current value and onChange handler\n const clonedField = React.cloneElement(field as React.ReactElement, {\n ...fieldProps,\n currentValue,\n propertyDescriptor,\n fieldName: propertyName,\n onValueChange: (value: unknown) => {\n if (propertyName) {\n const oldValue = currentValue;\n\n // Update the command value\n context.setCommandValues({ [propertyName]: value } as any);\n\n // Call validate() on the command instance and store the result\n if (context.commandInstance && typeof (context.commandInstance as any).validate === 'function') {\n const validationResult = (context.commandInstance as any).validate();\n if (validationResult) {\n context.setCommandResult(validationResult);\n }\n }\n\n // Call custom field validator if provided\n if (context.onFieldValidate) {\n const validationError = context.onFieldValidate(context.commandInstance as any, propertyName, oldValue, value);\n context.setCustomFieldError(propertyName, validationError);\n }\n\n // Call field change callback if provided\n if (context.onFieldChange) {\n context.onFieldChange(context.commandInstance as any, propertyName, oldValue, value);\n }\n }\n fieldProps.onChange?.(value as any);\n },\n required: fieldProps.required ?? true,\n invalid: !!errorMessage\n } as any);\n\n const tooltipId = fieldProps.description ? `tooltip-${propertyName}-${index}` : undefined;\n\n return (\n <div className=\"w-full\">\n <div className=\"p-inputgroup w-full\">\n {fieldProps.description && (\n <Tooltip target={`.${tooltipId}`} content={fieldProps.description} />\n )}\n {fieldProps.icon && (\n <span className={`p-inputgroup-addon ${tooltipId || ''}`}>\n {fieldProps.icon}\n </span>\n )}\n {clonedField}\n </div>\n {errorMessage && (\n <small className=\"p-error block mt-1\">{errorMessage}</small>\n )}\n </div>\n );\n};\n\nexport const CommandFormFields = (props: CommandFormFieldsProps) => {\n const { fields, columns } = props;\n\n // Render columns if provided\n if (columns && columns.length > 0) {\n return (\n <div className=\"card flex flex-column md:flex-row gap-3\">\n {columns.map((column, columnIndex) => (\n <div key={`column-${columnIndex}`} className=\"flex flex-column gap-3 flex-1\">\n {column.fields.map((field, index) => {\n const fieldProps = field.props as CommandFormFieldProps<any>;\n const propertyAccessor = fieldProps.value;\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : `field-${columnIndex}-${index}`;\n\n return (\n <CommandFormFieldWrapper\n key={propertyName}\n field={field}\n index={index}\n />\n );\n })}\n </div>\n ))}\n </div>\n );\n }\n\n // Render fields (single column layout)\n return (\n <div className=\"flex flex-col gap-4 w-full\">\n {(fields || []).map((field, index) => {\n const fieldProps = field.props as CommandFormFieldProps<any>;\n const propertyAccessor = fieldProps.value;\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : `field-${index}`;\n\n return (\n <CommandFormFieldWrapper\n key={propertyName}\n field={field}\n index={index}\n />\n );\n })}\n </div>\n );\n};\n\n// Helper function to extract property name from accessor function\nfunction getPropertyName<T>(accessor: (obj: T) => unknown): string {\n const fnStr = accessor.toString();\n const match = fnStr.match(/\\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);\n return match ? match[1] : '';\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;AAkBA,MAAM,uBAAuB,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAA4E,KAAI;AAC3H,IAAA,MAAM,OAAO,GAAG,qBAAqB,EAAO;AAC5C,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,KAAmC;AAC5D,IAAA,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK;AAGzC,IAAA,MAAM,YAAY,GAAG,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,CAAC,GAAG,EAAE;AAG9E,IAAA,MAAM,YAAY,GAAG,YAAY,GAAI,OAAO,CAAC,eAAuB,GAAG,YAAY,CA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AAK,GAAG,QAAQ,CAAC,QAAQ,EAAE;IACjC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC;AACzD,IAAA,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE;AAChC;;;;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Command, CommandValidator } from '@cratis/arc/commands';
|
|
2
|
+
import { SetCommandValues, ClearCommandValues } from '@cratis/arc.react/commands';
|
|
3
|
+
import { PropertyDescriptor } from '@cratis/arc/reflection';
|
|
4
|
+
import '@cratis/arc/validation';
|
|
5
|
+
export interface IUserRegistrationCommand {
|
|
6
|
+
username?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
confirmPassword?: string;
|
|
10
|
+
age?: number;
|
|
11
|
+
bio?: string;
|
|
12
|
+
favoriteColor?: string;
|
|
13
|
+
birthDate?: string;
|
|
14
|
+
agreeToTerms?: boolean;
|
|
15
|
+
experienceLevel?: number;
|
|
16
|
+
role?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class UserRegistrationCommandValidator extends CommandValidator<IUserRegistrationCommand> {
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
export declare class UserRegistrationCommand extends Command<IUserRegistrationCommand, object> implements IUserRegistrationCommand {
|
|
22
|
+
readonly route: string;
|
|
23
|
+
readonly validation: CommandValidator;
|
|
24
|
+
readonly propertyDescriptors: PropertyDescriptor[];
|
|
25
|
+
private _username;
|
|
26
|
+
private _email;
|
|
27
|
+
private _password;
|
|
28
|
+
private _confirmPassword;
|
|
29
|
+
private _age;
|
|
30
|
+
private _bio;
|
|
31
|
+
private _favoriteColor;
|
|
32
|
+
private _birthDate;
|
|
33
|
+
private _agreeToTerms;
|
|
34
|
+
private _experienceLevel;
|
|
35
|
+
private _role;
|
|
36
|
+
constructor();
|
|
37
|
+
get requestParameters(): string[];
|
|
38
|
+
get properties(): string[];
|
|
39
|
+
get username(): string;
|
|
40
|
+
set username(value: string);
|
|
41
|
+
get email(): string;
|
|
42
|
+
set email(value: string);
|
|
43
|
+
get password(): string;
|
|
44
|
+
set password(value: string);
|
|
45
|
+
get confirmPassword(): string;
|
|
46
|
+
set confirmPassword(value: string);
|
|
47
|
+
get age(): number;
|
|
48
|
+
set age(value: number);
|
|
49
|
+
get bio(): string;
|
|
50
|
+
set bio(value: string);
|
|
51
|
+
get favoriteColor(): string;
|
|
52
|
+
set favoriteColor(value: string);
|
|
53
|
+
get birthDate(): string;
|
|
54
|
+
set birthDate(value: string);
|
|
55
|
+
get agreeToTerms(): boolean;
|
|
56
|
+
set agreeToTerms(value: boolean);
|
|
57
|
+
get experienceLevel(): number;
|
|
58
|
+
set experienceLevel(value: number);
|
|
59
|
+
get role(): string;
|
|
60
|
+
set role(value: string);
|
|
61
|
+
static use(initialValues?: IUserRegistrationCommand): [UserRegistrationCommand, SetCommandValues<IUserRegistrationCommand>, ClearCommandValues];
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=UserRegistrationCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserRegistrationCommand.d.ts","sourceRoot":"","sources":["../../../CommandForm/UserRegistrationCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAc,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,wBAAwB,CAAC;AAEhC,MAAM,WAAW,wBAAwB;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAA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AAC,KAAK,EAAE,MAAM,EAGhC;IAED,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAGpB;IAED,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAGpB;IAED,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,IAAI,aAAa,CAAC,KAAK,EAAE,MAAM,EAG9B;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,MAAM,EAG1B;IAED,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,IAAI,YAAY,CAAC,KAAK,EAAE,OAAO,EAG9B;IAED,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAGhC;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAGrB;IAED,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,wBAAwB,GAAG,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,EAAE,kBAAkB,CAAC;CAGlJ"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Command, CommandValidator } from '@cratis/arc/commands';
|
|
2
|
+
import { useCommand } from '@cratis/arc.react/commands';
|
|
3
|
+
import { PropertyDescriptor } from '@cratis/arc/reflection';
|
|
4
|
+
import '@cratis/arc/validation';
|
|
5
|
+
export class UserRegistrationCommandValidator extends CommandValidator {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.ruleFor(c => c.username).notEmpty().minLength(3).maxLength(20);
|
|
9
|
+
this.ruleFor(c => c.email).notEmpty().emailAddress();
|
|
10
|
+
this.ruleFor(c => c.password).notEmpty().minLength(8);
|
|
11
|
+
this.ruleFor(c => c.age).greaterThanOrEqual(13).lessThanOrEqual(120);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class UserRegistrationCommand extends Command {
|
|
15
|
+
route = '/api/users/register';
|
|
16
|
+
validation = new UserRegistrationCommandValidator();
|
|
17
|
+
propertyDescriptors = [
|
|
18
|
+
new PropertyDescriptor('username', String),
|
|
19
|
+
new PropertyDescriptor('email', String),
|
|
20
|
+
new PropertyDescriptor('password', String),
|
|
21
|
+
new PropertyDescriptor('confirmPassword', String),
|
|
22
|
+
new PropertyDescriptor('age', Number),
|
|
23
|
+
new PropertyDescriptor('bio', String),
|
|
24
|
+
new PropertyDescriptor('favoriteColor', String),
|
|
25
|
+
new PropertyDescriptor('birthDate', String),
|
|
26
|
+
new PropertyDescriptor('agreeToTerms', Boolean),
|
|
27
|
+
new PropertyDescriptor('experienceLevel', Number),
|
|
28
|
+
new PropertyDescriptor('role', String),
|
|
29
|
+
];
|
|
30
|
+
_username;
|
|
31
|
+
_email;
|
|
32
|
+
_password;
|
|
33
|
+
_confirmPassword;
|
|
34
|
+
_age;
|
|
35
|
+
_bio;
|
|
36
|
+
_favoriteColor;
|
|
37
|
+
_birthDate;
|
|
38
|
+
_agreeToTerms;
|
|
39
|
+
_experienceLevel;
|
|
40
|
+
_role;
|
|
41
|
+
constructor() {
|
|
42
|
+
super(Object, false);
|
|
43
|
+
}
|
|
44
|
+
get requestParameters() {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
get properties() {
|
|
48
|
+
return [
|
|
49
|
+
'username',
|
|
50
|
+
'email',
|
|
51
|
+
'password',
|
|
52
|
+
'confirmPassword',
|
|
53
|
+
'age',
|
|
54
|
+
'bio',
|
|
55
|
+
'favoriteColor',
|
|
56
|
+
'birthDate',
|
|
57
|
+
'agreeToTerms',
|
|
58
|
+
'experienceLevel',
|
|
59
|
+
'role',
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
get username() {
|
|
63
|
+
return this._username;
|
|
64
|
+
}
|
|
65
|
+
set username(value) {
|
|
66
|
+
this._username = value;
|
|
67
|
+
this.propertyChanged('username');
|
|
68
|
+
}
|
|
69
|
+
get email() {
|
|
70
|
+
return this._email;
|
|
71
|
+
}
|
|
72
|
+
set email(value) {
|
|
73
|
+
this._email = value;
|
|
74
|
+
this.propertyChanged('email');
|
|
75
|
+
}
|
|
76
|
+
get password() {
|
|
77
|
+
return this._password;
|
|
78
|
+
}
|
|
79
|
+
set password(value) {
|
|
80
|
+
this._password = value;
|
|
81
|
+
this.propertyChanged('password');
|
|
82
|
+
}
|
|
83
|
+
get confirmPassword() {
|
|
84
|
+
return this._confirmPassword;
|
|
85
|
+
}
|
|
86
|
+
set confirmPassword(value) {
|
|
87
|
+
this._confirmPassword = value;
|
|
88
|
+
this.propertyChanged('confirmPassword');
|
|
89
|
+
}
|
|
90
|
+
get age() {
|
|
91
|
+
return this._age;
|
|
92
|
+
}
|
|
93
|
+
set age(value) {
|
|
94
|
+
this._age = value;
|
|
95
|
+
this.propertyChanged('age');
|
|
96
|
+
}
|
|
97
|
+
get bio() {
|
|
98
|
+
return this._bio;
|
|
99
|
+
}
|
|
100
|
+
set bio(value) {
|
|
101
|
+
this._bio = value;
|
|
102
|
+
this.propertyChanged('bio');
|
|
103
|
+
}
|
|
104
|
+
get favoriteColor() {
|
|
105
|
+
return this._favoriteColor;
|
|
106
|
+
}
|
|
107
|
+
set favoriteColor(value) {
|
|
108
|
+
this._favoriteColor = value;
|
|
109
|
+
this.propertyChanged('favoriteColor');
|
|
110
|
+
}
|
|
111
|
+
get birthDate() {
|
|
112
|
+
return this._birthDate;
|
|
113
|
+
}
|
|
114
|
+
set birthDate(value) {
|
|
115
|
+
this._birthDate = value;
|
|
116
|
+
this.propertyChanged('birthDate');
|
|
117
|
+
}
|
|
118
|
+
get agreeToTerms() {
|
|
119
|
+
return this._agreeToTerms;
|
|
120
|
+
}
|
|
121
|
+
set agreeToTerms(value) {
|
|
122
|
+
this._agreeToTerms = value;
|
|
123
|
+
this.propertyChanged('agreeToTerms');
|
|
124
|
+
}
|
|
125
|
+
get experienceLevel() {
|
|
126
|
+
return this._experienceLevel;
|
|
127
|
+
}
|
|
128
|
+
set experienceLevel(value) {
|
|
129
|
+
this._experienceLevel = value;
|
|
130
|
+
this.propertyChanged('experienceLevel');
|
|
131
|
+
}
|
|
132
|
+
get role() {
|
|
133
|
+
return this._role;
|
|
134
|
+
}
|
|
135
|
+
set role(value) {
|
|
136
|
+
this._role = value;
|
|
137
|
+
this.propertyChanged('role');
|
|
138
|
+
}
|
|
139
|
+
static use(initialValues) {
|
|
140
|
+
return useCommand(UserRegistrationCommand, initialValues);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=UserRegistrationCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserRegistrationCommand.js","sourceRoot":"","sources":["../../../CommandForm/UserRegistrationCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAwC,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,wBAAwB,CAAC;AAgBhC,MAAM,OAAO,gCAAiC,SAAQ,gBAA0C;IAC5F;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACpE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,YAAY,EAAE,CAAC;QACrD,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,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
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ValidationMessageProps<TCommand> {
|
|
2
|
+
value: (command: TCommand) => unknown;
|
|
3
|
+
}
|
|
4
|
+
export declare const ValidationMessage: {
|
|
5
|
+
<TCommand>(props: ValidationMessageProps<TCommand>): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=ValidationMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationMessage.d.ts","sourceRoot":"","sources":["../../../CommandForm/ValidationMessage.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,sBAAsB,CAAC,QAAQ;IAC5C,KAAK,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC;CACzC;AAED,eAAO,MAAM,iBAAiB;KAAI,QAAQ,SAAU,sBAAsB,CAAC,QAAQ,CAAC;;CAqBnF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useCommandFormContext } from './CommandForm.js';
|
|
3
|
+
|
|
4
|
+
const ValidationMessage = (props) => {
|
|
5
|
+
const context = useCommandFormContext();
|
|
6
|
+
const propertyAccessor = props.value;
|
|
7
|
+
const getPropertyName = (accessor) => {
|
|
8
|
+
const fnStr = accessor.toString();
|
|
9
|
+
const match = fnStr.match(/\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);
|
|
10
|
+
return match ? match[1] : '';
|
|
11
|
+
};
|
|
12
|
+
const propertyName = getPropertyName(propertyAccessor);
|
|
13
|
+
const errorMessage = propertyName ? context.getFieldError(propertyName) : undefined;
|
|
14
|
+
if (!errorMessage) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return (jsx("small", { className: "p-error block mt-1", children: errorMessage }));
|
|
18
|
+
};
|
|
19
|
+
ValidationMessage.displayName = 'ValidationMessage';
|
|
20
|
+
|
|
21
|
+
export { ValidationMessage };
|
|
22
|
+
//# sourceMappingURL=ValidationMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationMessage.js","sources":["../../../CommandForm/ValidationMessage.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 React from 'react';\nimport { useCommandFormContext } from './CommandForm';\n\nexport interface ValidationMessageProps<TCommand> {\n value: (command: TCommand) => unknown;\n}\n\nexport const ValidationMessage = <TCommand,>(props: ValidationMessageProps<TCommand>) => {\n const context = useCommandFormContext<TCommand>();\n const propertyAccessor = props.value;\n \n // Get the property name from the accessor function\n const getPropertyName = (accessor: (obj: TCommand) => unknown): string => {\n const fnStr = accessor.toString();\n const match = fnStr.match(/\\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);\n return match ? match[1] : '';\n };\n \n const propertyName = getPropertyName(propertyAccessor);\n const errorMessage = propertyName ? context.getFieldError(propertyName) : undefined;\n \n if (!errorMessage) {\n return null;\n }\n \n return (\n <small className=\"p-error block mt-1\">{errorMessage}</small>\n );\n};\n\nValidationMessage.displayName = 'ValidationMessage';\n"],"names":["_jsx"],"mappings":";;;AAUO,MAAM,iBAAiB,GAAG,CAAY,KAAuC,KAAI;AACpF,IAAA,MAAM,OAAO,GAAG,qBAAqB,EAAY;AACjD,IAAA,MAAM,gBAAgB,GAAG,KAAK,CAAC,KAAK;AAGpC,IAAA,MAAM,eAAe,GAAG,CAAC,QAAoC,KAAY;AACrE,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,EAAE;QACjC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC;AACzD,QAAA,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE;AAChC,IAAA,CAAC;AAED,IAAA,MAAM,YAAY,GAAG,eAAe,CAAC,gBAAgB,CAAC;AACtD,IAAA,MAAM,YAAY,GAAG,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS;IAEnF,IAAI,CAAC,YAAY,EAAE;AACf,QAAA,OAAO,IAAI;IACf;IAEA,QACIA,eAAO,SAAS,EAAC,oBAAoB,EAAA,QAAA,EAAE,YAAY,EAAA,CAAS;AAEpE;AAEA,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PropertyAccessor } from '@cratis/fundamentals';
|
|
2
|
+
import { PropertyDescriptor } from '@cratis/arc/reflection';
|
|
3
|
+
import React, { ComponentType } from 'react';
|
|
4
|
+
export interface InjectedCommandFormFieldProps {
|
|
5
|
+
currentValue?: unknown;
|
|
6
|
+
onValueChange?: (value: unknown) => void;
|
|
7
|
+
propertyDescriptor?: PropertyDescriptor;
|
|
8
|
+
fieldName?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface BaseCommandFormFieldProps<TCommand> {
|
|
11
|
+
icon?: React.ReactElement;
|
|
12
|
+
value: PropertyAccessor<TCommand>;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
title?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CommandFormFieldConfig<TValue = unknown> {
|
|
18
|
+
defaultValue: TValue;
|
|
19
|
+
extractValue?: (event: unknown) => TValue;
|
|
20
|
+
}
|
|
21
|
+
export interface WrappedFieldProps<TValue = unknown> {
|
|
22
|
+
value: TValue;
|
|
23
|
+
onChange: (valueOrEvent: TValue | unknown) => void;
|
|
24
|
+
invalid: boolean;
|
|
25
|
+
required: boolean;
|
|
26
|
+
errors: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare function asCommandFormField<TComponentProps extends WrappedFieldProps<unknown>>(component: ComponentType<TComponentProps> | ((props: TComponentProps) => React.ReactElement), config: CommandFormFieldConfig<TComponentProps['value']>): {
|
|
29
|
+
<TCommand>(props: Omit<TComponentProps, keyof WrappedFieldProps> & BaseCommandFormFieldProps<TCommand> & InjectedCommandFormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=asCommandFormField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asCommandFormField.d.ts","sourceRoot":"","sources":["../../../CommandForm/asCommandFormField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,EAAuB,aAAa,EAAE,MAAM,OAAO,CAAC;AAMlE,MAAM,WAAW,6BAA6B;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,MAAM,WAAW,yBAAyB,CAAC,QAAQ;IAC/C,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAKD,MAAM,WAAW,sBAAsB,CAAC,MAAM,GAAG,OAAO;IAEpD,YAAY,EAAE,MAAM,CAAC;IAErB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;CAC7C;AAKD,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,OAAO;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CACpB;AAoCD,wBAAgB,kBAAkB,CAAC,eAAe,SAAS,iBAAiB,CAAC,OAAO,CAAC,EACjF,SAAS,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,YAAY,CAAC,EAC5F,MAAM,EAAE,sBAAsB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;KAOlC,QAAQ,SACnB,IAAI,CAAC,eAAe,EAAE,MAAM,iBAAiB,CAAC,GAC9C,yBAAyB,CAAC,QAAQ,CAAC,GACnC,6BAA6B;;EA+C3C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { useCommandFormContext } from './CommandForm.js';
|
|
4
|
+
|
|
5
|
+
function asCommandFormField(component, config) {
|
|
6
|
+
const { defaultValue, extractValue } = config;
|
|
7
|
+
const Component = typeof component === 'function' && !component.prototype?.render
|
|
8
|
+
? component
|
|
9
|
+
: component;
|
|
10
|
+
const WrappedField = (props) => {
|
|
11
|
+
const { currentValue, onValueChange, fieldName, required = true, ...componentProps } = props;
|
|
12
|
+
const [localValue, setLocalValue] = useState(currentValue ?? defaultValue);
|
|
13
|
+
const { getFieldError, customFieldErrors } = useCommandFormContext();
|
|
14
|
+
const serverError = fieldName ? getFieldError(fieldName) : undefined;
|
|
15
|
+
const customError = fieldName ? customFieldErrors[fieldName] : undefined;
|
|
16
|
+
const errors = [];
|
|
17
|
+
if (serverError)
|
|
18
|
+
errors.push(serverError);
|
|
19
|
+
if (customError)
|
|
20
|
+
errors.push(customError);
|
|
21
|
+
const isInvalid = errors.length > 0;
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setLocalValue(currentValue ?? defaultValue);
|
|
24
|
+
}, [currentValue]);
|
|
25
|
+
const handleChange = (valueOrEvent) => {
|
|
26
|
+
const newValue = extractValue ? extractValue(valueOrEvent) : valueOrEvent;
|
|
27
|
+
setLocalValue(newValue);
|
|
28
|
+
onValueChange?.(newValue);
|
|
29
|
+
};
|
|
30
|
+
const wrappedProps = {
|
|
31
|
+
...componentProps,
|
|
32
|
+
value: localValue,
|
|
33
|
+
onChange: handleChange,
|
|
34
|
+
invalid: isInvalid,
|
|
35
|
+
required,
|
|
36
|
+
errors
|
|
37
|
+
};
|
|
38
|
+
return jsx(Component, { ...wrappedProps });
|
|
39
|
+
};
|
|
40
|
+
WrappedField.displayName = 'CommandFormField';
|
|
41
|
+
return WrappedField;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { asCommandFormField };
|
|
45
|
+
//# sourceMappingURL=asCommandFormField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asCommandFormField.js","sources":["../../../CommandForm/asCommandFormField.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 { PropertyAccessor } from '@cratis/fundamentals';\nimport { PropertyDescriptor } from '@cratis/arc/reflection';\nimport React, { useState, useEffect, ComponentType } from 'react';\nimport { useCommandFormContext } from './CommandForm';\n\n/**\n * Props that will be injected by CommandFormFields into your wrapped component\n */\nexport interface InjectedCommandFormFieldProps {\n currentValue?: unknown;\n onValueChange?: (value: unknown) => void;\n propertyDescriptor?: PropertyDescriptor;\n fieldName?: string;\n}\n\n/**\n * Props that your field component should accept (excluding the injected ones)\n */\nexport interface BaseCommandFormFieldProps<TCommand> {\n icon?: React.ReactElement;\n value: PropertyAccessor<TCommand>;\n required?: boolean;\n title?: string;\n description?: string;\n}\n\n/**\n * Configuration for the field wrapper\n */\nexport interface CommandFormFieldConfig<TValue = unknown> {\n /** Default value when currentValue is undefined */\n defaultValue: TValue;\n /** Value extractor from the change event */\n extractValue?: (event: unknown) => TValue;\n}\n\n/**\n * Props that your wrapped component will receive\n */\nexport interface WrappedFieldProps<TValue = unknown> {\n value: TValue;\n onChange: (valueOrEvent: TValue | unknown) => void;\n invalid: boolean;\n required: boolean;\n errors: string[];\n}\n\n/**\n * Wraps a field component to work with CommandForm, handling all integration automatically.\n * \n * @example\n * ```typescript\n * interface MyInputProps extends WrappedFieldProps<string> {\n * placeholder?: string;\n * }\n * \n * export const MyInputField = asCommandFormField<MyInputProps>(\n * (props) => (\n * <div>\n * <input\n * value={props.value}\n * onChange={props.onChange}\n * placeholder={props.placeholder}\n * className={props.invalid ? 'invalid' : ''}\n * />\n * {props.errors.length > 0 && (\n * <div className=\"error-messages\">\n * {props.errors.map((error, idx) => (\n * <small key={idx} className=\"p-error\">{error}</small>\n * ))}\n * </div>\n * )}\n * </div>\n * ),\n * {\n * defaultValue: '',\n * extractValue: (e) => e.target.value\n * }\n * );\n * ```\n */\nexport function asCommandFormField<TComponentProps extends WrappedFieldProps<unknown>>(\n component: ComponentType<TComponentProps> | ((props: TComponentProps) => React.ReactElement),\n config: CommandFormFieldConfig<TComponentProps['value']>\n) {\n const { defaultValue, extractValue } = config;\n const Component = typeof component === 'function' && !component.prototype?.render \n ? component \n : component as ComponentType<TComponentProps>;\n\n const WrappedField = <TCommand,>(\n props: Omit<TComponentProps, keyof WrappedFieldProps> & \n BaseCommandFormFieldProps<TCommand> & \n InjectedCommandFormFieldProps\n ) => {\n const { \n currentValue, \n onValueChange, \n fieldName, \n required = true,\n ...componentProps \n } = props;\n\n const [localValue, setLocalValue] = useState(currentValue ?? defaultValue);\n const { getFieldError, customFieldErrors } = useCommandFormContext();\n\n const serverError = fieldName ? getFieldError(fieldName) : undefined;\n const customError = fieldName ? customFieldErrors[fieldName] : undefined;\n \n const errors: string[] = [];\n if (serverError) errors.push(serverError);\n if (customError) errors.push(customError);\n\n const isInvalid = errors.length > 0;\n\n useEffect(() => {\n setLocalValue(currentValue ?? defaultValue);\n }, [currentValue]);\n\n const handleChange = (valueOrEvent: unknown) => {\n const newValue = extractValue ? extractValue(valueOrEvent) : valueOrEvent;\n setLocalValue(newValue);\n onValueChange?.(newValue);\n };\n\n const wrappedProps = {\n ...componentProps,\n value: localValue,\n onChange: handleChange,\n invalid: isInvalid,\n required,\n errors\n } as TComponentProps;\n\n return <Component {...wrappedProps} />;\n };\n\n WrappedField.displayName = 'CommandFormField';\n\n return WrappedField;\n}\n"],"names":["_jsx"],"mappings":";;;;AAoFM,SAAU,kBAAkB,CAC9B,SAA4F,EAC5F,MAAwD,EAAA;AAExD,IAAA,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,MAAM;AAC7C,IAAA,MAAM,SAAS,GAAG,OAAO,SAAS,KAAK,UAAU,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;AACvE,UAAE;UACA,SAA2C;AAEjD,IAAA,MAAM,YAAY,GAAG,CACjB,KAEoC,KACpC;AACA,QAAA,MAAM,EACF,YAAY,EACZ,aAAa,EACb,SAAS,EACT,QAAQ,GAAG,IAAI,EACf,GAAG,cAAc,EACpB,GAAG,KAAK;AAET,QAAA,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,YAAY,IAAI,YAAY,CAAC;QAC1E,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,GAAG,qBAAqB,EAAE;AAEpE,QAAA,MAAM,WAAW,GAAG,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,GAAG,SAAS;AACpE,QAAA,MAAM,WAAW,GAAG,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,GAAG,SAAS;QAExE,MAAM,MAAM,GAAa,EAAE;AAC3B,QAAA,IAAI,WAAW;AAAE,YAAA,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;AACzC,QAAA,IAAI,WAAW;AAAE,YAAA,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;AAEzC,QAAA,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC;QAEnC,SAAS,CAAC,MAAK;AACX,YAAA,aAAa,CAAC,YAAY,IAAI,YAAY,CAAC;AAC/C,QAAA,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;AAElB,QAAA,MAAM,YAAY,GAAG,CAAC,YAAqB,KAAI;AAC3C,YAAA,MAAM,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC,GAAG,YAAY;YACzE,aAAa,CAAC,QAAQ,CAAC;AACvB,YAAA,aAAa,GAAG,QAAQ,CAAC;AAC7B,QAAA,CAAC;AAED,QAAA,MAAM,YAAY,GAAG;AACjB,YAAA,GAAG,cAAc;AACjB,YAAA,KAAK,EAAE,UAAU;AACjB,YAAA,QAAQ,EAAE,YAAY;AACtB,YAAA,OAAO,EAAE,SAAS;YAClB,QAAQ;YACR;SACgB;AAEpB,QAAA,OAAOA,GAAA,CAAC,SAAS,EAAA,EAAA,GAAK,YAAY,GAAI;AAC1C,IAAA,CAAC;AAED,IAAA,YAAY,CAAC,WAAW,GAAG,kBAAkB;AAE7C,IAAA,OAAO,YAAY;AACvB;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WrappedFieldProps } from '../asCommandFormField';
|
|
2
|
+
interface CheckboxFieldComponentProps extends WrappedFieldProps<boolean> {
|
|
3
|
+
label?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const CheckboxField: {
|
|
6
|
+
<TCommand>(props: Omit<CheckboxFieldComponentProps, keyof WrappedFieldProps<unknown>> & import("..").BaseCommandFormFieldProps<TCommand> & import("..").InjectedCommandFormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=CheckboxField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxField.d.ts","sourceRoot":"","sources":["../../../../CommandForm/fields/CheckboxField.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAsB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,UAAU,2BAA4B,SAAQ,iBAAiB,CAAC,OAAO,CAAC;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,aAAa;;;CAezB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Checkbox } from 'primereact/checkbox';
|
|
3
|
+
import { asCommandFormField } from '../asCommandFormField.js';
|
|
4
|
+
|
|
5
|
+
const CheckboxField = asCommandFormField((props) => (jsxs("div", { className: "flex align-items-center", children: [jsx(Checkbox, { checked: props.value, onChange: props.onChange, invalid: props.invalid }), props.label && jsx("label", { className: "ml-2", children: props.label })] })), {
|
|
6
|
+
defaultValue: false,
|
|
7
|
+
extractValue: (e) => e.checked
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export { CheckboxField };
|
|
11
|
+
//# sourceMappingURL=CheckboxField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxField.js","sources":["../../../../CommandForm/fields/CheckboxField.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 { Checkbox } from 'primereact/checkbox';\nimport React from 'react';\nimport { asCommandFormField, WrappedFieldProps } from '../asCommandFormField';\n\ninterface CheckboxFieldComponentProps extends WrappedFieldProps<boolean> {\n label?: string;\n}\n\nexport const CheckboxField = asCommandFormField<CheckboxFieldComponentProps>(\n (props) => (\n <div className=\"flex align-items-center\">\n <Checkbox\n checked={props.value}\n onChange={props.onChange}\n invalid={props.invalid}\n />\n {props.label && <label className=\"ml-2\">{props.label}</label>}\n </div>\n ),\n {\n defaultValue: false,\n extractValue: (e: { checked: boolean }) => e.checked\n }\n);\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAWO,MAAM,aAAa,GAAG,kBAAkB,CAC3C,CAAC,KAAK,MACFA,cAAK,SAAS,EAAC,yBAAyB,EAAA,QAAA,EAAA,CACpCC,GAAA,CAAC,QAAQ,EAAA,EACL,OAAO,EAAE,KAAK,CAAC,KAAK,EACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EAAA,CACxB,EACD,KAAK,CAAC,KAAK,IAAIA,GAAA,CAAA,OAAA,EAAA,EAAO,SAAS,EAAC,MAAM,EAAA,QAAA,EAAE,KAAK,CAAC,KAAK,EAAA,CAAS,CAAA,EAAA,CAC3D,CACT,EACD;AACI,IAAA,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,CAAC,CAAuB,KAAK,CAAC,CAAC;AAChD,CAAA;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WrappedFieldProps } from '../asCommandFormField';
|
|
2
|
+
interface SelectComponentProps extends WrappedFieldProps<string> {
|
|
3
|
+
options: Array<{
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}>;
|
|
6
|
+
optionIdField: string;
|
|
7
|
+
optionLabelField: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const SelectField: {
|
|
11
|
+
<TCommand>(props: Omit<SelectComponentProps, keyof WrappedFieldProps<unknown>> & import("..").BaseCommandFormFieldProps<TCommand> & import("..").InjectedCommandFormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=DropdownField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownField.d.ts","sourceRoot":"","sources":["../../../../CommandForm/fields/DropdownField.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAsB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,UAAU,oBAAqB,SAAQ,iBAAiB,CAAC,MAAM,CAAC;IAC5D,OAAO,EAAE,KAAK,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAkBD,eAAO,MAAM,WAAW;;;CAMvB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { asCommandFormField } from '../asCommandFormField.js';
|
|
3
|
+
|
|
4
|
+
const SelectComponent = (props) => (jsxs("select", { value: props.value || '', onChange: props.onChange, required: props.required, className: `w-full p-3 rounded-md text-base ${props.invalid ? 'border border-red-500' : 'border border-gray-300'}`, children: [props.placeholder && jsx("option", { value: "", children: props.placeholder }), props.options.map((option, index) => (jsx("option", { value: String(option[props.optionIdField]), children: String(option[props.optionLabelField]) }, index)))] }));
|
|
5
|
+
const SelectField = asCommandFormField(SelectComponent, {
|
|
6
|
+
defaultValue: '',
|
|
7
|
+
extractValue: (e) => e.target.value
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export { SelectField };
|
|
11
|
+
//# sourceMappingURL=DropdownField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownField.js","sources":["../../../../CommandForm/fields/DropdownField.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 React from 'react';\nimport { asCommandFormField, WrappedFieldProps } from '../asCommandFormField';\n\ninterface SelectComponentProps extends WrappedFieldProps<string> {\n options: Array<{ [key: string]: unknown }>;\n optionIdField: string;\n optionLabelField: string;\n placeholder?: string;\n}\n\nconst SelectComponent = (props: SelectComponentProps) => (\n <select\n value={props.value || ''}\n onChange={props.onChange}\n required={props.required}\n className={`w-full p-3 rounded-md text-base ${props.invalid ? 'border border-red-500' : 'border border-gray-300'}`}\n >\n {props.placeholder && <option value=\"\">{props.placeholder}</option>}\n {props.options.map((option, index) => (\n <option key={index} value={String(option[props.optionIdField])}>\n {String(option[props.optionLabelField])}\n </option>\n ))}\n </select>\n);\n\nexport const SelectField = asCommandFormField<SelectComponentProps>(\n SelectComponent,\n {\n defaultValue: '',\n extractValue: (e: React.ChangeEvent<HTMLSelectElement>) => e.target.value\n }\n);\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAaA,MAAM,eAAe,GAAG,CAAC,KAA2B,MAChDA,IAAA,CAAA,QAAA,EAAA,EACI,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,CAAA,gCAAA,EAAmC,KAAK,CAAC,OAAO,GAAG,uBAAuB,GAAG,wBAAwB,CAAA,CAAE,aAEjH,KAAK,CAAC,WAAW,IAAIC,GAAA,CAAA,QAAA,EAAA,EAAQ,KAAK,EAAC,EAAE,EAAA,QAAA,EAAE,KAAK,CAAC,WAAW,GAAU,EAClE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,MAC7BA,GAAA,CAAA,QAAA,EAAA,EAAoB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,EAAA,QAAA,EACzD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAA,EAD9B,KAAK,CAET,CACZ,CAAC,CAAA,EAAA,CACG,CACZ;AAEM,MAAM,WAAW,GAAG,kBAAkB,CACzC,eAAe,EACf;AACI,IAAA,YAAY,EAAE,EAAE;IAChB,YAAY,EAAE,CAAC,CAAuC,KAAK,CAAC,CAAC,MAAM,CAAC;AACvE,CAAA;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WrappedFieldProps } from '../asCommandFormField';
|
|
2
|
+
interface InputTextComponentProps extends WrappedFieldProps<string> {
|
|
3
|
+
type?: 'text' | 'email' | 'password' | 'color' | 'date' | 'datetime-local' | 'time' | 'url' | 'tel' | 'search';
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const InputTextField: {
|
|
7
|
+
<TCommand>(props: Omit<InputTextComponentProps, keyof WrappedFieldProps<unknown>> & import("..").BaseCommandFormFieldProps<TCommand> & import("..").InjectedCommandFormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=InputTextField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputTextField.d.ts","sourceRoot":"","sources":["../../../../CommandForm/fields/InputTextField.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAsB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,UAAU,uBAAwB,SAAQ,iBAAiB,CAAC,MAAM,CAAC;IAC/D,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,gBAAgB,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC/G,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,cAAc;;;CAe1B,CAAC"}
|