@shival99/z-ui 1.9.20 → 1.9.22
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-accordion.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-accordion.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs +186 -26
- package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-kanban.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-kanban.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-pagination.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-pagination.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-select.mjs +205 -40
- package/fesm2022/shival99-z-ui-components-z-select.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-table.mjs +33 -5
- package/fesm2022/shival99-z-ui-components-z-table.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-tags.mjs +36 -9
- package/fesm2022/shival99-z-ui-components-z-tags.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-utils.mjs +69 -2
- package/fesm2022/shival99-z-ui-utils.mjs.map +1 -1
- package/package.json +2 -2
- package/types/shival99-z-ui-components-z-autocomplete.d.ts +37 -6
- package/types/shival99-z-ui-components-z-modal.d.ts +1 -1
- package/types/shival99-z-ui-components-z-select.d.ts +37 -4
- package/types/shival99-z-ui-components-z-table.d.ts +21 -5
- package/types/shival99-z-ui-components-z-tags.d.ts +11 -1
- package/types/shival99-z-ui-utils.d.ts +47 -2
|
@@ -4,7 +4,7 @@ import { TemplateRef, Signal, OnInit, ElementRef } from '@angular/core';
|
|
|
4
4
|
import { ControlValueAccessor } from '@angular/forms';
|
|
5
5
|
import { ZIcon } from '@shival99/z-ui/components/z-icon';
|
|
6
6
|
import { ZPopoverPosition, ZPopoverControl } from '@shival99/z-ui/components/z-popover';
|
|
7
|
-
import { ZEvent } from '@shival99/z-ui/utils';
|
|
7
|
+
import { ZAsyncOptionsConfig, ZEvent } from '@shival99/z-ui/utils';
|
|
8
8
|
import { ClassValue } from 'clsx';
|
|
9
9
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
10
10
|
import { VariantProps } from 'class-variance-authority';
|
|
@@ -22,20 +22,31 @@ interface ZAutocompleteOption<T = unknown> {
|
|
|
22
22
|
description?: string;
|
|
23
23
|
icon?: ZIcon;
|
|
24
24
|
}
|
|
25
|
-
interface ZAutocompleteConfig {
|
|
25
|
+
interface ZAutocompleteConfig<T = unknown> {
|
|
26
|
+
/** Số ký tự tối thiểu trước khi bắt đầu search hoặc gọi async.load. */
|
|
26
27
|
minLength: number;
|
|
28
|
+
/** Thời gian chờ sau khi người dùng ngừng nhập rồi mới phát zOnSearch/call async.load, tính bằng mili giây. */
|
|
27
29
|
debounceTime: number;
|
|
30
|
+
/** Giới hạn số option hiển thị sau khi filter; đặt 0 để không giới hạn. */
|
|
28
31
|
maxDisplayed: number;
|
|
32
|
+
/** Bật highlight phần text khớp với keyword trong label của option. */
|
|
29
33
|
highlightMatch: boolean;
|
|
34
|
+
/** i18n key hoặc text hiển thị khi đã nhập keyword nhưng không có kết quả. */
|
|
30
35
|
emptyMessage: string;
|
|
36
|
+
/** i18n key hoặc text hiển thị khi chưa có dữ liệu ban đầu. */
|
|
31
37
|
noDataMessage: string;
|
|
38
|
+
/** Tự đóng dropdown sau khi chọn option. */
|
|
32
39
|
closeOnSelect: boolean;
|
|
40
|
+
/** Chiều cao mặc định của một option, dùng cho virtual scroll và layout dropdown. */
|
|
33
41
|
optionHeight: number;
|
|
42
|
+
/** Chiều cao tối đa của dropdown, tính bằng pixel. */
|
|
34
43
|
dropdownMaxHeight: number;
|
|
35
|
-
/**
|
|
44
|
+
/** Bỏ filter local khi options đã được xử lý từ server qua zOnSearch. */
|
|
36
45
|
serverSearch: boolean;
|
|
46
|
+
/** Config để component tự search, load-more, loading và append options. */
|
|
47
|
+
async?: ZAsyncOptionsConfig<ZAutocompleteOption<T>>;
|
|
37
48
|
}
|
|
38
|
-
declare const Z_AUTOCOMPLETE_DEFAULT_CONFIG: ZAutocompleteConfig
|
|
49
|
+
declare const Z_AUTOCOMPLETE_DEFAULT_CONFIG: Omit<ZAutocompleteConfig, 'async'>;
|
|
39
50
|
type ZAutocompleteSize = 'sm' | 'default' | 'lg';
|
|
40
51
|
type ZAutocompleteType = 'default' | 'address_bar';
|
|
41
52
|
interface ZAutocompleteState {
|
|
@@ -90,7 +101,7 @@ declare class ZAutocompleteComponent<T = unknown> implements OnInit, ControlValu
|
|
|
90
101
|
protected readonly customOptionDirective: _angular_core.Signal<ZAutocompleteOptionDirective<any> | undefined>;
|
|
91
102
|
readonly class: _angular_core.InputSignal<ClassValue>;
|
|
92
103
|
readonly zOptions: _angular_core.InputSignal<ZAutocompleteOption<T>[]>;
|
|
93
|
-
readonly zConfig: _angular_core.InputSignal<Partial<ZAutocompleteConfig
|
|
104
|
+
readonly zConfig: _angular_core.InputSignal<Partial<ZAutocompleteConfig<T>>>;
|
|
94
105
|
readonly zSize: _angular_core.InputSignal<ZAutocompleteSize>;
|
|
95
106
|
readonly zType: _angular_core.InputSignal<ZAutocompleteType>;
|
|
96
107
|
readonly zLabel: _angular_core.InputSignal<string>;
|
|
@@ -135,6 +146,12 @@ declare class ZAutocompleteComponent<T = unknown> implements OnInit, ControlValu
|
|
|
135
146
|
private readonly _formControl;
|
|
136
147
|
private readonly _popoverControl;
|
|
137
148
|
private readonly _selectedOption;
|
|
149
|
+
private readonly _asyncOptions;
|
|
150
|
+
private readonly _asyncKeyword;
|
|
151
|
+
private readonly _asyncPage;
|
|
152
|
+
private readonly _asyncHasMore;
|
|
153
|
+
private readonly _asyncLoading;
|
|
154
|
+
private readonly _asyncLoadingMore;
|
|
138
155
|
protected readonly uiState: _angular_core.WritableSignal<{
|
|
139
156
|
isOpen: boolean;
|
|
140
157
|
isFocused: boolean;
|
|
@@ -153,13 +170,20 @@ declare class ZAutocompleteComponent<T = unknown> implements OnInit, ControlValu
|
|
|
153
170
|
private _localLoadingTimeout;
|
|
154
171
|
private _loadMoreObserver;
|
|
155
172
|
private _virtualScrollListener;
|
|
173
|
+
private _asyncLoadSubscription;
|
|
174
|
+
private _asyncRequestId;
|
|
156
175
|
private _lastFilteredOptionsLength;
|
|
157
176
|
private _shouldScrollActiveOption;
|
|
158
177
|
/** Stores input value before keyboard navigation for ESC revert */
|
|
159
178
|
private _valueBeforeNavigation;
|
|
160
179
|
protected readonly virtualizer: _shival99_angular_virtual.AngularVirtualizer<HTMLDivElement, Element>;
|
|
161
180
|
private readonly _measureVirtualItems;
|
|
162
|
-
protected readonly config: _angular_core.Signal<ZAutocompleteConfig
|
|
181
|
+
protected readonly config: _angular_core.Signal<ZAutocompleteConfig<T>>;
|
|
182
|
+
protected readonly hasAsyncOptions: _angular_core.Signal<boolean>;
|
|
183
|
+
protected readonly sourceOptions: _angular_core.Signal<ZAutocompleteOption<T>[]>;
|
|
184
|
+
protected readonly isLoading: _angular_core.Signal<boolean>;
|
|
185
|
+
protected readonly isLoadingMore: _angular_core.Signal<boolean>;
|
|
186
|
+
protected readonly canLoadMore: _angular_core.Signal<boolean>;
|
|
163
187
|
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
164
188
|
protected readonly isReadonly: _angular_core.Signal<boolean>;
|
|
165
189
|
protected readonly isInteractionDisabled: _angular_core.Signal<boolean>;
|
|
@@ -226,11 +250,18 @@ declare class ZAutocompleteComponent<T = unknown> implements OnInit, ControlValu
|
|
|
226
250
|
private _openPanel;
|
|
227
251
|
private _closePanel;
|
|
228
252
|
private _setupDebounce;
|
|
253
|
+
private _loadAsyncOptionsOnFocus;
|
|
254
|
+
private _loadAsyncOptions;
|
|
255
|
+
private _handleAsyncOptionsError;
|
|
256
|
+
private _getAsyncOptionsScrollTop;
|
|
257
|
+
private _restoreAsyncOptionsScrollTop;
|
|
258
|
+
private _resetAsyncOptions;
|
|
229
259
|
private _clearLocalLoadingTimer;
|
|
230
260
|
private _setupLoadMoreObserver;
|
|
231
261
|
private _cleanupLoadMoreObserver;
|
|
232
262
|
private _setupVirtualScrollLoadMore;
|
|
233
263
|
private _cleanupVirtualScrollListener;
|
|
264
|
+
private _handleLoadMore;
|
|
234
265
|
private _emitControl;
|
|
235
266
|
private _getOptionKey;
|
|
236
267
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZAutocompleteComponent<any>, never>;
|
|
@@ -231,7 +231,7 @@ declare class ZModalComponent<T, U> extends BasePortalOutlet implements OnDestro
|
|
|
231
231
|
protected readonly effectiveOkText: _angular_core.Signal<string | null | undefined>;
|
|
232
232
|
protected readonly effectiveCancelText: _angular_core.Signal<string | null | undefined>;
|
|
233
233
|
protected readonly effectiveOkDestructive: _angular_core.Signal<boolean | undefined>;
|
|
234
|
-
protected readonly effectiveTypeOk: _angular_core.Signal<"info" | "warning" | "error" | "
|
|
234
|
+
protected readonly effectiveTypeOk: _angular_core.Signal<"info" | "warning" | "error" | "default" | "primary" | "secondary" | "destructive" | "success" | "outline" | "outline-primary" | "outline-secondary" | "outline-success" | "outline-info" | "outline-warning" | "outline-error" | "outline-destructive" | "outline-success-secondary" | "outline-info-secondary" | "outline-warning-secondary" | "outline-error-secondary" | "outline-destructive-secondary" | "outline-primary-secondary" | "ghost" | "ghost-primary" | "ghost-success" | "ghost-info" | "ghost-warning" | "ghost-error" | "ghost-destructive" | "subtle" | "subtle-primary" | "subtle-success" | "subtle-info" | "subtle-warning" | "subtle-destructive" | "link" | null | undefined>;
|
|
235
235
|
protected readonly effectiveOkDisabled: _angular_core.Signal<boolean | undefined>;
|
|
236
236
|
protected readonly effectiveLoading: _angular_core.Signal<boolean>;
|
|
237
237
|
protected readonly effectiveContentLoading: _angular_core.Signal<boolean>;
|
|
@@ -4,7 +4,7 @@ import { TemplateRef, Signal, OnInit, ElementRef, PipeTransform } from '@angular
|
|
|
4
4
|
import { ControlValueAccessor } from '@angular/forms';
|
|
5
5
|
import { ZIcon } from '@shival99/z-ui/components/z-icon';
|
|
6
6
|
import { ZPopoverPosition, ZPopoverControl } from '@shival99/z-ui/components/z-popover';
|
|
7
|
-
import { ZEvent } from '@shival99/z-ui/utils';
|
|
7
|
+
import { ZAsyncOptionsConfig, ZEvent } from '@shival99/z-ui/utils';
|
|
8
8
|
import { ClassValue } from 'clsx';
|
|
9
9
|
import { Observable } from 'rxjs';
|
|
10
10
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
@@ -57,6 +57,15 @@ interface ZSelectOption<T = unknown> {
|
|
|
57
57
|
group?: string;
|
|
58
58
|
icon?: string;
|
|
59
59
|
}
|
|
60
|
+
interface ZSelectConfig<T = unknown> {
|
|
61
|
+
/** Số ký tự tối thiểu trước khi gọi async.load khi người dùng search. */
|
|
62
|
+
minLength: number;
|
|
63
|
+
/** Debounce search tính bằng mili giây, ưu tiên hơn zDebounce khi được truyền trong zConfig. */
|
|
64
|
+
debounceTime: number;
|
|
65
|
+
/** Config để component tự search, load-more, loading và append options. */
|
|
66
|
+
async?: ZAsyncOptionsConfig<ZSelectOption<T>>;
|
|
67
|
+
}
|
|
68
|
+
declare const Z_SELECT_DEFAULT_CONFIG: Omit<ZSelectConfig, 'async'>;
|
|
60
69
|
interface ZSelectAsyncValidator<T = unknown> {
|
|
61
70
|
error: string;
|
|
62
71
|
message: string;
|
|
@@ -132,6 +141,7 @@ declare class ZSelectComponent<T = unknown> implements OnInit, ControlValueAcces
|
|
|
132
141
|
readonly zVirtualScroll: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
|
|
133
142
|
readonly zShowAction: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
|
|
134
143
|
readonly zOptions: _angular_core.InputSignal<ZSelectOption<T>[]>;
|
|
144
|
+
readonly zConfig: _angular_core.InputSignal<Partial<ZSelectConfig<T>>>;
|
|
135
145
|
readonly zTranslateLabels: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
|
|
136
146
|
readonly zKey: _angular_core.InputSignal<string>;
|
|
137
147
|
readonly zSearchServer: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
|
|
@@ -156,6 +166,12 @@ declare class ZSelectComponent<T = unknown> implements OnInit, ControlValueAcces
|
|
|
156
166
|
private readonly _allKnownOptions;
|
|
157
167
|
private readonly _asyncErrors;
|
|
158
168
|
private readonly _customError;
|
|
169
|
+
private readonly _asyncOptions;
|
|
170
|
+
private readonly _asyncKeyword;
|
|
171
|
+
private readonly _asyncPage;
|
|
172
|
+
private readonly _asyncHasMore;
|
|
173
|
+
private readonly _asyncLoading;
|
|
174
|
+
private readonly _asyncLoadingMore;
|
|
159
175
|
protected readonly uiState: _angular_core.WritableSignal<{
|
|
160
176
|
isOpen: boolean;
|
|
161
177
|
hasScrollShadow: boolean;
|
|
@@ -169,6 +185,13 @@ declare class ZSelectComponent<T = unknown> implements OnInit, ControlValueAcces
|
|
|
169
185
|
protected readonly searchText: _angular_core.WritableSignal<string>;
|
|
170
186
|
protected readonly dropdownWidth: _angular_core.WritableSignal<number>;
|
|
171
187
|
protected readonly currentValue: _angular_core.Signal<T | T[] | null>;
|
|
188
|
+
protected readonly config: _angular_core.Signal<ZSelectConfig<T>>;
|
|
189
|
+
protected readonly hasAsyncOptions: _angular_core.Signal<boolean>;
|
|
190
|
+
protected readonly sourceOptions: _angular_core.Signal<ZSelectOption<T>[]>;
|
|
191
|
+
protected readonly isLoading: _angular_core.Signal<boolean>;
|
|
192
|
+
protected readonly isLoadingMore: _angular_core.Signal<boolean>;
|
|
193
|
+
protected readonly canLoadMore: _angular_core.Signal<boolean>;
|
|
194
|
+
protected readonly effectiveDebounceTime: _angular_core.Signal<number>;
|
|
172
195
|
protected readonly virtualizer: _shival99_angular_virtual.AngularVirtualizer<HTMLDivElement, Element>;
|
|
173
196
|
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
174
197
|
protected readonly isReadonly: _angular_core.Signal<boolean>;
|
|
@@ -185,6 +208,7 @@ declare class ZSelectComponent<T = unknown> implements OnInit, ControlValueAcces
|
|
|
185
208
|
protected readonly isTagsMode: _angular_core.Signal<boolean>;
|
|
186
209
|
protected readonly effectiveSelectedTemplate: _angular_core.Signal<TemplateRef<any> | null>;
|
|
187
210
|
protected readonly effectiveOptionTemplate: _angular_core.Signal<TemplateRef<any> | null>;
|
|
211
|
+
protected readonly knownOptions: _angular_core.Signal<ZSelectOption<T>[]>;
|
|
188
212
|
protected readonly shouldUseVirtualScroll: _angular_core.Signal<boolean>;
|
|
189
213
|
protected readonly selectedOption: _angular_core.Signal<ZSelectOption<T> | null>;
|
|
190
214
|
protected readonly selectedOptions: _angular_core.Signal<ZSelectOption<T>[]>;
|
|
@@ -210,6 +234,8 @@ declare class ZSelectComponent<T = unknown> implements OnInit, ControlValueAcces
|
|
|
210
234
|
private readonly _asyncValidationSubject;
|
|
211
235
|
private _loadMoreObserver;
|
|
212
236
|
private _virtualScrollListener;
|
|
237
|
+
private _asyncLoadSubscription;
|
|
238
|
+
private _asyncRequestId;
|
|
213
239
|
private _asyncValidationAbortController;
|
|
214
240
|
private _onChange;
|
|
215
241
|
private _onTouched;
|
|
@@ -243,16 +269,23 @@ declare class ZSelectComponent<T = unknown> implements OnInit, ControlValueAcces
|
|
|
243
269
|
protected toggleSelectAllAction(): void;
|
|
244
270
|
protected trackByValue: (_index: number, option: ZSelectOption<T>) => unknown;
|
|
245
271
|
private _emitControl;
|
|
272
|
+
private _loadAsyncOptionsOnFocus;
|
|
273
|
+
private _loadAsyncOptions;
|
|
274
|
+
private _handleAsyncOptionsError;
|
|
275
|
+
private _getAsyncOptionsScrollTop;
|
|
276
|
+
private _restoreAsyncOptionsScrollTop;
|
|
277
|
+
private _resetAsyncOptions;
|
|
246
278
|
private _setupLoadMoreObserver;
|
|
247
279
|
private _cleanupLoadMoreObserver;
|
|
248
280
|
private _setupVirtualScrollLoadMore;
|
|
249
281
|
private _cleanupVirtualScrollListener;
|
|
282
|
+
private _handleLoadMore;
|
|
250
283
|
private _getValidationErrors;
|
|
251
284
|
private _runAsyncValidation;
|
|
252
285
|
private _cancelAsyncValidation;
|
|
253
286
|
private _triggerAsyncValidation;
|
|
254
287
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZSelectComponent<any>, never>;
|
|
255
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZSelectComponent<any>, "z-select", ["zSelect"], { "class": { "alias": "class"; "required": false; "isSignal": true; }; "zMode": { "alias": "zMode"; "required": false; "isSignal": true; }; "zSize": { "alias": "zSize"; "required": false; "isSignal": true; }; "zLabel": { "alias": "zLabel"; "required": false; "isSignal": true; }; "zLabelClass": { "alias": "zLabelClass"; "required": false; "isSignal": true; }; "zPlaceholder": { "alias": "zPlaceholder"; "required": false; "isSignal": true; }; "zRequired": { "alias": "zRequired"; "required": false; "isSignal": true; }; "zDisabled": { "alias": "zDisabled"; "required": false; "isSignal": true; }; "zReadonly": { "alias": "zReadonly"; "required": false; "isSignal": true; }; "zLoading": { "alias": "zLoading"; "required": false; "isSignal": true; }; "zPrefix": { "alias": "zPrefix"; "required": false; "isSignal": true; }; "zAllowClear": { "alias": "zAllowClear"; "required": false; "isSignal": true; }; "zWrap": { "alias": "zWrap"; "required": false; "isSignal": true; }; "zShowSearch": { "alias": "zShowSearch"; "required": false; "isSignal": true; }; "zPlaceholderSearch": { "alias": "zPlaceholderSearch"; "required": false; "isSignal": true; }; "zDebounce": { "alias": "zDebounce"; "required": false; "isSignal": true; }; "zNotFoundText": { "alias": "zNotFoundText"; "required": false; "isSignal": true; }; "zEmptyText": { "alias": "zEmptyText"; "required": false; "isSignal": true; }; "zEmptyIcon": { "alias": "zEmptyIcon"; "required": false; "isSignal": true; }; "zMaxTagCount": { "alias": "zMaxTagCount"; "required": false; "isSignal": true; }; "zDropdownMaxHeight": { "alias": "zDropdownMaxHeight"; "required": false; "isSignal": true; }; "zOptionHeight": { "alias": "zOptionHeight"; "required": false; "isSignal": true; }; "zVirtualScroll": { "alias": "zVirtualScroll"; "required": false; "isSignal": true; }; "zShowAction": { "alias": "zShowAction"; "required": false; "isSignal": true; }; "zOptions": { "alias": "zOptions"; "required": false; "isSignal": true; }; "zTranslateLabels": { "alias": "zTranslateLabels"; "required": false; "isSignal": true; }; "zKey": { "alias": "zKey"; "required": false; "isSignal": true; }; "zSearchServer": { "alias": "zSearchServer"; "required": false; "isSignal": true; }; "zLoadingMore": { "alias": "zLoadingMore"; "required": false; "isSignal": true; }; "zEnableLoadMore": { "alias": "zEnableLoadMore"; "required": false; "isSignal": true; }; "zScrollDistance": { "alias": "zScrollDistance"; "required": false; "isSignal": true; }; "zMaxVisible": { "alias": "zMaxVisible"; "required": false; "isSignal": true; }; "zScrollClose": { "alias": "zScrollClose"; "required": false; "isSignal": true; }; "zPosition": { "alias": "zPosition"; "required": false; "isSignal": true; }; "zSelectedTemplate": { "alias": "zSelectedTemplate"; "required": false; "isSignal": true; }; "zOptionTemplate": { "alias": "zOptionTemplate"; "required": false; "isSignal": true; }; "zActionTemplate": { "alias": "zActionTemplate"; "required": false; "isSignal": true; }; "zAsyncValidators": { "alias": "zAsyncValidators"; "required": false; "isSignal": true; }; "zAsyncDebounce": { "alias": "zAsyncDebounce"; "required": false; "isSignal": true; }; "zAsyncValidateOn": { "alias": "zAsyncValidateOn"; "required": false; "isSignal": true; }; "zValidators": { "alias": "zValidators"; "required": false; "isSignal": true; }; }, { "zOnSearch": "zOnSearch"; "zOnLoadMore": "zOnLoadMore"; "zOnBlur": "zOnBlur"; "zOnFocus": "zOnFocus"; "zControl": "zControl"; "zEvent": "zEvent"; }, ["customSelectedDirective", "customOptionDirective"], never, true, never>;
|
|
288
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZSelectComponent<any>, "z-select", ["zSelect"], { "class": { "alias": "class"; "required": false; "isSignal": true; }; "zMode": { "alias": "zMode"; "required": false; "isSignal": true; }; "zSize": { "alias": "zSize"; "required": false; "isSignal": true; }; "zLabel": { "alias": "zLabel"; "required": false; "isSignal": true; }; "zLabelClass": { "alias": "zLabelClass"; "required": false; "isSignal": true; }; "zPlaceholder": { "alias": "zPlaceholder"; "required": false; "isSignal": true; }; "zRequired": { "alias": "zRequired"; "required": false; "isSignal": true; }; "zDisabled": { "alias": "zDisabled"; "required": false; "isSignal": true; }; "zReadonly": { "alias": "zReadonly"; "required": false; "isSignal": true; }; "zLoading": { "alias": "zLoading"; "required": false; "isSignal": true; }; "zPrefix": { "alias": "zPrefix"; "required": false; "isSignal": true; }; "zAllowClear": { "alias": "zAllowClear"; "required": false; "isSignal": true; }; "zWrap": { "alias": "zWrap"; "required": false; "isSignal": true; }; "zShowSearch": { "alias": "zShowSearch"; "required": false; "isSignal": true; }; "zPlaceholderSearch": { "alias": "zPlaceholderSearch"; "required": false; "isSignal": true; }; "zDebounce": { "alias": "zDebounce"; "required": false; "isSignal": true; }; "zNotFoundText": { "alias": "zNotFoundText"; "required": false; "isSignal": true; }; "zEmptyText": { "alias": "zEmptyText"; "required": false; "isSignal": true; }; "zEmptyIcon": { "alias": "zEmptyIcon"; "required": false; "isSignal": true; }; "zMaxTagCount": { "alias": "zMaxTagCount"; "required": false; "isSignal": true; }; "zDropdownMaxHeight": { "alias": "zDropdownMaxHeight"; "required": false; "isSignal": true; }; "zOptionHeight": { "alias": "zOptionHeight"; "required": false; "isSignal": true; }; "zVirtualScroll": { "alias": "zVirtualScroll"; "required": false; "isSignal": true; }; "zShowAction": { "alias": "zShowAction"; "required": false; "isSignal": true; }; "zOptions": { "alias": "zOptions"; "required": false; "isSignal": true; }; "zConfig": { "alias": "zConfig"; "required": false; "isSignal": true; }; "zTranslateLabels": { "alias": "zTranslateLabels"; "required": false; "isSignal": true; }; "zKey": { "alias": "zKey"; "required": false; "isSignal": true; }; "zSearchServer": { "alias": "zSearchServer"; "required": false; "isSignal": true; }; "zLoadingMore": { "alias": "zLoadingMore"; "required": false; "isSignal": true; }; "zEnableLoadMore": { "alias": "zEnableLoadMore"; "required": false; "isSignal": true; }; "zScrollDistance": { "alias": "zScrollDistance"; "required": false; "isSignal": true; }; "zMaxVisible": { "alias": "zMaxVisible"; "required": false; "isSignal": true; }; "zScrollClose": { "alias": "zScrollClose"; "required": false; "isSignal": true; }; "zPosition": { "alias": "zPosition"; "required": false; "isSignal": true; }; "zSelectedTemplate": { "alias": "zSelectedTemplate"; "required": false; "isSignal": true; }; "zOptionTemplate": { "alias": "zOptionTemplate"; "required": false; "isSignal": true; }; "zActionTemplate": { "alias": "zActionTemplate"; "required": false; "isSignal": true; }; "zAsyncValidators": { "alias": "zAsyncValidators"; "required": false; "isSignal": true; }; "zAsyncDebounce": { "alias": "zAsyncDebounce"; "required": false; "isSignal": true; }; "zAsyncValidateOn": { "alias": "zAsyncValidateOn"; "required": false; "isSignal": true; }; "zValidators": { "alias": "zValidators"; "required": false; "isSignal": true; }; }, { "zOnSearch": "zOnSearch"; "zOnLoadMore": "zOnLoadMore"; "zOnBlur": "zOnBlur"; "zOnFocus": "zOnFocus"; "zControl": "zControl"; "zEvent": "zEvent"; }, ["customSelectedDirective", "customOptionDirective"], never, true, never>;
|
|
256
289
|
}
|
|
257
290
|
|
|
258
291
|
declare class ZIsSelectedPipe implements PipeTransform {
|
|
@@ -296,5 +329,5 @@ declare function filterOptions<T>(options: {
|
|
|
296
329
|
disabled?: boolean;
|
|
297
330
|
}[];
|
|
298
331
|
|
|
299
|
-
export { TAG_COLORS, ZIsSelectedPipe, ZOptionClassesPipe, ZSelectComponent, ZSelectOptionDirective, ZSelectSelectedDirective, ZTagClassesPipe, filterOptions, getTagColor, zSelectOptionVariants, zSelectTagVariants, zSelectVariants };
|
|
300
|
-
export type { ZSelectAsyncValidateOn, ZSelectAsyncValidator, ZSelectControl, ZSelectLabelTemplate, ZSelectLoadMoreEvent, ZSelectMode, ZSelectOption, ZSelectOptionGroup, ZSelectOptionTemplate, ZSelectSize, ZSelectTagColor, ZSelectValidator };
|
|
332
|
+
export { TAG_COLORS, ZIsSelectedPipe, ZOptionClassesPipe, ZSelectComponent, ZSelectOptionDirective, ZSelectSelectedDirective, ZTagClassesPipe, Z_SELECT_DEFAULT_CONFIG, filterOptions, getTagColor, zSelectOptionVariants, zSelectTagVariants, zSelectVariants };
|
|
333
|
+
export type { ZSelectAsyncValidateOn, ZSelectAsyncValidator, ZSelectConfig, ZSelectControl, ZSelectLabelTemplate, ZSelectLoadMoreEvent, ZSelectMode, ZSelectOption, ZSelectOptionGroup, ZSelectOptionTemplate, ZSelectSize, ZSelectTagColor, ZSelectValidator };
|
|
@@ -215,8 +215,15 @@ interface ZTableBodyColumnConfig<T> {
|
|
|
215
215
|
contentClass?: string | ((info: CellContext<T, unknown>) => string);
|
|
216
216
|
contentStyle?: Record<string, string> | ((info: CellContext<T, unknown>) => Record<string, string>);
|
|
217
217
|
tooltip?: string | ZTooltipConfig | ((info: CellContext<T, unknown>) => string | ZTooltipConfig);
|
|
218
|
-
/**
|
|
219
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Action buttons rendered inside this cell.
|
|
220
|
+
*
|
|
221
|
+
* Preferred: pass an action array or `(row) => action[]` directly.
|
|
222
|
+
* Deprecated compatibility: `{ actions, maxVisible }` is still supported.
|
|
223
|
+
*/
|
|
224
|
+
actions?: ZTableActionBodyConfig<T>;
|
|
225
|
+
/** Maximum visible action buttons before rendering the overflow menu. */
|
|
226
|
+
actionMaxVisible?: number;
|
|
220
227
|
/** When true, clicking the cell emits a cellClick event */
|
|
221
228
|
enabledClick?: boolean;
|
|
222
229
|
/** Enable inline editing — true uses defaults, or pass full config */
|
|
@@ -363,17 +370,25 @@ interface ZTableActionItem<T = unknown> {
|
|
|
363
370
|
hidden?: boolean | ((row: T) => boolean);
|
|
364
371
|
divide?: 'before' | 'after';
|
|
365
372
|
}
|
|
373
|
+
type ZTableActionList<T = unknown> = ZTableActionItem<T>[] | ((row: T) => ZTableActionItem<T>[]);
|
|
366
374
|
interface ZTableActionClickEvent<T = unknown> {
|
|
367
375
|
key: string;
|
|
368
376
|
row: T;
|
|
369
377
|
rowId: string;
|
|
370
378
|
action: ZTableActionItem<T>;
|
|
371
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* @deprecated Use `ZTableBodyColumnConfig.actions` directly with an action array
|
|
382
|
+
* or `(row) => action[]`, and set `actionMaxVisible` on the body config when needed.
|
|
383
|
+
*/
|
|
372
384
|
interface ZTableActionColumnConfig<T = unknown> {
|
|
373
|
-
/**
|
|
374
|
-
|
|
385
|
+
/**
|
|
386
|
+
* @deprecated Put the action array/function directly in `body.actions` instead.
|
|
387
|
+
*/
|
|
388
|
+
actions: ZTableActionList<T>;
|
|
375
389
|
maxVisible?: number;
|
|
376
390
|
}
|
|
391
|
+
type ZTableActionBodyConfig<T = unknown> = ZTableActionColumnConfig<T> | (ZTableActionList<T> & Partial<ZTableActionColumnConfig<T>>);
|
|
377
392
|
/** All possible change event types — used as discriminant in ZTableChangeEvent */
|
|
378
393
|
type ZTableChangeType = 'page' | 'sort' | 'filter' | 'search' | 'select' | 'expand' | 'rowSelect' | 'rowSelectAll' | 'rowExpand' | 'rowDrag' | 'cellClick' | 'cellEdit' | 'action';
|
|
379
394
|
interface ZTableChangeEventBase {
|
|
@@ -894,6 +909,7 @@ declare class ZTableComponent<T> implements AfterViewInit {
|
|
|
894
909
|
private _isColumnSortModeLocal;
|
|
895
910
|
private _filterServerModeColumnFilters;
|
|
896
911
|
private _filterServerModeSorting;
|
|
912
|
+
private _getActionColumnConfig;
|
|
897
913
|
/**
|
|
898
914
|
* Recursively finds a column config by ID with caching.
|
|
899
915
|
* Cache is invalidated when the column array reference changes.
|
|
@@ -1103,4 +1119,4 @@ declare const findColumnConfig: <T>(columnId: string, columns: ZTableColumnConfi
|
|
|
1103
1119
|
declare function columnConfigToColumnDef<T>(config: ZTableColumnConfig<T>): ColumnDef<T>;
|
|
1104
1120
|
|
|
1105
1121
|
export { ZTableActionsComponent, ZTableComponent, ZTableEditCellComponent, ZTableFilterComponent, ZTableIconTextComponent, columnConfigToColumnDef, findColumnConfig, getBodyConfig, getFooterConfig, getHeaderConfig, isBodyConfig, isFooterConfig, isHeaderConfig };
|
|
1106
|
-
export type { ZTableActionClickEvent, ZTableActionColumnConfig, ZTableActionItem, ZTableCellEditChange, ZTableCellEditEvent, ZTableChangeEvent, ZTableColumn, ZTableColumnConfig, ZTableConfig, ZTableControl, ZTableEditCellChangeEvent, ZTableEditConfig, ZTableEditSize, ZTableEditType, ZTableFilterChangeEvent, ZTableFilterConfig, ZTableFilterType, ZTablePageChangeEvent, ZTablePaginationConfig, ZTableRowExpandEvent, ZTableRowSelectEvent, ZTableSavedConfig, ZTableSearchChangeEvent, ZTableSearchConfig, ZTableSortChangeEvent, ZTableSortConfig };
|
|
1122
|
+
export type { ZTableActionBodyConfig, ZTableActionClickEvent, ZTableActionColumnConfig, ZTableActionItem, ZTableActionList, ZTableCellEditChange, ZTableCellEditEvent, ZTableChangeEvent, ZTableColumn, ZTableColumnConfig, ZTableConfig, ZTableControl, ZTableEditCellChangeEvent, ZTableEditConfig, ZTableEditSize, ZTableEditType, ZTableFilterChangeEvent, ZTableFilterConfig, ZTableFilterType, ZTablePageChangeEvent, ZTablePaginationConfig, ZTableRowExpandEvent, ZTableRowSelectEvent, ZTableSavedConfig, ZTableSearchChangeEvent, ZTableSearchConfig, ZTableSortChangeEvent, ZTableSortConfig };
|
|
@@ -75,6 +75,16 @@ declare class ZTagsComponent implements AfterViewInit {
|
|
|
75
75
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZTagsComponent, "z-tags", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "zTags": { "alias": "zTags"; "required": false; "isSignal": true; }; "zSize": { "alias": "zSize"; "required": false; "isSignal": true; }; "zColor": { "alias": "zColor"; "required": false; "isSignal": true; }; "zClosable": { "alias": "zClosable"; "required": false; "isSignal": true; }; "zDisabled": { "alias": "zDisabled"; "required": false; "isSignal": true; }; "zAddable": { "alias": "zAddable"; "required": false; "isSignal": true; }; "zAddText": { "alias": "zAddText"; "required": false; "isSignal": true; }; "zAddPlaceholder": { "alias": "zAddPlaceholder"; "required": false; "isSignal": true; }; "zRandomColor": { "alias": "zRandomColor"; "required": false; "isSignal": true; }; "zTagClass": { "alias": "zTagClass"; "required": false; "isSignal": true; }; "zLabelClass": { "alias": "zLabelClass"; "required": false; "isSignal": true; }; "zMaxWidth": { "alias": "zMaxWidth"; "required": false; "isSignal": true; }; }, { "zTagClose": "zTagClose"; "zTagAdd": "zTagAdd"; }, never, never, true, never>;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
declare class ZTagsDirective {
|
|
79
|
+
readonly zSize: _angular_core.InputSignal<ZTagSize>;
|
|
80
|
+
readonly zColor: _angular_core.InputSignal<ZTagColor>;
|
|
81
|
+
readonly zDisabled: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
|
|
82
|
+
readonly zClass: _angular_core.InputSignal<ClassValue>;
|
|
83
|
+
protected readonly hostClasses: _angular_core.Signal<string>;
|
|
84
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZTagsDirective, never>;
|
|
85
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ZTagsDirective, "[z-tags]", ["zTags"], { "zSize": { "alias": "zSize"; "required": false; "isSignal": true; }; "zColor": { "alias": "zColor"; "required": false; "isSignal": true; }; "zDisabled": { "alias": "zDisabled"; "required": false; "isSignal": true; }; "zClass": { "alias": "zClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
86
|
+
}
|
|
87
|
+
|
|
78
88
|
declare const zTagsContainerVariants: (props?: ({
|
|
79
89
|
zSize?: "sm" | "default" | "lg" | null | undefined;
|
|
80
90
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -111,5 +121,5 @@ declare class ZTagStylePipe implements PipeTransform {
|
|
|
111
121
|
static ɵpipe: _angular_core.ɵɵPipeDeclaration<ZTagStylePipe, "zTagStyle", true>;
|
|
112
122
|
}
|
|
113
123
|
|
|
114
|
-
export { ZTagClassesPipe, ZTagClosablePipe, ZTagStylePipe, ZTagsComponent, zTagCloseButtonVariants, zTagVariants, zTagsContainerVariants };
|
|
124
|
+
export { ZTagClassesPipe, ZTagClosablePipe, ZTagStylePipe, ZTagsComponent, ZTagsDirective, zTagCloseButtonVariants, zTagVariants, zTagsContainerVariants };
|
|
115
125
|
export type { ZTagCloseButtonVariants, ZTagColor, ZTagConfig, ZTagItem, ZTagRandomColorCache, ZTagSize, ZTagVariants, ZTagsContainerVariants };
|
|
@@ -83,6 +83,51 @@ declare const zMiniSearch$: <T>(data: T[], query: string, fields: (keyof T | str
|
|
|
83
83
|
}) => Observable<T[]>;
|
|
84
84
|
declare const zDetectBrowser: () => ZBrowserInfo;
|
|
85
85
|
|
|
86
|
+
/** Thông tin truy vấn dùng cho autocomplete/select tự tải dữ liệu. */
|
|
87
|
+
interface ZAsyncOptionsQuery {
|
|
88
|
+
/** Từ khóa hiện tại người dùng đang nhập. */
|
|
89
|
+
keyword: string;
|
|
90
|
+
/** Trang cần tải, bắt đầu từ 1. */
|
|
91
|
+
page: number;
|
|
92
|
+
/** Số lượng option mong muốn trên mỗi trang. */
|
|
93
|
+
pageSize: number;
|
|
94
|
+
}
|
|
95
|
+
/** Kết quả trả về từ hàm tải option bất đồng bộ. */
|
|
96
|
+
interface ZAsyncOptionsResult<TOption> {
|
|
97
|
+
/** Danh sách option của trang hiện tại. */
|
|
98
|
+
items: TOption[];
|
|
99
|
+
/** Tổng số option trên server, dùng để component tự tính còn trang tiếp theo hay không. */
|
|
100
|
+
total?: number;
|
|
101
|
+
/** Đặt trực tiếp còn dữ liệu hay không khi API không trả total. */
|
|
102
|
+
hasMore?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/** Kiểu dữ liệu hàm load có thể trả về: sync, Promise hoặc Observable. */
|
|
105
|
+
type ZAsyncOptionsLoadResult<TOption> = ZAsyncOptionsResult<TOption> | Promise<ZAsyncOptionsResult<TOption>> | Observable<ZAsyncOptionsResult<TOption>>;
|
|
106
|
+
/** Hàm tải option theo keyword/page/pageSize. */
|
|
107
|
+
type ZAsyncOptionsLoadFn<TOption> = (query: ZAsyncOptionsQuery) => ZAsyncOptionsLoadResult<TOption>;
|
|
108
|
+
/** Config giúp component tự xử lý search, phân trang, loading và chống trùng option. */
|
|
109
|
+
interface ZAsyncOptionsConfig<TOption> {
|
|
110
|
+
/** Hàm gọi API hoặc nguồn dữ liệu bất đồng bộ. */
|
|
111
|
+
load: ZAsyncOptionsLoadFn<TOption>;
|
|
112
|
+
/** Số item mỗi lần tải, mặc định 20. */
|
|
113
|
+
pageSize?: number;
|
|
114
|
+
/** Tự tải trang đầu khi dropdown mở/focus, kể cả keyword rỗng. */
|
|
115
|
+
loadOnFocus?: boolean;
|
|
116
|
+
/** Khóa chống trùng khi append trang mới, ví dụ: option => option.value.code. */
|
|
117
|
+
dedupeBy?: (option: TOption) => unknown;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Số option mặc định mỗi lần component tự gọi load. */
|
|
121
|
+
declare const Z_ASYNC_OPTIONS_DEFAULT_PAGE_SIZE = 20;
|
|
122
|
+
/** Chuẩn hóa kết quả sync/Promise/Observable về Observable để component xử lý thống nhất. */
|
|
123
|
+
declare function zToAsyncOptionsObservable<TOption>(result: ZAsyncOptionsLoadResult<TOption>): Observable<ZAsyncOptionsResult<TOption>>;
|
|
124
|
+
/** Gộp option mới vào danh sách cũ và loại bỏ phần tử trùng theo dedupeBy/default key. */
|
|
125
|
+
declare function zMergeAsyncOptions<TOption>(current: TOption[], next: TOption[], dedupeBy?: ZAsyncOptionsConfig<TOption>['dedupeBy']): TOption[];
|
|
126
|
+
/** Tính còn dữ liệu để load-more dựa trên hasMore, total hoặc độ dài page vừa trả về. */
|
|
127
|
+
declare function zResolveAsyncOptionsHasMore<TOption>(result: ZAsyncOptionsResult<TOption>, pageSize: number, loadedCount: number): boolean;
|
|
128
|
+
/** Lấy khóa ổn định cho option, hỗ trợ value là object và vẫn cho phép truyền dedupeBy riêng. */
|
|
129
|
+
declare function zGetAsyncOptionKey<TOption>(option: TOption, dedupeBy?: ZAsyncOptionsConfig<TOption>['dedupeBy']): unknown;
|
|
130
|
+
|
|
86
131
|
interface ZEchartsThemeOptions {
|
|
87
132
|
/** Theme name (default: 'zTheme') */
|
|
88
133
|
themeName?: string;
|
|
@@ -152,5 +197,5 @@ interface ZFormDebugOptions {
|
|
|
152
197
|
logLevel?: 'error' | 'warn' | 'log';
|
|
153
198
|
}
|
|
154
199
|
|
|
155
|
-
export { VIETNAMESE_MAP, Z_DIVIDE_SCALE, Z_EXCEL_NUMBER_FORMAT_MAP, Z_LOCALE_MAP, zCapitalCase, zCleanObject, zConvertColorToArgb, zCreateEvent, zDebugFormInvalid, zDecodeUnicode, zDetectBrowser, zFormatNum, zFormatNumExcel, zMergeClasses, zMiniSearch, zMiniSearch$, zNoop, zNormalize, zRandomColor, zRegisterEchartsTheme, zRemoveVietnamese, zTransform, zTreeBuild, zTreeFlatten, zUuid, zValidForm };
|
|
156
|
-
export type { ZBlurEventData, ZBrowserInfo, ZBrowserName, ZCapitalizeType, ZChangeEventData, ZClickEventData, ZCopyEventData, ZCutEventData, ZDblclickEventData, ZDeviceType, ZDragenterEventData, ZDragleaveEventData, ZDragoverEventData, ZDropEventData, ZEchartsThemeOptions, ZEmptyCheck, ZEvent, ZEventType, ZFocusEventData, ZFormDebugOptions, ZFormSubmitResult, ZFormatNumExcelOptions, ZFormatNumOptions, ZInputEventData, ZKeydownEventData, ZKeypressEventData, ZKeyupEventData, ZMousedownEventData, ZMouseenterEventData, ZMouseleaveEventData, ZMouseoutEventData, ZMouseoverEventData, ZMouseupEventData, ZNavigatorUABrandVersion, ZNavigatorUAData, ZNumberDivide, ZPasteEventData, ZTouchendEventData, ZTouchmoveEventData, ZTouchstartEventData };
|
|
200
|
+
export { VIETNAMESE_MAP, Z_ASYNC_OPTIONS_DEFAULT_PAGE_SIZE, Z_DIVIDE_SCALE, Z_EXCEL_NUMBER_FORMAT_MAP, Z_LOCALE_MAP, zCapitalCase, zCleanObject, zConvertColorToArgb, zCreateEvent, zDebugFormInvalid, zDecodeUnicode, zDetectBrowser, zFormatNum, zFormatNumExcel, zGetAsyncOptionKey, zMergeAsyncOptions, zMergeClasses, zMiniSearch, zMiniSearch$, zNoop, zNormalize, zRandomColor, zRegisterEchartsTheme, zRemoveVietnamese, zResolveAsyncOptionsHasMore, zToAsyncOptionsObservable, zTransform, zTreeBuild, zTreeFlatten, zUuid, zValidForm };
|
|
201
|
+
export type { ZAsyncOptionsConfig, ZAsyncOptionsLoadFn, ZAsyncOptionsLoadResult, ZAsyncOptionsQuery, ZAsyncOptionsResult, ZBlurEventData, ZBrowserInfo, ZBrowserName, ZCapitalizeType, ZChangeEventData, ZClickEventData, ZCopyEventData, ZCutEventData, ZDblclickEventData, ZDeviceType, ZDragenterEventData, ZDragleaveEventData, ZDragoverEventData, ZDropEventData, ZEchartsThemeOptions, ZEmptyCheck, ZEvent, ZEventType, ZFocusEventData, ZFormDebugOptions, ZFormSubmitResult, ZFormatNumExcelOptions, ZFormatNumOptions, ZInputEventData, ZKeydownEventData, ZKeypressEventData, ZKeyupEventData, ZMousedownEventData, ZMouseenterEventData, ZMouseleaveEventData, ZMouseoutEventData, ZMouseoverEventData, ZMouseupEventData, ZNavigatorUABrandVersion, ZNavigatorUAData, ZNumberDivide, ZPasteEventData, ZTouchendEventData, ZTouchmoveEventData, ZTouchstartEventData };
|