react-luminus-components 2.0.3-beta.r19-5 → 2.0.3-beta.r19-6

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/hooks.es.js CHANGED
@@ -1,68 +1,45 @@
1
- import { an as x, ap as k, bc as I } from "./nivo-bar-DXK3wbjv.js";
2
- import { bR as X, aQ as Y, bT as K, am as tt, bS as et, b6 as st, aq as nt, bv as rt, al as at, aF as ot, aT as ut } from "./nivo-bar-DXK3wbjv.js";
3
- import { u as ct, a as it } from "./useLocalStorageState-B3o2yBVf.js";
4
- import { useState as v, useEffect as f, useContext as L, useRef as C, useCallback as S } from "react";
5
- import { b as mt, u as ft, a as pt } from "./useEmployeePhotoPath-DdMmh1qU.js";
1
+ import { an as x, ap as I, bc as k } from "./nivo-bar-x25pkH7Y.js";
2
+ import { bR as X, aQ as Y, bT as ee, am as te, bS as se, b6 as ae, aq as ne, bv as re, al as oe, aF as ue, aT as le } from "./nivo-bar-x25pkH7Y.js";
3
+ import { u as ie, a as de } from "./useLocalStorageState-CgixnUsv.js";
4
+ import { useSuspenseQuery as L } from "@tanstack/react-query";
5
+ import { b as fe, u as pe, a as ge } from "./useEmployeePhotoPath-DdMmh1qU.js";
6
6
  import "react/jsx-runtime";
7
+ import { useContext as B, useRef as w, useState as T, useCallback as v, useEffect as g } from "react";
7
8
  import "react-router";
8
- import { createPortal as R } from "react-dom";
9
+ import { createPortal as F } from "react-dom";
9
10
  import "react-hook-form";
10
11
  import "react-flexmonster";
11
12
  import "@azure/msal-browser";
12
13
  import "@azure/msal-react";
13
- const $ = (e) => {
14
- let t = "pending", r, s;
15
- const n = e.then((u) => {
16
- t = "success", r = u;
17
- }, (u) => {
18
- t = "error", s = u instanceof Error ? u : new Error(String(u));
19
- });
20
- return () => {
21
- switch (t) {
22
- case "pending":
23
- throw n;
24
- case "success":
25
- return r;
26
- case "error":
27
- if (s.code === "ERR_CANCELED")
28
- return null;
29
- throw s;
30
- default:
31
- throw new Error("Unknown status");
32
- }
33
- };
34
- };
35
- function z(e, t) {
14
+ function Z(t, e) {
36
15
  const r = x({
37
16
  silent: !0,
38
- differentBaseUrl: t == null ? void 0 : t.customBaseUrl,
39
- customToken: t == null ? void 0 : t.customToken
40
- }), [s, n] = v(null);
41
- return f(() => {
42
- (async () => {
43
- const a = r.get(e).then((l) => l.data);
44
- n($(a));
45
- })();
46
- }, [r, e]), s;
17
+ differentBaseUrl: e == null ? void 0 : e.customBaseUrl,
18
+ customToken: e == null ? void 0 : e.customToken
19
+ }), { data: a } = L({
20
+ queryKey: [t],
21
+ queryFn: () => r.get(t).then((s) => s.data)
22
+ });
23
+ return a;
47
24
  }
