@shival99/z-ui 2.6.7 → 2.6.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.
Files changed (69) hide show
  1. package/fesm2022/shival99-z-ui-components-z-button-group.mjs +1 -1
  2. package/fesm2022/shival99-z-ui-components-z-button-group.mjs.map +1 -1
  3. package/fesm2022/shival99-z-ui-components-z-calendar.mjs +13 -13
  4. package/fesm2022/shival99-z-ui-components-z-calendar.mjs.map +1 -1
  5. package/fesm2022/shival99-z-ui-components-z-editor.mjs +1 -1
  6. package/fesm2022/shival99-z-ui-components-z-editor.mjs.map +1 -1
  7. package/fesm2022/shival99-z-ui-components-z-modal.mjs +6 -7
  8. package/fesm2022/shival99-z-ui-components-z-modal.mjs.map +1 -1
  9. package/fesm2022/shival99-z-ui-components-z-popover.mjs +2 -2
  10. package/fesm2022/shival99-z-ui-components-z-popover.mjs.map +1 -1
  11. package/fesm2022/shival99-z-ui-components-z-toast.mjs +4 -4
  12. package/fesm2022/shival99-z-ui-components-z-toast.mjs.map +1 -1
  13. package/fesm2022/shival99-z-ui-components-z-tooltip.mjs +1 -1
  14. package/fesm2022/shival99-z-ui-components-z-tooltip.mjs.map +1 -1
  15. package/package.json +1 -1
  16. package/types/shival99-z-ui-components-z-button-group.d.ts +1 -1
  17. package/types/shival99-z-ui-components-z-modal.d.ts +1 -1
  18. package/.npmignore +0 -58
  19. package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs +0 -1212
  20. package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs.map +0 -1
  21. package/fesm2022/shival99-z-ui-components-z-drawer.mjs +0 -994
  22. package/fesm2022/shival99-z-ui-components-z-drawer.mjs.map +0 -1
  23. package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs +0 -99
  24. package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs.map +0 -1
  25. package/fesm2022/shival99-z-ui-components-z-filter.mjs +0 -962
  26. package/fesm2022/shival99-z-ui-components-z-filter.mjs.map +0 -1
  27. package/fesm2022/shival99-z-ui-components-z-number-ticker.mjs +0 -352
  28. package/fesm2022/shival99-z-ui-components-z-number-ticker.mjs.map +0 -1
  29. package/fesm2022/shival99-z-ui-components-z-pagination.mjs +0 -179
  30. package/fesm2022/shival99-z-ui-components-z-pagination.mjs.map +0 -1
  31. package/fesm2022/shival99-z-ui-components-z-qrcode.mjs +0 -429
  32. package/fesm2022/shival99-z-ui-components-z-qrcode.mjs.map +0 -1
  33. package/fesm2022/shival99-z-ui-components-z-radio.mjs +0 -183
  34. package/fesm2022/shival99-z-ui-components-z-radio.mjs.map +0 -1
  35. package/fesm2022/shival99-z-ui-components-z-scrollarea.mjs +0 -143
  36. package/fesm2022/shival99-z-ui-components-z-scrollarea.mjs.map +0 -1
  37. package/fesm2022/shival99-z-ui-components-z-show-more.mjs +0 -138
  38. package/fesm2022/shival99-z-ui-components-z-show-more.mjs.map +0 -1
  39. package/fesm2022/shival99-z-ui-components-z-skeleton-auto.mjs +0 -80
  40. package/fesm2022/shival99-z-ui-components-z-skeleton-auto.mjs.map +0 -1
  41. package/fesm2022/shival99-z-ui-components-z-steps.mjs +0 -420
  42. package/fesm2022/shival99-z-ui-components-z-steps.mjs.map +0 -1
  43. package/fesm2022/shival99-z-ui-components-z-table.mjs +0 -11490
  44. package/fesm2022/shival99-z-ui-components-z-table.mjs.map +0 -1
  45. package/fesm2022/shival99-z-ui-components-z-tabs.mjs +0 -1102
  46. package/fesm2022/shival99-z-ui-components-z-tabs.mjs.map +0 -1
  47. package/fesm2022/shival99-z-ui-components-z-tags.mjs +0 -364
  48. package/fesm2022/shival99-z-ui-components-z-tags.mjs.map +0 -1
  49. package/fesm2022/shival99-z-ui-components-z-timeline.mjs +0 -254
  50. package/fesm2022/shival99-z-ui-components-z-timeline.mjs.map +0 -1
  51. package/fesm2022/shival99-z-ui-services-excel.mjs +0 -672
  52. package/fesm2022/shival99-z-ui-services-excel.mjs.map +0 -1
  53. package/types/shival99-z-ui-components-z-autocomplete.d.ts +0 -301
  54. package/types/shival99-z-ui-components-z-drawer.d.ts +0 -301
  55. package/types/shival99-z-ui-components-z-dropdown-menu.d.ts +0 -52
  56. package/types/shival99-z-ui-components-z-filter.d.ts +0 -285
  57. package/types/shival99-z-ui-components-z-number-ticker.d.ts +0 -110
  58. package/types/shival99-z-ui-components-z-pagination.d.ts +0 -55
  59. package/types/shival99-z-ui-components-z-qrcode.d.ts +0 -79
  60. package/types/shival99-z-ui-components-z-radio.d.ts +0 -69
  61. package/types/shival99-z-ui-components-z-scrollarea.d.ts +0 -46
  62. package/types/shival99-z-ui-components-z-show-more.d.ts +0 -36
  63. package/types/shival99-z-ui-components-z-skeleton-auto.d.ts +0 -35
  64. package/types/shival99-z-ui-components-z-steps.d.ts +0 -106
  65. package/types/shival99-z-ui-components-z-table.d.ts +0 -2414
  66. package/types/shival99-z-ui-components-z-tabs.d.ts +0 -196
  67. package/types/shival99-z-ui-components-z-tags.d.ts +0 -127
  68. package/types/shival99-z-ui-components-z-timeline.d.ts +0 -71
  69. package/types/shival99-z-ui-services-excel.d.ts +0 -36
