@libs-ui/utils 0.2.304 → 0.2.306-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.
- package/dom.d.ts +23 -5
- package/esm2022/cache.mjs +4 -3
- package/esm2022/dom.mjs +125 -7
- package/esm2022/file.mjs +3 -2
- package/esm2022/helpers.mjs +30 -20
- package/fesm2022/libs-ui-utils.mjs +231 -101
- package/fesm2022/libs-ui-utils.mjs.map +1 -1
- package/file.d.ts +1 -1
- package/helpers.d.ts +4 -3
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fromEvent, tap, takeUntil, mergeMap, startWith, finalize, Subject, filter, Observable } from 'rxjs';
|
|
2
|
-
import Quill from 'quill';
|
|
3
1
|
import DeviceDetector from 'device-detector-js';
|
|
2
|
+
import Quill from 'quill';
|
|
3
|
+
import { fromEvent, tap, takeUntil, mergeMap, startWith, finalize, lastValueFrom, timer, Subject, filter, Observable } from 'rxjs';
|
|
4
4
|
import CryptoES from 'crypto-es';
|
|
5
5
|
import { HttpParams } from '@angular/common/http';
|
|
6
6
|
import { isSignal, TemplateRef, ElementRef, signal, InjectionToken } from '@angular/core';
|
|
@@ -352,18 +352,136 @@ const getDragEventByElement = (config) => {
|
|
|
352
352
|
? mousemove.pipe(startWith(e))
|
|
353
353
|
: mousemove), takeUntil(config.onDestroy), finalize(removeClass));
|
|
354
354
|
};
|
|
355
|
-
const getHTMLFromQuill = (
|
|
355
|
+
const getHTMLFromQuill = async (data, options) => {
|
|
356
|
+
const { replaceNewLineTo = '<br>', replaceTagBRTo, replaceTags, replaceBrToDiv } = options || {};
|
|
357
|
+
const delta = (typeof data === 'string') ? await getDeltaFromHTML(data) : data;
|
|
358
|
+
if (options?.functionReplaceDelta) {
|
|
359
|
+
options.functionReplaceDelta(delta);
|
|
360
|
+
}
|
|
356
361
|
delta.ops.forEach((op) => {
|
|
357
362
|
if (op.insert) {
|
|
358
363
|
if (typeof op.insert === 'string') {
|
|
359
|
-
|
|
364
|
+
if (replaceNewLineTo) {
|
|
365
|
+
op.insert = op.insert.replace(/\n/g, replaceNewLineTo);
|
|
366
|
+
}
|
|
367
|
+
if (replaceTagBRTo) {
|
|
368
|
+
op.insert = op.insert.replace(/<br>/g, replaceTagBRTo);
|
|
369
|
+
}
|
|
370
|
+
if (replaceTags?.length) {
|
|
371
|
+
for (const tag of replaceTags) {
|
|
372
|
+
op.insert = op.insert.replace(new RegExp(`<${tag.tag}>`, 'g'), `<${tag.replaceTo}>`);
|
|
373
|
+
op.insert = op.insert.replace(new RegExp(`</${tag.tag}>`, 'g'), `</${tag.replaceTo}>`);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
360
376
|
}
|
|
361
377
|
}
|
|
362
378
|
});
|
|
363
379
|
quill.setContents(delta);
|
|
364
|
-
|
|
380
|
+
let htmlText = options?.getRootHtml ? quill.root.innerHTML : quill.root.firstElementChild?.innerHTML;
|
|
381
|
+
if (replaceBrToDiv) {
|
|
382
|
+
htmlText = convertHtmlToDivBlocks(htmlText || '');
|
|
383
|
+
}
|
|
365
384
|
return decodeEscapeHtml(htmlText || '');
|
|
366
385
|
};
|
|
386
|
+
const convertHtmlToDivBlocks = (html) => {
|
|
387
|
+
const BREAK_TOKEN = '<<<BREAK>>>';
|
|
388
|
+
// Bước 1: thay <br> thành token tạm
|
|
389
|
+
const normalizedHtml = html.replace(/<br\s*\/?>/gi, BREAK_TOKEN);
|
|
390
|
+
// Bước 2: tách theo token
|
|
391
|
+
const parts = normalizedHtml.split(BREAK_TOKEN);
|
|
392
|
+
const parser = new DOMParser();
|
|
393
|
+
const divs = [];
|
|
394
|
+
for (const raw of parts) {
|
|
395
|
+
const trimmed = raw.trim();
|
|
396
|
+
if (!trimmed)
|
|
397
|
+
continue;
|
|
398
|
+
// parse mỗi phần nhỏ như một document riêng
|
|
399
|
+
const doc = parser.parseFromString(trimmed, 'text/html');
|
|
400
|
+
const body = doc.body;
|
|
401
|
+
// Lấy lại nội dung bên trong body
|
|
402
|
+
divs.push(`<div>${body.innerHTML}</div>`);
|
|
403
|
+
}
|
|
404
|
+
return divs.join('');
|
|
405
|
+
};
|
|
406
|
+
const getDeltaFromHTML = async (html) => {
|
|
407
|
+
quill.root.innerHTML = html;
|
|
408
|
+
setTimeout(() => {
|
|
409
|
+
console.log(quill.getContents());
|
|
410
|
+
}, 1000);
|
|
411
|
+
await lastValueFrom(timer(1000));
|
|
412
|
+
return quill.getContents();
|
|
413
|
+
};
|
|
414
|
+
const processPasteData = async (e, config) => {
|
|
415
|
+
const element = config.element;
|
|
416
|
+
const files = e.clipboardData?.files;
|
|
417
|
+
if (files?.length) {
|
|
418
|
+
e.preventDefault();
|
|
419
|
+
config.handlerPasteFile?.(files);
|
|
420
|
+
config.callBack?.('file');
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
// Lưu selection TRƯỚC khi prevent default
|
|
424
|
+
const selection = window.getSelection();
|
|
425
|
+
let savedRange = null;
|
|
426
|
+
if (selection && selection.rangeCount > 0) {
|
|
427
|
+
const range = selection.getRangeAt(0);
|
|
428
|
+
// Chỉ lưu nếu range nằm trong contentText element
|
|
429
|
+
const container = range.commonAncestorContainer;
|
|
430
|
+
const isInContentElement = element.contains(container.nodeType === Node.TEXT_NODE ? container.parentNode : container);
|
|
431
|
+
if (isInContentElement) {
|
|
432
|
+
savedRange = range.cloneRange();
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
// Prevent default để tự xử lý paste
|
|
436
|
+
e.preventDefault();
|
|
437
|
+
// Sử dụng Quill để clean HTML content
|
|
438
|
+
const htmlContent = e.clipboardData?.getData('text/html') || '';
|
|
439
|
+
const plainText = e.clipboardData?.getData('text/plain') || '';
|
|
440
|
+
let contentToInsert = (plainText || '').replace(/\n/g, '<br>');
|
|
441
|
+
if (htmlContent) {
|
|
442
|
+
contentToInsert = await getHTMLFromQuill(htmlContent);
|
|
443
|
+
}
|
|
444
|
+
if (!contentToInsert) {
|
|
445
|
+
config.callBack?.('no-content');
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
if (savedRange) {
|
|
449
|
+
insertContentWithRange(contentToInsert, savedRange, element);
|
|
450
|
+
config.callBack?.('range');
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
element.innerHTML += contentToInsert;
|
|
454
|
+
config.callBack?.('content');
|
|
455
|
+
};
|
|
456
|
+
const insertContentWithRange = (content, savedRange, element) => {
|
|
457
|
+
const selection = window.getSelection();
|
|
458
|
+
if (!selection) {
|
|
459
|
+
// Fallback: append vào cuối
|
|
460
|
+
element.innerHTML += content;
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
// Restore selection
|
|
464
|
+
selection.removeAllRanges();
|
|
465
|
+
selection.addRange(savedRange);
|
|
466
|
+
// Xóa nội dung đã select (nếu có)
|
|
467
|
+
savedRange.deleteContents();
|
|
468
|
+
// Tạo document fragment từ HTML content
|
|
469
|
+
const tempDiv = document.createElement('div');
|
|
470
|
+
tempDiv.innerHTML = content;
|
|
471
|
+
const fragment = document.createDocumentFragment();
|
|
472
|
+
while (tempDiv.firstChild) {
|
|
473
|
+
fragment.appendChild(tempDiv.firstChild);
|
|
474
|
+
}
|
|
475
|
+
// Insert fragment tại vị trí range
|
|
476
|
+
savedRange.insertNode(fragment);
|
|
477
|
+
// Di chuyển cursor đến cuối nội dung vừa insert
|
|
478
|
+
if (fragment.lastChild) {
|
|
479
|
+
savedRange.setStartAfter(fragment.lastChild);
|
|
480
|
+
}
|
|
481
|
+
savedRange.collapse(true);
|
|
482
|
+
selection.removeAllRanges();
|
|
483
|
+
selection.addRange(savedRange);
|
|
484
|
+
};
|
|
367
485
|
|
|
368
486
|
class UtilsUrlSearchParams {
|
|
369
487
|
static instance;
|
|
@@ -519,85 +637,6 @@ const uuid = () => {
|
|
|
519
637
|
return md5(shuffledString);
|
|
520
638
|
};
|
|
521
639
|
|
|
522
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
523
|
-
const UtilsHttpParamsRequestInstance = (options, instance) => {
|
|
524
|
-
return new UtilsHttpParamsRequest(options, instance);
|
|
525
|
-
};
|
|
526
|
-
class UtilsHttpParamsRequest extends HttpParams {
|
|
527
|
-
params = new HttpParams();
|
|
528
|
-
constructor(options, instance) {
|
|
529
|
-
super(options);
|
|
530
|
-
if (!instance) {
|
|
531
|
-
this.params = new HttpParams(options);
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
if (instance instanceof UtilsHttpParamsRequest) {
|
|
535
|
-
this.params = instance.getInstance();
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
if (instance instanceof HttpParams) {
|
|
539
|
-
this.params = instance;
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
getInstance() {
|
|
544
|
-
return this.params;
|
|
545
|
-
}
|
|
546
|
-
setInstance(instance) {
|
|
547
|
-
if (instance instanceof UtilsHttpParamsRequest) {
|
|
548
|
-
this.params = instance.getInstance();
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
if (instance instanceof HttpParams) {
|
|
552
|
-
this.params = instance;
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
set(param, value) {
|
|
557
|
-
this.params = this.params.set(param, value);
|
|
558
|
-
return this;
|
|
559
|
-
}
|
|
560
|
-
has(param) {
|
|
561
|
-
return this.params.has(param);
|
|
562
|
-
}
|
|
563
|
-
get(param) {
|
|
564
|
-
return this.params.get(param);
|
|
565
|
-
}
|
|
566
|
-
getAll(param) {
|
|
567
|
-
return this.params.getAll(param);
|
|
568
|
-
}
|
|
569
|
-
keys() {
|
|
570
|
-
return this.params.keys();
|
|
571
|
-
}
|
|
572
|
-
append(param, value) {
|
|
573
|
-
this.params = this.params.append(param, value);
|
|
574
|
-
return this;
|
|
575
|
-
}
|
|
576
|
-
appendAll(params) {
|
|
577
|
-
this.params = this.params.appendAll(params);
|
|
578
|
-
return this;
|
|
579
|
-
}
|
|
580
|
-
delete(param, value) {
|
|
581
|
-
this.params = this.params.delete(param, value);
|
|
582
|
-
return this;
|
|
583
|
-
}
|
|
584
|
-
toString() {
|
|
585
|
-
return this.params.toString();
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
// Demo su dung GET_PATH_VARIABLE
|
|
589
|
-
// interface Person {
|
|
590
|
-
// name: string;
|
|
591
|
-
// age: number;
|
|
592
|
-
// location: string;
|
|
593
|
-
// }
|
|
594
|
-
// type c = GET_PATH_VARIABLE<Person, unknown>;
|
|
595
|
-
// const a: c = {
|
|
596
|
-
// "pathVariable-age": 1,
|
|
597
|
-
// "pathVariable-location": '12',
|
|
598
|
-
// "pathVariable-name": '124',
|
|
599
|
-
// };
|
|
600
|
-
|
|
601
640
|
let key = '12~@#loqwsxacva(3rdhaq12';
|
|
602
641
|
/**
|
|
603
642
|
* @description Thiết lập key mã hóa
|
|
@@ -1231,8 +1270,9 @@ class UtilsCache {
|
|
|
1231
1270
|
resolve({ deleteSuccess: true });
|
|
1232
1271
|
};
|
|
1233
1272
|
request.onerror = (event) => {
|
|
1234
|
-
|
|
1235
|
-
|
|
1273
|
+
const error = event.target.error;
|
|
1274
|
+
console.trace('Error deleting database:', error);
|
|
1275
|
+
resolve({ messageError: get(error || {}, 'message'), deleteSuccess: false });
|
|
1236
1276
|
};
|
|
1237
1277
|
request.onblocked = () => {
|
|
1238
1278
|
console.trace('Delete request is blocked');
|
|
@@ -1421,6 +1461,85 @@ const getFormatData = (type, lang) => {
|
|
|
1421
1461
|
}
|
|
1422
1462
|
};
|
|
1423
1463
|
|
|
1464
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1465
|
+
const UtilsHttpParamsRequestInstance = (options, instance) => {
|
|
1466
|
+
return new UtilsHttpParamsRequest(options, instance);
|
|
1467
|
+
};
|
|
1468
|
+
class UtilsHttpParamsRequest extends HttpParams {
|
|
1469
|
+
params = new HttpParams();
|
|
1470
|
+
constructor(options, instance) {
|
|
1471
|
+
super(options);
|
|
1472
|
+
if (!instance) {
|
|
1473
|
+
this.params = new HttpParams(options);
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
if (instance instanceof UtilsHttpParamsRequest) {
|
|
1477
|
+
this.params = instance.getInstance();
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
if (instance instanceof HttpParams) {
|
|
1481
|
+
this.params = instance;
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
getInstance() {
|
|
1486
|
+
return this.params;
|
|
1487
|
+
}
|
|
1488
|
+
setInstance(instance) {
|
|
1489
|
+
if (instance instanceof UtilsHttpParamsRequest) {
|
|
1490
|
+
this.params = instance.getInstance();
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1493
|
+
if (instance instanceof HttpParams) {
|
|
1494
|
+
this.params = instance;
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
set(param, value) {
|
|
1499
|
+
this.params = this.params.set(param, value);
|
|
1500
|
+
return this;
|
|
1501
|
+
}
|
|
1502
|
+
has(param) {
|
|
1503
|
+
return this.params.has(param);
|
|
1504
|
+
}
|
|
1505
|
+
get(param) {
|
|
1506
|
+
return this.params.get(param);
|
|
1507
|
+
}
|
|
1508
|
+
getAll(param) {
|
|
1509
|
+
return this.params.getAll(param);
|
|
1510
|
+
}
|
|
1511
|
+
keys() {
|
|
1512
|
+
return this.params.keys();
|
|
1513
|
+
}
|
|
1514
|
+
append(param, value) {
|
|
1515
|
+
this.params = this.params.append(param, value);
|
|
1516
|
+
return this;
|
|
1517
|
+
}
|
|
1518
|
+
appendAll(params) {
|
|
1519
|
+
this.params = this.params.appendAll(params);
|
|
1520
|
+
return this;
|
|
1521
|
+
}
|
|
1522
|
+
delete(param, value) {
|
|
1523
|
+
this.params = this.params.delete(param, value);
|
|
1524
|
+
return this;
|
|
1525
|
+
}
|
|
1526
|
+
toString() {
|
|
1527
|
+
return this.params.toString();
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
// Demo su dung GET_PATH_VARIABLE
|
|
1531
|
+
// interface Person {
|
|
1532
|
+
// name: string;
|
|
1533
|
+
// age: number;
|
|
1534
|
+
// location: string;
|
|
1535
|
+
// }
|
|
1536
|
+
// type c = GET_PATH_VARIABLE<Person, unknown>;
|
|
1537
|
+
// const a: c = {
|
|
1538
|
+
// "pathVariable-age": 1,
|
|
1539
|
+
// "pathVariable-location": '12',
|
|
1540
|
+
// "pathVariable-name": '124',
|
|
1541
|
+
// };
|
|
1542
|
+
|
|
1424
1543
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1425
1544
|
/**Các hàm tương tự thư viện lodash */
|
|
1426
1545
|
/**
|
|
@@ -1469,7 +1588,7 @@ const omitBy = (objData, predicate) => {
|
|
|
1469
1588
|
return objData;
|
|
1470
1589
|
}
|
|
1471
1590
|
const newObj = {};
|
|
1472
|
-
Object.keys(objData).forEach(key => {
|
|
1591
|
+
Object.keys(objData).forEach((key) => {
|
|
1473
1592
|
const valueOfKey = get(objData, key);
|
|
1474
1593
|
if (!predicate(valueOfKey)) {
|
|
1475
1594
|
set(newObj, key, valueOfKey);
|
|
@@ -1540,7 +1659,7 @@ const omitBy = (objData, predicate) => {
|
|
|
1540
1659
|
* get(null, 'any.path'); // undefined
|
|
1541
1660
|
* get(undefined, 'any.path', 'fallback'); // 'fallback'
|
|
1542
1661
|
*/
|
|
1543
|
-
const get = (obj, path, defaultValue
|
|
1662
|
+
const get = (obj, path, defaultValue, keepLastValueIfSignal) => {
|
|
1544
1663
|
if (isNil(obj)) {
|
|
1545
1664
|
return defaultValue;
|
|
1546
1665
|
}
|
|
@@ -1551,12 +1670,17 @@ const get = (obj, path, defaultValue = undefined, keepLastValueIfSignal) => {
|
|
|
1551
1670
|
return obj;
|
|
1552
1671
|
}
|
|
1553
1672
|
if (obj instanceof HttpParams) {
|
|
1554
|
-
return obj.get(`${path}`);
|
|
1673
|
+
return (obj.get(`${path}`) ?? defaultValue);
|
|
1555
1674
|
}
|
|
1556
1675
|
if (obj instanceof DOMRect) {
|
|
1557
1676
|
return obj[path];
|
|
1558
1677
|
}
|
|
1559
|
-
const paths = Array.isArray(path)
|
|
1678
|
+
const paths = Array.isArray(path)
|
|
1679
|
+
? path
|
|
1680
|
+
: path
|
|
1681
|
+
.replace(/\[(\d+)]/g, '.$1')
|
|
1682
|
+
.split('.')
|
|
1683
|
+
.filter((key) => key);
|
|
1560
1684
|
for (const index in paths) {
|
|
1561
1685
|
const key = paths[index];
|
|
1562
1686
|
if (obj instanceof CSSStyleDeclaration) {
|
|
@@ -1587,18 +1711,23 @@ const get = (obj, path, defaultValue = undefined, keepLastValueIfSignal) => {
|
|
|
1587
1711
|
* set(obj, 'a.b', 2); // { a: { b: 2 } }
|
|
1588
1712
|
*/
|
|
1589
1713
|
const set = (obj, path, value) => {
|
|
1590
|
-
if (!obj || (typeof obj !==
|
|
1591
|
-
throw new Error(
|
|
1714
|
+
if (!obj || (typeof obj !== 'object' && !isSignal(obj)) || (isSignal(obj) && typeof obj() !== 'object')) {
|
|
1715
|
+
throw new Error('The first argument must be an object');
|
|
1592
1716
|
}
|
|
1593
1717
|
if (obj instanceof HttpParams) {
|
|
1594
1718
|
return obj.set(`${path}`, value);
|
|
1595
1719
|
}
|
|
1596
|
-
const pathArray = Array.isArray(path)
|
|
1720
|
+
const pathArray = Array.isArray(path)
|
|
1721
|
+
? path
|
|
1722
|
+
: path
|
|
1723
|
+
.replace(/\[(\d+)]/g, '.[$1]')
|
|
1724
|
+
.split('.')
|
|
1725
|
+
.filter((key) => key);
|
|
1597
1726
|
let currentObjectByKey = isSignal(obj) ? obj() : obj;
|
|
1598
1727
|
let preObjectByKey = obj;
|
|
1599
1728
|
pathArray.forEach((key, index) => {
|
|
1600
1729
|
if (index < pathArray.length - 1) {
|
|
1601
|
-
if (!(key in currentObjectByKey) || (typeof currentObjectByKey[key] !==
|
|
1730
|
+
if (!(key in currentObjectByKey) || (typeof currentObjectByKey[key] !== 'object' && !isSignal(currentObjectByKey[key]))) {
|
|
1602
1731
|
const nextKey = pathArray[index + 1];
|
|
1603
1732
|
key = key.replace(/\[(\d+)]/g, '$1');
|
|
1604
1733
|
currentObjectByKey[key] = /\[(\d+)]/g.test(nextKey) ? [] : {};
|
|
@@ -1608,7 +1737,7 @@ const set = (obj, path, value) => {
|
|
|
1608
1737
|
currentObjectByKey = isSignal(currentObjectByKey) ? currentObjectByKey() : currentObjectByKey;
|
|
1609
1738
|
return;
|
|
1610
1739
|
}
|
|
1611
|
-
if (typeof currentObjectByKey !==
|
|
1740
|
+
if (typeof currentObjectByKey !== 'object') {
|
|
1612
1741
|
return;
|
|
1613
1742
|
}
|
|
1614
1743
|
// Gán giá trị ở cuối đường dẫn
|
|
@@ -1689,13 +1818,13 @@ const cloneDeep = (data, options = { ignoreSignal: false }, seen = new WeakMap()
|
|
|
1689
1818
|
if (data instanceof Set) {
|
|
1690
1819
|
const setCopy = new Set();
|
|
1691
1820
|
seen.set(data, setCopy);
|
|
1692
|
-
data.forEach(val => {
|
|
1821
|
+
data.forEach((val) => {
|
|
1693
1822
|
setCopy.add(cloneDeep(val, options, seen));
|
|
1694
1823
|
});
|
|
1695
1824
|
return setCopy;
|
|
1696
1825
|
}
|
|
1697
1826
|
if (Array.isArray(data)) {
|
|
1698
|
-
seen.set(data, data.map(item => cloneDeep(item, options, seen)));
|
|
1827
|
+
seen.set(data, data.map((item) => cloneDeep(item, options, seen)));
|
|
1699
1828
|
return seen.get(data);
|
|
1700
1829
|
}
|
|
1701
1830
|
if (data instanceof File || data instanceof Blob || Object.prototype.toString.call(data) === '[object File]') {
|
|
@@ -1877,7 +2006,7 @@ const isEqual = (value1, value2, options) => {
|
|
|
1877
2006
|
return false;
|
|
1878
2007
|
}
|
|
1879
2008
|
if (!exactlyPosition) {
|
|
1880
|
-
return !value1.some(item => !value2.includes(item));
|
|
2009
|
+
return !value1.some((item) => !value2.includes(item));
|
|
1881
2010
|
}
|
|
1882
2011
|
return !value1.some((item, index) => !isEqual(item, value2[index], options));
|
|
1883
2012
|
}
|
|
@@ -1910,7 +2039,7 @@ const uniqBy = (data, key) => {
|
|
|
1910
2039
|
// Xử lý mảng chứa signal values
|
|
1911
2040
|
if (data[0] && isSignal(data[0])) {
|
|
1912
2041
|
const seen = new Set();
|
|
1913
|
-
return data.filter(item => {
|
|
2042
|
+
return data.filter((item) => {
|
|
1914
2043
|
const value = `${get(item, '')}`;
|
|
1915
2044
|
if (seen.has(value)) {
|
|
1916
2045
|
return false;
|
|
@@ -1923,7 +2052,7 @@ const uniqBy = (data, key) => {
|
|
|
1923
2052
|
return Array.from(new Set(data));
|
|
1924
2053
|
}
|
|
1925
2054
|
const dataUnique = keyBy(data, key);
|
|
1926
|
-
return Object.keys(dataUnique).map(key => dataUnique[key]);
|
|
2055
|
+
return Object.keys(dataUnique).map((key) => dataUnique[key]);
|
|
1927
2056
|
};
|
|
1928
2057
|
const generateInterface = (obj, interfaceName) => {
|
|
1929
2058
|
const generateType = (value) => {
|
|
@@ -2548,6 +2677,7 @@ const convertUrlToFile = (url, fileName) => {
|
|
|
2548
2677
|
const file = convertBase64ToBlob(reader.result);
|
|
2549
2678
|
resolve(convertBlobToFile(file, fileName || Date.now().toLocaleString()));
|
|
2550
2679
|
};
|
|
2680
|
+
reader.onerror = () => resolve(undefined);
|
|
2551
2681
|
reader.readAsDataURL(xhr.response);
|
|
2552
2682
|
};
|
|
2553
2683
|
xhr.onerror = (err) => {
|
|
@@ -2778,5 +2908,5 @@ const createUniqueRandomIntGenerator = (min, max) => {
|
|
|
2778
2908
|
* Generated bundle index. Do not edit.
|
|
2779
2909
|
*/
|
|
2780
2910
|
|
|
2781
|
-
export { AudioExtList, CHARACTER_DATA_EMPTY, COMMUNICATE_MICRO_KEY_GET_ALL_MESSAGE, COMMUNICATE_MICRO_PREFIX_TYPE, DEFAULT_START_PAGE_0, DocumentExtList, ENCODE_URI_PATTERN, ERROR_MESSAGE_EMPTY_VALID, ERROR_MESSAGE_MAX_LENGTH, ERROR_MESSAGE_MAX_VALID, ERROR_MESSAGE_MIN_LENGTH, ERROR_MESSAGE_MIN_VALID, ERROR_MESSAGE_PATTEN_VALID, ExcelExtList, ImageExtList, LINK_IMAGE_ERROR_TOKEN_INJECT, PROCESS_BAR_STANDARD_CONFIG_DEFAULT_TOKEN_INJECT, PROCESS_BAR_STEPS_CONFIG_DEFAULT_TOKEN_INJECT, UtilsCache, UtilsCommunicateMicro, UtilsCommunicateMicroKeyGlobal, UtilsHttpParamsRequest, UtilsHttpParamsRequestInstance, UtilsKeyCodeConstant, UtilsLanguageConstants, UtilsUrlSearchParams, VideoExtList, base64Decode, base64Encode, capitalize, checkMouseOverInContainer, checkViewInScreen, cloneDeep, cloneIBoundingClientRect, colorContrastFromOrigin, colorStepContrastFromOrigin, convertBase64ToBlob, convertBlobToFile, convertFileToBase64, convertFileToBase64_ObjectUrl, convertObjectToSignal, convertSignalToObject, convertUrlToFile, createUniqueRandomIntGenerator, decodeEscapeHtml, decodeURI, decrypt, decrypt3rd, deleteUnicode, downloadFileByUrl, downloadFileByUrlUseXmlRequest, downloadImageFromELement, encodeURI, encrypt, encrypt3rd, endCodeUrl, escapeHtml, firstLetterToUpperCase, formatDate, formatNumber, formatTextCompare, fullNameFormat, generateInterface, get, getColorById, getDayjs, getDeviceInfo, getDocumentByString, getDragEventByElement, getEventNameHandleClick, getFileExtension, getHTMLFromQuill, getKeyCacheByArrayObject, getLabelBySizeFile, getPlatFromBrowser, getSmartAxisScale, getViewport, groupBy, highlightByKeyword, isDifferenceDay, isDifferenceMonth, isDifferenceYear, isEmbedFrame, isEmpty, isEqual, isIncludeAudioExtList, isIncludeDocumentExtList, isIncludeImageExtList, isIncludeVideoExtList, isNil, isTypeAudio, isTypeFile, isTypeImage, isTypeVideo, keyBy, listColorDefine, md5, omitBy, patternAccount, patternDomain, patternEmail, patternEmoji, patternEncodeUri, patternGetFieldByRuleFieldReplace, patternHostUrl, patternKey, patternMobilePhone, patternName, patternNameProfile, patternNameSpecial, patternNameUtf8, patternNumber, patternPem, patternPhone, patternPhoneNormal, patternRuleFieldReplace, patternTax, patternUrl, protectString, range, removeEmoji, revealString, rgbToHex, set, setCaretPosition, setDefaultTimeZone, setKeyCrypto, setKeyCrypto3rd, setStylesElement, uniqBy, updateFunctionCheckEmbedFrame, updateFunctionFormatDate, updateFunctionXssFilter, uppercaseByPosition, uuid, viewDataNumberByLanguage, xssFilter };
|
|
2911
|
+
export { AudioExtList, CHARACTER_DATA_EMPTY, COMMUNICATE_MICRO_KEY_GET_ALL_MESSAGE, COMMUNICATE_MICRO_PREFIX_TYPE, DEFAULT_START_PAGE_0, DocumentExtList, ENCODE_URI_PATTERN, ERROR_MESSAGE_EMPTY_VALID, ERROR_MESSAGE_MAX_LENGTH, ERROR_MESSAGE_MAX_VALID, ERROR_MESSAGE_MIN_LENGTH, ERROR_MESSAGE_MIN_VALID, ERROR_MESSAGE_PATTEN_VALID, ExcelExtList, ImageExtList, LINK_IMAGE_ERROR_TOKEN_INJECT, PROCESS_BAR_STANDARD_CONFIG_DEFAULT_TOKEN_INJECT, PROCESS_BAR_STEPS_CONFIG_DEFAULT_TOKEN_INJECT, UtilsCache, UtilsCommunicateMicro, UtilsCommunicateMicroKeyGlobal, UtilsHttpParamsRequest, UtilsHttpParamsRequestInstance, UtilsKeyCodeConstant, UtilsLanguageConstants, UtilsUrlSearchParams, VideoExtList, base64Decode, base64Encode, capitalize, checkMouseOverInContainer, checkViewInScreen, cloneDeep, cloneIBoundingClientRect, colorContrastFromOrigin, colorStepContrastFromOrigin, convertBase64ToBlob, convertBlobToFile, convertFileToBase64, convertFileToBase64_ObjectUrl, convertHtmlToDivBlocks, convertObjectToSignal, convertSignalToObject, convertUrlToFile, createUniqueRandomIntGenerator, decodeEscapeHtml, decodeURI, decrypt, decrypt3rd, deleteUnicode, downloadFileByUrl, downloadFileByUrlUseXmlRequest, downloadImageFromELement, encodeURI, encrypt, encrypt3rd, endCodeUrl, escapeHtml, firstLetterToUpperCase, formatDate, formatNumber, formatTextCompare, fullNameFormat, generateInterface, get, getColorById, getDayjs, getDeltaFromHTML, getDeviceInfo, getDocumentByString, getDragEventByElement, getEventNameHandleClick, getFileExtension, getHTMLFromQuill, getKeyCacheByArrayObject, getLabelBySizeFile, getPlatFromBrowser, getSmartAxisScale, getViewport, groupBy, highlightByKeyword, insertContentWithRange, isDifferenceDay, isDifferenceMonth, isDifferenceYear, isEmbedFrame, isEmpty, isEqual, isIncludeAudioExtList, isIncludeDocumentExtList, isIncludeImageExtList, isIncludeVideoExtList, isNil, isTypeAudio, isTypeFile, isTypeImage, isTypeVideo, keyBy, listColorDefine, md5, omitBy, patternAccount, patternDomain, patternEmail, patternEmoji, patternEncodeUri, patternGetFieldByRuleFieldReplace, patternHostUrl, patternKey, patternMobilePhone, patternName, patternNameProfile, patternNameSpecial, patternNameUtf8, patternNumber, patternPem, patternPhone, patternPhoneNormal, patternRuleFieldReplace, patternTax, patternUrl, processPasteData, protectString, range, removeEmoji, revealString, rgbToHex, set, setCaretPosition, setDefaultTimeZone, setKeyCrypto, setKeyCrypto3rd, setStylesElement, uniqBy, updateFunctionCheckEmbedFrame, updateFunctionFormatDate, updateFunctionXssFilter, uppercaseByPosition, uuid, viewDataNumberByLanguage, xssFilter };
|
|
2782
2912
|
//# sourceMappingURL=libs-ui-utils.mjs.map
|