dynamic-mui 1.1.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -5
- package/dist/components/DynamicComponent.d.ts +13 -0
- package/dist/components/FormGenerator.d.ts +38 -0
- package/dist/components/charts/Bar/bar.d.ts +3 -0
- package/dist/components/charts/Line/line.d.ts +3 -0
- package/dist/components/charts/Mixchart/mixChart.d.ts +3 -0
- package/dist/components/charts/Pie/pie.d.ts +3 -0
- package/dist/components/controls/Accordion/accordion.d.ts +3 -0
- package/dist/components/controls/Autocomplete/autocomplete.d.ts +3 -0
- package/dist/components/controls/CheckBox/checkbox.d.ts +4 -0
- package/dist/components/controls/Chip/chip.d.ts +3 -0
- package/dist/components/controls/DataTable/datatable.d.ts +3 -0
- package/dist/components/controls/DateTime/datetime.d.ts +3 -0
- package/dist/components/controls/DateTimePicker/datetimepicker.d.ts +3 -0
- package/dist/components/controls/Divider/divider.d.ts +3 -0
- package/dist/components/controls/Group/group.d.ts +3 -0
- package/dist/components/controls/ImageList/imagelist.d.ts +3 -0
- package/dist/components/controls/List/list.d.ts +3 -0
- package/dist/components/controls/MultiTextbox/multitextbox.d.ts +3 -0
- package/dist/components/controls/NumberField/numberfield.d.ts +3 -0
- package/dist/components/controls/Radio/radio.d.ts +4 -0
- package/dist/components/controls/Select/select.d.ts +3 -0
- package/dist/components/controls/Signature/signature.d.ts +3 -0
- package/dist/components/controls/Stepper/stepper.d.ts +9 -0
- package/dist/components/controls/Switch/switch.d.ts +4 -0
- package/dist/components/controls/Tabs/tabs.d.ts +3 -0
- package/dist/components/controls/TextField/textfield.d.ts +3 -0
- package/dist/components/controls/TimePicker/timepicker.d.ts +3 -0
- package/dist/components/controls/Typography/typography.d.ts +4 -0
- package/dist/components/controls/index.d.ts +56 -0
- package/dist/config/mui.d.ts +8 -0
- package/dist/dynamic-mui.cjs.js +496 -0
- package/dist/dynamic-mui.es.js +82175 -0
- package/dist/index.d.ts +5 -0
- package/dist/main.d.ts +1 -0
- package/dist/playground/Builder.d.ts +1 -0
- package/dist/playground/Canvas.d.ts +10 -0
- package/dist/playground/PropertiesEditor.d.ts +11 -0
- package/dist/playground/Sidebar.d.ts +1 -0
- package/dist/playground/documentation.d.ts +6 -0
- package/dist/playground/templates.d.ts +8 -0
- package/dist/playground/testData.d.ts +3 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/theme/theme.d.ts +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/util/helper.d.ts +61 -0
- package/dist/util/stepperComponents.d.ts +6 -0
- package/dist/util/useIsFirstRender.d.ts +1 -0
- package/dist/util/useUpdateEffect.d.ts +3 -0
- package/dist/util/validation.d.ts +6 -0
- package/package.json +68 -54
- package/build/asset-manifest.json +0 -10
- package/build/favicon.ico +0 -0
- package/build/index.html +0 -1
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/build/static/js/main.11a67c51.js +0 -3
- package/build/static/js/main.11a67c51.js.LICENSE.txt +0 -85
- package/build/static/js/main.11a67c51.js.map +0 -1
- package/craco.config.js +0 -34
- package/dist-modules/components/DynamicComponent.js +0 -22
- package/dist-modules/components/FormGenerator.js +0 -200
- package/dist-modules/components/charts/Bar/bar.js +0 -31
- package/dist-modules/components/charts/Line/line.js +0 -31
- package/dist-modules/components/charts/Mixchart/mixChart.js +0 -59
- package/dist-modules/components/charts/Pie/pie.js +0 -31
- package/dist-modules/components/controls/CheckBox/checkbox.js +0 -56
- package/dist-modules/components/controls/DataTable/datatable.js +0 -28
- package/dist-modules/components/controls/DateTime/datetime.js +0 -53
- package/dist-modules/components/controls/DateTimePicker/datetimepicker.js +0 -53
- package/dist-modules/components/controls/Radio/radio.js +0 -88
- package/dist-modules/components/controls/Select/select.js +0 -173
- package/dist-modules/components/controls/Stepper/stepper.js +0 -192
- package/dist-modules/components/controls/Switch/switch.js +0 -85
- package/dist-modules/components/controls/TextField/textfield.js +0 -148
- package/dist-modules/components/controls/TimePicker/timepicker.js +0 -53
- package/dist-modules/components/controls/Typography/typography.js +0 -43
- package/dist-modules/components/controls/index.js +0 -42
- package/dist-modules/config/mui.js +0 -73
- package/dist-modules/data/checkbox.js +0 -143
- package/dist-modules/data/dataTable.js +0 -90
- package/dist-modules/data/dateTime.js +0 -136
- package/dist-modules/data/radio.js +0 -36
- package/dist-modules/data/select.js +0 -126
- package/dist-modules/data/stepper.js +0 -237
- package/dist-modules/data/switch.js +0 -123
- package/dist-modules/data/textfield.js +0 -240
- package/dist-modules/index.js +0 -16
- package/dist-modules/util/helper.js +0 -226
- package/dist-modules/util/stepperComponents.js +0 -40
- package/dist-modules/util/useIsFirstRender.js +0 -15
- package/dist-modules/util/useUpdateEffect.js +0 -19
- package/dist-modules/util/validation.js +0 -102
- package/docs/asset-manifest.json +0 -9
- package/docs/build/bundle.1eab2706.js +0 -2
- package/docs/build/bundle.1eab2706.js.LICENSE.txt +0 -153
- package/docs/index.html +0 -16
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/styleguide.config.js +0 -108
- package/themes/default.js +0 -114
- package/themes/index.js +0 -29
package/README.md
CHANGED
|
@@ -5,11 +5,16 @@ Build dynamic forms using Material UI
|
|
|
5
5
|
`npm install @mui/material @emotion/react @emotion/styled`
|
|
6
6
|
`npm install dynamic-mui --save`
|
|
7
7
|
|
|
8
|
-
##Usage
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { FormGenerator } from 'dynamic-mui';
|
|
11
12
|
|
|
12
13
|
export default function DynamicForm() {
|
|
14
|
+
const handleSubmit = (data) => {
|
|
15
|
+
console.log(data);
|
|
16
|
+
};
|
|
17
|
+
|
|
13
18
|
return (
|
|
14
19
|
<FormGenerator
|
|
15
20
|
data={[
|
|
@@ -26,8 +31,18 @@ export default function DynamicForm() {
|
|
|
26
31
|
},
|
|
27
32
|
]}
|
|
28
33
|
guid="Testing"
|
|
29
|
-
|
|
34
|
+
onSubmit={handleSubmit}
|
|
30
35
|
/>
|
|
31
36
|
);
|
|
32
|
-
}
|
|
37
|
+
}
|
|
33
38
|
```
|
|
39
|
+
|
|
40
|
+
## Local Development (Playground)
|
|
41
|
+
|
|
42
|
+
To run the local playground and test changes:
|
|
43
|
+
|
|
44
|
+
1. `npm install`
|
|
45
|
+
2. `npm run dev`
|
|
46
|
+
3. Open `http://localhost:5173` (or the port shown in terminal) in your browser.
|
|
47
|
+
|
|
48
|
+
The playground entry point is located at `src/main.tsx`.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ControlProps } from '../types';
|
|
2
|
+
|
|
3
|
+
interface DynamicComponentProps extends ControlProps {
|
|
4
|
+
map?: string;
|
|
5
|
+
option?: string;
|
|
6
|
+
control?: any;
|
|
7
|
+
currentStep?: number;
|
|
8
|
+
patch?: any;
|
|
9
|
+
onStepUpdate?: any;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export default function DynamicComponent(props: DynamicComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { GridProps } from '@mui/material';
|
|
3
|
+
import { FormField } from '../util/helper';
|
|
4
|
+
|
|
5
|
+
export declare const FormData: (id?: string) => any;
|
|
6
|
+
export declare const ClearFormData: (id?: string) => void;
|
|
7
|
+
export interface FormGeneratorProps {
|
|
8
|
+
/** Component unique identifier */
|
|
9
|
+
guid: string;
|
|
10
|
+
/** Component json data */
|
|
11
|
+
data: FormField[];
|
|
12
|
+
/** Json data to assign value */
|
|
13
|
+
patch?: Record<string, any>;
|
|
14
|
+
/** Component Ref */
|
|
15
|
+
formRef?: React.RefObject<HTMLButtonElement>;
|
|
16
|
+
/** Component Submit Function */
|
|
17
|
+
onSubmit?: (response: any, errors: any[], data: FormField[], guid: string) => void;
|
|
18
|
+
/** Component On Change Function */
|
|
19
|
+
onChange?: (args: {
|
|
20
|
+
id: string;
|
|
21
|
+
value: any;
|
|
22
|
+
option?: any;
|
|
23
|
+
}) => void;
|
|
24
|
+
/** Component On Step Change Function */
|
|
25
|
+
onStepChange?: (currentStep: number, isScreenChange: boolean, isLastStep: boolean) => void;
|
|
26
|
+
/** Grid Container Attributes */
|
|
27
|
+
MuiGridAttributes?: GridProps;
|
|
28
|
+
/** Stepper Active Step */
|
|
29
|
+
/** Stepper Active Step */
|
|
30
|
+
activeStep?: number;
|
|
31
|
+
/** On Field Click (Internal/Builder) */
|
|
32
|
+
onFieldClick?: (field: FormField) => void;
|
|
33
|
+
/** On Field Double Click (Internal/Builder) */
|
|
34
|
+
onFieldDoubleClick?: (field: FormField) => void;
|
|
35
|
+
/** On Field Context Menu (Internal/Builder) */
|
|
36
|
+
onFieldContextMenu?: (event: React.MouseEvent, field: FormField) => void;
|
|
37
|
+
}
|
|
38
|
+
export declare function FormGenerator({ data, patch, guid, formRef, onSubmit, onChange, onStepChange, MuiGridAttributes, activeStep, onFieldClick, onFieldDoubleClick, onFieldContextMenu, }: FormGeneratorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ControlProps } from '../../../types';
|
|
2
|
+
|
|
3
|
+
interface StepperProps extends ControlProps {
|
|
4
|
+
onStepUpdate?: (newStep: number, isScreenChange: boolean, isLastStep: boolean) => void;
|
|
5
|
+
currentStep?: number;
|
|
6
|
+
patch?: Record<string, any>;
|
|
7
|
+
}
|
|
8
|
+
export default function Stepper({ attributes, onChange, onStepUpdate, currentStep, patch }: StepperProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { default as Typography } from './Typography/typography';
|
|
2
|
+
import { default as TextField } from './TextField/textfield';
|
|
3
|
+
import { default as Table } from './DataTable/datatable';
|
|
4
|
+
import { default as DateTime } from './DateTime/datetime';
|
|
5
|
+
import { default as DateTimePicker } from './DateTimePicker/datetimepicker';
|
|
6
|
+
import { default as TimePicker } from './TimePicker/timepicker';
|
|
7
|
+
import { default as Select } from './Select/select';
|
|
8
|
+
import { default as CheckBox } from './CheckBox/checkbox';
|
|
9
|
+
import { default as Switch } from './Switch/switch';
|
|
10
|
+
import { default as Radio } from './Radio/radio';
|
|
11
|
+
import { default as Stepper } from './Stepper/stepper';
|
|
12
|
+
import { default as Bar } from '../charts/Bar/bar';
|
|
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';
|
|
16
|
+
import { default as Divider } from './Divider/divider';
|
|
17
|
+
import { default as Chip } from './Chip/chip';
|
|
18
|
+
import { default as List } from './List/list';
|
|
19
|
+
import { default as NumberField } from './NumberField/numberfield';
|
|
20
|
+
import { default as MultiTextbox } from './MultiTextbox/multitextbox';
|
|
21
|
+
import { default as Signature } from './Signature/signature';
|
|
22
|
+
import { default as Group } from './Group/group';
|
|
23
|
+
import { default as Accordion } from './Accordion/accordion';
|
|
24
|
+
import { default as Tabs } from './Tabs/tabs';
|
|
25
|
+
import { default as AutoComplete } from './Autocomplete/autocomplete';
|
|
26
|
+
import { default as ImgList } from './ImageList/imagelist';
|
|
27
|
+
|
|
28
|
+
declare const Controls: {
|
|
29
|
+
Typography: typeof Typography;
|
|
30
|
+
TextField: typeof TextField;
|
|
31
|
+
Table: typeof Table;
|
|
32
|
+
DateTime: typeof DateTime;
|
|
33
|
+
DateTimePicker: typeof DateTimePicker;
|
|
34
|
+
TimePicker: typeof TimePicker;
|
|
35
|
+
Select: typeof Select;
|
|
36
|
+
CheckBox: typeof CheckBox;
|
|
37
|
+
Switch: typeof Switch;
|
|
38
|
+
Radio: typeof Radio;
|
|
39
|
+
Stepper: typeof Stepper;
|
|
40
|
+
Bar: typeof Bar;
|
|
41
|
+
Line: typeof Line;
|
|
42
|
+
Pie: typeof Pie;
|
|
43
|
+
MixChart: typeof MixChart;
|
|
44
|
+
Divider: typeof Divider;
|
|
45
|
+
Chip: typeof Chip;
|
|
46
|
+
List: typeof List;
|
|
47
|
+
NumberField: typeof NumberField;
|
|
48
|
+
MultiTextbox: typeof MultiTextbox;
|
|
49
|
+
Signature: typeof Signature;
|
|
50
|
+
Group: typeof Group;
|
|
51
|
+
Accordion: typeof Accordion;
|
|
52
|
+
Tabs: typeof Tabs;
|
|
53
|
+
AutoComplete: typeof AutoComplete;
|
|
54
|
+
ImgList: typeof ImgList;
|
|
55
|
+
};
|
|
56
|
+
export default Controls;
|