@ng-matero/ng-select 0.5.1 → 1.0.0

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.
@@ -1,74 +1,9 @@
1
- import { NgTemplateOutlet } from '@angular/common';
1
+ import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { Injectable, EventEmitter, inject, DOCUMENT, Renderer2, NgZone, ElementRef, booleanAttribute, ViewChild, Output, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, Directive, TemplateRef, InjectionToken, ChangeDetectorRef, HostAttributeToken, forwardRef, numberAttribute, ContentChild, ContentChildren, NgModule } from '@angular/core';
4
- import { animationFrameScheduler, asapScheduler, Subject, fromEvent, merge } from 'rxjs';
5
- import { takeUntil, auditTime, startWith, tap, debounceTime, filter, map } from 'rxjs/operators';
3
+ import { Injectable, inject, ElementRef, booleanAttribute, Input, ChangeDetectionStrategy, Component, EventEmitter, Renderer2, NgZone, ViewChild, Output, ViewEncapsulation, Directive, TemplateRef, InjectionToken, ChangeDetectorRef, HostAttributeToken, forwardRef, numberAttribute, ContentChild, ContentChildren, NgModule } from '@angular/core';
6
4
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
7
-
8
- class NgDropdownPanelUtils {
9
- get dimensions() {
10
- return this._dimensions;
11
- }
12
- _dimensions = {
13
- itemHeight: 0,
14
- panelHeight: 0,
15
- itemsPerViewport: 0,
16
- };
17
- calculateItems(scrollPos, itemsLength, buffer) {
18
- const d = this._dimensions;
19
- const scrollHeight = d.itemHeight * itemsLength;
20
- const scrollTop = Math.max(0, scrollPos);
21
- const indexByScrollTop = (scrollTop / scrollHeight) * itemsLength;
22
- let end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
23
- const maxStartEnd = end;
24
- const maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
25
- let start = Math.min(maxStart, Math.floor(indexByScrollTop));
26
- let topPadding = d.itemHeight * Math.ceil(start) - d.itemHeight * Math.min(start, buffer);
27
- topPadding = !isNaN(topPadding) ? topPadding : 0;
28
- start = !isNaN(start) ? start : -1;
29
- end = !isNaN(end) ? end : -1;
30
- start -= buffer;
31
- start = Math.max(0, start);
32
- end += buffer;
33
- end = Math.min(itemsLength, end);
34
- return {
35
- topPadding,
36
- scrollHeight,
37
- start,
38
- end,
39
- };
40
- }
41
- setDimensions(itemHeight, panelHeight) {
42
- const itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
43
- this._dimensions = {
44
- itemHeight,
45
- panelHeight,
46
- itemsPerViewport,
47
- };
48
- }
49
- getScrollTo(itemTop, itemHeight, lastScroll) {
50
- const { panelHeight } = this.dimensions;
51
- const itemBottom = itemTop + itemHeight;
52
- const top = lastScroll;
53
- const bottom = top + panelHeight;
54
- if (panelHeight >= itemBottom && lastScroll === itemTop) {
55
- return null;
56
- }
57
- if (itemBottom > bottom) {
58
- return top + itemBottom - bottom;
59
- }
60
- else if (itemTop <= top) {
61
- return itemTop;
62
- }
63
- return null;
64
- }
65
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgDropdownPanelUtils, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
66
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgDropdownPanelUtils, providedIn: 'root' });
67
- }
68
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgDropdownPanelUtils, decorators: [{
69
- type: Injectable,
70
- args: [{ providedIn: 'root' }]
71
- }] });
5
+ import { Subject, animationFrameScheduler, asapScheduler, fromEvent, merge } from 'rxjs';
6
+ import { takeUntil, auditTime, startWith, tap, debounceTime, filter, map } from 'rxjs/operators';
72
7
 
73
8
  const unescapedHTMLExp = /[&<>"']/g;
74
9
  const hasUnescapedHTMLExp = RegExp(unescapedHTMLExp.source);
@@ -107,555 +42,6 @@ var KeyCode;
107
42
  KeyCode["Backspace"] = "Backspace";
108
43
  })(KeyCode || (KeyCode = {}));
109
44
 
