@libs-ui/utils 0.1.1-1

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 (65) hide show
  1. package/README.md +3 -0
  2. package/base64.d.ts +5 -0
  3. package/cache.d.ts +42 -0
  4. package/color.d.ts +11 -0
  5. package/communicate-micro.d.ts +16 -0
  6. package/constants.d.ts +10 -0
  7. package/crypto-3rd.d.ts +7 -0
  8. package/crypto.d.ts +8 -0
  9. package/dangerous-object.d.ts +79 -0
  10. package/date.d.ts +44 -0
  11. package/dom.d.ts +52 -0
  12. package/download.d.ts +3 -0
  13. package/esm2022/base64.mjs +43 -0
  14. package/esm2022/cache.mjs +388 -0
  15. package/esm2022/color.mjs +133 -0
  16. package/esm2022/communicate-micro.mjs +149 -0
  17. package/esm2022/constants.mjs +11 -0
  18. package/esm2022/crypto-3rd.mjs +38 -0
  19. package/esm2022/crypto.mjs +41 -0
  20. package/esm2022/dangerous-object.mjs +149 -0
  21. package/esm2022/date.mjs +191 -0
  22. package/esm2022/dom.mjs +256 -0
  23. package/esm2022/download.mjs +41 -0
  24. package/esm2022/file.mjs +90 -0
  25. package/esm2022/format-number.mjs +66 -0
  26. package/esm2022/format-text.mjs +149 -0
  27. package/esm2022/function-check-embed-frame.mjs +10 -0
  28. package/esm2022/get-smart-axis-scale.mjs +174 -0
  29. package/esm2022/helpers.mjs +651 -0
  30. package/esm2022/http-params.mjs +80 -0
  31. package/esm2022/index.mjs +30 -0
  32. package/esm2022/inject-token.mjs +5 -0
  33. package/esm2022/key-cache.mjs +31 -0
  34. package/esm2022/key-code.mjs +123 -0
  35. package/esm2022/language.mjs +70 -0
  36. package/esm2022/libs-ui-utils.mjs +5 -0
  37. package/esm2022/pattern.mjs +62 -0
  38. package/esm2022/random.mjs +42 -0
  39. package/esm2022/two-way-signal-object.mjs +131 -0
  40. package/esm2022/uri.mjs +25 -0
  41. package/esm2022/url-search-params.mjs +99 -0
  42. package/esm2022/uuid.mjs +18 -0
  43. package/esm2022/xss-filter.mjs +10 -0
  44. package/fesm2022/libs-ui-utils.mjs +3234 -0
  45. package/fesm2022/libs-ui-utils.mjs.map +1 -0
  46. package/file.d.ts +18 -0
  47. package/format-number.d.ts +2 -0
  48. package/format-text.d.ts +11 -0
  49. package/function-check-embed-frame.d.ts +2 -0
  50. package/get-smart-axis-scale.d.ts +34 -0
  51. package/helpers.d.ts +270 -0
  52. package/http-params.d.ts +37 -0
  53. package/index.d.ts +29 -0
  54. package/inject-token.d.ts +4 -0
  55. package/key-cache.d.ts +1 -0
  56. package/key-code.d.ts +122 -0
  57. package/language.d.ts +37 -0
  58. package/package.json +29 -0
  59. package/pattern.d.ts +20 -0
  60. package/random.d.ts +3 -0
  61. package/two-way-signal-object.d.ts +15 -0
  62. package/uri.d.ts +5 -0
  63. package/url-search-params.d.ts +25 -0
  64. package/uuid.d.ts +1 -0
  65. package/xss-filter.d.ts +3 -0
