@m4l/components 0.1.8 → 0.1.9
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/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 +4 -0
- package/components/DataGrid/types.d.ts +3 -1
- package/components/DynamicFilter/index.js +8 -7
- package/components/ErrorLabel/index.d.ts +3 -0
- package/components/ErrorLabel/styles.d.ts +2 -0
- package/components/ErrorLabel/types.d.ts +3 -0
- 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 +4 -3
- package/components/formatters/BooleanFormatter/types.d.ts +1 -1
- 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 +100 -4
- 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/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 +289 -19
- package/package.json +3 -3
- package/components/PaperForm/skeleton.d.ts +0 -6
- package/components/hook-form/RHFCheckbox/skeleton.d.ts +0 -2
|
@@ -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,61 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
import "
|
|
1
|
+
import require$$0 from "react";
|
|
2
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { getPropertyByString } from "@m4l/core";
|
|
3
4
|
import "@mui/material";
|
|
4
|
-
|
|
5
|
+
function UncertaintyFormatter(props) {
|
|
6
|
+
const {
|
|
7
|
+
value,
|
|
8
|
+
unit,
|
|
9
|
+
symbol,
|
|
10
|
+
Component = require$$0.Fragment
|
|
11
|
+
} = props;
|
|
12
|
+
if (value === void 0 || value === null || !Array.isArray(value)) {
|
|
13
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
14
|
+
children: ""
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
let result = "";
|
|
18
|
+
value.map((obj, idx) => {
|
|
19
|
+
const cmc_min_closed = obj.cmc_min_closed != true ? "<" : "\u2264";
|
|
20
|
+
const cmc_max_closed = obj.cmc_max_closed != true ? "<" : "\u2264";
|
|
21
|
+
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}]`);
|
|
22
|
+
});
|
|
23
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
24
|
+
children: result
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function PointsFormatter(props) {
|
|
28
|
+
const {
|
|
29
|
+
value,
|
|
30
|
+
unit,
|
|
31
|
+
Component = require$$0.Fragment
|
|
32
|
+
} = props;
|
|
33
|
+
console.log("points", value);
|
|
34
|
+
if (value === void 0 || value === null || !Array.isArray(value)) {
|
|
35
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
36
|
+
children: "[]"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
let result = "";
|
|
40
|
+
value.map((point) => {
|
|
41
|
+
if (point) {
|
|
42
|
+
console.log("point", point);
|
|
43
|
+
result = result.concat(`[${point}${unit}]`);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
47
|
+
children: result
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function PriceFormatter(props) {
|
|
51
|
+
const {
|
|
52
|
+
value,
|
|
53
|
+
Component = require$$0.Fragment
|
|
54
|
+
} = props;
|
|
55
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
56
|
+
children: `${value}$Cop`
|
|
57
|
+
});
|
|
58
|
+
}
|
|
5
59
|
function getFormattersComponentsDictionary() {
|
|
6
60
|
return ["formatters"];
|
|
7
61
|
}
|
|
@@ -13,4 +67,46 @@ const defaultFormattersDictionary = {
|
|
|
13
67
|
boolean_false: "False"
|
|
14
68
|
}
|
|
15
69
|
};
|
|
16
|
-
|
|
70
|
+
function columnUncertaintyFormatter(props) {
|
|
71
|
+
const {
|
|
72
|
+
fieldUnit,
|
|
73
|
+
fieldValue,
|
|
74
|
+
fieldSymbol,
|
|
75
|
+
Component
|
|
76
|
+
} = props;
|
|
77
|
+
return (obProps) => {
|
|
78
|
+
return /* @__PURE__ */ jsx(UncertaintyFormatter, {
|
|
79
|
+
Component,
|
|
80
|
+
value: getPropertyByString(obProps, fieldValue),
|
|
81
|
+
unit: getPropertyByString(obProps, fieldUnit),
|
|
82
|
+
symbol: getPropertyByString(obProps, fieldSymbol)
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function columnPointsFormatter(props) {
|
|
87
|
+
const {
|
|
88
|
+
fieldUnit,
|
|
89
|
+
fieldValue,
|
|
90
|
+
Component
|
|
91
|
+
} = props;
|
|
92
|
+
return (obProps) => {
|
|
93
|
+
return /* @__PURE__ */ jsx(PointsFormatter, {
|
|
94
|
+
Component,
|
|
95
|
+
value: getPropertyByString(obProps, fieldValue),
|
|
96
|
+
unit: getPropertyByString(obProps, fieldUnit)
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function columnNestedValueFormatter(props) {
|
|
101
|
+
const {
|
|
102
|
+
fieldValue,
|
|
103
|
+
Component = require$$0.Fragment
|
|
104
|
+
} = props;
|
|
105
|
+
return (obProps) => {
|
|
106
|
+
console.log("columnNestedValueFormatter", obProps, fieldValue);
|
|
107
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
108
|
+
children: getPropertyByString(obProps, fieldValue)
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
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>, {}, {}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WrapperProps } from './types';
|
|
3
|
+
export declare const Wrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
4
|
+
export declare const ContainerPeriod: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & WrapperProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const SKTWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const Gap: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare type PeriodProps = {
|
|
2
|
+
name: string;
|
|
3
|
+
variant?: 'single';
|
|
4
|
+
};
|
|
5
|
+
export declare enum ETimePeriods {
|
|
6
|
+
YEARS = 0,
|
|
7
|
+
MONTHS = 1,
|
|
8
|
+
DAYS = 2
|
|
9
|
+
}
|
|
10
|
+
export declare type PeriodVariant = 'monoperiod' | 'multiperiod';
|
|
11
|
+
export declare type PeriodTime = {
|
|
12
|
+
id: number;
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
export declare type PeriodType = {
|
|
16
|
+
variant: PeriodVariant;
|
|
17
|
+
selPeriodTime: ETimePeriods;
|
|
18
|
+
singleValue: number | '';
|
|
19
|
+
years?: number;
|
|
20
|
+
months?: number;
|
|
21
|
+
days?: number;
|
|
22
|
+
};
|
|
23
|
+
export interface WrapperProps {
|
|
24
|
+
error: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare type RHFPeriodProps = {
|
|
27
|
+
name: string;
|
|
28
|
+
variant?: PeriodVariant;
|
|
29
|
+
};
|
|
@@ -219,10 +219,9 @@ function RHFUploadImage({
|
|
|
219
219
|
const handleDrop = useCallback((acceptedFiles) => {
|
|
220
220
|
const file = acceptedFiles[0];
|
|
221
221
|
if (file) {
|
|
222
|
-
setValue(name, {
|
|
223
|
-
...file,
|
|
222
|
+
setValue(name, Object.assign(file, {
|
|
224
223
|
preview: URL.createObjectURL(file)
|
|
225
|
-
});
|
|
224
|
+
}));
|
|
226
225
|
}
|
|
227
226
|
}, [setValue]);
|
|
228
227
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { FormProvider } from './FormProvider';
|
|
2
|
+
export type { FormInitialValues, FormStatusLoad } from './FormProvider/types';
|
|
2
3
|
export { RHFAutocomplete } from './RHFAutocomplete';
|
|
3
4
|
export { RHFAutocompleteAsync } from './RHFAutocompleteAsync';
|
|
4
5
|
export { RHFCheckbox } from './RHFCheckbox';
|
|
@@ -7,4 +8,7 @@ export { RHFMultiCheckbox } from './RHFMultiCheckbox';
|
|
|
7
8
|
export { RHFSelect } from './RHFSelect';
|
|
8
9
|
export { RHFTextField } from './RHFTextField';
|
|
9
10
|
export { RHFRadioGroup } from './RHFRadioGroup';
|
|
11
|
+
export { RHFPeriod } from './RHFPeriod';
|
|
12
|
+
export type { PeriodType } from './RHFPeriod/types';
|
|
13
|
+
export { getPeriodComponetsDictionary } from './RHFPeriod/dictionary';
|
|
10
14
|
export * from './RHFUpload';
|
package/components/index.d.ts
CHANGED
|
@@ -3,14 +3,17 @@ export * from '../components/hook-form';
|
|
|
3
3
|
export * from '../components/mui_extended';
|
|
4
4
|
export * from '../components/CompanyLogo';
|
|
5
5
|
export * from './formatters';
|
|
6
|
+
export * from './formatters/types';
|
|
6
7
|
export * from './formatters/dicctionary';
|
|
7
8
|
export { DataGrid } from '../components/DataGrid';
|
|
8
|
-
export
|
|
9
|
+
export * from '../components/DataGrid/formatters';
|
|
10
|
+
export type { Column, EditorProps, FormatterProps } from 'react-data-grid';
|
|
9
11
|
export type { RowKey } from '../components/DataGrid/types';
|
|
10
12
|
export { getDataGridComponentsDictionary as getGridComponentsDictionary } from '../components/DataGrid/dictionary';
|
|
11
13
|
export { TextEditor, NumberEditor } from '../components/DataGrid/components/editors/TextEditor';
|
|
12
14
|
export * from '../components/DynamicFilter';
|
|
13
15
|
export * from '../components/DynamicFilter/dictionary';
|
|
16
|
+
export * from '../components/ErrorLabel';
|
|
14
17
|
export type { FilterFieldApply, RawFilterFieldApply, InitialFilterFieldApply, } from '../components/DynamicFilter/types';
|
|
15
18
|
export * from './CommonActions/';
|
|
16
19
|
export * from './CommonActions/dictionary';
|
|
@@ -1,7 +1,64 @@
|
|
|
1
|
-
import { Accordion as Accordion$1, AccordionSummary,
|
|
1
|
+
import { Skeleton, Accordion as Accordion$1, AccordionSummary, AccordionDetails } from "@mui/material";
|
|
2
2
|
import { I as IconButton } from "../IconButton/index.js";
|
|
3
3
|
import { useEnvironment, useModuleSkeleton } from "@m4l/core";
|
|
4
|
-
import {
|
|
4
|
+
import { I as Icon } from "../../Icon/index.js";
|
|
5
|
+
import { styled } from "@mui/material/styles";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
styled("div")(({
|
|
8
|
+
theme
|
|
9
|
+
}) => ({
|
|
10
|
+
display: "flex",
|
|
11
|
+
justifyContent: "space-between",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
borderRadius: theme.spacing(0.5),
|
|
14
|
+
height: theme.spacing(4.5),
|
|
15
|
+
minHeight: theme.spacing(4.5),
|
|
16
|
+
backgroundColor: theme.palette.background.header,
|
|
17
|
+
paddingLeft: theme.spacing(2),
|
|
18
|
+
paddingRight: theme.spacing(2),
|
|
19
|
+
marginBottom: "0px"
|
|
20
|
+
}));
|
|
21
|
+
const WrapperAccordionLabel = styled("div")(({
|
|
22
|
+
theme
|
|
23
|
+
}) => ({
|
|
24
|
+
display: "flex",
|
|
25
|
+
justifyContent: "flex-start",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
gap: theme.spacing(2)
|
|
28
|
+
}));
|
|
29
|
+
const Label = styled("span")(({
|
|
30
|
+
theme
|
|
31
|
+
}) => ({
|
|
32
|
+
...theme.typography.subtitle2
|
|
33
|
+
}));
|
|
34
|
+
const AccordionLabel = (props) => {
|
|
35
|
+
const {
|
|
36
|
+
isSkeleton,
|
|
37
|
+
label,
|
|
38
|
+
SKTWidht,
|
|
39
|
+
SKTHeight,
|
|
40
|
+
labelIcon
|
|
41
|
+
} = props;
|
|
42
|
+
return /* @__PURE__ */ jsx("div", {
|
|
43
|
+
children: isSkeleton ? /* @__PURE__ */ jsxs(WrapperAccordionLabel, {
|
|
44
|
+
children: [labelIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
45
|
+
variant: "circular",
|
|
46
|
+
width: "16px",
|
|
47
|
+
height: "16px"
|
|
48
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
49
|
+
variant: "text",
|
|
50
|
+
width: SKTWidht,
|
|
51
|
+
height: SKTHeight
|
|
52
|
+
})]
|
|
53
|
+
}) : /* @__PURE__ */ jsxs(WrapperAccordionLabel, {
|
|
54
|
+
children: [labelIcon && /* @__PURE__ */ jsx(Icon, {
|
|
55
|
+
src: labelIcon
|
|
56
|
+
}), /* @__PURE__ */ jsx(Label, {
|
|
57
|
+
children: label
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
5
62
|
function Accordion(props) {
|
|
6
63
|
const {
|
|
7
64
|
label,
|
|
@@ -9,7 +66,8 @@ function Accordion(props) {
|
|
|
9
66
|
SKTHeight,
|
|
10
67
|
children,
|
|
11
68
|
accordionProps,
|
|
12
|
-
summaryProps
|
|
69
|
+
summaryProps,
|
|
70
|
+
labelIcon
|
|
13
71
|
} = props;
|
|
14
72
|
const {
|
|
15
73
|
host_static_assets,
|
|
@@ -32,11 +90,13 @@ function Accordion(props) {
|
|
|
32
90
|
src: `${host_static_assets}/${environment_assets}/frontend/components/accordion/assets/icons/expanded.svg`
|
|
33
91
|
}),
|
|
34
92
|
...summaryProps,
|
|
35
|
-
children:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
93
|
+
children: /* @__PURE__ */ jsx(AccordionLabel, {
|
|
94
|
+
isSkeleton,
|
|
95
|
+
label,
|
|
96
|
+
SKTWidht,
|
|
97
|
+
SKTHeight,
|
|
98
|
+
labelIcon
|
|
99
|
+
})
|
|
40
100
|
}), /* @__PURE__ */ jsx(AccordionDetails, {
|
|
41
101
|
children
|
|
42
102
|
})]
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SKTAccordionWrapper: 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 WrapperAccordionLabel: 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 Label: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -5,6 +5,10 @@ export declare type AccordionProps = {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
accordionProps?: MUIAccordionProps;
|
|
7
7
|
summaryProps?: AccordionSummaryProps;
|
|
8
|
+
labelIcon?: string;
|
|
8
9
|
SKTWidht?: string | number;
|
|
9
10
|
SKTHeight?: string | number;
|
|
10
11
|
};
|
|
12
|
+
export interface AccordionLabelProps extends Pick<AccordionProps, 'label' | 'SKTWidht' | 'SKTHeight' | 'labelIcon'> {
|
|
13
|
+
isSkeleton: boolean;
|
|
14
|
+
}
|
package/hooks/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormStatusLoad } from '../../components/hook-form/FormProvider/types';
|
|
2
|
+
import { UseFormAddEditProps } from './types';
|
|
3
|
+
export declare const useFormAddEdit: (props: UseFormAddEditProps) => {
|
|
4
|
+
formValues: import("react-hook-form").FieldValues;
|
|
5
|
+
statusLoad: FormStatusLoad;
|
|
6
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
2
|
+
import { FormInitialValues } from '../../components/hook-form/FormProvider/types';
|
|
3
|
+
export interface UseFormAddEditProps {
|
|
4
|
+
objectId?: number;
|
|
5
|
+
endPoint: string;
|
|
6
|
+
initialValues: FormInitialValues;
|
|
7
|
+
formatDataEnpoint?: (data: FieldValues) => FormInitialValues;
|
|
8
|
+
}
|
package/index.d.ts
CHANGED