@@ -1,1212 +0,0 @@
1
- import { NgClass, NgTemplateOutlet } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { inject, TemplateRef, Directive, Injector, DestroyRef, viewChild, viewChildren, contentChild, input, output, signal, effect, computed, untracked, forwardRef, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
- import { NgControl, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
6
- import { ZEmptyComponent } from '@shival99/z-ui/components/z-empty';
7
- import { ZHoverGlideDirective } from '@shival99/z-ui/components/z-hover-glide';
8
- import { ZIconComponent } from '@shival99/z-ui/components/z-icon';
9
- import { ZLoadingComponent } from '@shival99/z-ui/components/z-loading';
10
- import { ZPopoverDirective } from '@shival99/z-ui/components/z-popover';
11
- import { ZTooltipDirective } from '@shival99/z-ui/components/z-tooltip';
12
- import { ZHighlightPipe, ZSafeHtmlPipe } from '@shival99/z-ui/pipes';
13
- import { zTransform, zUuid, zCreateDestroySafeTimeout, zResolveAsyncSelectedOptions, zMergeAsyncOptions, zRemoveVietnamese, zMergeClasses, zCreateEvent, Z_ASYNC_OPTIONS_DEFAULT_PAGE_SIZE, zToAsyncOptionsObservable, zResolveAsyncOptionsHasMore } from '@shival99/z-ui/utils';
14
- import { injectVirtualizer } from '@tanstack/angular-virtual';
15
- import { Subject, debounceTime, distinctUntilChanged, finalize } from 'rxjs';
16
- import { cva } from 'class-variance-authority';
17
-
18
- class ZAutocompleteOptionDirective {
19
- templateRef = inject((TemplateRef));
20
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: ZAutocompleteOptionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
21
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.6", type: ZAutocompleteOptionDirective, isStandalone: true, selector: "[z-autocomplete-option], [zAutocompleteOption]", ngImport: i0 });
22
- }
23
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: ZAutocompleteOptionDirective, decorators: [{
24
- type: Directive,
25
- args: [{
26
- selector: '[z-autocomplete-option], [zAutocompleteOption]',
27
- standalone: true,
28
- }]
29
- }] });
30
-
31
- const Z_AUTOCOMPLETE_DEFAULT_CONFIG = {
32
- minLength: 1,
33
- debounceTime: 0,
34
- maxDisplayed: 0,
35
- highlightMatch: true,
36
- emptyMessage: 'i18n_z_ui_autocomplete_no_results',
37
- noDataMessage: 'i18n_z_ui_autocomplete_no_data',
38
- closeOnSelect: true,
39
- optionHeight: 36,
40
- dropdownMaxHeight: 280,
41
- serverSearch: false,
42
- };
43
-
44
- const zAutocompleteInputVariants = cva([
45
- 'flex w-full items-center rounded-sm border border-input bg-white shadow-xs',
46
- 'transition-[border-color,box-shadow,background-color,color,opacity,border-radius] duration-200',
47
- 'dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
48
- 'outline-none',
49
- 'text-sm',
50
- ], {
51
- variants: {
52
- zSize: {
53
- sm: 'h-8 px-2 gap-2 text-sm',
54
- default: 'h-9 px-2.5 gap-2 text-sm',
55
- lg: 'h-10 px-3 gap-2.5 text-sm',
56
- },
57
- zStatus: {
58
- default: 'focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]',
59
- open: 'border-ring',
60
- error: 'border-destructive! ring-destructive/20 ring-[3px] focus-within:border-destructive! focus-within:ring-destructive/30',
61
- disabled: 'opacity-50 cursor-not-allowed bg-muted! text-muted-foreground',
62
- readonly: 'cursor-default bg-muted/50 text-muted-foreground',
63
- },
64
- },
65
- defaultVariants: {
66
- zSize: 'default',
67
- zStatus: 'default',
68
- },
69
- });
70
- const zAutocompleteOptionVariants = cva('px-2 py-1.5 cursor-pointer transition-colors text-sm rounded-sm outline-none', {
71
- variants: {
72
- customTemplate: {
73
- true: 'block h-auto whitespace-normal',
74
- false: 'flex items-center gap-2 whitespace-nowrap',
75
- },
76
- active: {
77
- true: 'bg-primary/15 text-primary',
78
- false: 'hover:bg-primary/10 hover:text-foreground',
79
- },
80
- disabled: {
81
- true: 'opacity-50 cursor-not-allowed pointer-events-none',
82
- false: '',
83
- },
84
- },
85
- defaultVariants: {
86
- customTemplate: false,
87
- active: false,
88
- disabled: false,
89
- },
90
- });
91
-
92
- class ZAutocompleteComponent {
93
- _injector = inject(Injector);
94
- _destroyRef = inject(DestroyRef);
95
- _query$ = new Subject();
96
- triggerRef = viewChild('triggerEl', /* @ts-ignore */
97
- ...(ngDevMode ? [{ debugName: "triggerRef" }] : /* istanbul ignore next */ []));
98
- inputRef = viewChild('inputEl', /* @ts-ignore */
99
- ...(ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []));
100
- dropdownTpl = viewChild('dropdownTpl', /* @ts-ignore */
101
- ...(ngDevMode ? [{ debugName: "dropdownTpl" }] : /* istanbul ignore next */ []));
102
- virtualScrollRef = viewChild('virtualScrollElement', /* @ts-ignore */
103
- ...(ngDevMode ? [{ debugName: "virtualScrollRef" }] : /* istanbul ignore next */ []));
104
- optionsContainerRef = viewChild('optionsContainer', /* @ts-ignore */
105
- ...(ngDevMode ? [{ debugName: "optionsContainerRef" }] : /* istanbul ignore next */ []));
106
- loadMoreSentinelRef = viewChild('loadMoreSentinel', /* @ts-ignore */
107
- ...(ngDevMode ? [{ debugName: "loadMoreSentinelRef" }] : /* istanbul ignore next */ []));
108
- virtualOptionElements = viewChildren('virtualOptionEl', /* @ts-ignore */
109
- ...(ngDevMode ? [{ debugName: "virtualOptionElements" }] : /* istanbul ignore next */ []));
110
- customOptionDirective = contentChild((ZAutocompleteOptionDirective), /* @ts-ignore */
111
- ...(ngDevMode ? [{ debugName: "customOptionDirective" }] : /* istanbul ignore next */ []));
112
- class = input('', /* @ts-ignore */
113
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
114
- zOptions = input([], /* @ts-ignore */
115
- ...(ngDevMode ? [{ debugName: "zOptions" }] : /* istanbul ignore next */ []));
116
- zConfig = input({}, /* @ts-ignore */
117
- ...(ngDevMode ? [{ debugName: "zConfig" }] : /* istanbul ignore next */ []));
118
- zSize = input('default', /* @ts-ignore */
119
- ...(ngDevMode ? [{ debugName: "zSize" }] : /* istanbul ignore next */ []));
120
- zType = input('default', /* @ts-ignore */
121
- ...(ngDevMode ? [{ debugName: "zType" }] : /* istanbul ignore next */ []));
122
- zLabel = input('', /* @ts-ignore */
123
- ...(ngDevMode ? [{ debugName: "zLabel" }] : /* istanbul ignore next */ []));
124
- zLabelClass = input('', /* @ts-ignore */
125
- ...(ngDevMode ? [{ debugName: "zLabelClass" }] : /* istanbul ignore next */ []));
126
- zPlaceholder = input('', /* @ts-ignore */
127
- ...(ngDevMode ? [{ debugName: "zPlaceholder" }] : /* istanbul ignore next */ []));
128
- zDisabled = input(false, { ...(ngDevMode ? { debugName: "zDisabled" } : /* istanbul ignore next */ {}), transform: zTransform });
129
- zReadonly = input(false, { ...(ngDevMode ? { debugName: "zReadonly" } : /* istanbul ignore next */ {}), transform: zTransform });
130
- zLoading = input(false, { ...(ngDevMode ? { debugName: "zLoading" } : /* istanbul ignore next */ {}), transform: zTransform });
131
- zLoadingOutline = input(false, { ...(ngDevMode ? { debugName: "zLoadingOutline" } : /* istanbul ignore next */ {}), transform: zTransform });
132
- zRequired = input(false, { ...(ngDevMode ? { debugName: "zRequired" } : /* istanbul ignore next */ {}), transform: zTransform });
133
- zPrefix = input('', /* @ts-ignore */
134
- ...(ngDevMode ? [{ debugName: "zPrefix" }] : /* istanbul ignore next */ []));
135
- zSuffix = input('', /* @ts-ignore */
136
- ...(ngDevMode ? [{ debugName: "zSuffix" }] : /* istanbul ignore next */ []));
137
- zAllowClear = input(true, { ...(ngDevMode ? { debugName: "zAllowClear" } : /* istanbul ignore next */ {}), transform: zTransform });
138
- zVirtualScroll = input(false, { ...(ngDevMode ? { debugName: "zVirtualScroll" } : /* istanbul ignore next */ {}), transform: zTransform });
139
- zDynamicSize = input(true, { ...(ngDevMode ? { debugName: "zDynamicSize" } : /* istanbul ignore next */ {}), transform: zTransform });
140
- zOptionHeight = input(36, /* @ts-ignore */
141
- ...(ngDevMode ? [{ debugName: "zOptionHeight" }] : /* istanbul ignore next */ []));
142
- zDropdownMaxHeight = input(null, /* @ts-ignore */
143
- ...(ngDevMode ? [{ debugName: "zDropdownMaxHeight" }] : /* istanbul ignore next */ []));
144
- /** @deprecated Dùng zDropdownMaxHeight để đồng nhất với z-select. */
145
- zHeightExpand = input(null, /* @ts-ignore */
146
- ...(ngDevMode ? [{ debugName: "zHeightExpand" }] : /* istanbul ignore next */ []));
147
- zMaxVisible = input(null, /* @ts-ignore */
148
- ...(ngDevMode ? [{ debugName: "zMaxVisible" }] : /* istanbul ignore next */ []));
149
- zResetOnSelect = input(true, { ...(ngDevMode ? { debugName: "zResetOnSelect" } : /* istanbul ignore next */ {}), transform: zTransform });
150
- zEmptyText = input('', /* @ts-ignore */
151
- ...(ngDevMode ? [{ debugName: "zEmptyText" }] : /* istanbul ignore next */ []));
152
- zEmptyIcon = input('lucideSearchX', /* @ts-ignore */
153
- ...(ngDevMode ? [{ debugName: "zEmptyIcon" }] : /* istanbul ignore next */ []));
154
- zNoDataText = input('', /* @ts-ignore */
155
- ...(ngDevMode ? [{ debugName: "zNoDataText" }] : /* istanbul ignore next */ []));
156
- zNoDataIcon = input('lucidePackageOpen', /* @ts-ignore */
157
- ...(ngDevMode ? [{ debugName: "zNoDataIcon" }] : /* istanbul ignore next */ []));
158
- zAllowCustomValue = input(false, { ...(ngDevMode ? { debugName: "zAllowCustomValue" } : /* istanbul ignore next */ {}), transform: zTransform });
159
- zOpenOnFocus = input(true, { ...(ngDevMode ? { debugName: "zOpenOnFocus" } : /* istanbul ignore next */ {}), transform: zTransform });
160
- zDebounceTime = input(200, /* @ts-ignore */
161
- ...(ngDevMode ? [{ debugName: "zDebounceTime" }] : /* istanbul ignore next */ []));
162
- zLoadingMore = input(false, { ...(ngDevMode ? { debugName: "zLoadingMore" } : /* istanbul ignore next */ {}), transform: zTransform });
163
- zEnableLoadMore = input(false, { ...(ngDevMode ? { debugName: "zEnableLoadMore" } : /* istanbul ignore next */ {}), transform: zTransform });
164
- zScrollDistance = input(2, /* @ts-ignore */
165
- ...(ngDevMode ? [{ debugName: "zScrollDistance" }] : /* istanbul ignore next */ []));
166
- zKey = input('', /* @ts-ignore */
167
- ...(ngDevMode ? [{ debugName: "zKey" }] : /* istanbul ignore next */ []));
168
- zOptionTemplate = input(null, /* @ts-ignore */
169
- ...(ngDevMode ? [{ debugName: "zOptionTemplate" }] : /* istanbul ignore next */ []));
170
- zOnSearch = output();
171
- zOnLoadMore = output();
172
- zOnSelect = output();
173
- zOnEnter = output();
174
- zOnCommit = output();
175
- zValueChange = output();
176
- zOnBlur = output();
177
- zOnFocus = output();
178
- zControl = output();
179
- zEvent = output();
180
- _value = signal('', /* @ts-ignore */
181
- ...(ngDevMode ? [{ debugName: "_value" }] : /* istanbul ignore next */ []));
182
- _disabled = signal(false, /* @ts-ignore */
183
- ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
184
- _formControl = signal(null, /* @ts-ignore */
185
- ...(ngDevMode ? [{ debugName: "_formControl" }] : /* istanbul ignore next */ []));
186
- _popoverControl = signal(null, /* @ts-ignore */
187
- ...(ngDevMode ? [{ debugName: "_popoverControl" }] : /* istanbul ignore next */ []));
188
- _selectedOption = signal(null, /* @ts-ignore */
189
- ...(ngDevMode ? [{ debugName: "_selectedOption" }] : /* istanbul ignore next */ []));
190
- _asyncOptions = signal([], /* @ts-ignore */
191
- ...(ngDevMode ? [{ debugName: "_asyncOptions" }] : /* istanbul ignore next */ []));
192
- _asyncKeyword = signal('', /* @ts-ignore */
193
- ...(ngDevMode ? [{ debugName: "_asyncKeyword" }] : /* istanbul ignore next */ []));
194
- _asyncPage = signal(1, /* @ts-ignore */
195
- ...(ngDevMode ? [{ debugName: "_asyncPage" }] : /* istanbul ignore next */ []));
196
- _asyncHasMore = signal(false, /* @ts-ignore */
197
- ...(ngDevMode ? [{ debugName: "_asyncHasMore" }] : /* istanbul ignore next */ []));
198
- _asyncLoading = signal(false, /* @ts-ignore */
199
- ...(ngDevMode ? [{ debugName: "_asyncLoading" }] : /* istanbul ignore next */ []));
200
- _asyncLoadingMore = signal(false, /* @ts-ignore */
201
- ...(ngDevMode ? [{ debugName: "_asyncLoadingMore" }] : /* istanbul ignore next */ []));
202
- uiState = signal({
203
- isOpen: false,
204
- isFocused: false,
205
- touched: false,
206
- dirty: false,
207
- }, /* @ts-ignore */
208
- ...(ngDevMode ? [{ debugName: "uiState" }] : /* istanbul ignore next */ []));
209
- actualPosition = signal('bottom', /* @ts-ignore */
210
- ...(ngDevMode ? [{ debugName: "actualPosition" }] : /* istanbul ignore next */ []));
211
- autocompleteId = zUuid('z-autocomplete');
212
- dropdownId = `${this.autocompleteId}-dropdown`;
213
- inputValue = signal('', /* @ts-ignore */
214
- ...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
215
- debouncedQuery = signal('', /* @ts-ignore */
216
- ...(ngDevMode ? [{ debugName: "debouncedQuery" }] : /* istanbul ignore next */ []));
217
- searchQuery = signal('', /* @ts-ignore */
218
- ...(ngDevMode ? [{ debugName: "searchQuery" }] : /* istanbul ignore next */ []));
219
- activeIndex = signal(-1, /* @ts-ignore */
220
- ...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
221
- dropdownWidth = signal(0, /* @ts-ignore */
222
- ...(ngDevMode ? [{ debugName: "dropdownWidth" }] : /* istanbul ignore next */ []));
223
- _pendingSearch = signal(false, /* @ts-ignore */
224
- ...(ngDevMode ? [{ debugName: "_pendingSearch" }] : /* istanbul ignore next */ []));
225
- _localLoadingTimer = zCreateDestroySafeTimeout(this._destroyRef);
226
- _focusInputTimer = zCreateDestroySafeTimeout(this._destroyRef);
227
- _navigationFillTimer = zCreateDestroySafeTimeout(this._destroyRef);
228
- _loadMoreObserver = null;
229
- _virtualScrollListener = null;
230
- _asyncLoadSubscription = null;
231
- _asyncRequestId = 0;
232
- _lastFilteredOptionsLength = 0;
233
- _shouldScrollActiveOption = false;
234
- _pendingServerSearchScrollReset = false;
235
- /** Guards against focus+click both requesting an open on the same gesture, which doubled CD cycles. */
236
- _openRequested = false;
237
- /** Stores input value before keyboard navigation for ESC revert */
238
- _valueBeforeNavigation = null;
239
- virtualizer = injectVirtualizer(() => ({
240
- scrollElement: this.virtualScrollRef(),
241
- count: this.filteredOptions().length,
242
- estimateSize: () => this.effectiveOptionHeight(),
243
- measureElement: (element) => element.getBoundingClientRect().height,
244
- gap: 3,
245
- overscan: 5,
246
- useApplicationRefTick: false,
247
- }));
248
- _measureVirtualItems = effect(() => {
249
- if (!this.zDynamicSize()) {
250
- return;
251
- }
252
- const elements = this.virtualOptionElements();
253
- for (const el of elements) {
254
- this.virtualizer.measureElement(el.nativeElement);
255
- }
256
- }, /* @ts-ignore */
257
- ...(ngDevMode ? [{ debugName: "_measureVirtualItems" }] : /* istanbul ignore next */ []));
258
- config = computed(() => ({
259
- ...Z_AUTOCOMPLETE_DEFAULT_CONFIG,
260
- ...this.zConfig(),
261
- }), /* @ts-ignore */
262
- ...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
263
- hasAsyncOptions = computed(() => !!this.config().async?.load, /* @ts-ignore */
264
- ...(ngDevMode ? [{ debugName: "hasAsyncOptions" }] : /* istanbul ignore next */ []));
265
- asyncSelectedOptions = computed(() => zResolveAsyncSelectedOptions(this.config().async), /* @ts-ignore */
266
- ...(ngDevMode ? [{ debugName: "asyncSelectedOptions" }] : /* istanbul ignore next */ []));
267
- sourceOptions = computed(() => {
268
- if (!this.hasAsyncOptions()) {
269
- return this.zOptions();
270
- }
271
- return zMergeAsyncOptions(this._asyncOptions(), this.asyncSelectedOptions(), this.config().async?.dedupeBy);
272
- }, /* @ts-ignore */
273
- ...(ngDevMode ? [{ debugName: "sourceOptions" }] : /* istanbul ignore next */ []));
274
- isLoading = computed(() => this.zLoading() || this._asyncLoading(), /* @ts-ignore */
275
- ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
276
- isLoadingMore = computed(() => this.zLoadingMore() || this._asyncLoadingMore(), /* @ts-ignore */
277
- ...(ngDevMode ? [{ debugName: "isLoadingMore" }] : /* istanbul ignore next */ []));
278
- canLoadMore = computed(() => this.hasAsyncOptions() ? this._asyncHasMore() : this.zEnableLoadMore(), /* @ts-ignore */
279
- ...(ngDevMode ? [{ debugName: "canLoadMore" }] : /* istanbul ignore next */ []));
280
- isDisabled = computed(() => this._disabled() || this.zDisabled(), /* @ts-ignore */
281
- ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
282
- isReadonly = computed(() => this.zReadonly(), /* @ts-ignore */
283
- ...(ngDevMode ? [{ debugName: "isReadonly" }] : /* istanbul ignore next */ []));
284
- isInteractionDisabled = computed(() => this.isDisabled() || this.isReadonly() || this.zLoading(), /* @ts-ignore */
285
- ...(ngDevMode ? [{ debugName: "isInteractionDisabled" }] : /* istanbul ignore next */ []));
286
- effectiveOptionHeight = computed(() => this.zOptionHeight() || this.config().optionHeight, /* @ts-ignore */
287
- ...(ngDevMode ? [{ debugName: "effectiveOptionHeight" }] : /* istanbul ignore next */ []));
288
- effectiveHeightExpand = computed(() => this.zDropdownMaxHeight() ?? this.zHeightExpand() ?? this.config().dropdownMaxHeight, /* @ts-ignore */
289
- ...(ngDevMode ? [{ debugName: "effectiveHeightExpand" }] : /* istanbul ignore next */ []));
290
- effectiveEmptyText = computed(() => this.zEmptyText() || this.config().emptyMessage, /* @ts-ignore */
291
- ...(ngDevMode ? [{ debugName: "effectiveEmptyText" }] : /* istanbul ignore next */ []));
292
- effectiveNoDataText = computed(() => this.zNoDataText() || this.config().noDataMessage, /* @ts-ignore */
293
- ...(ngDevMode ? [{ debugName: "effectiveNoDataText" }] : /* istanbul ignore next */ []));
294
- effectiveDebounceTime = computed(() => this.zConfig().debounceTime ?? this.zDebounceTime(), /* @ts-ignore */
295
- ...(ngDevMode ? [{ debugName: "effectiveDebounceTime" }] : /* istanbul ignore next */ []));
296
- effectiveOptionTemplate = computed(() => {
297
- const directive = this.customOptionDirective();
298
- if (directive) {
299
- return directive.templateRef;
300
- }
301
- return this.zOptionTemplate();
302
- }, /* @ts-ignore */
303
- ...(ngDevMode ? [{ debugName: "effectiveOptionTemplate" }] : /* istanbul ignore next */ []));
304
- hasCustomOptionTemplate = computed(() => this.effectiveOptionTemplate() !== null, /* @ts-ignore */
305
- ...(ngDevMode ? [{ debugName: "hasCustomOptionTemplate" }] : /* istanbul ignore next */ []));
306
- selected = computed(() => {
307
- const option = this._selectedOption();
308
- if (!option) {
309
- return [];
310
- }
311
- return [option];
312
- }, /* @ts-ignore */
313
- ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
314
- highlightQuery = computed(() => this.zType() === 'address_bar' ? this.searchQuery() : this.debouncedQuery(), /* @ts-ignore */
315
- ...(ngDevMode ? [{ debugName: "highlightQuery" }] : /* istanbul ignore next */ []));
316
- /**
317
- * Local-mode loading state after debounce to avoid quick flicker.
318
- * Server mode relies only on zLoading from parent.
319
- */
320
- isLoadingState = computed(() => {
321
- if (this.config().serverSearch || this.hasAsyncOptions()) {
322
- return false;
323
- }
324
- const hasInput = this.inputValue().trim() !== '';
325
- return hasInput && this._pendingSearch();
326
- }, /* @ts-ignore */
327
- ...(ngDevMode ? [{ debugName: "isLoadingState" }] : /* istanbul ignore next */ []));
328
- isPositionTop = computed(() => {
329
- const pos = this.actualPosition();
330
- return pos.startsWith('top');
331
- }, /* @ts-ignore */
332
- ...(ngDevMode ? [{ debugName: "isPositionTop" }] : /* istanbul ignore next */ []));
333
- shouldUseVirtualScroll = computed(() => {
334
- if (this.zVirtualScroll()) {
335
- return true;
336
- }
337
- if (this.hasCustomOptionTemplate()) {
338
- return false;
339
- }
340
- if (this.canLoadMore()) {
341
- return false;
342
- }
343
- if (this.hasAsyncOptions() && this._asyncPage() > 1) {
344
- return false;
345
- }
346
- const maxVisible = this.zMaxVisible();
347
- if (maxVisible !== null && this.sourceOptions().length > maxVisible) {
348
- return true;
349
- }
350
- return this.sourceOptions().length > 50;
351
- }, /* @ts-ignore */
352
- ...(ngDevMode ? [{ debugName: "shouldUseVirtualScroll" }] : /* istanbul ignore next */ []));
353
- filteredOptions = computed(() => {
354
- const options = this.sourceOptions();
355
- const cfg = this.config();
356
- const allowCustom = this.zAllowCustomValue();
357
- const query = this.zType() === 'address_bar' ? this.searchQuery() : this.debouncedQuery();
358
- // If server search is enabled, skip local filtering - just apply maxDisplayed limit
359
- if (cfg.serverSearch || this.hasAsyncOptions()) {
360
- let result = options;
361
- if (cfg.maxDisplayed && options.length > cfg.maxDisplayed) {
362
- result = options.slice(0, cfg.maxDisplayed);
363
- }
364
- // Allow custom value: if no results from server, show typed text as option
365
- if (allowCustom && result.length === 0 && query.trim() !== '') {
366
- return [{ label: query.trim(), value: query.trim() }];
367
- }
368
- return result;
369
- }
370
- if (!query || query.trim() === '') {
371
- if (cfg.maxDisplayed && options.length > cfg.maxDisplayed) {
372
- return options.slice(0, cfg.maxDisplayed);
373
- }
374
- return options;
375
- }
376
- const normalizedQuery = zRemoveVietnamese(query.toLowerCase());
377
- let filtered = options.filter(opt => {
378
- const normalizedLabel = zRemoveVietnamese(opt.label.toLowerCase());
379
- return normalizedLabel.includes(normalizedQuery);
380
- });
381
- if (cfg.maxDisplayed && filtered.length > cfg.maxDisplayed) {
382
- filtered = filtered.slice(0, cfg.maxDisplayed);
383
- }
384
- if (allowCustom && filtered.length === 0 && query.trim() !== '') {
385
- return [{ label: query.trim(), value: query.trim() }];
386
- }
387
- return filtered;
388
- }, /* @ts-ignore */
389
- ...(ngDevMode ? [{ debugName: "filteredOptions" }] : /* istanbul ignore next */ []));
390
- optionViews = computed(() => this.filteredOptions().map((option, index) => ({
391
- option,
392
- index,
393
- trackKey: `${String(this._getOptionKey(option))}::${index}`,
394
- })), /* @ts-ignore */
395
- ...(ngDevMode ? [{ debugName: "optionViews" }] : /* istanbul ignore next */ []));
396
- hasValue = computed(() => {
397
- const value = this.inputValue();
398
- return value !== null && value !== undefined && value.trim() !== '';
399
- }, /* @ts-ignore */
400
- ...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
401
- currentStatus = computed(() => {
402
- if (this.isDisabled()) {
403
- return 'disabled';
404
- }
405
- if (this.isReadonly()) {
406
- return 'readonly';
407
- }
408
- if (this.uiState().isOpen) {
409
- return 'open';
410
- }
411
- return 'default';
412
- }, /* @ts-ignore */
413
- ...(ngDevMode ? [{ debugName: "currentStatus" }] : /* istanbul ignore next */ []));
414
- inputClasses = computed(() => zMergeClasses(zAutocompleteInputVariants({
415
- zSize: this.zSize(),
416
- zStatus: this.currentStatus(),
417
- }), this.zLoading() && this.zLoadingOutline() ? 'z-loading-outline-active !ring-ring/50 !ring-[3px]' : '', this.class()), /* @ts-ignore */
418
- ...(ngDevMode ? [{ debugName: "inputClasses" }] : /* istanbul ignore next */ []));
419
- state = computed(() => ({
420
- focused: this.uiState().isFocused,
421
- touched: this.uiState().touched,
422
- dirty: this.uiState().dirty,
423
- disabled: this.isDisabled(),
424
- readonly: this.isReadonly(),
425
- open: this.uiState().isOpen,
426
- }), /* @ts-ignore */
427
- ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
428
- _onChange = () => void 0;
429
- _onTouched = () => void 0;
430
- _ngControl = null;
431
- _isNavigationFilling = false;
432
- _hasPendingInput = false;
433
- constructor() {
434
- effect(onCleanup => {
435
- const triggerEl = this.triggerRef()?.nativeElement;
436
- if (!triggerEl) {
437
- return;
438
- }
439
- const observer = new ResizeObserver(() => {
440
- this.dropdownWidth.set(triggerEl.getBoundingClientRect().width);
441
- });
442
- observer.observe(triggerEl);
443
- this.dropdownWidth.set(triggerEl.getBoundingClientRect().width);
444
- onCleanup(() => {
445
- observer.disconnect();
446
- });
447
- });
448
- effect(() => {
449
- this.zOptions();
450
- const isServerSearch = this.config().serverSearch;
451
- if (!isServerSearch || !this._pendingServerSearchScrollReset) {
452
- return;
453
- }
454
- this._pendingServerSearchScrollReset = false;
455
- this._resetOptionsScrollTop();
456
- });
457
- effect(() => {
458
- const options = this.filteredOptions();
459
- const { isOpen } = this.uiState();
460
- if (!isOpen || options.length === 0) {
461
- this._lastFilteredOptionsLength = options.length;
462
- return;
463
- }
464
- const previousLength = this._lastFilteredOptionsLength;
465
- const currentIndex = untracked(() => this.activeIndex());
466
- this._lastFilteredOptionsLength = options.length;
467
- if (currentIndex < 0 || currentIndex >= options.length || options.length <= previousLength) {
468
- this.activeIndex.set(0);
469
- }
470
- });
471
- effect(() => {
472
- const idx = this.activeIndex();
473
- const { isOpen } = this.uiState();
474
- if (!isOpen || idx < 0) {
475
- return;
476
- }
477
- if (!this._shouldScrollActiveOption || this.shouldUseVirtualScroll() || this.canLoadMore()) {
478
- return;
479
- }
480
- this._shouldScrollActiveOption = false;
481
- const container = this.optionsContainerRef()?.nativeElement;
482
- if (!container) {
483
- return;
484
- }
485
- const options = container.querySelectorAll('.z-autocomplete-option');
486
- const activeOption = options[idx];
487
- if (activeOption) {
488
- activeOption.scrollIntoView({ block: 'nearest' });
489
- }
490
- });
491
- effect(onCleanup => {
492
- const sentinel = this.loadMoreSentinelRef();
493
- const { isOpen } = this.uiState();
494
- const optionsCount = this.filteredOptions().length;
495
- if (!sentinel || !isOpen || optionsCount === 0 || !this.canLoadMore()) {
496
- this._cleanupLoadMoreObserver();
497
- return;
498
- }
499
- this._setupLoadMoreObserver();
500
- onCleanup(() => {
501
- this._cleanupLoadMoreObserver();
502
- });
503
- });
504
- effect(onCleanup => {
505
- const { isOpen } = this.uiState();
506
- const useVirtual = this.shouldUseVirtualScroll();
507
- const optionsCount = this.filteredOptions().length;
508
- if (!isOpen || !useVirtual || optionsCount === 0) {
509
- this._cleanupVirtualScrollListener();
510
- return;
511
- }
512
- requestAnimationFrame(() => {
513
- requestAnimationFrame(() => {
514
- this._setupVirtualScrollLoadMore();
515
- });
516
- });
517
- onCleanup(() => {
518
- this._cleanupVirtualScrollListener();
519
- });
520
- });
521
- }
522
- ngOnInit() {
523
- this._setupDebounce();
524
- this._emitControl();
525
- queueMicrotask(() => {
526
- try {
527
- this._ngControl = this._injector.get(NgControl, null);
528
- if (this._ngControl?.control) {
529
- this._formControl.set(this._ngControl.control);
530
- }
531
- }
532
- catch {
533
- this._ngControl = null;
534
- }
535
- });
536
- }
537
- writeValue(value) {
538
- this._value.set(value ?? '');
539
- this.inputValue.set(value ?? '');
540
- this.debouncedQuery.set(value ?? '');
541
- this._hasPendingInput = false;
542
- if (this.zType() === 'address_bar') {
543
- this.searchQuery.set(value ?? '');
544
- }
545
- }
546
- registerOnChange(fn) {
547
- this._onChange = fn;
548
- }
549
- registerOnTouched(fn) {
550
- this._onTouched = fn;
551
- }
552
- setDisabledState(isDisabled) {
553
- this._disabled.set(isDisabled);
554
- }
555
- onInput(event) {
556
- const { value } = event.target;
557
- this._clearLocalLoadingTimer();
558
- this._pendingSearch.set(false);
559
- this.inputValue.set(value);
560
- this._value.set(value);
561
- this._hasPendingInput = true;
562
- this.uiState.update(s => ({ ...s, dirty: true }));
563
- this._onChange(value);
564
- if (!this._isNavigationFilling) {
565
- this._query$.next(value);
566
- }
567
- this.zValueChange.emit(value);
568
- if (!this.uiState().isOpen) {
569
- this._openPanel();
570
- }
571
- this._selectedOption.set(null);
572
- }
573
- onFocus(event) {
574
- if (this.isReadonly()) {
575
- event.target.blur();
576
- return;
577
- }
578
- this.uiState.update(s => ({ ...s, isFocused: true }));
579
- this.zOnFocus.emit(event);
580
- this.zEvent.emit(zCreateEvent('focus', event));
581
- if (this.zOpenOnFocus()) {
582
- this._openPanel();
583
- }
584
- }
585
- onInputMousedown(event) {
586
- if (this.isReadonly()) {
587
- event.preventDefault();
588
- }
589
- }
590
- onInputClick() {
591
- if (this.uiState().isOpen || !this.zOpenOnFocus()) {
592
- return;
593
- }
594
- this._openPanel();
595
- }
596
- onBlur(event) {
597
- this.uiState.update(s => ({ ...s, isFocused: false }));
598
- this.zOnBlur.emit(event);
599
- this.zEvent.emit(zCreateEvent('blur', event));
600
- if (this.uiState().dirty) {
601
- this.uiState.update(s => ({ ...s, touched: true }));
602
- }
603
- this._onTouched();
604
- const currentValue = this.inputValue();
605
- this.zOnCommit.emit({ value: currentValue, source: 'blur' });
606
- }
607
- onKeydown(event) {
608
- if (this.isInteractionDisabled()) {
609
- return;
610
- }
611
- const { isOpen } = this.uiState();
612
- const options = this.filteredOptions();
613
- const currentValue = this.inputValue();
614
- const isAddressBarMode = this.zType() === 'address_bar';
615
- if (event.key === 'Enter') {
616
- event.preventDefault();
617
- if (!isOpen) {
618
- this._openPanel();
619
- return;
620
- }
621
- this._handleEnterKey(options, currentValue);
622
- return;
623
- }
624
- if (!isOpen) {
625
- if (event.key === 'ArrowDown') {
626
- event.preventDefault();
627
- this._openPanel();
628
- }
629
- return;
630
- }
631
- switch (event.key) {
632
- case 'ArrowDown':
633
- event.preventDefault();
634
- if (this._valueBeforeNavigation === null) {
635
- this._valueBeforeNavigation = currentValue;
636
- }
637
- this._shouldScrollActiveOption = true;
638
- this.activeIndex.update(i => (i < options.length - 1 ? i + 1 : 0));
639
- if (isAddressBarMode) {
640
- this._fillInputFromActiveOption();
641
- }
642
- break;
643
- case 'ArrowUp':
644
- event.preventDefault();
645
- if (this._valueBeforeNavigation === null) {
646
- this._valueBeforeNavigation = currentValue;
647
- }
648
- this._shouldScrollActiveOption = true;
649
- this.activeIndex.update(i => (i > 0 ? i - 1 : options.length - 1));
650
- if (isAddressBarMode) {
651
- this._fillInputFromActiveOption();
652
- }
653
- break;
654
- case 'Escape':
655
- event.preventDefault();
656
- if (isAddressBarMode && this._valueBeforeNavigation !== null) {
657
- this._revertToValueBeforeNavigation();
658
- this._hasPendingInput = false;
659
- }
660
- else {
661
- this._cancelPendingInput();
662
- }
663
- this._valueBeforeNavigation = null;
664
- this._closePanel();
665
- break;
666
- case 'Tab':
667
- this._valueBeforeNavigation = null;
668
- this._closePanel();
669
- break;
670
- }
671
- }
672
- _handleEnterKey(options, currentValue) {
673
- const trimmedValue = currentValue.trim();
674
- this._valueBeforeNavigation = null;
675
- this.zOnCommit.emit({ value: trimmedValue, source: 'enter' });
676
- if (this.zType() === 'address_bar') {
677
- this._closePanel();
678
- return;
679
- }
680
- const idx = this.activeIndex();
681
- if (options.length > 0) {
682
- const selectedIdx = idx >= 0 && idx < options.length ? idx : 0;
683
- this.selectOption(options[selectedIdx]);
684
- return;
685
- }
686
- if (this.zAllowCustomValue() && trimmedValue) {
687
- this.zOnEnter.emit(trimmedValue);
688
- this._resetInput();
689
- }
690
- }
691
- _fillInputFromActiveOption() {
692
- const idx = this.activeIndex();
693
- const options = this.filteredOptions();
694
- if (idx < 0 || idx >= options.length) {
695
- return;
696
- }
697
- const option = options[idx];
698
- this._isNavigationFilling = true;
699
- this.inputValue.set(option.label);
700
- this._value.set(option.label);
701
- this._onChange(option.label);
702
- this.zValueChange.emit(option.label);
703
- const inputEl = this.inputRef()?.nativeElement;
704
- if (inputEl) {
705
- inputEl.value = option.label;
706
- }
707
- this._navigationFillTimer.schedule(() => {
708
- this._isNavigationFilling = false;
709
- }, 0);
710
- }
711
- _revertToValueBeforeNavigation() {
712
- if (this._valueBeforeNavigation === null) {
713
- return;
714
- }
715
- const value = this._valueBeforeNavigation;
716
- this._isNavigationFilling = true;
717
- this.inputValue.set(value);
718
- this._value.set(value);
719
- this._onChange(value);
720
- this.zValueChange.emit(value);
721
- if (this.zType() === 'address_bar') {
722
- this.searchQuery.set(value);
723
- }
724
- const inputEl = this.inputRef()?.nativeElement;
725
- if (inputEl) {
726
- inputEl.value = value;
727
- }
728
- this._valueBeforeNavigation = null;
729
- this._navigationFillTimer.schedule(() => {
730
- this._isNavigationFilling = false;
731
- }, 0);
732
- }
733
- _resetInput() {
734
- this._hasPendingInput = false;
735
- if (!this.zResetOnSelect()) {
736
- this._closePanel();
737
- this.activeIndex.set(-1);
738
- return;
739
- }
740
- this.inputValue.set('');
741
- this._value.set('');
742
- this._onChange('');
743
- this.zValueChange.emit('');
744
- if (!this.hasAsyncOptions()) {
745
- this._query$.next('');
746
- }
747
- this._closePanel();
748
- this.activeIndex.set(-1);
749
- }
750
- onPopoverControl(control) {
751
- this._popoverControl.set(control);
752
- }
753
- onPopoverShow() {
754
- this._openRequested = false;
755
- this.uiState.update(s => ({ ...s, isOpen: true }));
756
- this._resetOptionsScrollTop();
757
- this._loadAsyncOptionsOnFocus();
758
- // Panel chỉ mở khi user focus/click thật, tức ancestor (vd. modal) đã hết animation transform —
759
- // đo lại ở đây để tránh dùng width "đóng băng" từ lúc effect khởi tạo đo hụt giữa lúc scale().
760
- const triggerEl = this.triggerRef()?.nativeElement;
761
- if (triggerEl) {
762
- this.dropdownWidth.set(triggerEl.getBoundingClientRect().width);
763
- }
764
- this._focusInputTimer.schedule(() => {
765
- this.inputRef()?.nativeElement.focus();
766
- }, 50);
767
- }
768
- onPopoverHideStart() {
769
- this._cancelPendingInput();
770
- this._openRequested = false;
771
- this.uiState.update(s => ({ ...s, isOpen: false }));
772
- this.activeIndex.set(-1);
773
- this._clearLocalLoadingTimer();
774
- this._pendingSearch.set(false);
775
- this.debouncedQuery.set('');
776
- if (!this.hasAsyncOptions()) {
777
- this._query$.next('');
778
- }
779
- }
780
- onPopoverHideEnd() {
781
- this.actualPosition.set('bottom');
782
- }
783
- onPositionChange(position) {
784
- this.actualPosition.set(position);
785
- }
786
- selectOption(option) {
787
- if (option.disabled) {
788
- return;
789
- }
790
- this.uiState.update(s => ({ ...s, dirty: true }));
791
- this.zOnSelect.emit(option);
792
- this._selectedOption.set(option);
793
- const newValue = this.zResetOnSelect() ? '' : option.label;
794
- this._hasPendingInput = false;
795
- this.inputValue.set(newValue);
796
- this._value.set(newValue);
797
- this.debouncedQuery.set(newValue);
798
- this._onChange(newValue);
799
- this.zValueChange.emit(newValue);
800
- this._valueBeforeNavigation = null;
801
- if (this.config().closeOnSelect) {
802
- this._closePanel();
803
- }
804
- this.activeIndex.set(-1);
805
- }
806
- clearInput(event) {
807
- event.stopPropagation();
808
- event.preventDefault();
809
- this._hasPendingInput = false;
810
- this.inputValue.set('');
811
- this._value.set('');
812
- this.uiState.update(s => ({ ...s, dirty: true }));
813
- this._onChange('');
814
- this.zValueChange.emit('');
815
- this._selectedOption.set(null);
816
- this._closePanel();
817
- this._clearLocalLoadingTimer();
818
- this._pendingSearch.set(false);
819
- this.debouncedQuery.set('');
820
- if (this.zType() === 'address_bar') {
821
- this.searchQuery.set('');
822
- }
823
- if (!this.hasAsyncOptions()) {
824
- this._query$.next('');
825
- }
826
- this.zOnCommit.emit({ value: '', source: 'blur' });
827
- this._resetAsyncOptions();
828
- this._focusInputTimer.schedule(() => {
829
- this.inputRef()?.nativeElement.focus();
830
- });
831
- }
832
- getOptionClasses(option, index) {
833
- return zAutocompleteOptionVariants({
834
- customTemplate: this.hasCustomOptionTemplate(),
835
- active: this.activeIndex() === index,
836
- disabled: option.disabled ?? false,
837
- });
838
- }
839
- trackByValue = (index, option) => {
840
- const key = this._getOptionKey(option);
841
- return `${String(key)}::${index}`;
842
- };
843
- focus() {
844
- this.inputRef()?.nativeElement.focus();
845
- }
846
- blur() {
847
- this.inputRef()?.nativeElement.blur();
848
- }
849
- clear() {
850
- this._hasPendingInput = false;
851
- this.inputValue.set('');
852
- this._value.set('');
853
- this.debouncedQuery.set('');
854
- const inputEl = this.inputRef()?.nativeElement;
855
- if (inputEl) {
856
- inputEl.value = '';
857
- }
858
- this._onChange('');
859
- this.zValueChange.emit('');
860
- this._selectedOption.set(null);
861
- this._closePanel();
862
- this._clearLocalLoadingTimer();
863
- this._pendingSearch.set(false);
864
- this._resetAsyncOptions();
865
- if (this.zType() === 'address_bar') {
866
- this.searchQuery.set('');
867
- }
868
- }
869
- reset() {
870
- this.clear();
871
- this.uiState.update(s => ({ ...s, touched: false, dirty: false }));
872
- }
873
- open() {
874
- this._openPanel();
875
- }
876
- close() {
877
- this._closePanel();
878
- }
879
- setValue(value) {
880
- this._hasPendingInput = false;
881
- this._value.set(value);
882
- this.inputValue.set(value);
883
- this.debouncedQuery.set(value);
884
- this._selectedOption.set(null);
885
- this._onChange(value);
886
- if (this.zType() === 'address_bar') {
887
- this.searchQuery.set(value);
888
- }
889
- }
890
- _openPanel() {
891
- if (this.isInteractionDisabled() || this._openRequested || this.uiState().isOpen) {
892
- return;
893
- }
894
- this._openRequested = true;
895
- this._popoverControl()?.show();
896
- }
897
- _closePanel() {
898
- this._popoverControl()?.close();
899
- }
900
- _cancelPendingInput() {
901
- if (!this._hasPendingInput) {
902
- return;
903
- }
904
- this._hasPendingInput = false;
905
- this.clear();
906
- }
907
- _setupDebounce() {
908
- this._query$
909
- .pipe(debounceTime(this.effectiveDebounceTime()), distinctUntilChanged(), takeUntilDestroyed(this._destroyRef))
910
- .subscribe(query => {
911
- if (this.zType() === 'address_bar') {
912
- this.searchQuery.set(query);
913
- }
914
- this.debouncedQuery.set(query);
915
- this.zOnSearch.emit(query);
916
- if (this.hasAsyncOptions()) {
917
- this._loadAsyncOptions(query, false);
918
- return;
919
- }
920
- if (this.config().serverSearch) {
921
- this._pendingServerSearchScrollReset = true;
922
- return;
923
- }
924
- this._resetOptionsScrollTop();
925
- this._clearLocalLoadingTimer();
926
- this._pendingSearch.set(true);
927
- this._localLoadingTimer.schedule(() => {
928
- this._pendingSearch.set(false);
929
- }, 100);
930
- });
931
- }
932
- _loadAsyncOptionsOnFocus() {
933
- const asyncConfig = this.config().async;
934
- if (!asyncConfig?.loadOnFocus) {
935
- return;
936
- }
937
- const keyword = this.inputValue().trim();
938
- if (this._asyncKeyword() === keyword && this._asyncOptions().length > 0) {
939
- return;
940
- }
941
- this._loadAsyncOptions(keyword, false);
942
- }
943
- _loadAsyncOptions(keyword, append) {
944
- const asyncConfig = this.config().async;
945
- if (!asyncConfig) {
946
- return;
947
- }
948
- const normalizedKeyword = keyword.trim();
949
- const pageSize = asyncConfig.pageSize ?? Z_ASYNC_OPTIONS_DEFAULT_PAGE_SIZE;
950
- const { minLength } = this.config();
951
- const canLoadEmptyOnFocus = asyncConfig.loadOnFocus && normalizedKeyword.length === 0;
952
- if (!append && normalizedKeyword.length < minLength && !canLoadEmptyOnFocus) {
953
- this._resetAsyncOptions();
954
- return;
955
- }
956
- if (append && (!this._asyncHasMore() || this._asyncLoading() || this._asyncLoadingMore())) {
957
- return;
958
- }
959
- const page = append ? this._asyncPage() + 1 : 1;
960
- const requestId = ++this._asyncRequestId;
961
- const scrollTopBeforeAppend = append ? this._getAsyncOptionsScrollTop() : null;
962
- if (!append) {
963
- this._asyncLoadSubscription?.unsubscribe();
964
- this._asyncKeyword.set(normalizedKeyword);
965
- this._asyncLoading.set(true);
966
- this._asyncHasMore.set(false);
967
- }
968
- else {
969
- this._asyncLoadingMore.set(true);
970
- }
971
- let result;
972
- try {
973
- result = asyncConfig.load({
974
- keyword: normalizedKeyword,
975
- page,
976
- pageSize,
977
- });
978
- }
979
- catch (error) {
980
- this._handleAsyncOptionsError(error, append);
981
- return;
982
- }
983
- this._asyncLoadSubscription = zToAsyncOptionsObservable(result)
984
- .pipe(finalize(() => {
985
- if (requestId !== this._asyncRequestId) {
986
- return;
987
- }
988
- this._asyncLoading.set(false);
989
- this._asyncLoadingMore.set(false);
990
- }), takeUntilDestroyed(this._destroyRef))
991
- .subscribe({
992
- next: response => {
993
- if (requestId !== this._asyncRequestId) {
994
- return;
995
- }
996
- const nextItems = response.items ?? [];
997
- const previousCount = this._asyncOptions().length;
998
- const mergedOptions = append
999
- ? zMergeAsyncOptions(this._asyncOptions(), nextItems, asyncConfig.dedupeBy)
1000
- : zMergeAsyncOptions([], nextItems, asyncConfig.dedupeBy);
1001
- const hasNewItems = mergedOptions.length > previousCount;
1002
- if (append && !hasNewItems) {
1003
- this._asyncHasMore.set(false);
1004
- this._restoreAsyncOptionsScrollTop(scrollTopBeforeAppend);
1005
- return;
1006
- }
1007
- this._asyncOptions.set(mergedOptions);
1008
- this._asyncPage.set(page);
1009
- this._asyncHasMore.set(append && !hasNewItems ? false : zResolveAsyncOptionsHasMore(response, pageSize, mergedOptions.length));
1010
- if (append) {
1011
- this._restoreAsyncOptionsScrollTop(scrollTopBeforeAppend);
1012
- return;
1013
- }
1014
- this._resetOptionsScrollTop();
1015
- },
1016
- error: error => {
1017
- if (requestId !== this._asyncRequestId) {
1018
- return;
1019
- }
1020
- this._handleAsyncOptionsError(error, append);
1021
- },
1022
- });
1023
- }
1024
- _handleAsyncOptionsError(error, append) {
1025
- console.error('ZAutocomplete async options load failed:', error);
1026
- if (!append) {
1027
- this._asyncOptions.set([]);
1028
- this._asyncPage.set(1);
1029
- }
1030
- this._asyncHasMore.set(false);
1031
- this._asyncLoading.set(false);
1032
- this._asyncLoadingMore.set(false);
1033
- }
1034
- _getAsyncOptionsScrollTop() {
1035
- return this._getOptionsScrollElement()?.scrollTop ?? null;
1036
- }
1037
- _restoreAsyncOptionsScrollTop(scrollTop) {
1038
- if (scrollTop === null) {
1039
- return;
1040
- }
1041
- requestAnimationFrame(() => {
1042
- const scrollElement = this._getOptionsScrollElement();
1043
- if (scrollElement) {
1044
- scrollElement.scrollTop = scrollTop;
1045
- }
1046
- });
1047
- }
1048
- _resetOptionsScrollTop(attempt = 0) {
1049
- requestAnimationFrame(() => {
1050
- const scrollElement = this._getOptionsScrollElement();
1051
- if (!scrollElement && attempt < 3) {
1052
- this._resetOptionsScrollTop(attempt + 1);
1053
- return;
1054
- }
1055
- if (!scrollElement) {
1056
- return;
1057
- }
1058
- if (this.shouldUseVirtualScroll()) {
1059
- this.virtualizer.scrollToOffset(0);
1060
- }
1061
- scrollElement.scrollTop = 0;
1062
- });
1063
- }
1064
- _getOptionsScrollElement() {
1065
- if (this.shouldUseVirtualScroll()) {
1066
- return this.virtualScrollRef()?.nativeElement ?? null;
1067
- }
1068
- return this.optionsContainerRef()?.nativeElement ?? null;
1069
- }
1070
- _resetAsyncOptions() {
1071
- this._asyncLoadSubscription?.unsubscribe();
1072
- this._asyncRequestId++;
1073
- this._asyncOptions.set([]);
1074
- this._asyncKeyword.set('');
1075
- this._asyncPage.set(1);
1076
- this._asyncHasMore.set(false);
1077
- this._asyncLoading.set(false);
1078
- this._asyncLoadingMore.set(false);
1079
- }
1080
- _clearLocalLoadingTimer() {
1081
- this._localLoadingTimer.cancel();
1082
- }
1083
- _setupLoadMoreObserver() {
1084
- this._cleanupLoadMoreObserver();
1085
- const sentinel = this.loadMoreSentinelRef()?.nativeElement;
1086
- const container = this.optionsContainerRef()?.nativeElement;
1087
- if (!sentinel || !container) {
1088
- return;
1089
- }
1090
- this._loadMoreObserver = new IntersectionObserver(entries => {
1091
- const entry = entries[0];
1092
- if (entry?.isIntersecting && !this.isLoadingMore()) {
1093
- this._handleLoadMore(container.scrollTop);
1094
- }
1095
- }, {
1096
- root: container,
1097
- rootMargin: '100px',
1098
- threshold: 0,
1099
- });
1100
- this._loadMoreObserver.observe(sentinel);
1101
- }
1102
- _cleanupLoadMoreObserver() {
1103
- if (!this._loadMoreObserver) {
1104
- return;
1105
- }
1106
- this._loadMoreObserver.disconnect();
1107
- this._loadMoreObserver = null;
1108
- }
1109
- _setupVirtualScrollLoadMore() {
1110
- this._cleanupVirtualScrollListener();
1111
- const scrollElement = this.virtualScrollRef()?.nativeElement;
1112
- if (!scrollElement) {
1113
- return;
1114
- }
1115
- const handleScroll = () => {
1116
- if (this.isLoadingMore()) {
1117
- return;
1118
- }
1119
- const { scrollTop, scrollHeight, clientHeight } = scrollElement;
1120
- const threshold = clientHeight * this.zScrollDistance();
1121
- const distanceFromBottom = scrollHeight - scrollTop - clientHeight;
1122
- if (distanceFromBottom <= threshold) {
1123
- this._handleLoadMore(scrollTop);
1124
- }
1125
- };
1126
- scrollElement.addEventListener('scroll', handleScroll);
1127
- this._virtualScrollListener = () => {
1128
- scrollElement.removeEventListener('scroll', handleScroll);
1129
- };
1130
- }
1131
- _cleanupVirtualScrollListener() {
1132
- if (!this._virtualScrollListener) {
1133
- return;
1134
- }
1135
- this._virtualScrollListener();
1136
- this._virtualScrollListener = null;
1137
- }
1138
- _handleLoadMore(scrollTop) {
1139
- if (this.hasAsyncOptions()) {
1140
- if (!this.canLoadMore()) {
1141
- return;
1142
- }
1143
- this._loadAsyncOptions(this._asyncKeyword(), true);
1144
- return;
1145
- }
1146
- this.zOnLoadMore.emit({
1147
- currentCount: this.filteredOptions().length,
1148
- scrollTop,
1149
- });
1150
- }
1151
- _emitControl() {
1152
- this.zControl.emit({
1153
- focus: () => this.focus(),
1154
- blur: () => this.blur(),
1155
- clear: () => this.clear(),
1156
- reset: () => this.reset(),
1157
- open: () => this.open(),
1158
- close: () => this.close(),
1159
- setValue: (val) => this.setValue(val),
1160
- value: this._value.asReadonly(),
1161
- selected: this.selected,
1162
- state: this.state,
1163
- });
1164
- }
1165
- _getOptionKey(option) {
1166
- const key = this.zKey();
1167
- if (key && key in option) {
1168
- return option[key];
1169
- }
1170
- if (key && typeof option.value === 'object' && option.value !== null && key in option.value) {
1171
- return option.value[key];
1172
- }
1173
- return option.value;
1174
- }
1175
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: ZAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1176
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: ZAutocompleteComponent, isStandalone: true, selector: "z-autocomplete", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, zOptions: { classPropertyName: "zOptions", publicName: "zOptions", isSignal: true, isRequired: false, transformFunction: null }, zConfig: { classPropertyName: "zConfig", publicName: "zConfig", isSignal: true, isRequired: false, transformFunction: null }, zSize: { classPropertyName: "zSize", publicName: "zSize", isSignal: true, isRequired: false, transformFunction: null }, zType: { classPropertyName: "zType", publicName: "zType", isSignal: true, isRequired: false, transformFunction: null }, zLabel: { classPropertyName: "zLabel", publicName: "zLabel", isSignal: true, isRequired: false, transformFunction: null }, zLabelClass: { classPropertyName: "zLabelClass", publicName: "zLabelClass", isSignal: true, isRequired: false, transformFunction: null }, zPlaceholder: { classPropertyName: "zPlaceholder", publicName: "zPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, zDisabled: { classPropertyName: "zDisabled", publicName: "zDisabled", isSignal: true, isRequired: false, transformFunction: null }, zReadonly: { classPropertyName: "zReadonly", publicName: "zReadonly", isSignal: true, isRequired: false, transformFunction: null }, zLoading: { classPropertyName: "zLoading", publicName: "zLoading", isSignal: true, isRequired: false, transformFunction: null }, zLoadingOutline: { classPropertyName: "zLoadingOutline", publicName: "zLoadingOutline", isSignal: true, isRequired: false, transformFunction: null }, zRequired: { classPropertyName: "zRequired", publicName: "zRequired", isSignal: true, isRequired: false, transformFunction: null }, zPrefix: { classPropertyName: "zPrefix", publicName: "zPrefix", isSignal: true, isRequired: false, transformFunction: null }, zSuffix: { classPropertyName: "zSuffix", publicName: "zSuffix", isSignal: true, isRequired: false, transformFunction: null }, zAllowClear: { classPropertyName: "zAllowClear", publicName: "zAllowClear", isSignal: true, isRequired: false, transformFunction: null }, zVirtualScroll: { classPropertyName: "zVirtualScroll", publicName: "zVirtualScroll", isSignal: true, isRequired: false, transformFunction: null }, zDynamicSize: { classPropertyName: "zDynamicSize", publicName: "zDynamicSize", isSignal: true, isRequired: false, transformFunction: null }, zOptionHeight: { classPropertyName: "zOptionHeight", publicName: "zOptionHeight", isSignal: true, isRequired: false, transformFunction: null }, zDropdownMaxHeight: { classPropertyName: "zDropdownMaxHeight", publicName: "zDropdownMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, zHeightExpand: { classPropertyName: "zHeightExpand", publicName: "zHeightExpand", isSignal: true, isRequired: false, transformFunction: null }, zMaxVisible: { classPropertyName: "zMaxVisible", publicName: "zMaxVisible", isSignal: true, isRequired: false, transformFunction: null }, zResetOnSelect: { classPropertyName: "zResetOnSelect", publicName: "zResetOnSelect", isSignal: true, isRequired: false, transformFunction: null }, zEmptyText: { classPropertyName: "zEmptyText", publicName: "zEmptyText", isSignal: true, isRequired: false, transformFunction: null }, zEmptyIcon: { classPropertyName: "zEmptyIcon", publicName: "zEmptyIcon", isSignal: true, isRequired: false, transformFunction: null }, zNoDataText: { classPropertyName: "zNoDataText", publicName: "zNoDataText", isSignal: true, isRequired: false, transformFunction: null }, zNoDataIcon: { classPropertyName: "zNoDataIcon", publicName: "zNoDataIcon", isSignal: true, isRequired: false, transformFunction: null }, zAllowCustomValue: { classPropertyName: "zAllowCustomValue", publicName: "zAllowCustomValue", isSignal: true, isRequired: false, transformFunction: null }, zOpenOnFocus: { classPropertyName: "zOpenOnFocus", publicName: "zOpenOnFocus", isSignal: true, isRequired: false, transformFunction: null }, zDebounceTime: { classPropertyName: "zDebounceTime", publicName: "zDebounceTime", isSignal: true, isRequired: false, transformFunction: null }, zLoadingMore: { classPropertyName: "zLoadingMore", publicName: "zLoadingMore", isSignal: true, isRequired: false, transformFunction: null }, zEnableLoadMore: { classPropertyName: "zEnableLoadMore", publicName: "zEnableLoadMore", isSignal: true, isRequired: false, transformFunction: null }, zScrollDistance: { classPropertyName: "zScrollDistance", publicName: "zScrollDistance", isSignal: true, isRequired: false, transformFunction: null }, zKey: { classPropertyName: "zKey", publicName: "zKey", isSignal: true, isRequired: false, transformFunction: null }, zOptionTemplate: { classPropertyName: "zOptionTemplate", publicName: "zOptionTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { zOnSearch: "zOnSearch", zOnLoadMore: "zOnLoadMore", zOnSelect: "zOnSelect", zOnEnter: "zOnEnter", zOnCommit: "zOnCommit", zValueChange: "zValueChange", zOnBlur: "zOnBlur", zOnFocus: "zOnFocus", zControl: "zControl", zEvent: "zEvent" }, providers: [
1177
- {
1178
- provide: NG_VALUE_ACCESSOR,
1179
- useExisting: forwardRef(() => ZAutocompleteComponent),
1180
- multi: true,
1181
- },
1182
- ], queries: [{ propertyName: "customOptionDirective", first: true, predicate: (ZAutocompleteOptionDirective), descendants: true, isSignal: true }], viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true, isSignal: true }, { propertyName: "inputRef", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }, { propertyName: "dropdownTpl", first: true, predicate: ["dropdownTpl"], descendants: true, isSignal: true }, { propertyName: "virtualScrollRef", first: true, predicate: ["virtualScrollElement"], descendants: true, isSignal: true }, { propertyName: "optionsContainerRef", first: true, predicate: ["optionsContainer"], descendants: true, isSignal: true }, { propertyName: "loadMoreSentinelRef", first: true, predicate: ["loadMoreSentinel"], descendants: true, isSignal: true }, { propertyName: "virtualOptionElements", predicate: ["virtualOptionEl"], descendants: true, isSignal: true }], exportAs: ["zAutocomplete"], ngImport: i0, template: "<div class=\"z-autocomplete-wrapper relative flex w-full flex-col gap-2\">\n @if (zLabel()) {\n <label [for]=\"autocompleteId\" class=\"text-xs leading-none font-medium\" [class]=\"zLabelClass()\">\n {{ zLabel() }}\n @if (zRequired()) {\n <span class=\"text-destructive! ml-0.5\">*</span>\n }\n </label>\n }\n\n <div\n #triggerEl\n z-popover\n [zPopoverContent]=\"dropdownTpl\"\n [zOffset]=\"0\"\n [zDisabled]=\"isInteractionDisabled()\"\n zPopoverWidth=\"trigger\"\n zPopoverTrigger=\"manual\"\n zPosition=\"bottom\"\n zClass=\"border-0 shadow-none bg-transparent p-0\"\n (zControl)=\"onPopoverControl($event)\"\n (zShow)=\"onPopoverShow()\"\n (zHideStart)=\"onPopoverHideStart()\"\n (zHide)=\"onPopoverHideEnd()\"\n (zPositionChange)=\"onPositionChange($event)\"\n class=\"z-autocomplete-trigger\"\n [class]=\"inputClasses()\"\n z-tooltip\n [zContent]=\"inputValue()\"\n [zTooltipShowDelay]=\"300\"\n zTooltipTrigger=\"hover\"\n zTooltipPosition=\"top\"\n [zTooltipDisabled]=\"uiState().isFocused || uiState().isOpen || !hasValue()\"\n [zTriggerElement]=\"inputEl\"\n [class.z-autocomplete-open]=\"uiState().isOpen\"\n [class.z-autocomplete-open-top]=\"uiState().isOpen && isPositionTop()\"\n [class.z-autocomplete-open-bottom]=\"uiState().isOpen && !isPositionTop()\"\n role=\"combobox\"\n [attr.aria-expanded]=\"uiState().isOpen\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"dropdownId\">\n @if (zPrefix()) {\n <z-icon [zType]=\"zPrefix() || 'lucideSearch'\" zSize=\"16\" class=\"text-muted-foreground shrink-0\" />\n }\n\n <input\n #inputEl\n [id]=\"autocompleteId\"\n type=\"text\"\n class=\"z-autocomplete-input placeholder:text-muted-foreground min-w-0 flex-1 overflow-hidden bg-transparent text-ellipsis whitespace-nowrap outline-none\"\n [class.text-sm]=\"zSize() === 'sm' || zSize() === 'default'\"\n [placeholder]=\"zPlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"isReadonly()\"\n [value]=\"inputValue()\"\n (mousedown)=\"onInputMousedown($event)\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n (click)=\"onInputClick()\"\n (keydown)=\"onKeydown($event)\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\" />\n\n @if (isLoading() || isLoadingState() || isLoadingMore()) {\n <z-icon zType=\"lucideLoaderCircle\" zSize=\"16\" class=\"text-muted-foreground shrink-0 animate-spin\" />\n } @else {\n @if (zAllowClear() && hasValue() && !isDisabled() && !isReadonly()) {\n <button\n type=\"button\"\n class=\"text-muted-foreground hover:text-foreground flex shrink-0 cursor-pointer items-center justify-center transition-colors\"\n (mousedown)=\"clearInput($event)\"\n tabindex=\"-1\">\n <z-icon zType=\"lucideX\" zSize=\"18\" class=\"cursor-pointer!\" />\n </button>\n }\n\n @if (zSuffix()) {\n <z-icon [zType]=\"zSuffix() || 'lucideSearch'\" zSize=\"16\" class=\"text-muted-foreground shrink-0\" />\n }\n }\n </div>\n</div>\n\n<ng-template #dropdownTpl let-close=\"close\">\n <div\n [id]=\"dropdownId\"\n class=\"z-autocomplete-dropdown bg-popover border-ring overflow-hidden border shadow-[var(--z-popover-shadow)]\"\n [class.z-autocomplete-dropdown-bottom]=\"!isPositionTop()\"\n [class.rounded-b-sm]=\"!isPositionTop()\"\n [class.rounded-t-sm]=\"isPositionTop()\"\n [class.border-t-0]=\"!isPositionTop()\"\n [class.border-b-0]=\"isPositionTop()\"\n [style.width.px]=\"dropdownWidth()\"\n role=\"listbox\"\n (mousedown)=\"$event.preventDefault()\">\n @if (isLoading() || isLoadingState()) {\n <div\n class=\"z-autocomplete-content-state flex flex-col items-center justify-center\"\n [style.minHeight.px]=\"effectiveHeightExpand()\">\n <z-loading [zLoading]=\"true\" zSize=\"default\" />\n </div>\n } @else {\n @if (filteredOptions().length === 0) {\n <!-- Empty State -->\n <div\n class=\"z-autocomplete-content-state flex flex-col items-center justify-center p-1\"\n [style.minHeight.px]=\"effectiveHeightExpand()\">\n @if (inputValue().trim() !== '') {\n <!-- Searched but no results -->\n <z-empty [zIcon]=\"zEmptyIcon()\" zSize=\"sm\" [zMessage]=\"effectiveEmptyText()\" />\n } @else {\n <!-- No data initially -->\n <z-empty [zIcon]=\"zNoDataIcon()\" zSize=\"sm\" [zMessage]=\"effectiveNoDataText()\" />\n }\n </div>\n } @else if (shouldUseVirtualScroll()) {\n <!-- Virtual Scroll Mode -->\n <div\n #virtualScrollElement\n zHoverGlide\n zHoverGlideClass=\"bg-primary/15 rounded-(--radius-sm)\"\n class=\"z-autocomplete-content-state z-autocomplete-options z-autocomplete-virtual-scroll relative overflow-x-hidden overflow-y-auto overscroll-y-contain p-1\"\n [style.height.px]=\"effectiveHeightExpand()\">\n <div class=\"z-autocomplete-virtual-inner relative\" [style.height.px]=\"virtualizer.getTotalSize()\">\n @for (virtualItem of virtualizer.getVirtualItems(); track virtualItem.index) {\n @let opt = filteredOptions()[virtualItem.index];\n @let isActive = activeIndex() === virtualItem.index;\n <div\n #virtualOptionEl\n data-glide-item\n class=\"z-autocomplete-option absolute right-0 left-0 min-w-0\"\n [ngClass]=\"getOptionClasses(opt, virtualItem.index)\"\n [attr.data-index]=\"virtualItem.index\"\n [style.display]=\"hasCustomOptionTemplate() ? 'block' : null\"\n [style.height.px]=\"zDynamicSize() ? null : effectiveOptionHeight()\"\n [style.minHeight.px]=\"zDynamicSize() ? effectiveOptionHeight() : null\"\n [style.overflow]=\"hasCustomOptionTemplate() ? 'visible' : null\"\n [style.transform]=\"'translateY(' + virtualItem.start + 'px) translateZ(0)'\"\n [attr.aria-selected]=\"isActive\"\n role=\"option\"\n (mouseenter)=\"activeIndex.set(virtualItem.index)\"\n (click)=\"selectOption(opt)\">\n @if (effectiveOptionTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"effectiveOptionTemplate()!; context: { $implicit: opt, active: isActive }\" />\n } @else {\n @if (opt.icon) {\n <z-icon [zType]=\"opt.icon\" zSize=\"16\" class=\"shrink-0\" />\n }\n <div class=\"min-w-0 flex-1\">\n <span\n class=\"block min-w-0 truncate\"\n z-tooltip\n [zContent]=\"opt.label\"\n [zShowDelay]=\"300\"\n zPosition=\"top\"\n [zHideDelay]=\"0\"\n [zOffset]=\"5\"\n [zArrow]=\"false\"\n [zTriggerElement]=\"virtualOptionEl\"\n [innerHTML]=\"\n config().highlightMatch ? (opt.label | zHighlight: highlightQuery() | zSafeHtml) : opt.label\n \"></span>\n @if (opt.description) {\n <span class=\"text-muted-foreground block min-w-0 truncate text-xs\">{{ opt.description }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n @if (isLoadingMore()) {\n <div\n class=\"z-autocomplete-loading-more from-popover via-popover/95 sticky bottom-0 -mx-1 -mb-1 flex items-center justify-center bg-gradient-to-t to-transparent pt-6 pb-2\"\n animate.enter=\"z-autocomplete-loading-enter\"\n animate.leave=\"z-autocomplete-loading-leave\">\n <z-loading zSize=\"xs\" [zLoading]=\"true\" />\n </div>\n }\n </div>\n } @else {\n <!-- Normal Scroll Mode -->\n <div\n #optionsContainer\n zHoverGlide\n zHoverGlideClass=\"bg-primary/15 rounded-(--radius-sm)\"\n class=\"z-autocomplete-content-state z-autocomplete-options flex flex-col gap-0.75 overflow-x-hidden overflow-y-auto overscroll-y-contain p-1\"\n [style.minHeight.px]=\"effectiveHeightExpand()\"\n [style.maxHeight.px]=\"effectiveHeightExpand()\">\n @for (item of optionViews(); track item.trackKey) {\n @let opt = item.option;\n @let i = item.index;\n @let isActive = activeIndex() === i;\n <div\n #optionEl2\n data-glide-item\n class=\"z-autocomplete-option relative min-w-0\"\n [ngClass]=\"getOptionClasses(opt, i)\"\n [style.display]=\"hasCustomOptionTemplate() ? 'block' : null\"\n [style.minHeight.px]=\"hasCustomOptionTemplate() ? null : effectiveOptionHeight()\"\n [style.overflow]=\"hasCustomOptionTemplate() ? 'visible' : null\"\n [attr.aria-selected]=\"isActive\"\n role=\"option\"\n (mouseenter)=\"activeIndex.set(i)\"\n (click)=\"selectOption(opt)\">\n @if (effectiveOptionTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"effectiveOptionTemplate()!; context: { $implicit: opt, active: isActive }\" />\n } @else {\n @if (opt.icon) {\n <z-icon [zType]=\"opt.icon\" zSize=\"16\" class=\"shrink-0\" />\n }\n <div class=\"min-w-0 flex-1\">\n <span\n class=\"block min-w-0 truncate\"\n z-tooltip\n [zContent]=\"opt.label\"\n [zShowDelay]=\"300\"\n zPosition=\"top\"\n [zHideDelay]=\"0\"\n [zOffset]=\"5\"\n [zArrow]=\"false\"\n [zTriggerElement]=\"optionEl2\"\n [innerHTML]=\"\n config().highlightMatch ? (opt.label | zHighlight: highlightQuery() | zSafeHtml) : opt.label\n \"></span>\n @if (opt.description) {\n <span class=\"text-muted-foreground block min-w-0 truncate text-xs\">{{ opt.description }}</span>\n }\n </div>\n }\n </div>\n }\n @if (canLoadMore()) {\n <div #loadMoreSentinel class=\"h-px w-full shrink-0\"></div>\n }\n @if (isLoadingMore()) {\n <div\n class=\"z-autocomplete-loading-more from-popover via-popover/95 sticky bottom-0 -mx-1 -mb-1 flex items-center justify-center bg-gradient-to-t to-transparent pt-6 pb-2\"\n animate.enter=\"z-autocomplete-loading-enter\"\n animate.leave=\"z-autocomplete-loading-leave\">\n <z-loading zSize=\"xs\" [zLoading]=\"true\" />\n </div>\n }\n </div>\n }\n }\n </div>\n</ng-template>\n", styles: [".z-autocomplete-wrapper{width:100%}.z-autocomplete-trigger{-webkit-user-select:none;user-select:none}.z-autocomplete-trigger:focus-within{outline:none}.z-autocomplete-trigger *{cursor:inherit}.z-autocomplete-input{text-overflow:ellipsis;overflow:hidden}.z-autocomplete-input::placeholder{color:hsl(var(--muted-foreground))}.z-autocomplete-input:disabled{cursor:not-allowed}.z-autocomplete-open-bottom{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.z-autocomplete-open-top{border-top-left-radius:0!important;border-top-right-radius:0!important}.z-autocomplete-dropdown{animation:z-autocomplete-dropdown-from-top .15s ease-out}.z-autocomplete-dropdown-bottom{animation:z-autocomplete-dropdown-from-bottom .15s ease-out}@keyframes z-autocomplete-dropdown-from-top{0%{opacity:0;transform:translateY(-.5rem)}to{opacity:1;transform:translateY(0)}}@keyframes z-autocomplete-dropdown-from-bottom{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}.z-autocomplete-separator{display:none}.z-autocomplete-options{overflow-x:hidden!important;overflow-anchor:none}.z-autocomplete-scrollbar{--scrollbar-padding: 0;--scrollbar-track-color: transparent;--scrollbar-thumb-color: hsl(var(--muted-foreground) / .3);--scrollbar-thumb-hover-color: hsl(var(--muted-foreground) / .5);--scrollbar-size: 6px}.z-autocomplete-virtual-scroll .z-autocomplete-virtual-inner{width:100%}.z-autocomplete-content-state{animation:z-autocomplete-content-fade-in .15s ease-out}@keyframes z-autocomplete-content-fade-in{0%{opacity:0}to{opacity:1}}.z-autocomplete-option mark{background:transparent;color:hsl(var(--primary));font-weight:600}.z-autocomplete-option{transition:background-color .1s ease,color .1s ease}.z-autocomplete-options:not(.z-autocomplete-virtual-scroll) .z-autocomplete-option{animation:z-autocomplete-option-enter .12s ease-out;animation-fill-mode:both}@keyframes z-autocomplete-option-enter{0%{opacity:0}to{opacity:1}}.z-autocomplete-loading-enter{animation:z-autocomplete-loading-fade-in .2s ease-out}.z-autocomplete-loading-leave{animation:z-autocomplete-loading-fade-out .15s ease-in}@keyframes z-autocomplete-loading-fade-in{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}@keyframes z-autocomplete-loading-fade-out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(.5rem)}}@media(prefers-reduced-motion:reduce){.z-autocomplete-loading-enter,.z-autocomplete-loading-leave{animation-duration:1ms}}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ZIconComponent, selector: "z-icon, [z-icon]", inputs: ["class", "zType", "zAnimatedType", "zAnimate", "zAnimationTrigger", "zSize", "zStrokeWidth", "zSvg"] }, { kind: "component", type: ZLoadingComponent, selector: "z-loading", inputs: ["class", "zSpinner", "zSize", "zColor", "zText", "zOverlay", "zOverlayType", "zFullscreen", "zLoading"] }, { kind: "directive", type: ZPopoverDirective, selector: "[z-popover]", inputs: ["zPopoverContent", "zPosition", "zTrigger", "zPopoverTrigger", "zClass", "zShowDelay", "zHideDelay", "zDisabled", "zOffset", "zPopoverWidth", "zTriggerRef", "zManualClose", "zOutsideClickClose", "zScrollClose", "zSticky", "zShowArrow", "zKeyboardSafe"], outputs: ["zShow", "zHide", "zHideStart", "zControl", "zPositionChange", "zOutsideClick"], exportAs: ["zPopover"] }, { kind: "directive", type: ZTooltipDirective, selector: "[z-tooltip], [zTooltip]", inputs: ["zContent", "zContext", "zPosition", "zTooltipPosition", "zTrigger", "zTooltipTrigger", "zTooltipType", "zTooltipSize", "zClass", "zTooltipClass", "zShowDelay", "zTooltipShowDelay", "zHideDelay", "zTooltipHideDelay", "zArrow", "zTooltipArrow", "zDisabled", "zTooltipDisabled", "zOffset", "zTooltipOffset", "zAutoDetect", "zTriggerElement", "zAlwaysShow", "zMaxWidth"], outputs: ["zShow", "zHide"], exportAs: ["zTooltip"] }, { kind: "component", type: ZEmptyComponent, selector: "z-empty", inputs: ["class", "zType", "zIcon", "zIconSize", "zSize", "zMessage", "zDescription"] }, { kind: "directive", type: ZHoverGlideDirective, selector: "[zHoverGlide]", inputs: ["zHoverGlideSelector", "zHoverGlideClass", "zHoverGlideDisabled"] }, { kind: "pipe", type: ZHighlightPipe, name: "zHighlight" }, { kind: "pipe", type: ZSafeHtmlPipe, name: "zSafeHtml" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1183
- }
1184
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: ZAutocompleteComponent, decorators: [{
1185
- type: Component,
1186
- args: [{ selector: 'z-autocomplete', imports: [
1187
- FormsModule,
1188
- NgClass,
1189
- NgTemplateOutlet,
1190
- ZIconComponent,
1191
- ZLoadingComponent,
1192
- ZPopoverDirective,
1193
- ZTooltipDirective,
1194
- ZEmptyComponent,
1195
- ZHighlightPipe,
1196
- ZSafeHtmlPipe,
1197
- ZHoverGlideDirective,
1198
- ], standalone: true, providers: [
1199
- {
1200
- provide: NG_VALUE_ACCESSOR,
1201
- useExisting: forwardRef(() => ZAutocompleteComponent),
1202
- multi: true,
1203
- },
1204
- ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'zAutocomplete', template: "<div class=\"z-autocomplete-wrapper relative flex w-full flex-col gap-2\">\n @if (zLabel()) {\n <label [for]=\"autocompleteId\" class=\"text-xs leading-none font-medium\" [class]=\"zLabelClass()\">\n {{ zLabel() }}\n @if (zRequired()) {\n <span class=\"text-destructive! ml-0.5\">*</span>\n }\n </label>\n }\n\n <div\n #triggerEl\n z-popover\n [zPopoverContent]=\"dropdownTpl\"\n [zOffset]=\"0\"\n [zDisabled]=\"isInteractionDisabled()\"\n zPopoverWidth=\"trigger\"\n zPopoverTrigger=\"manual\"\n zPosition=\"bottom\"\n zClass=\"border-0 shadow-none bg-transparent p-0\"\n (zControl)=\"onPopoverControl($event)\"\n (zShow)=\"onPopoverShow()\"\n (zHideStart)=\"onPopoverHideStart()\"\n (zHide)=\"onPopoverHideEnd()\"\n (zPositionChange)=\"onPositionChange($event)\"\n class=\"z-autocomplete-trigger\"\n [class]=\"inputClasses()\"\n z-tooltip\n [zContent]=\"inputValue()\"\n [zTooltipShowDelay]=\"300\"\n zTooltipTrigger=\"hover\"\n zTooltipPosition=\"top\"\n [zTooltipDisabled]=\"uiState().isFocused || uiState().isOpen || !hasValue()\"\n [zTriggerElement]=\"inputEl\"\n [class.z-autocomplete-open]=\"uiState().isOpen\"\n [class.z-autocomplete-open-top]=\"uiState().isOpen && isPositionTop()\"\n [class.z-autocomplete-open-bottom]=\"uiState().isOpen && !isPositionTop()\"\n role=\"combobox\"\n [attr.aria-expanded]=\"uiState().isOpen\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"dropdownId\">\n @if (zPrefix()) {\n <z-icon [zType]=\"zPrefix() || 'lucideSearch'\" zSize=\"16\" class=\"text-muted-foreground shrink-0\" />\n }\n\n <input\n #inputEl\n [id]=\"autocompleteId\"\n type=\"text\"\n class=\"z-autocomplete-input placeholder:text-muted-foreground min-w-0 flex-1 overflow-hidden bg-transparent text-ellipsis whitespace-nowrap outline-none\"\n [class.text-sm]=\"zSize() === 'sm' || zSize() === 'default'\"\n [placeholder]=\"zPlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"isReadonly()\"\n [value]=\"inputValue()\"\n (mousedown)=\"onInputMousedown($event)\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n (click)=\"onInputClick()\"\n (keydown)=\"onKeydown($event)\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\" />\n\n @if (isLoading() || isLoadingState() || isLoadingMore()) {\n <z-icon zType=\"lucideLoaderCircle\" zSize=\"16\" class=\"text-muted-foreground shrink-0 animate-spin\" />\n } @else {\n @if (zAllowClear() && hasValue() && !isDisabled() && !isReadonly()) {\n <button\n type=\"button\"\n class=\"text-muted-foreground hover:text-foreground flex shrink-0 cursor-pointer items-center justify-center transition-colors\"\n (mousedown)=\"clearInput($event)\"\n tabindex=\"-1\">\n <z-icon zType=\"lucideX\" zSize=\"18\" class=\"cursor-pointer!\" />\n </button>\n }\n\n @if (zSuffix()) {\n <z-icon [zType]=\"zSuffix() || 'lucideSearch'\" zSize=\"16\" class=\"text-muted-foreground shrink-0\" />\n }\n }\n </div>\n</div>\n\n<ng-template #dropdownTpl let-close=\"close\">\n <div\n [id]=\"dropdownId\"\n class=\"z-autocomplete-dropdown bg-popover border-ring overflow-hidden border shadow-[var(--z-popover-shadow)]\"\n [class.z-autocomplete-dropdown-bottom]=\"!isPositionTop()\"\n [class.rounded-b-sm]=\"!isPositionTop()\"\n [class.rounded-t-sm]=\"isPositionTop()\"\n [class.border-t-0]=\"!isPositionTop()\"\n [class.border-b-0]=\"isPositionTop()\"\n [style.width.px]=\"dropdownWidth()\"\n role=\"listbox\"\n (mousedown)=\"$event.preventDefault()\">\n @if (isLoading() || isLoadingState()) {\n <div\n class=\"z-autocomplete-content-state flex flex-col items-center justify-center\"\n [style.minHeight.px]=\"effectiveHeightExpand()\">\n <z-loading [zLoading]=\"true\" zSize=\"default\" />\n </div>\n } @else {\n @if (filteredOptions().length === 0) {\n <!-- Empty State -->\n <div\n class=\"z-autocomplete-content-state flex flex-col items-center justify-center p-1\"\n [style.minHeight.px]=\"effectiveHeightExpand()\">\n @if (inputValue().trim() !== '') {\n <!-- Searched but no results -->\n <z-empty [zIcon]=\"zEmptyIcon()\" zSize=\"sm\" [zMessage]=\"effectiveEmptyText()\" />\n } @else {\n <!-- No data initially -->\n <z-empty [zIcon]=\"zNoDataIcon()\" zSize=\"sm\" [zMessage]=\"effectiveNoDataText()\" />\n }\n </div>\n } @else if (shouldUseVirtualScroll()) {\n <!-- Virtual Scroll Mode -->\n <div\n #virtualScrollElement\n zHoverGlide\n zHoverGlideClass=\"bg-primary/15 rounded-(--radius-sm)\"\n class=\"z-autocomplete-content-state z-autocomplete-options z-autocomplete-virtual-scroll relative overflow-x-hidden overflow-y-auto overscroll-y-contain p-1\"\n [style.height.px]=\"effectiveHeightExpand()\">\n <div class=\"z-autocomplete-virtual-inner relative\" [style.height.px]=\"virtualizer.getTotalSize()\">\n @for (virtualItem of virtualizer.getVirtualItems(); track virtualItem.index) {\n @let opt = filteredOptions()[virtualItem.index];\n @let isActive = activeIndex() === virtualItem.index;\n <div\n #virtualOptionEl\n data-glide-item\n class=\"z-autocomplete-option absolute right-0 left-0 min-w-0\"\n [ngClass]=\"getOptionClasses(opt, virtualItem.index)\"\n [attr.data-index]=\"virtualItem.index\"\n [style.display]=\"hasCustomOptionTemplate() ? 'block' : null\"\n [style.height.px]=\"zDynamicSize() ? null : effectiveOptionHeight()\"\n [style.minHeight.px]=\"zDynamicSize() ? effectiveOptionHeight() : null\"\n [style.overflow]=\"hasCustomOptionTemplate() ? 'visible' : null\"\n [style.transform]=\"'translateY(' + virtualItem.start + 'px) translateZ(0)'\"\n [attr.aria-selected]=\"isActive\"\n role=\"option\"\n (mouseenter)=\"activeIndex.set(virtualItem.index)\"\n (click)=\"selectOption(opt)\">\n @if (effectiveOptionTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"effectiveOptionTemplate()!; context: { $implicit: opt, active: isActive }\" />\n } @else {\n @if (opt.icon) {\n <z-icon [zType]=\"opt.icon\" zSize=\"16\" class=\"shrink-0\" />\n }\n <div class=\"min-w-0 flex-1\">\n <span\n class=\"block min-w-0 truncate\"\n z-tooltip\n [zContent]=\"opt.label\"\n [zShowDelay]=\"300\"\n zPosition=\"top\"\n [zHideDelay]=\"0\"\n [zOffset]=\"5\"\n [zArrow]=\"false\"\n [zTriggerElement]=\"virtualOptionEl\"\n [innerHTML]=\"\n config().highlightMatch ? (opt.label | zHighlight: highlightQuery() | zSafeHtml) : opt.label\n \"></span>\n @if (opt.description) {\n <span class=\"text-muted-foreground block min-w-0 truncate text-xs\">{{ opt.description }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n @if (isLoadingMore()) {\n <div\n class=\"z-autocomplete-loading-more from-popover via-popover/95 sticky bottom-0 -mx-1 -mb-1 flex items-center justify-center bg-gradient-to-t to-transparent pt-6 pb-2\"\n animate.enter=\"z-autocomplete-loading-enter\"\n animate.leave=\"z-autocomplete-loading-leave\">\n <z-loading zSize=\"xs\" [zLoading]=\"true\" />\n </div>\n }\n </div>\n } @else {\n <!-- Normal Scroll Mode -->\n <div\n #optionsContainer\n zHoverGlide\n zHoverGlideClass=\"bg-primary/15 rounded-(--radius-sm)\"\n class=\"z-autocomplete-content-state z-autocomplete-options flex flex-col gap-0.75 overflow-x-hidden overflow-y-auto overscroll-y-contain p-1\"\n [style.minHeight.px]=\"effectiveHeightExpand()\"\n [style.maxHeight.px]=\"effectiveHeightExpand()\">\n @for (item of optionViews(); track item.trackKey) {\n @let opt = item.option;\n @let i = item.index;\n @let isActive = activeIndex() === i;\n <div\n #optionEl2\n data-glide-item\n class=\"z-autocomplete-option relative min-w-0\"\n [ngClass]=\"getOptionClasses(opt, i)\"\n [style.display]=\"hasCustomOptionTemplate() ? 'block' : null\"\n [style.minHeight.px]=\"hasCustomOptionTemplate() ? null : effectiveOptionHeight()\"\n [style.overflow]=\"hasCustomOptionTemplate() ? 'visible' : null\"\n [attr.aria-selected]=\"isActive\"\n role=\"option\"\n (mouseenter)=\"activeIndex.set(i)\"\n (click)=\"selectOption(opt)\">\n @if (effectiveOptionTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"effectiveOptionTemplate()!; context: { $implicit: opt, active: isActive }\" />\n } @else {\n @if (opt.icon) {\n <z-icon [zType]=\"opt.icon\" zSize=\"16\" class=\"shrink-0\" />\n }\n <div class=\"min-w-0 flex-1\">\n <span\n class=\"block min-w-0 truncate\"\n z-tooltip\n [zContent]=\"opt.label\"\n [zShowDelay]=\"300\"\n zPosition=\"top\"\n [zHideDelay]=\"0\"\n [zOffset]=\"5\"\n [zArrow]=\"false\"\n [zTriggerElement]=\"optionEl2\"\n [innerHTML]=\"\n config().highlightMatch ? (opt.label | zHighlight: highlightQuery() | zSafeHtml) : opt.label\n \"></span>\n @if (opt.description) {\n <span class=\"text-muted-foreground block min-w-0 truncate text-xs\">{{ opt.description }}</span>\n }\n </div>\n }\n </div>\n }\n @if (canLoadMore()) {\n <div #loadMoreSentinel class=\"h-px w-full shrink-0\"></div>\n }\n @if (isLoadingMore()) {\n <div\n class=\"z-autocomplete-loading-more from-popover via-popover/95 sticky bottom-0 -mx-1 -mb-1 flex items-center justify-center bg-gradient-to-t to-transparent pt-6 pb-2\"\n animate.enter=\"z-autocomplete-loading-enter\"\n animate.leave=\"z-autocomplete-loading-leave\">\n <z-loading zSize=\"xs\" [zLoading]=\"true\" />\n </div>\n }\n </div>\n }\n }\n </div>\n</ng-template>\n", styles: [".z-autocomplete-wrapper{width:100%}.z-autocomplete-trigger{-webkit-user-select:none;user-select:none}.z-autocomplete-trigger:focus-within{outline:none}.z-autocomplete-trigger *{cursor:inherit}.z-autocomplete-input{text-overflow:ellipsis;overflow:hidden}.z-autocomplete-input::placeholder{color:hsl(var(--muted-foreground))}.z-autocomplete-input:disabled{cursor:not-allowed}.z-autocomplete-open-bottom{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.z-autocomplete-open-top{border-top-left-radius:0!important;border-top-right-radius:0!important}.z-autocomplete-dropdown{animation:z-autocomplete-dropdown-from-top .15s ease-out}.z-autocomplete-dropdown-bottom{animation:z-autocomplete-dropdown-from-bottom .15s ease-out}@keyframes z-autocomplete-dropdown-from-top{0%{opacity:0;transform:translateY(-.5rem)}to{opacity:1;transform:translateY(0)}}@keyframes z-autocomplete-dropdown-from-bottom{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}.z-autocomplete-separator{display:none}.z-autocomplete-options{overflow-x:hidden!important;overflow-anchor:none}.z-autocomplete-scrollbar{--scrollbar-padding: 0;--scrollbar-track-color: transparent;--scrollbar-thumb-color: hsl(var(--muted-foreground) / .3);--scrollbar-thumb-hover-color: hsl(var(--muted-foreground) / .5);--scrollbar-size: 6px}.z-autocomplete-virtual-scroll .z-autocomplete-virtual-inner{width:100%}.z-autocomplete-content-state{animation:z-autocomplete-content-fade-in .15s ease-out}@keyframes z-autocomplete-content-fade-in{0%{opacity:0}to{opacity:1}}.z-autocomplete-option mark{background:transparent;color:hsl(var(--primary));font-weight:600}.z-autocomplete-option{transition:background-color .1s ease,color .1s ease}.z-autocomplete-options:not(.z-autocomplete-virtual-scroll) .z-autocomplete-option{animation:z-autocomplete-option-enter .12s ease-out;animation-fill-mode:both}@keyframes z-autocomplete-option-enter{0%{opacity:0}to{opacity:1}}.z-autocomplete-loading-enter{animation:z-autocomplete-loading-fade-in .2s ease-out}.z-autocomplete-loading-leave{animation:z-autocomplete-loading-fade-out .15s ease-in}@keyframes z-autocomplete-loading-fade-in{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}@keyframes z-autocomplete-loading-fade-out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(.5rem)}}@media(prefers-reduced-motion:reduce){.z-autocomplete-loading-enter,.z-autocomplete-loading-leave{animation-duration:1ms}}\n"] }]
1205
- }], ctorParameters: () => [], propDecorators: { triggerRef: [{ type: i0.ViewChild, args: ['triggerEl', { isSignal: true }] }], inputRef: [{ type: i0.ViewChild, args: ['inputEl', { isSignal: true }] }], dropdownTpl: [{ type: i0.ViewChild, args: ['dropdownTpl', { isSignal: true }] }], virtualScrollRef: [{ type: i0.ViewChild, args: ['virtualScrollElement', { isSignal: true }] }], optionsContainerRef: [{ type: i0.ViewChild, args: ['optionsContainer', { isSignal: true }] }], loadMoreSentinelRef: [{ type: i0.ViewChild, args: ['loadMoreSentinel', { isSignal: true }] }], virtualOptionElements: [{ type: i0.ViewChildren, args: ['virtualOptionEl', { isSignal: true }] }], customOptionDirective: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ZAutocompleteOptionDirective), { isSignal: true }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], zOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOptions", required: false }] }], zConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "zConfig", required: false }] }], zSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "zSize", required: false }] }], zType: [{ type: i0.Input, args: [{ isSignal: true, alias: "zType", required: false }] }], zLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "zLabel", required: false }] }], zLabelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "zLabelClass", required: false }] }], zPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "zPlaceholder", required: false }] }], zDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDisabled", required: false }] }], zReadonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "zReadonly", required: false }] }], zLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "zLoading", required: false }] }], zLoadingOutline: [{ type: i0.Input, args: [{ isSignal: true, alias: "zLoadingOutline", required: false }] }], zRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "zRequired", required: false }] }], zPrefix: [{ type: i0.Input, args: [{ isSignal: true, alias: "zPrefix", required: false }] }], zSuffix: [{ type: i0.Input, args: [{ isSignal: true, alias: "zSuffix", required: false }] }], zAllowClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "zAllowClear", required: false }] }], zVirtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "zVirtualScroll", required: false }] }], zDynamicSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDynamicSize", required: false }] }], zOptionHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOptionHeight", required: false }] }], zDropdownMaxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDropdownMaxHeight", required: false }] }], zHeightExpand: [{ type: i0.Input, args: [{ isSignal: true, alias: "zHeightExpand", required: false }] }], zMaxVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "zMaxVisible", required: false }] }], zResetOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "zResetOnSelect", required: false }] }], zEmptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "zEmptyText", required: false }] }], zEmptyIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "zEmptyIcon", required: false }] }], zNoDataText: [{ type: i0.Input, args: [{ isSignal: true, alias: "zNoDataText", required: false }] }], zNoDataIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "zNoDataIcon", required: false }] }], zAllowCustomValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "zAllowCustomValue", required: false }] }], zOpenOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOpenOnFocus", required: false }] }], zDebounceTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDebounceTime", required: false }] }], zLoadingMore: [{ type: i0.Input, args: [{ isSignal: true, alias: "zLoadingMore", required: false }] }], zEnableLoadMore: [{ type: i0.Input, args: [{ isSignal: true, alias: "zEnableLoadMore", required: false }] }], zScrollDistance: [{ type: i0.Input, args: [{ isSignal: true, alias: "zScrollDistance", required: false }] }], zKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "zKey", required: false }] }], zOptionTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOptionTemplate", required: false }] }], zOnSearch: [{ type: i0.Output, args: ["zOnSearch"] }], zOnLoadMore: [{ type: i0.Output, args: ["zOnLoadMore"] }], zOnSelect: [{ type: i0.Output, args: ["zOnSelect"] }], zOnEnter: [{ type: i0.Output, args: ["zOnEnter"] }], zOnCommit: [{ type: i0.Output, args: ["zOnCommit"] }], zValueChange: [{ type: i0.Output, args: ["zValueChange"] }], zOnBlur: [{ type: i0.Output, args: ["zOnBlur"] }], zOnFocus: [{ type: i0.Output, args: ["zOnFocus"] }], zControl: [{ type: i0.Output, args: ["zControl"] }], zEvent: [{ type: i0.Output, args: ["zEvent"] }] } });
1206
-
1207
- /**
1208
- * Generated bundle index. Do not edit.
1209
- */
1210
-
1211
- export { ZAutocompleteComponent, ZAutocompleteOptionDirective, Z_AUTOCOMPLETE_DEFAULT_CONFIG, zAutocompleteInputVariants, zAutocompleteOptionVariants };
1212
- //# sourceMappingURL=shival99-z-ui-components-z-autocomplete.mjs.map