react-luminus-components 1.5.1 → 1.5.3

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.
@@ -0,0 +1,6 @@
1
+ export default interface LocalStorageSettingsModel {
2
+ id: string;
3
+ name: string | null;
4
+ date: string | null;
5
+ setting: string | null;
6
+ }
@@ -118,6 +118,7 @@ export type { default as ApprovalPersonModel } from './api/approval/ApprovalPers
118
118
  export { default as ApprovalState } from './api/approval/ApprovalState';
119
119
  export type { default as ApprovalTimelineModel } from './api/approval/ApprovalTimelineModel';
120
120
  export type { default as EmployeeSmallModel } from './api/employee/EmployeeSmallModel';
121
+ export type { default as LocalStorageSettingsModel } from './api/localStorageSettings/LocalStorageSettingsModel';
121
122
  export type { default as ReloadDataWithReturnType } from './types/useGetApiData/ReloadDataWithReturnType';
122
123
  export type { default as ReloadDataType } from './types/useGetApiData/ReloadDataType';
123
124
  export type { default as XlsColumnErrorModel } from './api/imports/XlsColumnErrorModel';
@@ -1,5 +1,18 @@
1
1
  type UserSettingsTexts = {
2
2
  downloads: string;
3
3
  tryOpenFileLabel: string;
4
+ localStorage: string;
5
+ localStorageDeleteBackup: string;
6
+ localStorageNoBackups: string;
7
+ localStorageCreateBackup: string;
8
+ localStorageLoadBackup: string;
9
+ localStorageLoadBackupSuccess: string;
10
+ localStorageLoadBackupError: string;
11
+ localStorageDeleteBackupConfirm: string;
12
+ localStorageDeleteBackupSuccess: string;
13
+ localStorageCreateBackupName: string;
14
+ localStorageCreateBackupSave: string;
15
+ localStorageCreateBackupSuccess: string;
16
+ localStorageCreateBackupInfo: (count: number) => string;
4
17
  };
5
18
  export default UserSettingsTexts;
@@ -12,4 +12,5 @@ export * from './text/textUtils';
12
12
  export * from './route/apiPathUtils';
13
13
  export * from './localizationUtils/localizationUtils';
14
14
  export * from './apiUtils/apiUtils';
15
+ export * from './localStorage/localStorageUtils';
15
16
  export { default as CommonLuminusIconsArray } from './constants/CommonLuminusIconsArray';
