react-luminus-components 1.2.33 → 1.2.34

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.
@@ -2,3 +2,4 @@ export * from './apiErrorFields/apiErrorFieldsUtils';
2
2
  export * from './object/objectUtils';
3
3
  export * from './text/textUtils';
4
4
  export * from './date/dateUtils';
5
+ export * from './hookForm/hookFormUtils';
package/dist/utils.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./textUtils-CHVVh2oi.cjs");function N(t,e){const n=I(t);let i;if(n.date){const s=S(n.date,2);i=x(s.restDateString,s.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const o=i.getTime();let u=0,c;if(n.time&&(u=U(n.time),isNaN(u)))return new Date(NaN);if(n.timezone){if(c=h(n.timezone),isNaN(c))return new Date(NaN)}else{const s=new Date(o+u),l=new Date(0);return l.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),l.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),l}return new Date(o+u+c)}const m={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},p=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,g=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,T=/^([+-])(\d{2})(?::?(\d{2}))?$/;function I(t){const e={},r=t.split(m.dateTimeDelimiter);let n;if(r.length>2)return e;if(/:/.test(r[0])?n=r[0]:(e.date=r[0],n=r[1],m.timeZoneDelimiter.test(e.date)&&(e.date=t.split(m.timeZoneDelimiter)[0],n=t.substr(e.date.length,t.length))),n){const i=m.timezone.exec(n);i?(e.time=n.replace(i[1],""),e.timezone=i[1]):e.time=n}return e}function S(t,e){const r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=t.match(r);if(!n)return{year:NaN,restDateString:""};const i=n[1]?parseInt(n[1]):null,o=n[2]?parseInt(n[2]):null;return{year:o===null?i:o*100,restDateString:t.slice((n[1]||n[2]).length)}}function x(t,e){if(e===null)return new Date(NaN);const r=t.match(p);if(!r)return new Date(NaN);const n=!!r[4],i=f(r[1]),o=f(r[2])-1,u=f(r[3]),c=f(r[4]),s=f(r[5])-1;if(n)return z(e,c,s)?w(e,c,s):new Date(NaN);{const l=new Date(0);return!F(e,o,u)||!y(e,i)?new Date(NaN):(l.setUTCFullYear(e,o,Math.max(i,u)),l)}}function f(t){return t?parseInt(t):1}function U(t){const e=t.match(g);if(!e)return NaN;const r=d(e[1]),n=d(e[2]),i=d(e[3]);return O(r,n,i)?r*a.millisecondsInHour+n*a.millisecondsInMinute+i*1e3:NaN}function d(t){return t&&parseFloat(t.replace(",","."))||0}function h(t){if(t==="Z")return 0;const e=t.match(T);if(!e)return 0;const r=e[1]==="+"?-1:1,n=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return Y(n,i)?r*(n*a.millisecondsInHour+i*a.millisecondsInMinute):NaN}function w(t,e,r){const n=new Date(0);n.setUTCFullYear(t,0,4);const i=n.getUTCDay()||7,o=(e-1)*7+r+1-i;return n.setUTCDate(n.getUTCDate()+o),n}const C=[31,null,31,30,31,30,31,31,30,31,30,31];function D(t){return t%400===0||t%4===0&&t%100!==0}function F(t,e,r){return e>=0&&e<=11&&r>=1&&r<=(C[e]||(D(t)?29:28))}function y(t,e){return e>=1&&e<=(D(t)?366:365)}function z(t,e,r){return e>=1&&e<=53&&r>=0&&r<=6}function O(t,e,r){return t===24?e===0&&r===0:r>=0&&r<60&&e>=0&&e<60&&t>=0&&t<25}function Y(t,e){return e>=0&&e<=59}const v=t=>{const e=N(t);return!Number.isNaN(e.getTime())};exports.extractErrorsFromResponse=a.extractErrorsFromResponse;exports.fixNameIdNulls=a.fixNameIdNulls;exports.formatFileSize=a.formatFileSize;exports.hookFormSetServerErrors=a.hookFormSetServerErrors;exports.isPrimitive=a.isPrimitive;exports.joinStrings=a.joinStrings;exports.truncateText=a.truncateText;exports.isISODate=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./textUtils-CHVVh2oi.cjs"),o=require("./dateUtils-CWKBTsx7.cjs");function i(r,t){r.setValue(t,null)}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=o.isISODate;exports.hookFormSetNull=i;
package/dist/utils.es.js CHANGED
@@ -1,139 +1,16 @@
1
- import { b as d, c as D } from "./textUtils-BLtD0zaS.js";
2
- import { e as W, d as $, f as b, h as E, i as H, j, t as _ } from "./textUtils-BLtD0zaS.js";
3
- function N(t, e) {
4
- const n = U(t);
5
- let a;
6
- if (n.date) {
7
- const i = w(n.date, 2);
8
- a = x(i.restDateString, i.year);
9
- }
10
- if (!a || isNaN(a.getTime()))
11
- return /* @__PURE__ */ new Date(NaN);
12
- const s = a.getTime();
13
- let o = 0, c;
14
- if (n.time && (o = I(n.time), isNaN(o)))
15
- return /* @__PURE__ */ new Date(NaN);
16
- if (n.timezone) {
17
- if (c = C(n.timezone), isNaN(c))
18
- return /* @__PURE__ */ new Date(NaN);
19
- } else {
20
- const i = new Date(s + o), u = /* @__PURE__ */ new Date(0);
21
- return u.setFullYear(
22
- i.getUTCFullYear(),
23
- i.getUTCMonth(),
24
- i.getUTCDate()
25
- ), u.setHours(
26
- i.getUTCHours(),
27
- i.getUTCMinutes(),
28
- i.getUTCSeconds(),
29
- i.getUTCMilliseconds()
30
- ), u;
31
- }
32
- return new Date(s + o + c);
1
+ import { e as a, c as i, f as l, h as m, i as n, j as f, t as u } from "./textUtils-BbxuIsKq.js";
2
+ import { i as S } from "./dateUtils-Crak7ii9.js";
3
+ function o(r, e) {
4
+ r.setValue(e, null);
33
5
  }
34
- const f = {
35
- dateTimeDelimiter: /[T ]/,
36
- timeZoneDelimiter: /[Z ]/i,
37
- timezone: /([Z+-].*)$/
38
- }, g = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, T = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, h = /^([+-])(\d{2})(?::?(\d{2}))?$/;
39
- function U(t) {
40
- const e = {}, r = t.split(f.dateTimeDelimiter);
41
- let n;
42
- if (r.length > 2)
43
- return e;
44
- if (/:/.test(r[0]) ? n = r[0] : (e.date = r[0], n = r[1], f.timeZoneDelimiter.test(e.date) && (e.date = t.split(f.timeZoneDelimiter)[0], n = t.substr(
45
- e.date.length,
46
- t.length
47
- ))), n) {
48
- const a = f.timezone.exec(n);
49
- a ? (e.time = n.replace(a[1], ""), e.timezone = a[1]) : e.time = n;
50
- }
51
- return e;
52
- }
53
- function w(t, e) {
54
- const r = new RegExp(
55
- "^(?:(\\d{4}|[+-]\\d{" + (4 + e) + "})|(\\d{2}|[+-]\\d{" + (2 + e) + "})$)"
56
- ), n = t.match(r);
57
- if (!n)
58
- return { year: NaN, restDateString: "" };
59
- const a = n[1] ? parseInt(n[1]) : null, s = n[2] ? parseInt(n[2]) : null;
60
- return {
61
- year: s === null ? a : s * 100,
62
- restDateString: t.slice((n[1] || n[2]).length)
63
- };
64
- }
65
- function x(t, e) {
66
- if (e === null)
67
- return /* @__PURE__ */ new Date(NaN);
68
- const r = t.match(g);
69
- if (!r)
70
- return /* @__PURE__ */ new Date(NaN);
71
- const n = !!r[4], a = l(r[1]), s = l(r[2]) - 1, o = l(r[3]), c = l(r[4]), i = l(r[5]) - 1;
72
- if (n)
73
- return F(e, c, i) ? S(e, c, i) : /* @__PURE__ */ new Date(NaN);
74
- {
75
- const u = /* @__PURE__ */ new Date(0);
76
- return !y(e, s, o) || !z(e, a) ? /* @__PURE__ */ new Date(NaN) : (u.setUTCFullYear(e, s, Math.max(a, o)), u);
77
- }
78
- }
79
- function l(t) {
80
- return t ? parseInt(t) : 1;
81
- }
82
- function I(t) {
83
- const e = t.match(T);
84
- if (!e)
85
- return NaN;
86
- const r = m(e[1]), n = m(e[2]), a = m(e[3]);
87
- return O(r, n, a) ? r * d + n * D + a * 1e3 : NaN;
88
- }
89
- function m(t) {
90
- return t && parseFloat(t.replace(",", ".")) || 0;
91
- }
92
- function C(t) {
93
- if (t === "Z")
94
- return 0;
95
- const e = t.match(h);
96
- if (!e)
97
- return 0;
98
- const r = e[1] === "+" ? -1 : 1, n = parseInt(e[2]), a = e[3] && parseInt(e[3]) || 0;
99
- return k(n, a) ? r * (n * d + a * D) : NaN;
100
- }
101
- function S(t, e, r) {
102
- const n = /* @__PURE__ */ new Date(0);
103
- n.setUTCFullYear(t, 0, 4);
104
- const a = n.getUTCDay() || 7, s = (e - 1) * 7 + r + 1 - a;
105
- return n.setUTCDate(n.getUTCDate() + s), n;
106
- }
107
- const Y = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
108
- function p(t) {
109
- return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
110
- }
111
- function y(t, e, r) {
112
- return e >= 0 && e <= 11 && r >= 1 && r <= (Y[e] || (p(t) ? 29 : 28));
113
- }
114
- function z(t, e) {
115
- return e >= 1 && e <= (p(t) ? 366 : 365);
116
- }
117
- function F(t, e, r) {
118
- return e >= 1 && e <= 53 && r >= 0 && r <= 6;
119
- }
120
- function O(t, e, r) {
121
- return t === 24 ? e === 0 && r === 0 : r >= 0 && r < 60 && e >= 0 && e < 60 && t >= 0 && t < 25;
122
- }
123
- function k(t, e) {
124
- return e >= 0 && e <= 59;
125
- }
126
- const R = (t) => {
127
- const e = N(t);
128
- return !Number.isNaN(e.getTime());
129
- };
130
6
  export {
131
- W as extractErrorsFromResponse,
132
- $ as fixNameIdNulls,
133
- b as formatFileSize,
134
- E as hookFormSetServerErrors,
135
- R as isISODate,
136
- H as isPrimitive,
137
- j as joinStrings,
138
- _ as truncateText
7
+ a as extractErrorsFromResponse,
8
+ i as fixNameIdNulls,
9
+ l as formatFileSize,
10
+ o as hookFormSetNull,
11
+ m as hookFormSetServerErrors,
12
+ S as isISODate,
13
+ n as isPrimitive,
14
+ f as joinStrings,
15
+ u as truncateText
139
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-luminus-components",
3
- "version": "1.2.33",
3
+ "version": "1.2.34",
4
4
  "description": "Library of React Components reusable in Luminus projects (Fleetman, CAFM)",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,5 +0,0 @@
1
- import { j as o, O as e, T as i } from "./UserAvatarToggle-BWDRIIXE.js";
2
- const a = ({ text: s, placement: r, children: t }) => /* @__PURE__ */ o.jsx(e, { placement: r, overlay: /* @__PURE__ */ o.jsx(i, { className: "luminus-tooltip", children: s }), children: t });
3
- export {
4
- a as S
5
- };