react-luminus-components 2.0.3-beta.r19-7 → 2.0.3-beta.r19-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/usePersistentState/usePersistentState.d.ts +2 -0
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +113 -104
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/storages/queryStorage.d.ts +3 -0
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +103 -76
- package/package.json +1 -1
package/dist/hooks/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { default as useFormControlType } from './useFormControlType/useFormContr
|
|
|
13
13
|
export { default as useLocalStorageState } from './useLocalStorageState/useLocalStorageState';
|
|
14
14
|
export { default as useSearchQuery } from './useSearchQuery/useSearchQuery';
|
|
15
15
|
export { default as useSearchQueryState } from './useSearchQueryState/useSearchQueryState';
|
|
16
|
+
export { default as usePersistentState } from './usePersistentState/usePersistentState';
|
|
16
17
|
export { default as useEmployeePhotoPath } from './useEmployeePhotoPath/useEmployeePhotoPath';
|
|
17
18
|
export { default as useClipboard } from './useClipboard/useClipboard';
|
|
18
19
|
export { default as useGetApiDataBound } from './useGetApiDataBound/useGetApiDataBound';
|
package/dist/hooks.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./nivo-bar-DIm4VsOp.cjs"),E=require("./useLocalStorageState-DrNytfl8.cjs"),I=require("@tanstack/react-query"),w=require("./useEmployeePhotoPath-Q0EhpWOh.cjs"),r=require("react");require("react/jsx-runtime");require("react-router");const T=require("react-dom");require("react-hook-form");require("react-flexmonster");require("@azure/msal-browser");require("@azure/msal-react");function L(t,e){const u=o.useAxios({silent:!0,differentBaseUrl:e==null?void 0:e.customBaseUrl,customToken:e==null?void 0:e.customToken}),{data:n}=I.useSuspenseQuery({queryKey:[t],queryFn:()=>u.get(t).then(s=>s.data)});return n}const O=t=>e=>(window.addEventListener(`storage_${t}`,e),()=>window.removeEventListener(`storage_${t}`,e)),x=(t,e,u=localStorage)=>{const[n]=r.useState(e),s=r.useRef(JSON.stringify(e)),S=r.useRef(e),l=r.useCallback(()=>{const d=u.getItem(t);return d!==s.current&&(s.current=d,S.current=s.current?JSON.parse(s.current):n),S.current},[t,u,n]),c=r.useMemo(()=>O(t),[t]),i=r.useSyncExternalStore(c,l),a=r.useCallback(d=>{u.setItem(t,JSON.stringify(d)),window.dispatchEvent(new Event(`storage_${t}`))},[t,u]);return r.useMemo(()=>[i,a],[i,a])},R=(t,e,u)=>{let n="pending",s;const S=t.then(l=>{n="success",s=l},l=>{const c=l==null?void 0:l.response;(c==null?void 0:c.status)===404&&u?(n="error-404",s=l):(n="error",s=l)});return()=>{switch(n){case"pending":throw S;case"success":return s;case"error":if(s.code==="ERR_CANCELED")return null;throw s;case"error-404":throw new Error("404");default:throw new Error("Unknown status")}}},m={loadOnInit:!0,silent:!1,enabled:!0,nullStateBeforeLoad:!0,nullStateOnFail:!1},V=(t,{loadOnInit:e=m.loadOnInit,enabled:u=m.enabled,silent:n=m.silent,nullStateBeforeLoad:s=m.nullStateBeforeLoad,nullStateOnFail:S=m.nullStateOnFail,customApiUrl:l,customBearerToken:c,dataTransformer:i,errorBoundaryOn404:a}=m)=>{const f=o.useAxios({silent:n,customToken:c,differentBaseUrl:l,noToastOnStatus:a?[404]:void 0}),{startLoading:d,stopLoading:C}=r.useContext(o.LoadingContext),D=r.useRef(0),{isAuthenticated:b}=o.useAuth(),[q,p]=r.useState(null),v=r.useCallback(async(g,y)=>{if(!b()||u===!1)return;!n&&d(`loadData-${t}-${y}`),s&&p(null);const A=f.get(t,{signal:g}).then(P=>i?i(P.data):P.data).finally(()=>!n&&C(`loadData-${t}-${y}`));p(R(A,S??!1,a??!1))},[b,u,n,d,t,s,f,i,C,S,a]);return r.useEffect(()=>{if(e===!1)return;const g=new AbortController;return v(g.signal,++D.current),()=>{g.abort()}},[v,e]),{data:q,setData:p,reloadData:v}},B=()=>{const t=r.useRef({}).current;return r.useEffect(()=>{const e=document.createElement("div");return e.style.position="absolute",e.style.pointerEvents="none",e.style.top="0",e.style.width="100%",e.style.height="100%",t.elt=e,document.body.appendChild(e),()=>{document.body.removeChild(e)}},[t]),e=>(u,...n)=>{const s=e(u,...n);return u.draggableProps.style.position==="fixed"?T.createPortal(s,t.elt):s}},h={storageKey:"--tmp-scroll-save--",requiredHeight:100,retryInterval:50},N=(t,{storageKey:e=h.storageKey,requiredHeight:u=h.requiredHeight,retryInterval:n=h.retryInterval}=h)=>{const[s,S]=r.useState(!1),l=r.useRef(null),c=r.useCallback(()=>{const a=localStorage.getItem(e);return localStorage.removeItem(e),a===null?null:Number(a)},[e]),i=r.useCallback(a=>{localStorage.setItem(e,a)},[e]);return r.useEffect(()=>{const a=window.setInterval(()=>{if(!s&&t.current!==null&&t.current.getBoundingClientRect().height>u){S(!0);const f=c();f!==null&&t.current.scrollTo({top:f}),window.clearInterval(a)}},n);return()=>{window.clearTimeout(a)}},[s,u,c,n,t]),r.useEffect(()=>{var f;const a=new AbortController;return(f=t.current)==null||f.addEventListener("scrollend",()=>{var d;l.current=((d=t.current)==null?void 0:d.scrollTop)??0,i((l.current??0).toString())},{signal:a.signal}),()=>a.abort()},[i,t]),{saveValue:i,retrieveValue:c}};exports.cancelToken=o.cancelToken;exports.useAuth=o.useAuth;exports.useAxios=o.useAxios;exports.useClickOutside=o.useClickOutside;exports.useClipboard=o.useClipboard;exports.useConfirm=o.useConfirm;exports.useFormControlType=o.useFormControlType;exports.useKeyPress=o.useKeyPress;exports.useNotifications=o.useNotifications;exports.usePermissions=o.usePermissions;exports.usePrompt=o.usePrompt;exports.useWindowSize=o.useWindowSize;exports.useZodSchemaTypes=o.useZodSchemaTypes;exports.useGetApiData=E.useGetApiData;exports.useLocalStorageState=E.useLocalStorageState;exports.useEmployeePhotoPath=w.useEmployeePhotoPath;exports.useSearchQuery=w.useSearchQuery;exports.useSearchQueryState=w.useSearchQueryState;exports.useGetApiDataBound=V;exports.useGetDataBound=L;exports.usePersistentState=x;exports.useRenderDraggableInPortal=B;exports.useScrollSave=N;
|
package/dist/hooks.es.js
CHANGED
|
@@ -1,155 +1,164 @@
|
|
|
1
|
-
import { an as
|
|
2
|
-
import { bR as
|
|
3
|
-
import { u as
|
|
4
|
-
import { useSuspenseQuery as
|
|
5
|
-
import { b as
|
|
1
|
+
import { an as I, ap as V, bc as A } from "./nivo-bar-BOjrASSM.js";
|
|
2
|
+
import { bR as nt, aQ as rt, bT as st, am as at, bS as ot, b6 as ut, aq as lt, bv as ct, al as it, aF as dt, aT as mt } from "./nivo-bar-BOjrASSM.js";
|
|
3
|
+
import { u as gt, a as pt } from "./useLocalStorageState-DVcgyVda.js";
|
|
4
|
+
import { useSuspenseQuery as O } from "@tanstack/react-query";
|
|
5
|
+
import { b as vt, u as wt, a as ht } from "./useEmployeePhotoPath-DdMmh1qU.js";
|
|
6
|
+
import { useState as b, useRef as f, useCallback as g, useMemo as x, useSyncExternalStore as $, useContext as N, useEffect as v } from "react";
|
|
6
7
|
import "react/jsx-runtime";
|
|
7
|
-
import { useContext as B, useRef as w, useState as T, useCallback as v, useEffect as g } from "react";
|
|
8
8
|
import "react-router";
|
|
9
|
-
import { createPortal as
|
|
9
|
+
import { createPortal as B } from "react-dom";
|
|
10
10
|
import "react-hook-form";
|
|
11
11
|
import "react-flexmonster";
|
|
12
12
|
import "@azure/msal-browser";
|
|
13
13
|
import "@azure/msal-react";
|
|
14
|
-
function
|
|
15
|
-
const
|
|
14
|
+
function j(e, t) {
|
|
15
|
+
const s = I({
|
|
16
16
|
silent: !0,
|
|
17
|
-
differentBaseUrl:
|
|
18
|
-
customToken:
|
|
19
|
-
}), { data:
|
|
20
|
-
queryKey: [
|
|
21
|
-
queryFn: () =>
|
|
17
|
+
differentBaseUrl: t == null ? void 0 : t.customBaseUrl,
|
|
18
|
+
customToken: t == null ? void 0 : t.customToken
|
|
19
|
+
}), { data: r } = O({
|
|
20
|
+
queryKey: [e],
|
|
21
|
+
queryFn: () => s.get(e).then((n) => n.data)
|
|
22
22
|
});
|
|
23
|
-
return
|
|
23
|
+
return r;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const F = (e) => (t) => (window.addEventListener(`storage_${e}`, t), () => window.removeEventListener(`storage_${e}`, t)), K = (e, t, s = localStorage) => {
|
|
26
|
+
const [r] = b(t), n = f(JSON.stringify(t)), i = f(t), o = g(() => {
|
|
27
|
+
const c = s.getItem(e);
|
|
28
|
+
return c !== n.current && (n.current = c, i.current = n.current ? JSON.parse(n.current) : r), i.current;
|
|
29
|
+
}, [e, s, r]), u = x(() => F(e), [e]), l = $(u, o), a = g((c) => {
|
|
30
|
+
s.setItem(e, JSON.stringify(c)), window.dispatchEvent(new Event(`storage_${e}`));
|
|
31
|
+
}, [e, s]);
|
|
32
|
+
return x(() => [l, a], [l, a]);
|
|
33
|
+
}, q = (e, t, s) => {
|
|
34
|
+
let r = "pending", n;
|
|
35
|
+
const i = e.then((o) => {
|
|
36
|
+
r = "success", n = o;
|
|
29
37
|
}, (o) => {
|
|
30
38
|
const u = o == null ? void 0 : o.response;
|
|
31
|
-
(u == null ? void 0 : u.status) === 404 &&
|
|
39
|
+
(u == null ? void 0 : u.status) === 404 && s ? (r = "error-404", n = o) : (r = "error", n = o);
|
|
32
40
|
});
|
|
33
41
|
return () => {
|
|
34
|
-
switch (
|
|
42
|
+
switch (r) {
|
|
35
43
|
case "pending":
|
|
36
44
|
throw i;
|
|
37
45
|
case "success":
|
|
38
|
-
return
|
|
46
|
+
return n;
|
|
39
47
|
case "error":
|
|
40
|
-
if (
|
|
48
|
+
if (n.code === "ERR_CANCELED")
|
|
41
49
|
return null;
|
|
42
|
-
throw
|
|
50
|
+
throw n;
|
|
43
51
|
case "error-404":
|
|
44
52
|
throw new Error("404");
|
|
45
53
|
default:
|
|
46
54
|
throw new Error("Unknown status");
|
|
47
55
|
}
|
|
48
56
|
};
|
|
49
|
-
},
|
|
57
|
+
}, m = {
|
|
50
58
|
loadOnInit: !0,
|
|
51
59
|
silent: !1,
|
|
52
60
|
enabled: !0,
|
|
53
61
|
nullStateBeforeLoad: !0,
|
|
54
62
|
nullStateOnFail: !1
|
|
55
|
-
},
|
|
56
|
-
const
|
|
57
|
-
silent:
|
|
63
|
+
}, X = (e, { loadOnInit: t = m.loadOnInit, enabled: s = m.enabled, silent: r = m.silent, nullStateBeforeLoad: n = m.nullStateBeforeLoad, nullStateOnFail: i = m.nullStateOnFail, customApiUrl: o, customBearerToken: u, dataTransformer: l, errorBoundaryOn404: a } = m) => {
|
|
64
|
+
const d = I({
|
|
65
|
+
silent: r,
|
|
58
66
|
customToken: u,
|
|
59
67
|
differentBaseUrl: o,
|
|
60
|
-
noToastOnStatus:
|
|
61
|
-
}), { startLoading:
|
|
62
|
-
if (!
|
|
68
|
+
noToastOnStatus: a ? [404] : void 0
|
|
69
|
+
}), { startLoading: c, stopLoading: C } = N(V), P = f(0), { isAuthenticated: E } = A(), [T, w] = b(null), h = g(async (p, D) => {
|
|
70
|
+
if (!E() || s === !1)
|
|
63
71
|
return;
|
|
64
|
-
!
|
|
65
|
-
const
|
|
66
|
-
signal:
|
|
67
|
-
}).then((
|
|
68
|
-
|
|
72
|
+
!r && c(`loadData-${e}-${D}`), n && w(null);
|
|
73
|
+
const L = d.get(e, {
|
|
74
|
+
signal: p
|
|
75
|
+
}).then((y) => l ? l(y.data) : y.data).finally(() => !r && C(`loadData-${e}-${D}`));
|
|
76
|
+
w(q(L, i ?? !1, a ?? !1));
|
|
69
77
|
}, [
|
|
70
|
-
|
|
71
|
-
r,
|
|
72
|
-
a,
|
|
73
|
-
m,
|
|
74
|
-
t,
|
|
78
|
+
E,
|
|
75
79
|
s,
|
|
76
|
-
|
|
80
|
+
r,
|
|
77
81
|
c,
|
|
78
|
-
|
|
82
|
+
e,
|
|
83
|
+
n,
|
|
84
|
+
d,
|
|
85
|
+
l,
|
|
86
|
+
C,
|
|
79
87
|
i,
|
|
80
|
-
|
|
88
|
+
a
|
|
81
89
|
]);
|
|
82
|
-
return
|
|
83
|
-
if (
|
|
90
|
+
return v(() => {
|
|
91
|
+
if (t === !1)
|
|
84
92
|
return;
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
-
|
|
93
|
+
const p = new AbortController();
|
|
94
|
+
return h(p.signal, ++P.current), () => {
|
|
95
|
+
p.abort();
|
|
88
96
|
};
|
|
89
|
-
}, [
|
|
90
|
-
},
|
|
91
|
-
const
|
|
92
|
-
return
|
|
93
|
-
const
|
|
94
|
-
return
|
|
95
|
-
document.body.removeChild(
|
|
97
|
+
}, [h, t]), { data: T, setData: w, reloadData: h };
|
|
98
|
+
}, Y = () => {
|
|
99
|
+
const e = f({}).current;
|
|
100
|
+
return v(() => {
|
|
101
|
+
const t = document.createElement("div");
|
|
102
|
+
return t.style.position = "absolute", t.style.pointerEvents = "none", t.style.top = "0", t.style.width = "100%", t.style.height = "100%", e.elt = t, document.body.appendChild(t), () => {
|
|
103
|
+
document.body.removeChild(t);
|
|
96
104
|
};
|
|
97
|
-
}, [
|
|
98
|
-
const
|
|
99
|
-
return
|
|
105
|
+
}, [e]), (t) => (s, ...r) => {
|
|
106
|
+
const n = t(s, ...r);
|
|
107
|
+
return s.draggableProps.style.position === "fixed" ? B(n, e.elt) : n;
|
|
100
108
|
};
|
|
101
|
-
},
|
|
109
|
+
}, S = {
|
|
102
110
|
storageKey: "--tmp-scroll-save--",
|
|
103
111
|
requiredHeight: 100,
|
|
104
112
|
retryInterval: 50
|
|
105
|
-
},
|
|
106
|
-
const [
|
|
107
|
-
const
|
|
108
|
-
return localStorage.removeItem(
|
|
109
|
-
}, [
|
|
110
|
-
localStorage.setItem(
|
|
111
|
-
}, [
|
|
112
|
-
return
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
113
|
+
}, k = (e, { storageKey: t = S.storageKey, requiredHeight: s = S.requiredHeight, retryInterval: r = S.retryInterval } = S) => {
|
|
114
|
+
const [n, i] = b(!1), o = f(null), u = g(() => {
|
|
115
|
+
const a = localStorage.getItem(t);
|
|
116
|
+
return localStorage.removeItem(t), a === null ? null : Number(a);
|
|
117
|
+
}, [t]), l = g((a) => {
|
|
118
|
+
localStorage.setItem(t, a);
|
|
119
|
+
}, [t]);
|
|
120
|
+
return v(() => {
|
|
121
|
+
const a = window.setInterval(() => {
|
|
122
|
+
if (!n && e.current !== null && e.current.getBoundingClientRect().height > s) {
|
|
115
123
|
i(!0);
|
|
116
|
-
const
|
|
117
|
-
|
|
124
|
+
const d = u();
|
|
125
|
+
d !== null && e.current.scrollTo({ top: d }), window.clearInterval(a);
|
|
118
126
|
}
|
|
119
|
-
},
|
|
127
|
+
}, r);
|
|
120
128
|
return () => {
|
|
121
|
-
window.clearTimeout(
|
|
129
|
+
window.clearTimeout(a);
|
|
122
130
|
};
|
|
123
|
-
}, [
|
|
124
|
-
var
|
|
125
|
-
const
|
|
126
|
-
return (
|
|
127
|
-
var
|
|
128
|
-
o.current = ((
|
|
129
|
-
}, { signal:
|
|
130
|
-
}, [
|
|
131
|
+
}, [n, s, u, r, e]), v(() => {
|
|
132
|
+
var d;
|
|
133
|
+
const a = new AbortController();
|
|
134
|
+
return (d = e.current) == null || d.addEventListener("scrollend", () => {
|
|
135
|
+
var c;
|
|
136
|
+
o.current = ((c = e.current) == null ? void 0 : c.scrollTop) ?? 0, l((o.current ?? 0).toString());
|
|
137
|
+
}, { signal: a.signal }), () => a.abort();
|
|
138
|
+
}, [l, e]), { saveValue: l, retrieveValue: u };
|
|
131
139
|
};
|
|
132
140
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
141
|
+
nt as cancelToken,
|
|
142
|
+
A as useAuth,
|
|
143
|
+
I as useAxios,
|
|
144
|
+
rt as useClickOutside,
|
|
145
|
+
st as useClipboard,
|
|
146
|
+
at as useConfirm,
|
|
147
|
+
vt as useEmployeePhotoPath,
|
|
148
|
+
ot as useFormControlType,
|
|
149
|
+
gt as useGetApiData,
|
|
150
|
+
X as useGetApiDataBound,
|
|
151
|
+
j as useGetDataBound,
|
|
152
|
+
ut as useKeyPress,
|
|
153
|
+
pt as useLocalStorageState,
|
|
154
|
+
lt as useNotifications,
|
|
155
|
+
ct as usePermissions,
|
|
156
|
+
K as usePersistentState,
|
|
157
|
+
it as usePrompt,
|
|
158
|
+
Y as useRenderDraggableInPortal,
|
|
159
|
+
k as useScrollSave,
|
|
160
|
+
wt as useSearchQuery,
|
|
161
|
+
ht as useSearchQueryState,
|
|
162
|
+
dt as useWindowSize,
|
|
163
|
+
mt as useZodSchemaTypes
|
|
155
164
|
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -14,4 +14,5 @@ export * from './localizationUtils/localizationUtils';
|
|
|
14
14
|
export * from './apiUtils/apiUtils';
|
|
15
15
|
export * from './localStorage/localStorageUtils';
|
|
16
16
|
export * from './bnfTable/bnfTableUtils';
|
|
17
|
+
export { default as queryStorage } from './storages/queryStorage';
|
|
17
18
|
export { default as CommonLuminusIconsArray } from './constants/CommonLuminusIconsArray';
|
package/dist/utils.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./nivo-bar-DIm4VsOp.cjs"),l=require("react/jsx-runtime");require("react");require("@azure/msal-browser");require("@azure/msal-react");require("react-router");require("@tanstack/react-query");require("react-dom");require("react-hook-form");require("react-flexmonster");const u=require("./localStorageUtils-CkZslzIU.cjs"),h=e=>{var r,a;return l.jsx(t.SimpleTooltip,{text:((r=e.getValue())==null?void 0:r.toString())??"",placement:"bottom",children:l.jsx("div",{className:"w-100 text-truncate",children:((a=e.getValue())==null?void 0:a.toString())??""})})},p=e=>{var r;return l.jsx(l.Fragment,{children:(r=e.getValue())==null?void 0:r.toLocaleString("cs-CZ")})},y=e=>{var n;const r=((n=e.getValue())==null?void 0:n.toString())??"",a=t.format(new Date(r),"dd.MM.yyyy");return l.jsx(l.Fragment,{children:r?a:""})},b=(e,r)=>{let a=!1,n=e;e[0]==="#"&&(n=e.slice(1),a=!0);let s=parseInt(n.substring(0,2),16),o=parseInt(n.substring(2,4),16),i=parseInt(n.substring(4,6),16);s+=r,o+=r,i+=r,s>255?s=255:s<0&&(s=0),o>255?o=255:o<0&&(o=0),i>255?i=255:i<0&&(i=0);const m=s.toString(16).length===1?"0"+s.toString(16):s.toString(16),S=o.toString(16).length===1?"0"+o.toString(16):o.toString(16),d=i.toString(16).length===1?"0"+i.toString(16):i.toString(16);return(a?"#":"")+m+S+d},O=e=>{const r=e.slice(3),a=[];for(let s=0;s<r.length;s+=2)a.push(r.slice(s,s+2));return`#${a.reverse().join("")}`},F=e=>typeof e.directoryName=="string"&&typeof e.directoryPath=="string"&&typeof e.directoryTranslationKey=="string"&&Array.isArray(e.files),D=async e=>{let r={status:"pending"};try{r={status:"success",data:(await e).data}}catch(a){r={status:"error",error:a}}return r},f=e=>{var r,a,n;return{columnOrder:e.columnsOrder??[],columnVisibility:Object.fromEntries((e.hiddenColumns??[]).map(s=>[s,!1])),pageIndex:0,pageSize:e.defaultPageSize??50,columnSorting:e.defaultSort?[e.defaultSort]:[],columnFilters:e.defaultFilters??[],columnPinning:e.fixedColumns?{left:e.fixedColumns.left?[e.fixedColumns.left]:[],right:e.fixedColumns.right?[e.fixedColumns.right]:[]}:{left:[],right:[]},size:e.isDense?"sm":"md",mobileDisplayGroup:((r=e.onMobile)==null?void 0:r.defaultDisplayGroup)??"",mobileFilter:{globalFilter:""},mobileShowColumnNames:((a=e.onMobile)==null?void 0:a.showColumnNames)??!1,columnSizing:Object.fromEntries(((n=e.columnWidths)==null?void 0:n.map(s=>[s.column,s.width]))??[]),grouping:[],expanding:{},isFullScreen:!1}},T=(e,r)=>{const a=new URLSearchParams;return Object.keys(e).forEach(n=>{a.append(`BnfTable-${r||"Universal"}.${n}`,JSON.stringify(e[n]))}),a.toString()},x=(e,r)=>{const a=localStorage.getItem("BnfTable-SettingsMigration");if(a){const n=JSON.parse(a);if(n.done&&n.version>=r)return}console.log("Migrating BnfTable settings to Tanstack Table format..."),e.forEach(n=>{const s=localStorage.getItem(n);if(!s)return;const o=JSON.parse(s);if(!o||Object.keys(o).length<1)return;const i=f(o);Object.keys(i).forEach(m=>{localStorage.setItem(`BnfTable-${n}.${m}`,JSON.stringify(i[m]))})}),localStorage.setItem("BnfTable-SettingsMigration",JSON.stringify({done:!0,version:r}))},c=()=>new URLSearchParams(window.location.search),g=e=>{const r=window.location.pathname+(e.toString()?`?${e.toString()}`:"")+window.location.hash;window.history.replaceState(null,"",r)},N={get length(){return Array.from(c().keys()).length},key(e){const r=c();return Array.from(r.keys())[e]??null},getItem(e){const a=c().get(e);return a??null},setItem(e,r){const a=c();a.set(e,r),g(a)},removeItem(e){const r=c();r.delete(e),g(r)},clear(){g(new URLSearchParams)}},v=["edit","delete","info","warning","check","check-simple","add","cancel","cancel-simple","danger","chevron-left","chevron-right","chevron-up","chevron-down","chevron-double-left","chevron-double-right","folder","folder-filled","file-download","file-upload","star-outline","save","link","pending","resizer-horizontal","qr-code","phone","mail","mail-envelope","dashboard","user","role","close","search","plus","minus","menu","arrow-right"];exports.atobUtf8=t.atobUtf8;exports.buildEmployeeNameString=t.buildEmployeeNameString;exports.buildOrgUnitString=t.buildOrgUnitString;exports.buildVehicleNameString=t.buildVehicleNameString;exports.capitalizeFirstLetter=t.capitalizeFirstLetter;exports.compareDate=t.compareDate;exports.compareDateTime=t.compareDateTime;exports.extractErrorsFromResponse=t.extractErrorsFromResponse;exports.extractFilename=t.extractFilename;exports.extractPermissionsFromResponse=t.extractPermissionsFromResponse;exports.fixNameIdNulls=t.fixNameIdNulls;exports.formatDate=t.formatDate;exports.formatDateTime=t.formatDateTime;exports.formatFileSize=t.formatFileSize;exports.getDateString=t.getDateString;exports.getDaysDifference=t.getDaysDifference;exports.getFirstDayOfMonth=t.getFirstDayOfMonth;exports.getFirstDayOfOffsetMonth=t.getFirstDayOfOffsetMonth;exports.getFirstDayOfYear=t.getFirstDayOfYear;exports.getLastDayOfMonth=t.getLastDayOfMonth;exports.getLastDayOfOffsetMonth=t.getLastDayOfOffsetMonth;exports.getLastDayOfYear=t.getLastDayOfYear;exports.hasOnlyNullValues=t.hasOnlyNullValues;exports.hookFormSetServerErrors=t.hookFormSetServerErrors;exports.isExtensionOpenable=t.isExtensionOpenable;exports.isFileOpenable=t.isFileOpenable;exports.isISODate=t.isISODate;exports.isPrimitive=t.isPrimitive;exports.isValidDate=t.isValidDate;exports.joinStrings=t.joinStrings;exports.msToStartOfNextDay=t.msToStartOfNextDay;exports.replaceNullValuesOnlyObjectsWithNulls=t.replaceNullValuesOnlyObjectsWithNulls;exports.saveFile=t.saveFile;exports.saveFileFromResponse=t.saveFileFromResponse;exports.shortenText=t.shortenText;exports.stringContains=t.stringContains;exports.stringSearchWithin=t.stringSearchWithin;exports.stringStartsWith=t.stringStartsWith;exports.trimIsoDate=t.trimIsoDate;exports.truncateText=t.truncateText;exports.urlfyArray=t.urlfyArray;exports.dumpLocalStorage=u.dumpLocalStorage;exports.generateApiPath=u.generateApiPath;exports.hookFormSetNull=u.hookFormSetNull;exports.hookFormSetNulls=u.hookFormSetNulls;exports.limitNumber=u.limitNumber;exports.restoreLocalStorage=u.restoreLocalStorage;exports.CommonLuminusIconsArray=v;exports.adjustBrightness=b;exports.buildTableSearchQuery=T;exports.configToTanstackTableState=f;exports.dateValueFormat=y;exports.isFileStructureDirectory=F;exports.migrateBnfTableSettings=x;exports.numFormat=p;exports.queryStorage=N;exports.responsePromiseWrapper=D;exports.valueTooltip=h;exports.vclToHex=O;
|
package/dist/utils.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { aD as
|
|
2
|
-
import { cg as
|
|
3
|
-
import { jsx as
|
|
1
|
+
import { aD as f, W as p } from "./nivo-bar-BOjrASSM.js";
|
|
2
|
+
import { cg as U, ce as W, cf as $, cd as A, cc as G, bX as J, bY as Q, bo as Y, c3 as q, bU as Z, bD as H, aW as K, cb as X, ci as _, c2 as ee, bZ as te, bg as re, b$ as se, bh as ae, b_ as oe, c0 as ne, c1 as ie, c7 as le, bB as ce, c5 as me, c4 as ue, bV as ge, c6 as de, bW as fe, $ as pe, bO as he, c8 as Se, bk as be, bn as ye, ck as Oe, c9 as we, aj as De, ca as Fe, bf as ve, ch as xe, cj as Te } from "./nivo-bar-BOjrASSM.js";
|
|
3
|
+
import { jsx as c, Fragment as u } from "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@azure/msal-browser";
|
|
6
6
|
import "@azure/msal-react";
|
|
@@ -9,30 +9,30 @@ import "@tanstack/react-query";
|
|
|
9
9
|
import "react-dom";
|
|
10
10
|
import "react-hook-form";
|
|
11
11
|
import "react-flexmonster";
|
|
12
|
-
import { d as
|
|
12
|
+
import { d as ke, g as Ce, h as Ie, a as Pe, l as Me, r as Be } from "./localStorageUtils-B7BmbR_u.js";
|
|
13
13
|
const N = (e) => {
|
|
14
14
|
var t, r;
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
},
|
|
15
|
+
return /* @__PURE__ */ c(f, { text: ((t = e.getValue()) == null ? void 0 : t.toString()) ?? "", placement: "bottom", children: /* @__PURE__ */ c("div", { className: "w-100 text-truncate", children: ((r = e.getValue()) == null ? void 0 : r.toString()) ?? "" }) });
|
|
16
|
+
}, k = (e) => {
|
|
17
17
|
var t;
|
|
18
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ c(u, { children: (t = e.getValue()) == null ? void 0 : t.toLocaleString("cs-CZ") });
|
|
19
19
|
}, C = (e) => {
|
|
20
20
|
var a;
|
|
21
|
-
const t = ((a = e.getValue()) == null ? void 0 : a.toString()) ?? "", r =
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
},
|
|
21
|
+
const t = ((a = e.getValue()) == null ? void 0 : a.toString()) ?? "", r = p(new Date(t), "dd.MM.yyyy");
|
|
22
|
+
return /* @__PURE__ */ c(u, { children: t ? r : "" });
|
|
23
|
+
}, I = (e, t) => {
|
|
24
24
|
let r = !1, a = e;
|
|
25
25
|
e[0] === "#" && (a = e.slice(1), r = !0);
|
|
26
|
-
let s = parseInt(a.substring(0, 2), 16), o = parseInt(a.substring(2, 4), 16),
|
|
27
|
-
s += t, o += t,
|
|
28
|
-
const
|
|
29
|
-
return (r ? "#" : "") +
|
|
30
|
-
},
|
|
26
|
+
let s = parseInt(a.substring(0, 2), 16), o = parseInt(a.substring(2, 4), 16), n = parseInt(a.substring(4, 6), 16);
|
|
27
|
+
s += t, o += t, n += t, s > 255 ? s = 255 : s < 0 && (s = 0), o > 255 ? o = 255 : o < 0 && (o = 0), n > 255 ? n = 255 : n < 0 && (n = 0);
|
|
28
|
+
const l = s.toString(16).length === 1 ? "0" + s.toString(16) : s.toString(16), g = o.toString(16).length === 1 ? "0" + o.toString(16) : o.toString(16), d = n.toString(16).length === 1 ? "0" + n.toString(16) : n.toString(16);
|
|
29
|
+
return (r ? "#" : "") + l + g + d;
|
|
30
|
+
}, P = (e) => {
|
|
31
31
|
const t = e.slice(3), r = [];
|
|
32
32
|
for (let s = 0; s < t.length; s += 2)
|
|
33
33
|
r.push(t.slice(s, s + 2));
|
|
34
34
|
return `#${r.reverse().join("")}`;
|
|
35
|
-
},
|
|
35
|
+
}, M = (e) => typeof e.directoryName == "string" && typeof e.directoryPath == "string" && typeof e.directoryTranslationKey == "string" && Array.isArray(e.files), B = async (e) => {
|
|
36
36
|
let t = { status: "pending" };
|
|
37
37
|
try {
|
|
38
38
|
t = { status: "success", data: (await e).data };
|
|
@@ -40,7 +40,7 @@ const N = (e) => {
|
|
|
40
40
|
t = { status: "error", error: r };
|
|
41
41
|
}
|
|
42
42
|
return t;
|
|
43
|
-
},
|
|
43
|
+
}, h = (e) => {
|
|
44
44
|
var t, r, a;
|
|
45
45
|
return {
|
|
46
46
|
columnOrder: e.columnsOrder ?? [],
|
|
@@ -62,7 +62,7 @@ const N = (e) => {
|
|
|
62
62
|
expanding: {},
|
|
63
63
|
isFullScreen: !1
|
|
64
64
|
};
|
|
65
|
-
},
|
|
65
|
+
}, L = (e, t) => {
|
|
66
66
|
const r = new URLSearchParams();
|
|
67
67
|
return Object.keys(e).forEach((a) => {
|
|
68
68
|
r.append(`BnfTable-${t || "Universal"}.${a}`, JSON.stringify(e[a]));
|
|
@@ -81,15 +81,41 @@ const N = (e) => {
|
|
|
81
81
|
const o = JSON.parse(s);
|
|
82
82
|
if (!o || Object.keys(o).length < 1)
|
|
83
83
|
return;
|
|
84
|
-
const
|
|
85
|
-
Object.keys(
|
|
86
|
-
localStorage.setItem(`BnfTable-${a}.${
|
|
84
|
+
const n = h(o);
|
|
85
|
+
Object.keys(n).forEach((l) => {
|
|
86
|
+
localStorage.setItem(`BnfTable-${a}.${l}`, JSON.stringify(n[l]));
|
|
87
87
|
});
|
|
88
88
|
}), localStorage.setItem("BnfTable-SettingsMigration", JSON.stringify({
|
|
89
89
|
done: !0,
|
|
90
90
|
version: t
|
|
91
91
|
}));
|
|
92
|
-
},
|
|
92
|
+
}, i = () => new URLSearchParams(window.location.search), m = (e) => {
|
|
93
|
+
const t = window.location.pathname + (e.toString() ? `?${e.toString()}` : "") + window.location.hash;
|
|
94
|
+
window.history.replaceState(null, "", t);
|
|
95
|
+
}, j = {
|
|
96
|
+
get length() {
|
|
97
|
+
return Array.from(i().keys()).length;
|
|
98
|
+
},
|
|
99
|
+
key(e) {
|
|
100
|
+
const t = i();
|
|
101
|
+
return Array.from(t.keys())[e] ?? null;
|
|
102
|
+
},
|
|
103
|
+
getItem(e) {
|
|
104
|
+
const r = i().get(e);
|
|
105
|
+
return r ?? null;
|
|
106
|
+
},
|
|
107
|
+
setItem(e, t) {
|
|
108
|
+
const r = i();
|
|
109
|
+
r.set(e, t), m(r);
|
|
110
|
+
},
|
|
111
|
+
removeItem(e) {
|
|
112
|
+
const t = i();
|
|
113
|
+
t.delete(e), m(t);
|
|
114
|
+
},
|
|
115
|
+
clear() {
|
|
116
|
+
m(new URLSearchParams());
|
|
117
|
+
}
|
|
118
|
+
}, E = [
|
|
93
119
|
"edit",
|
|
94
120
|
"delete",
|
|
95
121
|
"info",
|
|
@@ -130,62 +156,63 @@ const N = (e) => {
|
|
|
130
156
|
"arrow-right"
|
|
131
157
|
];
|
|
132
158
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
159
|
+
E as CommonLuminusIconsArray,
|
|
160
|
+
I as adjustBrightness,
|
|
161
|
+
U as atobUtf8,
|
|
162
|
+
W as buildEmployeeNameString,
|
|
163
|
+
$ as buildOrgUnitString,
|
|
164
|
+
L as buildTableSearchQuery,
|
|
165
|
+
A as buildVehicleNameString,
|
|
166
|
+
G as capitalizeFirstLetter,
|
|
167
|
+
J as compareDate,
|
|
168
|
+
Q as compareDateTime,
|
|
169
|
+
h as configToTanstackTableState,
|
|
144
170
|
C as dateValueFormat,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
ke as dumpLocalStorage,
|
|
172
|
+
Y as extractErrorsFromResponse,
|
|
173
|
+
q as extractFilename,
|
|
174
|
+
Z as extractPermissionsFromResponse,
|
|
175
|
+
H as fixNameIdNulls,
|
|
176
|
+
K as formatDate,
|
|
177
|
+
X as formatDateTime,
|
|
178
|
+
_ as formatFileSize,
|
|
179
|
+
Ce as generateApiPath,
|
|
180
|
+
ee as getDateString,
|
|
181
|
+
te as getDaysDifference,
|
|
182
|
+
re as getFirstDayOfMonth,
|
|
183
|
+
se as getFirstDayOfOffsetMonth,
|
|
184
|
+
ae as getFirstDayOfYear,
|
|
185
|
+
oe as getLastDayOfMonth,
|
|
186
|
+
ne as getLastDayOfOffsetMonth,
|
|
187
|
+
ie as getLastDayOfYear,
|
|
188
|
+
le as hasOnlyNullValues,
|
|
189
|
+
Ie as hookFormSetNull,
|
|
190
|
+
Pe as hookFormSetNulls,
|
|
191
|
+
ce as hookFormSetServerErrors,
|
|
192
|
+
me as isExtensionOpenable,
|
|
193
|
+
ue as isFileOpenable,
|
|
194
|
+
M as isFileStructureDirectory,
|
|
195
|
+
ge as isISODate,
|
|
196
|
+
de as isPrimitive,
|
|
197
|
+
fe as isValidDate,
|
|
198
|
+
pe as joinStrings,
|
|
173
199
|
Me as limitNumber,
|
|
174
200
|
V as migrateBnfTableSettings,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
xe as
|
|
201
|
+
he as msToStartOfNextDay,
|
|
202
|
+
k as numFormat,
|
|
203
|
+
j as queryStorage,
|
|
204
|
+
Se as replaceNullValuesOnlyObjectsWithNulls,
|
|
205
|
+
B as responsePromiseWrapper,
|
|
206
|
+
Be as restoreLocalStorage,
|
|
207
|
+
be as saveFile,
|
|
208
|
+
ye as saveFileFromResponse,
|
|
209
|
+
Oe as shortenText,
|
|
210
|
+
we as stringContains,
|
|
211
|
+
De as stringSearchWithin,
|
|
212
|
+
Fe as stringStartsWith,
|
|
213
|
+
ve as trimIsoDate,
|
|
214
|
+
xe as truncateText,
|
|
215
|
+
Te as urlfyArray,
|
|
189
216
|
N as valueTooltip,
|
|
190
|
-
|
|
217
|
+
P as vclToHex
|
|
191
218
|
};
|