@@ -0,0 +1,2 @@
1
+ export declare const dumpLocalStorage: (ignoreSessionSpecific?: boolean) => Record<string, any>;
2
+ export declare const restoreLocalStorage: (json: string) => boolean;
package/dist/utils.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ShortcutLinksContext-CFDCR0fQ.cjs");require("react");require("@azure/msal-browser");require("@azure/msal-react");require("react-router-dom");require("react-dom");require("react-hook-form");require("react-flexmonster");const l=require("./apiPathUtils-CkTRKCPh.cjs"),f=({cell:{value:t}})=>e.jsxRuntimeExports.jsx(e.SimpleTooltip,{text:t,placement:"bottom",children:e.jsxRuntimeExports.jsx("div",{className:"w-100 text-truncate",children:t})}),h=({cell:{value:t}})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t==null?void 0:t.toLocaleString("cs-CZ")}),p=({cell:{value:t}})=>{const r=e.format(new Date(t),"dd.MM.yyyy");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t?r:""})},d=(t,r)=>{let s=!1,a=t;t[0]==="#"&&(a=t.slice(1),s=!0);let i=parseInt(a.substring(0,2),16),o=parseInt(a.substring(2,4),16),n=parseInt(a.substring(4,6),16);i+=r,o+=r,n+=r,i>255?i=255:i<0&&(i=0),o>255?o=255:o<0&&(o=0),n>255?n=255:n<0&&(n=0);const u=i.toString(16).length===1?"0"+i.toString(16):i.toString(16),m=o.toString(16).length===1?"0"+o.toString(16):o.toString(16),g=n.toString(16).length===1?"0"+n.toString(16):n.toString(16);return(s?"#":"")+u+m+g},y=t=>{const r=t.slice(3),s=[];for(let i=0;i<r.length;i+=2)s.push(r.slice(i,i+2));return`#${s.reverse().join("")}`};function c(t,r){t.setValue(r,null)}function S(t,r){r.forEach(s=>{c(t,s)})}const D=t=>typeof t.directoryName=="string"&&typeof t.directoryPath=="string"&&typeof t.directoryTranslationKey=="string"&&Array.isArray(t.files),F=async t=>{let r={status:"pending"};try{r={status:"success",data:(await t).data}}catch(s){r={status:"error",error:s}}return r},x=["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"];exports.atobUtf8=e.atobUtf8;exports.buildEmployeeNameString=e.buildEmployeeNameString;exports.buildOrgUnitString=e.buildOrgUnitString;exports.buildVehicleNameString=e.buildVehicleNameString;exports.capitalizeFirstLetter=e.capitalizeFirstLetter;exports.compareDate=e.compareDate;exports.compareDateTime=e.compareDateTime;exports.extractErrorsFromResponse=e.extractErrorsFromResponse;exports.extractFilename=e.extractFilename;exports.extractPermissionsFromResponse=e.extractPermissionsFromResponse;exports.fixNameIdNulls=e.fixNameIdNulls;exports.formatDate=e.formatDate;exports.formatDateTime=e.formatDateTime;exports.formatFileSize=e.formatFileSize;exports.getDateString=e.getDateString;exports.getDaysDifference=e.getDaysDifference;exports.getFirstDayOfMonth=e.getFirstDayOfMonth;exports.getFirstDayOfOffsetMonth=e.getFirstDayOfOffsetMonth;exports.getFirstDayOfYear=e.getFirstDayOfYear;exports.getLastDayOfMonth=e.getLastDayOfMonth;exports.getLastDayOfOffsetMonth=e.getLastDayOfOffsetMonth;exports.getLastDayOfYear=e.getLastDayOfYear;exports.hasOnlyNullValues=e.hasOnlyNullValues;exports.hookFormSetServerErrors=e.hookFormSetServerErrors;exports.isISODate=e.isISODate;exports.isPrimitive=e.isPrimitive;exports.isValidDate=e.isValidDate;exports.joinStrings=e.joinStrings;exports.msToStartOfNextDay=e.msToStartOfNextDay;exports.replaceNullValuesOnlyObjectsWithNulls=e.replaceNullValuesOnlyObjectsWithNulls;exports.saveFile=e.saveFile;exports.saveFileFromResponse=e.saveFileFromResponse;exports.shortenText=e.shortenText;exports.stringContains=e.stringContains;exports.stringSearchWithin=e.stringSearchWithin;exports.stringStartsWith=e.stringStartsWith;exports.trimIsoDate=e.trimIsoDate;exports.truncateText=e.truncateText;exports.urlfyArray=e.urlfyArray;exports.generateApiPath=l.generateApiPath;exports.limitNumber=l.limitNumber;exports.CommonLuminusIconsArray=x;exports.adjustBrightness=d;exports.dateValueFormat=p;exports.hookFormSetNull=c;exports.hookFormSetNulls=S;exports.isFileStructureDirectory=D;exports.numFormat=h;exports.responsePromiseWrapper=F;exports.valueTooltip=f;exports.vclToHex=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ShortcutLinksContext-CFDCR0fQ.cjs");require("react");require("@azure/msal-browser");require("@azure/msal-react");require("react-router-dom");require("react-dom");require("react-hook-form");require("react-flexmonster");const l=require("./localStorageUtils-DUQHXXBp.cjs"),f=({cell:{value:t}})=>e.jsxRuntimeExports.jsx(e.SimpleTooltip,{text:t,placement:"bottom",children:e.jsxRuntimeExports.jsx("div",{className:"w-100 text-truncate",children:t})}),h=({cell:{value:t}})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t==null?void 0:t.toLocaleString("cs-CZ")}),p=({cell:{value:t}})=>{const r=e.format(new Date(t),"dd.MM.yyyy");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t?r:""})},d=(t,r)=>{let i=!1,n=t;t[0]==="#"&&(n=t.slice(1),i=!0);let s=parseInt(n.substring(0,2),16),o=parseInt(n.substring(2,4),16),a=parseInt(n.substring(4,6),16);s+=r,o+=r,a+=r,s>255?s=255:s<0&&(s=0),o>255?o=255:o<0&&(o=0),a>255?a=255:a<0&&(a=0);const u=s.toString(16).length===1?"0"+s.toString(16):s.toString(16),m=o.toString(16).length===1?"0"+o.toString(16):o.toString(16),g=a.toString(16).length===1?"0"+a.toString(16):a.toString(16);return(i?"#":"")+u+m+g},S=t=>{const r=t.slice(3),i=[];for(let s=0;s<r.length;s+=2)i.push(r.slice(s,s+2));return`#${i.reverse().join("")}`};function c(t,r){t.setValue(r,null)}function y(t,r){r.forEach(i=>{c(t,i)})}const D=t=>typeof t.directoryName=="string"&&typeof t.directoryPath=="string"&&typeof t.directoryTranslationKey=="string"&&Array.isArray(t.files),F=async t=>{let r={status:"pending"};try{r={status:"success",data:(await t).data}}catch(i){r={status:"error",error:i}}return r},x=["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"];exports.atobUtf8=e.atobUtf8;exports.buildEmployeeNameString=e.buildEmployeeNameString;exports.buildOrgUnitString=e.buildOrgUnitString;exports.buildVehicleNameString=e.buildVehicleNameString;exports.capitalizeFirstLetter=e.capitalizeFirstLetter;exports.compareDate=e.compareDate;exports.compareDateTime=e.compareDateTime;exports.extractErrorsFromResponse=e.extractErrorsFromResponse;exports.extractFilename=e.extractFilename;exports.extractPermissionsFromResponse=e.extractPermissionsFromResponse;exports.fixNameIdNulls=e.fixNameIdNulls;exports.formatDate=e.formatDate;exports.formatDateTime=e.formatDateTime;exports.formatFileSize=e.formatFileSize;exports.getDateString=e.getDateString;exports.getDaysDifference=e.getDaysDifference;exports.getFirstDayOfMonth=e.getFirstDayOfMonth;exports.getFirstDayOfOffsetMonth=e.getFirstDayOfOffsetMonth;exports.getFirstDayOfYear=e.getFirstDayOfYear;exports.getLastDayOfMonth=e.getLastDayOfMonth;exports.getLastDayOfOffsetMonth=e.getLastDayOfOffsetMonth;exports.getLastDayOfYear=e.getLastDayOfYear;exports.hasOnlyNullValues=e.hasOnlyNullValues;exports.hookFormSetServerErrors=e.hookFormSetServerErrors;exports.isISODate=e.isISODate;exports.isPrimitive=e.isPrimitive;exports.isValidDate=e.isValidDate;exports.joinStrings=e.joinStrings;exports.msToStartOfNextDay=e.msToStartOfNextDay;exports.replaceNullValuesOnlyObjectsWithNulls=e.replaceNullValuesOnlyObjectsWithNulls;exports.saveFile=e.saveFile;exports.saveFileFromResponse=e.saveFileFromResponse;exports.shortenText=e.shortenText;exports.stringContains=e.stringContains;exports.stringSearchWithin=e.stringSearchWithin;exports.stringStartsWith=e.stringStartsWith;exports.trimIsoDate=e.trimIsoDate;exports.truncateText=e.truncateText;exports.urlfyArray=e.urlfyArray;exports.dumpLocalStorage=l.dumpLocalStorage;exports.generateApiPath=l.generateApiPath;exports.limitNumber=l.limitNumber;exports.restoreLocalStorage=l.restoreLocalStorage;exports.CommonLuminusIconsArray=x;exports.adjustBrightness=d;exports.dateValueFormat=p;exports.hookFormSetNull=c;exports.hookFormSetNulls=y;exports.isFileStructureDirectory=D;exports.numFormat=h;exports.responsePromiseWrapper=F;exports.valueTooltip=f;exports.vclToHex=S;
package/dist/utils.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { j as i, ao as f, U as u } from "./ShortcutLinksContext-CH9KdcxB.js";
2
- import { ca as V, c8 as k, c9 as L, c7 as M, c6 as A, bS as E, bT as W, a_ as z, b_ as B, bP as U, c0 as G, b6 as Y, c5 as Z, cc as _, bZ as H, bU as $, aI as q, bW as J, aJ as K, bV as Q, bX as X, bY as tt, c1 as et, bl as rt, bQ as st, b$ as at, bR as ot, cd as it, bI as nt, c2 as lt, aT as ct, aZ as mt, cf as ft, c3 as ut, _ as gt, c4 as pt, aH as dt, cb as ht, ce as yt } from "./ShortcutLinksContext-CH9KdcxB.js";
1
+ import { j as i, ao as f, U as g } from "./ShortcutLinksContext-CH9KdcxB.js";
2
+ import { ca as C, c8 as V, c9 as k, c7 as M, c6 as A, bS as E, bT as W, a_ as z, b_ as B, bP as U, c0 as G, b6 as Y, c5 as Z, cc as _, bZ as H, bU as $, aI as q, bW as J, aJ as K, bV as Q, bX as X, bY as tt, c1 as et, bl as rt, bQ as st, b$ as at, bR as ot, cd as it, bI as nt, c2 as lt, aT as ct, aZ as mt, cf as ft, c3 as gt, _ as ut, c4 as pt, aH as dt, cb as ht, ce as yt } from "./ShortcutLinksContext-CH9KdcxB.js";
3
3
  import "react";
