react-luminus-components 2.0.3-beta.r19-10 → 2.0.3-beta.r19-12
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/.vite/manifest.json +26 -26
- package/dist/{FormDisabledProvider-Dy-3Z-9i.js → FormDisabledProvider-BPAzfs0s.js} +1 -1
- package/dist/{FormDisabledProvider-BdATzEBI.cjs → FormDisabledProvider-Df1ohtig.cjs} +1 -1
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +6 -6
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +63 -63
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +13 -13
- package/dist/main.cjs.js +2 -2
- package/dist/main.es.js +745 -746
- package/dist/{nivo-bar-CAW-Jx1M.js → nivo-bar-CkGPzpeT.js} +4205 -4184
- package/dist/{nivo-bar-BbLPKXdj.cjs → nivo-bar-DIQcMyXJ.cjs} +53 -53
- package/dist/{useLocalStorageState-CEmt5A-f.cjs → useLocalStorageState-BStYdTWW.cjs} +1 -1
- package/dist/{useLocalStorageState-BGMKqdB2.js → useLocalStorageState-Bwt8wp1e.js} +1 -1
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +3 -3
- package/package.json +1 -1
package/dist/.vite/manifest.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_FormDisabledProvider-
|
|
3
|
-
"file": "FormDisabledProvider-
|
|
2
|
+
"_FormDisabledProvider-BPAzfs0s.js": {
|
|
3
|
+
"file": "FormDisabledProvider-BPAzfs0s.js",
|
|
4
4
|
"name": "FormDisabledProvider",
|
|
5
5
|
"imports": [
|
|
6
|
-
"_nivo-bar-
|
|
6
|
+
"_nivo-bar-CkGPzpeT.js"
|
|
7
7
|
]
|
|
8
8
|
},
|
|
9
|
-
"_FormDisabledProvider-
|
|
10
|
-
"file": "FormDisabledProvider-
|
|
9
|
+
"_FormDisabledProvider-Df1ohtig.cjs": {
|
|
10
|
+
"file": "FormDisabledProvider-Df1ohtig.cjs",
|
|
11
11
|
"name": "FormDisabledProvider",
|
|
12
12
|
"imports": [
|
|
13
|
-
"_nivo-bar-
|
|
13
|
+
"_nivo-bar-DIQcMyXJ.cjs"
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
16
|
"_localStorageUtils-B7BmbR_u.js": {
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"file": "localStorageUtils-CkZslzIU.cjs",
|
|
22
22
|
"name": "localStorageUtils"
|
|
23
23
|
},
|
|
24
|
-
"_nivo-bar-
|
|
25
|
-
"file": "nivo-bar-
|
|
24
|
+
"_nivo-bar-CkGPzpeT.js": {
|
|
25
|
+
"file": "nivo-bar-CkGPzpeT.js",
|
|
26
26
|
"name": "nivo-bar"
|
|
27
27
|
},
|
|
28
|
-
"_nivo-bar-
|
|
29
|
-
"file": "nivo-bar-
|
|
28
|
+
"_nivo-bar-DIQcMyXJ.cjs": {
|
|
29
|
+
"file": "nivo-bar-DIQcMyXJ.cjs",
|
|
30
30
|
"name": "nivo-bar"
|
|
31
31
|
},
|
|
32
32
|
"_useEmployeePhotoPath-DdMmh1qU.js": {
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"file": "useEmployeePhotoPath-Q0EhpWOh.cjs",
|
|
38
38
|
"name": "useEmployeePhotoPath"
|
|
39
39
|
},
|
|
40
|
-
"_useLocalStorageState-
|
|
41
|
-
"file": "useLocalStorageState-
|
|
40
|
+
"_useLocalStorageState-BStYdTWW.cjs": {
|
|
41
|
+
"file": "useLocalStorageState-BStYdTWW.cjs",
|
|
42
42
|
"name": "useLocalStorageState",
|
|
43
43
|
"imports": [
|
|
44
|
-
"_nivo-bar-
|
|
44
|
+
"_nivo-bar-DIQcMyXJ.cjs"
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
|
-
"_useLocalStorageState-
|
|
48
|
-
"file": "useLocalStorageState-
|
|
47
|
+
"_useLocalStorageState-Bwt8wp1e.js": {
|
|
48
|
+
"file": "useLocalStorageState-Bwt8wp1e.js",
|
|
49
49
|
"name": "useLocalStorageState",
|
|
50
50
|
"imports": [
|
|
51
|
-
"_nivo-bar-
|
|
51
|
+
"_nivo-bar-CkGPzpeT.js"
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
54
|
"src/contexts/index.ts": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"src": "src/contexts/index.ts",
|
|
58
58
|
"isEntry": true,
|
|
59
59
|
"imports": [
|
|
60
|
-
"_nivo-bar-
|
|
61
|
-
"_FormDisabledProvider-
|
|
62
|
-
"_useLocalStorageState-
|
|
60
|
+
"_nivo-bar-DIQcMyXJ.cjs",
|
|
61
|
+
"_FormDisabledProvider-Df1ohtig.cjs",
|
|
62
|
+
"_useLocalStorageState-BStYdTWW.cjs"
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
65
|
"src/hooks/index.ts": {
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"src": "src/hooks/index.ts",
|
|
69
69
|
"isEntry": true,
|
|
70
70
|
"imports": [
|
|
71
|
-
"_nivo-bar-
|
|
72
|
-
"_useLocalStorageState-
|
|
71
|
+
"_nivo-bar-DIQcMyXJ.cjs",
|
|
72
|
+
"_useLocalStorageState-BStYdTWW.cjs",
|
|
73
73
|
"_useEmployeePhotoPath-Q0EhpWOh.cjs"
|
|
74
74
|
]
|
|
75
75
|
},
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"src": "src/layout/index.ts",
|
|
80
80
|
"isEntry": true,
|
|
81
81
|
"imports": [
|
|
82
|
-
"_nivo-bar-
|
|
82
|
+
"_nivo-bar-DIQcMyXJ.cjs"
|
|
83
83
|
]
|
|
84
84
|
},
|
|
85
85
|
"src/main.ts": {
|
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
"src": "src/main.ts",
|
|
89
89
|
"isEntry": true,
|
|
90
90
|
"imports": [
|
|
91
|
-
"_nivo-bar-
|
|
92
|
-
"_FormDisabledProvider-
|
|
91
|
+
"_nivo-bar-DIQcMyXJ.cjs",
|
|
92
|
+
"_FormDisabledProvider-Df1ohtig.cjs",
|
|
93
93
|
"_localStorageUtils-CkZslzIU.cjs",
|
|
94
|
-
"_useLocalStorageState-
|
|
94
|
+
"_useLocalStorageState-BStYdTWW.cjs",
|
|
95
95
|
"_useEmployeePhotoPath-Q0EhpWOh.cjs"
|
|
96
96
|
]
|
|
97
97
|
},
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"src": "src/utils/index.ts",
|
|
102
102
|
"isEntry": true,
|
|
103
103
|
"imports": [
|
|
104
|
-
"_nivo-bar-
|
|
104
|
+
"_nivo-bar-DIQcMyXJ.cjs",
|
|
105
105
|
"_localStorageUtils-CkZslzIU.cjs"
|
|
106
106
|
]
|
|
107
107
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as d, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { c as t, t as _, a as l, bQ as g } from "./nivo-bar-
|
|
2
|
+
import { c as t, t as _, a as l, bQ as g } from "./nivo-bar-CkGPzpeT.js";
|
|
3
3
|
const h = "_loading_obchl_1", u = "_spinner-grow_obchl_10", m = "_second_obchl_14", p = "_third_obchl_17", b = "_loadingBlock_obchl_21", f = "_sizeLine_obchl_29", w = "_sizeFill_obchl_36", e = {
|
|
4
4
|
loading: h,
|
|
5
5
|
spinnerGrow: u,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("react/jsx-runtime"),s=require("./nivo-bar-
|
|
1
|
+
"use strict";const i=require("react/jsx-runtime"),s=require("./nivo-bar-DIQcMyXJ.cjs"),d="_loading_obchl_1",_="_spinner-grow_obchl_10",u="_second_obchl_14",g="_third_obchl_17",h="_loadingBlock_obchl_21",m="_sizeLine_obchl_29",p="_sizeFill_obchl_36",o={loading:d,spinnerGrow:_,second:u,third:g,loadingBlock:h,sizeLine:m,sizeFill:p},N=()=>i.jsxs("div",{className:s.classNames("luminus-loading",o.loading),children:[i.jsx("div",{className:s.classNames("spinner-grow",o.spinnerGrow,"text-primary"),role:"status"}),i.jsx("div",{className:s.classNames("spinner-grow",o.spinnerGrow,"text-primary",o.second),role:"status"}),i.jsx("div",{className:s.classNames("spinner-grow",o.spinnerGrow,"text-primary",o.third),role:"status"})]});function c(e,n){const r=s.toDate(e);if(isNaN(n))return s.constructFrom(e,NaN);if(!n)return r;const a=r.getDate(),t=s.constructFrom(e,r.getTime());t.setMonth(r.getMonth()+n+1,0);const l=t.getDate();return a>=l?t:(r.setFullYear(t.getFullYear(),t.getMonth(),a),r)}function b(e,n){return c(e,n*12)}const x=({children:e,disabled:n})=>i.jsx(s.FormDisabledContext.Provider,{value:n,children:e});exports.FormDisabledProvider=x;exports.Loading=N;exports.addMonths=c;exports.addYears=b;exports.classes=o;
|
package/dist/contexts.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./nivo-bar-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./nivo-bar-DIQcMyXJ.cjs"),u=require("react/jsx-runtime"),e=require("react"),M=require("@azure/msal-browser"),p=require("@azure/msal-react");require("@tanstack/react-query");require("react-router");require("react-dom");require("react-hook-form");require("react-flexmonster");const L=require("./FormDisabledProvider-Df1ohtig.cjs"),T=require("./useLocalStorageState-BStYdTWW.cjs");function O(s){const l=n.toDate(s);return l.setHours(23,59,59,999),l}function q(){return O(Date.now())}function N(s,l){const a=+n.toDate(s),[t,o]=[+n.toDate(l.start),+n.toDate(l.end)].sort((r,c)=>r-c);return a>=t&&a<=o}function I(){return n.startOfDay(Date.now())}const U=({children:s})=>{const[l,a]=e.useState(!1),[t,o]=e.useState(""),[r,c]=e.useState(void 0),d=e.useCallback((f,x)=>{a(!0),o(f),c(x)},[]),m=e.useCallback(()=>{a(!1)},[]),i=e.useMemo(()=>({show:l,text:t,showConfirm:d,hideConfirm:m,textSm:r}),[l,t,d,m,r]);return u.jsxs(n.ConfirmContext.Provider,{value:i,children:[u.jsx(V,{}),s]})},G=()=>{const{texts:{confirm:s}}=e.useContext(n.LuminusComponentsContext),{isShown:l,text:a,onFinish:t}=n.usePrompt(),{options:o}=e.useContext(n.PromptContext),[r,c]=e.useState(o.defaultValue??""),d=e.useCallback(()=>{t(null)},[t]),m=e.useCallback(f=>{f.preventDefault(),!(o.required&&!r)&&(t(r),c(""))},[t,o.required,r]),i=e.useMemo(()=>({value:r,onChange:f=>c(f.currentTarget.value),className:"w-100",autoFocus:!0,tabIndex:0}),[r]);return e.useEffect(()=>{l===!0&&c(o.defaultValue??"")},[l,o.defaultValue]),u.jsxs(n.Modal,{show:l,size:"sm",centered:!0,onHide:d,children:[u.jsx(n.Modal.Header,{className:"justify-content-center",children:u.jsx(n.Modal.Title,{children:a})}),u.jsxs("form",{onSubmit:m,onKeyDown:f=>f.stopPropagation(),children:[u.jsxs(n.Modal.Body,{children:[o.input==="textarea"?u.jsx("textarea",{...i,rows:5}):void 0,o.input==="input"?u.jsx(n.FormControl,{...i,type:o.type}):void 0]}),u.jsxs(n.Modal.Footer,{className:"w-100 d-flex gap-5",children:[u.jsx(n.PrimaryButton,{variant:"outlined",color:"secondary",onClick:d,className:"flex-grow-1",children:s.cancel}),u.jsx(n.PrimaryButton,{color:"primary",disabled:o.required&&!r,type:"submit",className:"flex-grow-1",children:s.confirm})]})]})]})},H=({children:s})=>{const[l,a]=e.useState(!1),[t,o]=e.useState(""),[r,c]=e.useState({input:"textarea",type:"text"}),d=e.useRef(()=>{}),m=e.useCallback(x=>{o(x),a(!0)},[]),i=e.useCallback(()=>{a(!1)},[]),f=e.useMemo(()=>({isShown:l,text:t,showPrompt:m,hidePrompt:i,resolveRef:d,options:r,setOptions:c}),[l,t,m,i,r]);return u.jsxs(n.PromptContext.Provider,{value:f,children:[s,u.jsx(G,{})]})},R=({cookieDomain:s,axiosOptions:l,language:a,texts:t,ProjectIconComponent:o,localizationContext:r,chartColorPalette:c,children:d})=>{const m=e.useMemo(()=>({axiosOptions:l,cookieDomain:s,language:a,texts:t,ProjectIconComponent:o,localizationContext:r,chartColorPalette:c}),[l,s,a,o,r,t,c]);return u.jsx(n.LuminusComponentsContext.Provider,{value:m,children:u.jsx(U,{children:u.jsxs(H,{children:[u.jsx(n.Fe,{}),d]})})})},F=({children:s})=>{const[l,a]=e.useState(!1),[t]=e.useState(new Set),o=e.useCallback(d=>{t.add(d),a(!0)},[t]),r=e.useCallback(d=>{t.delete(d),t.size===0&&a(!1)},[t]),c=e.useMemo(()=>({isLoading:l,startLoading:o,stopLoading:r}),[l,o,r]);return u.jsxs(n.LoadingContext.Provider,{value:c,children:[l&&u.jsx(L.Loading,{}),s]})},_=({children:s})=>{const l=n.useAxios(),{msalInstance:a,getToken:t}=e.useContext(n.AuthContext),{delegation:o,setDelegation:r,setAvailableDelegations:c,refreshAvailableDelegations:d}=e.useContext(n.DelegationContext),[m,i]=e.useState(null),f=e.useCallback(async()=>{const C=await t();C&&i(C.token)},[t]);e.useEffect(()=>{f()},[f]);const g=e.useCallback(()=>{const C=localStorage.getItem("user")??null;return C?JSON.parse(C??""):null},[])(),[h,k]=e.useState({state:g?n.LoginState.LOGGED_IN:n.LoginState.LOGGING_IN,user:g}),S=e.useCallback(async C=>{let v=null;return await l.get("/user/detail",C?{headers:{Authorization:`Bearer ${C}`}}:void 0).then(w=>{v=w.data}).catch(()=>{v=null}),v},[l]),b=e.useCallback(()=>{localStorage.removeItem("user"),k({state:n.LoginState.LOGGED_OUT,user:null}),r(null),c(null)},[c,r]),y=e.useCallback(async C=>{k({state:n.LoginState.LOGGING_IN,user:null});const v=await S(C);return v?(k({state:n.LoginState.LOGGED_IN,user:v}),localStorage.setItem("user",JSON.stringify(v)),await d(),!0):(k({state:n.LoginState.LOGIN_FAILED,user:null}),!1)},[S,d]),D=e.useCallback(()=>{b()},[b]);e.useEffect(()=>{if(a){const C=a.addEventCallback(v=>{if(v.eventType===M.EventType.LOGIN_SUCCESS&&v.payload){const w=v.payload;i(w.accessToken)}});return()=>{C&&a.removeEventCallback(C)}}return()=>{}},[a,y,D]);const P=e.useCallback(async C=>{C&&await y(C).catch(()=>{D(),r(null)})},[y,D,r]);e.useEffect(()=>{P(m)},[m,o==null?void 0:o.id,P]);const A=e.useMemo(()=>({user:h.user,userLoginState:h,loginUser:y,logoutUser:D}),[h,y,D]);return u.jsx(n.UserContext.Provider,{value:A,children:s})},B=({...s})=>{const{cookieDomain:l}=e.useContext(n.LuminusComponentsContext),[,a]=n.useCookies(["Authorization"]),t=e.useMemo(()=>s.useMsal?s.msalInstance:null,[s.useMsal,s.useMsal?s.msalInstance:null]),o=e.useMemo(()=>s.useMsal?s.msalScopes:[],[s.useMsal,s.useMsal?s.msalScopes:null]),r=e.useMemo(()=>s.useMsal?s.msalExtraScopes:[],[s.useMsal,s.useMsal?s.msalExtraScopes:null]),c=e.useRef(null),d=e.useCallback(()=>{const x=localStorage.getItem("token");return x?{token:x,expiresOn:L.addYears(new Date(Date.now()),1)}:null},[]),m=e.useCallback(async()=>{var k;if(c.current)return c.current;const x=t==null?void 0:t.getActiveAccount(),g=x??((k=t==null?void 0:t.getAllAccounts())==null?void 0:k.at(0))??void 0;if(!g)return null;x||t==null||t.setActiveAccount(g);const h=t==null?void 0:t.acquireTokenSilent({scopes:o,account:g}).then(S=>({token:S.accessToken,expiresOn:S.expiresOn??new Date(Date.now())})).catch(S=>{if(console.error("Error acquiring token",S),S instanceof M.InteractionRequiredAuthError)return console.log("Silent token acquisition failed. Acquiring token using redirect"),t==null||t.acquireTokenRedirect({scopes:o,extraScopesToConsent:r}),null;throw S}).finally(()=>{c.current=null});return c.current=h??null,h??null},[t,o,r]),i=e.useCallback(async()=>s.useMsal?m():d(),[d,m,s.useMsal]),f=e.useMemo(()=>({useMsal:s.useMsal??!1,msalInstance:t,msalScopes:o,msalExtraScopes:r,getToken:i}),[s.useMsal,t,o,r,i]);return e.useEffect(()=>{if(s.useMsal&&t){const x=t.addEventCallback(g=>{if(g.eventType===M.EventType.LOGIN_SUCCESS||g.eventType===M.EventType.ACQUIRE_TOKEN_SUCCESS&&g.payload){const h=g.payload,k=h.account;t.setActiveAccount(k);const S=h.accessToken,b=h.expiresOn;a("Authorization",S,{path:"/",secure:!0,sameSite:"none",domain:l,expires:b??void 0})}g.error&&console.error("AuthProvider MSAL Error",g)});return()=>{x&&t.removeEventCallback(x)}}return()=>{}},[s.useMsal,t,a,l]),u.jsx(n.AuthContext.Provider,{value:f,children:s.useMsal?u.jsx(p.MsalProvider,{instance:s.msalInstance,children:s.children}):s.children})},z=({children:s,relativeEndpoint:l})=>{const[a,t,o]=T.useLocalStorageState("user-delegation",null),r=e.useMemo(()=>{if(!a)return null;const x=a.from?n.parseISO(a.from):I(),g=a.to?n.parseISO(a.to):q();return N(new Date(Date.now()),{start:x,end:g})?a:(t(null),null)},[a,t]),{data:c,setData:d,reloadData:m}=T.useGetApiData(l,{nullStateBeforeLoad:!1,nullStateOnFail:!0}),i=e.useRef(null);e.useEffect(()=>{const x=()=>{m(),i.current=window.setTimeout(x,n.msToStartOfNextDay()+5e3)};return x(),()=>{i.current!==null&&window.clearTimeout(i.current)}},[m]),e.useEffect(()=>{const x=()=>{o()};return window.addEventListener("focus",x),()=>{window.removeEventListener("focus",x)}},[o,m]);const f=e.useMemo(()=>({delegation:r,setDelegation:t,availableDelegations:c,setAvailableDelegations:d,refreshAvailableDelegations:m}),[r,t,c,d,m]);return u.jsx(n.DelegationContext.Provider,{value:f,children:s})},j=(s,l)=>s?`${s} | ${l}`:l,K=({defaultHelmet:s,children:l,helmetPrefix:a})=>{const[t,o]=e.useState([j(a??"",s)]),r=e.useCallback(i=>{o(f=>[...f,j(a??"",i)])},[a]),c=e.useCallback(()=>{o(i=>i.length>1?i.slice(0,-1):i)},[o]),d=e.useMemo(()=>t.at(-1)??"",[t]),m=e.useMemo(()=>({addHelmet:r,removeHelmet:c}),[r,c]);return u.jsxs(n.HelmetContext.Provider,{value:m,children:[u.jsx("title",{children:d}),l]})},E=50,V=()=>{const{texts:{confirm:s}}=e.useContext(n.LuminusComponentsContext),{onConfirm:l,onCancel:a,text:t,show:o,textSm:r}=n.useConfirm(),c=e.useMemo(()=>r===void 0?t.length>E:r,[t,r]),d=e.useMemo(()=>t.length>E,[t]),m=e.useCallback(i=>{if(o)switch(i.key){case"Enter":i.preventDefault(),i.stopPropagation(),l();break;case"Escape":i.preventDefault(),i.stopPropagation(),a();break}},[l,a,o]);return n.useKeyPress(m),u.jsxs(n.Modal,{show:o,size:d?void 0:"sm",centered:!0,onHide:a,children:[u.jsx(n.Modal.Header,{className:"justify-content-center",children:c?u.jsx(n.Typography,{variant:"body",children:t}):u.jsx(n.Modal.Title,{children:t})}),u.jsx(n.Modal.Body,{children:u.jsxs("div",{className:"w-100 d-flex gap-5",children:[u.jsx(n.PrimaryButton,{type:"button",variant:"outlined",color:"secondary",className:"w-100",onClick:a,children:s.no}),u.jsx(n.PrimaryButton,{type:"button",color:"primary",onClick:l,className:"w-100 ml",children:s.yes})]})})]})};exports.AuthContext=n.AuthContext;exports.DelegationContext=n.DelegationContext;exports.FormDisabledContext=n.FormDisabledContext;exports.HelmetContext=n.HelmetContext;exports.LoadingContext=n.LoadingContext;exports.LuminusComponentsContext=n.LuminusComponentsContext;exports.UserContext=n.UserContext;exports.useFormDisabledContext=n.useFormDisabledContext;exports.FormDisabledProvider=L.FormDisabledProvider;exports.AuthProvider=B;exports.DelegationProvider=z;exports.HelmetProvider=K;exports.LoadingProvider=F;exports.LuminusComponentsProvider=R;exports.UserProvider=_;
|
package/dist/contexts.es.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { t as E, bJ as K, bK as j, P as M, al as J, bL as R, a3 as T, ai as Q, Q as O, bM as V, ap as $, an as W, bb as q, bx as z, bd as k, ao as X, bN as Y, aC as H, bO as Z, bP as ee, am as te, b6 as ne, a4 as oe } from "./nivo-bar-
|
|
2
|
-
import { bQ as _e, af as Fe } from "./nivo-bar-
|
|
1
|
+
import { t as E, bJ as K, bK as j, P as M, al as J, bL as R, a3 as T, ai as Q, Q as O, bM as V, ap as $, an as W, bb as q, bx as z, bd as k, ao as X, bN as Y, aC as H, bO as Z, bP as ee, am as te, b6 as ne, a4 as oe } from "./nivo-bar-CkGPzpeT.js";
|
|
2
|
+
import { bQ as _e, af as Fe } from "./nivo-bar-CkGPzpeT.js";
|
|
3
3
|
import { jsxs as w, jsx as u } from "react/jsx-runtime";
|
|
4
4
|
import { useState as x, useCallback as m, useMemo as h, useContext as p, useEffect as b, useRef as G } from "react";
|
|
5
5
|
import { EventType as I, InteractionRequiredAuthError as se } from "@azure/msal-browser";
|
|
6
6
|
import { MsalProvider as re } from "@azure/msal-react";
|
|
7
|
-
import "react-router";
|
|
8
7
|
import "@tanstack/react-query";
|
|
8
|
+
import "react-router";
|
|
9
9
|
import "react-dom";
|
|
10
10
|
import "react-hook-form";
|
|
11
11
|
import "react-flexmonster";
|
|
12
|
-
import { L as ae, b as ce } from "./FormDisabledProvider-
|
|
13
|
-
import { F as qe } from "./FormDisabledProvider-
|
|
14
|
-
import { a as le, u as ie } from "./useLocalStorageState-
|
|
12
|
+
import { L as ae, b as ce } from "./FormDisabledProvider-BPAzfs0s.js";
|
|
13
|
+
import { F as qe } from "./FormDisabledProvider-BPAzfs0s.js";
|
|
14
|
+
import { a as le, u as ie } from "./useLocalStorageState-Bwt8wp1e.js";
|
|
15
15
|
function ue(t) {
|
|
16
16
|
const r = E(t);
|
|
17
17
|
return r.setHours(23, 59, 59, 999), r;
|
package/dist/hooks.cjs.js
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 u=require("./nivo-bar-DIQcMyXJ.cjs"),E=require("./useLocalStorageState-BStYdTWW.cjs"),I=require("@tanstack/react-query"),w=require("./useEmployeePhotoPath-Q0EhpWOh.cjs"),r=require("react");require("react/jsx-runtime");require("react-router");const T=require("react-dom");require("react-hook-form");require("react-flexmonster");require("@azure/msal-browser");require("@azure/msal-react");function L(t,e){const a=u.useAxios({silent:!0,differentBaseUrl:e==null?void 0:e.customBaseUrl,customToken:e==null?void 0:e.customToken}),{isAuthenticated:n}=u.useAuth(),{data:s}=I.useSuspenseQuery({queryKey:[t,n],queryFn:()=>a.get(t).then(c=>c.data)});return s}const O=t=>e=>(window.addEventListener(`storage_${t}`,e),()=>window.removeEventListener(`storage_${t}`,e)),x=(t,e,a=localStorage)=>{const[n]=r.useState(e),s=r.useRef(JSON.stringify(e)),c=r.useRef(e),l=r.useCallback(()=>{const S=a.getItem(t);return S!==s.current&&(s.current=S,c.current=s.current?JSON.parse(s.current):n),c.current},[t,a,n]),i=r.useMemo(()=>O(t),[t]),d=r.useSyncExternalStore(i,l),o=r.useCallback(S=>{a.setItem(t,JSON.stringify(S)),window.dispatchEvent(new Event(`storage_${t}`))},[t,a]);return r.useMemo(()=>[d,o],[d,o])},R=(t,e,a)=>{let n="pending",s;const c=t.then(l=>{n="success",s=l},l=>{const i=l==null?void 0:l.response;(i==null?void 0:i.status)===404&&a?(n="error-404",s=l):(n="error",s=l)});return()=>{switch(n){case"pending":throw c;case"success":return s;case"error":if(s.code==="ERR_CANCELED")return null;throw s;case"error-404":throw new Error("404");default:throw new Error("Unknown status")}}},m={loadOnInit:!0,silent:!1,enabled:!0,nullStateBeforeLoad:!0,nullStateOnFail:!1},V=(t,{loadOnInit:e=m.loadOnInit,enabled:a=m.enabled,silent:n=m.silent,nullStateBeforeLoad:s=m.nullStateBeforeLoad,nullStateOnFail:c=m.nullStateOnFail,customApiUrl:l,customBearerToken:i,dataTransformer:d,errorBoundaryOn404:o}=m)=>{const f=u.useAxios({silent:n,customToken:i,differentBaseUrl:l,noToastOnStatus:o?[404]:void 0}),{startLoading:S,stopLoading:C}=r.useContext(u.LoadingContext),D=r.useRef(0),{isAuthenticated:b}=u.useAuth(),[A,p]=r.useState(null),v=r.useCallback(async(g,y)=>{if(!b()||a===!1)return;!n&&S(`loadData-${t}-${y}`),s&&p(null);const q=f.get(t,{signal:g}).then(P=>d?d(P.data):P.data).finally(()=>!n&&C(`loadData-${t}-${y}`));p(R(q,c??!1,o??!1))},[b,a,n,S,t,s,f,d,C,c,o]);return r.useEffect(()=>{if(e===!1)return;const g=new AbortController;return v(g.signal,++D.current),()=>{g.abort()}},[v,e]),{data:A,setData:p,reloadData:v}},B=()=>{const t=r.useRef({}).current;return r.useEffect(()=>{const e=document.createElement("div");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),()=>{document.body.removeChild(e)}},[t]),e=>(a,...n)=>{const s=e(a,...n);return a.draggableProps.style.position==="fixed"?T.createPortal(s,t.elt):s}},h={storageKey:"--tmp-scroll-save--",requiredHeight:100,retryInterval:50},N=(t,{storageKey:e=h.storageKey,requiredHeight:a=h.requiredHeight,retryInterval:n=h.retryInterval}=h)=>{const[s,c]=r.useState(!1),l=r.useRef(null),i=r.useCallback(()=>{const o=localStorage.getItem(e);return localStorage.removeItem(e),o===null?null:Number(o)},[e]),d=r.useCallback(o=>{localStorage.setItem(e,o)},[e]);return r.useEffect(()=>{const o=window.setInterval(()=>{if(!s&&t.current!==null&&t.current.getBoundingClientRect().height>a){c(!0);const f=i();f!==null&&t.current.scrollTo({top:f}),window.clearInterval(o)}},n);return()=>{window.clearTimeout(o)}},[s,a,i,n,t]),r.useEffect(()=>{var f;const o=new AbortController;return(f=t.current)==null||f.addEventListener("scrollend",()=>{var S;l.current=((S=t.current)==null?void 0:S.scrollTop)??0,d((l.current??0).toString())},{signal:o.signal}),()=>o.abort()},[d,t]),{saveValue:d,retrieveValue:i}};exports.cancelToken=u.cancelToken;exports.useAuth=u.useAuth;exports.useAxios=u.useAxios;exports.useClickOutside=u.useClickOutside;exports.useClipboard=u.useClipboard;exports.useConfirm=u.useConfirm;exports.useFormControlType=u.useFormControlType;exports.useKeyPress=u.useKeyPress;exports.useNotifications=u.useNotifications;exports.usePermissions=u.usePermissions;exports.usePrompt=u.usePrompt;exports.useWindowSize=u.useWindowSize;exports.useZodSchemaTypes=u.useZodSchemaTypes;exports.useGetApiData=E.useGetApiData;exports.useLocalStorageState=E.useLocalStorageState;exports.useEmployeePhotoPath=w.useEmployeePhotoPath;exports.useSearchQuery=w.useSearchQuery;exports.useSearchQueryState=w.useSearchQueryState;exports.useGetApiDataBound=V;exports.useGetDataBound=L;exports.usePersistentState=x;exports.useRenderDraggableInPortal=B;exports.useScrollSave=N;
|
package/dist/hooks.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { an as I,
|
|
2
|
-
import { bR as nt, aQ as
|
|
3
|
-
import { u as gt, a as pt } from "./useLocalStorageState-
|
|
1
|
+
import { an as I, bc as P, ap as V } from "./nivo-bar-CkGPzpeT.js";
|
|
2
|
+
import { bR as nt, aQ as st, bT as rt, am as at, bS as ot, b6 as ut, aq as lt, bv as ct, al as it, aF as dt, aT as mt } from "./nivo-bar-CkGPzpeT.js";
|
|
3
|
+
import { u as gt, a as pt } from "./useLocalStorageState-Bwt8wp1e.js";
|
|
4
4
|
import { useSuspenseQuery as O } from "@tanstack/react-query";
|
|
5
|
-
import { b as
|
|
6
|
-
import { useState as b, useRef as f, useCallback as g, useMemo as x, useSyncExternalStore as $, useContext as N, useEffect as
|
|
5
|
+
import { b as ht, u as vt, a as wt } from "./useEmployeePhotoPath-DdMmh1qU.js";
|
|
6
|
+
import { useState as b, useRef as f, useCallback as g, useMemo as x, useSyncExternalStore as $, useContext as N, useEffect as h } from "react";
|
|
7
7
|
import "react/jsx-runtime";
|
|
8
8
|
import "react-router";
|
|
9
9
|
import { createPortal as B } from "react-dom";
|
|
@@ -12,36 +12,36 @@ import "react-flexmonster";
|
|
|
12
12
|
import "@azure/msal-browser";
|
|
13
13
|
import "@azure/msal-react";
|
|
14
14
|
function j(e, t) {
|
|
15
|
-
const
|
|
15
|
+
const r = I({
|
|
16
16
|
silent: !0,
|
|
17
17
|
differentBaseUrl: t == null ? void 0 : t.customBaseUrl,
|
|
18
18
|
customToken: t == null ? void 0 : t.customToken
|
|
19
|
-
}), { data:
|
|
20
|
-
queryKey: [e],
|
|
21
|
-
queryFn: () =>
|
|
19
|
+
}), { isAuthenticated: s } = P(), { data: n } = O({
|
|
20
|
+
queryKey: [e, s],
|
|
21
|
+
queryFn: () => r.get(e).then((u) => u.data)
|
|
22
22
|
});
|
|
23
|
-
return
|
|
23
|
+
return n;
|
|
24
24
|
}
|
|
25
|
-
const F = (e) => (t) => (window.addEventListener(`storage_${e}`, t), () => window.removeEventListener(`storage_${e}`, t)), K = (e, t,
|
|
26
|
-
const [
|
|
27
|
-
const
|
|
28
|
-
return
|
|
29
|
-
}, [e,
|
|
30
|
-
|
|
31
|
-
}, [e,
|
|
32
|
-
return x(() => [
|
|
33
|
-
}, q = (e, t,
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
|
|
25
|
+
const F = (e) => (t) => (window.addEventListener(`storage_${e}`, t), () => window.removeEventListener(`storage_${e}`, t)), K = (e, t, r = localStorage) => {
|
|
26
|
+
const [s] = b(t), n = f(JSON.stringify(t)), u = f(t), o = g(() => {
|
|
27
|
+
const i = r.getItem(e);
|
|
28
|
+
return i !== n.current && (n.current = i, u.current = n.current ? JSON.parse(n.current) : s), u.current;
|
|
29
|
+
}, [e, r, s]), l = x(() => F(e), [e]), c = $(l, o), a = g((i) => {
|
|
30
|
+
r.setItem(e, JSON.stringify(i)), window.dispatchEvent(new Event(`storage_${e}`));
|
|
31
|
+
}, [e, r]);
|
|
32
|
+
return x(() => [c, a], [c, a]);
|
|
33
|
+
}, q = (e, t, r) => {
|
|
34
|
+
let s = "pending", n;
|
|
35
|
+
const u = e.then((o) => {
|
|
36
|
+
s = "success", n = o;
|
|
37
37
|
}, (o) => {
|
|
38
|
-
const
|
|
39
|
-
(
|
|
38
|
+
const l = o == null ? void 0 : o.response;
|
|
39
|
+
(l == null ? void 0 : l.status) === 404 && r ? (s = "error-404", n = o) : (s = "error", n = o);
|
|
40
40
|
});
|
|
41
41
|
return () => {
|
|
42
|
-
switch (
|
|
42
|
+
switch (s) {
|
|
43
43
|
case "pending":
|
|
44
|
-
throw
|
|
44
|
+
throw u;
|
|
45
45
|
case "success":
|
|
46
46
|
return n;
|
|
47
47
|
case "error":
|
|
@@ -60,91 +60,91 @@ const F = (e) => (t) => (window.addEventListener(`storage_${e}`, t), () => windo
|
|
|
60
60
|
enabled: !0,
|
|
61
61
|
nullStateBeforeLoad: !0,
|
|
62
62
|
nullStateOnFail: !1
|
|
63
|
-
}, X = (e, { loadOnInit: t = m.loadOnInit, enabled:
|
|
63
|
+
}, X = (e, { loadOnInit: t = m.loadOnInit, enabled: r = m.enabled, silent: s = m.silent, nullStateBeforeLoad: n = m.nullStateBeforeLoad, nullStateOnFail: u = m.nullStateOnFail, customApiUrl: o, customBearerToken: l, dataTransformer: c, errorBoundaryOn404: a } = m) => {
|
|
64
64
|
const d = I({
|
|
65
|
-
silent:
|
|
66
|
-
customToken:
|
|
65
|
+
silent: s,
|
|
66
|
+
customToken: l,
|
|
67
67
|
differentBaseUrl: o,
|
|
68
68
|
noToastOnStatus: a ? [404] : void 0
|
|
69
|
-
}), { startLoading:
|
|
70
|
-
if (!E() ||
|
|
69
|
+
}), { startLoading: i, stopLoading: C } = N(V), T = f(0), { isAuthenticated: E } = P(), [A, v] = b(null), w = g(async (p, D) => {
|
|
70
|
+
if (!E() || r === !1)
|
|
71
71
|
return;
|
|
72
|
-
!
|
|
72
|
+
!s && i(`loadData-${e}-${D}`), n && v(null);
|
|
73
73
|
const L = d.get(e, {
|
|
74
74
|
signal: p
|
|
75
|
-
}).then((y) =>
|
|
76
|
-
|
|
75
|
+
}).then((y) => c ? c(y.data) : y.data).finally(() => !s && C(`loadData-${e}-${D}`));
|
|
76
|
+
v(q(L, u ?? !1, a ?? !1));
|
|
77
77
|
}, [
|
|
78
78
|
E,
|
|
79
|
-
s,
|
|
80
79
|
r,
|
|
81
|
-
|
|
80
|
+
s,
|
|
81
|
+
i,
|
|
82
82
|
e,
|
|
83
83
|
n,
|
|
84
84
|
d,
|
|
85
|
-
|
|
85
|
+
c,
|
|
86
86
|
C,
|
|
87
|
-
|
|
87
|
+
u,
|
|
88
88
|
a
|
|
89
89
|
]);
|
|
90
|
-
return
|
|
90
|
+
return h(() => {
|
|
91
91
|
if (t === !1)
|
|
92
92
|
return;
|
|
93
93
|
const p = new AbortController();
|
|
94
|
-
return
|
|
94
|
+
return w(p.signal, ++T.current), () => {
|
|
95
95
|
p.abort();
|
|
96
96
|
};
|
|
97
|
-
}, [
|
|
97
|
+
}, [w, t]), { data: A, setData: v, reloadData: w };
|
|
98
98
|
}, Y = () => {
|
|
99
99
|
const e = f({}).current;
|
|
100
|
-
return
|
|
100
|
+
return h(() => {
|
|
101
101
|
const t = document.createElement("div");
|
|
102
102
|
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), () => {
|
|
103
103
|
document.body.removeChild(t);
|
|
104
104
|
};
|
|
105
|
-
}, [e]), (t) => (
|
|
106
|
-
const n = t(
|
|
107
|
-
return
|
|
105
|
+
}, [e]), (t) => (r, ...s) => {
|
|
106
|
+
const n = t(r, ...s);
|
|
107
|
+
return r.draggableProps.style.position === "fixed" ? B(n, e.elt) : n;
|
|
108
108
|
};
|
|
109
109
|
}, S = {
|
|
110
110
|
storageKey: "--tmp-scroll-save--",
|
|
111
111
|
requiredHeight: 100,
|
|
112
112
|
retryInterval: 50
|
|
113
|
-
}, k = (e, { storageKey: t = S.storageKey, requiredHeight:
|
|
114
|
-
const [n,
|
|
113
|
+
}, k = (e, { storageKey: t = S.storageKey, requiredHeight: r = S.requiredHeight, retryInterval: s = S.retryInterval } = S) => {
|
|
114
|
+
const [n, u] = b(!1), o = f(null), l = g(() => {
|
|
115
115
|
const a = localStorage.getItem(t);
|
|
116
116
|
return localStorage.removeItem(t), a === null ? null : Number(a);
|
|
117
|
-
}, [t]),
|
|
117
|
+
}, [t]), c = g((a) => {
|
|
118
118
|
localStorage.setItem(t, a);
|
|
119
119
|
}, [t]);
|
|
120
|
-
return
|
|
120
|
+
return h(() => {
|
|
121
121
|
const a = window.setInterval(() => {
|
|
122
|
-
if (!n && e.current !== null && e.current.getBoundingClientRect().height >
|
|
123
|
-
|
|
124
|
-
const d =
|
|
122
|
+
if (!n && e.current !== null && e.current.getBoundingClientRect().height > r) {
|
|
123
|
+
u(!0);
|
|
124
|
+
const d = l();
|
|
125
125
|
d !== null && e.current.scrollTo({ top: d }), window.clearInterval(a);
|
|
126
126
|
}
|
|
127
|
-
},
|
|
127
|
+
}, s);
|
|
128
128
|
return () => {
|
|
129
129
|
window.clearTimeout(a);
|
|
130
130
|
};
|
|
131
|
-
}, [n,
|
|
131
|
+
}, [n, r, l, s, e]), h(() => {
|
|
132
132
|
var d;
|
|
133
133
|
const a = new AbortController();
|
|
134
134
|
return (d = e.current) == null || d.addEventListener("scrollend", () => {
|
|
135
|
-
var
|
|
136
|
-
o.current = ((
|
|
135
|
+
var i;
|
|
136
|
+
o.current = ((i = e.current) == null ? void 0 : i.scrollTop) ?? 0, c((o.current ?? 0).toString());
|
|
137
137
|
}, { signal: a.signal }), () => a.abort();
|
|
138
|
-
}, [
|
|
138
|
+
}, [c, e]), { saveValue: c, retrieveValue: l };
|
|
139
139
|
};
|
|
140
140
|
export {
|
|
141
141
|
nt as cancelToken,
|
|
142
|
-
|
|
142
|
+
P as useAuth,
|
|
143
143
|
I as useAxios,
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
st as useClickOutside,
|
|
145
|
+
rt as useClipboard,
|
|
146
146
|
at as useConfirm,
|
|
147
|
-
|
|
147
|
+
ht as useEmployeePhotoPath,
|
|
148
148
|
ot as useFormControlType,
|
|
149
149
|
gt as useGetApiData,
|
|
150
150
|
X as useGetApiDataBound,
|
|
@@ -157,8 +157,8 @@ export {
|
|
|
157
157
|
it as usePrompt,
|
|
158
158
|
Y as useRenderDraggableInPortal,
|
|
159
159
|
k as useScrollSave,
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
vt as useSearchQuery,
|
|
161
|
+
wt as useSearchQueryState,
|
|
162
162
|
dt as useWindowSize,
|
|
163
163
|
mt as useZodSchemaTypes
|
|
164
164
|
};
|
package/dist/layout.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./nivo-bar-DIQcMyXJ.cjs"),b=require("react"),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,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as u, jsx as n, Fragment as S } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { aQ as $, c as l, _ as T, aD as j, bv as D, aF as q, bG as F, bH as G } from "./nivo-bar-CkGPzpeT.js";
|
|
3
|
+
import { at as Te, bI as Le } from "./nivo-bar-CkGPzpeT.js";
|
|
4
|
+
import { useState as A, useRef as O, useMemo as w, useEffect as H } from "react";
|
|
5
5
|
import { Link as I } from "react-router";
|
|
6
6
|
import "react-hook-form";
|
|
7
7
|
import "react-flexmonster";
|
|
@@ -25,10 +25,10 @@ const K = "_side-menu-item_o72rm_1", z = "_disabled_o72rm_6", Q = "_hidden_o72rm
|
|
|
25
25
|
visible: ne,
|
|
26
26
|
children: oe,
|
|
27
27
|
mobile: ie
|
|
28
|
-
}, se = ({ item: e, menuExpanded: t, useTooltips: a, children: m }) => e.tooltip && !t && a ? /* @__PURE__ */ n(
|
|
28
|
+
}, se = ({ item: e, menuExpanded: t, useTooltips: a, children: m }) => e.tooltip && !t && a ? /* @__PURE__ */ n(j, { 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 }) => {
|
|
29
29
|
var M, k, g, x;
|
|
30
|
-
const [B, h] =
|
|
31
|
-
return
|
|
30
|
+
const [B, h] = A(!1), [y] = v.split("?"), f = e.linkTo === y || ((M = e.children) == null ? void 0 : M.some((s) => s.linkTo === y)), _ = O(null);
|
|
31
|
+
return $([_], () => a && m()), /* @__PURE__ */ u("li", { ref: _, className: l("luminus-side-menu-item", o.sideMenuItem, { [o.mobile]: P }, {
|
|
32
32
|
[o.expanded]: t
|
|
33
33
|
}, { active: B || f }, { open: a && e.children }, {
|
|
34
34
|
[c === "disable" ? o.disabled : o.hidden]: e.disabled || e.notPermitted || ((k = e.children) == null ? void 0 : k.every((s) => s.notPermitted || s.disabled))
|
|
@@ -68,7 +68,7 @@ const K = "_side-menu-item_o72rm_1", z = "_disabled_o72rm_6", Q = "_hidden_o72rm
|
|
|
68
68
|
mobile: me,
|
|
69
69
|
divider: _e
|
|
70
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" }) => {
|
|
71
|
-
const [y, f] =
|
|
71
|
+
const [y, f] = A(-1), { checkUserHasPermissions: _ } = D(), M = w(() => m.map((i) => {
|
|
72
72
|
var r;
|
|
73
73
|
return {
|
|
74
74
|
...i,
|
|
@@ -92,24 +92,24 @@ const K = "_side-menu-item_o72rm_1", z = "_disabled_o72rm_6", Q = "_hidden_o72rm
|
|
|
92
92
|
}), [v, _]), g = (i) => {
|
|
93
93
|
f(i === y ? -1 : i);
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
H(() => {
|
|
96
96
|
d || f(-1);
|
|
97
97
|
}, [d]);
|
|
98
|
-
const x =
|
|
99
|
-
|
|
98
|
+
const x = O(null);
|
|
99
|
+
$([x], () => N(!1));
|
|
100
100
|
const s = w(() => [...M, ...k].filter((i) => {
|
|
101
101
|
var r;
|
|
102
102
|
return h === "hide" ? !i.disabled && !i.notPermitted && (((r = i.children) == null ? void 0 : r.filter((p) => !p.disabled && !p.notPermitted)) ?? []).length > 0 : !0;
|
|
103
|
-
}), [M, k, h]), { isMobile: C } =
|
|
103
|
+
}), [M, k, h]), { isMobile: C } = q();
|
|
104
104
|
return /* @__PURE__ */ u("section", { ref: x, className: l("luminus-side-menu shadow", b.sideMenu, { [b.mobile]: C }, {
|
|
105
105
|
[b.expand]: d
|
|
106
106
|
}, { expand: d }), onMouseEnter: () => c && N(!0), onMouseLeave: () => c && N(!1), children: [
|
|
107
107
|
/* @__PURE__ */ n("div", { className: l("sidebar-header", b.sidebarHeader, {
|
|
108
108
|
[b.onlyLogo]: c
|
|
109
109
|
}), role: c ? void 0 : "button", onClick: c ? void 0 : () => N(!d), children: c ? e : d ? /* @__PURE__ */ u(S, { children: [
|
|
110
|
-
/* @__PURE__ */ n(
|
|
110
|
+
/* @__PURE__ */ n(F, {}),
|
|
111
111
|
e
|
|
112
|
-
] }) : /* @__PURE__ */ n(
|
|
112
|
+
] }) : /* @__PURE__ */ n(G, {}) }),
|
|
113
113
|
d && (t || a) ? /* @__PURE__ */ u("div", { className: "mb-3 d-flex flex-column gap-3", children: [
|
|
114
114
|
a && d ? a : null,
|
|
115
115
|
t && d ? t : null
|