@ng-matero/ng-select 0.5.2 → 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,558 +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" }, host: { classAttribute: "ng-dropdown-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: `
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
- host: {
517
- class: 'ng-dropdown-panel',
518
- },
519
- encapsulation: ViewEncapsulation.None,
520
- changeDetection: ChangeDetectionStrategy.OnPush,
521
- }]
522
- }], propDecorators: { listboxId: [{
523
- type: Input
524
- }], items: [{
525
- type: Input
526
- }], markedItem: [{
527
- type: Input
528
- }], position: [{
529
- type: Input
530
- }], appendTo: [{
531
- type: Input
532
- }], bufferAmount: [{
533
- type: Input
534
- }], virtualScroll: [{
535
- type: Input,
536
- args: [{ transform: booleanAttribute }]
537
- }], headerTemplate: [{
538
- type: Input
539
- }], footerTemplate: [{
540
- type: Input
541
- }], filterValue: [{
542
- type: Input
543
- }], update: [{
544
- type: Output
545
- }], scroll: [{
546
- type: Output
547
- }], scrollToEnd: [{
548
- type: Output
549
- }], outsideClick: [{
550
- type: Output
551
- }], scrollHostElRef: [{
552
- type: ViewChild,
553
- args: ['scrollHost', { read: ElementRef, static: true }]
554
- }], scrollContentElRef: [{
555
- type: ViewChild,
556
- args: ['scrollContent', { read: ElementRef, static: true }]
557
- }], scrollSpacerElRef: [{
558
- type: ViewChild,
559
- args: ['scrollSpacer', { read: ElementRef, static: true }]
560
- }] } });
561
-
562
- class NgOption {
563
- value;
564
- disabled = false;
565
- elementRef = inject(ElementRef);
566
- stateChange$ = new Subject();
567
- _previousLabel = '';
568
- get label() {
569
- return (this.elementRef.nativeElement.textContent || '').trim();
570
- }
571
- ngOnChanges(changes) {
572
- if (changes['disabled']) {
573
- this.stateChange$.next({
574
- value: this.value,
575
- disabled: this.disabled,
576
- });
577
- }
578
- }
579
- ngAfterViewChecked() {
580
- if (this.label !== this._previousLabel) {
581
- this._previousLabel = this.label;
582
- this.stateChange$.next({
583
- value: this.value,
584
- disabled: this.disabled,
585
- label: this.elementRef.nativeElement.innerHTML,
586
- });
587
- }
588
- }
589
- ngOnDestroy() {
590
- this.stateChange$.complete();
591
- }
592
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOption, deps: [], target: i0.ɵɵFactoryTarget.Component });
593
- 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: `
594
- <ng-content />
595
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
596
- }
597
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOption, decorators: [{
598
- type: Component,
599
- args: [{
600
- selector: 'ng-option',
601
- template: `
602
- <ng-content />
603
- `,
604
- changeDetection: ChangeDetectionStrategy.OnPush,
605
- }]
606
- }], propDecorators: { value: [{
607
- type: Input
608
- }], disabled: [{
609
- type: Input,
610
- args: [{ transform: booleanAttribute }]
611
- }] } });
612
-
613
- class NgOptionHighlight {
614
- term = '';
615
- elementRef = inject(ElementRef);
616
- renderer = inject(Renderer2);
617
- element = this.elementRef.nativeElement;
618
- label = '';
619
- get _canHighlight() {
620
- return this.term && this.label;
621
- }
622
- ngOnChanges() {
623
- if (this._canHighlight) {
624
- this._highlightLabel();
625
- }
626
- }
627
- ngAfterViewInit() {
628
- this.label = this.element.innerHTML;
629
- if (this._canHighlight) {
630
- this._highlightLabel();
631
- }
632
- }
633
- _escapeRegExp(str) {
634
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
635
- }
636
- _highlightLabel() {
637
- const label = this.label;
638
- if (!this.term) {
639
- this._setInnerHtml(label);
640
- return;
641
- }
642
- const alternationString = this._escapeRegExp(this.term).replace(' ', '|');
643
- const termRegex = new RegExp(alternationString, 'gi');
644
- this._setInnerHtml(label.replace(termRegex, `<span class="highlighted">$&</span>`));
645
- }
646
- _setInnerHtml(html) {
647
- this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', html);
648
- }
649
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptionHighlight, deps: [], target: i0.ɵɵFactoryTarget.Directive });
650
- 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 });
651
- }
652
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptionHighlight, decorators: [{
653
- type: Directive,
654
- args: [{
655
- selector: '[ngOptionHighlight]',
656
- }]
657
- }], propDecorators: { term: [{
658
- type: Input,
659
- args: ['ngOptionHighlight']
660
- }] } });
661
-
662
45
  const diacritics = {
663
46
  '\u24B6': 'A',
664
47
  '\uFF21': 'A',
@@ -1517,552 +900,1133 @@ class ItemsList {
1517
900
  get items() {
1518
901
  return this._items;
1519
902
  }
1520
- _items = [];
1521
- get filteredItems() {
1522
- return this._filteredItems;
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
+ }
1523
1148
  }
1524
- _filteredItems = [];
1525
- get markedIndex() {
1526
- return this._markedIndex;
1149
+ _defaultSearchFn(search, opt) {
1150
+ const label = stripSpecialChars(opt.label).toLocaleLowerCase();
1151
+ return label.indexOf(search) > -1;
1527
1152
  }
1528
- _markedIndex = -1;
1529
- get selectedItems() {
1530
- return this._selectionModel.value;
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;
1531
1158
  }
1532
- get markedItem() {
1533
- return this._filteredItems[this._markedIndex];
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
+ }
1534
1167
  }
1535
- get noItemsToSelect() {
1536
- return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
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);
1537
1180
  }
1538
- get maxItemsSelected() {
1539
- return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
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;
1540
1211
  }
