@shival99/z-ui 1.0.1 → 1.0.2
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/assets/css/animations.css +207 -0
- package/assets/css/base.css +76 -0
- package/assets/css/tailwind.css +53 -0
- package/assets/css/themes/gray.css +73 -0
- package/assets/css/themes/green.css +75 -0
- package/assets/css/themes/hospital.css +79 -0
- package/assets/css/themes/neutral.css +73 -0
- package/assets/css/themes/orange.css +73 -0
- package/assets/css/themes/slate.css +73 -0
- package/assets/css/themes/stone.css +73 -0
- package/assets/css/themes/violet.css +73 -0
- package/assets/css/themes/zinc.css +73 -0
- package/assets/images/avatar.svg +6 -0
- package/assets/images/logo.svg +6 -0
- package/fesm2022/shival99-z-ui-components-z-accordion.mjs +148 -0
- package/fesm2022/shival99-z-ui-components-z-accordion.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-breadcrumb.mjs +74 -0
- package/fesm2022/shival99-z-ui-components-z-breadcrumb.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-button.mjs +155 -0
- package/fesm2022/shival99-z-ui-components-z-button.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-calendar.mjs +2335 -0
- package/fesm2022/shival99-z-ui-components-z-calendar.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-checkbox.mjs +240 -0
- package/fesm2022/shival99-z-ui-components-z-checkbox.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-code.mjs +139 -0
- package/fesm2022/shival99-z-ui-components-z-code.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-drawer.mjs +664 -0
- package/fesm2022/shival99-z-ui-components-z-drawer.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs +55 -0
- package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-editor.mjs +411 -0
- package/fesm2022/shival99-z-ui-components-z-editor.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-filter.mjs +794 -0
- package/fesm2022/shival99-z-ui-components-z-filter.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-icon.mjs +451 -0
- package/fesm2022/shival99-z-ui-components-z-icon.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-input.mjs +804 -0
- package/fesm2022/shival99-z-ui-components-z-input.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-loading.mjs +105 -0
- package/fesm2022/shival99-z-ui-components-z-loading.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-menu.mjs +351 -0
- package/fesm2022/shival99-z-ui-components-z-menu.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-modal.mjs +722 -0
- package/fesm2022/shival99-z-ui-components-z-modal.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-pagination.mjs +131 -0
- package/fesm2022/shival99-z-ui-components-z-pagination.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-popover.mjs +917 -0
- package/fesm2022/shival99-z-ui-components-z-popover.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-radio.mjs +154 -0
- package/fesm2022/shival99-z-ui-components-z-radio.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-select.mjs +998 -0
- package/fesm2022/shival99-z-ui-components-z-select.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-skeleton.mjs +139 -0
- package/fesm2022/shival99-z-ui-components-z-skeleton.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-switch.mjs +127 -0
- package/fesm2022/shival99-z-ui-components-z-switch.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-table.mjs +2628 -0
- package/fesm2022/shival99-z-ui-components-z-table.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-tabs.mjs +259 -0
- package/fesm2022/shival99-z-ui-components-z-tabs.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-timeline.mjs +335 -0
- package/fesm2022/shival99-z-ui-components-z-timeline.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-toast.mjs +93 -0
- package/fesm2022/shival99-z-ui-components-z-toast.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-tooltip.mjs +660 -0
- package/fesm2022/shival99-z-ui-components-z-tooltip.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-upload.mjs +504 -0
- package/fesm2022/shival99-z-ui-components-z-upload.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-i18n.mjs +258 -0
- package/fesm2022/shival99-z-ui-i18n.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-pipes.mjs +116 -0
- package/fesm2022/shival99-z-ui-pipes.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-providers.mjs +203 -0
- package/fesm2022/shival99-z-ui-providers.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-services.mjs +919 -0
- package/fesm2022/shival99-z-ui-services.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-utils.mjs +591 -0
- package/fesm2022/shival99-z-ui-utils.mjs.map +1 -0
- package/fesm2022/z-ui.mjs +3 -19924
- package/fesm2022/z-ui.mjs.map +1 -1
- package/package.json +129 -1
- package/types/shival99-z-ui-components-z-accordion.d.ts +55 -0
- package/types/shival99-z-ui-components-z-breadcrumb.d.ts +36 -0
- package/types/shival99-z-ui-components-z-button.d.ts +41 -0
- package/types/shival99-z-ui-components-z-calendar.d.ts +300 -0
- package/types/shival99-z-ui-components-z-checkbox.d.ts +84 -0
- package/types/shival99-z-ui-components-z-code.d.ts +35 -0
- package/types/shival99-z-ui-components-z-drawer.d.ts +232 -0
- package/types/shival99-z-ui-components-z-dropdown-menu.d.ts +50 -0
- package/types/shival99-z-ui-components-z-editor.d.ts +115 -0
- package/types/shival99-z-ui-components-z-filter.d.ts +268 -0
- package/types/shival99-z-ui-components-z-icon.d.ts +291 -0
- package/types/shival99-z-ui-components-z-input.d.ts +188 -0
- package/types/shival99-z-ui-components-z-loading.d.ts +46 -0
- package/types/shival99-z-ui-components-z-menu.d.ts +116 -0
- package/types/shival99-z-ui-components-z-modal.d.ts +270 -0
- package/types/shival99-z-ui-components-z-pagination.d.ts +52 -0
- package/types/shival99-z-ui-components-z-popover.d.ts +134 -0
- package/types/shival99-z-ui-components-z-radio.d.ts +63 -0
- package/types/shival99-z-ui-components-z-select.d.ts +268 -0
- package/types/shival99-z-ui-components-z-skeleton.d.ts +55 -0
- package/types/shival99-z-ui-components-z-switch.d.ts +48 -0
- package/types/shival99-z-ui-components-z-table.d.ts +482 -0
- package/types/shival99-z-ui-components-z-tabs.d.ts +75 -0
- package/types/shival99-z-ui-components-z-timeline.d.ts +98 -0
- package/types/shival99-z-ui-components-z-toast.d.ts +61 -0
- package/types/shival99-z-ui-components-z-tooltip.d.ts +85 -0
- package/types/shival99-z-ui-components-z-upload.d.ts +136 -0
- package/types/shival99-z-ui-i18n.d.ts +50 -0
- package/types/shival99-z-ui-pipes.d.ts +36 -0
- package/types/shival99-z-ui-providers.d.ts +132 -0
- package/types/shival99-z-ui-services.d.ts +364 -0
- package/types/shival99-z-ui-utils.d.ts +145 -0
- package/types/z-ui.d.ts +3 -4977
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { TranslationObject, TranslateService } from '@ngx-translate/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Z-Cache Types
|
|
7
|
+
*/
|
|
8
|
+
/** Cache entry with TTL */
|
|
9
|
+
interface ZCacheEntry<T = unknown> {
|
|
10
|
+
data: T;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
ttl: number;
|
|
13
|
+
}
|
|
14
|
+
/** Cache service configuration */
|
|
15
|
+
interface ZCacheConfig {
|
|
16
|
+
/** Prefix for cache keys */
|
|
17
|
+
prefix?: string;
|
|
18
|
+
/** Whether to encrypt data */
|
|
19
|
+
encrypt?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Z-Cache Service
|
|
24
|
+
* A localStorage-based cache service with optional encryption
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
declare class ZCacheService {
|
|
28
|
+
private static _prefix;
|
|
29
|
+
private static _encrypt;
|
|
30
|
+
/**
|
|
31
|
+
* Configure the cache service
|
|
32
|
+
*/
|
|
33
|
+
static configure(config: ZCacheConfig): void;
|
|
34
|
+
private static _encode;
|
|
35
|
+
private static _decode;
|
|
36
|
+
private static _getFullKey;
|
|
37
|
+
private static _safeOperation;
|
|
38
|
+
/**
|
|
39
|
+
* Get a value from cache
|
|
40
|
+
* @param key - Cache key
|
|
41
|
+
* @param defaultValue - Default value if not found
|
|
42
|
+
* @param encrypt - Whether to use encryption (default: service config)
|
|
43
|
+
*/
|
|
44
|
+
static get<T>(key: string, defaultValue?: T, encrypt?: boolean): T | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Set a value in cache
|
|
47
|
+
* @param key - Cache key
|
|
48
|
+
* @param data - Data to store
|
|
49
|
+
* @param encrypt - Whether to use encryption
|
|
50
|
+
*/
|
|
51
|
+
static set<T>(key: string, data: T, encrypt?: boolean): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Delete a key from cache
|
|
54
|
+
* @param key - Cache key
|
|
55
|
+
* @param encrypt - Whether key is encrypted
|
|
56
|
+
*/
|
|
57
|
+
static delete(key: string, encrypt?: boolean): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Delete multiple keys from cache
|
|
60
|
+
* @param keys - Array of cache keys
|
|
61
|
+
* @param encrypt - Whether keys are encrypted
|
|
62
|
+
*/
|
|
63
|
+
static deleteMultiple(keys: string[], encrypt?: boolean): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Clear all cache with the configured prefix
|
|
66
|
+
*/
|
|
67
|
+
static clear(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Check if a key exists in cache
|
|
70
|
+
* @param key - Cache key
|
|
71
|
+
* @param encrypt - Whether key is encrypted
|
|
72
|
+
*/
|
|
73
|
+
static has(key: string, encrypt?: boolean): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Get all keys with the configured prefix
|
|
76
|
+
*/
|
|
77
|
+
static keys(): string[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Z-IndexDB Types
|
|
82
|
+
*/
|
|
83
|
+
/** Configuration for a single IndexedDB store */
|
|
84
|
+
interface ZIndexDbStoreConfig {
|
|
85
|
+
/** Name of the store */
|
|
86
|
+
name: string;
|
|
87
|
+
/** Whether to encrypt data (default: true) */
|
|
88
|
+
encrypt?: boolean;
|
|
89
|
+
/** Keys to avoid during clear operation */
|
|
90
|
+
protectedKeys?: string[];
|
|
91
|
+
}
|
|
92
|
+
/** Configuration for Z-IndexDB Service */
|
|
93
|
+
interface ZIndexDbConfig {
|
|
94
|
+
/** Database name */
|
|
95
|
+
dbName?: string;
|
|
96
|
+
/** Database version */
|
|
97
|
+
version?: number;
|
|
98
|
+
/** Transaction mode */
|
|
99
|
+
mode?: IDBTransactionMode;
|
|
100
|
+
/** Store configurations - supports multiple stores */
|
|
101
|
+
stores?: ZIndexDbStoreConfig[];
|
|
102
|
+
/** Default store name (for backward compatibility) */
|
|
103
|
+
defaultStore?: string;
|
|
104
|
+
/** Keys to avoid during clear operation (global) */
|
|
105
|
+
protectedKeys?: string[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Z-IndexDB Service
|
|
110
|
+
* A robust IndexedDB service with multi-store support, encryption, and retry logic
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
declare class ZIndexDbService {
|
|
114
|
+
private _db;
|
|
115
|
+
private _dbName;
|
|
116
|
+
private _version;
|
|
117
|
+
private _mode;
|
|
118
|
+
private _dbReady;
|
|
119
|
+
private _stores;
|
|
120
|
+
private _defaultStoreName;
|
|
121
|
+
private _globalProtectedKeys;
|
|
122
|
+
constructor(config?: ZIndexDbConfig);
|
|
123
|
+
private _getStoreConfig;
|
|
124
|
+
private _encrypt;
|
|
125
|
+
private _decrypt;
|
|
126
|
+
private _closeConnection;
|
|
127
|
+
private _reconnect;
|
|
128
|
+
private _withRetry;
|
|
129
|
+
private _initDb;
|
|
130
|
+
/**
|
|
131
|
+
* Get a value from the store
|
|
132
|
+
* @param key - The key to retrieve
|
|
133
|
+
* @param defaultValue - Default value if key not found
|
|
134
|
+
* @param storeName - Optional store name (uses default if not specified)
|
|
135
|
+
*/
|
|
136
|
+
get<T>(key: string, defaultValue?: T, storeName?: string): Promise<T | undefined>;
|
|
137
|
+
/**
|
|
138
|
+
* Set a value in the store
|
|
139
|
+
* @param key - The key to set
|
|
140
|
+
* @param value - The value to store
|
|
141
|
+
* @param storeName - Optional store name
|
|
142
|
+
*/
|
|
143
|
+
set<T>(key: string, value: T, storeName?: string): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Delete a key from the store
|
|
146
|
+
* @param key - Key or array of keys to delete
|
|
147
|
+
* @param storeName - Optional store name
|
|
148
|
+
*/
|
|
149
|
+
delete(key: string | string[], storeName?: string): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Clear all data from a store (respecting protected keys)
|
|
152
|
+
* @param storeName - Optional store name
|
|
153
|
+
*/
|
|
154
|
+
clear(storeName?: string): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Get all items from a store
|
|
157
|
+
* @param storeName - Optional store name
|
|
158
|
+
*/
|
|
159
|
+
getAll<T = unknown>(storeName?: string): Promise<Record<string, T>>;
|
|
160
|
+
/**
|
|
161
|
+
* Set multiple items at once
|
|
162
|
+
* @param items - Object with key-value pairs
|
|
163
|
+
* @param storeName - Optional store name
|
|
164
|
+
*/
|
|
165
|
+
setMultiple<T>(items: Record<string, T>, storeName?: string): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Get the list of available store names
|
|
168
|
+
*/
|
|
169
|
+
getStoreNames(): string[];
|
|
170
|
+
/**
|
|
171
|
+
* Check if a store exists
|
|
172
|
+
* @param storeName - Store name to check
|
|
173
|
+
*/
|
|
174
|
+
hasStore(storeName: string): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Add a new store (requires database version upgrade)
|
|
177
|
+
* Note: This will cause database reconnection
|
|
178
|
+
* @param config - Store configuration
|
|
179
|
+
*/
|
|
180
|
+
addStore(config: ZIndexDbStoreConfig): Promise<void>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
type SubjectType = 'subject' | 'behavior';
|
|
184
|
+
declare class ZSubjectService {
|
|
185
|
+
private readonly _subjects;
|
|
186
|
+
private readonly _behaviorSubjects;
|
|
187
|
+
/**
|
|
188
|
+
* Emit a value to a subject
|
|
189
|
+
* @param key - Subject identifier
|
|
190
|
+
* @param type - 'subject' for Subject, 'behavior' for BehaviorSubject
|
|
191
|
+
* @param value - Value to emit
|
|
192
|
+
*/
|
|
193
|
+
emit<T>(key: string, type: SubjectType, value: T): void;
|
|
194
|
+
/**
|
|
195
|
+
* Get an observable for a subject
|
|
196
|
+
* @param key - Subject identifier
|
|
197
|
+
* @param type - 'subject' for Subject, 'behavior' for BehaviorSubject
|
|
198
|
+
* @param initialValue - Initial value for BehaviorSubject (required for new behavior subjects)
|
|
199
|
+
*/
|
|
200
|
+
on$<T>(key: string, type: SubjectType, initialValue?: T): Observable<T>;
|
|
201
|
+
/**
|
|
202
|
+
* Get the current value of a BehaviorSubject
|
|
203
|
+
* @param key - Subject identifier
|
|
204
|
+
*/
|
|
205
|
+
getValue<T>(key: string): T | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* Complete and remove a subject
|
|
208
|
+
* @param key - Subject identifier
|
|
209
|
+
* @param type - 'subject' for Subject, 'behavior' for BehaviorSubject
|
|
210
|
+
*/
|
|
211
|
+
complete(key: string, type: SubjectType): void;
|
|
212
|
+
/**
|
|
213
|
+
* Complete all subjects
|
|
214
|
+
*/
|
|
215
|
+
completeAll(): void;
|
|
216
|
+
/**
|
|
217
|
+
* Check if a subject exists
|
|
218
|
+
* @param key - Subject identifier
|
|
219
|
+
* @param type - 'subject' for Subject, 'behavior' for BehaviorSubject
|
|
220
|
+
*/
|
|
221
|
+
has(key: string, type: SubjectType): boolean;
|
|
222
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ZSubjectService, never>;
|
|
223
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ZSubjectService>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Z-Theme Types
|
|
228
|
+
*/
|
|
229
|
+
type ZThemeName = 'green' | 'orange' | 'violet' | 'neutral' | 'stone' | 'zinc' | 'gray' | 'slate' | 'hospital';
|
|
230
|
+
declare const Z_DEFAULT_THEME: ZThemeName;
|
|
231
|
+
declare const Z_THEME_CSS_MAP: Record<ZThemeName, string>;
|
|
232
|
+
|
|
233
|
+
declare class ZThemeService {
|
|
234
|
+
private readonly _document;
|
|
235
|
+
private readonly _isDark;
|
|
236
|
+
private readonly _currentTheme;
|
|
237
|
+
private readonly _loadedThemes;
|
|
238
|
+
readonly isDark: i0.Signal<boolean>;
|
|
239
|
+
readonly currentTheme: i0.Signal<ZThemeName>;
|
|
240
|
+
setTheme(theme: ZThemeName): void;
|
|
241
|
+
toggleDarkMode(isDark: boolean): void;
|
|
242
|
+
preloadTheme(theme: ZThemeName): void;
|
|
243
|
+
private _loadThemeCSS;
|
|
244
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ZThemeService, never>;
|
|
245
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ZThemeService>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
declare class ZTranslateService {
|
|
249
|
+
private readonly _translate;
|
|
250
|
+
/** Current language signal */
|
|
251
|
+
readonly currentLang: i0.WritableSignal<string>;
|
|
252
|
+
/** Available languages */
|
|
253
|
+
readonly availableLangs: i0.WritableSignal<string[]>;
|
|
254
|
+
constructor();
|
|
255
|
+
private _initialize;
|
|
256
|
+
/**
|
|
257
|
+
* Change the current language
|
|
258
|
+
* @param lang - Language code
|
|
259
|
+
*/
|
|
260
|
+
use(lang: string): void;
|
|
261
|
+
/**
|
|
262
|
+
* Get the current language code
|
|
263
|
+
*/
|
|
264
|
+
getLang(): string;
|
|
265
|
+
/**
|
|
266
|
+
* Get translation synchronously (returns key if not found)
|
|
267
|
+
* @param key - Translation key
|
|
268
|
+
* @param params - Interpolation parameters
|
|
269
|
+
*/
|
|
270
|
+
instant(key: string, params?: Record<string, unknown>): string;
|
|
271
|
+
/**
|
|
272
|
+
* Get translation asynchronously
|
|
273
|
+
* @param key - Translation key
|
|
274
|
+
* @param params - Interpolation parameters
|
|
275
|
+
*/
|
|
276
|
+
get(key: string, params?: Record<string, unknown>): Promise<string>;
|
|
277
|
+
/**
|
|
278
|
+
* Get translation as observable
|
|
279
|
+
* @param key - Translation key
|
|
280
|
+
* @param params - Interpolation parameters
|
|
281
|
+
*/
|
|
282
|
+
get$(key: string, params?: Record<string, unknown>): Observable<string>;
|
|
283
|
+
/**
|
|
284
|
+
* Stream translations (re-emits on language change)
|
|
285
|
+
* @param key - Translation key
|
|
286
|
+
* @param params - Interpolation parameters
|
|
287
|
+
*/
|
|
288
|
+
stream$(key: string, params?: Record<string, unknown>): Observable<string>;
|
|
289
|
+
/**
|
|
290
|
+
* Get multiple translations at once
|
|
291
|
+
* @param keys - Array of translation keys
|
|
292
|
+
* @param params - Interpolation parameters (applied to all)
|
|
293
|
+
*/
|
|
294
|
+
getMany(keys: string[], params?: Record<string, unknown>): Promise<Record<string, string>>;
|
|
295
|
+
/**
|
|
296
|
+
* Check if a translation key exists
|
|
297
|
+
* @param key - Translation key
|
|
298
|
+
*/
|
|
299
|
+
has(key: string): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Add translations dynamically
|
|
302
|
+
* @param lang - Language code
|
|
303
|
+
* @param translations - Translation object
|
|
304
|
+
* @param shouldMerge - Whether to merge with existing translations
|
|
305
|
+
*/
|
|
306
|
+
setTranslation(lang: string, translations: TranslationObject, shouldMerge?: boolean): void;
|
|
307
|
+
/**
|
|
308
|
+
* Get the underlying TranslateService for advanced usage
|
|
309
|
+
*/
|
|
310
|
+
getNgxTranslate(): TranslateService;
|
|
311
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ZTranslateService, never>;
|
|
312
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ZTranslateService>;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Z-Http Types
|
|
317
|
+
*/
|
|
318
|
+
/** HTTP cache entry */
|
|
319
|
+
interface ZHttpCacheEntry<T = unknown> {
|
|
320
|
+
data: T;
|
|
321
|
+
timestamp: number;
|
|
322
|
+
ttl: number;
|
|
323
|
+
}
|
|
324
|
+
/** HTTP error response */
|
|
325
|
+
interface ZHttpError {
|
|
326
|
+
message: string;
|
|
327
|
+
status: number;
|
|
328
|
+
error?: unknown;
|
|
329
|
+
endpoint?: string;
|
|
330
|
+
method?: string;
|
|
331
|
+
body?: unknown;
|
|
332
|
+
}
|
|
333
|
+
/** HTTP request options */
|
|
334
|
+
interface ZHttpOptions<TParams extends object = object> {
|
|
335
|
+
params?: TParams;
|
|
336
|
+
headers?: Record<string, string | string[]>;
|
|
337
|
+
enableCache?: boolean;
|
|
338
|
+
timeCache?: number;
|
|
339
|
+
contentType?: 'json' | 'urlencoded' | 'form-data';
|
|
340
|
+
skipToken?: boolean;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Z-Translate Types
|
|
345
|
+
*/
|
|
346
|
+
/** Translate service configuration */
|
|
347
|
+
interface ZTranslateConfig {
|
|
348
|
+
/** Default language */
|
|
349
|
+
defaultLang?: string;
|
|
350
|
+
/** Available languages */
|
|
351
|
+
availableLangs?: string[];
|
|
352
|
+
/** Path to translation files */
|
|
353
|
+
translationPath?: string;
|
|
354
|
+
/** Translation file extension */
|
|
355
|
+
fileExtension?: string;
|
|
356
|
+
}
|
|
357
|
+
/** Translate I18n configuration */
|
|
358
|
+
interface ZTranslateI18nConfig {
|
|
359
|
+
defaultLang?: string;
|
|
360
|
+
availableLangs?: string[];
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export { ZCacheService, ZIndexDbService, ZSubjectService, ZThemeService, ZTranslateService, Z_DEFAULT_THEME, Z_THEME_CSS_MAP };
|
|
364
|
+
export type { ZCacheConfig, ZCacheEntry, ZHttpCacheEntry, ZHttpError, ZHttpOptions, ZIndexDbConfig, ZIndexDbStoreConfig, ZThemeName, ZTranslateConfig, ZTranslateI18nConfig };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { WritableSignal } from '@angular/core';
|
|
2
|
+
import { ClassValue } from 'clsx';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { FormGroup, FormArray } from '@angular/forms';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Z-Common Types
|
|
8
|
+
* Common utility types
|
|
9
|
+
*/
|
|
10
|
+
type ZBrowserName = 'Chrome' | 'Edge' | 'Firefox' | 'Safari' | 'Opera' | 'IE' | 'Unknown' | string;
|
|
11
|
+
type ZDeviceType = 'mobile' | 'tablet' | 'desktop';
|
|
12
|
+
interface ZBrowserInfo {
|
|
13
|
+
name: ZBrowserName;
|
|
14
|
+
version: string;
|
|
15
|
+
agent: string;
|
|
16
|
+
device: ZDeviceType;
|
|
17
|
+
time: string;
|
|
18
|
+
}
|
|
19
|
+
interface ZNavigatorUABrandVersion {
|
|
20
|
+
brand: string;
|
|
21
|
+
version: string;
|
|
22
|
+
}
|
|
23
|
+
interface ZNavigatorUAData {
|
|
24
|
+
brands: ZNavigatorUABrandVersion[];
|
|
25
|
+
mobile: boolean;
|
|
26
|
+
platform: string;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface Navigator {
|
|
30
|
+
userAgentData?: ZNavigatorUAData;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
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
|
+
declare const zMergeClasses: (...inputs: ClassValue[]) => string;
|
|
42
|
+
/** Transform boolean-like values to boolean */
|
|
43
|
+
declare const zTransform: (value: boolean | string) => boolean;
|
|
44
|
+
/** Generate a unique ID with optional prefix */
|
|
45
|
+
declare const zGenerateId: (prefix?: string) => string;
|
|
46
|
+
declare const zNoop: () => undefined;
|
|
47
|
+
/** Simple UUID generator */
|
|
48
|
+
declare const zUuid: () => string;
|
|
49
|
+
/** Capitalize each word in a string */
|
|
50
|
+
declare const zCapitalCase: (text: string) => string;
|
|
51
|
+
/** Check if text is truncated (requires element to be rendered) */
|
|
52
|
+
declare const zIsTextTruncated: (el: HTMLElement) => Promise<boolean>;
|
|
53
|
+
/** Decode unicode escape sequences */
|
|
54
|
+
declare const zDecodeUnicode: (str: string) => string;
|
|
55
|
+
/** Generate a random color in hex, rgb, and hsl formats */
|
|
56
|
+
declare const zRandomColor: () => {
|
|
57
|
+
hex: string;
|
|
58
|
+
rgb: string;
|
|
59
|
+
hsl: string;
|
|
60
|
+
};
|
|
61
|
+
/** Convert color string to ARGB format */
|
|
62
|
+
declare const zConvertColorToArgb: (color: string) => string;
|
|
63
|
+
/** Clean null/undefined values from object recursively */
|
|
64
|
+
declare const zCleanObject: <T = unknown>(obj: T) => T;
|
|
65
|
+
/** Flatten tree structure to flat array */
|
|
66
|
+
declare const zTreeFlatten: <T extends Record<string, unknown>>(list: T[], keyMap: keyof T, parentKeyMap: keyof T, sortFn?: (a: T, b: T) => number) => (T & {
|
|
67
|
+
level: number;
|
|
68
|
+
parentsKey: string[];
|
|
69
|
+
})[];
|
|
70
|
+
/** Build tree structure from flat array */
|
|
71
|
+
declare const zTreeBuild: <T extends Record<string, unknown>>(list: T[], keyMap: keyof T, parentKeyMap: keyof T, sortFn?: (a: T, b: T) => number) => (T & {
|
|
72
|
+
level: number;
|
|
73
|
+
parentsKey: string[];
|
|
74
|
+
children: unknown[];
|
|
75
|
+
})[];
|
|
76
|
+
/** Vietnamese character map for normalization */
|
|
77
|
+
declare const VIETNAMESE_MAP: Record<string, string>;
|
|
78
|
+
/** Remove Vietnamese diacritics from string */
|
|
79
|
+
declare const zRemoveVietnamese: (str: string) => string;
|
|
80
|
+
/** Full-text search using MiniSearch */
|
|
81
|
+
declare const zMiniSearch: <T>(data: T[], query: string, fields: (keyof T | string)[]) => T[];
|
|
82
|
+
/** Full-text search as Observable with loading state */
|
|
83
|
+
declare const zMiniSearch$: <T>(data: T[], query: string, fields: (keyof T | string)[], loading?: WritableSignal<boolean>, fakeDelay?: number) => Observable<T[]>;
|
|
84
|
+
/** Detect browser information */
|
|
85
|
+
declare const zDetectBrowser: () => ZBrowserInfo;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Z-Echarts Types
|
|
89
|
+
*/
|
|
90
|
+
interface ZEchartsThemeOptions {
|
|
91
|
+
/** Theme name (default: 'zTheme') */
|
|
92
|
+
themeName?: string;
|
|
93
|
+
/** Font family (default: Lexend, Arial, Helvetica, sans-serif) */
|
|
94
|
+
fontFamily?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Z-Echarts Utils
|
|
99
|
+
* ECharts utility functions
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Register custom Z-UI theme for ECharts
|
|
104
|
+
* @param options - Theme configuration options
|
|
105
|
+
*/
|
|
106
|
+
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
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Submit form and mark invalid controls as dirty
|
|
117
|
+
* @param form - FormGroup or FormArray to submit
|
|
118
|
+
* @returns true if form is valid, false otherwise
|
|
119
|
+
*/
|
|
120
|
+
declare const zSubmitForm: (form: FormGroup | FormArray) => boolean;
|
|
121
|
+
/** Legacy alias */
|
|
122
|
+
declare const submitForm: (form: FormGroup | FormArray) => boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Debug invalid form controls by logging to console
|
|
125
|
+
* @param form - FormGroup to debug
|
|
126
|
+
* @param parentKey - Parent key for nested controls
|
|
127
|
+
*/
|
|
128
|
+
declare const zDebugFormInvalid: (form: FormGroup, parentKey?: string) => void;
|
|
129
|
+
/** Legacy alias */
|
|
130
|
+
declare const debugFormInvalid: (form: FormGroup, parentKey?: string) => void;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Z-Form Types
|
|
134
|
+
* Form utility types
|
|
135
|
+
*/
|
|
136
|
+
/** Form submit result */
|
|
137
|
+
type ZFormSubmitResult = boolean;
|
|
138
|
+
/** Form debug options */
|
|
139
|
+
interface ZFormDebugOptions {
|
|
140
|
+
showValid?: boolean;
|
|
141
|
+
logLevel?: 'error' | 'warn' | 'log';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { VIETNAMESE_MAP, debugFormInvalid, registerEchartsMsgTheme, submitForm, zCapitalCase, zCleanObject, zConvertColorToArgb, zDebugFormInvalid, zDecodeUnicode, zDetectBrowser, zGenerateId, zIsTextTruncated, zMergeClasses, zMiniSearch, zMiniSearch$, zNoop, zRandomColor, zRegisterEchartsTheme, zRemoveVietnamese, zSubmitForm, zTransform, zTreeBuild, zTreeFlatten, zUuid };
|
|
145
|
+
export type { ZBrowserInfo, ZBrowserName, ZDeviceType, ZEchartsThemeOptions, ZFormDebugOptions, ZFormSubmitResult, ZNavigatorUABrandVersion, ZNavigatorUAData };
|