@shival99/z-ui 1.0.12 → 1.0.14
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/fesm2022/shival99-z-ui-components-z-menu.mjs +2 -2
- package/fesm2022/shival99-z-ui-i18n.mjs +20 -6
- package/fesm2022/shival99-z-ui-i18n.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-providers.mjs +0 -12
- package/fesm2022/shival99-z-ui-providers.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-services.mjs +444 -163
- package/fesm2022/shival99-z-ui-services.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-utils.mjs +44 -68
- package/fesm2022/shival99-z-ui-utils.mjs.map +1 -1
- package/fesm2022/z-ui.mjs +0 -1
- package/fesm2022/z-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/shival99-z-ui-components-z-calendar.d.ts +5 -5
- package/types/shival99-z-ui-components-z-input.d.ts +2 -2
- package/types/shival99-z-ui-i18n.d.ts +0 -6
- package/types/shival99-z-ui-providers.d.ts +0 -10
- package/types/shival99-z-ui-services.d.ts +163 -129
- package/types/shival99-z-ui-utils.d.ts +15 -50
- package/types/z-ui.d.ts +0 -1
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
import { HttpHeaders, HttpContext, HttpParams, HttpClient } from '@angular/common/http';
|
|
2
|
+
import { Router } from '@angular/router';
|
|
1
3
|
import { Observable } from 'rxjs';
|
|
2
4
|
import * as i0 from '@angular/core';
|
|
3
5
|
import { InjectionToken } from '@angular/core';
|
|
4
6
|
import { TranslationObject, TranslateService } from '@ngx-translate/core';
|
|
5
7
|
|
|
6
|
-
/**
|
|
7
|
-
* Z-Cache Types
|
|
8
|
-
*/
|
|
9
|
-
/** Cache entry with TTL */
|
|
10
8
|
interface ZCacheEntry<T = unknown> {
|
|
11
9
|
data: T;
|
|
12
10
|
timestamp: number;
|
|
13
11
|
ttl: number;
|
|
14
12
|
}
|
|
15
|
-
/** Cache service configuration */
|
|
16
13
|
interface ZCacheConfig {
|
|
17
14
|
/** Prefix for cache keys */
|
|
18
15
|
prefix?: string;
|
|
@@ -20,17 +17,9 @@ interface ZCacheConfig {
|
|
|
20
17
|
encrypt?: boolean;
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
/**
|
|
24
|
-
* Z-Cache Service
|
|
25
|
-
* A localStorage-based cache service with optional encryption
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
20
|
declare class ZCacheService {
|
|
29
21
|
private static _prefix;
|
|
30
22
|
private static _encrypt;
|
|
31
|
-
/**
|
|
32
|
-
* Configure the cache service
|
|
33
|
-
*/
|
|
34
23
|
static configure(config: ZCacheConfig): void;
|
|
35
24
|
private static _encode;
|
|
36
25
|
private static _decode;
|
|
@@ -78,10 +67,66 @@ declare class ZCacheService {
|
|
|
78
67
|
static keys(): string[];
|
|
79
68
|
}
|
|
80
69
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
70
|
+
type ZHttpParamsType<T> = {
|
|
71
|
+
[K in keyof T]: string | number | boolean | ReadonlyArray<string | number | boolean>;
|
|
72
|
+
};
|
|
73
|
+
type ZHttpContentType = 'json' | 'urlencoded' | 'form-data';
|
|
74
|
+
interface ZHttpBaseOptions {
|
|
75
|
+
headers?: HttpHeaders | Record<string, string | string[]>;
|
|
76
|
+
context?: HttpContext;
|
|
77
|
+
observe?: 'body';
|
|
78
|
+
params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
|
|
79
|
+
reportProgress?: boolean;
|
|
80
|
+
responseType?: 'json' | 'arraybuffer' | 'blob' | 'text';
|
|
81
|
+
withCredentials?: boolean;
|
|
82
|
+
credentials?: RequestCredentials;
|
|
83
|
+
keepalive?: boolean;
|
|
84
|
+
priority?: RequestPriority;
|
|
85
|
+
cache?: RequestCache;
|
|
86
|
+
mode?: RequestMode;
|
|
87
|
+
redirect?: RequestRedirect;
|
|
88
|
+
transferCache?: {
|
|
89
|
+
includeHeaders?: string[];
|
|
90
|
+
} | boolean;
|
|
91
|
+
body?: unknown;
|
|
92
|
+
}
|
|
93
|
+
interface ZHttpOptions<TParams extends object = object, TApiType extends string = string> extends ZHttpBaseOptions {
|
|
94
|
+
contentType?: ZHttpContentType;
|
|
95
|
+
api?: TApiType;
|
|
96
|
+
skipToken?: boolean;
|
|
97
|
+
params?: HttpParams | ZHttpParamsType<TParams>;
|
|
98
|
+
enableCache?: boolean;
|
|
99
|
+
timeCache?: number;
|
|
100
|
+
skipErrorToast?: boolean;
|
|
101
|
+
}
|
|
102
|
+
interface ZHttpCacheEntry<T = unknown> {
|
|
103
|
+
data: T;
|
|
104
|
+
timestamp: number;
|
|
105
|
+
ttl: number;
|
|
106
|
+
}
|
|
107
|
+
interface ZHttpError<TApiType extends string = string> {
|
|
108
|
+
message: string;
|
|
109
|
+
status: number;
|
|
110
|
+
error?: unknown;
|
|
111
|
+
endpoint?: string;
|
|
112
|
+
method?: string;
|
|
113
|
+
body?: unknown;
|
|
114
|
+
options?: ZHttpOptions<object, TApiType>;
|
|
115
|
+
}
|
|
116
|
+
interface ZHttpConfig {
|
|
117
|
+
defaultCacheTime?: number;
|
|
118
|
+
networkCheckCacheTime?: number;
|
|
119
|
+
tokenKey?: string;
|
|
120
|
+
userInfoKey?: string;
|
|
121
|
+
lastUrlKey?: string;
|
|
122
|
+
loginRoute?: string;
|
|
123
|
+
homeRoute?: string;
|
|
124
|
+
}
|
|
125
|
+
interface ZHttpNetworkCheck {
|
|
126
|
+
time: number;
|
|
127
|
+
isOnline: boolean;
|
|
128
|
+
}
|
|
129
|
+
|
|
85
130
|
interface ZIndexDbStoreConfig {
|
|
86
131
|
/** Name of the store */
|
|
87
132
|
name: string;
|
|
@@ -90,7 +135,6 @@ interface ZIndexDbStoreConfig {
|
|
|
90
135
|
/** Keys to avoid during clear operation */
|
|
91
136
|
protectedKeys?: string[];
|
|
92
137
|
}
|
|
93
|
-
/** Configuration for Z-IndexDB Service */
|
|
94
138
|
interface ZIndexDbConfig {
|
|
95
139
|
/** Database name */
|
|
96
140
|
dbName?: string;
|
|
@@ -106,11 +150,6 @@ interface ZIndexDbConfig {
|
|
|
106
150
|
protectedKeys?: string[];
|
|
107
151
|
}
|
|
108
152
|
|
|
109
|
-
/**
|
|
110
|
-
* Z-IndexDB Service
|
|
111
|
-
* A robust IndexedDB service with multi-store support, encryption, and retry logic
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
153
|
declare class ZIndexDbService {
|
|
115
154
|
private _db;
|
|
116
155
|
private _dbName;
|
|
@@ -181,6 +220,105 @@ declare class ZIndexDbService {
|
|
|
181
220
|
addStore(config: ZIndexDbStoreConfig): Promise<void>;
|
|
182
221
|
}
|
|
183
222
|
|
|
223
|
+
declare class ZTranslateService {
|
|
224
|
+
private readonly _translate;
|
|
225
|
+
readonly currentLang: i0.WritableSignal<string>;
|
|
226
|
+
readonly availableLangs: i0.WritableSignal<string[]>;
|
|
227
|
+
constructor();
|
|
228
|
+
private _initialize;
|
|
229
|
+
/**
|
|
230
|
+
* Change the current language
|
|
231
|
+
* @param lang - Language code
|
|
232
|
+
*/
|
|
233
|
+
use(lang: string): void;
|
|
234
|
+
/**
|
|
235
|
+
* Get the current language code
|
|
236
|
+
*/
|
|
237
|
+
getLang(): string;
|
|
238
|
+
/**
|
|
239
|
+
* Get translation synchronously (returns key if not found)
|
|
240
|
+
* @param key - Translation key
|
|
241
|
+
* @param params - Interpolation parameters
|
|
242
|
+
*/
|
|
243
|
+
instant(key: string, params?: Record<string, unknown>): string;
|
|
244
|
+
/**
|
|
245
|
+
* Get translation asynchronously
|
|
246
|
+
* @param key - Translation key
|
|
247
|
+
* @param params - Interpolation parameters
|
|
248
|
+
*/
|
|
249
|
+
get(key: string, params?: Record<string, unknown>): Promise<string>;
|
|
250
|
+
/**
|
|
251
|
+
* Get translation as observable
|
|
252
|
+
* @param key - Translation key
|
|
253
|
+
* @param params - Interpolation parameters
|
|
254
|
+
*/
|
|
255
|
+
get$(key: string, params?: Record<string, unknown>): Observable<string>;
|
|
256
|
+
/**
|
|
257
|
+
* Stream translations (re-emits on language change)
|
|
258
|
+
* @param key - Translation key
|
|
259
|
+
* @param params - Interpolation parameters
|
|
260
|
+
*/
|
|
261
|
+
stream$(key: string, params?: Record<string, unknown>): Observable<string>;
|
|
262
|
+
/**
|
|
263
|
+
* Get multiple translations at once
|
|
264
|
+
* @param keys - Array of translation keys
|
|
265
|
+
* @param params - Interpolation parameters (applied to all)
|
|
266
|
+
*/
|
|
267
|
+
getMany(keys: string[], params?: Record<string, unknown>): Promise<Record<string, string>>;
|
|
268
|
+
/**
|
|
269
|
+
* Check if a translation key exists
|
|
270
|
+
* @param key - Translation key
|
|
271
|
+
*/
|
|
272
|
+
has(key: string): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Add translations dynamically
|
|
275
|
+
* @param lang - Language code
|
|
276
|
+
* @param translations - Translation object
|
|
277
|
+
* @param shouldMerge - Whether to merge with existing translations
|
|
278
|
+
*/
|
|
279
|
+
setTranslation(lang: string, translations: TranslationObject, shouldMerge?: boolean): void;
|
|
280
|
+
/**
|
|
281
|
+
* Get the underlying TranslateService for advanced usage
|
|
282
|
+
*/
|
|
283
|
+
getNgxTranslate(): TranslateService;
|
|
284
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ZTranslateService, never>;
|
|
285
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ZTranslateService>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
declare abstract class ZHttpAbstractService<TApiType extends string = string> {
|
|
289
|
+
protected readonly http: HttpClient;
|
|
290
|
+
protected readonly router: Router;
|
|
291
|
+
protected readonly cacheService: typeof ZCacheService;
|
|
292
|
+
protected readonly translateService: ZTranslateService;
|
|
293
|
+
protected readonly indexDbService: ZIndexDbService;
|
|
294
|
+
protected readonly config: Required<ZHttpConfig>;
|
|
295
|
+
private _networkCache;
|
|
296
|
+
constructor();
|
|
297
|
+
protected abstract resolveBaseUrl(apiType?: TApiType): string;
|
|
298
|
+
protected get<T, TParams extends object = object>(endpoint: string, options?: ZHttpOptions<TParams, TApiType>): Observable<T>;
|
|
299
|
+
protected post<T, TParams extends object = object>(endpoint: string, body: unknown, options?: ZHttpOptions<TParams, TApiType>): Observable<T>;
|
|
300
|
+
protected put<T, TParams extends object = object>(endpoint: string, body: unknown, options?: ZHttpOptions<TParams, TApiType>): Observable<T>;
|
|
301
|
+
protected patch<T, TParams extends object = object>(endpoint: string, body: unknown, options?: ZHttpOptions<TParams, TApiType>): Observable<T>;
|
|
302
|
+
protected delete<T, TParams extends object = object>(endpoint: string, body?: unknown, options?: ZHttpOptions<TParams, TApiType>): Observable<T>;
|
|
303
|
+
private _buildRequest;
|
|
304
|
+
private _buildHttpOptions;
|
|
305
|
+
private _handleCacheAndRequest;
|
|
306
|
+
private _executeHttpCall;
|
|
307
|
+
private _generateCacheKey;
|
|
308
|
+
private _cacheData;
|
|
309
|
+
private _getCachedData;
|
|
310
|
+
private _detectNetworkStatus;
|
|
311
|
+
private _checkNetworkWithRetry;
|
|
312
|
+
private _performNetworkCheck;
|
|
313
|
+
private _handleError;
|
|
314
|
+
private _buildErrorObject;
|
|
315
|
+
private _localizeError;
|
|
316
|
+
private _get401Message;
|
|
317
|
+
private _handleStatusCode;
|
|
318
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ZHttpAbstractService<any>, never>;
|
|
319
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ZHttpAbstractService<any>>;
|
|
320
|
+
}
|
|
321
|
+
|
|
184
322
|
type SubjectType = 'subject' | 'behavior';
|
|
185
323
|
declare class ZSubjectService {
|
|
186
324
|
private readonly _subjects;
|
|
@@ -224,10 +362,6 @@ declare class ZSubjectService {
|
|
|
224
362
|
static ɵprov: i0.ɵɵInjectableDeclaration<ZSubjectService>;
|
|
225
363
|
}
|
|
226
364
|
|
|
227
|
-
/**
|
|
228
|
-
* Z-Theme Types
|
|
229
|
-
*/
|
|
230
|
-
|
|
231
365
|
type ZThemeName = 'green' | 'orange' | 'violet' | 'neutral' | 'stone' | 'zinc' | 'gray' | 'slate' | 'hospital';
|
|
232
366
|
interface ZThemeConfig {
|
|
233
367
|
defaultTheme?: ZThemeName;
|
|
@@ -263,105 +397,6 @@ declare class ZThemeService {
|
|
|
263
397
|
static ɵprov: i0.ɵɵInjectableDeclaration<ZThemeService>;
|
|
264
398
|
}
|
|
265
399
|
|
|
266
|
-
declare class ZTranslateService {
|
|
267
|
-
private readonly _translate;
|
|
268
|
-
/** Current language signal */
|
|
269
|
-
readonly currentLang: i0.WritableSignal<string>;
|
|
270
|
-
/** Available languages */
|
|
271
|
-
readonly availableLangs: i0.WritableSignal<string[]>;
|
|
272
|
-
constructor();
|
|
273
|
-
private _initialize;
|
|
274
|
-
/**
|
|
275
|
-
* Change the current language
|
|
276
|
-
* @param lang - Language code
|
|
277
|
-
*/
|
|
278
|
-
use(lang: string): void;
|
|
279
|
-
/**
|
|
280
|
-
* Get the current language code
|
|
281
|
-
*/
|
|
282
|
-
getLang(): string;
|
|
283
|
-
/**
|
|
284
|
-
* Get translation synchronously (returns key if not found)
|
|
285
|
-
* @param key - Translation key
|
|
286
|
-
* @param params - Interpolation parameters
|
|
287
|
-
*/
|
|
288
|
-
instant(key: string, params?: Record<string, unknown>): string;
|
|
289
|
-
/**
|
|
290
|
-
* Get translation asynchronously
|
|
291
|
-
* @param key - Translation key
|
|
292
|
-
* @param params - Interpolation parameters
|
|
293
|
-
*/
|
|
294
|
-
get(key: string, params?: Record<string, unknown>): Promise<string>;
|
|
295
|
-
/**
|
|
296
|
-
* Get translation as observable
|
|
297
|
-
* @param key - Translation key
|
|
298
|
-
* @param params - Interpolation parameters
|
|
299
|
-
*/
|
|
300
|
-
get$(key: string, params?: Record<string, unknown>): Observable<string>;
|
|
301
|
-
/**
|
|
302
|
-
* Stream translations (re-emits on language change)
|
|
303
|
-
* @param key - Translation key
|
|
304
|
-
* @param params - Interpolation parameters
|
|
305
|
-
*/
|
|
306
|
-
stream$(key: string, params?: Record<string, unknown>): Observable<string>;
|
|
307
|
-
/**
|
|
308
|
-
* Get multiple translations at once
|
|
309
|
-
* @param keys - Array of translation keys
|
|
310
|
-
* @param params - Interpolation parameters (applied to all)
|
|
311
|
-
*/
|
|
312
|
-
getMany(keys: string[], params?: Record<string, unknown>): Promise<Record<string, string>>;
|
|
313
|
-
/**
|
|
314
|
-
* Check if a translation key exists
|
|
315
|
-
* @param key - Translation key
|
|
316
|
-
*/
|
|
317
|
-
has(key: string): boolean;
|
|
318
|
-
/**
|
|
319
|
-
* Add translations dynamically
|
|
320
|
-
* @param lang - Language code
|
|
321
|
-
* @param translations - Translation object
|
|
322
|
-
* @param shouldMerge - Whether to merge with existing translations
|
|
323
|
-
*/
|
|
324
|
-
setTranslation(lang: string, translations: TranslationObject, shouldMerge?: boolean): void;
|
|
325
|
-
/**
|
|
326
|
-
* Get the underlying TranslateService for advanced usage
|
|
327
|
-
*/
|
|
328
|
-
getNgxTranslate(): TranslateService;
|
|
329
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ZTranslateService, never>;
|
|
330
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ZTranslateService>;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Z-Http Types
|
|
335
|
-
*/
|
|
336
|
-
/** HTTP cache entry */
|
|
337
|
-
interface ZHttpCacheEntry<T = unknown> {
|
|
338
|
-
data: T;
|
|
339
|
-
timestamp: number;
|
|
340
|
-
ttl: number;
|
|
341
|
-
}
|
|
342
|
-
/** HTTP error response */
|
|
343
|
-
interface ZHttpError {
|
|
344
|
-
message: string;
|
|
345
|
-
status: number;
|
|
346
|
-
error?: unknown;
|
|
347
|
-
endpoint?: string;
|
|
348
|
-
method?: string;
|
|
349
|
-
body?: unknown;
|
|
350
|
-
}
|
|
351
|
-
/** HTTP request options */
|
|
352
|
-
interface ZHttpOptions<TParams extends object = object> {
|
|
353
|
-
params?: TParams;
|
|
354
|
-
headers?: Record<string, string | string[]>;
|
|
355
|
-
enableCache?: boolean;
|
|
356
|
-
timeCache?: number;
|
|
357
|
-
contentType?: 'json' | 'urlencoded' | 'form-data';
|
|
358
|
-
skipToken?: boolean;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Z-Translate Types
|
|
363
|
-
*/
|
|
364
|
-
/** Translate service configuration */
|
|
365
400
|
interface ZTranslateConfig {
|
|
366
401
|
/** Default language */
|
|
367
402
|
defaultLang?: string;
|
|
@@ -372,11 +407,10 @@ interface ZTranslateConfig {
|
|
|
372
407
|
/** Translation file extension */
|
|
373
408
|
fileExtension?: string;
|
|
374
409
|
}
|
|
375
|
-
/** Translate I18n configuration */
|
|
376
410
|
interface ZTranslateI18nConfig {
|
|
377
411
|
defaultLang?: string;
|
|
378
412
|
availableLangs?: string[];
|
|
379
413
|
}
|
|
380
414
|
|
|
381
|
-
export { ZCacheService, ZIndexDbService, ZSubjectService, ZThemeService, ZTranslateService, Z_DARK_MODE_CACHE_KEY, Z_DEFAULT_THEME, Z_THEME_CACHE_KEY, Z_THEME_CONFIG, Z_THEME_CSS_MAP };
|
|
382
|
-
export type { ZCacheConfig, ZCacheEntry, ZHttpCacheEntry, ZHttpError, ZHttpOptions, ZIndexDbConfig, ZIndexDbStoreConfig, ZThemeConfig, ZThemeName, ZTranslateConfig, ZTranslateI18nConfig };
|
|
415
|
+
export { ZCacheService, ZHttpAbstractService, ZIndexDbService, ZSubjectService, ZThemeService, ZTranslateService, Z_DARK_MODE_CACHE_KEY, Z_DEFAULT_THEME, Z_THEME_CACHE_KEY, Z_THEME_CONFIG, Z_THEME_CSS_MAP };
|
|
416
|
+
export type { ZCacheConfig, ZCacheEntry, ZHttpBaseOptions, ZHttpCacheEntry, ZHttpConfig, ZHttpContentType, ZHttpError, ZHttpNetworkCheck, ZHttpOptions, ZHttpParamsType, ZIndexDbConfig, ZIndexDbStoreConfig, ZThemeConfig, ZThemeName, ZTranslateConfig, ZTranslateI18nConfig };
|
|
@@ -3,10 +3,6 @@ import { ClassValue } from 'clsx';
|
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { FormGroup, FormArray } from '@angular/forms';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Z-Common Types
|
|
8
|
-
* Common utility types
|
|
9
|
-
*/
|
|
10
6
|
type ZBrowserName = 'Chrome' | 'Edge' | 'Firefox' | 'Safari' | 'Opera' | 'IE' | 'Unknown' | string;
|
|
11
7
|
type ZDeviceType = 'mobile' | 'tablet' | 'desktop';
|
|
12
8
|
interface ZBrowserInfo {
|
|
@@ -25,68 +21,55 @@ interface ZNavigatorUAData {
|
|
|
25
21
|
mobile: boolean;
|
|
26
22
|
platform: string;
|
|
27
23
|
}
|
|
24
|
+
type ZNumberDivide = 'none' | 'thousand' | 'million' | 'billion';
|
|
25
|
+
type ZEmptyCheck = 'strict' | 'includeZero';
|
|
26
|
+
declare const Z_DIVIDE_SCALE: Record<ZNumberDivide, number>;
|
|
27
|
+
declare const Z_LOCALE_MAP: Record<string, string>;
|
|
28
|
+
interface ZFormatNumOptions {
|
|
29
|
+
divide?: ZNumberDivide;
|
|
30
|
+
format?: string;
|
|
31
|
+
percent?: boolean;
|
|
32
|
+
emptyCheck?: ZEmptyCheck;
|
|
33
|
+
locale?: 'vi' | 'en';
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
}
|
|
28
36
|
declare global {
|
|
29
37
|
interface Navigator {
|
|
30
38
|
userAgentData?: ZNavigatorUAData;
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
|
|
34
|
-
/**
|
|
35
|
-
* Z-Common Utils
|
|
36
|
-
* Common utility functions for z-ui library
|
|
37
|
-
* All functions are prefixed with 'z' for consistency
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/** Merge Tailwind CSS classes with clsx */
|
|
41
42
|
declare const zMergeClasses: (...inputs: ClassValue[]) => string;
|
|
42
|
-
/** Transform boolean-like values to boolean */
|
|
43
43
|
declare const zTransform: (value: boolean | string) => boolean;
|
|
44
|
-
/** Generate a unique ID with optional prefix */
|
|
45
44
|
declare const zGenerateId: (prefix?: string) => string;
|
|
46
45
|
declare const zNoop: () => undefined;
|
|
47
|
-
|
|
46
|
+
declare const zFormatNum: (value: unknown, options?: ZFormatNumOptions) => string;
|
|
48
47
|
declare const zUuid: () => string;
|
|
49
|
-
/** Capitalize each word in a string */
|
|
50
48
|
declare const zCapitalCase: (text: string) => string;
|
|
51
|
-
/** Check if text is truncated (requires element to be rendered) */
|
|
52
49
|
declare const zIsTextTruncated: (el: HTMLElement) => Promise<boolean>;
|
|
53
|
-
/** Decode unicode escape sequences */
|
|
54
50
|
declare const zDecodeUnicode: (str: string) => string;
|
|
55
|
-
/** Generate a random color in hex, rgb, and hsl formats */
|
|
56
51
|
declare const zRandomColor: () => {
|
|
57
52
|
hex: string;
|
|
58
53
|
rgb: string;
|
|
59
54
|
hsl: string;
|
|
60
55
|
};
|
|
61
|
-
/** Convert color string to ARGB format */
|
|
62
56
|
declare const zConvertColorToArgb: (color: string) => string;
|
|
63
|
-
/** Clean null/undefined values from object recursively */
|
|
64
57
|
declare const zCleanObject: <T = unknown>(obj: T) => T;
|
|
65
|
-
/** Flatten tree structure to flat array */
|
|
66
58
|
declare const zTreeFlatten: <T extends Record<string, unknown>>(list: T[], keyMap: keyof T, parentKeyMap: keyof T, sortFn?: (a: T, b: T) => number) => (T & {
|
|
67
59
|
level: number;
|
|
68
60
|
parentsKey: string[];
|
|
69
61
|
})[];
|
|
70
|
-
/** Build tree structure from flat array */
|
|
71
62
|
declare const zTreeBuild: <T extends Record<string, unknown>>(list: T[], keyMap: keyof T, parentKeyMap: keyof T, sortFn?: (a: T, b: T) => number) => (T & {
|
|
72
63
|
level: number;
|
|
73
64
|
parentsKey: string[];
|
|
74
65
|
children: unknown[];
|
|
75
66
|
})[];
|
|
76
|
-
/** Vietnamese character map for normalization */
|
|
77
67
|
declare const VIETNAMESE_MAP: Record<string, string>;
|
|
78
|
-
/** Remove Vietnamese diacritics from string */
|
|
79
68
|
declare const zRemoveVietnamese: (str: string) => string;
|
|
80
|
-
/** Full-text search using MiniSearch */
|
|
81
69
|
declare const zMiniSearch: <T>(data: T[], query: string, fields: (keyof T | string)[]) => T[];
|
|
82
|
-
/** Full-text search as Observable with loading state */
|
|
83
70
|
declare const zMiniSearch$: <T>(data: T[], query: string, fields: (keyof T | string)[], loading?: WritableSignal<boolean>, fakeDelay?: number) => Observable<T[]>;
|
|
84
|
-
/** Detect browser information */
|
|
85
71
|
declare const zDetectBrowser: () => ZBrowserInfo;
|
|
86
72
|
|
|
87
|
-
/**
|
|
88
|
-
* Z-Echarts Types
|
|
89
|
-
*/
|
|
90
73
|
interface ZEchartsThemeOptions {
|
|
91
74
|
/** Theme name (default: 'zTheme') */
|
|
92
75
|
themeName?: string;
|
|
@@ -94,23 +77,11 @@ interface ZEchartsThemeOptions {
|
|
|
94
77
|
fontFamily?: string;
|
|
95
78
|
}
|
|
96
79
|
|
|
97
|
-
/**
|
|
98
|
-
* Z-Echarts Utils
|
|
99
|
-
* ECharts utility functions
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
80
|
/**
|
|
103
81
|
* Register custom Z-UI theme for ECharts
|
|
104
82
|
* @param options - Theme configuration options
|
|
105
83
|
*/
|
|
106
84
|
declare function zRegisterEchartsTheme(options?: ZEchartsThemeOptions): void;
|
|
107
|
-
/** @deprecated Use zRegisterEchartsTheme instead */
|
|
108
|
-
declare const registerEchartsMsgTheme: () => void;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Z-Form Utils
|
|
112
|
-
* Form utility functions
|
|
113
|
-
*/
|
|
114
85
|
|
|
115
86
|
/**
|
|
116
87
|
* Submit form and mark invalid controls as dirty
|
|
@@ -129,17 +100,11 @@ declare const zDebugFormInvalid: (form: FormGroup, parentKey?: string) => void;
|
|
|
129
100
|
/** Legacy alias */
|
|
130
101
|
declare const debugFormInvalid: (form: FormGroup, parentKey?: string) => void;
|
|
131
102
|
|
|
132
|
-
/**
|
|
133
|
-
* Z-Form Types
|
|
134
|
-
* Form utility types
|
|
135
|
-
*/
|
|
136
|
-
/** Form submit result */
|
|
137
103
|
type ZFormSubmitResult = boolean;
|
|
138
|
-
/** Form debug options */
|
|
139
104
|
interface ZFormDebugOptions {
|
|
140
105
|
showValid?: boolean;
|
|
141
106
|
logLevel?: 'error' | 'warn' | 'log';
|
|
142
107
|
}
|
|
143
108
|
|
|
144
|
-
export { VIETNAMESE_MAP,
|
|
145
|
-
export type { ZBrowserInfo, ZBrowserName, ZDeviceType, ZEchartsThemeOptions, ZFormDebugOptions, ZFormSubmitResult, ZNavigatorUABrandVersion, ZNavigatorUAData };
|
|
109
|
+
export { VIETNAMESE_MAP, Z_DIVIDE_SCALE, Z_LOCALE_MAP, debugFormInvalid, submitForm, zCapitalCase, zCleanObject, zConvertColorToArgb, zDebugFormInvalid, zDecodeUnicode, zDetectBrowser, zFormatNum, zGenerateId, zIsTextTruncated, zMergeClasses, zMiniSearch, zMiniSearch$, zNoop, zRandomColor, zRegisterEchartsTheme, zRemoveVietnamese, zSubmitForm, zTransform, zTreeBuild, zTreeFlatten, zUuid };
|
|
110
|
+
export type { ZBrowserInfo, ZBrowserName, ZDeviceType, ZEchartsThemeOptions, ZEmptyCheck, ZFormDebugOptions, ZFormSubmitResult, ZFormatNumOptions, ZNavigatorUABrandVersion, ZNavigatorUAData, ZNumberDivide };
|
package/types/z-ui.d.ts
CHANGED