@m4l/core 0.1.39 → 0.1.41
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/DomainCountryContext/{index.85791bcb.js → index.d994d34d.js} +3 -3
- package/contexts/ModuleDictionaryContext/{index.b7c026b1.js → index.2bea2f5a.js} +31 -31
- package/contexts/ModulePrivilegesContext/{index.7abed4dc.js → index.dbac0629.js} +3 -3
- package/contexts/ModuleSkeletonContext/{index.18801a35.js → index.cefdbe76.js} +3 -3
- package/hooks/useDomain/{index.9e5dc4a4.js → index.5d407979.js} +1 -1
- package/hooks/useModuleDictionary/{index.93177cf8.js → index.74058055.js} +1 -1
- package/hooks/useModulePrivileges/{index.4b22874b.js → index.a2c70907.js} +1 -1
- package/hooks/useModuleSkeleton/{index.0429108c.js → index.ac23278e.js} +1 -1
- package/hooks/usePaginate/index.d4437ef6.js +62 -0
- package/hooks/usePaginate/types.d.ts +2 -1
- package/index.js +20 -19
- package/package.json +3 -3
- package/types/index.d.ts +2 -0
- package/utils/axiosOperation/types.d.ts +4 -0
- package/utils/{axiosOperation.5a823aca.js → axiosOperation.e428c3b5.js} +22 -22
- package/utils/evaluateWithContext/index.d.ts +7 -0
- package/utils/getPropertyByString/index.d.ts +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.ee07ca4a.js +63 -0
- package/hooks/usePaginate/index.7cb17527.js +0 -58
- package/utils/index.8c4b528d.js +0 -40
|
@@ -4,9 +4,9 @@ import "../EnvironmentContext/index.7045c64f.js";
|
|
|
4
4
|
import "../FlagsContext/index.5f795859.js";
|
|
5
5
|
import { u as T } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
6
6
|
import "../DomainContext/index.8d81b39c.js";
|
|
7
|
-
import "../ModuleDictionaryContext/index.
|
|
8
|
-
import "../ModulePrivilegesContext/index.
|
|
9
|
-
import "../ModuleSkeletonContext/index.
|
|
7
|
+
import "../ModuleDictionaryContext/index.2bea2f5a.js";
|
|
8
|
+
import "../ModulePrivilegesContext/index.dbac0629.js";
|
|
9
|
+
import "../ModuleSkeletonContext/index.cefdbe76.js";
|
|
10
10
|
import "../NetworkContext/index.d1dfbc3a.js";
|
|
11
11
|
import { u as f } from "../../hooks/usePropageteMF/index.c440b829.js";
|
|
12
12
|
import { E as i } from "../../types/index.42c24946.js";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { createContext as y, useState as F, useEffect as L, useCallback as
|
|
1
|
+
import { createContext as y, useState as F, useEffect as L, useCallback as s } from "react";
|
|
2
2
|
import "../BaseContext/index.f9cdc955.js";
|
|
3
3
|
import { u as M } from "../../hooks/useEnvironment/index.04dca988.js";
|
|
4
4
|
import { u as N } from "../../hooks/useFlags/index.a986729d.js";
|
|
5
5
|
import { u as P } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
6
6
|
import "../DomainContext/index.8d81b39c.js";
|
|
7
|
-
import "../ModulePrivilegesContext/index.
|
|
8
|
-
import "../ModuleSkeletonContext/index.
|
|
7
|
+
import "../ModulePrivilegesContext/index.dbac0629.js";
|
|
8
|
+
import "../ModuleSkeletonContext/index.cefdbe76.js";
|
|
9
9
|
import { u as _ } from "../../hooks/useNetwork/index.acbf28d5.js";
|
|
10
|
-
import "../DomainCountryContext/index.
|
|
10
|
+
import "../DomainCountryContext/index.d994d34d.js";
|
|
11
11
|
import { C as x } from "../../types/index.42c24946.js";
|
|
12
12
|
import { jsx as A } from "react/jsx-runtime";
|
|
13
13
|
const E = y(null);
|
|
14
|
-
function
|
|
14
|
+
function U(a) {
|
|
15
15
|
const {
|
|
16
|
-
children:
|
|
17
|
-
componentsDictionary:
|
|
18
|
-
moduleId:
|
|
19
|
-
moduleNameField:
|
|
20
|
-
currentLang:
|
|
21
|
-
isAuth:
|
|
22
|
-
} =
|
|
16
|
+
children: u,
|
|
17
|
+
componentsDictionary: l,
|
|
18
|
+
moduleId: m,
|
|
19
|
+
moduleNameField: i = "module_name",
|
|
20
|
+
currentLang: c = "en",
|
|
21
|
+
isAuth: d = !0
|
|
22
|
+
} = a, {
|
|
23
23
|
addFlag: p
|
|
24
24
|
} = N(), [r, f] = F(void 0), {
|
|
25
25
|
domain_token: g
|
|
@@ -30,49 +30,49 @@ function Y(u) {
|
|
|
30
30
|
networkOperation: v
|
|
31
31
|
} = _();
|
|
32
32
|
L(() => {
|
|
33
|
-
let
|
|
33
|
+
let o = !0;
|
|
34
34
|
return D(), v({
|
|
35
35
|
method: "GET",
|
|
36
|
-
endPoint:
|
|
36
|
+
endPoint: `na/dictionaries/${m}`,
|
|
37
37
|
parms: {
|
|
38
|
-
comps:
|
|
39
|
-
...
|
|
38
|
+
comps: l,
|
|
39
|
+
...d ? {} : {
|
|
40
40
|
domain_token: g
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
}).then((
|
|
44
|
-
|
|
45
|
-
...
|
|
46
|
-
}), p(x.FLAG_DICTIONARY_LOADED));
|
|
43
|
+
}).then((t) => {
|
|
44
|
+
o && (f({
|
|
45
|
+
...t
|
|
46
|
+
}), console.log("se actualizaron los diccionarios...."), p(x.FLAG_DICTIONARY_LOADED));
|
|
47
47
|
}).finally(() => {
|
|
48
48
|
h();
|
|
49
49
|
}), function() {
|
|
50
|
-
|
|
50
|
+
o = !1;
|
|
51
51
|
};
|
|
52
|
-
}, [
|
|
53
|
-
const n =
|
|
52
|
+
}, [c]);
|
|
53
|
+
const n = s((o) => {
|
|
54
54
|
if (r === void 0)
|
|
55
55
|
return "";
|
|
56
|
-
if (
|
|
56
|
+
if (o === "")
|
|
57
57
|
return "No key";
|
|
58
|
-
let
|
|
59
|
-
const e =
|
|
58
|
+
let t;
|
|
59
|
+
const e = o.split(".");
|
|
60
60
|
try {
|
|
61
|
-
e.length === 1 && (
|
|
61
|
+
e.length === 1 && (t = r.data[o]), e.length === 2 && (t = r[e[0]][e[1]]);
|
|
62
62
|
} catch {
|
|
63
63
|
}
|
|
64
|
-
return
|
|
65
|
-
}, [r]), C =
|
|
64
|
+
return t || `N_D:[${o}]`;
|
|
65
|
+
}, [r]), C = s(() => n(i), [i, n]);
|
|
66
66
|
return /* @__PURE__ */ A(E.Provider, {
|
|
67
67
|
value: {
|
|
68
68
|
moduleDictionary: r,
|
|
69
69
|
getLabel: n,
|
|
70
70
|
getModuleLabel: C
|
|
71
71
|
},
|
|
72
|
-
children:
|
|
72
|
+
children: u
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
export {
|
|
76
76
|
E as M,
|
|
77
|
-
|
|
77
|
+
U as a
|
|
78
78
|
};
|
|
@@ -4,10 +4,10 @@ import "../EnvironmentContext/index.7045c64f.js";
|
|
|
4
4
|
import { u as v } from "../../hooks/useFlags/index.a986729d.js";
|
|
5
5
|
import { u as E } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
6
6
|
import "../DomainContext/index.8d81b39c.js";
|
|
7
|
-
import "../ModuleDictionaryContext/index.
|
|
8
|
-
import "../ModuleSkeletonContext/index.
|
|
7
|
+
import "../ModuleDictionaryContext/index.2bea2f5a.js";
|
|
8
|
+
import "../ModuleSkeletonContext/index.cefdbe76.js";
|
|
9
9
|
import { u as h } from "../../hooks/useNetwork/index.acbf28d5.js";
|
|
10
|
-
import "../DomainCountryContext/index.
|
|
10
|
+
import "../DomainCountryContext/index.d994d34d.js";
|
|
11
11
|
import { C as i } from "../../types/index.42c24946.js";
|
|
12
12
|
import { jsx as L } from "react/jsx-runtime";
|
|
13
13
|
const C = f(null);
|
|
@@ -4,10 +4,10 @@ import "../EnvironmentContext/index.7045c64f.js";
|
|
|
4
4
|
import { a as m } from "../../hooks/useFlags/index.a986729d.js";
|
|
5
5
|
import "../HostToolsContext/index.499db832.js";
|
|
6
6
|
import "../DomainContext/index.8d81b39c.js";
|
|
7
|
-
import "../ModuleDictionaryContext/index.
|
|
8
|
-
import "../ModulePrivilegesContext/index.
|
|
7
|
+
import "../ModuleDictionaryContext/index.2bea2f5a.js";
|
|
8
|
+
import "../ModulePrivilegesContext/index.dbac0629.js";
|
|
9
9
|
import "../NetworkContext/index.d1dfbc3a.js";
|
|
10
|
-
import "../DomainCountryContext/index.
|
|
10
|
+
import "../DomainCountryContext/index.d994d34d.js";
|
|
11
11
|
import { jsx as n } from "react/jsx-runtime";
|
|
12
12
|
const p = i(null);
|
|
13
13
|
function P(o) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext as t } from "react";
|
|
2
2
|
import { D as n } from "../../contexts/DomainContext/index.8d81b39c.js";
|
|
3
|
-
import { D as e } from "../../contexts/DomainCountryContext/index.
|
|
3
|
+
import { D as e } from "../../contexts/DomainCountryContext/index.d994d34d.js";
|
|
4
4
|
const m = () => {
|
|
5
5
|
const o = t(n);
|
|
6
6
|
if (!o)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState as n, useContext as s, useEffect as u } from "react";
|
|
2
|
-
import { M as r } from "../../contexts/ModuleSkeletonContext/index.
|
|
2
|
+
import { M as r } from "../../contexts/ModuleSkeletonContext/index.cefdbe76.js";
|
|
3
3
|
const S = () => {
|
|
4
4
|
const [t, o] = n(!0), e = s(r);
|
|
5
5
|
if (!e)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useState as s, useRef as T, useCallback as b, useEffect as f } from "react";
|
|
2
|
+
import { u as q } from "../useHostTools/index.66d9a667.js";
|
|
3
|
+
import { u as x } from "../useNetwork/index.acbf28d5.js";
|
|
4
|
+
const a = {
|
|
5
|
+
page: 0,
|
|
6
|
+
rowsPerPage: 25,
|
|
7
|
+
totalRecords: 0
|
|
8
|
+
}, v = (m) => {
|
|
9
|
+
const {
|
|
10
|
+
endPoint: l,
|
|
11
|
+
timeout: h = 5e3,
|
|
12
|
+
queryParams: g,
|
|
13
|
+
fireOnChangeParms: P,
|
|
14
|
+
rowsPerPage: c = a.rowsPerPage,
|
|
15
|
+
startProgress: w,
|
|
16
|
+
stopProgress: R
|
|
17
|
+
} = m, [u, o] = s(P ? 1 : 0), [S, i] = s([]), [d, n] = s({ ...a, rowsPerPage: c }), t = T({ ...a, rowsPerPage: c }), [C, k] = s(!0), { startProgress: y, stopProgress: E } = q(), { networkOperation: O } = x(), p = b(() => {
|
|
18
|
+
o((r) => r + 1);
|
|
19
|
+
}, []);
|
|
20
|
+
return f(() => {
|
|
21
|
+
if (C) {
|
|
22
|
+
k(!1);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
P && p();
|
|
26
|
+
}, [g]), f(() => {
|
|
27
|
+
let r = !0;
|
|
28
|
+
if (u !== 0)
|
|
29
|
+
return O({
|
|
30
|
+
method: "GET",
|
|
31
|
+
endPoint: l,
|
|
32
|
+
timeout: h,
|
|
33
|
+
parms: {
|
|
34
|
+
...g,
|
|
35
|
+
page: t.current.page,
|
|
36
|
+
limit: t.current.rowsPerPage
|
|
37
|
+
},
|
|
38
|
+
options: {
|
|
39
|
+
startProgress: w || y,
|
|
40
|
+
stopProgress: R || E
|
|
41
|
+
}
|
|
42
|
+
}).then((e) => {
|
|
43
|
+
r && (i(e.data), t.current.page = e.pager.page, n((Q) => ({
|
|
44
|
+
...Q,
|
|
45
|
+
page: e.pager.page,
|
|
46
|
+
totalRecords: e.pager.total
|
|
47
|
+
})));
|
|
48
|
+
}), function() {
|
|
49
|
+
r = !1;
|
|
50
|
+
};
|
|
51
|
+
}, [u]), { onPageChange: (r) => {
|
|
52
|
+
t.current.page = r, o((e) => e + 1);
|
|
53
|
+
}, onRowsPerPageChange: (r) => {
|
|
54
|
+
t.current.rowsPerPage = r, n((e) => ({ ...e, rowsPerPage: r })), o((e) => e + 1);
|
|
55
|
+
}, pagerState: d, rows: S, clearRows: () => {
|
|
56
|
+
i([]), n(a);
|
|
57
|
+
}, Refresh: p };
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
a as i,
|
|
61
|
+
v as u
|
|
62
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { AxiosOptions } from '../../utils/axiosOperation/types';
|
|
1
2
|
export declare interface PagerState {
|
|
2
3
|
page: number;
|
|
3
4
|
rowsPerPage: number;
|
|
4
5
|
totalRecords: number;
|
|
5
6
|
}
|
|
6
7
|
export declare const initialPagerState: PagerState;
|
|
7
|
-
export interface UsePaginateProps {
|
|
8
|
+
export interface UsePaginateProps extends AxiosOptions {
|
|
8
9
|
endPoint: string;
|
|
9
10
|
timeout?: number;
|
|
10
11
|
fireOnChangeParms?: boolean;
|
package/index.js
CHANGED
|
@@ -2,28 +2,28 @@ import "react";
|
|
|
2
2
|
import { B as i, a as n } from "./contexts/BaseContext/index.f9cdc955.js";
|
|
3
3
|
import { E as u, a as x } from "./contexts/EnvironmentContext/index.7045c64f.js";
|
|
4
4
|
import { F as l, a as f } from "./contexts/FlagsContext/index.5f795859.js";
|
|
5
|
-
import { H as
|
|
5
|
+
import { H as v, a as g } from "./contexts/HostToolsContext/index.499db832.js";
|
|
6
6
|
import { D as C, a as M } from "./contexts/DomainContext/index.8d81b39c.js";
|
|
7
|
-
import { M as S, a as c } from "./contexts/ModuleDictionaryContext/index.
|
|
8
|
-
import { M as F, a as E } from "./contexts/ModulePrivilegesContext/index.
|
|
9
|
-
import { M as B, a as L } from "./contexts/ModuleSkeletonContext/index.
|
|
7
|
+
import { M as S, a as c } from "./contexts/ModuleDictionaryContext/index.2bea2f5a.js";
|
|
8
|
+
import { M as F, a as E } from "./contexts/ModulePrivilegesContext/index.dbac0629.js";
|
|
9
|
+
import { M as B, a as L } from "./contexts/ModuleSkeletonContext/index.cefdbe76.js";
|
|
10
10
|
import { N, a as w } from "./contexts/NetworkContext/index.d1dfbc3a.js";
|
|
11
|
-
import { D as h, a as
|
|
11
|
+
import { D as h, a as W } from "./contexts/DomainCountryContext/index.d994d34d.js";
|
|
12
12
|
import { u as b } from "./hooks/useBase/index.4375dcef.js";
|
|
13
13
|
import { u as q } from "./hooks/useEnvironment/index.04dca988.js";
|
|
14
14
|
import { u as A, a as G } from "./hooks/useFlags/index.a986729d.js";
|
|
15
15
|
import { u as J } from "./hooks/useHostTools/index.66d9a667.js";
|
|
16
|
-
import { u as Q, a as R } from "./hooks/useDomain/index.
|
|
16
|
+
import { u as Q, a as R } from "./hooks/useDomain/index.5d407979.js";
|
|
17
17
|
import { u as V, a as X } from "./hooks/useLocalStorage/index.48b47dca.js";
|
|
18
|
-
import { u as Z } from "./hooks/useModuleDictionary/index.
|
|
19
|
-
import { u as $ } from "./hooks/useModulePrivileges/index.
|
|
20
|
-
import { u as eo } from "./hooks/useModuleSkeleton/index.
|
|
18
|
+
import { u as Z } from "./hooks/useModuleDictionary/index.74058055.js";
|
|
19
|
+
import { u as $ } from "./hooks/useModulePrivileges/index.a2c70907.js";
|
|
20
|
+
import { u as eo } from "./hooks/useModuleSkeleton/index.ac23278e.js";
|
|
21
21
|
import { u as ao } from "./hooks/useNetwork/index.acbf28d5.js";
|
|
22
|
-
import { i as so, u as io } from "./hooks/usePaginate/index.
|
|
22
|
+
import { i as so, u as io } from "./hooks/usePaginate/index.d4437ef6.js";
|
|
23
23
|
import { u as mo } from "./hooks/usePropageteMF/index.c440b829.js";
|
|
24
24
|
import { C as xo, E as po } from "./types/index.42c24946.js";
|
|
25
|
-
import {
|
|
26
|
-
import { a as
|
|
25
|
+
import { e as fo, a as vo, g as go, s as Po, v as Co } from "./utils/index.ee07ca4a.js";
|
|
26
|
+
import { a as Do } from "./utils/axiosOperation.e428c3b5.js";
|
|
27
27
|
import "react/jsx-runtime";
|
|
28
28
|
import "axios";
|
|
29
29
|
import "qs";
|
|
@@ -33,15 +33,15 @@ export {
|
|
|
33
33
|
xo as CommonFlags,
|
|
34
34
|
C as DomainContext,
|
|
35
35
|
h as DomainCountryContext,
|
|
36
|
-
|
|
36
|
+
W as DomainCountryProvider,
|
|
37
37
|
M as DomainProvider,
|
|
38
38
|
po as EmitEvents,
|
|
39
39
|
u as EnvironmentContext,
|
|
40
40
|
x as EnvironmentProvider,
|
|
41
41
|
l as FlagsContext,
|
|
42
42
|
f as FlagsProvider,
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
v as HostToolsContext,
|
|
44
|
+
g as HostToolsProvider,
|
|
45
45
|
S as ModuleDictionaryContext,
|
|
46
46
|
c as ModuleDictionaryProvider,
|
|
47
47
|
F as ModulePrivilegesContext,
|
|
@@ -50,11 +50,12 @@ export {
|
|
|
50
50
|
L as ModuleSkeletonProvider,
|
|
51
51
|
N as NetworkContext,
|
|
52
52
|
w as NetworkProvider,
|
|
53
|
-
|
|
54
|
-
fo as
|
|
53
|
+
Do as axiosOperation,
|
|
54
|
+
fo as evaluateWithContext,
|
|
55
|
+
vo as getLocalStorage,
|
|
55
56
|
go as getPropertyByString,
|
|
56
57
|
so as initialPagerState,
|
|
57
|
-
|
|
58
|
+
Po as setLocalStorage,
|
|
58
59
|
b as useBase,
|
|
59
60
|
Q as useDomain,
|
|
60
61
|
R as useDomainCountry,
|
|
@@ -70,5 +71,5 @@ export {
|
|
|
70
71
|
ao as useNetwork,
|
|
71
72
|
io as usePaginate,
|
|
72
73
|
mo as usePropageteMF,
|
|
73
|
-
|
|
74
|
+
Co as voidFunction
|
|
74
75
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.41",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team",
|
|
6
|
+
"private": false,
|
|
6
7
|
"peerDependencies": {
|
|
7
8
|
"@types/nprogress": "^0.2.0",
|
|
8
9
|
"@types/qs": "^6.9.7",
|
|
@@ -27,6 +28,5 @@
|
|
|
27
28
|
},
|
|
28
29
|
"engines": {
|
|
29
30
|
"node": ">=12.0.0"
|
|
30
|
-
}
|
|
31
|
-
"private": false
|
|
31
|
+
}
|
|
32
32
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Id, ToastContent, ToastOptions } from 'react-toastify';
|
|
|
2
2
|
import type { BrowserHistory } from 'history';
|
|
3
3
|
import { ResponseType } from 'axios';
|
|
4
4
|
import { DomainCountry } from '../contexts';
|
|
5
|
+
import { AxiosOptions } from '../utils/axiosOperation/types';
|
|
5
6
|
export declare type Maybe<T> = T | undefined | null;
|
|
6
7
|
export declare interface EnvironmentType {
|
|
7
8
|
isLocalhost: boolean;
|
|
@@ -27,6 +28,7 @@ export declare type NetworkProps = {
|
|
|
27
28
|
isExternalUrl?: boolean;
|
|
28
29
|
responseType?: ResponseType;
|
|
29
30
|
signal?: AbortSignal;
|
|
31
|
+
options?: AxiosOptions;
|
|
30
32
|
};
|
|
31
33
|
export declare type ToastFunction = (content: ToastContent, options?: ToastOptions) => Id;
|
|
32
34
|
export declare enum EmmitEvents {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { E as
|
|
4
|
-
function
|
|
1
|
+
import $ from "axios";
|
|
2
|
+
import y from "qs";
|
|
3
|
+
import { E as R } from "../types/index.42c24946.js";
|
|
4
|
+
function j(e, s, a, i, o) {
|
|
5
5
|
const { toast: t } = a;
|
|
6
6
|
return i === "json" ? s && s.data && typeof s.data == "object" ? s.data.error && s.data.error?.code && s.data.error?.msg !== void 0 ? Promise.reject({ ...s.data.error, status: s.status }) : (s.data.messagen && o && t(s.data.message, { type: "success", autoClose: 1e4 }), s.data) : Promise.reject({
|
|
7
7
|
code: 1,
|
|
@@ -9,54 +9,54 @@ function v(e, s, a, i, o) {
|
|
|
9
9
|
status: s.status
|
|
10
10
|
}) : s.data;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function v(e, s, a = !0, i = !0) {
|
|
13
13
|
const { toast: o } = s;
|
|
14
14
|
let t = {
|
|
15
15
|
message: "",
|
|
16
16
|
status: 1,
|
|
17
17
|
code: 0
|
|
18
18
|
};
|
|
19
|
-
return e?.code !== void 0 && t.status !== void 0 && e.message !== void 0 && (t = { ...t, ...e }), e?.response ? e.response.data && typeof e.response.data == "object" && e.response.data.error && e.response.data.error?.code && e.response.data.error?.message !== void 0 ? t = { ...e.response.data.error, status: e.response.status } : (t.message = e.message, t.status = e.response.status, t.code = 0) : e?.request ? (t.message = `${e?.code} ${e.message}`, t.code = -1) : (t.message = `${e?.code} ${e.message}`, t.status = 0, t.code = -2), a && e?.response?.status === 401 && s.events_emit(
|
|
19
|
+
return e?.code !== void 0 && t.status !== void 0 && e.message !== void 0 && (t = { ...t, ...e }), e?.response ? e.response.data && typeof e.response.data == "object" && e.response.data.error && e.response.data.error?.code && e.response.data.error?.message !== void 0 ? t = { ...e.response.data.error, status: e.response.status } : (t.message = e.message, t.status = e.response.status, t.code = 0) : e?.request ? (t.message = `${e?.code} ${e.message}`, t.code = -1) : (t.message = `${e?.code} ${e.message}`, t.status = 0, t.code = -2), a && e?.response?.status === 401 && s.events_emit(R.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, {}), e?.response?.data?.error?.message && (t.message = e?.response?.data?.error.message), a && (t.message.indexOf("ERR_CANCELED") > -1 || i && o(`${t.message} - status: ${t.status} - code: ${t.code}`, {
|
|
20
20
|
type: "error"
|
|
21
21
|
})), t;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const U = async (e, s, a) => {
|
|
24
24
|
const {
|
|
25
25
|
method: i,
|
|
26
26
|
endPoint: o,
|
|
27
27
|
timeout: t = 6e4,
|
|
28
28
|
parms: c = {},
|
|
29
29
|
data: g = {},
|
|
30
|
-
isRemote:
|
|
30
|
+
isRemote: r = !0,
|
|
31
31
|
checkUnAuthorized: f = !0,
|
|
32
|
-
headers:
|
|
33
|
-
onDownloadProgress:
|
|
32
|
+
headers: l,
|
|
33
|
+
onDownloadProgress: p,
|
|
34
34
|
isExternalUrl: u,
|
|
35
35
|
responseType: m = "json",
|
|
36
|
-
signal:
|
|
36
|
+
signal: E,
|
|
37
37
|
toastSuccess: _ = !0,
|
|
38
|
-
toastError:
|
|
38
|
+
toastError: P = !0
|
|
39
39
|
} = e;
|
|
40
40
|
let d;
|
|
41
|
-
return
|
|
41
|
+
return r ? d = s.host_api_remote : d = s.host_api_local, e?.options?.startProgress && e?.options?.startProgress(), $({
|
|
42
42
|
baseURL: u ? void 0 : d,
|
|
43
|
-
withCredentials:
|
|
43
|
+
withCredentials: r,
|
|
44
44
|
method: i,
|
|
45
45
|
url: u ? o : `/${o}`,
|
|
46
46
|
data: g,
|
|
47
47
|
params: {},
|
|
48
|
-
paramsSerializer: () =>
|
|
49
|
-
headers:
|
|
48
|
+
paramsSerializer: () => y.stringify(c, { encode: !0 }),
|
|
49
|
+
headers: l,
|
|
50
50
|
timeout: t,
|
|
51
|
-
onDownloadProgress:
|
|
51
|
+
onDownloadProgress: p,
|
|
52
52
|
responseType: m,
|
|
53
|
-
signal:
|
|
54
|
-
}).then((
|
|
55
|
-
(
|
|
53
|
+
signal: E
|
|
54
|
+
}).then((n) => j(o, n, a, m, _)).catch(
|
|
55
|
+
(n) => Promise.reject(v(n, a, f, P))
|
|
56
56
|
).finally(() => {
|
|
57
|
-
|
|
57
|
+
e?.options?.stopProgress && e?.options?.stopProgress();
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
export {
|
|
61
|
-
|
|
61
|
+
U as a
|
|
62
62
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evalúa un fragmento de código dentro de un contexto específico.
|
|
3
|
+
* @param context - El contexto en el que se evaluará el código.
|
|
4
|
+
* @param code - El código a evaluar.
|
|
5
|
+
* @returns El resultado de la evaluación como una cadena.
|
|
6
|
+
*/
|
|
7
|
+
export declare function evaluateWithContext(context: any, code: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getPropertyByString(object:
|
|
1
|
+
export declare function getPropertyByString(object: any, key: string): string | undefined | any[] | Record<any, any>;
|
package/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { voidFunction } from './voidFunction';
|
|
2
2
|
export { getPropertyByString } from './getPropertyByString';
|
|
3
|
+
export { evaluateWithContext } from './evaluateWithContext';
|
|
3
4
|
export { getLocalStorage } from './getLocalStorage';
|
|
4
5
|
export { setLocalStorage } from './setLocalStorage';
|
|
5
6
|
export { axiosOperation } from './axiosOperation';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import "axios";
|
|
2
|
+
import "qs";
|
|
3
|
+
function g() {
|
|
4
|
+
}
|
|
5
|
+
function f(n, e) {
|
|
6
|
+
const r = e.split(".");
|
|
7
|
+
let t = n;
|
|
8
|
+
for (const o of r) {
|
|
9
|
+
const a = o.match(/^(\w+)\[(\w+)\]$/);
|
|
10
|
+
if (a) {
|
|
11
|
+
const s = a[1], c = a[2];
|
|
12
|
+
if (t[s] && Array.isArray(t[s])) {
|
|
13
|
+
if (c === "lastIndex")
|
|
14
|
+
return t[s][t[s].length - 1];
|
|
15
|
+
{
|
|
16
|
+
const i = parseInt(c);
|
|
17
|
+
return t[s][i];
|
|
18
|
+
}
|
|
19
|
+
} else
|
|
20
|
+
return;
|
|
21
|
+
} else if (t[o] !== void 0)
|
|
22
|
+
t = t[o];
|
|
23
|
+
else
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
function y(n, e) {
|
|
29
|
+
try {
|
|
30
|
+
const t = new Function(...Object.keys(n), `return \`${e}\``)(...Object.values(n));
|
|
31
|
+
return String(t).replace(/`/g, "");
|
|
32
|
+
} catch (r) {
|
|
33
|
+
return console.error(`Error evaluating expression: ${r}`), "";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function d(n, e) {
|
|
37
|
+
try {
|
|
38
|
+
const r = window.localStorage.getItem(n);
|
|
39
|
+
return r !== null ? typeof e == "string" ? r : JSON.parse(r) : e;
|
|
40
|
+
} catch {
|
|
41
|
+
return e;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function p(n, e, r = !1) {
|
|
45
|
+
try {
|
|
46
|
+
let t = null;
|
|
47
|
+
if (typeof e == "string") {
|
|
48
|
+
window.localStorage.setItem(n, e);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
r && (t = window.localStorage.getItem(n));
|
|
52
|
+
let o = t !== null ? JSON.parse(t) : {};
|
|
53
|
+
o = { ...o, ...e }, window.localStorage.setItem(n, JSON.stringify(o));
|
|
54
|
+
} catch {
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
d as a,
|
|
59
|
+
y as e,
|
|
60
|
+
f as g,
|
|
61
|
+
p as s,
|
|
62
|
+
g as v
|
|
63
|
+
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { useState as a, useRef as O, useCallback as Q, useEffect as l } from "react";
|
|
2
|
-
import { u as T } from "../useHostTools/index.66d9a667.js";
|
|
3
|
-
import { u as b } from "../useNetwork/index.acbf28d5.js";
|
|
4
|
-
const s = {
|
|
5
|
-
page: 0,
|
|
6
|
-
rowsPerPage: 25,
|
|
7
|
-
totalRecords: 0
|
|
8
|
-
}, U = (m) => {
|
|
9
|
-
const {
|
|
10
|
-
endPoint: w,
|
|
11
|
-
timeout: h = 5e3,
|
|
12
|
-
queryParams: g,
|
|
13
|
-
fireOnChangeParms: c,
|
|
14
|
-
rowsPerPage: u = s.rowsPerPage
|
|
15
|
-
} = m, [P, o] = a(c ? 1 : 0), [R, i] = a([]), [d, n] = a({ ...s, rowsPerPage: u }), t = O({ ...s, rowsPerPage: u }), [C, S] = a(!0), { startProgress: y, stopProgress: f } = T(), { networkOperation: k } = b(), p = Q(() => {
|
|
16
|
-
o((r) => r + 1);
|
|
17
|
-
}, []);
|
|
18
|
-
return l(() => {
|
|
19
|
-
if (C) {
|
|
20
|
-
S(!1);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
c && p();
|
|
24
|
-
}, [g]), l(() => {
|
|
25
|
-
let r = !0;
|
|
26
|
-
if (P !== 0)
|
|
27
|
-
return y(), k({
|
|
28
|
-
method: "GET",
|
|
29
|
-
endPoint: w,
|
|
30
|
-
timeout: h,
|
|
31
|
-
parms: {
|
|
32
|
-
...g,
|
|
33
|
-
page: t.current.page,
|
|
34
|
-
limit: t.current.rowsPerPage
|
|
35
|
-
}
|
|
36
|
-
}).then((e) => {
|
|
37
|
-
r && (i(e.data), t.current.page = e.pager.page, n((E) => ({
|
|
38
|
-
...E,
|
|
39
|
-
page: e.pager.page,
|
|
40
|
-
totalRecords: e.pager.total
|
|
41
|
-
})));
|
|
42
|
-
}).finally(() => {
|
|
43
|
-
r && f();
|
|
44
|
-
}), function() {
|
|
45
|
-
f(), r = !1;
|
|
46
|
-
};
|
|
47
|
-
}, [P]), { onPageChange: (r) => {
|
|
48
|
-
t.current.page = r, o((e) => e + 1);
|
|
49
|
-
}, onRowsPerPageChange: (r) => {
|
|
50
|
-
t.current.rowsPerPage = r, n((e) => ({ ...e, rowsPerPage: r })), o((e) => e + 1);
|
|
51
|
-
}, pagerState: d, rows: R, clearRows: () => {
|
|
52
|
-
i([]), n(s);
|
|
53
|
-
}, Refresh: p };
|
|
54
|
-
};
|
|
55
|
-
export {
|
|
56
|
-
s as i,
|
|
57
|
-
U as u
|
|
58
|
-
};
|
package/utils/index.8c4b528d.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
import "qs";
|
|
3
|
-
function a() {
|
|
4
|
-
}
|
|
5
|
-
function s(e, r) {
|
|
6
|
-
let t = e;
|
|
7
|
-
const o = r.split(".");
|
|
8
|
-
if (!e)
|
|
9
|
-
return e;
|
|
10
|
-
for (let n = 0; n < o.length && !(t[o[n]] === void 0 || t[o[n]] === null); n += 1)
|
|
11
|
-
t = t[o[n]];
|
|
12
|
-
return t;
|
|
13
|
-
}
|
|
14
|
-
function g(e, r) {
|
|
15
|
-
try {
|
|
16
|
-
const t = window.localStorage.getItem(e);
|
|
17
|
-
return t !== null ? typeof r == "string" ? t : JSON.parse(t) : r;
|
|
18
|
-
} catch {
|
|
19
|
-
return r;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function c(e, r, t = !1) {
|
|
23
|
-
try {
|
|
24
|
-
let o = null;
|
|
25
|
-
if (typeof r == "string") {
|
|
26
|
-
window.localStorage.setItem(e, r);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
t && (o = window.localStorage.getItem(e));
|
|
30
|
-
let n = o !== null ? JSON.parse(o) : {};
|
|
31
|
-
n = { ...n, ...r }, window.localStorage.setItem(e, JSON.stringify(n));
|
|
32
|
-
} catch {
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
g as a,
|
|
37
|
-
s as g,
|
|
38
|
-
c as s,
|
|
39
|
-
a as v
|
|
40
|
-
};
|