1541
- get lastSelectedItem() {
1542
- let i = this.selectedItems.length - 1;
1543
- for (; i >= 0; i--) {
1544
- const item = this.selectedItems[i];
1545
- if (!item.disabled) {
1546
- return item;
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;
1547
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++;
1548
1256
  }
1549
- return null;
1257
+ return items;
1550
1258
  }
1551
- setItems(items) {
1552
- this._items = items.map((item, index) => this.mapItem(item, index));
1553
- if (this._ngSelect.groupBy) {
1554
- this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
1555
- this._items = this._flatten(this._groups);
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();
1292
+ }
1293
+ ngOnChanges(changes) {
1294
+ if (changes['disabled']) {
1295
+ this.stateChange$.next({
1296
+ value: this.value,
1297
+ disabled: this.disabled,
1298
+ });
1556
1299
  }
1557
- else {
1558
- this._groups = new Map();
1559
- this._groups.set(undefined, this._items);
1300
+ }
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
+ });
1560
1309
  }
1561
- this._filteredItems = [...this._items];
1562
1310
  }
1563
- select(item) {
1564
- if (item.selected || this.maxItemsSelected) {
1565
- return;
1311
+ ngOnDestroy() {
1312
+ this.stateChange$.complete();
1313
+ }
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;
1566
1383
  }
1567
- const multiple = this._ngSelect.multiple;
1568
- if (!multiple) {
1569
- this.clearSelected();
1384
+ if (itemBottom > bottom) {
1385
+ return top + itemBottom - bottom;
1570
1386
  }
1571
- this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
1572
- if (this._ngSelect.hideSelected) {
1573
- this._hideSelected(item);
1387
+ else if (itemTop <= top) {
1388
+ return itemTop;
1574
1389
  }
1390
+ return null;
1575
1391
  }
1576
- unselect(item) {
1577
- if (!item.selected) {
1578
- return;
1579
- }
1580
- this._selectionModel.unselect(item, this._ngSelect.multiple);
1581
- if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {
1582
- this._showSelected(item);
1583
- }
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;
1584
1438
  }
1585
- findItem(value) {
1586
- let findBy;
1587
- if (this._ngSelect.compareWith) {
1588
- findBy = item => this._ngSelect.compareWith(item.value, value);
1589
- }
1590
- else if (this._ngSelect.bindValue) {
1591
- findBy = item => !item.children &&
1592
- this.resolveNested(item.value, this._ngSelect.bindValue) === value;
1439
+ _currentPosition = 'auto';
1440
+ get itemsLength() {
1441
+ return this._itemsLength;
1442
+ }
1443
+ set itemsLength(value) {
1444
+ if (value !== this._itemsLength) {
1445
+ this._itemsLength = value;
1446
+ this._onItemsLengthChanged();
1593
1447
  }
1594
- else {
1595
- findBy = item => item.value === value ||
1596
- !!(!item.children &&
1597
- item.label &&
1598
- item.label === this.resolveNested(value, this._ngSelect.bindLabel));
1448
+ }
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;
1599
1455
  }
1600
- return this._items.find(item => findBy(item));
1456
+ return 0;
1601
1457
  }
1602
- addItem(item) {
1603
- const option = this.mapItem(item, this._items.length);
1604
- this._items.push(option);
1605
- this._filteredItems.push(option);
1606
- return option;
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();
1607
1467
  }
1608
- clearSelected(keepDisabled = false) {
1609
- this._selectionModel.clear(keepDisabled);
1610
- this._items.forEach(item => {
1611
- item.selected = keepDisabled && item.selected && item.disabled;
1612
- item.marked = false;
1613
- });
1614
- if (this._ngSelect.hideSelected) {
1615
- this.resetFilteredItems();
1468
+ ngOnChanges(changes) {
1469
+ if (changes['items']) {
1470
+ const change = changes['items'];
1471
+ this._onItemsChange(change.currentValue, change.firstChange);
1616
1472
  }
1617
1473
  }
1618
- findByLabel(term) {
1619
- term = stripSpecialChars(term).toLocaleLowerCase();
1620
- return this.filteredItems.find(item => {
1621
- const label = stripSpecialChars(item.label).toLocaleLowerCase();
1622
- return label.substr(0, term.length) === term;
1623
- });
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);
1480
+ }
1624
1481
  }
1625
- filter(term) {
1626
- if (!term) {
1627
- this.resetFilteredItems();
1482
+ scrollTo(option, startFromOption = false) {
1483
+ if (!option) {
1628
1484
  return;
1629
1485
  }
1630
- this._filteredItems = [];
1631
- term = this._ngSelect.searchFn
1632
- ? term
1633
- : stripSpecialChars(term).toLocaleLowerCase();
1634
- const match = this._ngSelect.searchFn || this._defaultSearchFn;
1635
- const hideSelected = this._ngSelect.hideSelected;
1636
- for (const key of Array.from(this._groups.keys())) {
1637
- const matchedItems = [];
1638
- for (const item of this._groups.get(key)) {
1639
- if (hideSelected && ((item.parent && item.parent.selected) || item.selected)) {
1640
- continue;
1641
- }
1642
- const searchItem = this._ngSelect.searchFn ? item.value : item;
1643
- if (match(term, searchItem)) {
1644
- matchedItems.push(item);
1645
- }
1646
- }
1647
- if (matchedItems.length > 0) {
1648
- const [last] = matchedItems.slice(-1);
1649
- if (last.parent) {
1650
- const head = this._items.find(x => x === last.parent);
1651
- this._filteredItems.push(head);
1652
- }
1653
- this._filteredItems.push(...matchedItems);
1654
- }
1655
- }
1656
- }
1657
- resetFilteredItems() {
1658
- if (this._filteredItems.length === this._items.length) {
1486
+ const index = this.items.indexOf(option);
1487
+ if (index < 0 || index >= this.itemsLength) {
1659
1488
  return;
1660
1489
  }
1661
- if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
1662
- this._filteredItems = this._items.filter(x => !x.selected);
1490
+ let scrollTo;
1491
+ if (this.virtualScroll) {
1492
+ const itemHeight = this._panelUtils.dimensions.itemHeight;
1493
+ scrollTo = this._panelUtils.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
1663
1494
  }
1664
1495
  else {
1665
- this._filteredItems = this._items;
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);
1499
+ }
1500
+ if (isDefined(scrollTo)) {
1501
+ this._scrollHost.scrollTop = scrollTo;
1666
1502
  }
1667
1503
  }
1668
- unmarkItem() {
1669
- this._markedIndex = -1;
1670
- }
1671
- markNextItem() {
1672
- this._stepToItem(+1);
1673
- }
1674
- markPreviousItem() {
1675
- this._stepToItem(-1);
1504
+ scrollToTag() {
1505
+ const panel = this._scrollHost;
1506
+ panel.scrollTop = panel.scrollHeight - panel.clientHeight;
1676
1507
  }
1677
- markItem(item) {
1678
- this._markedIndex = this._filteredItems.indexOf(item);
1508
+ adjustPosition() {
1509
+ this._updateYPosition();
1679
1510
  }
1680
- markSelectedOrDefault(markDefault) {
1681
- if (this._filteredItems.length === 0) {
1682
- return;
1683
- }
1684
- const lastMarkedIndex = this._getLastMarkedIndex();
1685
- if (lastMarkedIndex > -1) {
1686
- this._markedIndex = lastMarkedIndex;
1511
+ _handleDropdownPosition() {
1512
+ this._currentPosition = this._calculateCurrentPosition(this._dropdown);
1513
+ if (CSS_POSITIONS.includes(this._currentPosition)) {
1514
+ this._updateDropdownClass(this._currentPosition);
1687
1515
  }
1688
1516
  else {
1689
- this._markedIndex = markDefault ? this.filteredItems.findIndex(x => !x.disabled) : -1;
1690
- }
1691
- }
1692
- resolveNested(option, key) {
1693
- if (!isObject(option)) {
1694
- return option;
1517
+ this._updateDropdownClass('bottom');
1695
1518
  }
1696
- if (key.indexOf('.') === -1) {
1697
- return option[key];
1519
+ if (this.appendTo) {
1520
+ this._updateYPosition();
1698
1521
  }
1699
- else {
1700
- const keys = key.split('.');
1701
- let value = option;
1702
- for (let i = 0, len = keys.length; i < len; ++i) {
1703
- if (value == null) {
1704
- return null;
1522
+ this._dropdown.style.opacity = '1';
1523
+ }
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);
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);
1533
+ }
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;
1705
1542
  }
1706
- value = value[keys[i]];
1707
- }
1708
- return value;
1709
- }
1543
+ const scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;
1544
+ this._onContentScrolled(scrollTop);
1545
+ });
1546
+ });
1710
1547
  }
1711
- mapItem(item, index) {
1712
- const label = isDefined(item.$ngOptionLabel)
1713
- ? item.$ngOptionLabel
1714
- : this.resolveNested(item, this._ngSelect.bindLabel);
1715
- const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
1716
- return {
1717
- index,
1718
- label: isDefined(label) ? label.toString() : '',
1719
- value,
1720
- disabled: item.disabled,
1721
- htmlId: `${this._ngSelect._uid}-option-${index}`,
1722
- };
1548
+ _handleOutsideClick() {
1549
+ if (!this._document) {
1550
+ return;
1551
+ }
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
+ });
1723
1557
  }
1724
- mapSelectedItems() {
1725
- const multiple = this._ngSelect.multiple;
1726
- for (const selected of this.selectedItems) {
1727
- const value = this._ngSelect.bindValue
1728
- ? this.resolveNested(selected.value, this._ngSelect.bindValue)
1729
- : selected.value;
1730
- const item = isDefined(value) ? this.findItem(value) : null;
1731
- this._selectionModel.unselect(selected, multiple);
1732
- this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
1558
+ _checkToClose($event) {
1559
+ if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
1560
+ return;
1733
1561
  }
1734
- if (this._ngSelect.hideSelected) {
1735
- this._filteredItems = this.filteredItems.filter(x => this.selectedItems.indexOf(x) === -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;
1736
1569
  }
1570
+ this._zone.run(() => this.outsideClick.emit());
1737
1571
  }
1738
- _showSelected(item) {
1739
- this._filteredItems.push(item);
1740
- if (item.parent) {
1741
- const parent = item.parent;
1742
- const parentExists = this._filteredItems.find(x => x === parent);
1743
- if (!parentExists) {
1744
- this._filteredItems.push(parent);
1745
- }
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);
1746
1578
  }
1747
- else if (item.children) {
1748
- for (const child of item.children) {
1749
- child.selected = false;
1750
- this._filteredItems.push(child);
1751
- }
1579
+ else {
1580
+ this._setVirtualHeight();
1581
+ this._updateItems(firstChange);
1752
1582
  }
1753
- this._filteredItems = [...this._filteredItems.sort((a, b) => a.index - b.index)];
1754
1583
  }
1755
- _hideSelected(item) {
1756
- this._filteredItems = this._filteredItems.filter(x => x !== item);
1757
- if (item.parent) {
1758
- const children = item.parent.children;
1759
- if (children.every(x => x.selected)) {
1760
- this._filteredItems = this._filteredItems.filter(x => x !== item.parent);
1761
- }
1762
- }
1763
- else if (item.children) {
1764
- this._filteredItems = this.filteredItems.filter(x => x.parent !== item);
1584
+ _updateItems(firstChange) {
1585
+ this.update.emit(this.items);
1586
+ if (firstChange === false) {
1587
+ return;
1765
1588
  }
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
+ });
1766
1597
  }
1767
- _defaultSearchFn(search, opt) {
1768
- const label = stripSpecialChars(opt.label).toLocaleLowerCase();
1769
- return label.indexOf(search) > -1;
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
+ });
1770
1610
  }
1771
- _getNextItemIndex(steps) {
1772
- if (steps > 0) {
1773
- return this._markedIndex >= this._filteredItems.length - 1 ? 0 : this._markedIndex + 1;
1611
+ _onContentScrolled(scrollTop) {
1612
+ if (this.virtualScroll) {
1613
+ this._renderItemsRange(scrollTop);
1774
1614
  }
1775
- return this._markedIndex <= 0 ? this._filteredItems.length - 1 : this._markedIndex - 1;
1615
+ this._lastScrollPosition = scrollTop;
1616
+ this._fireScrollToEnd(scrollTop);
1776
1617
  }
1777
- _stepToItem(steps) {
1778
- if (this._filteredItems.length === 0 || this._filteredItems.every(x => x.disabled)) {
1779
- return;
1780
- }
1781
- this._markedIndex = this._getNextItemIndex(steps);
1782
- if (this.markedItem?.disabled) {
1783
- this._stepToItem(steps);
1618
+ _updateVirtualHeight(height) {
1619
+ if (this._updateScrollHeight) {
1620
+ this._scrollSpacer.style.height = `${height}px`;
1621
+ this._updateScrollHeight = false;
1784
1622
  }
1785
1623
  }
1786
- _getLastMarkedIndex() {
1787
- if (this._ngSelect.hideSelected) {
1788
- return -1;
1624
+ _setVirtualHeight() {
1625
+ if (!this._scrollSpacer) {
1626
+ return;
1789
1627
  }
1790
- if (this._markedIndex > -1 && this.markedItem == null) {
1791
- return -1;
1628
+ this._scrollSpacer.style.height = `0px`;
1629
+ }
1630
+ _onItemsLengthChanged() {
1631
+ this._updateScrollHeight = true;
1632
+ }
1633
+ _renderItemsRange(scrollTop) {
1634
+ if (scrollTop && this._lastScrollPosition === scrollTop) {
1635
+ return;
1792
1636
  }
1793
- const selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
1794
- if (this.lastSelectedItem && selectedIndex < 0) {
1795
- return -1;
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;
1796
1648
  }
1797
- return Math.max(this.markedIndex, selectedIndex);
1798
1649
  }
1799
- _groupBy(items, prop) {
1800
- const groups = new Map();
1801
- if (items.length === 0) {
1802
- return groups;
1650
+ _measureDimensions() {
1651
+ if (this._panelUtils.dimensions.itemHeight > 0 || this.itemsLength === 0) {
1652
+ return Promise.resolve(this._panelUtils.dimensions);
1803
1653
  }
1804
- // Check if items are already grouped by given key.
1805
- if (Array.isArray(items[0].value[prop])) {
1806
- for (const item of items) {
1807
- const children = (item.value[prop] || []).map((x, index) => this.mapItem(x, index));
1808
- groups.set(item, children);
1809
- }
1810
- return groups;
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
+ });
1664
+ }
1665
+ _fireScrollToEnd(scrollTop) {
1666
+ if (this._scrollToEndFired || scrollTop === 0) {
1667
+ return;
1811
1668
  }
1812
- const isFnKey = isFunction(this._ngSelect.groupBy);
1813
- const keyFn = (item) => {
1814
- const key = isFnKey ? prop(item.value) : item.value[prop];
1815
- return isDefined(key) ? key : undefined;
1816
- };
1817
- // Group items by key.
1818
- for (const item of items) {
1819
- const key = keyFn(item);
1820
- const group = groups.get(key);
1821
- if (group) {
1822
- group.push(item);
1823
- }
1824
- else {
1825
- groups.set(key, [item]);
1826
- }
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;
1827
1673
  }
1828
- return groups;
1829
1674
  }
1830
- _flatten(groups) {
1831
- const isGroupByFn = isFunction(this._ngSelect.groupBy);
1832
- const items = [];
1833
- let groupIndex = 0;
1834
- for (const key of groups.keys()) {
1835
- let i = items.length;
1836
- if (key == null) {
1837
- const withoutGroup = groups.get(undefined) || [];
1838
- items.push(...withoutGroup.map(x => {
1839
- x.index = i++;
1840
- return x;
1841
- }));
1842
- continue;
1843
- }
1844
- const isObjectKey = isObject(key);
1845
- const parent = {
1846
- label: isObjectKey ? '' : String(key),
1847
- children: null,
1848
- parent: null,
1849
- index: i++,
1850
- disabled: !this._ngSelect.selectableGroup,
1851
- htmlId: `${this._ngSelect._uid}-group-${groupIndex}-heading`,
1852
- };
1853
- const groupKey = isGroupByFn
1854
- ? this._ngSelect.bindLabel
1855
- : this._ngSelect.groupBy;
1856
- const groupValue = this._ngSelect.groupValue ||
1857
- (() => {
1858
- if (isObjectKey) {
1859
- return key.value;
1860
- }
1861
- return { [groupKey]: key };
1862
- });
1863
- const children = groups.get(key).map(x => {
1864
- x.parent = parent;
1865
- x.children = null;
1866
- x.index = i++;
1867
- return x;
1868
- });
1869
- parent.children = children;
1870
- parent.value = groupValue(key, children.map(x => x.value));
1871
- items.push(parent);
1872
- items.push(...children);
1873
- groupIndex++;
1675
+ _calculateCurrentPosition(dropdownEl) {
1676
+ if (this.position !== 'auto') {
1677
+ return this.position;
1678
+ }
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';
1686
+ }
1687
+ else {
1688
+ return 'bottom';
1874
1689
  }
1875
- return items;
1876
1690
  }
1691
+ _appendDropdown() {
1692
+ if (!this.appendTo) {
1693
+ return;
1694
+ }
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`);
1700
+ }
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';
1725
+ }
1726
+ }
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();
1737
+ });
1738
+ });
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 });
1877
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
+ }] } });
1878
1866
 
1879
- class NgSelectConfig {
1880
- placeholder;
1881
- fixedPlaceholder = true;
1882
- notFoundText = 'No items found';
1883
- typeToSearchText = 'Type to search';
1884
- addTagText = 'Add item';
1885
- loadingText = 'Loading...';
1886
- clearAllText = 'Clear all';
1887
- virtualScroll = false;
1888
- openOnEnter = true;
1889
- appendTo;
1890
- bindValue;
1891
- bindLabel;
1892
- clearSearchOnAdd;
1893
- deselectOnClick;
1894
- appearance = 'underline';
1895
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1896
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, providedIn: 'root' });
1897
- }
1898
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectConfig, decorators: [{
1899
- type: Injectable,
1900
- args: [{ providedIn: 'root' }]
1901
- }] });
1902
-
1903
- class NgItemLabel {
1904
- ngItemLabel = '';
1905
- escape = true;
1867
+ class NgSelectLabelRenderer {
1868
+ ngSelectLabelValue = '';
1869
+ ngSelectLabelEscape = true;
1906
1870
  element = inject(ElementRef);
1907
1871
  ngOnChanges() {
1908
- this.element.nativeElement.innerHTML = this.escape
1909
- ? escapeHTML(this.ngItemLabel)
1910
- : this.ngItemLabel;
1872
+ this.element.nativeElement.innerHTML = this.ngSelectLabelEscape
1873
+ ? escapeHTML(this.ngSelectLabelValue)
1874
+ : this.ngSelectLabelValue;
1911
1875
  }
1912
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgItemLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1913
- 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 });
1914
1878
  }
1915
- 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: [{
1916
1880
  type: Directive,
1917
1881
  args: [{
1918
- selector: '[ngItemLabel]',
1882
+ selector: '[ngSelectLabelValue]',
1919
1883
  }]
1920
- }], propDecorators: { ngItemLabel: [{
1884
+ }], propDecorators: { ngSelectLabelValue: [{
1921
1885
  type: Input
1922
- }], escape: [{
1886
+ }], ngSelectLabelEscape: [{
1923
1887
  type: Input
1924
1888
  }] } });
1925
- class NgOptionTemplate {
1889
+ class NgSelectOptionTemplate {
1926
1890
  template = inject(TemplateRef);
1927
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptionTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1928
- 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 });
1929
1893
  }
1930
- 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: [{
1931
1895
  type: Directive,
1932
1896
  args: [{
1933
- selector: '[ng-option-tmp]',
1897
+ selector: '[ngSelectOption]',
1934
1898
  }]
1935
1899
  }] });
1936
- class NgOptgroupTemplate {
1900
+ class NgSelectOptgroupTemplate {
1937
1901
  template = inject(TemplateRef);
1938
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgOptgroupTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1939
- 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 });
1940
1904
  }
1941
- 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: [{
1942
1906
  type: Directive,
1943
1907
  args: [{
1944
- selector: '[ng-optgroup-tmp]',
1908
+ selector: '[ngSelectOptgroup]',
1945
1909
  }]
1946
1910
  }] });
1947
- class NgLabelTemplate {
1911
+ class NgSelectLabelTemplate {
1948
1912
  template = inject(TemplateRef);
1949
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgLabelTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1950
- 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 });
1951
1915
  }
1952
- 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: [{
1953
1917
  type: Directive,
1954
1918
  args: [{
1955
- selector: '[ng-label-tmp]',
1919
+ selector: '[ngSelectLabel]',
1956
1920
  }]
1957
1921
  }] });
1958
- class NgMultiLabelTemplate {
1922
+ class NgSelectMultiLabelTemplate {
1959
1923
  template = inject(TemplateRef);
1960
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgMultiLabelTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1961
- 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 });
1962
1926
  }
1963
- 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: [{
1964
1928
  type: Directive,
1965
1929
  args: [{
1966
- selector: '[ng-multi-label-tmp]',
1930
+ selector: '[ngSelectMultiLabel]',
1967
1931
  }]
1968
1932
  }] });
1969
- class NgHeaderTemplate {
1933
+ class NgSelectPanelHeaderTemplate {
1970
1934
  template = inject(TemplateRef);
1971
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgHeaderTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1972
- 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 });
1973
1937
  }
1974
- 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: [{
1975
1939
  type: Directive,
1976
1940
  args: [{
1977
- selector: '[ng-header-tmp]',
1941
+ selector: '[ngSelectPanelHeader]',
1978
1942
  }]
1979
1943
  }] });
1980
- class NgFooterTemplate {
1944
+ class NgSelectPanelFooterTemplate {
1981
1945
  template = inject(TemplateRef);
1982
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgFooterTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1983
- 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 });
1984
1948
  }
1985
- 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: [{
1986
1950
  type: Directive,
1987
1951
  args: [{
1988
- selector: '[ng-footer-tmp]',
1952
+ selector: '[ngSelectPanelFooter]',
1989
1953
  }]
1990
1954
  }] });
1991
- class NgNotFoundTemplate {
1955
+ class NgSelectNotFoundTemplate {
1992
1956
  template = inject(TemplateRef);
1993
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgNotFoundTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1994
- 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 });
1995
1959
  }
1996
- 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: [{
1997
1961
  type: Directive,
1998
1962
  args: [{
1999
- selector: '[ng-notfound-tmp]',
1963
+ selector: '[ngSelectNotFound]',
2000
1964
  }]
2001
1965
  }] });
2002
- class NgPlaceholderTemplate {
1966
+ class NgSelectPlaceholderTemplate {
2003
1967
  template = inject(TemplateRef);
2004
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgPlaceholderTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2005
- 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 });
2006
1970
  }
2007
- 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: [{
2008
1972
  type: Directive,
2009
1973
  args: [{
2010
- selector: '[ng-placeholder-tmp]',
1974
+ selector: '[ngSelectPlaceholder]',
2011
1975
  }]
2012
1976
  }] });
2013
- class NgTypeToSearchTemplate {
1977
+ class NgSelectTypeToSearchTemplate {
2014
1978
  template = inject(TemplateRef);
2015
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgTypeToSearchTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2016
- 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 });
2017
1981
  }
2018
- 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: [{
2019
1983
  type: Directive,
2020
1984
  args: [{
2021
- selector: '[ng-typetosearch-tmp]',
1985
+ selector: '[ngSelectTypeToSearch]',
2022
1986
  }]
2023
1987
  }] });
2024
- class NgLoadingTextTemplate {
1988
+ class NgSelectLoadingTextTemplate {
2025
1989
  template = inject(TemplateRef);
2026
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgLoadingTextTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2027
- 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 });
2028
1992
  }
2029
- 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: [{
2030
1994
  type: Directive,
2031
1995
  args: [{
2032
- selector: '[ng-loadingtext-tmp]',
1996
+ selector: '[ngSelectLoadingText]',
2033
1997
  }]
2034
1998
  }] });
2035
- class NgTagTemplate {
1999
+ class NgSelectTagTemplate {
2036
2000
  template = inject(TemplateRef);
2037
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgTagTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2038
- 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 });
2039
2003
  }
2040
- 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: [{
2041
2005
  type: Directive,
2042
2006
  args: [{
2043
- selector: '[ng-tag-tmp]',
2007
+ selector: '[ngSelectTag]',
2044
2008
  }]
2045
2009
  }] });
2046
- class NgLoadingSpinnerTemplate {
2010
+ class NgSelectLoadingTemplate {
2047
2011
  template = inject(TemplateRef);
2048
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgLoadingSpinnerTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2049
- 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 });
2050
2014
  }
2051
- 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: [{
2052
2016
  type: Directive,
2053
2017
  args: [{
2054
- selector: '[ng-loadingspinner-tmp]',
2018
+ selector: '[ngSelectLoading]',
2055
2019
  }]
2056
2020
  }] });
2057
- class NgClearButtonTemplate {
2021
+ class NgSelectClearButtonTemplate {
2058
2022
  template = inject(TemplateRef);
2059
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgClearButtonTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2060
- 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 });
2061
2025
  }
2062
- 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: [{
2063
2027
  type: Directive,
2064
2028
  args: [{
2065
- selector: '[ng-clearbutton-tmp]',
2029
+ selector: '[ngSelectClearButton]',
2066
2030
  }]
2067
2031
  }] });
2068
2032
 
@@ -2150,6 +2114,8 @@ class NgSelect {
2150
2114
  classes = inject(new HostAttributeToken('class'), { optional: true });
2151
2115
  _classList = {};
2152
2116
  _uid = `ng-select-${nextUniqueId++}`;
2117
+ _listboxId = `${this._uid}-listbox`;
2118
+ _viewValuesId = `${this._uid}-view-values`;
2153
2119
  bindLabel = this._config.bindLabel;
2154
2120
  bindValue = this._config.bindValue;
2155
2121
  placeholder = this._config.placeholder;
@@ -2189,12 +2155,17 @@ class NgSelect {
2189
2155
  searchFn = null;
2190
2156
  keyDownFn = (e) => true;
2191
2157
  trackByFn = null;
2192
- appearance = this._config.appearance;
2193
2158
  tabIndex;
2159
+ inputAttrs = {};
2194
2160
  ariaLabel;
2195
2161
  ariaLabelledby;
2196
- ariaDescribedby;
2197
- 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;
2198
2169
  set panelClass(value) {
2199
2170
  const newClassList = {};
2200
2171
  this.classes?.split(/\s+/).forEach(c => (newClassList[c] = true));
@@ -2211,12 +2182,14 @@ class NgSelect {
2211
2182
  this._cdr.markForCheck();
2212
2183
  }
2213
2184
  get inputId() {
2214
- return this._inputId || `${this._uid}-input`;
2185
+ return this._inputId;
2215
2186
  }
2216
2187
  set inputId(value) {
2217
- this._inputId = value;
2188
+ if (value) {
2189
+ this._inputId = value;
2190
+ }
2218
2191
  }
2219
- _inputId;
2192
+ _inputId = `${this._uid}-input`;
2220
2193
  get items() {
2221
2194
  return this._items;
2222
2195
  }
@@ -2274,14 +2247,14 @@ class NgSelect {
2274
2247
  optgroupTemplate;
2275
2248
  labelTemplate;
2276
2249
  multiLabelTemplate;
2277
- headerTemplate;
2278
- footerTemplate;
2250
+ panelHeaderTemplate;
2251
+ panelFooterTemplate;
2279
2252
  notFoundTemplate;
2280
2253
  placeholderTemplate;
2281
2254
  typeToSearchTemplate;
2282
2255
  loadingTextTemplate;
2283
2256
  tagTemplate;
2284
- loadingSpinnerTemplate;
2257
+ loadingTemplate;
2285
2258
  clearButtonTemplate;
2286
2259
  itemsList = new ItemsList(this, this.newSelectionModel?.() ?? DefaultSelectionModelFactory());
2287
2260
  element = this._elementRef.nativeElement;
@@ -2303,6 +2276,9 @@ class NgSelect {
2303
2276
  get selectedValues() {
2304
2277
  return this.selectedItems.map(x => x.value);
2305
2278
  }
2279
+ get selectedViewValuesStr() {
2280
+ return this.selectedItems.map(x => x.viewValue).join(', ');
2281
+ }
2306
2282
  get hasValue() {
2307
2283
  return this.selectedItems.length > 0;
2308
2284
  }
@@ -2330,7 +2306,7 @@ class NgSelect {
2330
2306
  return this.editableSearchTerm && !this.multiple;
2331
2307
  }
2332
2308
  get _isTypeahead() {
2333
- return this.typeahead && this.typeahead.observers.length > 0;
2309
+ return this.typeahead && this.typeahead.observed;
2334
2310
  }
2335
2311
  get _validTerm() {
2336
2312
  const term = this.searchTerm?.trim();
@@ -2349,9 +2325,6 @@ class NgSelect {
2349
2325
  const empty = this.itemsList.filteredItems.length === 0;
2350
2326
  return empty && this._isTypeahead && !this._validTerm && !this.loading;
2351
2327
  }
2352
- get listboxId() {
2353
- return `${this._uid}-listbox`;
2354
- }
2355
2328
  _onChange = (_) => { };
2356
2329
  _onTouched = () => { };
2357
2330
  trackByOption = (_, item) => {
@@ -2471,33 +2444,34 @@ class NgSelect {
2471
2444
  }
2472
2445
  }
2473
2446
  handleMousedown(e) {
2474
- if (this.preventToggleOnRightClick && e.button === 2) {
2447
+ if (this.preventToggleOnRightClick && e.button === 2)
2475
2448
  return;
2476
- }
2477
2449
  const target = e.target;
2478
- 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) {
2479
2455
  e.preventDefault();
2480
2456
  }
2481
- if (target.classList.contains('ng-clear-wrapper')) {
2457
+ if (isClearClick) {
2482
2458
  this.handleClearClick();
2483
2459
  return;
2484
2460
  }
2485
- if (target.classList.contains('ng-arrow-wrapper')) {
2461
+ if (isArrowClick) {
2486
2462
  this.handleArrowClick();
2487
2463
  return;
2488
2464
  }
2489
- if (target.classList.contains('ng-value-remove')) {
2465
+ if (isValueRemoveClick) {
2490
2466
  return;
2491
2467
  }
2492
2468
  if (!this.focused) {
2493
2469
  this.focus();
2494
2470
  }
2495
- if (this.searchable) {
2496
- this.open();
2497
- }
2498
- else {
2499
- this.toggle();
2471
+ if (this.searchable && this.isOpen) {
2472
+ return;
2500
2473
  }
2474
+ this.toggle();
2501
2475
  }
2502
2476
  handleArrowClick() {
2503
2477
  if (this.isOpen) {
@@ -2564,6 +2538,12 @@ class NgSelect {
2564
2538
  this.closeEvent.emit();
2565
2539
  this._cdr.markForCheck();
2566
2540
  }
2541
+ focus() {
2542
+ this.searchInput.nativeElement.focus();
2543
+ }
2544
+ blur() {
2545
+ this.searchInput.nativeElement.blur();
2546
+ }
2567
2547
  toggleItem(item) {
2568
2548
  if (!item || item.disabled || this.disabled) {
2569
2549
  return;
@@ -2594,12 +2574,6 @@ class NgSelect {
2594
2574
  }
2595
2575
  this._onSelectionChanged();
2596
2576
  }
2597
- focus() {
2598
- this.searchInput.nativeElement.focus();
2599
- }
2600
- blur() {
2601
- this.searchInput.nativeElement.blur();
2602
- }
2603
2577
  unselect(item) {
2604
2578
  if (!item) {
2605
2579
  return;
@@ -2714,6 +2688,7 @@ class NgSelect {
2714
2688
  this.items = options.map(option => ({
2715
2689
  $ngOptionValue: option.value,
2716
2690
  $ngOptionLabel: option.elementRef.nativeElement.innerHTML,
2691
+ viewValue: (option.elementRef.nativeElement.textContent || '').trim(),
2717
2692
  disabled: option.disabled,
2718
2693
  }));
2719
2694
  this.itemsList.setItems(this.items);
@@ -2981,17 +2956,17 @@ class NgSelect {
2981
2956
  }
2982
2957
  }
2983
2958
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
2984
- 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: [
2985
2960
  {
2986
2961
  provide: NG_VALUE_ACCESSOR,
2987
2962
  useExisting: forwardRef(() => NgSelect),
2988
2963
  multi: true,
2989
2964
  },
2990
- ], 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-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 });
2991
2966
  }
2992
2967
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelect, decorators: [{
2993
2968
  type: Component,
2994
- args: [{ selector: 'ng-select', imports: [NgTemplateOutlet, NgItemLabel, NgDropdownPanel], host: {
2969
+ args: [{ selector: 'ng-select', imports: [NgTemplateOutlet, NgSelectLabelRenderer, NgSelectPanel], host: {
2995
2970
  'class': 'ng-select',
2996
2971
  '[class.ng-select-single]': '!multiple',
2997
2972
  '[class.ng-select-multiple]': 'multiple',
@@ -3009,7 +2984,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3009
2984
  useExisting: forwardRef(() => NgSelect),
3010
2985
  multi: true,
3011
2986
  },
3012
- ], 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-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"] }]
3013
2988
  }], ctorParameters: () => [], propDecorators: { bindLabel: [{
3014
2989
  type: Input
3015
2990
  }], bindValue: [{
@@ -3109,19 +3084,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3109
3084
  type: Input
3110
3085
  }], trackByFn: [{
3111
3086
  type: Input
3112
- }], appearance: [{
3113
- type: Input
3114
3087
  }], tabIndex: [{
3115
3088
  type: Input,
3116
3089
  args: [{ transform: numberAttribute }]
3090
+ }], inputAttrs: [{
3091
+ type: Input
3117
3092
  }], ariaLabel: [{
3118
3093
  type: Input
3119
3094
  }], ariaLabelledby: [{
3120
3095
  type: Input
3121
3096
  }], ariaDescribedby: [{
3122
3097
  type: Input
3123
- }], inputAttrs: [{
3124
- type: Input
3125
3098
  }], panelClass: [{
3126
3099
  type: Input
3127
3100
  }], inputId: [{
@@ -3169,7 +3142,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3169
3142
  type: Output
3170
3143
  }], dropdownPanel: [{
3171
3144
  type: ViewChild,
3172
- args: [forwardRef(() => NgDropdownPanel)]
3145
+ args: [forwardRef(() => NgSelectPanel)]
3173
3146
  }], searchInput: [{
3174
3147
  type: ViewChild,
3175
3148
  args: ['searchInput', { static: true }]
@@ -3178,81 +3151,81 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3178
3151
  args: ['clearButton']
3179
3152
  }], ngOptions: [{
3180
3153
  type: ContentChildren,
3181
- args: [NgOption, { descendants: true }]
3154
+ args: [NgSelectOption, { descendants: true }]
3182
3155
  }], optionTemplate: [{
3183
3156
  type: ContentChild,
3184
- args: [NgOptionTemplate, { read: TemplateRef }]
3157
+ args: [NgSelectOptionTemplate, { read: TemplateRef }]
3185
3158
  }], optgroupTemplate: [{
3186
3159
  type: ContentChild,
3187
- args: [NgOptgroupTemplate, { read: TemplateRef }]
3160
+ args: [NgSelectOptgroupTemplate, { read: TemplateRef }]
3188
3161
  }], labelTemplate: [{
3189
3162
  type: ContentChild,
3190
- args: [NgLabelTemplate, { read: TemplateRef }]
3163
+ args: [NgSelectLabelTemplate, { read: TemplateRef }]
3191
3164
  }], multiLabelTemplate: [{
3192
3165
  type: ContentChild,
3193
- args: [NgMultiLabelTemplate, { read: TemplateRef }]
3194
- }], headerTemplate: [{
3166
+ args: [NgSelectMultiLabelTemplate, { read: TemplateRef }]
3167
+ }], panelHeaderTemplate: [{
3195
3168
  type: ContentChild,
3196
- args: [NgHeaderTemplate, { read: TemplateRef }]
3197
- }], footerTemplate: [{
3169
+ args: [NgSelectPanelHeaderTemplate, { read: TemplateRef }]
3170
+ }], panelFooterTemplate: [{
3198
3171
  type: ContentChild,
3199
- args: [NgFooterTemplate, { read: TemplateRef }]
3172
+ args: [NgSelectPanelFooterTemplate, { read: TemplateRef }]
3200
3173
  }], notFoundTemplate: [{
3201
3174
  type: ContentChild,
3202
- args: [NgNotFoundTemplate, { read: TemplateRef }]
3175
+ args: [NgSelectNotFoundTemplate, { read: TemplateRef }]
3203
3176
  }], placeholderTemplate: [{
3204
3177
  type: ContentChild,
3205
- args: [NgPlaceholderTemplate, { read: TemplateRef }]
3178
+ args: [NgSelectPlaceholderTemplate, { read: TemplateRef }]
3206
3179
  }], typeToSearchTemplate: [{
3207
3180
  type: ContentChild,
3208
- args: [NgTypeToSearchTemplate, { read: TemplateRef }]
3181
+ args: [NgSelectTypeToSearchTemplate, { read: TemplateRef }]
3209
3182
  }], loadingTextTemplate: [{
3210
3183
  type: ContentChild,
3211
- args: [NgLoadingTextTemplate, { read: TemplateRef }]
3184
+ args: [NgSelectLoadingTextTemplate, { read: TemplateRef }]
3212
3185
  }], tagTemplate: [{
3213
3186
  type: ContentChild,
3214
- args: [NgTagTemplate, { read: TemplateRef }]
3215
- }], loadingSpinnerTemplate: [{
3187
+ args: [NgSelectTagTemplate, { read: TemplateRef }]
3188
+ }], loadingTemplate: [{
3216
3189
  type: ContentChild,
3217
- args: [NgLoadingSpinnerTemplate, { read: TemplateRef }]
3190
+ args: [NgSelectLoadingTemplate, { read: TemplateRef }]
3218
3191
  }], clearButtonTemplate: [{
3219
3192
  type: ContentChild,
3220
- args: [NgClearButtonTemplate, { read: TemplateRef }]
3193
+ args: [NgSelectClearButtonTemplate, { read: TemplateRef }]
3221
3194
  }] } });
3222
3195
 
3223
3196
  class NgSelectModule {
3224
3197
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3225
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, imports: [NgDropdownPanel,
3226
- NgOption,
3198
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, imports: [NgSelectPanel,
3227
3199
  NgSelect,
3228
- NgOptgroupTemplate,
3229
- NgOptionTemplate,
3230
- NgLabelTemplate,
3231
- NgMultiLabelTemplate,
3232
- NgHeaderTemplate,
3233
- NgFooterTemplate,
3234
- NgPlaceholderTemplate,
3235
- NgClearButtonTemplate,
3236
- NgNotFoundTemplate,
3237
- NgTypeToSearchTemplate,
3238
- NgLoadingTextTemplate,
3239
- NgTagTemplate,
3240
- NgLoadingSpinnerTemplate,
3241
- NgItemLabel], exports: [NgSelect,
3242
- NgOption,
3243
- NgOptgroupTemplate,
3244
- NgOptionTemplate,
3245
- NgLabelTemplate,
3246
- NgMultiLabelTemplate,
3247
- NgHeaderTemplate,
3248
- NgFooterTemplate,
3249
- NgPlaceholderTemplate,
3250
- NgNotFoundTemplate,
3251
- NgTypeToSearchTemplate,
3252
- NgLoadingTextTemplate,
3253
- NgTagTemplate,
3254
- NgLoadingSpinnerTemplate,
3255
- 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] });
3256
3229
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSelectModule, providers: [
3257
3230
  {
3258
3231
  provide: SELECTION_MODEL_FACTORY,
@@ -3264,40 +3237,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3264
3237
  type: NgModule,
3265
3238
  args: [{
3266
3239
  imports: [
3267
- NgDropdownPanel,
3268
- NgOption,
3240
+ NgSelectPanel,
3269
3241
  NgSelect,
3270
- NgOptgroupTemplate,
3271
- NgOptionTemplate,
3272
- NgLabelTemplate,
3273
- NgMultiLabelTemplate,
3274
- NgHeaderTemplate,
3275
- NgFooterTemplate,
3276
- NgPlaceholderTemplate,
3277
- NgClearButtonTemplate,
3278
- NgNotFoundTemplate,
3279
- NgTypeToSearchTemplate,
3280
- NgLoadingTextTemplate,
3281
- NgTagTemplate,
3282
- NgLoadingSpinnerTemplate,
3283
- 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,
3284
3257
  ],
3285
3258
  exports: [
3286
3259
  NgSelect,
3287
- NgOption,
3288
- NgOptgroupTemplate,
3289
- NgOptionTemplate,
3290
- NgLabelTemplate,
3291
- NgMultiLabelTemplate,
3292
- NgHeaderTemplate,
3293
- NgFooterTemplate,
3294
- NgPlaceholderTemplate,
3295
- NgNotFoundTemplate,
3296
- NgTypeToSearchTemplate,
3297
- NgLoadingTextTemplate,
3298
- NgTagTemplate,
3299
- NgLoadingSpinnerTemplate,
3300
- 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,
3301
3274
  ],
3302
3275
  providers: [
3303
3276
  {
@@ -3308,6 +3281,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3308
3281
  }]
3309
3282
  }] });
3310
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
+
3311
3333
  /*
3312
3334
  * Public API Surface of ng-select
3313
3335
  */
@@ -3316,5 +3338,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3316
3338
  * Generated bundle index. Do not edit.
3317
3339
  */
3318
3340
 
3319
- 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 };
3320
3342
  //# sourceMappingURL=ng-matero-ng-select.mjs.map