dynamic-mui 2.2.0 → 2.3.1
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/README.md +142 -5
- package/dist/accordion-Bf0VwGuE.js +1 -0
- package/dist/accordion-DEd2a2Ps.mjs +23 -0
- package/dist/addressfield-Dfd9ilpe.js +1 -0
- package/dist/addressfield-FjNJCCuC.mjs +152 -0
- package/dist/asyncautocomplete-9O6nwGP_.js +1 -0
- package/dist/asyncautocomplete-B8qI_lz9.mjs +89 -0
- package/dist/bar-BzO7tvYJ.mjs +20 -0
- package/dist/bar-DEVxyUVS.js +1 -0
- package/dist/cascadeselect-D8sVXV1g.mjs +64 -0
- package/dist/cascadeselect-DeoPn4_V.js +1 -0
- package/dist/colorpicker-BcnqB34i.js +1 -0
- package/dist/colorpicker-DcyceL6g.mjs +98 -0
- package/dist/components/DynamicComponent.d.ts +2 -0
- package/dist/components/FormGenerator.d.ts +99 -10
- package/dist/components/controls/index.d.ts +45 -79
- package/dist/consentfield-B_qBOIuX.mjs +78 -0
- package/dist/consentfield-CR69IP1l.js +1 -0
- package/dist/datatable-BIQznwQe.mjs +20 -0
- package/dist/datatable-BWlcUP0M.js +1 -0
- package/dist/dynamic-mui.cjs +1 -0
- package/dist/dynamic-mui.mjs +32 -0
- package/dist/editabletable-BdywdA42.js +1 -0
- package/dist/editabletable-D6_U9op8.mjs +126 -0
- package/dist/fileupload-CugTpR-B.mjs +172 -0
- package/dist/fileupload-YzpAUgok.js +1 -0
- package/dist/formrepeater-B_2UOIBm.js +1 -0
- package/dist/formrepeater-Cxawn2sQ.mjs +71 -0
- package/dist/formwizard-CCBY6s19.js +1 -0
- package/dist/formwizard-Cfd5IPkE.mjs +83 -0
- package/dist/geofield-CJm8hivf.js +1 -0
- package/dist/geofield-k2V0hglK.mjs +104 -0
- package/dist/group-D40b3E1V.mjs +23 -0
- package/dist/group-IFZTzo-g.js +1 -0
- package/dist/imagelist-Bn9QhIv7.js +1 -0
- package/dist/imagelist-rqmJajHt.mjs +18 -0
- package/dist/index-Bh6BLrzq.mjs +12226 -0
- package/dist/index-eJceCjKS.js +43 -0
- package/dist/index.d.ts +9 -1
- package/dist/intlphone-BbTprmmA.mjs +140 -0
- package/dist/intlphone-CmiRFHv-.js +1 -0
- package/dist/keyvaluefield-CoOmou7m.js +1 -0
- package/dist/keyvaluefield-zD6Kf4D0.mjs +125 -0
- package/dist/line-B-DwR1hm.mjs +20 -0
- package/dist/line-BkymZu31.js +1 -0
- package/dist/lineitemlist-BRsW0O7Z.js +1 -0
- package/dist/lineitemlist-BZbAId8H.mjs +166 -0
- package/dist/list-BhTzYFrR.mjs +20 -0
- package/dist/list-DWf2NWix.js +1 -0
- package/dist/locationfield-BZpGC10B.mjs +119 -0
- package/dist/locationfield-DC_2IN-B.js +1 -0
- package/dist/markdowneditor-B5F4okCW.mjs +90 -0
- package/dist/markdowneditor-Coi3sksx.js +2 -0
- package/dist/matrixfield-CUo7zFWC.mjs +117 -0
- package/dist/matrixfield-DAjfXU96.js +1 -0
- package/dist/mixChart-C3o184UT.js +1 -0
- package/dist/mixChart-ISf3Kbr-.mjs +75 -0
- package/dist/multitextbox-Cq7vt1-g.js +1 -0
- package/dist/multitextbox-CsNOrHZP.mjs +78 -0
- package/dist/npsscale-BWpMrK_O.js +1 -0
- package/dist/npsscale-Cb8NxADb.mjs +87 -0
- package/dist/numberstepper-BqQeBbR9.js +1 -0
- package/dist/numberstepper-DLk_r1HM.mjs +128 -0
- package/dist/pie-CJSL8Sv5.js +1 -0
- package/dist/pie-CL29dlh5.mjs +20 -0
- package/dist/richtexteditor-BUrvVR_T.js +1 -0
- package/dist/richtexteditor-pQIK2f-6.mjs +141 -0
- package/dist/s3Upload-B0JeoLkS.js +1 -0
- package/dist/s3Upload-dpioZ2c8.mjs +51 -0
- package/dist/signature-CFv0jhVN.mjs +1225 -0
- package/dist/signature-G-XCOszC.js +2 -0
- package/dist/stepper-Bc9NlbU7.js +1 -0
- package/dist/stepper-U0kv127E.mjs +140 -0
- package/dist/summaryfield-B_bePxLk.js +1 -0
- package/dist/summaryfield-QcpYr9Xt.mjs +96 -0
- package/dist/tabs-Cs9eNEbR.js +1 -0
- package/dist/tabs-DCLyTKVm.mjs +39 -0
- package/dist/tagsinput-D1VP8Bjq.mjs +58 -0
- package/dist/tagsinput-DlopThdw.js +1 -0
- package/dist/util/dayjsSetup.d.ts +2 -0
- package/dist/util/registry.d.ts +29 -0
- package/dist/util/resolvers.d.ts +45 -0
- package/dist/util/useFormEngine.d.ts +74 -0
- package/dist/util/validateSchema.d.ts +23 -0
- package/dist/v4-BysszJq8.mjs +30 -0
- package/dist/v4-CqdK_b8Y.js +1 -0
- package/package.json +38 -12
- package/dist/AxisSharedComponents-BbsKw1BT.js +0 -3
- package/dist/AxisSharedComponents-xLtpOLH_.mjs +0 -605
- package/dist/ChartsAxis-CANvBdY9.mjs +0 -47
- package/dist/ChartsAxis-EZ7m_KrU.js +0 -1
- package/dist/ChartsGrid-BCRTvNTr.js +0 -3
- package/dist/ChartsGrid-C_HT7qpL.mjs +0 -381
- package/dist/ChartsWrapper-CM7EDyAK.js +0 -5
- package/dist/ChartsWrapper-CO5_Z6BD.mjs +0 -1878
- package/dist/ChartsXAxis-CPmuCRhq.mjs +0 -487
- package/dist/ChartsXAxis-DFFY1sPg.js +0 -3
- package/dist/ChartsYAxis-DLUMr9vG.mjs +0 -392
- package/dist/ChartsYAxis-fpevi1sP.js +0 -1
- package/dist/XmlShapeDeserializer-3yQdm0b0.mjs +0 -237
- package/dist/XmlShapeDeserializer-XKJAoqLc.js +0 -1
- package/dist/clampAngle-BvZjnf53.mjs +0 -11
- package/dist/clampAngle-DpAsDoeT.js +0 -1
- package/dist/createSelector-B-9FwV16.mjs +0 -430
- package/dist/createSelector-f0oqn8Lr.js +0 -7
- package/dist/date-utils-CFUUt6NL.js +0 -4
- package/dist/date-utils-pGzaKb0p.mjs +0 -477
- package/dist/dynamic-mui.cjs.js +0 -1
- package/dist/dynamic-mui.es.js +0 -22
- package/dist/index--8Zky9Oh.js +0 -299
- package/dist/index-6WTs1Xy_.js +0 -1
- package/dist/index-B1R1akM2.js +0 -1
- package/dist/index-BW8_rRff.js +0 -7
- package/dist/index-BXFVK_GX.js +0 -1
- package/dist/index-B_KNUTjy.js +0 -1
- package/dist/index-BhaKvHkU.mjs +0 -62051
- package/dist/index-Bif92ima.js +0 -1
- package/dist/index-BnZOu8CL.js +0 -1
- package/dist/index-CDxpgRlR.mjs +0 -7
- package/dist/index-CThMfvtJ.mjs +0 -2555
- package/dist/index-CVqLvm8B.js +0 -1
- package/dist/index-CodJBIn6.mjs +0 -1665
- package/dist/index-Cr6Wp_S-.mjs +0 -3141
- package/dist/index-CslPwsrf.mjs +0 -4
- package/dist/index-CuV0MQzZ.mjs +0 -1173
- package/dist/index-DA0XouZs.mjs +0 -153
- package/dist/index-DKS5Sz9e.js +0 -14
- package/dist/index-DSkYYZuW.mjs +0 -4
- package/dist/index-DU78_FiA.js +0 -1
- package/dist/index-D_mYhgJ0.js +0 -10
- package/dist/index-DcWfyXJp.mjs +0 -92
- package/dist/index-Dlimbnxj.mjs +0 -2965
- package/dist/index-MllWgTJ5.mjs +0 -9372
- package/dist/index-in5z9hUb.js +0 -133
- package/dist/index-qUW7FnZ-.mjs +0 -20540
- package/dist/index.browser-BSu11T_q.mjs +0 -363
- package/dist/index.browser-By7-GABP.js +0 -4
- package/dist/isDeepEqual-BHfPvf9U.mjs +0 -393
- package/dist/isDeepEqual-CqxZGVRk.js +0 -1
- package/dist/loadCognitoIdentity-DtYTy-DW.js +0 -1
- package/dist/loadCognitoIdentity-DzdR91GB.mjs +0 -872
- package/dist/loadSts-Cic6UToN.mjs +0 -593
- package/dist/loadSts-csbFP6zX.js +0 -1
- package/dist/main.d.ts +0 -1
- package/dist/noAuth-B8ui2kBg.mjs +0 -71
- package/dist/noAuth-JPA2o4dt.js +0 -1
- package/dist/playground/AIContext.d.ts +0 -18
- package/dist/playground/AIPanel.d.ts +0 -10
- package/dist/playground/Builder.d.ts +0 -1
- package/dist/playground/Canvas.d.ts +0 -9
- package/dist/playground/DemoGallery.d.ts +0 -6
- package/dist/playground/PropertiesEditor.d.ts +0 -10
- package/dist/playground/Sidebar.d.ts +0 -9
- package/dist/playground/demoForms.d.ts +0 -3
- package/dist/playground/demoRecipes.d.ts +0 -15
- package/dist/playground/demoVariants.d.ts +0 -11
- package/dist/playground/documentation.d.ts +0 -6
- package/dist/playground/templates.d.ts +0 -7
- package/dist/playground/testData.d.ts +0 -2
- package/dist/test/setup.d.ts +0 -0
- package/dist/theme/theme.d.ts +0 -6
- package/dist/useAxis-DSbfEtO7.js +0 -3
- package/dist/useAxis-SiNBMMWq.mjs +0 -3010
- package/dist/useChartContainerProps-Bl3hO-r1.mjs +0 -5418
- package/dist/useChartContainerProps-C_C_PZoi.js +0 -12
- package/dist/useItemHighlightedGetter-9CIwqsGj.js +0 -1
- package/dist/useItemHighlightedGetter-CTISrNdV.mjs +0 -88
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { GridProps } from '@mui/material';
|
|
3
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
4
|
import { FormField } from '../util/helper';
|
|
4
|
-
|
|
5
|
+
import { FormResolver } from '../util/resolvers';
|
|
6
|
+
export declare const FormData: <T = any>(id?: string) => T;
|
|
5
7
|
export declare const ClearFormData: (id?: string) => void;
|
|
6
|
-
/** Convenience accessor for a form's stored values (imperative; pairs with `guid`).
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/** Convenience accessor for a form's stored values (imperative; pairs with `guid`).
|
|
9
|
+
* Pass a values type for autocomplete: `useForm<MyValues>(guid)`. */
|
|
10
|
+
export declare const useForm: <T = Record<string, any>>(guid: string) => {
|
|
11
|
+
getValues: () => T;
|
|
9
12
|
clear: () => void;
|
|
10
13
|
};
|
|
11
14
|
export interface FormGeneratorProps {
|
|
@@ -52,11 +55,49 @@ export interface FormGeneratorProps {
|
|
|
52
55
|
/** Which browser storage to use for auto-save (default 'local'). */
|
|
53
56
|
autoSaveStorage?: 'local' | 'session';
|
|
54
57
|
/** Imperative API — getValues/getErrors/validate/reset/setValues/submit. */
|
|
55
|
-
apiRef?: React.Ref<FormApi
|
|
58
|
+
apiRef?: React.Ref<FormApi<any>>;
|
|
56
59
|
/** Localizable default messages (e.g. { required: 'Champ obligatoire' }). */
|
|
57
60
|
messages?: FormMessages;
|
|
61
|
+
/** Translate every user-facing string (labels, placeholders, helper text,
|
|
62
|
+
* option labels, validation messages, typography, submit/cancel labels).
|
|
63
|
+
* Plug in any i18n: `translate={(s) => dictionary[s] ?? s}`. */
|
|
64
|
+
translate?: (text: string) => string;
|
|
58
65
|
/** Show a visible validation summary above the form after a failed submit. */
|
|
59
66
|
validationSummary?: boolean;
|
|
67
|
+
/** Validate the whole form against a schema resolver (see `zodResolver` /
|
|
68
|
+
* `yupResolver`). Its errors merge with per-field `rules.validation` and
|
|
69
|
+
* appear in `onSubmit`, the validation summary, and `apiRef.getErrors()`. */
|
|
70
|
+
resolver?: FormResolver;
|
|
71
|
+
/** Per-field async (remote) validators, keyed by field id — e.g. an
|
|
72
|
+
* "is this username taken?" server check. Each returns an error message
|
|
73
|
+
* (string) or a falsy value when valid. Runs debounced on change with a
|
|
74
|
+
* pending / valid / invalid indicator, and blocks submit while pending or
|
|
75
|
+
* invalid. */
|
|
76
|
+
asyncValidators?: Record<string, AsyncValidator>;
|
|
77
|
+
/** Render every control disabled (non-editable) while keeping the form layout. */
|
|
78
|
+
readOnly?: boolean;
|
|
79
|
+
/** Warn the user (native beforeunload prompt) when they try to leave the page
|
|
80
|
+
* with unsaved edits — i.e. while the form is dirty. */
|
|
81
|
+
warnOnUnsavedChanges?: boolean;
|
|
82
|
+
/** Render a visible submit button with this label (runs the same submit flow).
|
|
83
|
+
* When omitted, no visible submit button is rendered (external/apiRef submit).
|
|
84
|
+
* Shortcut for `submitButton: { label }`. */
|
|
85
|
+
submitLabel?: string;
|
|
86
|
+
/** Fully configure the visible submit button — colour, icon, loader, variant.
|
|
87
|
+
* Takes precedence over `submitLabel`. */
|
|
88
|
+
submitButton?: SubmitButtonConfig;
|
|
89
|
+
/** Make the submit bar stick to the bottom of the scroll area. */
|
|
90
|
+
stickySubmit?: boolean;
|
|
91
|
+
/** Optional cancel/secondary action shown beside submit. */
|
|
92
|
+
cancelLabel?: string;
|
|
93
|
+
/** Handler for the cancel button. */
|
|
94
|
+
onCancel?: () => void;
|
|
95
|
+
/**
|
|
96
|
+
* Render the form as a clean read-only SUMMARY of its current values
|
|
97
|
+
* (label → value), instead of input controls. Respects `visibleWhen`,
|
|
98
|
+
* resolves option labels/booleans/dates, and follows matching subforms.
|
|
99
|
+
*/
|
|
100
|
+
reviewMode?: boolean;
|
|
60
101
|
}
|
|
61
102
|
/** Localizable built-in strings. */
|
|
62
103
|
export interface FormMessages {
|
|
@@ -64,19 +105,67 @@ export interface FormMessages {
|
|
|
64
105
|
/** "{n} error(s) found" summary prefix; `{n}` is replaced with the count. */
|
|
65
106
|
errorSummary?: string;
|
|
66
107
|
}
|
|
67
|
-
/**
|
|
68
|
-
export interface
|
|
108
|
+
/** Declarative styling/behaviour for the visible submit button. */
|
|
109
|
+
export interface SubmitButtonConfig {
|
|
110
|
+
/** Button text. */
|
|
111
|
+
label?: string;
|
|
112
|
+
/** MUI theme palette colour, or any CSS colour string for a custom fill. */
|
|
113
|
+
color?: 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info' | 'inherit' | string;
|
|
114
|
+
/** Two-colour gradient `[from, to]` for the button background (overrides `color`). */
|
|
115
|
+
gradient?: [string, string];
|
|
116
|
+
/** Leading Material icon name (e.g. `send`, `save`). */
|
|
117
|
+
icon?: string;
|
|
118
|
+
/** Trailing Material icon name. */
|
|
119
|
+
endIcon?: string;
|
|
120
|
+
/** MUI button variant. */
|
|
121
|
+
variant?: 'contained' | 'outlined' | 'text';
|
|
122
|
+
/** Show a spinner and disable the button. Also driven automatically while an
|
|
123
|
+
* async `onSubmit` (one that returns a Promise) is pending. */
|
|
124
|
+
loading?: boolean;
|
|
125
|
+
/** Text shown while loading (defaults to the label). */
|
|
126
|
+
loadingLabel?: string;
|
|
127
|
+
/** Stretch the button to the full width of the bar. */
|
|
128
|
+
fullWidth?: boolean;
|
|
129
|
+
/** Extra styles merged onto the button. */
|
|
130
|
+
sx?: SxProps<Theme>;
|
|
131
|
+
}
|
|
132
|
+
/** An async field validator: resolves to an error message when invalid, or a
|
|
133
|
+
* falsy value when valid. Receives the field's value and all current values. */
|
|
134
|
+
export type AsyncValidator = (value: any, values: Record<string, any>) => Promise<string | null | undefined | false>;
|
|
135
|
+
/** Imperative handle exposed via `apiRef`. Pass a values type for full
|
|
136
|
+
* autocomplete: `useRef<FormApi<MyValues>>(null)`. */
|
|
137
|
+
export interface FormApi<T = Record<string, any>> {
|
|
69
138
|
/** Current values for this form. */
|
|
70
|
-
getValues: () =>
|
|
139
|
+
getValues: () => T;
|
|
71
140
|
/** Run validation now and return the errors (also displays them). */
|
|
72
141
|
getErrors: () => any[];
|
|
73
142
|
/** Alias of getErrors that returns whether the form is valid. */
|
|
74
143
|
validate: () => boolean;
|
|
75
144
|
/** Merge values into the form and re-render. */
|
|
76
|
-
setValues: (values:
|
|
145
|
+
setValues: (values: Partial<T>) => void;
|
|
77
146
|
/** Clear this form's stored values. */
|
|
78
147
|
reset: () => void;
|
|
148
|
+
/** The values the form started with (initial patch/schema snapshot). */
|
|
149
|
+
getInitialValues: () => T;
|
|
150
|
+
/** True when the current values differ from the initial snapshot. */
|
|
151
|
+
isDirty: () => boolean;
|
|
152
|
+
/** Restore the values to the initial snapshot (undo all edits). */
|
|
153
|
+
resetToInitial: () => void;
|
|
154
|
+
/** Adopt the current values as the new "clean" baseline (e.g. after a save),
|
|
155
|
+
* so `isDirty()` reports false until the next edit. */
|
|
156
|
+
markPristine: () => void;
|
|
79
157
|
/** Programmatically submit (runs the same flow as the submit button). */
|
|
80
158
|
submit: () => void;
|
|
159
|
+
/** Open the browser print dialog for a clean summary of the current values
|
|
160
|
+
* (the same "review" layout). Users can also "Save as PDF" from there. */
|
|
161
|
+
print: (options?: {
|
|
162
|
+
title?: string;
|
|
163
|
+
}) => void;
|
|
164
|
+
/** Download a PDF of the current values. Requires the optional `pdfmake`
|
|
165
|
+
* package (`npm i pdfmake`); lazy-loaded, so it never bloats the bundle. */
|
|
166
|
+
exportPdf: (options?: {
|
|
167
|
+
title?: string;
|
|
168
|
+
filename?: string;
|
|
169
|
+
}) => Promise<void>;
|
|
81
170
|
}
|
|
82
|
-
export declare function FormGenerator({ data, patch, guid, formRef, onSubmit, onChange, onStepChange, MuiGridAttributes, activeStep, onFieldClick, onFieldDoubleClick, onFieldContextMenu, persistOnUnmount, autoSave, autoSaveKey, autoSaveStorage, apiRef, messages, validationSummary, }: FormGeneratorProps): import("react/jsx-runtime").JSX.Element;
|
|
171
|
+
export declare function FormGenerator({ data, patch, guid, formRef, onSubmit, onChange, onStepChange, MuiGridAttributes, activeStep, onFieldClick, onFieldDoubleClick, onFieldContextMenu, persistOnUnmount, autoSave, autoSaveKey, autoSaveStorage, apiRef, messages, validationSummary, resolver, asyncValidators, readOnly, reviewMode, warnOnUnsavedChanges, submitLabel, submitButton, stickySubmit, cancelLabel, onCancel, translate, }: FormGeneratorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,67 +1,33 @@
|
|
|
1
1
|
import { default as Typography } from './Typography/typography';
|
|
2
2
|
import { default as TextField } from './TextField/textfield';
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as DateTime } from './DateTime/datetime';
|
|
5
|
-
import { default as DateTimePicker } from './DateTimePicker/datetimepicker';
|
|
6
|
-
import { default as TimePicker } from './TimePicker/timepicker';
|
|
3
|
+
import { default as NumberField } from './NumberField/numberfield';
|
|
7
4
|
import { default as Select } from './Select/select';
|
|
5
|
+
import { default as AutoComplete } from './Autocomplete/autocomplete';
|
|
8
6
|
import { default as CheckBox } from './CheckBox/checkbox';
|
|
9
|
-
import { default as Switch } from './Switch/switch';
|
|
10
7
|
import { default as Radio } from './Radio/radio';
|
|
11
|
-
import { default as
|
|
12
|
-
import { default as
|
|
13
|
-
import { default as Line } from '../charts/Line/line';
|
|
14
|
-
import { default as Pie } from '../charts/Pie/pie';
|
|
15
|
-
import { default as MixChart } from '../charts/Mixchart/mixChart';
|
|
8
|
+
import { default as Switch } from './Switch/switch';
|
|
9
|
+
import { default as Button } from './Button/button';
|
|
16
10
|
import { default as Divider } from './Divider/divider';
|
|
11
|
+
import { default as Computed } from './Computed/computed';
|
|
12
|
+
import { default as Alert } from './Alert/alert';
|
|
13
|
+
import { default as DateTime } from './DateTime/datetime';
|
|
14
|
+
import { default as DateTimePicker } from './DateTimePicker/datetimepicker';
|
|
15
|
+
import { default as TimePicker } from './TimePicker/timepicker';
|
|
16
|
+
import { default as DateRangePicker } from './DateRangePicker/daterangepicker';
|
|
17
17
|
import { default as Chip } from './Chip/chip';
|
|
18
18
|
import { default as ChipSelect } from './ChipSelect/chipselect';
|
|
19
|
-
import { default as Button } from './Button/button';
|
|
20
|
-
import { default as DateRangePicker } from './DateRangePicker/daterangepicker';
|
|
21
|
-
import { default as Rating } from './Rating/rating';
|
|
22
19
|
import { default as Slider } from './Slider/slider';
|
|
23
|
-
import { default as
|
|
20
|
+
import { default as Rating } from './Rating/rating';
|
|
24
21
|
import { default as ToggleButtons } from './ToggleButtons/togglebuttons';
|
|
25
22
|
import { default as PasswordField } from './PasswordField/passwordfield';
|
|
26
23
|
import { default as OtpField } from './OtpField/otpfield';
|
|
27
24
|
import { default as PhoneField } from './PhoneField/phonefield';
|
|
28
25
|
import { default as CurrencyField } from './CurrencyField/currencyfield';
|
|
29
|
-
import { default as FileUpload } from './FileUpload/fileupload';
|
|
30
|
-
import { default as Alert } from './Alert/alert';
|
|
31
|
-
import { default as Computed } from './Computed/computed';
|
|
32
|
-
import { default as KeyValueField } from './KeyValueField/keyvaluefield';
|
|
33
|
-
import { default as NumberStepper } from './NumberStepper/numberstepper';
|
|
34
|
-
import { default as MatrixField } from './MatrixField/matrixfield';
|
|
35
|
-
import { default as ConsentField } from './ConsentField/consentfield';
|
|
36
|
-
import { default as ColorPicker } from './ColorPicker/colorpicker';
|
|
37
|
-
import { default as MarkdownEditor } from './MarkdownEditor/markdowneditor';
|
|
38
|
-
import { default as AddressField } from './AddressField/addressfield';
|
|
39
|
-
import { default as CascadeSelect } from './CascadeSelect/cascadeselect';
|
|
40
|
-
import { default as FormWizard } from './FormWizard/formwizard';
|
|
41
|
-
import { default as SummaryField } from './SummaryField/summaryfield';
|
|
42
|
-
import { default as GeoField } from './GeoField/geofield';
|
|
43
|
-
import { default as RichTextEditor } from './RichTextEditor/richtexteditor';
|
|
44
|
-
import { default as NpsScale } from './NpsScale/npsscale';
|
|
45
|
-
import { default as EditableTable } from './EditableTable/editabletable';
|
|
46
|
-
import { default as IntlPhone } from './IntlPhone/intlphone';
|
|
47
|
-
import { default as AsyncAutocomplete } from './AsyncAutocomplete/asyncautocomplete';
|
|
48
|
-
import { default as List } from './List/list';
|
|
49
|
-
import { default as NumberField } from './NumberField/numberfield';
|
|
50
|
-
import { default as MultiTextbox } from './MultiTextbox/multitextbox';
|
|
51
|
-
import { default as LineItemList } from './LineItemList/lineitemlist';
|
|
52
|
-
import { default as FormRepeater } from './FormRepeater/formrepeater';
|
|
53
|
-
import { default as Signature } from './Signature/signature';
|
|
54
|
-
import { default as Group } from './Group/group';
|
|
55
|
-
import { default as Accordion } from './Accordion/accordion';
|
|
56
|
-
import { default as Tabs } from './Tabs/tabs';
|
|
57
|
-
import { default as AutoComplete } from './Autocomplete/autocomplete';
|
|
58
|
-
import { default as ImgList } from './ImageList/imagelist';
|
|
59
26
|
import { default as Hyperlink } from './Hyperlink/hyperlink';
|
|
60
|
-
import { default as LocationField } from './LocationField/locationfield';
|
|
61
27
|
declare const Controls: {
|
|
62
28
|
Typography: typeof Typography;
|
|
63
29
|
TextField: typeof TextField;
|
|
64
|
-
Table: typeof
|
|
30
|
+
Table: import('react').LazyExoticComponent<typeof import('./DataTable/datatable').default>;
|
|
65
31
|
DateTime: typeof DateTime;
|
|
66
32
|
DateTimePicker: typeof DateTimePicker;
|
|
67
33
|
TimePicker: typeof TimePicker;
|
|
@@ -69,11 +35,11 @@ declare const Controls: {
|
|
|
69
35
|
CheckBox: typeof CheckBox;
|
|
70
36
|
Switch: typeof Switch;
|
|
71
37
|
Radio: typeof Radio;
|
|
72
|
-
Stepper: typeof Stepper
|
|
73
|
-
Bar: typeof Bar
|
|
74
|
-
Line: typeof Line
|
|
75
|
-
Pie: typeof Pie
|
|
76
|
-
MixChart: typeof
|
|
38
|
+
Stepper: import('react').LazyExoticComponent<typeof import('./Stepper/stepper').default>;
|
|
39
|
+
Bar: import('react').LazyExoticComponent<typeof import('../charts/Bar/bar').default>;
|
|
40
|
+
Line: import('react').LazyExoticComponent<typeof import('../charts/Line/line').default>;
|
|
41
|
+
Pie: import('react').LazyExoticComponent<typeof import('../charts/Pie/pie').default>;
|
|
42
|
+
MixChart: import('react').LazyExoticComponent<typeof import('../charts/Mixchart/mixChart').default>;
|
|
77
43
|
Divider: typeof Divider;
|
|
78
44
|
Chip: typeof Chip;
|
|
79
45
|
ChipSelect: typeof ChipSelect;
|
|
@@ -81,43 +47,43 @@ declare const Controls: {
|
|
|
81
47
|
DateRangePicker: typeof DateRangePicker;
|
|
82
48
|
Rating: typeof Rating;
|
|
83
49
|
Slider: typeof Slider;
|
|
84
|
-
TagsInput: typeof TagsInput
|
|
50
|
+
TagsInput: import('react').LazyExoticComponent<typeof import('./TagsInput/tagsinput').default>;
|
|
85
51
|
ToggleButtons: typeof ToggleButtons;
|
|
86
52
|
PasswordField: typeof PasswordField;
|
|
87
53
|
OtpField: typeof OtpField;
|
|
88
54
|
PhoneField: typeof PhoneField;
|
|
89
55
|
CurrencyField: typeof CurrencyField;
|
|
90
|
-
FileUpload: typeof FileUpload
|
|
56
|
+
FileUpload: import('react').LazyExoticComponent<typeof import('./FileUpload/fileupload').default>;
|
|
91
57
|
Alert: typeof Alert;
|
|
92
58
|
Computed: typeof Computed;
|
|
93
|
-
KeyValueField: typeof KeyValueField
|
|
94
|
-
NumberStepper: typeof NumberStepper
|
|
95
|
-
MatrixField: typeof MatrixField
|
|
96
|
-
ConsentField: typeof ConsentField
|
|
97
|
-
ColorPicker: typeof ColorPicker
|
|
98
|
-
MarkdownEditor: typeof MarkdownEditor
|
|
99
|
-
AddressField: typeof AddressField
|
|
100
|
-
CascadeSelect: typeof CascadeSelect
|
|
101
|
-
FormWizard: typeof FormWizard
|
|
102
|
-
SummaryField: typeof SummaryField
|
|
103
|
-
GeoField: typeof GeoField
|
|
104
|
-
RichTextEditor: typeof RichTextEditor
|
|
105
|
-
NpsScale: typeof NpsScale
|
|
106
|
-
EditableTable: typeof EditableTable
|
|
107
|
-
IntlPhone: typeof IntlPhone
|
|
108
|
-
AsyncAutocomplete: typeof AsyncAutocomplete
|
|
109
|
-
List: typeof List
|
|
59
|
+
KeyValueField: import('react').LazyExoticComponent<typeof import('./KeyValueField/keyvaluefield').default>;
|
|
60
|
+
NumberStepper: import('react').LazyExoticComponent<typeof import('./NumberStepper/numberstepper').default>;
|
|
61
|
+
MatrixField: import('react').LazyExoticComponent<typeof import('./MatrixField/matrixfield').default>;
|
|
62
|
+
ConsentField: import('react').LazyExoticComponent<typeof import('./ConsentField/consentfield').default>;
|
|
63
|
+
ColorPicker: import('react').LazyExoticComponent<typeof import('./ColorPicker/colorpicker').default>;
|
|
64
|
+
MarkdownEditor: import('react').LazyExoticComponent<typeof import('./MarkdownEditor/markdowneditor').default>;
|
|
65
|
+
AddressField: import('react').LazyExoticComponent<typeof import('./AddressField/addressfield').default>;
|
|
66
|
+
CascadeSelect: import('react').LazyExoticComponent<typeof import('./CascadeSelect/cascadeselect').default>;
|
|
67
|
+
FormWizard: import('react').LazyExoticComponent<typeof import('./FormWizard/formwizard').default>;
|
|
68
|
+
SummaryField: import('react').LazyExoticComponent<typeof import('./SummaryField/summaryfield').default>;
|
|
69
|
+
GeoField: import('react').LazyExoticComponent<typeof import('./GeoField/geofield').default>;
|
|
70
|
+
RichTextEditor: import('react').LazyExoticComponent<typeof import('./RichTextEditor/richtexteditor').default>;
|
|
71
|
+
NpsScale: import('react').LazyExoticComponent<typeof import('./NpsScale/npsscale').default>;
|
|
72
|
+
EditableTable: import('react').LazyExoticComponent<typeof import('./EditableTable/editabletable').default>;
|
|
73
|
+
IntlPhone: import('react').LazyExoticComponent<typeof import('./IntlPhone/intlphone').default>;
|
|
74
|
+
AsyncAutocomplete: import('react').LazyExoticComponent<typeof import('./AsyncAutocomplete/asyncautocomplete').default>;
|
|
75
|
+
List: import('react').LazyExoticComponent<typeof import('./List/list').default>;
|
|
110
76
|
NumberField: typeof NumberField;
|
|
111
|
-
MultiTextbox: typeof MultiTextbox
|
|
112
|
-
LineItemList: typeof LineItemList
|
|
113
|
-
FormRepeater: typeof FormRepeater
|
|
114
|
-
Signature: typeof Signature
|
|
115
|
-
Group: typeof Group
|
|
116
|
-
Accordion: typeof Accordion
|
|
117
|
-
Tabs: typeof Tabs
|
|
77
|
+
MultiTextbox: import('react').LazyExoticComponent<typeof import('./MultiTextbox/multitextbox').default>;
|
|
78
|
+
LineItemList: import('react').LazyExoticComponent<typeof import('./LineItemList/lineitemlist').default>;
|
|
79
|
+
FormRepeater: import('react').LazyExoticComponent<typeof import('./FormRepeater/formrepeater').default>;
|
|
80
|
+
Signature: import('react').LazyExoticComponent<typeof import('./Signature/signature').default>;
|
|
81
|
+
Group: import('react').LazyExoticComponent<typeof import('./Group/group').default>;
|
|
82
|
+
Accordion: import('react').LazyExoticComponent<typeof import('./Accordion/accordion').default>;
|
|
83
|
+
Tabs: import('react').LazyExoticComponent<typeof import('./Tabs/tabs').default>;
|
|
118
84
|
AutoComplete: typeof AutoComplete;
|
|
119
|
-
ImgList: typeof
|
|
85
|
+
ImgList: import('react').LazyExoticComponent<typeof import('./ImageList/imagelist').default>;
|
|
120
86
|
Hyperlink: typeof Hyperlink;
|
|
121
|
-
LocationField: typeof LocationField
|
|
87
|
+
LocationField: import('react').LazyExoticComponent<typeof import('./LocationField/locationfield').default>;
|
|
122
88
|
};
|
|
123
89
|
export default Controls;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsxs as p, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import s from "react";
|
|
3
|
+
import j from "@mui/material/Box";
|
|
4
|
+
import R from "@mui/material/Checkbox";
|
|
5
|
+
import V from "@mui/material/FormControl";
|
|
6
|
+
import A from "@mui/material/FormControlLabel";
|
|
7
|
+
import B from "@mui/material/FormHelperText";
|
|
8
|
+
import { alpha as I } from "@mui/material/styles";
|
|
9
|
+
import { u as P, m as f, b as U, c as W } from "./index-Bh6BLrzq.mjs";
|
|
10
|
+
function Z({ attributes: a = {}, rules: n = {}, onChange: h }) {
|
|
11
|
+
const {
|
|
12
|
+
MuiAttributes: g = {},
|
|
13
|
+
id: x = "",
|
|
14
|
+
text: S = "",
|
|
15
|
+
label: c = "I agree to the terms",
|
|
16
|
+
requireScroll: i = !0
|
|
17
|
+
} = a, [b, d] = s.useState(!!a.value), [C, v] = s.useState(!i), [k, T] = s.useState(!1), [m, y] = s.useState("");
|
|
18
|
+
P(() => {
|
|
19
|
+
d(!!a.value);
|
|
20
|
+
}, [a.value]);
|
|
21
|
+
const l = n?.validation?.some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect") || !1, H = (e) => {
|
|
22
|
+
let r = !0, t = "";
|
|
23
|
+
return l && !e && (r = !1, t = n?.validation?.find(
|
|
24
|
+
(u) => u.rule === "mandatory" || u.rule === "mandatoryselect"
|
|
25
|
+
)?.message || "Required"), { isValid: r, message: t };
|
|
26
|
+
}, q = (e) => {
|
|
27
|
+
const r = e.currentTarget;
|
|
28
|
+
r.scrollTop + r.clientHeight >= r.scrollHeight - 4 && v(!0);
|
|
29
|
+
}, E = (e) => {
|
|
30
|
+
const r = e.target.checked;
|
|
31
|
+
d(r);
|
|
32
|
+
const t = H(r);
|
|
33
|
+
T(!t.isValid), y(t.message), h?.({ id: x, value: r });
|
|
34
|
+
}, F = i && !C, { sx: L, ...w } = g, M = l ? /* @__PURE__ */ p("span", { children: [
|
|
35
|
+
c,
|
|
36
|
+
/* @__PURE__ */ o("span", { "aria-hidden": "true", style: { color: "#d32f2f", marginLeft: 2 }, children: "*" })
|
|
37
|
+
] }) : c;
|
|
38
|
+
return /* @__PURE__ */ p(V, { required: l, error: k, component: "fieldset", fullWidth: !0, children: [
|
|
39
|
+
/* @__PURE__ */ o(
|
|
40
|
+
j,
|
|
41
|
+
{
|
|
42
|
+
"data-testid": "consent-terms",
|
|
43
|
+
onScroll: q,
|
|
44
|
+
sx: f(U, {
|
|
45
|
+
maxHeight: 200,
|
|
46
|
+
overflow: "auto",
|
|
47
|
+
p: 2,
|
|
48
|
+
mb: 1,
|
|
49
|
+
whiteSpace: "pre-wrap",
|
|
50
|
+
backgroundColor: (e) => I(e.palette.background.paper, 1)
|
|
51
|
+
}),
|
|
52
|
+
children: S
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ o(
|
|
56
|
+
A,
|
|
57
|
+
{
|
|
58
|
+
...w,
|
|
59
|
+
sx: f(W, L),
|
|
60
|
+
label: M,
|
|
61
|
+
control: /* @__PURE__ */ o(
|
|
62
|
+
R,
|
|
63
|
+
{
|
|
64
|
+
checked: b,
|
|
65
|
+
disabled: F,
|
|
66
|
+
onChange: E,
|
|
67
|
+
required: l,
|
|
68
|
+
inputProps: { "aria-label": "consent-agree" }
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
m && /* @__PURE__ */ o(B, { children: m })
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
Z as default
|
|
78
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),M=require("@mui/material/Box"),w=require("@mui/material/Checkbox"),R=require("@mui/material/FormControl"),P=require("@mui/material/FormControlLabel"),V=require("@mui/material/FormHelperText"),A=require("@mui/material/styles"),o=require("./index-eJceCjKS.js");function B({attributes:l={},rules:c={},onChange:h}){const{MuiAttributes:g={},id:p="",text:f="",label:i="I agree to the terms",requireScroll:u=!0}=l,[S,d]=a.useState(!!l.value),[q,b]=a.useState(!u),[C,j]=a.useState(!1),[m,v]=a.useState("");o.useUpdateEffect(()=>{d(!!l.value)},[l.value]);const n=c?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,y=e=>{let r=!0,s="";return n&&!e&&(r=!1,s=c?.validation?.find(x=>x.rule==="mandatory"||x.rule==="mandatoryselect")?.message||"Required"),{isValid:r,message:s}},T=e=>{const r=e.currentTarget;r.scrollTop+r.clientHeight>=r.scrollHeight-4&&b(!0)},k=e=>{const r=e.target.checked;d(r);const s=y(r);j(!s.isValid),v(s.message),h?.({id:p,value:r})},H=u&&!q,{sx:E,...F}=g,L=n?t.jsxs("span",{children:[i,t.jsx("span",{"aria-hidden":"true",style:{color:"#d32f2f",marginLeft:2},children:"*"})]}):i;return t.jsxs(R,{required:n,error:C,component:"fieldset",fullWidth:!0,children:[t.jsx(M,{"data-testid":"consent-terms",onScroll:T,sx:o.mergeSx(o.premiumSurfaceSx,{maxHeight:200,overflow:"auto",p:2,mb:1,whiteSpace:"pre-wrap",backgroundColor:e=>A.alpha(e.palette.background.paper,1)}),children:f}),t.jsx(P,{...F,sx:o.mergeSx(o.premiumControlLabelSx,E),label:L,control:t.jsx(w,{checked:S,disabled:H,onChange:k,required:n,inputProps:{"aria-label":"consent-agree"}})}),m&&t.jsx(V,{children:m})]})}exports.default=B;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import i, { Suspense as a } from "react";
|
|
3
|
+
import n from "@mui/material/Box";
|
|
4
|
+
import s from "@mui/material/CircularProgress";
|
|
5
|
+
const l = i.lazy(
|
|
6
|
+
() => import("@mui/x-data-grid").then((t) => ({ default: t.DataGrid }))
|
|
7
|
+
);
|
|
8
|
+
function d({ attributes: t = {} }) {
|
|
9
|
+
const { MuiAttributes: e = {}, container: o = {} } = t;
|
|
10
|
+
return /* @__PURE__ */ r("div", { ...o, children: /* @__PURE__ */ r(
|
|
11
|
+
a,
|
|
12
|
+
{
|
|
13
|
+
fallback: /* @__PURE__ */ r(n, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ r(s, {}) }),
|
|
14
|
+
children: /* @__PURE__ */ r(l, { rows: [], columns: [], ...e })
|
|
15
|
+
}
|
|
16
|
+
) });
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
d as default
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.create;var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var j=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of l(t))!x.call(e,s)&&s!==r&&a(e,s,{get:()=>t[s],enumerable:!(i=u(t,s))||i.enumerable});return e};var f=(e,t,r)=>(r=e!=null?o(d(e)):{},j(t||!e||!e.__esModule?a(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("react"),b=require("@mui/material/Box"),p=require("@mui/material/CircularProgress"),y=c.lazy(()=>import("@mui/x-data-grid").then(e=>({default:e.DataGrid})));function h({attributes:e={}}){const{MuiAttributes:t={},container:r={}}=e;return n.jsx("div",{...r,children:n.jsx(c.Suspense,{fallback:n.jsx(b,{sx:{display:"flex",justifyContent:"center",p:2},children:n.jsx(p,{})}),children:n.jsx(y,{rows:[],columns:[],...t})})})}exports.default=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-eJceCjKS.js");exports.AIFill=e.AIFill;exports.AIForm=e.AIForm;exports.AIFormGenerator=e.AIFormGenerator;exports.AISchemaReview=e.AISchemaReview;exports.AITextAssist=e.AITextAssist;exports.AIVisionImport=e.AIVisionImport;exports.ClearFormData=e.ClearFormData;exports.Controls=e.Controls_default;exports.DynamicComponent=e.DynamicComponent;exports.FormData=e.FormData;exports.FormGenerator=e.FormGenerator;exports.MuiConfig=e.mui;exports.createAIClient=e.createAIClient;exports.defineForm=e.defineForm;exports.formFieldsToSimple=e.formFieldsToSimple;exports.getRegisteredControl=e.getRegisteredControl;exports.hasRegisteredControl=e.hasRegisteredControl;exports.registerControl=e.registerControl;exports.registerControls=e.registerControls;exports.registeredControlTypes=e.registeredControlTypes;exports.simpleFieldsToFormFields=e.simpleFieldsToFormFields;exports.slug=e.slug;exports.unregisterControl=e.unregisterControl;exports.useAIAssist=e.useAIAssist;exports.useForm=e.useForm;exports.useFormEngine=e.useFormEngine;exports.validateSchema=e.validateSchema;exports.yupResolver=e.yupResolver;exports.zodResolver=e.zodResolver;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { A as a, k as o, l as r, o as t, q as i, r as l, s as n, C as m, D as F, e as C, F as A, h as g, t as I, v as d, w as p, x as u, y as v, z as R, B as c, E as f, G as h, H as y, I as D, J as T, K as x, L as G, M as S, N as w, O as z } from "./index-Bh6BLrzq.mjs";
|
|
2
|
+
export {
|
|
3
|
+
a as AIFill,
|
|
4
|
+
o as AIForm,
|
|
5
|
+
r as AIFormGenerator,
|
|
6
|
+
t as AISchemaReview,
|
|
7
|
+
i as AITextAssist,
|
|
8
|
+
l as AIVisionImport,
|
|
9
|
+
n as ClearFormData,
|
|
10
|
+
m as Controls,
|
|
11
|
+
F as DynamicComponent,
|
|
12
|
+
C as FormData,
|
|
13
|
+
A as FormGenerator,
|
|
14
|
+
g as MuiConfig,
|
|
15
|
+
I as createAIClient,
|
|
16
|
+
d as defineForm,
|
|
17
|
+
p as formFieldsToSimple,
|
|
18
|
+
u as getRegisteredControl,
|
|
19
|
+
v as hasRegisteredControl,
|
|
20
|
+
R as registerControl,
|
|
21
|
+
c as registerControls,
|
|
22
|
+
f as registeredControlTypes,
|
|
23
|
+
h as simpleFieldsToFormFields,
|
|
24
|
+
y as slug,
|
|
25
|
+
D as unregisterControl,
|
|
26
|
+
T as useAIAssist,
|
|
27
|
+
x as useForm,
|
|
28
|
+
G as useFormEngine,
|
|
29
|
+
S as validateSchema,
|
|
30
|
+
w as yupResolver,
|
|
31
|
+
z as zodResolver
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("react"),A=require("@mui/material/Table"),S=require("@mui/material/TableBody"),a=require("@mui/material/TableCell"),z=require("@mui/material/TableContainer"),I=require("@mui/material/TableHead"),j=require("@mui/material/TableRow"),W=require("@mui/material/TextField"),B=require("@mui/material/IconButton"),F=require("@mui/material/Button"),M=require("@mui/material/FormControl"),P=require("@mui/material/FormLabel"),E=require("@mui/material/Paper"),L=require("@mui/icons-material/Add"),H=require("@mui/icons-material/Close"),d=require("./index-eJceCjKS.js");function f(o){return Array.isArray(o)?o.map(c=>({...c||{}})):[]}function O({attributes:o={},onChange:c}){const{MuiAttributes:g={},id:p="",columns:x=[],addLabel:q="Add row",label:m}=o,{sx:v,...y}=g,h=Array.isArray(x)?x:[],[l,i]=w.useState(()=>f(o.value));d.useUpdateEffect(()=>{i(f(o.value))},[o.value]);const u=r=>{c?.({id:p,value:r})},C=(r,n,t)=>{const s=l.map((b,k)=>k===r?{...b,[n]:t}:b);i(s),u(s)},R=()=>{const r=[...l,{}];i(r),u(r)},T=r=>{const n=l.filter((t,s)=>s!==r);i(n),u(n)};return e.jsxs(M,{component:"fieldset",fullWidth:!0,children:[m&&e.jsx(P,{component:"legend",sx:{mb:1},children:m}),e.jsx(z,{component:E,variant:"outlined",sx:{borderRadius:2,overflow:"hidden"},children:e.jsxs(A,{size:"small",children:[e.jsx(I,{children:e.jsxs(j,{sx:{backgroundColor:"action.hover"},children:[h.map(r=>e.jsx(a,{sx:{fontWeight:600},children:r.label},r.key)),e.jsx(a,{align:"right",sx:{width:48}})]})}),e.jsx(S,{children:l.map((r,n)=>e.jsxs(j,{sx:{transition:"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{backgroundColor:"action.hover"}},children:[h.map(t=>e.jsx(a,{children:e.jsx(W,{...y,type:t.type==="number"?"number":"text",value:r[t.key]??"",onChange:s=>C(n,t.key,s.target.value),inputProps:{"aria-label":`${t.label} row ${n+1}`},size:"small",variant:"standard",fullWidth:!0,sx:d.mergeSx(d.premiumInputSx,v)})},t.key)),e.jsx(a,{align:"right",children:e.jsx(B,{"aria-label":`Remove row ${n+1}`,onClick:()=>T(n),size:"small",sx:{borderRadius:2,color:"text.secondary","&:hover":{color:"error.main"}},children:e.jsx(H,{fontSize:"small"})})})]},n))})]})}),e.jsx(F,{onClick:R,startIcon:e.jsx(L,{}),size:"small",variant:"text",sx:{alignSelf:"flex-start",mt:1,borderRadius:2,textTransform:"none",fontWeight:600},children:q})]})}exports.default=O;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import z from "react";
|
|
3
|
+
import S from "@mui/material/Table";
|
|
4
|
+
import I from "@mui/material/TableBody";
|
|
5
|
+
import s from "@mui/material/TableCell";
|
|
6
|
+
import W from "@mui/material/TableContainer";
|
|
7
|
+
import B from "@mui/material/TableHead";
|
|
8
|
+
import b from "@mui/material/TableRow";
|
|
9
|
+
import F from "@mui/material/TextField";
|
|
10
|
+
import $ from "@mui/material/IconButton";
|
|
11
|
+
import j from "@mui/material/Button";
|
|
12
|
+
import E from "@mui/material/FormControl";
|
|
13
|
+
import L from "@mui/material/FormLabel";
|
|
14
|
+
import M from "@mui/material/Paper";
|
|
15
|
+
import P from "@mui/icons-material/Add";
|
|
16
|
+
import H from "@mui/icons-material/Close";
|
|
17
|
+
import { u as U, m as _, a as q } from "./index-Bh6BLrzq.mjs";
|
|
18
|
+
function x(n) {
|
|
19
|
+
return Array.isArray(n) ? n.map((d) => ({ ...d || {} })) : [];
|
|
20
|
+
}
|
|
21
|
+
function lr({ attributes: n = {}, onChange: d }) {
|
|
22
|
+
const {
|
|
23
|
+
MuiAttributes: g = {},
|
|
24
|
+
id: v = "",
|
|
25
|
+
columns: u = [],
|
|
26
|
+
addLabel: y = "Add row",
|
|
27
|
+
label: p
|
|
28
|
+
} = n, { sx: C, ...k } = g, f = Array.isArray(u) ? u : [], [l, i] = z.useState(() => x(n.value));
|
|
29
|
+
U(() => {
|
|
30
|
+
i(x(n.value));
|
|
31
|
+
}, [n.value]);
|
|
32
|
+
const c = (r) => {
|
|
33
|
+
d?.({ id: v, value: r });
|
|
34
|
+
}, w = (r, o, t) => {
|
|
35
|
+
const a = l.map((h, T) => T === r ? { ...h, [o]: t } : h);
|
|
36
|
+
i(a), c(a);
|
|
37
|
+
}, A = () => {
|
|
38
|
+
const r = [...l, {}];
|
|
39
|
+
i(r), c(r);
|
|
40
|
+
}, R = (r) => {
|
|
41
|
+
const o = l.filter((t, a) => a !== r);
|
|
42
|
+
i(o), c(o);
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ m(E, { component: "fieldset", fullWidth: !0, children: [
|
|
45
|
+
p && /* @__PURE__ */ e(L, { component: "legend", sx: { mb: 1 }, children: p }),
|
|
46
|
+
/* @__PURE__ */ e(
|
|
47
|
+
W,
|
|
48
|
+
{
|
|
49
|
+
component: M,
|
|
50
|
+
variant: "outlined",
|
|
51
|
+
sx: {
|
|
52
|
+
borderRadius: 2,
|
|
53
|
+
overflow: "hidden"
|
|
54
|
+
},
|
|
55
|
+
children: /* @__PURE__ */ m(S, { size: "small", children: [
|
|
56
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ m(b, { sx: { backgroundColor: "action.hover" }, children: [
|
|
57
|
+
f.map((r) => /* @__PURE__ */ e(s, { sx: { fontWeight: 600 }, children: r.label }, r.key)),
|
|
58
|
+
/* @__PURE__ */ e(s, { align: "right", sx: { width: 48 } })
|
|
59
|
+
] }) }),
|
|
60
|
+
/* @__PURE__ */ e(I, { children: l.map((r, o) => /* @__PURE__ */ m(
|
|
61
|
+
b,
|
|
62
|
+
{
|
|
63
|
+
sx: {
|
|
64
|
+
transition: "background-color 150ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
65
|
+
"&:hover": { backgroundColor: "action.hover" }
|
|
66
|
+
},
|
|
67
|
+
children: [
|
|
68
|
+
f.map((t) => /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(
|
|
69
|
+
F,
|
|
70
|
+
{
|
|
71
|
+
...k,
|
|
72
|
+
type: t.type === "number" ? "number" : "text",
|
|
73
|
+
value: r[t.key] ?? "",
|
|
74
|
+
onChange: (a) => w(o, t.key, a.target.value),
|
|
75
|
+
inputProps: {
|
|
76
|
+
"aria-label": `${t.label} row ${o + 1}`
|
|
77
|
+
},
|
|
78
|
+
size: "small",
|
|
79
|
+
variant: "standard",
|
|
80
|
+
fullWidth: !0,
|
|
81
|
+
sx: _(q, C)
|
|
82
|
+
}
|
|
83
|
+
) }, t.key)),
|
|
84
|
+
/* @__PURE__ */ e(s, { align: "right", children: /* @__PURE__ */ e(
|
|
85
|
+
$,
|
|
86
|
+
{
|
|
87
|
+
"aria-label": `Remove row ${o + 1}`,
|
|
88
|
+
onClick: () => R(o),
|
|
89
|
+
size: "small",
|
|
90
|
+
sx: {
|
|
91
|
+
borderRadius: 2,
|
|
92
|
+
color: "text.secondary",
|
|
93
|
+
"&:hover": { color: "error.main" }
|
|
94
|
+
},
|
|
95
|
+
children: /* @__PURE__ */ e(H, { fontSize: "small" })
|
|
96
|
+
}
|
|
97
|
+
) })
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
o
|
|
101
|
+
)) })
|
|
102
|
+
] })
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ e(
|
|
106
|
+
j,
|
|
107
|
+
{
|
|
108
|
+
onClick: A,
|
|
109
|
+
startIcon: /* @__PURE__ */ e(P, {}),
|
|
110
|
+
size: "small",
|
|
111
|
+
variant: "text",
|
|
112
|
+
sx: {
|
|
113
|
+
alignSelf: "flex-start",
|
|
114
|
+
mt: 1,
|
|
115
|
+
borderRadius: 2,
|
|
116
|
+
textTransform: "none",
|
|
117
|
+
fontWeight: 600
|
|
118
|
+
},
|
|
119
|
+
children: y
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] });
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
lr as default
|
|
126
|
+
};
|