@shival99/z-ui 1.0.12 → 1.0.13

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.
@@ -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
- /** Simple UUID generator */
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, 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 };
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
@@ -1,4 +1,3 @@
1
- /** Z-UI library version */
2
1
  declare const Z_UI_VERSION = "1.0.1";
3
2
 
4
3
  export { Z_UI_VERSION };