@libs-ui/utils 0.2.304 → 0.2.306-10

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.
Files changed (44) hide show
  1. package/communicate-micro.d.ts +1 -1
  2. package/dangerous-object.d.ts +75 -0
  3. package/date.d.ts +14 -19
  4. package/dom.d.ts +21 -3
  5. package/esm2022/base64.mjs +2 -2
  6. package/esm2022/cache.mjs +20 -16
  7. package/esm2022/color.mjs +66 -14
  8. package/esm2022/communicate-micro.mjs +20 -16
  9. package/esm2022/constants.mjs +1 -1
  10. package/esm2022/crypto-3rd.mjs +3 -3
  11. package/esm2022/crypto.mjs +3 -3
  12. package/esm2022/dangerous-object.mjs +143 -0
  13. package/esm2022/date.mjs +24 -22
  14. package/esm2022/dom.mjs +127 -17
  15. package/esm2022/download.mjs +3 -3
  16. package/esm2022/file.mjs +23 -11
  17. package/esm2022/format-number.mjs +9 -6
  18. package/esm2022/format-text.mjs +13 -15
  19. package/esm2022/function-check-embed-frame.mjs +1 -1
  20. package/esm2022/get-smart-axis-scale.mjs +10 -10
  21. package/esm2022/helpers.mjs +136 -48
  22. package/esm2022/http-params.mjs +2 -2
  23. package/esm2022/index.mjs +2 -1
  24. package/esm2022/inject-token.mjs +2 -2
  25. package/esm2022/key-cache.mjs +6 -6
  26. package/esm2022/key-code.mjs +1 -1
  27. package/esm2022/language.mjs +28 -28
  28. package/esm2022/pattern.mjs +1 -1
  29. package/esm2022/random.mjs +2 -2
  30. package/esm2022/two-way-signal-object.mjs +32 -20
  31. package/esm2022/uri.mjs +9 -6
  32. package/esm2022/url-search-params.mjs +13 -11
  33. package/esm2022/uuid.mjs +2 -2
  34. package/esm2022/xss-filter.mjs +1 -1
  35. package/fesm2022/libs-ui-utils.mjs +797 -368
  36. package/fesm2022/libs-ui-utils.mjs.map +1 -1
  37. package/file.d.ts +2 -2
  38. package/format-text.d.ts +1 -1
  39. package/helpers.d.ts +54 -5
  40. package/http-params.d.ts +1 -1
  41. package/index.d.ts +1 -0
  42. package/inject-token.d.ts +1 -1
  43. package/package.json +2 -2
  44. package/uri.d.ts +1 -1
package/file.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IFile } from "@libs-ui/interfaces-types";
1
+ import { IFile } from '@libs-ui/interfaces-types';
2
2
  export declare const isTypeImage: (file: File | Blob) => boolean;
3
3
  export declare const isTypeVideo: (file: File | Blob) => boolean;
4
4
  export declare const isTypeAudio: (file: File | Blob) => boolean;
@@ -15,4 +15,4 @@ export declare const isIncludeAudioExtList: (ext: string, listExt?: Array<string
15
15
  export declare const getFileExtension: (file: IFile | File) => string | undefined;
16
16
  export declare const getLabelBySizeFile: (size: number, toFixed?: number) => string;
17
17
  export declare const convertBlobToFile: (blob: Blob, fileName?: string) => File;
18
- export declare const convertUrlToFile: (url: string, fileName?: string) => Promise<File>;
18
+ export declare const convertUrlToFile: (url: string, fileName?: string) => Promise<File | undefined>;
package/format-text.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ITextFormatOptions } from "@libs-ui/interfaces-types";
1
+ import { ITextFormatOptions } from '@libs-ui/interfaces-types';
2
2
  export declare const highlightByKeyword: (value: string | undefined, search: string | undefined, ignoreHighlight?: boolean, classHightLight?: string) => string;
3
3
  export declare const formatTextCompare: (text: string, options?: ITextFormatOptions) => string;
4
4
  export declare const fullNameFormat: (value: string) => string;