48
- const B = (e, t, r) => {
49
- let s = "pending", n;
50
- const u = e.then((a) => {
51
- s = "success", n = a;
52
- }, (a) => {
53
- const l = a == null ? void 0 : a.response;
54
- (l == null ? void 0 : l.status) === 404 && r ? (s = "error-404", n = a) : (s = "error", n = a);
25
+ const O = (t, e, r) => {
26
+ let a = "pending", s;
27
+ const i = t.then((o) => {
28
+ a = "success", s = o;
29
+ }, (o) => {
30
+ const u = o == null ? void 0 : o.response;
31
+ (u == null ? void 0 : u.status) === 404 && r ? (a = "error-404", s = o) : (a = "error", s = o);
55
32
  });
56
33
  return () => {
57
- switch (s) {
34
+ switch (a) {
58
35
  case "pending":
59
- throw u;
36
+ throw i;
60
37
  case "success":
61
- return n;
38
+ return s;
62
39
  case "error":
63
- if (n.code === "ERR_CANCELED")
40
+ if (s.code === "ERR_CANCELED")
64
41
  return null;
65
- throw n;
42
+ throw s;
66
43
  case "error-404":
67
44
  throw new Error("404");
68
45
  default:
@@ -75,104 +52,104 @@ const B = (e, t, r) => {
75
52
  enabled: !0,
76
53
  nullStateBeforeLoad: !0,
77
54
  nullStateOnFail: !1
78
- }, H = (e, { loadOnInit: t = d.loadOnInit, enabled: r = d.enabled, silent: s = d.silent, nullStateBeforeLoad: n = d.nullStateBeforeLoad, nullStateOnFail: u = d.nullStateOnFail, customApiUrl: a, customBearerToken: l, dataTransformer: i, errorBoundaryOn404: o } = d) => {
79
- const c = x({
80
- silent: s,
81
- customToken: l,
82
- differentBaseUrl: a,
83
- noToastOnStatus: o ? [404] : void 0
84
- }), { startLoading: m, stopLoading: b } = L(k), T = C(0), { isAuthenticated: D } = I(), [A, h] = v(null), w = S(async (p, E) => {
85
- if (!D() || r === !1)
55
+ }, _ = (t, { loadOnInit: e = d.loadOnInit, enabled: r = d.enabled, silent: a = d.silent, nullStateBeforeLoad: s = d.nullStateBeforeLoad, nullStateOnFail: i = d.nullStateOnFail, customApiUrl: o, customBearerToken: u, dataTransformer: c, errorBoundaryOn404: n } = d) => {
56
+ const l = x({
57
+ silent: a,
58
+ customToken: u,
59
+ differentBaseUrl: o,
60
+ noToastOnStatus: n ? [404] : void 0
61
+ }), { startLoading: m, stopLoading: b } = B(I), E = w(0), { isAuthenticated: y } = k(), [P, h] = T(null), S = v(async (f, C) => {
62
+ if (!y() || r === !1)
86
63
  return;
87
- !s && m(`loadData-${e}-${E}`), n && h(null);
88
- const P = c.get(e, {
89
- signal: p
90
- }).then((y) => i ? i(y.data) : y.data).finally(() => !s && b(`loadData-${e}-${E}`));
91
- h(B(P, u ?? !1, o ?? !1));
64
+ !a && m(`loadData-${t}-${C}`), s && h(null);
65
+ const A = l.get(t, {
66
+ signal: f
67
+ }).then((D) => c ? c(D.data) : D.data).finally(() => !a && b(`loadData-${t}-${C}`));
68
+ h(O(A, i ?? !1, n ?? !1));
92
69
  }, [
93
- D,
70
+ y,
94
71
  r,
95
- s,
72
+ a,
96
73
  m,
97
- e,
98
- n,
74
+ t,
75
+ s,
76
+ l,
99
77
  c,
100
- i,
101
78
  b,
102
- u,
103
- o
79
+ i,
80
+ n
104
81
  ]);
105
- return f(() => {
106
- if (t === !1)
82
+ return g(() => {
83
+ if (e === !1)
107
84
  return;
108
- const p = new AbortController();
109
- return w(p.signal, ++T.current), () => {
110
- p.abort();
85
+ const f = new AbortController();
86
+ return S(f.signal, ++E.current), () => {
87
+ f.abort();
111
88
  };
112
- }, [w, t]), { data: A, setData: h, reloadData: w };
113
- }, Z = () => {
114
- const e = C({}).current;
115
- return f(() => {
116
- const t = document.createElement("div");
117
- return t.style.position = "absolute", t.style.pointerEvents = "none", t.style.top = "0", t.style.width = "100%", t.style.height = "100%", e.elt = t, document.body.appendChild(t), () => {
118
- document.body.removeChild(t);
89
+ }, [S, e]), { data: P, setData: h, reloadData: S };
90
+ }, j = () => {
91
+ const t = w({}).current;
92
+ return g(() => {
93
+ const e = document.createElement("div");
94
+ return e.style.position = "absolute", e.style.pointerEvents = "none", e.style.top = "0", e.style.width = "100%", e.style.height = "100%", t.elt = e, document.body.appendChild(e), () => {
95
+ document.body.removeChild(e);
119
96
  };
120
- }, [e]), (t) => (r, ...s) => {
121
- const n = t(r, ...s);
122
- return r.draggableProps.style.position === "fixed" ? R(n, e.elt) : n;
97
+ }, [t]), (e) => (r, ...a) => {
98
+ const s = e(r, ...a);
99
+ return r.draggableProps.style.position === "fixed" ? F(s, t.elt) : s;
123
100
  };
124
- }, g = {
101
+ }, p = {
125
102
  storageKey: "--tmp-scroll-save--",
126
103
  requiredHeight: 100,
127
104
  retryInterval: 50
128
- }, j = (e, { storageKey: t = g.storageKey, requiredHeight: r = g.requiredHeight, retryInterval: s = g.retryInterval } = g) => {
129
- const [n, u] = v(!1), a = C(null), l = S(() => {
130
- const o = localStorage.getItem(t);
131
- return localStorage.removeItem(t), o === null ? null : Number(o);
132
- }, [t]), i = S((o) => {
133
- localStorage.setItem(t, o);
134
- }, [t]);
135
- return f(() => {
136
- const o = window.setInterval(() => {
137
- if (!n && e.current !== null && e.current.getBoundingClientRect().height > r) {
138
- u(!0);
139
- const c = l();
140
- c !== null && e.current.scrollTo({ top: c }), window.clearInterval(o);
105
+ }, J = (t, { storageKey: e = p.storageKey, requiredHeight: r = p.requiredHeight, retryInterval: a = p.retryInterval } = p) => {
106
+ const [s, i] = T(!1), o = w(null), u = v(() => {
107
+ const n = localStorage.getItem(e);
108
+ return localStorage.removeItem(e), n === null ? null : Number(n);
109
+ }, [e]), c = v((n) => {
110
+ localStorage.setItem(e, n);
111
+ }, [e]);
112
+ return g(() => {
113
+ const n = window.setInterval(() => {
114
+ if (!s && t.current !== null && t.current.getBoundingClientRect().height > r) {
115
+ i(!0);
116
+ const l = u();
117
+ l !== null && t.current.scrollTo({ top: l }), window.clearInterval(n);
141
118
  }
142
- }, s);
119
+ }, a);
143
120
  return () => {
144
- window.clearTimeout(o);
121
+ window.clearTimeout(n);
145
122
  };
146
- }, [n, r, l, s, e]), f(() => {
147
- var c;
148
- const o = new AbortController();
149
- return (c = e.current) == null || c.addEventListener("scrollend", () => {
123
+ }, [s, r, u, a, t]), g(() => {
124
+ var l;
125
+ const n = new AbortController();
126
+ return (l = t.current) == null || l.addEventListener("scrollend", () => {
150
127
  var m;
151
- a.current = ((m = e.current) == null ? void 0 : m.scrollTop) ?? 0, i((a.current ?? 0).toString());
152
- }, { signal: o.signal }), () => o.abort();
153
- }, [i, e]), { saveValue: i, retrieveValue: l };
128
+ o.current = ((m = t.current) == null ? void 0 : m.scrollTop) ?? 0, c((o.current ?? 0).toString());
129
+ }, { signal: n.signal }), () => n.abort();
130
+ }, [c, t]), { saveValue: c, retrieveValue: u };
154
131
  };
155
132
  export {
156
133
  X as cancelToken,
157
- I as useAuth,
134
+ k as useAuth,
158
135
  x as useAxios,
159
136
  Y as useClickOutside,
160
- K as useClipboard,
161
- tt as useConfirm,
162
- mt as useEmployeePhotoPath,
163
- et as useFormControlType,
164
- ct as useGetApiData,
165
- H as useGetApiDataBound,
166
- z as useGetDataBound,
167
- st as useKeyPress,
168
- it as useLocalStorageState,
169
- nt as useNotifications,
170
- rt as usePermissions,
171
- at as usePrompt,
172
- Z as useRenderDraggableInPortal,
173
- j as useScrollSave,
174
- ft as useSearchQuery,
175
- pt as useSearchQueryState,
176
- ot as useWindowSize,
177
- ut as useZodSchemaTypes
137
+ ee as useClipboard,
138
+ te as useConfirm,
139
+ fe as useEmployeePhotoPath,
140
+ se as useFormControlType,
141
+ ie as useGetApiData,
142
+ _ as useGetApiDataBound,
143
+ Z as useGetDataBound,
144
+ ae as useKeyPress,
145
+ de as useLocalStorageState,
146
+ ne as useNotifications,
147
+ re as usePermissions,
148
+ oe as usePrompt,
149
+ j as useRenderDraggableInPortal,
150
+ J as useScrollSave,
151
+ pe as useSearchQuery,
152
+ ge as useSearchQueryState,
153
+ ue as useWindowSize,
154
+ le as useZodSchemaTypes
178
155
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),s=require("./nivo-bar-U0TkOANS.cjs"),f=require("react-router");require("react-hook-form");require("react-flexmonster");require("@azure/msal-browser");require("@azure/msal-react");require("react-dom");const I="_side-menu-item_o72rm_1",R="_disabled_o72rm_6",q="_hidden_o72rm_10",S="_nav-button_o72rm_13",L="_child_o72rm_21",O="_text_o72rm_26",A="_icon_o72rm_36",$="_collapse-icon_o72rm_42",K="_collapsed_o72rm_52",D="_collapse-icon-mini_o72rm_55",F="_expanded_o72rm_86",z="_children-container_o72rm_92",G="_visible_o72rm_100",H="_children_o72rm_92",U="_mobile_o72rm_112",i={sideMenuItem:I,disabled:R,hidden:q,navButton:S,child:L,text:O,icon:A,collapseIcon:$,collapsed:K,collapseIconMini:D,expanded:F,childrenContainer:z,visible:G,children:H,mobile:U},W=({item:n,menuExpanded:t,useTooltips:r,children:m})=>n.tooltip&&!t&&r?e.jsx(s.SimpleTooltip,{text:n.tooltip,placement:"top",delay:{show:1e3,hide:0},children:e.jsx("div",{children:m})}):m,w=({item:n,menuExpanded:t,collapsed:r,onCollapse:m,currentPath:x,useHover:c,useTooltips:N,isMobile:B,disableMode:d})=>{var j,y,k,g;const[P,p]=b.useState(!1),[v]=x.split("?"),M=n.linkTo===v||((j=n.children)==null?void 0:j.some(l=>l.linkTo===v)),u=b.useRef(null);return s.useClickOutside([u],()=>r&&m()),e.jsxs("li",{ref:u,className:s.classNames("luminus-side-menu-item",i.sideMenuItem,{[i.mobile]:B},{[i.expanded]:t},{active:P||M},{open:r&&n.children},{[d==="disable"?i.disabled:i.hidden]:n.disabled||n.notPermitted||((y=n.children)==null?void 0:y.every(l=>l.notPermitted||l.disabled))},{[d==="disable"?"disabled":"hidden"]:n.disabled||n.notPermitted||((k=n.children)==null?void 0:k.every(l=>l.notPermitted||l.disabled))}),onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[e.jsx(W,{item:n,menuExpanded:t,useTooltips:N,children:n.children?e.jsx(e.Fragment,{children:e.jsxs("button",{type:"button",className:s.classNames("nav-link",i.navButton),onClick:()=>{m()},children:[e.jsx("div",{className:s.classNames("icon",i.icon),children:n.icon}),!c&&!t&&e.jsx("div",{className:s.classNames("collapse-icon-mini rounded",i.collapseIconMini,{[i.collapsed]:r}),children:e.jsx(s.MdOutlineKeyboardArrowRight,{})}),t&&e.jsx("div",{className:s.classNames("text",i.text,"text-nowrap"),children:n.title}),t&&e.jsx("div",{className:s.classNames("collapse-icon",i.collapseIcon,{[i.collapsed]:r}),children:e.jsx(s.MdOutlineKeyboardArrowRight,{})})]})}):e.jsxs(f.Link,{to:n.disabled||n.notPermitted?"/":n.linkTo??"/",className:s.classNames("nav-link",i.navButton),children:[e.jsx("div",{className:s.classNames("icon",i.icon),children:n.icon}),t&&e.jsx("div",{className:s.classNames("text",i.text,"text-nowrap"),children:n.title})]})}),e.jsx("div",{className:s.classNames("children-container",i.childrenContainer,{[i.visible]:r}),children:e.jsx("div",{className:s.classNames("shadow rounded children",i.children),children:(g=n.children)==null?void 0:g.map(l=>e.jsx(f.Link,{to:l.disabled||l.notPermitted?"/":l.linkTo??"/",className:s.classNames("nav-link child rounded",i.navButton,i.child,{[d==="disable"?i.disabled:i.hidden]:l.disabled||l.notPermitted},{[d==="disable"?"disabled":"hidden"]:l.disabled||l.notPermitted}),onClick:m,children:e.jsx("div",{className:s.classNames("text",i.text,"text-nowrap"),children:l.title})},l.linkTo))})})]})},E="_side-menu_12rky_1",J="_sidebar-header_12rky_15",Q="_side-menu-content_12rky_22",V="_no-top-margin_12rky_28",X="_expand_12rky_34",Y="_only-logo_12rky_38",Z="_mobile_12rky_41",ee="_divider_12rky_56",h={sideMenu:E,sidebarHeader:J,sideMenuContent:Q,noTopMargin:V,expand:X,onlyLogo:Y,mobile:Z,divider:ee},se=14,ne=({headerItem:n,searchItem:t,shortcutsItem:r,mainItems:m,secondaryItems:x,expanded:c,setExpanded:N,currentPath:B,useHover:d,useTooltips:P,disableMode:p="disable"})=>{const[v,M]=b.useState(-1),{checkUserHasPermissions:u}=s.usePermissions(),j=b.useMemo(()=>m.map(o=>{var a;return{...o,notPermitted:!u(o.permissions??[],"any"),children:(a=o.children)==null?void 0:a.map(_=>({..._,notPermitted:!u(_.permissions??[],"any"),disabled:o.disabled||_.disabled}))}}),[m,u]),y=b.useMemo(()=>x.map(o=>{var a;return{...o,notPermitted:!u(o.permissions??[],"any"),children:(a=o.children)==null?void 0:a.map(_=>({..._,notPermitted:!u(_.permissions??[],"any")}))}}),[x,u]),k=o=>{M(o===v?-1:o)};b.useEffect(()=>{c||M(-1)},[c]);const g=b.useRef(null);s.useClickOutside([g],()=>N(!1));const l=b.useMemo(()=>[...j,...y].filter(o=>{var a;return p==="hide"?!o.disabled&&!o.notPermitted&&(((a=o.children)==null?void 0:a.filter(_=>!_.disabled&&!_.notPermitted))??[]).length>0:!0}),[j,y,p]),{isMobile:C}=s.useWindowSize();return e.jsxs("section",{ref:g,className:s.classNames("luminus-side-menu shadow",h.sideMenu,{[h.mobile]:C},{[h.expand]:c},{expand:c}),onMouseEnter:()=>d&&N(!0),onMouseLeave:()=>d&&N(!1),children:[e.jsx("div",{className:s.classNames("sidebar-header",h.sidebarHeader,{[h.onlyLogo]:d}),role:d?void 0:"button",onClick:d?void 0:()=>N(!c),children:d?n:c?e.jsxs(e.Fragment,{children:[e.jsx(s.MdOutlineKeyboardDoubleArrowLeft,{}),n]}):e.jsx(s.MdOutlineMenu,{})}),c&&(t||r)?e.jsxs("div",{className:"mb-3 d-flex flex-column gap-3",children:[r&&c?r:null,t&&c?t:null]}):null,e.jsxs("ul",{className:s.classNames(h.sideMenuContent,{[h.noTopMargin]:l.length>se}),children:[j.map((o,a)=>e.jsx(w,{item:o,menuExpanded:c,collapsed:a===v,onCollapse:()=>k(a),currentPath:B,useHover:d,useTooltips:P,isMobile:C,disableMode:p},o.title)),e.jsx("hr",{className:s.classNames("divider",h.divider)}),y.map((o,a)=>e.jsx(w,{item:o,menuExpanded:c,collapsed:a===v,onCollapse:()=>k(a),currentPath:B,useHover:d,useTooltips:P,isMobile:C,disableMode:p},o.title))]})]})},ie="_top-bar_lnmq0_1",oe="_top-bar-brand_lnmq0_12",T={topBar:ie,topBarBrand:oe},le=({appName:n,leftOffset:t,leftContent:r,centerContent:m,rightContent:x})=>e.jsx("nav",{className:s.classNames("luminus-top-bar shadow",T.topBar),style:{width:t?`calc(100% - ${t}px)`:void 0,left:t?`${t}px`:void 0},children:e.jsxs("div",{className:"w-100 row g-0",children:[e.jsxs("div",{className:"col-4 d-flex gap-3 align-items-center",children:[e.jsx(f.Link,{to:"/",className:s.classNames("luminus-top-bar-brand",T.topBarBrand),children:n}),r]}),e.jsx("div",{className:"col-4 d-flex align-items-center",children:m??null}),e.jsx("div",{className:"col-4 d-flex justify-content-end align-items-center",children:x??null})]})});exports.PageContainer=s.PageContainer;exports.SideContentBar=s.SideContentBar;exports.SideMenu=ne;exports.TopBar=le;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),s=require("./nivo-bar-BoNqpopc.cjs"),f=require("react-router");require("react-hook-form");require("react-flexmonster");require("@azure/msal-browser");require("@azure/msal-react");require("@tanstack/react-query");require("react-dom");const q="_side-menu-item_o72rm_1",I="_disabled_o72rm_6",R="_hidden_o72rm_10",S="_nav-button_o72rm_13",L="_child_o72rm_21",O="_text_o72rm_26",A="_icon_o72rm_36",$="_collapse-icon_o72rm_42",K="_collapsed_o72rm_52",D="_collapse-icon-mini_o72rm_55",F="_expanded_o72rm_86",z="_children-container_o72rm_92",G="_visible_o72rm_100",H="_children_o72rm_92",U="_mobile_o72rm_112",i={sideMenuItem:q,disabled:I,hidden:R,navButton:S,child:L,text:O,icon:A,collapseIcon:$,collapsed:K,collapseIconMini:D,expanded:F,childrenContainer:z,visible:G,children:H,mobile:U},W=({item:n,menuExpanded:t,useTooltips:r,children:m})=>n.tooltip&&!t&&r?e.jsx(s.SimpleTooltip,{text:n.tooltip,placement:"top",delay:{show:1e3,hide:0},children:e.jsx("div",{children:m})}):m,w=({item:n,menuExpanded:t,collapsed:r,onCollapse:m,currentPath:x,useHover:c,useTooltips:N,isMobile:B,disableMode:d})=>{var j,y,k,g;const[P,p]=b.useState(!1),[v]=x.split("?"),M=n.linkTo===v||((j=n.children)==null?void 0:j.some(l=>l.linkTo===v)),u=b.useRef(null);return s.useClickOutside([u],()=>r&&m()),e.jsxs("li",{ref:u,className:s.classNames("luminus-side-menu-item",i.sideMenuItem,{[i.mobile]:B},{[i.expanded]:t},{active:P||M},{open:r&&n.children},{[d==="disable"?i.disabled:i.hidden]:n.disabled||n.notPermitted||((y=n.children)==null?void 0:y.every(l=>l.notPermitted||l.disabled))},{[d==="disable"?"disabled":"hidden"]:n.disabled||n.notPermitted||((k=n.children)==null?void 0:k.every(l=>l.notPermitted||l.disabled))}),onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[e.jsx(W,{item:n,menuExpanded:t,useTooltips:N,children:n.children?e.jsx(e.Fragment,{children:e.jsxs("button",{type:"button",className:s.classNames("nav-link",i.navButton),onClick:()=>{m()},children:[e.jsx("div",{className:s.classNames("icon",i.icon),children:n.icon}),!c&&!t&&e.jsx("div",{className:s.classNames("collapse-icon-mini rounded",i.collapseIconMini,{[i.collapsed]:r}),children:e.jsx(s.MdOutlineKeyboardArrowRight,{})}),t&&e.jsx("div",{className:s.classNames("text",i.text,"text-nowrap"),children:n.title}),t&&e.jsx("div",{className:s.classNames("collapse-icon",i.collapseIcon,{[i.collapsed]:r}),children:e.jsx(s.MdOutlineKeyboardArrowRight,{})})]})}):e.jsxs(f.Link,{to:n.disabled||n.notPermitted?"/":n.linkTo??"/",className:s.classNames("nav-link",i.navButton),children:[e.jsx("div",{className:s.classNames("icon",i.icon),children:n.icon}),t&&e.jsx("div",{className:s.classNames("text",i.text,"text-nowrap"),children:n.title})]})}),e.jsx("div",{className:s.classNames("children-container",i.childrenContainer,{[i.visible]:r}),children:e.jsx("div",{className:s.classNames("shadow rounded children",i.children),children:(g=n.children)==null?void 0:g.map(l=>e.jsx(f.Link,{to:l.disabled||l.notPermitted?"/":l.linkTo??"/",className:s.classNames("nav-link child rounded",i.navButton,i.child,{[d==="disable"?i.disabled:i.hidden]:l.disabled||l.notPermitted},{[d==="disable"?"disabled":"hidden"]:l.disabled||l.notPermitted}),onClick:m,children:e.jsx("div",{className:s.classNames("text",i.text,"text-nowrap"),children:l.title})},l.linkTo))})})]})},E="_side-menu_12rky_1",J="_sidebar-header_12rky_15",Q="_side-menu-content_12rky_22",V="_no-top-margin_12rky_28",X="_expand_12rky_34",Y="_only-logo_12rky_38",Z="_mobile_12rky_41",ee="_divider_12rky_56",h={sideMenu:E,sidebarHeader:J,sideMenuContent:Q,noTopMargin:V,expand:X,onlyLogo:Y,mobile:Z,divider:ee},se=14,ne=({headerItem:n,searchItem:t,shortcutsItem:r,mainItems:m,secondaryItems:x,expanded:c,setExpanded:N,currentPath:B,useHover:d,useTooltips:P,disableMode:p="disable"})=>{const[v,M]=b.useState(-1),{checkUserHasPermissions:u}=s.usePermissions(),j=b.useMemo(()=>m.map(o=>{var a;return{...o,notPermitted:!u(o.permissions??[],"any"),children:(a=o.children)==null?void 0:a.map(_=>({..._,notPermitted:!u(_.permissions??[],"any"),disabled:o.disabled||_.disabled}))}}),[m,u]),y=b.useMemo(()=>x.map(o=>{var a;return{...o,notPermitted:!u(o.permissions??[],"any"),children:(a=o.children)==null?void 0:a.map(_=>({..._,notPermitted:!u(_.permissions??[],"any")}))}}),[x,u]),k=o=>{M(o===v?-1:o)};b.useEffect(()=>{c||M(-1)},[c]);const g=b.useRef(null);s.useClickOutside([g],()=>N(!1));const l=b.useMemo(()=>[...j,...y].filter(o=>{var a;return p==="hide"?!o.disabled&&!o.notPermitted&&(((a=o.children)==null?void 0:a.filter(_=>!_.disabled&&!_.notPermitted))??[]).length>0:!0}),[j,y,p]),{isMobile:C}=s.useWindowSize();return e.jsxs("section",{ref:g,className:s.classNames("luminus-side-menu shadow",h.sideMenu,{[h.mobile]:C},{[h.expand]:c},{expand:c}),onMouseEnter:()=>d&&N(!0),onMouseLeave:()=>d&&N(!1),children:[e.jsx("div",{className:s.classNames("sidebar-header",h.sidebarHeader,{[h.onlyLogo]:d}),role:d?void 0:"button",onClick:d?void 0:()=>N(!c),children:d?n:c?e.jsxs(e.Fragment,{children:[e.jsx(s.MdOutlineKeyboardDoubleArrowLeft,{}),n]}):e.jsx(s.MdOutlineMenu,{})}),c&&(t||r)?e.jsxs("div",{className:"mb-3 d-flex flex-column gap-3",children:[r&&c?r:null,t&&c?t:null]}):null,e.jsxs("ul",{className:s.classNames(h.sideMenuContent,{[h.noTopMargin]:l.length>se}),children:[j.map((o,a)=>e.jsx(w,{item:o,menuExpanded:c,collapsed:a===v,onCollapse:()=>k(a),currentPath:B,useHover:d,useTooltips:P,isMobile:C,disableMode:p},o.title)),e.jsx("hr",{className:s.classNames("divider",h.divider)}),y.map((o,a)=>e.jsx(w,{item:o,menuExpanded:c,collapsed:a===v,onCollapse:()=>k(a),currentPath:B,useHover:d,useTooltips:P,isMobile:C,disableMode:p},o.title))]})]})},ie="_top-bar_lnmq0_1",oe="_top-bar-brand_lnmq0_12",T={topBar:ie,topBarBrand:oe},le=({appName:n,leftOffset:t,leftContent:r,centerContent:m,rightContent:x})=>e.jsx("nav",{className:s.classNames("luminus-top-bar shadow",T.topBar),style:{width:t?`calc(100% - ${t}px)`:void 0,left:t?`${t}px`:void 0},children:e.jsxs("div",{className:"w-100 row g-0",children:[e.jsxs("div",{className:"col-4 d-flex gap-3 align-items-center",children:[e.jsx(f.Link,{to:"/",className:s.classNames("luminus-top-bar-brand",T.topBarBrand),children:n}),r]}),e.jsx("div",{className:"col-4 d-flex align-items-center",children:m??null}),e.jsx("div",{className:"col-4 d-flex justify-content-end align-items-center",children:x??null})]})});exports.PageContainer=s.PageContainer;exports.SideContentBar=s.SideContentBar;exports.SideMenu=ne;exports.TopBar=le;
package/dist/layout.es.js CHANGED
@@ -1,12 +1,13 @@
1
- import { jsxs as p, jsx as n, Fragment as S } from "react/jsx-runtime";
1
+ import { jsxs as u, jsx as n, Fragment as S } from "react/jsx-runtime";
2
2
  import { useState as $, useRef as A, useMemo as w, useEffect as j } from "react";
3
- import { aQ as O, c as l, _ as T, aD as D, bv as q, aF as F, bG as G, bH as H } from "./nivo-bar-DXK3wbjv.js";
4
- import { at as Ie, bI as Te } from "./nivo-bar-DXK3wbjv.js";
3
+ import { aQ as O, c as l, _ as T, aD as D, bv as q, aF as F, bG as G, bH as H } from "./nivo-bar-x25pkH7Y.js";
4
+ import { at as Te, bI as Le } from "./nivo-bar-x25pkH7Y.js";
5
5
  import { Link as I } from "react-router";
6
6
  import "react-hook-form";
7
7
  import "react-flexmonster";
8
8
  import "@azure/msal-browser";
9
9
  import "@azure/msal-react";
10
+ import "@tanstack/react-query";
10
11
  import "react-dom";
11
12
  const K = "_side-menu-item_o72rm_1", z = "_disabled_o72rm_6", Q = "_hidden_o72rm_10", U = "_nav-button_o72rm_13", W = "_child_o72rm_21", E = "_text_o72rm_26", J = "_icon_o72rm_36", V = "_collapse-icon_o72rm_42", X = "_collapsed_o72rm_52", Y = "_collapse-icon-mini_o72rm_55", Z = "_expanded_o72rm_86", ee = "_children-container_o72rm_92", ne = "_visible_o72rm_100", oe = "_children_o72rm_92", ie = "_mobile_o72rm_112", o = {
12
13
  sideMenuItem: K,
@@ -27,14 +28,14 @@ const K = "_side-menu-item_o72rm_1", z = "_disabled_o72rm_6", Q = "_hidden_o72rm
27
28
  }, se = ({ item: e, menuExpanded: t, useTooltips: a, children: m }) => e.tooltip && !t && a ? /* @__PURE__ */ n(D, { text: e.tooltip, placement: "top", delay: { show: 1e3, hide: 0 }, children: /* @__PURE__ */ n("div", { children: m }) }) : m, L = ({ item: e, menuExpanded: t, collapsed: a, onCollapse: m, currentPath: v, useHover: d, useTooltips: N, isMobile: P, disableMode: c }) => {
28
29
  var M, k, g, x;
29
30
  const [B, h] = $(!1), [y] = v.split("?"), f = e.linkTo === y || ((M = e.children) == null ? void 0 : M.some((s) => s.linkTo === y)), _ = A(null);
30
- return O([_], () => a && m()), /* @__PURE__ */ p("li", { ref: _, className: l("luminus-side-menu-item", o.sideMenuItem, { [o.mobile]: P }, {
31
+ return O([_], () => a && m()), /* @__PURE__ */ u("li", { ref: _, className: l("luminus-side-menu-item", o.sideMenuItem, { [o.mobile]: P }, {
31
32
  [o.expanded]: t
32
33
  }, { active: B || f }, { open: a && e.children }, {
33
34
  [c === "disable" ? o.disabled : o.hidden]: e.disabled || e.notPermitted || ((k = e.children) == null ? void 0 : k.every((s) => s.notPermitted || s.disabled))
34
35
  }, {
35
36
  [c === "disable" ? "disabled" : "hidden"]: e.disabled || e.notPermitted || ((g = e.children) == null ? void 0 : g.every((s) => s.notPermitted || s.disabled))
36
37
  }), onMouseEnter: () => h(!0), onMouseLeave: () => h(!1), children: [
37
- /* @__PURE__ */ n(se, { item: e, menuExpanded: t, useTooltips: N, children: e.children ? /* @__PURE__ */ n(S, { children: /* @__PURE__ */ p("button", { type: "button", className: l("nav-link", o.navButton), onClick: () => {
38
+ /* @__PURE__ */ n(se, { item: e, menuExpanded: t, useTooltips: N, children: e.children ? /* @__PURE__ */ n(S, { children: /* @__PURE__ */ u("button", { type: "button", className: l("nav-link", o.navButton), onClick: () => {
38
39
  m();
39
40
  }, children: [
40
41
  /* @__PURE__ */ n("div", { className: l("icon", o.icon), children: e.icon }),
@@ -45,7 +46,7 @@ const K = "_side-menu-item_o72rm_1", z = "_disabled_o72rm_6", Q = "_hidden_o72rm
45
46
  t && /* @__PURE__ */ n("div", { className: l("collapse-icon", o.collapseIcon, {
46
47
  [o.collapsed]: a
47
48
  }), children: /* @__PURE__ */ n(T, {}) })
48
- ] }) }) : /* @__PURE__ */ p(I, { to: e.disabled || e.notPermitted ? "/" : e.linkTo ?? "/", className: l("nav-link", o.navButton), children: [
49
+ ] }) }) : /* @__PURE__ */ u(I, { to: e.disabled || e.notPermitted ? "/" : e.linkTo ?? "/", className: l("nav-link", o.navButton), children: [
49
50
  /* @__PURE__ */ n("div", { className: l("icon", o.icon), children: e.icon }),
50
51
  t && /* @__PURE__ */ n("div", { className: l("text", o.text, "text-nowrap"), children: e.title })
51
52
  ] }) }),
@@ -66,16 +67,16 @@ const K = "_side-menu-item_o72rm_1", z = "_disabled_o72rm_6", Q = "_hidden_o72rm
66
67
  onlyLogo: ce,
67
68
  mobile: me,
68
69
  divider: _e
69
- }, ue = 14, Pe = ({ headerItem: e, searchItem: t, shortcutsItem: a, mainItems: m, secondaryItems: v, expanded: d, setExpanded: N, currentPath: P, useHover: c, useTooltips: B, disableMode: h = "disable" }) => {
70
+ }, pe = 14, Be = ({ headerItem: e, searchItem: t, shortcutsItem: a, mainItems: m, secondaryItems: v, expanded: d, setExpanded: N, currentPath: P, useHover: c, useTooltips: B, disableMode: h = "disable" }) => {
70
71
  const [y, f] = $(-1), { checkUserHasPermissions: _ } = q(), M = w(() => m.map((i) => {
71
72
  var r;
72
73
  return {
73
74
  ...i,
74
75
  notPermitted: !_(i.permissions ?? [], "any"),
75
- children: (r = i.children) == null ? void 0 : r.map((u) => ({
76
- ...u,
77
- notPermitted: !_(u.permissions ?? [], "any"),
78
- disabled: i.disabled || u.disabled
76
+ children: (r = i.children) == null ? void 0 : r.map((p) => ({
77
+ ...p,
78
+ notPermitted: !_(p.permissions ?? [], "any"),
79
+ disabled: i.disabled || p.disabled
79
80
  }))
80
81
  };
81
82
  }), [m, _]), k = w(() => v.map((i) => {
@@ -83,9 +84,9 @@ const K = "_side-menu-item_o72rm_1", z = "_disabled_o72rm_6", Q = "_hidden_o72rm
83
84
  return {
84
85
  ...i,
85
86
  notPermitted: !_(i.permissions ?? [], "any"),
86
- children: (r = i.children) == null ? void 0 : r.map((u) => ({
87
- ...u,
88
- notPermitted: !_(u.permissions ?? [], "any")
87
+ children: (r = i.children) == null ? void 0 : r.map((p) => ({
88
+ ...p,
89
+ notPermitted: !_(p.permissions ?? [], "any")
89
90
  }))
90
91
  };
91
92
  }), [v, _]), g = (i) => {
@@ -98,37 +99,37 @@ const K = "_side-menu-item_o72rm_1", z = "_disabled_o72rm_6", Q = "_hidden_o72rm
98
99
  O([x], () => N(!1));
99
100
  const s = w(() => [...M, ...k].filter((i) => {
100
101
  var r;
101
- return h === "hide" ? !i.disabled && !i.notPermitted && (((r = i.children) == null ? void 0 : r.filter((u) => !u.disabled && !u.notPermitted)) ?? []).length > 0 : !0;
102
+ return h === "hide" ? !i.disabled && !i.notPermitted && (((r = i.children) == null ? void 0 : r.filter((p) => !p.disabled && !p.notPermitted)) ?? []).length > 0 : !0;
102
103
  }), [M, k, h]), { isMobile: C } = F();
103
- return /* @__PURE__ */ p("section", { ref: x, className: l("luminus-side-menu shadow", b.sideMenu, { [b.mobile]: C }, {
104
+ return /* @__PURE__ */ u("section", { ref: x, className: l("luminus-side-menu shadow", b.sideMenu, { [b.mobile]: C }, {
104
105
  [b.expand]: d
105
106
  }, { expand: d }), onMouseEnter: () => c && N(!0), onMouseLeave: () => c && N(!1), children: [
106
107
  /* @__PURE__ */ n("div", { className: l("sidebar-header", b.sidebarHeader, {
107
108
  [b.onlyLogo]: c
108
- }), role: c ? void 0 : "button", onClick: c ? void 0 : () => N(!d), children: c ? e : d ? /* @__PURE__ */ p(S, { children: [
109
+ }), role: c ? void 0 : "button", onClick: c ? void 0 : () => N(!d), children: c ? e : d ? /* @__PURE__ */ u(S, { children: [
109
110
  /* @__PURE__ */ n(G, {}),
110
111
  e
111
112
  ] }) : /* @__PURE__ */ n(H, {}) }),
112
- d && (t || a) ? /* @__PURE__ */ p("div", { className: "mb-3 d-flex flex-column gap-3", children: [
113
+ d && (t || a) ? /* @__PURE__ */ u("div", { className: "mb-3 d-flex flex-column gap-3", children: [
113
114
  a && d ? a : null,
114
115
  t && d ? t : null
115
116
  ] }) : null,
116
- /* @__PURE__ */ p("ul", { className: l(b.sideMenuContent, {
117
- [b.noTopMargin]: s.length > ue
117
+ /* @__PURE__ */ u("ul", { className: l(b.sideMenuContent, {
118
+ [b.noTopMargin]: s.length > pe
118
119
  }), children: [
119
120
  M.map((i, r) => /* @__PURE__ */ n(L, { item: i, menuExpanded: d, collapsed: r === y, onCollapse: () => g(r), currentPath: P, useHover: c, useTooltips: B, isMobile: C, disableMode: h }, i.title)),
120
121
  /* @__PURE__ */ n("hr", { className: l("divider", b.divider) }),
121
122
  k.map((i, r) => /* @__PURE__ */ n(L, { item: i, menuExpanded: d, collapsed: r === y, onCollapse: () => g(r), currentPath: P, useHover: c, useTooltips: B, isMobile: C, disableMode: h }, i.title))
122
123
  ] })
123
124
  ] });
124
- }, pe = "_top-bar_lnmq0_1", be = "_top-bar-brand_lnmq0_12", R = {
125
- topBar: pe,
125
+ }, ue = "_top-bar_lnmq0_1", be = "_top-bar-brand_lnmq0_12", R = {
126
+ topBar: ue,
126
127
  topBarBrand: be
127
- }, Be = ({ appName: e, leftOffset: t, leftContent: a, centerContent: m, rightContent: v }) => /* @__PURE__ */ n("nav", { className: l("luminus-top-bar shadow", R.topBar), style: {
128
+ }, Ce = ({ appName: e, leftOffset: t, leftContent: a, centerContent: m, rightContent: v }) => /* @__PURE__ */ n("nav", { className: l("luminus-top-bar shadow", R.topBar), style: {
128
129
  width: t ? `calc(100% - ${t}px)` : void 0,
129
130
  left: t ? `${t}px` : void 0
130
- }, children: /* @__PURE__ */ p("div", { className: "w-100 row g-0", children: [
131
- /* @__PURE__ */ p("div", { className: "col-4 d-flex gap-3 align-items-center", children: [
131
+ }, children: /* @__PURE__ */ u("div", { className: "w-100 row g-0", children: [
132
+ /* @__PURE__ */ u("div", { className: "col-4 d-flex gap-3 align-items-center", children: [
132
133
  /* @__PURE__ */ n(I, { to: "/", className: l("luminus-top-bar-brand", R.topBarBrand), children: e }),
133
134
  a
134
135
  ] }),
@@ -136,8 +137,8 @@ const K = "_side-menu-item_o72rm_1", z = "_disabled_o72rm_6", Q = "_hidden_o72rm
136
137
  /* @__PURE__ */ n("div", { className: "col-4 d-flex justify-content-end align-items-center", children: v ?? null })
137
138
  ] }) });
138
139
  export {
139
- Ie as PageContainer,
140
- Te as SideContentBar,
141
- Pe as SideMenu,
142
- Be as TopBar
140
+ Te as PageContainer,
141
+ Le as SideContentBar,
142
+ Be as SideMenu,
143
+ Ce as TopBar
143
144
  };
@@ -13,7 +13,7 @@ function g(r, t) {
13
13
  }
14
14
  const l = (r, t, o = !0) => Object.keys(r).reduce((e, n) => {
15
15
  const c = r[n];
16
- return o && (c == null || c === "") || (e[n] = t(c, n)), e;
16
+ return o && c == null || (e[n] = t(c, n)), e;
17
17
  }, {}), f = (r, t) => {
18
18
  const o = t != null && t.query ? new URLSearchParams(l(t.query, (e) => (e == null ? void 0 : e.toString()) ?? "")) : null;
19
19
  return `${u(r, t != null && t.path ? l(t.path, (e) => (e == null ? void 0 : e.toString()) ?? null) : void 0)}${o && o.size > 0 ? `?${o.toString()}` : ""}`;
@@ -0,0 +1 @@
1
+ "use strict";const i=require("react-router"),s=(r,t,o)=>{let e=r;return t!==void 0&&(e=Math.max(e,t)),o!==void 0&&(e=Math.min(e,o)),e};function u(r,t){r.setValue(t,null)}function S(r,t){t.forEach(o=>{u(r,o)})}const l=(r,t,o=!0)=>Object.keys(r).reduce((e,n)=>{const c=r[n];return o&&c==null||(e[n]=t(c,n)),e},{}),a=(r,t)=>{const o=t!=null&&t.query?new URLSearchParams(l(t.query,e=>(e==null?void 0:e.toString())??"")):null;return`${i.generatePath(r,t!=null&&t.path?l(t.path,e=>(e==null?void 0:e.toString())??null):void 0)}${o&&o.size>0?`?${o.toString()}`:""}`},g=[{key:"msal",mode:"includes"},{key:"token",mode:"exact"},{key:"user",mode:"exact"},{key:"user-delegation",mode:"exact"}],h=(r=!0)=>{const t={};for(let o=0;o<localStorage.length;o++){const e=localStorage.key(o);if(e&&!(r&&g.some(({key:n,mode:c})=>c==="includes"?e.includes(n):e===n)))try{t[e]=JSON.parse(localStorage.getItem(e))}catch{t[e]=localStorage.getItem(e)}}return t},f=r=>{try{const t=JSON.parse(r);if(typeof t!="object"||t===null)return!1;Object.entries(t).forEach(([o,e])=>{localStorage.setItem(o,JSON.stringify(e))})}catch{return!1}return localStorage.removeItem("BnfTable-SettingsMigration"),!0};exports.dumpLocalStorage=h;exports.generateApiPath=a;exports.hookFormSetNull=u;exports.hookFormSetNulls=S;exports.limitNumber=s;exports.restoreLocalStorage=f;