@shival99/z-ui 2.6.8 → 2.6.10

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 (58) hide show
  1. package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs +1211 -0
  2. package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs.map +1 -0
  3. package/fesm2022/shival99-z-ui-components-z-drawer.mjs +991 -0
  4. package/fesm2022/shival99-z-ui-components-z-drawer.mjs.map +1 -0
  5. package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs +99 -0
  6. package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs.map +1 -0
  7. package/fesm2022/shival99-z-ui-components-z-editor.mjs +16 -6
  8. package/fesm2022/shival99-z-ui-components-z-editor.mjs.map +1 -1
  9. package/fesm2022/shival99-z-ui-components-z-filter.mjs +962 -0
  10. package/fesm2022/shival99-z-ui-components-z-filter.mjs.map +1 -0
  11. package/fesm2022/shival99-z-ui-components-z-gallery.mjs +2 -2
  12. package/fesm2022/shival99-z-ui-components-z-gallery.mjs.map +1 -1
  13. package/fesm2022/shival99-z-ui-components-z-number-ticker.mjs +352 -0
  14. package/fesm2022/shival99-z-ui-components-z-number-ticker.mjs.map +1 -0
  15. package/fesm2022/shival99-z-ui-components-z-pagination.mjs +179 -0
  16. package/fesm2022/shival99-z-ui-components-z-pagination.mjs.map +1 -0
  17. package/fesm2022/shival99-z-ui-components-z-qrcode.mjs +429 -0
  18. package/fesm2022/shival99-z-ui-components-z-qrcode.mjs.map +1 -0
  19. package/fesm2022/shival99-z-ui-components-z-radio.mjs +183 -0
  20. package/fesm2022/shival99-z-ui-components-z-radio.mjs.map +1 -0
  21. package/fesm2022/shival99-z-ui-components-z-scrollarea.mjs +137 -0
  22. package/fesm2022/shival99-z-ui-components-z-scrollarea.mjs.map +1 -0
  23. package/fesm2022/shival99-z-ui-components-z-show-more.mjs +138 -0
  24. package/fesm2022/shival99-z-ui-components-z-show-more.mjs.map +1 -0
  25. package/fesm2022/shival99-z-ui-components-z-skeleton-auto.mjs +80 -0
  26. package/fesm2022/shival99-z-ui-components-z-skeleton-auto.mjs.map +1 -0
  27. package/fesm2022/shival99-z-ui-components-z-steps.mjs +420 -0
  28. package/fesm2022/shival99-z-ui-components-z-steps.mjs.map +1 -0
  29. package/fesm2022/shival99-z-ui-components-z-table.mjs +11424 -0
  30. package/fesm2022/shival99-z-ui-components-z-table.mjs.map +1 -0
  31. package/fesm2022/shival99-z-ui-components-z-tabs.mjs +1102 -0
  32. package/fesm2022/shival99-z-ui-components-z-tabs.mjs.map +1 -0
  33. package/fesm2022/shival99-z-ui-components-z-tags.mjs +364 -0
  34. package/fesm2022/shival99-z-ui-components-z-tags.mjs.map +1 -0
  35. package/fesm2022/shival99-z-ui-components-z-timeline.mjs +254 -0
  36. package/fesm2022/shival99-z-ui-components-z-timeline.mjs.map +1 -0
  37. package/fesm2022/shival99-z-ui-services-excel.mjs +672 -0
  38. package/fesm2022/shival99-z-ui-services-excel.mjs.map +1 -0
  39. package/package.json +1 -1
  40. package/types/shival99-z-ui-components-z-autocomplete.d.ts +301 -0
  41. package/types/shival99-z-ui-components-z-drawer.d.ts +298 -0
  42. package/types/shival99-z-ui-components-z-dropdown-menu.d.ts +52 -0
  43. package/types/shival99-z-ui-components-z-editor.d.ts +3 -3
  44. package/types/shival99-z-ui-components-z-filter.d.ts +285 -0
  45. package/types/shival99-z-ui-components-z-modal.d.ts +1 -1
  46. package/types/shival99-z-ui-components-z-number-ticker.d.ts +110 -0
  47. package/types/shival99-z-ui-components-z-pagination.d.ts +55 -0
  48. package/types/shival99-z-ui-components-z-qrcode.d.ts +79 -0
  49. package/types/shival99-z-ui-components-z-radio.d.ts +69 -0
  50. package/types/shival99-z-ui-components-z-scrollarea.d.ts +48 -0
  51. package/types/shival99-z-ui-components-z-show-more.d.ts +36 -0
  52. package/types/shival99-z-ui-components-z-skeleton-auto.d.ts +35 -0
  53. package/types/shival99-z-ui-components-z-steps.d.ts +106 -0
  54. package/types/shival99-z-ui-components-z-table.d.ts +2386 -0
  55. package/types/shival99-z-ui-components-z-tabs.d.ts +196 -0
  56. package/types/shival99-z-ui-components-z-tags.d.ts +127 -0
  57. package/types/shival99-z-ui-components-z-timeline.d.ts +71 -0
  58. package/types/shival99-z-ui-services-excel.d.ts +36 -0
