@m4l/components 0.0.9 → 0.0.12
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/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 +2 -37
- package/dist/components/ObjectLogs/index.js +3 -3
- package/dist/components/PaperForm/index.d.ts +3 -0
- package/dist/components/PaperForm/index.js +122 -0
- package/dist/components/PaperForm/skeleton.d.ts +6 -0
- package/dist/components/PaperForm/styles.d.ts +8 -0
- package/dist/components/PaperForm/types.d.ts +7 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/core-js.js +7 -4
- package/dist/index.js +6 -2
- package/dist/vendor.js +9 -68
- package/package.json +7 -9
- package/dist/hooks/usePaginate.d.ts +0 -15
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Checkbox } from "@mui/material";
|
|
2
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
+
function BooleanFormatter(props) {
|
|
4
|
+
const {
|
|
5
|
+
presentationType,
|
|
6
|
+
value
|
|
7
|
+
} = props;
|
|
8
|
+
if (presentationType === "string_yes_no") {
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
10
|
+
children: value ? "Yes" : "No"
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
if (presentationType === "string_true_false") {
|
|
14
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
15
|
+
children: value ? "True" : "False"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(Checkbox, {
|
|
19
|
+
checked: value !== void 0 ? value : false,
|
|
20
|
+
size: "small",
|
|
21
|
+
readOnly: true,
|
|
22
|
+
disableFocusRipple: true,
|
|
23
|
+
disableRipple: true
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { BooleanFormatter as B };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { format } from "date-fns";
|
|
2
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
+
function DateFormatter(props) {
|
|
4
|
+
const {
|
|
5
|
+
presentationType,
|
|
6
|
+
dateTime,
|
|
7
|
+
formatDate
|
|
8
|
+
} = props;
|
|
9
|
+
let finalFormat = formatDate || "yyyy-MM-dd HH:mm:ss";
|
|
10
|
+
let result;
|
|
11
|
+
let resultDate;
|
|
12
|
+
if (presentationType === "date") {
|
|
13
|
+
finalFormat = formatDate || "yyyy-MM-dd";
|
|
14
|
+
} else if (presentationType === "time") {
|
|
15
|
+
finalFormat = formatDate || "HH:mm:ss";
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
if (typeof dateTime === "number") {
|
|
19
|
+
resultDate = new Date(dateTime);
|
|
20
|
+
} else if (typeof dateTime === "string") {
|
|
21
|
+
resultDate = new Date(Date.parse(dateTime));
|
|
22
|
+
} else {
|
|
23
|
+
resultDate = dateTime;
|
|
24
|
+
}
|
|
25
|
+
result = format(resultDate, finalFormat);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
result = "err_typing";
|
|
28
|
+
}
|
|
29
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
30
|
+
children: result
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export { DateFormatter as D };
|
|
@@ -11,8 +11,8 @@ import { P as Pager, g as getPagerComponentsDictionary, d as defaultPagerDiction
|
|
|
11
11
|
import { I as IconButton } from "../mui_extended/IconButton/index.js";
|
|
12
12
|
import { u as useModal } from "../../hooks/useModal/index.js";
|
|
13
13
|
import { u as useResponsiveDesktop } from "../../vendor.js";
|
|
14
|
+
import "date-fns";
|
|
14
15
|
import { g as getModalDialogComponentsDictionary, d as defaultModalDialogDictionary } from "../ModalDialog/index.js";
|
|
15
|
-
import { format } from "date-fns";
|
|
16
16
|
const WrapperGrid$1 = styled("div")(() => ({
|
|
17
17
|
display: "flex",
|
|
18
18
|
flexDirection: "column",
|
|
@@ -1617,39 +1617,4 @@ function getGridComponentsDictionary() {
|
|
|
1617
1617
|
...defaultPagerDictionary,
|
|
1618
1618
|
...defaultModalDialogDictionary
|
|
1619
1619
|
});
|
|
1620
|
-
|
|
1621
|
-
const {
|
|
1622
|
-
presentationType,
|
|
1623
|
-
dateTime,
|
|
1624
|
-
formatDate
|
|
1625
|
-
} = props;
|
|
1626
|
-
let finalFormat = formatDate || "yyyy-MM-dd HH:mm:ss";
|
|
1627
|
-
let result;
|
|
1628
|
-
let resultDate;
|
|
1629
|
-
if (presentationType === "date") {
|
|
1630
|
-
finalFormat = formatDate || "yyyy-MM-dd";
|
|
1631
|
-
} else if (presentationType === "time") {
|
|
1632
|
-
finalFormat = formatDate || "HH:mm:ss";
|
|
1633
|
-
}
|
|
1634
|
-
try {
|
|
1635
|
-
if (typeof dateTime === "number") {
|
|
1636
|
-
resultDate = new Date(dateTime);
|
|
1637
|
-
} else if (typeof dateTime === "string") {
|
|
1638
|
-
resultDate = new Date(Date.parse(dateTime));
|
|
1639
|
-
} else {
|
|
1640
|
-
resultDate = dateTime;
|
|
1641
|
-
}
|
|
1642
|
-
result = format(resultDate, finalFormat);
|
|
1643
|
-
} catch (e) {
|
|
1644
|
-
result = "err_typing";
|
|
1645
|
-
}
|
|
1646
|
-
return /* @__PURE__ */ jsx(Fragment, {
|
|
1647
|
-
children: result
|
|
1648
|
-
});
|
|
1649
|
-
}
|
|
1650
|
-
const initialPagerState = {
|
|
1651
|
-
page: 0,
|
|
1652
|
-
rowsPerPage: 25,
|
|
1653
|
-
totalRecords: 0
|
|
1654
|
-
};
|
|
1655
|
-
export { DateFormatter as D, DataGrid as a, getGridComponentsDictionary as g, initialPagerState as i };
|
|
1620
|
+
export { DataGrid as D, getGridComponentsDictionary as g };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback, useMemo } from "react";
|
|
2
|
-
import { useNetwork, useModuleDictionary } from "@m4l/core";
|
|
2
|
+
import { useNetwork, useModuleDictionary, usePaginate } from "@m4l/core";
|
|
3
3
|
import { Tooltip, IconButton, TextField } from "@mui/material";
|
|
4
4
|
import { LocalizationProvider, DateTimePicker } from "@mui/x-date-pickers";
|
|
5
5
|
import AdapterDateFns from "@mui/lab/AdapterDateFns";
|
|
6
6
|
import { styled, useTheme } from "@mui/material/styles";
|
|
7
7
|
import { startOfMonth, endOfDay } from "date-fns";
|
|
8
|
-
import { D as
|
|
8
|
+
import { D as DataGrid } from "../DataGrid/index.js";
|
|
9
9
|
import { I as IconButton$1 } from "../mui_extended/IconButton/index.js";
|
|
10
|
+
import { D as DateFormatter } from "../DataGrid/formatters/DateFormatter/index.js";
|
|
10
11
|
import { R as ReactJson } from "../../react-json-view.js";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
13
|
import { u as useModal } from "../../hooks/useModal/index.js";
|
|
13
|
-
import { a as usePaginate } from "../../vendor.js";
|
|
14
14
|
const Container$1 = styled("div")(() => ({
|
|
15
15
|
height: "100%",
|
|
16
16
|
width: "100%",
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { styled, useTheme } from "@mui/material/styles";
|
|
2
|
+
import { Skeleton } from "@mui/material";
|
|
3
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
4
|
+
import { BoxIcon } from "@mui_extended/BoxIcon";
|
|
5
|
+
const WrapperPaper = styled("div")(({
|
|
6
|
+
theme
|
|
7
|
+
}) => ({
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "column",
|
|
10
|
+
padding: theme.spacing(1),
|
|
11
|
+
[theme.breakpoints.up("sm")]: {
|
|
12
|
+
margin: `${theme.spacing(1.5)} ${theme.spacing(1.5)} ${theme.spacing(3)} ${theme.spacing(1.5)}`,
|
|
13
|
+
borderRadius: theme.spacing(2),
|
|
14
|
+
boxShadow: theme.customShadows.z8,
|
|
15
|
+
padding: theme.spacing(3),
|
|
16
|
+
backgroundColor: theme.palette.background.paper
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
const Header = styled("div")(({
|
|
20
|
+
theme
|
|
21
|
+
}) => ({
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "row",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
26
|
+
paddingBottom: theme.spacing(3),
|
|
27
|
+
marginBottom: theme.spacing(2),
|
|
28
|
+
overflow: "hidden"
|
|
29
|
+
}));
|
|
30
|
+
const IconTitleContainer = styled("div")(({
|
|
31
|
+
theme
|
|
32
|
+
}) => ({
|
|
33
|
+
display: "flex",
|
|
34
|
+
flexDirection: "row",
|
|
35
|
+
flexGrow: 1,
|
|
36
|
+
alignItems: "center",
|
|
37
|
+
cursor: "move",
|
|
38
|
+
...theme.typography.subtitle1,
|
|
39
|
+
color: theme.palette.text.primary
|
|
40
|
+
}));
|
|
41
|
+
const IconHeader = styled("div")(({
|
|
42
|
+
theme
|
|
43
|
+
}) => ({
|
|
44
|
+
display: "flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
marginRight: theme.spacing(1.5)
|
|
48
|
+
}));
|
|
49
|
+
const Content = styled("div")(() => ({
|
|
50
|
+
flexGrow: 1,
|
|
51
|
+
position: "relative"
|
|
52
|
+
}));
|
|
53
|
+
const SkPaperFormHeader = styled("div")(({
|
|
54
|
+
theme
|
|
55
|
+
}) => ({
|
|
56
|
+
width: "auto",
|
|
57
|
+
display: "grid",
|
|
58
|
+
gridTemplateColumns: `${theme.spacing(2)} auto`,
|
|
59
|
+
gridGap: `${theme.spacing(1.5)}`,
|
|
60
|
+
paddingBottom: `${theme.spacing(3)}`,
|
|
61
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
62
|
+
marginBottom: `${theme.spacing(3)}`
|
|
63
|
+
}));
|
|
64
|
+
const PaperFormBoddy = styled("div")(() => ({
|
|
65
|
+
display: "flex",
|
|
66
|
+
flexDirection: "column",
|
|
67
|
+
flexGrow: "1"
|
|
68
|
+
}));
|
|
69
|
+
function SKTPaperForm(prop) {
|
|
70
|
+
const {
|
|
71
|
+
children
|
|
72
|
+
} = prop;
|
|
73
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
74
|
+
children: [/* @__PURE__ */ jsxs(SkPaperFormHeader, {
|
|
75
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
76
|
+
variant: "circular",
|
|
77
|
+
width: 16,
|
|
78
|
+
height: 16
|
|
79
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
80
|
+
variant: "text",
|
|
81
|
+
width: 68,
|
|
82
|
+
height: 14
|
|
83
|
+
})]
|
|
84
|
+
}), /* @__PURE__ */ jsx(PaperFormBoddy, {
|
|
85
|
+
children
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function PaperForm(props) {
|
|
90
|
+
const {
|
|
91
|
+
urlIcon,
|
|
92
|
+
tittle,
|
|
93
|
+
children,
|
|
94
|
+
isSkeleton = false
|
|
95
|
+
} = props;
|
|
96
|
+
const theme = useTheme();
|
|
97
|
+
return /* @__PURE__ */ jsx(WrapperPaper, {
|
|
98
|
+
id: "ContainerPropertyValue",
|
|
99
|
+
children: !isSkeleton ? /* @__PURE__ */ jsxs(Fragment, {
|
|
100
|
+
children: [/* @__PURE__ */ jsx(Header, {
|
|
101
|
+
id: "Header",
|
|
102
|
+
children: /* @__PURE__ */ jsxs(IconTitleContainer, {
|
|
103
|
+
className: "draggable-dialog-title",
|
|
104
|
+
children: [/* @__PURE__ */ jsx(IconHeader, {
|
|
105
|
+
children: /* @__PURE__ */ jsx(BoxIcon, {
|
|
106
|
+
src: urlIcon,
|
|
107
|
+
sx: {
|
|
108
|
+
color: theme.palette.action.active
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
}), tittle]
|
|
112
|
+
})
|
|
113
|
+
}), /* @__PURE__ */ jsx(Content, {
|
|
114
|
+
id: "Content",
|
|
115
|
+
children
|
|
116
|
+
})]
|
|
117
|
+
}) : /* @__PURE__ */ jsx(SKTPaperForm, {
|
|
118
|
+
children
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
export { PaperForm as P };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const WrapperPaper: 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 Header: 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 IconTitleContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const IconHeader: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const Content: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
7
|
+
export declare const SkPaperFormHeader: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
8
|
+
export declare const PaperFormBoddy: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { DataGrid } from '../components/DataGrid';
|
|
2
|
+
export { DateFormatter, BooleanFormatter } from '../components/DataGrid/formatters';
|
|
2
3
|
export type { Column } from 'react-data-grid';
|
|
3
4
|
export type { RowKey } from '../components/DataGrid/types';
|
|
4
5
|
export { getGridComponentsDictionary } from '../components/DataGrid/dictionary';
|
|
@@ -11,6 +12,7 @@ export * from '../components/NoItemSelected';
|
|
|
11
12
|
export * from '../components/NoItemSelected/dictionary';
|
|
12
13
|
export * from '../components/ObjectLogs';
|
|
13
14
|
export * from '../components/ObjectLogs/dictionary';
|
|
15
|
+
export * from '../components/PaperForm';
|
|
14
16
|
export * from '../components/PropertyValue';
|
|
15
17
|
export * from '../components/Resizeable';
|
|
16
18
|
export * from '../components/ScrollBar';
|
package/dist/core-js.js
CHANGED
|
@@ -198,10 +198,10 @@ var store$2 = sharedStore;
|
|
|
198
198
|
(shared$4.exports = function(key, value) {
|
|
199
199
|
return store$2[key] || (store$2[key] = value !== void 0 ? value : {});
|
|
200
200
|
})("versions", []).push({
|
|
201
|
-
version: "3.23.
|
|
201
|
+
version: "3.23.4",
|
|
202
202
|
mode: "global",
|
|
203
203
|
copyright: "\xA9 2014-2022 Denis Pushkarev (zloirock.ru)",
|
|
204
|
-
license: "https://github.com/zloirock/core-js/blob/v3.23.
|
|
204
|
+
license: "https://github.com/zloirock/core-js/blob/v3.23.4/LICENSE",
|
|
205
205
|
source: "https://github.com/zloirock/core-js"
|
|
206
206
|
});
|
|
207
207
|
var requireObjectCoercible$4 = requireObjectCoercible$6;
|
|
@@ -1685,6 +1685,7 @@ var ResultPrototype = Result.prototype;
|
|
|
1685
1685
|
var iterate$2 = function(iterable, unboundFunction, options) {
|
|
1686
1686
|
var that = options && options.that;
|
|
1687
1687
|
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
1688
|
+
var IS_RECORD = !!(options && options.IS_RECORD);
|
|
1688
1689
|
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
1689
1690
|
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
1690
1691
|
var fn = bind(unboundFunction, that);
|
|
@@ -1701,7 +1702,9 @@ var iterate$2 = function(iterable, unboundFunction, options) {
|
|
|
1701
1702
|
}
|
|
1702
1703
|
return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
1703
1704
|
};
|
|
1704
|
-
if (
|
|
1705
|
+
if (IS_RECORD) {
|
|
1706
|
+
iterator = iterable.iterator;
|
|
1707
|
+
} else if (IS_ITERATOR) {
|
|
1705
1708
|
iterator = iterable;
|
|
1706
1709
|
} else {
|
|
1707
1710
|
iterFn = getIteratorMethod(iterable);
|
|
@@ -1717,7 +1720,7 @@ var iterate$2 = function(iterable, unboundFunction, options) {
|
|
|
1717
1720
|
}
|
|
1718
1721
|
iterator = getIterator(iterable, iterFn);
|
|
1719
1722
|
}
|
|
1720
|
-
next2 = iterator.next;
|
|
1723
|
+
next2 = IS_RECORD ? iterable.next : iterator.next;
|
|
1721
1724
|
while (!(step = call$5(next2, iterator)).done) {
|
|
1722
1725
|
try {
|
|
1723
1726
|
result = callFn(step.value);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { D as DataGrid, g as getGridComponentsDictionary } from "./components/DataGrid/index.js";
|
|
2
|
+
export { B as BooleanFormatter } from "./components/DataGrid/formatters/BooleanFormatter/index.js";
|
|
3
|
+
export { D as DateFormatter } from "./components/DataGrid/formatters/DateFormatter/index.js";
|
|
2
4
|
export { F as FormActions, d as defaultActionsDictionary, g as getActionnsComponentsDictionary } from "./components/FormActions/index.js";
|
|
3
5
|
export { F as FormProvider } from "./components/hook-form/FormProvider/index.js";
|
|
4
6
|
export { R as RHFAutocompleteAsync } from "./components/hook-form/RHFAutocompleteAsync/index.js";
|
|
@@ -10,6 +12,7 @@ export { R as RHFRadioGroup } from "./components/hook-form/RHFRadioGroup.js";
|
|
|
10
12
|
export { M as ModalDialog, d as defaultModalDialogDictionary, g as getModalDialogComponentsDictionary } from "./components/ModalDialog/index.js";
|
|
11
13
|
export { N as NoItemSelected, d as defaultNoItemSelectedDictionary, g as getNoItemSelectedComponentsDictionary } from "./components/NoItemSelected/index.js";
|
|
12
14
|
export { O as ObjectLogs, d as defaultObjectLogDictionary, g as getObjectLogsComponentsDictionary } from "./components/ObjectLogs/index.js";
|
|
15
|
+
export { P as PaperForm } from "./components/PaperForm/index.js";
|
|
13
16
|
export { P as PropertyValue } from "./components/PropertyValue/index.js";
|
|
14
17
|
export { R as Resizeable } from "./components/Resizeable/index.js";
|
|
15
18
|
export { S as ScrollBar } from "./components/ScrollBar/index.js";
|
|
@@ -38,14 +41,15 @@ import "@mui/material/useMediaQuery";
|
|
|
38
41
|
import "react-hook-form";
|
|
39
42
|
import "react-router-dom";
|
|
40
43
|
import "@mui/lab";
|
|
44
|
+
import "date-fns";
|
|
41
45
|
import "./react-draggable.js";
|
|
42
46
|
import "prop-types";
|
|
43
47
|
import "react-dom";
|
|
44
48
|
import "@mui/x-date-pickers";
|
|
45
49
|
import "@mui/lab/AdapterDateFns";
|
|
46
|
-
import "date-fns";
|
|
47
50
|
import "./react-json-view.js";
|
|
48
51
|
import "./commonjs.js";
|
|
52
|
+
import "@mui_extended/BoxIcon";
|
|
49
53
|
import "./react-splitter-layout.js";
|
|
50
54
|
import "./node_modules.js";
|
|
51
55
|
import "./react-resizable.js";
|
package/dist/vendor.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useTheme } from "@mui/material/styles";
|
|
2
2
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
3
|
-
import
|
|
3
|
+
import "react";
|
|
4
4
|
import "react-hook-form";
|
|
5
5
|
import "./components/hook-form/FormProvider/index.js";
|
|
6
6
|
import "react-router-dom";
|
|
7
|
-
import
|
|
7
|
+
import "@m4l/core";
|
|
8
8
|
import "@mui/lab";
|
|
9
9
|
import "@mui/material";
|
|
10
10
|
import "./contexts/ModalContext/index.js";
|
|
@@ -12,13 +12,14 @@ import "react/jsx-runtime";
|
|
|
12
12
|
import "./components/hook-form/RHFAutocompleteAsync/index.js";
|
|
13
13
|
import "./components/hook-form/RHFCheckbox/index.js";
|
|
14
14
|
import "./components/hook-form/RHFTextField/index.js";
|
|
15
|
-
import { i as initialPagerState } from "./components/DataGrid/index.js";
|
|
16
15
|
import "./components/mui_extended/MenuPopover/index.js";
|
|
17
16
|
import "./components/mui_extended/MenuActions/index.js";
|
|
18
17
|
import "./components/mui_extended/Pager/index.js";
|
|
19
18
|
import "./components/mui_extended/Tab/index.js";
|
|
19
|
+
import "./components/DataGrid/index.js";
|
|
20
20
|
import "react-dnd";
|
|
21
21
|
import "react-dnd-html5-backend";
|
|
22
|
+
import "date-fns";
|
|
22
23
|
import "./components/FormActions/index.js";
|
|
23
24
|
import "./react-draggable.js";
|
|
24
25
|
import "./components/ModalDialog/index.js";
|
|
@@ -26,13 +27,16 @@ import "./components/Resizeable/index.js";
|
|
|
26
27
|
import "./components/NoItemSelected/index.js";
|
|
27
28
|
import "@mui/x-date-pickers";
|
|
28
29
|
import "@mui/lab/AdapterDateFns";
|
|
29
|
-
import "date-fns";
|
|
30
30
|
import "./components/ObjectLogs/index.js";
|
|
31
31
|
import "./react-json-view.js";
|
|
32
|
+
import "./components/PaperForm/index.js";
|
|
33
|
+
import "@mui_extended/BoxIcon";
|
|
32
34
|
import "./components/PropertyValue/index.js";
|
|
33
35
|
import "./components/ScrollBar/index.js";
|
|
34
36
|
import "./react-splitter-layout.js";
|
|
35
37
|
import "./components/SplitLayout/index.js";
|
|
38
|
+
import "./components/DataGrid/formatters/BooleanFormatter/index.js";
|
|
39
|
+
import "./components/DataGrid/formatters/DateFormatter/index.js";
|
|
36
40
|
import "./components/hook-form/RHFMultiCheckbox/index.js";
|
|
37
41
|
import "./components/hook-form/RHFSelect.js";
|
|
38
42
|
import "./components/hook-form/RHFRadioGroup.js";
|
|
@@ -64,67 +68,4 @@ function useResponsiveDesktop() {
|
|
|
64
68
|
const isDesktop = useResponsive("up", "sm");
|
|
65
69
|
return isDesktop;
|
|
66
70
|
}
|
|
67
|
-
|
|
68
|
-
const { endPoint, timeout = 5e3, queryParams = {}, fireOnEnter = true } = props;
|
|
69
|
-
const [refresh, setRefresh] = useState(0);
|
|
70
|
-
const [rows, setRows] = useState([]);
|
|
71
|
-
const [pagerState, setPagerState] = useState(initialPagerState);
|
|
72
|
-
const refPagerState = useRef(initialPagerState);
|
|
73
|
-
const [fire, setFire] = useState(fireOnEnter);
|
|
74
|
-
const { startProgress, stopProgress } = useHostTools();
|
|
75
|
-
const { networkOperation } = useNetwork();
|
|
76
|
-
const Refresh = useCallback(() => {
|
|
77
|
-
setRefresh((oldValue) => oldValue + 1);
|
|
78
|
-
}, []);
|
|
79
|
-
useEffect(() => {
|
|
80
|
-
let mounted = true;
|
|
81
|
-
if (!fire) {
|
|
82
|
-
setFire(true);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
startProgress();
|
|
86
|
-
networkOperation({
|
|
87
|
-
method: "GET",
|
|
88
|
-
endPoint,
|
|
89
|
-
timeout,
|
|
90
|
-
parms: {
|
|
91
|
-
...queryParams,
|
|
92
|
-
page: refPagerState.current.page,
|
|
93
|
-
limit: refPagerState.current.rowsPerPage
|
|
94
|
-
}
|
|
95
|
-
}).then((response) => {
|
|
96
|
-
if (mounted) {
|
|
97
|
-
setRows(response.data);
|
|
98
|
-
refPagerState.current.page = response.pager.page;
|
|
99
|
-
setPagerState((oldPagerState) => ({
|
|
100
|
-
...oldPagerState,
|
|
101
|
-
page: response.pager.page,
|
|
102
|
-
totalRecords: response.pager.total
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
|
-
}).finally(() => {
|
|
106
|
-
if (mounted) {
|
|
107
|
-
stopProgress();
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
return function cleanUp() {
|
|
111
|
-
stopProgress();
|
|
112
|
-
mounted = false;
|
|
113
|
-
};
|
|
114
|
-
}, [refresh, queryParams]);
|
|
115
|
-
const onPageChange = (newPage) => {
|
|
116
|
-
refPagerState.current.page = newPage;
|
|
117
|
-
setRefresh((oldValue) => oldValue + 1);
|
|
118
|
-
};
|
|
119
|
-
const onRowsPerPageChange = (newRowsPerPage) => {
|
|
120
|
-
refPagerState.current.rowsPerPage = newRowsPerPage;
|
|
121
|
-
setPagerState((oldPagerState) => ({ ...oldPagerState, rowsPerPage: newRowsPerPage }));
|
|
122
|
-
setRefresh((oldValue) => oldValue + 1);
|
|
123
|
-
};
|
|
124
|
-
const clearRows = () => {
|
|
125
|
-
setRows([]);
|
|
126
|
-
setPagerState(initialPagerState);
|
|
127
|
-
};
|
|
128
|
-
return { onPageChange, onRowsPerPageChange, pagerState, rows, clearRows, Refresh };
|
|
129
|
-
};
|
|
130
|
-
export { usePaginate as a, useResponsiveDesktop as u };
|
|
71
|
+
export { useResponsiveDesktop as u };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.12",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"react-dom": "^18.0.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@
|
|
21
|
+
"@hookform/resolvers": "^2.9.5",
|
|
22
|
+
"@m4l/core": "^0.0.27",
|
|
22
23
|
"@mui/lab": "^5.0.0-alpha.89",
|
|
23
24
|
"@mui/material": "^5.8.7",
|
|
24
25
|
"@mui/x-date-pickers": "^5.0.0-beta.0",
|
|
@@ -29,17 +30,13 @@
|
|
|
29
30
|
"react-dnd": "^16.0.1",
|
|
30
31
|
"react-dnd-html5-backend": "^16.0.1",
|
|
31
32
|
"react-dom": "^18.0.0",
|
|
32
|
-
"react-
|
|
33
|
-
"
|
|
34
|
-
"react-hook-form": "^7.33.1"
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
"react-hook-form": "^7.33.1",
|
|
34
|
+
"react-router-dom": "^6.3.0"
|
|
37
35
|
},
|
|
38
36
|
"devDependencies": {
|
|
39
37
|
"@emotion/styled": "^11.9.3",
|
|
40
38
|
"@hookform/resolvers": "^2.9.5",
|
|
41
|
-
"@m4l/core": "^0.0.
|
|
42
|
-
"@m4l/graphics": "^0.0.14",
|
|
39
|
+
"@m4l/core": "^0.0.27",
|
|
43
40
|
"@mui/lab": "^5.0.0-alpha.89",
|
|
44
41
|
"@mui/material": "^5.8.7",
|
|
45
42
|
"@mui/x-date-pickers": "^5.0.0-beta.0",
|
|
@@ -74,6 +71,7 @@
|
|
|
74
71
|
"react-resizable": "^3.0.4",
|
|
75
72
|
"react-splitter-layout": "^4.0.0",
|
|
76
73
|
"rollup-plugin-terser": "^7.0.2",
|
|
74
|
+
"simplebar-react": "^2.4.1",
|
|
77
75
|
"typescript": "^4.6.3",
|
|
78
76
|
"vite": "^2.9.9",
|
|
79
77
|
"vite-plugin-dts": "^1.2.1",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PagerState } from '../components/DataGrid/types';
|
|
2
|
-
export interface propsUsePaginate {
|
|
3
|
-
endPoint: string;
|
|
4
|
-
timeout?: number;
|
|
5
|
-
fireOnEnter?: boolean;
|
|
6
|
-
queryParams?: Record<string, unknown>;
|
|
7
|
-
}
|
|
8
|
-
export declare const usePaginate: <TRow>(props: propsUsePaginate) => {
|
|
9
|
-
onPageChange: (newPage: number) => void;
|
|
10
|
-
onRowsPerPageChange: (newRowsPerPage: number) => void;
|
|
11
|
-
pagerState: PagerState;
|
|
12
|
-
rows: TRow[];
|
|
13
|
-
clearRows: () => void;
|
|
14
|
-
Refresh: () => void;
|
|
15
|
-
};
|