@shival99/z-ui 1.4.6 → 1.4.8
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-providers.mjs +35 -3
- package/fesm2022/shival99-z-ui-providers.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-services.mjs +85 -86
- package/fesm2022/shival99-z-ui-services.mjs.map +1 -1
- package/package.json +1 -1
- package/types/shival99-z-ui-providers.d.ts +23 -2
- package/types/shival99-z-ui-services.d.ts +32 -52
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shival99/z-ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8",
|
|
4
4
|
"description": "Z-UI: Modern Angular UI Component Library - A comprehensive, high-performance design system built with Angular 20+, featuring 40+ customizable components with dark mode, accessibility, and enterprise-ready features.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import { EnvironmentProviders, InjectionToken } from '@angular/core';
|
|
2
|
-
import { ZIndexDbConfig, ZIndexDbService, ZThemeConfig } from '@shival99/z-ui/services';
|
|
2
|
+
import { ZCacheConfig, ZIndexDbConfig, ZIndexDbService, ZThemeConfig } from '@shival99/z-ui/services';
|
|
3
3
|
export { ZThemeConfig, ZThemeName } from '@shival99/z-ui/services';
|
|
4
4
|
import { HttpClient } from '@angular/common/http';
|
|
5
5
|
import { TranslateLoader } from '@ngx-translate/core';
|
|
6
6
|
import { ZUITranslations } from '@shival99/z-ui/i18n';
|
|
7
7
|
|
|
8
|
+
/** Injection token for ZCacheService configuration */
|
|
9
|
+
declare const Z_CACHE_CONFIG: InjectionToken<ZCacheConfig>;
|
|
10
|
+
/**
|
|
11
|
+
* Provide Z-Cache service with configuration
|
|
12
|
+
* @param config - Cache configuration with prefix and encrypt options
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // In app.config.ts
|
|
17
|
+
* export const appConfig: ApplicationConfig = {
|
|
18
|
+
* providers: [
|
|
19
|
+
* provideZCache({
|
|
20
|
+
* prefix: 'myapp_',
|
|
21
|
+
* encrypt: false, // Disable encryption for debugging
|
|
22
|
+
* }),
|
|
23
|
+
* ],
|
|
24
|
+
* };
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare function provideZCache(config?: ZCacheConfig): EnvironmentProviders;
|
|
28
|
+
|
|
8
29
|
/** Injection token for ZIndexDbService */
|
|
9
30
|
declare const Z_INDEXDB_SERVICE: InjectionToken<ZIndexDbService>;
|
|
10
31
|
/**
|
|
@@ -126,5 +147,5 @@ interface ZTranslateProviderConfig {
|
|
|
126
147
|
declare function zCreateTranslateLoader(http: HttpClient, path?: string, extension?: string, includeZUI?: boolean, zuiOverridePath?: string, customZUI?: Partial<Record<string, ZUITranslations>>): TranslateLoader;
|
|
127
148
|
declare function provideZTranslate(config?: ZTranslateProviderConfig): EnvironmentProviders;
|
|
128
149
|
|
|
129
|
-
export { Z_INDEXDB_SERVICE, provideZIndexDb, provideZNgxMask, provideZScrollbar, provideZTheme, provideZTranslate, zCreateTranslateLoader };
|
|
150
|
+
export { Z_CACHE_CONFIG, Z_INDEXDB_SERVICE, provideZCache, provideZIndexDb, provideZNgxMask, provideZScrollbar, provideZTheme, provideZTranslate, zCreateTranslateLoader };
|
|
130
151
|
export type { ZNgxMaskConfig, ZTranslateProviderConfig };
|
|
@@ -12,9 +12,7 @@ interface ZCacheEntry<T = unknown> {
|
|
|
12
12
|
ttl: number;
|
|
13
13
|
}
|
|
14
14
|
interface ZCacheConfig {
|
|
15
|
-
/** Prefix for cache keys */
|
|
16
15
|
prefix?: string;
|
|
17
|
-
/** Whether to encrypt data */
|
|
18
16
|
encrypt?: boolean;
|
|
19
17
|
}
|
|
20
18
|
|
|
@@ -26,45 +24,12 @@ declare class ZCacheService {
|
|
|
26
24
|
private static _decode;
|
|
27
25
|
private static _getFullKey;
|
|
28
26
|
private static _safeOperation;
|
|
29
|
-
/**
|
|
30
|
-
* Get a value from cache
|
|
31
|
-
* @param key - Cache key
|
|
32
|
-
* @param defaultValue - Default value if not found
|
|
33
|
-
* @param encrypt - Whether to use encryption (default: service config)
|
|
34
|
-
*/
|
|
35
27
|
static get<T>(key: string, defaultValue?: T, encrypt?: boolean): T | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Set a value in cache
|
|
38
|
-
* @param key - Cache key
|
|
39
|
-
* @param data - Data to store
|
|
40
|
-
* @param encrypt - Whether to use encryption
|
|
41
|
-
*/
|
|
42
28
|
static set<T>(key: string, data: T, encrypt?: boolean): boolean;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* @param key - Cache key
|
|
46
|
-
* @param encrypt - Whether key is encrypted
|
|
47
|
-
*/
|
|
48
|
-
static delete(key: string, encrypt?: boolean): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Delete multiple keys from cache
|
|
51
|
-
* @param keys - Array of cache keys
|
|
52
|
-
* @param encrypt - Whether keys are encrypted
|
|
53
|
-
*/
|
|
54
|
-
static deleteMultiple(keys: string[], encrypt?: boolean): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Clear all cache with the configured prefix
|
|
57
|
-
*/
|
|
29
|
+
static delete(key: string): boolean;
|
|
30
|
+
static deleteMultiple(keys: string[]): boolean;
|
|
58
31
|
static clear(): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Check if a key exists in cache
|
|
61
|
-
* @param key - Cache key
|
|
62
|
-
* @param encrypt - Whether key is encrypted
|
|
63
|
-
*/
|
|
64
32
|
static has(key: string, encrypt?: boolean): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Get all keys with the configured prefix
|
|
67
|
-
*/
|
|
68
33
|
static keys(): string[];
|
|
69
34
|
}
|
|
70
35
|
|
|
@@ -307,26 +272,27 @@ interface ZHttpNetworkCheck {
|
|
|
307
272
|
}
|
|
308
273
|
|
|
309
274
|
interface ZIndexDbStoreConfig {
|
|
310
|
-
/** Name of the store */
|
|
311
275
|
name: string;
|
|
312
|
-
/** Whether to encrypt data (default: true) */
|
|
313
276
|
encrypt?: boolean;
|
|
314
|
-
/** Keys to avoid during clear operation */
|
|
315
277
|
protectedKeys?: string[];
|
|
316
278
|
}
|
|
317
279
|
interface ZIndexDbConfig {
|
|
318
|
-
/** Database name */
|
|
319
280
|
dbName?: string;
|
|
320
|
-
/** Database version */
|
|
321
281
|
version?: number;
|
|
322
|
-
/** Transaction mode */
|
|
323
282
|
mode?: IDBTransactionMode;
|
|
324
|
-
/** Store configurations - supports multiple stores */
|
|
325
283
|
stores?: ZIndexDbStoreConfig[];
|
|
326
|
-
/** Default store name (for backward compatibility) */
|
|
327
284
|
defaultStore?: string;
|
|
328
|
-
/** Keys to avoid during clear operation (global) */
|
|
329
285
|
protectedKeys?: string[];
|
|
286
|
+
encrypt?: boolean;
|
|
287
|
+
}
|
|
288
|
+
interface ZIndexDbGetOptions<T = unknown> {
|
|
289
|
+
defaultValue?: T;
|
|
290
|
+
storeName?: string;
|
|
291
|
+
encrypt?: boolean;
|
|
292
|
+
}
|
|
293
|
+
interface ZIndexDbSetOptions {
|
|
294
|
+
storeName?: string;
|
|
295
|
+
encrypt?: boolean;
|
|
330
296
|
}
|
|
331
297
|
|
|
332
298
|
declare class ZIndexDbService {
|
|
@@ -338,10 +304,18 @@ declare class ZIndexDbService {
|
|
|
338
304
|
private _stores;
|
|
339
305
|
private _defaultStoreName;
|
|
340
306
|
private _globalProtectedKeys;
|
|
307
|
+
private _encrypt;
|
|
341
308
|
constructor(config?: ZIndexDbConfig);
|
|
342
309
|
private _getStoreConfig;
|
|
343
|
-
|
|
344
|
-
|
|
310
|
+
/**
|
|
311
|
+
* Determines if encryption should be used.
|
|
312
|
+
* Priority: per-call > store-level > global
|
|
313
|
+
* @param storeConfig - Store configuration
|
|
314
|
+
* @param perCallEncrypt - Per-call encrypt override (highest priority)
|
|
315
|
+
*/
|
|
316
|
+
private _shouldEncrypt;
|
|
317
|
+
private _encryptData;
|
|
318
|
+
private _decryptData;
|
|
345
319
|
private _closeConnection;
|
|
346
320
|
private _reconnect;
|
|
347
321
|
private _withRetry;
|
|
@@ -351,15 +325,21 @@ declare class ZIndexDbService {
|
|
|
351
325
|
private _resetDatabase;
|
|
352
326
|
private _getMissingStores;
|
|
353
327
|
private _ensureStoreExists;
|
|
354
|
-
get<T>(key: string,
|
|
355
|
-
set<T>(key: string, value: T,
|
|
328
|
+
get<T>(key: string, options?: ZIndexDbGetOptions<T>): Promise<T | undefined>;
|
|
329
|
+
set<T>(key: string, value: T, options?: ZIndexDbSetOptions): Promise<void>;
|
|
330
|
+
/**
|
|
331
|
+
* Delete key(s) from IndexDB. If storeName not provided, deletes from all stores.
|
|
332
|
+
* Tries both encrypted and non-encrypted versions of the key.
|
|
333
|
+
*/
|
|
356
334
|
delete(key: string | string[], storeName?: string): Promise<void>;
|
|
335
|
+
private _deleteFromStore;
|
|
357
336
|
clear(storeName?: string): Promise<void>;
|
|
358
337
|
getAll<T = unknown>(storeName?: string): Promise<Record<string, T>>;
|
|
359
|
-
setMultiple<T>(items: Record<string, T>,
|
|
338
|
+
setMultiple<T>(items: Record<string, T>, options?: ZIndexDbSetOptions): Promise<void>;
|
|
360
339
|
getStoreNames(): string[];
|
|
361
340
|
hasStore(storeName: string): boolean;
|
|
362
341
|
addStore(config: ZIndexDbStoreConfig): Promise<void>;
|
|
342
|
+
clearAll(): Promise<void>;
|
|
363
343
|
}
|
|
364
344
|
|
|
365
345
|
declare class ZTranslateService {
|
|
@@ -607,4 +587,4 @@ interface ZTranslateI18nConfig {
|
|
|
607
587
|
declare const Z_LANG_CACHE_KEY = "Z_LANGUAGE";
|
|
608
588
|
|
|
609
589
|
export { ZCacheService, ZExcelService, ZHttpAbstractService, ZIndexDbService, ZSubjectService, ZThemeService, ZTranslateService, Z_DARK_MODE_CACHE_KEY, Z_DEFAULT_THEME, Z_EXCEL_BORDER_THIN, Z_EXCEL_CHAR_WIDTH_MAP, Z_EXCEL_COLORS, Z_EXCEL_DEFAULT_CONFIG, Z_EXCEL_FONT_MULTIPLIERS, Z_EXCEL_WIDTH_LIMITS, Z_HTTP_DEFAULT_CONFIG, Z_INDEXDB_BATCH_SIZE, Z_INDEXDB_DEFAULT_CONFIG, Z_INDEXDB_MAX_VERSION, Z_LANG_CACHE_KEY, Z_THEME_CACHE_KEY, Z_THEME_CONFIG, Z_THEME_CONFIG_CACHE_KEY, Z_THEME_CSS_MAP };
|
|
610
|
-
export type { ZCacheConfig, ZCacheEntry, ZExcelAlign, ZExcelCell, ZExcelCellContext, ZExcelColumnConfig, ZExcelConfig, ZExcelDefaultConfig, ZExcelExportOptions, ZExcelExportResult, ZExcelFontConfig, ZExcelFromTableConfig, ZExcelHeaderColors, ZExcelHeaderContext, ZExcelSheetSource, ZExcelTableColumnConfig, ZExcelTableHeaderConfig, ZExcelToastHandler, ZHttpBaseOptions, ZHttpCacheEntry, ZHttpConfig, ZHttpContentType, ZHttpError, ZHttpNetworkCheck, ZHttpOptions, ZHttpParamsType, ZIndexDbConfig, ZIndexDbStoreConfig, ZTableToExcelColumn, ZThemeConfig, ZThemeName, ZTranslateConfig, ZTranslateI18nConfig };
|
|
590
|
+
export type { ZCacheConfig, ZCacheEntry, ZExcelAlign, ZExcelCell, ZExcelCellContext, ZExcelColumnConfig, ZExcelConfig, ZExcelDefaultConfig, ZExcelExportOptions, ZExcelExportResult, ZExcelFontConfig, ZExcelFromTableConfig, ZExcelHeaderColors, ZExcelHeaderContext, ZExcelSheetSource, ZExcelTableColumnConfig, ZExcelTableHeaderConfig, ZExcelToastHandler, ZHttpBaseOptions, ZHttpCacheEntry, ZHttpConfig, ZHttpContentType, ZHttpError, ZHttpNetworkCheck, ZHttpOptions, ZHttpParamsType, ZIndexDbConfig, ZIndexDbGetOptions, ZIndexDbSetOptions, ZIndexDbStoreConfig, ZTableToExcelColumn, ZThemeConfig, ZThemeName, ZTranslateConfig, ZTranslateI18nConfig };
|