package/helpers.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { TYPE_OBJECT } from "@libs-ui/interfaces-types";
1
+ import { Signal } from '@angular/core';
2
+ import { GetReturnType, GetValueAtPath, PathOf, TYPE_OBJECT } from '@libs-ui/interfaces-types';
2
3
  /**Các hàm tương tự thư viện lodash */
3
4
  /**
4
5
  * Kiểm tra xem một giá trị có phải là null hoặc undefined hay không
@@ -10,7 +11,9 @@ import { TYPE_OBJECT } from "@libs-ui/interfaces-types";
10
11
  * isNil(0); // false
11
12
  * isNil('hello'); // false
12
13
  */
13
- export declare const isNil: (value: unknown) => value is null | undefined;
14
+ export declare const isNil: (value: unknown, options?: {
15
+ ignoreUnWrapSignal?: boolean;
16
+ }) => value is null | undefined;
14
17
  /**
15
18
  * Kiểm tra xem một giá trị có phải là rỗng hay không
16
19
  * @param value Giá trị cần kiểm tra
@@ -24,7 +27,49 @@ export declare const isNil: (value: unknown) => value is null | undefined;
24
27
  * isEmpty([1, 2, 3]); // false
25
28
  * isEmpty({ a: 1 }); // false
26
29
  */
27
- export declare const isEmpty: (value: unknown) => boolean;
30
+ export declare const isEmpty: (value: unknown, options?: {
31
+ ignoreCheckTypePrimitive?: boolean;
32
+ ignoreUnWrapSignal?: boolean;
33
+ ignoreCheckString?: boolean;
34
+ }) => value is null | undefined | "" | 0;
35
+ /**
36
+ * Kiểm tra xem một giá trị có phải là null, rỗng, undefined hoặc 0 hay không
37
+ * @param value Giá trị cần kiểm tra
38
+ * @param options Cấu hình tùy chọn
39
+ * @param options.ignoreZero Nếu true, sẽ không kiểm tra giá trị 0
40
+ * @returns true nếu giá trị là null, rỗng, undefined hoặc 0, false nếu không
41
+ * @example
42
+ * isTruthy(null); // false
43
+ * isTruthy(''); // false
44
+ * isTruthy(undefined); // false
45
+ * isTruthy(0); // false
46
+ * isTruthy({}); // true
47
+ * isTruthy(0, { ignoreZero: true }); // true
48
+ */
49
+ export declare const isTruthy: <T>(value: T, options?: {
50
+ ignoreZero?: boolean;
51
+ ignoreCheckString?: boolean;
52
+ ignoreUnWrapSignal?: boolean;
53
+ }) => value is NonNullable<T>;
54
+ /**
55
+ * Kiểm tra xem một giá trị có phải là null, rỗng, undefined hoặc 0 hay không
56
+ * @param value Giá trị cần kiểm tra
57
+ * @param options Cấu hình tùy chọn
58
+ * @param options.ignoreZero Nếu true, sẽ không kiểm tra giá trị 0
59
+ * @returns true nếu giá trị là null, rỗng, undefined hoặc 0, false nếu không
60
+ * @example
61
+ * isFalsy(null); // true
62
+ * isFalsy(''); // true
63
+ * isFalsy(undefined); // true
64
+ * isFalsy(0); // true
65
+ * isFalsy({}); // false
66
+ * isFalsy(0, { ignoreZero: true }); // false
67
+ */
68
+ export declare const isFalsy: (value: unknown, options?: {
69
+ ignoreZero?: boolean;
70
+ ignoreCheckString?: boolean;
71
+ ignoreUnWrapSignal?: boolean;
72
+ }) => value is null | undefined | "" | 0;
28
73
  /**
29
74
  * Loại bỏ các thuộc tính của đối tượng dựa trên một hàm điều kiện
30
75
  * @param objData Đối tượng cần xử lý
@@ -98,7 +143,7 @@ export declare const omitBy: <T>(objData: Record<string, any>, predicate: (val:
98
143
  * get(null, 'any.path'); // undefined
99
144
  * get(undefined, 'any.path', 'fallback'); // 'fallback'
100
145
  */
