react-luminus-components 1.3.76 → 1.3.78
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/README.md +349 -349
- package/dist/.vite/manifest.json +60 -95
- package/dist/Loading-CBsJX4LG.js +17 -0
- package/dist/Loading-If5qsvY2.cjs +1 -0
- package/dist/SimpleTooltip-DwgjTb1C.js +5 -0
- package/dist/{SimpleTooltip-Duct0nes.cjs → SimpleTooltip-dm9JzI9d.cjs} +1 -1
- package/dist/components/Documents/Documents.d.ts +10 -0
- package/dist/components/Documents/components/DocumentDirectory/DocumentDirectory.d.ts +5 -0
- package/dist/components/Documents/components/DocumentDirectory/components/DocumentDirectoryLabel/DocumentDirectoryLabel.d.ts +7 -0
- package/dist/components/Documents/components/DocumentDirectory/components/index.d.ts +1 -0
- package/dist/components/Documents/components/DocumentsActions/DocumentsActions.d.ts +7 -0
- package/dist/components/Documents/components/DocumentsActions/components/DocActionButton/DocActionButton.d.ts +10 -0
- package/dist/components/Documents/components/DocumentsActions/components/DocumentsUpload/DocumentsUpload.d.ts +10 -0
- package/dist/components/Documents/components/DocumentsActions/components/DocumentsUpload/componenets/UploadFilesModal/UploadFilesModal.d.ts +7 -0
- package/dist/components/Documents/components/DocumentsActions/components/DocumentsUpload/componenets/UploadFilesModal/hooks/useUploadFilesFormSchema.d.ts +18 -0
- package/dist/components/Documents/components/DocumentsActions/components/DocumentsUpload/componenets/index.d.ts +1 -0
- package/dist/components/Documents/components/DocumentsActions/components/index.d.ts +2 -0
- package/dist/components/Documents/components/DocumentsFilesTable/DocumentsFilesTable.d.ts +6 -0
- package/dist/components/Documents/components/DocumentsFilesTable/hooks/useDocumentsFilesColumns.d.ts +11 -0
- package/dist/components/Documents/components/DocumentsModals/DocumentsModals.d.ts +2 -0
- package/dist/components/Documents/components/DocumentsModals/components/CreateFolderModal/CreateFolderModal.d.ts +5 -0
- package/dist/components/Documents/components/DocumentsModals/components/CreateFolderModal/hooks/useDocCreateFolderForm.d.ts +13 -0
- package/dist/components/Documents/components/DocumentsModals/components/EditFileModal/EditFileModal.d.ts +5 -0
- package/dist/components/Documents/components/DocumentsModals/components/EditFileModal/EditFileModalInner.d.ts +8 -0
- package/dist/components/Documents/components/DocumentsModals/components/EditFileModal/hooks/useEditFileForm.d.ts +18 -0
- package/dist/components/Documents/components/DocumentsModals/components/index.d.ts +2 -0
- package/dist/components/Documents/components/DocumentsModals/types/DocumentsModalType.d.ts +2 -0
- package/dist/components/Documents/components/DocumentsRoot/DocumentsRoot.d.ts +5 -0
- package/dist/components/Documents/components/FileExtensionIcon/FileExtensionIcon.d.ts +7 -0
- package/dist/components/Documents/components/index.d.ts +6 -0
- package/dist/components/Documents/contexts/DocumentsContext.d.ts +13 -0
- package/dist/components/Documents/hooks/useDocContextApiActions.d.ts +17 -0
- package/dist/components/Documents/hooks/useDocumentsApiActions.d.ts +7 -0
- package/dist/components/Documents/hooks/useDocumentsDrag.d.ts +19 -0
- package/dist/components/Documents/hooks/useDocumentsReducer.d.ts +91 -0
- package/dist/components/Documents/index.d.ts +2 -0
- package/dist/components/Documents/types/api/DocType.d.ts +6 -0
- package/dist/components/Documents/types/api/DocumentFileModel.d.ts +18 -0
- package/dist/components/Documents/types/api/DocumentFolderModel.d.ts +9 -0
- package/dist/components/Documents/types/api/DocumentListModel.d.ts +8 -0
- package/dist/components/Documents/types/api/DocumentUploadModel.d.ts +6 -0
- package/dist/components/Documents/types/api/DocumentsCreateFolderModel.d.ts +8 -0
- package/dist/components/Documents/types/ui/DocumentFile.d.ts +6 -0
- package/dist/components/Documents/types/ui/DocumentFolder.d.ts +10 -0
- package/dist/components/Documents/types/ui/DocumentState.d.ts +2 -0
- package/dist/components/Documents/types/ui/DocumentsActionsObj.d.ts +14 -0
- package/dist/components/Documents/types/ui/DocumentsFolderId.d.ts +2 -0
- package/dist/components/Documents/types/ui/FileDirType.d.ts +2 -0
- package/dist/components/Documents/utils/documentsConstants.d.ts +1 -0
- package/dist/components/Documents/utils/documentsDataUtils.d.ts +12 -0
- package/dist/components/Documents/utils/documentsTypeUtils.d.ts +4 -0
- package/dist/components/Documents/utils/documentsUtils.d.ts +7 -0
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +103 -105
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +40 -2968
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +18 -18
- package/dist/main.cjs.js +2 -2
- package/dist/main.d.ts +2 -0
- package/dist/main.es.js +2958 -3364
- package/dist/models/luminus-context-types/CommonLuminusIcons.d.ts +1 -1
- package/dist/models/texts/ComponentsContextTexts.d.ts +2 -0
- package/dist/models/texts/DocumentsTexts.d.ts +45 -0
- package/dist/nivo-pie.es-CWpL5Qz1.cjs +279 -0
- package/dist/nivo-pie.es-CfGrs0qQ.js +21226 -0
- package/dist/{searchUtils-C-P7nqmc.js → searchUtils-6cFIcqrD.js} +1 -1
- package/dist/{searchUtils-Bwcn0kNN.cjs → searchUtils-eG-nNTgU.cjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/useClipboard-BbFBkj-c.cjs +1 -0
- package/dist/{useClipboard-Ci3XItTi.js → useClipboard-BsBDyYHu.js} +12 -13
- package/dist/useLocalStorageState-B8C3HlW-.cjs +1 -0
- package/dist/useLocalStorageState-D9uh-D8S.js +64 -0
- package/dist/{usePermissions-CDkc5n4B.cjs → usePermissions-D3jEVB-f.cjs} +1 -1
- package/dist/{usePermissions-D1kTfy1F.js → usePermissions-DInna_ZH.js} +1 -1
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +70 -105
- package/dist/variables.scss +171 -171
- package/package.json +111 -109
- package/dist/PrimaryButton-DHWMFBqe.js +0 -682
- package/dist/PrimaryButton-DoEWPvdG.cjs +0 -1
- package/dist/SimpleTooltip-DIbveCyg.js +0 -5
- package/dist/dateUtils-DBObp1Kn.js +0 -1402
- package/dist/dateUtils-UEaQDw00.cjs +0 -1
- package/dist/nivo-pie.es-CYja6R0y.cjs +0 -279
- package/dist/nivo-pie.es-DbylxdLa.js +0 -14728
- package/dist/useClipboard-KQiedKAp.cjs +0 -1
- package/dist/useConfirm-BFRnARZA.js +0 -18
- package/dist/useConfirm-SzzUX_WZ.cjs +0 -1
- package/dist/useLocalStorageState-C2fAE5hY.cjs +0 -1
- package/dist/useLocalStorageState-OXK3MAPN.js +0 -72
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type DocumentFileModel = {
|
|
2
|
+
id: number;
|
|
3
|
+
createdDate: string;
|
|
4
|
+
validToDate: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
size?: number;
|
|
9
|
+
fileExtension?: string;
|
|
10
|
+
docEntityId?: number;
|
|
11
|
+
docEntityName?: string;
|
|
12
|
+
documentTypeId?: number;
|
|
13
|
+
documentTypeName?: string;
|
|
14
|
+
archive: boolean;
|
|
15
|
+
dmsId?: number;
|
|
16
|
+
folderId: number;
|
|
17
|
+
};
|
|
18
|
+
export default DocumentFileModel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as DocumentFileModel } from './DocumentFileModel';
|
|
2
|
+
import { default as DocumentFolderModel } from './DocumentFolderModel';
|
|
3
|
+
|
|
4
|
+
type DocumentListModel = {
|
|
5
|
+
documents: Array<DocumentFileModel>;
|
|
6
|
+
folders: Array<DocumentFolderModel>;
|
|
7
|
+
};
|
|
8
|
+
export default DocumentListModel;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type DocumentFolder = {
|
|
2
|
+
name: string;
|
|
3
|
+
defaultDocType?: string;
|
|
4
|
+
childrenIds: Array<number>;
|
|
5
|
+
parentId: number | null;
|
|
6
|
+
isDefault: boolean;
|
|
7
|
+
onlyRead: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type DocumentFolderMap = Map<number, DocumentFolder>;
|
|
10
|
+
export default DocumentFolder;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as DocumentUploadModel } from '../api/DocumentUploadModel';
|
|
2
|
+
import { default as DocumentsFolderId } from './DocumentsFolderId';
|
|
3
|
+
|
|
4
|
+
type DocumentActionsObj = {
|
|
5
|
+
moveDocuments: (directoryId: number, fileIds?: Array<number>) => Promise<void>;
|
|
6
|
+
deleteFiles: (fileIds: Array<number>) => Promise<void>;
|
|
7
|
+
deleteDirectory: (dirId: DocumentsFolderId) => Promise<void>;
|
|
8
|
+
renameFiles: (newName: string) => Promise<void>;
|
|
9
|
+
downloadAsZip: () => Promise<void>;
|
|
10
|
+
archivateFiles: (isDearchive?: boolean) => Promise<void>;
|
|
11
|
+
downloadFile: (fileId: number, tryToOpen?: boolean) => Promise<void>;
|
|
12
|
+
uploadFiles: (fileList: FileList, uploadModel: DocumentUploadModel) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export default DocumentActionsObj;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DOCUMENTS_DESCRIPTION_MAX_LENGTH = 100;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as DocumentFileModel } from '../types/api/DocumentFileModel';
|
|
2
|
+
import { default as DocumentFolderModel } from '../types/api/DocumentFolderModel';
|
|
3
|
+
import { default as DocumentFile } from '../types/ui/DocumentFile';
|
|
4
|
+
import { default as DocumentFolder, DocumentFolderMap } from '../types/ui/DocumentFolder';
|
|
5
|
+
|
|
6
|
+
export declare function transformFolder(modelData: DocumentFolderModel): DocumentFolder;
|
|
7
|
+
export declare function transformFolderList(modelData: Array<DocumentFolderModel>): {
|
|
8
|
+
dirsMap: DocumentFolderMap;
|
|
9
|
+
rootIds: Array<number>;
|
|
10
|
+
};
|
|
11
|
+
export declare function filterFiles(files: Array<DocumentFile>, searchString: string): DocumentFile[];
|
|
12
|
+
export declare function transormFileList(files: Array<DocumentFileModel>, dirMap: DocumentFolderMap): Array<DocumentFile>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DocumentsReducerState, DocumentsReducerStateCommon, DocumentsReducerStateFolderChoosing, DocumentsReducerStateModal } from '../hooks/useDocumentsReducer';
|
|
2
|
+
|
|
3
|
+
export declare function assertReducerModalState(state: DocumentsReducerState): asserts state is DocumentsReducerStateModal & DocumentsReducerStateCommon;
|
|
4
|
+
export declare function assertReducerFolderChoosingState(state: DocumentsReducerState): asserts state is DocumentsReducerStateFolderChoosing & DocumentsReducerStateCommon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DocumentsContextType } from '../contexts/DocumentsContext';
|
|
2
|
+
import { default as DocumentFolder } from '../types/ui/DocumentFolder';
|
|
3
|
+
|
|
4
|
+
export declare function hasDescendant(folder: DocumentFolder, descendantId: number, folderMap: Map<number, DocumentFolder>): boolean;
|
|
5
|
+
export declare function canUploadToCurrent(contextState: DocumentsContextType['reducer'][0]): contextState is DocumentsContextType['reducer'][0] & {
|
|
6
|
+
activeFolder: number;
|
|
7
|
+
};
|
package/dist/contexts.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./nivo-pie.es-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./nivo-pie.es-CWpL5Qz1.cjs"),t=require("react"),v=require("@azure/msal-browser"),b=require("@azure/msal-react");require("react-router-dom");require("react-hook-form");const k=require("./Loading-If5qsvY2.cjs"),w=require("./useLocalStorageState-B8C3HlW-.cjs");function P(s){const u=e.toDate(s);return u.setHours(23,59,59,999),u}function I(){return P(Date.now())}function T(s,u){const n=+e.toDate(s),[o,r]=[+e.toDate(u.start),+e.toDate(u.end)].sort((a,i)=>a-i);return n>=o&&n<=r}function M(){return e.startOfDay(Date.now())}const A=({children:s})=>{const[u,n]=t.useState(!1),[o,r]=t.useState(""),a=t.useCallback(c=>{n(!0),r(c)},[]),i=t.useCallback(()=>{n(!1)},[]),l=t.useMemo(()=>({show:u,text:o,showConfirm:a,hideConfirm:i}),[u,o,a,i]);return e.jsxRuntimeExports.jsxs(e.ConfirmContext.Provider,{value:l,children:[e.jsxRuntimeExports.jsx(z,{}),s]})},O=()=>{const{texts:{confirm:s}}=t.useContext(e.LuminusComponentsContext),{isShown:u,text:n,onFinish:o}=e.usePrompt(),{options:r}=t.useContext(e.PromptContext),[a,i]=t.useState(r.defaultValue??""),l=t.useCallback(()=>{o(null)},[o]),c=t.useCallback(f=>{f.preventDefault(),!(r.required&&!a)&&o(a)},[o,r.required,a]);t.useEffect(()=>{u===!0&&i(r.defaultValue??"")},[u,r.defaultValue]);const d=t.useMemo(()=>({value:a,onChange:f=>i(f.currentTarget.value),className:"w-100",autoFocus:!0,tabIndex:0}),[a]);return e.jsxRuntimeExports.jsxs(e.Modal,{show:u,size:"sm",centered:!0,onHide:l,children:[e.jsxRuntimeExports.jsx(e.Modal.Header,{className:"justify-content-center",children:e.jsxRuntimeExports.jsx(e.Modal.Title,{children:n})}),e.jsxRuntimeExports.jsxs("form",{onSubmit:c,children:[e.jsxRuntimeExports.jsxs(e.Modal.Body,{children:[r.input==="textarea"?e.jsxRuntimeExports.jsx("textarea",{...d,rows:5}):void 0,r.input==="input"?e.jsxRuntimeExports.jsx(e.FormControl,{...d,type:r.type}):void 0]}),e.jsxRuntimeExports.jsxs(e.Modal.Footer,{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx(e.PrimaryButton,{variant:"outlined",color:"secondary",onClick:l,className:"flex-grow-1",children:s.cancel}),e.jsxRuntimeExports.jsx(e.PrimaryButton,{color:"primary",disabled:r.required&&!a,type:"submit",className:"flex-grow-1",children:s.confirm})]})]})]})},N=({children:s})=>{const[u,n]=t.useState(!1),[o,r]=t.useState(""),[a,i]=t.useState({input:"textarea",type:"text"}),l=t.useRef(()=>{}),c=t.useCallback(C=>{r(C),n(!0)},[]),d=t.useCallback(()=>{n(!1)},[]),f=t.useMemo(()=>({isShown:u,text:o,showPrompt:c,hidePrompt:d,resolveRef:l,options:a,setOptions:i}),[u,o,c,d,a]);return e.jsxRuntimeExports.jsxs(e.PromptContext.Provider,{value:f,children:[s,e.jsxRuntimeExports.jsx(O,{})]})},U=({cookieDomain:s,axiosOptions:u,language:n,texts:o,ProjectIconComponent:r,localizationContext:a,chartColorPalette:i,children:l})=>{const c=t.useMemo(()=>({axiosOptions:u,cookieDomain:s,language:n,texts:o,ProjectIconComponent:r,localizationContext:a,chartColorPalette:i}),[u,s,n,r,a,o,i]);return e.jsxRuntimeExports.jsx(e.LuminusComponentsContext.Provider,{value:c,children:e.jsxRuntimeExports.jsx(A,{children:e.jsxRuntimeExports.jsxs(N,{children:[e.jsxRuntimeExports.jsx(e.Ie,{}),l]})})})},G=({children:s})=>{const[u,n]=t.useState(!1),[o]=t.useState(new Set),r=t.useCallback(l=>{o.add(l),n(!0)},[o]),a=t.useCallback(l=>{o.delete(l),o.size===0&&n(!1)},[o]),i=t.useMemo(()=>({isLoading:u,startLoading:r,stopLoading:a}),[u,r,a]);return e.jsxRuntimeExports.jsxs(e.LoadingContext.Provider,{value:i,children:[u&&e.jsxRuntimeExports.jsx(k.Loading,{}),s]})},_=({children:s})=>{const u=e.useAxios(),{msalInstance:n}=t.useContext(e.AuthContext),{delegation:o,setDelegation:r,setAvailableDelegations:a,refreshAvailableDelegations:i}=t.useContext(e.DelegationContext),{getToken:l}=e.useAuth(),[c,d]=t.useState(null),f=t.useCallback(async()=>{const x=await l();x&&d(x)},[l]);t.useEffect(()=>{f()},[f]);const p=t.useCallback(()=>{const x=localStorage.getItem("user")??null;return x?JSON.parse(x??""):null},[])(),[E,h]=t.useState({state:p?e.LoginState.LOGGED_IN:e.LoginState.LOGGING_IN,user:p}),L=t.useCallback(async x=>{let m=null;return await u.get("/user/detail",x?{headers:{Authorization:`Bearer ${x}`}}:void 0).then(S=>{m=S.data}).catch(()=>{m=null}),m},[u]),y=t.useCallback(()=>{localStorage.removeItem("user"),h({state:e.LoginState.LOGGED_OUT,user:null}),r(null),a(null)},[a,r]),j=t.useCallback(async x=>{h({state:e.LoginState.LOGGING_IN,user:null});const m=await L(x);return m?(h({state:e.LoginState.LOGGED_IN,user:m}),localStorage.setItem("user",JSON.stringify(m)),await i(),!0):(h({state:e.LoginState.LOGIN_FAILED,user:null}),!1)},[L,i]),g=t.useCallback(()=>{y()},[y]);t.useEffect(()=>{if(n){const x=n.addEventCallback(m=>{if(m.eventType===v.EventType.LOGIN_SUCCESS&&m.payload){const S=m.payload;d(S.accessToken)}});return()=>{x&&n.removeEventCallback(x)}}return()=>{}},[n,j,g]);const R=t.useCallback(async x=>{x&&await j(x).catch(()=>{g(),r(null)})},[j,g,r]);t.useEffect(()=>{R(c)},[c,o==null?void 0:o.id,R]);const D=t.useMemo(()=>({user:E.user,userLoginState:E,loginUser:j,logoutUser:g}),[E,j,g]);return e.jsxRuntimeExports.jsx(e.UserContext.Provider,{value:D,children:s})},q=({...s})=>{const{cookieDomain:u}=t.useContext(e.LuminusComponentsContext),[,n]=e.useCookies(["Authorization"]),o=t.useMemo(()=>({useMsal:s.useMsal??!1,msalInstance:s.useMsal?s.msalInstance??null:null,msalScopes:s.useMsal?s.msalScopes??[]:[]}),[s]);return t.useEffect(()=>{if(s.useMsal){const r=s.msalInstance.addEventCallback(a=>{if(a.eventType===v.EventType.LOGIN_SUCCESS||a.eventType===v.EventType.ACQUIRE_TOKEN_SUCCESS&&a.payload){const i=a.payload,l=i.account;s.msalInstance.setActiveAccount(l);const c=i.accessToken,d=i.expiresOn;n("Authorization",c,{path:"/",secure:!0,sameSite:"none",domain:u,expires:d??void 0})}a.error&&console.error("AuthProvider MSAL Error",a)});return()=>{r&&s.msalInstance.removeEventCallback(r)}}return()=>{}},[s,n,u]),e.jsxRuntimeExports.jsx(e.AuthContext.Provider,{value:o,children:s.useMsal?e.jsxRuntimeExports.jsx(b.MsalProvider,{instance:s.msalInstance,children:s.children}):s.children})},B=({children:s,relativeEndpoint:u})=>{const[n,o,r]=w.useLocalStorageState("user-delegation",null),a=t.useMemo(()=>{if(!n)return null;const C=n.from?e.parseISO(n.from):M(),p=n.to?e.parseISO(n.to):I();return T(new Date(Date.now()),{start:C,end:p})?n:(o(null),null)},[n,o]),{data:i,setData:l,reloadData:c}=w.useGetApiData(u,{nullStateBeforeLoad:!1,nullStateOnFail:!0}),d=t.useRef(null);t.useEffect(()=>{const C=()=>{c(),d.current=window.setTimeout(C,e.msToStartOfNextDay()+5e3)};return C(),()=>{d.current!==null&&window.clearTimeout(d.current)}},[c]),t.useEffect(()=>{const C=()=>{r()};return window.addEventListener("focus",C),()=>{window.removeEventListener("focus",C)}},[r,c]);const f=t.useMemo(()=>({delegation:a,setDelegation:o,availableDelegations:i,setAvailableDelegations:l,refreshAvailableDelegations:c}),[a,o,i,l,c]);return e.jsxRuntimeExports.jsx(e.DelegationContext.Provider,{value:f,children:s})},z=()=>{const{texts:{confirm:s}}=t.useContext(e.LuminusComponentsContext),{onConfirm:u,onCancel:n,text:o,show:r}=e.useConfirm();return e.jsxRuntimeExports.jsxs(e.Modal,{show:r,size:"sm",centered:!0,onHide:n,children:[e.jsxRuntimeExports.jsx(e.Modal.Header,{className:"justify-content-center",children:e.jsxRuntimeExports.jsx(e.Modal.Title,{children:o})}),e.jsxRuntimeExports.jsx(e.Modal.Body,{children:e.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx(e.PrimaryButton,{type:"button",variant:"outlined",color:"secondary",className:"w-100",onClick:n,children:s.no}),e.jsxRuntimeExports.jsx(e.PrimaryButton,{type:"button",color:"primary",onClick:u,className:"w-100 ml",children:s.yes})]})})]})};exports.AuthContext=e.AuthContext;exports.DelegationContext=e.DelegationContext;exports.LoadingContext=e.LoadingContext;exports.LuminusComponentsContext=e.LuminusComponentsContext;exports.UserContext=e.UserContext;exports.AuthProvider=q;exports.DelegationProvider=B;exports.LoadingProvider=G;exports.LuminusComponentsProvider=U;exports.UserProvider=_;
|
package/dist/contexts.es.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { t as L, j as r, as as
|
|
2
|
-
import { useState as v, useCallback as d, useMemo as S, useContext as j, useEffect as
|
|
3
|
-
import { EventType as
|
|
4
|
-
import { MsalProvider as
|
|
1
|
+
import { t as L, aY as z, j as r, aZ as B, a2 as b, a_ as H, a$ as U, ap as g, al as q, a3 as T, b0 as V, aN as J, ao as $, aC as _, b1 as M, aD as K, aF as w, aE as Q, b2 as W, an as G, b3 as Y, aP as Z } from "./nivo-pie.es-CfGrs0qQ.js";
|
|
2
|
+
import { useState as v, useCallback as d, useMemo as S, useContext as j, useEffect as C, useRef as R } from "react";
|
|
3
|
+
import { EventType as E } from "@azure/msal-browser";
|
|
4
|
+
import { MsalProvider as X } from "@azure/msal-react";
|
|
5
5
|
import "react-router-dom";
|
|
6
6
|
import "react-hook-form";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { u as Y, a as Z, b as ee } from "./useLocalStorageState-OXK3MAPN.js";
|
|
10
|
-
import { e as te, p as U, m as se } from "./dateUtils-DBObp1Kn.js";
|
|
7
|
+
import { L as ee } from "./Loading-CBsJX4LG.js";
|
|
8
|
+
import { u as te, a as se } from "./useLocalStorageState-D9uh-D8S.js";
|
|
11
9
|
function ne(e) {
|
|
12
10
|
const a = L(e);
|
|
13
11
|
return a.setHours(23, 59, 59, 999), a;
|
|
@@ -19,53 +17,53 @@ function ae(e, a) {
|
|
|
19
17
|
const t = +L(e), [s, n] = [
|
|
20
18
|
+L(a.start),
|
|
21
19
|
+L(a.end)
|
|
22
|
-
].sort((o,
|
|
20
|
+
].sort((o, l) => o - l);
|
|
23
21
|
return t >= s && t <= n;
|
|
24
22
|
}
|
|
25
23
|
function re() {
|
|
26
|
-
return
|
|
24
|
+
return z(Date.now());
|
|
27
25
|
}
|
|
28
|
-
const
|
|
26
|
+
const le = ({ children: e }) => {
|
|
29
27
|
const [a, t] = v(!1), [s, n] = v(""), o = d((c) => {
|
|
30
28
|
t(!0), n(c);
|
|
31
|
-
}, []),
|
|
29
|
+
}, []), l = d(() => {
|
|
32
30
|
t(!1);
|
|
33
|
-
}, []),
|
|
34
|
-
return /* @__PURE__ */ r.jsxs(
|
|
31
|
+
}, []), i = S(() => ({ show: a, text: s, showConfirm: o, hideConfirm: l }), [a, s, o, l]);
|
|
32
|
+
return /* @__PURE__ */ r.jsxs(B.Provider, { value: i, children: [
|
|
35
33
|
/* @__PURE__ */ r.jsx(ue, {}),
|
|
36
34
|
e
|
|
37
35
|
] });
|
|
38
|
-
},
|
|
39
|
-
const { texts: { confirm: e } } = j(
|
|
36
|
+
}, ie = () => {
|
|
37
|
+
const { texts: { confirm: e } } = j(b), { isShown: a, text: t, onFinish: s } = H(), { options: n } = j(U), [o, l] = v(n.defaultValue ?? ""), i = d(() => {
|
|
40
38
|
s(null);
|
|
41
39
|
}, [s]), c = d((x) => {
|
|
42
40
|
x.preventDefault(), !(n.required && !o) && s(o);
|
|
43
41
|
}, [s, n.required, o]);
|
|
44
|
-
|
|
45
|
-
a === !0 &&
|
|
42
|
+
C(() => {
|
|
43
|
+
a === !0 && l(n.defaultValue ?? "");
|
|
46
44
|
}, [a, n.defaultValue]);
|
|
47
45
|
const m = S(() => ({
|
|
48
46
|
value: o,
|
|
49
|
-
onChange: (x) =>
|
|
47
|
+
onChange: (x) => l(x.currentTarget.value),
|
|
50
48
|
className: "w-100",
|
|
51
49
|
autoFocus: !0,
|
|
52
50
|
tabIndex: 0
|
|
53
51
|
}), [o]);
|
|
54
|
-
return /* @__PURE__ */ r.jsxs(g, { show: a, size: "sm", centered: !0, onHide:
|
|
52
|
+
return /* @__PURE__ */ r.jsxs(g, { show: a, size: "sm", centered: !0, onHide: i, children: [
|
|
55
53
|
/* @__PURE__ */ r.jsx(g.Header, { className: "justify-content-center", children: /* @__PURE__ */ r.jsx(g.Title, { children: t }) }),
|
|
56
54
|
/* @__PURE__ */ r.jsxs("form", { onSubmit: c, children: [
|
|
57
55
|
/* @__PURE__ */ r.jsxs(g.Body, { children: [
|
|
58
56
|
n.input === "textarea" ? /* @__PURE__ */ r.jsx("textarea", { ...m, rows: 5 }) : void 0,
|
|
59
|
-
n.input === "input" ? /* @__PURE__ */ r.jsx(
|
|
57
|
+
n.input === "input" ? /* @__PURE__ */ r.jsx(q, { ...m, type: n.type }) : void 0
|
|
60
58
|
] }),
|
|
61
59
|
/* @__PURE__ */ r.jsxs(g.Footer, { className: "w-100 d-flex gap-5", children: [
|
|
62
|
-
/* @__PURE__ */ r.jsx(T, { variant: "outlined", color: "secondary", onClick:
|
|
60
|
+
/* @__PURE__ */ r.jsx(T, { variant: "outlined", color: "secondary", onClick: i, className: "flex-grow-1", children: e.cancel }),
|
|
63
61
|
/* @__PURE__ */ r.jsx(T, { color: "primary", disabled: n.required && !o, type: "submit", className: "flex-grow-1", children: e.confirm })
|
|
64
62
|
] })
|
|
65
63
|
] })
|
|
66
64
|
] });
|
|
67
65
|
}, ce = ({ children: e }) => {
|
|
68
|
-
const [a, t] = v(!1), [s, n] = v(""), [o,
|
|
66
|
+
const [a, t] = v(!1), [s, n] = v(""), [o, l] = v({ input: "textarea", type: "text" }), i = R(() => {
|
|
69
67
|
}), c = d((h) => {
|
|
70
68
|
n(h), t(!0);
|
|
71
69
|
}, []), m = d(() => {
|
|
@@ -75,15 +73,15 @@ const ie = ({ children: e }) => {
|
|
|
75
73
|
text: s,
|
|
76
74
|
showPrompt: c,
|
|
77
75
|
hidePrompt: m,
|
|
78
|
-
resolveRef:
|
|
76
|
+
resolveRef: i,
|
|
79
77
|
options: o,
|
|
80
|
-
setOptions:
|
|
78
|
+
setOptions: l
|
|
81
79
|
}), [a, s, c, m, o]);
|
|
82
|
-
return /* @__PURE__ */ r.jsxs(
|
|
80
|
+
return /* @__PURE__ */ r.jsxs(U.Provider, { value: x, children: [
|
|
83
81
|
e,
|
|
84
|
-
/* @__PURE__ */ r.jsx(
|
|
82
|
+
/* @__PURE__ */ r.jsx(ie, {})
|
|
85
83
|
] });
|
|
86
|
-
},
|
|
84
|
+
}, Ce = ({ cookieDomain: e, axiosOptions: a, language: t, texts: s, ProjectIconComponent: n, localizationContext: o, chartColorPalette: l, children: i }) => {
|
|
87
85
|
const c = S(() => ({
|
|
88
86
|
axiosOptions: a,
|
|
89
87
|
cookieDomain: e,
|
|
@@ -91,7 +89,7 @@ const ie = ({ children: e }) => {
|
|
|
91
89
|
texts: s,
|
|
92
90
|
ProjectIconComponent: n,
|
|
93
91
|
localizationContext: o,
|
|
94
|
-
chartColorPalette:
|
|
92
|
+
chartColorPalette: l
|
|
95
93
|
}), [
|
|
96
94
|
a,
|
|
97
95
|
e,
|
|
@@ -99,70 +97,70 @@ const ie = ({ children: e }) => {
|
|
|
99
97
|
n,
|
|
100
98
|
o,
|
|
101
99
|
s,
|
|
102
|
-
i
|
|
103
|
-
]);
|
|
104
|
-
return /* @__PURE__ */ r.jsx(P.Provider, { value: c, children: /* @__PURE__ */ r.jsx(ie, { children: /* @__PURE__ */ r.jsxs(ce, { children: [
|
|
105
|
-
/* @__PURE__ */ r.jsx(B, {}),
|
|
106
100
|
l
|
|
101
|
+
]);
|
|
102
|
+
return /* @__PURE__ */ r.jsx(b.Provider, { value: c, children: /* @__PURE__ */ r.jsx(le, { children: /* @__PURE__ */ r.jsxs(ce, { children: [
|
|
103
|
+
/* @__PURE__ */ r.jsx(V, {}),
|
|
104
|
+
i
|
|
107
105
|
] }) }) });
|
|
108
|
-
},
|
|
109
|
-
const [a, t] = v(!1), [s] = v(/* @__PURE__ */ new Set()), n = d((
|
|
110
|
-
s.add(
|
|
111
|
-
}, [s]), o = d((
|
|
112
|
-
s.delete(
|
|
113
|
-
}, [s]),
|
|
114
|
-
return /* @__PURE__ */ r.jsxs(
|
|
115
|
-
a && /* @__PURE__ */ r.jsx(
|
|
106
|
+
}, we = ({ children: e }) => {
|
|
107
|
+
const [a, t] = v(!1), [s] = v(/* @__PURE__ */ new Set()), n = d((i) => {
|
|
108
|
+
s.add(i), t(!0);
|
|
109
|
+
}, [s]), o = d((i) => {
|
|
110
|
+
s.delete(i), s.size === 0 && t(!1);
|
|
111
|
+
}, [s]), l = S(() => ({ isLoading: a, startLoading: n, stopLoading: o }), [a, n, o]);
|
|
112
|
+
return /* @__PURE__ */ r.jsxs(J.Provider, { value: l, children: [
|
|
113
|
+
a && /* @__PURE__ */ r.jsx(ee, {}),
|
|
116
114
|
e
|
|
117
115
|
] });
|
|
118
|
-
},
|
|
119
|
-
const a =
|
|
120
|
-
const u = await
|
|
116
|
+
}, je = ({ children: e }) => {
|
|
117
|
+
const a = $(), { msalInstance: t } = j(_), { delegation: s, setDelegation: n, setAvailableDelegations: o, refreshAvailableDelegations: l } = j(M), { getToken: i } = K(), [c, m] = v(null), x = d(async () => {
|
|
118
|
+
const u = await i();
|
|
121
119
|
u && m(u);
|
|
122
|
-
}, [
|
|
123
|
-
|
|
120
|
+
}, [i]);
|
|
121
|
+
C(() => {
|
|
124
122
|
x();
|
|
125
123
|
}, [x]);
|
|
126
|
-
const
|
|
124
|
+
const D = d(() => {
|
|
127
125
|
const u = localStorage.getItem("user") ?? null;
|
|
128
126
|
return u ? JSON.parse(u ?? "") : null;
|
|
129
|
-
}, [])(), [
|
|
130
|
-
state:
|
|
131
|
-
user:
|
|
132
|
-
}),
|
|
127
|
+
}, [])(), [N, p] = v({
|
|
128
|
+
state: D ? w.LOGGED_IN : w.LOGGING_IN,
|
|
129
|
+
user: D
|
|
130
|
+
}), O = d(async (u) => {
|
|
133
131
|
let f = null;
|
|
134
|
-
return await a.get("/user/detail", u ? { headers: { Authorization: `Bearer ${u}` } } : void 0).then((
|
|
135
|
-
f =
|
|
132
|
+
return await a.get("/user/detail", u ? { headers: { Authorization: `Bearer ${u}` } } : void 0).then((P) => {
|
|
133
|
+
f = P.data;
|
|
136
134
|
}).catch(() => {
|
|
137
135
|
f = null;
|
|
138
136
|
}), f;
|
|
139
137
|
}, [a]), k = d(() => {
|
|
140
|
-
localStorage.removeItem("user"),
|
|
141
|
-
state:
|
|
138
|
+
localStorage.removeItem("user"), p({
|
|
139
|
+
state: w.LOGGED_OUT,
|
|
142
140
|
user: null
|
|
143
141
|
}), n(null), o(null);
|
|
144
142
|
}, [o, n]), y = d(async (u) => {
|
|
145
|
-
|
|
146
|
-
state:
|
|
143
|
+
p({
|
|
144
|
+
state: w.LOGGING_IN,
|
|
147
145
|
user: null
|
|
148
146
|
});
|
|
149
|
-
const f = await
|
|
150
|
-
return f ? (
|
|
151
|
-
state:
|
|
147
|
+
const f = await O(u);
|
|
148
|
+
return f ? (p({
|
|
149
|
+
state: w.LOGGED_IN,
|
|
152
150
|
user: f
|
|
153
|
-
}), localStorage.setItem("user", JSON.stringify(f)), await
|
|
154
|
-
state:
|
|
151
|
+
}), localStorage.setItem("user", JSON.stringify(f)), await l(), !0) : (p({
|
|
152
|
+
state: w.LOGIN_FAILED,
|
|
155
153
|
user: null
|
|
156
154
|
}), !1);
|
|
157
|
-
}, [
|
|
155
|
+
}, [O, l]), I = d(() => {
|
|
158
156
|
k();
|
|
159
157
|
}, [k]);
|
|
160
|
-
|
|
158
|
+
C(() => {
|
|
161
159
|
if (t) {
|
|
162
160
|
const u = t.addEventCallback((f) => {
|
|
163
|
-
if (f.eventType ===
|
|
164
|
-
const
|
|
165
|
-
m(
|
|
161
|
+
if (f.eventType === E.LOGIN_SUCCESS && f.payload) {
|
|
162
|
+
const P = f.payload;
|
|
163
|
+
m(P.accessToken);
|
|
166
164
|
}
|
|
167
165
|
});
|
|
168
166
|
return () => {
|
|
@@ -171,35 +169,35 @@ const ie = ({ children: e }) => {
|
|
|
171
169
|
}
|
|
172
170
|
return () => {
|
|
173
171
|
};
|
|
174
|
-
}, [t, y,
|
|
172
|
+
}, [t, y, I]);
|
|
175
173
|
const A = d(async (u) => {
|
|
176
174
|
u && await y(u).catch(() => {
|
|
177
|
-
|
|
175
|
+
I(), n(null);
|
|
178
176
|
});
|
|
179
|
-
}, [y,
|
|
180
|
-
|
|
177
|
+
}, [y, I, n]);
|
|
178
|
+
C(() => {
|
|
181
179
|
A(c);
|
|
182
180
|
}, [c, s == null ? void 0 : s.id, A]);
|
|
183
|
-
const
|
|
184
|
-
user:
|
|
185
|
-
userLoginState:
|
|
181
|
+
const F = S(() => ({
|
|
182
|
+
user: N.user,
|
|
183
|
+
userLoginState: N,
|
|
186
184
|
loginUser: y,
|
|
187
|
-
logoutUser:
|
|
188
|
-
}), [
|
|
189
|
-
return /* @__PURE__ */ r.jsx(
|
|
190
|
-
},
|
|
191
|
-
const { cookieDomain: a } = j(
|
|
185
|
+
logoutUser: I
|
|
186
|
+
}), [N, y, I]);
|
|
187
|
+
return /* @__PURE__ */ r.jsx(Q.Provider, { value: F, children: e });
|
|
188
|
+
}, ye = ({ ...e }) => {
|
|
189
|
+
const { cookieDomain: a } = j(b), [, t] = W(["Authorization"]), s = S(() => ({
|
|
192
190
|
useMsal: e.useMsal ?? !1,
|
|
193
191
|
msalInstance: e.useMsal ? e.msalInstance ?? null : null,
|
|
194
192
|
msalScopes: e.useMsal ? e.msalScopes ?? [] : []
|
|
195
193
|
}), [e]);
|
|
196
|
-
return
|
|
194
|
+
return C(() => {
|
|
197
195
|
if (e.useMsal) {
|
|
198
196
|
const n = e.msalInstance.addEventCallback((o) => {
|
|
199
|
-
if (o.eventType ===
|
|
200
|
-
const
|
|
201
|
-
e.msalInstance.setActiveAccount(
|
|
202
|
-
const c =
|
|
197
|
+
if (o.eventType === E.LOGIN_SUCCESS || o.eventType === E.ACQUIRE_TOKEN_SUCCESS && o.payload) {
|
|
198
|
+
const l = o.payload, i = l.account;
|
|
199
|
+
e.msalInstance.setActiveAccount(i);
|
|
200
|
+
const c = l.accessToken, m = l.expiresOn;
|
|
203
201
|
t("Authorization", c, {
|
|
204
202
|
path: "/",
|
|
205
203
|
secure: !0,
|
|
@@ -216,25 +214,25 @@ const ie = ({ children: e }) => {
|
|
|
216
214
|
}
|
|
217
215
|
return () => {
|
|
218
216
|
};
|
|
219
|
-
}, [e, t, a]), /* @__PURE__ */ r.jsx(_.Provider, { value: s, children: e.useMsal ? /* @__PURE__ */ r.jsx(
|
|
220
|
-
},
|
|
221
|
-
const [t, s, n] =
|
|
217
|
+
}, [e, t, a]), /* @__PURE__ */ r.jsx(_.Provider, { value: s, children: e.useMsal ? /* @__PURE__ */ r.jsx(X, { instance: e.msalInstance, children: e.children }) : e.children });
|
|
218
|
+
}, Ie = ({ children: e, relativeEndpoint: a }) => {
|
|
219
|
+
const [t, s, n] = te("user-delegation", null), o = S(() => {
|
|
222
220
|
if (!t)
|
|
223
221
|
return null;
|
|
224
|
-
const h = t.from ?
|
|
225
|
-
return ae(new Date(Date.now()), { start: h, end:
|
|
226
|
-
}, [t, s]), { data:
|
|
222
|
+
const h = t.from ? G(t.from) : re(), D = t.to ? G(t.to) : oe();
|
|
223
|
+
return ae(new Date(Date.now()), { start: h, end: D }) ? t : (s(null), null);
|
|
224
|
+
}, [t, s]), { data: l, setData: i, reloadData: c } = se(a, {
|
|
227
225
|
nullStateBeforeLoad: !1,
|
|
228
226
|
nullStateOnFail: !0
|
|
229
227
|
}), m = R(null);
|
|
230
|
-
|
|
228
|
+
C(() => {
|
|
231
229
|
const h = () => {
|
|
232
|
-
c(), m.current = window.setTimeout(h,
|
|
230
|
+
c(), m.current = window.setTimeout(h, Y() + 5e3);
|
|
233
231
|
};
|
|
234
232
|
return h(), () => {
|
|
235
233
|
m.current !== null && window.clearTimeout(m.current);
|
|
236
234
|
};
|
|
237
|
-
}, [c]),
|
|
235
|
+
}, [c]), C(() => {
|
|
238
236
|
const h = () => {
|
|
239
237
|
n();
|
|
240
238
|
};
|
|
@@ -245,19 +243,19 @@ const ie = ({ children: e }) => {
|
|
|
245
243
|
const x = S(() => ({
|
|
246
244
|
delegation: o,
|
|
247
245
|
setDelegation: s,
|
|
248
|
-
availableDelegations:
|
|
249
|
-
setAvailableDelegations:
|
|
246
|
+
availableDelegations: l,
|
|
247
|
+
setAvailableDelegations: i,
|
|
250
248
|
refreshAvailableDelegations: c
|
|
251
249
|
}), [
|
|
252
250
|
o,
|
|
253
251
|
s,
|
|
254
|
-
i,
|
|
255
252
|
l,
|
|
253
|
+
i,
|
|
256
254
|
c
|
|
257
255
|
]);
|
|
258
256
|
return /* @__PURE__ */ r.jsx(M.Provider, { value: x, children: e });
|
|
259
257
|
}, ue = () => {
|
|
260
|
-
const { texts: { confirm: e } } = j(
|
|
258
|
+
const { texts: { confirm: e } } = j(b), { onConfirm: a, onCancel: t, text: s, show: n } = Z();
|
|
261
259
|
return /* @__PURE__ */ r.jsxs(g, { show: n, size: "sm", centered: !0, onHide: t, children: [
|
|
262
260
|
/* @__PURE__ */ r.jsx(g.Header, { className: "justify-content-center", children: /* @__PURE__ */ r.jsx(g.Title, { children: s }) }),
|
|
263
261
|
/* @__PURE__ */ r.jsx(g.Body, { children: /* @__PURE__ */ r.jsxs("div", { className: "w-100 d-flex gap-5", children: [
|
|
@@ -268,13 +266,13 @@ const ie = ({ children: e }) => {
|
|
|
268
266
|
};
|
|
269
267
|
export {
|
|
270
268
|
_ as AuthContext,
|
|
271
|
-
|
|
269
|
+
ye as AuthProvider,
|
|
272
270
|
M as DelegationContext,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
271
|
+
Ie as DelegationProvider,
|
|
272
|
+
J as LoadingContext,
|
|
273
|
+
we as LoadingProvider,
|
|
274
|
+
b as LuminusComponentsContext,
|
|
275
|
+
Ce as LuminusComponentsProvider,
|
|
276
|
+
Q as UserContext,
|
|
277
|
+
je as UserProvider
|
|
280
278
|
};
|