@libs-ui/utils 0.2.306 → 0.2.307-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.
@@ -90,7 +90,7 @@ const highlightByKeyword = (value, search, ignoreHighlight, classHightLight) =>
90
90
  if (!classHightLight) {
91
91
  classHightLight = 'bg-[#19344a] text-white';
92
92
  }
93
- keysReplace.forEach(key => {
93
+ keysReplace.forEach((key) => {
94
94
  const regExp = new RegExp(key, 'gi');
95
95
  value = value?.replace(regExp, `<span class="${classHightLight}">$&</span>`);
96
96
  });
@@ -119,7 +119,7 @@ const formatTextCompare = (text, options) => {
119
119
  if (!text) {
120
120
  return text;
121
121
  }
122
- text = text.normalize("NFC");
122
+ text = text.normalize('NFC');
123
123
  return formatByOptions(text, options);
124
124
  };
125
125
  const fullNameFormat = (value) => {
@@ -133,7 +133,10 @@ const capitalize = (text, options) => {
133
133
  return text;
134
134
  }
135
135
  text = formatByOptions(text, options);
136
- return text.split(' ').map(word => firstLetterToUpperCase(word)).join(' ');
136
+ return text
137
+ .split(' ')
138
+ .map((word) => firstLetterToUpperCase(word))
139
+ .join(' ');
137
140
  };
138
141
  const firstLetterToUpperCase = (text, options) => {
139
142
  if (!text) {
@@ -159,7 +162,7 @@ const formatByOptions = (text, options) => {
159
162
  text = text.toLowerCase();
160
163
  }
161
164
  if (options?.removeMultipleSpace) {
162
- text = text.replace(/\u200B|\u00A0/g, "");
165
+ text = text.replace(/\u200B|\u00A0/g, '');
163
166
  text = text.replace(/\s+/g, ' ');
164
167
  }
165
168
  if (options?.removeEmoji) {
@@ -177,12 +180,7 @@ const escapeHtml = (str) => {
177
180
  if (!str || typeof str !== 'string') {
178
181
  return str;
179
182
  }
180
- return str
181
- .replace(/&/g, "&amp;")
182
- .replace(/</g, "&lt;")
183
- .replace(/>/g, "&gt;")
184
- .replace(/"/g, "&quot;")
185
- .replace(/'/g, "&#039;");
183
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
186
184
  };
187
185
  const decodeEscapeHtml = (str) => {
188
186
  const htmlTag = document.createElement('textarea');
@@ -213,9 +211,9 @@ const deleteUnicode = (str) => {
213
211
  str = str.replace(/Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ/g, 'U');
214
212
  str = str.replace(/Ỳ|Ý|Ỵ|Ỷ|Ỹ/g, 'Y');
215
213
  str = str.replace(/Đ/g, 'D');
216
- str = str.replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g, ""); // ̀ ́ ̃ ̉ ̣ huyền, sắc, ngã, hỏi, nặng
217
- str = str.replace(/\u02C6|\u0306|\u031B/g, ""); // ˆ ̆ ̛ Â, Ê, Ă, Ơ, Ư
218
- return str.normalize("NFC");
214
+ str = str.replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g, ''); // ̀ ́ ̃ ̉ ̣ huyền, sắc, ngã, hỏi, nặng
215
+ str = str.replace(/\u02C6|\u0306|\u031B/g, ''); // ˆ ̆ ̛ Â, Ê, Ă, Ơ, Ư
216
+ return str.normalize('NFC');
219
217
  };
220
218
  const removeEmoji = (text) => {
221
219
  if (!text || !text.trim()) {
@@ -290,10 +288,7 @@ const checkViewInScreen = (container, element, elementScroll, maxTopLeft) => {
290
288
  const limitLeft = leftContainer + scrollLeftContainer + widthContainer;
291
289
  const maxTopItem = top + (maxTopLeft?.top || 0);
292
290
  const maxLeftItem = left + (maxTopLeft?.left || 0);
293
- if (topContainer <= maxTopItem &&
294
- maxTopItem <= limitTop &&
295
- leftContainer <= maxLeftItem &&
296
- maxLeftItem <= limitLeft) {
291
+ if (topContainer <= maxTopItem && maxTopItem <= limitTop && leftContainer <= maxLeftItem && maxLeftItem <= limitLeft) {
297
292
  return true;
298
293
  }
299
294
  return false;
@@ -307,10 +302,7 @@ const checkMouseOverInContainer = (mousePosition, element, rect) => {
307
302
  const limitLeft = left + width;
308
303
  const limitTop = top + height;
309
304
  const { clientX, clientY } = mousePosition;
310
- if (left <= clientX &&
311
- clientX <= limitLeft &&
312
- top <= clientY &&
313
- clientY <= limitTop) {
305
+ if (left <= clientX && clientX <= limitLeft && top <= clientY && clientY <= limitTop) {
314
306
  return true;
315
307
  }
316
308
  return false;
@@ -348,13 +340,11 @@ const getDragEventByElement = (config) => {
348
340
  e.stopPropagation();
349
341
  config.functionMouseMove?.(e);
350
342
  }), takeUntil(mouseup));
351
- return mouseDown.pipe(mergeMap((e) => config.isStartWithMouseDownEvent
352
- ? mousemove.pipe(startWith(e))
353
- : mousemove), takeUntil(config.onDestroy), finalize(removeClass));
343
+ return mouseDown.pipe(mergeMap((e) => (config.isStartWithMouseDownEvent ? mousemove.pipe(startWith(e)) : mousemove)), takeUntil(config.onDestroy), finalize(removeClass));
354
344
  };
355
345
  const getHTMLFromQuill = async (data, options) => {
356
346
  const { replaceNewLineTo = '<br>', replaceTagBRTo, replaceTags, replaceBrToDiv } = options || {};
357
- const delta = (typeof data === 'string') ? await getDeltaFromHTML(data) : data;
347
+ const delta = typeof data === 'string' ? await getDeltaFromHTML(data) : data;
358
348
  if (options?.functionReplaceDelta) {
359
349
  options.functionReplaceDelta(delta);
360
350
  }
@@ -498,17 +488,19 @@ class UtilsUrlSearchParams {
498
488
  return this.instance;
499
489
  }
500
490
  static toStringParamObject(params) {
501
- const paramsArr = Object.keys(params).map(key => {
491
+ const paramsArr = Object.keys(params).map((key) => {
502
492
  return {
503
493
  key,
504
- value: params[key]
494
+ value: params[key],
505
495
  };
506
496
  });
507
497
  return UtilsUrlSearchParams.ToString(paramsArr);
508
498
  }
509
499
  static ToString(params) {
510
500
  let paramsStr = '';
511
- params.sort((item1, item2) => item1.key.localeCompare(item2.key)).forEach((item) => {
501
+ params
502
+ .sort((item1, item2) => item1.key.localeCompare(item2.key))
503
+ .forEach((item) => {
512
504
  const { key, value } = item;
513
505
  paramsStr = `${paramsStr}${paramsStr ? '&' : ''}${key}=${value}`;
514
506
  });
@@ -525,14 +517,14 @@ class UtilsUrlSearchParams {
525
517
  }
526
518
  const params = paramString.replace(/\S+[?]/g, '').split('&');
527
519
  if (params) {
528
- params.forEach(param => {
520
+ params.forEach((param) => {
529
521
  if (param.indexOf('=') < 0) {
530
522
  return;
531
523
  }
532
524
  let [key, value] = param.split('=');
533
525
  key = key.replace(/[?&]+/g, '');
534
526
  value = decodeURIComponent(value.replace(/\+/g, ' '));
535
- if (!paramsBuild.some(param => param.key === key)) {
527
+ if (!paramsBuild.some((param) => param.key === key)) {
536
528
  paramsBuild.push({ key, value });
537
529
  }
538
530
  });
@@ -540,7 +532,7 @@ class UtilsUrlSearchParams {
540
532
  return paramsBuild;
541
533
  }
542
534
  set(key, value) {
543
- const paramByKey = this.params.find(param => param.key === key);
535
+ const paramByKey = this.params.find((param) => param.key === key);
544
536
  if (!paramByKey) {
545
537
  this.params.push({ key, value: decodeURIComponent(value.replace(/\+/g, ' ')) });
546
538
  return;
@@ -548,13 +540,13 @@ class UtilsUrlSearchParams {
548
540
  paramByKey['value'] = value;
549
541
  }
550
542
  get(key) {
551
- return this.params.find(param => param.key === key)?.value;
543
+ return this.params.find((param) => param.key === key)?.value;
552
544
  }
553
545
  has(key) {
554
- return this.params.some(param => param.key === key);
546
+ return this.params.some((param) => param.key === key);
555
547
  }
556
548
  delete(key) {
557
- const index = this.params.findIndex(param => param.key === key);
549
+ const index = this.params.findIndex((param) => param.key === key);
558
550
  if (index >= 0) {
559
551
  this.params.splice(index, 1);
560
552
  }
@@ -568,7 +560,7 @@ class UtilsUrlSearchParams {
568
560
  }
569
561
  getParamObject() {
570
562
  const params = {};
571
- this.params.forEach(item => {
563
+ this.params.forEach((item) => {
572
564
  params[item.key] = item.value;
573
565
  });
574
566
  return params;
@@ -596,7 +588,7 @@ const keyStore$1 = () => {
596
588
  };
597
589
  const encrypt = (plainData) => {
598
590
  if (!keyStore$1()) {
599
- throw Error("lỗi chưa setup key mã hóa");
591
+ throw Error('lỗi chưa setup key mã hóa');
600
592
  }
601
593
  const key = CryptoES.enc.Hex.parse(keyStore$1());
602
594
  const iv = CryptoES.enc.Hex.parse(keyStore$1());
@@ -607,7 +599,7 @@ const encrypt = (plainData) => {
607
599
  };
608
600
  const decrypt = (encryptedData) => {
609
601
  if (!keyStore$1()) {
610
- throw Error("lỗi chưa setup key mã hóa");
602
+ throw Error('lỗi chưa setup key mã hóa');
611
603
  }
612
604
  const key = CryptoES.enc.Hex.parse(keyStore$1());
613
605
  const iv = CryptoES.enc.Hex.parse(keyStore$1());
@@ -732,7 +724,7 @@ const keyStore = () => {
732
724
  };
733
725
  const encrypt3rd = (plainData) => {
734
726
  if (!keyStore()) {
735
- throw Error("lỗi chưa setup key mã hóa");
727
+ throw Error('lỗi chưa setup key mã hóa');
736
728
  }
737
729
  const key = CryptoES.enc.Hex.parse(keyStore());
738
730
  const iv = CryptoES.enc.Hex.parse(keyStore());
@@ -743,7 +735,7 @@ const encrypt3rd = (plainData) => {
743
735
  };
744
736
  const decrypt3rd = (encryptedData) => {
745
737
  if (!keyStore()) {
746
- throw Error("lỗi chưa setup key mã hóa");
738
+ throw Error('lỗi chưa setup key mã hóa');
747
739
  }
748
740
  const key = CryptoES.enc.Hex.parse(keyStore());
749
741
  const iv = CryptoES.enc.Hex.parse(keyStore());
@@ -790,7 +782,9 @@ class UtilsCommunicateMicro {
790
782
  if (!this.subs.get(COMMUNICATE_MICRO_KEY_GET_ALL_MESSAGE)) {
791
783
  this.subs.set(COMMUNICATE_MICRO_KEY_GET_ALL_MESSAGE, UtilsCommunicateMicro.allMessageSub);
792
784
  }
793
- fromEvent(currentWindow, 'message').pipe(takeUntil(onDestroy)).subscribe(e => {
785
+ fromEvent(currentWindow, 'message')
786
+ .pipe(takeUntil(onDestroy))
787
+ .subscribe((e) => {
794
788
  const event = { data: { ...e.data } };
795
789
  const data = event.data;
796
790
  const type = data.type;
@@ -818,7 +812,9 @@ class UtilsCommunicateMicro {
818
812
  this.allMessageSub.next(event);
819
813
  }
820
814
  });
821
- UtilsCommunicateMicro.GetMessage(UtilsCache.typeKeyClearLocalStorage).pipe(filter(e => e.data.response !== UtilsCache.idService), takeUntil(onDestroy)).subscribe(() => {
815
+ UtilsCommunicateMicro.GetMessage(UtilsCache.typeKeyClearLocalStorage)
816
+ .pipe(filter((e) => e.data.response !== UtilsCache.idService), takeUntil(onDestroy))
817
+ .subscribe(() => {
822
818
  console.log('clear all cache by event');
823
819
  UtilsCache.ClearAll();
824
820
  });
@@ -827,10 +823,10 @@ class UtilsCommunicateMicro {
827
823
  data = this.convertData(data);
828
824
  try {
829
825
  if (isEmbedFrame()) {
830
- window?.parent?.postMessage(data, "*");
826
+ window?.parent?.postMessage(data, '*');
831
827
  return;
832
828
  }
833
- window?.top?.postMessage(data, "*");
829
+ window?.top?.postMessage(data, '*');
834
830
  }
835
831
  catch (error) {
836
832
  console.log(error);
@@ -838,8 +834,8 @@ class UtilsCommunicateMicro {
838
834
  }
839
835
  static PostMessageToChildren(data) {
840
836
  data = this.convertData(data);
841
- const iframes = document.querySelectorAll("iframe");
842
- Array.from(iframes).forEach(iframe => {
837
+ const iframes = document.querySelectorAll('iframe');
838
+ Array.from(iframes).forEach((iframe) => {
843
839
  iframe?.contentWindow?.postMessage(data, '*');
844
840
  });
845
841
  }
@@ -877,7 +873,7 @@ class UtilsCommunicateMicro {
877
873
  }
878
874
  static GetMessage(messageType) {
879
875
  if (!this.initdEvent) {
880
- throw Error("chưa khơi tạo hàm lắng nghe sự kiện, gọi UtilsCommunicateMicro.initEvent(window) tại root component");
876
+ throw Error('chưa khơi tạo hàm lắng nghe sự kiện, gọi UtilsCommunicateMicro.initEvent(window) tại root component');
881
877
  }
882
878
  if (typeof messageType === 'string') {
883
879
  let sub = this.subs.get(messageType);
@@ -905,8 +901,8 @@ class UtilsCommunicateMicro {
905
901
  return sub;
906
902
  }
907
903
  static initSubject(subRoot, messageType) {
908
- messageType.forEach(key => {
909
- this.GetMessage(key).subscribe(e => {
904
+ messageType.forEach((key) => {
905
+ this.GetMessage(key).subscribe((e) => {
910
906
  subRoot.next(e);
911
907
  });
912
908
  });
@@ -914,33 +910,33 @@ class UtilsCommunicateMicro {
914
910
  }
915
911
 
916
912
  class UtilsLanguageConstants {
917
- static VI = "vi"; // Tiếng Việt
918
- static EN = "en"; // Tiếng Anh
919
- static FR = "fr"; // Tiếng Pháp
920
- static DE = "de"; // Tiếng Đức
921
- static ES = "es"; // Tiếng Tây Ban Nha
922
- static ZH = "zh"; // Tiếng Trung (Giản thể)
923
- static ZH_TW = "zh-TW"; // Tiếng Trung (Phồn thể)
924
- static JA = "ja"; // Tiếng Nhật
925
- static KO = "ko"; // Tiếng Hàn
926
- static RU = "ru"; // Tiếng Nga
927
- static IT = "it"; // Tiếng Ý
928
- static PT = "pt"; // Tiếng Bồ Đào Nha
929
- static TH = "th"; // Tiếng Thái
930
- static ID = "id"; // Tiếng Indonesia
931
- static MS = "ms"; // Tiếng Malaysia
932
- static AR = "ar"; // Tiếng Ả Rập
933
- static HI = "hi"; // Tiếng Hindi
934
- static BN = "bn"; // Tiếng Bengal
935
- static TR = "tr"; // Tiếng Thổ Nhĩ Kỳ
936
- static NL = "nl"; // Tiếng Hà Lan
937
- static KM = "km"; // Tiếng Khmer (Campuchia)
938
- static LO = "lo"; // Tiếng Lào
939
- static MY = "my"; // Tiếng Miến Điện (Myanmar)
940
- static TL = "tl"; // Tiếng Tagalog (Philippines)
941
- static CEB = "ceb"; // Tiếng Cebuano (Philippines)
942
- static JV = "jv"; // Tiếng Java (Indonesia)
943
- static SU = "su"; // Tiếng Sundanese (Indonesia)
913
+ static VI = 'vi'; // Tiếng Việt
914
+ static EN = 'en'; // Tiếng Anh
915
+ static FR = 'fr'; // Tiếng Pháp
916
+ static DE = 'de'; // Tiếng Đức
917
+ static ES = 'es'; // Tiếng Tây Ban Nha
918
+ static ZH = 'zh'; // Tiếng Trung (Giản thể)
919
+ static ZH_TW = 'zh-TW'; // Tiếng Trung (Phồn thể)
920
+ static JA = 'ja'; // Tiếng Nhật
921
+ static KO = 'ko'; // Tiếng Hàn
922
+ static RU = 'ru'; // Tiếng Nga
923
+ static IT = 'it'; // Tiếng Ý
924
+ static PT = 'pt'; // Tiếng Bồ Đào Nha
925
+ static TH = 'th'; // Tiếng Thái
926
+ static ID = 'id'; // Tiếng Indonesia
927
+ static MS = 'ms'; // Tiếng Malaysia
928
+ static AR = 'ar'; // Tiếng Ả Rập
929
+ static HI = 'hi'; // Tiếng Hindi
930
+ static BN = 'bn'; // Tiếng Bengal
931
+ static TR = 'tr'; // Tiếng Thổ Nhĩ Kỳ
932
+ static NL = 'nl'; // Tiếng Hà Lan
933
+ static KM = 'km'; // Tiếng Khmer (Campuchia)
934
+ static LO = 'lo'; // Tiếng Lào
935
+ static MY = 'my'; // Tiếng Miến Điện (Myanmar)
936
+ static TL = 'tl'; // Tiếng Tagalog (Philippines)
937
+ static CEB = 'ceb'; // Tiếng Cebuano (Philippines)
938
+ static JV = 'jv'; // Tiếng Java (Indonesia)
939
+ static SU = 'su'; // Tiếng Sundanese (Indonesia)
944
940
  // Ngôn ngữ mặc định
945
941
  static defaultLang = UtilsLanguageConstants.VI;
946
942
  // Danh sách các ngôn ngữ được hỗ trợ
@@ -1026,7 +1022,7 @@ class UtilsCache {
1026
1022
  return this.Get(this.languageKeyCache, UtilsLanguageConstants.defaultLang);
1027
1023
  }
1028
1024
  static openDB() {
1029
- return new Promise(resolve => {
1025
+ return new Promise((resolve) => {
1030
1026
  const request = indexedDB.open(this.dbName, this.dbVersion);
1031
1027
  request.onupgradeneeded = (event) => {
1032
1028
  const db = event.target.result;
@@ -1098,7 +1094,7 @@ class UtilsCache {
1098
1094
  clear: () => {
1099
1095
  this.storage = {};
1100
1096
  localStorage.clear();
1101
- }
1097
+ },
1102
1098
  };
1103
1099
  }
1104
1100
  static getLocalStorageFake() {
@@ -1117,7 +1113,7 @@ class UtilsCache {
1117
1113
  },
1118
1114
  clear: () => {
1119
1115
  this.storage = {};
1120
- }
1116
+ },
1121
1117
  };
1122
1118
  }
1123
1119
  static async GetAsync(key, default_value, isKeyMD5 = false) {
@@ -1136,7 +1132,7 @@ class UtilsCache {
1136
1132
  if (data.expire === this.CACHE_EXPIRE_NONE) {
1137
1133
  return resolve(data.json);
1138
1134
  }
1139
- const currentMillisecond = (new Date().valueOf() / 1000);
1135
+ const currentMillisecond = new Date().valueOf() / 1000;
1140
1136
  if (data.expire < currentMillisecond) {
1141
1137
  return resolve(default_value);
1142
1138
  }
@@ -1149,6 +1145,7 @@ class UtilsCache {
1149
1145
  });
1150
1146
  }
1151
1147
  static Get(key, default_value) {
1148
+ // support cho những file không thể inject UtilsCache
1152
1149
  if (!key) {
1153
1150
  return this.GetDefaultValueBySpecificKey(key, default_value);
1154
1151
  }
@@ -1161,7 +1158,7 @@ class UtilsCache {
1161
1158
  if (data.expire === this.CACHE_EXPIRE_NONE) {
1162
1159
  return data.value ?? default_value;
1163
1160
  }
1164
- const currentMillisecond = (new Date().valueOf() / 1000);
1161
+ const currentMillisecond = new Date().valueOf() / 1000;
1165
1162
  if (data.expire < currentMillisecond) {
1166
1163
  return this.GetDefaultValueBySpecificKey(key, default_value);
1167
1164
  }
@@ -1176,11 +1173,12 @@ class UtilsCache {
1176
1173
  return default_value;
1177
1174
  }
1178
1175
  static async SetAsync(key, value, expireTimeBySecond = this.CACHE_EXPIRE_TIME_DEFAULT, isKeyMD5 = false) {
1176
+ // support inject UtilsCache
1179
1177
  return new Promise(async (resolve) => {
1180
1178
  const objectStore = await this.getObjectStore();
1181
1179
  key = isKeyMD5 ? key : md5(key);
1182
1180
  try {
1183
- const currentMillisecond = expireTimeBySecond === this.CACHE_EXPIRE_NONE ? this.CACHE_EXPIRE_NONE : (new Date().valueOf() / 1000) + expireTimeBySecond;
1181
+ const currentMillisecond = expireTimeBySecond === this.CACHE_EXPIRE_NONE ? this.CACHE_EXPIRE_NONE : new Date().valueOf() / 1000 + expireTimeBySecond;
1184
1182
  const data = {
1185
1183
  value: encrypt(JSON.stringify({ json: value, expire: currentMillisecond })),
1186
1184
  };
@@ -1206,10 +1204,11 @@ class UtilsCache {
1206
1204
  });
1207
1205
  }
1208
1206
  static Set(key, value, expireTimeBySecond = this.CACHE_EXPIRE_TIME_DEFAULT) {
1209
- const currentMillisecond = expireTimeBySecond === this.CACHE_EXPIRE_NONE ? this.CACHE_EXPIRE_NONE : (new Date().valueOf() / 1000) + expireTimeBySecond;
1207
+ // support cho những file không inject UtilsCache
1208
+ const currentMillisecond = expireTimeBySecond === this.CACHE_EXPIRE_NONE ? this.CACHE_EXPIRE_NONE : new Date().valueOf() / 1000 + expireTimeBySecond;
1210
1209
  const data = {
1211
1210
  value: value,
1212
- expire: currentMillisecond
1211
+ expire: currentMillisecond,
1213
1212
  };
1214
1213
  try {
1215
1214
  this.LocalStorage.setItem(key, encrypt(JSON.stringify(data)));
@@ -1264,13 +1263,13 @@ class UtilsCache {
1264
1263
  const data = {
1265
1264
  type: this.typeKeyClearLocalStorage,
1266
1265
  response: {
1267
- idEvent: this.idService
1268
- }
1266
+ idEvent: this.idService,
1267
+ },
1269
1268
  };
1270
1269
  UtilsCommunicateMicro.PostMessageToParent(data);
1271
1270
  }
1272
1271
  const keys = [...this.listKeyKeepWhenClearALll];
1273
- Object.keys(this.LocalStorage).forEach(key => {
1272
+ Object.keys(this.LocalStorage).forEach((key) => {
1274
1273
  if (key.includes('kc-callback-')) {
1275
1274
  keys.push(key);
1276
1275
  }
@@ -1316,7 +1315,7 @@ class UtilsCache {
1316
1315
  if (!Array.isArray(data)) {
1317
1316
  return resolve({});
1318
1317
  }
1319
- data.forEach(obj => {
1318
+ data.forEach((obj) => {
1320
1319
  if (obj[this.itemIndexByKey].startsWith(keyCacheStartWith)) {
1321
1320
  this.ClearAsync(obj[this.itemIndexByKey], true);
1322
1321
  }
@@ -1334,7 +1333,7 @@ class UtilsCache {
1334
1333
  if (!keys || !keys.length) {
1335
1334
  return;
1336
1335
  }
1337
- keys.forEach(key => {
1336
+ keys.forEach((key) => {
1338
1337
  if (key.startsWith(keyCache)) {
1339
1338
  this.Clear(key);
1340
1339
  }
@@ -1365,7 +1364,7 @@ dayjs.extend(updateLocale);
1365
1364
  dayjs.extend(utc);
1366
1365
  dayjs.extend(timezone);
1367
1366
  dayjs.extend(customParseFormat);
1368
- let timeZoneSetup = "Asia/Ho_Chi_Minh";
1367
+ let timeZoneSetup = 'Asia/Ho_Chi_Minh';
1369
1368
  const setDefaultTimeZone = (localeZone = timeZoneSetup) => {
1370
1369
  timeZoneSetup = localeZone;
1371
1370
  dayjs.tz.setDefault(localeZone);
@@ -1375,13 +1374,13 @@ const updateFunctionFormatDate = (functionCustom) => {
1375
1374
  functionFormatDate = functionCustom;
1376
1375
  };
1377
1376
  /**
1378
- * @description Lấy đối tượng dayjs theo config
1379
- * @param config nếu không có config sẽ trả về đối tượng dayjs là thời gian hiện tại
1380
- * @param config.date thời gian cần lấy
1381
- * @param config.returnDayjsIfConfigDateNotExist true nếu muốn trả về đối tượng dayjs nếu config.date không có
1382
- * @param config.utc true nếu muốn lấy thời gian UTC
1383
- * @param config.formatOfDate định dạng thời gian đang được truyền vào
1384
- */
1377
+ * @description Lấy đối tượng dayjs theo config
1378
+ * @param config nếu không có config sẽ trả về đối tượng dayjs là thời gian hiện tại
1379
+ * @param config.date thời gian cần lấy
1380
+ * @param config.returnDayjsIfConfigDateNotExist true nếu muốn trả về đối tượng dayjs nếu config.date không có
1381
+ * @param config.utc true nếu muốn lấy thời gian UTC
1382
+ * @param config.formatOfDate định dạng thời gian đang được truyền vào
1383
+ */
1385
1384
  const getDayjs = (config) => {
1386
1385
  if (!config) {
1387
1386
  return dayjs().tz();
@@ -1474,7 +1473,7 @@ const formatDate = (date, formatOutput = 'YYYY/MM/DD HH:mm', lang, formatInput)
1474
1473
  date = getDayjs({ date, formatOfDate: formatInput }).locale(lang);
1475
1474
  if (lang === 'vi') {
1476
1475
  dayjs.updateLocale('vi', {
1477
- monthsShort: 'Thg 1_Thg 2_Thg 3_Thg 4_Thg 5_Thg 6_Thg 7_Thg 8_Thg 9_Thg 10_Thg 11_Thg 12'.split('_')
1476
+ monthsShort: 'Thg 1_Thg 2_Thg 3_Thg 4_Thg 5_Thg 6_Thg 7_Thg 8_Thg 9_Thg 10_Thg 11_Thg 12'.split('_'),
1478
1477
  });
1479
1478
  }
1480
1479
  return date.format(getFormatData(getTypeByFormat(formatOutput), lang)) || '';
@@ -1587,7 +1586,7 @@ const omitBy = (objData, predicate) => {
1587
1586
  return objData;
1588
1587
  }
1589
1588
  const newObj = {};
1590
- Object.keys(objData).forEach(key => {
1589
+ Object.keys(objData).forEach((key) => {
1591
1590
  const valueOfKey = get(objData, key);
1592
1591
  if (!predicate(valueOfKey)) {
1593
1592
  set(newObj, key, valueOfKey);
@@ -1674,7 +1673,12 @@ const get = (obj, path, defaultValue = undefined, keepLastValueIfSignal) => {
1674
1673
  if (obj instanceof DOMRect) {
1675
1674
  return obj[path];
1676
1675
  }
1677
- const paths = Array.isArray(path) ? path : path.replace(/\[(\d+)]/g, '.$1').split('.').filter(key => key);
1676
+ const paths = Array.isArray(path)
1677
+ ? path
1678
+ : path
1679
+ .replace(/\[(\d+)]/g, '.$1')
1680
+ .split('.')
1681
+ .filter((key) => key);
1678
1682
  for (const index in paths) {
1679
1683
  const key = paths[index];
1680
1684
  if (obj instanceof CSSStyleDeclaration) {
@@ -1705,18 +1709,23 @@ const get = (obj, path, defaultValue = undefined, keepLastValueIfSignal) => {
1705
1709
  * set(obj, 'a.b', 2); // { a: { b: 2 } }
1706
1710
  */
1707
1711
  const set = (obj, path, value) => {
1708
- if (!obj || (typeof obj !== "object" && !isSignal(obj)) || (isSignal(obj) && typeof obj() !== "object")) {
1709
- throw new Error("The first argument must be an object");
1712
+ if (!obj || (typeof obj !== 'object' && !isSignal(obj)) || (isSignal(obj) && typeof obj() !== 'object')) {
1713
+ throw new Error('The first argument must be an object');
1710
1714
  }
1711
1715
  if (obj instanceof HttpParams) {
1712
1716
  return obj.set(`${path}`, value);
1713
1717
  }
1714
- const pathArray = Array.isArray(path) ? path : path.replace(/\[(\d+)]/g, '.[$1]').split('.').filter(key => key);
1718
+ const pathArray = Array.isArray(path)
1719
+ ? path
1720
+ : path
1721
+ .replace(/\[(\d+)]/g, '.[$1]')
1722
+ .split('.')
1723
+ .filter((key) => key);
1715
1724
  let currentObjectByKey = isSignal(obj) ? obj() : obj;
1716
1725
  let preObjectByKey = obj;
1717
1726
  pathArray.forEach((key, index) => {
1718
1727
  if (index < pathArray.length - 1) {
1719
- if (!(key in currentObjectByKey) || (typeof currentObjectByKey[key] !== "object" && !isSignal(currentObjectByKey[key]))) {
1728
+ if (!(key in currentObjectByKey) || (typeof currentObjectByKey[key] !== 'object' && !isSignal(currentObjectByKey[key]))) {
1720
1729
  const nextKey = pathArray[index + 1];
1721
1730
  key = key.replace(/\[(\d+)]/g, '$1');
1722
1731
  currentObjectByKey[key] = /\[(\d+)]/g.test(nextKey) ? [] : {};
@@ -1726,7 +1735,7 @@ const set = (obj, path, value) => {
1726
1735
  currentObjectByKey = isSignal(currentObjectByKey) ? currentObjectByKey() : currentObjectByKey;
1727
1736
  return;
1728
1737
  }
1729
- if (typeof currentObjectByKey !== "object") {
1738
+ if (typeof currentObjectByKey !== 'object') {
1730
1739
  return;
1731
1740
  }
1732
1741
  // Gán giá trị ở cuối đường dẫn
@@ -1807,13 +1816,13 @@ const cloneDeep = (data, options = { ignoreSignal: false }, seen = new WeakMap()
1807
1816
  if (data instanceof Set) {
1808
1817
  const setCopy = new Set();
1809
1818
  seen.set(data, setCopy);
1810
- data.forEach(val => {
1819
+ data.forEach((val) => {
1811
1820
  setCopy.add(cloneDeep(val, options, seen));
1812
1821
  });
1813
1822
  return setCopy;
1814
1823
  }
1815
1824
  if (Array.isArray(data)) {
1816
- seen.set(data, data.map(item => cloneDeep(item, options, seen)));
1825
+ seen.set(data, data.map((item) => cloneDeep(item, options, seen)));
1817
1826
  return seen.get(data);
1818
1827
  }
1819
1828
  if (data instanceof File || data instanceof Blob || Object.prototype.toString.call(data) === '[object File]') {
@@ -1995,7 +2004,7 @@ const isEqual = (value1, value2, options) => {
1995
2004
  return false;
1996
2005
  }
1997
2006
  if (!exactlyPosition) {
1998
- return !value1.some(item => !value2.includes(item));
2007
+ return !value1.some((item) => !value2.includes(item));
1999
2008
  }
2000
2009
  return !value1.some((item, index) => !isEqual(item, value2[index], options));
2001
2010
  }
@@ -2028,7 +2037,7 @@ const uniqBy = (data, key) => {
2028
2037
  // Xử lý mảng chứa signal values
2029
2038
  if (data[0] && isSignal(data[0])) {
2030
2039
  const seen = new Set();
2031
- return data.filter(item => {
2040
+ return data.filter((item) => {
2032
2041
  const value = `${get(item, '')}`;
2033
2042
  if (seen.has(value)) {
2034
2043
  return false;
@@ -2041,7 +2050,7 @@ const uniqBy = (data, key) => {
2041
2050
  return Array.from(new Set(data));
2042
2051
  }
2043
2052
  const dataUnique = keyBy(data, key);
2044
- return Object.keys(dataUnique).map(key => dataUnique[key]);
2053
+ return Object.keys(dataUnique).map((key) => dataUnique[key]);
2045
2054
  };
2046
2055
  const generateInterface = (obj, interfaceName) => {
2047
2056
  const generateType = (value) => {
@@ -2090,11 +2099,10 @@ const generateInterface = (obj, interfaceName) => {
2090
2099
  return interfaceStr;
2091
2100
  };
2092
2101
 
2093
- ;
2094
2102
  const step = 20;
2095
2103
  const percent = 0.05;
2096
2104
  const colorStepContrastFromOrigin = (color, stepNumber) => {
2097
- return colorContrastFromOrigin(color).find(item => item.step === stepNumber);
2105
+ return colorContrastFromOrigin(color).find((item) => item.step === stepNumber);
2098
2106
  };
2099
2107
  const colorContrastFromOrigin = (color) => {
2100
2108
  const parsedColorsArray = parseColorValues(color);
@@ -2129,10 +2137,10 @@ const parseColorValues = (colorValues) => {
2129
2137
  return colorValuesArray;
2130
2138
  };
2131
2139
  const calculateShades = (colorValue) => {
2132
- return calculate(colorValue, rgbShade).concat("000000");
2140
+ return calculate(colorValue, rgbShade).concat('000000');
2133
2141
  };
2134
2142
  const calculateTints = (colorValue) => {
2135
- return calculate(colorValue, rgbTint).concat("ffffff");
2143
+ return calculate(colorValue, rgbTint).concat('ffffff');
2136
2144
  };
2137
2145
  const calculate = (colorValue, shadeOrTint) => {
2138
2146
  const color = hexToRGB(colorValue);
@@ -2142,11 +2150,21 @@ const calculate = (colorValue, shadeOrTint) => {
2142
2150
  }
2143
2151
  return shadeValues;
2144
2152
  };
2145
- const rgbShade = (rgb, i) => { return { red: rgb.red * (1 - percent * i), green: rgb.green * (1 - percent * i), blue: rgb.blue * (1 - percent * i) }; };
2146
- const rgbTint = (rgb, i) => { return { red: rgb.red + (255 - rgb.red) * i * percent, green: rgb.green + (255 - rgb.green) * i * percent, blue: rgb.blue + (255 - rgb.blue) * i * percent }; };
2147
- const rgbToHex = (rgb) => { return intToHex(rgb.red) + intToHex(rgb.green) + intToHex(rgb.blue); };
2148
- const hexToRGB = (colorValue) => { return { red: parseInt(colorValue.substr(0, 2), 16), green: parseInt(colorValue.substr(2, 2), 16), blue: parseInt(colorValue.substr(4, 2), 16) }; };
2149
- const intToHex = (rgbint) => { return pad(Math.min(Math.max(Math.round(rgbint), 0), 255).toString(16), 2); };
2153
+ const rgbShade = (rgb, i) => {
2154
+ return { red: rgb.red * (1 - percent * i), green: rgb.green * (1 - percent * i), blue: rgb.blue * (1 - percent * i) };
2155
+ };
2156
+ const rgbTint = (rgb, i) => {
2157
+ return { red: rgb.red + (255 - rgb.red) * i * percent, green: rgb.green + (255 - rgb.green) * i * percent, blue: rgb.blue + (255 - rgb.blue) * i * percent };
2158
+ };
2159
+ const rgbToHex = (rgb) => {
2160
+ return intToHex(rgb.red) + intToHex(rgb.green) + intToHex(rgb.blue);
2161
+ };
2162
+ const hexToRGB = (colorValue) => {
2163
+ return { red: parseInt(colorValue.substr(0, 2), 16), green: parseInt(colorValue.substr(2, 2), 16), blue: parseInt(colorValue.substr(4, 2), 16) };
2164
+ };
2165
+ const intToHex = (rgbint) => {
2166
+ return pad(Math.min(Math.max(Math.round(rgbint), 0), 255).toString(16), 2);
2167
+ };
2150
2168
  const pad = (number, length) => {
2151
2169
  let str = '' + number;
2152
2170
  while (str.length < length) {
@@ -2154,9 +2172,52 @@ const pad = (number, length) => {
2154
2172
  }
2155
2173
  return str;
2156
2174
  };
2157
- const listColorDefine = ['#E62222', '#B81B1B', '#EB4E4E', '#F97316', '#C75C12', '#FA8F45', '#FFB700', '#CC9200', '#FFC533', '#84CC16', '#6AA312', '#9dd645', '#00BC62', '#00A757', '#33DA8A', '#06B6D4', '#1B59C4', '#4E8CF7', '#0EA5E9',
2158
- '#1B59C4', '#4E8CF7', '#226FF5', '#1B59C4', '#4E8CF7', '#6366F1', '#4F52C1', '#8285F4', '#5B04B3', '#49038F', '#7C36C2', '#D946EF', '#AE38BF', '#E16BF2', '#EC4899', '#BD3A7A', '#F06DAD', '#F43F5E', '#C3324B', '#F6657E', '#757380', '#5E5C66', '#918F99',
2159
- '#202020', '#1A1A1A', '#4D4D4D'
2175
+ const listColorDefine = [
2176
+ '#E62222',
2177
+ '#B81B1B',
2178
+ '#EB4E4E',
2179
+ '#F97316',
2180
+ '#C75C12',
2181
+ '#FA8F45',
2182
+ '#FFB700',
2183
+ '#CC9200',
2184
+ '#FFC533',
2185
+ '#84CC16',
2186
+ '#6AA312',
2187
+ '#9dd645',
2188
+ '#00BC62',
2189
+ '#00A757',
2190
+ '#33DA8A',
2191
+ '#06B6D4',
2192
+ '#1B59C4',
2193
+ '#4E8CF7',
2194
+ '#0EA5E9',
2195
+ '#1B59C4',
2196
+ '#4E8CF7',
2197
+ '#226FF5',
2198
+ '#1B59C4',
2199
+ '#4E8CF7',
2200
+ '#6366F1',
2201
+ '#4F52C1',
2202
+ '#8285F4',
2203
+ '#5B04B3',
2204
+ '#49038F',
2205
+ '#7C36C2',
2206
+ '#D946EF',
2207
+ '#AE38BF',
2208
+ '#E16BF2',
2209
+ '#EC4899',
2210
+ '#BD3A7A',
2211
+ '#F06DAD',
2212
+ '#F43F5E',
2213
+ '#C3324B',
2214
+ '#F6657E',
2215
+ '#757380',
2216
+ '#5E5C66',
2217
+ '#918F99',
2218
+ '#202020',
2219
+ '#1A1A1A',
2220
+ '#4D4D4D',
2160
2221
  ];
2161
2222
  const getColorById = (str) => {
2162
2223
  let hashString = 0;
@@ -2165,7 +2226,7 @@ const getColorById = (str) => {
2165
2226
  }
2166
2227
  for (let i = 0; i < str.length; i++) {
2167
2228
  const char = str.charCodeAt(i);
2168
- hashString = ((hashString << 5) - hashString) + char;
2229
+ hashString = (hashString << 5) - hashString + char;
2169
2230
  hashString = hashString & hashString;
2170
2231
  }
2171
2232
  return listColorDefine[Math.abs(hashString) % listColorDefine.length];
@@ -2305,8 +2366,8 @@ const getKeyCacheByArrayObject = (keyCache, argumentsValue) => {
2305
2366
  keyBuild = `${keyBuild}${JSON.stringify(item)}`;
2306
2367
  return;
2307
2368
  }
2308
- const keys = (item instanceof HttpParams ? item.keys() : Object.keys(item)).sort(((str1, str2) => str1.localeCompare(str2)));
2309
- keys.forEach(key => {
2369
+ const keys = (item instanceof HttpParams ? item.keys() : Object.keys(item)).sort((str1, str2) => str1.localeCompare(str2));
2370
+ keys.forEach((key) => {
2310
2371
  if (key.toLocaleLowerCase() === 'pem') {
2311
2372
  return;
2312
2373
  }
@@ -2350,7 +2411,7 @@ const viewDataNumberByLanguage = (value, acceptNegativeValue, parseFixed = 1, ig
2350
2411
  return Math.round(value * fixed) / fixed;
2351
2412
  };
2352
2413
  if (parseFixed > (floatStr?.length || 0)) {
2353
- const maxParseFixed = (acceptNegativeValue && +value < 0) ? 17 : 16;
2414
+ const maxParseFixed = acceptNegativeValue && +value < 0 ? 17 : 16;
2354
2415
  const fixed = maxParseFixed - (intStr?.length || 0);
2355
2416
  parseFixed = parseFixed < fixed ? parseFixed : fixed;
2356
2417
  }
@@ -2377,7 +2438,10 @@ const viewDataNumberByLanguage = (value, acceptNegativeValue, parseFixed = 1, ig
2377
2438
  if (lang === UtilsLanguageConstants.EN) {
2378
2439
  return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
2379
2440
  }
2380
- return value.toString().replace('.', ',').replace(/\B(?=(\d{3})+(?!\d))/g, '.');
2441
+ return value
2442
+ .toString()
2443
+ .replace('.', ',')
2444
+ .replace(/\B(?=(\d{3})+(?!\d))/g, '.');
2381
2445
  }
2382
2446
  };
2383
2447
 
@@ -2419,12 +2483,12 @@ const convertObjectToSignal = (data, cloneDeepIfNotSignal = true, isSignalPrimit
2419
2483
  return seen.get(data);
2420
2484
  }
2421
2485
  if (Array.isArray(data)) {
2422
- seen.set(data, signal(data.map(item => convertObjectToSignal(item, cloneDeepIfNotSignal, isSignalPrimitiveType, acceptConvertObjectInnerWritableSignal, seen))));
2486
+ seen.set(data, signal(data.map((item) => convertObjectToSignal(item, cloneDeepIfNotSignal, isSignalPrimitiveType, acceptConvertObjectInnerWritableSignal, seen))));
2423
2487
  return seen.get(data);
2424
2488
  }
2425
2489
  if (data instanceof Map) {
2426
2490
  const mapCopy = new Map();
2427
- Array.from(data.keys()).forEach(key => {
2491
+ Array.from(data.keys()).forEach((key) => {
2428
2492
  mapCopy.set(key, convertObjectToSignal(data.get(key), cloneDeepIfNotSignal, isSignalPrimitiveType, acceptConvertObjectInnerWritableSignal));
2429
2493
  });
2430
2494
  seen.set(data, signal(mapCopy));
@@ -2437,7 +2501,19 @@ const convertObjectToSignal = (data, cloneDeepIfNotSignal = true, isSignalPrimit
2437
2501
  seen.set(data, data);
2438
2502
  for (const key in data()) {
2439
2503
  const value = data()[key];
2440
- if (value instanceof TemplateRef || value instanceof File || value instanceof Blob || Object.prototype.toString.call(value) === '[object File]' || value instanceof ElementRef || value instanceof Element || value instanceof Date || value instanceof RegExp || value instanceof Set || value instanceof Map || value instanceof Promise || value instanceof Observable || value instanceof HttpParams) {
2504
+ if (value instanceof TemplateRef ||
2505
+ value instanceof File ||
2506
+ value instanceof Blob ||
2507
+ Object.prototype.toString.call(value) === '[object File]' ||
2508
+ value instanceof ElementRef ||
2509
+ value instanceof Element ||
2510
+ value instanceof Date ||
2511
+ value instanceof RegExp ||
2512
+ value instanceof Set ||
2513
+ value instanceof Map ||
2514
+ value instanceof Promise ||
2515
+ value instanceof Observable ||
2516
+ value instanceof HttpParams) {
2441
2517
  continue;
2442
2518
  }
2443
2519
  if (Object.prototype.hasOwnProperty.call(data(), key)) {
@@ -2472,12 +2548,12 @@ const convertSignalToObject = (data, isCloneDeep = true, seen = new WeakMap()) =
2472
2548
  if (!isSignal(data[0])) {
2473
2549
  return data;
2474
2550
  }
2475
- seen.set(data, data.map(item => convertSignalToObject((isCloneDeep ? cloneDeep(item) : item), isCloneDeep, seen)));
2551
+ seen.set(data, data.map((item) => convertSignalToObject(isCloneDeep ? cloneDeep(item) : item, isCloneDeep, seen)));
2476
2552
  return seen.get(data);
2477
2553
  }
2478
2554
  if (data instanceof Map) {
2479
2555
  const mapCopy = new Map();
2480
- Array.from(data.keys()).forEach(key => {
2556
+ Array.from(data.keys()).forEach((key) => {
2481
2557
  mapCopy.set(key, convertSignalToObject(isCloneDeep ? cloneDeep(data.get(key)) : data.get(key), isCloneDeep));
2482
2558
  });
2483
2559
  seen.set(data, mapCopy);
@@ -2502,9 +2578,12 @@ const convertSignalToObject = (data, isCloneDeep = true, seen = new WeakMap()) =
2502
2578
 
2503
2579
  const ENCODE_URI_PATTERN = /%([0-9A-F]{2})/g;
2504
2580
  const decodeURI = (value) => {
2505
- return decodeURIComponent(value.split('').map((c) => {
2581
+ return decodeURIComponent(value
2582
+ .split('')
2583
+ .map((c) => {
2506
2584
  return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
2507
- }).join(''));
2585
+ })
2586
+ .join(''));
2508
2587
  };
2509
2588
  const encodeURI = (value) => {
2510
2589
  return encodeURIComponent(value).replace(ENCODE_URI_PATTERN, (match, p1) => {
@@ -2512,7 +2591,7 @@ const encodeURI = (value) => {
2512
2591
  });
2513
2592
  };
2514
2593
  const endCodeUrl = (params, isBody) => {
2515
- params = omitBy(params, param => param === '' || isNil(param));
2594
+ params = omitBy(params, (param) => param === '' || isNil(param));
2516
2595
  let res = '';
2517
2596
  for (const p in params) {
2518
2597
  res += `&${p}=${encodeURIComponent(params[p])}`;
@@ -2590,7 +2669,7 @@ const downloadFileByUrl = async (fileUrl, filename, onlyOpen) => {
2590
2669
  const downloadImageFromELement = (imageElement, typeFileDownload, nameFile) => {
2591
2670
  const parentElement = imageElement?.src;
2592
2671
  const blobData = convertBase64ToBlob(parentElement);
2593
- const blob = new Blob([blobData], { type: typeFileDownload || "image/png" });
2672
+ const blob = new Blob([blobData], { type: typeFileDownload || 'image/png' });
2594
2673
  const url = window.URL.createObjectURL(blob);
2595
2674
  const link = document.createElement('a');
2596
2675
  link.href = url;
@@ -2602,12 +2681,22 @@ const LINK_IMAGE_ERROR_TOKEN_INJECT = new InjectionToken('LINK_IMAGE_ERROR_TOKEN
2602
2681
  const PROCESS_BAR_STANDARD_CONFIG_DEFAULT_TOKEN_INJECT = new InjectionToken('PROCESS_BAR_STANDARD_CONFIG_DEFAULT_TOKEN_INJECT');
2603
2682
  const PROCESS_BAR_STEPS_CONFIG_DEFAULT_TOKEN_INJECT = new InjectionToken('PROCESS_BAR_STEPS_CONFIG_DEFAULT_TOKEN_INJECT');
2604
2683
 
2605
- const isTypeImage = (file) => file.type.match(/image.*/) ? true : false;
2606
- const isTypeVideo = (file) => file.type.match(/video.*/) ? true : false;
2607
- const isTypeAudio = (file) => file.type.match(/audio.*/) ? true : false;
2608
- const isTypeFile = (file) => file instanceof File || Object.prototype.toString.call(file) === '[object File]' ? true : false;
2684
+ const isTypeImage = (file) => (file.type.match(/image.*/) ? true : false);
2685
+ const isTypeVideo = (file) => (file.type.match(/video.*/) ? true : false);
2686
+ const isTypeAudio = (file) => (file.type.match(/audio.*/) ? true : false);
2687
+ const isTypeFile = (file) => (file instanceof File || Object.prototype.toString.call(file) === '[object File]' ? true : false);
2609
2688
  const ExcelExtList = ['xls', 'xlsx', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
2610
- const DocumentExtList = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf', 'json', 'xml', 'application/msword',
2689
+ const DocumentExtList = [
2690
+ 'doc',
2691
+ 'docx',
2692
+ 'xls',
2693
+ 'xlsx',
2694
+ 'ppt',
2695
+ 'pptx',
2696
+ 'pdf',
2697
+ 'json',
2698
+ 'xml',
2699
+ 'application/msword',
2611
2700
  'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
2612
2701
  'application/vnd.ms-excel',
2613
2702
  'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
@@ -2615,7 +2704,8 @@ const DocumentExtList = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf', 'js
2615
2704
  'application/vnd.openxmlformats-officedocument.presentationml.presentation',
2616
2705
  'application/pdf',
2617
2706
  'application/json',
2618
- 'application/xml'];
2707
+ 'application/xml',
2708
+ ];
2619
2709
  const isIncludeDocumentExtList = (ext, listExt = DocumentExtList) => listExt.includes(ext) || listExt.includes(`application/${ext}`);
2620
2710
  const ImageExtList = ['gif', 'jpg', 'jpeg', 'png', 'image/gif', 'image/jpeg', 'image/jpeg', 'image/png'];
2621
2711
  const isIncludeImageExtList = (ext, listExt = ImageExtList) => listExt.includes(ext);
@@ -2640,7 +2730,7 @@ const getFileExtension = (file) => {
2640
2730
  fileName = url.split('/').pop() || '';
2641
2731
  set(file, 'name', fileName);
2642
2732
  }
2643
- const dots = fileName.split(".");
2733
+ const dots = fileName.split('.');
2644
2734
  if (!dots) {
2645
2735
  return;
2646
2736
  }
@@ -2743,12 +2833,12 @@ const getSmartAxisScale = (originalMaxData, options) => {
2743
2833
  }
2744
2834
  const maxValuePositive = maxValue - Math.abs(minValue);
2745
2835
  tickCount = maxValuePositive - originalMaxData > Math.abs(step) && tickCount - 1 >= minTickCount ? tickCount - 1 : tickCount;
2746
- maxValue = (step * tickCount * scaleDirection) - (minValue * scaleDirection);
2836
+ maxValue = step * tickCount * scaleDirection - minValue * scaleDirection;
2747
2837
  return {
2748
2838
  stepSize: Math.abs(step),
2749
2839
  max: maxValue,
2750
2840
  min: minValue,
2751
- tickAmount: tickCount
2841
+ tickAmount: tickCount,
2752
2842
  };
2753
2843
  }
2754
2844
  }
@@ -2763,7 +2853,7 @@ const getSmartAxisScale = (originalMaxData, options) => {
2763
2853
  stepSize: Math.abs(step),
2764
2854
  max: maxValue,
2765
2855
  min: 0,
2766
- tickAmount: minTickCount
2856
+ tickAmount: minTickCount,
2767
2857
  };
2768
2858
  };
2769
2859
  // Cache cho các giá trị lũy thừa 10 để tối ưu hiệu suất
@@ -2819,7 +2909,7 @@ const getStepCandidates = (maxData, minStep, minNegative, acceptStepIsTypeFloat
2819
2909
  const checkAndSetNegativeSteps = (stepCandidates, acceptNegative, minNegative) => {
2820
2910
  if (acceptNegative && minNegative < 0) {
2821
2911
  // Tạo các step âm và thêm vào đầu danh sách
2822
- const negativeSteps = [...stepCandidates].map(step => -step);
2912
+ const negativeSteps = [...stepCandidates].map((step) => -step);
2823
2913
  stepCandidates.unshift(...negativeSteps);
2824
2914
  }
2825
2915
  };
@@ -2832,20 +2922,20 @@ const checkAndSetNegativeSteps = (stepCandidates, acceptNegative, minNegative) =
2832
2922
  const validateInputs = (maxData, options) => {
2833
2923
  // Kiểm tra maxData âm khi không chấp nhận giá trị âm
2834
2924
  if (maxData < 0 && !options?.acceptNegative) {
2835
- throw new Error("maxData is less than 0 and acceptNegative is false");
2925
+ throw new Error('maxData is less than 0 and acceptNegative is false');
2836
2926
  }
2837
2927
  if (options?.acceptNegative) {
2838
2928
  // Kiểm tra minNegative có được cung cấp không
2839
2929
  if (isNil(options.minNegative)) {
2840
- throw new Error("minNegative is required when acceptNegative is true");
2930
+ throw new Error('minNegative is required when acceptNegative is true');
2841
2931
  }
2842
2932
  // Kiểm tra maxData phải >= minNegative
2843
2933
  if (maxData < options.minNegative) {
2844
- throw new Error("maxData is less than minNegative");
2934
+ throw new Error('maxData is less than minNegative');
2845
2935
  }
2846
2936
  // Kiểm tra minNegative phải là số âm
2847
2937
  if (options.minNegative >= 0) {
2848
- throw new Error("minNegative must be negative");
2938
+ throw new Error('minNegative must be negative');
2849
2939
  }
2850
2940
  }
2851
2941
  };
@@ -2865,7 +2955,7 @@ const revealString = (encoded) => {
2865
2955
  const decoded = base
2866
2956
  .split('')
2867
2957
  .reverse()
2868
- .map(c => String.fromCharCode(c.charCodeAt(0) ^ xorKey))
2958
+ .map((c) => String.fromCharCode(c.charCodeAt(0) ^ xorKey))
2869
2959
  .join('');
2870
2960
  return decoded;
2871
2961
  };