@@ -0,0 +1,11 @@
1
+ import { ITextFormatOptions } from '@libs-ui/interfaces-types';
2
+ export declare const highlightByKeyword: (value: string | undefined, search: string | undefined, ignoreHighlight?: boolean, classHightLight?: string) => string;
3
+ export declare const formatTextCompare: (text: string, options?: ITextFormatOptions) => string;
4
+ export declare const fullNameFormat: (value: string) => string;
5
+ export declare const capitalize: (text: string, options?: ITextFormatOptions) => string;
6
+ export declare const firstLetterToUpperCase: (text: string, options?: ITextFormatOptions) => string;
7
+ export declare const uppercaseByPosition: (text: string, position: number, options?: ITextFormatOptions) => string;
8
+ export declare const escapeHtml: (str: string) => string;
9
+ export declare const decodeEscapeHtml: (str: string) => string;
10
+ export declare const deleteUnicode: (str: string) => string;
11
+ export declare const removeEmoji: (text: string) => string;
@@ -0,0 +1,2 @@
1
+ export declare const updateFunctionCheckEmbedFrame: (functionCustom: () => boolean) => void;
2
+ export declare const isEmbedFrame: () => boolean;
@@ -0,0 +1,34 @@
1
+ interface AxisScaleOptions {
2
+ minTickCount?: number;
3
+ maxTickCount?: number;
4
+ stepCandidates?: number[];
5
+ acceptNegative?: boolean;
6
+ minNegative?: number;
7
+ acceptStepIsTypeFloat?: boolean;
8
+ }
9
+ interface AxisScaleResult {
10
+ stepSize: number;
11
+ max: number;
12
+ min: number;
13
+ tickAmount: number;
14
+ }
15
+ /**
16
+ * Tính toán smart axis scale cho biểu đồ
17
+ *
18
+ * @param maxData - Giá trị tối đa của dữ liệu
19
+ * @param options - Các tùy chọn cấu hình axis scale
20
+ * @returns Cấu hình axis scale bao gồm stepSize, max, min, tickAmount
21
+ *
22
+ * @throws {Error} INVALID_NEGATIVE_DATA - khi maxData < 0 mà acceptNegative = false
23
+ * @throws {Error} MISSING_MIN_NEGATIVE - khi acceptNegative = true nhưng thiếu minNegative
24
+ * @throws {Error} INVALID_RANGE - khi maxData < minNegative
25
+ * @throws {Error} INVALID_MIN_NEGATIVE - khi minNegative >= 0
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const result = getSmartAxisScale(100, { minTickCount: 5, maxTickCount: 10 });
30
+ * // returns { stepSize: 20, max: 120, min: 0, tickAmount: 6 }
31
+ * ```
32
+ */
33
+ export declare const getSmartAxisScale: (originalMaxData: number, options?: AxisScaleOptions) => AxisScaleResult;
34
+ export {};
package/helpers.d.ts ADDED
@@ -0,0 +1,270 @@
1
+ import { Signal } from '@angular/core';
2
+ import { GetReturnType, GetValueAtPath, PathOf, TYPE_OBJECT } from '@libs-ui/interfaces-types';
3
+ /**Các hàm tương tự thư viện lodash */
4
+ /**
5
+ * Kiểm tra xem một giá trị có phải là null hoặc undefined hay không
6
+ * @param value Giá trị cần kiểm tra
7
+ * @returns true nếu giá trị là null hoặc undefined, false nếu không
8
+ * @example
9
+ * isNil(null); // true
10
+ * isNil(undefined); // true
11
+ * isNil(0); // false
12
+ * isNil('hello'); // false
13
+ */
14
+ export declare const isNil: (value: unknown, options?: {
15
+ ignoreUnWrapSignal?: boolean;
16
+ }) => value is null | undefined;
17
+ /**
18
+ * Kiểm tra xem một giá trị có phải là rỗng hay không
19
+ * @param value Giá trị cần kiểm tra
20
+ * @returns true nếu giá trị là null, rỗng hoặc undefined, false nếu không
21
+ * @example
22
+ * isEmpty(null); // true
23
+ * isEmpty(''); // true
24
+ * isEmpty(undefined); // true
25
+ * isEmpty({}); // true
26
+ * isEmpty([]); // true
27
+ * isEmpty([1, 2, 3]); // false
28
+ * isEmpty({ a: 1 }); // false
29
+ */
30
+ export declare const isEmpty: (value: any, 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;
73
+ /**
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
75
+ * @param objData Đối tượng cần xử lý
76
+ * @param predicate Hàm điều kiện để kiểm tra giá trị của thuộc tính. Nếu hàm trả về true thì thuộc tính đó sẽ bị loại bỏ
77
+ * @returns Đối tượng mới sau khi đã loại bỏ các thuộc tính thỏa mãn điều kiện
78
+ * @example
79
+ * const obj = { a: 1, b: null, c: 3, d: undefined };
80
+ * omitBy(obj, isNil); // { a: 1, c: 3 }
81
+ */
82
+ export declare const omitBy: <T>(objData: Record<string, any>, predicate: (val: any) => boolean) => T;
83
+ /**
84
+ * Lấy giá trị từ đối tượng theo đường dẫn chỉ định
85
+ *
86
+ * Hàm này giúp bạn truy cập vào các thuộc tính sâu bên trong một đối tượng một cách an toàn,
87
+ * tránh lỗi khi thuộc tính không tồn tại.
88
+ *
89
+ * @param obj Đối tượng nguồn cần lấy giá trị
90
+ * @param path Đường dẫn đến thuộc tính cần lấy. Có thể là:
91
+ * - Chuỗi: 'user.profile.name' hoặc 'items[0].title'
92
+ * - Mảng: ['user', 'profile', 'name'] hoặc ['items', '0', 'title']
93
+ * - Chuỗi rỗng '': trả về chính đối tượng gốc
94
+ * @param defaultValue Giá trị mặc định trả về khi không tìm thấy thuộc tính (mặc định: undefined)
95
+ * @param keepLastValueIfSignal Có giữ nguyên signal cuối cùng hay không (mặc định: false - sẽ gọi signal())
96
+ * @returns Giá trị tìm được hoặc giá trị mặc định
97
+ *
98
+ * @example
99
+ * // Ví dụ cơ bản
100
+ * const user = { name: 'John', age: 30 };
101
+ * get(user, 'name'); // 'John'
102
+ * get(user, 'email'); // undefined
103
+ * get(user, 'email', 'no-email'); // 'no-email'
104
+ *
105
+ * @example
106
+ * // Truyền path rỗng - trả về chính đối tượng gốc
107
+ * const data = { name: 'Alice', age: 25 };
108
+ * get(data, ''); // { name: 'Alice', age: 25 } (chính đối tượng data)
109
+ * get(data, '', 'default'); // { name: 'Alice', age: 25 } (bỏ qua defaultValue)
110
+ *
111
+ * @example
112
+ * // Truy cập thuộc tính sâu
113
+ * const data = {
114
+ * user: {
115
+ * profile: {
116
+ * name: 'Alice',
117
+ * settings: { theme: 'dark' }
118
+ * }
119
+ * }
120
+ * };
121
+ * get(data, 'user.profile.name'); // 'Alice'
122
+ * get(data, 'user.profile.settings.theme'); // 'dark'
123
+ * get(data, 'user.profile.avatar', 'default.jpg'); // 'default.jpg'
124
+ *
125
+ * @example
126
+ * // Truy cập mảng
127
+ * const items = [
128
+ * { name: 'Item 1', price: 100 },
129
+ * { name: 'Item 2', price: 200 }
130
+ * ];
131
+ * get(items, '[0].name'); // 'Item 1'
132
+ * get(items, '[1].name'); // 'Item 2'
133
+ * get(items, '[2].name', 'Not found'); // 'Not found'
134
+ *
135
+ * @example
136
+ * // Sử dụng với mảng path
137
+ * const nested = { a: { b: { c: 'deep value' } } };
138
+ * get(nested, ['a', 'b', 'c']); // 'deep value'
139
+ * get(nested, ['a', 'b', 'd'], 'default'); // 'default'
140
+ *
141
+ * @example
142
+ * // Trường hợp đặc biệt
143
+ * get(null, 'any.path'); // undefined
144
+ * get(undefined, 'any.path', 'fallback'); // 'fallback'
145
+ */
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>;
147
+ /**
148
+ * Thiết lập giá trị cho một thuộc tính trong đối tượng theo đường dẫn chỉ định
149
+ * @param obj Đối tượng cần thiết lập giá trị
150
+ * @param path Đường dẫn đến thuộc tính, có thể là chuỗi (vd: 'a.b.c') hoặc mảng (vd: ['a', 'b', 'c'])
151
+ * @param value Giá trị cần thiết lập
152
+ * @returns Đối tượng sau khi đã thiết lập giá trị
153
+ * @throws Error nếu tham số đầu tiên không phải là đối tượng
154
+ * @example
155
+ * const obj = { a: { b: 1 } };
156
+ * set(obj, 'a.b', 2); // { a: { b: 2 } }
157
+ */
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;
162
+ /**
163
+ * Tạo một bản sao sâu của một đối tượng hoặc giá trị bất kỳ
164
+ * @param data Dữ liệu cần sao chép
165
+ * @param options Tùy chọn cấu hình
166
+ * @param options.ignoreSignal Nếu true, sẽ không sao chép các signal mà trả về signal gốc
167
+ * @param seen WeakMap để theo dõi các tham chiếu đã được sao chép, tránh lặp vô hạn với các tham chiếu vòng
168
+ * @returns Bản sao sâu của dữ liệu đầu vào
169
+ * @example
170
+ * const obj = {
171
+ * a: 1,
172
+ * b: { c: 2 },
173
+ * d: [1, 2, 3]
174
+ * };
175
+ * const clone = cloneDeep(obj);
176
+ * // clone là một bản sao hoàn toàn độc lập của obj
177
+ */
178
+ export declare const cloneDeep: <T = any>(data: any, options?: {
179
+ ignoreSignal: boolean;
180
+ }, seen?: WeakMap<object, any>) => T;
181
+ /**
182
+ * Chuyển đổi một mảng các đối tượng thành một đối tượng với khóa được chỉ định
183
+ * @param data Mảng các đối tượng cần chuyển đổi
184
+ * @param key Tên thuộc tính được sử dụng làm khóa trong đối tượng kết quả
185
+ * @returns Đối tượng với các giá trị từ mảng được đánh key theo thuộc tính đã chỉ định
186
+ * @example
187
+ * const data = [
188
+ * { id: 1, name: 'John' },
189
+ * { id: 2, name: 'Jane' }
190
+ * ];
191
+ * keyBy(data, 'id');
192
+ * // Kết quả: {
193
+ * // '1': { id: 1, name: 'John' },
194
+ * // '2': { id: 2, name: 'Jane' }
195
+ * // }
196
+ */
197
+ export declare const keyBy: (data: Array<TYPE_OBJECT>, key: string) => TYPE_OBJECT;
198
+ /**
199
+ * Nhóm các đối tượng trong một mảng thành các nhóm dựa trên một thuộc tính cụ thể
200
+ * @param data Mảng các đối tượng cần nhóm
201
+ * @param key Tên thuộc tính được sử dụng làm khóa nhóm
202
+ * @returns Đối tượng với các giá trị từ mảng được nhóm theo thuộc tính đã chỉ định
203
+ * @example
204
+ * const data = [
205
+ * { id: 1, name: 'John' },
206
+ * { id: 2, name: 'Jane' },
207
+ * { id: 1, name: 'John' }
208
+ * ];
209
+ * groupBy(data, 'id');
210
+ * // Kết quả: {
211
+ * // '1': [
212
+ * // { id: 1, name: 'John' },
213
+ * // { id: 1, name: 'John' }
214
+ * // ],
215
+ * // '2': [
216
+ * // { id: 2, name: 'Jane' }
217
+ * // }
218
+ */
219
+ export declare const groupBy: (data: Array<TYPE_OBJECT>, key: string) => TYPE_OBJECT;
220
+ /**
221
+ * Tạo một mảng các số từ giá trị bắt đầu đến giá trị kết thúc với bước nhảy tùy chọn
222
+ * @param start Giá trị bắt đầu của dãy số. Nếu chỉ có một tham số, đây sẽ là giá trị kết thúc và giá trị bắt đầu sẽ là 0
223
+ * @param end Giá trị kết thúc của dãy số (tùy chọn)
224
+ * @param step Bước nhảy giữa các số trong dãy (tùy chọn). Mặc định là 1 nếu end > start, -1 nếu end < start
225
+ * @returns Mảng các số từ start đến end với bước nhảy step
226
+ * @example
227
+ * range(4); // [0, 1, 2, 3]
228
+ * range(1, 5); // [1, 2, 3, 4]
229
+ * range(0, 20, 5); // [0, 5, 10, 15]
230
+ * range(5, 2); // [5, 4, 3]
231
+ */
232
+ export declare const range: (start: number, end?: number, step?: number) => Array<number>;
233
+ /**
234
+ * So sánh hai giá trị bất kỳ có bằng nhau hay không
235
+ * @param value1 Giá trị thứ nhất cần so sánh
236
+ * @param value2 Giá trị thứ hai cần so sánh
237
+ * @param exactlyPosition Có so sánh chính xác vị trí các phần tử trong mảng hay không
238
+ * @returns true nếu hai giá trị bằng nhau, false nếu không bằng nhau
239
+ * @example
240
+ * isEqual([1,2,3], [1,2,3]); // true
241
+ * isEqual([1,2,3], [3,2,1]); // true khi exactlyPosition = false
242
+ * isEqual([1,2,3], [3,2,1]); // false khi exactlyPosition = true
243
+ * isEqual({a:1}, {a:1}); // true
244
+ */
245
+ export declare const isEqual: (value1: any, value2: any, options?: {
246
+ exactlyPosition?: boolean;
247
+ ignoreExactlyDataType?: boolean;
248
+ ignoreUnWrapSignal?: boolean;
249
+ }) => boolean;
250
+ /**
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
252
+ * @param data Mảng dữ liệu cần xử lý
253
+ * @param key Tên thuộc tính dùng để so sánh trùng lặp. Nếu không có key thì so sánh trực tiếp giá trị
254
+ * @returns Mảng mới chứa các phần tử không trùng lặp
255
+ * @example
256
+ * const arr = [
257
+ * { id: 1, name: 'A' },
258
+ * { id: 2, name: 'B' },
259
+ * { id: 1, name: 'C' }
260
+ * ];
261
+ * uniqBy(arr, 'id'); // [{ id: 1, name: 'A' }, { id: 2, name: 'B' }]
262
+ *
263
+ * const numbers = [1, 2, 2, 3, 3];
264
+ * uniqBy(numbers); // [1, 2, 3]
265
+ *
266
+ * const numbersSignal = [signal(1), signal(2), signal(3), signal(2), signal(5), signal(4), signal(1), signal(6), signal(7), signal(6)];
267
+ * uniqBy(numbersSignal); // [signal(1), signal(2), signal(3), signal(5), signal(4), signal(6), signal(7)]
268
+ */
269
+ export declare const uniqBy: <T>(data: Array<T>, key?: string) => Array<T>;
270
+ export declare const generateInterface: (obj: any, interfaceName: string) => string;
@@ -0,0 +1,37 @@
1
+ import { HttpParameterCodec, HttpParams } from '@angular/common/http';
2
+ export declare const UtilsHttpParamsRequestInstance: <Type>(options?: HttpParamsOptions<Type>, instance?: HttpParams) => UtilsHttpParamsRequest<Type>;
3
+ export declare class UtilsHttpParamsRequest<Type = {
4
+ pem: string;
5
+ }> extends HttpParams {
6
+ protected params: HttpParams;
7
+ constructor(options?: HttpParamsOptions<Type>, instance?: HttpParams);
8
+ getInstance(): HttpParams;
9
+ setInstance(instance: HttpParams): void;
10
+ set(param: string, value: string | number | boolean): UtilsHttpParamsRequest;
11
+ has(param: string): boolean;
12
+ get(param: string): string | null;
13
+ getAll(param: string): string[] | null;
14
+ keys(): string[];
15
+ append(param: string, value: string | number | boolean): HttpParams;
16
+ appendAll(params: {
17
+ [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
18
+ }): HttpParams;
19
+ delete(param: string, value?: string | number | boolean): UtilsHttpParamsRequest;
20
+ toString(): string;
21
+ }
22
+ export declare interface HttpParamsOptions<Type> {
23
+ fromString?: string;
24
+ fromObject?: TYPE_FROM_OBJECT<Type>;
25
+ encoder?: HttpParameterCodec;
26
+ }
27
+ export type GET_PATH_VARIABLE<TypePath, TypeOther = unknown> = {
28
+ [Property in keyof TypePath as `pathVariable-${Lowercase<string & Property>}`]: TypePath[Property];
29
+ } & TypeOther;
30
+ type TYPE_FROM_OBJECT<Type> = Type extends undefined | null ? {
31
+ pem: string;
32
+ } : {
33
+ pem?: string;
34
+ } & {
35
+ [Property in keyof Type]?: Type[Property];
36
+ };
37
+ export {};
package/index.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ export * from './dom';
2
+ export * from './url-search-params';
3
+ export * from './uuid';
4
+ export * from './helpers';
5
+ export * from './color';
6
+ export * from './crypto';
7
+ export * from './crypto-3rd';
8
+ export * from './key-code';
9
+ export * from './http-params';
10
+ export * from './language';
11
+ export * from './key-cache';
12
+ export * from './cache';
13
+ export * from './format-number';
14
+ export * from './communicate-micro';
15
+ export * from './function-check-embed-frame';
16
+ export * from './constants';
17
+ export * from './pattern';
18
+ export * from './xss-filter';
19
+ export * from './two-way-signal-object';
20
+ export * from './date';
21
+ export * from './download';
22
+ export * from './base64';
23
+ export * from './inject-token';
24
+ export * from './file';
25
+ export * from './uri';
26
+ export * from './format-text';
27
+ export * from './get-smart-axis-scale';
28
+ export * from './random';
29
+ export * from './dangerous-object';
@@ -0,0 +1,4 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ export declare const LINK_IMAGE_ERROR_TOKEN_INJECT: InjectionToken<string>;
3
+ export declare const PROCESS_BAR_STANDARD_CONFIG_DEFAULT_TOKEN_INJECT: InjectionToken<string>;
4
+ export declare const PROCESS_BAR_STEPS_CONFIG_DEFAULT_TOKEN_INJECT: InjectionToken<string>;
package/key-cache.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const getKeyCacheByArrayObject: (keyCache: string, argumentsValue?: Array<unknown>) => string;
package/key-code.d.ts ADDED
@@ -0,0 +1,122 @@
1
+ export declare abstract class UtilsKeyCodeConstant {
2
+ static readonly MAC_ENTER = 3;
3
+ static readonly BACKSPACE = 8;
4
+ static readonly TAB = 9;
5
+ static readonly NUM_CENTER = 12;
6
+ static readonly ENTER = 13;
7
+ static readonly SHIFT = 16;
8
+ static readonly CONTROL = 17;
9
+ static readonly ALT = 18;
10
+ static readonly PAUSE = 19;
11
+ static readonly CAPS_LOCK = 20;
12
+ static readonly ESCAPE = 27;
13
+ static readonly SPACE = 32;
14
+ static readonly PAGE_UP = 33;
15
+ static readonly PAGE_DOWN = 34;
16
+ static readonly END = 35;
17
+ static readonly HOME = 36;
18
+ static readonly LEFT_ARROW = 37;
19
+ static readonly UP_ARROW = 38;
20
+ static readonly RIGHT_ARROW = 39;
21
+ static readonly DOWN_ARROW = 40;
22
+ static readonly PLUS_SIGN = 43;
23
+ static readonly PRINT_SCREEN = 44;
24
+ static readonly INSERT = 45;
25
+ static readonly DELETE = 46;
26
+ static readonly ZERO = 48;
27
+ static readonly ONE = 49;
28
+ static readonly TWO = 50;
29
+ static readonly THREE = 51;
30
+ static readonly FOUR = 52;
31
+ static readonly FIVE = 53;
32
+ static readonly SIX = 54;
33
+ static readonly SEVEN = 55;
34
+ static readonly EIGHT = 56;
35
+ static readonly NINE = 57;
36
+ static readonly FF_SEMICOLON = 59;
37
+ static readonly FF_EQUALS = 61;
38
+ static readonly QUESTION_MARK = 63;
39
+ static readonly AT_SIGN = 64;
40
+ static readonly A = 65;
41
+ static readonly B = 66;
42
+ static readonly C = 67;
43
+ static readonly D = 68;
44
+ static readonly E = 69;
45
+ static readonly F = 70;
46
+ static readonly G = 71;
47
+ static readonly H = 72;
48
+ static readonly I = 73;
49
+ static readonly J = 74;
50
+ static readonly K = 75;
51
+ static readonly L = 76;
52
+ static readonly M = 77;
53
+ static readonly N = 78;
54
+ static readonly O = 79;
55
+ static readonly P = 80;
56
+ static readonly Q = 81;
57
+ static readonly R = 82;
58
+ static readonly S = 83;
59
+ static readonly T = 84;
60
+ static readonly U = 85;
61
+ static readonly V = 86;
62
+ static readonly W = 87;
63
+ static readonly X = 88;
64
+ static readonly Y = 89;
65
+ static readonly Z = 90;
66
+ static readonly META = 91;
67
+ static readonly MAC_WK_CMD_LEFT = 91;
68
+ static readonly MAC_WK_CMD_RIGHT = 93;
69
+ static readonly CONTEXT_MENU = 93;
70
+ static readonly NUMPAD_ZERO = 96;
71
+ static readonly NUMPAD_ONE = 97;
72
+ static readonly NUMPAD_TWO = 98;
73
+ static readonly NUMPAD_THREE = 99;
74
+ static readonly NUMPAD_FOUR = 100;
75
+ static readonly NUMPAD_FIVE = 101;
76
+ static readonly NUMPAD_SIX = 102;
77
+ static readonly NUMPAD_SEVEN = 103;
78
+ static readonly NUMPAD_EIGHT = 104;
79
+ static readonly NUMPAD_NINE = 105;
80
+ static readonly NUMPAD_MULTIPLY = 106;
81
+ static readonly NUMPAD_PLUS = 107;
82
+ static readonly NUMPAD_MINUS = 109;
83
+ static readonly NUMPAD_PERIOD = 110;
84
+ static readonly NUMPAD_DIVIDE = 111;
85
+ static readonly F1 = 112;
86
+ static readonly F2 = 113;
87
+ static readonly F3 = 114;
88
+ static readonly F4 = 115;
89
+ static readonly F5 = 116;
90
+ static readonly F6 = 117;
91
+ static readonly F7 = 118;
92
+ static readonly F8 = 119;
93
+ static readonly F9 = 120;
94
+ static readonly F10 = 121;
95
+ static readonly F11 = 122;
96
+ static readonly F12 = 123;
97
+ static readonly NUM_LOCK = 144;
98
+ static readonly SCROLL_LOCK = 145;
99
+ static readonly FIRST_MEDIA = 166;
100
+ static readonly FF_MINUS = 173;
101
+ static readonly MUTE = 173;
102
+ static readonly VOLUME_DOWN = 174;
103
+ static readonly VOLUME_UP = 175;
104
+ static readonly FF_MUTE = 181;
105
+ static readonly FF_VOLUME_DOWN = 182;
106
+ static readonly LAST_MEDIA = 183;
107
+ static readonly FF_VOLUME_UP = 183;
108
+ static readonly SEMICOLON = 186;
109
+ static readonly EQUALS = 187;
110
+ static readonly COMMA = 188;
111
+ static readonly DASH = 189;
112
+ static readonly PERIOD = 190;
113
+ static readonly SLASH = 191;
114
+ static readonly APOSTROPHE = 192;
115
+ static readonly TILDE = 192;
116
+ static readonly OPEN_SQUARE_BRACKET = 219;
117
+ static readonly BACKSLASH = 220;
118
+ static readonly CLOSE_SQUARE_BRACKET = 221;
119
+ static readonly SINGLE_QUOTE = 222;
120
+ static readonly MAC_META = 224;
121
+ static readonly BUFFERED = 229;
122
+ }
package/language.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ export declare class UtilsLanguageConstants {
2
+ static VI: string;
3
+ static EN: string;
4
+ static FR: string;
5
+ static DE: string;
6
+ static ES: string;
7
+ static ZH: string;
8
+ static ZH_TW: string;
9
+ static JA: string;
10
+ static KO: string;
11
+ static RU: string;
12
+ static IT: string;
13
+ static PT: string;
14
+ static TH: string;
15
+ static ID: string;
16
+ static MS: string;
17
+ static AR: string;
18
+ static HI: string;
19
+ static BN: string;
20
+ static TR: string;
21
+ static NL: string;
22
+ static KM: string;
23
+ static LO: string;
24
+ static MY: string;
25
+ static TL: string;
26
+ static CEB: string;
27
+ static JV: string;
28
+ static SU: string;
29
+ static defaultLang: string;
30
+ static supportedLanguages: Set<string>;
31
+ /**
32
+ * Kiểm tra xem ngôn ngữ đầu vào có được hỗ trợ không
33
+ * @param lang Mã ngôn ngữ cần kiểm tra
34
+ * @returns True nếu được hỗ trợ, False nếu không
35
+ */
36
+ static isSupported(lang: string): boolean;
37
+ }
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@libs-ui/utils",
3
+ "version": "0.1.1-1",
4
+ "peerDependencies": {
5
+ "@angular/common": ">=18.0.0",
6
+ "@angular/core": ">=18.0.0",
7
+ "crypto-es": "^2.1.0",
8
+ "dayjs": "1.11.5",
9
+ "@libs-ui/interfaces-types": "0.1.1-1",
10
+ "rxjs": "~7.8.0"
11
+ },
12
+ "sideEffects": false,
13
+ "module": "fesm2022/libs-ui-utils.mjs",
14
+ "typings": "index.d.ts",
15
+ "exports": {
16
+ "./package.json": {
17
+ "default": "./package.json"
18
+ },
19
+ ".": {
20
+ "types": "./index.d.ts",
21
+ "esm2022": "./esm2022/libs-ui-utils.mjs",
22
+ "esm": "./esm2022/libs-ui-utils.mjs",
23
+ "default": "./fesm2022/libs-ui-utils.mjs"
24
+ }
25
+ },
26
+ "dependencies": {
27
+ "tslib": "^2.3.0"
28
+ }
29
+ }
package/pattern.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ export declare const patternEmail: () => RegExp;
2
+ export declare const patternUrl: () => RegExp;
3
+ export declare const patternHostUrl: () => RegExp;
4
+ export declare const patternDomain: () => RegExp;
5
+ export declare const patternMobilePhone: () => RegExp;
6
+ export declare const patternPhone: () => RegExp;
7
+ export declare const patternPhoneNormal: () => RegExp;
8
+ export declare const patternNumber: () => RegExp;
9
+ export declare const patternEncodeUri: () => RegExp;
10
+ export declare const patternName: () => RegExp;
11
+ export declare const patternNameUtf8: () => RegExp;
12
+ export declare const patternNameSpecial: () => RegExp;
13
+ export declare const patternNameProfile: () => RegExp;
14
+ export declare const patternEmoji: () => RegExp;
15
+ export declare const patternRuleFieldReplace: () => RegExp;
16
+ export declare const patternGetFieldByRuleFieldReplace: () => RegExp;
17
+ export declare const patternPem: () => RegExp;
18
+ export declare const patternTax: () => RegExp;
19
+ export declare const patternKey: () => RegExp;
20
+ export declare const patternAccount: () => RegExp;
package/random.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare const protectString: (input: string) => string;
2
+ export declare const revealString: (encoded: string) => string;
3
+ export declare const createUniqueRandomIntGenerator: (min: number, max: number) => () => number;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Chuyển đổi một đối tượng hoặc giá trị thành signal
3
+ * @param data Dữ liệu cần chuyển đổi thành signal
4
+ * @param cloneDeepIfNotSignal Có thực hiện sao chép sâu dữ liệu trước khi chuyển đổi hay không nếu data không phải signal. Mặc định là true.
5
+ * Đặt false nếu muốn giữ nguyên tham chiếu đến dữ liệu gốc.
6
+ * Nếu muốn sao chép sâu đối tượng signal thì đặt cloneDeepIfNotSignal là true và acceptConvertObjectInnerWritableSignal là true.
7
+ * @param isSignalPrimitiveType Có chuyển đổi các giá trị nguyên thủy (string, number, boolean) thành signal hay không. Mặc định là false.
8
+ * Đặt true nếu muốn bọc các giá trị nguyên thủy trong signal.
9
+ * @param acceptConvertObjectInnerWritableSignal Có tiếp tục tìm kiếm và chuyển đổi các đối tượng bên trong signal hay không. Mặc định là false.
10
+ * Đặt true nếu muốn tìm và chuyển đổi các đối tượng bên trong signal hoặc chính nó thành signal mới.
11
+ * @returns Dữ liệu đã được chuyển đổi theo kiểu T
12
+ */
13
+ export declare const convertObjectToSignal: <T = any>(data: any, cloneDeepIfNotSignal?: boolean, isSignalPrimitiveType?: boolean, acceptConvertObjectInnerWritableSignal?: boolean, seen?: WeakMap<object, any>) => T;
14
+ export declare const convertSignalToObject: <T = any>(data: any, isCloneDeep?: boolean, seen?: WeakMap<object, any>) => T;
15
+ export declare const unwrapSignal: (data: any) => any;
package/uri.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { TYPE_OBJECT } from '@libs-ui/interfaces-types';
2
+ export declare const ENCODE_URI_PATTERN: RegExp;
3
+ export declare const decodeURI: (value: string) => string;
4
+ export declare const encodeURI: (value: string) => string;
5
+ export declare const endCodeUrl: (params: TYPE_OBJECT, isBody: boolean) => string;
@@ -0,0 +1,25 @@
1
+ export declare class UtilsUrlSearchParams {
2
+ private static instance;
3
+ private params;
4
+ constructor(paramString: string);
5
+ static getInstance(): UtilsUrlSearchParams;
6
+ static toStringParamObject(params: {
7
+ [key in string]: string;
8
+ }): string;
9
+ static ToString(params: Array<{
10
+ key: string;
11
+ value: string;
12
+ }>): string;
13
+ private buildParams;
14
+ set(key: string, value: string): void;
15
+ get(key: string): string | undefined;
16
+ has(key: string): boolean;
17
+ delete(key: string): void;
18
+ length(): number;
19
+ toString(params?: Array<{
20
+ key: string;
21
+ value: string;
22
+ }>): string;
23
+ getParamObject(): Record<string, string>;
24
+ compareParams(param1: string, param2: string): boolean;
25
+ }
package/uuid.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const uuid: () => string;
@@ -0,0 +1,3 @@
1
+ export type TYPE_FUNCTION_XSS = (data: string) => Promise<string>;
2
+ export declare const updateFunctionXssFilter: (functionCustom: TYPE_FUNCTION_XSS) => void;
3
+ export declare const xssFilter: TYPE_FUNCTION_XSS;