react-luminus-components 1.2.80 → 1.2.82

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.
Files changed (31) hide show
  1. package/dist/.vite/manifest.json +57 -57
  2. package/dist/{EventType-BCIiHNVo.cjs → EventType-B2MjpDfc.cjs} +1 -1
  3. package/dist/{EventType-DiHqEDqn.js → EventType-DY7SjWGF.js} +1 -1
  4. package/dist/{NoInputContainer-D_sgAiux.js → NoInputContainer-D94YvUXW.js} +628 -627
  5. package/dist/{NoInputContainer-QV9JLbnE.cjs → NoInputContainer-pmSdlv8f.cjs} +16 -16
  6. package/dist/{SimpleTooltip-BKmgu79J.cjs → SimpleTooltip-DMEC0-ba.cjs} +1 -1
  7. package/dist/{SimpleTooltip-CXeUwU65.js → SimpleTooltip-OyME0pwt.js} +1 -1
  8. package/dist/contexts.cjs.js +1 -1
  9. package/dist/contexts.es.js +3 -3
  10. package/dist/{dateUtils-Crak7ii9.js → dateUtils-Clmwz8MD.js} +1 -1
  11. package/dist/{dateUtils-CWKBTsx7.cjs → dateUtils-DjdXQqjK.cjs} +1 -1
  12. package/dist/hooks.cjs.js +1 -1
  13. package/dist/hooks.es.js +6 -6
  14. package/dist/layout.cjs.js +1 -1
  15. package/dist/layout.es.js +3 -3
  16. package/dist/main.cjs.js +1 -1
  17. package/dist/main.es.js +5 -5
  18. package/dist/models/texts/AxiosTexts.d.ts +1 -0
  19. package/dist/models/types/ApiErrorResult.d.ts +1 -0
  20. package/dist/textUtils-BZyf3rh0.js +41 -0
  21. package/dist/textUtils-DPetpRXS.cjs +1 -0
  22. package/dist/{useConfirm-ZMFNWP8A.cjs → useConfirm-BKXZtGGa.cjs} +1 -1
  23. package/dist/{useConfirm-BgDxf_xi.js → useConfirm-cF9njJCE.js} +1 -1
  24. package/dist/{usePermissions-cOpmP15X.js → usePermissions-SxjfyxfQ.js} +1 -1
  25. package/dist/{usePermissions-DQNoOuU8.cjs → usePermissions-kWbAumCC.cjs} +1 -1
  26. package/dist/utils/apiErrorFields/apiErrorFieldsUtils.d.ts +1 -1
  27. package/dist/utils.cjs.js +1 -1
  28. package/dist/utils.es.js +15 -14
  29. package/package.json +1 -1
  30. package/dist/textUtils-BbxuIsKq.js +0 -36
  31. package/dist/textUtils-CHVVh2oi.cjs +0 -1
package/dist/main.es.js CHANGED
@@ -1,12 +1,12 @@
1
- import { j as s, c as w, t as re, a as ie, g as cr, T as lr, b as ur, s as jt, E as dr, d as hr, e as mr, f as fr, h as pr, u as V, i as de, k as Qt, F as kt, l as gr, m as wr, n as xr, o as yr, p as br, q as vr, r as _r, v as jr, w as lt, x as ut, y as kr, z as Cr, P as _e, A as he, B as Nr, C as $r, D as dt, S as Ct, G as Pe, H as Ae, I as ht, J as Ir, K as Xt, L as Ie, M as qe, O as Nt, N as Sr, Q as oe, R as Tr, U as Er, V as Jt, W as mt, X as ft, Y as z, Z as Or, _ as Zt, $ as Mr, a0 as en, a1 as Dr, a2 as Pr, a3 as Ar, a4 as Fr, a5 as tn, a6 as ke, a7 as Wr, a8 as Rr, a9 as Lr, aa as qr, ab as Yr, ac as Ze, ad as Ve, ae as nn, af as xe, ag as Br } from "./NoInputContainer-D_sgAiux.js";
2
- import { ai as yl, ah as bl } from "./NoInputContainer-D_sgAiux.js";
1
+ import { j as s, c as w, t as re, a as ie, g as cr, T as lr, b as ur, s as jt, E as dr, d as hr, e as mr, f as fr, h as pr, u as V, i as de, k as Qt, F as kt, l as gr, m as wr, n as xr, o as yr, p as br, q as vr, r as _r, v as jr, w as lt, x as ut, y as kr, z as Cr, P as _e, A as he, B as Nr, C as $r, D as dt, S as Ct, G as Pe, H as Ae, I as ht, J as Ir, K as Xt, L as Ie, M as qe, O as Nt, N as Sr, Q as oe, R as Tr, U as Er, V as Jt, W as mt, X as ft, Y as z, Z as Or, _ as Zt, $ as Mr, a0 as en, a1 as Dr, a2 as Pr, a3 as Ar, a4 as Fr, a5 as tn, a6 as ke, a7 as Wr, a8 as Rr, a9 as Lr, aa as qr, ab as Yr, ac as Ze, ad as Ve, ae as nn, af as xe, ag as Br } from "./NoInputContainer-D94YvUXW.js";
2
+ import { ai as yl, ah as bl } from "./NoInputContainer-D94YvUXW.js";
3
3
  import * as A from "react";
