@owp/core 1.24.3 → 1.25.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@owp/core",
3
3
  "private": false,
4
- "version": "1.24.3",
4
+ "version": "1.25.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -1,628 +0,0 @@
1
- var P = Object.defineProperty;
2
- var v = (e, n, t) => n in e ? P(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
- var u = (e, n) => P(e, "name", { value: n, configurable: !0 });
4
- var g = (e, n, t) => v(e, typeof n != "symbol" ? n + "" : n, t);
5
- import { q as F, e as D, Y as E, Z as G, _, $, a0 as C, a1 as z, a2 as k, a3 as V, a4 as U, t as X, a5 as m, b as Y, a6 as Z, a7 as H, c as J, a8 as L, u as Q, a9 as j, aa as T, d as x, g as ee } from "./treeGridUtil-CGze1rYA.js";
6
- import * as ne from "@mui/material/colors";
7
- var Ae = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
8
- function Oe(e) {
9
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
10
- }
11
- u(Oe, "getDefaultExportFromCjs");
12
- function we(e) {
13
- if (e.__esModule) return e;
14
- var n = e.default;
15
- if (typeof n == "function") {
16
- var t = /* @__PURE__ */ u(function r() {
17
- return this instanceof r ? Reflect.construct(n, arguments, this.constructor) : n.apply(this, arguments);
18
- }, "a");
19
- t.prototype = n.prototype;
20
- } else t = {};
21
- return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
22
- var f = Object.getOwnPropertyDescriptor(e, r);
23
- Object.defineProperty(t, r, f.get ? f : {
24
- enumerable: !0,
25
- get: /* @__PURE__ */ u(function() {
26
- return e[r];
27
- }, "get")
28
- });
29
- }), t;
30
- }
31
- u(we, "getAugmentedNamespace");
32
- function S(e) {
33
- return e;
34
- }
35
- u(S, "identity");
36
- function N(e) {
37
- return function(n) {
38
- return F(n, e);
39
- };
40
- }
41
- u(N, "property");
42
- function A(e) {
43
- return e !== null && (typeof e == "object" || typeof e == "function");
44
- }
45
- u(A, "isObject");
46
- function te(e, n, t) {
47
- return typeof t != "function" ? I(e, n) : O(e, n, /* @__PURE__ */ u(function r(f, i, s, l, a, o) {
48
- const c = t(f, i, s, l, a, o);
49
- return c !== void 0 ? !!c : O(f, i, r, o);
50
- }, "doesMatch"), /* @__PURE__ */ new Map());
51
- }
52
- u(te, "isMatchWith");
53
- function O(e, n, t, r) {
54
- if (n === e)
55
- return !0;
56
- switch (typeof n) {
57
- case "object":
58
- return re(e, n, t, r);
59
- case "function":
60
- return Object.keys(n).length > 0 ? O(e, { ...n }, t, r) : D(e, n);
61
- default:
62
- return A(e) ? typeof n == "string" ? n === "" : !0 : D(e, n);
63
- }
64
- }
65
- u(O, "isMatchWithInternal");
66
- function re(e, n, t, r) {
67
- if (n == null)
68
- return !0;
69
- if (Array.isArray(n))
70
- return K(e, n, t, r);
71
- if (n instanceof Map)
72
- return ie(e, n, t, r);
73
- if (n instanceof Set)
74
- return fe(e, n, t, r);
75
- const f = Object.keys(n);
76
- if (e == null)
77
- return f.length === 0;
78
- if (f.length === 0)
79
- return !0;
80
- if (r && r.has(n))
81
- return r.get(n) === e;
82
- r && r.set(n, e);
83
- try {
84
- for (let i = 0; i < f.length; i++) {
85
- const s = f[i];
86
- if (!E(e) && !(s in e) || n[s] === void 0 && e[s] !== void 0 || n[s] === null && e[s] !== null || !t(e[s], n[s], s, e, n, r))
87
- return !1;
88
- }
89
- return !0;
90
- } finally {
91
- r && r.delete(n);
92
- }
93
- }
94
- u(re, "isObjectMatch");
95
- function ie(e, n, t, r) {
96
- if (n.size === 0)
97
- return !0;
98
- if (!(e instanceof Map))
99
- return !1;
100
- for (const [f, i] of n.entries()) {
101
- const s = e.get(f);
102
- if (t(s, i, f, e, n, r) === !1)
103
- return !1;
104
- }
105
- return !0;
106
- }
107
- u(ie, "isMapMatch");
108
- function K(e, n, t, r) {
109
- if (n.length === 0)
110
- return !0;
111
- if (!Array.isArray(e))
112
- return !1;
113
- const f = /* @__PURE__ */ new Set();
114
- for (let i = 0; i < n.length; i++) {
115
- const s = n[i];
116
- let l = !1;
117
- for (let a = 0; a < e.length; a++) {
118
- if (f.has(a))
119
- continue;
120
- const o = e[a];
121
- let c = !1;
122
- if (t(o, s, i, e, n, r) && (c = !0), c) {
123
- f.add(a), l = !0;
124
- break;
125
- }
126
- }
127
- if (!l)
128
- return !1;
129
- }
130
- return !0;
131
- }
132
- u(K, "isArrayMatch");
133
- function fe(e, n, t, r) {
134
- return n.size === 0 ? !0 : e instanceof Set ? K([...e], [...n], t, r) : !1;
135
- }
136
- u(fe, "isSetMatch");
137
- function I(e, n) {
138
- return te(e, n, () => {
139
- });
140
- }
141
- u(I, "isMatch");
142
- function R(e) {
143
- return e = G(e), (n) => I(n, e);
144
- }
145
- u(R, "matches");
146
- function se(e, n) {
147
- return _(e, (t, r, f, i) => {
148
- if (typeof e == "object")
149
- switch (Object.prototype.toString.call(e)) {
150
- case V:
151
- case k:
152
- case z: {
153
- const s = new e.constructor(e == null ? void 0 : e.valueOf());
154
- return C(s, e), s;
155
- }
156
- case $: {
157
- const s = {};
158
- return C(s, e), s.length = e.length, s[Symbol.iterator] = e[Symbol.iterator], s;
159
- }
160
- default:
161
- return;
162
- }
163
- });
164
- }
165
- u(se, "cloneDeepWith");
166
- function w(e) {
167
- return se(e);
168
- }
169
- u(w, "cloneDeep");
170
- const le = /^(?:0|[1-9]\d*)$/;
171
- function ue(e, n = Number.MAX_SAFE_INTEGER) {
172
- switch (typeof e) {
173
- case "number":
174
- return Number.isInteger(e) && e >= 0 && e < n;
175
- case "symbol":
176
- return !1;
177
- case "string":
178
- return le.test(e);
179
- }
180
- }
181
- u(ue, "isIndex");
182
- function ae(e, n) {
183
- let t;
184
- if (Array.isArray(n) ? t = n : typeof n == "string" && U(n) && (e == null ? void 0 : e[n]) == null ? t = X(n) : t = [n], t.length === 0)
185
- return !1;
186
- let r = e;
187
- for (let f = 0; f < t.length; f++) {
188
- const i = t[f];
189
- if ((r == null || !Object.hasOwn(r, i)) && !((Array.isArray(r) || m(r)) && ue(i) && i < r.length))
190
- return !1;
191
- r = r[i];
192
- }
193
- return !0;
194
- }
195
- u(ae, "has");
196
- function W(e, n) {
197
- switch (typeof e) {
198
- case "object": {
199
- Object.is(e == null ? void 0 : e.valueOf(), -0) && (e = "-0");
200
- break;
201
- }
202
- case "number": {
203
- e = Y(e);
204
- break;
205
- }
206
- }
207
- return n = w(n), function(t) {
208
- const r = F(t, e);
209
- return r === void 0 ? ae(t, e) : n === void 0 ? r === void 0 : I(r, n);
210
- };
211
- }
212
- u(W, "matchesProperty");
213
- function oe(e) {
214
- if (e == null)
215
- return S;
216
- switch (typeof e) {
217
- case "function":
218
- return e;
219
- case "object":
220
- return Array.isArray(e) && e.length === 2 ? W(e[0], e[1]) : R(e);
221
- case "string":
222
- case "symbol":
223
- case "number":
224
- return N(e);
225
- }
226
- }
227
- u(oe, "iteratee");
228
- function ce(e, n = S, t = 0) {
229
- if (!e)
230
- return;
231
- t < 0 && (t = Math.max(e.length + t, 0));
232
- const r = oe(n);
233
- if (typeof r == "function" && !Array.isArray(e)) {
234
- const i = Object.keys(e);
235
- for (let s = t; s < i.length; s++) {
236
- const l = i[s], a = e[l];
237
- if (r(a, l, e))
238
- return a;
239
- }
240
- return;
241
- }
242
- return (Array.isArray(e) ? e.slice(t) : Object.values(e).slice(t)).find(r);
243
- }
244
- u(ce, "find");
245
- function ye(e, n, t) {
246
- if (!e)
247
- return !1;
248
- n || (n = S);
249
- const r = Array.isArray(e) ? e : Object.values(e);
250
- switch (typeof n) {
251
- case "function": {
252
- if (!Array.isArray(e)) {
253
- const f = Object.keys(e);
254
- for (let i = 0; i < f.length; i++) {
255
- const s = f[i], l = e[s];
256
- if (n(l, s, e))
257
- return !0;
258
- }
259
- return !1;
260
- }
261
- for (let f = 0; f < e.length; f++)
262
- if (n(e[f], f, e))
263
- return !0;
264
- return !1;
265
- }
266
- case "object":
267
- if (Array.isArray(n) && n.length === 2) {
268
- const f = n[0], i = n[1], s = W(f, i);
269
- if (Array.isArray(e)) {
270
- for (let l = 0; l < e.length; l++)
271
- if (s(e[l]))
272
- return !0;
273
- return !1;
274
- }
275
- return r.some(s);
276
- } else {
277
- const f = R(n);
278
- if (Array.isArray(e)) {
279
- for (let i = 0; i < e.length; i++)
280
- if (f(e[i]))
281
- return !0;
282
- return !1;
283
- }
284
- return r.some(f);
285
- }
286
- case "number":
287
- case "symbol":
288
- case "string": {
289
- const f = N(n);
290
- if (Array.isArray(e)) {
291
- for (let i = 0; i < e.length; i++)
292
- if (f(e[i]))
293
- return !0;
294
- return !1;
295
- }
296
- return r.some(f);
297
- }
298
- }
299
- }
300
- u(ye, "some");
301
- function de(e) {
302
- if (E(e))
303
- return e;
304
- if (Array.isArray(e) || Z(e) || e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer)
305
- return e.slice(0);
306
- const n = Object.getPrototypeOf(e), t = n.constructor;
307
- if (e instanceof Date || e instanceof Map || e instanceof Set)
308
- return new t(e);
309
- if (e instanceof RegExp) {
310
- const r = new t(e);
311
- return r.lastIndex = e.lastIndex, r;
312
- }
313
- if (e instanceof DataView)
314
- return new t(e.buffer.slice(0));
315
- if (e instanceof Error) {
316
- const r = new t(e.message);
317
- return r.stack = e.stack, r.name = e.name, r.cause = e.cause, r;
318
- }
319
- if (typeof File < "u" && e instanceof File)
320
- return new t([e], e.name, { type: e.type, lastModified: e.lastModified });
321
- if (typeof e == "object") {
322
- const r = Object.create(n);
323
- return Object.assign(r, e);
324
- }
325
- return e;
326
- }
327
- u(de, "clone");
328
- function he(e, ...n) {
329
- const t = n.slice(0, -1), r = n[n.length - 1];
330
- let f = e;
331
- for (let i = 0; i < t.length; i++) {
332
- const s = t[i];
333
- f = y(f, s, r, /* @__PURE__ */ new Map());
334
- }
335
- return f;
336
- }
337
- u(he, "mergeWith");
338
- function y(e, n, t, r) {
339
- if (E(e) && (e = Object(e)), n == null || typeof n != "object")
340
- return e;
341
- if (r.has(n))
342
- return de(r.get(n));
343
- if (r.set(n, e), Array.isArray(n)) {
344
- n = n.slice();
345
- for (let i = 0; i < n.length; i++)
346
- n[i] = n[i] ?? void 0;
347
- }
348
- const f = [...Object.keys(n), ...H(n)];
349
- for (let i = 0; i < f.length; i++) {
350
- const s = f[i];
351
- if (J(s))
352
- continue;
353
- let l = n[s], a = e[s];
354
- if (m(l) && (l = { ...l }), m(a) && (a = { ...a }), typeof Buffer < "u" && Buffer.isBuffer(l) && (l = w(l)), Array.isArray(l))
355
- if (typeof a == "object" && a != null) {
356
- const c = [], h = Reflect.ownKeys(a);
357
- for (let p = 0; p < h.length; p++) {
358
- const B = h[p];
359
- c[B] = a[B];
360
- }
361
- a = c;
362
- } else
363
- a = [];
364
- const o = t(a, l, s, e, n, r);
365
- o !== void 0 ? e[s] = o : Array.isArray(l) || L(a) && L(l) ? e[s] = y(a, l, t, r) : a == null && Q(l) ? e[s] = y({}, l, t, r) : a == null && j(l) ? e[s] = w(l) : (a === void 0 || l !== void 0) && (e[s] = l);
366
- }
367
- return e;
368
- }
369
- u(y, "mergeWithDeep");
370
- function pe(e, ...n) {
371
- return he(e, ...n, T);
372
- }
373
- u(pe, "merge");
374
- function Me(e) {
375
- return e === null;
376
- }
377
- u(Me, "isNull");
378
- function Ee(e) {
379
- return x(e).toUpperCase();
380
- }
381
- u(Ee, "toUpper");
382
- const b = class b {
383
- constructor() {
384
- g(this, "events");
385
- this.events = {};
386
- }
387
- /**
388
- * The _getEventListByName method returns the event list for a given event name.
389
- * If the event list does not exist, it creates a new one.
390
- *
391
- */
392
- _getEventListByName(n) {
393
- return typeof this.events[n] > "u" && (this.events[n] = /* @__PURE__ */ new Set()), this.events[n];
394
- }
395
- /**
396
- * The on method registers a callback function for a given event name.
397
- *
398
- */
399
- on(n, t) {
400
- this._getEventListByName(n).add(t);
401
- }
402
- /**
403
- * The once method registers a callback function for a given event name that will only be called once.
404
- *
405
- */
406
- once(n, t) {
407
- const r = /* @__PURE__ */ u((...f) => {
408
- this.removeListener(n, r), t.apply(this, f);
409
- }, "onceFn");
410
- this.on(n, r);
411
- }
412
- /**
413
- * The emit method triggers all registered callback functions for a given event name.
414
- *
415
- */
416
- emit(n, ...t) {
417
- this._getEventListByName(n).forEach((r) => {
418
- r.apply(this, t);
419
- });
420
- }
421
- /**
422
- * The removeListener method removes a registered callback function for a given event name.
423
- *
424
- */
425
- removeListener(n, t) {
426
- this._getEventListByName(n).delete(t);
427
- }
428
- };
429
- u(b, "EventEmitter");
430
- let M = b;
431
- const d = class d {
432
- /**
433
- * The filterArrayByString function filters an array of objects by a search string.
434
- * It takes in an array of objects and a search string as parameters and returns a filtered array of objects.
435
- *
436
- */
437
- static filterArrayByString(n, t) {
438
- if (!t || (t == null ? void 0 : t.length) === 0 || !t)
439
- return n;
440
- t = t == null ? void 0 : t.toLowerCase();
441
- const r = n.filter((f) => this.searchInObj(f, t));
442
- return r.length === n.length ? n : r;
443
- }
444
- static filterArrayByString2(n, t) {
445
- return typeof t != "string" || t === "" ? n : (t = t == null ? void 0 : t.toLowerCase(), n.filter((r) => this.searchInObj(r, t)));
446
- }
447
- /**
448
- * The searchInObj function searches an object for a given search string.
449
- * It takes in an object and a search string as parameters and returns a boolean indicating whether the search string was found in the object.
450
- *
451
- */
452
- static searchInObj(n, t) {
453
- if (!f(n))
454
- return !1;
455
- const r = Object.keys(n);
456
- function f(i) {
457
- return !!(i && typeof i == "object" && !Array.isArray(i) && typeof i != "function");
458
- }
459
- u(f, "isRecord");
460
- for (let i = 0; i < r.length; i += 1) {
461
- const s = r[i], l = n[s];
462
- if (typeof l == "string") {
463
- if (this.searchInString(l, t))
464
- return !0;
465
- } else if (Array.isArray(l) && this.searchInArray(l, t))
466
- return !0;
467
- if (typeof l == "object" && this.searchInObj(l, t))
468
- return !0;
469
- }
470
- return !1;
471
- }
472
- /**
473
- * The searchInArray function searches an array for a given search string.
474
- * It takes in an array and a search string as parameters and returns a boolean indicating whether the search string was found in the array.
475
- *
476
- */
477
- static searchInArray(n, t) {
478
- return n.forEach((r) => !!(typeof r == "string" && this.searchInString(r, t) || r && typeof r == "object" && this.searchInObj(r, t))), !1;
479
- }
480
- /**
481
- * The searchInString function searches a string for a given search string.
482
- * It takes in a string and a search string as parameters and returns a boolean indicating whether the search string was found in the string.
483
- *
484
- */
485
- static searchInString(n, t) {
486
- return n.toLowerCase().includes(t);
487
- }
488
- /**
489
- * The generateGUID function generates a globally unique identifier.
490
- * It returns a string representing the GUID.
491
- *
492
- */
493
- static generateGUID() {
494
- function n() {
495
- return Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
496
- }
497
- return u(n, "S4"), n() + n();
498
- }
499
- /**
500
- * The toggleInArray function toggles an item in an array.
501
- */
502
- static toggleInArray(n, t) {
503
- t.indexOf(n) === -1 ? t.push(n) : t.splice(t.indexOf(n), 1);
504
- }
505
- /**
506
- * The handleize function converts a string to a handle.
507
- */
508
- static handleize(n) {
509
- return n.toString().toLowerCase().replace(/\s+/g, "-").replace(/\W+/g, "").replace(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
510
- }
511
- /**
512
- * The setRoutes function sets the routes for the Owp project.
513
- */
514
- static setRoutes(n, t = void 0) {
515
- let r = [];
516
- n != null && n.routes && (r = [...n.routes]);
517
- const f = /* @__PURE__ */ u((i, s) => {
518
- const l = i.auth || i.auth === null ? i.auth : s, a = pe({}, n.settings, i.settings), o = {
519
- ...i,
520
- settings: a,
521
- auth: l
522
- };
523
- return i.children && (o.children = i.children.map((c) => f(c, l))), o;
524
- }, "applyAuth");
525
- return r = r.map((i) => {
526
- const s = n.auth || n.auth === null ? n.auth : t || null;
527
- return f(i, s);
528
- }), [...r];
529
- }
530
- /**
531
- * The generateRoutesFromConfigs function generates routes from a set of route configurations.
532
- * It takes in an array of route configurations as a parameter and returns an array of routes.
533
- *
534
- */
535
- static generateRoutesFromConfigs(n, t) {
536
- let r = [];
537
- return n.forEach((f) => {
538
- r = [...r, ...this.setRoutes(f, t)];
539
- }), r;
540
- }
541
- /**
542
- * The findById function finds an object by its id.
543
- */
544
- static findById(n, t) {
545
- const r = ce(n, { id: t });
546
- if (r)
547
- return r;
548
- let f;
549
- return ye(n, (i) => i.children ? (f = this.findById(i.children, t), f) : !1), f;
550
- }
551
- /**
552
- * The randomMatColor function generates a random material color.
553
- */
554
- static randomMatColor(n = "400") {
555
- var f;
556
- const t = [
557
- "red",
558
- "pink",
559
- "purple",
560
- "deepPurple",
561
- "indigo",
562
- "blue",
563
- "lightBlue",
564
- "cyan",
565
- "teal",
566
- "green",
567
- "lightGreen",
568
- "lime",
569
- "yellow",
570
- "amber",
571
- "orange",
572
- "deepOrange"
573
- ], r = t[Math.floor(Math.random() * t.length)];
574
- return (f = ne[r]) == null ? void 0 : f[n];
575
- }
576
- /**
577
- * The findNavItemById function finds a navigation item by its id.
578
- */
579
- static difference(n, t) {
580
- function r(f, i) {
581
- return f == null ? void 0 : f.reduce((s, l, a) => (ee(l, i[a]) || (s[a] = A(l) && A(i[a]) ? r(l, i[a]) : l), s), {});
582
- }
583
- return u(r, "changes"), r(n, t);
584
- }
585
- /**
586
- * The hasPermission function checks if a user has permission to access a resource.
587
- */
588
- // @ts-expect-error
589
- static hasPermission(n, t) {
590
- var r;
591
- return n == null ? !0 : Array.isArray(n) && (n == null ? void 0 : n.length) === 0 ? !t || t.length === 0 : t && Array.isArray(n) && Array.isArray(t) ? n.some((f) => t.indexOf(f) >= 0) : typeof t == "string" && Array.isArray(n) ? (r = n == null ? void 0 : n.includes) == null ? void 0 : r.call(n, t) : !1;
592
- }
593
- /**
594
- * The filterArrayByString function filters an array of objects by a search string.
595
- */
596
- static filterRecursive(n, t) {
597
- return n ? n.reduce((r, f) => {
598
- let i = null;
599
- if (t(f) && (i = { ...f }), f.children != null) {
600
- const s = this.filterRecursive(f.children, t);
601
- s && (s == null ? void 0 : s.length) > 0 && (i = { ...f, children: s });
602
- }
603
- return i && r.push(i), r;
604
- }, []) : null;
605
- }
606
- };
607
- u(d, "OwpUtils"), /**
608
- * The EventEmitter class is a custom implementation of an event emitter.
609
- * It provides methods for registering and emitting events.
610
- */
611
- g(d, "EventEmitter", M);
612
- let q = d;
613
- export {
614
- M as E,
615
- q as O,
616
- ue as a,
617
- Oe as b,
618
- Ae as c,
619
- Me as d,
620
- oe as e,
621
- ce as f,
622
- we as g,
623
- S as h,
624
- A as i,
625
- pe as m,
626
- Ee as t
627
- };
628
- //# sourceMappingURL=OwpUtils-DgBOzRu6.js.map