110
- const CSS_POSITIONS = ['top', 'right', 'bottom', 'left'];
111
- const SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? animationFrameScheduler : asapScheduler;
112
- class NgDropdownPanel {
113
- listboxId = '';
114
- items = [];
115
- markedItem;
116
- position = 'auto';
117
- appendTo;
118
- bufferAmount = 4;
119
- virtualScroll = false;
120
- headerTemplate;
121
- footerTemplate;
122
- filterValue = null;
123
- update = new EventEmitter();
124
- scroll = new EventEmitter();
125
- scrollToEnd = new EventEmitter();
126
- outsideClick = new EventEmitter();
127
- scrollHostElRef;
128
- scrollContentElRef;
129
- scrollSpacerElRef;
130
- _document = inject(DOCUMENT, { optional: true });
131
- _renderer = inject(Renderer2);
132
- _zone = inject(NgZone);
133
- _elementRef = inject(ElementRef);
134
- _panelUtils = inject(NgDropdownPanelUtils);
135
- _destroy$ = new Subject();
136
- _dropdown = this._elementRef.nativeElement;
137
- _select;
138
- _parent;
139
- _scrollHost;
140
- _scrollContent;
141
- _scrollSpacer;
142
- _scrollToEndFired = false;
143
- _updateScrollHeight = false;
144
- _lastScrollPosition = 0;
145
- get currentPosition() {
146
- return this._currentPosition;
147
- }
148
- _currentPosition = 'auto';
149
- get itemsLength() {
150
- return this._itemsLength;
151
- }
152
- set itemsLength(value) {
153
- if (value !== this._itemsLength) {
154
- this._itemsLength = value;
155
- this._onItemsLengthChanged();
156
- }
157
- }
158
- _itemsLength;
159
- get _startOffset() {
160
- if (this.markedItem) {
161
- const { itemHeight, panelHeight } = this._panelUtils.dimensions;
162
- const offset = this.markedItem.index * itemHeight;
163
- return panelHeight > offset ? 0 : offset;
164
- }
165
- return 0;
166
- }
167
- ngOnInit() {
168
- this._select = this._dropdown.parentElement;
169
- this._scrollHost = this.scrollHostElRef.nativeElement;
170
- this._scrollContent = this.scrollContentElRef.nativeElement;
171
- this._scrollSpacer = this.scrollSpacerElRef.nativeElement;
172
- this._handleScroll();
173
- this._handleOutsideClick();
174
- this._appendDropdown();
175
- this._setupMousedownListener();
176
- }
177
- ngOnChanges(changes) {
178
- if (changes['items']) {
179
- const change = changes['items'];
180
- this._onItemsChange(change.currentValue, change.firstChange);
181
- }
182
- }
183
- ngOnDestroy() {
184
- this._destroy$.next();
185
- this._destroy$.complete();
186
- this._destroy$.unsubscribe();
187
- if (this.appendTo) {
188
- this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
189
- }
190
- }
191
- scrollTo(option, startFromOption = false) {
192
- if (!option) {
193
- return;
194
- }
195
- const index = this.items.indexOf(option);
196
- if (index < 0 || index >= this.itemsLength) {
197
- return;
198
- }
199
- let scrollTo;
200
- if (this.virtualScroll) {
201
- const itemHeight = this._panelUtils.dimensions.itemHeight;
202
- scrollTo = this._panelUtils.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
203
- }
204
- else {
205
- const item = this._dropdown.querySelector(`#${option.htmlId}`);
206
- const lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
207
- scrollTo = this._panelUtils.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
208
- }
209
- if (isDefined(scrollTo)) {
210
- this._scrollHost.scrollTop = scrollTo;
211
- }
212
- }
213
- scrollToTag() {
214
- const panel = this._scrollHost;
215
- panel.scrollTop = panel.scrollHeight - panel.clientHeight;
216
- }
217
- adjustPosition() {
218
- this._updateYPosition();
219
- }
220
- _handleDropdownPosition() {
221
- this._currentPosition = this._calculateCurrentPosition(this._dropdown);
222
- if (CSS_POSITIONS.includes(this._currentPosition)) {
223
- this._updateDropdownClass(this._currentPosition);
224
- }
225
- else {
226
- this._updateDropdownClass('bottom');
227
- }
228
- if (this.appendTo) {
229
- this._updateYPosition();
230
- }
231
- this._dropdown.style.opacity = '1';
232
- }
233
- _updateDropdownClass(currentPosition) {
234
- CSS_POSITIONS.forEach(position => {
235
- const REMOVE_CSS_CLASS = `ng-select-${position}`;
236
- this._renderer.removeClass(this._dropdown, REMOVE_CSS_CLASS);
237
- this._renderer.removeClass(this._select, REMOVE_CSS_CLASS);
238
- });
239
- const ADD_CSS_CLASS = `ng-select-${currentPosition}`;
240
- this._renderer.addClass(this._dropdown, ADD_CSS_CLASS);
241
- this._renderer.addClass(this._select, ADD_CSS_CLASS);
242
- }
243
- _handleScroll() {
244
- this._zone.runOutsideAngular(() => {
245
- fromEvent(this._scrollHost, 'scroll')
246
- .pipe(takeUntil(this._destroy$), auditTime(0, SCROLL_SCHEDULER))
247
- .subscribe(e => {
248
- const path = e.path || (e.composedPath && e.composedPath());
249
- if (!path || (path.length === 0 && !e.target)) {
250
- return;
251
- }
252
- const scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;
253
- this._onContentScrolled(scrollTop);
254
- });
255
- });
256
- }
257
- _handleOutsideClick() {
258
- if (!this._document) {
259
- return;
260
- }
261
- this._zone.runOutsideAngular(() => {
262
- merge(fromEvent(this._document, 'touchstart', { capture: true }), fromEvent(this._document, 'click', { capture: true }))
263
- .pipe(takeUntil(this._destroy$))
264
- .subscribe($event => this._checkToClose($event));
265
- });
266
- }
267
- _checkToClose($event) {
268
- if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
269
- return;
270
- }
271
- const path = $event.path || ($event.composedPath && $event.composedPath());
272
- if ($event.target &&
273
- $event.target.shadowRoot &&
274
- path &&
275
- path[0] &&
276
- this._select.contains(path[0])) {
277
- return;
278
- }
279
- this._zone.run(() => this.outsideClick.emit());
280
- }
281
- _onItemsChange(items, firstChange) {
282
- this.items = items || [];
283
- this._scrollToEndFired = false;
284
- this.itemsLength = items.length;
285
- if (this.virtualScroll) {
286
- this._updateItemsRange(firstChange);
287
- }
288
- else {
289
- this._setVirtualHeight();
290
- this._updateItems(firstChange);
291
- }
292
- }
293
- _updateItems(firstChange) {
294
- this.update.emit(this.items);
295
- if (firstChange === false) {
296
- return;
297
- }
298
- this._zone.runOutsideAngular(() => {
299
- Promise.resolve().then(() => {
300
- const panelHeight = this._scrollHost.clientHeight;
301
- this._panelUtils.setDimensions(0, panelHeight);
302
- this._handleDropdownPosition();
303
- this.scrollTo(this.markedItem, firstChange);
304
- });
305
- });
306
- }
307
- _updateItemsRange(firstChange) {
308
- this._zone.runOutsideAngular(() => {
309
- this._measureDimensions().then(() => {
310
- if (firstChange) {
311
- this._renderItemsRange(this._startOffset);
312
- this._handleDropdownPosition();
313
- }
314
- else {
315
- this._renderItemsRange();
316
- }
317
- });
318
- });
319
- }
320
- _onContentScrolled(scrollTop) {
321
- if (this.virtualScroll) {
322
- this._renderItemsRange(scrollTop);
323
- }
324
- this._lastScrollPosition = scrollTop;
325
- this._fireScrollToEnd(scrollTop);
326
- }
327
- _updateVirtualHeight(height) {
328
- if (this._updateScrollHeight) {
329
- this._scrollSpacer.style.height = `${height}px`;
330
- this._updateScrollHeight = false;
331
- }
332
- }
333
- _setVirtualHeight() {
334
- if (!this._scrollSpacer) {
335
- return;
336
- }
337
- this._scrollSpacer.style.height = `0px`;
338
- }
339
- _onItemsLengthChanged() {
340
- this._updateScrollHeight = true;
341
- }
342
- _renderItemsRange(scrollTop) {
343
- if (scrollTop && this._lastScrollPosition === scrollTop) {
344
- return;
345
- }
346
- scrollTop = scrollTop || this._scrollHost.scrollTop;
347
- const range = this._panelUtils.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);
348
- this._updateVirtualHeight(range.scrollHeight);
349
- this._scrollContent.style.transform = `translateY(${range.topPadding}px)`;
350
- this._zone.run(() => {
351
- this.update.emit(this.items.slice(range.start, range.end));
352
- this.scroll.emit({ start: range.start, end: range.end });
353
- });
354
- if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
355
- this._scrollHost.scrollTop = scrollTop;
356
- this._lastScrollPosition = scrollTop;
357
- }
358
- }
359
- _measureDimensions() {
360
- if (this._panelUtils.dimensions.itemHeight > 0 || this.itemsLength === 0) {
361
- return Promise.resolve(this._panelUtils.dimensions);
362
- }
363
- const [first] = this.items;
364
- this.update.emit([first]);
365
- return Promise.resolve().then(() => {
366
- const option = this._dropdown.querySelector(`#${first.htmlId}`);
367
- const optionHeight = option.clientHeight;
368
- this._scrollSpacer.style.height = `${optionHeight * this.itemsLength}px`;
369
- const panelHeight = this._scrollHost.clientHeight;
370
- this._panelUtils.setDimensions(optionHeight, panelHeight);
371
- return this._panelUtils.dimensions;
372
- });
373
- }
374
- _fireScrollToEnd(scrollTop) {
375
- if (this._scrollToEndFired || scrollTop === 0) {
376
- return;
377
- }
378
- const padding = this.virtualScroll ? this._scrollSpacer : this._scrollContent;
379
- if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight - 1) {
380
- this._zone.run(() => this.scrollToEnd.emit());
381
- this._scrollToEndFired = true;
382
- }
383
- }
384
- _calculateCurrentPosition(dropdownEl) {
385
- if (this.position !== 'auto') {
386
- return this.position;
387
- }
388
- const selectRect = this._select.getBoundingClientRect();
389
- const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
390
- const offsetTop = selectRect.top + window.pageYOffset;
391
- const height = selectRect.height;
392
- const dropdownHeight = dropdownEl.getBoundingClientRect().height;
393
- if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
394
- return 'top';
395
- }
396
- else {
397
- return 'bottom';
398
- }
399
- }
400
- _appendDropdown() {
401
- if (!this.appendTo) {
402
- return;
403
- }
404
- this._parent = this._dropdown.shadowRoot
405
- ? this._dropdown.shadowRoot.querySelector(this.appendTo)
406
- : document.querySelector(this.appendTo);
407
- if (!this._parent) {
408
- throw new Error(`appendTo selector ${this.appendTo} did not found any parent element`);
409
- }
410
- this._updateXPosition();
411
- this._parent.appendChild(this._dropdown);
412
- }
413
- _updateXPosition() {
414
- const select = this._select.getBoundingClientRect();
415
- const parent = this._parent.getBoundingClientRect();
416
- const offsetLeft = select.left - parent.left;
417
- this._dropdown.style.left = offsetLeft + 'px';
418
- this._dropdown.style.width = select.width + 'px';
419
- this._dropdown.style.minWidth = select.width + 'px';
420
- }
421
- _updateYPosition() {
422
- const select = this._select.getBoundingClientRect();
423
- const parent = this._parent.getBoundingClientRect();
424
- const delta = select.height;
425
- if (this._currentPosition === 'top') {
426
- const offsetBottom = parent.bottom - select.bottom;
427
- this._dropdown.style.bottom = offsetBottom + delta + 'px';
428
- this._dropdown.style.top = 'auto';
429
- }
430
- else if (this._currentPosition === 'bottom') {
431
- const offsetTop = select.top - parent.top;
432
- this._dropdown.style.top = offsetTop + delta + 'px';
433
- this._dropdown.style.bottom = 'auto';
434
- }
435
- }
436
- _setupMousedownListener() {
437
- this._zone.runOutsideAngular(() => {
438
- fromEvent(this._dropdown, 'mousedown')
439
- .pipe(takeUntil(this._destroy$))
440
- .subscribe(event => {
441
- const target = event.target;
442
- if (target.tagName === 'INPUT') {
443
- return;
444
- }
445
- event.preventDefault();
446
- });
447
- });
448
- }
449
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgDropdownPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
450
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: NgDropdownPanel, isStandalone: true, selector: "ng-dropdown-panel", inputs: { listboxId: "listboxId", items: "items", markedItem: "markedItem", position: "position", appendTo: "appendTo", bufferAmount: "bufferAmount", virtualScroll: ["virtualScroll", "virtualScroll", booleanAttribute], headerTemplate: "headerTemplate", footerTemplate: "footerTemplate", filterValue: "filterValue" }, outputs: { update: "update", scroll: "scroll", scrollToEnd: "scrollToEnd", outsideClick: "outsideClick" }, viewQueries: [{ propertyName: "scrollHostElRef", first: true, predicate: ["scrollHost"], descendants: true, read: ElementRef, static: true }, { propertyName: "scrollContentElRef", first: true, predicate: ["scrollContent"], descendants: true, read: ElementRef, static: true }, { propertyName: "scrollSpacerElRef", first: true, predicate: ["scrollSpacer"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
451
- @if (headerTemplate) {
452
- <div class="ng-dropdown-header">
453
- <ng-container
454
- [ngTemplateOutlet]="headerTemplate"
455
- [ngTemplateOutletContext]="{ searchTerm: filterValue }"
456
- />
457
- </div>
458
- }
459
- <div
460
- #scrollHost
461
- class="ng-dropdown-panel-items"
462
- [class.ng-select-virtual-scroll-host]="virtualScroll"
463
- [attr.id]="listboxId"
464
- role="listbox"
465
- >
466
- <div #scrollSpacer [class.ng-select-virtual-scroll-spacer]="virtualScroll"></div>
467
- <div #scrollContent [class.ng-select-virtual-scroll-content]="virtualScroll && items.length">
468
- <ng-content />
469
- </div>
470
- </div>
471
- @if (footerTemplate) {
472
- <div class="ng-dropdown-footer">
473
- <ng-container
474
- [ngTemplateOutlet]="footerTemplate"
475
- [ngTemplateOutletContext]="{ searchTerm: filterValue }"
476
- />
477
- </div>
478
- }
479
- `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
480
- }
481
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgDropdownPanel, decorators: [{
482
- type: Component,
483
- args: [{
484
- selector: 'ng-dropdown-panel',
485
- template: `
486
- @if (headerTemplate) {
487
- <div class="ng-dropdown-header">
488
- <ng-container
489
- [ngTemplateOutlet]="headerTemplate"
490
- [ngTemplateOutletContext]="{ searchTerm: filterValue }"
491
- />
492
- </div>
493
- }
494
- <div
495
- #scrollHost
496
- class="ng-dropdown-panel-items"
497
- [class.ng-select-virtual-scroll-host]="virtualScroll"
498
- [attr.id]="listboxId"
499
- role="listbox"
500
- >
501
- <div #scrollSpacer [class.ng-select-virtual-scroll-spacer]="virtualScroll"></div>
502
- <div #scrollContent [class.ng-select-virtual-scroll-content]="virtualScroll && items.length">
503
- <ng-content />
504
- </div>
505
- </div>
506
- @if (footerTemplate) {
507
- <div class="ng-dropdown-footer">
508
- <ng-container
509
- [ngTemplateOutlet]="footerTemplate"
510
- [ngTemplateOutletContext]="{ searchTerm: filterValue }"
511
- />
512
- </div>
513
- }
514
- `,
515
- imports: [NgTemplateOutlet],
516
- encapsulation: ViewEncapsulation.None,
517
- changeDetection: ChangeDetectionStrategy.OnPush,
518
- }]
519
- }], propDecorators: { listboxId: [{
520
- type: Input
521
- }], items: [{
522
- type: Input
523
- }], markedItem: [{
524
- type: Input
525
- }], position: [{
526
- type: Input
527
- }], appendTo: [{
528
- type: Input
529
- }], bufferAmount: [{
530
- type: Input
531
- }], virtualScroll: [{
532
- type: Input,
533
- args: [{ transform: booleanAttribute }]
534
- }], headerTemplate: [{
535
- type: Input
536
- }], footerTemplate: [{
537
- type: Input
538
- }], filterValue: [{
539
- type: Input
540
- }], update: [{
541
- type: Output
542
- }], scroll: [{
543
- type: Output
544
- }], scrollToEnd: [{
545
- type: Output
546
- }], outsideClick: [{
547
- type: Output
548
- }], scrollHostElRef: [{
549
- type: ViewChild,
550
- args: ['scrollHost', { read: ElementRef, static: true }]
551
- }], scrollContentElRef: [{
552
- type: ViewChild,
553
- args: ['scrollContent', { read: ElementRef, static: true }]
554
- }], scrollSpacerElRef: [{
555
- type: ViewChild,
556
- args: ['scrollSpacer', { read: ElementRef, static: true }]
557
- }] } });
558
-
559
- class NgOption {
560
- value;
561
- disabled = false;
562
- elementRef = inject(ElementRef);
563
- stateChange$ = new Subject();
564
- _previousLabel = '';
565
- get label() {
566
- return (this.elementRef.nativeElement.textContent || '').trim();
567
- }
568
- ngOnChanges(changes) {
569
- if (changes['disabled']) {
570
- this.stateChange$.next({
571
- value: this.value,
572
- disabled: this.disabled,
573
- });
574
- }
575
- }
576
- ngAfterViewChecked() {
577
- if (this.label !== this._previousLabel) {
578
- this._previousLabel = this.label;
579
- this.stateChange$.next({
580
- value: this.value,
581
- disabled: this.disabled,
582
- label: this.elementRef.nativeElement.innerHTML,
583
- });
584
- }
585
- }
586
- ngOnDestroy() {
587
- this.stateChange$.complete();
588
- }
589
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOption, deps: [], target: i0.ɵɵFactoryTarget.Component });
590
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.3.12", type: NgOption, isStandalone: true, selector: "ng-option", inputs: { value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, usesOnChanges: true, ngImport: i0, template: `
591
- <ng-content />
592
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
593
- }
594
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOption, decorators: [{
595
- type: Component,
596
- args: [{
597
- selector: 'ng-option',
598
- template: `
599
- <ng-content />
600
- `,
601
- changeDetection: ChangeDetectionStrategy.OnPush,
602
- }]
603
- }], propDecorators: { value: [{
604
- type: Input
605
- }], disabled: [{
606
- type: Input,
607
- args: [{ transform: booleanAttribute }]
608
- }] } });
609
-
610
- class NgOptionHighlight {
611
- term = '';
612
- elementRef = inject(ElementRef);
613
- renderer = inject(Renderer2);
614
- element = this.elementRef.nativeElement;
615
- label = '';
616
- get _canHighlight() {
617
- return this.term && this.label;
618
- }
619
- ngOnChanges() {
620
- if (this._canHighlight) {
621
- this._highlightLabel();
622
- }
623
- }
624
- ngAfterViewInit() {
625
- this.label = this.element.innerHTML;
626
- if (this._canHighlight) {
627
- this._highlightLabel();
628
- }
629
- }
630
- _escapeRegExp(str) {
631
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
632
- }
633
- _highlightLabel() {
634
- const label = this.label;
635
- if (!this.term) {
636
- this._setInnerHtml(label);
637
- return;
638
- }
639
- const alternationString = this._escapeRegExp(this.term).replace(' ', '|');
640
- const termRegex = new RegExp(alternationString, 'gi');
641
- this._setInnerHtml(label.replace(termRegex, `<span class="highlighted">$&</span>`));
642
- }
643
- _setInnerHtml(html) {
644
- this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', html);
645
- }
646
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptionHighlight, deps: [], target: i0.ɵɵFactoryTarget.Directive });
647
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgOptionHighlight, isStandalone: true, selector: "[ngOptionHighlight]", inputs: { term: ["ngOptionHighlight", "term"] }, usesOnChanges: true, ngImport: i0 });
648
- }
649
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptionHighlight, decorators: [{
650
- type: Directive,
651
- args: [{
652
- selector: '[ngOptionHighlight]',
653
- }]
654
- }], propDecorators: { term: [{
655
- type: Input,
656
- args: ['ngOptionHighlight']
657
- }] } });
658
-
659
45
  const diacritics = {
660
46
  '\u24B6': 'A',
661
47
  '\uFF21': 'A',
@@ -1503,563 +889,1144 @@ function stripSpecialChars(text) {
1503
889
  return text.replace(/[^\u0000-\u007E]/g, match);
1504
890
  }
1505
891
 
1506
- class ItemsList {
1507
- _ngSelect;
1508
- _selectionModel;
1509
- _groups;
1510
- constructor(_ngSelect, _selectionModel) {
1511
- this._ngSelect = _ngSelect;
1512
- this._selectionModel = _selectionModel;
892
+ class ItemsList {
893
+ _ngSelect;
894
+ _selectionModel;
895
+ _groups;
896
+ constructor(_ngSelect, _selectionModel) {
897
+ this._ngSelect = _ngSelect;
898
+ this._selectionModel = _selectionModel;
899
+ }
900
+ get items() {
901
+ return this._items;
902
+ }
903
+ _items = [];
904
+ get filteredItems() {
905
+ return this._filteredItems;
906
+ }
907
+ _filteredItems = [];
908
+ get markedIndex() {
909
+ return this._markedIndex;
910
+ }
911
+ _markedIndex = -1;
912
+ get selectedItems() {
913
+ return this._selectionModel.value;
914
+ }
915
+ get markedItem() {
916
+ return this._filteredItems[this._markedIndex];
917
+ }
918
+ get noItemsToSelect() {
919
+ return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
920
+ }
921
+ get maxItemsSelected() {
922
+ return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
923
+ }
924
+ get lastSelectedItem() {
925
+ let i = this.selectedItems.length - 1;
926
+ for (; i >= 0; i--) {
927
+ const item = this.selectedItems[i];
928
+ if (!item.disabled) {
929
+ return item;
930
+ }
931
+ }
932
+ return null;
933
+ }
934
+ setItems(items) {
935
+ this._items = items.map((item, index) => this.mapItem(item, index));
936
+ if (this._ngSelect.groupBy) {
937
+ this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
938
+ this._items = this._flatten(this._groups);
939
+ }
940
+ else {
941
+ this._groups = new Map();
942
+ this._groups.set(undefined, this._items);
943
+ }
944
+ this._filteredItems = [...this._items];
945
+ }
946
+ select(item) {
947
+ if (item.selected || this.maxItemsSelected) {
948
+ return;
949
+ }
950
+ const multiple = this._ngSelect.multiple;
951
+ if (!multiple) {
952
+ this.clearSelected();
953
+ }
954
+ this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
955
+ if (this._ngSelect.hideSelected) {
956
+ this._hideSelected(item);
957
+ }
958
+ }
959
+ unselect(item) {
960
+ if (!item.selected) {
961
+ return;
962
+ }
963
+ this._selectionModel.unselect(item, this._ngSelect.multiple);
964
+ if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {
965
+ this._showSelected(item);
966
+ }
967
+ }
968
+ findItem(value) {
969
+ let findBy;
970
+ if (this._ngSelect.compareWith) {
971
+ findBy = item => this._ngSelect.compareWith(item.value, value);
972
+ }
973
+ else if (this._ngSelect.bindValue) {
974
+ findBy = item => !item.children &&
975
+ this.resolveNested(item.value, this._ngSelect.bindValue) === value;
976
+ }
977
+ else {
978
+ findBy = item => item.value === value ||
979
+ !!(!item.children &&
980
+ item.label &&
981
+ item.label === this.resolveNested(value, this._ngSelect.bindLabel));
982
+ }
983
+ return this._items.find(item => findBy(item));
984
+ }
985
+ addItem(item) {
986
+ const option = this.mapItem(item, this._items.length);
987
+ this._items.push(option);
988
+ this._filteredItems.push(option);
989
+ return option;
990
+ }
991
+ clearSelected(keepDisabled = false) {
992
+ this._selectionModel.clear(keepDisabled);
993
+ this._items.forEach(item => {
994
+ item.selected = keepDisabled && item.selected && item.disabled;
995
+ item.marked = false;
996
+ });
997
+ if (this._ngSelect.hideSelected) {
998
+ this.resetFilteredItems();
999
+ }
1000
+ }
1001
+ findByLabel(term) {
1002
+ term = stripSpecialChars(term).toLocaleLowerCase();
1003
+ return this.filteredItems.find(item => {
1004
+ const label = stripSpecialChars(item.label).toLocaleLowerCase();
1005
+ return label.startsWith(term);
1006
+ });
1007
+ }
1008
+ filter(term) {
1009
+ if (!term) {
1010
+ this.resetFilteredItems();
1011
+ return;
1012
+ }
1013
+ this._filteredItems = [];
1014
+ term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();
1015
+ const match = this._ngSelect.searchFn || this._defaultSearchFn;
1016
+ const hideSelected = this._ngSelect.hideSelected;
1017
+ for (const key of Array.from(this._groups.keys())) {
1018
+ const matchedItems = [];
1019
+ for (const item of this._groups.get(key)) {
1020
+ if (hideSelected && ((item.parent && item.parent.selected) || item.selected)) {
1021
+ continue;
1022
+ }
1023
+ const searchItem = this._ngSelect.searchFn ? item.value : item;
1024
+ if (match(term, searchItem)) {
1025
+ matchedItems.push(item);
1026
+ }
1027
+ }
1028
+ if (matchedItems.length > 0) {
1029
+ const [last] = matchedItems.slice(-1);
1030
+ if (last.parent) {
1031
+ const head = this._items.find(x => x === last.parent);
1032
+ this._filteredItems.push(head);
1033
+ }
1034
+ this._filteredItems.push(...matchedItems);
1035
+ }
1036
+ }
1037
+ }
1038
+ resetFilteredItems() {
1039
+ if (this._filteredItems.length === this._items.length) {
1040
+ return;
1041
+ }
1042
+ if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
1043
+ this._filteredItems = this._items.filter(x => !x.selected);
1044
+ }
1045
+ else {
1046
+ this._filteredItems = this._items;
1047
+ }
1048
+ }
1049
+ unmarkItem() {
1050
+ this._markedIndex = -1;
1051
+ }
1052
+ markNextItem() {
1053
+ this._stepToItem(+1);
1054
+ }
1055
+ markPreviousItem() {
1056
+ this._stepToItem(-1);
1057
+ }
1058
+ markItem(item) {
1059
+ this._markedIndex = this._filteredItems.indexOf(item);
1060
+ }
1061
+ markSelectedOrDefault(markDefault) {
1062
+ if (this._filteredItems.length === 0) {
1063
+ return;
1064
+ }
1065
+ const lastMarkedIndex = this._getLastMarkedIndex();
1066
+ if (lastMarkedIndex > -1) {
1067
+ this._markedIndex = lastMarkedIndex;
1068
+ }
1069
+ else {
1070
+ this._markedIndex = markDefault ? this.filteredItems.findIndex(x => !x.disabled) : -1;
1071
+ }
1072
+ }
1073
+ resolveNested(option, key) {
1074
+ if (!isObject(option)) {
1075
+ return option;
1076
+ }
1077
+ if (key.indexOf('.') === -1) {
1078
+ return option[key];
1079
+ }
1080
+ else {
1081
+ const keys = key.split('.');
1082
+ let value = option;
1083
+ for (let i = 0, len = keys.length; i < len; ++i) {
1084
+ if (value == null) {
1085
+ return null;
1086
+ }
1087
+ value = value[keys[i]];
1088
+ }
1089
+ return value;
1090
+ }
1091
+ }
1092
+ mapItem(item, index) {
1093
+ const label = isDefined(item.$ngOptionLabel)
1094
+ ? item.$ngOptionLabel
1095
+ : this.resolveNested(item, this._ngSelect.bindLabel);
1096
+ const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
1097
+ return {
1098
+ index,
1099
+ label: isDefined(label) ? label.toString() : '',
1100
+ value,
1101
+ viewValue: item.viewValue || label,
1102
+ disabled: item.disabled,
1103
+ htmlId: `${this._ngSelect._uid}-option-${index}`,
1104
+ };
1105
+ }
1106
+ mapSelectedItems() {
1107
+ const multiple = this._ngSelect.multiple;
1108
+ for (const selected of this.selectedItems) {
1109
+ const value = this._ngSelect.bindValue
1110
+ ? this.resolveNested(selected.value, this._ngSelect.bindValue)
1111
+ : selected.value;
1112
+ const item = isDefined(value) ? this.findItem(value) : null;
1113
+ this._selectionModel.unselect(selected, multiple);
1114
+ this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
1115
+ }
1116
+ if (this._ngSelect.hideSelected) {
1117
+ this._filteredItems = this.filteredItems.filter(x => this.selectedItems.indexOf(x) === -1);
1118
+ }
1119
+ }
1120
+ _showSelected(item) {
1121
+ this._filteredItems.push(item);
1122
+ if (item.parent) {
1123
+ const parent = item.parent;
1124
+ const parentExists = this._filteredItems.find(x => x === parent);
1125
+ if (!parentExists) {
1126
+ this._filteredItems.push(parent);
1127
+ }
1128
+ }
1129
+ else if (item.children) {
1130
+ for (const child of item.children) {
1131
+ child.selected = false;
1132
+ this._filteredItems.push(child);
1133
+ }
1134
+ }
1135
+ this._filteredItems = [...this._filteredItems.sort((a, b) => a.index - b.index)];
1136
+ }
1137
+ _hideSelected(item) {
1138
+ this._filteredItems = this._filteredItems.filter(x => x !== item);
1139
+ if (item.parent) {
1140
+ const children = item.parent.children;
1141
+ if (children.every(x => x.selected)) {
1142
+ this._filteredItems = this._filteredItems.filter(x => x !== item.parent);
1143
+ }
1144
+ }
1145
+ else if (item.children) {
1146
+ this._filteredItems = this.filteredItems.filter(x => x.parent !== item);
1147
+ }
1148
+ }
1149
+ _defaultSearchFn(search, opt) {
1150
+ const label = stripSpecialChars(opt.label).toLocaleLowerCase();
1151
+ return label.indexOf(search) > -1;
1152
+ }
1153
+ _getNextItemIndex(steps) {
1154
+ if (steps > 0) {
1155
+ return this._markedIndex >= this._filteredItems.length - 1 ? 0 : this._markedIndex + 1;
1156
+ }
1157
+ return this._markedIndex <= 0 ? this._filteredItems.length - 1 : this._markedIndex - 1;
1158
+ }
1159
+ _stepToItem(steps) {
1160
+ if (this._filteredItems.length === 0 || this._filteredItems.every(x => x.disabled)) {
1161
+ return;
1162
+ }
1163
+ this._markedIndex = this._getNextItemIndex(steps);
1164
+ if (this.markedItem?.disabled) {
1165
+ this._stepToItem(steps);
1166
+ }
1167
+ }
1168
+ _getLastMarkedIndex() {
1169
+ if (this._ngSelect.hideSelected) {
1170
+ return -1;
1171
+ }
1172
+ if (this._markedIndex > -1 && this.markedItem == null) {
1173
+ return -1;
1174
+ }
1175
+ const selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
1176
+ if (this.lastSelectedItem && selectedIndex < 0) {
1177
+ return -1;
1178
+ }
1179
+ return Math.max(this.markedIndex, selectedIndex);
1180
+ }
1181
+ _groupBy(items, prop) {
1182
+ const groups = new Map();
1183
+ if (items.length === 0) {
1184
+ return groups;
1185
+ }
1186
+ // Check if items are already grouped by given key.
1187
+ if (Array.isArray(items[0].value[prop])) {
1188
+ for (const item of items) {
1189
+ const children = (item.value[prop] || []).map((x, index) => this.mapItem(x, index));
1190
+ groups.set(item, children);
1191
+ }
1192
+ return groups;
1193
+ }
1194
+ const isFnKey = isFunction(this._ngSelect.groupBy);
1195
+ const keyFn = (item) => {
1196
+ const key = isFnKey ? prop(item.value) : item.value[prop];
1197
+ return isDefined(key) ? key : undefined;
1198
+ };
1199
+ // Group items by key.
1200
+ for (const item of items) {
1201
+ const key = keyFn(item);
1202
+ const group = groups.get(key);
1203
+ if (group) {
1204
+ group.push(item);
1205
+ }
1206
+ else {
1207
+ groups.set(key, [item]);
1208
+ }
1209
+ }
1210
+ return groups;
1211
+ }
1212
+ _flatten(groups) {
1213
+ const isGroupByFn = isFunction(this._ngSelect.groupBy);
1214
+ const items = [];
1215
+ let groupIndex = 0;
1216
+ for (const key of groups.keys()) {
1217
+ let i = items.length;
1218
+ if (key == null) {
1219
+ const withoutGroup = groups.get(undefined) || [];
1220
+ items.push(...withoutGroup.map(x => {
1221
+ x.index = i++;
1222
+ return x;
1223
+ }));
1224
+ continue;
1225
+ }
1226
+ const isObjectKey = isObject(key);
1227
+ const parent = {
1228
+ label: isObjectKey ? '' : String(key),
1229
+ children: null,
1230
+ parent: null,
1231
+ index: i++,
1232
+ disabled: !this._ngSelect.selectableGroup,
1233
+ htmlId: `${this._ngSelect._uid}-group-${groupIndex}-heading`,
1234
+ };
1235
+ const groupKey = isGroupByFn
1236
+ ? this._ngSelect.bindLabel
1237
+ : this._ngSelect.groupBy;
1238
+ const groupValue = this._ngSelect.groupValue ||
1239
+ (() => {
1240
+ if (isObjectKey) {
1241
+ return key.value;
1242
+ }
1243
+ return { [groupKey]: key };
1244
+ });
1245
+ const children = groups.get(key).map(x => {
1246
+ x.parent = parent;
1247
+ x.children = null;
1248
+ x.index = i++;
1249
+ return x;
1250
+ });
1251
+ parent.children = children;
1252
+ parent.value = groupValue(key, children.map(x => x.value));
1253
+ items.push(parent);
1254
+ items.push(...children);
1255
+ groupIndex++;
1256
+ }
1257
+ return items;
1258
+ }
1259
+ }
1260
+
1261
+ class NgSelectConfig {
1262
+ placeholder;
1263
+ fixedPlaceholder = false;
1264
+ notFoundText = 'No items found';
1265
+ typeToSearchText = 'Type to search';
1266
+ addTagText = 'Add item';
1267
+ loadingText = 'Loading...';
1268
+ clearAllText = 'Clear all';
1269
+ virtualScroll = false;
1270
+ openOnEnter = true;
1271
+ appendTo;
1272
+ bindValue;
1273
+ bindLabel;
1274
+ clearSearchOnAdd;
1275
+ deselectOnClick;
1276
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1277
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, providedIn: 'root' });
1278
+ }
1279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, decorators: [{
1280
+ type: Injectable,
1281
+ args: [{ providedIn: 'root' }]
1282
+ }] });
1283
+
1284
+ class NgSelectOption {
1285
+ value;
1286
+ disabled = false;
1287
+ elementRef = inject(ElementRef);
1288
+ stateChange$ = new Subject();
1289
+ _previousLabel = '';
1290
+ get label() {
1291
+ return (this.elementRef.nativeElement.textContent || '').trim();
1513
1292
  }
1514
- get items() {
1515
- return this._items;
1293
+ ngOnChanges(changes) {
1294
+ if (changes['disabled']) {
1295
+ this.stateChange$.next({
1296
+ value: this.value,
1297
+ disabled: this.disabled,
1298
+ });
1299
+ }
1516
1300
  }
1517
- _items = [];
1518
- get filteredItems() {
1519
- return this._filteredItems;
1301
+ ngAfterViewChecked() {
1302
+ if (this.label !== this._previousLabel) {
1303
+ this._previousLabel = this.label;
1304
+ this.stateChange$.next({
1305
+ value: this.value,
1306
+ disabled: this.disabled,
1307
+ label: this.elementRef.nativeElement.innerHTML,
1308
+ });
1309
+ }
1520
1310
  }
1521
- _filteredItems = [];
1522
- get markedIndex() {
1523
- return this._markedIndex;
1311
+ ngOnDestroy() {
1312
+ this.stateChange$.complete();
1524
1313
  }
1525
- _markedIndex = -1;
1526
- get selectedItems() {
1527
- return this._selectionModel.value;
1314
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOption, deps: [], target: i0.ɵɵFactoryTarget.Component });
1315
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.3.12", type: NgSelectOption, isStandalone: true, selector: "ng-option, ng-select-option", inputs: { value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, usesOnChanges: true, ngImport: i0, template: `
1316
+ <ng-content />
1317
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1318
+ }
1319
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOption, decorators: [{
1320
+ type: Component,
1321
+ args: [{
1322
+ selector: 'ng-option, ng-select-option',
1323
+ template: `
1324
+ <ng-content />
1325
+ `,
1326
+ changeDetection: ChangeDetectionStrategy.OnPush,
1327
+ }]
1328
+ }], propDecorators: { value: [{
1329
+ type: Input
1330
+ }], disabled: [{
1331
+ type: Input,
1332
+ args: [{ transform: booleanAttribute }]
1333
+ }] } });
1334
+
1335
+ class NgSelectPanelUtils {
1336
+ get dimensions() {
1337
+ return this._dimensions;
1338
+ }
1339
+ _dimensions = {
1340
+ itemHeight: 0,
1341
+ panelHeight: 0,
1342
+ itemsPerViewport: 0,
1343
+ };
1344
+ calculateItems(scrollPos, itemsLength, buffer) {
1345
+ const d = this._dimensions;
1346
+ const scrollHeight = d.itemHeight * itemsLength;
1347
+ const scrollTop = Math.max(0, scrollPos);
1348
+ const indexByScrollTop = (scrollTop / scrollHeight) * itemsLength;
1349
+ let end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
1350
+ const maxStartEnd = end;
1351
+ const maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
1352
+ let start = Math.min(maxStart, Math.floor(indexByScrollTop));
1353
+ let topPadding = d.itemHeight * Math.ceil(start) - d.itemHeight * Math.min(start, buffer);
1354
+ topPadding = !isNaN(topPadding) ? topPadding : 0;
1355
+ start = !isNaN(start) ? start : -1;
1356
+ end = !isNaN(end) ? end : -1;
1357
+ start -= buffer;
1358
+ start = Math.max(0, start);
1359
+ end += buffer;
1360
+ end = Math.min(itemsLength, end);
1361
+ return {
1362
+ topPadding,
1363
+ scrollHeight,
1364
+ start,
1365
+ end,
1366
+ };
1367
+ }
1368
+ setDimensions(itemHeight, panelHeight) {
1369
+ const itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
1370
+ this._dimensions = {
1371
+ itemHeight,
1372
+ panelHeight,
1373
+ itemsPerViewport,
1374
+ };
1375
+ }
1376
+ getScrollTo(itemTop, itemHeight, lastScroll) {
1377
+ const { panelHeight } = this.dimensions;
1378
+ const itemBottom = itemTop + itemHeight;
1379
+ const top = lastScroll;
1380
+ const bottom = top + panelHeight;
1381
+ if (panelHeight >= itemBottom && lastScroll === itemTop) {
1382
+ return null;
1383
+ }
1384
+ if (itemBottom > bottom) {
1385
+ return top + itemBottom - bottom;
1386
+ }
1387
+ else if (itemTop <= top) {
1388
+ return itemTop;
1389
+ }
1390
+ return null;
1528
1391
  }
1529
- get markedItem() {
1530
- return this._filteredItems[this._markedIndex];
1392
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelUtils, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1393
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelUtils, providedIn: 'root' });
1394
+ }
1395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelUtils, decorators: [{
1396
+ type: Injectable,
1397
+ args: [{ providedIn: 'root' }]
1398
+ }] });
1399
+
1400
+ const CSS_POSITIONS = ['top', 'right', 'bottom', 'left'];
1401
+ const SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? animationFrameScheduler : asapScheduler;
1402
+ class NgSelectPanel {
1403
+ listboxId = '';
1404
+ items = [];
1405
+ markedItem;
1406
+ position = 'auto';
1407
+ appendTo;
1408
+ bufferAmount = 4;
1409
+ virtualScroll = false;
1410
+ multiple = false;
1411
+ headerTemplate;
1412
+ footerTemplate;
1413
+ filterValue = null;
1414
+ update = new EventEmitter();
1415
+ scroll = new EventEmitter();
1416
+ scrollToEnd = new EventEmitter();
1417
+ outsideClick = new EventEmitter();
1418
+ scrollHostElRef;
1419
+ scrollContentElRef;
1420
+ scrollSpacerElRef;
1421
+ _document = inject(DOCUMENT, { optional: true });
1422
+ _renderer = inject(Renderer2);
1423
+ _zone = inject(NgZone);
1424
+ _elementRef = inject(ElementRef);
1425
+ _panelUtils = inject(NgSelectPanelUtils);
1426
+ _destroy$ = new Subject();
1427
+ _dropdown = this._elementRef.nativeElement;
1428
+ _select;
1429
+ _parent;
1430
+ _scrollHost;
1431
+ _scrollContent;
1432
+ _scrollSpacer;
1433
+ _scrollToEndFired = false;
1434
+ _updateScrollHeight = false;
1435
+ _lastScrollPosition = 0;
1436
+ get currentPosition() {
1437
+ return this._currentPosition;
1531
1438
  }
1532
- get noItemsToSelect() {
1533
- return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
1439
+ _currentPosition = 'auto';
1440
+ get itemsLength() {
1441
+ return this._itemsLength;
1534
1442
  }
1535
- get maxItemsSelected() {
1536
- return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
1443
+ set itemsLength(value) {
1444
+ if (value !== this._itemsLength) {
1445
+ this._itemsLength = value;
1446
+ this._onItemsLengthChanged();
1447
+ }
1537
1448
  }
1538
- get lastSelectedItem() {
1539
- let i = this.selectedItems.length - 1;
1540
- for (; i >= 0; i--) {
1541
- const item = this.selectedItems[i];
1542
- if (!item.disabled) {
1543
- return item;
1544
- }
1449
+ _itemsLength;
1450
+ get _startOffset() {
1451
+ if (this.markedItem) {
1452
+ const { itemHeight, panelHeight } = this._panelUtils.dimensions;
1453
+ const offset = this.markedItem.index * itemHeight;
1454
+ return panelHeight > offset ? 0 : offset;
1545
1455
  }
1546
- return null;
1456
+ return 0;
1547
1457
  }
1548
- setItems(items) {
1549
- this._items = items.map((item, index) => this.mapItem(item, index));
1550
- if (this._ngSelect.groupBy) {
1551
- this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
1552
- this._items = this._flatten(this._groups);
1458
+ ngOnInit() {
1459
+ this._select = this._dropdown.parentElement;
1460
+ this._scrollHost = this.scrollHostElRef.nativeElement;
1461
+ this._scrollContent = this.scrollContentElRef.nativeElement;
1462
+ this._scrollSpacer = this.scrollSpacerElRef.nativeElement;
1463
+ this._handleScroll();
1464
+ this._handleOutsideClick();
1465
+ this._appendDropdown();
1466
+ this._setupMousedownListener();
1467
+ }
1468
+ ngOnChanges(changes) {
1469
+ if (changes['items']) {
1470
+ const change = changes['items'];
1471
+ this._onItemsChange(change.currentValue, change.firstChange);
1553
1472
  }
1554
- else {
1555
- this._groups = new Map();
1556
- this._groups.set(undefined, this._items);
1473
+ }
1474
+ ngOnDestroy() {
1475
+ this._destroy$.next();
1476
+ this._destroy$.complete();
1477
+ this._destroy$.unsubscribe();
1478
+ if (this.appendTo) {
1479
+ this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
1557
1480
  }
1558
- this._filteredItems = [...this._items];
1559
1481
  }
1560
- select(item) {
1561
- if (item.selected || this.maxItemsSelected) {
1482
+ scrollTo(option, startFromOption = false) {
1483
+ if (!option) {
1562
1484
  return;
1563
1485
  }
1564
- const multiple = this._ngSelect.multiple;
1565
- if (!multiple) {
1566
- this.clearSelected();
1486
+ const index = this.items.indexOf(option);
1487
+ if (index < 0 || index >= this.itemsLength) {
1488
+ return;
1567
1489
  }
1568
- this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
1569
- if (this._ngSelect.hideSelected) {
1570
- this._hideSelected(item);
1490
+ let scrollTo;
1491
+ if (this.virtualScroll) {
1492
+ const itemHeight = this._panelUtils.dimensions.itemHeight;
1493
+ scrollTo = this._panelUtils.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
1571
1494
  }
1572
- }
1573
- unselect(item) {
1574
- if (!item.selected) {
1575
- return;
1495
+ else {
1496
+ const item = this._dropdown.querySelector(`#${option.htmlId}`);
1497
+ const lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
1498
+ scrollTo = this._panelUtils.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
1576
1499
  }
1577
- this._selectionModel.unselect(item, this._ngSelect.multiple);
1578
- if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {
1579
- this._showSelected(item);
1500
+ if (isDefined(scrollTo)) {
1501
+ this._scrollHost.scrollTop = scrollTo;
1580
1502
  }
1581
1503
  }
1582
- findItem(value) {
1583
- let findBy;
1584
- if (this._ngSelect.compareWith) {
1585
- findBy = item => this._ngSelect.compareWith(item.value, value);
1586
- }
1587
- else if (this._ngSelect.bindValue) {
1588
- findBy = item => !item.children &&
1589
- this.resolveNested(item.value, this._ngSelect.bindValue) === value;
1504
+ scrollToTag() {
1505
+ const panel = this._scrollHost;
1506
+ panel.scrollTop = panel.scrollHeight - panel.clientHeight;
1507
+ }
1508
+ adjustPosition() {
1509
+ this._updateYPosition();
1510
+ }
1511
+ _handleDropdownPosition() {
1512
+ this._currentPosition = this._calculateCurrentPosition(this._dropdown);
1513
+ if (CSS_POSITIONS.includes(this._currentPosition)) {
1514
+ this._updateDropdownClass(this._currentPosition);
1590
1515
  }
1591
1516
  else {
1592
- findBy = item => item.value === value ||
1593
- !!(!item.children &&
1594
- item.label &&
1595
- item.label === this.resolveNested(value, this._ngSelect.bindLabel));
1517
+ this._updateDropdownClass('bottom');
1596
1518
  }
1597
- return this._items.find(item => findBy(item));
1598
- }
1599
- addItem(item) {
1600
- const option = this.mapItem(item, this._items.length);
1601
- this._items.push(option);
1602
- this._filteredItems.push(option);
1603
- return option;
1604
- }
1605
- clearSelected(keepDisabled = false) {
1606
- this._selectionModel.clear(keepDisabled);
1607
- this._items.forEach(item => {
1608
- item.selected = keepDisabled && item.selected && item.disabled;
1609
- item.marked = false;
1610
- });
1611
- if (this._ngSelect.hideSelected) {
1612
- this.resetFilteredItems();
1519
+ if (this.appendTo) {
1520
+ this._updateYPosition();
1613
1521
  }
1522
+ this._dropdown.style.opacity = '1';
1614
1523
  }
1615
- findByLabel(term) {
1616
- term = stripSpecialChars(term).toLocaleLowerCase();
1617
- return this.filteredItems.find(item => {
1618
- const label = stripSpecialChars(item.label).toLocaleLowerCase();
1619
- return label.substr(0, term.length) === term;
1524
+ _updateDropdownClass(currentPosition) {
1525
+ CSS_POSITIONS.forEach(position => {
1526
+ const REMOVE_CSS_CLASS = `ng-select-${position}`;
1527
+ this._renderer.removeClass(this._dropdown, REMOVE_CSS_CLASS);
1528
+ this._renderer.removeClass(this._select, REMOVE_CSS_CLASS);
1620
1529
  });
1530
+ const ADD_CSS_CLASS = `ng-select-${currentPosition}`;
1531
+ this._renderer.addClass(this._dropdown, ADD_CSS_CLASS);
1532
+ this._renderer.addClass(this._select, ADD_CSS_CLASS);
1621
1533
  }
1622
- filter(term) {
1623
- if (!term) {
1624
- this.resetFilteredItems();
1625
- return;
1626
- }
1627
- this._filteredItems = [];
1628
- term = this._ngSelect.searchFn
1629
- ? term
1630
- : stripSpecialChars(term).toLocaleLowerCase();
1631
- const match = this._ngSelect.searchFn || this._defaultSearchFn;
1632
- const hideSelected = this._ngSelect.hideSelected;
1633
- for (const key of Array.from(this._groups.keys())) {
1634
- const matchedItems = [];
1635
- for (const item of this._groups.get(key)) {
1636
- if (hideSelected && ((item.parent && item.parent.selected) || item.selected)) {
1637
- continue;
1638
- }
1639
- const searchItem = this._ngSelect.searchFn ? item.value : item;
1640
- if (match(term, searchItem)) {
1641
- matchedItems.push(item);
1642
- }
1643
- }
1644
- if (matchedItems.length > 0) {
1645
- const [last] = matchedItems.slice(-1);
1646
- if (last.parent) {
1647
- const head = this._items.find(x => x === last.parent);
1648
- this._filteredItems.push(head);
1534
+ _handleScroll() {
1535
+ this._zone.runOutsideAngular(() => {
1536
+ fromEvent(this._scrollHost, 'scroll')
1537
+ .pipe(takeUntil(this._destroy$), auditTime(0, SCROLL_SCHEDULER))
1538
+ .subscribe(e => {
1539
+ const path = e.path || (e.composedPath && e.composedPath());
1540
+ if (!path || (path.length === 0 && !e.target)) {
1541
+ return;
1649
1542
  }
1650
- this._filteredItems.push(...matchedItems);
1651
- }
1652
- }
1543
+ const scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;
1544
+ this._onContentScrolled(scrollTop);
1545
+ });
1546
+ });
1653
1547
  }
1654
- resetFilteredItems() {
1655
- if (this._filteredItems.length === this._items.length) {
1548
+ _handleOutsideClick() {
1549
+ if (!this._document) {
1656
1550
  return;
1657
1551
  }
1658
- if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
1659
- this._filteredItems = this._items.filter(x => !x.selected);
1660
- }
1661
- else {
1662
- this._filteredItems = this._items;
1663
- }
1664
- }
1665
- unmarkItem() {
1666
- this._markedIndex = -1;
1667
- }
1668
- markNextItem() {
1669
- this._stepToItem(+1);
1670
- }
1671
- markPreviousItem() {
1672
- this._stepToItem(-1);
1673
- }
1674
- markItem(item) {
1675
- this._markedIndex = this._filteredItems.indexOf(item);
1676
- }
1677
- markSelectedOrDefault(markDefault) {
1678
- if (this._filteredItems.length === 0) {
1552
+ this._zone.runOutsideAngular(() => {
1553
+ merge(fromEvent(this._document, 'touchstart', { capture: true }), fromEvent(this._document, 'click', { capture: true }))
1554
+ .pipe(takeUntil(this._destroy$))
1555
+ .subscribe($event => this._checkToClose($event));
1556
+ });
1557
+ }
1558
+ _checkToClose($event) {
1559
+ if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
1679
1560
  return;
1680
1561
  }
1681
- const lastMarkedIndex = this._getLastMarkedIndex();
1682
- if (lastMarkedIndex > -1) {
1683
- this._markedIndex = lastMarkedIndex;
1684
- }
1685
- else {
1686
- this._markedIndex = markDefault ? this.filteredItems.findIndex(x => !x.disabled) : -1;
1562
+ const path = $event.path || ($event.composedPath && $event.composedPath());
1563
+ if ($event.target &&
1564
+ $event.target.shadowRoot &&
1565
+ path &&
1566
+ path[0] &&
1567
+ this._select.contains(path[0])) {
1568
+ return;
1687
1569
  }
1570
+ this._zone.run(() => this.outsideClick.emit());
1688
1571
  }
1689
- resolveNested(option, key) {
1690
- if (!isObject(option)) {
1691
- return option;
1692
- }
1693
- if (key.indexOf('.') === -1) {
1694
- return option[key];
1572
+ _onItemsChange(items, firstChange) {
1573
+ this.items = items || [];
1574
+ this._scrollToEndFired = false;
1575
+ this.itemsLength = items.length;
1576
+ if (this.virtualScroll) {
1577
+ this._updateItemsRange(firstChange);
1695
1578
  }
1696
1579
  else {
1697
- const keys = key.split('.');
1698
- let value = option;
1699
- for (let i = 0, len = keys.length; i < len; ++i) {
1700
- if (value == null) {
1701
- return null;
1702
- }
1703
- value = value[keys[i]];
1704
- }
1705
- return value;
1580
+ this._setVirtualHeight();
1581
+ this._updateItems(firstChange);
1706
1582
  }
1707
1583
  }
1708
- mapItem(item, index) {
1709
- const label = isDefined(item.$ngOptionLabel)
1710
- ? item.$ngOptionLabel
1711
- : this.resolveNested(item, this._ngSelect.bindLabel);
1712
- const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
1713
- return {
1714
- index,
1715
- label: isDefined(label) ? label.toString() : '',
1716
- value,
1717
- disabled: item.disabled,
1718
- htmlId: `${this._ngSelect._uid}-option-${index}`,
1719
- };
1720
- }
1721
- mapSelectedItems() {
1722
- const multiple = this._ngSelect.multiple;
1723
- for (const selected of this.selectedItems) {
1724
- const value = this._ngSelect.bindValue
1725
- ? this.resolveNested(selected.value, this._ngSelect.bindValue)
1726
- : selected.value;
1727
- const item = isDefined(value) ? this.findItem(value) : null;
1728
- this._selectionModel.unselect(selected, multiple);
1729
- this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
1584
+ _updateItems(firstChange) {
1585
+ this.update.emit(this.items);
1586
+ if (firstChange === false) {
1587
+ return;
1730
1588
  }
1731
- if (this._ngSelect.hideSelected) {
1732
- this._filteredItems = this.filteredItems.filter(x => this.selectedItems.indexOf(x) === -1);
1589
+ this._zone.runOutsideAngular(() => {
1590
+ Promise.resolve().then(() => {
1591
+ const panelHeight = this._scrollHost.clientHeight;
1592
+ this._panelUtils.setDimensions(0, panelHeight);
1593
+ this._handleDropdownPosition();
1594
+ this.scrollTo(this.markedItem, firstChange);
1595
+ });
1596
+ });
1597
+ }
1598
+ _updateItemsRange(firstChange) {
1599
+ this._zone.runOutsideAngular(() => {
1600
+ this._measureDimensions().then(() => {
1601
+ if (firstChange) {
1602
+ this._renderItemsRange(this._startOffset);
1603
+ this._handleDropdownPosition();
1604
+ }
1605
+ else {
1606
+ this._renderItemsRange();
1607
+ }
1608
+ });
1609
+ });
1610
+ }
1611
+ _onContentScrolled(scrollTop) {
1612
+ if (this.virtualScroll) {
1613
+ this._renderItemsRange(scrollTop);
1733
1614
  }
1615
+ this._lastScrollPosition = scrollTop;
1616
+ this._fireScrollToEnd(scrollTop);
1734
1617
  }
1735
- _showSelected(item) {
1736
- this._filteredItems.push(item);
1737
- if (item.parent) {
1738
- const parent = item.parent;
1739
- const parentExists = this._filteredItems.find(x => x === parent);
1740
- if (!parentExists) {
1741
- this._filteredItems.push(parent);
1742
- }
1618
+ _updateVirtualHeight(height) {
1619
+ if (this._updateScrollHeight) {
1620
+ this._scrollSpacer.style.height = `${height}px`;
1621
+ this._updateScrollHeight = false;
1743
1622
  }
1744
- else if (item.children) {
1745
- for (const child of item.children) {
1746
- child.selected = false;
1747
- this._filteredItems.push(child);
1748
- }
1623
+ }
1624
+ _setVirtualHeight() {
1625
+ if (!this._scrollSpacer) {
1626
+ return;
1749
1627
  }
1750
- this._filteredItems = [...this._filteredItems.sort((a, b) => a.index - b.index)];
1628
+ this._scrollSpacer.style.height = `0px`;
1751
1629
  }
1752
- _hideSelected(item) {
1753
- this._filteredItems = this._filteredItems.filter(x => x !== item);
1754
- if (item.parent) {
1755
- const children = item.parent.children;
1756
- if (children.every(x => x.selected)) {
1757
- this._filteredItems = this._filteredItems.filter(x => x !== item.parent);
1758
- }
1630
+ _onItemsLengthChanged() {
1631
+ this._updateScrollHeight = true;
1632
+ }
1633
+ _renderItemsRange(scrollTop) {
1634
+ if (scrollTop && this._lastScrollPosition === scrollTop) {
1635
+ return;
1759
1636
  }
1760
- else if (item.children) {
1761
- this._filteredItems = this.filteredItems.filter(x => x.parent !== item);
1637
+ scrollTop = scrollTop || this._scrollHost.scrollTop;
1638
+ const range = this._panelUtils.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);
1639
+ this._updateVirtualHeight(range.scrollHeight);
1640
+ this._scrollContent.style.transform = `translateY(${range.topPadding}px)`;
1641
+ this._zone.run(() => {
1642
+ this.update.emit(this.items.slice(range.start, range.end));
1643
+ this.scroll.emit({ start: range.start, end: range.end });
1644
+ });
1645
+ if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
1646
+ this._scrollHost.scrollTop = scrollTop;
1647
+ this._lastScrollPosition = scrollTop;
1762
1648
  }
1763
1649
  }
1764
- _defaultSearchFn(search, opt) {
1765
- const label = stripSpecialChars(opt.label).toLocaleLowerCase();
1766
- return label.indexOf(search) > -1;
1767
- }
1768
- _getNextItemIndex(steps) {
1769
- if (steps > 0) {
1770
- return this._markedIndex >= this._filteredItems.length - 1 ? 0 : this._markedIndex + 1;
1650
+ _measureDimensions() {
1651
+ if (this._panelUtils.dimensions.itemHeight > 0 || this.itemsLength === 0) {
1652
+ return Promise.resolve(this._panelUtils.dimensions);
1771
1653
  }
1772
- return this._markedIndex <= 0 ? this._filteredItems.length - 1 : this._markedIndex - 1;
1654
+ const [first] = this.items;
1655
+ this.update.emit([first]);
1656
+ return Promise.resolve().then(() => {
1657
+ const option = this._dropdown.querySelector(`#${first.htmlId}`);
1658
+ const optionHeight = option.clientHeight;
1659
+ this._scrollSpacer.style.height = `${optionHeight * this.itemsLength}px`;
1660
+ const panelHeight = this._scrollHost.clientHeight;
1661
+ this._panelUtils.setDimensions(optionHeight, panelHeight);
1662
+ return this._panelUtils.dimensions;
1663
+ });
1773
1664
  }
1774
- _stepToItem(steps) {
1775
- if (this._filteredItems.length === 0 || this._filteredItems.every(x => x.disabled)) {
1665
+ _fireScrollToEnd(scrollTop) {
1666
+ if (this._scrollToEndFired || scrollTop === 0) {
1776
1667
  return;
1777
1668
  }
1778
- this._markedIndex = this._getNextItemIndex(steps);
1779
- if (this.markedItem?.disabled) {
1780
- this._stepToItem(steps);
1669
+ const padding = this.virtualScroll ? this._scrollSpacer : this._scrollContent;
1670
+ if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight - 1) {
1671
+ this._zone.run(() => this.scrollToEnd.emit());
1672
+ this._scrollToEndFired = true;
1781
1673
  }
1782
1674
  }
1783
- _getLastMarkedIndex() {
1784
- if (this._ngSelect.hideSelected) {
1785
- return -1;
1675
+ _calculateCurrentPosition(dropdownEl) {
1676
+ if (this.position !== 'auto') {
1677
+ return this.position;
1786
1678
  }
1787
- if (this._markedIndex > -1 && this.markedItem == null) {
1788
- return -1;
1679
+ const selectRect = this._select.getBoundingClientRect();
1680
+ const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
1681
+ const offsetTop = selectRect.top + window.pageYOffset;
1682
+ const height = selectRect.height;
1683
+ const dropdownHeight = dropdownEl.getBoundingClientRect().height;
1684
+ if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
1685
+ return 'top';
1789
1686
  }
1790
- const selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
1791
- if (this.lastSelectedItem && selectedIndex < 0) {
1792
- return -1;
1687
+ else {
1688
+ return 'bottom';
1793
1689
  }
1794
- return Math.max(this.markedIndex, selectedIndex);
1795
1690
  }
1796
- _groupBy(items, prop) {
1797
- const groups = new Map();
1798
- if (items.length === 0) {
1799
- return groups;
1691
+ _appendDropdown() {
1692
+ if (!this.appendTo) {
1693
+ return;
1800
1694
  }
1801
- // Check if items are already grouped by given key.
1802
- if (Array.isArray(items[0].value[prop])) {
1803
- for (const item of items) {
1804
- const children = (item.value[prop] || []).map((x, index) => this.mapItem(x, index));
1805
- groups.set(item, children);
1806
- }
1807
- return groups;
1695
+ this._parent = this._dropdown.shadowRoot
1696
+ ? this._dropdown.shadowRoot.querySelector(this.appendTo)
1697
+ : document.querySelector(this.appendTo);
1698
+ if (!this._parent) {
1699
+ throw new Error(`appendTo selector ${this.appendTo} did not found any parent element`);
1808
1700
  }
1809
- const isFnKey = isFunction(this._ngSelect.groupBy);
1810
- const keyFn = (item) => {
1811
- const key = isFnKey ? prop(item.value) : item.value[prop];
1812
- return isDefined(key) ? key : undefined;
1813
- };
1814
- // Group items by key.
1815
- for (const item of items) {
1816
- const key = keyFn(item);
1817
- const group = groups.get(key);
1818
- if (group) {
1819
- group.push(item);
1820
- }
1821
- else {
1822
- groups.set(key, [item]);
1823
- }
1701
+ this._updateXPosition();
1702
+ this._parent.appendChild(this._dropdown);
1703
+ }
1704
+ _updateXPosition() {
1705
+ const select = this._select.getBoundingClientRect();
1706
+ const parent = this._parent.getBoundingClientRect();
1707
+ const offsetLeft = select.left - parent.left;
1708
+ this._dropdown.style.left = offsetLeft + 'px';
1709
+ this._dropdown.style.width = select.width + 'px';
1710
+ this._dropdown.style.minWidth = select.width + 'px';
1711
+ }
1712
+ _updateYPosition() {
1713
+ const select = this._select.getBoundingClientRect();
1714
+ const parent = this._parent.getBoundingClientRect();
1715
+ const delta = select.height;
1716
+ if (this._currentPosition === 'top') {
1717
+ const offsetBottom = parent.bottom - select.bottom;
1718
+ this._dropdown.style.bottom = offsetBottom + delta + 'px';
1719
+ this._dropdown.style.top = 'auto';
1720
+ }
1721
+ else if (this._currentPosition === 'bottom') {
1722
+ const offsetTop = select.top - parent.top;
1723
+ this._dropdown.style.top = offsetTop + delta + 'px';
1724
+ this._dropdown.style.bottom = 'auto';
1824
1725
  }
1825
- return groups;
1826
1726
  }
1827
- _flatten(groups) {
1828
- const isGroupByFn = isFunction(this._ngSelect.groupBy);
1829
- const items = [];
1830
- let groupIndex = 0;
1831
- for (const key of groups.keys()) {
1832
- let i = items.length;
1833
- if (key == null) {
1834
- const withoutGroup = groups.get(undefined) || [];
1835
- items.push(...withoutGroup.map(x => {
1836
- x.index = i++;
1837
- return x;
1838
- }));
1839
- continue;
1840
- }
1841
- const isObjectKey = isObject(key);
1842
- const parent = {
1843
- label: isObjectKey ? '' : String(key),
1844
- children: null,
1845
- parent: null,
1846
- index: i++,
1847
- disabled: !this._ngSelect.selectableGroup,
1848
- htmlId: `${this._ngSelect._uid}-group-${groupIndex}-heading`,
1849
- };
1850
- const groupKey = isGroupByFn
1851
- ? this._ngSelect.bindLabel
1852
- : this._ngSelect.groupBy;
1853
- const groupValue = this._ngSelect.groupValue ||
1854
- (() => {
1855
- if (isObjectKey) {
1856
- return key.value;
1857
- }
1858
- return { [groupKey]: key };
1859
- });
1860
- const children = groups.get(key).map(x => {
1861
- x.parent = parent;
1862
- x.children = null;
1863
- x.index = i++;
1864
- return x;
1727
+ _setupMousedownListener() {
1728
+ this._zone.runOutsideAngular(() => {
1729
+ fromEvent(this._dropdown, 'mousedown')
1730
+ .pipe(takeUntil(this._destroy$))
1731
+ .subscribe(event => {
1732
+ const target = event.target;
1733
+ if (target.tagName === 'INPUT') {
1734
+ return;
1735
+ }
1736
+ event.preventDefault();
1865
1737
  });
1866
- parent.children = children;
1867
- parent.value = groupValue(key, children.map(x => x.value));
1868
- items.push(parent);
1869
- items.push(...children);
1870
- groupIndex++;
1871
- }
1872
- return items;
1738
+ });
1873
1739
  }
1740
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
1741
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: NgSelectPanel, isStandalone: true, selector: "ng-select-panel", inputs: { listboxId: "listboxId", items: "items", markedItem: "markedItem", position: "position", appendTo: "appendTo", bufferAmount: "bufferAmount", virtualScroll: ["virtualScroll", "virtualScroll", booleanAttribute], multiple: ["multiple", "multiple", booleanAttribute], headerTemplate: "headerTemplate", footerTemplate: "footerTemplate", filterValue: "filterValue" }, outputs: { update: "update", scroll: "scroll", scrollToEnd: "scrollToEnd", outsideClick: "outsideClick" }, host: { properties: { "class.ng-select-multiple": "multiple" }, classAttribute: "ng-select-panel" }, viewQueries: [{ propertyName: "scrollHostElRef", first: true, predicate: ["scrollHost"], descendants: true, read: ElementRef, static: true }, { propertyName: "scrollContentElRef", first: true, predicate: ["scrollContent"], descendants: true, read: ElementRef, static: true }, { propertyName: "scrollSpacerElRef", first: true, predicate: ["scrollSpacer"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
1742
+ @if (headerTemplate) {
1743
+ <div class="ng-select-panel-header">
1744
+ <ng-container
1745
+ [ngTemplateOutlet]="headerTemplate"
1746
+ [ngTemplateOutletContext]="{ searchTerm: filterValue }"
1747
+ />
1748
+ </div>
1749
+ }
1750
+ <div
1751
+ #scrollHost
1752
+ class="ng-select-listbox"
1753
+ [class.ng-select-virtual-scroll-host]="virtualScroll"
1754
+ [attr.id]="listboxId"
1755
+ [attr.aria-multiselectable]="multiple"
1756
+ role="listbox"
1757
+ >
1758
+ <div #scrollSpacer [class.ng-select-virtual-scroll-spacer]="virtualScroll"></div>
1759
+ <div
1760
+ #scrollContent
1761
+ [class.ng-select-virtual-scroll-content]="virtualScroll && items.length"
1762
+ role="presentation"
1763
+ >
1764
+ <ng-content />
1765
+ </div>
1766
+ </div>
1767
+ @if (footerTemplate) {
1768
+ <div class="ng-select-panel-footer">
1769
+ <ng-container
1770
+ [ngTemplateOutlet]="footerTemplate"
1771
+ [ngTemplateOutletContext]="{ searchTerm: filterValue }"
1772
+ />
1773
+ </div>
1774
+ }
1775
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1874
1776
  }
1777
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanel, decorators: [{
1778
+ type: Component,
1779
+ args: [{
1780
+ selector: 'ng-select-panel',
1781
+ template: `
1782
+ @if (headerTemplate) {
1783
+ <div class="ng-select-panel-header">
1784
+ <ng-container
1785
+ [ngTemplateOutlet]="headerTemplate"
1786
+ [ngTemplateOutletContext]="{ searchTerm: filterValue }"
1787
+ />
1788
+ </div>
1789
+ }
1790
+ <div
1791
+ #scrollHost
1792
+ class="ng-select-listbox"
1793
+ [class.ng-select-virtual-scroll-host]="virtualScroll"
1794
+ [attr.id]="listboxId"
1795
+ [attr.aria-multiselectable]="multiple"
1796
+ role="listbox"
1797
+ >
1798
+ <div #scrollSpacer [class.ng-select-virtual-scroll-spacer]="virtualScroll"></div>
1799
+ <div
1800
+ #scrollContent
1801
+ [class.ng-select-virtual-scroll-content]="virtualScroll && items.length"
1802
+ role="presentation"
1803
+ >
1804
+ <ng-content />
1805
+ </div>
1806
+ </div>
1807
+ @if (footerTemplate) {
1808
+ <div class="ng-select-panel-footer">
1809
+ <ng-container
1810
+ [ngTemplateOutlet]="footerTemplate"
1811
+ [ngTemplateOutletContext]="{ searchTerm: filterValue }"
1812
+ />
1813
+ </div>
1814
+ }
1815
+ `,
1816
+ imports: [NgTemplateOutlet],
1817
+ host: {
1818
+ 'class': 'ng-select-panel',
1819
+ '[class.ng-select-multiple]': 'multiple',
1820
+ },
1821
+ encapsulation: ViewEncapsulation.None,
1822
+ changeDetection: ChangeDetectionStrategy.OnPush,
1823
+ }]
1824
+ }], propDecorators: { listboxId: [{
1825
+ type: Input
1826
+ }], items: [{
1827
+ type: Input
1828
+ }], markedItem: [{
1829
+ type: Input
1830
+ }], position: [{
1831
+ type: Input
1832
+ }], appendTo: [{
1833
+ type: Input
1834
+ }], bufferAmount: [{
1835
+ type: Input
1836
+ }], virtualScroll: [{
1837
+ type: Input,
1838
+ args: [{ transform: booleanAttribute }]
1839
+ }], multiple: [{
1840
+ type: Input,
1841
+ args: [{ transform: booleanAttribute }]
1842
+ }], headerTemplate: [{
1843
+ type: Input
1844
+ }], footerTemplate: [{
1845
+ type: Input
1846
+ }], filterValue: [{
1847
+ type: Input
1848
+ }], update: [{
1849
+ type: Output
1850
+ }], scroll: [{
1851
+ type: Output
1852
+ }], scrollToEnd: [{
1853
+ type: Output
1854
+ }], outsideClick: [{
1855
+ type: Output
1856
+ }], scrollHostElRef: [{
1857
+ type: ViewChild,
1858
+ args: ['scrollHost', { read: ElementRef, static: true }]
1859
+ }], scrollContentElRef: [{
1860
+ type: ViewChild,
1861
+ args: ['scrollContent', { read: ElementRef, static: true }]
1862
+ }], scrollSpacerElRef: [{
1863
+ type: ViewChild,
1864
+ args: ['scrollSpacer', { read: ElementRef, static: true }]
1865
+ }] } });
1875
1866
 
1876
- class NgSelectConfig {
1877
- placeholder;
1878
- fixedPlaceholder = true;
1879
- notFoundText = 'No items found';
1880
- typeToSearchText = 'Type to search';
1881
- addTagText = 'Add item';
1882
- loadingText = 'Loading...';
1883
- clearAllText = 'Clear all';
1884
- virtualScroll = false;
1885
- openOnEnter = true;
1886
- appendTo;
1887
- bindValue;
1888
- bindLabel;
1889
- clearSearchOnAdd;
1890
- deselectOnClick;
1891
- appearance = 'underline';
1892
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1893
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, providedIn: 'root' });
1894
- }
1895
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, decorators: [{
1896
- type: Injectable,
1897
- args: [{ providedIn: 'root' }]
1898
- }] });
1899
-
1900
- class NgItemLabel {
1901
- ngItemLabel = '';
1902
- escape = true;
1867
+ class NgSelectLabelRenderer {
1868
+ ngSelectLabelValue = '';
1869
+ ngSelectLabelEscape = true;
1903
1870
  element = inject(ElementRef);
1904
1871
  ngOnChanges() {
1905
- this.element.nativeElement.innerHTML = this.escape
1906
- ? escapeHTML(this.ngItemLabel)
1907
- : this.ngItemLabel;
1872
+ this.element.nativeElement.innerHTML = this.ngSelectLabelEscape
1873
+ ? escapeHTML(this.ngSelectLabelValue)
1874
+ : this.ngSelectLabelValue;
1908
1875
  }
1909
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgItemLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1910
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgItemLabel, isStandalone: true, selector: "[ngItemLabel]", inputs: { ngItemLabel: "ngItemLabel", escape: "escape" }, usesOnChanges: true, ngImport: i0 });
1876
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLabelRenderer, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1877
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectLabelRenderer, isStandalone: true, selector: "[ngSelectLabelValue]", inputs: { ngSelectLabelValue: "ngSelectLabelValue", ngSelectLabelEscape: "ngSelectLabelEscape" }, usesOnChanges: true, ngImport: i0 });
1911
1878
  }
1912
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgItemLabel, decorators: [{
1879
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLabelRenderer, decorators: [{
1913
1880
  type: Directive,
1914
1881
  args: [{
1915
- selector: '[ngItemLabel]',
1882
+ selector: '[ngSelectLabelValue]',
1916
1883
  }]
1917
- }], propDecorators: { ngItemLabel: [{
1884
+ }], propDecorators: { ngSelectLabelValue: [{
1918
1885
  type: Input
1919
- }], escape: [{
1886
+ }], ngSelectLabelEscape: [{
1920
1887
  type: Input
1921
1888
  }] } });
1922
- class NgOptionTemplate {
1889
+ class NgSelectOptionTemplate {
1923
1890
  template = inject(TemplateRef);
1924
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptionTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1925
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgOptionTemplate, isStandalone: true, selector: "[ng-option-tmp]", ngImport: i0 });
1891
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptionTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1892
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectOptionTemplate, isStandalone: true, selector: "[ngSelectOption]", ngImport: i0 });
1926
1893
  }
1927
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptionTemplate, decorators: [{
1894
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptionTemplate, decorators: [{
1928
1895
  type: Directive,
1929
1896
  args: [{
1930
- selector: '[ng-option-tmp]',
1897
+ selector: '[ngSelectOption]',
1931
1898
  }]
1932
1899
  }] });
1933
- class NgOptgroupTemplate {
1900
+ class NgSelectOptgroupTemplate {
1934
1901
  template = inject(TemplateRef);
1935
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptgroupTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1936
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgOptgroupTemplate, isStandalone: true, selector: "[ng-optgroup-tmp]", ngImport: i0 });
1902
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptgroupTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1903
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectOptgroupTemplate, isStandalone: true, selector: "[ngSelectOptgroup]", ngImport: i0 });
1937
1904
  }
1938
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptgroupTemplate, decorators: [{
1905
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptgroupTemplate, decorators: [{
1939
1906
  type: Directive,
1940
1907
  args: [{
1941
- selector: '[ng-optgroup-tmp]',
1908
+ selector: '[ngSelectOptgroup]',
1942
1909
  }]
1943
1910
  }] });
1944
- class NgLabelTemplate {
1911
+ class NgSelectLabelTemplate {
1945
1912
  template = inject(TemplateRef);
1946
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgLabelTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1947
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgLabelTemplate, isStandalone: true, selector: "[ng-label-tmp]", ngImport: i0 });
1913
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLabelTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1914
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectLabelTemplate, isStandalone: true, selector: "[ngSelectLabel]", ngImport: i0 });
1948
1915
  }
1949
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgLabelTemplate, decorators: [{
1916
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLabelTemplate, decorators: [{
1950
1917
  type: Directive,
1951
1918
  args: [{
1952
- selector: '[ng-label-tmp]',
1919
+ selector: '[ngSelectLabel]',
1953
1920
  }]
1954
1921
  }] });
1955
- class NgMultiLabelTemplate {
1922
+ class NgSelectMultiLabelTemplate {
1956
1923
  template = inject(TemplateRef);
1957
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgMultiLabelTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1958
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgMultiLabelTemplate, isStandalone: true, selector: "[ng-multi-label-tmp]", ngImport: i0 });
1924
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectMultiLabelTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1925
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectMultiLabelTemplate, isStandalone: true, selector: "[ngSelectMultiLabel]", ngImport: i0 });
1959
1926
  }
1960
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgMultiLabelTemplate, decorators: [{
1927
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectMultiLabelTemplate, decorators: [{
1961
1928
  type: Directive,
1962
1929
  args: [{
1963
- selector: '[ng-multi-label-tmp]',
1930
+ selector: '[ngSelectMultiLabel]',
1964
1931
  }]
1965
1932
  }] });
1966
- class NgHeaderTemplate {
1933
+ class NgSelectPanelHeaderTemplate {
1967
1934
  template = inject(TemplateRef);
1968
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgHeaderTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1969
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgHeaderTemplate, isStandalone: true, selector: "[ng-header-tmp]", ngImport: i0 });
1935
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelHeaderTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1936
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectPanelHeaderTemplate, isStandalone: true, selector: "[ngSelectPanelHeader]", ngImport: i0 });
1970
1937
  }
1971
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgHeaderTemplate, decorators: [{
1938
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelHeaderTemplate, decorators: [{
1972
1939
  type: Directive,
1973
1940
  args: [{
1974
- selector: '[ng-header-tmp]',
1941
+ selector: '[ngSelectPanelHeader]',
1975
1942
  }]
1976
1943
  }] });
1977
- class NgFooterTemplate {
1944
+ class NgSelectPanelFooterTemplate {
1978
1945
  template = inject(TemplateRef);
1979
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgFooterTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1980
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgFooterTemplate, isStandalone: true, selector: "[ng-footer-tmp]", ngImport: i0 });
1946
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelFooterTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1947
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectPanelFooterTemplate, isStandalone: true, selector: "[ngSelectPanelFooter]", ngImport: i0 });
1981
1948
  }
1982
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgFooterTemplate, decorators: [{
1949
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPanelFooterTemplate, decorators: [{
1983
1950
  type: Directive,
1984
1951
  args: [{
1985
- selector: '[ng-footer-tmp]',
1952
+ selector: '[ngSelectPanelFooter]',
1986
1953
  }]
1987
1954
  }] });
1988
- class NgNotFoundTemplate {
1955
+ class NgSelectNotFoundTemplate {
1989
1956
  template = inject(TemplateRef);
1990
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgNotFoundTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1991
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgNotFoundTemplate, isStandalone: true, selector: "[ng-notfound-tmp]", ngImport: i0 });
1957
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectNotFoundTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1958
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectNotFoundTemplate, isStandalone: true, selector: "[ngSelectNotFound]", ngImport: i0 });
1992
1959
  }
1993
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgNotFoundTemplate, decorators: [{
1960
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectNotFoundTemplate, decorators: [{
1994
1961
  type: Directive,
1995
1962
  args: [{
1996
- selector: '[ng-notfound-tmp]',
1963
+ selector: '[ngSelectNotFound]',
1997
1964
  }]
1998
1965
  }] });
1999
- class NgPlaceholderTemplate {
1966
+ class NgSelectPlaceholderTemplate {
2000
1967
  template = inject(TemplateRef);
2001
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgPlaceholderTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2002
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgPlaceholderTemplate, isStandalone: true, selector: "[ng-placeholder-tmp]", ngImport: i0 });
1968
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPlaceholderTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1969
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectPlaceholderTemplate, isStandalone: true, selector: "[ngSelectPlaceholder]", ngImport: i0 });
2003
1970
  }
2004
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgPlaceholderTemplate, decorators: [{
1971
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectPlaceholderTemplate, decorators: [{
2005
1972
  type: Directive,
2006
1973
  args: [{
2007
- selector: '[ng-placeholder-tmp]',
1974
+ selector: '[ngSelectPlaceholder]',
2008
1975
  }]
2009
1976
  }] });
2010
- class NgTypeToSearchTemplate {
1977
+ class NgSelectTypeToSearchTemplate {
2011
1978
  template = inject(TemplateRef);
2012
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgTypeToSearchTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2013
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgTypeToSearchTemplate, isStandalone: true, selector: "[ng-typetosearch-tmp]", ngImport: i0 });
1979
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectTypeToSearchTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1980
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectTypeToSearchTemplate, isStandalone: true, selector: "[ngSelectTypeToSearch]", ngImport: i0 });
2014
1981
  }
2015
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgTypeToSearchTemplate, decorators: [{
1982
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectTypeToSearchTemplate, decorators: [{
2016
1983
  type: Directive,
2017
1984
  args: [{
2018
- selector: '[ng-typetosearch-tmp]',
1985
+ selector: '[ngSelectTypeToSearch]',
2019
1986
  }]
2020
1987
  }] });
2021
- class NgLoadingTextTemplate {
1988
+ class NgSelectLoadingTextTemplate {
2022
1989
  template = inject(TemplateRef);
2023
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgLoadingTextTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2024
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgLoadingTextTemplate, isStandalone: true, selector: "[ng-loadingtext-tmp]", ngImport: i0 });
1990
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLoadingTextTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1991
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectLoadingTextTemplate, isStandalone: true, selector: "[ngSelectLoadingText]", ngImport: i0 });
2025
1992
  }
2026
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgLoadingTextTemplate, decorators: [{
1993
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLoadingTextTemplate, decorators: [{
2027
1994
  type: Directive,
2028
1995
  args: [{
2029
- selector: '[ng-loadingtext-tmp]',
1996
+ selector: '[ngSelectLoadingText]',
2030
1997
  }]
2031
1998
  }] });
2032
- class NgTagTemplate {
1999
+ class NgSelectTagTemplate {
2033
2000
  template = inject(TemplateRef);
2034
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgTagTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2035
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgTagTemplate, isStandalone: true, selector: "[ng-tag-tmp]", ngImport: i0 });
2001
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectTagTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2002
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectTagTemplate, isStandalone: true, selector: "[ngSelectTag]", ngImport: i0 });
2036
2003
  }
2037
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgTagTemplate, decorators: [{
2004
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectTagTemplate, decorators: [{
2038
2005
  type: Directive,
2039
2006
  args: [{
2040
- selector: '[ng-tag-tmp]',
2007
+ selector: '[ngSelectTag]',
2041
2008
  }]
2042
2009
  }] });
2043
- class NgLoadingSpinnerTemplate {
2010
+ class NgSelectLoadingTemplate {
2044
2011
  template = inject(TemplateRef);
2045
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgLoadingSpinnerTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2046
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgLoadingSpinnerTemplate, isStandalone: true, selector: "[ng-loadingspinner-tmp]", ngImport: i0 });
2012
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLoadingTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2013
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectLoadingTemplate, isStandalone: true, selector: "[ngSelectLoading]", ngImport: i0 });
2047
2014
  }
2048
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgLoadingSpinnerTemplate, decorators: [{
2015
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectLoadingTemplate, decorators: [{
2049
2016
  type: Directive,
2050
2017
  args: [{
2051
- selector: '[ng-loadingspinner-tmp]',
2018
+ selector: '[ngSelectLoading]',
2052
2019
  }]
2053
2020
  }] });
2054
- class NgClearButtonTemplate {
2021
+ class NgSelectClearButtonTemplate {
2055
2022
  template = inject(TemplateRef);
2056
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgClearButtonTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2057
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgClearButtonTemplate, isStandalone: true, selector: "[ng-clearbutton-tmp]", ngImport: i0 });
2023
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectClearButtonTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2024
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectClearButtonTemplate, isStandalone: true, selector: "[ngSelectClearButton]", ngImport: i0 });
2058
2025
  }
2059
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgClearButtonTemplate, decorators: [{
2026
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectClearButtonTemplate, decorators: [{
2060
2027
  type: Directive,
2061
2028
  args: [{
2062
- selector: '[ng-clearbutton-tmp]',
2029
+ selector: '[ngSelectClearButton]',
2063
2030
  }]
2064
2031
  }] });
2065
2032
 
@@ -2147,6 +2114,8 @@ class NgSelect {
2147
2114
  classes = inject(new HostAttributeToken('class'), { optional: true });
2148
2115
  _classList = {};
2149
2116
  _uid = `ng-select-${nextUniqueId++}`;
2117
+ _listboxId = `${this._uid}-listbox`;
2118
+ _viewValuesId = `${this._uid}-view-values`;
2150
2119
  bindLabel = this._config.bindLabel;
2151
2120
  bindValue = this._config.bindValue;
2152
2121
  placeholder = this._config.placeholder;
@@ -2186,12 +2155,17 @@ class NgSelect {
2186
2155
  searchFn = null;
2187
2156
  keyDownFn = (e) => true;
2188
2157
  trackByFn = null;
2189
- appearance = this._config.appearance;
2190
2158
  tabIndex;
2159
+ inputAttrs = {};
2191
2160
  ariaLabel;
2192
2161
  ariaLabelledby;
2193
- ariaDescribedby;
2194
- inputAttrs = {};
2162
+ get ariaDescribedby() {
2163
+ return this._ariaDescribedby || this._viewValuesId;
2164
+ }
2165
+ set ariaDescribedby(value) {
2166
+ this._ariaDescribedby = value ? `${value} ${this._viewValuesId}` : this._viewValuesId;
2167
+ }
2168
+ _ariaDescribedby;
2195
2169
  set panelClass(value) {
2196
2170
  const newClassList = {};
2197
2171
  this.classes?.split(/\s+/).forEach(c => (newClassList[c] = true));
@@ -2208,12 +2182,14 @@ class NgSelect {
2208
2182
  this._cdr.markForCheck();
2209
2183
  }
2210
2184
  get inputId() {
2211
- return this._inputId || `${this._uid}-input`;
2185
+ return this._inputId;
2212
2186
  }
2213
2187
  set inputId(value) {
2214
- this._inputId = value;
2188
+ if (value) {
2189
+ this._inputId = value;
2190
+ }
2215
2191
  }
2216
- _inputId;
2192
+ _inputId = `${this._uid}-input`;
2217
2193
  get items() {
2218
2194
  return this._items;
2219
2195
  }
@@ -2271,14 +2247,14 @@ class NgSelect {
2271
2247
  optgroupTemplate;
2272
2248
  labelTemplate;
2273
2249
  multiLabelTemplate;
2274
- headerTemplate;
2275
- footerTemplate;
2250
+ panelHeaderTemplate;
2251
+ panelFooterTemplate;
2276
2252
  notFoundTemplate;
2277
2253
  placeholderTemplate;
2278
2254
  typeToSearchTemplate;
2279
2255
  loadingTextTemplate;
2280
2256
  tagTemplate;
2281
- loadingSpinnerTemplate;
2257
+ loadingTemplate;
2282
2258
  clearButtonTemplate;
2283
2259
  itemsList = new ItemsList(this, this.newSelectionModel?.() ?? DefaultSelectionModelFactory());
2284
2260
  element = this._elementRef.nativeElement;
@@ -2300,6 +2276,9 @@ class NgSelect {
2300
2276
  get selectedValues() {
2301
2277
  return this.selectedItems.map(x => x.value);
2302
2278
  }
2279
+ get selectedViewValuesStr() {
2280
+ return this.selectedItems.map(x => x.viewValue).join(', ');
2281
+ }
2303
2282
  get hasValue() {
2304
2283
  return this.selectedItems.length > 0;
2305
2284
  }
@@ -2327,7 +2306,7 @@ class NgSelect {
2327
2306
  return this.editableSearchTerm && !this.multiple;
2328
2307
  }
2329
2308
  get _isTypeahead() {
2330
- return this.typeahead && this.typeahead.observers.length > 0;
2309
+ return this.typeahead && this.typeahead.observed;
2331
2310
  }
2332
2311
  get _validTerm() {
2333
2312
  const term = this.searchTerm?.trim();
@@ -2346,9 +2325,6 @@ class NgSelect {
2346
2325
  const empty = this.itemsList.filteredItems.length === 0;
2347
2326
  return empty && this._isTypeahead && !this._validTerm && !this.loading;
2348
2327
  }
2349
- get listboxId() {
2350
- return `${this._uid}-listbox`;
2351
- }
2352
2328
  _onChange = (_) => { };
2353
2329
  _onTouched = () => { };
2354
2330
  trackByOption = (_, item) => {
@@ -2468,33 +2444,34 @@ class NgSelect {
2468
2444
  }
2469
2445
  }
2470
2446
  handleMousedown(e) {
2471
- if (this.preventToggleOnRightClick && e.button === 2) {
2447
+ if (this.preventToggleOnRightClick && e.button === 2)
2472
2448
  return;
2473
- }
2474
2449
  const target = e.target;
2475
- if (target.tagName !== 'INPUT') {
2450
+ const isInput = target.tagName === 'INPUT';
2451
+ const isClearClick = !!target.closest('.ng-select-clear');
2452
+ const isArrowClick = !!target.closest('.ng-select-arrow');
2453
+ const isValueRemoveClick = !!target.closest('.ng-select-value-remove');
2454
+ if (!isInput) {
2476
2455
  e.preventDefault();
2477
2456
  }
2478
- if (target.classList.contains('ng-clear-wrapper')) {
2457
+ if (isClearClick) {
2479
2458
  this.handleClearClick();
2480
2459
  return;
2481
2460
  }
2482
- if (target.classList.contains('ng-arrow-wrapper')) {
2461
+ if (isArrowClick) {
2483
2462
  this.handleArrowClick();
2484
2463
  return;
2485
2464
  }
2486
- if (target.classList.contains('ng-value-remove')) {
2465
+ if (isValueRemoveClick) {
2487
2466
  return;
2488
2467
  }
2489
2468
  if (!this.focused) {
2490
2469
  this.focus();
2491
2470
  }
2492
- if (this.searchable) {
2493
- this.open();
2494
- }
2495
- else {
2496
- this.toggle();
2471
+ if (this.searchable && this.isOpen) {
2472
+ return;
2497
2473
  }
2474
+ this.toggle();
2498
2475
  }
2499
2476
  handleArrowClick() {
2500
2477
  if (this.isOpen) {
@@ -2561,6 +2538,12 @@ class NgSelect {
2561
2538
  this.closeEvent.emit();
2562
2539
  this._cdr.markForCheck();
2563
2540
  }
2541
+ focus() {
2542
+ this.searchInput.nativeElement.focus();
2543
+ }
2544
+ blur() {
2545
+ this.searchInput.nativeElement.blur();
2546
+ }
2564
2547
  toggleItem(item) {
2565
2548
  if (!item || item.disabled || this.disabled) {
2566
2549
  return;
@@ -2591,12 +2574,6 @@ class NgSelect {
2591
2574
  }
2592
2575
  this._onSelectionChanged();
2593
2576
  }
2594
- focus() {
2595
- this.searchInput.nativeElement.focus();
2596
- }
2597
- blur() {
2598
- this.searchInput.nativeElement.blur();
2599
- }
2600
2577
  unselect(item) {
2601
2578
  if (!item) {
2602
2579
  return;
@@ -2711,6 +2688,7 @@ class NgSelect {
2711
2688
  this.items = options.map(option => ({
2712
2689
  $ngOptionValue: option.value,
2713
2690
  $ngOptionLabel: option.elementRef.nativeElement.innerHTML,
2691
+ viewValue: (option.elementRef.nativeElement.textContent || '').trim(),
2714
2692
  disabled: option.disabled,
2715
2693
  }));
2716
2694
  this.itemsList.setItems(this.items);
@@ -2978,17 +2956,17 @@ class NgSelect {
2978
2956
  }
2979
2957
  }
2980
2958
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
2981
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: NgSelect, isStandalone: true, selector: "ng-select", inputs: { bindLabel: "bindLabel", bindValue: "bindValue", placeholder: "placeholder", fixedPlaceholder: "fixedPlaceholder", appendTo: "appendTo", panelPosition: "panelPosition", panelDisabled: ["panelDisabled", "panelDisabled", booleanAttribute], readonly: ["readonly", "readonly", booleanAttribute], multiple: ["multiple", "multiple", booleanAttribute], searchable: ["searchable", "searchable", booleanAttribute], clearable: ["clearable", "clearable", booleanAttribute], clearOnBackspace: ["clearOnBackspace", "clearOnBackspace", booleanAttribute], clearAllText: "clearAllText", loading: ["loading", "loading", booleanAttribute], loadingText: "loadingText", closeOnSelect: ["closeOnSelect", "closeOnSelect", booleanAttribute], hideSelected: ["hideSelected", "hideSelected", booleanAttribute], selectOnTab: ["selectOnTab", "selectOnTab", booleanAttribute], openOnEnter: ["openOnEnter", "openOnEnter", booleanAttribute], virtualScroll: ["virtualScroll", "virtualScroll", booleanAttribute], bufferAmount: ["bufferAmount", "bufferAmount", numberAttribute], selectableGroup: ["selectableGroup", "selectableGroup", booleanAttribute], selectableGroupAsModel: ["selectableGroupAsModel", "selectableGroupAsModel", booleanAttribute], searchWhileComposing: ["searchWhileComposing", "searchWhileComposing", booleanAttribute], editableSearchTerm: ["editableSearchTerm", "editableSearchTerm", booleanAttribute], maxSelectedItems: ["maxSelectedItems", "maxSelectedItems", numberAttribute], minTermLength: ["minTermLength", "minTermLength", numberAttribute], markFirst: ["markFirst", "markFirst", booleanAttribute], preventToggleOnRightClick: ["preventToggleOnRightClick", "preventToggleOnRightClick", booleanAttribute], addTag: "addTag", addTagText: "addTagText", notFoundText: "notFoundText", typeahead: "typeahead", typeToSearchText: "typeToSearchText", groupBy: "groupBy", groupValue: "groupValue", searchFn: "searchFn", keyDownFn: "keyDownFn", trackByFn: "trackByFn", appearance: "appearance", tabIndex: ["tabIndex", "tabIndex", numberAttribute], ariaLabel: "ariaLabel", ariaLabelledby: "ariaLabelledby", ariaDescribedby: "ariaDescribedby", inputAttrs: "inputAttrs", panelClass: "panelClass", inputId: "inputId", items: "items", compareWith: "compareWith", clearSearchOnAdd: ["clearSearchOnAdd", "clearSearchOnAdd", booleanAttribute], deselectOnClick: ["deselectOnClick", "deselectOnClick", booleanAttribute] }, outputs: { blurEvent: "blur", focusEvent: "focus", changeEvent: "change", openEvent: "open", closeEvent: "close", searchEvent: "search", clearEvent: "clear", addEvent: "add", removeEvent: "remove", scroll: "scroll", scrollToEnd: "scrollToEnd" }, host: { listeners: { "keydown": "handleKeyDown($event)" }, properties: { "class.ng-select-single": "!multiple", "class.ng-select-multiple": "multiple", "class.ng-select-typeahead": "typeahead", "class.ng-select-taggable": "addTag", "class.ng-select-searchable": "searchable", "class.ng-select-clearable": "clearable", "class.ng-select-opened": "isOpen", "class.ng-select-filtered": "filtered", "class.ng-select-disabled": "disabled" }, classAttribute: "ng-select" }, providers: [
2959
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: NgSelect, isStandalone: true, selector: "ng-select", inputs: { bindLabel: "bindLabel", bindValue: "bindValue", placeholder: "placeholder", fixedPlaceholder: "fixedPlaceholder", appendTo: "appendTo", panelPosition: "panelPosition", panelDisabled: ["panelDisabled", "panelDisabled", booleanAttribute], readonly: ["readonly", "readonly", booleanAttribute], multiple: ["multiple", "multiple", booleanAttribute], searchable: ["searchable", "searchable", booleanAttribute], clearable: ["clearable", "clearable", booleanAttribute], clearOnBackspace: ["clearOnBackspace", "clearOnBackspace", booleanAttribute], clearAllText: "clearAllText", loading: ["loading", "loading", booleanAttribute], loadingText: "loadingText", closeOnSelect: ["closeOnSelect", "closeOnSelect", booleanAttribute], hideSelected: ["hideSelected", "hideSelected", booleanAttribute], selectOnTab: ["selectOnTab", "selectOnTab", booleanAttribute], openOnEnter: ["openOnEnter", "openOnEnter", booleanAttribute], virtualScroll: ["virtualScroll", "virtualScroll", booleanAttribute], bufferAmount: ["bufferAmount", "bufferAmount", numberAttribute], selectableGroup: ["selectableGroup", "selectableGroup", booleanAttribute], selectableGroupAsModel: ["selectableGroupAsModel", "selectableGroupAsModel", booleanAttribute], searchWhileComposing: ["searchWhileComposing", "searchWhileComposing", booleanAttribute], editableSearchTerm: ["editableSearchTerm", "editableSearchTerm", booleanAttribute], maxSelectedItems: ["maxSelectedItems", "maxSelectedItems", numberAttribute], minTermLength: ["minTermLength", "minTermLength", numberAttribute], markFirst: ["markFirst", "markFirst", booleanAttribute], preventToggleOnRightClick: ["preventToggleOnRightClick", "preventToggleOnRightClick", booleanAttribute], addTag: "addTag", addTagText: "addTagText", notFoundText: "notFoundText", typeahead: "typeahead", typeToSearchText: "typeToSearchText", groupBy: "groupBy", groupValue: "groupValue", searchFn: "searchFn", keyDownFn: "keyDownFn", trackByFn: "trackByFn", tabIndex: ["tabIndex", "tabIndex", numberAttribute], inputAttrs: "inputAttrs", ariaLabel: "ariaLabel", ariaLabelledby: "ariaLabelledby", ariaDescribedby: "ariaDescribedby", panelClass: "panelClass", inputId: "inputId", items: "items", compareWith: "compareWith", clearSearchOnAdd: ["clearSearchOnAdd", "clearSearchOnAdd", booleanAttribute], deselectOnClick: ["deselectOnClick", "deselectOnClick", booleanAttribute] }, outputs: { blurEvent: "blur", focusEvent: "focus", changeEvent: "change", openEvent: "open", closeEvent: "close", searchEvent: "search", clearEvent: "clear", addEvent: "add", removeEvent: "remove", scroll: "scroll", scrollToEnd: "scrollToEnd" }, host: { listeners: { "keydown": "handleKeyDown($event)" }, properties: { "class.ng-select-single": "!multiple", "class.ng-select-multiple": "multiple", "class.ng-select-typeahead": "typeahead", "class.ng-select-taggable": "addTag", "class.ng-select-searchable": "searchable", "class.ng-select-clearable": "clearable", "class.ng-select-opened": "isOpen", "class.ng-select-filtered": "filtered", "class.ng-select-disabled": "disabled" }, classAttribute: "ng-select" }, providers: [
2982
2960
  {
2983
2961
  provide: NG_VALUE_ACCESSOR,
2984
2962
  useExisting: forwardRef(() => NgSelect),
2985
2963
  multi: true,
2986
2964
  },
2987
- ], queries: [{ propertyName: "optionTemplate", first: true, predicate: NgOptionTemplate, descendants: true, read: TemplateRef }, { propertyName: "optgroupTemplate", first: true, predicate: NgOptgroupTemplate, descendants: true, read: TemplateRef }, { propertyName: "labelTemplate", first: true, predicate: NgLabelTemplate, descendants: true, read: TemplateRef }, { propertyName: "multiLabelTemplate", first: true, predicate: NgMultiLabelTemplate, descendants: true, read: TemplateRef }, { propertyName: "headerTemplate", first: true, predicate: NgHeaderTemplate, descendants: true, read: TemplateRef }, { propertyName: "footerTemplate", first: true, predicate: NgFooterTemplate, descendants: true, read: TemplateRef }, { propertyName: "notFoundTemplate", first: true, predicate: NgNotFoundTemplate, descendants: true, read: TemplateRef }, { propertyName: "placeholderTemplate", first: true, predicate: NgPlaceholderTemplate, descendants: true, read: TemplateRef }, { propertyName: "typeToSearchTemplate", first: true, predicate: NgTypeToSearchTemplate, descendants: true, read: TemplateRef }, { propertyName: "loadingTextTemplate", first: true, predicate: NgLoadingTextTemplate, descendants: true, read: TemplateRef }, { propertyName: "tagTemplate", first: true, predicate: NgTagTemplate, descendants: true, read: TemplateRef }, { propertyName: "loadingSpinnerTemplate", first: true, predicate: NgLoadingSpinnerTemplate, descendants: true, read: TemplateRef }, { propertyName: "clearButtonTemplate", first: true, predicate: NgClearButtonTemplate, descendants: true, read: TemplateRef }, { propertyName: "ngOptions", predicate: NgOption, descendants: true }], viewQueries: [{ propertyName: "dropdownPanel", first: true, predicate: i0.forwardRef(() => NgDropdownPanel), descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, static: true }, { propertyName: "clearButton", first: true, predicate: ["clearButton"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/mouse-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<div\n class=\"ng-select-container\"\n [class.ng-appearance-outline]=\"appearance === 'outline'\"\n [class.ng-has-value]=\"hasValue\"\n (mousedown)=\"handleMousedown($event)\"\n>\n <div class=\"ng-value-container\">\n @if ((selectedItems.length === 0 && !searchTerm) || fixedPlaceholder) {\n <ng-template #defaultPlaceholderTemplate>\n <div class=\"ng-placeholder\">{{ placeholder }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"placeholderTemplate || defaultPlaceholderTemplate\" />\n }\n\n @if ((!multiLabelTemplate || !multiple) && selectedItems.length > 0) {\n @for (item of selectedItems; track trackByOption($index, item)) {\n <div class=\"ng-value\" [class.ng-value-disabled]=\"item.disabled\">\n <ng-template #defaultLabelTemplate>\n <span\n class=\"ng-value-label\"\n [ngItemLabel]=\"item.label || ''\"\n [escape]=\"escapeHTML\"\n ></span>\n <span class=\"ng-value-remove\" (click)=\"unselect(item)\" role=\"button\">\u00D7</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\"\n />\n </div>\n }\n }\n\n @if (multiple && multiLabelTemplate && selectedValues.length > 0) {\n <ng-template\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\"\n />\n }\n\n <div class=\"ng-input\">\n <input\n #searchInput\n [disabled]=\"disabled\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [value]=\"searchTerm ?? ''\"\n (change)=\"$event.stopPropagation()\"\n (input)=\"filter(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n [tabIndex]=\"tabIndex\"\n [attr.id]=\"inputId\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-haspopup]=\"panelDisabled ? 'false' : 'listbox'\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"isOpen ? listboxId : null\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n role=\"combobox\"\n />\n </div>\n </div>\n\n @if (loading) {\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-select-spinner\"></div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingSpinnerTemplate || defaultLoadingSpinnerTemplate\" />\n }\n\n @if (showClearButton) {\n @if (clearButtonTemplate) {\n <ng-container [ngTemplateOutlet]=\"clearButtonTemplate\" />\n } @else {\n <span #clearButton class=\"ng-clear-wrapper\" [title]=\"clearAllText\" aria-hidden=\"true\">\n <span class=\"ng-clear\">\u00D7</span>\n </span>\n }\n }\n\n @if (!panelDisabled) {\n <span class=\"ng-arrow-wrapper\" aria-hidden=\"true\">\n <span class=\"ng-arrow\"></span>\n </span>\n }\n</div>\n\n@if (isOpen) {\n <ng-dropdown-panel\n class=\"ng-dropdown-panel\"\n [class.ng-select-multiple]=\"multiple\"\n [class]=\"appendTo ? _classList : null\"\n [listboxId]=\"listboxId\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"panelPosition\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit()\"\n (outsideClick)=\"close()\"\n >\n @for (item of viewPortItems; track trackByOption($index, item)) {\n <div\n class=\"ng-option\"\n [class.ng-option-disabled]=\"item.disabled\"\n [class.ng-option-selected]=\"item.selected\"\n [class.ng-optgroup]=\"item.children\"\n [class.ng-option]=\"!item.children\"\n [class.ng-option-child]=\"!!item.parent\"\n [class.ng-option-marked]=\"item === itemsList.markedItem\"\n [attr.id]=\"item?.htmlId\"\n [attr.role]=\"item.children ? 'group' : 'option'\"\n [attr.aria-disabled]=\"item.disabled\"\n [attr.aria-selected]=\"item.selected\"\n [attr.aria-setsize]=\"itemsList.filteredItems.length\"\n [attr.aria-posinset]=\"(item.index || 0) + 1\"\n (click)=\"toggleItem(item)\"\n (mouseover)=\"onItemHover(item)\"\n >\n <ng-template #defaultOptionTemplate>\n <span\n class=\"ng-option-label\"\n [ngItemLabel]=\"item.label || ''\"\n [escape]=\"escapeHTML\"\n ></span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"\n item.children\n ? optgroupTemplate || defaultOptionTemplate\n : optionTemplate || defaultOptionTemplate\n \"\n [ngTemplateOutletContext]=\"{\n item: item.value,\n item$: item,\n index: item.index,\n searchTerm: searchTerm,\n }\"\n />\n </div>\n }\n\n @if (showAddTag) {\n <div\n class=\"ng-option\"\n [class.ng-option-marked]=\"!itemsList.markedItem\"\n role=\"option\"\n [attr.aria-disabled]=\"false\"\n [attr.aria-selected]=\"false\"\n (click)=\"selectTag()\"\n (mouseover)=\"itemsList.unmarkItem()\"\n >\n <ng-template #defaultTagTemplate>\n <span>\n <span class=\"ng-tag-label\">{{ addTagText }}</span>\n \"{{ searchTerm }}\"\n </span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n </div>\n }\n\n @if (showNoItemsFound) {\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ notFoundText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n @if (showTypeToSearch) {\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ typeToSearchText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\" />\n }\n @if (loading && itemsList.filteredItems.length === 0) {\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ loadingText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n </ng-dropdown-panel>\n}\n\n<!-- Always present aria-live region -->\n<div class=\"ng-select-visually-hidden\" aria-atomic=\"true\" aria-live=\"polite\" role=\"status\">\n @if (isOpen && showNoItemsFound) {\n {{ notFoundText }}\n }\n</div>\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block}.ng-select.ng-select-searchable .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-placeholder,.ng-select.ng-select-disabled .ng-value{-webkit-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder,.ng-select .ng-has-value .ng-placeholder{display:none}.ng-select .ng-select-container{box-sizing:border-box;position:relative;display:flex;width:100%;outline:none;overflow:hidden;cursor:default}.ng-select .ng-value-container{display:flex;flex:1}.ng-select .ng-input{box-sizing:border-box;opacity:0}.ng-select .ng-input>input{width:100%;padding:0;background:transparent;border:none;box-shadow:none;outline:none;cursor:default}.ng-select .ng-input>input::-ms-clear{display:none}.ng-select .ng-input>input[readonly]{-webkit-user-select:unset;user-select:unset;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-value-container,.ng-select.ng-select-single .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-value-remove{display:none}.ng-select.ng-select-single .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled .ng-value-remove{display:none}.ng-select.ng-select-multiple .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-placeholder{position:absolute;z-index:1}.ng-select.ng-select-multiple .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-value-remove{cursor:pointer}.ng-select.ng-select-multiple .ng-value-disabled .ng-value-remove{display:none}.ng-select.ng-select-multiple .ng-input{flex:1;z-index:2}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;user-select:none}.ng-select .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-arrow-wrapper{position:relative;text-align:center;-webkit-user-select:none;user-select:none;cursor:pointer}.ng-select .ng-arrow{position:relative;display:inline-block;height:0;width:0;pointer-events:none}.ng-dropdown-panel{box-sizing:border-box;position:absolute;z-index:1050;width:100%;opacity:0;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-optgroup,.ng-dropdown-panel .ng-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-option{display:block;cursor:pointer}.ng-dropdown-panel .ng-option.disabled{cursor:default}.ng-dropdown-panel .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-option-label:empty:before{content:\"\\200b\"}.ng-select-virtual-scroll-host{position:relative;display:block;overflow:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}.ng-select-virtual-scroll-content{position:absolute;top:0;left:0;width:100%;height:100%}.ng-select-virtual-scroll-spacer{width:1px;opacity:0}.ng-select-visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;border:0;clip-path:rect(0 0 0 0);white-space:nowrap}.ng-select-spinner{position:relative;width:16px;height:16px;margin:0 4px;font-size:10px;text-indent:-9999em;border-radius:50%;border:2px solid rgba(66,66,66,.2);border-left-color:#424242;animation:load8 .8s infinite linear}@keyframes load8{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgItemLabel, selector: "[ngItemLabel]", inputs: ["ngItemLabel", "escape"] }, { kind: "component", type: NgDropdownPanel, selector: "ng-dropdown-panel", inputs: ["listboxId", "items", "markedItem", "position", "appendTo", "bufferAmount", "virtualScroll", "headerTemplate", "footerTemplate", "filterValue"], outputs: ["update", "scroll", "scrollToEnd", "outsideClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2965
+ ], queries: [{ propertyName: "optionTemplate", first: true, predicate: NgSelectOptionTemplate, descendants: true, read: TemplateRef }, { propertyName: "optgroupTemplate", first: true, predicate: NgSelectOptgroupTemplate, descendants: true, read: TemplateRef }, { propertyName: "labelTemplate", first: true, predicate: NgSelectLabelTemplate, descendants: true, read: TemplateRef }, { propertyName: "multiLabelTemplate", first: true, predicate: NgSelectMultiLabelTemplate, descendants: true, read: TemplateRef }, { propertyName: "panelHeaderTemplate", first: true, predicate: NgSelectPanelHeaderTemplate, descendants: true, read: TemplateRef }, { propertyName: "panelFooterTemplate", first: true, predicate: NgSelectPanelFooterTemplate, descendants: true, read: TemplateRef }, { propertyName: "notFoundTemplate", first: true, predicate: NgSelectNotFoundTemplate, descendants: true, read: TemplateRef }, { propertyName: "placeholderTemplate", first: true, predicate: NgSelectPlaceholderTemplate, descendants: true, read: TemplateRef }, { propertyName: "typeToSearchTemplate", first: true, predicate: NgSelectTypeToSearchTemplate, descendants: true, read: TemplateRef }, { propertyName: "loadingTextTemplate", first: true, predicate: NgSelectLoadingTextTemplate, descendants: true, read: TemplateRef }, { propertyName: "tagTemplate", first: true, predicate: NgSelectTagTemplate, descendants: true, read: TemplateRef }, { propertyName: "loadingTemplate", first: true, predicate: NgSelectLoadingTemplate, descendants: true, read: TemplateRef }, { propertyName: "clearButtonTemplate", first: true, predicate: NgSelectClearButtonTemplate, descendants: true, read: TemplateRef }, { propertyName: "ngOptions", predicate: NgSelectOption, descendants: true }], viewQueries: [{ propertyName: "dropdownPanel", first: true, predicate: i0.forwardRef(() => NgSelectPanel), descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, static: true }, { propertyName: "clearButton", first: true, predicate: ["clearButton"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/mouse-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n\n<div class=\"ng-select-visually-hidden\">\n <div role=\"status\" aria-atomic=\"true\" aria-live=\"polite\">\n @if (isOpen && showNoItemsFound) {\n {{ notFoundText }}\n }\n </div>\n\n <div [attr.id]=\"_viewValuesId\">{{ selectedViewValuesStr }}</div>\n</div>\n\n<div\n class=\"ng-select-control\"\n [class.ng-select-has-value]=\"hasValue\"\n (mousedown)=\"handleMousedown($event)\"\n>\n <div class=\"ng-select-value-container\">\n @if ((selectedItems.length === 0 && !searchTerm) || fixedPlaceholder) {\n <ng-template #defaultPlaceholderTemplate>\n <div class=\"ng-select-placeholder\">{{ placeholder }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"placeholderTemplate || defaultPlaceholderTemplate\" />\n }\n\n @if ((!multiLabelTemplate || !multiple) && selectedItems.length > 0) {\n @for (item of selectedItems; track trackByOption($index, item)) {\n <div class=\"ng-select-value\" [class.ng-select-value-disabled]=\"item.disabled\">\n <ng-template #defaultLabelTemplate>\n <span\n class=\"ng-select-value-label\"\n [ngSelectLabelValue]=\"item.label || ''\"\n [ngSelectLabelEscape]=\"escapeHTML\"\n ></span>\n @if (multiple) {\n <span class=\"ng-select-value-remove\" (click)=\"unselect(item)\" role=\"button\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n />\n </svg>\n </span>\n }\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\"\n />\n </div>\n }\n }\n\n @if (multiple && multiLabelTemplate && selectedValues.length > 0) {\n <ng-template\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\"\n />\n }\n\n <div class=\"ng-select-input-container\">\n <input\n #searchInput\n class=\"ng-select-input\"\n [disabled]=\"disabled\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [value]=\"searchTerm ?? ''\"\n (change)=\"$event.stopPropagation()\"\n (input)=\"filter(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n [tabIndex]=\"tabIndex\"\n [attr.id]=\"inputId\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-haspopup]=\"panelDisabled ? 'false' : 'listbox'\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"isOpen ? _listboxId : null\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n role=\"combobox\"\n />\n </div>\n </div>\n\n @if (loading) {\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-select-spinner\"></div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingTemplate || defaultLoadingSpinnerTemplate\" />\n }\n\n @if (showClearButton) {\n @if (clearButtonTemplate) {\n <ng-container [ngTemplateOutlet]=\"clearButtonTemplate\" />\n } @else {\n <span #clearButton class=\"ng-select-clear\" [title]=\"clearAllText\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n />\n </svg>\n </span>\n }\n }\n\n @if (!panelDisabled) {\n <span class=\"ng-select-arrow\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z\"\n />\n </svg>\n </span>\n }\n</div>\n\n@if (isOpen) {\n <ng-select-panel\n [class]=\"appendTo ? _classList : null\"\n [multiple]=\"multiple\"\n [listboxId]=\"_listboxId\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"panelPosition\"\n [headerTemplate]=\"panelHeaderTemplate\"\n [footerTemplate]=\"panelFooterTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit()\"\n (outsideClick)=\"close()\"\n >\n @for (item of viewPortItems; track trackByOption($index, item)) {\n <div\n class=\"ng-select-option\"\n [class.ng-select-option-disabled]=\"item.disabled\"\n [class.ng-select-option-selected]=\"item.selected\"\n [class.ng-select-optgroup]=\"item.children\"\n [class.ng-select-option]=\"!item.children\"\n [class.ng-select-option-child]=\"!!item.parent\"\n [class.ng-select-option-marked]=\"item === itemsList.markedItem\"\n [attr.id]=\"item.htmlId\"\n [attr.role]=\"item.children ? 'group' : 'option'\"\n [attr.aria-disabled]=\"item.disabled ?? false\"\n [attr.aria-selected]=\"item.selected ?? false\"\n [attr.aria-setsize]=\"itemsList.filteredItems.length\"\n [attr.aria-posinset]=\"(item.index || 0) + 1\"\n (click)=\"toggleItem(item)\"\n (mouseover)=\"onItemHover(item)\"\n >\n <ng-template #defaultOptionTemplate>\n <span\n class=\"ng-select-option-label\"\n [ngSelectLabelValue]=\"item.label || ''\"\n [ngSelectLabelEscape]=\"escapeHTML\"\n ></span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"\n item.children\n ? optgroupTemplate || defaultOptionTemplate\n : optionTemplate || defaultOptionTemplate\n \"\n [ngTemplateOutletContext]=\"{\n item: item.value,\n item$: item,\n index: item.index,\n searchTerm: searchTerm,\n }\"\n />\n </div>\n }\n\n @if (showAddTag) {\n <div\n class=\"ng-select-option ng-select-tag-option\"\n [class.ng-select-option-marked]=\"!itemsList.markedItem\"\n role=\"option\"\n [attr.aria-disabled]=\"false\"\n [attr.aria-selected]=\"false\"\n (click)=\"selectTag()\"\n (mouseover)=\"itemsList.unmarkItem()\"\n >\n <ng-template #defaultTagTemplate>\n <span class=\"ng-select-tag-option-label\">{{ addTagText }}</span>\n <span class=\"ng-select-tag-option-value\">\"{{ searchTerm }}\"</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n </div>\n }\n\n @if (showNoItemsFound) {\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ notFoundText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n @if (showTypeToSearch) {\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ typeToSearchText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\" />\n }\n @if (loading && itemsList.filteredItems.length === 0) {\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ loadingText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n </ng-select-panel>\n}\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block}.ng-select-control{box-sizing:border-box;position:relative;display:flex;width:100%;outline:none;overflow:hidden}.ng-select-opened .ng-select-control{z-index:1010}.ng-select-value-container{position:relative;display:flex;flex:1;flex-wrap:wrap;align-items:center}.ng-select-input-container{position:relative;box-sizing:border-box}.ng-select-value-remove svg{width:14px;height:14px}.ng-select-input{width:100%;padding:0;background:transparent;border:none;box-shadow:none;outline:none;cursor:default}.ng-select-input[readonly]{width:0;-webkit-user-select:unset;user-select:unset}.ng-select-clear,.ng-select-arrow{position:relative;-webkit-user-select:none;user-select:none}.ng-select-clear svg,.ng-select-arrow svg{width:20px;height:20px}.ng-select-visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;border:0;overflow:hidden;white-space:nowrap;clip-path:inset(50%)}.ng-select-disabled .ng-select-placeholder,.ng-select-disabled .ng-select-value{-webkit-user-select:none;user-select:none}.ng-select-disabled .ng-select-clear,.ng-select-disabled .ng-select-arrow{pointer-events:none}.ng-select-filtered .ng-select-placeholder,.ng-select-has-value .ng-select-placeholder{display:none}.ng-select-single.ng-select-filtered .ng-select-value{visibility:hidden}.ng-select-single .ng-select-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select-single .ng-select-input-container{position:absolute;left:0;right:0}.ng-select-multiple .ng-select-placeholder{position:absolute}.ng-select-multiple .ng-select-value{display:inline-flex;align-items:center;overflow:hidden}.ng-select-multiple .ng-select-value.ng-select-value-disabled{-webkit-user-select:none;user-select:none}.ng-select-multiple.ng-select-disabled .ng-select-value-remove,.ng-select-multiple .ng-select-value-disabled .ng-select-value-remove{display:none}.ng-select-multiple .ng-select-input-container{flex:1}.ng-select-panel{box-sizing:border-box;position:absolute;z-index:1080;width:100%;opacity:0;-webkit-overflow-scrolling:touch}.ng-select-listbox{max-height:300px;overflow-y:auto}.ng-select-option,.ng-select-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select-option-highlighted{font-weight:700;text-decoration:underline}.ng-select-option-label:empty:before{content:\"\\200b\"}.ng-select-virtual-scroll-host{position:relative;overflow:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}.ng-select-virtual-scroll-content{position:absolute;top:0;left:0;width:100%;height:100%}.ng-select-virtual-scroll-spacer{width:1px;opacity:0}.ng-select-spinner{position:relative;width:16px;height:16px;margin:auto 4px;border-radius:50%;border:2px solid rgba(66,66,66,.2);border-left-color:#666;animation:ng-select-spinning .8s infinite linear}@keyframes ng-select-spinning{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgSelectLabelRenderer, selector: "[ngSelectLabelValue]", inputs: ["ngSelectLabelValue", "ngSelectLabelEscape"] }, { kind: "component", type: NgSelectPanel, selector: "ng-select-panel", inputs: ["listboxId", "items", "markedItem", "position", "appendTo", "bufferAmount", "virtualScroll", "multiple", "headerTemplate", "footerTemplate", "filterValue"], outputs: ["update", "scroll", "scrollToEnd", "outsideClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2988
2966
  }
2989
2967
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelect, decorators: [{
2990
2968
  type: Component,
2991
- args: [{ selector: 'ng-select', imports: [NgTemplateOutlet, NgItemLabel, NgDropdownPanel], host: {
2969
+ args: [{ selector: 'ng-select', imports: [NgTemplateOutlet, NgSelectLabelRenderer, NgSelectPanel], host: {
2992
2970
  'class': 'ng-select',
2993
2971
  '[class.ng-select-single]': '!multiple',
2994
2972
  '[class.ng-select-multiple]': 'multiple',
@@ -3006,7 +2984,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3006
2984
  useExisting: forwardRef(() => NgSelect),
3007
2985
  multi: true,
3008
2986
  },
3009
- ], template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/mouse-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<div\n class=\"ng-select-container\"\n [class.ng-appearance-outline]=\"appearance === 'outline'\"\n [class.ng-has-value]=\"hasValue\"\n (mousedown)=\"handleMousedown($event)\"\n>\n <div class=\"ng-value-container\">\n @if ((selectedItems.length === 0 && !searchTerm) || fixedPlaceholder) {\n <ng-template #defaultPlaceholderTemplate>\n <div class=\"ng-placeholder\">{{ placeholder }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"placeholderTemplate || defaultPlaceholderTemplate\" />\n }\n\n @if ((!multiLabelTemplate || !multiple) && selectedItems.length > 0) {\n @for (item of selectedItems; track trackByOption($index, item)) {\n <div class=\"ng-value\" [class.ng-value-disabled]=\"item.disabled\">\n <ng-template #defaultLabelTemplate>\n <span\n class=\"ng-value-label\"\n [ngItemLabel]=\"item.label || ''\"\n [escape]=\"escapeHTML\"\n ></span>\n <span class=\"ng-value-remove\" (click)=\"unselect(item)\" role=\"button\">\u00D7</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\"\n />\n </div>\n }\n }\n\n @if (multiple && multiLabelTemplate && selectedValues.length > 0) {\n <ng-template\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\"\n />\n }\n\n <div class=\"ng-input\">\n <input\n #searchInput\n [disabled]=\"disabled\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [value]=\"searchTerm ?? ''\"\n (change)=\"$event.stopPropagation()\"\n (input)=\"filter(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n [tabIndex]=\"tabIndex\"\n [attr.id]=\"inputId\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-haspopup]=\"panelDisabled ? 'false' : 'listbox'\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"isOpen ? listboxId : null\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n role=\"combobox\"\n />\n </div>\n </div>\n\n @if (loading) {\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-select-spinner\"></div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingSpinnerTemplate || defaultLoadingSpinnerTemplate\" />\n }\n\n @if (showClearButton) {\n @if (clearButtonTemplate) {\n <ng-container [ngTemplateOutlet]=\"clearButtonTemplate\" />\n } @else {\n <span #clearButton class=\"ng-clear-wrapper\" [title]=\"clearAllText\" aria-hidden=\"true\">\n <span class=\"ng-clear\">\u00D7</span>\n </span>\n }\n }\n\n @if (!panelDisabled) {\n <span class=\"ng-arrow-wrapper\" aria-hidden=\"true\">\n <span class=\"ng-arrow\"></span>\n </span>\n }\n</div>\n\n@if (isOpen) {\n <ng-dropdown-panel\n class=\"ng-dropdown-panel\"\n [class.ng-select-multiple]=\"multiple\"\n [class]=\"appendTo ? _classList : null\"\n [listboxId]=\"listboxId\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"panelPosition\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit()\"\n (outsideClick)=\"close()\"\n >\n @for (item of viewPortItems; track trackByOption($index, item)) {\n <div\n class=\"ng-option\"\n [class.ng-option-disabled]=\"item.disabled\"\n [class.ng-option-selected]=\"item.selected\"\n [class.ng-optgroup]=\"item.children\"\n [class.ng-option]=\"!item.children\"\n [class.ng-option-child]=\"!!item.parent\"\n [class.ng-option-marked]=\"item === itemsList.markedItem\"\n [attr.id]=\"item?.htmlId\"\n [attr.role]=\"item.children ? 'group' : 'option'\"\n [attr.aria-disabled]=\"item.disabled\"\n [attr.aria-selected]=\"item.selected\"\n [attr.aria-setsize]=\"itemsList.filteredItems.length\"\n [attr.aria-posinset]=\"(item.index || 0) + 1\"\n (click)=\"toggleItem(item)\"\n (mouseover)=\"onItemHover(item)\"\n >\n <ng-template #defaultOptionTemplate>\n <span\n class=\"ng-option-label\"\n [ngItemLabel]=\"item.label || ''\"\n [escape]=\"escapeHTML\"\n ></span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"\n item.children\n ? optgroupTemplate || defaultOptionTemplate\n : optionTemplate || defaultOptionTemplate\n \"\n [ngTemplateOutletContext]=\"{\n item: item.value,\n item$: item,\n index: item.index,\n searchTerm: searchTerm,\n }\"\n />\n </div>\n }\n\n @if (showAddTag) {\n <div\n class=\"ng-option\"\n [class.ng-option-marked]=\"!itemsList.markedItem\"\n role=\"option\"\n [attr.aria-disabled]=\"false\"\n [attr.aria-selected]=\"false\"\n (click)=\"selectTag()\"\n (mouseover)=\"itemsList.unmarkItem()\"\n >\n <ng-template #defaultTagTemplate>\n <span>\n <span class=\"ng-tag-label\">{{ addTagText }}</span>\n \"{{ searchTerm }}\"\n </span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n </div>\n }\n\n @if (showNoItemsFound) {\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ notFoundText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n @if (showTypeToSearch) {\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ typeToSearchText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\" />\n }\n @if (loading && itemsList.filteredItems.length === 0) {\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ loadingText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n </ng-dropdown-panel>\n}\n\n<!-- Always present aria-live region -->\n<div class=\"ng-select-visually-hidden\" aria-atomic=\"true\" aria-live=\"polite\" role=\"status\">\n @if (isOpen && showNoItemsFound) {\n {{ notFoundText }}\n }\n</div>\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block}.ng-select.ng-select-searchable .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-placeholder,.ng-select.ng-select-disabled .ng-value{-webkit-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder,.ng-select .ng-has-value .ng-placeholder{display:none}.ng-select .ng-select-container{box-sizing:border-box;position:relative;display:flex;width:100%;outline:none;overflow:hidden;cursor:default}.ng-select .ng-value-container{display:flex;flex:1}.ng-select .ng-input{box-sizing:border-box;opacity:0}.ng-select .ng-input>input{width:100%;padding:0;background:transparent;border:none;box-shadow:none;outline:none;cursor:default}.ng-select .ng-input>input::-ms-clear{display:none}.ng-select .ng-input>input[readonly]{-webkit-user-select:unset;user-select:unset;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-value-container,.ng-select.ng-select-single .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-value-remove{display:none}.ng-select.ng-select-single .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled .ng-value-remove{display:none}.ng-select.ng-select-multiple .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-placeholder{position:absolute;z-index:1}.ng-select.ng-select-multiple .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-value-remove{cursor:pointer}.ng-select.ng-select-multiple .ng-value-disabled .ng-value-remove{display:none}.ng-select.ng-select-multiple .ng-input{flex:1;z-index:2}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;user-select:none}.ng-select .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-arrow-wrapper{position:relative;text-align:center;-webkit-user-select:none;user-select:none;cursor:pointer}.ng-select .ng-arrow{position:relative;display:inline-block;height:0;width:0;pointer-events:none}.ng-dropdown-panel{box-sizing:border-box;position:absolute;z-index:1050;width:100%;opacity:0;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-optgroup,.ng-dropdown-panel .ng-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-option{display:block;cursor:pointer}.ng-dropdown-panel .ng-option.disabled{cursor:default}.ng-dropdown-panel .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-option-label:empty:before{content:\"\\200b\"}.ng-select-virtual-scroll-host{position:relative;display:block;overflow:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}.ng-select-virtual-scroll-content{position:absolute;top:0;left:0;width:100%;height:100%}.ng-select-virtual-scroll-spacer{width:1px;opacity:0}.ng-select-visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;border:0;clip-path:rect(0 0 0 0);white-space:nowrap}.ng-select-spinner{position:relative;width:16px;height:16px;margin:0 4px;font-size:10px;text-indent:-9999em;border-radius:50%;border:2px solid rgba(66,66,66,.2);border-left-color:#424242;animation:load8 .8s infinite linear}@keyframes load8{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
2987
+ ], template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/mouse-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n\n<div class=\"ng-select-visually-hidden\">\n <div role=\"status\" aria-atomic=\"true\" aria-live=\"polite\">\n @if (isOpen && showNoItemsFound) {\n {{ notFoundText }}\n }\n </div>\n\n <div [attr.id]=\"_viewValuesId\">{{ selectedViewValuesStr }}</div>\n</div>\n\n<div\n class=\"ng-select-control\"\n [class.ng-select-has-value]=\"hasValue\"\n (mousedown)=\"handleMousedown($event)\"\n>\n <div class=\"ng-select-value-container\">\n @if ((selectedItems.length === 0 && !searchTerm) || fixedPlaceholder) {\n <ng-template #defaultPlaceholderTemplate>\n <div class=\"ng-select-placeholder\">{{ placeholder }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"placeholderTemplate || defaultPlaceholderTemplate\" />\n }\n\n @if ((!multiLabelTemplate || !multiple) && selectedItems.length > 0) {\n @for (item of selectedItems; track trackByOption($index, item)) {\n <div class=\"ng-select-value\" [class.ng-select-value-disabled]=\"item.disabled\">\n <ng-template #defaultLabelTemplate>\n <span\n class=\"ng-select-value-label\"\n [ngSelectLabelValue]=\"item.label || ''\"\n [ngSelectLabelEscape]=\"escapeHTML\"\n ></span>\n @if (multiple) {\n <span class=\"ng-select-value-remove\" (click)=\"unselect(item)\" role=\"button\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n />\n </svg>\n </span>\n }\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\"\n />\n </div>\n }\n }\n\n @if (multiple && multiLabelTemplate && selectedValues.length > 0) {\n <ng-template\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\"\n />\n }\n\n <div class=\"ng-select-input-container\">\n <input\n #searchInput\n class=\"ng-select-input\"\n [disabled]=\"disabled\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [value]=\"searchTerm ?? ''\"\n (change)=\"$event.stopPropagation()\"\n (input)=\"filter(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n [tabIndex]=\"tabIndex\"\n [attr.id]=\"inputId\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-haspopup]=\"panelDisabled ? 'false' : 'listbox'\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"isOpen ? _listboxId : null\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n role=\"combobox\"\n />\n </div>\n </div>\n\n @if (loading) {\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-select-spinner\"></div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingTemplate || defaultLoadingSpinnerTemplate\" />\n }\n\n @if (showClearButton) {\n @if (clearButtonTemplate) {\n <ng-container [ngTemplateOutlet]=\"clearButtonTemplate\" />\n } @else {\n <span #clearButton class=\"ng-select-clear\" [title]=\"clearAllText\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n />\n </svg>\n </span>\n }\n }\n\n @if (!panelDisabled) {\n <span class=\"ng-select-arrow\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z\"\n />\n </svg>\n </span>\n }\n</div>\n\n@if (isOpen) {\n <ng-select-panel\n [class]=\"appendTo ? _classList : null\"\n [multiple]=\"multiple\"\n [listboxId]=\"_listboxId\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"panelPosition\"\n [headerTemplate]=\"panelHeaderTemplate\"\n [footerTemplate]=\"panelFooterTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit()\"\n (outsideClick)=\"close()\"\n >\n @for (item of viewPortItems; track trackByOption($index, item)) {\n <div\n class=\"ng-select-option\"\n [class.ng-select-option-disabled]=\"item.disabled\"\n [class.ng-select-option-selected]=\"item.selected\"\n [class.ng-select-optgroup]=\"item.children\"\n [class.ng-select-option]=\"!item.children\"\n [class.ng-select-option-child]=\"!!item.parent\"\n [class.ng-select-option-marked]=\"item === itemsList.markedItem\"\n [attr.id]=\"item.htmlId\"\n [attr.role]=\"item.children ? 'group' : 'option'\"\n [attr.aria-disabled]=\"item.disabled ?? false\"\n [attr.aria-selected]=\"item.selected ?? false\"\n [attr.aria-setsize]=\"itemsList.filteredItems.length\"\n [attr.aria-posinset]=\"(item.index || 0) + 1\"\n (click)=\"toggleItem(item)\"\n (mouseover)=\"onItemHover(item)\"\n >\n <ng-template #defaultOptionTemplate>\n <span\n class=\"ng-select-option-label\"\n [ngSelectLabelValue]=\"item.label || ''\"\n [ngSelectLabelEscape]=\"escapeHTML\"\n ></span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"\n item.children\n ? optgroupTemplate || defaultOptionTemplate\n : optionTemplate || defaultOptionTemplate\n \"\n [ngTemplateOutletContext]=\"{\n item: item.value,\n item$: item,\n index: item.index,\n searchTerm: searchTerm,\n }\"\n />\n </div>\n }\n\n @if (showAddTag) {\n <div\n class=\"ng-select-option ng-select-tag-option\"\n [class.ng-select-option-marked]=\"!itemsList.markedItem\"\n role=\"option\"\n [attr.aria-disabled]=\"false\"\n [attr.aria-selected]=\"false\"\n (click)=\"selectTag()\"\n (mouseover)=\"itemsList.unmarkItem()\"\n >\n <ng-template #defaultTagTemplate>\n <span class=\"ng-select-tag-option-label\">{{ addTagText }}</span>\n <span class=\"ng-select-tag-option-value\">\"{{ searchTerm }}\"</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n </div>\n }\n\n @if (showNoItemsFound) {\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ notFoundText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n @if (showTypeToSearch) {\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ typeToSearchText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\" />\n }\n @if (loading && itemsList.filteredItems.length === 0) {\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-select-option ng-select-option-disabled\">{{ loadingText }}</div>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"\n />\n }\n </ng-select-panel>\n}\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block}.ng-select-control{box-sizing:border-box;position:relative;display:flex;width:100%;outline:none;overflow:hidden}.ng-select-opened .ng-select-control{z-index:1010}.ng-select-value-container{position:relative;display:flex;flex:1;flex-wrap:wrap;align-items:center}.ng-select-input-container{position:relative;box-sizing:border-box}.ng-select-value-remove svg{width:14px;height:14px}.ng-select-input{width:100%;padding:0;background:transparent;border:none;box-shadow:none;outline:none;cursor:default}.ng-select-input[readonly]{width:0;-webkit-user-select:unset;user-select:unset}.ng-select-clear,.ng-select-arrow{position:relative;-webkit-user-select:none;user-select:none}.ng-select-clear svg,.ng-select-arrow svg{width:20px;height:20px}.ng-select-visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;border:0;overflow:hidden;white-space:nowrap;clip-path:inset(50%)}.ng-select-disabled .ng-select-placeholder,.ng-select-disabled .ng-select-value{-webkit-user-select:none;user-select:none}.ng-select-disabled .ng-select-clear,.ng-select-disabled .ng-select-arrow{pointer-events:none}.ng-select-filtered .ng-select-placeholder,.ng-select-has-value .ng-select-placeholder{display:none}.ng-select-single.ng-select-filtered .ng-select-value{visibility:hidden}.ng-select-single .ng-select-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select-single .ng-select-input-container{position:absolute;left:0;right:0}.ng-select-multiple .ng-select-placeholder{position:absolute}.ng-select-multiple .ng-select-value{display:inline-flex;align-items:center;overflow:hidden}.ng-select-multiple .ng-select-value.ng-select-value-disabled{-webkit-user-select:none;user-select:none}.ng-select-multiple.ng-select-disabled .ng-select-value-remove,.ng-select-multiple .ng-select-value-disabled .ng-select-value-remove{display:none}.ng-select-multiple .ng-select-input-container{flex:1}.ng-select-panel{box-sizing:border-box;position:absolute;z-index:1080;width:100%;opacity:0;-webkit-overflow-scrolling:touch}.ng-select-listbox{max-height:300px;overflow-y:auto}.ng-select-option,.ng-select-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select-option-highlighted{font-weight:700;text-decoration:underline}.ng-select-option-label:empty:before{content:\"\\200b\"}.ng-select-virtual-scroll-host{position:relative;overflow:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}.ng-select-virtual-scroll-content{position:absolute;top:0;left:0;width:100%;height:100%}.ng-select-virtual-scroll-spacer{width:1px;opacity:0}.ng-select-spinner{position:relative;width:16px;height:16px;margin:auto 4px;border-radius:50%;border:2px solid rgba(66,66,66,.2);border-left-color:#666;animation:ng-select-spinning .8s infinite linear}@keyframes ng-select-spinning{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
3010
2988
  }], ctorParameters: () => [], propDecorators: { bindLabel: [{
3011
2989
  type: Input
3012
2990
  }], bindValue: [{
@@ -3106,19 +3084,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3106
3084
  type: Input
3107
3085
  }], trackByFn: [{
3108
3086
  type: Input
3109
- }], appearance: [{
3110
- type: Input
3111
3087
  }], tabIndex: [{
3112
3088
  type: Input,
3113
3089
  args: [{ transform: numberAttribute }]
3090
+ }], inputAttrs: [{
3091
+ type: Input
3114
3092
  }], ariaLabel: [{
3115
3093
  type: Input
3116
3094
  }], ariaLabelledby: [{
3117
3095
  type: Input
3118
3096
  }], ariaDescribedby: [{
3119
3097
  type: Input
3120
- }], inputAttrs: [{
3121
- type: Input
3122
3098
  }], panelClass: [{
3123
3099
  type: Input
3124
3100
  }], inputId: [{
@@ -3166,7 +3142,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3166
3142
  type: Output
3167
3143
  }], dropdownPanel: [{
3168
3144
  type: ViewChild,
3169
- args: [forwardRef(() => NgDropdownPanel)]
3145
+ args: [forwardRef(() => NgSelectPanel)]
3170
3146
  }], searchInput: [{
3171
3147
  type: ViewChild,
3172
3148
  args: ['searchInput', { static: true }]
@@ -3175,81 +3151,81 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3175
3151
  args: ['clearButton']
3176
3152
  }], ngOptions: [{
3177
3153
  type: ContentChildren,
3178
- args: [NgOption, { descendants: true }]
3154
+ args: [NgSelectOption, { descendants: true }]
3179
3155
  }], optionTemplate: [{
3180
3156
  type: ContentChild,
3181
- args: [NgOptionTemplate, { read: TemplateRef }]
3157
+ args: [NgSelectOptionTemplate, { read: TemplateRef }]
3182
3158
  }], optgroupTemplate: [{
3183
3159
  type: ContentChild,
3184
- args: [NgOptgroupTemplate, { read: TemplateRef }]
3160
+ args: [NgSelectOptgroupTemplate, { read: TemplateRef }]
3185
3161
  }], labelTemplate: [{
3186
3162
  type: ContentChild,
3187
- args: [NgLabelTemplate, { read: TemplateRef }]
3163
+ args: [NgSelectLabelTemplate, { read: TemplateRef }]
3188
3164
  }], multiLabelTemplate: [{
3189
3165
  type: ContentChild,
3190
- args: [NgMultiLabelTemplate, { read: TemplateRef }]
3191
- }], headerTemplate: [{
3166
+ args: [NgSelectMultiLabelTemplate, { read: TemplateRef }]
3167
+ }], panelHeaderTemplate: [{
3192
3168
  type: ContentChild,
3193
- args: [NgHeaderTemplate, { read: TemplateRef }]
3194
- }], footerTemplate: [{
3169
+ args: [NgSelectPanelHeaderTemplate, { read: TemplateRef }]
3170
+ }], panelFooterTemplate: [{
3195
3171
  type: ContentChild,
3196
- args: [NgFooterTemplate, { read: TemplateRef }]
3172
+ args: [NgSelectPanelFooterTemplate, { read: TemplateRef }]
3197
3173
  }], notFoundTemplate: [{
3198
3174
  type: ContentChild,
3199
- args: [NgNotFoundTemplate, { read: TemplateRef }]
3175
+ args: [NgSelectNotFoundTemplate, { read: TemplateRef }]
3200
3176
  }], placeholderTemplate: [{
3201
3177
  type: ContentChild,
3202
- args: [NgPlaceholderTemplate, { read: TemplateRef }]
3178
+ args: [NgSelectPlaceholderTemplate, { read: TemplateRef }]
3203
3179
  }], typeToSearchTemplate: [{
3204
3180
  type: ContentChild,
3205
- args: [NgTypeToSearchTemplate, { read: TemplateRef }]
3181
+ args: [NgSelectTypeToSearchTemplate, { read: TemplateRef }]
3206
3182
  }], loadingTextTemplate: [{
3207
3183
  type: ContentChild,
3208
- args: [NgLoadingTextTemplate, { read: TemplateRef }]
3184
+ args: [NgSelectLoadingTextTemplate, { read: TemplateRef }]
3209
3185
  }], tagTemplate: [{
3210
3186
  type: ContentChild,
3211
- args: [NgTagTemplate, { read: TemplateRef }]
3212
- }], loadingSpinnerTemplate: [{
3187
+ args: [NgSelectTagTemplate, { read: TemplateRef }]
3188
+ }], loadingTemplate: [{
3213
3189
  type: ContentChild,
3214
- args: [NgLoadingSpinnerTemplate, { read: TemplateRef }]
3190
+ args: [NgSelectLoadingTemplate, { read: TemplateRef }]
3215
3191
  }], clearButtonTemplate: [{
3216
3192
  type: ContentChild,
3217
- args: [NgClearButtonTemplate, { read: TemplateRef }]
3193
+ args: [NgSelectClearButtonTemplate, { read: TemplateRef }]
3218
3194
  }] } });
3219
3195
 
3220
3196
  class NgSelectModule {
3221
3197
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3222
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, imports: [NgDropdownPanel,
3223
- NgOption,
3198
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, imports: [NgSelectPanel,
3224
3199
  NgSelect,
3225
- NgOptgroupTemplate,
3226
- NgOptionTemplate,
3227
- NgLabelTemplate,
3228
- NgMultiLabelTemplate,
3229
- NgHeaderTemplate,
3230
- NgFooterTemplate,
3231
- NgPlaceholderTemplate,
3232
- NgClearButtonTemplate,
3233
- NgNotFoundTemplate,
3234
- NgTypeToSearchTemplate,
3235
- NgLoadingTextTemplate,
3236
- NgTagTemplate,
3237
- NgLoadingSpinnerTemplate,
3238
- NgItemLabel], exports: [NgSelect,
3239
- NgOption,
3240
- NgOptgroupTemplate,
3241
- NgOptionTemplate,
3242
- NgLabelTemplate,
3243
- NgMultiLabelTemplate,
3244
- NgHeaderTemplate,
3245
- NgFooterTemplate,
3246
- NgPlaceholderTemplate,
3247
- NgNotFoundTemplate,
3248
- NgTypeToSearchTemplate,
3249
- NgLoadingTextTemplate,
3250
- NgTagTemplate,
3251
- NgLoadingSpinnerTemplate,
3252
- NgClearButtonTemplate] });
3200
+ NgSelectOption,
3201
+ NgSelectOptgroupTemplate,
3202
+ NgSelectOptionTemplate,
3203
+ NgSelectLabelTemplate,
3204
+ NgSelectMultiLabelTemplate,
3205
+ NgSelectPanelHeaderTemplate,
3206
+ NgSelectPanelFooterTemplate,
3207
+ NgSelectPlaceholderTemplate,
3208
+ NgSelectClearButtonTemplate,
3209
+ NgSelectNotFoundTemplate,
3210
+ NgSelectTypeToSearchTemplate,
3211
+ NgSelectLoadingTextTemplate,
3212
+ NgSelectTagTemplate,
3213
+ NgSelectLoadingTemplate,
3214
+ NgSelectLabelRenderer], exports: [NgSelect,
3215
+ NgSelectOption,
3216
+ NgSelectOptgroupTemplate,
3217
+ NgSelectOptionTemplate,
3218
+ NgSelectLabelTemplate,
3219
+ NgSelectMultiLabelTemplate,
3220
+ NgSelectPanelHeaderTemplate,
3221
+ NgSelectPanelFooterTemplate,
3222
+ NgSelectPlaceholderTemplate,
3223
+ NgSelectClearButtonTemplate,
3224
+ NgSelectNotFoundTemplate,
3225
+ NgSelectTypeToSearchTemplate,
3226
+ NgSelectLoadingTextTemplate,
3227
+ NgSelectTagTemplate,
3228
+ NgSelectLoadingTemplate] });
3253
3229
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, providers: [
3254
3230
  {
3255
3231
  provide: SELECTION_MODEL_FACTORY,
@@ -3261,40 +3237,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3261
3237
  type: NgModule,
3262
3238
  args: [{
3263
3239
  imports: [
3264
- NgDropdownPanel,
3265
- NgOption,
3240
+ NgSelectPanel,
3266
3241
  NgSelect,
3267
- NgOptgroupTemplate,
3268
- NgOptionTemplate,
3269
- NgLabelTemplate,
3270
- NgMultiLabelTemplate,
3271
- NgHeaderTemplate,
3272
- NgFooterTemplate,
3273
- NgPlaceholderTemplate,
3274
- NgClearButtonTemplate,
3275
- NgNotFoundTemplate,
3276
- NgTypeToSearchTemplate,
3277
- NgLoadingTextTemplate,
3278
- NgTagTemplate,
3279
- NgLoadingSpinnerTemplate,
3280
- NgItemLabel,
3242
+ NgSelectOption,
3243
+ NgSelectOptgroupTemplate,
3244
+ NgSelectOptionTemplate,
3245
+ NgSelectLabelTemplate,
3246
+ NgSelectMultiLabelTemplate,
3247
+ NgSelectPanelHeaderTemplate,
3248
+ NgSelectPanelFooterTemplate,
3249
+ NgSelectPlaceholderTemplate,
3250
+ NgSelectClearButtonTemplate,
3251
+ NgSelectNotFoundTemplate,
3252
+ NgSelectTypeToSearchTemplate,
3253
+ NgSelectLoadingTextTemplate,
3254
+ NgSelectTagTemplate,
3255
+ NgSelectLoadingTemplate,
3256
+ NgSelectLabelRenderer,
3281
3257
  ],
3282
3258
  exports: [
3283
3259
  NgSelect,
3284
- NgOption,
3285
- NgOptgroupTemplate,
3286
- NgOptionTemplate,
3287
- NgLabelTemplate,
3288
- NgMultiLabelTemplate,
3289
- NgHeaderTemplate,
3290
- NgFooterTemplate,
3291
- NgPlaceholderTemplate,
3292
- NgNotFoundTemplate,
3293
- NgTypeToSearchTemplate,
3294
- NgLoadingTextTemplate,
3295
- NgTagTemplate,
3296
- NgLoadingSpinnerTemplate,
3297
- NgClearButtonTemplate,
3260
+ NgSelectOption,
3261
+ NgSelectOptgroupTemplate,
3262
+ NgSelectOptionTemplate,
3263
+ NgSelectLabelTemplate,
3264
+ NgSelectMultiLabelTemplate,
3265
+ NgSelectPanelHeaderTemplate,
3266
+ NgSelectPanelFooterTemplate,
3267
+ NgSelectPlaceholderTemplate,
3268
+ NgSelectClearButtonTemplate,
3269
+ NgSelectNotFoundTemplate,
3270
+ NgSelectTypeToSearchTemplate,
3271
+ NgSelectLoadingTextTemplate,
3272
+ NgSelectTagTemplate,
3273
+ NgSelectLoadingTemplate,
3298
3274
  ],
3299
3275
  providers: [
3300
3276
  {
@@ -3305,6 +3281,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3305
3281
  }]
3306
3282
  }] });
3307
3283
 
3284
+ class NgSelectOptionHighlight {
3285
+ term = '';
3286
+ elementRef = inject(ElementRef);
3287
+ renderer = inject(Renderer2);
3288
+ element = this.elementRef.nativeElement;
3289
+ label = '';
3290
+ get _canHighlight() {
3291
+ return this.term && this.label;
3292
+ }
3293
+ ngOnChanges() {
3294
+ if (this._canHighlight) {
3295
+ this._highlightLabel();
3296
+ }
3297
+ }
3298
+ ngAfterViewInit() {
3299
+ this.label = this.element.innerHTML;
3300
+ if (this._canHighlight) {
3301
+ this._highlightLabel();
3302
+ }
3303
+ }
3304
+ _escapeRegExp(str) {
3305
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
3306
+ }
3307
+ _highlightLabel() {
3308
+ const label = this.label;
3309
+ if (!this.term) {
3310
+ this._setInnerHtml(label);
3311
+ return;
3312
+ }
3313
+ const alternationString = this._escapeRegExp(this.term).replace(' ', '|');
3314
+ const termRegex = new RegExp(alternationString, 'gi');
3315
+ this._setInnerHtml(label.replace(termRegex, `<span class="ng-select-option-highlighted">$&</span>`));
3316
+ }
3317
+ _setInnerHtml(html) {
3318
+ this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', html);
3319
+ }
3320
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptionHighlight, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3321
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSelectOptionHighlight, isStandalone: true, selector: "[ngOptionHighlight]", inputs: { term: ["ngOptionHighlight", "term"] }, usesOnChanges: true, ngImport: i0 });
3322
+ }
3323
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectOptionHighlight, decorators: [{
3324
+ type: Directive,
3325
+ args: [{
3326
+ selector: '[ngOptionHighlight]',
3327
+ }]
3328
+ }], propDecorators: { term: [{
3329
+ type: Input,
3330
+ args: ['ngOptionHighlight']
3331
+ }] } });
3332
+
3308
3333
  /*
3309
3334
  * Public API Surface of ng-select
3310
3335
  */
@@ -3313,5 +3338,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3313
3338
  * Generated bundle index. Do not edit.
3314
3339
  */
3315
3340
 
3316
- export { DefaultSelectionModel, DefaultSelectionModelFactory, NgClearButtonTemplate, NgDropdownPanel, NgDropdownPanelUtils, NgFooterTemplate, NgHeaderTemplate, NgItemLabel, NgLabelTemplate, NgLoadingSpinnerTemplate, NgLoadingTextTemplate, NgMultiLabelTemplate, NgNotFoundTemplate, NgOptgroupTemplate, NgOption, NgOptionHighlight, NgOptionTemplate, NgPlaceholderTemplate, NgSelect, NgSelectConfig, NgSelectModule, NgTagTemplate, NgTypeToSearchTemplate, SELECTION_MODEL_FACTORY };
3341
+ export { DefaultSelectionModel, DefaultSelectionModelFactory, NgSelect, NgSelectClearButtonTemplate, NgSelectConfig, NgSelectLabelRenderer, NgSelectLabelTemplate, NgSelectLoadingTemplate, NgSelectLoadingTextTemplate, NgSelectModule, NgSelectMultiLabelTemplate, NgSelectNotFoundTemplate, NgSelectOptgroupTemplate, NgSelectOption, NgSelectOptionHighlight, NgSelectOptionTemplate, NgSelectPanel, NgSelectPanelFooterTemplate, NgSelectPanelHeaderTemplate, NgSelectPanelUtils, NgSelectPlaceholderTemplate, NgSelectTagTemplate, NgSelectTypeToSearchTemplate, SELECTION_MODEL_FACTORY };
3317
3342
  //# sourceMappingURL=ng-matero-ng-select.mjs.map