@m4l/components 0.0.11 → 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.
|
@@ -1617,9 +1617,4 @@ function getGridComponentsDictionary() {
|
|
|
1617
1617
|
...defaultPagerDictionary,
|
|
1618
1618
|
...defaultModalDialogDictionary
|
|
1619
1619
|
});
|
|
1620
|
-
|
|
1621
|
-
page: 0,
|
|
1622
|
-
rowsPerPage: 25,
|
|
1623
|
-
totalRecords: 0
|
|
1624
|
-
};
|
|
1625
|
-
export { DataGrid as D, getGridComponentsDictionary as g, initialPagerState as i };
|
|
1620
|
+
export { DataGrid as D, getGridComponentsDictionary as g };
|
|
@@ -1,5 +1,5 @@
|
|
|
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";
|
|
@@ -11,7 +11,6 @@ import { D as DateFormatter } from "../DataGrid/formatters/DateFormatter/index.j
|
|
|
11
11
|
import { R as ReactJson } from "../../react-json-view.js";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { u as useModal } from "../../hooks/useModal/index.js";
|
|
14
|
-
import { a as usePaginate } from "../../vendor.js";
|
|
15
14
|
const Container$1 = styled("div")(() => ({
|
|
16
15
|
height: "100%",
|
|
17
16
|
width: "100%",
|
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/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,11 +12,11 @@ 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
22
|
import "date-fns";
|
|
@@ -68,67 +68,4 @@ function useResponsiveDesktop() {
|
|
|
68
68
|
const isDesktop = useResponsive("up", "sm");
|
|
69
69
|
return isDesktop;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
const { endPoint, timeout = 5e3, queryParams = {}, fireOnEnter = true } = props;
|
|
73
|
-
const [refresh, setRefresh] = useState(0);
|
|
74
|
-
const [rows, setRows] = useState([]);
|
|
75
|
-
const [pagerState, setPagerState] = useState(initialPagerState);
|
|
76
|
-
const refPagerState = useRef(initialPagerState);
|
|
77
|
-
const [fire, setFire] = useState(fireOnEnter);
|
|
78
|
-
const { startProgress, stopProgress } = useHostTools();
|
|
79
|
-
const { networkOperation } = useNetwork();
|
|
80
|
-
const Refresh = useCallback(() => {
|
|
81
|
-
setRefresh((oldValue) => oldValue + 1);
|
|
82
|
-
}, []);
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
let mounted = true;
|
|
85
|
-
if (!fire) {
|
|
86
|
-
setFire(true);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
startProgress();
|
|
90
|
-
networkOperation({
|
|
91
|
-
method: "GET",
|
|
92
|
-
endPoint,
|
|
93
|
-
timeout,
|
|
94
|
-
parms: {
|
|
95
|
-
...queryParams,
|
|
96
|
-
page: refPagerState.current.page,
|
|
97
|
-
limit: refPagerState.current.rowsPerPage
|
|
98
|
-
}
|
|
99
|
-
}).then((response) => {
|
|
100
|
-
if (mounted) {
|
|
101
|
-
setRows(response.data);
|
|
102
|
-
refPagerState.current.page = response.pager.page;
|
|
103
|
-
setPagerState((oldPagerState) => ({
|
|
104
|
-
...oldPagerState,
|
|
105
|
-
page: response.pager.page,
|
|
106
|
-
totalRecords: response.pager.total
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
|
-
}).finally(() => {
|
|
110
|
-
if (mounted) {
|
|
111
|
-
stopProgress();
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
return function cleanUp() {
|
|
115
|
-
stopProgress();
|
|
116
|
-
mounted = false;
|
|
117
|
-
};
|
|
118
|
-
}, [refresh, queryParams]);
|
|
119
|
-
const onPageChange = (newPage) => {
|
|
120
|
-
refPagerState.current.page = newPage;
|
|
121
|
-
setRefresh((oldValue) => oldValue + 1);
|
|
122
|
-
};
|
|
123
|
-
const onRowsPerPageChange = (newRowsPerPage) => {
|
|
124
|
-
refPagerState.current.rowsPerPage = newRowsPerPage;
|
|
125
|
-
setPagerState((oldPagerState) => ({ ...oldPagerState, rowsPerPage: newRowsPerPage }));
|
|
126
|
-
setRefresh((oldValue) => oldValue + 1);
|
|
127
|
-
};
|
|
128
|
-
const clearRows = () => {
|
|
129
|
-
setRows([]);
|
|
130
|
-
setPagerState(initialPagerState);
|
|
131
|
-
};
|
|
132
|
-
return { onPageChange, onRowsPerPageChange, pagerState, rows, clearRows, Refresh };
|
|
133
|
-
};
|
|
134
|
-
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
|
-
};
|