@m4l/components 0.1.8 → 0.1.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/commonjs.js +1 -1
- package/components/CommonActions/components/Actions/index.js +42 -41
- package/components/DataGrid/formatters/columnBooleanFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/columnBooleanFormatter/types.d.ts +7 -0
- package/components/DataGrid/formatters/columnDateFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/columnDateFormatter/types.d.ts +8 -0
- package/components/DataGrid/formatters/columnNestedValueFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/columnNestedValueFormatter/types.d.ts +5 -0
- package/components/DataGrid/formatters/columnPointsFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/columnPointsFormatter/types.d.ts +6 -0
- package/components/DataGrid/formatters/columnUncertaintyFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/columnUncertaintyFormatter/types.d.ts +7 -0
- package/components/DataGrid/formatters/index.d.ts +6 -0
- package/components/DataGrid/index.js +3 -0
- package/components/DataGrid/types.d.ts +3 -1
- package/components/DynamicFilter/index.js +11 -9
- package/components/ErrorLabel/index.d.ts +4 -0
- package/components/ErrorLabel/styles.d.ts +2 -0
- package/components/ErrorLabel/types.d.ts +3 -0
- package/components/Icon/index.js +1 -1
- package/components/LanguagePopover/index.js +1 -0
- package/components/PaperForm/components/Header.d.ts +3 -0
- package/components/PaperForm/index.js +37 -46
- package/components/PaperForm/styles.d.ts +2 -3
- package/components/PaperForm/types.d.ts +1 -0
- package/components/PropertyValue/index.js +35 -24
- package/components/PropertyValue/styles.d.ts +3 -4
- package/components/PropertyValue/types.d.ts +8 -8
- package/components/animate/variants/bounce.d.ts +1 -1
- package/components/animate/variants/container.d.ts +1 -1
- package/components/animate/variants/fade.d.ts +1 -1
- package/components/animate/variants/transition.d.ts +3 -3
- package/components/formatters/BooleanFormatter/index.js +33 -13
- package/components/formatters/BooleanFormatter/types.d.ts +3 -3
- package/components/formatters/DateFormatter/index.js +20 -16
- package/components/formatters/DateFormatter/types.d.ts +2 -2
- package/components/formatters/PointsFormatter/index.d.ts +3 -0
- package/components/formatters/PointsFormatter/types.d.ts +7 -0
- package/components/formatters/PriceFormatter/index.d.ts +3 -0
- package/components/formatters/PriceFormatter/types.d.ts +5 -0
- package/components/formatters/UncertaintyFormatter/index.d.ts +3 -0
- package/components/formatters/UncertaintyFormatter/types.d.ts +14 -0
- package/components/formatters/index.d.ts +4 -0
- package/components/formatters/index.js +102 -5
- package/components/hook-form/FormProvider/index.js +19 -7
- package/components/hook-form/FormProvider/types.d.ts +4 -1
- package/components/hook-form/RHFAutocompleteAsync/index.js +0 -1
- package/components/hook-form/RHFCheckbox/index.js +34 -29
- package/components/hook-form/RHFCheckbox/styles.d.ts +12 -1
- package/components/hook-form/RHFPeriod/dictionary.d.ts +3 -0
- package/components/hook-form/RHFPeriod/index.d.ts +3 -0
- package/components/hook-form/RHFPeriod/index.js +227 -0
- package/components/hook-form/RHFPeriod/styles.d.ts +6 -0
- package/components/hook-form/RHFPeriod/types.d.ts +29 -0
- package/components/hook-form/RHFUpload/index.js +2 -3
- package/components/hook-form/index.d.ts +4 -0
- package/components/index.d.ts +4 -1
- package/components/mui_extended/Accordion/components/AccordionLabel.d.ts +3 -0
- package/components/mui_extended/Accordion/index.js +68 -8
- package/components/mui_extended/Accordion/styles.d.ts +4 -0
- package/components/mui_extended/Accordion/types.d.ts +4 -0
- package/components/mui_extended/Tab/index.d.ts +2 -1
- package/components/mui_extended/Tab/types.d.ts +5 -0
- package/hooks/index.d.ts +2 -0
- package/hooks/useFormAddEdit/index.d.ts +6 -0
- package/hooks/useFormAddEdit/types.d.ts +8 -0
- package/index.d.ts +1 -1
- package/index.js +76 -20
- package/package.json +3 -3
- package/react-draggable.js +3 -3
- package/react-json-view.js +2 -2
- package/react-lazy-load-image-component.js +2 -2
- package/react-resizable.js +3 -3
- package/react-splitter-layout.js +2 -2
- package/utils/index.js +2 -2
- package/components/PaperForm/skeleton.d.ts +0 -6
- package/components/hook-form/RHFCheckbox/skeleton.d.ts +0 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { TranHoverType, TranEnterType, TranExitType } from '../type';
|
|
2
|
-
export declare const varTranHover: (props?: TranHoverType
|
|
2
|
+
export declare const varTranHover: (props?: TranHoverType) => {
|
|
3
3
|
duration: number;
|
|
4
4
|
ease: "linear" | number[] | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate";
|
|
5
5
|
};
|
|
6
|
-
export declare const varTranEnter: (props?: TranEnterType
|
|
6
|
+
export declare const varTranEnter: (props?: TranEnterType) => {
|
|
7
7
|
duration: number;
|
|
8
8
|
ease: "linear" | number[] | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate";
|
|
9
9
|
};
|
|
10
|
-
export declare const varTranExit: (props?: TranExitType
|
|
10
|
+
export declare const varTranExit: (props?: TranExitType) => {
|
|
11
11
|
duration: number;
|
|
12
12
|
ease: "linear" | number[] | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate";
|
|
13
13
|
};
|
|
@@ -1,32 +1,52 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { useModuleDictionary, useEnvironment, getPropertyByString } from "@m4l/core";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { I as Icon } from "../../Icon/index.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
function BooleanFormatter(props) {
|
|
6
6
|
const {
|
|
7
7
|
presentationType,
|
|
8
8
|
value,
|
|
9
|
-
Component =
|
|
9
|
+
Component = React.Fragment
|
|
10
10
|
} = props;
|
|
11
11
|
const {
|
|
12
12
|
getLabel
|
|
13
13
|
} = useModuleDictionary();
|
|
14
|
+
const {
|
|
15
|
+
host_static_assets,
|
|
16
|
+
environment_assets
|
|
17
|
+
} = useEnvironment();
|
|
18
|
+
const final_value = value ?? false;
|
|
19
|
+
const srcCheckTrue = `${host_static_assets}/${environment_assets}/frontend/components/data_grid/components/boolean_formatter/assets/icons/check_true.svg`;
|
|
20
|
+
const srcCheckFalse = `${host_static_assets}/${environment_assets}/frontend/components/data_grid/components/boolean_formatter/assets/icons/check_false.svg`;
|
|
14
21
|
if (presentationType === "string_yes_no") {
|
|
15
22
|
return /* @__PURE__ */ jsx(Component, {
|
|
16
|
-
children:
|
|
23
|
+
children: final_value ? getLabel("formatters.boolean_yes") : getLabel("formatters.boolean_no")
|
|
17
24
|
});
|
|
18
25
|
}
|
|
19
26
|
if (presentationType === "string_true_false") {
|
|
20
27
|
return /* @__PURE__ */ jsx(Component, {
|
|
21
|
-
children:
|
|
28
|
+
children: final_value ? getLabel("formatters.boolean_true") : getLabel("formatters.boolean_false")
|
|
22
29
|
});
|
|
23
30
|
}
|
|
24
|
-
return /* @__PURE__ */ jsx(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
disableRipple: true
|
|
31
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
32
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
33
|
+
src: final_value ? srcCheckTrue : srcCheckFalse,
|
|
34
|
+
bgColor: "action.disabled"
|
|
35
|
+
})
|
|
30
36
|
});
|
|
31
37
|
}
|
|
32
|
-
|
|
38
|
+
function columnBooleanFormatter(props) {
|
|
39
|
+
const {
|
|
40
|
+
fieldValue,
|
|
41
|
+
presentationType,
|
|
42
|
+
Component = React.Fragment
|
|
43
|
+
} = props;
|
|
44
|
+
return (obProps) => {
|
|
45
|
+
return /* @__PURE__ */ jsx(BooleanFormatter, {
|
|
46
|
+
presentationType,
|
|
47
|
+
value: getPropertyByString(obProps, fieldValue),
|
|
48
|
+
Component
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export { BooleanFormatter as B, columnBooleanFormatter as c };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
2
|
export declare type PresentationType = 'string_yes_no' | 'string_true_false' | 'check';
|
|
3
3
|
export interface BooleanFormatterProps {
|
|
4
|
-
Component?:
|
|
4
|
+
Component?: ComponentType;
|
|
5
5
|
presentationType: PresentationType;
|
|
6
|
-
value
|
|
6
|
+
value?: boolean;
|
|
7
7
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useEnvironment, useHostTools, getPropertyByString } from "@m4l/core";
|
|
3
|
+
import "../../Icon/index.js";
|
|
4
|
+
import "@mui/material/styles";
|
|
3
5
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
4
6
|
function DateFormatter(props) {
|
|
5
7
|
const {
|
|
6
8
|
presentationType,
|
|
7
9
|
value,
|
|
8
10
|
format,
|
|
9
|
-
Component =
|
|
11
|
+
Component = React.Fragment
|
|
10
12
|
} = props;
|
|
11
13
|
const {
|
|
12
14
|
dfnsFormat
|
|
@@ -43,20 +45,22 @@ function DateFormatter(props) {
|
|
|
43
45
|
} catch (e) {
|
|
44
46
|
result = "err_typing";
|
|
45
47
|
}
|
|
46
|
-
switch (Component) {
|
|
47
|
-
case "div":
|
|
48
|
-
return /* @__PURE__ */ jsx("div", {
|
|
49
|
-
className: "DateFormatter",
|
|
50
|
-
children: result
|
|
51
|
-
});
|
|
52
|
-
case "span":
|
|
53
|
-
return /* @__PURE__ */ jsx("span", {
|
|
54
|
-
className: "DateFormatter",
|
|
55
|
-
children: result
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
48
|
return /* @__PURE__ */ jsx(Component, {
|
|
59
49
|
children: result
|
|
60
50
|
});
|
|
61
51
|
}
|
|
62
|
-
|
|
52
|
+
function columnDateFormatter(props) {
|
|
53
|
+
const {
|
|
54
|
+
fieldValue,
|
|
55
|
+
presentationType,
|
|
56
|
+
Component = React.Fragment
|
|
57
|
+
} = props;
|
|
58
|
+
return (obProps) => {
|
|
59
|
+
return /* @__PURE__ */ jsx(DateFormatter, {
|
|
60
|
+
presentationType,
|
|
61
|
+
value: getPropertyByString(obProps, fieldValue),
|
|
62
|
+
Component
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export { DateFormatter as D, columnDateFormatter as c };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Maybe } from '@m4l/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
3
|
export declare type PresentationType = 'date' | 'datetime' | 'time';
|
|
4
4
|
export interface DateFormatterProps {
|
|
5
|
-
Component?:
|
|
5
|
+
Component?: ComponentType;
|
|
6
6
|
presentationType: PresentationType;
|
|
7
7
|
format?: string;
|
|
8
8
|
value: Maybe<Date | string | number>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
export interface UncertaintyRange {
|
|
3
|
+
cmc_min_closed: boolean;
|
|
4
|
+
cmc_min: number;
|
|
5
|
+
cmc_max_closed: boolean;
|
|
6
|
+
cmc_max: number;
|
|
7
|
+
cmc_uncertainty: number;
|
|
8
|
+
}
|
|
9
|
+
export interface UncertaintyFormatterProps {
|
|
10
|
+
Component?: ComponentType;
|
|
11
|
+
symbol?: string;
|
|
12
|
+
unit?: string;
|
|
13
|
+
value?: Array<UncertaintyRange>;
|
|
14
|
+
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { BooleanFormatter } from './BooleanFormatter';
|
|
2
2
|
export { DateFormatter } from './DateFormatter';
|
|
3
|
+
export { UncertaintyFormatter } from './UncertaintyFormatter';
|
|
4
|
+
export { PointsFormatter } from './PointsFormatter';
|
|
5
|
+
export { PriceFormatter } from './PriceFormatter';
|
|
6
|
+
export type { UncertaintyRange } from './UncertaintyFormatter/types';
|
|
@@ -1,7 +1,62 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
import "
|
|
3
|
-
import "@
|
|
4
|
-
import "
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { getPropertyByString } from "@m4l/core";
|
|
4
|
+
import "../Icon/index.js";
|
|
5
|
+
import "@mui/material/styles";
|
|
6
|
+
function UncertaintyFormatter(props) {
|
|
7
|
+
const {
|
|
8
|
+
value,
|
|
9
|
+
unit,
|
|
10
|
+
symbol,
|
|
11
|
+
Component = React.Fragment
|
|
12
|
+
} = props;
|
|
13
|
+
if (value === void 0 || value === null || !Array.isArray(value)) {
|
|
14
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
15
|
+
children: ""
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
let result = "";
|
|
19
|
+
value.map((obj, idx) => {
|
|
20
|
+
const cmc_min_closed = obj.cmc_min_closed != true ? "<" : "\u2264";
|
|
21
|
+
const cmc_max_closed = obj.cmc_max_closed != true ? "<" : "\u2264";
|
|
22
|
+
result = result.concat(`${idx > 0 ? " " : ""}`, obj.cmc_min !== obj.cmc_max ? `[${obj.cmc_min}${unit} ${cmc_min_closed} ${symbol} ${cmc_max_closed} ${obj.cmc_max}${unit} \xB1 ${obj.cmc_uncertainty}]` : `[${obj.cmc_min}${unit} \xB1 ${obj.cmc_uncertainty}]`);
|
|
23
|
+
});
|
|
24
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
25
|
+
children: result
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function PointsFormatter(props) {
|
|
29
|
+
const {
|
|
30
|
+
value,
|
|
31
|
+
unit,
|
|
32
|
+
Component = React.Fragment
|
|
33
|
+
} = props;
|
|
34
|
+
console.log("points", value);
|
|
35
|
+
if (value === void 0 || value === null || !Array.isArray(value)) {
|
|
36
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
37
|
+
children: "[]"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
let result = "";
|
|
41
|
+
value.map((point) => {
|
|
42
|
+
if (point) {
|
|
43
|
+
console.log("point", point);
|
|
44
|
+
result = result.concat(`[${point}${unit}]`);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
48
|
+
children: result
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function PriceFormatter(props) {
|
|
52
|
+
const {
|
|
53
|
+
value,
|
|
54
|
+
Component = React.Fragment
|
|
55
|
+
} = props;
|
|
56
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
57
|
+
children: `${value}$Cop`
|
|
58
|
+
});
|
|
59
|
+
}
|
|
5
60
|
function getFormattersComponentsDictionary() {
|
|
6
61
|
return ["formatters"];
|
|
7
62
|
}
|
|
@@ -13,4 +68,46 @@ const defaultFormattersDictionary = {
|
|
|
13
68
|
boolean_false: "False"
|
|
14
69
|
}
|
|
15
70
|
};
|
|
16
|
-
|
|
71
|
+
function columnUncertaintyFormatter(props) {
|
|
72
|
+
const {
|
|
73
|
+
fieldUnit,
|
|
74
|
+
fieldValue,
|
|
75
|
+
fieldSymbol,
|
|
76
|
+
Component
|
|
77
|
+
} = props;
|
|
78
|
+
return (obProps) => {
|
|
79
|
+
return /* @__PURE__ */ jsx(UncertaintyFormatter, {
|
|
80
|
+
Component,
|
|
81
|
+
value: getPropertyByString(obProps, fieldValue),
|
|
82
|
+
unit: getPropertyByString(obProps, fieldUnit),
|
|
83
|
+
symbol: getPropertyByString(obProps, fieldSymbol)
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function columnPointsFormatter(props) {
|
|
88
|
+
const {
|
|
89
|
+
fieldUnit,
|
|
90
|
+
fieldValue,
|
|
91
|
+
Component
|
|
92
|
+
} = props;
|
|
93
|
+
return (obProps) => {
|
|
94
|
+
return /* @__PURE__ */ jsx(PointsFormatter, {
|
|
95
|
+
Component,
|
|
96
|
+
value: getPropertyByString(obProps, fieldValue),
|
|
97
|
+
unit: getPropertyByString(obProps, fieldUnit)
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function columnNestedValueFormatter(props) {
|
|
102
|
+
const {
|
|
103
|
+
fieldValue,
|
|
104
|
+
Component = React.Fragment
|
|
105
|
+
} = props;
|
|
106
|
+
return (obProps) => {
|
|
107
|
+
console.log("columnNestedValueFormatter", obProps, fieldValue);
|
|
108
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
109
|
+
children: getPropertyByString(obProps, fieldValue)
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export { PointsFormatter as P, UncertaintyFormatter as U, PriceFormatter as a, columnPointsFormatter as b, columnUncertaintyFormatter as c, defaultFormattersDictionary as d, columnNestedValueFormatter as e, getFormattersComponentsDictionary as g };
|
|
@@ -18,25 +18,37 @@ function FormProvider(props) {
|
|
|
18
18
|
children,
|
|
19
19
|
onSubmit,
|
|
20
20
|
values,
|
|
21
|
-
validationSchema
|
|
21
|
+
validationSchema,
|
|
22
|
+
statusLoad = "ready"
|
|
22
23
|
} = props;
|
|
23
24
|
const methods = useForm({
|
|
24
25
|
resolver: o(validationSchema),
|
|
25
26
|
defaultValues: values
|
|
26
27
|
});
|
|
27
28
|
useEffect(() => {
|
|
28
|
-
|
|
29
|
+
console.log("useEffect FormProvider reload_values_provider===", statusLoad);
|
|
30
|
+
if (statusLoad === "reload_values_provider") {
|
|
31
|
+
const keys = Object.keys(values);
|
|
32
|
+
keys.forEach((key) => {
|
|
33
|
+
methods.setValue(key, values[key], {
|
|
34
|
+
shouldValidate: false,
|
|
35
|
+
shouldDirty: false,
|
|
36
|
+
shouldTouch: false
|
|
37
|
+
});
|
|
38
|
+
});
|
|
29
39
|
return;
|
|
30
40
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
}, [methods, statusLoad, values]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (statusLoad === "ready") {
|
|
44
|
+
console.log("useEffect FormProvider Ready", statusLoad);
|
|
45
|
+
methods.setValue("statusLoad", "ready", {
|
|
34
46
|
shouldValidate: false,
|
|
35
47
|
shouldDirty: false,
|
|
36
48
|
shouldTouch: false
|
|
37
49
|
});
|
|
38
|
-
}
|
|
39
|
-
}, [
|
|
50
|
+
}
|
|
51
|
+
}, [statusLoad]);
|
|
40
52
|
return /* @__PURE__ */ jsx(FormProvider$1, {
|
|
41
53
|
...methods,
|
|
42
54
|
children: /* @__PURE__ */ jsx(WrapperFormProvider, {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
export declare type FormStatusLoad = 'initial' | 'new' | 'edit' | 'reload_values_provider' | 'ready' | 'error';
|
|
4
|
+
export declare type FormInitialValues = FieldValues;
|
|
3
5
|
export interface FormProviderProps {
|
|
4
6
|
children: ReactNode;
|
|
5
7
|
onSubmit: (data: FieldValues) => void;
|
|
6
|
-
values:
|
|
8
|
+
values: FormInitialValues;
|
|
7
9
|
validationSchema: any;
|
|
10
|
+
statusLoad?: FormStatusLoad;
|
|
8
11
|
}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { useFormContext, Controller } from "react-hook-form";
|
|
2
2
|
import { styled } from "@mui/material/styles";
|
|
3
3
|
import { Skeleton, FormControlLabel, Checkbox } from "@mui/material";
|
|
4
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
4
|
import { useModuleSkeleton } from "@m4l/core";
|
|
5
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
6
6
|
const WrapperSKTRHFCheckbox = styled("div")(() => ({
|
|
7
|
-
display: "flex"
|
|
7
|
+
display: "flex",
|
|
8
|
+
justifyContent: "center",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
padding: "8px"
|
|
11
|
+
}));
|
|
12
|
+
const SKTCheckSkeleton = styled(Skeleton)(() => ({
|
|
13
|
+
width: "20px",
|
|
14
|
+
height: "20px",
|
|
15
|
+
borderRadius: "4px"
|
|
8
16
|
}));
|
|
9
|
-
function SKTRHFCheckbox() {
|
|
10
|
-
return /* @__PURE__ */ jsx(WrapperSKTRHFCheckbox, {
|
|
11
|
-
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
12
|
-
variant: "rectangular",
|
|
13
|
-
width: 16,
|
|
14
|
-
height: 16
|
|
15
|
-
})
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
17
|
const ErrorLabel = styled("p")(({
|
|
19
18
|
theme
|
|
20
19
|
}) => ({
|
|
@@ -32,29 +31,35 @@ function RHFCheckbox({
|
|
|
32
31
|
control
|
|
33
32
|
} = useFormContext();
|
|
34
33
|
const isSkeleton = useModuleSkeleton();
|
|
35
|
-
return /* @__PURE__ */ jsx(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
control
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
return /* @__PURE__ */ jsx(FormControlLabel, {
|
|
35
|
+
control: /* @__PURE__ */ jsx(Controller, {
|
|
36
|
+
name,
|
|
37
|
+
control,
|
|
38
|
+
render: ({
|
|
39
|
+
field,
|
|
40
|
+
fieldState: {
|
|
41
|
+
error
|
|
42
|
+
}
|
|
43
|
+
}) => {
|
|
44
|
+
if (isSkeleton) {
|
|
45
|
+
return /* @__PURE__ */ jsx(WrapperSKTRHFCheckbox, {
|
|
46
|
+
children: /* @__PURE__ */ jsx(SKTCheckSkeleton, {
|
|
47
|
+
variant: "rectangular"
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
47
52
|
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
48
53
|
size: sizeCheck,
|
|
49
54
|
...field,
|
|
50
55
|
checked: field.value
|
|
51
|
-
}),
|
|
56
|
+
}), error?.message && /* @__PURE__ */ jsx(ErrorLabel, {
|
|
52
57
|
children: error?.message + ""
|
|
53
58
|
})]
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
...other
|
|
63
|
+
});
|
|
59
64
|
}
|
|
60
65
|
export { RHFCheckbox as R };
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const WrapperSKTRHFCheckbox: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material
|
|
2
|
+
export declare const WrapperSKTRHFCheckbox: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
|
+
export declare const SKTCheckSkeleton: import("@emotion/styled").StyledComponent<{
|
|
4
|
+
animation?: false | "wave" | "pulse" | undefined;
|
|
5
|
+
children?: import("react").ReactNode;
|
|
6
|
+
classes?: Partial<import("@mui/material").SkeletonClasses> | undefined;
|
|
7
|
+
height?: string | number | undefined;
|
|
8
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
+
variant?: "text" | "rectangular" | "rounded" | "circular" | undefined;
|
|
10
|
+
width?: string | number | undefined;
|
|
11
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
|
|
12
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
13
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "width" | "height" | "animation" | "children" | "sx" | "variant"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|