@m4l/core 2.0.2 → 2.0.4
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/contexts/AuthContext/constants.d.ts +5 -0
- package/contexts/AuthContext/index.d.ts +1 -1
- package/contexts/AuthContext/index.dd2ed9e6.js +137 -0
- package/contexts/AuthContext/types.d.ts +17 -18
- package/contexts/BaseContext/index.d.ts +1 -0
- package/contexts/DomainContext/index.d.ts +1 -0
- package/contexts/DomainCountryContext/index.3cdf9462.js +46 -0
- package/contexts/DomainCountryContext/index.d.ts +1 -0
- package/contexts/EnvironmentContext/index.d.ts +1 -0
- package/contexts/FlagsContext/index.d.ts +1 -0
- package/contexts/HostToolsContext/index.d.ts +1 -0
- package/contexts/ModuleDictionaryContext/index.63e1dbbd.js +74 -0
- package/contexts/ModuleDictionaryContext/index.d.ts +1 -0
- package/contexts/ModulePrivilegesContext/index.1274092a.js +52 -0
- package/contexts/ModulePrivilegesContext/index.d.ts +1 -0
- package/contexts/ModuleSkeletonContext/index.9267d86a.js +20 -0
- package/contexts/ModuleSkeletonContext/index.d.ts +1 -0
- package/contexts/NetworkContext/index.d.ts +1 -0
- package/contexts/index.d.ts +1 -1
- package/hooks/useAuth/index.94b696a7.js +11 -0
- package/hooks/useAuth/useAuth.d.ts +1 -1
- package/hooks/useDomain/{index.be2722d9.js → index.dd6909f6.js} +1 -1
- package/hooks/useModuleDictionary/{index.9004a259.js → index.80b52ae5.js} +1 -1
- package/hooks/useModulePrivileges/{index.6ebd7c42.js → index.e93abed8.js} +1 -1
- package/hooks/useModuleSkeleton/{index.1cdf5081.js → index.a8238d1d.js} +1 -1
- package/hooks/usePaginate/index.0a5d70e5.js +74 -0
- package/hooks/usePaginate/index.d.ts +1 -0
- package/hooks/usePaginate/types.d.ts +2 -0
- package/index.js +66 -66
- package/package.json +1 -1
- package/types/dictionary.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/utils/getPropertyByString/index.d.ts +3 -1
- package/utils/index.54ccec2f.js +61 -0
- package/vite-env.d.ts +4 -4
- package/contexts/AuthContext/index.db46edbc.js +0 -150
- package/contexts/DomainCountryContext/index.506456a3.js +0 -57
- package/contexts/ModuleDictionaryContext/index.a64207d4.js +0 -81
- package/contexts/ModulePrivilegesContext/index.79c3cc04.js +0 -62
- package/contexts/ModuleSkeletonContext/index.f6150fb9.js +0 -30
- package/hooks/useAuth/index.4154d394.js +0 -21
- package/hooks/usePaginate/index.1306b0de.js +0 -70
- package/utils/index.2f5ce5aa.js +0 -65
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { useState as s, useRef as G, useCallback as H, useEffect as p } from "react";
|
|
2
|
-
import { u as L } from "../useHostTools/index.66d9a667.js";
|
|
3
|
-
import { u as N } from "../useNetwork/index.3d79002b.js";
|
|
4
|
-
const a = {
|
|
5
|
-
page: 0,
|
|
6
|
-
rowsPerPage: 25,
|
|
7
|
-
totalRecords: 0
|
|
8
|
-
}, D = (l) => {
|
|
9
|
-
const {
|
|
10
|
-
endPoint: m,
|
|
11
|
-
timeout: w = 5e3,
|
|
12
|
-
queryParams: P,
|
|
13
|
-
fireOnChangeParms: i,
|
|
14
|
-
fireOnFirstLoad: h = !0,
|
|
15
|
-
rowsPerPage: u = a.rowsPerPage,
|
|
16
|
-
startProgress: R,
|
|
17
|
-
stopProgress: C,
|
|
18
|
-
isRemote: d = !0,
|
|
19
|
-
bodyToSnakeCase: S = !1,
|
|
20
|
-
responseToCamelCase: k = !1,
|
|
21
|
-
initialRows: y = []
|
|
22
|
-
} = l, [c, o] = s(i ? 1 : 0), [T, n] = s(y), [O, g] = s({ ...a, rowsPerPage: u }), t = G({ ...a, rowsPerPage: u }), [b, E] = s(h), { startProgress: F, stopProgress: Q } = L(), { networkOperation: q } = N(), f = H(() => {
|
|
23
|
-
o((r) => r + 1);
|
|
24
|
-
}, []);
|
|
25
|
-
return p(() => {
|
|
26
|
-
if (b) {
|
|
27
|
-
E(!1);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
i && f();
|
|
31
|
-
}, [P]), p(() => {
|
|
32
|
-
let r = !0;
|
|
33
|
-
if (c !== 0)
|
|
34
|
-
return q({
|
|
35
|
-
method: "GET",
|
|
36
|
-
endPoint: m,
|
|
37
|
-
timeout: w,
|
|
38
|
-
parms: {
|
|
39
|
-
...P,
|
|
40
|
-
page: t.current.page,
|
|
41
|
-
limit: t.current.rowsPerPage
|
|
42
|
-
},
|
|
43
|
-
bodyToSnakeCase: S,
|
|
44
|
-
responseToCamelCase: k,
|
|
45
|
-
options: {
|
|
46
|
-
startProgress: R || F,
|
|
47
|
-
stopProgress: C || Q
|
|
48
|
-
},
|
|
49
|
-
isRemote: d
|
|
50
|
-
}).then((e) => {
|
|
51
|
-
r && (n(e.data), t.current.page = e.pager.page, g((x) => ({
|
|
52
|
-
...x,
|
|
53
|
-
page: e.pager.page,
|
|
54
|
-
totalRecords: e.pager.total
|
|
55
|
-
})));
|
|
56
|
-
}), function() {
|
|
57
|
-
r = !1;
|
|
58
|
-
};
|
|
59
|
-
}, [c]), { onPageChange: (r) => {
|
|
60
|
-
t.current.page = r, o((e) => e + 1);
|
|
61
|
-
}, onRowsPerPageChange: (r) => {
|
|
62
|
-
t.current.rowsPerPage = r, g((e) => ({ ...e, rowsPerPage: r })), o((e) => e + 1);
|
|
63
|
-
}, pagerState: O, rows: T, clearRows: () => {
|
|
64
|
-
n([]), g(a);
|
|
65
|
-
}, Refresh: f, setRows: n };
|
|
66
|
-
};
|
|
67
|
-
export {
|
|
68
|
-
a as i,
|
|
69
|
-
D as u
|
|
70
|
-
};
|
package/utils/index.2f5ce5aa.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
import "qs";
|
|
3
|
-
import "camelcase-keys";
|
|
4
|
-
import "snakecase-keys";
|
|
5
|
-
function y() {
|
|
6
|
-
}
|
|
7
|
-
function p(n, e) {
|
|
8
|
-
const r = e.split(".");
|
|
9
|
-
let t = n;
|
|
10
|
-
for (const o of r) {
|
|
11
|
-
const a = o.match(/^(\w+)\[(\w+)\]$/);
|
|
12
|
-
if (a) {
|
|
13
|
-
const s = a[1], c = a[2];
|
|
14
|
-
if (t[s] && Array.isArray(t[s])) {
|
|
15
|
-
if (c === "lastIndex")
|
|
16
|
-
return t[s][t[s].length - 1];
|
|
17
|
-
{
|
|
18
|
-
const i = parseInt(c);
|
|
19
|
-
return t[s][i];
|
|
20
|
-
}
|
|
21
|
-
} else
|
|
22
|
-
return;
|
|
23
|
-
} else if (t[o] !== void 0)
|
|
24
|
-
t = t[o];
|
|
25
|
-
else
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
return t;
|
|
29
|
-
}
|
|
30
|
-
function d(n, e) {
|
|
31
|
-
try {
|
|
32
|
-
const t = new Function(...Object.keys(n), `return \`${e}\``)(...Object.values(n));
|
|
33
|
-
return String(t).replace(/`/g, "");
|
|
34
|
-
} catch (r) {
|
|
35
|
-
return console.error(`Error evaluating expression: ${r}`), "";
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function m(n, e) {
|
|
39
|
-
try {
|
|
40
|
-
const r = window.localStorage.getItem(n);
|
|
41
|
-
return r !== null ? typeof e == "string" ? r : JSON.parse(r) : e;
|
|
42
|
-
} catch {
|
|
43
|
-
return e;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function v(n, e, r = !1) {
|
|
47
|
-
try {
|
|
48
|
-
let t = null;
|
|
49
|
-
if (typeof e == "string") {
|
|
50
|
-
window.localStorage.setItem(n, e);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
r && (t = window.localStorage.getItem(n));
|
|
54
|
-
let o = t !== null ? JSON.parse(t) : {};
|
|
55
|
-
o = { ...o, ...e }, window.localStorage.setItem(n, JSON.stringify(o));
|
|
56
|
-
} catch {
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export {
|
|
60
|
-
p as a,
|
|
61
|
-
d as e,
|
|
62
|
-
m as g,
|
|
63
|
-
v as s,
|
|
64
|
-
y as v
|
|
65
|
-
};
|