@ldmjs/ui 1.0.21 → 1.0.22

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/README.md CHANGED
@@ -106,16 +106,36 @@ const vuetify = createVuetify({
106
106
  - ld-text-markup
107
107
  - ld-switch
108
108
  - ld-dialog
109
+ - ld-data-iterator
110
+ - ld-pager
109
111
 
110
112
  # Utilities
111
113
 
112
114
  - awaiting
113
- - isDefined
114
- - uidGen
115
+ - base64
116
+ .encode
117
+ .decode
118
+ .isValid
119
+ - cookie
120
+ .get
121
+ .set
122
+ .delete
115
123
  - delay
116
124
  - deepValueGetter
125
+ - isDefined
117
126
  - isObjectEmpty
118
- - datetime
127
+ - pluralizeNoun
128
+ - strings
129
+ .camelCase
130
+ .capitalize
131
+ - uidGen
132
+ - fileToArrayBuffer
133
+ - fileToBase64
134
+ - base64ToUint8Array
135
+ - Uint8ArrayToHex
136
+ - hexToArrayBuffer
137
+ - Uint8ArrayToBase64
138
+ - arrayBufferToUint8Array
119
139
 
120
140
  # Directives
121
141
  - v-active
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ import { Dialog } from './types/dialogs';
18
18
  */
19
19
  export declare function awaiting(callback: () => unknown): Promise<any>;
20
20
  /**
21
- * a = null (undefined, '', NaN) => isDefined(a) // false
21
+ * a = null (undefined, NaN) => isDefined(a) // false
22
22
  */
23
23
  export declare function isDefined(value: unknown): boolean;
24
24
  /**
@@ -44,24 +44,84 @@ export declare function deepValueGetter(obj: Record<string, unknown>, path: stri
44
44
  */
45
45
  export declare function isObjectEmpty(obj: Record<string, unknown>): boolean;
46
46
 
47
+ /**
48
+ * @param num кол-во элементов
49
+ * @param one название в единичном варианте (1 элемент, 21 элемент и тд)
50
+ * @param two название в двоичном варианте (2 элемента, 3 элемента и тд)
51
+ * @param five название во множественном варианте (5 элементов, много элементов)
52
+ * @param printNum выводить ли кол-во
53
+ */
47
54
  export declare function pluralizeNoun(
48
55
  num: string | number,
49
56
  one: string,
50
57
  two: string,
51
58
  five: string,
52
- printNum: boolean
59
+ printNum?: boolean
53
60
  ): string;
54
61
 
62
+ /* convert File or Blob to ArrayBuffer */
63
+ export declare function fileToArrayBuffer(value: File | Blob): Promise<ArrayBuffer>;
64
+ /* convert File or Blob to Base64 */
65
+ export declare function fileToBase64(value: File | Blob): Promise<string>;
66
+ /* convert Base64 string to Uint8Array */
67
+ export declare function base64ToUint8Array(base64: string): Uint8Array;
68
+ /* convert Uint8Array to Hexadecimal system */
69
+ export declare function Uint8ArrayToHex(bytes: Uint8Array): string;
70
+ /* convert a hex string to an ArrayBuffer */
71
+ export declare function hexToArrayBuffer(hex: string): Array<number>;
72
+ /* convert Uint8Array to Base64 */
73
+ export declare function Uint8ArrayToBase64(value: Uint8Array): string
74
+ /* convert ArrayBuffer to Uint8Array */
75
+ export declare function arrayBufferToUint8Array(value: ArrayBuffer): Uint8Array;
76
+
77
+ export declare const cookie: {
78
+ get: (key: string) => string;
79
+ set: (key: string, value: string, expires?: string) => void;
80
+ delete: (key: string) => void;
81
+ }
82
+
83
+ export declare const base64: {
84
+ encode: (input: string) => string;
85
+ decode: (input: string) => string;
86
+ isValid: (input: string) => boolean;
87
+ }
88
+
89
+ export declare const strings: {
90
+ camelCase: (str: string) => string;
91
+ capitalize: (str: string) => string;
92
+ }
93
+
55
94
  declare module '@vue/runtime-core' {
56
95
  export interface ComponentCustomProperties {
57
96
  $utils: {
58
- awaiting: typeof awaiting;
59
- isDefined: typeof isDefined;
60
- uidGen: typeof uidGen;
61
- delay: typeof delay;
62
- deepValueGetter: typeof deepValueGetter;
63
- isObjectEmpty: typeof isObjectEmpty;
64
- pluralizeNoun: typeof pluralizeNoun;
97
+ awaiting: (callback: () => unknown) => Promise<any>;
98
+ base64: {
99
+ encode: (input: string) => string;
100
+ decode: (input: string) => string;
101
+ isValid: (input: string) => boolean;
102
+ }
103
+ cookie: {
104
+ get: (key: string) => string;
105
+ set: (key: string, value: string, expires?: string) => void;
106
+ delete: (key: string) => void;
107
+ }
108
+ isDefined: (value: unknown) => boolean;
109
+ delay: (timeout: number) => Promise<void>;
110
+ deepValueGetter: (obj: Record<string, unknown>, path: string) => unknown;
111
+ isObjectEmpty: (obj: Record<string, unknown>) => boolean;
112
+ pluralizeNoun: (num: string | number,one: string,two: string, five: string, printNum?: boolean) => string;
113
+ strings: {
114
+ camelCase: (str: string) => string;
115
+ capitalize: (str: string) => string;
116
+ }
117
+ uidGen: (len?: number, format?: string) => string | number;
118
+ fileToArrayBuffer: (value: File | Blob) => Promise<ArrayBuffer>;
119
+ fileToBase64: (value: File | Blob) => Promise<string>;
120
+ base64ToUint8Array: (base64: string) => Uint8Array;
121
+ Uint8ArrayToHex: (bytes: Uint8Array) => string;
122
+ hexToArrayBuffer: (hex: string) => Array<number>;
123
+ Uint8ArrayToBase64: (value: Uint8Array) => string;
124
+ arrayBufferToUint8Array: (value: ArrayBuffer) => Uint8Array;
65
125
  };
66
126
  $ldmui: {
67
127
  options: ldmuiOptions;
package/dist/index.js CHANGED
@@ -250,18 +250,27 @@ __webpack_require__.d(__webpack_exports__, {
250
250
  ModalType: () => (/* reexport */ ModalType),
251
251
  PromptDialog: () => (/* reexport */ PromptDialog),
252
252
  SelectDialog: () => (/* reexport */ SelectDialog),
253
+ Uint8ArrayToHex: () => (/* reexport */ Uint8ArrayToHex),
253
254
  ValidateMixin: () => (/* reexport */ ValidateMixin),
254
255
  ValidateMixinOptions: () => (/* reexport */ ValidateMixinOptions),
255
256
  awaiting: () => (/* reexport */ awaiting),
257
+ base64: () => (/* reexport */ base64),
258
+ base64ToUint8Array: () => (/* reexport */ base64ToUint8Array),
259
+ cookie: () => (/* reexport */ cookie),
256
260
  deepValueGetter: () => (/* reexport */ deepValueGetter),
257
261
  "default": () => (/* binding */ src),
258
262
  defaults: () => (/* reexport */ defaults),
259
263
  delay: () => (/* reexport */ delay),
264
+ fileToArrayBuffer: () => (/* reexport */ fileToArrayBuffer),
265
+ fileToBase64: () => (/* reexport */ fileToBase64),
260
266
  getAliases: () => (/* reexport */ getAliases),
267
+ hexToArrayBuffer: () => (/* reexport */ hexToArrayBuffer),
261
268
  isDefined: () => (/* reexport */ isDefined),
262
269
  isObjectEmpty: () => (/* reexport */ isObjectEmpty),
263
270
  pluralizeNoun: () => (/* reexport */ pluralizeNoun),
271
+ strings: () => (/* reexport */ strings),
264
272
  uidGen: () => (/* reexport */ uidGen),
273
+ uint8ArrayToBase64: () => (/* reexport */ uint8ArrayToBase64),
265
274
  urlRegexp: () => (/* reexport */ urlRegexp)
266
275
  });
267
276
 
@@ -269,13 +278,22 @@ __webpack_require__.d(__webpack_exports__, {
269
278
  var src_utils_namespaceObject = {};
270
279
  __webpack_require__.r(src_utils_namespaceObject);
271
280
  __webpack_require__.d(src_utils_namespaceObject, {
281
+ Uint8ArrayToHex: () => (Uint8ArrayToHex),
272
282
  awaiting: () => (awaiting),
283
+ base64: () => (base64),
284
+ base64ToUint8Array: () => (base64ToUint8Array),
285
+ cookie: () => (cookie),
273
286
  deepValueGetter: () => (deepValueGetter),
274
287
  delay: () => (delay),
288
+ fileToArrayBuffer: () => (fileToArrayBuffer),
289
+ fileToBase64: () => (fileToBase64),
290
+ hexToArrayBuffer: () => (hexToArrayBuffer),
275
291
  isDefined: () => (isDefined),
276
292
  isObjectEmpty: () => (isObjectEmpty),
277
293
  pluralizeNoun: () => (pluralizeNoun),
294
+ strings: () => (strings),
278
295
  uidGen: () => (uidGen),
296
+ uint8ArrayToBase64: () => (uint8ArrayToBase64),
279
297
  urlRegexp: () => (urlRegexp)
280
298
  });
281
299
 
@@ -499,18 +517,6 @@ function isDefined(value) {
499
517
  return value !== null && value !== undefined && !isNaNValue;
500
518
  }
501
519
 
502
- ;// CONCATENATED MODULE: ./src/utils/zIndex.ts
503
- function getZIndex(el) {
504
- if (!el || el.nodeType !== Node.ELEMENT_NODE) {
505
- return 0;
506
- }
507
- const index = Number(window.getComputedStyle(el).getPropertyValue('z-index'));
508
- if (isNaN(index)) {
509
- return getZIndex(el.parentNode);
510
- }
511
- return index;
512
- }
513
-
514
520
  ;// CONCATENATED MODULE: ./node_modules/ts-loader/index.js??clonedRuleSet-1.use!./src/ld-loader/ld-loader.ts?vue&type=script&lang=ts&external
515
521
  var ld_loadervue_type_script_lang_ts_external_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
516
522
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -523,7 +529,6 @@ var ld_loadervue_type_script_lang_ts_external_metadata = (undefined && undefined
523
529
  };
524
530
 
525
531
 
526
-
527
532
  class LoaderComponent extends external_vue_property_decorator_.Vue {
528
533
  created() {
529
534
  if (!this.options.size) {
@@ -541,7 +546,7 @@ class LoaderComponent extends external_vue_property_decorator_.Vue {
541
546
  }
542
547
  get styles() {
543
548
  return {
544
- 'z-index': getZIndex(this.$parent.$el) + 2,
549
+ 'z-index': this.zIndex(this.$parent.$el) + 2,
545
550
  };
546
551
  }
547
552
  get size() {
@@ -573,6 +578,16 @@ class LoaderComponent extends external_vue_property_decorator_.Vue {
573
578
  classes.push(`loader__color-${this.color}`);
574
579
  return classes;
575
580
  }
581
+ zIndex(el) {
582
+ if (!el || el.nodeType !== Node.ELEMENT_NODE) {
583
+ return 0;
584
+ }
585
+ const index = Number(window.getComputedStyle(el).getPropertyValue('z-index'));
586
+ if (isNaN(index)) {
587
+ return this.zIndex(el.parentNode);
588
+ }
589
+ return index;
590
+ }
576
591
  }
577
592
  ld_loadervue_type_script_lang_ts_external_decorate([
578
593
  (0,external_vue_property_decorator_.Prop)({ type: Object, default: { size: 'big', bg: true } }),
@@ -10027,9 +10042,9 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
10027
10042
 
10028
10043
 
10029
10044
  /** Built-in value references. */
10030
- var Uint8Array = _root.Uint8Array;
10045
+ var _Uint8Array_Uint8Array = _root.Uint8Array;
10031
10046
 
10032
- /* harmony default export */ const _Uint8Array = (Uint8Array);
10047
+ /* harmony default export */ const _Uint8Array = (_Uint8Array_Uint8Array);
10033
10048
 
10034
10049
  ;// CONCATENATED MODULE: ./node_modules/lodash-es/_mapToArray.js
10035
10050
  /**
@@ -15344,6 +15359,364 @@ function ld_dialogvue_type_template_id_184339ee_ts_true_render(_ctx, _cache, $pr
15344
15359
 
15345
15360
  // EXTERNAL MODULE: ./node_modules/@ldmjs/core/dist/index.js
15346
15361
  var dist = __webpack_require__(634);
15362
+ ;// CONCATENATED MODULE: ./src/utils/awaiting.ts
15363
+ async function awaiting(callback) {
15364
+ let resolveFunc = null;
15365
+ const counter = 0;
15366
+ let timer = null;
15367
+ const promise = new Promise(resolve => {
15368
+ resolveFunc = resolve;
15369
+ });
15370
+ timer = setInterval(() => {
15371
+ const a = callback();
15372
+ if (counter > 100 || Boolean(a)) {
15373
+ clearInterval(timer);
15374
+ resolveFunc(a ?? true);
15375
+ }
15376
+ }, 100);
15377
+ await promise;
15378
+ }
15379
+
15380
+ ;// CONCATENATED MODULE: ./src/utils/base64.ts
15381
+ /* eslint-disable no-bitwise */
15382
+ class Base64Util {
15383
+ constructor() {
15384
+ this._keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
15385
+ }
15386
+ encode(input) {
15387
+ let output = '';
15388
+ let chr1, chr2, chr3, enc1, enc2, enc3, enc4;
15389
+ let i = 0;
15390
+ input = Base64Util._utf8_encode(input);
15391
+ while (i < input.length) {
15392
+ chr1 = input.charCodeAt(i++);
15393
+ chr2 = input.charCodeAt(i++);
15394
+ chr3 = input.charCodeAt(i++);
15395
+ enc1 = chr1 >> 2;
15396
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
15397
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
15398
+ enc4 = chr3 & 63;
15399
+ if (isNaN(chr2)) {
15400
+ enc3 = enc4 = 64;
15401
+ }
15402
+ else if (isNaN(chr3)) {
15403
+ enc4 = 64;
15404
+ }
15405
+ output =
15406
+ output +
15407
+ this._keyStr.charAt(enc1) +
15408
+ this._keyStr.charAt(enc2) +
15409
+ this._keyStr.charAt(enc3) +
15410
+ this._keyStr.charAt(enc4);
15411
+ }
15412
+ return output;
15413
+ }
15414
+ decode(input) {
15415
+ let output = '';
15416
+ let chr1, chr2, chr3;
15417
+ let enc1, enc2, enc3, enc4;
15418
+ let i = 0;
15419
+ input = input.replace(/[^\d+/=A-Za-z]/g, '');
15420
+ while (i < input.length) {
15421
+ enc1 = this._keyStr.indexOf(input.charAt(i++));
15422
+ enc2 = this._keyStr.indexOf(input.charAt(i++));
15423
+ enc3 = this._keyStr.indexOf(input.charAt(i++));
15424
+ enc4 = this._keyStr.indexOf(input.charAt(i++));
15425
+ chr1 = (enc1 << 2) | (enc2 >> 4);
15426
+ chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
15427
+ chr3 = ((enc3 & 3) << 6) | enc4;
15428
+ output = output + String.fromCharCode(chr1);
15429
+ if (enc3 !== 64) {
15430
+ output = output + String.fromCharCode(chr2);
15431
+ }
15432
+ if (enc4 !== 64) {
15433
+ output = output + String.fromCharCode(chr3);
15434
+ }
15435
+ }
15436
+ output = Base64Util._utf8_decode(output);
15437
+ return output;
15438
+ }
15439
+ static _utf8_encode(str) {
15440
+ str = str.replace(/\r\n/g, '\n');
15441
+ let utftext = '';
15442
+ for (let n = 0; n < str.length; n++) {
15443
+ const c = str.charCodeAt(n);
15444
+ if (c < 128) {
15445
+ utftext += String.fromCharCode(c);
15446
+ }
15447
+ else if (c > 127 && c < 2048) {
15448
+ utftext += String.fromCharCode((c >> 6) | 192);
15449
+ utftext += String.fromCharCode((c & 63) | 128);
15450
+ }
15451
+ else {
15452
+ utftext += String.fromCharCode((c >> 12) | 224);
15453
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
15454
+ utftext += String.fromCharCode((c & 63) | 128);
15455
+ }
15456
+ }
15457
+ return utftext;
15458
+ }
15459
+ static _utf8_decode(utftext) {
15460
+ let string = '';
15461
+ let i = 0;
15462
+ let c = 0;
15463
+ let c2 = 0;
15464
+ let c3 = 0;
15465
+ while (i < utftext.length) {
15466
+ c = utftext.charCodeAt(i);
15467
+ if (c < 128) {
15468
+ string += String.fromCharCode(c);
15469
+ i++;
15470
+ }
15471
+ else if (c > 191 && c < 224) {
15472
+ c2 = utftext.charCodeAt(i + 1);
15473
+ string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
15474
+ i += 2;
15475
+ }
15476
+ else {
15477
+ c2 = utftext.charCodeAt(i + 1);
15478
+ c3 = utftext.charCodeAt(i + 2);
15479
+ string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
15480
+ i += 3;
15481
+ }
15482
+ }
15483
+ return string;
15484
+ }
15485
+ isValid(value) {
15486
+ // eslint-disable-next-line optimize-regex/optimize-regex
15487
+ const base64Regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/gim;
15488
+ return base64Regex.test(value);
15489
+ }
15490
+ }
15491
+ const base64 = new Base64Util();
15492
+
15493
+
15494
+ ;// CONCATENATED MODULE: ./src/utils/cookie.ts
15495
+ class Cookie {
15496
+ get(key) {
15497
+ const _key = key.replace(/([$()*+./?[\\\]^{|}])/g, '\\$1');
15498
+ const matches = document.cookie.match(new RegExp('(?:^|; )' + _key + '=([^;]*)'));
15499
+ if (matches && matches[1] && matches[1].length) {
15500
+ return matches[1];
15501
+ }
15502
+ return null;
15503
+ }
15504
+ set(key, value, expires) {
15505
+ let time = 0;
15506
+ switch (expires) {
15507
+ case 'day':
15508
+ time = 1000 * 60 * 60 * 24;
15509
+ break;
15510
+ case 'month':
15511
+ time = 1000 * 60 * 60 * 24 * 30;
15512
+ break;
15513
+ }
15514
+ let exp = '';
15515
+ if (time) {
15516
+ time = Date.now() + time;
15517
+ exp = new Date(time).toUTCString();
15518
+ }
15519
+ document.cookie = key + '=' + value + '; path=/; expires=' + exp;
15520
+ }
15521
+ delete(key) {
15522
+ document.cookie = key + '=; path=/; expires=-1';
15523
+ }
15524
+ }
15525
+ const cookie = new Cookie();
15526
+
15527
+
15528
+ ;// CONCATENATED MODULE: ./src/utils/converting.ts
15529
+ function fileToArrayBuffer(src) {
15530
+ return new Promise(resolve => {
15531
+ const reader = new FileReader();
15532
+ reader.onloadend = function () {
15533
+ resolve(reader.result);
15534
+ };
15535
+ reader.readAsArrayBuffer(src);
15536
+ });
15537
+ }
15538
+ function fileToBase64(file) {
15539
+ return new Promise((resolve, reject) => {
15540
+ const reader = new FileReader();
15541
+ reader.readAsDataURL(file);
15542
+ reader.onload = () => {
15543
+ let fileStr = reader.result.toString();
15544
+ if (fileStr.includes(',')) {
15545
+ fileStr = fileStr.split(',')[1];
15546
+ }
15547
+ resolve(fileStr);
15548
+ };
15549
+ reader.onerror = error => reject(error);
15550
+ });
15551
+ }
15552
+ function base64ToUint8Array(base64) {
15553
+ if (!base64.trim()) {
15554
+ return null;
15555
+ }
15556
+ const decrypted = window.atob(base64);
15557
+ let n = decrypted.length;
15558
+ const arr = new Uint8Array(n);
15559
+ while (n--) {
15560
+ arr[n] = decrypted.charCodeAt(n);
15561
+ }
15562
+ return arr;
15563
+ }
15564
+ function Uint8ArrayToHex(bytes) {
15565
+ const hex = [];
15566
+ /* eslint-disable-next-line @typescript-eslint/prefer-for-of */
15567
+ for (let i = 0; i < bytes.length; i++) {
15568
+ const current = bytes[i] < 0 ? bytes[i] + 256 : bytes[i];
15569
+ /* eslint-disable-next-line no-bitwise */
15570
+ hex.push((current >>> 4).toString(16));
15571
+ /* eslint-disable-next-line no-bitwise */
15572
+ hex.push((current & 0xf).toString(16));
15573
+ }
15574
+ return hex.join('');
15575
+ }
15576
+ function hexToArrayBuffer(hex) {
15577
+ hex = hex.replace(/^0x/, '');
15578
+ if (hex.length % 2 != 0) {
15579
+ // console.log('WARNING: expecting an even number of characters in the hexString');
15580
+ }
15581
+ const bad = hex.match(/[\sg-z]/i);
15582
+ if (bad) {
15583
+ // console.log('WARNING: found non-hex characters', bad);
15584
+ }
15585
+ const pairs = hex.match(/[\da-f]{2}/gi);
15586
+ const result = [];
15587
+ for (const s of pairs) {
15588
+ result.push(parseInt(s, 16));
15589
+ }
15590
+ return result;
15591
+ }
15592
+ function uint8ArrayToBase64(value) {
15593
+ const bin = value.reduce((acc, i) => (acc += String.fromCharCode.apply(null, [i])), '');
15594
+ return window.btoa(bin);
15595
+ }
15596
+ function arrayBufferToUint8Array(value) {
15597
+ return new Uint8Array(value);
15598
+ }
15599
+
15600
+
15601
+ ;// CONCATENATED MODULE: ./src/utils/deepValueGetter.ts
15602
+ /**
15603
+ * Returns a deep object given a string. zoo['animal.type']
15604
+ * @param {object} obj
15605
+ * @param {string} path
15606
+ */
15607
+ function deepValueGetter(obj, path) {
15608
+ if (obj === null) {
15609
+ return '';
15610
+ }
15611
+ if (!obj || !path) {
15612
+ return obj;
15613
+ }
15614
+ const value = obj[path];
15615
+ // eslint-disable-next-line no-undefined
15616
+ if (value !== undefined) {
15617
+ return value;
15618
+ }
15619
+ let current = obj;
15620
+ const split = path.split('.');
15621
+ if (split.length) {
15622
+ for (const key of split) {
15623
+ current = current[key];
15624
+ // if found undefined, return empty string
15625
+ // eslint-disable-next-line no-undefined
15626
+ if (current === undefined || current === null) {
15627
+ return '';
15628
+ }
15629
+ }
15630
+ }
15631
+ return current;
15632
+ }
15633
+
15634
+ ;// CONCATENATED MODULE: ./src/utils/delay.ts
15635
+ async function delay(timeout) {
15636
+ return new Promise(resolve => setTimeout(() => resolve(), timeout));
15637
+ }
15638
+
15639
+ ;// CONCATENATED MODULE: ./src/utils/isObjectEmpty.ts
15640
+ function isObjectEmpty(obj) {
15641
+ for (const _i in obj) {
15642
+ return false;
15643
+ }
15644
+ return true;
15645
+ }
15646
+
15647
+ ;// CONCATENATED MODULE: ./src/utils/pluralizeNoun.ts
15648
+ function pluralizeNoun(num, one, two, five, printNum = true) {
15649
+ if (!num) {
15650
+ return '';
15651
+ }
15652
+ let n;
15653
+ if (typeof num === 'string') {
15654
+ n = Number(num.match(/\d+\.?\d*/g));
15655
+ }
15656
+ else {
15657
+ n = Math.abs(num);
15658
+ }
15659
+ n %= 100;
15660
+ if (n >= 5 && n <= 20) {
15661
+ return printNum ? `${num} ${five}` : `${five}`;
15662
+ }
15663
+ n %= 10;
15664
+ if (n === 1) {
15665
+ return printNum ? `${num} ${one}` : `${one}`;
15666
+ }
15667
+ if (n >= 2 && n <= 4) {
15668
+ return printNum ? `${num} ${two}` : `${two}`;
15669
+ }
15670
+ return printNum ? `${num} ${five}` : `${five}`;
15671
+ }
15672
+
15673
+ ;// CONCATENATED MODULE: ./src/utils/strings.ts
15674
+ class Strings {
15675
+ camelCase(str) {
15676
+ // Replace special characters with a space
15677
+ str = str.replace(/[^\d A-Za-z]/g, ' ');
15678
+ // put a space before an uppercase letter
15679
+ str = str.replace(/([a-z](?=[A-Z]))/g, '$1 ');
15680
+ // Lower case first character and some other stuff
15681
+ str = str
15682
+ .replace(/([^\d A-Za-z])|^\d+/g, '')
15683
+ .trim()
15684
+ .toLowerCase();
15685
+ // uppercase characters preceded by a space or number
15686
+ str = str.replace(/([\d ]+)([A-Za-z])/g, (a, b, c) => b.trim() + c.toUpperCase());
15687
+ return str;
15688
+ }
15689
+ capitalize(str) {
15690
+ if (!str) {
15691
+ return str;
15692
+ }
15693
+ const first = str[0];
15694
+ const other = str.substring(1);
15695
+ return `${first.toUpperCase()}${other}`;
15696
+ }
15697
+ }
15698
+ const strings = new Strings();
15699
+
15700
+
15701
+ ;// CONCATENATED MODULE: ./src/utils/urlRegexp.ts
15702
+ const urlRegexp =
15703
+ // eslint-disable-next-line optimize-regex/optimize-regex
15704
+ /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\\[\]{};:'".,<>?«»“”‘’]))/i;
15705
+
15706
+ ;// CONCATENATED MODULE: ./src/utils/index.ts
15707
+
15708
+
15709
+
15710
+
15711
+
15712
+
15713
+
15714
+
15715
+
15716
+
15717
+
15718
+
15719
+
15347
15720
  ;// CONCATENATED MODULE: ./src/ld-dialog/dialog.manager.ts
15348
15721
 
15349
15722
 
@@ -16839,26 +17212,6 @@ IteratorItemComponent = IteratorItemComponent_1 = iteratorItem_decorate([
16839
17212
  ], IteratorItemComponent);
16840
17213
  /* harmony default export */ const iteratorItem = (IteratorItemComponent);
16841
17214
 
16842
- ;// CONCATENATED MODULE: ./src/utils/strings.ts
16843
- function camelCase(str) {
16844
- // Replace special characters with a space
16845
- str = str.replace(/[^\d A-Za-z]/g, ' ');
16846
- // put a space before an uppercase letter
16847
- str = str.replace(/([a-z](?=[A-Z]))/g, '$1 ');
16848
- // Lower case first character and some other stuff
16849
- str = str
16850
- .replace(/([^\d A-Za-z])|^\d+/g, '')
16851
- .trim()
16852
- .toLowerCase();
16853
- // uppercase characters preceded by a space or number
16854
- str = str.replace(/([\d ]+)([A-Za-z])/g, (a, b, c) => b.trim() + c.toUpperCase());
16855
- return str;
16856
- }
16857
- const strings = {
16858
- camelCase
16859
- };
16860
-
16861
-
16862
17215
  ;// CONCATENATED MODULE: ./src/ld-data-iterator/prefixes.ts
16863
17216
  /* eslint-disable no-undefined */
16864
17217
 
@@ -18196,32 +18549,6 @@ function ld_pagervue_type_template_id_03c82e7a_render(_ctx, _cache, $props, $set
18196
18549
  }
18197
18550
  ;// CONCATENATED MODULE: ./src/ld-pager/ld-pager.vue?vue&type=template&id=03c82e7a
18198
18551
 
18199
- ;// CONCATENATED MODULE: ./src/utils/pluralizeNoun.ts
18200
- function pluralizeNoun(num, one, two, five, printNum = true) {
18201
- if (!num) {
18202
- return '';
18203
- }
18204
- let n;
18205
- if (typeof num === 'string') {
18206
- n = Number(num.match(/\d+\.?\d*/g));
18207
- }
18208
- else {
18209
- n = Math.abs(num);
18210
- }
18211
- n %= 100;
18212
- if (n >= 5 && n <= 20) {
18213
- return printNum ? `${num} ${five}` : `${five}`;
18214
- }
18215
- n %= 10;
18216
- if (n === 1) {
18217
- return printNum ? `${num} ${one}` : `${one}`;
18218
- }
18219
- if (n >= 2 && n <= 4) {
18220
- return printNum ? `${num} ${two}` : `${two}`;
18221
- }
18222
- return printNum ? `${num} ${five}` : `${five}`;
18223
- }
18224
-
18225
18552
  ;// CONCATENATED MODULE: ./node_modules/ts-loader/index.js??clonedRuleSet-1.use!./src/ld-pager/ld-pager.ts?vue&type=script&lang=js&external
18226
18553
  var ld_pagervue_type_script_lang_js_external_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
18227
18554
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -18472,87 +18799,6 @@ function ld_pager_reg(vue, options) {
18472
18799
  // EXTERNAL MODULE: external "vue-toastification"
18473
18800
  var external_vue_toastification_ = __webpack_require__(7982);
18474
18801
  var external_vue_toastification_default = /*#__PURE__*/__webpack_require__.n(external_vue_toastification_);
18475
- ;// CONCATENATED MODULE: ./src/utils/awaiting.ts
18476
- async function awaiting(callback) {
18477
- let resolveFunc = null;
18478
- const counter = 0;
18479
- let timer = null;
18480
- const promise = new Promise(resolve => {
18481
- resolveFunc = resolve;
18482
- });
18483
- timer = setInterval(() => {
18484
- const a = callback();
18485
- if (counter > 100 || Boolean(a)) {
18486
- clearInterval(timer);
18487
- resolveFunc(a ?? true);
18488
- }
18489
- }, 100);
18490
- await promise;
18491
- }
18492
-
18493
- ;// CONCATENATED MODULE: ./src/utils/deepValueGetter.ts
18494
- /**
18495
- * Returns a deep object given a string. zoo['animal.type']
18496
- * @param {object} obj
18497
- * @param {string} path
18498
- */
18499
- function deepValueGetter(obj, path) {
18500
- if (obj === null) {
18501
- return '';
18502
- }
18503
- if (!obj || !path) {
18504
- return obj;
18505
- }
18506
- // check if path matches a root-level field
18507
- // { "a.b.c": 123 }
18508
- const value = obj[path];
18509
- // eslint-disable-next-line no-undefined
18510
- if (value !== undefined) {
18511
- return value;
18512
- }
18513
- let current = obj;
18514
- const split = path.split('.');
18515
- if (split.length) {
18516
- for (const key of split) {
18517
- current = current[key];
18518
- // if found undefined, return empty string
18519
- // eslint-disable-next-line no-undefined
18520
- if (current === undefined || current === null) {
18521
- return '';
18522
- }
18523
- }
18524
- }
18525
- return current;
18526
- }
18527
-
18528
- ;// CONCATENATED MODULE: ./src/utils/delay.ts
18529
- async function delay(timeout) {
18530
- return new Promise(resolve => setTimeout(() => resolve(), timeout));
18531
- }
18532
-
18533
- ;// CONCATENATED MODULE: ./src/utils/isObjectEmpty.ts
18534
- function isObjectEmpty(obj) {
18535
- for (const _i in obj) {
18536
- return false;
18537
- }
18538
- return true;
18539
- }
18540
-
18541
- ;// CONCATENATED MODULE: ./src/utils/urlRegexp.ts
18542
- const urlRegexp =
18543
- // eslint-disable-next-line optimize-regex/optimize-regex
18544
- /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\\[\]{};:'".,<>?«»“”‘’]))/i;
18545
-
18546
- ;// CONCATENATED MODULE: ./src/utils/index.ts
18547
-
18548
-
18549
-
18550
-
18551
-
18552
-
18553
-
18554
-
18555
-
18556
18802
  ;// CONCATENATED MODULE: ./src/vuetify.ts
18557
18803
  const aliases = {
18558
18804
  SmallButton: 'VBtn',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldmjs/ui",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "ldm ui",
5
5
  "main": "dist/index.js",
6
6
  "engines": {