react-luminus-components 2.1.3 → 2.1.4
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 +38 -38
- package/dist/{FormDisabledProvider-9PRnBdWU.js → FormDisabledProvider-BlA7oC25.js} +1 -1
- package/dist/FormDisabledProvider-CECmrBJd.cjs +1 -0
- package/dist/components/Form/DropdownPicker/DropdownPicker.d.ts +1 -1
- package/dist/components/HookForm/DropdownPicker/HookFormDropdownPicker.d.ts +1 -1
- package/dist/components/common/SimplePicker/SimplePicker.d.ts +2 -1
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +77 -77
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +47 -47
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +52 -52
- package/dist/main.cjs.js +7 -7
- package/dist/main.es.js +11713 -11712
- package/dist/models/prop-types/InputProps/DropdownPickerProps.d.ts +1 -0
- package/dist/{ShortcutLinksContext-BY-R5-zs.js → nivo-bar-D2xeG6Ps.js} +21213 -21210
- package/dist/nivo-bar-DKJ66whl.cjs +293 -0
- package/dist/style.css +1 -1
- package/dist/{useIsFormDirty-COyiQoVZ.js → useIsFormDirty-BDa_BKvX.js} +5 -5
- package/dist/useIsFormDirty-CgvxOtfe.cjs +1 -0
- package/dist/useLocalStorageState-BJQMZg4Q.cjs +1 -0
- package/dist/{useLocalStorageState-BC8nJ4qt.js → useLocalStorageState-lCgUtRKF.js} +1 -1
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +18 -18
- package/dist/variables.scss +165 -165
- package/package.json +128 -128
- package/dist/FormDisabledProvider-BC1rYj84.cjs +0 -1
- package/dist/ShortcutLinksContext-BrP3e2lp.cjs +0 -293
- package/dist/useIsFormDirty-CXJBlN5Q.cjs +0 -1
- package/dist/useLocalStorageState-DzGRXMpR.cjs +0 -1
package/dist/contexts.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { t as re, bZ as Ne, c as N, b_ as Oe, R as ae,
|
|
2
|
-
import { cs as pn,
|
|
1
|
+
import { t as re, bZ as Ne, c as N, b_ as Oe, R as ae, an as He, b$ as Ae, a5 as H, al as Ue, S as ie, c0 as We, ar as je, ap as Fe, bi as pe, bD as De, bk as J, aq as Be, c1 as ze, aG as we, av as Ge, c2 as Ve, c3 as Xe, c4 as L, c5 as Ke, c6 as U, c7 as l, c8 as _e, c9 as Ie, ca as V, cb as E, cc as Y, cd as ce, ce as Le, cf as Je, cg as Se, ch as Qe, ci as qe, cj as Ye, ck as Ze, cl as be, cm as G, cn as Re, co as Ce, cp as et, cq as fe, cr as Me, ao as tt, bd as nt, a6 as ot } from "./nivo-bar-D2xeG6Ps.js";
|
|
2
|
+
import { cs as pn, ae as _n } from "./nivo-bar-D2xeG6Ps.js";
|
|
3
3
|
import { jsxs as R, jsx as y } from "react/jsx-runtime";
|
|
4
|
-
import { useState as I, useContext as z, useEffect as
|
|
4
|
+
import { useState as I, useContext as z, useEffect as B, useRef as Q, useMemo as F, useCallback as q, useSyncExternalStore as st } from "react";
|
|
5
5
|
import { EventType as ge, InteractionStatus as rt, InteractionRequiredAuthError as it } from "@azure/msal-browser";
|
|
6
6
|
import { MsalProvider as ct, useMsal as at } from "@azure/msal-react";
|
|
7
7
|
import "react-router";
|
|
8
8
|
import "react-dom";
|
|
9
9
|
import "react-hook-form";
|
|
10
10
|
import "react-flexmonster";
|
|
11
|
-
import { L as lt, b as ht } from "./FormDisabledProvider-
|
|
12
|
-
import { F as wn } from "./FormDisabledProvider-
|
|
13
|
-
import { u as ut } from "./useLocalStorageState-
|
|
11
|
+
import { L as lt, b as ht } from "./FormDisabledProvider-BlA7oC25.js";
|
|
12
|
+
import { F as wn } from "./FormDisabledProvider-BlA7oC25.js";
|
|
13
|
+
import { u as ut } from "./useLocalStorageState-lCgUtRKF.js";
|
|
14
14
|
import { u as dt } from "./useIsBrowserOnline-RAirIO4c.js";
|
|
15
15
|
function ft(t) {
|
|
16
16
|
const e = re(t);
|
|
@@ -95,7 +95,7 @@ const mt = (t) => {
|
|
|
95
95
|
let d, S;
|
|
96
96
|
t[9] !== s || t[10] !== r.defaultValue ? (d = () => {
|
|
97
97
|
s === !0 && a(r.defaultValue ?? "");
|
|
98
|
-
}, S = [s, r.defaultValue], t[9] = s, t[10] = r.defaultValue, t[11] = d, t[12] = S) : (d = t[11], S = t[12]),
|
|
98
|
+
}, S = [s, r.defaultValue], t[9] = s, t[10] = r.defaultValue, t[11] = d, t[12] = S) : (d = t[11], S = t[12]), B(d, S);
|
|
99
99
|
let p;
|
|
100
100
|
t[13] !== o ? (p = /* @__PURE__ */ y(H.Header, { className: "justify-content-center", children: /* @__PURE__ */ y(H.Title, { children: o }) }), t[13] = o, t[14] = p) : p = t[14];
|
|
101
101
|
let C;
|
|
@@ -107,16 +107,16 @@ const mt = (t) => {
|
|
|
107
107
|
C,
|
|
108
108
|
_
|
|
109
109
|
] }), t[22] = C, t[23] = _, t[24] = v) : v = t[24];
|
|
110
|
-
let
|
|
111
|
-
t[25] !== n.cancel || t[26] !== u ? (
|
|
110
|
+
let k;
|
|
111
|
+
t[25] !== n.cancel || t[26] !== u ? (k = /* @__PURE__ */ y(ie, { variant: "outlined", color: "secondary", onClick: u, className: "flex-grow-1", children: n.cancel }), t[25] = n.cancel, t[26] = u, t[27] = k) : k = t[27];
|
|
112
112
|
const W = r.required && !c;
|
|
113
113
|
let P;
|
|
114
114
|
t[28] !== n.confirm || t[29] !== W ? (P = /* @__PURE__ */ y(ie, { color: "primary", disabled: W, type: "submit", className: "flex-grow-1", children: n.confirm }), t[28] = n.confirm, t[29] = W, t[30] = P) : P = t[30];
|
|
115
115
|
let M;
|
|
116
|
-
t[31] !==
|
|
117
|
-
|
|
116
|
+
t[31] !== k || t[32] !== P ? (M = /* @__PURE__ */ R(H.Footer, { className: "w-100 d-flex gap-5", children: [
|
|
117
|
+
k,
|
|
118
118
|
P
|
|
119
|
-
] }), t[31] =
|
|
119
|
+
] }), t[31] = k, t[32] = P, t[33] = M) : M = t[33];
|
|
120
120
|
let x;
|
|
121
121
|
t[34] !== f || t[35] !== v || t[36] !== M ? (x = /* @__PURE__ */ R("form", { onSubmit: f, onKeyDown: St, children: [
|
|
122
122
|
v,
|
|
@@ -237,7 +237,7 @@ const on = (t) => {
|
|
|
237
237
|
}, rn = (t) => {
|
|
238
238
|
const e = N.c(39), {
|
|
239
239
|
children: n
|
|
240
|
-
} = t, s =
|
|
240
|
+
} = t, s = Fe(), {
|
|
241
241
|
msalInstance: o,
|
|
242
242
|
getToken: i
|
|
243
243
|
} = z(pe), {
|
|
@@ -255,7 +255,7 @@ const on = (t) => {
|
|
|
255
255
|
let w, b;
|
|
256
256
|
e[2] !== g ? (w = () => {
|
|
257
257
|
g();
|
|
258
|
-
}, b = [g], e[2] = g, e[3] = w, e[4] = b) : (w = e[3], b = e[4]),
|
|
258
|
+
}, b = [g], e[2] = g, e[3] = w, e[4] = b) : (w = e[3], b = e[4]), B(w, b);
|
|
259
259
|
let d;
|
|
260
260
|
if (e[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
261
261
|
e: {
|
|
@@ -289,7 +289,7 @@ const on = (t) => {
|
|
|
289
289
|
$ = null;
|
|
290
290
|
}), $;
|
|
291
291
|
}, e[7] = s, e[8] = v) : v = e[8];
|
|
292
|
-
const
|
|
292
|
+
const k = v;
|
|
293
293
|
let W;
|
|
294
294
|
e[9] !== a || e[10] !== c ? (W = () => {
|
|
295
295
|
localStorage.removeItem("user"), _({
|
|
@@ -299,12 +299,12 @@ const on = (t) => {
|
|
|
299
299
|
}, e[9] = a, e[10] = c, e[11] = W) : W = e[11];
|
|
300
300
|
const P = W;
|
|
301
301
|
let M;
|
|
302
|
-
e[12] !==
|
|
302
|
+
e[12] !== k || e[13] !== h ? (M = async (A) => {
|
|
303
303
|
_({
|
|
304
304
|
state: J.LOGGING_IN,
|
|
305
305
|
user: null
|
|
306
306
|
});
|
|
307
|
-
const $ = await
|
|
307
|
+
const $ = await k(A);
|
|
308
308
|
return $ ? (_({
|
|
309
309
|
state: J.LOGGED_IN,
|
|
310
310
|
user: $
|
|
@@ -312,7 +312,7 @@ const on = (t) => {
|
|
|
312
312
|
state: J.LOGIN_FAILED,
|
|
313
313
|
user: null
|
|
314
314
|
}), !1);
|
|
315
|
-
}, e[12] =
|
|
315
|
+
}, e[12] = k, e[13] = h, e[14] = M) : M = e[14];
|
|
316
316
|
const x = M;
|
|
317
317
|
let O;
|
|
318
318
|
e[15] !== o ? (O = () => {
|
|
@@ -330,7 +330,7 @@ const on = (t) => {
|
|
|
330
330
|
return yt;
|
|
331
331
|
}, e[15] = o, e[16] = O) : O = e[16];
|
|
332
332
|
let j;
|
|
333
|
-
e[17] !== x || e[18] !== P || e[19] !== o ? (j = [o, x, P], e[17] = x, e[18] = P, e[19] = o, e[20] = j) : j = e[20],
|
|
333
|
+
e[17] !== x || e[18] !== P || e[19] !== o ? (j = [o, x, P], e[17] = x, e[18] = P, e[19] = o, e[20] = j) : j = e[20], B(O, j);
|
|
334
334
|
let Z;
|
|
335
335
|
e[21] !== x || e[22] !== P || e[23] !== c ? (Z = async (A) => {
|
|
336
336
|
A && await x(A).catch(() => {
|
|
@@ -344,7 +344,7 @@ const on = (t) => {
|
|
|
344
344
|
}, e[25] = u, e[26] = K, e[27] = ee) : ee = e[27];
|
|
345
345
|
const he = r == null ? void 0 : r.id;
|
|
346
346
|
let te;
|
|
347
|
-
e[28] !== u || e[29] !== K || e[30] !== he ? (te = [u, he, K], e[28] = u, e[29] = K, e[30] = he, e[31] = te) : te = e[31],
|
|
347
|
+
e[28] !== u || e[29] !== K || e[30] !== he ? (te = [u, he, K], e[28] = u, e[29] = K, e[30] = he, e[31] = te) : te = e[31], B(ee, te);
|
|
348
348
|
let ne;
|
|
349
349
|
e[32] !== x || e[33] !== P || e[34] !== C ? (ne = {
|
|
350
350
|
user: C.user,
|
|
@@ -354,7 +354,7 @@ const on = (t) => {
|
|
|
354
354
|
}, e[32] = x, e[33] = P, e[34] = C, e[35] = ne) : ne = e[35];
|
|
355
355
|
const ue = ne;
|
|
356
356
|
let oe;
|
|
357
|
-
return e[36] !== n || e[37] !== ue ? (oe = /* @__PURE__ */ y(
|
|
357
|
+
return e[36] !== n || e[37] !== ue ? (oe = /* @__PURE__ */ y(Be.Provider, { value: ue, children: n }), e[36] = n, e[37] = ue, e[38] = oe) : oe = e[38], oe;
|
|
358
358
|
};
|
|
359
359
|
function yt() {
|
|
360
360
|
}
|
|
@@ -371,7 +371,7 @@ const vt = () => {
|
|
|
371
371
|
/* @__PURE__ */ y("a", { href: window.location.href.replace("/blank", "/"), children: "here" })
|
|
372
372
|
] })
|
|
373
373
|
] }), t[1] = n) : n = t[1], n;
|
|
374
|
-
},
|
|
374
|
+
}, kt = (t) => {
|
|
375
375
|
const e = t == null ? void 0 : t.getActiveAccount();
|
|
376
376
|
console.log("getTokenMsal activeAccount", e);
|
|
377
377
|
const n = t == null ? void 0 : t.getAllAccounts();
|
|
@@ -385,32 +385,32 @@ const vt = () => {
|
|
|
385
385
|
inProgress: e
|
|
386
386
|
} = at(), {
|
|
387
387
|
cookieDomain: n
|
|
388
|
-
} = z(ae), [, s] = ze(["Authorization"]), o =
|
|
388
|
+
} = z(ae), [, s] = ze(["Authorization"]), o = F(
|
|
389
389
|
() => t.useMsal ? t.msalInstance : null,
|
|
390
390
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
391
391
|
[t.useMsal, t.useMsal ? t.msalInstance : null]
|
|
392
|
-
), i =
|
|
392
|
+
), i = F(
|
|
393
393
|
() => t.useMsal ? t.msalScopes : [],
|
|
394
394
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
395
395
|
[t.useMsal, t.useMsal ? t.msalScopes : null]
|
|
396
|
-
), r =
|
|
396
|
+
), r = F(
|
|
397
397
|
() => t.useMsal ? t.msalExtraScopes : [],
|
|
398
398
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
399
399
|
[t.useMsal, t.useMsal ? t.msalExtraScopes : null]
|
|
400
|
-
), c = Q(null), a = Q(!1), h =
|
|
400
|
+
), c = Q(null), a = Q(!1), h = q(() => {
|
|
401
401
|
const d = localStorage.getItem("token");
|
|
402
402
|
return d ? {
|
|
403
403
|
token: d,
|
|
404
404
|
expiresOn: ht(new Date(Date.now()), 1)
|
|
405
405
|
} : null;
|
|
406
|
-
}, []), u =
|
|
406
|
+
}, []), u = q(async () => {
|
|
407
407
|
if (console.log("getTokenMsal"), o == null)
|
|
408
408
|
throw console.log("getTokenMsal throwing error because msalInstance is null"), new Error("getTokenMsal: msalInstance is null");
|
|
409
409
|
if (c.current)
|
|
410
410
|
return console.log("getTokenMsal returning tokenRequestPromise.current", c.current), c.current;
|
|
411
411
|
const d = new Promise((S, p) => {
|
|
412
412
|
const C = (_) => {
|
|
413
|
-
const v =
|
|
413
|
+
const v = kt(o);
|
|
414
414
|
if (!v) {
|
|
415
415
|
console.log("getTokenMsal no account found. Redirecting to login"), o == null || o.loginRedirect({
|
|
416
416
|
scopes: i,
|
|
@@ -422,16 +422,16 @@ const vt = () => {
|
|
|
422
422
|
scopes: i,
|
|
423
423
|
account: v,
|
|
424
424
|
redirectUri: t.useMsal ? t.msalSilentRedirectUri : void 0
|
|
425
|
-
}).then((
|
|
425
|
+
}).then((k) => {
|
|
426
426
|
_(), S({
|
|
427
|
-
token:
|
|
428
|
-
expiresOn:
|
|
427
|
+
token: k.accessToken,
|
|
428
|
+
expiresOn: k.expiresOn ?? new Date(Date.now())
|
|
429
429
|
});
|
|
430
|
-
}).catch((
|
|
431
|
-
console.error("Error acquiring token",
|
|
430
|
+
}).catch((k) => {
|
|
431
|
+
console.error("Error acquiring token", k), k instanceof it && (console.log("Silent token acquisition failed. Acquiring token using redirect"), o == null || o.acquireTokenRedirect({
|
|
432
432
|
scopes: i,
|
|
433
433
|
extraScopesToConsent: r
|
|
434
|
-
}), _(), S(null)), _(), p(
|
|
434
|
+
}), _(), S(null)), _(), p(k);
|
|
435
435
|
}).finally(() => {
|
|
436
436
|
_(), p(new Error("No access token returned from handleRedirectPromise"));
|
|
437
437
|
});
|
|
@@ -452,13 +452,13 @@ const vt = () => {
|
|
|
452
452
|
});
|
|
453
453
|
});
|
|
454
454
|
return c.current = d, d;
|
|
455
|
-
}, [r, o, i, t.msalSilentRedirectUri, t.useMsal]), m =
|
|
455
|
+
}, [r, o, i, t.msalSilentRedirectUri, t.useMsal]), m = q(async () => t.useMsal ? u() : h(), [h, u, t.useMsal]), f = q((d) => t.useMsal ? () => {
|
|
456
456
|
} : (window.addEventListener("storage", d), window.addEventListener("dev-auth-change", d), () => {
|
|
457
457
|
window.removeEventListener("storage", d), window.removeEventListener("dev-auth-change", d);
|
|
458
|
-
}), [t.useMsal]), g = st(f, () => localStorage.getItem("token") !== null ? "AUTH_OK" : "NO_AUTH"), w =
|
|
458
|
+
}), [t.useMsal]), g = st(f, () => localStorage.getItem("token") !== null ? "AUTH_OK" : "NO_AUTH"), w = F(() => {
|
|
459
459
|
var d;
|
|
460
460
|
return t.useMsal ? e !== rt.None ? "AUTH_IN_PROGRESS" : (o == null ? void 0 : o.getActiveAccount()) ?? ((d = o == null ? void 0 : o.getAllAccounts()) == null ? void 0 : d[0]) ?? null ? "AUTH_OK" : "NO_AUTH" : g;
|
|
461
|
-
}, [g, e, o, t.useMsal]), b =
|
|
461
|
+
}, [g, e, o, t.useMsal]), b = F(() => ({
|
|
462
462
|
useMsal: t.useMsal ?? !1,
|
|
463
463
|
msalInstance: o,
|
|
464
464
|
msalScopes: i,
|
|
@@ -466,7 +466,7 @@ const vt = () => {
|
|
|
466
466
|
getToken: m,
|
|
467
467
|
authState: w
|
|
468
468
|
}), [t.useMsal, o, i, r, m, w]);
|
|
469
|
-
return
|
|
469
|
+
return B(() => {
|
|
470
470
|
if (t.useMsal && o) {
|
|
471
471
|
const d = o.addEventCallback((S) => {
|
|
472
472
|
if (S.eventType === ge.LOGIN_SUCCESS || S.eventType === ge.ACQUIRE_TOKEN_SUCCESS && S.payload) {
|
|
@@ -514,10 +514,10 @@ const vt = () => {
|
|
|
514
514
|
c = null;
|
|
515
515
|
break e;
|
|
516
516
|
}
|
|
517
|
-
const v = o.from ? we(o.from) : _t(),
|
|
517
|
+
const v = o.from ? we(o.from) : _t(), k = o.to ? we(o.to) : gt();
|
|
518
518
|
if (!pt(new Date(Date.now()), {
|
|
519
519
|
start: v,
|
|
520
|
-
end:
|
|
520
|
+
end: k
|
|
521
521
|
})) {
|
|
522
522
|
i(null), c = null;
|
|
523
523
|
break e;
|
|
@@ -543,7 +543,7 @@ const vt = () => {
|
|
|
543
543
|
return v(), () => {
|
|
544
544
|
g.current !== null && window.clearTimeout(g.current);
|
|
545
545
|
};
|
|
546
|
-
}, b = [f], e[1] = f, e[2] = w, e[3] = b) : (w = e[2], b = e[3]),
|
|
546
|
+
}, b = [f], e[1] = f, e[2] = w, e[3] = b) : (w = e[2], b = e[3]), B(w, b);
|
|
547
547
|
let d;
|
|
548
548
|
e[4] !== r ? (d = () => {
|
|
549
549
|
const v = () => {
|
|
@@ -554,7 +554,7 @@ const vt = () => {
|
|
|
554
554
|
};
|
|
555
555
|
}, e[4] = r, e[5] = d) : d = e[5];
|
|
556
556
|
let S;
|
|
557
|
-
e[6] !== r || e[7] !== f ? (S = [r, f], e[6] = r, e[7] = f, e[8] = S) : S = e[8],
|
|
557
|
+
e[6] !== r || e[7] !== f ? (S = [r, f], e[6] = r, e[7] = f, e[8] = S) : S = e[8], B(d, S);
|
|
558
558
|
let p;
|
|
559
559
|
e[9] !== u || e[10] !== f || e[11] !== m || e[12] !== i || e[13] !== a ? (p = {
|
|
560
560
|
delegation: a,
|
|
@@ -584,7 +584,7 @@ const vt = () => {
|
|
|
584
584
|
const m = u;
|
|
585
585
|
let f;
|
|
586
586
|
e[7] === Symbol.for("react.memo_cache_sentinel") ? (f = () => {
|
|
587
|
-
h(
|
|
587
|
+
h(Tt);
|
|
588
588
|
}, e[7] = f) : f = e[7];
|
|
589
589
|
const g = f;
|
|
590
590
|
let w;
|
|
@@ -604,7 +604,7 @@ const vt = () => {
|
|
|
604
604
|
s
|
|
605
605
|
] }), e[14] = s, e[15] = S, e[16] = p, e[17] = C) : C = e[17], C;
|
|
606
606
|
};
|
|
607
|
-
function
|
|
607
|
+
function Tt(t) {
|
|
608
608
|
return t.length > 1 ? t.slice(0, -1) : t;
|
|
609
609
|
}
|
|
610
610
|
class $e {
|
|
@@ -699,10 +699,10 @@ class Et extends le {
|
|
|
699
699
|
o && clearTimeout(o), e.abortSignal && (e.abortSignal.onabort = null);
|
|
700
700
|
}
|
|
701
701
|
if (!i.ok) {
|
|
702
|
-
const a = await
|
|
702
|
+
const a = await ke(i, "text");
|
|
703
703
|
throw new V(a || i.statusText, i.status);
|
|
704
704
|
}
|
|
705
|
-
const c = await
|
|
705
|
+
const c = await ke(i, e.responseType);
|
|
706
706
|
return new $e(i.status, i.statusText, c);
|
|
707
707
|
}
|
|
708
708
|
getCookieString(e) {
|
|
@@ -710,7 +710,7 @@ class Et extends le {
|
|
|
710
710
|
return L.isNode && this._jar && this._jar.getCookies(e, (s, o) => n = o.join("; ")), n;
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function ke(t, e) {
|
|
714
714
|
let n;
|
|
715
715
|
switch (e) {
|
|
716
716
|
case "arraybuffer":
|
|
@@ -772,7 +772,7 @@ class xt extends le {
|
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
774
|
const At = [0, 2e3, 1e4, 3e4, null];
|
|
775
|
-
class
|
|
775
|
+
class Te {
|
|
776
776
|
constructor(e) {
|
|
777
777
|
this._retryDelays = e !== void 0 ? [...e, null] : At;
|
|
778
778
|
}
|
|
@@ -801,10 +801,10 @@ class Dt extends le {
|
|
|
801
801
|
return this._innerClient.getCookieString(e);
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
|
-
var
|
|
804
|
+
var T;
|
|
805
805
|
(function(t) {
|
|
806
806
|
t[t.None = 0] = "None", t[t.WebSockets = 1] = "WebSockets", t[t.ServerSentEvents = 2] = "ServerSentEvents", t[t.LongPolling = 4] = "LongPolling";
|
|
807
|
-
})(
|
|
807
|
+
})(T || (T = {}));
|
|
808
808
|
var D;
|
|
809
809
|
(function(t) {
|
|
810
810
|
t[t.Text = 1] = "Text", t[t.Binary = 2] = "Binary";
|
|
@@ -834,7 +834,7 @@ class Ee {
|
|
|
834
834
|
async connect(e, n) {
|
|
835
835
|
if (E.isRequired(e, "url"), E.isRequired(n, "transferFormat"), E.isIn(n, D, "transferFormat"), this._url = e, this._logger.log(l.Trace, "(LongPolling transport) Connecting."), n === D.Binary && typeof XMLHttpRequest < "u" && typeof new XMLHttpRequest().responseType != "string")
|
|
836
836
|
throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");
|
|
837
|
-
const [s, o] =
|
|
837
|
+
const [s, o] = Y(), i = { [s]: o, ...this._options.headers }, r = {
|
|
838
838
|
abortSignal: this._pollAbort.signal,
|
|
839
839
|
headers: i,
|
|
840
840
|
timeout: 1e5,
|
|
@@ -868,7 +868,7 @@ class Ee {
|
|
|
868
868
|
this._logger.log(l.Trace, "(LongPolling transport) Stopping polling."), this._running = !1, this._pollAbort.abort();
|
|
869
869
|
try {
|
|
870
870
|
await this._receiving, this._logger.log(l.Trace, `(LongPolling transport) sending DELETE request to ${this._url}.`);
|
|
871
|
-
const e = {}, [n, s] =
|
|
871
|
+
const e = {}, [n, s] = Y();
|
|
872
872
|
e[n] = s;
|
|
873
873
|
const o = {
|
|
874
874
|
headers: { ...e, ...this._options.headers },
|
|
@@ -910,7 +910,7 @@ class Lt {
|
|
|
910
910
|
else {
|
|
911
911
|
const c = this._httpClient.getCookieString(e), a = {};
|
|
912
912
|
a.Cookie = c;
|
|
913
|
-
const [h, u] =
|
|
913
|
+
const [h, u] = Y();
|
|
914
914
|
a[h] = u, r = new this._options.EventSource(e, { withCredentials: this._options.withCredentials, headers: { ...a, ...this._options.headers } });
|
|
915
915
|
}
|
|
916
916
|
try {
|
|
@@ -956,7 +956,7 @@ class Rt {
|
|
|
956
956
|
const c = this._httpClient.getCookieString(e);
|
|
957
957
|
let a = !1;
|
|
958
958
|
if (L.isNode || L.isReactNative) {
|
|
959
|
-
const h = {}, [u, m] =
|
|
959
|
+
const h = {}, [u, m] = Y();
|
|
960
960
|
h[u] = m, s && (h[X.Authorization] = `Bearer ${s}`), c && (h[X.Cookie] = c), r = new this._webSocketConstructor(e, void 0, {
|
|
961
961
|
headers: { ...h, ...this._headers }
|
|
962
962
|
});
|
|
@@ -1062,8 +1062,8 @@ class Mt {
|
|
|
1062
1062
|
this._accessTokenFactory = this._options.accessTokenFactory, this._httpClient._accessTokenFactory = this._accessTokenFactory;
|
|
1063
1063
|
try {
|
|
1064
1064
|
if (this._options.skipNegotiation)
|
|
1065
|
-
if (this._options.transport ===
|
|
1066
|
-
this.transport = this._constructTransport(
|
|
1065
|
+
if (this._options.transport === T.WebSockets)
|
|
1066
|
+
this.transport = this._constructTransport(T.WebSockets), await this._startTransport(n, e);
|
|
1067
1067
|
else
|
|
1068
1068
|
throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");
|
|
1069
1069
|
else {
|
|
@@ -1091,7 +1091,7 @@ class Mt {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
async _getNegotiationResponse(e) {
|
|
1094
|
-
const n = {}, [s, o] =
|
|
1094
|
+
const n = {}, [s, o] = Y();
|
|
1095
1095
|
n[s] = o;
|
|
1096
1096
|
const i = this._resolveNegotiateUrl(e);
|
|
1097
1097
|
this._logger.log(l.Debug, `Sending negotiation request: ${i}.`);
|
|
@@ -1139,26 +1139,26 @@ class Mt {
|
|
|
1139
1139
|
await this._startTransport(i, o), this.connectionId = a.connectionId;
|
|
1140
1140
|
return;
|
|
1141
1141
|
} catch (m) {
|
|
1142
|
-
if (this._logger.log(l.Error, `Failed to start the transport '${h.transport}': ${m}`), a = void 0, r.push(new Qe(`${h.transport} failed: ${m}`,
|
|
1142
|
+
if (this._logger.log(l.Error, `Failed to start the transport '${h.transport}': ${m}`), a = void 0, r.push(new Qe(`${h.transport} failed: ${m}`, T[h.transport])), this._connectionState !== "Connecting") {
|
|
1143
1143
|
const f = "Failed to select transport before stop() was called.";
|
|
1144
1144
|
return this._logger.log(l.Debug, f), Promise.reject(new U(f));
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
1147
|
}
|
|
1148
1148
|
}
|
|
1149
|
-
return r.length > 0 ? Promise.reject(new
|
|
1149
|
+
return r.length > 0 ? Promise.reject(new qe(`Unable to connect to the server with any of the available transports. ${r.join(" ")}`, r)) : Promise.reject(new Error("None of the transports supported by the client are supported by the server."));
|
|
1150
1150
|
}
|
|
1151
1151
|
_constructTransport(e) {
|
|
1152
1152
|
switch (e) {
|
|
1153
|
-
case
|
|
1153
|
+
case T.WebSockets:
|
|
1154
1154
|
if (!this._options.WebSocket)
|
|
1155
1155
|
throw new Error("'WebSocket' is not supported in your environment.");
|
|
1156
1156
|
return new Rt(this._httpClient, this._accessTokenFactory, this._logger, this._options.logMessageContent, this._options.WebSocket, this._options.headers || {});
|
|
1157
|
-
case
|
|
1157
|
+
case T.ServerSentEvents:
|
|
1158
1158
|
if (!this._options.EventSource)
|
|
1159
1159
|
throw new Error("'EventSource' is not supported in your environment.");
|
|
1160
1160
|
return new Lt(this._httpClient, this._httpClient._accessToken, this._logger, this._options);
|
|
1161
|
-
case
|
|
1161
|
+
case T.LongPolling:
|
|
1162
1162
|
return new Ee(this._httpClient, this._logger, this._options);
|
|
1163
1163
|
default:
|
|
1164
1164
|
throw new Error(`Unknown transport: ${e}.`);
|
|
@@ -1181,23 +1181,23 @@ class Mt {
|
|
|
1181
1181
|
} : this.transport.onclose = (s) => this._stopConnection(s), this.transport.connect(e, n);
|
|
1182
1182
|
}
|
|
1183
1183
|
_resolveTransportOrError(e, n, s, o) {
|
|
1184
|
-
const i =
|
|
1184
|
+
const i = T[e.transport];
|
|
1185
1185
|
if (i == null)
|
|
1186
1186
|
return this._logger.log(l.Debug, `Skipping transport '${e.transport}' because it is not supported by this client.`), new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);
|
|
1187
1187
|
if ($t(n, i))
|
|
1188
1188
|
if (e.transferFormats.map((c) => D[c]).indexOf(s) >= 0) {
|
|
1189
|
-
if (i ===
|
|
1190
|
-
return this._logger.log(l.Debug, `Skipping transport '${
|
|
1191
|
-
this._logger.log(l.Debug, `Selecting transport '${
|
|
1189
|
+
if (i === T.WebSockets && !this._options.WebSocket || i === T.ServerSentEvents && !this._options.EventSource)
|
|
1190
|
+
return this._logger.log(l.Debug, `Skipping transport '${T[i]}' because it is not supported in your environment.'`), new Ye(`'${T[i]}' is not supported in your environment.`, i);
|
|
1191
|
+
this._logger.log(l.Debug, `Selecting transport '${T[i]}'.`);
|
|
1192
1192
|
try {
|
|
1193
|
-
return this.features.reconnect = i ===
|
|
1193
|
+
return this.features.reconnect = i === T.WebSockets ? o : void 0, this._constructTransport(i);
|
|
1194
1194
|
} catch (c) {
|
|
1195
1195
|
return c;
|
|
1196
1196
|
}
|
|
1197
1197
|
} else
|
|
1198
|
-
return this._logger.log(l.Debug, `Skipping transport '${
|
|
1198
|
+
return this._logger.log(l.Debug, `Skipping transport '${T[i]}' because it does not support the requested transfer format '${D[s]}'.`), new Error(`'${T[i]}' does not support ${D[s]}.`);
|
|
1199
1199
|
else
|
|
1200
|
-
return this._logger.log(l.Debug, `Skipping transport '${
|
|
1200
|
+
return this._logger.log(l.Debug, `Skipping transport '${T[i]}' because it was disabled by the client.`), new Ze(`'${T[i]}' is disabled by the client.`, i);
|
|
1201
1201
|
}
|
|
1202
1202
|
_isITransport(e) {
|
|
1203
1203
|
return e && typeof e == "object" && "connect" in e;
|
|
@@ -1416,7 +1416,7 @@ class Wt {
|
|
|
1416
1416
|
withAutomaticReconnect(e) {
|
|
1417
1417
|
if (this.reconnectPolicy)
|
|
1418
1418
|
throw new Error("A reconnectPolicy has already been set.");
|
|
1419
|
-
return e ? Array.isArray(e) ? this.reconnectPolicy = new
|
|
1419
|
+
return e ? Array.isArray(e) ? this.reconnectPolicy = new Te(e) : this.reconnectPolicy = e : this.reconnectPolicy = new Te(), this;
|
|
1420
1420
|
}
|
|
1421
1421
|
/** Configures {@link @microsoft/signalr.HubConnection.serverTimeoutInMilliseconds} for the {@link @microsoft/signalr.HubConnection}.
|
|
1422
1422
|
*
|
|
@@ -1454,7 +1454,7 @@ class Wt {
|
|
|
1454
1454
|
function jt(t) {
|
|
1455
1455
|
return t.log !== void 0;
|
|
1456
1456
|
}
|
|
1457
|
-
const
|
|
1457
|
+
const Ft = 10 * 1e3, Bt = 15 * 1e3, un = ({
|
|
1458
1458
|
children: t,
|
|
1459
1459
|
apiUrl: e,
|
|
1460
1460
|
endpoint: n
|
|
@@ -1464,18 +1464,18 @@ const Bt = 10 * 1e3, Ft = 15 * 1e3, un = ({
|
|
|
1464
1464
|
getToken: o
|
|
1465
1465
|
} = z(pe), i = dt(), [r, c] = I(fe.Disconnected), [a, h] = I(!1), u = Q(null), m = Q(o);
|
|
1466
1466
|
m.current = o;
|
|
1467
|
-
const f =
|
|
1467
|
+
const f = q(() => {
|
|
1468
1468
|
var d;
|
|
1469
1469
|
return c(((d = u.current) == null ? void 0 : d.state) ?? fe.Disconnected);
|
|
1470
1470
|
}, []);
|
|
1471
|
-
|
|
1471
|
+
B(() => {
|
|
1472
1472
|
if (s !== "AUTH_OK" || !i)
|
|
1473
1473
|
return;
|
|
1474
1474
|
let d = !1, S = null;
|
|
1475
1475
|
const p = new Wt().withUrl(`${e}/${n}`, {
|
|
1476
1476
|
accessTokenFactory: () => m.current().then((_) => (_ == null ? void 0 : _.token) ?? "")
|
|
1477
1477
|
}).withAutomaticReconnect({
|
|
1478
|
-
nextRetryDelayInMilliseconds: (_) => Math.min(1e3 * 2 ** _.previousRetryCount,
|
|
1478
|
+
nextRetryDelayInMilliseconds: (_) => Math.min(1e3 * 2 ** _.previousRetryCount, Bt)
|
|
1479
1479
|
}).build();
|
|
1480
1480
|
u.current = p, p.on("Connected", (_) => {
|
|
1481
1481
|
console.log("Server says:", _);
|
|
@@ -1496,7 +1496,7 @@ const Bt = 10 * 1e3, Ft = 15 * 1e3, un = ({
|
|
|
1496
1496
|
}
|
|
1497
1497
|
console.log("Connection started"), f(), h(!1);
|
|
1498
1498
|
}).catch((_) => {
|
|
1499
|
-
d || (console.log("Error starting connection:", _), f(), h(!0), S = window.setTimeout(C,
|
|
1499
|
+
d || (console.log("Error starting connection:", _), f(), h(!0), S = window.setTimeout(C, Ft));
|
|
1500
1500
|
});
|
|
1501
1501
|
};
|
|
1502
1502
|
return C(), () => {
|
|
@@ -1505,7 +1505,7 @@ const Bt = 10 * 1e3, Ft = 15 * 1e3, un = ({
|
|
|
1505
1505
|
});
|
|
1506
1506
|
};
|
|
1507
1507
|
}, [e, s, n, f, i]);
|
|
1508
|
-
const g =
|
|
1508
|
+
const g = F(() => r === fe.Connected, [r]), w = F(() => s === "AUTH_OK", [s]), b = F(() => ({
|
|
1509
1509
|
isAlive: g,
|
|
1510
1510
|
shouldBeAlive: w,
|
|
1511
1511
|
connectionState: r,
|
|
@@ -1576,7 +1576,7 @@ export {
|
|
|
1576
1576
|
sn as LoadingProvider,
|
|
1577
1577
|
ae as LuminusComponentsContext,
|
|
1578
1578
|
on as LuminusComponentsProvider,
|
|
1579
|
-
|
|
1579
|
+
Be as UserContext,
|
|
1580
1580
|
rn as UserProvider,
|
|
1581
1581
|
dn as useApiWebSocketContext,
|
|
1582
1582
|
_n as useFormDisabledContext
|
package/dist/hooks.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./nivo-bar-DKJ66whl.cjs"),f=require("react"),V=require("./useLocalStorageState-BJQMZg4Q.cjs"),F=require("./useIsFormDirty-CgvxOtfe.cjs");require("react/jsx-runtime");require("react-router");const H=require("react-dom");require("react-hook-form");require("react-flexmonster");require("@azure/msal-react");require("@azure/msal-browser");const Q=require("./useIsBrowserOnline-CREGrf2l.cjs"),C=new Map;function _(s,r){const e=a.useAxios({silent:!0,differentBaseUrl:r==null?void 0:r.customBaseUrl,customToken:r==null?void 0:r.customToken}),t=f.useRef(null);if(!C.has(s)){const m=e.get(s).then(n=>(C.set(s,{status:"success",data:n.data}),t.current=setTimeout(()=>{C.delete(s),t.current=null},1e4),n.data)).catch(n=>{throw C.set(s,{status:"error",error:n}),t.current=setTimeout(()=>{C.delete(s),t.current=null},1e3),n});throw C.set(s,{status:"pending",promise:m}),m}const o=C.get(s);if(o.status==="pending")throw o.promise;if(o.status==="error")throw o.error;return o.data}const J=s=>r=>(window.addEventListener(`storage_${s}`,r),()=>window.removeEventListener(`storage_${s}`,r)),M=(s,r,e)=>{const t=a.compilerRuntimeExports.c(15),o=e===void 0?localStorage:e,[m]=f.useState(r);let n;t[0]!==r?(n=JSON.stringify(r),t[0]=r,t[1]=n):n=t[1];const l=f.useRef(n),w=f.useRef(r);let h;t[2]!==s||t[3]!==m||t[4]!==o?(h=()=>{const i=o.getItem(s);return i!==l.current&&(l.current=i,w.current=l.current?JSON.parse(l.current):m),w.current},t[2]=s,t[3]=m,t[4]=o,t[5]=h):h=t[5];const y=h;let g;t[6]!==s?(g=J(s),t[6]=s,t[7]=g):g=t[7];const I=g,c=f.useSyncExternalStore(I,y);let u;t[8]!==y||t[9]!==s||t[10]!==o?(u=i=>{const O=typeof i=="function"?i(y()):i;o.setItem(s,JSON.stringify(O)),window.dispatchEvent(new Event(`storage_${s}`))},t[8]=y,t[9]=s,t[10]=o,t[11]=u):u=t[11];const d=u;let v;return t[12]!==d||t[13]!==c?(v=[c,d],t[12]=d,t[13]=c,t[14]=v):v=t[14],v},W=(s,r,e)=>{let t="pending",o;const m=s.then(n=>{t="success",o=n},n=>{const l=n==null?void 0:n.response;(l==null?void 0:l.status)===404&&e?(t="error-404",o=n):(t="error",o=n)});return()=>{switch(t){case"pending":throw m;case"success":return o;case"error":if(o.code==="ERR_CANCELED")return null;throw o;case"error-404":throw new Error("404");default:throw new Error("Unknown status")}}},P={loadOnInit:!0,silent:!1,enabled:!0,nullStateBeforeLoad:!0,nullStateOnFail:!1},z=(s,r)=>{const e=a.compilerRuntimeExports.c(26),{loadOnInit:t,enabled:o,silent:m,nullStateBeforeLoad:n,nullStateOnFail:l,customApiUrl:w,customBearerToken:h,dataTransformer:y,errorBoundaryOn404:g}=r===void 0?P:r,I=t===void 0?P.loadOnInit:t,c=o===void 0?P.enabled:o,u=m===void 0?P.silent:m,d=n===void 0?P.nullStateBeforeLoad:n,v=l===void 0?P.nullStateOnFail:l;let p;e[0]!==g?(p=g?[404]:void 0,e[0]=g,e[1]=p):p=e[1];let i;e[2]!==w||e[3]!==h||e[4]!==u||e[5]!==p?(i={silent:u,customToken:h,differentBaseUrl:w,noToastOnStatus:p},e[2]=w,e[3]=h,e[4]=u,e[5]=p,e[6]=i):i=e[6];const O=a.useAxios(i),{startLoading:D,stopLoading:S}=f.useContext(a.LoadingContext),E=f.useRef(0),{isAuthenticated:B}=a.useAuth(),[R,N]=f.useState(null);let b;e[7]!==O||e[8]!==y||e[9]!==c||e[10]!==g||e[11]!==B||e[12]!==d||e[13]!==v||e[14]!==u||e[15]!==D||e[16]!==S||e[17]!==s?(b=async(x,G)=>{if(!B()||c===!1)return;!u&&D(`loadData-${s}-${G}`),d&&N(null);const U=O.get(s,{signal:x}).then(K=>y?y(K.data):K.data).finally(()=>!u&&S(`loadData-${s}-${G}`));N(W(U,v??!1,g??!1))},e[7]=O,e[8]=y,e[9]=c,e[10]=g,e[11]=B,e[12]=d,e[13]=v,e[14]=u,e[15]=D,e[16]=S,e[17]=s,e[18]=b):b=e[18];const T=b;let q,A;e[19]!==T||e[20]!==I?(A=()=>{if(I===!1)return;const x=new AbortController;return T(x.signal,E.current=E.current+1),()=>{x.abort()}},q=[T,I],e[19]=T,e[20]=I,e[21]=q,e[22]=A):(q=e[21],A=e[22]),f.useEffect(A,q);let L;return e[23]!==R||e[24]!==T?(L={data:R,setData:N,reloadData:T},e[23]=R,e[24]=T,e[25]=L):L=e[25],L},Z=()=>{const s=f.useRef({}).current;return f.useEffect(()=>{const r=document.createElement("div");return r.style.position="absolute",r.style.pointerEvents="none",r.style.top="0",r.style.width="100%",r.style.height="100%",s.elt=r,document.body.appendChild(r),()=>{document.body.removeChild(r)}},[s]),r=>(e,...t)=>{const o=r(e,...t);return e.draggableProps.style.position==="fixed"?H.createPortal(o,s.elt):o}},$={storageKey:"--tmp-scroll-save--",requiredHeight:100,retryInterval:50},j=(s,r)=>{const e=a.compilerRuntimeExports.c(18),{storageKey:t,requiredHeight:o,retryInterval:m}=r===void 0?$:r,n=t===void 0?$.storageKey:t,l=o===void 0?$.requiredHeight:o,w=m===void 0?$.retryInterval:m,[h,y]=f.useState(!1),g=f.useRef(null);let I;e[0]!==n?(I=()=>{const S=localStorage.getItem(n);return localStorage.removeItem(n),S===null?null:Number(S)},e[0]=n,e[1]=I):I=e[1];const c=I;let u;e[2]!==n?(u=S=>{localStorage.setItem(n,S)},e[2]=n,e[3]=u):u=e[3];const d=u;let v,p;e[4]!==h||e[5]!==l||e[6]!==c||e[7]!==w||e[8]!==s?(v=()=>{const S=window.setInterval(()=>{if(!h&&s.current!==null&&s.current.getBoundingClientRect().height>l){y(!0);const E=c();E!==null&&s.current.scrollTo({top:E}),window.clearInterval(S)}},w);return()=>{window.clearTimeout(S)}},p=[h,l,c,w,s],e[4]=h,e[5]=l,e[6]=c,e[7]=w,e[8]=s,e[9]=v,e[10]=p):(v=e[9],p=e[10]),f.useEffect(v,p);let i,O;e[11]!==d||e[12]!==s?(i=()=>{var E;const S=new AbortController;return(E=s.current)==null||E.addEventListener("scrollend",()=>{var B;g.current=((B=s.current)==null?void 0:B.scrollTop)??0,d((g.current??0).toString())},{signal:S.signal}),()=>S.abort()},O=[d,s],e[11]=d,e[12]=s,e[13]=i,e[14]=O):(i=e[13],O=e[14]),f.useEffect(i,O);let D;return e[15]!==c||e[16]!==d?(D={saveValue:d,retrieveValue:c},e[15]=c,e[16]=d,e[17]=D):D=e[17],D};exports.cancelToken=a.cancelToken;exports.useAuth=a.useAuth;exports.useAxios=a.useAxios;exports.useClickOutside=a.useClickOutside;exports.useClipboard=a.useClipboard;exports.useConfirm=a.useConfirm;exports.useFormControlType=a.useFormControlType;exports.useGetApiData=a.useGetApiData;exports.useKeyPress=a.useKeyPress;exports.useNotifications=a.useNotifications;exports.usePermissions=a.usePermissions;exports.usePrompt=a.usePrompt;exports.useWindowSize=a.useWindowSize;exports.useZodSchemaTypes=a.useZodSchemaTypes;exports.useLocalStorageState=V.useLocalStorageState;exports.useEmployeePhotoPath=F.useEmployeePhotoPath;exports.useIsFormDirty=F.useIsFormDirty;exports.useSearchQuery=F.useSearchQuery;exports.useSearchQueryState=F.useSearchQueryState;exports.useIsBrowserOnline=Q.useIsBrowserOnline;exports.useGetApiDataBound=z;exports.useGetDataBound=_;exports.usePersistentState=M;exports.useRenderDraggableInPortal=Z;exports.useScrollSave=j;
|