@ukpc-lib/react 0.13.1-dev.7 → 0.13.1-dev.9
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/dist/components/PopUp/types.d.ts +1 -1
- package/dist/components/index.cjs +2 -2
- package/dist/components/index.js +99 -93
- package/dist/components/main.d.ts +1 -0
- package/dist/{index.esm2017-PBMi68u0.cjs → index.esm2017-C3w5APcd.cjs} +84 -84
- package/dist/{index.esm2017-BaUD-cIs.js → index.esm2017-DJ5XZpWt.js} +4254 -4222
- package/dist/share/hooks/index.d.ts +1 -0
- package/dist/share/hooks/useSyncBackdrop.d.ts +4 -0
- package/dist/share/index.cjs +1 -1
- package/dist/share/index.js +63 -52
- package/package.json +1 -1
- package/web-components-bundle/favorite-menu/index.js +1 -1
- package/web-components-bundle/global-menu/index.js +1 -1
- package/web-components-bundle/global-topbar/index.js +1 -1
- package/web-components-bundle/has-permission/index.js +1 -1
- package/web-components-bundle/{index-DofEXbsA.js → index-2K0_9D9S.js} +2550 -2518
package/dist/share/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.esm2017-C3w5APcd.cjs"),h=require("axios"),c=require("react"),l=require("react-router-dom"),u=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");const d=n=>{const[s,r]=c.useState([]);return c.useEffect(()=>{h.get(`${n}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(e=>r(e.data)).catch(e=>{console.error("Getting user permission error:",e)})},[n]),s},f=n=>{const s=l.useNavigate(),r=l.useLocation();console.log(" useSyncRouter.tsx ~ location1:",r,window.location.pathname);const e=(t=r)=>(n||"")+t.pathname+t.search+t.hash;if(c.useEffect(()=>{const t={changeRoute:i=>{const a=e();if(typeof i=="string"&&a!==i){console.log(" useSyncRouter.tsx ~ location2:",a,i);const g=n&&i.startsWith(n)?i.substring(n.length):i;s(g)}}};window.MicrofeBridge=t},[s,r]),c.useEffect(()=>{var i,a;const t=e();console.log("fullPath1",window.location.pathname,t),(a=(i=window.parent)==null?void 0:i.HostBridge)==null||a.childRouteChange(t)},[r]),window.self===window.top){console.log("useSyncRouter: Navigate to /app path"),window.location.href=window.location.href.replace(window.origin,`${window.origin}/app`);return}};function w({open:n,disabled:s}){c.useMemo(()=>{var r,e,t,i;s||(n?(e=(r=window.top)==null?void 0:r.HostBridge)==null||e.openBackdrop(!0):(i=(t=window.top)==null?void 0:t.HostBridge)==null||i.openBackdrop(!1))},[n,s])}const m=n=>(s,r)=>{const e=d(n);return r?s.every(t=>e==null?void 0:e.includes(t)):s.some(t=>e==null?void 0:e.includes(t))},P=({baseUrl:n,accessWith:s,requireAll:r,children:e})=>m(n)(s,r)?u.jsx(u.Fragment,{children:e}):null,p=({accessWith:n,requireAll:s,baseUrl:r,unAuthorizedPath:e,children:t})=>m(r)(n,s)?u.jsx(u.Fragment,{children:t}):u.jsx(l.Navigate,{to:e,replace:!0});exports.AuthContext=o.AuthContext;exports.AuthProvider=o.AuthProvider;exports.ERROR_MESSAGE=o.ERROR_MESSAGE;exports.SaasThemeProvider=o.SaasThemeProvider;exports.TranslationProvider=o.TranslationProvider;exports.axiosInstance=o.axiosInstance;exports.color=o.color;exports.createCustomTheme=o.createCustomTheme;exports.handleErrorAxios=o.handleErrorAxios;exports.login=o.login;exports.logout=o.logout;exports.responseInterceptor=o.responseInterceptor;exports.search=o.search;exports.setFavicon=o.setFavicon;exports.translate=o.translate;exports.translationConfig=o.translationConfig;exports.useAuth=o.useAuth;exports.useCustomTranslation=o.useCustomTranslation;exports.useTheme=o.useTheme;exports.useTranslation=o.useTranslation$1;exports.HasPermission=P;exports.PermissionRoute=p;exports.getUseHasPermission=m;exports.useGetPermission=d;exports.useSyncBackdrop=w;exports.useSyncRouter=f;
|
package/dist/share/index.js
CHANGED
|
@@ -1,93 +1,104 @@
|
|
|
1
|
-
import { M, N, O as
|
|
1
|
+
import { M as F, N, O as k, a0 as G, Y as $, a as I, c as O, Z as j, U as z, R as L, T as U, V, v as W, $ as X, t as Y, W as Z, b as _, u as q, g as D, X as J } from "../index.esm2017-DJ5XZpWt.js";
|
|
2
2
|
import g from "axios";
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useNavigate as
|
|
3
|
+
import { useState as d, useEffect as a, useMemo as f } from "react";
|
|
4
|
+
import { useNavigate as h, useLocation as w, Navigate as p } from "react-router-dom";
|
|
5
5
|
import { jsx as u, Fragment as c } from "react/jsx-runtime";
|
|
6
6
|
import "@r2wc/react-to-web-component";
|
|
7
7
|
import "@mui/material";
|
|
8
|
-
const P = (
|
|
9
|
-
const [n,
|
|
10
|
-
return
|
|
11
|
-
g.get(`${
|
|
8
|
+
const P = (t) => {
|
|
9
|
+
const [n, s] = d([]);
|
|
10
|
+
return a(() => {
|
|
11
|
+
g.get(`${t}/user-management/api/v1/users/my-account/permissions`, {
|
|
12
12
|
withCredentials: !0
|
|
13
|
-
}).then((o) =>
|
|
13
|
+
}).then((o) => s(o.data)).catch((o) => {
|
|
14
14
|
console.error("Getting user permission error:", o);
|
|
15
15
|
});
|
|
16
|
-
}, [
|
|
17
|
-
}, T = (
|
|
18
|
-
const n =
|
|
16
|
+
}, [t]), n;
|
|
17
|
+
}, T = (t) => {
|
|
18
|
+
const n = h(), s = w();
|
|
19
19
|
console.log(
|
|
20
20
|
" useSyncRouter.tsx ~ location1:",
|
|
21
|
-
|
|
21
|
+
s,
|
|
22
22
|
window.location.pathname
|
|
23
23
|
);
|
|
24
|
-
const o = (e =
|
|
25
|
-
if (
|
|
24
|
+
const o = (e = s) => (t || "") + e.pathname + e.search + e.hash;
|
|
25
|
+
if (a(() => {
|
|
26
26
|
const e = {
|
|
27
27
|
changeRoute: (r) => {
|
|
28
|
-
const
|
|
29
|
-
if (typeof r == "string" &&
|
|
30
|
-
console.log(" useSyncRouter.tsx ~ location2:",
|
|
31
|
-
const m =
|
|
28
|
+
const i = o();
|
|
29
|
+
if (typeof r == "string" && i !== r) {
|
|
30
|
+
console.log(" useSyncRouter.tsx ~ location2:", i, r);
|
|
31
|
+
const m = t && r.startsWith(t) ? r.substring(t.length) : r;
|
|
32
32
|
n(m);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
window.MicrofeBridge = e;
|
|
37
|
-
}, [n,
|
|
38
|
-
var r,
|
|
37
|
+
}, [n, s]), a(() => {
|
|
38
|
+
var r, i;
|
|
39
39
|
const e = o();
|
|
40
|
-
console.log("fullPath1", window.location.pathname, e), (
|
|
41
|
-
}, [
|
|
40
|
+
console.log("fullPath1", window.location.pathname, e), (i = (r = window.parent) == null ? void 0 : r.HostBridge) == null || i.childRouteChange(e);
|
|
41
|
+
}, [s]), window.self === window.top) {
|
|
42
42
|
console.log("useSyncRouter: Navigate to /app path"), window.location.href = window.location.href.replace(
|
|
43
43
|
window.origin,
|
|
44
44
|
`${window.origin}/app`
|
|
45
45
|
);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
};
|
|
49
|
+
function C({
|
|
50
|
+
open: t,
|
|
51
|
+
disabled: n
|
|
52
|
+
}) {
|
|
53
|
+
f(() => {
|
|
54
|
+
var s, o, e, r;
|
|
55
|
+
n || (t ? (o = (s = window.top) == null ? void 0 : s.HostBridge) == null || o.openBackdrop(!0) : (r = (e = window.top) == null ? void 0 : e.HostBridge) == null || r.openBackdrop(!1));
|
|
56
|
+
}, [t, n]);
|
|
57
|
+
}
|
|
58
|
+
const l = (t) => (n, s) => {
|
|
59
|
+
const o = P(t);
|
|
60
|
+
return s ? n.every(
|
|
51
61
|
(e) => o == null ? void 0 : o.includes(e)
|
|
52
62
|
) : n.some(
|
|
53
63
|
(e) => o == null ? void 0 : o.includes(e)
|
|
54
64
|
);
|
|
55
|
-
},
|
|
56
|
-
baseUrl:
|
|
65
|
+
}, A = ({
|
|
66
|
+
baseUrl: t,
|
|
57
67
|
accessWith: n,
|
|
58
|
-
requireAll:
|
|
68
|
+
requireAll: s,
|
|
59
69
|
children: o
|
|
60
|
-
}) => l(
|
|
61
|
-
accessWith:
|
|
70
|
+
}) => l(t)(n, s) ? /* @__PURE__ */ u(c, { children: o }) : null, E = ({
|
|
71
|
+
accessWith: t,
|
|
62
72
|
requireAll: n,
|
|
63
|
-
baseUrl:
|
|
73
|
+
baseUrl: s,
|
|
64
74
|
unAuthorizedPath: o,
|
|
65
75
|
children: e
|
|
66
|
-
}) => l(
|
|
76
|
+
}) => l(s)(t, n) ? /* @__PURE__ */ u(c, { children: e }) : /* @__PURE__ */ u(p, { to: o, replace: !0 });
|
|
67
77
|
export {
|
|
68
|
-
|
|
78
|
+
F as AuthContext,
|
|
69
79
|
N as AuthProvider,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
k as ERROR_MESSAGE,
|
|
81
|
+
A as HasPermission,
|
|
82
|
+
E as PermissionRoute,
|
|
73
83
|
G as SaasThemeProvider,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
$ as TranslationProvider,
|
|
85
|
+
I as axiosInstance,
|
|
86
|
+
O as color,
|
|
87
|
+
j as createCustomTheme,
|
|
78
88
|
l as getUseHasPermission,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
z as handleErrorAxios,
|
|
90
|
+
L as login,
|
|
91
|
+
U as logout,
|
|
92
|
+
V as responseInterceptor,
|
|
93
|
+
W as search,
|
|
94
|
+
X as setFavicon,
|
|
95
|
+
Y as translate,
|
|
96
|
+
Z as translationConfig,
|
|
97
|
+
_ as useAuth,
|
|
98
|
+
q as useCustomTranslation,
|
|
89
99
|
P as useGetPermission,
|
|
100
|
+
C as useSyncBackdrop,
|
|
90
101
|
T as useSyncRouter,
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
D as useTheme,
|
|
103
|
+
J as useTranslation
|
|
93
104
|
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../react-to-web-component-C4-Jmrxs.js";
|
|
2
|
-
import { L as g, T as n } from "../index-
|
|
2
|
+
import { L as g, T as n } from "../index-2K0_9D9S.js";
|
|
3
3
|
import "../index-B1bJ4sn5.js";
|
|
4
4
|
import "../index-DyX6L9q-.js";
|
|
5
5
|
import "../react-toastify.esm-C4-Xv2fh.js";
|