@@ -0,0 +1,1211 @@
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 Use `zDropdownMaxHeight` for consistency with 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
+ // Measure after a real focus/click so transformed ancestors have finished animating.
759
+ const triggerEl = this.triggerRef()?.nativeElement;
760
+ if (triggerEl) {
761
+ this.dropdownWidth.set(triggerEl.getBoundingClientRect().width);
762
+ }
763
+ this._focusInputTimer.schedule(() => {
764
+ this.inputRef()?.nativeElement.focus();
765
+ }, 50);
766
+ }
767
+ onPopoverHideStart() {
768
+ this._cancelPendingInput();
769
+ this._openRequested = false;
770
+ this.uiState.update(s => ({ ...s, isOpen: false }));
771
+ this.activeIndex.set(-1);
772
+ this._clearLocalLoadingTimer();
773
+ this._pendingSearch.set(false);
774
+ this.debouncedQuery.set('');
775
+ if (!this.hasAsyncOptions()) {
776
+ this._query$.next('');
777
+ }
778
+ }
779
+ onPopoverHideEnd() {
780
+ this.actualPosition.set('bottom');
781
+ }
782
+ onPositionChange(position) {
783
+ this.actualPosition.set(position);
784
+ }
785
+ selectOption(option) {
786
+ if (option.disabled) {
787
+ return;
788
+ }
789
+ this.uiState.update(s => ({ ...s, dirty: true }));
790
+ this.zOnSelect.emit(option);
791
+ this._selectedOption.set(option);
792
+ const newValue = this.zResetOnSelect() ? '' : option.label;
793
+ this._hasPendingInput = false;
794
+ this.inputValue.set(newValue);
795
+ this._value.set(newValue);
796
+ this.debouncedQuery.set(newValue);
797
+ this._onChange(newValue);
798
+ this.zValueChange.emit(newValue);
799
+ this._valueBeforeNavigation = null;
800
+ if (this.config().closeOnSelect) {
801
+ this._closePanel();
802
+ }
803
+ this.activeIndex.set(-1);
804
+ }
805
+ clearInput(event) {
806
+ event.stopPropagation();
807
+ event.preventDefault();
808
+ this._hasPendingInput = false;
809
+ this.inputValue.set('');
810
+ this._value.set('');
811
+ this.uiState.update(s => ({ ...s, dirty: true }));
812
+ this._onChange('');
813
+ this.zValueChange.emit('');
814
+ this._selectedOption.set(null);
815
+ this._closePanel();
816
+ this._clearLocalLoadingTimer();
817
+ this._pendingSearch.set(false);
818
+ this.debouncedQuery.set('');
819
+ if (this.zType() === 'address_bar') {
820
+ this.searchQuery.set('');
821
+ }
822
+ if (!this.hasAsyncOptions()) {
823
+ this._query$.next('');
824
+ }
825
+ this.zOnCommit.emit({ value: '', source: 'blur' });
826
+ this._resetAsyncOptions();
827
+ this._focusInputTimer.schedule(() => {
828
+ this.inputRef()?.nativeElement.focus();
829
+ });
830
+ }
831
+ getOptionClasses(option, index) {
832
+ return zAutocompleteOptionVariants({
833
+ customTemplate: this.hasCustomOptionTemplate(),
834
+ active: this.activeIndex() === index,
835
+ disabled: option.disabled ?? false,
836
+ });
837
+ }
838
+ trackByValue = (index, option) => {
839
+ const key = this._getOptionKey(option);
840
+ return `${String(key)}::${index}`;
841
+ };
842
+ focus() {
843
+ this.inputRef()?.nativeElement.focus();
844
+ }
845
+ blur() {
846
+ this.inputRef()?.nativeElement.blur();
847
+ }
848
+ clear() {
849
+ this._hasPendingInput = false;
850
+ this.inputValue.set('');
851
+ this._value.set('');
852
+ this.debouncedQuery.set('');
853
+ const inputEl = this.inputRef()?.nativeElement;
854
+ if (inputEl) {
855
+ inputEl.value = '';
856
+ }
857
+ this._onChange('');
858
+ this.zValueChange.emit('');
859
+ this._selectedOption.set(null);
860
+ this._closePanel();
861
+ this._clearLocalLoadingTimer();
862
+ this._pendingSearch.set(false);
863
+ this._resetAsyncOptions();
864
+ if (this.zType() === 'address_bar') {
865
+ this.searchQuery.set('');
866
+ }
867
+ }
868
+ reset() {
869
+ this.clear();
870
+ this.uiState.update(s => ({ ...s, touched: false, dirty: false }));
871
+ }
872
+ open() {
873
+ this._openPanel();
874
+ }
875
+ close() {
876
+ this._closePanel();
877
+ }
878
+ setValue(value) {
879
+ this._hasPendingInput = false;
880
+ this._value.set(value);
881
+ this.inputValue.set(value);
882
+ this.debouncedQuery.set(value);
883
+ this._selectedOption.set(null);
884
+ this._onChange(value);
885
+ if (this.zType() === 'address_bar') {
886
+ this.searchQuery.set(value);
887
+ }
888
+ }
889
+ _openPanel() {
890
+ if (this.isInteractionDisabled() || this._openRequested || this.uiState().isOpen) {
891
+ return;
892
+ }
893
+ this._openRequested = true;
894
+ this._popoverControl()?.show();
895
+ }
896
+ _closePanel() {
897
+ this._popoverControl()?.close();
898
+ }
899
+ _cancelPendingInput() {
900
+ if (!this._hasPendingInput) {
901
+ return;
902
+ }
903
+ this._hasPendingInput = false;
904
+ this.clear();
905
+ }
906
+ _setupDebounce() {
907
+ this._query$
908
+ .pipe(debounceTime(this.effectiveDebounceTime()), distinctUntilChanged(), takeUntilDestroyed(this._destroyRef))
909
+ .subscribe(query => {
910
+ if (this.zType() === 'address_bar') {
911
+ this.searchQuery.set(query);
912
+ }
913
+ this.debouncedQuery.set(query);
914
+ this.zOnSearch.emit(query);
915
+ if (this.hasAsyncOptions()) {
916
+ this._loadAsyncOptions(query, false);
917
+ return;
918
+ }
919
+ if (this.config().serverSearch) {
920
+ this._pendingServerSearchScrollReset = true;
921
+ return;
922
+ }
923
+ this._resetOptionsScrollTop();
924
+ this._clearLocalLoadingTimer();
925
+ this._pendingSearch.set(true);
926
+ this._localLoadingTimer.schedule(() => {
927
+ this._pendingSearch.set(false);
928
+ }, 100);
929
+ });
930
+ }
931
+ _loadAsyncOptionsOnFocus() {
932
+ const asyncConfig = this.config().async;
933
+ if (!asyncConfig?.loadOnFocus) {
934
+ return;
935
+ }
936
+ const keyword = this.inputValue().trim();
937
+ if (this._asyncKeyword() === keyword && this._asyncOptions().length > 0) {
938
+ return;
939
+ }
940
+ this._loadAsyncOptions(keyword, false);
941
+ }
942
+ _loadAsyncOptions(keyword, append) {
943
+ const asyncConfig = this.config().async;
944
+ if (!asyncConfig) {
945
+ return;
946
+ }
947
+ const normalizedKeyword = keyword.trim();
948
+ const pageSize = asyncConfig.pageSize ?? Z_ASYNC_OPTIONS_DEFAULT_PAGE_SIZE;
949
+ const { minLength } = this.config();
950
+ const canLoadEmptyOnFocus = asyncConfig.loadOnFocus && normalizedKeyword.length === 0;
951
+ if (!append && normalizedKeyword.length < minLength && !canLoadEmptyOnFocus) {
952
+ this._resetAsyncOptions();
953
+ return;
954
+ }
955
+ if (append && (!this._asyncHasMore() || this._asyncLoading() || this._asyncLoadingMore())) {
956
+ return;
957
+ }
958
+ const page = append ? this._asyncPage() + 1 : 1;
959
+ const requestId = ++this._asyncRequestId;
960
+ const scrollTopBeforeAppend = append ? this._getAsyncOptionsScrollTop() : null;
961
+ if (!append) {
962
+ this._asyncLoadSubscription?.unsubscribe();
963
+ this._asyncKeyword.set(normalizedKeyword);
964
+ this._asyncLoading.set(true);
965
+ this._asyncHasMore.set(false);
966
+ }
967
+ else {
968
+ this._asyncLoadingMore.set(true);
969
+ }
970
+ let result;
971
+ try {
972
+ result = asyncConfig.load({
973
+ keyword: normalizedKeyword,
974
+ page,
975
+ pageSize,
976
+ });
977
+ }
978
+ catch (error) {
979
+ this._handleAsyncOptionsError(error, append);
980
+ return;
981
+ }
982
+ this._asyncLoadSubscription = zToAsyncOptionsObservable(result)
983
+ .pipe(finalize(() => {
984
+ if (requestId !== this._asyncRequestId) {
985
+ return;
986
+ }
987
+ this._asyncLoading.set(false);
988
+ this._asyncLoadingMore.set(false);
989
+ }), takeUntilDestroyed(this._destroyRef))
990
+ .subscribe({
991
+ next: response => {
992
+ if (requestId !== this._asyncRequestId) {
993
+ return;
994
+ }
995
+ const nextItems = response.items ?? [];
996
+ const previousCount = this._asyncOptions().length;
997
+ const mergedOptions = append
998
+ ? zMergeAsyncOptions(this._asyncOptions(), nextItems, asyncConfig.dedupeBy)
999
+ : zMergeAsyncOptions([], nextItems, asyncConfig.dedupeBy);
1000
+ const hasNewItems = mergedOptions.length > previousCount;
1001
+ if (append && !hasNewItems) {
1002
+ this._asyncHasMore.set(false);
1003
+ this._restoreAsyncOptionsScrollTop(scrollTopBeforeAppend);
1004
+ return;
1005
+ }
1006
+ this._asyncOptions.set(mergedOptions);
1007
+ this._asyncPage.set(page);
1008
+ this._asyncHasMore.set(append && !hasNewItems ? false : zResolveAsyncOptionsHasMore(response, pageSize, mergedOptions.length));
1009
+ if (append) {
1010
+ this._restoreAsyncOptionsScrollTop(scrollTopBeforeAppend);
1011
+ return;
1012
+ }
1013
+ this._resetOptionsScrollTop();
1014
+ },
1015
+ error: error => {
1016
+ if (requestId !== this._asyncRequestId) {
1017
+ return;
1018
+ }
1019
+ this._handleAsyncOptionsError(error, append);
1020
+ },
1021
+ });
1022
+ }
1023
+ _handleAsyncOptionsError(error, append) {
1024
+ console.error('ZAutocomplete async options load failed:', error);
1025
+ if (!append) {
1026
+ this._asyncOptions.set([]);
1027
+ this._asyncPage.set(1);
1028
+ }
1029
+ this._asyncHasMore.set(false);
1030
+ this._asyncLoading.set(false);
1031
+ this._asyncLoadingMore.set(false);
1032
+ }
1033
+ _getAsyncOptionsScrollTop() {
1034
+ return this._getOptionsScrollElement()?.scrollTop ?? null;
1035
+ }
1036
+ _restoreAsyncOptionsScrollTop(scrollTop) {
1037
+ if (scrollTop === null) {
1038
+ return;
1039
+ }
1040
+ requestAnimationFrame(() => {
1041
+ const scrollElement = this._getOptionsScrollElement();
1042
+ if (scrollElement) {
1043
+ scrollElement.scrollTop = scrollTop;
1044
+ }
1045
+ });
1046
+ }
1047
+ _resetOptionsScrollTop(attempt = 0) {
1048
+ requestAnimationFrame(() => {
1049
+ const scrollElement = this._getOptionsScrollElement();
1050
+ if (!scrollElement && attempt < 3) {
1051
+ this._resetOptionsScrollTop(attempt + 1);
1052
+ return;
1053
+ }
1054
+ if (!scrollElement) {
1055
+ return;
1056
+ }
1057
+ if (this.shouldUseVirtualScroll()) {
1058
+ this.virtualizer.scrollToOffset(0);
1059
+ }
1060
+ scrollElement.scrollTop = 0;
1061
+ });
1062
+ }
1063
+ _getOptionsScrollElement() {
1064
+ if (this.shouldUseVirtualScroll()) {
1065
+ return this.virtualScrollRef()?.nativeElement ?? null;
1066
+ }
1067
+ return this.optionsContainerRef()?.nativeElement ?? null;
1068
+ }
1069
+ _resetAsyncOptions() {
1070
+ this._asyncLoadSubscription?.unsubscribe();
1071
+ this._asyncRequestId++;
1072
+ this._asyncOptions.set([]);
1073
+ this._asyncKeyword.set('');
1074
+ this._asyncPage.set(1);
1075
+ this._asyncHasMore.set(false);
1076
+ this._asyncLoading.set(false);
1077
+ this._asyncLoadingMore.set(false);
1078
+ }
1079
+ _clearLocalLoadingTimer() {
1080
+ this._localLoadingTimer.cancel();
1081
+ }
1082
+ _setupLoadMoreObserver() {
1083
+ this._cleanupLoadMoreObserver();
1084
+ const sentinel = this.loadMoreSentinelRef()?.nativeElement;
1085
+ const container = this.optionsContainerRef()?.nativeElement;
1086
+ if (!sentinel || !container) {
1087
+ return;
1088
+ }
1089
+ this._loadMoreObserver = new IntersectionObserver(entries => {
1090
+ const entry = entries[0];
1091
+ if (entry?.isIntersecting && !this.isLoadingMore()) {
1092
+ this._handleLoadMore(container.scrollTop);
1093
+ }
1094
+ }, {
1095
+ root: container,
1096
+ rootMargin: '100px',
1097
+ threshold: 0,
1098
+ });
1099
+ this._loadMoreObserver.observe(sentinel);
1100
+ }
1101
+ _cleanupLoadMoreObserver() {
1102
+ if (!this._loadMoreObserver) {
1103
+ return;
1104
+ }
1105
+ this._loadMoreObserver.disconnect();
1106
+ this._loadMoreObserver = null;
1107
+ }
1108
+ _setupVirtualScrollLoadMore() {
1109
+ this._cleanupVirtualScrollListener();
1110
+ const scrollElement = this.virtualScrollRef()?.nativeElement;
1111
+ if (!scrollElement) {
1112
+ return;
1113
+ }
1114
+ const handleScroll = () => {
1115
+ if (this.isLoadingMore()) {
1116
+ return;
1117
+ }
1118
+ const { scrollTop, scrollHeight, clientHeight } = scrollElement;
1119
+ const threshold = clientHeight * this.zScrollDistance();
1120
+ const distanceFromBottom = scrollHeight - scrollTop - clientHeight;
1121
+ if (distanceFromBottom <= threshold) {
1122
+ this._handleLoadMore(scrollTop);
1123
+ }
1124
+ };
1125
+ scrollElement.addEventListener('scroll', handleScroll);
1126
+ this._virtualScrollListener = () => {
1127
+ scrollElement.removeEventListener('scroll', handleScroll);
1128
+ };
1129
+ }
1130
+ _cleanupVirtualScrollListener() {
1131
+ if (!this._virtualScrollListener) {
1132
+ return;
1133
+ }
1134
+ this._virtualScrollListener();
1135
+ this._virtualScrollListener = null;
1136
+ }
1137
+ _handleLoadMore(scrollTop) {
1138
+ if (this.hasAsyncOptions()) {
1139
+ if (!this.canLoadMore()) {
1140
+ return;
1141
+ }
1142
+ this._loadAsyncOptions(this._asyncKeyword(), true);
1143
+ return;
1144
+ }
1145
+ this.zOnLoadMore.emit({
1146
+ currentCount: this.filteredOptions().length,
1147
+ scrollTop,
1148
+ });
1149
+ }
1150
+ _emitControl() {
1151
+ this.zControl.emit({
1152
+ focus: () => this.focus(),
1153
+ blur: () => this.blur(),
1154
+ clear: () => this.clear(),
1155
+ reset: () => this.reset(),
1156
+ open: () => this.open(),
1157
+ close: () => this.close(),
1158
+ setValue: (val) => this.setValue(val),
1159
+ value: this._value.asReadonly(),
1160
+ selected: this.selected,
1161
+ state: this.state,
1162
+ });
1163
+ }
1164
+ _getOptionKey(option) {
1165
+ const key = this.zKey();
1166
+ if (key && key in option) {
1167
+ return option[key];
1168
+ }
1169
+ if (key && typeof option.value === 'object' && option.value !== null && key in option.value) {
1170
+ return option.value[key];
1171
+ }
1172
+ return option.value;
1173
+ }
1174
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: ZAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1175
+ 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: [
1176
+ {
1177
+ provide: NG_VALUE_ACCESSOR,
1178
+ useExisting: forwardRef(() => ZAutocompleteComponent),
1179
+ multi: true,
1180
+ },
1181
+ ], 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 });
1182
+ }
1183
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: ZAutocompleteComponent, decorators: [{
1184
+ type: Component,
1185
+ args: [{ selector: 'z-autocomplete', imports: [
1186
+ FormsModule,
1187
+ NgClass,
1188
+ NgTemplateOutlet,
1189
+ ZIconComponent,
1190
+ ZLoadingComponent,
1191
+ ZPopoverDirective,
1192
+ ZTooltipDirective,
1193
+ ZEmptyComponent,
1194
+ ZHighlightPipe,
1195
+ ZSafeHtmlPipe,
1196
+ ZHoverGlideDirective,
1197
+ ], standalone: true, providers: [
1198
+ {
1199
+ provide: NG_VALUE_ACCESSOR,
1200
+ useExisting: forwardRef(() => ZAutocompleteComponent),
1201
+ multi: true,
1202
+ },
1203
+ ], 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"] }]
1204
+ }], 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"] }] } });
1205
+
1206
+ /**
1207
+ * Generated bundle index. Do not edit.
1208
+ */
1209
+
1210
+ export { ZAutocompleteComponent, ZAutocompleteOptionDirective, Z_AUTOCOMPLETE_DEFAULT_CONFIG, zAutocompleteInputVariants, zAutocompleteOptionVariants };
1211
+ //# sourceMappingURL=shival99-z-ui-components-z-autocomplete.mjs.map