4
4
  import "@azure/msal-browser";
5
5
  import "@azure/msal-react";
@@ -7,9 +7,9 @@ import "react-router-dom";
7
7
  import "react-dom";
8
8
  import "react-hook-form";
9
9
  import "react-flexmonster";
10
- import { g as St, l as xt } from "./apiPathUtils-DiqvB8mF.js";
10
+ import { d as bt, g as xt, l as Dt, r as Ft } from "./localStorageUtils-CHdu9Xvf.js";
11
11
  const F = ({ cell: { value: t } }) => /* @__PURE__ */ i.jsx(f, { text: t, placement: "bottom", children: /* @__PURE__ */ i.jsx("div", { className: "w-100 text-truncate", children: t }) }), O = ({ cell: { value: t } }) => /* @__PURE__ */ i.jsx(i.Fragment, { children: t == null ? void 0 : t.toLocaleString("cs-CZ") }), N = ({ cell: { value: t } }) => {
12
- const e = u(new Date(t), "dd.MM.yyyy");
12
+ const e = g(new Date(t), "dd.MM.yyyy");
13
13
  return /* @__PURE__ */ i.jsx(i.Fragment, { children: t ? e : "" });
14
14
  }, v = (t, e) => {
15
15
  let s = !1, n = t;
@@ -24,15 +24,15 @@ const F = ({ cell: { value: t } }) => /* @__PURE__ */ i.jsx(f, { text: t, placem
24
24
  s.push(e.slice(r, r + 2));
25
25
  return `#${s.reverse().join("")}`;
26
26
  };
27
- function g(t, e) {
27
+ function u(t, e) {
28
28
  t.setValue(e, null);
29
29
  }
30
30
  function I(t, e) {
31
31
  e.forEach((s) => {
32
- g(t, s);
32
+ u(t, s);
33
33
  });
34
34
  }
35
- const P = (t) => typeof t.directoryName == "string" && typeof t.directoryPath == "string" && typeof t.directoryTranslationKey == "string" && Array.isArray(t.files), R = async (t) => {
35
+ const L = (t) => typeof t.directoryName == "string" && typeof t.directoryPath == "string" && typeof t.directoryTranslationKey == "string" && Array.isArray(t.files), P = async (t) => {
36
36
  let e = { status: "pending" };
37
37
  try {
38
38
  e = { status: "success", data: (await t).data };
@@ -40,7 +40,7 @@ const P = (t) => typeof t.directoryName == "string" && typeof t.directoryPath ==
40
40
  e = { status: "error", error: s };
41
41
  }
42
42
  return e;
43
- }, j = [
43
+ }, R = [
44
44
  "edit",
45
45
  "delete",
46
46
  "info",
@@ -79,16 +79,17 @@ const P = (t) => typeof t.directoryName == "string" && typeof t.directoryPath ==
79
79
  "minus"
80
80
  ];
81
81
  export {
82
- j as CommonLuminusIconsArray,
82
+ R as CommonLuminusIconsArray,
83
83
  v as adjustBrightness,
84
- V as atobUtf8,
85
- k as buildEmployeeNameString,
86
- L as buildOrgUnitString,
84
+ C as atobUtf8,
85
+ V as buildEmployeeNameString,
86
+ k as buildOrgUnitString,
87
87
  M as buildVehicleNameString,
88
88
  A as capitalizeFirstLetter,
89
89
  E as compareDate,
90
90
  W as compareDateTime,
91
91
  N as dateValueFormat,
92
+ bt as dumpLocalStorage,
92
93
  z as extractErrorsFromResponse,
93
94
  B as extractFilename,
94
95
  U as extractPermissionsFromResponse,
@@ -96,7 +97,7 @@ export {
96
97
  Y as formatDate,
97
98
  Z as formatDateTime,
98
99
  _ as formatFileSize,
99
- St as generateApiPath,
100
+ xt as generateApiPath,
100
101
  H as getDateString,
101
102
  $ as getDaysDifference,
102
103
  q as getFirstDayOfMonth,
@@ -106,24 +107,25 @@ export {
106
107
  X as getLastDayOfOffsetMonth,
107
108
  tt as getLastDayOfYear,
108
109
  et as hasOnlyNullValues,
109
- g as hookFormSetNull,
110
+ u as hookFormSetNull,
110
111
  I as hookFormSetNulls,
111
112
  rt as hookFormSetServerErrors,
112
- P as isFileStructureDirectory,
113
+ L as isFileStructureDirectory,
113
114
  st as isISODate,
114
115
  at as isPrimitive,
115
116
  ot as isValidDate,
116
117
  it as joinStrings,
117
- xt as limitNumber,
118
+ Dt as limitNumber,
118
119
  nt as msToStartOfNextDay,
119
120
  O as numFormat,
120
121
  lt as replaceNullValuesOnlyObjectsWithNulls,
121
- R as responsePromiseWrapper,
122
+ P as responsePromiseWrapper,
123
+ Ft as restoreLocalStorage,
122
124
  ct as saveFile,
123
125
  mt as saveFileFromResponse,
124
126
  ft as shortenText,
125
- ut as stringContains,
126
- gt as stringSearchWithin,
127
+ gt as stringContains,
128
+ ut as stringSearchWithin,
127
129
  pt as stringStartsWith,
128
130
  dt as trimIsoDate,
129
131
  ht as truncateText,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-luminus-components",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Library of React Components reusable in Luminus projects (Fleetman, CAFM)",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- "use strict";const h=require("react-router-dom"),c=(i,e,n)=>{let t=i;return e!==void 0&&(t=Math.max(t,e)),n!==void 0&&(t=Math.min(t,n)),t},o=(i,e,n=!0)=>Object.keys(i).reduce((t,u)=>{const r=i[u];return n&&(r==null||r==="")||(t[u]=e(r,u)),t},{}),g=(i,e)=>{const n=e!=null&&e.query?new URLSearchParams(o(e.query,t=>(t==null?void 0:t.toString())??"")):null;return`${h.generatePath(i,e!=null&&e.path?o(e.path,t=>(t==null?void 0:t.toString())??null):void 0)}${n&&n.size>0?`?${n.toString()}`:""}`};exports.generateApiPath=g;exports.limitNumber=c;
@@ -1,15 +0,0 @@
1
- import { generatePath as h } from "react-router-dom";
2
- const c = (i, e, n) => {
3
- let t = i;
4
- return e !== void 0 && (t = Math.max(t, e)), n !== void 0 && (t = Math.min(t, n)), t;
5
- }, u = (i, e, n = !0) => Object.keys(i).reduce((t, o) => {
6
- const r = i[o];
7
- return n && (r == null || r === "") || (t[o] = e(r, o)), t;
8
- }, {}), d = (i, e) => {
9
- const n = e != null && e.query ? new URLSearchParams(u(e.query, (t) => (t == null ? void 0 : t.toString()) ?? "")) : null;
10
- return `${h(i, e != null && e.path ? u(e.path, (t) => (t == null ? void 0 : t.toString()) ?? null) : void 0)}${n && n.size > 0 ? `?${n.toString()}` : ""}`;
11
- };
12
- export {
13
- d as g,
14
- c as l
15
- };