@m4l/components 0.1.27 → 0.1.28
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/assets/Logo/index.228dcb5a.js +42 -35
- package/commonjs.565e6834.js +5 -5
- package/components/CommonActions/components/ActionCancel/index.e498eeb2.js +17 -0
- package/components/CommonActions/components/ActionFormCancel/index.4ff0ad73.js +64 -0
- package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +28 -22
- package/components/CommonActions/components/ActionIntro/index.60ef7bd7.js +18 -0
- package/components/CommonActions/components/Actions/index.0645e30f.js +867 -0
- package/components/DataGrid/index.76d8fd25.js +1075 -0
- package/components/DynamicFilter/index.342ba5fe.js +1577 -0
- package/components/ErrorLabel/index.c8615f16.js +13 -12
- package/components/Icon/index.619c31c4.js +65 -53
- package/components/Image/index.93d5f37f.js +190 -0
- package/components/Loadable/index.f5518558.js +8 -8
- package/components/ModalDialog/index.9ea10764.js +184 -0
- package/components/NoItemSelected/{index.9609a7f7.js → index.46d2f632.js} +52 -41
- package/components/ObjectLogs/index.f941fb79.js +288 -0
- package/components/Page/index.4237c241.js +22 -20
- package/components/PaperForm/index.ec9cb8c9.js +66 -59
- package/components/Period/index.2941fbda.js +249 -0
- package/components/PropertyValue/index.dfcfe1ba.js +95 -65
- package/components/Resizeable/index.45995d2b.js +19 -19
- package/components/ScrollBar/index.39eeb2de.js +26 -21
- package/components/ScrollToTop/index.e06f98f6.js +8 -7
- package/components/SplitLayout/index.4032673d.js +35 -33
- package/components/animate/LoadingScreen/index.1d0c4307.js +33 -33
- package/components/animate/MotionContainer/index.8d9f9d80.js +25 -22
- package/components/animate/MotionLazyContainer/index.572dd012.js +10 -10
- package/components/animate/features.0fbf41e1.js +3 -3
- package/components/animate/variants/bounce.784aaaaa.js +16 -13
- package/components/animate/variants/container.11f82b76.js +8 -6
- package/components/animate/variants/fade.b561c0fc.js +32 -28
- package/components/animate/variants/transition.bd46b9ce.js +17 -12
- package/components/formatters/BooleanFormatter/index.8da35c9c.js +46 -33
- package/components/formatters/DateFormatter/index.1b9baacc.js +49 -37
- package/components/formatters/index.689a8086.js +119 -0
- package/components/hook-form/RHFAutocomplete/index.59a68f9f.js +224 -0
- package/components/hook-form/RHFAutocompleteAsync/index.c3083062.js +87 -0
- package/components/hook-form/RHFCheckbox/index.6dcec9e2.js +49 -39
- package/components/hook-form/RHFDateTime/index.9231a7c7.js +69 -56
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +23 -23
- package/components/hook-form/RHFPeriod/index.64a228d5.js +55 -0
- package/components/hook-form/RHFRadioGroup/index.b3335e13.js +29 -29
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +24 -24
- package/components/hook-form/RHFTextField/index.f9aaaa90.js +110 -93
- package/components/hook-form/RHFUpload/{index.ec4d5326.js → index.d5cc7c13.js} +151 -130
- package/components/mui_extended/Accordion/index.a02ac6ae.js +73 -69
- package/components/mui_extended/Avatar/index.fe06afd7.js +44 -34
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +10 -10
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +49 -44
- package/components/mui_extended/Button/index.53b56958.js +178 -0
- package/components/mui_extended/CircularProgress/index.ad569afd.js +8 -6
- package/components/mui_extended/IconButton/index.a321e5cb.js +82 -67
- package/components/mui_extended/LinkWithRoute/index.16436ab8.js +25 -21
- package/components/mui_extended/Pager/index.c0865b70.js +141 -0
- package/components/mui_extended/Popover/index.705275a4.js +278 -0
- package/components/mui_extended/Tab/index.e0653a0a.js +25 -21
- package/components/mui_extended/Typography/index.e5494696.js +25 -21
- package/contexts/ModalContext/index.b92fa565.js +153 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/index.d.ts +0 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/styles.d.ts +0 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/types.d.ts +0 -0
- package/contexts/RHFormContext/index.b142190a.js +63 -0
- package/hooks/useFormAddEdit/index.d4845f1a.js +40 -22
- package/hooks/useModal/index.5fee01a3.js +11 -0
- package/index.js +153 -153
- package/package.json +2 -1
- package/react-data-grid.d46d625e.js +2206 -1663
- package/react-draggable.20e95c61.js +800 -553
- package/react-json-view.f56a7f8e.js +2344 -2340
- package/react-resizable.5277deaf.js +470 -298
- package/react-splitter-layout.7810ac1b.js +130 -128
- package/utils/index.214d9542.js +500 -354
- package/components/CommonActions/components/ActionCancel/index.431160ba.js +0 -17
- package/components/CommonActions/components/ActionFormCancel/index.6a0f34aa.js +0 -49
- package/components/CommonActions/components/ActionIntro/index.85557b90.js +0 -18
- package/components/CommonActions/components/Actions/index.edeb05c2.js +0 -742
- package/components/DataGrid/index.2ce9da7d.js +0 -894
- package/components/DynamicFilter/index.e1d4a948.js +0 -1157
- package/components/Image/index.c9da2d5a.js +0 -152
- package/components/ModalDialog/index.ad61757f.js +0 -168
- package/components/ObjectLogs/index.6ebaec71.js +0 -266
- package/components/Period/index.81de7941.js +0 -175
- package/components/contexts/RHFormContext/index.33dba822.js +0 -56
- package/components/formatters/index.c2a9b55d.js +0 -106
- package/components/hook-form/RHFAutocomplete/index.5eee9d7c.js +0 -174
- package/components/hook-form/RHFAutocompleteAsync/index.757b5080.js +0 -65
- package/components/hook-form/RHFPeriod/index.e08fb1ab.js +0 -51
- package/components/mui_extended/Button/index.51dae0bb.js +0 -144
- package/components/mui_extended/Pager/index.1dc45f5e.js +0 -126
- package/components/mui_extended/Popover/index.cb2ccc66.js +0 -252
- package/contexts/ModalContext/index.9ebc793c.js +0 -136
- package/hooks/useModal/index.34f5978e.js +0 -11
- package/node_modules.168cb897.js +0 -55
|
@@ -1,58 +1,68 @@
|
|
|
1
|
-
import { useFormContext
|
|
2
|
-
import { styled as
|
|
3
|
-
import { styled
|
|
4
|
-
import { useModuleSkeleton
|
|
5
|
-
import { jsx
|
|
6
|
-
const
|
|
1
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
2
|
+
import { styled as styled$1 } from "@mui/material/styles";
|
|
3
|
+
import { styled, Skeleton, FormControlLabel, Checkbox } from "@mui/material";
|
|
4
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
5
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
6
|
+
const WrapperSkeletonCheckBox = styled("div")(() => ({
|
|
7
7
|
display: "flex",
|
|
8
8
|
justifyContent: "center",
|
|
9
9
|
alignItems: "center",
|
|
10
10
|
width: "36px",
|
|
11
11
|
height: "36px"
|
|
12
|
-
}))
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
}));
|
|
13
|
+
const SkeletonCheckBox = () => {
|
|
14
|
+
return /* @__PURE__ */ jsx(WrapperSkeletonCheckBox, {
|
|
15
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
16
|
+
variant: "rounded",
|
|
17
|
+
width: "18px",
|
|
18
|
+
height: "18px"
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const ErrorLabel = styled$1("p")(({
|
|
23
|
+
theme
|
|
20
24
|
}) => ({
|
|
21
|
-
...
|
|
22
|
-
color:
|
|
25
|
+
...theme.typography.caption,
|
|
26
|
+
color: theme.palette.error.main,
|
|
23
27
|
marginRight: 14,
|
|
24
28
|
marginLeft: 14
|
|
25
29
|
}));
|
|
26
|
-
function
|
|
27
|
-
name
|
|
28
|
-
sizeCheck
|
|
29
|
-
...
|
|
30
|
+
function RHFCheckbox({
|
|
31
|
+
name,
|
|
32
|
+
sizeCheck = "small",
|
|
33
|
+
...other
|
|
30
34
|
}) {
|
|
31
35
|
const {
|
|
32
|
-
control
|
|
33
|
-
} =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
control
|
|
37
|
+
} = useFormContext();
|
|
38
|
+
const isSkeleton = useModuleSkeleton();
|
|
39
|
+
return /* @__PURE__ */ jsx(FormControlLabel, {
|
|
40
|
+
control: /* @__PURE__ */ jsx(Controller, {
|
|
41
|
+
name,
|
|
42
|
+
control,
|
|
38
43
|
render: ({
|
|
39
|
-
field
|
|
44
|
+
field,
|
|
40
45
|
fieldState: {
|
|
41
|
-
error
|
|
46
|
+
error
|
|
47
|
+
}
|
|
48
|
+
}) => {
|
|
49
|
+
if (isSkeleton) {
|
|
50
|
+
return /* @__PURE__ */ jsx(SkeletonCheckBox, {});
|
|
42
51
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
53
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
54
|
+
size: sizeCheck,
|
|
55
|
+
...field,
|
|
56
|
+
checked: field.value
|
|
57
|
+
}), error?.message && /* @__PURE__ */ jsx(ErrorLabel, {
|
|
58
|
+
children: error?.message + ""
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
52
62
|
}),
|
|
53
|
-
...
|
|
63
|
+
...other
|
|
54
64
|
});
|
|
55
65
|
}
|
|
56
66
|
export {
|
|
57
|
-
|
|
67
|
+
RHFCheckbox as R
|
|
58
68
|
};
|
|
@@ -1,81 +1,94 @@
|
|
|
1
|
-
import { useFormContext
|
|
2
|
-
import { Skeleton
|
|
3
|
-
import { DateTimePicker
|
|
4
|
-
import { useModuleSkeleton
|
|
5
|
-
import { styled
|
|
6
|
-
import { jsxs
|
|
7
|
-
const
|
|
8
|
-
theme
|
|
1
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
2
|
+
import { Skeleton, TextField } from "@mui/material";
|
|
3
|
+
import { DateTimePicker } from "@mui/x-date-pickers";
|
|
4
|
+
import { useModuleSkeleton, useEnvironment } from "@m4l/core";
|
|
5
|
+
import { styled } from "@mui/material/styles";
|
|
6
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
7
|
+
const SKTRHFWrapperTextField = styled("div")(({
|
|
8
|
+
theme
|
|
9
9
|
}) => ({
|
|
10
10
|
display: "flex",
|
|
11
11
|
width: "100%",
|
|
12
12
|
height: "42.25px",
|
|
13
13
|
alignItems: "center",
|
|
14
14
|
justifyContent: "space-between",
|
|
15
|
-
border: `1px solid ${
|
|
15
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
16
16
|
padding: "0 14px",
|
|
17
|
-
borderRadius:
|
|
18
|
-
}))
|
|
17
|
+
borderRadius: theme.spacing(0.5)
|
|
18
|
+
}));
|
|
19
|
+
const SkeletonRHFDateTime = (props) => {
|
|
19
20
|
const {
|
|
20
|
-
skeletonWidth
|
|
21
|
-
skeletonHeight
|
|
22
|
-
} =
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
children: [/* @__PURE__ */
|
|
21
|
+
skeletonWidth,
|
|
22
|
+
skeletonHeight
|
|
23
|
+
} = props;
|
|
24
|
+
return /* @__PURE__ */ jsxs(SKTRHFWrapperTextField, {
|
|
25
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
25
26
|
variant: "text",
|
|
26
|
-
width:
|
|
27
|
-
height:
|
|
28
|
-
}), /* @__PURE__ */
|
|
27
|
+
width: skeletonWidth,
|
|
28
|
+
height: skeletonHeight
|
|
29
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
29
30
|
variant: "circular",
|
|
30
31
|
width: "20px",
|
|
31
32
|
height: "20px"
|
|
32
33
|
})]
|
|
33
34
|
});
|
|
34
35
|
};
|
|
35
|
-
function
|
|
36
|
+
function RHFDateTime(props) {
|
|
37
|
+
const {
|
|
38
|
+
name,
|
|
39
|
+
autoComplete = "off",
|
|
40
|
+
skeletonWidth = "50%",
|
|
41
|
+
skeletonHeight = 14
|
|
42
|
+
} = props;
|
|
43
|
+
const isSkeleton = useModuleSkeleton();
|
|
44
|
+
const {
|
|
45
|
+
control
|
|
46
|
+
} = useFormContext();
|
|
36
47
|
const {
|
|
37
|
-
name: n,
|
|
38
|
-
autoComplete: r = "off",
|
|
39
|
-
skeletonWidth: l = "50%",
|
|
40
|
-
skeletonHeight: m = 14
|
|
41
|
-
} = e, d = k(), {
|
|
42
|
-
control: p
|
|
43
|
-
} = c(), {
|
|
44
48
|
dfnsFormat: {
|
|
45
|
-
datetime_format
|
|
46
|
-
datetime_mask
|
|
49
|
+
datetime_format,
|
|
50
|
+
datetime_mask
|
|
47
51
|
}
|
|
48
|
-
} =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
} = useEnvironment();
|
|
53
|
+
if (isSkeleton) {
|
|
54
|
+
return /* @__PURE__ */ jsx(SkeletonRHFDateTime, {
|
|
55
|
+
skeletonWidth,
|
|
56
|
+
skeletonHeight
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
60
|
+
name,
|
|
61
|
+
control,
|
|
55
62
|
render: ({
|
|
56
|
-
field
|
|
63
|
+
field,
|
|
57
64
|
fieldState: {
|
|
58
|
-
error
|
|
65
|
+
error
|
|
59
66
|
}
|
|
60
|
-
}) =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
}) => {
|
|
68
|
+
return /* @__PURE__ */ jsx(DateTimePicker, {
|
|
69
|
+
ampm: false,
|
|
70
|
+
inputFormat: datetime_format,
|
|
71
|
+
mask: datetime_mask,
|
|
72
|
+
label: "",
|
|
73
|
+
value: field.value,
|
|
74
|
+
onChange: (value) => {
|
|
75
|
+
if (!isNaN(value)) {
|
|
76
|
+
field.onChange(value);
|
|
77
|
+
} else {
|
|
78
|
+
field.onChange(void 0);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField, {
|
|
82
|
+
autoComplete,
|
|
83
|
+
fullWidth: true,
|
|
84
|
+
error: !!error,
|
|
85
|
+
helperText: error?.message,
|
|
86
|
+
...params
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
}
|
|
77
90
|
});
|
|
78
91
|
}
|
|
79
92
|
export {
|
|
80
|
-
|
|
93
|
+
RHFDateTime as R
|
|
81
94
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { useFormContext
|
|
2
|
-
import { FormGroup
|
|
3
|
-
import { jsx
|
|
4
|
-
function
|
|
5
|
-
name
|
|
6
|
-
options
|
|
7
|
-
...
|
|
1
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
2
|
+
import { FormGroup, FormControlLabel, Checkbox } from "@mui/material";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
function RHFMultiCheckbox({
|
|
5
|
+
name,
|
|
6
|
+
options,
|
|
7
|
+
...other
|
|
8
8
|
}) {
|
|
9
9
|
const {
|
|
10
|
-
control
|
|
11
|
-
} =
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
name
|
|
14
|
-
control
|
|
10
|
+
control
|
|
11
|
+
} = useFormContext();
|
|
12
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
13
|
+
name,
|
|
14
|
+
control,
|
|
15
15
|
render: ({
|
|
16
|
-
field
|
|
16
|
+
field
|
|
17
17
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
children:
|
|
21
|
-
control: /* @__PURE__ */
|
|
22
|
-
checked:
|
|
23
|
-
onChange: () =>
|
|
18
|
+
const onSelected = (option) => field.value.includes(option) ? field.value.filter((value) => value !== option) : [...field.value, option];
|
|
19
|
+
return /* @__PURE__ */ jsx(FormGroup, {
|
|
20
|
+
children: options.map((option) => /* @__PURE__ */ jsx(FormControlLabel, {
|
|
21
|
+
control: /* @__PURE__ */ jsx(Checkbox, {
|
|
22
|
+
checked: field.value.includes(option),
|
|
23
|
+
onChange: () => field.onChange(onSelected(option))
|
|
24
24
|
}),
|
|
25
|
-
label:
|
|
26
|
-
...
|
|
27
|
-
},
|
|
25
|
+
label: option,
|
|
26
|
+
...other
|
|
27
|
+
}, option))
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
export {
|
|
33
|
-
|
|
33
|
+
RHFMultiCheckbox as R
|
|
34
34
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { styled } from "@mui/material";
|
|
2
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
3
|
+
import { E as ErrorLabel } from "../../ErrorLabel/index.c8615f16.js";
|
|
4
|
+
import { P as Period } from "../../Period/index.2941fbda.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
const Wrapper = styled("div")(({
|
|
7
|
+
theme
|
|
8
|
+
}) => ({
|
|
9
|
+
width: "100%",
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
alignItems: "flex-start",
|
|
14
|
+
gap: theme.spacing(1)
|
|
15
|
+
}));
|
|
16
|
+
const RHFPeriod = (props) => {
|
|
17
|
+
const {
|
|
18
|
+
name,
|
|
19
|
+
readOnly,
|
|
20
|
+
skeletonWidth,
|
|
21
|
+
skeletonHeight
|
|
22
|
+
} = props;
|
|
23
|
+
const {
|
|
24
|
+
control
|
|
25
|
+
} = useFormContext();
|
|
26
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
27
|
+
name,
|
|
28
|
+
control,
|
|
29
|
+
render: ({
|
|
30
|
+
field: {
|
|
31
|
+
onChange,
|
|
32
|
+
value
|
|
33
|
+
},
|
|
34
|
+
fieldState: {
|
|
35
|
+
error
|
|
36
|
+
}
|
|
37
|
+
}) => {
|
|
38
|
+
return /* @__PURE__ */ jsxs(Wrapper, {
|
|
39
|
+
children: [/* @__PURE__ */ jsx(Period, {
|
|
40
|
+
value,
|
|
41
|
+
onChange,
|
|
42
|
+
error: !!error,
|
|
43
|
+
readOnly,
|
|
44
|
+
skeletonWidth,
|
|
45
|
+
skeletonHeight
|
|
46
|
+
}), error && /* @__PURE__ */ jsx(ErrorLabel, {
|
|
47
|
+
message: error.message || ""
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
RHFPeriod as R
|
|
55
|
+
};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { useFormContext
|
|
2
|
-
import { RadioGroup
|
|
3
|
-
import { jsx
|
|
4
|
-
function
|
|
5
|
-
name
|
|
6
|
-
options
|
|
7
|
-
getOptionLabel
|
|
8
|
-
...
|
|
1
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
2
|
+
import { RadioGroup, FormControlLabel, Radio, FormHelperText } from "@mui/material";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
function RHFRadioGroup({
|
|
5
|
+
name,
|
|
6
|
+
options,
|
|
7
|
+
getOptionLabel,
|
|
8
|
+
...other
|
|
9
9
|
}) {
|
|
10
10
|
const {
|
|
11
|
-
control
|
|
12
|
-
} =
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
name
|
|
15
|
-
control
|
|
11
|
+
control
|
|
12
|
+
} = useFormContext();
|
|
13
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
14
|
+
name,
|
|
15
|
+
control,
|
|
16
16
|
render: ({
|
|
17
|
-
field
|
|
17
|
+
field,
|
|
18
18
|
fieldState: {
|
|
19
|
-
error
|
|
19
|
+
error
|
|
20
20
|
}
|
|
21
|
-
}) => /* @__PURE__ */
|
|
22
|
-
children: [/* @__PURE__ */
|
|
23
|
-
...
|
|
24
|
-
row:
|
|
25
|
-
...
|
|
26
|
-
children:
|
|
27
|
-
value:
|
|
28
|
-
control: /* @__PURE__ */
|
|
29
|
-
label:
|
|
30
|
-
},
|
|
31
|
-
}), !!
|
|
32
|
-
error:
|
|
21
|
+
}) => /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
children: [/* @__PURE__ */ jsx(RadioGroup, {
|
|
23
|
+
...field,
|
|
24
|
+
row: true,
|
|
25
|
+
...other,
|
|
26
|
+
children: options.map((option, index) => /* @__PURE__ */ jsx(FormControlLabel, {
|
|
27
|
+
value: option,
|
|
28
|
+
control: /* @__PURE__ */ jsx(Radio, {}),
|
|
29
|
+
label: getOptionLabel?.length ? getOptionLabel[index] : option
|
|
30
|
+
}, option))
|
|
31
|
+
}), !!error && /* @__PURE__ */ jsx(FormHelperText, {
|
|
32
|
+
error: true,
|
|
33
33
|
sx: {
|
|
34
34
|
px: 2
|
|
35
35
|
},
|
|
36
|
-
children:
|
|
36
|
+
children: error.message
|
|
37
37
|
})]
|
|
38
38
|
})
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
|
-
|
|
42
|
+
RHFRadioGroup as R
|
|
43
43
|
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { useFormContext
|
|
2
|
-
import { TextField
|
|
3
|
-
import { jsx
|
|
4
|
-
function
|
|
5
|
-
name
|
|
6
|
-
children
|
|
7
|
-
...
|
|
1
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
2
|
+
import { TextField } from "@mui/material";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
function RHFSelect({
|
|
5
|
+
name,
|
|
6
|
+
children,
|
|
7
|
+
...other
|
|
8
8
|
}) {
|
|
9
9
|
const {
|
|
10
|
-
control
|
|
11
|
-
} =
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
name
|
|
14
|
-
control
|
|
10
|
+
control
|
|
11
|
+
} = useFormContext();
|
|
12
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
13
|
+
name,
|
|
14
|
+
control,
|
|
15
15
|
render: ({
|
|
16
|
-
field
|
|
16
|
+
field,
|
|
17
17
|
fieldState: {
|
|
18
|
-
error
|
|
18
|
+
error
|
|
19
19
|
}
|
|
20
|
-
}) => /* @__PURE__ */
|
|
21
|
-
...
|
|
22
|
-
select:
|
|
23
|
-
fullWidth:
|
|
20
|
+
}) => /* @__PURE__ */ jsx(TextField, {
|
|
21
|
+
...field,
|
|
22
|
+
select: true,
|
|
23
|
+
fullWidth: true,
|
|
24
24
|
SelectProps: {
|
|
25
|
-
native:
|
|
25
|
+
native: true
|
|
26
26
|
},
|
|
27
|
-
error: !!
|
|
28
|
-
helperText:
|
|
29
|
-
...
|
|
30
|
-
children
|
|
27
|
+
error: !!error,
|
|
28
|
+
helperText: error?.message,
|
|
29
|
+
...other,
|
|
30
|
+
children
|
|
31
31
|
})
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
export {
|
|
35
|
-
|
|
35
|
+
RHFSelect as R
|
|
36
36
|
};
|