@m4l/graphics 7.0.13 → 7.0.15
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.
|
@@ -1,73 +1,76 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { i as
|
|
3
|
-
import { useHostTools as
|
|
4
|
-
const
|
|
1
|
+
import { useState as s, useRef as j, useCallback as v, useEffect as u } from "react";
|
|
2
|
+
import { i as o } from "./types.js";
|
|
3
|
+
import { useHostTools as z, useNetwork as A, useModuleSkeleton as B, useModuleDictionary as I } from "@m4l/core";
|
|
4
|
+
const Z = (C) => {
|
|
5
5
|
const {
|
|
6
|
-
endPoint:
|
|
7
|
-
timeout:
|
|
8
|
-
queryParams:
|
|
9
|
-
fireOnChangeParms:
|
|
6
|
+
endPoint: R,
|
|
7
|
+
timeout: S = 5e3,
|
|
8
|
+
queryParams: c,
|
|
9
|
+
fireOnChangeParms: P,
|
|
10
10
|
// Propiedad para permitir que un cambio en los parametros de la consulta dispare la recarga de la red
|
|
11
|
-
fireOnFirstLoad:
|
|
11
|
+
fireOnFirstLoad: k = !0,
|
|
12
12
|
// propiedad que evita que se cargue la red la en el primer render del hook
|
|
13
|
-
rowsPerPage:
|
|
14
|
-
startProgress:
|
|
15
|
-
stopProgress:
|
|
16
|
-
isRemote:
|
|
17
|
-
bodyToSnakeCase:
|
|
18
|
-
responseToCamelCase:
|
|
19
|
-
initialRows:
|
|
20
|
-
externalCondition:
|
|
21
|
-
onNetworkError:
|
|
22
|
-
|
|
23
|
-
} =
|
|
13
|
+
rowsPerPage: l = o.rowsPerPage,
|
|
14
|
+
startProgress: y,
|
|
15
|
+
stopProgress: O,
|
|
16
|
+
isRemote: T = !0,
|
|
17
|
+
bodyToSnakeCase: b = !1,
|
|
18
|
+
responseToCamelCase: E = !1,
|
|
19
|
+
initialRows: L = [],
|
|
20
|
+
externalCondition: f = !0,
|
|
21
|
+
onNetworkError: p,
|
|
22
|
+
refreshOnChangeDictionary: m = !1
|
|
23
|
+
} = C, [h, g] = s(P ? 1 : 0), [x, a] = s(L), [D, n] = s({ ...o, rowsPerPage: l }), t = j({ ...o, rowsPerPage: l }), [F, M] = s(k), [N, w] = s(!1), { startProgress: Q, stopProgress: q } = z(), { networkOperation: G } = A(), d = B(), { getLabel: H } = I(), i = v(() => {
|
|
24
24
|
g((r) => r + 1);
|
|
25
25
|
}, []);
|
|
26
|
-
return
|
|
26
|
+
return u(() => {
|
|
27
27
|
if (F) {
|
|
28
|
-
|
|
28
|
+
M(!1);
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
t.current.page = 0,
|
|
32
|
-
}, [
|
|
31
|
+
t.current.page = 0, P && i();
|
|
32
|
+
}, [c]), u(() => {
|
|
33
33
|
let r = !0;
|
|
34
|
-
if (!(!
|
|
35
|
-
return
|
|
34
|
+
if (!(!f || h === 0))
|
|
35
|
+
return w(!0), G({
|
|
36
36
|
method: "GET",
|
|
37
|
-
endPoint:
|
|
38
|
-
timeout:
|
|
37
|
+
endPoint: R,
|
|
38
|
+
timeout: S,
|
|
39
39
|
parms: {
|
|
40
|
-
...
|
|
40
|
+
...c,
|
|
41
41
|
page: t.current.page,
|
|
42
42
|
limit: t.current.rowsPerPage
|
|
43
43
|
},
|
|
44
|
-
bodyToSnakeCase:
|
|
45
|
-
responseToCamelCase:
|
|
44
|
+
bodyToSnakeCase: b,
|
|
45
|
+
responseToCamelCase: E,
|
|
46
46
|
options: {
|
|
47
|
-
startProgress:
|
|
48
|
-
stopProgress:
|
|
47
|
+
startProgress: y || Q,
|
|
48
|
+
stopProgress: O || q
|
|
49
49
|
},
|
|
50
|
-
isRemote:
|
|
50
|
+
isRemote: T
|
|
51
51
|
}).then((e) => {
|
|
52
|
-
r && (a(e.data), t.current.page = e.pager.page,
|
|
53
|
-
...
|
|
52
|
+
r && (a(e.data), t.current.page = e.pager.page, n((U) => ({
|
|
53
|
+
...U,
|
|
54
54
|
page: e.pager.page,
|
|
55
|
-
// rowsPerPage: response.pager.limit,
|
|
56
55
|
totalRecords: e.pager.total
|
|
57
56
|
})));
|
|
58
57
|
}).catch((e) => {
|
|
59
|
-
a([]), o
|
|
58
|
+
a([]), n(o), p && p(e.status);
|
|
59
|
+
}).finally(() => {
|
|
60
|
+
w(!1);
|
|
60
61
|
}), function() {
|
|
61
62
|
r = !1;
|
|
62
63
|
};
|
|
63
|
-
}, [
|
|
64
|
+
}, [h, f]), u(() => {
|
|
65
|
+
!d && m && i();
|
|
66
|
+
}, [H, m, d]), { onPageChange: (r) => {
|
|
64
67
|
t.current.page = r, g((e) => e + 1);
|
|
65
68
|
}, onRowsPerPageChange: (r) => {
|
|
66
|
-
t.current.rowsPerPage = r,
|
|
67
|
-
}, pagerState:
|
|
68
|
-
a([]), o
|
|
69
|
-
}, Refresh:
|
|
69
|
+
t.current.rowsPerPage = r, n((e) => ({ ...e, rowsPerPage: r })), g((e) => e + 1);
|
|
70
|
+
}, pagerState: D, rows: x, clearRows: () => {
|
|
71
|
+
a([]), n(o);
|
|
72
|
+
}, Refresh: i, setRows: a, loading: N };
|
|
70
73
|
};
|
|
71
74
|
export {
|
|
72
|
-
|
|
75
|
+
Z as u
|
|
73
76
|
};
|
|
@@ -13,5 +13,9 @@ export interface UsePaginateProps<TRow> extends Pick<NetworkProps, 'endPoint' |
|
|
|
13
13
|
initialRows?: TRow[];
|
|
14
14
|
externalCondition?: boolean;
|
|
15
15
|
onNetworkError?: (code: number) => void;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated This property is not used
|
|
18
|
+
*/
|
|
16
19
|
getLabel?: GetLabelType;
|
|
20
|
+
refreshOnChangeDictionary?: boolean;
|
|
17
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/graphics",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.15",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team*",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"date-fns": "^2.30.0",
|
|
15
|
-
"immer": "^9.0.21",
|
|
16
15
|
"lodash-es": "^4.17.21",
|
|
17
16
|
"zustand": "4.3.6"
|
|
18
17
|
},
|