@ukpc-lib/react 0.16.3-dev.29 → 0.16.3-dev.31
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/index.cjs +1 -1
- package/dist/components/index.js +2 -2
- package/dist/{index.esm2017-A_0wLJbQ.cjs → index.esm2017-B2aVWYj3.cjs} +23 -23
- package/dist/{index.esm2017-DVc64d4k.js → index.esm2017-C6M7ujmD.js} +261 -260
- package/dist/share/index.cjs +1 -1
- package/dist/share/index.js +2 -2
- package/package.json +1 -1
- package/web-components-bundle/access-denied/index.js +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-BT0XlPI_.js → index-BGG_-9rl.js} +22 -21
package/dist/share/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.esm2017-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.esm2017-B2aVWYj3.cjs"),R=require("axios"),y=require("react"),U=require("react-router-dom"),g=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");require("react-query");require("react-dom");require("moment");const D=r=>{const[t,e]=y.useState([]);return y.useEffect(()=>{R.get(`${r}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(i=>e(i.data)).catch(i=>{console.error("Getting user permission error:",i)})},[r]),t},H=r=>{const t=U.useLocation();if(y.useEffect(()=>{var i,c;let e=t.pathname+t.search+t.hash;r&&!e.includes(r)&&(e=r+e),console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:",e),(c=(i=window.top)==null?void 0:i.shellNavigate)==null||c.call(i,"/app"+e,{replace:!0})},[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 $({open:r,disabled:t}){y.useMemo(()=>{var e,i,c,u;t||(r?(i=(e=window.top)==null?void 0:e.HostBridge)==null||i.openBackdrop(!0):(u=(c=window.top)==null?void 0:c.HostBridge)==null||u.openBackdrop(!1))},[r,t])}const k=(r,t)=>(e,i)=>{const u=o.useUserPermissions({axiosInstance:t,baseUrl:r}).data;return u?i?e.every(f=>u==null?void 0:u.includes(f)):e.some(f=>u==null?void 0:u.includes(f)):!1},M=({baseUrl:r,accessWith:t,requireAll:e,children:i})=>k(r)(t,e)?g.jsx(g.Fragment,{children:i}):null,q=({accessWith:r,requireAll:t,baseUrl:e,children:i})=>k(e)(r,t)?g.jsx(g.Fragment,{children:i}):g.jsx(o.UnauthorizedPage,{});var p={},I;function z(){if(I)return p;I=1,Object.defineProperty(p,"__esModule",{value:!0}),p.parse=f,p.serialize=_;const r=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,e=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/,c=Object.prototype.toString,u=(()=>{const s=function(){};return s.prototype=Object.create(null),s})();function f(s,l){const n=new u,h=s.length;if(h<2)return n;const w=(l==null?void 0:l.decode)||b;let a=0;do{const d=s.indexOf("=",a);if(d===-1)break;const E=s.indexOf(";",a),S=E===-1?h:E;if(d>S){a=s.lastIndexOf(";",d-1)+1;continue}const v=m(s,a,d),j=x(s,d,v),T=s.slice(v,j);if(n[T]===void 0){let P=m(s,d+1,S),L=x(s,S,P);const N=w(s.slice(P,L));n[T]=N}a=S+1}while(a<h);return n}function m(s,l,n){do{const h=s.charCodeAt(l);if(h!==32&&h!==9)return l}while(++l<n);return n}function x(s,l,n){for(;l>n;){const h=s.charCodeAt(--l);if(h!==32&&h!==9)return l+1}return n}function _(s,l,n){const h=(n==null?void 0:n.encode)||encodeURIComponent;if(!r.test(s))throw new TypeError(`argument name is invalid: ${s}`);const w=h(l);if(!t.test(w))throw new TypeError(`argument val is invalid: ${l}`);let a=s+"="+w;if(!n)return a;if(n.maxAge!==void 0){if(!Number.isInteger(n.maxAge))throw new TypeError(`option maxAge is invalid: ${n.maxAge}`);a+="; Max-Age="+n.maxAge}if(n.domain){if(!e.test(n.domain))throw new TypeError(`option domain is invalid: ${n.domain}`);a+="; Domain="+n.domain}if(n.path){if(!i.test(n.path))throw new TypeError(`option path is invalid: ${n.path}`);a+="; Path="+n.path}if(n.expires){if(!A(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);a+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(a+="; HttpOnly"),n.secure&&(a+="; Secure"),n.partitioned&&(a+="; Partitioned"),n.priority)switch(typeof n.priority=="string"?n.priority.toLowerCase():void 0){case"low":a+="; Priority=Low";break;case"medium":a+="; Priority=Medium";break;case"high":a+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}if(n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"none":a+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}return a}function b(s){if(s.indexOf("%")===-1)return s;try{return decodeURIComponent(s)}catch{return s}}function A(s){return c.call(s)==="[object Date]"}return p}var O=z();function B(){const r=typeof global>"u"?void 0:global.TEST_HAS_DOCUMENT_COOKIE;return typeof r=="boolean"?r:typeof document=="object"&&typeof document.cookie=="string"}function K(r){return typeof r=="string"?O.parse(r):typeof r=="object"&&r!==null?r:{}}function C(r,t={}){const e=V(r);if(!t.doNotParse)try{return JSON.parse(e)}catch{}return r}function V(r){return r&&r[0]==="j"&&r[1]===":"?r.substr(2):r}class F{constructor(t,e={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const c=this.cookies;this.cookies=O.parse(document.cookie),this._checkChanges(c)};const i=typeof document>"u"?"":document.cookie;this.cookies=K(t||i),this.defaultSetOptions=e,this.HAS_DOCUMENT_COOKIE=B()}_emitChange(t){for(let e=0;e<this.changeListeners.length;++e)this.changeListeners[e](t)}_checkChanges(t){new Set(Object.keys(t).concat(Object.keys(this.cookies))).forEach(i=>{t[i]!==this.cookies[i]&&this._emitChange({name:i,value:C(this.cookies[i])})})}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(t,e={}){return e.doNotUpdate||this.update(),C(this.cookies[t],e)}getAll(t={}){t.doNotUpdate||this.update();const e={};for(let i in this.cookies)e[i]=C(this.cookies[i],t);return e}set(t,e,i){i?i=Object.assign(Object.assign({},this.defaultSetOptions),i):i=this.defaultSetOptions;const c=typeof e=="string"?e:JSON.stringify(e);this.cookies=Object.assign(Object.assign({},this.cookies),{[t]:c}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=O.serialize(t,c,i)),this._emitChange({name:t,value:e,options:i})}remove(t,e){const i=e=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),e),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[t],this.HAS_DOCUMENT_COOKIE&&(document.cookie=O.serialize(t,"",i)),this._emitChange({name:t,value:void 0,options:e})}addChangeListener(t){this.changeListeners.push(t),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===1&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(t){const e=this.changeListeners.indexOf(t);e>=0&&this.changeListeners.splice(e,1),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===0&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}removeAllChangeListeners(){for(;this.changeListeners.length>0;)this.removeChangeListener(this.changeListeners[0])}}const G=r=>{const t=new F;let i=new URLSearchParams(window.location.search).get("tenantId")||t.get("tenantId");const c=t.get("accessToken")||null;if(console.log("ThemeProvider1:tenantId",i),!i&&c){const f=atob(c.split(".")[1]),m=JSON.parse(f);i=m.tenantId?m.tenantId.toString():null}console.log("ThemeProvider2:tenantId",i);const u=r.isBrand||i!=null?r.viteThemeUrl:"";return console.log("themeUrl",u),g.jsx(o.SaasThemeProvider,{brandTheme:{enabled:!!u,url:u},children:r.children})};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.setShellBackdrop=o.setShellBackdrop;exports.translate=o.translate;exports.translationConfig=o.translationConfig;exports.useAuth=o.useAuth;exports.useCustomTranslation=o.useCustomTranslation;exports.useTheme=o.useTheme;exports.useTranslation=o.useTranslation;exports.HasPermission=M;exports.PermissionRoute=q;exports.ThemeProvider=G;exports.getUseHasPermission=k;exports.useGetPermission=D;exports.useSyncBackdrop=$;exports.useSyncRouter=H;
|
package/dist/share/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as U, R as D, W as R } from "../index.esm2017-
|
|
2
|
-
import { X as he, Y as de, Z as fe, a5 as ge, a as me, c as pe, a6 as we, a1 as Oe, $ as Se, a0 as ye, a2 as ke, y as Ce, a7 as xe, s as Ee, t as ve, a3 as Ie, g as Te, u as _e, m as be, a4 as Pe } from "../index.esm2017-
|
|
1
|
+
import { V as U, R as D, W as R } from "../index.esm2017-C6M7ujmD.js";
|
|
2
|
+
import { X as he, Y as de, Z as fe, a5 as ge, a as me, c as pe, a6 as we, a1 as Oe, $ as Se, a0 as ye, a2 as ke, y as Ce, a7 as xe, s as Ee, t as ve, a3 as Ie, g as Te, u as _e, m as be, a4 as Pe } from "../index.esm2017-C6M7ujmD.js";
|
|
3
3
|
import $ from "axios";
|
|
4
4
|
import { useState as H, useEffect as I, useMemo as M } from "react";
|
|
5
5
|
import { useLocation as z } from "react-router-dom";
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../react-to-web-component-BOygDorD.js";
|
|
2
|
-
import { U as d } from "../index-
|
|
2
|
+
import { U as d } from "../index-BGG_-9rl.js";
|
|
3
3
|
import "../react-toastify.esm-DnABvuky.js";
|
|
4
4
|
import "../toast-config/index.js";
|
|
5
5
|
import "../toast-config-notification/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../react-to-web-component-BOygDorD.js";
|
|
2
|
-
import { F as u, u as F } from "../index-
|
|
2
|
+
import { F as u, u as F } from "../index-BGG_-9rl.js";
|
|
3
3
|
import "../index-BwEhsh9S.js";
|
|
4
4
|
import "../index-DnQ4tn_A.js";
|
|
5
5
|
import "../react-toastify.esm-DnABvuky.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../react-to-web-component-BOygDorD.js";
|
|
2
|
-
import { G as i, a as e } from "../index-
|
|
2
|
+
import { G as i, a as e } from "../index-BGG_-9rl.js";
|
|
3
3
|
import "../index-BwEhsh9S.js";
|
|
4
4
|
import "../index-DnQ4tn_A.js";
|
|
5
5
|
import "../SaasThemeProvider-A_eMJWqw.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../react-to-web-component-BOygDorD.js";
|
|
2
|
-
import { L as n, T as s } from "../index-
|
|
2
|
+
import { L as n, T as s } from "../index-BGG_-9rl.js";
|
|
3
3
|
import "../index-BwEhsh9S.js";
|
|
4
4
|
import "../index-DnQ4tn_A.js";
|
|
5
5
|
import "../SaasThemeProvider-A_eMJWqw.js";
|
|
@@ -44436,6 +44436,7 @@ function c$(e, t = !1) {
|
|
|
44436
44436
|
}
|
|
44437
44437
|
const Dp = localStorage.getItem("isCollapsed");
|
|
44438
44438
|
c$(Dp);
|
|
44439
|
+
document.documentElement.style.setProperty("--favorite-menu-height", "0px");
|
|
44439
44440
|
function bpe(e) {
|
|
44440
44441
|
const t = new CustomEvent("favoriteMenusChange", {
|
|
44441
44442
|
detail: { favoriteMenus: e }
|
|
@@ -44443,9 +44444,7 @@ function bpe(e) {
|
|
|
44443
44444
|
window.dispatchEvent(t);
|
|
44444
44445
|
}
|
|
44445
44446
|
function wpe(e) {
|
|
44446
|
-
const t = Gb(), { user: n } = rM(), [r, i] = A.useState([]), s = r.map((ie) => ie.data), [o, a] = A.useState(!1), [u, f] = A.useState([]), [d, p] = A.useState(
|
|
44447
|
-
Dp === null ? !0 : Dp === "true"
|
|
44448
|
-
), [v, y] = A.useState(window.innerWidth < 767), [S, w] = A.useState(!1), [E, _] = A.useState(window.location.href), P = A.useRef(null);
|
|
44447
|
+
const t = Gb(), { user: n } = rM(), [r, i] = A.useState([]), s = r.map((ie) => ie.data), [o, a] = A.useState(!1), [u, f] = A.useState([]), [d, p] = A.useState(window.innerWidth < 767), [v, y] = A.useState(() => window.innerWidth < 767 ? !1 : Dp === null ? !0 : Dp === "true"), [S, w] = A.useState(!1), [E, _] = A.useState(window.location.href), P = A.useRef(null);
|
|
44449
44448
|
A.useEffect(() => {
|
|
44450
44449
|
var ie;
|
|
44451
44450
|
(ie = e.handleCallback) == null || ie.call(e, s);
|
|
@@ -44459,23 +44458,25 @@ function wpe(e) {
|
|
|
44459
44458
|
);
|
|
44460
44459
|
}, [t]), A.useEffect(() => {
|
|
44461
44460
|
const ie = () => {
|
|
44462
|
-
|
|
44461
|
+
const me = window.innerWidth < 767;
|
|
44462
|
+
p(me), me && v ? y(!1) : !me && !v && localStorage.getItem("isCollapsed") === "true" && y(!0);
|
|
44463
44463
|
};
|
|
44464
44464
|
return window.addEventListener("resize", ie), () => window.removeEventListener("resize", ie);
|
|
44465
|
-
}, []), A.useEffect(() => {
|
|
44466
|
-
c$(
|
|
44467
|
-
}, [
|
|
44465
|
+
}, [v]), A.useEffect(() => {
|
|
44466
|
+
c$(v, d);
|
|
44467
|
+
}, [v, d]);
|
|
44468
44468
|
const D = Ak(s, E), [j, N] = ype({
|
|
44469
44469
|
initOpenIds: e.initOpenIds
|
|
44470
44470
|
}), B = () => {
|
|
44471
44471
|
var ie, me;
|
|
44472
|
-
if (
|
|
44473
|
-
|
|
44474
|
-
|
|
44475
|
-
|
|
44476
|
-
|
|
44477
|
-
|
|
44478
|
-
|
|
44472
|
+
if (!d)
|
|
44473
|
+
if (y(!v), localStorage.setItem("isCollapsed", JSON.stringify(!v)), v)
|
|
44474
|
+
j && ((ie = P.current) == null || ie.open(j));
|
|
44475
|
+
else {
|
|
44476
|
+
const _e = r.filter((Se) => Se.parent === 0).map((Se) => Se.id);
|
|
44477
|
+
console.log("closeIds:", _e), (me = P.current) == null || me.close(_e);
|
|
44478
|
+
}
|
|
44479
|
+
}, [b, H] = A.useState(!1), U = v && !d ? "collapsed" : "expanded", Z = (ie) => `${ie} ${U}`, ce = A.useRef(null);
|
|
44479
44480
|
A.useLayoutEffect(() => {
|
|
44480
44481
|
(async () => {
|
|
44481
44482
|
var me, _e, Se;
|
|
@@ -44574,7 +44575,7 @@ function wpe(e) {
|
|
|
44574
44575
|
const ie = (me) => {
|
|
44575
44576
|
var qe;
|
|
44576
44577
|
const _e = me, { path: Se } = _e.detail, We = Ak(s, Se).map((Be) => Be.id), Fe = ee.current.filter((Be) => We.includes(Be) ? !1 : !We.some((ke) => Y(s, Be, ke)));
|
|
44577
|
-
console.log("idsToClose:", Fe),
|
|
44578
|
+
console.log("idsToClose:", Fe), v || (qe = P.current) == null || qe.open(We), setTimeout(() => {
|
|
44578
44579
|
var Be;
|
|
44579
44580
|
(Be = P.current) == null || Be.close(Fe);
|
|
44580
44581
|
}, 0), N(We);
|
|
@@ -44655,7 +44656,7 @@ function wpe(e) {
|
|
|
44655
44656
|
{
|
|
44656
44657
|
className: Z(
|
|
44657
44658
|
// `side-bar`,
|
|
44658
|
-
`side-bar${
|
|
44659
|
+
`side-bar${d ? " is-mobile" : ""}`
|
|
44659
44660
|
),
|
|
44660
44661
|
style: e.inlineMode ? {
|
|
44661
44662
|
position: "relative",
|
|
@@ -44669,12 +44670,12 @@ function wpe(e) {
|
|
|
44669
44670
|
flexDirection: "column"
|
|
44670
44671
|
} : void 0,
|
|
44671
44672
|
children: [
|
|
44672
|
-
!
|
|
44673
|
+
!d && /* @__PURE__ */ R.jsx("div", { className: Z("wrap-section side-bar__wrapper-toggle-btn"), children: /* @__PURE__ */ R.jsx(
|
|
44673
44674
|
"button",
|
|
44674
44675
|
{
|
|
44675
44676
|
className: "icon-btn side-bar__toggle-btn",
|
|
44676
44677
|
onClick: B,
|
|
44677
|
-
children:
|
|
44678
|
+
children: v ? /* @__PURE__ */ R.jsx(hpe, {}) : /* @__PURE__ */ R.jsx(dpe, {})
|
|
44678
44679
|
}
|
|
44679
44680
|
) }),
|
|
44680
44681
|
/* @__PURE__ */ R.jsx(
|
|
@@ -44688,7 +44689,7 @@ function wpe(e) {
|
|
|
44688
44689
|
ref: ce,
|
|
44689
44690
|
className: Z("wrap-section side-bar__menu"),
|
|
44690
44691
|
style: {
|
|
44691
|
-
marginTop:
|
|
44692
|
+
marginTop: d ? 0 : 24,
|
|
44692
44693
|
flex: 1,
|
|
44693
44694
|
overflow: "auto",
|
|
44694
44695
|
height: "100%",
|
|
@@ -44741,7 +44742,7 @@ function wpe(e) {
|
|
|
44741
44742
|
onClickItem: e.onClickItem,
|
|
44742
44743
|
isInternalApp: e.isInternalApp,
|
|
44743
44744
|
isActive: De,
|
|
44744
|
-
isCollapsed:
|
|
44745
|
+
isCollapsed: v,
|
|
44745
44746
|
replacePath: e.replacePath,
|
|
44746
44747
|
ssr: e.ssr,
|
|
44747
44748
|
brandColors: e.brandColors,
|
|
@@ -44778,7 +44779,7 @@ function wpe(e) {
|
|
|
44778
44779
|
node: ie,
|
|
44779
44780
|
depth: me,
|
|
44780
44781
|
color: (_e = e.brandColors) == null ? void 0 : _e.primary300,
|
|
44781
|
-
isCollapsed:
|
|
44782
|
+
isCollapsed: v
|
|
44782
44783
|
}
|
|
44783
44784
|
);
|
|
44784
44785
|
},
|