@m4l/components 0.0.6 → 0.0.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/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/index.js +5 -6
- 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/NoItemSelected/dictionary.d.ts +3 -0
- package/dist/components/NoItemSelected/index.d.ts +2 -0
- package/dist/components/NoItemSelected/index.js +76 -0
- package/dist/components/NoItemSelected/styles.d.ts +5 -0
- package/dist/components/NoItemSelected/types.d.ts +5 -0
- 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 +12 -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 +35 -18
- 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 +26 -14
- package/package.json +7 -2
|
@@ -6,11 +6,10 @@ import { HTML5Backend } from "react-dnd-html5-backend";
|
|
|
6
6
|
import { SvgIcon, Checkbox, InputBase, Skeleton } from "@mui/material";
|
|
7
7
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
8
8
|
import { voidFunction, useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
9
|
-
import { MenuActions } from "
|
|
9
|
+
import { M as MenuActions } from "../mui_extended/MenuActions/index.js";
|
|
10
10
|
import { P as Pager, g as getPagerComponentsDictionary, d as defaultPagerDictionary } from "../mui_extended/Pager/index.js";
|
|
11
11
|
import { I as IconButton } from "../mui_extended/IconButton/index.js";
|
|
12
12
|
import { u as useModal } from "../../hooks/useModal/index.js";
|
|
13
|
-
import { M as MenuActions$1 } from "../mui_extended/MenuActions/index.js";
|
|
14
13
|
import { u as useResponsiveDesktop } from "../../vendor.js";
|
|
15
14
|
import { g as getModalDialogComponentsDictionary, d as defaultModalDialogDictionary } from "../ModalDialog/index.js";
|
|
16
15
|
import { format } from "date-fns";
|
|
@@ -1478,7 +1477,7 @@ function Density() {
|
|
|
1478
1477
|
}
|
|
1479
1478
|
return /* @__PURE__ */ jsx(WrapperDensity, {
|
|
1480
1479
|
id: "WrapperDensity",
|
|
1481
|
-
children: /* @__PURE__ */ jsx(MenuActions
|
|
1480
|
+
children: /* @__PURE__ */ jsx(MenuActions, {
|
|
1482
1481
|
arrow: "right-top",
|
|
1483
1482
|
anchorOrigin: {
|
|
1484
1483
|
vertical: "top",
|
|
@@ -1589,7 +1588,7 @@ function DataGrid(props) {
|
|
|
1589
1588
|
function getGridComponentsDictionary() {
|
|
1590
1589
|
return ["grid"].concat(getPagerComponentsDictionary()).concat(getModalDialogComponentsDictionary());
|
|
1591
1590
|
}
|
|
1592
|
-
|
|
1591
|
+
({
|
|
1593
1592
|
grid: {
|
|
1594
1593
|
actions: "Actions",
|
|
1595
1594
|
settings_tooltip: "Settings",
|
|
@@ -1617,7 +1616,7 @@ const defaultGridDictionary = {
|
|
|
1617
1616
|
},
|
|
1618
1617
|
...defaultPagerDictionary,
|
|
1619
1618
|
...defaultModalDialogDictionary
|
|
1620
|
-
};
|
|
1619
|
+
});
|
|
1621
1620
|
function DateFormatter(props) {
|
|
1622
1621
|
const {
|
|
1623
1622
|
presentationType,
|
|
@@ -1653,4 +1652,4 @@ const initialPagerState = {
|
|
|
1653
1652
|
rowsPerPage: 25,
|
|
1654
1653
|
totalRecords: 0
|
|
1655
1654
|
};
|
|
1656
|
-
export { DateFormatter as D, DataGrid as a,
|
|
1655
|
+
export { DateFormatter as D, DataGrid as a, getGridComponentsDictionary as g, initialPagerState as i };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { MenuAction } from '@mui_extended/MenuActions/types';
|
|
3
2
|
import { Column } from 'react-data-grid';
|
|
3
|
+
import type { MenuAction } from '../mui_extended/MenuActions/types';
|
|
4
4
|
import { ActionsProps } from './components/Actions/types';
|
|
5
5
|
export declare type ColumnType = 'text' | 'date' | 'number' | 'boolean' | 'custom';
|
|
6
6
|
export declare type ColumnAlign = 'left' | 'center' | 'right';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModalOpenOptions } from "
|
|
1
|
+
import { ModalOpenOptions } from "../../contexts/ModalContext/types";
|
|
2
2
|
declare type ImodalOpt = Pick<ModalOpenOptions, 'actionComponents' | 'standardActions'>;
|
|
3
3
|
export interface ActionsProps extends ImodalOpt {
|
|
4
4
|
variant?: string | undefined;
|
|
@@ -6,12 +6,7 @@ import { R as Resizeable } from "../Resizeable/index.js";
|
|
|
6
6
|
import { u as useResponsiveDesktop } from "../../vendor.js";
|
|
7
7
|
import { useEnvironment } from "@m4l/core";
|
|
8
8
|
import { B as BoxIcon } from "../mui_extended/BoxIcon/index.js";
|
|
9
|
-
import "../mui_extended/MenuPopover/index.js";
|
|
10
|
-
import "react";
|
|
11
9
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
12
|
-
import "react-router-dom";
|
|
13
|
-
import "../mui_extended/MenuActions/index.js";
|
|
14
|
-
import "../mui_extended/Pager/index.js";
|
|
15
10
|
import { F as FormActions, g as getActionnsComponentsDictionary } from "../FormActions/index.js";
|
|
16
11
|
const WrapperDialog = styled(Dialog)(() => ({}));
|
|
17
12
|
const Container = styled("div")(({ theme }) => ({
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
2
|
+
import { styled } from "@mui/material/styles";
|
|
3
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
|
+
const WrapperNoItemSelected = styled("div")(({
|
|
5
|
+
theme
|
|
6
|
+
}) => ({
|
|
7
|
+
width: "100%",
|
|
8
|
+
height: "100%",
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexDirection: "column",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
overflow: "auto",
|
|
14
|
+
padding: theme.spacing(3)
|
|
15
|
+
}));
|
|
16
|
+
const Image = styled("span", {
|
|
17
|
+
shouldForwardProp: (prop) => prop !== "src"
|
|
18
|
+
})(({
|
|
19
|
+
src,
|
|
20
|
+
theme
|
|
21
|
+
}) => ({
|
|
22
|
+
zIndex: 9,
|
|
23
|
+
top: 0,
|
|
24
|
+
height: "100%",
|
|
25
|
+
width: "100%",
|
|
26
|
+
maxWidth: "500px",
|
|
27
|
+
maxHeight: "200px",
|
|
28
|
+
".split_horizontal &": {
|
|
29
|
+
bruces: "sss",
|
|
30
|
+
minWidth: "150px"
|
|
31
|
+
},
|
|
32
|
+
".split_vertical &": {
|
|
33
|
+
bruces: "sss",
|
|
34
|
+
minHeight: "150px"
|
|
35
|
+
},
|
|
36
|
+
padding: `0px ${theme.spacing(1)} ${theme.spacing(1)} ${theme.spacing(1)}`,
|
|
37
|
+
display: "inline-block",
|
|
38
|
+
backgroundColor: theme.palette.divider,
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
mask: `url(${src}) no-repeat center / contain`,
|
|
41
|
+
WebkitMask: `url(${src}) no-repeat center / contain`
|
|
42
|
+
}));
|
|
43
|
+
const Label = styled("span")(({
|
|
44
|
+
theme
|
|
45
|
+
}) => ({
|
|
46
|
+
...theme.typography.body2,
|
|
47
|
+
padding: `${theme.spacing(1.5)} ${theme.spacing(1)} ${theme.spacing(1)} ${theme.spacing(1)}`,
|
|
48
|
+
color: theme.palette.text.primary
|
|
49
|
+
}));
|
|
50
|
+
function NoItemSelected() {
|
|
51
|
+
const {
|
|
52
|
+
host_static_assets,
|
|
53
|
+
environment
|
|
54
|
+
} = useEnvironment();
|
|
55
|
+
const {
|
|
56
|
+
getLabel
|
|
57
|
+
} = useModuleDictionary();
|
|
58
|
+
const src = `${host_static_assets}/${environment}/frontend/components/no_item_selected/assets/icons/no_selected.svg`;
|
|
59
|
+
return /* @__PURE__ */ jsxs(WrapperNoItemSelected, {
|
|
60
|
+
id: "Wrapper",
|
|
61
|
+
children: [/* @__PURE__ */ jsx(Image, {
|
|
62
|
+
src
|
|
63
|
+
}), /* @__PURE__ */ jsx(Label, {
|
|
64
|
+
children: getLabel("no_item_selected.message")
|
|
65
|
+
})]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function getNoItemSelectedComponentsDictionary() {
|
|
69
|
+
return ["no_item_selected"];
|
|
70
|
+
}
|
|
71
|
+
const defaultNoItemSelectedDictionary = {
|
|
72
|
+
no_item_selected: {
|
|
73
|
+
message: "Please select a item to show detail"
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
export { NoItemSelected as N, defaultNoItemSelectedDictionary as d, getNoItemSelectedComponentsDictionary as g };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ImageProps } from './types';
|
|
3
|
+
export declare const WrapperNoItemSelected: 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 Image: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & ImageProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
5
|
+
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>, {}>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { Skeleton } from "@mui/material";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
const WrapperPropertyValue = styled("div", {
|
|
5
|
+
shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight" && prop !== "isForm"
|
|
6
|
+
})(({
|
|
7
|
+
propertyHeight,
|
|
8
|
+
isForm,
|
|
9
|
+
theme
|
|
10
|
+
}) => ({
|
|
11
|
+
display: "flex",
|
|
12
|
+
alignItems: "flex-start",
|
|
13
|
+
width: "100%",
|
|
14
|
+
padding: `${theme.spacing(1)} ${theme.spacing(2)}`,
|
|
15
|
+
height: propertyHeight || "auto",
|
|
16
|
+
":hover": {
|
|
17
|
+
backgroundColor: isForm ? "unset" : theme.palette.grid?.rowHover
|
|
18
|
+
},
|
|
19
|
+
borderBottom: isForm ? "none" : `1px solid ${theme.palette.divider}`,
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
[theme.breakpoints.up("sm")]: {
|
|
22
|
+
flexDirection: "row",
|
|
23
|
+
alignItems: "center"
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
const Property = styled("span", {
|
|
27
|
+
shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight" && prop !== "isForm"
|
|
28
|
+
})(({
|
|
29
|
+
propertyWidth,
|
|
30
|
+
isForm,
|
|
31
|
+
theme
|
|
32
|
+
}) => ({
|
|
33
|
+
width: propertyWidth || "150px",
|
|
34
|
+
minWidth: propertyWidth || "150px",
|
|
35
|
+
...theme.typography.subtitle2,
|
|
36
|
+
color: theme.palette.text.primary,
|
|
37
|
+
position: "relative",
|
|
38
|
+
[theme.breakpoints.up("sm")]: {
|
|
39
|
+
borderRight: isForm ? "none" : `1px solid ${theme.palette.divider}`,
|
|
40
|
+
paddingRight: theme.spacing(2),
|
|
41
|
+
textAlign: "right"
|
|
42
|
+
},
|
|
43
|
+
overflow: "hidden",
|
|
44
|
+
overflowWrap: "break-word"
|
|
45
|
+
}));
|
|
46
|
+
const Value = styled("div", {
|
|
47
|
+
shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight"
|
|
48
|
+
})(({
|
|
49
|
+
propertyHeight,
|
|
50
|
+
theme
|
|
51
|
+
}) => ({
|
|
52
|
+
flexGrow: "1",
|
|
53
|
+
...theme.typography.body2,
|
|
54
|
+
color: theme.palette.text.secondary,
|
|
55
|
+
position: "relative",
|
|
56
|
+
padding: "1px",
|
|
57
|
+
height: propertyHeight ? propertyHeight - 24 : "auto",
|
|
58
|
+
marginTop: theme.spacing(1),
|
|
59
|
+
width: "100%",
|
|
60
|
+
[theme.breakpoints.up("sm")]: {
|
|
61
|
+
marginLeft: theme.spacing(2),
|
|
62
|
+
marginTop: "0px"
|
|
63
|
+
},
|
|
64
|
+
overflow: "hidden",
|
|
65
|
+
overflowWrap: "break-word"
|
|
66
|
+
}));
|
|
67
|
+
const SKTWrapperProperty = styled("div")(() => ({
|
|
68
|
+
display: "flex",
|
|
69
|
+
justifyContent: "flex-end"
|
|
70
|
+
}));
|
|
71
|
+
function SKTProperty() {
|
|
72
|
+
return /* @__PURE__ */ jsx(SKTWrapperProperty, {
|
|
73
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
74
|
+
variant: "text",
|
|
75
|
+
width: 68,
|
|
76
|
+
height: 14
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function PropertyValue(props) {
|
|
81
|
+
const {
|
|
82
|
+
property,
|
|
83
|
+
value,
|
|
84
|
+
propertyWidth,
|
|
85
|
+
propertyHeight,
|
|
86
|
+
isForm,
|
|
87
|
+
isSkeleton = false
|
|
88
|
+
} = props;
|
|
89
|
+
return /* @__PURE__ */ jsxs(WrapperPropertyValue, {
|
|
90
|
+
id: "ContainerPropertyValue",
|
|
91
|
+
isForm,
|
|
92
|
+
propertyWidth,
|
|
93
|
+
propertyHeight,
|
|
94
|
+
children: [/* @__PURE__ */ jsx(Property, {
|
|
95
|
+
id: "Property",
|
|
96
|
+
isForm,
|
|
97
|
+
propertyWidth,
|
|
98
|
+
propertyHeight,
|
|
99
|
+
children: isSkeleton ? /* @__PURE__ */ jsx(SKTProperty, {}) : property
|
|
100
|
+
}), /* @__PURE__ */ jsx(Value, {
|
|
101
|
+
id: "Value",
|
|
102
|
+
propertyWidth,
|
|
103
|
+
propertyHeight,
|
|
104
|
+
children: value
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export { PropertyValue as P };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PropertyProps } from './types';
|
|
3
|
+
export declare const WrapperPropertyValue: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & PropertyProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
4
|
+
export declare const Property: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & PropertyProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
5
|
+
export declare const Value: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & PropertyProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const SKTWrapperProperty: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface PropertyProps {
|
|
3
|
+
propertyWidth?: number;
|
|
4
|
+
propertyHeight?: number;
|
|
5
|
+
isForm?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface PropertyValueProps extends PropertyProps {
|
|
8
|
+
isSkeleton?: boolean;
|
|
9
|
+
property: string;
|
|
10
|
+
value: number | string | ReactNode;
|
|
11
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Box } from "@mui/material";
|
|
2
|
+
import { styled, alpha } from "@mui/material/styles";
|
|
3
|
+
import { S as SimpleBar } from "../../simplebar.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
const RootStyle = styled("div")(() => ({
|
|
6
|
+
flexGrow: 1,
|
|
7
|
+
height: "100%",
|
|
8
|
+
overflow: "hidden"
|
|
9
|
+
}));
|
|
10
|
+
const SimpleBarStyle = styled(SimpleBar)(({
|
|
11
|
+
theme
|
|
12
|
+
}) => ({
|
|
13
|
+
maxHeight: "100%",
|
|
14
|
+
"& .simplebar-scrollbar": {
|
|
15
|
+
"&:before": {
|
|
16
|
+
backgroundColor: alpha(theme.palette.grey[600], 0.48)
|
|
17
|
+
},
|
|
18
|
+
"&.simplebar-visible:before": {
|
|
19
|
+
opacity: 1
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"& .simplebar-track.simplebar-vertical": {
|
|
23
|
+
width: 10
|
|
24
|
+
},
|
|
25
|
+
"& .simplebar-track.simplebar-horizontal .simplebar-scrollbar": {
|
|
26
|
+
height: 6
|
|
27
|
+
},
|
|
28
|
+
"& .simplebar-mask": {
|
|
29
|
+
zIndex: "inherit"
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
function ScrollBar({
|
|
33
|
+
children,
|
|
34
|
+
sx,
|
|
35
|
+
...other
|
|
36
|
+
}) {
|
|
37
|
+
const userAgent = typeof navigator === "undefined" ? "SSR" : navigator.userAgent;
|
|
38
|
+
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
|
|
39
|
+
if (isMobile) {
|
|
40
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
41
|
+
sx: {
|
|
42
|
+
overflowX: "auto",
|
|
43
|
+
...sx
|
|
44
|
+
},
|
|
45
|
+
...other,
|
|
46
|
+
children
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ jsx(RootStyle, {
|
|
50
|
+
id: "RootStyle",
|
|
51
|
+
children: /* @__PURE__ */ jsx(SimpleBarStyle, {
|
|
52
|
+
timeout: 500,
|
|
53
|
+
clickOnTrack: false,
|
|
54
|
+
sx,
|
|
55
|
+
...other,
|
|
56
|
+
children
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export { ScrollBar as S };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import SimpleBarReact from 'simplebar-react';
|
|
3
|
+
export declare const RootStyle: 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 SimpleBarStyle: import("@emotion/styled").StyledComponent<SimpleBarReact.Props & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {
|
|
5
|
+
ref?: import("react").Ref<SimpleBarReact> | undefined;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const WrapperFormActions: 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 WrapperSKTFormActions: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { useCallback, useEffect } from "react";
|
|
2
|
+
import { useFormContext, useFormState, useForm, FormProvider as FormProvider$1 } from "react-hook-form";
|
|
3
|
+
import { o } from "../../../node_modules.js";
|
|
4
|
+
import { styled } from "@mui/material/styles";
|
|
5
|
+
import { useNavigate } from "react-router-dom";
|
|
6
|
+
import { useModuleDictionary, useFlagsPresent } from "@m4l/core";
|
|
7
|
+
import { LoadingButton } from "@mui/lab";
|
|
8
|
+
import { Skeleton, Button } from "@mui/material";
|
|
9
|
+
import { u as useModal } from "../../../hooks/useModal/index.js";
|
|
10
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
11
|
+
const WrapperFormProvider = styled("form")(({
|
|
12
|
+
theme
|
|
13
|
+
}) => ({
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
width: "100%",
|
|
17
|
+
overflow: "scroll",
|
|
18
|
+
marginBottom: theme.spacing(1)
|
|
19
|
+
}));
|
|
20
|
+
const WrapperFormActions = styled("div")(({
|
|
21
|
+
theme
|
|
22
|
+
}) => ({
|
|
23
|
+
paddingTop: theme.spacing(3),
|
|
24
|
+
marginRight: theme.spacing(1.5),
|
|
25
|
+
display: "flex",
|
|
26
|
+
flexDirection: "row",
|
|
27
|
+
justifyContent: "flex-end",
|
|
28
|
+
"& > button": {
|
|
29
|
+
marginLeft: "10px"
|
|
30
|
+
},
|
|
31
|
+
"& .MuiLoadingButton-root ": {
|
|
32
|
+
minWidth: "80px"
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
const WrapperSKTFormActions = styled("div")(({
|
|
36
|
+
theme
|
|
37
|
+
}) => ({
|
|
38
|
+
display: "grid",
|
|
39
|
+
gridTemplateColumns: "auto auto",
|
|
40
|
+
margin: "0px",
|
|
41
|
+
gridGap: `${theme.spacing(3)}`,
|
|
42
|
+
justifyContent: "flex-end",
|
|
43
|
+
paddingTop: `${theme.spacing(3)}`,
|
|
44
|
+
borderTop: `1px solid ${theme.palette.divider}`,
|
|
45
|
+
[theme.breakpoints.up("sm")]: {
|
|
46
|
+
margin: `0 ${theme.spacing(4.5)}`
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
function SKTFormActions() {
|
|
50
|
+
return /* @__PURE__ */ jsxs(WrapperSKTFormActions, {
|
|
51
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
52
|
+
variant: "text",
|
|
53
|
+
width: 57,
|
|
54
|
+
height: 30
|
|
55
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
56
|
+
variant: "text",
|
|
57
|
+
width: 57,
|
|
58
|
+
height: 30
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function FormActions(props) {
|
|
63
|
+
const {
|
|
64
|
+
withIntro,
|
|
65
|
+
urlCancel
|
|
66
|
+
} = props;
|
|
67
|
+
const navigate = useNavigate();
|
|
68
|
+
const {
|
|
69
|
+
getLabel
|
|
70
|
+
} = useModuleDictionary();
|
|
71
|
+
const isSkeleton = !useFlagsPresent(["dictionary_loaded", "form_loaded"]);
|
|
72
|
+
const {
|
|
73
|
+
openModalConfirm
|
|
74
|
+
} = useModal();
|
|
75
|
+
const {
|
|
76
|
+
control
|
|
77
|
+
} = useFormContext();
|
|
78
|
+
const {
|
|
79
|
+
isDirty,
|
|
80
|
+
isSubmitting
|
|
81
|
+
} = useFormState({
|
|
82
|
+
control
|
|
83
|
+
});
|
|
84
|
+
const onConfirmCancel = useCallback(() => {
|
|
85
|
+
if (typeof urlCancel === "number") {
|
|
86
|
+
navigate(urlCancel);
|
|
87
|
+
}
|
|
88
|
+
if (urlCancel && typeof urlCancel === "undefined") {
|
|
89
|
+
navigate(urlCancel, {
|
|
90
|
+
replace: false
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, [navigate, urlCancel]);
|
|
94
|
+
const onClickCancel = useCallback(() => {
|
|
95
|
+
if (isDirty) {
|
|
96
|
+
openModalConfirm({
|
|
97
|
+
variant: "warning",
|
|
98
|
+
title: getLabel("form_provider.confirm_quit_title"),
|
|
99
|
+
msg: getLabel("form_provider.confirm_quit_msg"),
|
|
100
|
+
onClickIntro: onConfirmCancel
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
onConfirmCancel();
|
|
104
|
+
}
|
|
105
|
+
}, [getLabel, isDirty, onConfirmCancel, openModalConfirm]);
|
|
106
|
+
if (isSkeleton) {
|
|
107
|
+
return /* @__PURE__ */ jsx(SKTFormActions, {});
|
|
108
|
+
}
|
|
109
|
+
return /* @__PURE__ */ jsxs(WrapperFormActions, {
|
|
110
|
+
children: [urlCancel && /* @__PURE__ */ jsx(Button, {
|
|
111
|
+
variant: "outlined",
|
|
112
|
+
color: "inherit",
|
|
113
|
+
onClick: onClickCancel,
|
|
114
|
+
children: getLabel("actions.action_cancel")
|
|
115
|
+
}), withIntro && /* @__PURE__ */ jsx(LoadingButton, {
|
|
116
|
+
variant: "contained",
|
|
117
|
+
type: "submit",
|
|
118
|
+
loading: isSubmitting,
|
|
119
|
+
children: getLabel("actions.action_accept")
|
|
120
|
+
})]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function FormProvider(props) {
|
|
124
|
+
const {
|
|
125
|
+
children,
|
|
126
|
+
onSubmit,
|
|
127
|
+
values,
|
|
128
|
+
validationSchema,
|
|
129
|
+
withIntro,
|
|
130
|
+
urlCancel = -1
|
|
131
|
+
} = props;
|
|
132
|
+
const methods = useForm({
|
|
133
|
+
resolver: o(validationSchema),
|
|
134
|
+
defaultValues: values
|
|
135
|
+
});
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
if (values.initial) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
console.log("****\xB7\xB7\xB7\xB7\xB7\xB7useEffect FormProvider", values);
|
|
141
|
+
const keys = Object.keys(values);
|
|
142
|
+
keys.forEach((key) => {
|
|
143
|
+
methods.setValue(key, values[key], {
|
|
144
|
+
shouldValidate: false,
|
|
145
|
+
shouldDirty: false,
|
|
146
|
+
shouldTouch: false
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
}, [methods, values]);
|
|
150
|
+
return /* @__PURE__ */ jsx(FormProvider$1, {
|
|
151
|
+
...methods,
|
|
152
|
+
children: /* @__PURE__ */ jsxs(WrapperFormProvider, {
|
|
153
|
+
id: "formProvider",
|
|
154
|
+
onSubmit: methods.handleSubmit(onSubmit),
|
|
155
|
+
children: [children, withIntro && /* @__PURE__ */ jsx(FormActions, {
|
|
156
|
+
withIntro,
|
|
157
|
+
urlCancel
|
|
158
|
+
})]
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
export { FormProvider as F };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const WrapperFormProvider: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
export interface FormProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
onSubmit: (data: FieldValues) => void;
|
|
6
|
+
values: FieldValues;
|
|
7
|
+
validationSchema: any;
|
|
8
|
+
withIntro?: boolean;
|
|
9
|
+
urlCancel?: string | number;
|
|
10
|
+
}
|