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.
Files changed (108) hide show
  1. package/README.md +20 -5
  2. package/dist/components/DynamicComponent.d.ts +13 -0
  3. package/dist/components/FormGenerator.d.ts +38 -0
  4. package/dist/components/charts/Bar/bar.d.ts +3 -0
  5. package/dist/components/charts/Line/line.d.ts +3 -0
  6. package/dist/components/charts/Mixchart/mixChart.d.ts +3 -0
  7. package/dist/components/charts/Pie/pie.d.ts +3 -0
  8. package/dist/components/controls/Accordion/accordion.d.ts +3 -0
  9. package/dist/components/controls/Autocomplete/autocomplete.d.ts +3 -0
  10. package/dist/components/controls/CheckBox/checkbox.d.ts +4 -0
  11. package/dist/components/controls/Chip/chip.d.ts +3 -0
  12. package/dist/components/controls/DataTable/datatable.d.ts +3 -0
  13. package/dist/components/controls/DateTime/datetime.d.ts +3 -0
  14. package/dist/components/controls/DateTimePicker/datetimepicker.d.ts +3 -0
  15. package/dist/components/controls/Divider/divider.d.ts +3 -0
  16. package/dist/components/controls/Group/group.d.ts +3 -0
  17. package/dist/components/controls/ImageList/imagelist.d.ts +3 -0
  18. package/dist/components/controls/List/list.d.ts +3 -0
  19. package/dist/components/controls/MultiTextbox/multitextbox.d.ts +3 -0
  20. package/dist/components/controls/NumberField/numberfield.d.ts +3 -0
  21. package/dist/components/controls/Radio/radio.d.ts +4 -0
  22. package/dist/components/controls/Select/select.d.ts +3 -0
  23. package/dist/components/controls/Signature/signature.d.ts +3 -0
  24. package/dist/components/controls/Stepper/stepper.d.ts +9 -0
  25. package/dist/components/controls/Switch/switch.d.ts +4 -0
  26. package/dist/components/controls/Tabs/tabs.d.ts +3 -0
  27. package/dist/components/controls/TextField/textfield.d.ts +3 -0
  28. package/dist/components/controls/TimePicker/timepicker.d.ts +3 -0
  29. package/dist/components/controls/Typography/typography.d.ts +4 -0
  30. package/dist/components/controls/index.d.ts +56 -0
  31. package/dist/config/mui.d.ts +8 -0
  32. package/dist/dynamic-mui.cjs.js +496 -0
  33. package/dist/dynamic-mui.es.js +82175 -0
  34. package/dist/index.d.ts +5 -0
  35. package/dist/main.d.ts +1 -0
  36. package/dist/playground/Builder.d.ts +1 -0
  37. package/dist/playground/Canvas.d.ts +10 -0
  38. package/dist/playground/PropertiesEditor.d.ts +11 -0
  39. package/dist/playground/Sidebar.d.ts +1 -0
  40. package/dist/playground/documentation.d.ts +6 -0
  41. package/dist/playground/templates.d.ts +8 -0
  42. package/dist/playground/testData.d.ts +3 -0
  43. package/dist/test/setup.d.ts +1 -0
  44. package/dist/theme/theme.d.ts +1 -0
  45. package/dist/types.d.ts +19 -0
  46. package/dist/util/helper.d.ts +61 -0
  47. package/dist/util/stepperComponents.d.ts +6 -0
  48. package/dist/util/useIsFirstRender.d.ts +1 -0
  49. package/dist/util/useUpdateEffect.d.ts +3 -0
  50. package/dist/util/validation.d.ts +6 -0
  51. package/package.json +68 -54
  52. package/build/asset-manifest.json +0 -10
  53. package/build/favicon.ico +0 -0
  54. package/build/index.html +0 -1
  55. package/build/logo192.png +0 -0
  56. package/build/logo512.png +0 -0
  57. package/build/manifest.json +0 -25
  58. package/build/robots.txt +0 -3
  59. package/build/static/js/main.11a67c51.js +0 -3
  60. package/build/static/js/main.11a67c51.js.LICENSE.txt +0 -85
  61. package/build/static/js/main.11a67c51.js.map +0 -1
  62. package/craco.config.js +0 -34
  63. package/dist-modules/components/DynamicComponent.js +0 -22
  64. package/dist-modules/components/FormGenerator.js +0 -200
  65. package/dist-modules/components/charts/Bar/bar.js +0 -31
  66. package/dist-modules/components/charts/Line/line.js +0 -31
  67. package/dist-modules/components/charts/Mixchart/mixChart.js +0 -59
  68. package/dist-modules/components/charts/Pie/pie.js +0 -31
  69. package/dist-modules/components/controls/CheckBox/checkbox.js +0 -56
  70. package/dist-modules/components/controls/DataTable/datatable.js +0 -28
  71. package/dist-modules/components/controls/DateTime/datetime.js +0 -53
  72. package/dist-modules/components/controls/DateTimePicker/datetimepicker.js +0 -53
  73. package/dist-modules/components/controls/Radio/radio.js +0 -88
  74. package/dist-modules/components/controls/Select/select.js +0 -173
  75. package/dist-modules/components/controls/Stepper/stepper.js +0 -192
  76. package/dist-modules/components/controls/Switch/switch.js +0 -85
  77. package/dist-modules/components/controls/TextField/textfield.js +0 -148
  78. package/dist-modules/components/controls/TimePicker/timepicker.js +0 -53
  79. package/dist-modules/components/controls/Typography/typography.js +0 -43
  80. package/dist-modules/components/controls/index.js +0 -42
  81. package/dist-modules/config/mui.js +0 -73
  82. package/dist-modules/data/checkbox.js +0 -143
  83. package/dist-modules/data/dataTable.js +0 -90
  84. package/dist-modules/data/dateTime.js +0 -136
  85. package/dist-modules/data/radio.js +0 -36
  86. package/dist-modules/data/select.js +0 -126
  87. package/dist-modules/data/stepper.js +0 -237
  88. package/dist-modules/data/switch.js +0 -123
  89. package/dist-modules/data/textfield.js +0 -240
  90. package/dist-modules/index.js +0 -16
  91. package/dist-modules/util/helper.js +0 -226
  92. package/dist-modules/util/stepperComponents.js +0 -40
  93. package/dist-modules/util/useIsFirstRender.js +0 -15
  94. package/dist-modules/util/useUpdateEffect.js +0 -19
  95. package/dist-modules/util/validation.js +0 -102
  96. package/docs/asset-manifest.json +0 -9
  97. package/docs/build/bundle.1eab2706.js +0 -2
  98. package/docs/build/bundle.1eab2706.js.LICENSE.txt +0 -153
  99. package/docs/index.html +0 -16
  100. package/public/favicon.ico +0 -0
  101. package/public/index.html +0 -43
  102. package/public/logo192.png +0 -0
  103. package/public/logo512.png +0 -0
  104. package/public/manifest.json +0 -25
  105. package/public/robots.txt +0 -3
  106. package/styleguide.config.js +0 -108
  107. package/themes/default.js +0 -114
  108. 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
