@m4l/core 2.0.14 → 2.0.16-beta.0
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 { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { u as
|
|
4
|
-
import { u as
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
import { C as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as I, useState as f, useEffect as O, useCallback as p } from "react";
|
|
3
|
+
import { u as P } from "../../hooks/useEnvironment/index.js";
|
|
4
|
+
import { u as $ } from "../../hooks/useFlagsStore/index.js";
|
|
5
|
+
import { u as x } from "../../hooks/useHostTools/index.js";
|
|
6
|
+
import { u as S } from "../../hooks/useNetwork/index.js";
|
|
7
|
+
import { C as D } from "../../types/index.js";
|
|
8
|
+
const T = I(null);
|
|
9
|
+
function H(g) {
|
|
10
10
|
const {
|
|
11
|
-
children:
|
|
12
|
-
componentsDictionary:
|
|
13
|
-
moduleId:
|
|
11
|
+
children: L,
|
|
12
|
+
componentsDictionary: h,
|
|
13
|
+
moduleId: s,
|
|
14
14
|
moduleNameField: l = "module_name",
|
|
15
|
-
currentLang:
|
|
16
|
-
isAuth:
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
currentLang: A = "en",
|
|
16
|
+
isAuth: d = !0,
|
|
17
|
+
moduleDictionaryLoaded: v
|
|
18
|
+
} = g, u = $((t) => t.flagsActions.addFlag), [n, c] = f(void 0), { domain_token: y } = P(), { startProgress: _, stopProgress: C } = x(), { networkOperation: F } = S(), [m, M] = f(v);
|
|
19
|
+
O(() => {
|
|
19
20
|
let t = !0;
|
|
20
|
-
return
|
|
21
|
+
return m ? (c({
|
|
22
|
+
...m
|
|
23
|
+
}), M(void 0), u(D.FLAG_DICTIONARY_LOADED)) : (_(), F({
|
|
21
24
|
method: "GET",
|
|
22
|
-
endPoint:
|
|
25
|
+
endPoint: d ? `dictionaries/${s}` : `na/dictionaries/${s}`,
|
|
23
26
|
parms: {
|
|
24
|
-
comps:
|
|
27
|
+
comps: h,
|
|
25
28
|
// lang: 'en',
|
|
26
|
-
...
|
|
29
|
+
...d ? {} : { domain_token: y }
|
|
27
30
|
}
|
|
28
31
|
// isRemote: false
|
|
29
32
|
}).then((e) => {
|
|
30
|
-
t && (
|
|
33
|
+
t && (c({
|
|
31
34
|
...e
|
|
32
|
-
}),
|
|
35
|
+
}), u(D.FLAG_DICTIONARY_LOADED));
|
|
33
36
|
}).finally(() => {
|
|
34
|
-
|
|
35
|
-
}), function() {
|
|
37
|
+
C();
|
|
38
|
+
})), function() {
|
|
36
39
|
t = !1;
|
|
37
40
|
};
|
|
38
|
-
}, [
|
|
39
|
-
const
|
|
41
|
+
}, [A]);
|
|
42
|
+
const a = p(
|
|
40
43
|
(t, ...e) => {
|
|
41
|
-
if (
|
|
44
|
+
if (n === void 0)
|
|
42
45
|
return "";
|
|
43
46
|
if (t === "")
|
|
44
47
|
return "No key";
|
|
45
48
|
let o;
|
|
46
49
|
const i = t.split(".");
|
|
47
50
|
try {
|
|
48
|
-
i.length === 1 && (o =
|
|
51
|
+
i.length === 1 && (o = n.data[t]), i.length === 2 && (o = n[i[0]][i[1]]);
|
|
49
52
|
} catch {
|
|
50
53
|
}
|
|
51
54
|
if (e.length > 0 && o)
|
|
52
|
-
for (let
|
|
53
|
-
o = o?.replaceAll(`$${
|
|
55
|
+
for (let r = 0; r < e.length; r++)
|
|
56
|
+
o = o?.replaceAll(`$${r + 1}`, e[r]);
|
|
54
57
|
return o || `N_D:[${t}]`;
|
|
55
58
|
},
|
|
56
|
-
[
|
|
57
|
-
),
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
|
|
59
|
+
[n]
|
|
60
|
+
), N = p(() => a(l), [l, a]);
|
|
61
|
+
return /* @__PURE__ */ E(
|
|
62
|
+
T.Provider,
|
|
60
63
|
{
|
|
61
64
|
value: {
|
|
62
|
-
moduleDictionary:
|
|
63
|
-
getLabel:
|
|
64
|
-
getModuleLabel:
|
|
65
|
+
moduleDictionary: n,
|
|
66
|
+
getLabel: a,
|
|
67
|
+
getModuleLabel: N
|
|
65
68
|
},
|
|
66
|
-
children:
|
|
69
|
+
children: L
|
|
67
70
|
}
|
|
68
71
|
);
|
|
69
72
|
}
|
|
70
73
|
export {
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
T as M,
|
|
75
|
+
H as a
|
|
73
76
|
};
|
|
@@ -7,6 +7,7 @@ export interface ModuleDictionaryProviderProps {
|
|
|
7
7
|
moduleNameField?: string;
|
|
8
8
|
componentsDictionary: string[];
|
|
9
9
|
children: ReactNode;
|
|
10
|
+
moduleDictionaryLoaded?: ModuleDictionary;
|
|
10
11
|
}
|
|
11
12
|
export interface ModuleDictionaryContextProps {
|
|
12
13
|
moduleDictionary?: ModuleDictionary;
|
|
@@ -1,51 +1,55 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
1
|
+
import { jsx as P } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as v, useState as a, useEffect as E, useCallback as h } from "react";
|
|
3
3
|
import { C as i } from "../../types/index.js";
|
|
4
|
-
import { u as
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
const { children:
|
|
10
|
-
|
|
4
|
+
import { u as D } from "../../hooks/useFlagsStore/index.js";
|
|
5
|
+
import { u as F } from "../../hooks/useHostTools/index.js";
|
|
6
|
+
import { u as L } from "../../hooks/useNetwork/index.js";
|
|
7
|
+
const A = v(null);
|
|
8
|
+
function k(n) {
|
|
9
|
+
const { children: l, queryPrivileges: s } = n, o = D((e) => e.flagsActions.addFlag), [t, u] = a({}), [m, c] = a({}), { startProgress: g, stopProgress: f } = F(), { networkOperation: d } = L();
|
|
10
|
+
E(() => {
|
|
11
11
|
let e = !0;
|
|
12
|
-
if (
|
|
12
|
+
if (s.length === 0) {
|
|
13
13
|
o(i.FLAG_PRIVILEGES_LOADED);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return g(), d({
|
|
17
17
|
method: "GET",
|
|
18
18
|
endPoint: "auth/login",
|
|
19
19
|
parms: {
|
|
20
|
-
privileges:
|
|
20
|
+
privileges: s,
|
|
21
|
+
user_data: !0
|
|
21
22
|
}
|
|
22
23
|
// isRemote: false
|
|
23
|
-
}).then((
|
|
24
|
-
e && (
|
|
25
|
-
...
|
|
24
|
+
}).then((r) => {
|
|
25
|
+
e && (u({
|
|
26
|
+
...r.data
|
|
27
|
+
}), c({
|
|
28
|
+
...r.user
|
|
26
29
|
}), o(i.FLAG_PRIVILEGES_LOADED));
|
|
27
30
|
}).finally(() => {
|
|
28
|
-
|
|
31
|
+
f();
|
|
29
32
|
}), function() {
|
|
30
33
|
e = !1;
|
|
31
34
|
};
|
|
32
35
|
}, []);
|
|
33
|
-
const
|
|
36
|
+
const p = h(
|
|
34
37
|
(e) => e in t,
|
|
35
38
|
[t]
|
|
36
39
|
);
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
40
|
+
return /* @__PURE__ */ P(
|
|
41
|
+
A.Provider,
|
|
39
42
|
{
|
|
40
43
|
value: {
|
|
41
|
-
hasPrivilege:
|
|
42
|
-
privileges: t
|
|
44
|
+
hasPrivilege: p,
|
|
45
|
+
privileges: t,
|
|
46
|
+
userData: m
|
|
43
47
|
},
|
|
44
|
-
children:
|
|
48
|
+
children: l
|
|
45
49
|
}
|
|
46
50
|
);
|
|
47
51
|
}
|
|
48
52
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
A as M,
|
|
54
|
+
k as a
|
|
51
55
|
};
|