@m4l/components 0.0.7 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/can-use-dom.js +3 -0
- package/dist/components/DataGrid/components/Actions/types.d.ts +1 -1
- package/dist/components/DataGrid/contexts/BaseContext/types.d.ts +1 -1
- package/dist/components/DataGrid/formatters/BooleanFormatter/index.d.ts +3 -0
- package/dist/components/DataGrid/formatters/BooleanFormatter/index.js +26 -0
- package/dist/components/DataGrid/formatters/BooleanFormatter/types.d.ts +5 -0
- package/dist/components/DataGrid/formatters/DateFormatter/index.js +33 -0
- package/dist/components/DataGrid/formatters/index.d.ts +2 -0
- package/dist/components/DataGrid/index.js +6 -37
- package/dist/components/DataGrid/types.d.ts +1 -1
- package/dist/components/FormActions/types.d.ts +1 -1
- package/dist/components/ModalDialog/components/Header/types.d.ts +1 -1
- package/dist/components/ModalDialog/index.js +0 -5
- package/dist/components/ObjectLogs/index.js +2 -1
- package/dist/components/PropertyValue/index.d.ts +3 -0
- package/dist/components/PropertyValue/index.js +108 -0
- package/dist/components/PropertyValue/skeleton.d.ts +2 -0
- package/dist/components/PropertyValue/styles.d.ts +6 -0
- package/dist/components/PropertyValue/types.d.ts +11 -0
- package/dist/components/ScrollBar/index.d.ts +3 -0
- package/dist/components/ScrollBar/index.js +60 -0
- package/dist/components/ScrollBar/styles.d.ts +6 -0
- package/dist/components/ScrollBar/types.d.ts +7 -0
- package/dist/components/hook-form/FormProvider/components/FormActions/index.d.ts +3 -0
- package/dist/components/hook-form/FormProvider/components/FormActions/skeleton.d.ts +2 -0
- package/dist/components/hook-form/FormProvider/components/FormActions/styles.d.ts +3 -0
- package/dist/components/hook-form/FormProvider/components/FormActions/types.d.ts +4 -0
- package/dist/components/hook-form/FormProvider/index.d.ts +3 -0
- package/dist/components/hook-form/FormProvider/index.js +162 -0
- package/dist/components/hook-form/FormProvider/styles.d.ts +2 -0
- package/dist/components/hook-form/FormProvider/types.d.ts +10 -0
- package/dist/components/hook-form/RHFAutocompleteAsync/index.d.ts +4 -0
- package/dist/components/hook-form/RHFAutocompleteAsync/index.js +184 -0
- package/dist/components/hook-form/RHFAutocompleteAsync/styles.d.ts +4 -0
- package/dist/components/hook-form/RHFAutocompleteAsync/types.d.ts +17 -0
- package/dist/components/hook-form/RHFCheckbox/index.d.ts +3 -0
- package/dist/components/hook-form/RHFCheckbox/index.js +41 -0
- package/dist/components/hook-form/RHFCheckbox/skeleton.d.ts +2 -0
- package/dist/components/hook-form/RHFCheckbox/styles.d.ts +2 -0
- package/dist/components/hook-form/RHFCheckbox/types.d.ts +10 -0
- package/dist/components/hook-form/RHFMultiCheckbox/index.d.ts +3 -0
- package/dist/components/hook-form/RHFMultiCheckbox/index.js +32 -0
- package/dist/components/hook-form/RHFMultiCheckbox/types.d.ts +10 -0
- package/dist/components/hook-form/RHFRadioGroup.d.ts +9 -0
- package/dist/components/hook-form/RHFRadioGroup.js +41 -0
- package/dist/components/hook-form/RHFSelect.d.ts +8 -0
- package/dist/components/hook-form/RHFSelect.js +34 -0
- package/dist/components/hook-form/RHFTextField/index.d.ts +4 -0
- package/dist/components/hook-form/RHFTextField/index.js +57 -0
- package/dist/components/hook-form/RHFTextField/styles.d.ts +2 -0
- package/dist/components/hook-form/RHFTextField/types.d.ts +9 -0
- package/dist/components/hook-form/index.d.ts +7 -0
- package/dist/components/index.d.ts +11 -5
- package/dist/components/mui_extended/Accordion/index.d.ts +3 -0
- package/dist/components/mui_extended/Accordion/index.js +45 -0
- package/dist/components/mui_extended/Accordion/types.d.ts +11 -0
- package/dist/components/mui_extended/BoxIcon/index.js +1 -1
- package/dist/components/mui_extended/Breadcrumbs/index.d.ts +2 -1
- package/dist/components/mui_extended/MenuPopover/index.d.ts +2 -1
- package/dist/components/mui_extended/Tab/index.d.ts +2 -0
- package/dist/components/mui_extended/Tab/index.js +29 -0
- package/dist/components/mui_extended/Tab/styles.d.ts +2 -0
- package/dist/components/mui_extended/index.d.ts +8 -6
- package/dist/contexts/ModalContext/index.js +1 -1
- package/dist/core-js.js +2645 -0
- package/dist/index.js +37 -19
- package/dist/juggle.js +511 -0
- package/dist/lodash.js +489 -0
- package/dist/node_modules.js +54 -0
- package/dist/react-draggable.js +3 -3
- package/dist/react-resizable.js +3 -3
- package/dist/react-splitter-layout.js +2 -2
- package/dist/simplebar.js +849 -0
- package/dist/vendor.js +27 -14
- package/package.json +7 -2
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { useState, useEffect, Fragment } from "react";
|
|
2
|
+
import { useModuleDictionary, useNetwork, getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
4
|
+
import { Skeleton, Autocomplete, TextField, CircularProgress } from "@mui/material";
|
|
5
|
+
import { styled } from "@mui/material/styles";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
const SKTRHFAutocompleteAsyncWrapper = styled("div")(() => ({
|
|
8
|
+
display: "flex",
|
|
9
|
+
width: "100%",
|
|
10
|
+
flexDirection: "column"
|
|
11
|
+
}));
|
|
12
|
+
styled("div")(({
|
|
13
|
+
theme
|
|
14
|
+
}) => ({
|
|
15
|
+
display: "flex",
|
|
16
|
+
justifyContent: "flex-end",
|
|
17
|
+
paddingRight: `${theme.spacing(2)}`,
|
|
18
|
+
[theme.breakpoints.down("md")]: {
|
|
19
|
+
justifyContent: "flex-start"
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
const SKTInputText = styled("div")(({
|
|
23
|
+
theme
|
|
24
|
+
}) => ({
|
|
25
|
+
width: "100%",
|
|
26
|
+
display: "grid",
|
|
27
|
+
gridTemplateColumns: "1fr auto",
|
|
28
|
+
gridGap: theme.spacing(2),
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
height: `${theme.spacing(4.5)}`,
|
|
31
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
32
|
+
borderRadius: `${theme.spacing(1)}`,
|
|
33
|
+
padding: `0 ${theme.spacing(2)}`,
|
|
34
|
+
[theme.breakpoints.down("md")]: {
|
|
35
|
+
width: "100%"
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
function RHFAutocompleteAsync(props) {
|
|
39
|
+
const {
|
|
40
|
+
name,
|
|
41
|
+
getOptionLabel,
|
|
42
|
+
isOptionEqualToValue,
|
|
43
|
+
label,
|
|
44
|
+
endPoint,
|
|
45
|
+
timeout = 5e3,
|
|
46
|
+
parms = {},
|
|
47
|
+
resultField = "data",
|
|
48
|
+
skeletonProps = {},
|
|
49
|
+
isRemote = true,
|
|
50
|
+
...other
|
|
51
|
+
} = props;
|
|
52
|
+
const {
|
|
53
|
+
isSkeleton = false,
|
|
54
|
+
width = 100,
|
|
55
|
+
height = "18px"
|
|
56
|
+
} = skeletonProps;
|
|
57
|
+
const {
|
|
58
|
+
getLabel
|
|
59
|
+
} = useModuleDictionary();
|
|
60
|
+
const {
|
|
61
|
+
control,
|
|
62
|
+
getValues
|
|
63
|
+
} = useFormContext();
|
|
64
|
+
const {
|
|
65
|
+
networkOperation
|
|
66
|
+
} = useNetwork();
|
|
67
|
+
const initialValue = getValues(name);
|
|
68
|
+
const [options, setOptions] = useState(initialValue === null ? [] : [initialValue]);
|
|
69
|
+
const [open, setOpen] = useState(false);
|
|
70
|
+
const [optionsLoaded, setOptionsLoaded] = useState(false);
|
|
71
|
+
const loading = open && !optionsLoaded;
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!optionsLoaded && initialValue) {
|
|
74
|
+
setOptions([initialValue]);
|
|
75
|
+
}
|
|
76
|
+
}, [initialValue, optionsLoaded]);
|
|
77
|
+
console.log("***2022Render RHFAutocompleteAsync", loading, options, initialValue);
|
|
78
|
+
const getOptionLabelLocal = (option) => {
|
|
79
|
+
if (option === void 0 || option === null) {
|
|
80
|
+
return "";
|
|
81
|
+
}
|
|
82
|
+
return getOptionLabel(option);
|
|
83
|
+
};
|
|
84
|
+
const isOptionEqualToValueLocal = (option, value) => {
|
|
85
|
+
if (value === void 0 || value === null || option === null) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
return isOptionEqualToValue(option, value);
|
|
89
|
+
};
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
let mounted = true;
|
|
92
|
+
if (!loading) {
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
console.debug("useEffect - RHFAutocompleteAsync - initial", endPoint, loading, parms, resultField, timeout);
|
|
96
|
+
networkOperation({
|
|
97
|
+
method: "GET",
|
|
98
|
+
endPoint,
|
|
99
|
+
timeout,
|
|
100
|
+
parms,
|
|
101
|
+
isRemote
|
|
102
|
+
}).then((response) => {
|
|
103
|
+
if (mounted) {
|
|
104
|
+
setOptions(getPropertyByString(response, resultField));
|
|
105
|
+
setOptionsLoaded(true);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return () => {
|
|
109
|
+
mounted = false;
|
|
110
|
+
};
|
|
111
|
+
}, [loading]);
|
|
112
|
+
if (isSkeleton) {
|
|
113
|
+
return /* @__PURE__ */ jsx(SKTRHFAutocompleteAsyncWrapper, {
|
|
114
|
+
children: /* @__PURE__ */ jsxs(SKTInputText, {
|
|
115
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
116
|
+
variant: "text",
|
|
117
|
+
width,
|
|
118
|
+
height
|
|
119
|
+
}, "sk1"), /* @__PURE__ */ jsx(Skeleton, {
|
|
120
|
+
variant: "circular",
|
|
121
|
+
width: 16,
|
|
122
|
+
height: 16
|
|
123
|
+
}, "sk2")]
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
128
|
+
name,
|
|
129
|
+
control,
|
|
130
|
+
render: ({
|
|
131
|
+
field: {
|
|
132
|
+
onChange,
|
|
133
|
+
value
|
|
134
|
+
},
|
|
135
|
+
fieldState: {
|
|
136
|
+
error
|
|
137
|
+
}
|
|
138
|
+
}) => /* @__PURE__ */ jsx(Autocomplete, {
|
|
139
|
+
options,
|
|
140
|
+
getOptionLabel: getOptionLabelLocal,
|
|
141
|
+
defaultValue: initialValue,
|
|
142
|
+
isOptionEqualToValue: isOptionEqualToValueLocal,
|
|
143
|
+
disableClearable: true,
|
|
144
|
+
value: value || null,
|
|
145
|
+
onOpen: () => {
|
|
146
|
+
setOpen(true);
|
|
147
|
+
},
|
|
148
|
+
onClose: () => {
|
|
149
|
+
setOpen(false);
|
|
150
|
+
},
|
|
151
|
+
onChange: (_e, val) => {
|
|
152
|
+
onChange(val);
|
|
153
|
+
},
|
|
154
|
+
loading,
|
|
155
|
+
loadingText: "",
|
|
156
|
+
noOptionsText: getLabel("component_no_options"),
|
|
157
|
+
renderInput: (params) => {
|
|
158
|
+
console.log("TextField", params);
|
|
159
|
+
return /* @__PURE__ */ jsx(TextField, {
|
|
160
|
+
...params,
|
|
161
|
+
label,
|
|
162
|
+
fullWidth: true,
|
|
163
|
+
SelectProps: {
|
|
164
|
+
native: true
|
|
165
|
+
},
|
|
166
|
+
InputProps: {
|
|
167
|
+
...params.InputProps,
|
|
168
|
+
endAdornment: /* @__PURE__ */ jsxs(Fragment, {
|
|
169
|
+
children: [loading ? /* @__PURE__ */ jsx(CircularProgress, {
|
|
170
|
+
color: "primary",
|
|
171
|
+
size: 20
|
|
172
|
+
}, `cp_async${params.id}`) : null, params.InputProps.endAdornment]
|
|
173
|
+
}, `fr_async_${params.id}`)
|
|
174
|
+
},
|
|
175
|
+
autoComplete: "off",
|
|
176
|
+
error: !!error,
|
|
177
|
+
helperText: error?.message,
|
|
178
|
+
...other
|
|
179
|
+
}, `tx_async_${params.id}`);
|
|
180
|
+
}
|
|
181
|
+
}, "at_async")
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
export { RHFAutocompleteAsync as R };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SKTRHFAutocompleteAsyncWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
|
+
export declare const PropertieValueLabel: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
4
|
+
export declare const SKTInputText: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SkeletonProps {
|
|
2
|
+
isSkeleton?: boolean;
|
|
3
|
+
width?: string | number;
|
|
4
|
+
height?: string | number;
|
|
5
|
+
}
|
|
6
|
+
export interface RHFAutocompleteAsyncProps<T> {
|
|
7
|
+
name: string;
|
|
8
|
+
getOptionLabel: (option: T) => string;
|
|
9
|
+
isOptionEqualToValue: (option: T, value: T) => boolean;
|
|
10
|
+
skeletonProps?: SkeletonProps;
|
|
11
|
+
endPoint: string;
|
|
12
|
+
timeout?: number;
|
|
13
|
+
parms?: any;
|
|
14
|
+
resultField?: string;
|
|
15
|
+
label: string;
|
|
16
|
+
isRemote?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
2
|
+
import { Skeleton, FormControlLabel, Checkbox } from "@mui/material";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
const WrapperSKTRHFCheckbox = styled("div")(() => ({
|
|
6
|
+
display: "flex"
|
|
7
|
+
}));
|
|
8
|
+
function SKTRHFCheckbox() {
|
|
9
|
+
return /* @__PURE__ */ jsx(WrapperSKTRHFCheckbox, {
|
|
10
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
11
|
+
variant: "rectangular",
|
|
12
|
+
width: 16,
|
|
13
|
+
height: 16
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function RHFCheckbox({
|
|
18
|
+
name,
|
|
19
|
+
sizeCheck = "small",
|
|
20
|
+
isSkeleton = false,
|
|
21
|
+
...other
|
|
22
|
+
}) {
|
|
23
|
+
const {
|
|
24
|
+
control
|
|
25
|
+
} = useFormContext();
|
|
26
|
+
return /* @__PURE__ */ jsx(FormControlLabel, {
|
|
27
|
+
control: /* @__PURE__ */ jsx(Controller, {
|
|
28
|
+
name,
|
|
29
|
+
control,
|
|
30
|
+
render: ({
|
|
31
|
+
field
|
|
32
|
+
}) => isSkeleton ? /* @__PURE__ */ jsx(SKTRHFCheckbox, {}) : /* @__PURE__ */ jsx(Checkbox, {
|
|
33
|
+
size: sizeCheck,
|
|
34
|
+
...field,
|
|
35
|
+
checked: field.value
|
|
36
|
+
})
|
|
37
|
+
}),
|
|
38
|
+
...other
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { RHFCheckbox as R };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const WrapperSKTRHFCheckbox: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormControlLabelProps } from '@mui/material';
|
|
2
|
+
export interface RHFCheckboxProps extends Omit<FormControlLabelProps, 'control'> {
|
|
3
|
+
name: string;
|
|
4
|
+
sizeCheck?: 'small' | 'medium';
|
|
5
|
+
isSkeleton?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface RHFMultiCheckboxProps extends Omit<FormControlLabelProps, 'control' | 'label'> {
|
|
8
|
+
name: string;
|
|
9
|
+
options: string[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
}) {
|
|
9
|
+
const {
|
|
10
|
+
control
|
|
11
|
+
} = useFormContext();
|
|
12
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
13
|
+
name,
|
|
14
|
+
control,
|
|
15
|
+
render: ({
|
|
16
|
+
field
|
|
17
|
+
}) => {
|
|
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
|
+
}),
|
|
25
|
+
label: option,
|
|
26
|
+
...other
|
|
27
|
+
}, option))
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export { RHFMultiCheckbox as R };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormControlLabelProps } from '@mui/material';
|
|
2
|
+
export interface RHFCheckboxProps extends Omit<FormControlLabelProps, 'control'> {
|
|
3
|
+
name: string;
|
|
4
|
+
sizeCheck?: 'small' | 'medium';
|
|
5
|
+
isSkeleton?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface RHFMultiCheckboxProps extends Omit<FormControlLabelProps, 'control' | 'label'> {
|
|
8
|
+
name: string;
|
|
9
|
+
options: string[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { RadioGroupProps } from '@mui/material';
|
|
3
|
+
interface IProps {
|
|
4
|
+
name: string;
|
|
5
|
+
options: string[];
|
|
6
|
+
getOptionLabel?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function RHFRadioGroup({ name, options, getOptionLabel, ...other }: IProps & RadioGroupProps): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
}) {
|
|
10
|
+
const {
|
|
11
|
+
control
|
|
12
|
+
} = useFormContext();
|
|
13
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
14
|
+
name,
|
|
15
|
+
control,
|
|
16
|
+
render: ({
|
|
17
|
+
field,
|
|
18
|
+
fieldState: {
|
|
19
|
+
error
|
|
20
|
+
}
|
|
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
|
+
sx: {
|
|
34
|
+
px: 2
|
|
35
|
+
},
|
|
36
|
+
children: error.message
|
|
37
|
+
})]
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { RHFRadioGroup as R };
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}) {
|
|
9
|
+
const {
|
|
10
|
+
control
|
|
11
|
+
} = useFormContext();
|
|
12
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
13
|
+
name,
|
|
14
|
+
control,
|
|
15
|
+
render: ({
|
|
16
|
+
field,
|
|
17
|
+
fieldState: {
|
|
18
|
+
error
|
|
19
|
+
}
|
|
20
|
+
}) => /* @__PURE__ */ jsx(TextField, {
|
|
21
|
+
...field,
|
|
22
|
+
select: true,
|
|
23
|
+
fullWidth: true,
|
|
24
|
+
SelectProps: {
|
|
25
|
+
native: true
|
|
26
|
+
},
|
|
27
|
+
error: !!error,
|
|
28
|
+
helperText: error?.message,
|
|
29
|
+
...other,
|
|
30
|
+
children
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export { RHFSelect as R };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
2
|
+
import { Skeleton, TextField } from "@mui/material";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
const SKTRHFWrapperTextField = styled("div")(({
|
|
6
|
+
theme
|
|
7
|
+
}) => ({
|
|
8
|
+
display: "flex",
|
|
9
|
+
width: "100%",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
12
|
+
padding: "12px 14px",
|
|
13
|
+
borderRadius: theme.spacing(1)
|
|
14
|
+
}));
|
|
15
|
+
function RHFTextField(props) {
|
|
16
|
+
const {
|
|
17
|
+
name,
|
|
18
|
+
autoComplete = "off",
|
|
19
|
+
skeletonProps: skeletoProps = {},
|
|
20
|
+
...other
|
|
21
|
+
} = props;
|
|
22
|
+
const {
|
|
23
|
+
isSkeleton = true,
|
|
24
|
+
width = "100%",
|
|
25
|
+
height = 14
|
|
26
|
+
} = skeletoProps;
|
|
27
|
+
const {
|
|
28
|
+
control
|
|
29
|
+
} = useFormContext();
|
|
30
|
+
if (isSkeleton) {
|
|
31
|
+
return /* @__PURE__ */ jsx(SKTRHFWrapperTextField, {
|
|
32
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
33
|
+
variant: "text",
|
|
34
|
+
width,
|
|
35
|
+
height
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
40
|
+
name,
|
|
41
|
+
control,
|
|
42
|
+
render: ({
|
|
43
|
+
field,
|
|
44
|
+
fieldState: {
|
|
45
|
+
error
|
|
46
|
+
}
|
|
47
|
+
}) => /* @__PURE__ */ jsx(TextField, {
|
|
48
|
+
autoComplete,
|
|
49
|
+
...field,
|
|
50
|
+
fullWidth: true,
|
|
51
|
+
error: !!error,
|
|
52
|
+
helperText: error?.message,
|
|
53
|
+
...other
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export { RHFTextField as R };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SKTRHFWrapperTextField: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { FormProvider } from './FormProvider';
|
|
2
|
+
export { RHFAutocompleteAsync } from './RHFAutocompleteAsync';
|
|
3
|
+
export { RHFCheckbox } from './RHFCheckbox';
|
|
4
|
+
export { RHFMultiCheckbox } from './RHFMultiCheckbox';
|
|
5
|
+
export { RHFSelect } from './RHFSelect';
|
|
6
|
+
export { RHFTextField } from './RHFTextField';
|
|
7
|
+
export { RHFRadioGroup } from './RHFRadioGroup';
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export { DataGrid } from '../components/DataGrid';
|
|
2
|
+
export { DateFormatter, BooleanFormatter } from '../components/DataGrid/formatters';
|
|
3
|
+
export type { Column } from 'react-data-grid';
|
|
4
|
+
export type { RowKey } from '../components/DataGrid/types';
|
|
5
|
+
export { getGridComponentsDictionary } from '../components/DataGrid/dictionary';
|
|
6
6
|
export * from '../components/FormActions';
|
|
7
7
|
export * from '../components/FormActions/dictionary';
|
|
8
|
+
export * from '../components/hook-form';
|
|
8
9
|
export * from '../components/ModalDialog';
|
|
9
10
|
export * from '../components/ModalDialog/dictionary';
|
|
10
11
|
export * from '../components/NoItemSelected';
|
|
11
12
|
export * from '../components/NoItemSelected/dictionary';
|
|
13
|
+
export * from '../components/ObjectLogs';
|
|
14
|
+
export * from '../components/ObjectLogs/dictionary';
|
|
15
|
+
export * from '../components/PropertyValue';
|
|
12
16
|
export * from '../components/Resizeable';
|
|
17
|
+
export * from '../components/ScrollBar';
|
|
13
18
|
export * from '../components/SplitLayout';
|
|
19
|
+
export * from '../components/mui_extended';
|
|
14
20
|
export type { SplitPosition } from '../components/SplitLayout/types';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Accordion as Accordion$1, AccordionSummary, Skeleton, AccordionDetails } from "@mui/material";
|
|
2
|
+
import { I as IconButton } from "../IconButton/index.js";
|
|
3
|
+
import { useEnvironment } from "@m4l/core";
|
|
4
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
5
|
+
function Accordion(props) {
|
|
6
|
+
const {
|
|
7
|
+
host_static_assets,
|
|
8
|
+
environment
|
|
9
|
+
} = useEnvironment();
|
|
10
|
+
const {
|
|
11
|
+
label,
|
|
12
|
+
isSkeleton,
|
|
13
|
+
SKTWidht,
|
|
14
|
+
SKTHeight,
|
|
15
|
+
children,
|
|
16
|
+
accordionProps,
|
|
17
|
+
summaryProps
|
|
18
|
+
} = props;
|
|
19
|
+
return /* @__PURE__ */ jsxs(Accordion$1, {
|
|
20
|
+
variant: "outlined",
|
|
21
|
+
square: true,
|
|
22
|
+
TransitionProps: {
|
|
23
|
+
unmountOnExit: true
|
|
24
|
+
},
|
|
25
|
+
defaultExpanded: true,
|
|
26
|
+
...accordionProps,
|
|
27
|
+
children: [/* @__PURE__ */ jsx(AccordionSummary, {
|
|
28
|
+
"aria-controls": "expanded-content",
|
|
29
|
+
disableTouchRipple: false,
|
|
30
|
+
expandIcon: /* @__PURE__ */ jsx(IconButton, {
|
|
31
|
+
"aria-label": "settings",
|
|
32
|
+
src: `${host_static_assets}/${environment}/frontend/components/accordion/assets/icons/expanded.svg`
|
|
33
|
+
}),
|
|
34
|
+
...summaryProps,
|
|
35
|
+
children: isSkeleton ? /* @__PURE__ */ jsx(Skeleton, {
|
|
36
|
+
variant: "text",
|
|
37
|
+
width: SKTWidht,
|
|
38
|
+
height: SKTHeight
|
|
39
|
+
}) : label
|
|
40
|
+
}), /* @__PURE__ */ jsx(AccordionDetails, {
|
|
41
|
+
children
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export { Accordion as A };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AccordionProps as MUIAccordionProps, AccordionSummaryProps } from '@mui/material';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export declare type AccordionProps = {
|
|
4
|
+
label: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
accordionProps?: MUIAccordionProps;
|
|
7
|
+
summaryProps?: AccordionSummaryProps;
|
|
8
|
+
isSkeleton?: boolean;
|
|
9
|
+
SKTWidht?: string | number;
|
|
10
|
+
SKTHeight?: string | number;
|
|
11
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MenuPopoverProps } from './types';
|
|
3
|
-
export
|
|
3
|
+
export declare function MenuPopover({ children, arrow, disabledArrow, sx, ...other }: MenuPopoverProps): JSX.Element;
|
|
4
|
+
export default MenuPopover;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Skeleton, Tab as Tab$1 } from "@mui/material";
|
|
2
|
+
import { styled } from "@mui/material/styles";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
const SKTTabWrapper = styled("div")(({
|
|
5
|
+
theme
|
|
6
|
+
}) => ({
|
|
7
|
+
padding: theme.spacing(1.5, 2)
|
|
8
|
+
}));
|
|
9
|
+
function Tab(props) {
|
|
10
|
+
const {
|
|
11
|
+
isSkeleton,
|
|
12
|
+
SKTWidth,
|
|
13
|
+
SKTHeight,
|
|
14
|
+
...other
|
|
15
|
+
} = props;
|
|
16
|
+
if (isSkeleton) {
|
|
17
|
+
return /* @__PURE__ */ jsx(SKTTabWrapper, {
|
|
18
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
19
|
+
variant: "text",
|
|
20
|
+
width: SKTWidth,
|
|
21
|
+
height: SKTHeight
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ jsx(Tab$1, {
|
|
26
|
+
...other
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export { Tab as T };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SKTTabWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|