- `import { FormGenerator } from 'dynamic-mui/dist-modules/components/FormGenerator'`;
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
- library={MUI}
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,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function Bar({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function Line({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function MixChart({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function Pie({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function Accordion({ attributes, patch, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function AutoComplete({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ /** Playground Component */
4
+ export default function CheckBox({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function Chip({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function DataTable({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function DateTime({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function DateTimePicker({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function Divider({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function Group({ attributes, patch, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function ImgList({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function List({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function MultiTextbox({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function NumberField({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ /** Radio Component */
4
+ export default function Radio({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function Select({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function Signature({ attributes, onChange }: ControlProps): 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,4 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ /** Switch Component */
4
+ export default function Switch({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function Tabs({ attributes, patch, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function TextField({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ export default function TimePicker({ attributes, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { ControlProps } from '../../../types';
2
+
3
+ /** Typography Component */
4
+ export default function Typography({ attributes }: ControlProps): import("react/jsx-runtime").JSX.Element;
@@ -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;
@@ -0,0 +1,8 @@
1
+ export interface ComponentConfig {
2
+ type: string;
3
+ map: string;
4
+ options?: Record<string, any>;
5
+ }
6
+ export type MuiConfigMap = Record<string, ComponentConfig>;
7
+ declare const mui: MuiConfigMap;
8
+ export default mui;