4
4
  import J, { useCallback as O, useMemo as Q, useEffect as D, useRef as Y, useState as P, useReducer as rn, useContext as F, Component as Hr, isValidElement as Gr, Suspense as Vr, createElement as Ur } from "react";
5
- import { c as le, d as zr, C as Kr, a as on, u as Qr, q as $t, E as Fe, M as We, L as Xr } from "./EventType-DiHqEDqn.js";
5
+ import { c as le, d as zr, C as Kr, a as on, u as Qr, q as $t, E as Fe, M as We, L as Xr } from "./EventType-DY7SjWGF.js";
6
6
  import { useFormContext as me, Controller as sn } from "react-hook-form";
7
- import { m as Jr, a as an } from "./textUtils-BbxuIsKq.js";
7
+ import { m as Jr, a as an } from "./textUtils-BZyf3rh0.js";
8
8
  import { u as cn, a as ln, b as un } from "./useFormControlType-BAFqxupC.js";
9
- import { S as _l } from "./SimpleTooltip-CXeUwU65.js";
9
+ import { S as _l } from "./SimpleTooltip-OyME0pwt.js";
10
10
  const qc = ({ fileLoader: t, fileName: e, children: n }) => {
11
11
  const r = O(async () => {
12
12
  var l;
@@ -3,5 +3,6 @@ type AxiosTexts = {
3
3
  networkError: string;
4
4
  unexpectedError: string;
5
5
  forbiddenError: string;
6
+ permissionError: string;
6
7
  };
7
8
  export default AxiosTexts;
@@ -3,5 +3,6 @@ type ApiErrorResult = {
3
3
  message: string;
4
4
  statusCode: number;
5
5
  errorFields: ErrorField[];
6
+ permissions: string[];
6
7
  };
7
8
  export default ApiErrorResult;
@@ -0,0 +1,41 @@
1
+ const u = 6048e5, c = 864e5, m = 6e4, d = 36e5, n = (r) => r == null ? !0 : !(typeof r == "object" || typeof r == "function"), i = (r) => {
2
+ n(r) || Object.keys(r).forEach((e) => {
3
+ const s = r[e];
4
+ if (n(s))
5
+ return;
6
+ const t = Object.keys(s);
7
+ t.includes("id") && t.length === 1 && s.id === null ? r[e] = null : i(s);
8
+ });
9
+ }, a = (r) => {
10
+ var s;
11
+ const e = (s = r.response) == null ? void 0 : s.data;
12
+ return e && e.errorFields && e.errorFields.length > 0 ? e.errorFields.map((t) => ({
13
+ name: t.name.split(".").map((o) => `${o.charAt(0).toLowerCase()}${o.slice(1)}`).join("."),
14
+ errors: t.errors
15
+ })) : [];
16
+ }, p = (r, e) => {
17
+ a(e).forEach((t) => {
18
+ r.setError(t.name, { message: t.errors, type: "server" }, { shouldFocus: !0 }), n(r.getValues(t.name)) || r.setError(`${t.name}.id`, { message: t.errors, type: "server" }, { shouldFocus: !0 });
19
+ });
20
+ }, f = (r) => {
21
+ var s;
22
+ const e = (s = r.response) == null ? void 0 : s.data;
23
+ return e.permissions && e.permissions.length > 0 ? e.permissions : null;
24
+ }, F = (r) => r.length < 300 ? r : r.substring(0, 300) + "...", h = (r) => r < 1024 ? `${r} bytes` : r >= 1024 && r < 1048576 ? `${(r / 1024).toFixed(1)} KB` : `${(r / 1048576).toFixed(1)} MB`;
25
+ function y(r = " ", ...e) {
26
+ return e.filter((s) => s != null && s.length > 0).join(r);
27
+ }
28
+ export {
29
+ u as a,
30
+ d as b,
31
+ f as c,
32
+ i as d,
33
+ a as e,
34
+ h as f,
35
+ m as g,
36
+ p as h,
37
+ n as i,
38
+ y as j,
39
+ c as m,
40
+ F as t
41
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=e=>e==null?!0:!(typeof e=="object"||typeof e=="function"),o=e=>{t(e)||Object.keys(e).forEach(r=>{const s=e[r];if(t(s))return;const n=Object.keys(s);n.includes("id")&&n.length===1&&s.id===null?e[r]=null:o(s)})},l=e=>{var s;const r=(s=e.response)==null?void 0:s.data;return r&&r.errorFields&&r.errorFields.length>0?r.errorFields.map(n=>({name:n.name.split(".").map(i=>`${i.charAt(0).toLowerCase()}${i.slice(1)}`).join("."),errors:n.errors})):[]},c=(e,r)=>{l(r).forEach(n=>{e.setError(n.name,{message:n.errors,type:"server"},{shouldFocus:!0}),t(e.getValues(n.name))||e.setError(`${n.name}.id`,{message:n.errors,type:"server"},{shouldFocus:!0})})},u=e=>{var s;const r=(s=e.response)==null?void 0:s.data;return r.permissions&&r.permissions.length>0?r.permissions:null},m=e=>e.length<300?e:e.substring(0,300)+"...",a=e=>e<1024?`${e} bytes`:e>=1024&&e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`;function d(e=" ",...r){return r.filter(s=>s!=null&&s.length>0).join(e)}exports.extractErrorsFromResponse=l;exports.extractPermissionsFromResponse=u;exports.fixNameIdNulls=o;exports.formatFileSize=a;exports.hookFormSetServerErrors=c;exports.isPrimitive=t;exports.joinStrings=d;exports.millisecondsInDay=864e5;exports.millisecondsInHour=36e5;exports.millisecondsInMinute=6e4;exports.millisecondsInWeek=6048e5;exports.truncateText=m;
@@ -1 +1 @@
1
- "use strict";const r=require("react"),f=require("./NoInputContainer-QV9JLbnE.cjs"),p=()=>{const{isShown:s,text:c,showPrompt:e,hidePrompt:t,resolveRef:n,setOptions:i}=r.useContext(f.PromptContext),a=r.useCallback(o=>{t(),n.current(o)},[t,n]),l=r.useCallback(async(o,u)=>(i(m=>({...m,...u})),e(o),new Promise(m=>{n.current=m})),[n,i,e]);return{isShown:s,text:c,prompt:l,onFinish:a}};let C;const h=()=>{const{show:s,text:c,showConfirm:e,hideConfirm:t}=r.useContext(f.ConfirmContext),n=()=>{t()};return{confirm:async o=>(e(o),new Promise(u=>{C=u})),onConfirm:()=>{n(),C(!0)},onCancel:()=>{n(),C(!1)},show:s,text:c}};exports.useConfirm=h;exports.usePrompt=p;
1
+ "use strict";const r=require("react"),f=require("./NoInputContainer-pmSdlv8f.cjs"),p=()=>{const{isShown:s,text:c,showPrompt:e,hidePrompt:t,resolveRef:n,setOptions:i}=r.useContext(f.PromptContext),a=r.useCallback(o=>{t(),n.current(o)},[t,n]),l=r.useCallback(async(o,u)=>(i(m=>({...m,...u})),e(o),new Promise(m=>{n.current=m})),[n,i,e]);return{isShown:s,text:c,prompt:l,onFinish:a}};let C;const h=()=>{const{show:s,text:c,showConfirm:e,hideConfirm:t}=r.useContext(f.ConfirmContext),n=()=>{t()};return{confirm:async o=>(e(o),new Promise(u=>{C=u})),onConfirm:()=>{n(),C(!0)},onCancel:()=>{n(),C(!1)},show:s,text:c}};exports.useConfirm=h;exports.usePrompt=p;
@@ -1,5 +1,5 @@
1
1
  import { useContext as u, useCallback as l } from "react";
2
- import { al as p, ak as h } from "./NoInputContainer-D_sgAiux.js";
2
+ import { al as p, ak as h } from "./NoInputContainer-D94YvUXW.js";
3
3
  const P = () => {
4
4
  const { isShown: e, text: s, showPrompt: t, hidePrompt: r, resolveRef: o, setOptions: c } = u(p), C = l((n) => {
5
5
  r(), o.current(n);
@@ -1,5 +1,5 @@
1
1
  import { useContext as t, useCallback as i } from "react";
2
- import { aa as n } from "./NoInputContainer-D_sgAiux.js";
2
+ import { aa as n } from "./NoInputContainer-D94YvUXW.js";
3
3
  import "react-hook-form";
4
4
  const p = () => {
5
5
  const { user: s } = t(n);
@@ -1 +1 @@
1
- "use strict";const r=require("react"),t=require("./NoInputContainer-QV9JLbnE.cjs");require("react-hook-form");const o=()=>{const{user:s}=r.useContext(t.UserContext);return{checkUserHasPermissions:r.useCallback(n=>n.every(i=>{var e;return(e=s==null?void 0:s.permissions)==null?void 0:e.includes(i)}),[s])}};exports.usePermissions=o;
1
+ "use strict";const r=require("react"),t=require("./NoInputContainer-pmSdlv8f.cjs");require("react-hook-form");const o=()=>{const{user:s}=r.useContext(t.UserContext);return{checkUserHasPermissions:r.useCallback(n=>n.every(i=>{var e;return(e=s==null?void 0:s.permissions)==null?void 0:e.includes(i)}),[s])}};exports.usePermissions=o;
@@ -1,4 +1,4 @@
1
1
  import { ErrorField } from '@models/index';
2
2
  export declare const extractErrorsFromResponse: (error: any) => ErrorField[];
3
3
  export declare const hookFormSetServerErrors: (formMethods: any, error: any) => void;
4
- export default extractErrorsFromResponse;
4
+ export declare const extractPermissionsFromResponse: (error: any) => string[] | null;
package/dist/utils.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./textUtils-CHVVh2oi.cjs"),s=require("./dateUtils-CWKBTsx7.cjs");function o(r,t){r.setValue(t,null)}function l(r,t){t.forEach(i=>{o(r,i)})}exports.extractErrorsFromResponse=e.extractErrorsFromResponse;exports.fixNameIdNulls=e.fixNameIdNulls;exports.formatFileSize=e.formatFileSize;exports.hookFormSetServerErrors=e.hookFormSetServerErrors;exports.isPrimitive=e.isPrimitive;exports.joinStrings=e.joinStrings;exports.truncateText=e.truncateText;exports.isISODate=s.isISODate;exports.hookFormSetNull=o;exports.hookFormSetNulls=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./textUtils-DPetpRXS.cjs"),i=require("./dateUtils-DjdXQqjK.cjs");function t(r,o){r.setValue(o,null)}function l(r,o){o.forEach(s=>{t(r,s)})}exports.extractErrorsFromResponse=e.extractErrorsFromResponse;exports.extractPermissionsFromResponse=e.extractPermissionsFromResponse;exports.fixNameIdNulls=e.fixNameIdNulls;exports.formatFileSize=e.formatFileSize;exports.hookFormSetServerErrors=e.hookFormSetServerErrors;exports.isPrimitive=e.isPrimitive;exports.joinStrings=e.joinStrings;exports.truncateText=e.truncateText;exports.isISODate=i.isISODate;exports.hookFormSetNull=t;exports.hookFormSetNulls=l;
package/dist/utils.es.js CHANGED
@@ -1,22 +1,23 @@
1
- import { e as l, c as m, f as n, h as f, i as u, j as S, t as c } from "./textUtils-BbxuIsKq.js";
2
- import { i as h } from "./dateUtils-Crak7ii9.js";
3
- function t(o, r) {
1
+ import { e as m, c as n, d as l, f, h as u, i as c, j as x, t as S } from "./textUtils-BZyf3rh0.js";
2
+ import { i as h } from "./dateUtils-Clmwz8MD.js";
3
+ function s(o, r) {
4
4
  o.setValue(r, null);
5
5
  }
6
- function s(o, r) {
6
+ function t(o, r) {
7
7
  r.forEach((e) => {
8
- t(o, e);
8
+ s(o, e);
9
9
  });
10
10
  }
11
11
  export {
12
- l as extractErrorsFromResponse,
13
- m as fixNameIdNulls,
14
- n as formatFileSize,
15
- t as hookFormSetNull,
16
- s as hookFormSetNulls,
17
- f as hookFormSetServerErrors,
12
+ m as extractErrorsFromResponse,
13
+ n as extractPermissionsFromResponse,
14
+ l as fixNameIdNulls,
15
+ f as formatFileSize,
16
+ s as hookFormSetNull,
17
+ t as hookFormSetNulls,
18
+ u as hookFormSetServerErrors,
18
19
  h as isISODate,
19
- u as isPrimitive,
20
- S as joinStrings,
21
- c as truncateText
20
+ c as isPrimitive,
21
+ x as joinStrings,
22
+ S as truncateText
22
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-luminus-components",
3
- "version": "1.2.80",
3
+ "version": "1.2.82",
4
4
  "description": "Library of React Components reusable in Luminus projects (Fleetman, CAFM)",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,36 +0,0 @@
1
- const u = 6048e5, c = 864e5, d = 6e4, m = 36e5, n = (r) => r == null ? !0 : !(typeof r == "object" || typeof r == "function"), i = (r) => {
2
- n(r) || Object.keys(r).forEach((s) => {
3
- const e = r[s];
4
- if (n(e))
5
- return;
6
- const t = Object.keys(e);
7
- t.includes("id") && t.length === 1 && e.id === null ? r[s] = null : i(e);
8
- });
9
- }, l = (r) => {
10
- var e;
11
- const s = (e = r.response) == null ? void 0 : e.data;
12
- return s && s.errorFields && s.errorFields.length > 0 ? s.errorFields.map((t) => ({
13
- name: t.name.split(".").map((o) => `${o.charAt(0).toLowerCase()}${o.slice(1)}`).join("."),
14
- errors: t.errors
15
- })) : [];
16
- }, f = (r, s) => {
17
- l(s).forEach((t) => {
18
- r.setError(t.name, { message: t.errors, type: "server" }, { shouldFocus: !0 }), n(r.getValues(t.name)) || r.setError(`${t.name}.id`, { message: t.errors, type: "server" }, { shouldFocus: !0 });
19
- });
20
- }, p = (r) => r.length < 300 ? r : r.substring(0, 300) + "...", F = (r) => r < 1024 ? `${r} bytes` : r >= 1024 && r < 1048576 ? `${(r / 1024).toFixed(1)} KB` : `${(r / 1048576).toFixed(1)} MB`;
21
- function y(r = " ", ...s) {
22
- return s.filter((e) => e != null && e.length > 0).join(r);
23
- }
24
- export {
25
- u as a,
26
- m as b,
27
- i as c,
28
- d,
29
- l as e,
30
- F as f,
31
- f as h,
32
- n as i,
33
- y as j,
34
- c as m,
35
- p as t
36
- };
@@ -1 +0,0 @@
1
- "use strict";const t=e=>e==null?!0:!(typeof e=="object"||typeof e=="function"),o=e=>{t(e)||Object.keys(e).forEach(n=>{const r=e[n];if(t(r))return;const s=Object.keys(r);s.includes("id")&&s.length===1&&r.id===null?e[n]=null:o(r)})},l=e=>{var r;const n=(r=e.response)==null?void 0:r.data;return n&&n.errorFields&&n.errorFields.length>0?n.errorFields.map(s=>({name:s.name.split(".").map(i=>`${i.charAt(0).toLowerCase()}${i.slice(1)}`).join("."),errors:s.errors})):[]},c=(e,n)=>{l(n).forEach(s=>{e.setError(s.name,{message:s.errors,type:"server"},{shouldFocus:!0}),t(e.getValues(s.name))||e.setError(`${s.name}.id`,{message:s.errors,type:"server"},{shouldFocus:!0})})},u=e=>e.length<300?e:e.substring(0,300)+"...",a=e=>e<1024?`${e} bytes`:e>=1024&&e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`;function m(e=" ",...n){return n.filter(r=>r!=null&&r.length>0).join(e)}exports.extractErrorsFromResponse=l;exports.fixNameIdNulls=o;exports.formatFileSize=a;exports.hookFormSetServerErrors=c;exports.isPrimitive=t;exports.joinStrings=m;exports.millisecondsInDay=864e5;exports.millisecondsInHour=36e5;exports.millisecondsInMinute=6e4;exports.millisecondsInWeek=6048e5;exports.truncateText=u;