101
- export declare const get: <T = any>(obj: any, path: string | string[], defaultValue?: any, keepLastValueIfSignal?: boolean) => T;
146
+ export declare const get: <O, P extends PathOf<O> = PathOf<O>, KS extends boolean = false, D extends GetValueAtPath<O, P, KS> | undefined = undefined>(obj: Signal<O> | O, path: P, defaultValue?: D, keepLastValueIfSignal?: KS) => GetReturnType<O, P, KS, D>;
102
147
  /**
103
148
  * Thiết lập giá trị cho một thuộc tính trong đối tượng theo đường dẫn chỉ định
104
149
  * @param obj Đối tượng cần thiết lập giá trị
@@ -110,7 +155,10 @@ export declare const get: <T = any>(obj: any, path: string | string[], defaultVa
110
155
  * const obj = { a: { b: 1 } };
111
156
  * set(obj, 'a.b', 2); // { a: { b: 2 } }
112
157
  */
113
- export declare const set: <T = any>(obj: any, path: string | string[], value: any) => T;
158
+ export declare const set: <O, P extends PathOf<O> = PathOf<O>, T extends GetValueAtPath<O, P, true> = GetValueAtPath<O, P, true>>(obj: Signal<O> | O, path: P, value: T, options?: {
159
+ valueDefaultPathObjectUndefined?: any;
160
+ valueDefaultPathArrayUndefined?: any;
161
+ }) => O;
114
162
  /**
115
163
  * Tạo một bản sao sâu của một đối tượng hoặc giá trị bất kỳ
116
164
  * @param data Dữ liệu cần sao chép
@@ -197,6 +245,7 @@ export declare const range: (start: number, end?: number, step?: number) => Arra
197
245
  export declare const isEqual: (value1: any, value2: any, options?: {
198
246
  exactlyPosition?: boolean;
199
247
  ignoreExactlyDataType?: boolean;
248
+ ignoreUnWrapSignal?: boolean;
200
249
  }) => boolean;
201
250
  /**
202
251
  * Loại bỏ các phần tử trùng lặp trong mảng dựa trên một thuộc tính chỉ định
package/http-params.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HttpParameterCodec, HttpParams } from "@angular/common/http";
1
+ import { HttpParameterCodec, HttpParams } from '@angular/common/http';
2
2
  export declare const UtilsHttpParamsRequestInstance: <Type>(options?: HttpParamsOptions<Type>, instance?: HttpParams) => UtilsHttpParamsRequest<Type>;
3
3
  export declare class UtilsHttpParamsRequest<Type = {
4
4
  pem: string;
package/index.d.ts CHANGED
@@ -26,3 +26,4 @@ export * from './uri';
26
26
  export * from './format-text';
27
27
  export * from './get-smart-axis-scale';
28
28
  export * from './random';
29
+ export * from './dangerous-object';
package/inject-token.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { InjectionToken } from "@angular/core";
1
+ import { InjectionToken } from '@angular/core';
2
2
  export declare const LINK_IMAGE_ERROR_TOKEN_INJECT: InjectionToken<string>;
3
3
  export declare const PROCESS_BAR_STANDARD_CONFIG_DEFAULT_TOKEN_INJECT: InjectionToken<string>;
4
4
  export declare const PROCESS_BAR_STEPS_CONFIG_DEFAULT_TOKEN_INJECT: InjectionToken<string>;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@libs-ui/utils",
3
- "version": "0.2.304",
3
+ "version": "0.2.306-10",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.0.0",
6
6
  "@angular/core": ">=18.0.0",
7
7
  "crypto-es": "^2.1.0",
8
8
  "dayjs": "1.11.5",
9
- "@libs-ui/interfaces-types": "0.2.304",
9
+ "@libs-ui/interfaces-types": "0.2.306-10",
10
10
  "rxjs": "~7.8.0"
11
11
  },
12
12
  "sideEffects": false,
package/uri.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TYPE_OBJECT } from "@libs-ui/interfaces-types";
1
+ import { TYPE_OBJECT } from '@libs-ui/interfaces-types';
2
2
  export declare const ENCODE_URI_PATTERN: RegExp;
3
3
  export declare const decodeURI: (value: string) => string;
4
4
  export declare const encodeURI: (value: string) => string;