@ukpc-lib/react 0.15.9-sandbox.saas-9173.patch-1 → 0.15.9-sandbox.saas-9249.patch-1

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-BI6e9cTN.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 m=n=>{const[s,r]=c.useState([]);return c.useEffect(()=>{h.get(`${n}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(o=>r(o.data)).catch(o=>{console.error("Getting user permission error:",o)})},[n]),s},f=n=>{const s=l.useNavigate(),r=l.useLocation();console.log(" useSyncRouter.tsx ~ location1:",r,window.location.pathname);const o=(t=r)=>(n||"")+t.pathname+t.search+t.hash;if(c.useEffect(()=>{const t={changeRoute:i=>{const a=o();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=o();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,o,t,i;s||(n?(o=(r=window.top)==null?void 0:r.HostBridge)==null||o.openBackdrop(!0):(i=(t=window.top)==null?void 0:t.HostBridge)==null||i.openBackdrop(!1))},[n,s])}const d=n=>(s,r)=>{const o=m(n);return r?s.every(t=>o==null?void 0:o.includes(t)):s.some(t=>o==null?void 0:o.includes(t))},P=({baseUrl:n,accessWith:s,requireAll:r,children:o})=>d(n)(s,r)?u.jsx(u.Fragment,{children:o}):null,p=({accessWith:n,requireAll:s,baseUrl:r,unAuthorizedPath:o,children:t})=>d(r)(n,s)?u.jsx(u.Fragment,{children:t}):u.jsx(l.Navigate,{to:o,replace:!0});exports.AuthContext=e.AuthContext;exports.AuthProvider=e.AuthProvider;exports.ERROR_MESSAGE=e.ERROR_MESSAGE;exports.SaasThemeProvider=e.SaasThemeProvider;exports.TranslationProvider=e.TranslationProvider;exports.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.login=e.login;exports.logout=e.logout;exports.responseInterceptor=e.responseInterceptor;exports.search=e.search;exports.setFavicon=e.setFavicon;exports.setShellBackdrop=e.setShellBackdrop;exports.translate=e.translate;exports.translationConfig=e.translationConfig;exports.useAuth=e.useAuth;exports.useCustomTranslation=e.useCustomTranslation;exports.useTheme=e.useTheme;exports.useTranslation=e.useTranslation$1;exports.HasPermission=P;exports.PermissionRoute=p;exports.getUseHasPermission=d;exports.useGetPermission=m;exports.useSyncBackdrop=w;exports.useSyncRouter=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-Cub-8n-S.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 m=n=>{const[s,r]=c.useState([]);return c.useEffect(()=>{h.get(`${n}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(o=>r(o.data)).catch(o=>{console.error("Getting user permission error:",o)})},[n]),s},f=n=>{const s=l.useNavigate(),r=l.useLocation();console.log(" useSyncRouter.tsx ~ location1:",r,window.location.pathname);const o=(t=r)=>(n||"")+t.pathname+t.search+t.hash;if(c.useEffect(()=>{const t={changeRoute:i=>{const a=o();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=o();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,o,t,i;s||(n?(o=(r=window.top)==null?void 0:r.HostBridge)==null||o.openBackdrop(!0):(i=(t=window.top)==null?void 0:t.HostBridge)==null||i.openBackdrop(!1))},[n,s])}const d=n=>(s,r)=>{const o=m(n);return r?s.every(t=>o==null?void 0:o.includes(t)):s.some(t=>o==null?void 0:o.includes(t))},P=({baseUrl:n,accessWith:s,requireAll:r,children:o})=>d(n)(s,r)?u.jsx(u.Fragment,{children:o}):null,p=({accessWith:n,requireAll:s,baseUrl:r,unAuthorizedPath:o,children:t})=>d(r)(n,s)?u.jsx(u.Fragment,{children:t}):u.jsx(l.Navigate,{to:o,replace:!0});exports.AuthContext=e.AuthContext;exports.AuthProvider=e.AuthProvider;exports.ERROR_MESSAGE=e.ERROR_MESSAGE;exports.SaasThemeProvider=e.SaasThemeProvider;exports.TranslationProvider=e.TranslationProvider;exports.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.login=e.login;exports.logout=e.logout;exports.responseInterceptor=e.responseInterceptor;exports.search=e.search;exports.setFavicon=e.setFavicon;exports.setShellBackdrop=e.setShellBackdrop;exports.translate=e.translate;exports.translationConfig=e.translationConfig;exports.useAuth=e.useAuth;exports.useCustomTranslation=e.useCustomTranslation;exports.useTheme=e.useTheme;exports.useTranslation=e.useTranslation$1;exports.HasPermission=P;exports.PermissionRoute=p;exports.getUseHasPermission=d;exports.useGetPermission=m;exports.useSyncBackdrop=w;exports.useSyncRouter=f;
@@ -1,4 +1,4 @@
1
- import { O as F, R as M, T as G, a2 as N, $, a as I, c as O, a0 as j, W as z, U as L, V as U, X as V, w as W, a1 as X, s as Y, t as Z, Y as _, e as q, u as D, i as J, Z as K } from "../index.esm2017-1lcAhfaR.js";
1
+ import { O as F, R as M, T as G, a2 as N, $, a as I, c as O, a0 as j, W as z, U as L, V as U, X as V, w as W, a1 as X, s as Y, t as Z, Y as _, e as q, u as D, i as J, Z as K } from "../index.esm2017-DdvYAMyv.js";
2
2
  import d from "axios";
3
3
  import { useState as g, useEffect as i, useMemo as h } from "react";
4
4
  import { useNavigate as w, useLocation as f, Navigate as p } from "react-router-dom";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.15.9-sandbox.saas-9173.patch-1",
4
+ "version": "0.15.9-sandbox.saas-9249.patch-1",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-w5r1Fs9q.js";
2
- import { F as i, u as m } from "../index-Czdzzso3.js";
2
+ import { F as i, u as m } from "../index-D8Cgcd8a.js";
3
3
  import "../index-DqxmsDJs.js";
4
4
  import "../index-BU5SX9Tl.js";
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-w5r1Fs9q.js";
2
- import { G as i } from "../index-Czdzzso3.js";
2
+ import { G as i } from "../index-D8Cgcd8a.js";
3
3
  import "../index-DqxmsDJs.js";
4
4
  import "../index-BU5SX9Tl.js";
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-w5r1Fs9q.js";
2
- import { L as n, T as s } from "../index-Czdzzso3.js";
2
+ import { L as n, T as s } from "../index-D8Cgcd8a.js";
3
3
  import "../index-DqxmsDJs.js";
4
4
  import "../index-Ch-015PG.js";
5
5
  import "../index-BU5SX9Tl.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-w5r1Fs9q.js";
2
- import { H as e, g as m } from "../index-Czdzzso3.js";
2
+ import { H as e, g as m } from "../index-D8Cgcd8a.js";
3
3
  import "../index-BU5SX9Tl.js";
4
4
  export {
5
5
  e as HasPermission,
@@ -17119,7 +17119,7 @@ function tA({ ...e }) {
17119
17119
  var se, ae, ye;
17120
17120
  const t = e.item, n = e.level || 0, r = !!((se = e.item.children) != null && se.length), i = `level-${n}`, s = (oe, te = i) => `${oe} ${te} `, [o, l] = A.useState(!1), [c, d] = A.useState(t.isFavorite || !1), h = A.useRef(), p = A.useRef();
17121
17121
  p != null && p.current && ((ae = p == null ? void 0 : p.current) == null ? void 0 : ae.scrollWidth) > ((ye = p == null ? void 0 : p.current) == null ? void 0 : ye.clientWidth);
17122
- const y = window.location.origin, b = t.path && t.path.includes("http") ? new URL(t.path) : { origin: "", pathname: "" }, C = window.location.pathname.split("/")[1], w = b.pathname.split("/")[1], E = e.item.redirectUrl || e.ssr || !y.includes("local") && y !== b.origin || w !== C, _ = r || n === 0 ? "div" : E ? "a" : lk, I = t.redirectUrl || t.path || "#", P = n + 1, V = r && o && n > 0, N = () => {
17122
+ const y = window.location.origin, b = t.path && t.path.includes("http") ? new URL(t.path) : { origin: "", pathname: "" }, C = window.location.pathname.split("/")[1], w = b.pathname.split("/")[1], E = e.item.redirectUrl || e.ssr || !y.includes("local") && y !== b.origin || w !== C, _ = r || n === 0 ? "div" : E ? "a" : lk, I = t.redirectUrl || (t.path && t.path.includes("http") ? new URL(t.path).pathname : t.path) || "#", P = n + 1, V = r && o && n > 0, N = () => {
17123
17123
  e.isDrop || l(!0);
17124
17124
  }, j = () => {
17125
17125
  l(!1);
@@ -17151,13 +17151,15 @@ function tA({ ...e }) {
17151
17151
  {
17152
17152
  target: Y,
17153
17153
  to: I,
17154
- href: I,
17155
17154
  draggable: "true",
17156
17155
  className: s("menu-item__link"),
17157
17156
  style: {
17158
17157
  width: "100%",
17159
17158
  transition: "all 0.3s"
17160
17159
  },
17160
+ onClick: () => {
17161
+ _ === "a" && Y === "_blank" || !r && t.path && e.onClickItem(I);
17162
+ },
17161
17163
  onDragStart: (oe) => {
17162
17164
  console.log("onDragStart component", oe.target);
17163
17165
  },
@@ -17220,7 +17222,8 @@ function tA({ ...e }) {
17220
17222
  ...e,
17221
17223
  key: fe.id,
17222
17224
  item: fe,
17223
- level: P
17225
+ level: P,
17226
+ onClickItem: e.onClickItem
17224
17227
  }
17225
17228
  ))
17226
17229
  }
@@ -22629,7 +22632,8 @@ function Tte(e) {
22629
22632
  item: N,
22630
22633
  level: 1,
22631
22634
  onSetFavoriteSuccess: b,
22632
- isDrop: o
22635
+ isDrop: o,
22636
+ onClickItem: e.onClickItem
22633
22637
  }
22634
22638
  )
22635
22639
  }
@@ -40063,7 +40067,7 @@ function nN({ ...e }) {
40063
40067
  }, [e.item.isFavorite]);
40064
40068
  const _ = A.useRef(), I = A.useRef();
40065
40069
  I != null && I.current && ((Ie = I == null ? void 0 : I.current) == null ? void 0 : Ie.scrollWidth) > ((Be = I == null ? void 0 : I.current) == null ? void 0 : Be.clientWidth);
40066
- const P = window.location.origin, V = t.path && t.path.includes("http") ? new URL(t.path) : { origin: "", pathname: "" }, N = window.location.pathname.split("/")[1], j = V.pathname.split("/")[1], v = e.item.redirectUrl || e.ssr || !P.includes("local") && P !== V.origin || j !== N, Y = r ? "div" : !e.isInternalApp && v ? "a" : lk, z = t.redirectUrl || t.path || "#", se = n + 1, ae = r && s && b, ye = s || n === 0 ? void 0 : `${n + 0.25}rem`, oe = () => {
40070
+ const P = window.location.origin, V = t.path && t.path.includes("http") ? new URL(t.path) : { origin: "", pathname: "" }, N = window.location.pathname.split("/")[1], j = V.pathname.split("/")[1], v = e.item.redirectUrl || e.ssr || !P.includes("local") && P !== V.origin || j !== N, Y = r ? "div" : !e.isInternalApp && v ? "a" : lk, z = t.redirectUrl || (t.path && t.path.includes("http") ? new URL(t.path).pathname : t.path) || "#", se = n + 1, ae = r && s && b, ye = s || n === 0 ? void 0 : `${n + 0.25}rem`, oe = () => {
40067
40071
  C(!0);
40068
40072
  }, te = () => {
40069
40073
  C(!1);
@@ -40098,7 +40102,6 @@ function nN({ ...e }) {
40098
40102
  {
40099
40103
  target: we,
40100
40104
  to: z,
40101
- href: z,
40102
40105
  draggable: "true",
40103
40106
  className: y("menu-item__link"),
40104
40107
  style: {
@@ -40114,10 +40117,10 @@ function nN({ ...e }) {
40114
40117
  // : undefined,
40115
40118
  },
40116
40119
  onClick: (je) => {
40117
- Y === "a" && we === "_blank" || (!r && t.path && localStorage.setItem(
40120
+ Y === "a" && we === "_blank" || (!r && t.path && (localStorage.setItem(
40118
40121
  "latestClickMenuPath",
40119
40122
  (t.path || "").replace(window.location.origin, "")
40120
- ), !s && e.toggleExpand(je));
40123
+ ), e.onClickItem(z)), !s && e.toggleExpand(je));
40121
40124
  },
40122
40125
  children: [
40123
40126
  /* @__PURE__ */ L.jsx(Ace, { cls: y, item: t }),
@@ -40551,6 +40554,7 @@ function Wce(e) {
40551
40554
  return /* @__PURE__ */ L.jsx(
40552
40555
  nN,
40553
40556
  {
40557
+ onClickItem: e.onClickItem,
40554
40558
  isInternalApp: e.isInternalApp,
40555
40559
  isActive: re,
40556
40560
  isCollapsed: d,