react-luminus-components 1.2.76 → 1.2.79
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 +355 -355
- package/dist/.vite/manifest.json +50 -50
- package/dist/{EventType-CYj5c_TM.js → EventType-CpXqyU6N.js} +140 -138
- package/dist/EventType-DyGsWo_d.cjs +1 -0
- package/dist/SimpleTooltip-CWolhOb-.cjs +1 -0
- package/dist/SimpleTooltip-Dlu42YM6.js +5 -0
- package/dist/{NoInputContainer-CzSDOA31.js → UserAvatarToggle-ByG1NTlM.js} +1114 -1111
- package/dist/{NoInputContainer-Ceb-y7u0.cjs → UserAvatarToggle-cJKNvqKT.cjs} +46 -46
- package/dist/components/common/Card/Card.d.ts +1 -1
- package/dist/components/common/ErrorBoundary/ErrorBoundary.d.ts +8 -0
- package/dist/components/common/Loading/LoadingBlock.d.ts +4 -0
- package/dist/components/common/Widget/WidgetCard.d.ts +8 -0
- package/dist/components/common/Widget/WidgetWrapper.d.ts +7 -0
- package/dist/components/common/index.d.ts +4 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/contexts/luminus-components/LuminusComponentsContext.d.ts +5 -1
- package/dist/contexts/luminus-components/LuminusComponentsProvider.d.ts +7 -3
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +74 -70
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useGetDataBound/useGetDataBound.d.ts +2 -0
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +102 -73
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +13 -13
- package/dist/main.cjs.js +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.es.js +1525 -1482
- package/dist/models/index.d.ts +3 -0
- package/dist/models/prop-types/DashboardWidgetCommonProps.d.ts +5 -0
- package/dist/models/texts/ErrorBoundaryTexts.d.ts +5 -0
- package/dist/models/texts/WidgetTexts.d.ts +4 -0
- package/dist/models/types/DashboardWidget.d.ts +4 -2
- package/dist/style.css +1 -1
- package/dist/{useConfirm-C1e4wjoh.js → useConfirm-C2tLxO-b.js} +1 -1
- package/dist/useConfirm-HYlAqd-s.cjs +1 -0
- package/dist/{useFormControlType-BAFqxupC.js → useFormControlType-oJGqgThz.js} +3 -3
- package/dist/usePermissions-BlYpl_RP.cjs +1 -0
- package/dist/{usePermissions-Crr2ZkmJ.js → usePermissions-CPbQAr2_.js} +1 -1
- package/package.json +100 -100
- package/dist/EventType-LFHQrrOn.cjs +0 -1
- package/dist/SimpleTooltip-BAljsAeT.cjs +0 -1
- package/dist/SimpleTooltip-CUAvaEIL.js +0 -5
- package/dist/useConfirm-CgzfU9AB.cjs +0 -1
- package/dist/usePermissions--HXCgQlu.cjs +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
type ErrorBoundaryProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
fallback: ReactNode;
|
|
5
|
+
reloadButtonDisplay?: 'inject-to-child' | 'append-after-child' | 'none';
|
|
6
|
+
};
|
|
7
|
+
declare const ErrorBoundary: (props: ErrorBoundaryProps) => React.JSX.Element;
|
|
8
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type WidgetCardProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
headerContent?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare const WidgetCard: ({ children, title, headerContent }: WidgetCardProps) => import("react").JSX.Element;
|
|
8
|
+
export default WidgetCard;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as ApiFileDownloadButton } from './ApiFileDownloadButton/ApiFileDownloadButton';
|
|
2
2
|
export { default as Loading } from './Loading/Loading';
|
|
3
|
+
export { default as LoadingBlock } from './Loading/LoadingBlock';
|
|
3
4
|
export { default as MonthPicker } from './MonthPicker/MonthPicker';
|
|
4
5
|
export { default as YearPicker } from './YearPicker/YearPicker';
|
|
5
6
|
export { default as Typography } from './Typography/Typography';
|
|
@@ -17,3 +18,6 @@ export { default as Backdrop } from './Backdrop/Backdrop';
|
|
|
17
18
|
export { default as AuthTemplate } from './AuthTemplate/AuthTemplate';
|
|
18
19
|
export { default as Alert } from './Alert/Alert';
|
|
19
20
|
export { default as VersionInfo } from './VersionInfo/VersionInfo';
|
|
21
|
+
export { default as WidgetCard } from './Widget/WidgetCard';
|
|
22
|
+
export { default as WidgetWrapper } from './Widget/WidgetWrapper';
|
|
23
|
+
export { default as ErrorBoundary } from './ErrorBoundary/ErrorBoundary';
|
package/dist/contexts/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as LuminusComponentsContext } from './luminus-components/LuminusComponentsContext';
|
|
2
2
|
export { default as LuminusComponentsProvider } from './luminus-components/LuminusComponentsProvider';
|
|
3
|
+
export type { ILuminusComponentsContext } from './luminus-components/LuminusComponentsContext';
|
|
3
4
|
export { default as LoadingContext } from './loading/LoadingContext';
|
|
4
5
|
export { default as LoadingProvider } from './loading/LoadingProvider';
|
|
5
6
|
export { default as UserContext } from './user/UserContext';
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { AxiosInstance } from 'axios';
|
|
3
3
|
import { LinkProps, NavigateProps } from 'react-router-dom';
|
|
4
4
|
import { AppSearchTexts, AxiosTexts, ConfirmTexts, CustomSelectTexts, FormSubmitTexts, FormValidationTexts, HomeDashboardTexts } from '@models/index';
|
|
5
|
-
|
|
5
|
+
import ErrorBoundaryTexts from '@models/texts/ErrorBoundaryTexts';
|
|
6
|
+
import WidgetTexts from '@models/texts/WidgetTexts';
|
|
7
|
+
export interface ILuminusComponentsContext {
|
|
6
8
|
cookieDomain: string;
|
|
7
9
|
axiosInstance: AxiosInstance;
|
|
8
10
|
LinkComponent: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -15,6 +17,8 @@ interface ILuminusComponentsContext {
|
|
|
15
17
|
formSubmitTexts: FormSubmitTexts;
|
|
16
18
|
appSearchTexts: AppSearchTexts;
|
|
17
19
|
customSelectTexts: CustomSelectTexts;
|
|
20
|
+
errorBoundaryTexts: ErrorBoundaryTexts;
|
|
21
|
+
widgetTexts: WidgetTexts;
|
|
18
22
|
}
|
|
19
23
|
declare const LuminusComponentsContext: import("react").Context<ILuminusComponentsContext>;
|
|
20
24
|
export default LuminusComponentsContext;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { LinkProps, NavigateProps } from 'react-router-dom';
|
|
3
|
-
import { AxiosInstance } from 'axios';
|
|
4
2
|
import { AppSearchTexts, AxiosTexts, ConfirmTexts, CustomSelectTexts, FormSubmitTexts, FormValidationTexts, HomeDashboardTexts } from '@models/index';
|
|
3
|
+
import ErrorBoundaryTexts from '@models/texts/ErrorBoundaryTexts';
|
|
4
|
+
import WidgetTexts from '@models/texts/WidgetTexts';
|
|
5
|
+
import { AxiosInstance } from 'axios';
|
|
6
|
+
import { LinkProps, NavigateProps } from 'react-router-dom';
|
|
5
7
|
type Props = {
|
|
6
8
|
cookieDomain: string;
|
|
7
9
|
axiosInstance: AxiosInstance;
|
|
@@ -16,6 +18,8 @@ type Props = {
|
|
|
16
18
|
appSearchTexts: AppSearchTexts;
|
|
17
19
|
customSelectTexts: CustomSelectTexts;
|
|
18
20
|
children: React.ReactNode;
|
|
21
|
+
errorBoundaryTexts: ErrorBoundaryTexts;
|
|
22
|
+
widgetTexts: WidgetTexts;
|
|
19
23
|
};
|
|
20
|
-
declare const LuminusComponentsProvider: ({ cookieDomain, axiosInstance, LinkComponent, NavigateComponent, language, axiosTexts, confirmTexts, formValidationTexts, homeDashboardTexts, formSubmitTexts, appSearchTexts, customSelectTexts, children, }: Props) => import("react").JSX.Element;
|
|
24
|
+
declare const LuminusComponentsProvider: ({ cookieDomain, axiosInstance, LinkComponent, NavigateComponent, language, axiosTexts, confirmTexts, formValidationTexts, homeDashboardTexts, formSubmitTexts, appSearchTexts, customSelectTexts, errorBoundaryTexts, widgetTexts, children, }: Props) => import("react").JSX.Element;
|
|
21
25
|
export default LuminusComponentsProvider;
|
package/dist/contexts.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./UserAvatarToggle-cJKNvqKT.cjs"),n=require("react");require("react-hook-form");const f=require("./useConfirm-HYlAqd-s.cjs"),l=require("./EventType-DyGsWo_d.cjs"),y=({children:t})=>{const[r,s]=n.useState(!1),[a,o]=n.useState(""),c=n.useCallback(d=>{s(!0),o(d)},[]),i=n.useCallback(()=>{s(!1)},[]),u=n.useMemo(()=>({show:r,text:a,showConfirm:c,hideConfirm:i}),[r,a,c,i]);return e.jsxRuntimeExports.jsxs(e.ConfirmContext.Provider,{value:u,children:[e.jsxRuntimeExports.jsx(U,{}),t]})},I=()=>{const{confirmTexts:t}=n.useContext(e.LuminusComponentsContext),{isShown:r,text:s,onFinish:a}=f.usePrompt(),{options:o}=n.useContext(e.PromptContext),[c,i]=n.useState(o.defaultValue??""),u=n.useCallback(()=>{a(null)},[a]),d=n.useCallback(()=>{a(c)},[a,c]);n.useEffect(()=>{r===!0&&i(o.defaultValue??"")},[r,o.defaultValue]);const x=n.useMemo(()=>({value:c,onChange:C=>i(C.currentTarget.value),className:"w-100",autoFocus:!0,tabIndex:0}),[c]);return e.jsxRuntimeExports.jsxs(l.Modal,{show:r,size:"sm",centered:!0,onHide:u,children:[e.jsxRuntimeExports.jsx(l.Modal.Header,{children:e.jsxRuntimeExports.jsx(l.Modal.Title,{children:s})}),e.jsxRuntimeExports.jsxs(l.Modal.Body,{children:[o.input==="textarea"?e.jsxRuntimeExports.jsx("textarea",{...x,rows:5}):void 0,o.input==="input"?e.jsxRuntimeExports.jsx("input",{...x,type:o.type}):void 0]}),e.jsxRuntimeExports.jsxs(l.Modal.Footer,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary",onClick:u,children:t.cancel}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary ml",onClick:d,disabled:o.required&&!c,children:t.confirm})]})]})},T=({children:t})=>{const[r,s]=n.useState(!1),[a,o]=n.useState(""),[c,i]=n.useState({input:"textarea",type:"text"}),u=n.useRef(()=>{}),d=n.useCallback(p=>{o(p),s(!0)},[]),x=n.useCallback(()=>{s(!1)},[]),C=n.useMemo(()=>({isShown:r,text:a,showPrompt:d,hidePrompt:x,resolveRef:u,options:c,setOptions:i}),[r,a,d,x,c]);return e.jsxRuntimeExports.jsxs(e.PromptContext.Provider,{value:C,children:[t,e.jsxRuntimeExports.jsx(I,{})]})},h=({cookieDomain:t,axiosInstance:r,LinkComponent:s,NavigateComponent:a,language:o,axiosTexts:c,confirmTexts:i,formValidationTexts:u,homeDashboardTexts:d,formSubmitTexts:x,appSearchTexts:C,customSelectTexts:p,errorBoundaryTexts:g,widgetTexts:E,children:m})=>{const R=n.useMemo(()=>({axiosInstance:r,cookieDomain:t,LinkComponent:s,NavigateComponent:a,language:o,axiosTexts:c,confirmTexts:i,formValidationTexts:u,homeDashboardTexts:d,formSubmitTexts:x,appSearchTexts:C,customSelectTexts:p,errorBoundaryTexts:g,widgetTexts:E}),[r,t,s,a,o,c,i,u,d,x,C,p,g,E]);return e.jsxRuntimeExports.jsx(e.LuminusComponentsContext.Provider,{value:R,children:e.jsxRuntimeExports.jsx(y,{children:e.jsxRuntimeExports.jsxs(T,{children:[e.jsxRuntimeExports.jsx(e.Ie,{}),m]})})})},j=({children:t})=>{const[r,s]=n.useState(!1),[a]=n.useState(new Set),o=n.useCallback(u=>{a.add(u),s(!0)},[a]),c=n.useCallback(u=>{a.delete(u),a.size===0&&s(!1)},[a]),i=n.useMemo(()=>({isLoading:r,startLoading:o,stopLoading:c}),[r,o,c]);return e.jsxRuntimeExports.jsxs(e.LoadingContext.Provider,{value:i,children:[r&&e.jsxRuntimeExports.jsx(l.Loading,{}),t]})};/*! @azure/msal-browser v3.14.0 2024-05-07 */class P{static getInteractionStatusFromEvent(r,s){switch(r.eventType){case l.EventType.LOGIN_START:return e.InteractionStatus.Login;case l.EventType.SSO_SILENT_START:return e.InteractionStatus.SsoSilent;case l.EventType.ACQUIRE_TOKEN_START:if(r.interactionType===e.InteractionType.Redirect||r.interactionType===e.InteractionType.Popup)return e.InteractionStatus.AcquireToken;break;case l.EventType.HANDLE_REDIRECT_START:return e.InteractionStatus.HandleRedirect;case l.EventType.LOGOUT_START:return e.InteractionStatus.Logout;case l.EventType.SSO_SILENT_SUCCESS:case l.EventType.SSO_SILENT_FAILURE:if(s&&s!==e.InteractionStatus.SsoSilent)break;return e.InteractionStatus.None;case l.EventType.LOGOUT_END:if(s&&s!==e.InteractionStatus.Logout)break;return e.InteractionStatus.None;case l.EventType.HANDLE_REDIRECT_END:if(s&&s!==e.InteractionStatus.HandleRedirect)break;return e.InteractionStatus.None;case l.EventType.LOGIN_SUCCESS:case l.EventType.LOGIN_FAILURE:case l.EventType.ACQUIRE_TOKEN_SUCCESS:case l.EventType.ACQUIRE_TOKEN_FAILURE:case l.EventType.RESTORE_FROM_BFCACHE:if(r.interactionType===e.InteractionType.Redirect||r.interactionType===e.InteractionType.Popup){if(s&&s!==e.InteractionStatus.Login&&s!==e.InteractionStatus.AcquireToken)break;return e.InteractionStatus.None}break}return null}}/*! @azure/msal-react v2.0.16 2024-05-07 */const b="@azure/msal-react",v="2.0.16";/*! @azure/msal-react v2.0.16 2024-05-07 */const S={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},L=(t,r)=>{const{type:s,payload:a}=r;let o=t.inProgress;switch(s){case S.UNBLOCK_INPROGRESS:t.inProgress===e.InteractionStatus.Startup&&(o=e.InteractionStatus.None,a.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case S.EVENT:const i=a.message,u=P.getInteractionStatusFromEvent(i,t.inProgress);u&&(a.logger.info(`MsalProvider - ${i.eventType} results in setting inProgress from ${t.inProgress} to ${u}`),o=u);break;default:throw new Error(`Unknown action type: ${s}`)}const c=a.instance.getAllAccounts();return o!==t.inProgress&&!e.accountArraysAreEqual(c,t.accounts)?{...t,inProgress:o,accounts:c}:o!==t.inProgress?{...t,inProgress:o}:e.accountArraysAreEqual(c,t.accounts)?t:{...t,accounts:c}};function k({instance:t,children:r}){n.useEffect(()=>{t.initializeWrapperLibrary(e.WrapperSKU.React,v)},[t]);const s=n.useMemo(()=>t.getLogger().clone(b,v),[t]),[a,o]=n.useReducer(L,void 0,()=>({inProgress:e.InteractionStatus.Startup,accounts:t.getAllAccounts()}));n.useEffect(()=>{const i=t.addEventCallback(u=>{o({payload:{instance:t,logger:s,message:u},type:S.EVENT})});return s.verbose(`MsalProvider - Registered event callback with id: ${i}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{o({payload:{instance:t,logger:s},type:S.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{i&&(s.verbose(`MsalProvider - Removing event callback ${i}`),t.removeEventCallback(i))}},[t,s]);const c={instance:t,inProgress:a.inProgress,accounts:a.accounts,logger:s};return n.createElement(e.MsalContext.Provider,{value:c},r)}const N=({children:t})=>{const r=e.useAxios(),{msalInstance:s}=n.useContext(e.AuthContext),[a,o]=n.useState(!1),c=n.useCallback(()=>{const E=localStorage.getItem("user")??null;return E?JSON.parse(E):null},[]),[i,u]=n.useState(c()),d=n.useCallback(async E=>{let m=null;return await r.get("/user/detail",E?{headers:{Authorization:`Bearer ${E}`}}:void 0).then(R=>{m=R.data}).catch(()=>{m=null}),localStorage.setItem("user",JSON.stringify(m)),m},[r]),x=n.useCallback(()=>{localStorage.removeItem("user")},[]),C=n.useCallback(async E=>{o(!0);const m=await d(E);return o(!1),m?(u(m),!0):!1},[d]),p=n.useCallback(()=>{x(),u(null)},[x]),g=n.useMemo(()=>({user:i,loggingInProgress:a,loginUser:C,logoutUser:p}),[i,C,p,a]);return n.useEffect(()=>{u(c())},[c]),n.useEffect(()=>{if(s){const E=s.addEventCallback(m=>{if(m.eventType===l.EventType.LOGIN_SUCCESS&&m.payload){const R=m.payload;C(R.accessToken).catch(()=>p())}});return()=>{E&&s.removeEventCallback(E)}}return()=>{}},[s,C,p]),e.jsxRuntimeExports.jsx(e.UserContext.Provider,{value:g,children:t})},A=({...t})=>{const{cookieDomain:r}=n.useContext(e.LuminusComponentsContext),[,s]=e.useCookies(["Authorization"]),a=n.useMemo(()=>({useMsal:t.useMsal??!1,msalInstance:t.useMsal?t.msalInstance??null:null,msalScopes:t.useMsal?t.msalScopes??[]:[]}),[t]);return n.useEffect(()=>{if(t.useMsal){const o=t.msalInstance.addEventCallback(c=>{if(c.eventType===l.EventType.LOGIN_SUCCESS||c.eventType===l.EventType.ACQUIRE_TOKEN_SUCCESS&&c.payload){const i=c.payload,u=i.account;t.msalInstance.setActiveAccount(u);const d=i.accessToken,x=i.expiresOn;s("Authorization",d,{path:"/",secure:!0,sameSite:"none",domain:r,expires:x??void 0})}});return()=>{o&&t.msalInstance.removeEventCallback(o)}}return()=>{}},[t,s,r]),e.jsxRuntimeExports.jsx(e.AuthContext.Provider,{value:a,children:t.useMsal?e.jsxRuntimeExports.jsx(k,{instance:t.msalInstance,children:t.children}):t.children})},U=()=>{const{confirmTexts:t}=n.useContext(e.LuminusComponentsContext),{onConfirm:r,onCancel:s,text:a,show:o}=f.useConfirm();return e.jsxRuntimeExports.jsx(l.Modal,{show:o,size:"sm",centered:!0,onHide:s,children:e.jsxRuntimeExports.jsxs(l.Modal.Body,{children:[e.jsxRuntimeExports.jsx("div",{className:"mb-5 text-center",children:e.jsxRuntimeExports.jsx(e.Typography,{variant:"h6",children:a})}),e.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary w-100",onClick:s,children:t.no}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary w-100 ml",onClick:r,children:t.yes})]})]})})};exports.AuthContext=e.AuthContext;exports.LoadingContext=e.LoadingContext;exports.LuminusComponentsContext=e.LuminusComponentsContext;exports.UserContext=e.UserContext;exports.AuthProvider=A;exports.LoadingProvider=j;exports.LuminusComponentsProvider=h;exports.UserProvider=N;
|
package/dist/contexts.es.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import K, {
|
|
3
|
-
import { u as D, a as V } from "./useConfirm-C1e4wjoh.js";
|
|
1
|
+
import { j as a, ak as j, Q as T, al as _, am as k, an as O, M as b, L as l, ao as U, ap as w, aq as p, ab as M, ae as A, ag as G, ar as z, _ as F } from "./UserAvatarToggle-ByG1NTlM.js";
|
|
2
|
+
import K, { useState as x, useCallback as E, useMemo as P, useContext as S, useEffect as I, useRef as H, useReducer as B } from "react";
|
|
4
3
|
import "react-hook-form";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { u as D, a as V } from "./useConfirm-C2tLxO-b.js";
|
|
5
|
+
import { M as v, L as $, E as u } from "./EventType-CpXqyU6N.js";
|
|
6
|
+
const q = ({ children: e }) => {
|
|
7
|
+
const [s, t] = x(!1), [o, n] = x(""), r = E((d) => {
|
|
8
|
+
t(!0), n(d);
|
|
9
|
+
}, []), c = E(() => {
|
|
10
|
+
t(!1);
|
|
11
|
+
}, []), i = P(() => ({ show: s, text: o, showConfirm: r, hideConfirm: c }), [s, o, r, c]);
|
|
12
|
+
return /* @__PURE__ */ a.jsxs(j.Provider, { value: i, children: [
|
|
13
|
+
/* @__PURE__ */ a.jsx(ee, {}),
|
|
14
|
+
e
|
|
15
|
+
] });
|
|
16
|
+
}, Q = () => {
|
|
17
|
+
const { confirmTexts: e } = S(T), { isShown: s, text: t, onFinish: o } = D(), { options: n } = S(_), [r, c] = x(n.defaultValue ?? ""), i = E(() => {
|
|
8
18
|
o(null);
|
|
9
|
-
}, [o]), d =
|
|
19
|
+
}, [o]), d = E(() => {
|
|
10
20
|
o(r);
|
|
11
21
|
}, [o, r]);
|
|
12
22
|
I(() => {
|
|
@@ -14,7 +24,7 @@ const q = () => {
|
|
|
14
24
|
}, [s, n.defaultValue]);
|
|
15
25
|
const g = P(() => ({
|
|
16
26
|
value: r,
|
|
17
|
-
onChange: (
|
|
27
|
+
onChange: (h) => c(h.currentTarget.value),
|
|
18
28
|
className: "w-100",
|
|
19
29
|
autoFocus: !0,
|
|
20
30
|
tabIndex: 0
|
|
@@ -30,13 +40,13 @@ const q = () => {
|
|
|
30
40
|
/* @__PURE__ */ a.jsx("button", { type: "button", className: "btn btn-primary ml", onClick: d, disabled: n.required && !r, children: e.confirm })
|
|
31
41
|
] })
|
|
32
42
|
] });
|
|
33
|
-
},
|
|
34
|
-
const [s, t] =
|
|
35
|
-
}), d =
|
|
43
|
+
}, J = ({ children: e }) => {
|
|
44
|
+
const [s, t] = x(!1), [o, n] = x(""), [r, c] = x({ input: "textarea", type: "text" }), i = H(() => {
|
|
45
|
+
}), d = E((C) => {
|
|
36
46
|
n(C), t(!0);
|
|
37
|
-
}, []), g =
|
|
47
|
+
}, []), g = E(() => {
|
|
38
48
|
t(!1);
|
|
39
|
-
}, []),
|
|
49
|
+
}, []), h = P(() => ({
|
|
40
50
|
isShown: s,
|
|
41
51
|
text: o,
|
|
42
52
|
showPrompt: d,
|
|
@@ -45,22 +55,12 @@ const q = () => {
|
|
|
45
55
|
options: r,
|
|
46
56
|
setOptions: c
|
|
47
57
|
}), [s, o, d, g, r]);
|
|
48
|
-
return /* @__PURE__ */ a.jsxs(
|
|
58
|
+
return /* @__PURE__ */ a.jsxs(_.Provider, { value: h, children: [
|
|
49
59
|
e,
|
|
50
|
-
/* @__PURE__ */ a.jsx(
|
|
51
|
-
] });
|
|
52
|
-
}, J = ({ children: e }) => {
|
|
53
|
-
const [s, t] = h(!1), [o, n] = h(""), r = m((d) => {
|
|
54
|
-
t(!0), n(d);
|
|
55
|
-
}, []), c = m(() => {
|
|
56
|
-
t(!1);
|
|
57
|
-
}, []), i = P(() => ({ show: s, text: o, showConfirm: r, hideConfirm: c }), [s, o, r, c]);
|
|
58
|
-
return /* @__PURE__ */ a.jsxs(j.Provider, { value: i, children: [
|
|
59
|
-
/* @__PURE__ */ a.jsx(ee, {}),
|
|
60
|
-
e
|
|
60
|
+
/* @__PURE__ */ a.jsx(Q, {})
|
|
61
61
|
] });
|
|
62
|
-
}, ae = ({ cookieDomain: e, axiosInstance: s, LinkComponent: t, NavigateComponent: o, language: n, axiosTexts: r, confirmTexts: c, formValidationTexts: i, homeDashboardTexts: d, formSubmitTexts: g, appSearchTexts:
|
|
63
|
-
const
|
|
62
|
+
}, ae = ({ cookieDomain: e, axiosInstance: s, LinkComponent: t, NavigateComponent: o, language: n, axiosTexts: r, confirmTexts: c, formValidationTexts: i, homeDashboardTexts: d, formSubmitTexts: g, appSearchTexts: h, customSelectTexts: C, errorBoundaryTexts: y, widgetTexts: m, children: f }) => {
|
|
63
|
+
const R = P(() => ({
|
|
64
64
|
axiosInstance: s,
|
|
65
65
|
cookieDomain: e,
|
|
66
66
|
LinkComponent: t,
|
|
@@ -71,8 +71,10 @@ const q = () => {
|
|
|
71
71
|
formValidationTexts: i,
|
|
72
72
|
homeDashboardTexts: d,
|
|
73
73
|
formSubmitTexts: g,
|
|
74
|
-
appSearchTexts:
|
|
75
|
-
customSelectTexts: C
|
|
74
|
+
appSearchTexts: h,
|
|
75
|
+
customSelectTexts: C,
|
|
76
|
+
errorBoundaryTexts: y,
|
|
77
|
+
widgetTexts: m
|
|
76
78
|
}), [
|
|
77
79
|
s,
|
|
78
80
|
e,
|
|
@@ -84,17 +86,19 @@ const q = () => {
|
|
|
84
86
|
i,
|
|
85
87
|
d,
|
|
86
88
|
g,
|
|
87
|
-
|
|
88
|
-
C
|
|
89
|
+
h,
|
|
90
|
+
C,
|
|
91
|
+
y,
|
|
92
|
+
m
|
|
89
93
|
]);
|
|
90
|
-
return /* @__PURE__ */ a.jsx(T.Provider, { value:
|
|
94
|
+
return /* @__PURE__ */ a.jsx(T.Provider, { value: R, children: /* @__PURE__ */ a.jsx(q, { children: /* @__PURE__ */ a.jsxs(J, { children: [
|
|
91
95
|
/* @__PURE__ */ a.jsx(k, {}),
|
|
92
|
-
|
|
96
|
+
f
|
|
93
97
|
] }) }) });
|
|
94
98
|
}, ce = ({ children: e }) => {
|
|
95
|
-
const [s, t] =
|
|
99
|
+
const [s, t] = x(!1), [o] = x(/* @__PURE__ */ new Set()), n = E((i) => {
|
|
96
100
|
o.add(i), t(!0);
|
|
97
|
-
}, [o]), r =
|
|
101
|
+
}, [o]), r = E((i) => {
|
|
98
102
|
o.delete(i), o.size === 0 && t(!1);
|
|
99
103
|
}, [o]), c = P(() => ({ isLoading: s, startLoading: n, stopLoading: r }), [s, n, r]);
|
|
100
104
|
return /* @__PURE__ */ a.jsxs(O.Provider, { value: c, children: [
|
|
@@ -116,7 +120,7 @@ class W {
|
|
|
116
120
|
case u.SSO_SILENT_START:
|
|
117
121
|
return l.SsoSilent;
|
|
118
122
|
case u.ACQUIRE_TOKEN_START:
|
|
119
|
-
if (s.interactionType ===
|
|
123
|
+
if (s.interactionType === b.Redirect || s.interactionType === b.Popup)
|
|
120
124
|
return l.AcquireToken;
|
|
121
125
|
break;
|
|
122
126
|
case u.HANDLE_REDIRECT_START:
|
|
@@ -141,7 +145,7 @@ class W {
|
|
|
141
145
|
case u.ACQUIRE_TOKEN_SUCCESS:
|
|
142
146
|
case u.ACQUIRE_TOKEN_FAILURE:
|
|
143
147
|
case u.RESTORE_FROM_BFCACHE:
|
|
144
|
-
if (s.interactionType ===
|
|
148
|
+
if (s.interactionType === b.Redirect || s.interactionType === b.Popup) {
|
|
145
149
|
if (t && t !== l.Login && t !== l.AcquireToken)
|
|
146
150
|
break;
|
|
147
151
|
return l.None;
|
|
@@ -152,19 +156,19 @@ class W {
|
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
158
|
/*! @azure/msal-react v2.0.16 2024-05-07 */
|
|
155
|
-
const
|
|
159
|
+
const X = "@azure/msal-react", L = "2.0.16";
|
|
156
160
|
/*! @azure/msal-react v2.0.16 2024-05-07 */
|
|
157
|
-
const
|
|
161
|
+
const N = {
|
|
158
162
|
UNBLOCK_INPROGRESS: "UNBLOCK_INPROGRESS",
|
|
159
163
|
EVENT: "EVENT"
|
|
160
|
-
},
|
|
164
|
+
}, Y = (e, s) => {
|
|
161
165
|
const { type: t, payload: o } = s;
|
|
162
166
|
let n = e.inProgress;
|
|
163
167
|
switch (t) {
|
|
164
|
-
case
|
|
168
|
+
case N.UNBLOCK_INPROGRESS:
|
|
165
169
|
e.inProgress === l.Startup && (n = l.None, o.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));
|
|
166
170
|
break;
|
|
167
|
-
case
|
|
171
|
+
case N.EVENT:
|
|
168
172
|
const c = o.message, i = W.getInteractionStatusFromEvent(c, e.inProgress);
|
|
169
173
|
i && (o.logger.info(`MsalProvider - ${c.eventType} results in setting inProgress from ${e.inProgress} to ${i}`), n = i);
|
|
170
174
|
break;
|
|
@@ -188,7 +192,7 @@ function Z({ instance: e, children: s }) {
|
|
|
188
192
|
I(() => {
|
|
189
193
|
e.initializeWrapperLibrary(U.React, L);
|
|
190
194
|
}, [e]);
|
|
191
|
-
const t = P(() => e.getLogger().clone(
|
|
195
|
+
const t = P(() => e.getLogger().clone(X, L), [e]), [o, n] = B(Y, void 0, () => ({
|
|
192
196
|
inProgress: l.Startup,
|
|
193
197
|
accounts: e.getAllAccounts()
|
|
194
198
|
}));
|
|
@@ -200,7 +204,7 @@ function Z({ instance: e, children: s }) {
|
|
|
200
204
|
logger: t,
|
|
201
205
|
message: i
|
|
202
206
|
},
|
|
203
|
-
type:
|
|
207
|
+
type: N.EVENT
|
|
204
208
|
});
|
|
205
209
|
});
|
|
206
210
|
return t.verbose(`MsalProvider - Registered event callback with id: ${c}`), e.initialize().then(() => {
|
|
@@ -211,7 +215,7 @@ function Z({ instance: e, children: s }) {
|
|
|
211
215
|
instance: e,
|
|
212
216
|
logger: t
|
|
213
217
|
},
|
|
214
|
-
type:
|
|
218
|
+
type: N.UNBLOCK_INPROGRESS
|
|
215
219
|
});
|
|
216
220
|
});
|
|
217
221
|
}).catch(() => {
|
|
@@ -228,44 +232,44 @@ function Z({ instance: e, children: s }) {
|
|
|
228
232
|
return K.createElement(w.Provider, { value: r }, s);
|
|
229
233
|
}
|
|
230
234
|
const ie = ({ children: e }) => {
|
|
231
|
-
const s = M(), { msalInstance: t } =
|
|
232
|
-
const
|
|
233
|
-
return
|
|
234
|
-
}, []), [c, i] =
|
|
235
|
-
let
|
|
236
|
-
return await s.get("/user/detail",
|
|
237
|
-
|
|
235
|
+
const s = M(), { msalInstance: t } = S(A), [o, n] = x(!1), r = E(() => {
|
|
236
|
+
const m = localStorage.getItem("user") ?? null;
|
|
237
|
+
return m ? JSON.parse(m) : null;
|
|
238
|
+
}, []), [c, i] = x(r()), d = E(async (m) => {
|
|
239
|
+
let f = null;
|
|
240
|
+
return await s.get("/user/detail", m ? { headers: { Authorization: `Bearer ${m}` } } : void 0).then((R) => {
|
|
241
|
+
f = R.data;
|
|
238
242
|
}).catch(() => {
|
|
239
|
-
|
|
240
|
-
}), localStorage.setItem("user", JSON.stringify(
|
|
241
|
-
}, [s]), g =
|
|
243
|
+
f = null;
|
|
244
|
+
}), localStorage.setItem("user", JSON.stringify(f)), f;
|
|
245
|
+
}, [s]), g = E(() => {
|
|
242
246
|
localStorage.removeItem("user");
|
|
243
|
-
}, []),
|
|
247
|
+
}, []), h = E(async (m) => {
|
|
244
248
|
n(!0);
|
|
245
|
-
const
|
|
246
|
-
return n(!1),
|
|
247
|
-
}, [d]), C =
|
|
249
|
+
const f = await d(m);
|
|
250
|
+
return n(!1), f ? (i(f), !0) : !1;
|
|
251
|
+
}, [d]), C = E(() => {
|
|
248
252
|
g(), i(null);
|
|
249
|
-
}, [g]),
|
|
253
|
+
}, [g]), y = P(() => ({ user: c, loggingInProgress: o, loginUser: h, logoutUser: C }), [c, h, C, o]);
|
|
250
254
|
return I(() => {
|
|
251
255
|
i(r());
|
|
252
256
|
}, [r]), I(() => {
|
|
253
257
|
if (t) {
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
+
const m = t.addEventCallback((f) => {
|
|
259
|
+
if (f.eventType === u.LOGIN_SUCCESS && f.payload) {
|
|
260
|
+
const R = f.payload;
|
|
261
|
+
h(R.accessToken).catch(() => C());
|
|
258
262
|
}
|
|
259
263
|
});
|
|
260
264
|
return () => {
|
|
261
|
-
|
|
265
|
+
m && t.removeEventCallback(m);
|
|
262
266
|
};
|
|
263
267
|
}
|
|
264
268
|
return () => {
|
|
265
269
|
};
|
|
266
|
-
}, [t,
|
|
270
|
+
}, [t, h, C]), /* @__PURE__ */ a.jsx(G.Provider, { value: y, children: e });
|
|
267
271
|
}, le = ({ ...e }) => {
|
|
268
|
-
const { cookieDomain: s } =
|
|
272
|
+
const { cookieDomain: s } = S(T), [, t] = z(["Authorization"]), o = P(() => ({
|
|
269
273
|
useMsal: e.useMsal ?? !1,
|
|
270
274
|
msalInstance: e.useMsal ? e.msalInstance ?? null : null,
|
|
271
275
|
msalScopes: e.useMsal ? e.msalScopes ?? [] : []
|
|
@@ -292,9 +296,9 @@ const ie = ({ children: e }) => {
|
|
|
292
296
|
}
|
|
293
297
|
return () => {
|
|
294
298
|
};
|
|
295
|
-
}, [e, t, s]), /* @__PURE__ */ a.jsx(
|
|
299
|
+
}, [e, t, s]), /* @__PURE__ */ a.jsx(A.Provider, { value: o, children: e.useMsal ? /* @__PURE__ */ a.jsx(Z, { instance: e.msalInstance, children: e.children }) : e.children });
|
|
296
300
|
}, ee = () => {
|
|
297
|
-
const { confirmTexts: e } =
|
|
301
|
+
const { confirmTexts: e } = S(T), { onConfirm: s, onCancel: t, text: o, show: n } = V();
|
|
298
302
|
return /* @__PURE__ */ a.jsx(v, { show: n, size: "sm", centered: !0, onHide: t, children: /* @__PURE__ */ a.jsxs(v.Body, { children: [
|
|
299
303
|
/* @__PURE__ */ a.jsx("div", { className: "mb-5 text-center", children: /* @__PURE__ */ a.jsx(F, { variant: "h6", children: o }) }),
|
|
300
304
|
/* @__PURE__ */ a.jsxs("div", { className: "w-100 d-flex gap-5", children: [
|
|
@@ -304,7 +308,7 @@ const ie = ({ children: e }) => {
|
|
|
304
308
|
] }) });
|
|
305
309
|
};
|
|
306
310
|
export {
|
|
307
|
-
|
|
311
|
+
A as AuthContext,
|
|
308
312
|
le as AuthProvider,
|
|
309
313
|
O as LoadingContext,
|
|
310
314
|
ce as LoadingProvider,
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export { default as useClickOutside } from './useClickOutside/useClickOutside';
|
|
|
8
8
|
export { default as usePermissions } from './usePermissions/usePermissions';
|
|
9
9
|
export { default as useKeyPress } from './useKeyPress/useKeyPress';
|
|
10
10
|
export { default as useGetApiData } from './useGetApiData/useGetApiData';
|
|
11
|
+
export { default as useGetDataBound } from './useGetDataBound/useGetDataBound';
|
|
11
12
|
export { default as useFormControlType } from './useFormControlType/useFormControlType';
|