@ng-select/ng-select
Version:
Angular select, multiselect and autocomplete with Signal Forms, Reactive Forms and Template-driven Forms support
5,606 lines • 184 kB
JavaScript
import * as i0 from "@angular/core";
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, Directive, ElementRef, HostAttributeToken, HostListener, Injectable, InjectionToken, Injector, NgModule, NgZone, Renderer2, TemplateRef, ViewContainerRef, ViewEncapsulation, afterEveryRender, booleanAttribute, computed, contentChild, contentChildren, effect, forwardRef, inject, input, isDevMode, linkedSignal, model, numberAttribute, output, runInInjectionContext, signal, untracked, viewChild } from "@angular/core";
import { FlexibleConnectedPositionStrategy, OverlayContainer, createFlexibleConnectedPositionStrategy, createNoopScrollStrategy, createOverlayRef } from "@angular/cdk/overlay";
import { DOCUMENT, NgClass, NgTemplateOutlet } from "@angular/common";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { Subject, animationFrameScheduler, asapScheduler, fromEvent } from "rxjs";
import { auditTime, debounceTime, filter, map, tap } from "rxjs/operators";
import { EventPhase } from "@angular/core/primitives/event-dispatch";
import { NG_VALUE_ACCESSOR } from "@angular/forms";
import { TemplatePortal } from "@angular/cdk/portal";
var NgItemLabelDirective = class NgItemLabelDirective {
constructor() {
this.element = inject(ElementRef);
this.ngItemLabel = input(...ngDevMode ? [void 0, { debugName: "ngItemLabel" }] : /* istanbul ignore next */ []);
this.escape = input(true, ...ngDevMode ? [{ debugName: "escape" }] : /* istanbul ignore next */ []);
effect(() => {
this.element.nativeElement.textContent = this.ngItemLabel() ?? "";
});
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgItemLabelDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "17.1.0",
version: "22.2.0",
type: NgItemLabelDirective,
isStandalone: true,
selector: "[ngItemLabel]",
inputs: {
ngItemLabel: {
classPropertyName: "ngItemLabel",
publicName: "ngItemLabel",
isSignal: true,
isRequired: false,
transformFunction: null
},
escape: {
classPropertyName: "escape",
publicName: "escape",
isSignal: true,
isRequired: false,
transformFunction: null
}
},
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgItemLabelDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ngItemLabel]",
standalone: true
}]
}],
ctorParameters: () => [],
propDecorators: {
ngItemLabel: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "ngItemLabel",
required: false
}]
}],
escape: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "escape",
required: false
}]
}]
}
});
var NgOptionTemplateDirective = class NgOptionTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgOptionTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgOptionTemplateDirective,
isStandalone: true,
selector: "[ng-option-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgOptionTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-option-tmp]",
standalone: true
}]
}]
});
var NgOptgroupTemplateDirective = class NgOptgroupTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgOptgroupTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgOptgroupTemplateDirective,
isStandalone: true,
selector: "[ng-optgroup-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgOptgroupTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-optgroup-tmp]",
standalone: true
}]
}]
});
var NgLabelTemplateDirective = class NgLabelTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgLabelTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgLabelTemplateDirective,
isStandalone: true,
selector: "[ng-label-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgLabelTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-label-tmp]",
standalone: true
}]
}]
});
var NgMultiLabelTemplateDirective = class NgMultiLabelTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgMultiLabelTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgMultiLabelTemplateDirective,
isStandalone: true,
selector: "[ng-multi-label-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgMultiLabelTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-multi-label-tmp]",
standalone: true
}]
}]
});
var NgHeaderTemplateDirective = class NgHeaderTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgHeaderTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgHeaderTemplateDirective,
isStandalone: true,
selector: "[ng-header-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgHeaderTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-header-tmp]",
standalone: true
}]
}]
});
var NgFooterTemplateDirective = class NgFooterTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgFooterTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgFooterTemplateDirective,
isStandalone: true,
selector: "[ng-footer-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgFooterTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-footer-tmp]",
standalone: true
}]
}]
});
var NgNotFoundTemplateDirective = class NgNotFoundTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgNotFoundTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgNotFoundTemplateDirective,
isStandalone: true,
selector: "[ng-notfound-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgNotFoundTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-notfound-tmp]",
standalone: true
}]
}]
});
var NgPlaceholderTemplateDirective = class NgPlaceholderTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgPlaceholderTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgPlaceholderTemplateDirective,
isStandalone: true,
selector: "[ng-placeholder-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgPlaceholderTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-placeholder-tmp]",
standalone: true
}]
}]
});
var NgTypeToSearchTemplateDirective = class NgTypeToSearchTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgTypeToSearchTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgTypeToSearchTemplateDirective,
isStandalone: true,
selector: "[ng-typetosearch-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgTypeToSearchTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-typetosearch-tmp]",
standalone: true
}]
}]
});
var NgLoadingTextTemplateDirective = class NgLoadingTextTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgLoadingTextTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgLoadingTextTemplateDirective,
isStandalone: true,
selector: "[ng-loadingtext-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgLoadingTextTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-loadingtext-tmp]",
standalone: true
}]
}]
});
var NgTagTemplateDirective = class NgTagTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgTagTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgTagTemplateDirective,
isStandalone: true,
selector: "[ng-tag-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgTagTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-tag-tmp]",
standalone: true
}]
}]
});
var NgLoadingSpinnerTemplateDirective = class NgLoadingSpinnerTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgLoadingSpinnerTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgLoadingSpinnerTemplateDirective,
isStandalone: true,
selector: "[ng-loadingspinner-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgLoadingSpinnerTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-loadingspinner-tmp]",
standalone: true
}]
}]
});
var NgClearButtonTemplateDirective = class NgClearButtonTemplateDirective {
constructor() {
this.template = inject(TemplateRef);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgClearButtonTemplateDirective,
deps: [],
target: i0.ɵɵFactoryTarget.Directive
});
}
static {
this.ɵdir = i0.ɵɵngDeclareDirective({
minVersion: "14.0.0",
version: "22.2.0",
type: NgClearButtonTemplateDirective,
isStandalone: true,
selector: "[ng-clearbutton-tmp]",
ngImport: i0
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgClearButtonTemplateDirective,
decorators: [{
type: Directive,
args: [{
selector: "[ng-clearbutton-tmp]",
standalone: true
}]
}]
});
const EVENT_SCHEDULER = typeof requestAnimationFrame !== "undefined" ? animationFrameScheduler : asapScheduler;
function isEventInside(event, select, dropdown) {
const path = event.path || event.composedPath?.();
if (path?.length) return path.includes(select) || path.includes(dropdown);
return select.contains(event.target) || dropdown.contains(event.target);
}
var DropdownPanelDomEvents = class {
constructor(options) {
this.options = options;
this.lastMousedownInside = false;
}
start() {
this.handleOutsideClick();
this.preventPanelMousedownFocus();
this.handleDocumentScroll();
this.handleSelectResize();
}
handleOutsideClick() {
const { destroyRef, document, outsideClickEvent, zone } = this.options;
if (!document) return;
zone.runOutsideAngular(() => {
if (outsideClickEvent === "click") fromEvent(document, "mousedown", { capture: true }).pipe(takeUntilDestroyed(destroyRef)).subscribe((event) => this.lastMousedownInside = isEventInside(event, this.options.select, this.options.dropdown));
fromEvent(document, outsideClickEvent, { capture: true }).pipe(takeUntilDestroyed(destroyRef)).subscribe((event) => this.checkToClose(event));
});
}
checkToClose(event) {
const pressStartedInside = this.lastMousedownInside;
this.lastMousedownInside = false;
if (pressStartedInside || isEventInside(event, this.options.select, this.options.dropdown)) return;
this.options.zone.run(this.options.onOutsideClick);
}
preventPanelMousedownFocus() {
const { destroyRef, dropdown, zone } = this.options;
zone.runOutsideAngular(() => {
fromEvent(dropdown, "mousedown").pipe(takeUntilDestroyed(destroyRef)).subscribe((event) => {
if (event.target.tagName !== "INPUT") event.preventDefault();
});
});
}
handleDocumentScroll() {
const { closeOnScroll, destroyRef, document, dropdown, onOutsideScroll, overlayRef, zone } = this.options;
if (!document || !overlayRef && !closeOnScroll) return;
zone.runOutsideAngular(() => {
const subscribe = () => fromEvent(document, "scroll", {
capture: true,
passive: true
}).pipe(auditTime(0, EVENT_SCHEDULER), takeUntilDestroyed(destroyRef)).subscribe((event) => {
const target = event.target;
if (target && dropdown.contains(target)) return;
if (closeOnScroll) zone.run(onOutsideScroll);
else overlayRef.updatePosition();
});
if (!closeOnScroll || typeof requestAnimationFrame === "undefined") {
subscribe();
return;
}
const frame = requestAnimationFrame(subscribe);
destroyRef.onDestroy(() => cancelAnimationFrame(frame));
});
}
handleSelectResize() {
const { destroyRef, overlayRef, select, zone } = this.options;
if (!overlayRef || typeof ResizeObserver === "undefined") return;
zone.runOutsideAngular(() => {
const observer = new ResizeObserver(() => {
overlayRef.updateSize({ width: select.getBoundingClientRect().width });
overlayRef.updatePosition();
});
observer.observe(select);
destroyRef.onDestroy(() => observer.disconnect());
});
}
};
const DROPDOWN_POSITION_BELOW = {
originX: "start",
originY: "bottom",
overlayX: "start",
overlayY: "top"
};
const DROPDOWN_POSITION_ABOVE = {
originX: "start",
originY: "top",
overlayX: "start",
overlayY: "bottom"
};
const DROPDOWN_POSITIONS = {
auto: [DROPDOWN_POSITION_BELOW, DROPDOWN_POSITION_ABOVE],
bottom: [DROPDOWN_POSITION_BELOW],
top: [DROPDOWN_POSITION_ABOVE],
right: [{
originX: "end",
originY: "top",
overlayX: "start",
overlayY: "top"
}],
left: [{
originX: "start",
originY: "top",
overlayX: "end",
overlayY: "top"
}]
};
const DROPDOWN_CSS_POSITIONS = [
"top",
"right",
"bottom",
"left"
];
function connectionPairToDropdownPosition(pair) {
if (pair.originY === "bottom" && pair.overlayY === "top") return "bottom";
if (pair.originY === "top" && pair.overlayY === "bottom") return "top";
if (pair.originX === "end" && pair.overlayX === "start") return "right";
if (pair.originX === "start" && pair.overlayX === "end") return "left";
return "bottom";
}
var NgDropdownPanelService = class NgDropdownPanelService {
constructor() {
this._dimensions = {
itemHeight: 0,
groupHeight: 0,
panelHeight: 0,
itemsPerViewport: 0
};
}
get dimensions() {
return this._dimensions;
}
calculateItems(scrollPos, itemsLength, buffer, items) {
const d = this._dimensions;
if (!!items && d.groupHeight > 0 && d.groupHeight !== d.itemHeight) return this._calculateItemsVariable(scrollPos, items, buffer);
const scrollHeight = d.itemHeight * itemsLength;
const indexByScrollTop = Math.max(0, scrollPos) / scrollHeight * itemsLength;
let end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
const maxStart = Math.max(0, end - d.itemsPerViewport);
let start = Math.min(maxStart, Math.floor(indexByScrollTop));
let topPadding = d.itemHeight * Math.ceil(start) - d.itemHeight * Math.min(start, buffer);
topPadding = !isNaN(topPadding) ? topPadding : 0;
start = !isNaN(start) ? start : -1;
end = !isNaN(end) ? end : -1;
start -= buffer;
start = Math.max(0, start);
end += buffer;
end = Math.min(itemsLength, end);
return {
topPadding,
scrollHeight,
start,
end
};
}
setDimensions(itemHeight, panelHeight, groupHeight = itemHeight) {
const effectiveItemHeight = itemHeight > 0 ? itemHeight : groupHeight;
const itemsPerViewport = effectiveItemHeight > 0 ? Math.max(1, Math.floor(panelHeight / effectiveItemHeight)) : 0;
this._dimensions = {
itemHeight,
groupHeight: groupHeight > 0 ? groupHeight : itemHeight,
panelHeight,
itemsPerViewport
};
}
getItemHeight(item) {
const d = this._dimensions;
if (item?.children) return d.groupHeight || d.itemHeight;
return d.itemHeight || d.groupHeight;
}
getItemOffset(items, index) {
let offset = 0;
const end = Math.max(0, Math.min(index, items.length));
for (let i = 0; i < end; i++) offset += this.getItemHeight(items[i]);
return offset;
}
getScrollHeight(items) {
return this.getItemOffset(items, items.length);
}
getScrollTo(itemTop, itemHeight, lastScroll) {
const { panelHeight } = this.dimensions;
const itemBottom = itemTop + itemHeight;
const top = lastScroll;
const bottom = top + panelHeight;
if (panelHeight >= itemBottom && lastScroll === itemTop) return null;
if (itemBottom > bottom) return top + itemBottom - bottom;
else if (itemTop <= top) return itemTop;
return null;
}
_calculateItemsVariable(scrollPos, items, buffer) {
const { panelHeight } = this._dimensions;
const itemsLength = items.length;
const scrollHeight = this.getScrollHeight(items);
const scrollTop = Math.max(0, scrollPos);
let accumulated = 0;
let start = 0;
for (let i = 0; i < itemsLength; i++) {
const height = this.getItemHeight(items[i]);
if (accumulated + height > scrollTop) {
start = i;
break;
}
accumulated += height;
start = i + 1;
}
let end = start;
let visibleHeight = 0;
while (end < itemsLength && visibleHeight < panelHeight) {
visibleHeight += this.getItemHeight(items[end]);
end++;
}
end = Math.min(itemsLength, end + 1);
const bufferedStart = Math.max(0, start - buffer);
const bufferedEnd = Math.min(itemsLength, end + buffer);
return {
topPadding: this.getItemOffset(items, bufferedStart),
scrollHeight,
start: bufferedStart,
end: bufferedEnd
};
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgDropdownPanelService,
deps: [],
target: i0.ɵɵFactoryTarget.Injectable
});
}
static {
this.ɵprov = i0.ɵɵngDeclareInjectable({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgDropdownPanelService
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgDropdownPanelService,
decorators: [{ type: Injectable }]
});
function isDefined(value) {
return value !== void 0 && value !== null;
}
function isObject(value) {
return typeof value === "object" && isDefined(value);
}
function isPromise(value) {
return value instanceof Promise;
}
function isFunction(value) {
return value instanceof Function;
}
const SCROLL_SCHEDULER = typeof requestAnimationFrame !== "undefined" ? animationFrameScheduler : asapScheduler;
var NgDropdownPanelComponent = class NgDropdownPanelComponent {
constructor() {
this.items = input([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
this.showAddTag = input(false, {
...ngDevMode ? { debugName: "showAddTag" } : /* istanbul ignore next */ {},
transform: booleanAttribute
});
this.markedItem = input(void 0, ...ngDevMode ? [{ debugName: "markedItem" }] : /* istanbul ignore next */ []);
this.position = input("auto", ...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
this.bufferAmount = input(void 0, ...ngDevMode ? [{ debugName: "bufferAmount" }] : /* istanbul ignore next */ []);
this.virtualScroll = input(false, {
...ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {},
transform: booleanAttribute
});
this.headerTemplate = input(void 0, ...ngDevMode ? [{ debugName: "headerTemplate" }] : /* istanbul ignore next */ []);
this.footerTemplate = input(void 0, ...ngDevMode ? [{ debugName: "footerTemplate" }] : /* istanbul ignore next */ []);
this.filterValue = input(null, ...ngDevMode ? [{ debugName: "filterValue" }] : /* istanbul ignore next */ []);
this.ariaLabelDropdown = input(null, ...ngDevMode ? [{ debugName: "ariaLabelDropdown" }] : /* istanbul ignore next */ []);
this.listboxId = input(null, ...ngDevMode ? [{ debugName: "listboxId" }] : /* istanbul ignore next */ []);
this.outsideClickEvent = input("click", ...ngDevMode ? [{ debugName: "outsideClickEvent" }] : /* istanbul ignore next */ []);
this.closeOnScroll = input(false, {
...ngDevMode ? { debugName: "closeOnScroll" } : /* istanbul ignore next */ {},
transform: booleanAttribute
});
this.popover = input(false, {
...ngDevMode ? { debugName: "popover" } : /* istanbul ignore next */ {},
transform: booleanAttribute
});
this.overlayRef = input(null, ...ngDevMode ? [{ debugName: "overlayRef" }] : /* istanbul ignore next */ []);
this.selectElement = input(void 0, ...ngDevMode ? [{ debugName: "selectElement" }] : /* istanbul ignore next */ []);
this.update = output();
this.scroll = output();
this.scrollToEnd = output();
this.outsideClick = output();
this.outsideScroll = output();
this._renderer = inject(Renderer2);
this._zone = inject(NgZone);
this._panelService = inject(NgDropdownPanelService);
this._document = inject(DOCUMENT, { optional: true });
this._destroyRef = inject(DestroyRef);
this._dropdown = inject(ElementRef).nativeElement;
this.contentElementRef = viewChild("content", {
...ngDevMode ? { debugName: "contentElementRef" } : /* istanbul ignore next */ {},
read: ElementRef
});
this.scrollElementRef = viewChild("scroll", {
...ngDevMode ? { debugName: "scrollElementRef" } : /* istanbul ignore next */ {},
read: ElementRef
});
this.paddingElementRef = viewChild("padding", {
...ngDevMode ? { debugName: "paddingElementRef" } : /* istanbul ignore next */ {},
read: ElementRef
});
this._virtualPadding = computed(() => this.paddingElementRef()?.nativeElement, ...ngDevMode ? [{ debugName: "_virtualPadding" }] : /* istanbul ignore next */ []);
this._scrollablePanel = computed(() => this.scrollElementRef()?.nativeElement, ...ngDevMode ? [{ debugName: "_scrollablePanel" }] : /* istanbul ignore next */ []);
this._contentPanel = computed(() => this.contentElementRef()?.nativeElement, ...ngDevMode ? [{ debugName: "_contentPanel" }] : /* istanbul ignore next */ []);
this.contentTransform = signal(null, ...ngDevMode ? [{ debugName: "contentTransform" }] : /* istanbul ignore next */ []);
this._scrollToEndFired = false;
this._updateScrollHeight = false;
this._lastScrollPosition = 0;
}
get currentPosition() {
return this._currentPosition;
}
get itemsLength() {
return this._itemsLength;
}
set itemsLength(value) {
if (value !== this._itemsLength) {
this._itemsLength = value;
this._onItemsLengthChanged();
}
}
get _startOffset() {
if (this.markedItem()) {
const { panelHeight } = this._panelService.dimensions;
const offset = this._panelService.getItemOffset(this.items(), this.markedItem().index);
return panelHeight > offset ? 0 : offset;
}
return 0;
}
ngOnInit() {
this._select = this.selectElement() ?? this._dropdown.parentElement;
this._handleScroll();
new DropdownPanelDomEvents({
closeOnScroll: this.closeOnScroll(),
destroyRef: this._destroyRef,
document: this._document,
dropdown: this._dropdown,
onOutsideClick: () => this.outsideClick.emit(),
onOutsideScroll: () => this.outsideScroll.emit(),
outsideClickEvent: this.outsideClickEvent() ?? "click",
overlayRef: this.overlayRef(),
select: this._select,
zone: this._zone
}).start();
this._subscribeOverlayPosition();
}
ngOnChanges(changes) {
if (changes.items) {
const change = changes.items;
this._onItemsOrShowAddTagChange(change.currentValue, this.showAddTag(), change.firstChange);
}
if (changes.showAddTag) {
const change = changes.showAddTag;
this._onItemsOrShowAddTagChange(this.items(), change.currentValue, change.firstChange);
}
}
scrollTo(option, startFromOption = false) {
if (!option || this._destroyRef.destroyed) return;
const index = this.items().indexOf(option);
if (index < 0 || index >= this.itemsLength) return;
let scrollTo;
if (this.virtualScroll()) {
const items = this.items();
const itemHeight = this._panelService.getItemHeight(option);
const itemTop = this._panelService.getItemOffset(items, index);
scrollTo = this._panelService.getScrollTo(itemTop, itemHeight, this._lastScrollPosition);
} else {
const item = this._dropdown.querySelector(`#${option.htmlId}`);
if (!item) return;
const lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
scrollTo = this._panelService.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
}
if (isDefined(scrollTo)) {
this._scrollablePanel().scrollTop = scrollTo;
if (this.virtualScroll()) this._onContentScrolled(scrollTo);
else this._lastScrollPosition = scrollTo;
}
}
scrollToTag() {
const panel = this._scrollablePanel();
if (!panel) return;
panel.scrollTop = panel.scrollHeight - panel.clientHeight;
}
adjustPosition() {
this.overlayRef()?.updatePosition();
}
_setCurrentPosition(position) {
this._currentPosition = position;
if (DROPDOWN_CSS_POSITIONS.includes(position)) this._updateDropdownClass(position);
else this._updateDropdownClass("bottom");
}
_positionDropdown() {
const overlayRef = this.overlayRef();
if (overlayRef) overlayRef.updatePosition();
else if (!isDefined(this._currentPosition)) this._setCurrentPosition(this.position() === "auto" ? "bottom" : this.position());
this._dropdown.style.opacity = "1";
}
_subscribeOverlayPosition() {
const strategy = this.overlayRef()?.getConfig().positionStrategy;
if (!(strategy instanceof FlexibleConnectedPositionStrategy)) return;
strategy.positionChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((change) => {
this._setCurrentPosition(connectionPairToDropdownPosition(change.connectionPair));
});
}
_updateDropdownClass(currentPosition) {
DROPDOWN_CSS_POSITIONS.forEach((position) => {
const REMOVE_CSS_CLASS = `ng-select-${position}`;
this._renderer.removeClass(this._dropdown, REMOVE_CSS_CLASS);
this._renderer.removeClass(this._select, REMOVE_CSS_CLASS);
});
const ADD_CSS_CLASS = `ng-select-${currentPosition}`;
this._renderer.addClass(this._dropdown, ADD_CSS_CLASS);
this._renderer.addClass(this._select, ADD_CSS_CLASS);
}
_handleScroll() {
this._zone.runOutsideAngular(() => {
const scrollablePanel = this._scrollablePanel();
if (!scrollablePanel) return;
fromEvent(scrollablePanel, "scroll").pipe(auditTime(0, SCROLL_SCHEDULER), takeUntilDestroyed(this._destroyRef)).subscribe(() => {
this._onContentScrolled(scrollablePanel.scrollTop);
});
});
}
_onItemsOrShowAddTagChange(items = [], showAddTag, firstChange) {
this._scrollToEndFired = false;
this.itemsLength = items.length;
if (showAddTag && items.length) this.itemsLength++;
if (this.virtualScroll()) this._updateItemsRange(firstChange);
else {
this._setVirtualHeight();
this._updateItems(firstChange);
}
}
_updateItems(firstChange) {
this.update.emit(this.items());
this._zone.runOutsideAngular(() => {
Promise.resolve().then(() => {
if (this._destroyRef.destroyed) return;
this._syncPanelHeightFromDom();
if (!firstChange) {
this.overlayRef()?.updatePosition();
return;
}
this._positionDropdown();
this.scrollTo(this.markedItem(), firstChange);
});
});
}
_updateItemsRange(firstChange) {
this._zone.runOutsideAngular(() => {
this._measureDimensions().then(() => {
if (this._destroyRef.destroyed) return;
const scrollTop = firstChange ? this._startOffset : this._scrollablePanel()?.scrollTop ?? 0;
if (!firstChange) this._lastScrollPosition = -1;
this._renderItemsRange(scrollTop);
if (!firstChange) this._lastScrollPosition = scrollTop;
const itemsPerViewportBefore = this._panelService.dimensions.itemsPerViewport;
this._syncPanelHeightFromDom();
if (this._panelService.dimensions.itemsPerViewport !== itemsPerViewportBefore) {
const currentScrollTop = this._scrollablePanel()?.scrollTop ?? scrollTop;
this._lastScrollPosition = -1;
this._renderItemsRange(currentScrollTop);
this._lastScrollPosition = currentScrollTop;
}
if (firstChange) this._positionDropdown();
else this.overlayRef()?.updatePosition();
});
});
}
_syncPanelHeightFromDom() {
const panel = this._scrollablePanel();
if (!panel) return;
const panelHeight = panel.clientHeight;
if (panelHeight <= 0) return;
const { itemHeight, groupHeight } = this._panelService.dimensions;
this._panelService.setDimensions(itemHeight, panelHeight, groupHeight);
}
_onContentScrolled(scrollTop) {
if (this.virtualScroll()) this._renderItemsRange(scrollTop);
this._lastScrollPosition = scrollTop;
this._fireScrollToEnd(scrollTop);
}
_updateVirtualHeight(height) {
if (this._updateScrollHeight) {
this._virtualPadding().style.height = `${height}px`;
this._updateScrollHeight = false;
}
}
_setVirtualHeight() {
if (!this._virtualPadding()) return;
this._virtualPadding().style.height = `0px`;
}
_onItemsLengthChanged() {
this._updateScrollHeight = true;
}
_renderItemsRange(scrollTop = null) {
if (scrollTop && this._lastScrollPosition === scrollTop) return;
const scrollablePanel = this._scrollablePanel();
const contentPanel = this._contentPanel();
if (!scrollablePanel || !contentPanel) return;
scrollTop = scrollTop || scrollablePanel.scrollTop;
const range = this._panelService.calculateItems(scrollTop, this.itemsLength, this.bufferAmount(), this.items());
this._updateVirtualHeight(range.scrollHeight);
this.contentTransform.set(`translateY(${range.topPadding}px)`);
this._zone.run(() => {
this.update.emit(this.items().slice(range.start, range.end));
this.scroll.emit({
start: range.start,
end: range.end
});
});
if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
scrollablePanel.scrollTop = scrollTop;
this._lastScrollPosition = scrollTop;
}
}
_measureDimensions() {
if (this._panelService.dimensions.itemHeight > 0 || this.itemsLength === 0) return Promise.resolve(this._panelService.dimensions);
const items = this.items();
const firstGroup = items.find((item) => !!item.children);
const firstOption = items.find((item) => !item.children);
const toMeasure = [firstGroup, firstOption].filter((item) => !!item);
if (toMeasure.length === 0) return Promise.resolve(this._panelService.dimensions);
this._zone.run(() => this.update.emit(toMeasure));
return Promise.resolve().then(() => this._readMeasuredDimensions(items, firstOption, firstGroup)).then((dims) => {
if (dims.itemHeight > 0) return dims;
return new Promise((resolve) => {
requestAnimationFrame(() => {
if (this._destroyRef.destroyed) {
resolve(this._panelService.dimensions);
return;
}
this._zone.run(() => this.update.emit(toMeasure));
Promise.resolve().then(() => resolve(this._readMeasuredDimensions(items, firstOption, firstGroup)));
});
});
});
}
_readMeasuredDimensions(items, firstOption, firstGroup) {
const optionEl = firstOption ? this._dropdown.querySelector(`#${firstOption.htmlId}`) : null;
const groupEl = firstGroup ? this._dropdown.querySelector(`#${firstGroup.htmlId}`) : null;
if (!optionEl && !groupEl) return this._panelService.dimensions;
const measuredOptionHeight = optionEl?.offsetHeight ?? 0;
const measuredGroupHeight = groupEl?.offsetHeight ?? 0;
const optionHeight = measuredOptionHeight || measuredGroupHeight;
const groupHeight = measuredGroupHeight || measuredOptionHeight;
const panelHeight = this._scrollablePanel().clientHeight;
this._panelService.setDimensions(optionHeight, panelHeight, groupHeight);
this._virtualPadding().style.height = `${this._panelService.getScrollHeight(items)}px`;
return this._panelService.dimensions;
}
_fireScrollToEnd(scrollTop) {
if (this._scrollToEndFired || scrollTop === 0) return;
const padding = this.virtualScroll() ? this._virtualPadding() : this._contentPanel();
if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight - 1) {
this._zone.run(() => this.scrollToEnd.emit());
this._scrollToEndFired = true;
}
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgDropdownPanelComponent,
deps: [],
target: i0.ɵɵFactoryTarget.Component
});
}
static {
this.ɵcmp = i0.ɵɵngDeclareComponent({
minVersion: "17.0.0",
version: "22.2.0",
type: NgDropdownPanelComponent,
isStandalone: true,
selector: "ng-dropdown-panel",
inputs: {
items: {
classPropertyName: "items",
publicName: "items",
isSignal: true,
isRequired: false,
transformFunction: null
},
showAddTag: {
classPropertyName: "showAddTag",
publicName: "showAddTag",
isSignal: true,
isRequired: false,
transformFunction: null
},
markedItem: {
classPropertyName: "markedItem",
publicName: "markedItem",
isSignal: true,
isRequired: false,
transformFunction: null
},
position: {
classPropertyName: "position",
publicName: "position",
isSignal: true,
isRequired: false,
transformFunction: null
},
bufferAmount: {
classPropertyName: "bufferAmount",
publicName: "bufferAmount",
isSignal: true,
isRequired: false,
transformFunction: null
},
virtualScroll: {
classPropertyName: "virtualScroll",
publicName: "virtualScroll",
isSignal: true,
isRequired: false,
transformFunction: null
},
headerTemplate: {
classPropertyName: "headerTemplate",
publicName: "headerTemplate",
isSignal: true,
isRequired: false,
transformFunction: null
},
footerTemplate: {
classPropertyName: "footerTemplate",
publicName: "footerTemplate",
isSignal: true,
isRequired: false,
transformFunction: null
},
filterValue: {
classPropertyName: "filterValue",
publicName: "filterValue",
isSignal: true,
isRequired: false,
transformFunction: null
},
ariaLabelDropdown: {
classPropertyName: "ariaLabelDropdown",
publicName: "ariaLabelDropdown",
isSignal: true,
isRequired: false,
transformFunction: null
},
listboxId: {
classPropertyName: "listboxId",
publicName: "listboxId",
isSignal: true,
isRequired: false,
transformFunction: null
},
outsideClickEvent: {
classPropertyName: "outsideClickEvent",
publicName: "outsideClickEvent",
isSignal: true,
isRequired: false,
transformFunction: null
},
closeOnScroll: {
classPropertyName: "closeOnScroll",
publicName: "closeOnScroll",
isSignal: true,
isRequired: false,
transformFunction: null
},
popover: {
classPropertyName: "popover",
publicName: "popover",
isSignal: true,
isRequired: false,
transformFunction: null
},
overlayRef: {
classPropertyName: "overlayRef",
publicName: "overlayRef",
isSignal: true,
isRequired: false,
transformFunction: null
},
selectElement: {
classPropertyName: "selectElement",
publicName: "selectElement",
isSignal: true,
isRequired: false,
transformFunction: null
}
},
outputs: {
update: "update",
scroll: "scroll",
scrollToEnd: "scrollToEnd",
outsideClick: "outsideClick",
outsideScroll: "outsideScroll"
},
viewQueries: [
{
propertyName: "contentElementRef",
first: true,
predicate: ["content"],
descendants: true,
read: ElementRef,
isSignal: true
},
{
propertyName: "scrollElementRef",
first: true,
predicate: ["scroll"],
descendants: true,
read: ElementRef,
isSignal: true
},
{
propertyName: "paddingElementRef",
first: true,
predicate: ["padding"],
descendants: true,
read: ElementRef,
isSignal: true
}
],
usesOnChanges: true,
ngImport: i0,
template: `
@if (headerTemplate()) {
<div class="ng-dropdown-header">
<ng-container [ngTemplateOutlet]="headerTemplate()" [ngTemplateOutletContext]="{ searchTerm: filterValue() }" />
</div>
}
<div #scroll role="listbox" class="ng-dropdown-panel-items scroll-host" [attr.id]="listboxId()" [attr.aria-label]="ariaLabelDropdown()">
<div #padding [class.total-padding]="virtualScroll()"></div>
<div #content [class.scrollable-content]="virtualScroll() && items().length" [style.transform]="contentTransform()">
<ng-content />
</div>
</div>
@if (footerTemplate()) {
<div class="ng-dropdown-footer">
<ng-container [ngTemplateOutlet]="footerTemplate()" [ngTemplateOutletContext]="{ searchTerm: filterValue() }" />
</div>
}
`,
isInline: true,
dependencies: [{
kind: "directive",
type: NgTemplateOutlet,
selector: "[ngTemplateOutlet]",
inputs: [
"ngTemplateOutletContext",
"ngTemplateOutlet",
"ngTemplateOutletInjector"
]
}],
changeDetection: i0.ChangeDetectionStrategy.OnPush,
encapsulation: i0.ViewEncapsulation.None
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgDropdownPanelComponent,
decorators: [{
type: Component,
args: [{
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
selector: "ng-dropdown-panel",
template: `
@if (headerTemplate()) {
<div class="ng-dropdown-header">
<ng-container [ngTemplateOutlet]="headerTemplate()" [ngTemplateOutletContext]="{ searchTerm: filterValue() }" />
</div>
}
<div #scroll role="listbox" class="ng-dropdown-panel-items scroll-host" [attr.id]="listboxId()" [attr.aria-label]="ariaLabelDropdown()">
<div #padding [class.total-padding]="virtualScroll()"></div>
<div #content [class.scrollable-content]="virtualScroll() && items().length" [style.transform]="contentTransform()">
<ng-content />
</div>
</div>
@if (footerTemplate()) {
<div class="ng-dropdown-footer">
<ng-container [ngTemplateOutlet]="footerTemplate()" [ngTemplateOutletContext]="{ searchTerm: filterValue() }" />
</div>
}
`,
imports: [NgTemplateOutlet]
}]
}],
propDecorators: {
items: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "items",
required: false
}]
}],
showAddTag: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "showAddTag",
required: false
}]
}],
markedItem: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "markedItem",
required: false
}]
}],
position: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "position",
required: false
}]
}],
bufferAmount: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "bufferAmount",
required: false
}]
}],
virtualScroll: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "virtualScroll",
required: false
}]
}],
headerTemplate: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "headerTemplate",
required: false
}]
}],
footerTemplate: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "footerTemplate",
required: false
}]
}],
filterValue: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "filterValue",
required: false
}]
}],
ariaLabelDropdown: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "ariaLabelDropdown",
required: false
}]
}],
listboxId: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "listboxId",
required: false
}]
}],
outsideClickEvent: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "outsideClickEvent",
required: false
}]
}],
closeOnScroll: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "closeOnScroll",
required: false
}]
}],
popover: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "popover",
required: false
}]
}],
overlayRef: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "overlayRef",
required: false
}]
}],
selectElement: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "selectElement",
required: false
}]
}],
update: [{
type: i0.Output,
args: ["update"]
}],
scroll: [{
type: i0.Output,
args: ["scroll"]
}],
scrollToEnd: [{
type: i0.Output,
args: ["scrollToEnd"]
}],
outsideClick: [{
type: i0.Output,
args: ["outsideClick"]
}],
outsideScroll: [{
type: i0.Output,
args: ["outsideScroll"]
}],
contentElementRef: [{
type: i0.ViewChild,
args: ["content", {
read: ElementRef,
isSignal: true
}]
}],
scrollElementRef: [{
type: i0.ViewChild,
args: ["scroll", {
read: ElementRef,
isSignal: true
}]
}],
paddingElementRef: [{
type: i0.ViewChild,
args: ["padding", {
read: ElementRef,
isSignal: true
}]
}]
}
});
var NgOptionComponent = class NgOptionComponent {
constructor() {
this.value = input(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
this.disabled = input(false, {
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
transform: booleanAttribute
});
this.elementRef = inject(ElementRef);
this.label = signal("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
this.classes = signal("", ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
this.isInitialized = signal(false, ...ngDevMode ? [{ debugName: "isInitialized" }] : /* istanbul ignore next */ []);
afterEveryRender(() => {
const element = this.elementRef.nativeElement;
const currentLabel = (element.textContent || "").trim();
if (currentLabel !== this.label()) this.label.set(currentLabel);
const currentClasses = Array.from(element.classList).filter((className) => className !== "ng-star-inserted").join(" ");
if (currentClasses !== this.classes()) this.classes.set(currentClasses);
});
}
ngOnInit() {
this.isInitialized.set(true);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgOptionComponent,
deps: [],
target: i0.ɵɵFactoryTarget.Component
});
}
static {
this.ɵcmp = i0.ɵɵngDeclareComponent({
minVersion: "17.1.0",
version: "22.2.0",
type: NgOptionComponent,
isStandalone: true,
selector: "ng-option",
inputs: {
value: {
classPropertyName: "value",
publicName: "value",
isSignal: true,
isRequired: false,
transformFunction: null
},
disabled: {
classPropertyName: "disabled",
publicName: "disabled",
isSignal: true,
isRequired: false,
transformFunction: null
}
},
ngImport: i0,
template: `<ng-content />`,
isInline: true,
changeDetection: i0.ChangeDetectionStrategy.OnPush
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgOptionComponent,
decorators: [{
type: Component,
args: [{
selector: "ng-option",
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush,
template: `<ng-content />`
}]
}],
ctorParameters: () => [],
propDecorators: {
value: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "value",
required: false
}]
}],
disabled: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "disabled",
required: false
}]
}]
}
});
var NgSelectAppendToOverlayContainer = class extends OverlayContainer {
constructor(appendToHost) {
super();
this.appendToHost = appendToHost;
}
_createContainer() {
super._createContainer();
this.appendToHost.appendChild(this._containerElement);
}
};
var DropdownOverlayManager = class {
constructor(injector, document, selectElement) {
this.injector = injector;
this.document = document;
this.selectElement = selectElement;
this.overlayRef = null;
this.positionStrategy = null;
this.portal = null;
this.overlayAppendTo = null;
this.overlayAppendToHost = null;
this.appendToContainer = null;
}
open(request) {
const overlayRef = this.ensureOverlay(request.origin, request.appendTo);
this.positionStrategy.withPositions([...DROPDOWN_POSITIONS[request.position] ?? DROPDOWN_POSITIONS.auto]);
overlayRef.setDirection(this.document.documentElement?.dir === "rtl" ? "rtl" : "ltr");
overlayRef.updateSize({ width: request.origin.getBoundingClientRect().width });
request.beforeAttach?.(overlayRef);
if (overlayRef.hasAttached()) {
overlayRef.updatePosition();
return overlayRef;
}
this.portal ??= new TemplatePortal(request.template, request.viewContainer);
overlayRef.attach(this.portal);
return overlayRef;
}
close() {
this.overlayRef?.detach();
}
destroy() {
this.overlayRef?.dispose();
this.overlayRef = null;
this.positionStrategy = null;
this.overlayAppendToHost = null;
this.appendToContainer?.ngOnDestroy();
this.appendToContainer = null;
}
ensureOverlay(origin, appendTo) {
const appendToHost = appendTo ? this.resolveAppendToHost(appendTo) : null;
if (this.overlayRef && (appendTo !== this.overlayAppendTo || appendToHost !== this.overlayAppendToHost)) this.destroy();
if (!this.overlayRef) {
let injector = this.injector;
if (appendToHost) {
this.appendToContainer = runInInjectionContext(this.injector, () => new NgSelectAppendToOverlayContainer(appendToHost));
injector = Injector.create({
parent: this.injector,
providers: [{
provide: OverlayContainer,
useValue: this.appendToContainer
}]
});
}
this.positionStrategy = createFlexibleConnectedPositionStrategy(injector, origin).withFlexibleDimensions(false).withPush(false);
if (appendToHost) this.positionStrategy.withPopoverLocation({
type: "parent",
element: appendToHost
});
this.overlayAppendTo = appendTo;
this.overlayAppendToHost = appendToHost;
this.overlayRef = createOverlayRef(injector, {
positionStrategy: this.positionStrategy,
scrollStrategy: createNoopScrollStrategy(),
disableAnimations: true
});
}
return this.overlayRef;
}
resolveAppendToHost(selector) {
const root = this.selectElement.getRootNode();
const host = (typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot ? root : this.document).querySelector(selector);
if (!host) throw new Error(`appendTo selector ${selector} did not found any parent element`);
return host;
}
};
const INTERNAL_HOST_CLASSES = /* @__PURE__ */ new Set([
"ng-select",
"ng-select-single",
"ng-select-multiple",
"ng-select-typeahead",
"ng-select-taggable",
"ng-select-searchable",
"ng-select-clearable",
"ng-select-opened",
"ng-select-filtered",
"ng-select-disabled",
"ng-select-focused",
"ng-select-top",
"ng-select-bottom",
"ng-select-left",
"ng-select-right"
]);
const ANGULAR_MANAGED_HOST_CLASSES = /* @__PURE__ */ new Set([
"ng-star-inserted",
"ng-untouched",
"ng-touched",
"ng-pristine",
"ng-dirty",
"ng-valid",
"ng-invalid",
"ng-pending",
"ng-submitted"
]);
function readConsumerHostClasses(element) {
return Array.from(element.classList).filter((className) => !INTERNAL_HOST_CLASSES.has(className) && !ANGULAR_MANAGED_HOST_CLASSES.has(className)).join(" ");
}
function mergeClassValues(...values) {
const classes = /* @__PURE__ */ new Set();
for (const value of values) collectClasses(classes, value);
return Array.from(classes).join(" ");
}
function collectClasses(target, value) {
if (!value) return;
if (typeof value === "string") {
collectClassString(target, value);
return;
}
if (Array.isArray(value) || value instanceof Set) {
for (const className of value) collectClassString(target, className);
return;
}
for (const [classNames, enabled] of Object.entries(value)) if (enabled) collectClassString(target, classNames);
}
function collectClassString(target, value) {
for (const className of value.split(/\s+/)) if (className) target.add(className);
}
function newId() {
return "axxxxxxxxxxx".replace(/[x]/g, () => {
return (Math.random() * 16 | 0).toString(16);
});
}
const diacritics = {
"Ⓐ": "A",
"A": "A",
"À": "A",
"Á": "A",
"Â": "A",
"Ầ": "A",
"Ấ": "A",
"Ẫ": "A",
"Ẩ": "A",
"Ã": "A",
"Ā": "A",
"Ă": "A",
"Ằ": "A",
"Ắ": "A",
"Ẵ": "A",
"Ẳ": "A",
"Ȧ": "A",
"Ǡ": "A",
"Ä": "A",
"Ǟ": "A",
"Ả": "A",
"Å": "A",
"Ǻ": "A",
"Ǎ": "A",
"Ȁ": "A",
"Ȃ": "A",
"Ạ": "A",
"Ậ": "A",
"Ặ": "A",
"Ḁ": "A",
"Ą": "A",
"Ⱥ": "A",
"Ɐ": "A",
"Ꜳ": "AA",
"Æ": "AE",
"Ǽ": "AE",
"Ǣ": "AE",
"Ꜵ": "AO",
"Ꜷ": "AU",
"Ꜹ": "AV",
"Ꜻ": "AV",
"Ꜽ": "AY",
"Ⓑ": "B",
"B": "B",
"Ḃ": "B",
"Ḅ": "B",
"Ḇ": "B",
"Ƀ": "B",
"Ƃ": "B",
"Ɓ": "B",
"Ⓒ": "C",
"C": "C",
"Ć": "C",
"Ĉ": "C",
"Ċ": "C",
"Č": "C",
"Ç": "C",
"Ḉ": "C",
"Ƈ": "C",
"Ȼ": "C",
"Ꜿ": "C",
"Ⓓ": "D",
"D": "D",
"Ḋ": "D",
"Ď": "D",
"Ḍ": "D",
"Ḑ": "D",
"Ḓ": "D",
"Ḏ": "D",
"Đ": "D",
"Ƌ": "D",
"Ɗ": "D",
"Ɖ": "D",
"Ꝺ": "D",
"DZ": "DZ",
"DŽ": "DZ",
"Dz": "Dz",
"Dž": "Dz",
"Ⓔ": "E",
"E": "E",
"È": "E",
"É": "E",
"Ê": "E",
"Ề": "E",
"Ế": "E",
"Ễ": "E",
"Ể": "E",
"Ẽ": "E",
"Ē": "E",
"Ḕ": "E",
"Ḗ": "E",
"Ĕ": "E",
"Ė": "E",
"Ë": "E",
"Ẻ": "E",
"Ě": "E",
"Ȅ": "E",
"Ȇ": "E",
"Ẹ": "E",
"Ệ": "E",
"Ȩ": "E",
"Ḝ": "E",
"Ę": "E",
"Ḙ": "E",
"Ḛ": "E",
"Ɛ": "E",
"Ǝ": "E",
"Ⓕ": "F",
"F": "F",
"Ḟ": "F",
"Ƒ": "F",
"Ꝼ": "F",
"Ⓖ": "G",
"G": "G",
"Ǵ": "G",
"Ĝ": "G",
"Ḡ": "G",
"Ğ": "G",
"Ġ": "G",
"Ǧ": "G",
"Ģ": "G",
"Ǥ": "G",
"Ɠ": "G",
"Ꞡ": "G",
"Ᵹ": "G",
"Ꝿ": "G",
"Ⓗ": "H",
"H": "H",
"Ĥ": "H",
"Ḣ": "H",
"Ḧ": "H",
"Ȟ": "H",
"Ḥ": "H",
"Ḩ": "H",
"Ḫ": "H",
"Ħ": "H",
"Ⱨ": "H",
"Ⱶ": "H",
"Ɥ": "H",
"Ⓘ": "I",
"I": "I",
"Ì": "I",
"Í": "I",
"Î": "I",
"Ĩ": "I",
"Ī": "I",
"Ĭ": "I",
"İ": "I",
"Ï": "I",
"Ḯ": "I",
"Ỉ": "I",
"Ǐ": "I",
"Ȉ": "I",
"Ȋ": "I",
"Ị": "I",
"Į": "I",
"Ḭ": "I",
"Ɨ": "I",
"Ⓙ": "J",
"J": "J",
"Ĵ": "J",
"Ɉ": "J",
"Ⓚ": "K",
"K": "K",
"Ḱ": "K",
"Ǩ": "K",
"Ḳ": "K",
"Ķ": "K",
"Ḵ": "K",
"Ƙ": "K",
"Ⱪ": "K",
"Ꝁ": "K",
"Ꝃ": "K",
"Ꝅ": "K",
"Ꞣ": "K",
"Ⓛ": "L",
"L": "L",
"Ŀ": "L",
"Ĺ": "L",
"Ľ": "L",
"Ḷ": "L",
"Ḹ": "L",
"Ļ": "L",
"Ḽ": "L",
"Ḻ": "L",
"Ł": "L",
"Ƚ": "L",
"Ɫ": "L",
"Ⱡ": "L",
"Ꝉ": "L",
"Ꝇ": "L",
"Ꞁ": "L",
"LJ": "LJ",
"Lj": "Lj",
"Ⓜ": "M",
"M": "M",
"Ḿ": "M",
"Ṁ": "M",
"Ṃ": "M",
"Ɱ": "M",
"Ɯ": "M",
"Ⓝ": "N",
"N": "N",
"Ǹ": "N",
"Ń": "N",
"Ñ": "N",
"Ṅ": "N",
"Ň": "N",
"Ṇ": "N",
"Ņ": "N",
"Ṋ": "N",
"Ṉ": "N",
"Ƞ": "N",
"Ɲ": "N",
"Ꞑ": "N",
"Ꞥ": "N",
"NJ": "NJ",
"Nj": "Nj",
"Ⓞ": "O",
"O": "O",
"Ò": "O",
"Ó": "O",
"Ô": "O",
"Ồ": "O",
"Ố": "O",
"Ỗ": "O",
"Ổ": "O",
"Õ": "O",
"Ṍ": "O",
"Ȭ": "O",
"Ṏ": "O",
"Ō": "O",
"Ṑ": "O",
"Ṓ": "O",
"Ŏ": "O",
"Ȯ": "O",
"Ȱ": "O",
"Ö": "O",
"Ȫ": "O",
"Ỏ": "O",
"Ő": "O",
"Ǒ": "O",
"Ȍ": "O",
"Ȏ": "O",
"Ơ": "O",
"Ờ": "O",
"Ớ": "O",
"Ỡ": "O",
"Ở": "O",
"Ợ": "O",
"Ọ": "O",
"Ộ": "O",
"Ǫ": "O",
"Ǭ": "O",
"Ø": "O",
"Ǿ": "O",
"Ɔ": "O",
"Ɵ": "O",
"Ꝋ": "O",
"Ꝍ": "O",
"Ƣ": "OI",
"Ꝏ": "OO",
"Ȣ": "OU",
"Ⓟ": "P",
"P": "P",
"Ṕ": "P",
"Ṗ": "P",
"Ƥ": "P",
"Ᵽ": "P",
"Ꝑ": "P",
"Ꝓ": "P",
"Ꝕ": "P",
"Ⓠ": "Q",
"Q": "Q",
"Ꝗ": "Q",
"Ꝙ": "Q",
"Ɋ": "Q",
"Ⓡ": "R",
"R": "R",
"Ŕ": "R",
"Ṙ": "R",
"Ř": "R",
"Ȑ": "R",
"Ȓ": "R",
"Ṛ": "R",
"Ṝ": "R",
"Ŗ": "R",
"Ṟ": "R",
"Ɍ": "R",
"Ɽ": "R",
"Ꝛ": "R",
"Ꞧ": "R",
"Ꞃ": "R",
"Ⓢ": "S",
"S": "S",
"ẞ": "S",
"Ś": "S",
"Ṥ": "S",
"Ŝ": "S",
"Ṡ": "S",
"Š": "S",
"Ṧ": "S",
"Ṣ": "S",
"Ṩ": "S",
"Ș": "S",
"Ş": "S",
"Ȿ": "S",
"Ꞩ": "S",
"Ꞅ": "S",
"Ⓣ": "T",
"T": "T",
"Ṫ": "T",
"Ť": "T",
"Ṭ": "T",
"Ț": "T",
"Ţ": "T",
"Ṱ": "T",
"Ṯ": "T",
"Ŧ": "T",
"Ƭ": "T",
"Ʈ": "T",
"Ⱦ": "T",
"Ꞇ": "T",
"Ꜩ": "TZ",
"Ⓤ": "U",
"U": "U",
"Ù": "U",
"Ú": "U",
"Û": "U",
"Ũ": "U",
"Ṹ": "U",
"Ū": "U",
"Ṻ": "U",
"Ŭ": "U",
"Ü": "U",
"Ǜ": "U",
"Ǘ": "U",
"Ǖ": "U",
"Ǚ": "U",
"Ủ": "U",
"Ů": "U",
"Ű": "U",
"Ǔ": "U",
"Ȕ": "U",
"Ȗ": "U",
"Ư": "U",
"Ừ": "U",
"Ứ": "U",
"Ữ": "U",
"Ử": "U",
"Ự": "U",
"Ụ": "U",
"Ṳ": "U",
"Ų": "U",
"Ṷ": "U",
"Ṵ": "U",
"Ʉ": "U",
"Ⓥ": "V",
"V": "V",
"Ṽ": "V",
"Ṿ": "V",
"Ʋ": "V",
"Ꝟ": "V",
"Ʌ": "V",
"Ꝡ": "VY",
"Ⓦ": "W",
"W": "W",
"Ẁ": "W",
"Ẃ": "W",
"Ŵ": "W",
"Ẇ": "W",
"Ẅ": "W",
"Ẉ": "W",
"Ⱳ": "W",
"Ⓧ": "X",
"X": "X",
"Ẋ": "X",
"Ẍ": "X",
"Ⓨ": "Y",
"Y": "Y",
"Ỳ": "Y",
"Ý": "Y",
"Ŷ": "Y",
"Ỹ": "Y",
"Ȳ": "Y",
"Ẏ": "Y",
"Ÿ": "Y",
"Ỷ": "Y",
"Ỵ": "Y",
"Ƴ": "Y",
"Ɏ": "Y",
"Ỿ": "Y",
"Ⓩ": "Z",
"Z": "Z",
"Ź": "Z",
"Ẑ": "Z",
"Ż": "Z",
"Ž": "Z",
"Ẓ": "Z",
"Ẕ": "Z",
"Ƶ": "Z",
"Ȥ": "Z",
"Ɀ": "Z",
"Ⱬ": "Z",
"Ꝣ": "Z",
"ⓐ": "a",
"a": "a",
"ẚ": "a",
"à": "a",
"á": "a",
"â": "a",
"ầ": "a",
"ấ": "a",
"ẫ": "a",
"ẩ": "a",
"ã": "a",
"ā": "a",
"ă": "a",
"ằ": "a",
"ắ": "a",
"ẵ": "a",
"ẳ": "a",
"ȧ": "a",
"ǡ": "a",
"ä": "a",
"ǟ": "a",
"ả": "a",
"å": "a",
"ǻ": "a",
"ǎ": "a",
"ȁ": "a",
"ȃ": "a",
"ạ": "a",
"ậ": "a",
"ặ": "a",
"ḁ": "a",
"ą": "a",
"ⱥ": "a",
"ɐ": "a",
"ꜳ": "aa",
"æ": "ae",
"ǽ": "ae",
"ǣ": "ae",
"ꜵ": "ao",
"ꜷ": "au",
"ꜹ": "av",
"ꜻ": "av",
"ꜽ": "ay",
"ⓑ": "b",
"b": "b",
"ḃ": "b",
"ḅ": "b",
"ḇ": "b",
"ƀ": "b",
"ƃ": "b",
"ɓ": "b",
"ⓒ": "c",
"c": "c",
"ć": "c",
"ĉ": "c",
"ċ": "c",
"č": "c",
"ç": "c",
"ḉ": "c",
"ƈ": "c",
"ȼ": "c",
"ꜿ": "c",
"ↄ": "c",
"ⓓ": "d",
"d": "d",
"ḋ": "d",
"ď": "d",
"ḍ": "d",
"ḑ": "d",
"ḓ": "d",
"ḏ": "d",
"đ": "d",
"ƌ": "d",
"ɖ": "d",
"ɗ": "d",
"ꝺ": "d",
"dz": "dz",
"dž": "dz",
"ⓔ": "e",
"e": "e",
"è": "e",
"é": "e",
"ê": "e",
"ề": "e",
"ế": "e",
"ễ": "e",
"ể": "e",
"ẽ": "e",
"ē": "e",
"ḕ": "e",
"ḗ": "e",
"ĕ": "e",
"ė": "e",
"ë": "e",
"ẻ": "e",
"ě": "e",
"ȅ": "e",
"ȇ": "e",
"ẹ": "e",
"ệ": "e",
"ȩ": "e",
"ḝ": "e",
"ę": "e",
"ḙ": "e",
"ḛ": "e",
"ɇ": "e",
"ɛ": "e",
"ǝ": "e",
"ⓕ": "f",
"f": "f",
"ḟ": "f",
"ƒ": "f",
"ꝼ": "f",
"ⓖ": "g",
"g": "g",
"ǵ": "g",
"ĝ": "g",
"ḡ": "g",
"ğ": "g",
"ġ": "g",
"ǧ": "g",
"ģ": "g",
"ǥ": "g",
"ɠ": "g",
"ꞡ": "g",
"ᵹ": "g",
"ꝿ": "g",
"ⓗ": "h",
"h": "h",
"ĥ": "h",
"ḣ": "h",
"ḧ": "h",
"ȟ": "h",
"ḥ": "h",
"ḩ": "h",
"ḫ": "h",
"ẖ": "h",
"ħ": "h",
"ⱨ": "h",
"ⱶ": "h",
"ɥ": "h",
"ƕ": "hv",
"ⓘ": "i",
"i": "i",
"ì": "i",
"í": "i",
"î": "i",
"ĩ": "i",
"ī": "i",
"ĭ": "i",
"ï": "i",
"ḯ": "i",
"ỉ": "i",
"ǐ": "i",
"ȉ": "i",
"ȋ": "i",
"ị": "i",
"į": "i",
"ḭ": "i",
"ɨ": "i",
"ı": "i",
"ⓙ": "j",
"j": "j",
"ĵ": "j",
"ǰ": "j",
"ɉ": "j",
"ⓚ": "k",
"k": "k",
"ḱ": "k",
"ǩ": "k",
"ḳ": "k",
"ķ": "k",
"ḵ": "k",
"ƙ": "k",
"ⱪ": "k",
"ꝁ": "k",
"ꝃ": "k",
"ꝅ": "k",
"ꞣ": "k",
"ⓛ": "l",
"l": "l",
"ŀ": "l",
"ĺ": "l",
"ľ": "l",
"ḷ": "l",
"ḹ": "l",
"ļ": "l",
"ḽ": "l",
"ḻ": "l",
"ſ": "l",
"ł": "l",
"ƚ": "l",
"ɫ": "l",
"ⱡ": "l",
"ꝉ": "l",
"ꞁ": "l",
"ꝇ": "l",
"lj": "lj",
"ⓜ": "m",
"m": "m",
"ḿ": "m",
"ṁ": "m",
"ṃ": "m",
"ɱ": "m",
"ɯ": "m",
"ⓝ": "n",
"n": "n",
"ǹ": "n",
"ń": "n",
"ñ": "n",
"ṅ": "n",
"ň": "n",
"ṇ": "n",
"ņ": "n",
"ṋ": "n",
"ṉ": "n",
"ƞ": "n",
"ɲ": "n",
"ʼn": "n",
"ꞑ": "n",
"ꞥ": "n",
"nj": "nj",
"ⓞ": "o",
"o": "o",
"ò": "o",
"ó": "o",
"ô": "o",
"ồ": "o",
"ố": "o",
"ỗ": "o",
"ổ": "o",
"õ": "o",
"ṍ": "o",
"ȭ": "o",
"ṏ": "o",
"ō": "o",
"ṑ": "o",
"ṓ": "o",
"ŏ": "o",
"ȯ": "o",
"ȱ": "o",
"ö": "o",
"ȫ": "o",
"ỏ": "o",
"ő": "o",
"ǒ": "o",
"ȍ": "o",
"ȏ": "o",
"ơ": "o",
"ờ": "o",
"ớ": "o",
"ỡ": "o",
"ở": "o",
"ợ": "o",
"ọ": "o",
"ộ": "o",
"ǫ": "o",
"ǭ": "o",
"ø": "o",
"ǿ": "o",
"ɔ": "o",
"ꝋ": "o",
"ꝍ": "o",
"ɵ": "o",
"ƣ": "oi",
"ȣ": "ou",
"ꝏ": "oo",
"ⓟ": "p",
"p": "p",
"ṕ": "p",
"ṗ": "p",
"ƥ": "p",
"ᵽ": "p",
"ꝑ": "p",
"ꝓ": "p",
"ꝕ": "p",
"ⓠ": "q",
"q": "q",
"ɋ": "q",
"ꝗ": "q",
"ꝙ": "q",
"ⓡ": "r",
"r": "r",
"ŕ": "r",
"ṙ": "r",
"ř": "r",
"ȑ": "r",
"ȓ": "r",
"ṛ": "r",
"ṝ": "r",
"ŗ": "r",
"ṟ": "r",
"ɍ": "r",
"ɽ": "r",
"ꝛ": "r",
"ꞧ": "r",
"ꞃ": "r",
"ⓢ": "s",
"s": "s",
"ß": "s",
"ś": "s",
"ṥ": "s",
"ŝ": "s",
"ṡ": "s",
"š": "s",
"ṧ": "s",
"ṣ": "s",
"ṩ": "s",
"ș": "s",
"ş": "s",
"ȿ": "s",
"ꞩ": "s",
"ꞅ": "s",
"ẛ": "s",
"ⓣ": "t",
"t": "t",
"ṫ": "t",
"ẗ": "t",
"ť": "t",
"ṭ": "t",
"ț": "t",
"ţ": "t",
"ṱ": "t",
"ṯ": "t",
"ŧ": "t",
"ƭ": "t",
"ʈ": "t",
"ⱦ": "t",
"ꞇ": "t",
"ꜩ": "tz",
"ⓤ": "u",
"u": "u",
"ù": "u",
"ú": "u",
"û": "u",
"ũ": "u",
"ṹ": "u",
"ū": "u",
"ṻ": "u",
"ŭ": "u",
"ü": "u",
"ǜ": "u",
"ǘ": "u",
"ǖ": "u",
"ǚ": "u",
"ủ": "u",
"ů": "u",
"ű": "u",
"ǔ": "u",
"ȕ": "u",
"ȗ": "u",
"ư": "u",
"ừ": "u",
"ứ": "u",
"ữ": "u",
"ử": "u",
"ự": "u",
"ụ": "u",
"ṳ": "u",
"ų": "u",
"ṷ": "u",
"ṵ": "u",
"ʉ": "u",
"ⓥ": "v",
"v": "v",
"ṽ": "v",
"ṿ": "v",
"ʋ": "v",
"ꝟ": "v",
"ʌ": "v",
"ꝡ": "vy",
"ⓦ": "w",
"w": "w",
"ẁ": "w",
"ẃ": "w",
"ŵ": "w",
"ẇ": "w",
"ẅ": "w",
"ẘ": "w",
"ẉ": "w",
"ⱳ": "w",
"ⓧ": "x",
"x": "x",
"ẋ": "x",
"ẍ": "x",
"ⓨ": "y",
"y": "y",
"ỳ": "y",
"ý": "y",
"ŷ": "y",
"ỹ": "y",
"ȳ": "y",
"ẏ": "y",
"ÿ": "y",
"ỷ": "y",
"ẙ": "y",
"ỵ": "y",
"ƴ": "y",
"ɏ": "y",
"ỿ": "y",
"ⓩ": "z",
"z": "z",
"ź": "z",
"ẑ": "z",
"ż": "z",
"ž": "z",
"ẓ": "z",
"ẕ": "z",
"ƶ": "z",
"ȥ": "z",
"ɀ": "z",
"ⱬ": "z",
"ꝣ": "z",
"Ά": "Α",
"Έ": "Ε",
"Ή": "Η",
"Ί": "Ι",
"Ϊ": "Ι",
"Ό": "Ο",
"Ύ": "Υ",
"Ϋ": "Υ",
"Ώ": "Ω",
"ά": "α",
"έ": "ε",
"ή": "η",
"ί": "ι",
"ϊ": "ι",
"ΐ": "ι",
"ό": "ο",
"ύ": "υ",
"ϋ": "υ",
"ΰ": "υ",
"ω": "ω",
"ς": "σ"
};
function stripSpecialChars(text) {
const match = (a) => diacritics[a] || a;
return text.replace(/[^\u0000-\u007E]/g, match);
}
var ItemsList = class {
constructor(_ngSelect, _selectionModel) {
this._ngSelect = _ngSelect;
this._selectionModel = _selectionModel;
this._items = [];
this._filteredItems = [];
this._markedIndex = -1;
}
get items() {
return this._items;
}
get filteredItems() {
return this._filteredItems;
}
get markedIndex() {
return this._markedIndex;
}
get selectedItems() {
return this._selectionModel.value;
}
get markedItem() {
return this._filteredItems[this._markedIndex];
}
get noItemsToSelect() {
return this._ngSelect.hideSelected() && this._items.length === this.selectedItems.length;
}
get maxItemsSelected() {
return this._ngSelect.multiple() && this._ngSelect.maxSelectedItems() <= this.selectedItems.length;
}
get lastSelectedItem() {
let i = this.selectedItems.length - 1;
for (; i >= 0; i--) {
const item = this.selectedItems[i];
if (!item.disabled) return item;
}
return null;
}
setItems(items) {
this._items = items.map((item, index) => this.mapItem(item, index));
const groupBy = this._ngSelect.groupBy();
if (groupBy) {
this._groups = this._groupBy(this._items, groupBy);
this._items = this._flatten(this._groups);
} else {
this._groups = /* @__PURE__ */ new Map();
this._groups.set(void 0, this._items);
}
this._filteredItems = [...this._items];
}
select(item) {
if (item.selected || this.maxItemsSelected) return;
const multiple = this._ngSelect.multiple();
if (!multiple) this.clearSelected(false);
this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel());
if (this._ngSelect.hideSelected()) this._hideSelected(item);
}
unselect(item) {
if (!item.selected) return;
const multiple = this._ngSelect.multiple();
this._selectionModel.unselect(item, multiple);
if (this._ngSelect.hideSelected() && isDefined(item.index) && multiple) this._showSelected(item);
}
findItem(value) {
let findBy;
if (this._ngSelect.compareWith()) findBy = (item) => this._ngSelect.compareWith()(item.value, value);
else if (this._ngSelect.bindValue()) findBy = (item) => !item.children && this.resolveNested(item.value, this._ngSelect.bindValue()) === value;
else findBy = (item) => item.value === value || !item.children && item.label && item.label === this.resolveNested(value, this._ngSelect.bindLabel());
return this._items.find((item) => findBy(item));
}
addItem(item) {
const option = this.mapItem(item, this._items.length);
this._items.push(option);
this._filteredItems.push(option);
return option;
}
clearSelected(keepDisabled) {
this._selectionModel.clear(keepDisabled);
this._items.forEach((item) => {
item.selected = keepDisabled && item.selected && item.disabled;
item.marked = false;
});
if (this._ngSelect.hideSelected()) this.resetFilteredItems();
}
findByLabel(term) {
term = stripSpecialChars(term).toLocaleLowerCase();
return this.filteredItems.find((item) => {
return stripSpecialChars(item.label).toLocaleLowerCase().substr(0, term.length) === term;
});
}
filter(term) {
if (!term) {
this.resetFilteredItems();
return;
}
this._filteredItems = [];
term = this._ngSelect.searchFn() ? term : stripSpecialChars(term).toLocaleLowerCase();
const match = this._ngSelect.searchFn() || this._defaultSearchFn;
const hideSelected = this._ngSelect.hideSelected();
for (const key of Array.from(this._groups.keys())) {
const matchedItems = [];
for (const item of this._groups.get(key)) {
if (hideSelected && (item.parent && item.parent.selected || item.selected)) continue;
const searchItem = this._ngSelect.searchFn() ? item.value : item;
if (match(term, searchItem)) matchedItems.push(item);
}
if (matchedItems.length > 0) {
const [last] = matchedItems.slice(-1);
if (last.parent) {
const head = this._items.find((x) => x === last.parent);
this._filteredItems.push(head);
}
this._filteredItems.push(...matchedItems);
}
}
}
resetFilteredItems() {
if (this._filteredItems.length === this._items.length) return;
if (this._ngSelect.hideSelected() && this.selectedItems.length > 0) this._filteredItems = this._items.filter((x) => !x.selected);
else this._filteredItems = this._items;
}
unmarkItem() {
this._markedIndex = -1;
}
markNextItem() {
this._stepToItem(1);
}
markPreviousItem() {
this._stepToItem(-1);
}
markItem(item) {
this._markedIndex = this._filteredItems.indexOf(item);
}
markSelectedOrDefault(markDefault) {
if (this._filteredItems.length === 0) return;
const lastMarkedIndex = this._getLastMarkedIndex();
if (lastMarkedIndex > -1) this._markedIndex = lastMarkedIndex;
else this._markedIndex = markDefault ? this.filteredItems.findIndex((x) => !x.disabled) : -1;
}
resolveNested(option, key) {
if (!isObject(option)) return option;
if (!key) return;
if (key.indexOf(".") === -1) return option[key];
else {
const keys = key.split(".");
let value = option;
for (let i = 0, len = keys.length; i < len; ++i) {
if (value == null) return null;
value = value[keys[i]];
}
return value;
}
}
mapItem(item, index) {
const hasNgOptionLabel = isObject(item) && "$ngOptionLabel" in item;
const hasNgOptionValue = isObject(item) && "$ngOptionValue" in item;
const hasNgOptionClasses = isObject(item) && "$ngOptionClasses" in item;
const label = hasNgOptionLabel ? item.$ngOptionLabel : this.resolveNested(item, this._ngSelect.bindLabel());
const value = hasNgOptionValue ? item.$ngOptionValue : item;
return {
index,
label: isDefined(label) ? label.toString() : "",
value,
disabled: item && item.disabled ? item.disabled : false,
selected: false,
classes: hasNgOptionClasses ? item.$ngOptionClasses : "",
htmlId: `${this._ngSelect.dropdownId}-${index}`
};
}
mapSelectedItems() {
const multiple = this._ngSelect.multiple();
for (const selected of this.selectedItems) {
const bindValue = this._ngSelect.bindValue();
const value = bindValue ? this.resolveNested(selected.value, bindValue) : selected.value;
const valueFound = isDefined(value);
let item = valueFound ? this.findItem(value) : null;
if (!item && !valueFound && this._ngSelect.compareWith()) item = this._items.find((item) => this._ngSelect.compareWith()(item.value, selected.value));
this._selectionModel.unselect(selected, multiple);
if (item?.selected) continue;
this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel());
}
if (this._ngSelect.hideSelected()) this._filteredItems = this.filteredItems.filter((x) => this.selectedItems.indexOf(x) === -1);
}
_showSelected(item) {
this._filteredItems.push(item);
if (item.parent) {
const parent = item.parent;
if (!this._filteredItems.find((x) => x === parent)) this._filteredItems.push(parent);
} else if (item.children) for (const child of item.children) {
child.selected = false;
this._filteredItems.push(child);
}
this._filteredItems = [...this._filteredItems.sort((a, b) => a.index - b.index)];
}
_hideSelected(item) {
this._filteredItems = this._filteredItems.filter((x) => x !== item);
if (item.parent) {
if (item.parent.children.every((x) => x.selected)) this._filteredItems = this._filteredItems.filter((x) => x !== item.parent);
} else if (item.children) this._filteredItems = this.filteredItems.filter((x) => x.parent !== item);
}
_defaultSearchFn(search, opt) {
return stripSpecialChars(opt.label).toLocaleLowerCase().indexOf(search) > -1;
}
_getNextItemIndex(steps) {
if (steps > 0) return this._markedIndex >= this._filteredItems.length - 1 ? 0 : this._markedIndex + 1;
return this._markedIndex <= 0 ? this._filteredItems.length - 1 : this._markedIndex - 1;
}
_stepToItem(steps) {
if (this._filteredItems.length === 0 || this._filteredItems.every((x) => x.disabled)) return;
this._markedIndex = this._getNextItemIndex(steps);
if (this.markedItem.disabled) this._stepToItem(steps);
}
_getLastMarkedIndex() {
if (this._ngSelect.hideSelected()) return -1;
if (this._markedIndex > -1 && this.markedItem === void 0) return -1;
const selectedIndex = this._getFirstSelectedIndex();
if (this.lastSelectedItem && selectedIndex < 0) return -1;
return selectedIndex > -1 ? selectedIndex : this.markedIndex;
}
_getFirstSelectedIndex() {
let index = -1;
for (const selected of this.selectedItems) {
if (selected.disabled) continue;
const i = this._filteredItems.indexOf(selected);
if (i > -1 && (index === -1 || i < index)) index = i;
}
return index;
}
_groupBy(items, prop) {
const groups = /* @__PURE__ */ new Map();
if (items.length === 0) return groups;
const firstValue = items[0].value;
if (firstValue != null && Array.isArray(firstValue[prop])) {
for (const item of items) {
const children = (item.value?.[prop] || []).map((x, index) => this.mapItem(x, index));
groups.set(item, children);
}
return groups;
}
const isFnKey = isFunction(this._ngSelect.groupBy());
const keyFn = (item) => {
const key = isFnKey ? prop(item.value) : item.value?.[prop];
return isDefined(key) ? key : void 0;
};
for (const item of items) {
const key = keyFn(item);
const group = groups.get(key);
if (group) group.push(item);
else groups.set(key, [item]);
}
return groups;
}
_flatten(groups) {
const isGroupByFn = isFunction(this._ngSelect.groupBy());
const items = [];
for (const key of Array.from(groups.keys())) {
let i = items.length;
if (key === void 0) {
const withoutGroup = groups.get(void 0) || [];
items.push(...withoutGroup.map((x) => {
x.index = i++;
x.htmlId = `${this._ngSelect.dropdownId}-${x.index}`;
return x;
}));
continue;
}
const isObjectKey = isObject(key);
const parent = {
label: isObjectKey ? "" : String(key),
children: void 0,
parent: null,
index: i++,
disabled: !this._ngSelect.selectableGroup(),
htmlId: newId()
};
const groupKey = isGroupByFn ? this._ngSelect.bindLabel() : this._ngSelect.groupBy();
const groupValue = this._ngSelect.groupValue() || (() => {
if (isObjectKey) return key.value;
return { [groupKey]: key };
});
const children = groups.get(key).map((x) => {
x.parent = parent;
x.children = void 0;
x.index = i++;
x.htmlId = `${this._ngSelect.dropdownId}-${x.index}`;
return x;
});
parent.children = children;
parent.value = groupValue(key, children.map((x) => x.value));
items.push(parent);
items.push(...children);
}
return items;
}
};
function DefaultSelectionModelFactory() {
return new DefaultSelectionModel();
}
var DefaultSelectionModel = class {
constructor() {
this._selected = [];
}
get value() {
return this._selected;
}
select(item, multiple, groupAsModel) {
item.selected = true;
if (!item.children || !multiple && groupAsModel) this._selected.push(item);
if (multiple) {
if (item.parent) {
const childrenCount = item.parent.children.length;
const selectedCount = item.parent.children.filter((x) => x.selected).length;
item.parent.selected = childrenCount === selectedCount;
} else if (item.children) {
this._setChildrenSelectedState(item.children, true);
this._removeChildren(item);
if (groupAsModel && this._activeChildren(item)) this._selected = [...this._selected.filter((x) => x.parent !== item), item];
else this._selected = [...this._selected, ...item.children.filter((x) => !x.disabled)];
}
}
}
unselect(item, multiple) {
this._selected = this._selected.filter((x) => x !== item);
item.selected = false;
if (multiple) {
if (item.parent && item.parent.selected) {
const children = item.parent.children;
this._removeParent(item.parent);
this._removeChildren(item.parent);
this._selected.push(...children.filter((x) => x !== item && !x.disabled));
item.parent.selected = false;
} else if (item.children) {
this._setChildrenSelectedState(item.children, false);
this._removeChildren(item);
}
}
}
clear(keepDisabled) {
this._selected = keepDisabled ? this._selected.filter((x) => x.disabled) : [];
}
_setChildrenSelectedState(children, selected) {
for (const child of children) {
if (child.disabled) continue;
child.selected = selected;
}
}
_removeChildren(parent) {
this._selected = [...this._selected.filter((x) => x.parent !== parent), ...parent.children.filter((x) => x.parent === parent && x.disabled && x.selected)];
}
_removeParent(parent) {
this._selected = this._selected.filter((x) => x !== parent);
}
_activeChildren(item) {
return item.children.every((x) => !x.disabled || x.selected);
}
};
var NgSelectConfig = class NgSelectConfig {
constructor() {
this.fixedPlaceholder = true;
this.notFoundText = "No items found";
this.typeToSearchText = "Type to search";
this.addTagText = "Add item";
this.loadingText = "Loading...";
this.clearAllText = "Clear all";
this.removeText = "Remove";
this.ariaLabelDropdown = "Options List";
this.disableVirtualScroll = true;
this.openOnEnter = true;
this.appearance = "underline";
this.tabFocusOnClear = true;
this.outsideClickEvent = "click";
this.closeOnScroll = false;
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgSelectConfig,
deps: [],
target: i0.ɵɵFactoryTarget.Injectable
});
}
static {
this.ɵprov = i0.ɵɵngDeclareInjectable({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgSelectConfig,
providedIn: "root"
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgSelectConfig,
decorators: [{
type: Injectable,
args: [{ providedIn: "root" }]
}]
});
var ConsoleService = class ConsoleService {
warn(message) {
console.warn(message);
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: ConsoleService,
deps: [],
target: i0.ɵɵFactoryTarget.Injectable
});
}
static {
this.ɵprov = i0.ɵɵngDeclareInjectable({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: ConsoleService,
providedIn: "root"
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: ConsoleService,
decorators: [{
type: Injectable,
args: [{ providedIn: "root" }]
}]
});
var KeyCode;
(function(KeyCode) {
KeyCode["Tab"] = "Tab";
KeyCode["Enter"] = "Enter";
KeyCode["Esc"] = "Escape";
KeyCode["Space"] = " ";
KeyCode["ArrowUp"] = "ArrowUp";
KeyCode["ArrowDown"] = "ArrowDown";
KeyCode["Backspace"] = "Backspace";
})(KeyCode || (KeyCode = {}));
function validateWriteValue(value, options) {
if (!isDefined(value) || options.multiple && value === "" || Array.isArray(value) && value.length === 0) return { valid: false };
if (options.multiple && !Array.isArray(value)) return {
valid: false,
warning: "Multiple select form value should be an array."
};
const invalidBinding = (options.multiple ? value : [value]).find((item) => !isDefined(options.compareWith) && isObject(item) && options.bindValue);
if (invalidBinding) return {
valid: false,
warning: `Setting object(${JSON.stringify(invalidBinding)}) as your model with bindValue is not allowed unless [compareWith] is used.`
};
return { valid: true };
}
function createUnmatchedOptionValue(value, bindLabel, bindValue) {
if (isObject(value) || !bindValue) return value;
return {
[bindLabel]: null,
[bindValue]: value
};
}
function selectedItemsToModel(selectedItems, options, resolveNested) {
return selectedItems.map((item) => {
if (!options.bindValue) return item.value;
if (item.children) {
const groupKey = options.hasGroupValue ? options.bindValue : options.groupBy;
return item.value[groupKey || options.groupBy];
}
return resolveNested(item.value, options.bindValue);
});
}
const SELECTION_MODEL_FACTORY = new InjectionToken("ng-select-selection-model");
function optionalBooleanAttribute(value) {
return value == null ? void 0 : booleanAttribute(value);
}
var NgSelectComponent = class NgSelectComponent {
constructor() {
this.classes = inject(new HostAttributeToken("class"), { optional: true });
this.config = inject(NgSelectConfig);
this._disabled = signal(false, ...ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []);
this._ariaLabelDropdown = input(void 0, {
...ngDevMode ? { debugName: "_ariaLabelDropdown" } : /* istanbul ignore next */ {},
alias: "ariaLabelDropdown"
});
this.ariaLabelDropdown = linkedSignal(() => this._ariaLabelDropdown(), ...ngDevMode ? [{ debugName: "ariaLabelDropdown" }] : /* istanbul ignore next */ []);
this._ariaLabel = input(void 0, {
...ngDevMode ? { debugName: "_ariaLabel" } : /* istanbul ignore next */ {},
alias: "ariaLabel"
});
this.ariaLabel = linkedSignal(() => this._ariaLabel(), ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
this._markFirst = input(true, {
...ngDevMode ? { debugName: "_markFirst" } : /* istanbul ignore next */ {},
alias: "markFirst",
transform: booleanAttribute
});
this.markFirst = linkedSignal(() => this._markFirst(), ...ngDevMode ? [{ debugName: "markFirst" }] : /* istanbul ignore next */ []);
this._placeholder = input(this.config.placeholder, {
...ngDevMode ? { debugName: "_placeholder" } : /* istanbul ignore next */ {},
alias: "placeholder"
});
this.placeholder = linkedSignal(() => this._placeholder(), ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
this._fixedPlaceholder = input(this.config.fixedPlaceholder, {
...ngDevMode ? { debugName: "_fixedPlaceholder" } : /* istanbul ignore next */ {},
alias: "fixedPlaceholder"
});
this.fixedPlaceholder = linkedSignal(() => this._fixedPlaceholder(), ...ngDevMode ? [{ debugName: "fixedPlaceholder" }] : /* istanbul ignore next */ []);
this._notFoundText = input(void 0, {
...ngDevMode ? { debugName: "_notFoundText" } : /* istanbul ignore next */ {},
alias: "notFoundText"
});
this.notFoundText = linkedSignal(() => this._notFoundText(), ...ngDevMode ? [{ debugName: "notFoundText" }] : /* istanbul ignore next */ []);
this._typeToSearchText = input(void 0, {
...ngDevMode ? { debugName: "_typeToSearchText" } : /* istanbul ignore next */ {},
alias: "typeToSearchText"
});
this.typeToSearchText = linkedSignal(() => this._typeToSearchText(), ...ngDevMode ? [{ debugName: "typeToSearchText" }] : /* istanbul ignore next */ []);
this._preventToggleOnRightClick = input(false, {
...ngDevMode ? { debugName: "_preventToggleOnRightClick" } : /* istanbul ignore next */ {},
alias: "preventToggleOnRightClick"
});
this.preventToggleOnRightClick = linkedSignal(() => this._preventToggleOnRightClick(), ...ngDevMode ? [{ debugName: "preventToggleOnRightClick" }] : /* istanbul ignore next */ []);
this._addTagText = input(void 0, {
...ngDevMode ? { debugName: "_addTagText" } : /* istanbul ignore next */ {},
alias: "addTagText"
});
this.addTagText = linkedSignal(() => this._addTagText(), ...ngDevMode ? [{ debugName: "addTagText" }] : /* istanbul ignore next */ []);
this._loadingText = input(void 0, {
...ngDevMode ? { debugName: "_loadingText" } : /* istanbul ignore next */ {},
alias: "loadingText"
});
this.loadingText = linkedSignal(() => this._loadingText(), ...ngDevMode ? [{ debugName: "loadingText" }] : /* istanbul ignore next */ []);
this._clearAllText = input(void 0, {
...ngDevMode ? { debugName: "_clearAllText" } : /* istanbul ignore next */ {},
alias: "clearAllText"
});
this.clearAllText = linkedSignal(() => this._clearAllText(), ...ngDevMode ? [{ debugName: "clearAllText" }] : /* istanbul ignore next */ []);
this._removeText = input(void 0, {
...ngDevMode ? { debugName: "_removeText" } : /* istanbul ignore next */ {},
alias: "removeText"
});
this.removeText = linkedSignal(() => this._removeText(), ...ngDevMode ? [{ debugName: "removeText" }] : /* istanbul ignore next */ []);
this._dropdownPosition = input("auto", {
...ngDevMode ? { debugName: "_dropdownPosition" } : /* istanbul ignore next */ {},
alias: "dropdownPosition"
});
this.dropdownPosition = linkedSignal(() => this._dropdownPosition(), ...ngDevMode ? [{ debugName: "dropdownPosition" }] : /* istanbul ignore next */ []);
this._appendTo = input(void 0, {
...ngDevMode ? { debugName: "_appendTo" } : /* istanbul ignore next */ {},
alias: "appendTo"
});
this.appendTo = linkedSignal(() => this._appendTo(), ...ngDevMode ? [{ debugName: "appendTo" }] : /* istanbul ignore next */ []);
this._outsideClickEvent = input(this.config.outsideClickEvent ?? "click", {
...ngDevMode ? { debugName: "_outsideClickEvent" } : /* istanbul ignore next */ {},
alias: "outsideClickEvent"
});
this.outsideClickEvent = linkedSignal(() => this._outsideClickEvent(), ...ngDevMode ? [{ debugName: "outsideClickEvent" }] : /* istanbul ignore next */ []);
this._loading = input(false, {
...ngDevMode ? { debugName: "_loading" } : /* istanbul ignore next */ {},
alias: "loading",
transform: booleanAttribute
});
this.loading = linkedSignal(() => this._loading(), ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
this._closeOnSelect = input(true, {
...ngDevMode ? { debugName: "_closeOnSelect" } : /* istanbul ignore next */ {},
alias: "closeOnSelect",
transform: booleanAttribute
});
this.closeOnSelect = linkedSignal(() => this._closeOnSelect(), ...ngDevMode ? [{ debugName: "closeOnSelect" }] : /* istanbul ignore next */ []);
this._closeOnScroll = input(this.config.closeOnScroll ?? false, {
...ngDevMode ? { debugName: "_closeOnScroll" } : /* istanbul ignore next */ {},
alias: "closeOnScroll",
transform: booleanAttribute
});
this.closeOnScroll = linkedSignal(() => this._closeOnScroll(), ...ngDevMode ? [{ debugName: "closeOnScroll" }] : /* istanbul ignore next */ []);
this._hideSelected = input(false, {
...ngDevMode ? { debugName: "_hideSelected" } : /* istanbul ignore next */ {},
alias: "hideSelected",
transform: booleanAttribute
});
this.hideSelected = linkedSignal(() => this._hideSelected(), ...ngDevMode ? [{ debugName: "hideSelected" }] : /* istanbul ignore next */ []);
this._selectOnTab = input(false, {
...ngDevMode ? { debugName: "_selectOnTab" } : /* istanbul ignore next */ {},
alias: "selectOnTab",
transform: booleanAttribute
});
this.selectOnTab = linkedSignal(() => this._selectOnTab(), ...ngDevMode ? [{ debugName: "selectOnTab" }] : /* istanbul ignore next */ []);
this._openOnEnter = input(void 0, {
...ngDevMode ? { debugName: "_openOnEnter" } : /* istanbul ignore next */ {},
alias: "openOnEnter",
transform: booleanAttribute
});
this.openOnEnter = linkedSignal(() => this._openOnEnter(), ...ngDevMode ? [{ debugName: "openOnEnter" }] : /* istanbul ignore next */ []);
this._maxSelectedItems = input(void 0, {
...ngDevMode ? { debugName: "_maxSelectedItems" } : /* istanbul ignore next */ {},
alias: "maxSelectedItems",
transform: numberAttribute
});
this.maxSelectedItems = linkedSignal(() => this._maxSelectedItems(), ...ngDevMode ? [{ debugName: "maxSelectedItems" }] : /* istanbul ignore next */ []);
this._groupBy = input(void 0, {
...ngDevMode ? { debugName: "_groupBy" } : /* istanbul ignore next */ {},
alias: "groupBy"
});
this.groupBy = linkedSignal(() => this._groupBy(), ...ngDevMode ? [{ debugName: "groupBy" }] : /* istanbul ignore next */ []);
this._groupValue = input(void 0, {
...ngDevMode ? { debugName: "_groupValue" } : /* istanbul ignore next */ {},
alias: "groupValue"
});
this.groupValue = linkedSignal(() => this._groupValue(), ...ngDevMode ? [{ debugName: "groupValue" }] : /* istanbul ignore next */ []);
this._bufferAmount = input(4, {
...ngDevMode ? { debugName: "_bufferAmount" } : /* istanbul ignore next */ {},
alias: "bufferAmount",
transform: numberAttribute
});
this.bufferAmount = linkedSignal(() => this._bufferAmount(), ...ngDevMode ? [{ debugName: "bufferAmount" }] : /* istanbul ignore next */ []);
this._virtualScroll = input(void 0, {
...ngDevMode ? { debugName: "_virtualScroll" } : /* istanbul ignore next */ {},
alias: "virtualScroll",
transform: optionalBooleanAttribute
});
this.virtualScroll = linkedSignal(() => this._virtualScroll(), ...ngDevMode ? [{ debugName: "virtualScroll" }] : /* istanbul ignore next */ []);
this.dropdownVirtualScroll = computed(() => {
const value = this._virtualScroll();
return isDefined(value) ? value : this.isVirtualScrollDisabled(this.config);
}, ...ngDevMode ? [{ debugName: "dropdownVirtualScroll" }] : /* istanbul ignore next */ []);
this._selectableGroup = input(false, {
...ngDevMode ? { debugName: "_selectableGroup" } : /* istanbul ignore next */ {},
alias: "selectableGroup",
transform: booleanAttribute
});
this.selectableGroup = linkedSignal(() => this._selectableGroup(), ...ngDevMode ? [{ debugName: "selectableGroup" }] : /* istanbul ignore next */ []);
this._tabFocusOnClearButton = input(void 0, {
...ngDevMode ? { debugName: "_tabFocusOnClearButton" } : /* istanbul ignore next */ {},
alias: "tabFocusOnClearButton"
});
this.tabFocusOnClearButton = linkedSignal(() => this._tabFocusOnClearButton(), ...ngDevMode ? [{ debugName: "tabFocusOnClearButton" }] : /* istanbul ignore next */ []);
this._selectableGroupAsModel = input(true, {
...ngDevMode ? { debugName: "_selectableGroupAsModel" } : /* istanbul ignore next */ {},
alias: "selectableGroupAsModel",
transform: booleanAttribute
});
this.selectableGroupAsModel = linkedSignal(() => this._selectableGroupAsModel(), ...ngDevMode ? [{ debugName: "selectableGroupAsModel" }] : /* istanbul ignore next */ []);
this._searchFn = input(null, {
...ngDevMode ? { debugName: "_searchFn" } : /* istanbul ignore next */ {},
alias: "searchFn"
});
this.searchFn = linkedSignal(() => this._searchFn(), ...ngDevMode ? [{ debugName: "searchFn" }] : /* istanbul ignore next */ []);
this._trackByFn = input(null, {
...ngDevMode ? { debugName: "_trackByFn" } : /* istanbul ignore next */ {},
alias: "trackByFn"
});
this.trackByFn = linkedSignal(() => this._trackByFn(), ...ngDevMode ? [{ debugName: "trackByFn" }] : /* istanbul ignore next */ []);
this._clearOnBackspace = input(true, {
...ngDevMode ? { debugName: "_clearOnBackspace" } : /* istanbul ignore next */ {},
alias: "clearOnBackspace",
transform: booleanAttribute
});
this.clearOnBackspace = linkedSignal(() => this._clearOnBackspace(), ...ngDevMode ? [{ debugName: "clearOnBackspace" }] : /* istanbul ignore next */ []);
this._labelForId = input(null, {
...ngDevMode ? { debugName: "_labelForId" } : /* istanbul ignore next */ {},
alias: "labelForId"
});
this.labelForId = linkedSignal(() => this._labelForId(), ...ngDevMode ? [{ debugName: "labelForId" }] : /* istanbul ignore next */ []);
this._inputAttrs = input({}, {
...ngDevMode ? { debugName: "_inputAttrs" } : /* istanbul ignore next */ {},
alias: "inputAttrs"
});
this.inputAttrs = linkedSignal(() => this._inputAttrs(), ...ngDevMode ? [{ debugName: "inputAttrs" }] : /* istanbul ignore next */ []);
this._tabIndex = input(void 0, {
...ngDevMode ? { debugName: "_tabIndex" } : /* istanbul ignore next */ {},
alias: "tabIndex",
transform: numberAttribute
});
this.tabIndex = linkedSignal(() => this._tabIndex(), ...ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []);
this._readonly = input(false, {
...ngDevMode ? { debugName: "_readonly" } : /* istanbul ignore next */ {},
alias: "readonly",
transform: booleanAttribute
});
this.readonly = linkedSignal(() => this._readonly(), ...ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []);
this._searchWhileComposing = input(true, {
...ngDevMode ? { debugName: "_searchWhileComposing" } : /* istanbul ignore next */ {},
alias: "searchWhileComposing",
transform: booleanAttribute
});
this.searchWhileComposing = linkedSignal(() => this._searchWhileComposing(), ...ngDevMode ? [{ debugName: "searchWhileComposing" }] : /* istanbul ignore next */ []);
this._minTermLength = input(0, {
...ngDevMode ? { debugName: "_minTermLength" } : /* istanbul ignore next */ {},
alias: "minTermLength",
transform: numberAttribute
});
this.minTermLength = linkedSignal(() => this._minTermLength(), ...ngDevMode ? [{ debugName: "minTermLength" }] : /* istanbul ignore next */ []);
this._editableSearchTerm = input(false, {
...ngDevMode ? { debugName: "_editableSearchTerm" } : /* istanbul ignore next */ {},
alias: "editableSearchTerm",
transform: booleanAttribute
});
this.editableSearchTerm = linkedSignal(() => this._editableSearchTerm(), ...ngDevMode ? [{ debugName: "editableSearchTerm" }] : /* istanbul ignore next */ []);
this._ngClass = input(null, {
...ngDevMode ? { debugName: "_ngClass" } : /* istanbul ignore next */ {},
alias: "ngClass"
});
this.ngClass = linkedSignal(() => this._ngClass(), ...ngDevMode ? [{ debugName: "ngClass" }] : /* istanbul ignore next */ []);
this._panelClass = input(null, {
...ngDevMode ? { debugName: "_panelClass" } : /* istanbul ignore next */ {},
alias: "panelClass"
});
this.panelClass = linkedSignal(() => this._panelClass(), ...ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []);
this._typeahead = input(void 0, {
...ngDevMode ? { debugName: "_typeahead" } : /* istanbul ignore next */ {},
alias: "typeahead"
});
this.typeahead = linkedSignal(() => this._typeahead(), ...ngDevMode ? [{ debugName: "typeahead" }] : /* istanbul ignore next */ []);
this._multiple = input(false, {
...ngDevMode ? { debugName: "_multiple" } : /* istanbul ignore next */ {},
alias: "multiple",
transform: booleanAttribute
});
this.multiple = linkedSignal(() => this._multiple(), ...ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []);
this._addTag = input(false, {
...ngDevMode ? { debugName: "_addTag" } : /* istanbul ignore next */ {},
alias: "addTag"
});
this.addTag = linkedSignal(() => this._addTag(), ...ngDevMode ? [{ debugName: "addTag" }] : /* istanbul ignore next */ []);
this._searchable = input(true, {
...ngDevMode ? { debugName: "_searchable" } : /* istanbul ignore next */ {},
alias: "searchable",
transform: booleanAttribute
});
this.searchable = linkedSignal(() => this._searchable(), ...ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []);
this._clearable = input(true, {
...ngDevMode ? { debugName: "_clearable" } : /* istanbul ignore next */ {},
alias: "clearable",
transform: booleanAttribute
});
this.clearable = linkedSignal(() => this._clearable(), ...ngDevMode ? [{ debugName: "clearable" }] : /* istanbul ignore next */ []);
this._clearKeepsDisabledOptions = input(true, {
...ngDevMode ? { debugName: "_clearKeepsDisabledOptions" } : /* istanbul ignore next */ {},
alias: "clearKeepsDisabledOptions",
transform: booleanAttribute
});
this.clearKeepsDisabledOptions = linkedSignal(() => this._clearKeepsDisabledOptions(), ...ngDevMode ? [{ debugName: "clearKeepsDisabledOptions" }] : /* istanbul ignore next */ []);
this._deselectOnClick = input(void 0, {
...ngDevMode ? { debugName: "_deselectOnClick" } : /* istanbul ignore next */ {},
alias: "deselectOnClick"
});
this.deselectOnClick = linkedSignal(() => this._deselectOnClick(), ...ngDevMode ? [{ debugName: "deselectOnClick" }] : /* istanbul ignore next */ []);
this._clearSearchOnAdd = input(void 0, {
...ngDevMode ? { debugName: "_clearSearchOnAdd" } : /* istanbul ignore next */ {},
alias: "clearSearchOnAdd"
});
this.clearSearchOnAdd = linkedSignal(() => this._clearSearchOnAdd(), ...ngDevMode ? [{ debugName: "clearSearchOnAdd" }] : /* istanbul ignore next */ []);
this._compareWith = input(void 0, {
...ngDevMode ? { debugName: "_compareWith" } : /* istanbul ignore next */ {},
alias: "compareWith",
transform: (fn) => {
if (fn !== void 0 && fn !== null && !isFunction(fn)) throw Error("`compareWith` must be a function.");
return fn;
}
});
this.compareWith = linkedSignal(() => this._compareWith(), ...ngDevMode ? [{ debugName: "compareWith" }] : /* istanbul ignore next */ []);
this._keyDownFn = input((_) => true, {
...ngDevMode ? { debugName: "_keyDownFn" } : /* istanbul ignore next */ {},
alias: "keyDownFn"
});
this.keyDownFn = linkedSignal(() => this._keyDownFn(), ...ngDevMode ? [{ debugName: "keyDownFn" }] : /* istanbul ignore next */ []);
this._popover = input(false, {
...ngDevMode ? { debugName: "_popover" } : /* istanbul ignore next */ {},
alias: "popover",
transform: booleanAttribute
});
this.popover = linkedSignal(() => this._popover(), ...ngDevMode ? [{ debugName: "popover" }] : /* istanbul ignore next */ []);
this.bindLabel = model(void 0, ...ngDevMode ? [{ debugName: "bindLabel" }] : /* istanbul ignore next */ []);
this.bindValue = model(void 0, ...ngDevMode ? [{ debugName: "bindValue" }] : /* istanbul ignore next */ []);
this.appearance = model(void 0, ...ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []);
this.isOpen = model(false, ...ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []);
this.items = model([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
this.blurEvent = output({ alias: "blur" });
this.focusEvent = output({ alias: "focus" });
this.changeEvent = output({ alias: "change" });
this.openEvent = output({ alias: "open" });
this.closeEvent = output({ alias: "close" });
this.searchEvent = output({ alias: "search" });
this.clearEvent = output({ alias: "clear" });
this.addEvent = output({ alias: "add" });
this.removeEvent = output({ alias: "remove" });
this.scroll = output({ alias: "scroll" });
this.scrollToEnd = output({ alias: "scrollToEnd" });
this.disabled = computed(() => this.readonly() || this._disabled(), ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
this.clearSearchOnAddValue = computed(() => {
if (isDefined(this.clearSearchOnAdd())) return this.clearSearchOnAdd();
if (isDefined(this.config.clearSearchOnAdd)) return this.config.clearSearchOnAdd;
return this.closeOnSelect();
}, ...ngDevMode ? [{ debugName: "clearSearchOnAddValue" }] : /* istanbul ignore next */ []);
this.deselectOnClickValue = computed(() => {
if (isDefined(this.deselectOnClick())) return this.deselectOnClick();
if (isDefined(this.config.deselectOnClick)) return this.config.deselectOnClick;
return this.multiple();
}, ...ngDevMode ? [{ debugName: "deselectOnClickValue" }] : /* istanbul ignore next */ []);
this.optionTemplate = contentChild(NgOptionTemplateDirective, {
...ngDevMode ? { debugName: "optionTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.optgroupTemplate = contentChild(NgOptgroupTemplateDirective, {
...ngDevMode ? { debugName: "optgroupTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.labelTemplate = contentChild(NgLabelTemplateDirective, {
...ngDevMode ? { debugName: "labelTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.multiLabelTemplate = contentChild(NgMultiLabelTemplateDirective, {
...ngDevMode ? { debugName: "multiLabelTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.headerTemplate = contentChild(NgHeaderTemplateDirective, {
...ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.footerTemplate = contentChild(NgFooterTemplateDirective, {
...ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.notFoundTemplate = contentChild(NgNotFoundTemplateDirective, {
...ngDevMode ? { debugName: "notFoundTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.placeholderTemplate = contentChild(NgPlaceholderTemplateDirective, {
...ngDevMode ? { debugName: "placeholderTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.typeToSearchTemplate = contentChild(NgTypeToSearchTemplateDirective, {
...ngDevMode ? { debugName: "typeToSearchTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.loadingTextTemplate = contentChild(NgLoadingTextTemplateDirective, {
...ngDevMode ? { debugName: "loadingTextTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.tagTemplate = contentChild(NgTagTemplateDirective, {
...ngDevMode ? { debugName: "tagTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.loadingSpinnerTemplate = contentChild(NgLoadingSpinnerTemplateDirective, {
...ngDevMode ? { debugName: "loadingSpinnerTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.clearButtonTemplate = contentChild(NgClearButtonTemplateDirective, {
...ngDevMode ? { debugName: "clearButtonTemplate" } : /* istanbul ignore next */ {},
read: TemplateRef
});
this.ngOptions = contentChildren(NgOptionComponent, {
...ngDevMode ? { debugName: "ngOptions" } : /* istanbul ignore next */ {},
descendants: true
});
this.dropdownPanel = viewChild(forwardRef(() => NgDropdownPanelComponent), ...ngDevMode ? [{ debugName: "dropdownPanel" }] : /* istanbul ignore next */ []);
this.searchInput = viewChild("searchInput", ...ngDevMode ? [{ debugName: "searchInput" }] : /* istanbul ignore next */ []);
this.clearButton = viewChild("clearButton", ...ngDevMode ? [{ debugName: "clearButton" }] : /* istanbul ignore next */ []);
this._dropdownTemplate = viewChild("dropdownTemplate", ...ngDevMode ? [{ debugName: "_dropdownTemplate" }] : /* istanbul ignore next */ []);
this._dropdownOutlet = viewChild("dropdownTemplate", {
...ngDevMode ? { debugName: "_dropdownOutlet" } : /* istanbul ignore next */ {},
read: ViewContainerRef
});
this._selectContainer = viewChild("selectContainer", ...ngDevMode ? [{ debugName: "_selectContainer" }] : /* istanbul ignore next */ []);
this.dropdownId = newId();
this.outlineNotchWidth = signal(0, ...ngDevMode ? [{ debugName: "outlineNotchWidth" }] : /* istanbul ignore next */ []);
this.viewPortItems = [];
this.tabFocusOnClear = signal(true, ...ngDevMode ? [{ debugName: "tabFocusOnClear" }] : /* istanbul ignore next */ []);
this._cd = inject(ChangeDetectorRef);
this._console = inject(ConsoleService);
this._destroyRef = inject(DestroyRef);
this.autoFocus = inject(new HostAttributeToken("autofocus"), { optional: true });
this.dropdownOverlayRef = null;
this._defaultLabel = "label";
this._editableSearchTermActive = computed(() => this.editableSearchTerm() && !this.multiple(), ...ngDevMode ? [{ debugName: "_editableSearchTermActive" }] : /* istanbul ignore next */ []);
this._document = inject(DOCUMENT);
this._injector = inject(Injector);
this._isComposing = false;
this._keyPress$ = new Subject();
this._pressedKeys = [];
this._lastWrittenValue = null;
this._searchTerm = signal(null, ...ngDevMode ? [{ debugName: "_searchTerm" }] : /* istanbul ignore next */ []);
this._validTerm = computed(() => {
const term = this._searchTerm()?.trim();
return term && term.length >= this.minTermLength();
}, ...ngDevMode ? [{ debugName: "_validTerm" }] : /* istanbul ignore next */ []);
this._consumerHostClasses = signal(null, ...ngDevMode ? [{ debugName: "_consumerHostClasses" }] : /* istanbul ignore next */ []);
this.panelClasses = computed(() => {
return mergeClassValues(this.classes, this._consumerHostClasses(), this.ngClass(), this.panelClass());
}, ...ngDevMode ? [{ debugName: "panelClasses" }] : /* istanbul ignore next */ []);
this.clearItem = (item) => {
const option = this.selectedItems.find((x) => x.value === item);
this.unselect(option);
};
this.trackByOption = (index, item) => {
if (this.trackByFn()) return this.trackByFn()(item.value);
return index;
};
this._onChange = (_) => {};
this._onTouched = () => {};
const config = this.config;
const newSelectionModel = inject(SELECTION_MODEL_FACTORY, { optional: true });
const _elementRef = inject(ElementRef);
this._mergeGlobalConfig(config);
this.itemsList = new ItemsList(this, newSelectionModel ? newSelectionModel() : DefaultSelectionModelFactory());
this.element = _elementRef.nativeElement;
this._dropdownOverlay = new DropdownOverlayManager(this._injector, this._document, this.element);
this._handleSignalChanges();
afterEveryRender({ read: () => this._measureOutlineNotch() });
afterEveryRender({ read: () => {
const normalized = readConsumerHostClasses(this.element) || null;
if (normalized !== this._consumerHostClasses()) this._consumerHostClasses.set(normalized);
} });
this._destroyRef.onDestroy(() => {
this._dropdownOverlay.destroy();
this.dropdownOverlayRef = null;
});
}
_measureOutlineNotch() {
if (this.appearance() !== "outline") return;
const label = this.element.querySelector(".ng-select-container > .ng-value-container .ng-placeholder");
const width = label ? label.offsetWidth * .75 : 0;
if (width !== this.outlineNotchWidth()) this.outlineNotchWidth.set(width);
}
get focused() {
return this._focused;
}
get filtered() {
return !!this.searchTerm && this.searchable() || this._isComposing;
}
get searchTerm() {
return this._searchTerm();
}
get selectedItems() {
return this.itemsList.selectedItems;
}
get selectedValues() {
return this.selectedItems.map((x) => x.value);
}
get hasValue() {
return this.selectedItems.length > 0;
}
get currentPanelPosition() {
if (this.dropdownPanel()) return this.dropdownPanel().currentPosition;
}
get showAddTag() {
if (!this._validTerm()) return false;
const term = this.searchTerm.toLowerCase().trim();
return this.addTag() && !this.itemsList.filteredItems.some((x) => x.label.toLowerCase() === term) && (!this.hideSelected() && this.isOpen() || !this.selectedItems.some((x) => x.label.toLowerCase() === term)) && !this.loading();
}
ngOnInit() {
this._handleKeyPresses();
this._setInputAttributes();
this._warnDeprecatedInputs();
}
ngOnChanges(changes) {
const itemsChange = changes.items;
const isOpenChange = changes.isOpen;
const groupByChange = changes._groupBy ?? changes.groupBy;
if (itemsChange?.firstChange) {
this._itemsAreUsed = true;
this._setItems(itemsChange.currentValue || []);
}
if (isOpenChange) this._manualOpen = isDefined(isOpenChange.currentValue);
if (groupByChange?.firstChange && !itemsChange) this._setItems([...this.items()]);
this._setTabFocusOnClear();
}
ngAfterViewInit() {
if (!this._itemsAreUsed) this._setItemsFromNgOptions();
if (isDefined(this.autoFocus)) this.focus();
}
handleKeyDown($event) {
const keyName = $event.key;
if (Object.values(KeyCode).includes(keyName)) {
if (this.keyDownFn()($event) === false) return;
this.handleKeyCode($event);
} else if (keyName && keyName.length === 1) this._keyPress$.next(keyName.toLocaleLowerCase());
}
handleKeyCode($event) {
const target = $event.target;
if (this.clearButton() && this.clearButton().nativeElement === target) this.handleKeyCodeClear($event);
else this.handleKeyCodeInput($event);
}
handleKeyCodeInput($event) {
switch ($event.key) {
case KeyCode.ArrowDown:
this._handleArrowDown($event);
break;
case KeyCode.ArrowUp:
this._handleArrowUp($event);
break;
case KeyCode.Space:
this._handleSpace($event);
break;
case KeyCode.Enter:
this._handleEnter($event);
break;
case KeyCode.Tab:
this._handleTab($event);
break;
case KeyCode.Esc:
if (!this.isOpen() || this._manualOpen) return;
this.close();
$event.preventDefault();
break;
case KeyCode.Backspace: this._handleBackspace();
}
}
handleKeyCodeClear($event) {
switch ($event.key) {
case KeyCode.Enter:
case KeyCode.Space:
this.handleClearClick();
$event.preventDefault();
}
}
handleRemoveKeydown($event, item) {
if (item.disabled) return;
if ($event.key === KeyCode.Enter || $event.key === KeyCode.Space) {
$event.preventDefault();
$event.stopPropagation();
this.unselect(item);
}
}
handleMousedown($event) {
if (this.disabled()) return;
if (this.preventToggleOnRightClick() && $event.button === 2) return false;
const target = $event.target;
const onSelectedValue = !!target.closest?.(".ng-value");
const onValueIcon = target.classList.contains("ng-value-icon") || !!target.closest?.(".ng-value-icon");
if (!this.searchable() && onSelectedValue && !onValueIcon) {
if (!this._focused) this.focus();
return;
}
if (target.tagName !== "INPUT" && $event.eventPhase !== EventPhase.REPLAY) $event.preventDefault();
if (target.classList.contains("ng-clear-wrapper")) return;
if (target.classList.contains("ng-arrow-wrapper")) {
this.handleArrowClick();
return;
}
if (target.classList.contains("ng-value-icon")) return;
if (!this._focused) this.focus();
if (this.searchable()) this.open();
else this.toggle();
}
handleArrowClick() {
if (this.isOpen()) this.close();
else this.open();
}
handleClearClick(_event) {
if (this.hasValue) {
this.itemsList.clearSelected(this.clearKeepsDisabledOptions());
this._updateNgModel();
}
this._clearSearch();
this.focus();
this.clearEvent.emit();
this._onSelectionChanged();
}
clearModel() {
if (!this.clearable()) return;
this.itemsList.clearSelected(false);
this._updateNgModel();
}
writeValue(value) {
this._lastWrittenValue = value;
this.itemsList.clearSelected(false);
this._handleWriteValue(value);
if (this._editableSearchTermActive()) this._setSearchTermFromItems();
this._cd.markForCheck();
}
registerOnChange(fn) {
this._onChange = fn;
}
registerOnTouched(fn) {
this._onTouched = fn;
}
setDisabledState(state) {
this._disabled.set(state);
this._cd.markForCheck();
}
toggle() {
if (!this.isOpen()) this.open();
else this.close();
}
open() {
if (this.disabled() || this.isOpen() || this._manualOpen) return;
if (!this.typeahead()?.observed && !this.addTag() && this.itemsList.noItemsToSelect) return;
this.isOpen.set(true);
this.itemsList.markSelectedOrDefault(this.markFirst());
this.openEvent.emit();
if (!this.searchTerm) this.focus();
this._syncDropdownOverlay();
this.detectChanges();
}
close() {
if (!this.isOpen() || this._manualOpen) return;
this.isOpen.set(false);
this._isComposing = false;
if (!this._editableSearchTermActive()) this._clearSearch();
else this.itemsList.resetFilteredItems();
this.itemsList.unmarkItem();
this._onTouched();
this.closeEvent.emit();
this._syncDropdownOverlay();
this.detectChanges();
}
toggleItem(item) {
if (!item || item.disabled || this.disabled()) return;
if (this.deselectOnClickValue() && item.selected) this.unselect(item);
else this.select(item);
if (this._editableSearchTermActive()) this._setSearchTermFromItems();
}
select(item) {
if (!item.selected) {
this.itemsList.select(item);
if (this.clearSearchOnAddValue() && !this._editableSearchTermActive()) this._clearSearch();
this._updateNgModel();
if (this.multiple()) this.addEvent.emit(item.value);
}
if (this.closeOnSelect() || this.itemsList.noItemsToSelect) this.close();
this._onSelectionChanged();
}
focus() {
this.searchInput().nativeElement.focus();
}
blur() {
this.searchInput().nativeElement.blur();
}
unselect(item) {
if (!item || this.disabled() || item.disabled) return;
this.itemsList.unselect(item);
this.focus();
this._updateNgModel();
this.removeEvent.emit(item.value);
this._onSelectionChanged();
}
selectTag() {
let tag;
if (isFunction(this.addTag())) tag = this.addTag()(this.searchTerm);
else tag = this._primitive ? this.searchTerm : { [this.bindLabel()]: this.searchTerm };
const handleTag = (item) => this.typeahead()?.observed || !this.isOpen() ? this.itemsList.mapItem(item, null) : this.itemsList.addItem(item);
if (isPromise(tag)) tag.then((item) => this.select(handleTag(item))).catch(() => {});
else if (tag) this.select(handleTag(tag));
}
showClear() {
return this.clearable() && (this.hasValue || this.searchTerm) && !this.disabled();
}
focusOnClear() {
this.blur();
if (this.clearButton()) this.clearButton().nativeElement.focus();
}
showNoItemsFound() {
const empty = this.itemsList.filteredItems.length === 0;
return (empty && !this.typeahead()?.observed && !this.loading() || empty && this.typeahead()?.observed && this._validTerm() && !this.loading()) && !this.showAddTag;
}
showTypeToSearch() {
return this.itemsList.filteredItems.length === 0 && this.typeahead()?.observed && !this._validTerm() && !this.loading();
}
onCompositionStart() {
this._isComposing = true;
}
onCompositionEnd(term) {
this._isComposing = false;
if (this.searchWhileComposing()) return;
this.filter(term);
}
filter(term) {
if (this._isComposing && !this.searchWhileComposing()) return;
this._searchTerm.set(term);
if (this.typeahead()?.observed && (this._validTerm() || this.minTermLength() === 0)) this.typeahead().next(term);
if (!this.typeahead()?.observed) {
this.itemsList.filter(term);
if (this.isOpen()) this.itemsList.markSelectedOrDefault(this.markFirst());
}
this.searchEvent.emit({
term,
items: this.itemsList.filteredItems.map((x) => x.value)
});
this.open();
}
onInputFocus($event) {
if (this._focused) return;
if (this._editableSearchTermActive()) this._setSearchTermFromItems();
this.element.classList.add("ng-select-focused");
this.focusEvent.emit($event);
this._focused = true;
}
onInputBlur($event) {
this.element.classList.remove("ng-select-focused");
this.blurEvent.emit($event);
if (!this.isOpen() && !this.disabled()) this._onTouched();
if (this._editableSearchTermActive()) this._setSearchTermFromItems();
this._focused = false;
}
onItemHover(item) {
if (item.disabled) return;
this.itemsList.markItem(item);
}
detectChanges() {
if (!this._cd.destroyed) this._cd.detectChanges();
}
_handleSignalChanges() {
let itemsInitialized = false;
effect(() => {
const items = this.items();
if (!itemsInitialized) {
itemsInitialized = true;
return;
}
untracked(() => {
this._itemsAreUsed = true;
this._setItems(items || []);
});
}, { injector: this._injector });
let multipleInitialized = false;
effect(() => {
this.multiple();
if (!multipleInitialized) {
multipleInitialized = true;
return;
}
untracked(() => {
const written = this._lastWrittenValue;
this._resyncSelectionFromWrittenValue();
if (isDefined(written) && !(Array.isArray(written) && written.length === 0) && !this.hasValue) this._updateNgModel();
});
}, { injector: this._injector });
let bindingsInitialized = false;
effect(() => {
this.bindValue();
this.compareWith();
if (!bindingsInitialized) {
bindingsInitialized = true;
return;
}
untracked(() => this._resyncSelectionFromWrittenValue());
}, { injector: this._injector });
let groupByInitialized = false;
effect(() => {
this.groupBy();
if (!groupByInitialized) {
groupByInitialized = true;
return;
}
untracked(() => this._setItems([...this.items()]));
}, { injector: this._injector });
effect(() => {
this.inputAttrs();
if (!this.searchInput()) return;
untracked(() => this._setInputAttributes());
}, { injector: this._injector });
effect(() => {
this.isOpen();
this.dropdownPosition();
this._dropdownTemplate();
untracked(() => this._syncDropdownOverlay());
}, { injector: this._injector });
}
_setSearchTermFromItems() {
const selected = this.selectedItems?.[0];
this._searchTerm.set(selected?.label ?? null);
}
_resyncSelectionFromWrittenValue() {
this.itemsList.clearSelected(false);
this._handleWriteValue(this._lastWrittenValue);
if (this._editableSearchTermActive()) this._setSearchTermFromItems();
this._cd.markForCheck();
}
_setItems(items) {
const firstItem = items[0];
this.bindLabel.set(this.bindLabel() || this._defaultLabel);
this._primitive = isDefined(firstItem) ? !isObject(firstItem) : this._primitive || this.bindLabel() === this._defaultLabel;
this.itemsList.setItems(items);
if (items.length > 0 && this.hasValue) this.itemsList.mapSelectedItems();
if (this.isOpen() && isDefined(this.searchTerm) && !this.typeahead()?.observed) this.itemsList.filter(this.searchTerm);
if (this.typeahead()?.observed || this.isOpen()) this.itemsList.markSelectedOrDefault(this.markFirst());
}
_setItemsFromNgOptions() {
effect(() => {
const options = this.ngOptions();
if (options.length > 0 && !options.every((opt) => opt.isInitialized())) return;
this.bindLabel.set(this._defaultLabel);
const items = options.map((option) => ({
$ngOptionValue: option.value(),
$ngOptionLabel: option.label(),
$ngOptionClasses: option.classes(),
disabled: option.disabled()
}));
this.items.set(items);
this.itemsList.setItems(items);
if (this.hasValue) this.itemsList.mapSelectedItems();
this._cd.detectChanges();
options.map((option) => ({
option,
item: this.itemsList.findItem(option.value())
})).filter(({ item }) => isDefined(item)).forEach(({ option, item }) => {
item.disabled = option.disabled();
item.label = option.label() || item.label;
item.classes = option.classes();
});
}, { injector: this._injector });
}
_handleWriteValue(value) {
const validation = validateWriteValue(value, {
bindValue: this.bindValue(),
compareWith: this.compareWith(),
multiple: this.multiple()
});
if (!validation.valid) {
if (validation.warning) this._console.warn(validation.warning);
return;
}
const select = (val) => {
let item = this.itemsList.findItem(val);
if (item) this.itemsList.select(item);
else {
item = createUnmatchedOptionValue(val, this.bindLabel() || this._defaultLabel, this.bindValue());
this.itemsList.select(this.itemsList.mapItem(item, null));
}
};
if (this.multiple()) value.forEach((item) => select(item));
else select(value);
}
_handleKeyPresses() {
if (this.searchable()) return;
this._keyPress$.pipe(takeUntilDestroyed(this._destroyRef), tap((letter) => this._pressedKeys.push(letter)), debounceTime(200), filter(() => this._pressedKeys.length > 0), map(() => this._pressedKeys.join(""))).subscribe((term) => {
const item = this.itemsList.findByLabel(term);
if (item) {
if (this.isOpen()) {
if (!item.disabled) {
this.itemsList.markItem(item);
this._scrollToMarked();
this._cd.markForCheck();
}
} else this.select(item);
}
this._pressedKeys = [];
});
}
_setInputAttributes() {
const input = this.searchInput().nativeElement;
const attributes = {
type: "text",
autocorrect: "off",
autocapitalize: "off",
autocomplete: "off",
...this.inputAttrs()
};
for (const key of Object.keys(attributes)) input.setAttribute(key, attributes[key]);
}
_setTabFocusOnClear() {
this.tabFocusOnClear.set(isDefined(this.tabFocusOnClearButton()) ? !!this.tabFocusOnClearButton() : this.config.tabFocusOnClear);
}
_updateNgModel() {
const model = selectedItemsToModel(this.selectedItems, {
bindValue: this.bindValue(),
groupBy: this.groupBy(),
hasGroupValue: !!this.groupValue()
}, (value, key) => this.itemsList.resolveNested(value, key));
const selected = this.selectedItems.map((x) => x.value);
if (this.multiple()) {
this._lastWrittenValue = model;
this._onChange(model);
this.changeEvent.emit(selected);
} else {
const single = isDefined(model[0]) ? model[0] : null;
this._lastWrittenValue = single;
this._onChange(single);
this.changeEvent.emit(selected[0]);
}
this._cd.markForCheck();
}
_clearSearch() {
if (!this.searchTerm) return;
this._changeSearch(null);
this.itemsList.resetFilteredItems();
}
_changeSearch(searchTerm) {
this._searchTerm.set(searchTerm);
}
_scrollToMarked() {
if (!this.isOpen() || !this.dropdownPanel()) return;
this.dropdownPanel().scrollTo(this.itemsList.markedItem);
}
_scrollToTag() {
if (!this.isOpen() || !this.dropdownPanel()) return;
this.dropdownPanel().scrollToTag();
}
_onSelectionChanged() {
if (this.isOpen() && this.deselectOnClickValue()) {
this._cd.detectChanges();
this.dropdownPanel()?.adjustPosition();
}
}
_syncDropdownOverlay() {
const template = this._dropdownTemplate();
const viewContainer = this._dropdownOutlet();
if (!template || !viewContainer) return;
if (this.isOpen()) this._dropdownOverlay.open({
appendTo: this.appendTo() ?? this.config.appendTo ?? null,
beforeAttach: (overlayRef) => this.dropdownOverlayRef = overlayRef,
origin: this._dropdownOrigin(),
position: this.dropdownPosition(),
template,
viewContainer
});
else this._dropdownOverlay.close();
}
_dropdownOrigin() {
return this._selectContainer()?.nativeElement ?? this.element;
}
_warnDeprecatedInputs() {
if (!isDevMode()) return;
if (this.popover()) this._console.warn("[ng-select] `popover` is deprecated and has no effect: the dropdown panel now renders in an Angular CDK overlay, which uses the native Popover API top layer automatically in supporting browsers.");
}
_handleTab($event) {
if (this.isOpen() === false) {
if (this.showClear() && !$event.shiftKey && this.tabFocusOnClear()) {
this.focusOnClear();
$event.preventDefault();
} else if (!this.addTag()) return;
}
if (this.selectOnTab()) {
if (this.itemsList.markedItem) {
this.toggleItem(this.itemsList.markedItem);
$event.preventDefault();
} else if (this.showAddTag) {
this.selectTag();
$event.preventDefault();
} else this.close();
} else this.close();
}
_handleEnter($event) {
const openOnEnter = this.openOnEnter() ?? this.config.openOnEnter;
if (this.isOpen() || this._manualOpen) {
if (this.itemsList.markedItem) this.toggleItem(this.itemsList.markedItem);
else if (this.showAddTag) this.selectTag();
} else if (openOnEnter) this.open();
else return;
$event.preventDefault();
}
_handleSpace($event) {
if (this.isOpen() || this._manualOpen) return;
this.open();
$event.preventDefault();
}
_handleArrowDown($event) {
if (this._nextItemIsTag(1)) {
this.itemsList.unmarkItem();
this._scrollToTag();
} else {
this.itemsList.markNextItem();
this._scrollToMarked();
}
this.open();
$event.preventDefault();
}
_handleArrowUp($event) {
if (!this.isOpen()) return;
if (this._nextItemIsTag(-1)) {
this.itemsList.unmarkItem();
this._scrollToTag();
} else {
this.itemsList.markPreviousItem();
this._scrollToMarked();
}
$event.preventDefault();
}
_nextItemIsTag(nextStep) {
const nextIndex = this.itemsList.markedIndex + nextStep;
return this.addTag() && this.searchTerm && this.itemsList.markedItem && (nextIndex < 0 || nextIndex === this.itemsList.filteredItems.length);
}
_handleBackspace() {
if (this.searchTerm || !this.clearable() || !this.clearOnBackspace() || !this.hasValue) return;
if (this.multiple()) this.unselect(this.itemsList.lastSelectedItem);
else this.clearModel();
}
_mergeGlobalConfig(config) {
this.bindValue.set(this.bindValue() || config.bindValue);
this.bindLabel.set(this.bindLabel() || config.bindLabel || this._defaultLabel);
this.appearance.set(this.appearance() || config.appearance);
this._setTabFocusOnClear();
}
getVirtualScroll(config) {
return isDefined(this._virtualScroll()) ? this._virtualScroll() : this.isVirtualScrollDisabled(config);
}
isVirtualScrollDisabled(config) {
return isDefined(config.disableVirtualScroll) ? !config.disableVirtualScroll : false;
}
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgSelectComponent,
deps: [],
target: i0.ɵɵFactoryTarget.Component
});
}
static {
this.ɵcmp = i0.ɵɵngDeclareComponent({
minVersion: "17.0.0",
version: "22.2.0",
type: NgSelectComponent,
isStandalone: true,
selector: "ng-select",
inputs: {
_ariaLabelDropdown: {
classPropertyName: "_ariaLabelDropdown",
publicName: "ariaLabelDropdown",
isSignal: true,
isRequired: false,
transformFunction: null
},
_ariaLabel: {
classPropertyName: "_ariaLabel",
publicName: "ariaLabel",
isSignal: true,
isRequired: false,
transformFunction: null
},
_markFirst: {
classPropertyName: "_markFirst",
publicName: "markFirst",
isSignal: true,
isRequired: false,
transformFunction: null
},
_placeholder: {
classPropertyName: "_placeholder",
publicName: "placeholder",
isSignal: true,
isRequired: false,
transformFunction: null
},
_fixedPlaceholder: {
classPropertyName: "_fixedPlaceholder",
publicName: "fixedPlaceholder",
isSignal: true,
isRequired: false,
transformFunction: null
},
_notFoundText: {
classPropertyName: "_notFoundText",
publicName: "notFoundText",
isSignal: true,
isRequired: false,
transformFunction: null
},
_typeToSearchText: {
classPropertyName: "_typeToSearchText",
publicName: "typeToSearchText",
isSignal: true,
isRequired: false,
transformFunction: null
},
_preventToggleOnRightClick: {
classPropertyName: "_preventToggleOnRightClick",
publicName: "preventToggleOnRightClick",
isSignal: true,
isRequired: false,
transformFunction: null
},
_addTagText: {
classPropertyName: "_addTagText",
publicName: "addTagText",
isSignal: true,
isRequired: false,
transformFunction: null
},
_loadingText: {
classPropertyName: "_loadingText",
publicName: "loadingText",
isSignal: true,
isRequired: false,
transformFunction: null
},
_clearAllText: {
classPropertyName: "_clearAllText",
publicName: "clearAllText",
isSignal: true,
isRequired: false,
transformFunction: null
},
_removeText: {
classPropertyName: "_removeText",
publicName: "removeText",
isSignal: true,
isRequired: false,
transformFunction: null
},
_dropdownPosition: {
classPropertyName: "_dropdownPosition",
publicName: "dropdownPosition",
isSignal: true,
isRequired: false,
transformFunction: null
},
_appendTo: {
classPropertyName: "_appendTo",
publicName: "appendTo",
isSignal: true,
isRequired: false,
transformFunction: null
},
_outsideClickEvent: {
classPropertyName: "_outsideClickEvent",
publicName: "outsideClickEvent",
isSignal: true,
isRequired: false,
transformFunction: null
},
_loading: {
classPropertyName: "_loading",
publicName: "loading",
isSignal: true,
isRequired: false,
transformFunction: null
},
_closeOnSelect: {
classPropertyName: "_closeOnSelect",
publicName: "closeOnSelect",
isSignal: true,
isRequired: false,
transformFunction: null
},
_closeOnScroll: {
classPropertyName: "_closeOnScroll",
publicName: "closeOnScroll",
isSignal: true,
isRequired: false,
transformFunction: null
},
_hideSelected: {
classPropertyName: "_hideSelected",
publicName: "hideSelected",
isSignal: true,
isRequired: false,
transformFunction: null
},
_selectOnTab: {
classPropertyName: "_selectOnTab",
publicName: "selectOnTab",
isSignal: true,
isRequired: false,
transformFunction: null
},
_openOnEnter: {
classPropertyName: "_openOnEnter",
publicName: "openOnEnter",
isSignal: true,
isRequired: false,
transformFunction: null
},
_maxSelectedItems: {
classPropertyName: "_maxSelectedItems",
publicName: "maxSelectedItems",
isSignal: true,
isRequired: false,
transformFunction: null
},
_groupBy: {
classPropertyName: "_groupBy",
publicName: "groupBy",
isSignal: true,
isRequired: false,
transformFunction: null
},
_groupValue: {
classPropertyName: "_groupValue",
publicName: "groupValue",
isSignal: true,
isRequired: false,
transformFunction: null
},
_bufferAmount: {
classPropertyName: "_bufferAmount",
publicName: "bufferAmount",
isSignal: true,
isRequired: false,
transformFunction: null
},
_virtualScroll: {
classPropertyName: "_virtualScroll",
publicName: "virtualScroll",
isSignal: true,
isRequired: false,
transformFunction: null
},
_selectableGroup: {
classPropertyName: "_selectableGroup",
publicName: "selectableGroup",
isSignal: true,
isRequired: false,
transformFunction: null
},
_tabFocusOnClearButton: {
classPropertyName: "_tabFocusOnClearButton",
publicName: "tabFocusOnClearButton",
isSignal: true,
isRequired: false,
transformFunction: null
},
_selectableGroupAsModel: {
classPropertyName: "_selectableGroupAsModel",
publicName: "selectableGroupAsModel",
isSignal: true,
isRequired: false,
transformFunction: null
},
_searchFn: {
classPropertyName: "_searchFn",
publicName: "searchFn",
isSignal: true,
isRequired: false,
transformFunction: null
},
_trackByFn: {
classPropertyName: "_trackByFn",
publicName: "trackByFn",
isSignal: true,
isRequired: false,
transformFunction: null
},
_clearOnBackspace: {
classPropertyName: "_clearOnBackspace",
publicName: "clearOnBackspace",
isSignal: true,
isRequired: false,
transformFunction: null
},
_labelForId: {
classPropertyName: "_labelForId",
publicName: "labelForId",
isSignal: true,
isRequired: false,
transformFunction: null
},
_inputAttrs: {
classPropertyName: "_inputAttrs",
publicName: "inputAttrs",
isSignal: true,
isRequired: false,
transformFunction: null
},
_tabIndex: {
classPropertyName: "_tabIndex",
publicName: "tabIndex",
isSignal: true,
isRequired: false,
transformFunction: null
},
_readonly: {
classPropertyName: "_readonly",
publicName: "readonly",
isSignal: true,
isRequired: false,
transformFunction: null
},
_searchWhileComposing: {
classPropertyName: "_searchWhileComposing",
publicName: "searchWhileComposing",
isSignal: true,
isRequired: false,
transformFunction: null
},
_minTermLength: {
classPropertyName: "_minTermLength",
publicName: "minTermLength",
isSignal: true,
isRequired: false,
transformFunction: null
},
_editableSearchTerm: {
classPropertyName: "_editableSearchTerm",
publicName: "editableSearchTerm",
isSignal: true,
isRequired: false,
transformFunction: null
},
_ngClass: {
classPropertyName: "_ngClass",
publicName: "ngClass",
isSignal: true,
isRequired: false,
transformFunction: null
},
_panelClass: {
classPropertyName: "_panelClass",
publicName: "panelClass",
isSignal: true,
isRequired: false,
transformFunction: null
},
_typeahead: {
classPropertyName: "_typeahead",
publicName: "typeahead",
isSignal: true,
isRequired: false,
transformFunction: null
},
_multiple: {
classPropertyName: "_multiple",
publicName: "multiple",
isSignal: true,
isRequired: false,
transformFunction: null
},
_addTag: {
classPropertyName: "_addTag",
publicName: "addTag",
isSignal: true,
isRequired: false,
transformFunction: null
},
_searchable: {
classPropertyName: "_searchable",
publicName: "searchable",
isSignal: true,
isRequired: false,
transformFunction: null
},
_clearable: {
classPropertyName: "_clearable",
publicName: "clearable",
isSignal: true,
isRequired: false,
transformFunction: null
},
_clearKeepsDisabledOptions: {
classPropertyName: "_clearKeepsDisabledOptions",
publicName: "clearKeepsDisabledOptions",
isSignal: true,
isRequired: false,
transformFunction: null
},
_deselectOnClick: {
classPropertyName: "_deselectOnClick",
publicName: "deselectOnClick",
isSignal: true,
isRequired: false,
transformFunction: null
},
_clearSearchOnAdd: {
classPropertyName: "_clearSearchOnAdd",
publicName: "clearSearchOnAdd",
isSignal: true,
isRequired: false,
transformFunction: null
},
_compareWith: {
classPropertyName: "_compareWith",
publicName: "compareWith",
isSignal: true,
isRequired: false,
transformFunction: null
},
_keyDownFn: {
classPropertyName: "_keyDownFn",
publicName: "keyDownFn",
isSignal: true,
isRequired: false,
transformFunction: null
},
_popover: {
classPropertyName: "_popover",
publicName: "popover",
isSignal: true,
isRequired: false,
transformFunction: null
},
bindLabel: {
classPropertyName: "bindLabel",
publicName: "bindLabel",
isSignal: true,
isRequired: false,
transformFunction: null
},
bindValue: {
classPropertyName: "bindValue",
publicName: "bindValue",
isSignal: true,
isRequired: false,
transformFunction: null
},
appearance: {
classPropertyName: "appearance",
publicName: "appearance",
isSignal: true,
isRequired: false,
transformFunction: null
},
isOpen: {
classPropertyName: "isOpen",
publicName: "isOpen",
isSignal: true,
isRequired: false,
transformFunction: null
},
items: {
classPropertyName: "items",
publicName: "items",
isSignal: true,
isRequired: false,
transformFunction: null
}
},
outputs: {
bindLabel: "bindLabelChange",
bindValue: "bindValueChange",
appearance: "appearanceChange",
isOpen: "isOpenChange",
items: "itemsChange",
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": "true",
"class.ng-select-single": "!multiple()",
"class.ng-select-typeahead": "typeahead()",
"class.ng-select-multiple": "multiple()",
"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()"
}
},
providers: [{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => NgSelectComponent),
multi: true
}, NgDropdownPanelService],
queries: [
{
propertyName: "optionTemplate",
first: true,
predicate: NgOptionTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "optgroupTemplate",
first: true,
predicate: NgOptgroupTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "labelTemplate",
first: true,
predicate: NgLabelTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "multiLabelTemplate",
first: true,
predicate: NgMultiLabelTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "headerTemplate",
first: true,
predicate: NgHeaderTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "footerTemplate",
first: true,
predicate: NgFooterTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "notFoundTemplate",
first: true,
predicate: NgNotFoundTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "placeholderTemplate",
first: true,
predicate: NgPlaceholderTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "typeToSearchTemplate",
first: true,
predicate: NgTypeToSearchTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "loadingTextTemplate",
first: true,
predicate: NgLoadingTextTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "tagTemplate",
first: true,
predicate: NgTagTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "loadingSpinnerTemplate",
first: true,
predicate: NgLoadingSpinnerTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "clearButtonTemplate",
first: true,
predicate: NgClearButtonTemplateDirective,
descendants: true,
read: TemplateRef,
isSignal: true
},
{
propertyName: "ngOptions",
predicate: NgOptionComponent,
descendants: true,
isSignal: true
}
],
viewQueries: [
{
propertyName: "dropdownPanel",
first: true,
predicate: i0.forwardRef(() => NgDropdownPanelComponent),
descendants: true,
isSignal: true
},
{
propertyName: "searchInput",
first: true,
predicate: ["searchInput"],
descendants: true,
isSignal: true
},
{
propertyName: "clearButton",
first: true,
predicate: ["clearButton"],
descendants: true,
isSignal: true
},
{
propertyName: "_dropdownTemplate",
first: true,
predicate: ["dropdownTemplate"],
descendants: true,
isSignal: true
},
{
propertyName: "_dropdownOutlet",
first: true,
predicate: ["dropdownTemplate"],
descendants: true,
read: ViewContainerRef,
isSignal: true
},
{
propertyName: "_selectContainer",
first: true,
predicate: ["selectContainer"],
descendants: true,
isSignal: true
}
],
exportAs: ["ngSelect"],
usesOnChanges: true,
ngImport: i0,
template: "<div\n #selectContainer\n (mousedown)=\"handleMousedown($event)\"\n [class.ng-appearance-outline]=\"appearance() === 'outline'\"\n [class.ng-appearance-fill]=\"appearance() === 'fill'\"\n [class.ng-has-value]=\"hasValue\"\n class=\"ng-select-container\">\n <div class=\"ng-value-container\">\n @if ((selectedItems.length === 0 && !searchTerm) || (fixedPlaceholder() ?? config.fixedPlaceholder)) {\n <ng-template #defaultPlaceholderTemplate>\n <div class=\"ng-placeholder\">{{ placeholder() ?? config.placeholder }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"placeholderTemplate() || defaultPlaceholderTemplate\"> </ng-template>\n }\n\n @if ((!multiLabelTemplate() || !multiple()) && selectedItems.length > 0) {\n @for (item of selectedItems; track trackByOption($index, item)) {\n <div [class.ng-value-disabled]=\"item.disabled\" class=\"ng-value\">\n <ng-template #defaultLabelTemplate>\n <span\n class=\"ng-value-icon left\"\n role=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"(removeText() ?? config.removeText) + ' ' + item.label\"\n (click)=\"unselect(item)\"\n (keydown)=\"handleRemoveKeydown($event, item)\"\n >×</span\n >\n <span class=\"ng-value-label\">{{ item.label }}</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate() || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n </ng-template>\n </div>\n }\n }\n\n @if (multiple() && multiLabelTemplate() && selectedValues.length > 0) {\n <ng-template [ngTemplateOutlet]=\"multiLabelTemplate()\" [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\"> </ng-template>\n }\n\n <div class=\"ng-input\">\n <input\n #searchInput\n (blur)=\"onInputBlur($event)\"\n (change)=\"$event.stopPropagation()\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n (focus)=\"onInputFocus($event)\"\n (input)=\"filter(searchInput.value)\"\n [attr.aria-activedescendant]=\"isOpen() ? itemsList?.markedItem?.htmlId : null\"\n [attr.aria-controls]=\"isOpen() ? dropdownId : null\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.id]=\"labelForId()\"\n [attr.tabindex]=\"tabIndex()\"\n [disabled]=\"disabled()\"\n [readOnly]=\"!searchable() || itemsList.maxItemsSelected\"\n [value]=\"searchTerm ?? ''\"\n aria-autocomplete=\"list\"\n role=\"combobox\" />\n </div>\n </div>\n\n @if (loading()) {\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-spinner-loader\"></div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingSpinnerTemplate() || defaultLoadingSpinnerTemplate\"></ng-template>\n }\n\n @if (showClear()) {\n <span\n class=\"ng-clear-wrapper\"\n role=\"button\"\n tabindex=\"0\"\n [attr.tabindex]=\"tabFocusOnClear() ? 0 : -1\"\n [attr.aria-label]=\"clearAllText() || config.clearAllText\"\n title=\"{{ clearAllText() || config.clearAllText }}\"\n #clearButton\n (click)=\"handleClearClick($event)\">\n @if (clearButtonTemplate()) {\n <ng-container [ngTemplateOutlet]=\"clearButtonTemplate()\"></ng-container>\n } @else {\n <span class=\"ng-clear\" aria-hidden=\"true\">×</span>\n }\n </span>\n }\n\n <span class=\"ng-arrow-wrapper\">\n <span class=\"ng-arrow\"></span>\n </span>\n\n @if (appearance() === 'outline') {\n <div class=\"ng-notched-outline\" aria-hidden=\"true\">\n <div class=\"ng-notched-outline-leading\"></div>\n <div class=\"ng-notched-outline-notch\" [style.width.px]=\"outlineNotchWidth()\"></div>\n <div class=\"ng-notched-outline-trailing\"></div>\n </div>\n }\n</div>\n\n<!-- Rendered through a TemplatePortal into the CDK overlay while the select is open;\n the embedded view stays part of this component's view tree, only the DOM moves. -->\n<ng-template #dropdownTemplate>\n <ng-dropdown-panel\n class=\"ng-dropdown-panel\"\n [virtualScroll]=\"dropdownVirtualScroll()\"\n [bufferAmount]=\"bufferAmount()\"\n [position]=\"dropdownPosition()\"\n [outsideClickEvent]=\"outsideClickEvent()\"\n [closeOnScroll]=\"closeOnScroll()\"\n [headerTemplate]=\"headerTemplate()\"\n [footerTemplate]=\"footerTemplate()\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [showAddTag]=\"showAddTag\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit($event)\"\n (outsideClick)=\"close()\"\n (outsideScroll)=\"close()\"\n [class.ng-select-multiple]=\"multiple()\"\n [class]=\"panelClasses()\"\n [listboxId]=\"dropdownId\"\n [ariaLabelDropdown]=\"ariaLabelDropdown() ?? config.ariaLabelDropdown\"\n [overlayRef]=\"dropdownOverlayRef\"\n [selectElement]=\"element\">\n <ng-container>\n @for (item of viewPortItems; track trackByOption($index, item)) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus, @angular-eslint/template/mouse-events-have-key-events -->\n <div\n [attr.role]=\"item.children ? 'group' : 'option'\"\n (click)=\"toggleItem(item)\"\n (mouseover)=\"onItemHover(item)\"\n [ngClass]=\"item.classes\"\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.aria-selected]=\"item.selected\"\n [attr.id]=\"item?.htmlId\"\n [attr.aria-setsize]=\"itemsList.filteredItems.length\"\n [attr.aria-posinset]=\"itemsList.filteredItems.indexOf(item) + 1 || null\">\n <ng-template #defaultOptionTemplate>\n <span class=\"ng-option-label\">{{ item.label }}</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"item.children ? optgroupTemplate() || defaultOptionTemplate : optionTemplate() || defaultOptionTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, item$: item, index: item.index, searchTerm: searchTerm }\">\n </ng-template>\n </div>\n }\n @if (showAddTag) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus, @angular-eslint/template/mouse-events-have-key-events -->\n <div\n class=\"ng-option\"\n [class.ng-option-marked]=\"!itemsList.markedItem\"\n (mouseover)=\"itemsList.unmarkItem()\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n (click)=\"selectTag()\">\n <ng-template #defaultTagTemplate>\n <span\n ><span class=\"ng-tag-label\">{{ addTagText() || config.addTagText }}</span\n >\"{{ searchTerm }}\"</span\n >\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"tagTemplate() || defaultTagTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"> </ng-template>\n </div>\n }\n </ng-container>\n @if (showNoItemsFound()) {\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ notFoundText() ?? config.notFoundText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"notFoundTemplate() || defaultNotFoundTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n }\n @if (showTypeToSearch()) {\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ typeToSearchText() || config.typeToSearchText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate() || defaultTypeToSearchTemplate\"></ng-template>\n }\n @if (loading() && itemsList.filteredItems.length === 0) {\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ loadingText() || config.loadingText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingTextTemplate() || defaultLoadingTextTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n }\n </ng-dropdown-panel>\n</ng-template>\n\n<!-- Always present aria-live region -->\n<div aria-atomic=\"true\" aria-live=\"polite\" class=\"ng-visually-hidden\" role=\"status\">\n @if (isOpen()) {\n @if (showNoItemsFound()) {\n {{ notFoundText() ?? config.notFoundText }}\n } @else if (showTypeToSearch()) {\n {{ typeToSearchText() || config.typeToSearchText }}\n } @else if (loading() && itemsList.filteredItems.length === 0) {\n {{ loadingText() || config.loadingText }}\n } @else if (itemsList.markedItem) {\n {{ itemsList.markedItem.label }}\n }\n }\n</div>\n",
styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select:not(.ng-select-searchable) .ng-select-container .ng-value-container .ng-input{pointer-events:none}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .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{display:none}.ng-select .ng-select-container{cursor:default;display:flex;outline:none;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:flex;flex:1}.ng-select .ng-select-container .ng-value-container .ng-input{opacity:0}.ng-select .ng-select-container .ng-value-container .ng-input>input{box-sizing:content-box;background:none transparent;border:0 none;box-shadow:none;outline:none;padding:0;cursor:default;width:100%}.ng-select .ng-select-container .ng-value-container .ng-input>input::-ms-clear{display:none}.ng-select .ng-select-container .ng-value-container .ng-input>input[readonly]{-webkit-user-select:unset;user-select:unset;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-select-container .ng-value-container .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-select-container .ng-value-container,.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{position:absolute}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{cursor:pointer}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;user-select:none}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-spinner-loader{border-radius:50%;width:17px;height:17px;margin-right:5px;font-size:10px;position:relative;text-indent:-9999em;border-top:2px solid rgba(66,66,66,.2);border-right:2px solid rgba(66,66,66,.2);border-bottom:2px solid rgba(66,66,66,.2);border-left:2px solid #424242;transform:translateZ(0);animation:load8 .8s infinite linear}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-user-select:none;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{pointer-events:none;display:inline-block;height:0;width:0;position:relative}.ng-dropdown-panel{box-sizing:border-box;position:relative;opacity:0;width:100%;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{box-sizing:border-box;cursor:pointer;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .ng-option-label:empty:before{content:\"\\200b\"}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option.disabled{cursor:default}.ng-dropdown-panel .scroll-host{overflow:hidden;overflow-y:auto;position:relative;display:block;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .scrollable-content{top:0;left:0;width:100%;height:100%;position:absolute}.ng-dropdown-panel .total-padding{width:1px;opacity:0}.cdk-overlay-pane .ng-dropdown-panel{position:relative;inset:auto}.ng-visually-hidden{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0;white-space:nowrap}\n"],
dependencies: [
{
kind: "directive",
type: NgClass,
selector: "[ngClass]",
inputs: ["class", "ngClass"]
},
{
kind: "directive",
type: NgTemplateOutlet,
selector: "[ngTemplateOutlet]",
inputs: [
"ngTemplateOutletContext",
"ngTemplateOutlet",
"ngTemplateOutletInjector"
]
},
{
kind: "component",
type: NgDropdownPanelComponent,
selector: "ng-dropdown-panel",
inputs: [
"items",
"showAddTag",
"markedItem",
"position",
"bufferAmount",
"virtualScroll",
"headerTemplate",
"footerTemplate",
"filterValue",
"ariaLabelDropdown",
"listboxId",
"outsideClickEvent",
"closeOnScroll",
"popover",
"overlayRef",
"selectElement"
],
outputs: [
"update",
"scroll",
"scrollToEnd",
"outsideClick",
"outsideScroll"
]
}
],
changeDetection: i0.ChangeDetectionStrategy.OnPush,
encapsulation: i0.ViewEncapsulation.None
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgSelectComponent,
decorators: [{
type: Component,
args: [{
selector: "ng-select",
exportAs: "ngSelect",
providers: [{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => NgSelectComponent),
multi: true
}, NgDropdownPanelService],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [
NgClass,
NgTemplateOutlet,
NgDropdownPanelComponent
],
host: {
"[class.ng-select]": "true",
"[class.ng-select-single]": "!multiple()",
"[class.ng-select-typeahead]": "typeahead()",
"[class.ng-select-multiple]": "multiple()",
"[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()"
},
template: "<div\n #selectContainer\n (mousedown)=\"handleMousedown($event)\"\n [class.ng-appearance-outline]=\"appearance() === 'outline'\"\n [class.ng-appearance-fill]=\"appearance() === 'fill'\"\n [class.ng-has-value]=\"hasValue\"\n class=\"ng-select-container\">\n <div class=\"ng-value-container\">\n @if ((selectedItems.length === 0 && !searchTerm) || (fixedPlaceholder() ?? config.fixedPlaceholder)) {\n <ng-template #defaultPlaceholderTemplate>\n <div class=\"ng-placeholder\">{{ placeholder() ?? config.placeholder }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"placeholderTemplate() || defaultPlaceholderTemplate\"> </ng-template>\n }\n\n @if ((!multiLabelTemplate() || !multiple()) && selectedItems.length > 0) {\n @for (item of selectedItems; track trackByOption($index, item)) {\n <div [class.ng-value-disabled]=\"item.disabled\" class=\"ng-value\">\n <ng-template #defaultLabelTemplate>\n <span\n class=\"ng-value-icon left\"\n role=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"(removeText() ?? config.removeText) + ' ' + item.label\"\n (click)=\"unselect(item)\"\n (keydown)=\"handleRemoveKeydown($event, item)\"\n >×</span\n >\n <span class=\"ng-value-label\">{{ item.label }}</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate() || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n </ng-template>\n </div>\n }\n }\n\n @if (multiple() && multiLabelTemplate() && selectedValues.length > 0) {\n <ng-template [ngTemplateOutlet]=\"multiLabelTemplate()\" [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\"> </ng-template>\n }\n\n <div class=\"ng-input\">\n <input\n #searchInput\n (blur)=\"onInputBlur($event)\"\n (change)=\"$event.stopPropagation()\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n (focus)=\"onInputFocus($event)\"\n (input)=\"filter(searchInput.value)\"\n [attr.aria-activedescendant]=\"isOpen() ? itemsList?.markedItem?.htmlId : null\"\n [attr.aria-controls]=\"isOpen() ? dropdownId : null\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.id]=\"labelForId()\"\n [attr.tabindex]=\"tabIndex()\"\n [disabled]=\"disabled()\"\n [readOnly]=\"!searchable() || itemsList.maxItemsSelected\"\n [value]=\"searchTerm ?? ''\"\n aria-autocomplete=\"list\"\n role=\"combobox\" />\n </div>\n </div>\n\n @if (loading()) {\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-spinner-loader\"></div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingSpinnerTemplate() || defaultLoadingSpinnerTemplate\"></ng-template>\n }\n\n @if (showClear()) {\n <span\n class=\"ng-clear-wrapper\"\n role=\"button\"\n tabindex=\"0\"\n [attr.tabindex]=\"tabFocusOnClear() ? 0 : -1\"\n [attr.aria-label]=\"clearAllText() || config.clearAllText\"\n title=\"{{ clearAllText() || config.clearAllText }}\"\n #clearButton\n (click)=\"handleClearClick($event)\">\n @if (clearButtonTemplate()) {\n <ng-container [ngTemplateOutlet]=\"clearButtonTemplate()\"></ng-container>\n } @else {\n <span class=\"ng-clear\" aria-hidden=\"true\">×</span>\n }\n </span>\n }\n\n <span class=\"ng-arrow-wrapper\">\n <span class=\"ng-arrow\"></span>\n </span>\n\n @if (appearance() === 'outline') {\n <div class=\"ng-notched-outline\" aria-hidden=\"true\">\n <div class=\"ng-notched-outline-leading\"></div>\n <div class=\"ng-notched-outline-notch\" [style.width.px]=\"outlineNotchWidth()\"></div>\n <div class=\"ng-notched-outline-trailing\"></div>\n </div>\n }\n</div>\n\n<!-- Rendered through a TemplatePortal into the CDK overlay while the select is open;\n the embedded view stays part of this component's view tree, only the DOM moves. -->\n<ng-template #dropdownTemplate>\n <ng-dropdown-panel\n class=\"ng-dropdown-panel\"\n [virtualScroll]=\"dropdownVirtualScroll()\"\n [bufferAmount]=\"bufferAmount()\"\n [position]=\"dropdownPosition()\"\n [outsideClickEvent]=\"outsideClickEvent()\"\n [closeOnScroll]=\"closeOnScroll()\"\n [headerTemplate]=\"headerTemplate()\"\n [footerTemplate]=\"footerTemplate()\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [showAddTag]=\"showAddTag\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit($event)\"\n (outsideClick)=\"close()\"\n (outsideScroll)=\"close()\"\n [class.ng-select-multiple]=\"multiple()\"\n [class]=\"panelClasses()\"\n [listboxId]=\"dropdownId\"\n [ariaLabelDropdown]=\"ariaLabelDropdown() ?? config.ariaLabelDropdown\"\n [overlayRef]=\"dropdownOverlayRef\"\n [selectElement]=\"element\">\n <ng-container>\n @for (item of viewPortItems; track trackByOption($index, item)) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus, @angular-eslint/template/mouse-events-have-key-events -->\n <div\n [attr.role]=\"item.children ? 'group' : 'option'\"\n (click)=\"toggleItem(item)\"\n (mouseover)=\"onItemHover(item)\"\n [ngClass]=\"item.classes\"\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.aria-selected]=\"item.selected\"\n [attr.id]=\"item?.htmlId\"\n [attr.aria-setsize]=\"itemsList.filteredItems.length\"\n [attr.aria-posinset]=\"itemsList.filteredItems.indexOf(item) + 1 || null\">\n <ng-template #defaultOptionTemplate>\n <span class=\"ng-option-label\">{{ item.label }}</span>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"item.children ? optgroupTemplate() || defaultOptionTemplate : optionTemplate() || defaultOptionTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, item$: item, index: item.index, searchTerm: searchTerm }\">\n </ng-template>\n </div>\n }\n @if (showAddTag) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus, @angular-eslint/template/mouse-events-have-key-events -->\n <div\n class=\"ng-option\"\n [class.ng-option-marked]=\"!itemsList.markedItem\"\n (mouseover)=\"itemsList.unmarkItem()\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n (click)=\"selectTag()\">\n <ng-template #defaultTagTemplate>\n <span\n ><span class=\"ng-tag-label\">{{ addTagText() || config.addTagText }}</span\n >\"{{ searchTerm }}\"</span\n >\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"tagTemplate() || defaultTagTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\"> </ng-template>\n </div>\n }\n </ng-container>\n @if (showNoItemsFound()) {\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ notFoundText() ?? config.notFoundText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"notFoundTemplate() || defaultNotFoundTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n }\n @if (showTypeToSearch()) {\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ typeToSearchText() || config.typeToSearchText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate() || defaultTypeToSearchTemplate\"></ng-template>\n }\n @if (loading() && itemsList.filteredItems.length === 0) {\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{ loadingText() || config.loadingText }}</div>\n </ng-template>\n <ng-template [ngTemplateOutlet]=\"loadingTextTemplate() || defaultLoadingTextTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n }\n </ng-dropdown-panel>\n</ng-template>\n\n<!-- Always present aria-live region -->\n<div aria-atomic=\"true\" aria-live=\"polite\" class=\"ng-visually-hidden\" role=\"status\">\n @if (isOpen()) {\n @if (showNoItemsFound()) {\n {{ notFoundText() ?? config.notFoundText }}\n } @else if (showTypeToSearch()) {\n {{ typeToSearchText() || config.typeToSearchText }}\n } @else if (loading() && itemsList.filteredItems.length === 0) {\n {{ loadingText() || config.loadingText }}\n } @else if (itemsList.markedItem) {\n {{ itemsList.markedItem.label }}\n }\n }\n</div>\n",
styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select:not(.ng-select-searchable) .ng-select-container .ng-value-container .ng-input{pointer-events:none}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .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{display:none}.ng-select .ng-select-container{cursor:default;display:flex;outline:none;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:flex;flex:1}.ng-select .ng-select-container .ng-value-container .ng-input{opacity:0}.ng-select .ng-select-container .ng-value-container .ng-input>input{box-sizing:content-box;background:none transparent;border:0 none;box-shadow:none;outline:none;padding:0;cursor:default;width:100%}.ng-select .ng-select-container .ng-value-container .ng-input>input::-ms-clear{display:none}.ng-select .ng-select-container .ng-value-container .ng-input>input[readonly]{-webkit-user-select:unset;user-select:unset;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-select-container .ng-value-container .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-select-container .ng-value-container,.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{position:absolute}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{cursor:pointer}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;user-select:none}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-spinner-loader{border-radius:50%;width:17px;height:17px;margin-right:5px;font-size:10px;position:relative;text-indent:-9999em;border-top:2px solid rgba(66,66,66,.2);border-right:2px solid rgba(66,66,66,.2);border-bottom:2px solid rgba(66,66,66,.2);border-left:2px solid #424242;transform:translateZ(0);animation:load8 .8s infinite linear}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-user-select:none;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{pointer-events:none;display:inline-block;height:0;width:0;position:relative}.ng-dropdown-panel{box-sizing:border-box;position:relative;opacity:0;width:100%;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{box-sizing:border-box;cursor:pointer;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .ng-option-label:empty:before{content:\"\\200b\"}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option.disabled{cursor:default}.ng-dropdown-panel .scroll-host{overflow:hidden;overflow-y:auto;position:relative;display:block;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .scrollable-content{top:0;left:0;width:100%;height:100%;position:absolute}.ng-dropdown-panel .total-padding{width:1px;opacity:0}.cdk-overlay-pane .ng-dropdown-panel{position:relative;inset:auto}.ng-visually-hidden{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0;white-space:nowrap}\n"]
}]
}],
ctorParameters: () => [],
propDecorators: {
_ariaLabelDropdown: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "ariaLabelDropdown",
required: false
}]
}],
_ariaLabel: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "ariaLabel",
required: false
}]
}],
_markFirst: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "markFirst",
required: false
}]
}],
_placeholder: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "placeholder",
required: false
}]
}],
_fixedPlaceholder: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "fixedPlaceholder",
required: false
}]
}],
_notFoundText: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "notFoundText",
required: false
}]
}],
_typeToSearchText: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "typeToSearchText",
required: false
}]
}],
_preventToggleOnRightClick: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "preventToggleOnRightClick",
required: false
}]
}],
_addTagText: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "addTagText",
required: false
}]
}],
_loadingText: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "loadingText",
required: false
}]
}],
_clearAllText: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "clearAllText",
required: false
}]
}],
_removeText: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "removeText",
required: false
}]
}],
_dropdownPosition: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "dropdownPosition",
required: false
}]
}],
_appendTo: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "appendTo",
required: false
}]
}],
_outsideClickEvent: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "outsideClickEvent",
required: false
}]
}],
_loading: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "loading",
required: false
}]
}],
_closeOnSelect: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "closeOnSelect",
required: false
}]
}],
_closeOnScroll: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "closeOnScroll",
required: false
}]
}],
_hideSelected: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "hideSelected",
required: false
}]
}],
_selectOnTab: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "selectOnTab",
required: false
}]
}],
_openOnEnter: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "openOnEnter",
required: false
}]
}],
_maxSelectedItems: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "maxSelectedItems",
required: false
}]
}],
_groupBy: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "groupBy",
required: false
}]
}],
_groupValue: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "groupValue",
required: false
}]
}],
_bufferAmount: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "bufferAmount",
required: false
}]
}],
_virtualScroll: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "virtualScroll",
required: false
}]
}],
_selectableGroup: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "selectableGroup",
required: false
}]
}],
_tabFocusOnClearButton: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "tabFocusOnClearButton",
required: false
}]
}],
_selectableGroupAsModel: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "selectableGroupAsModel",
required: false
}]
}],
_searchFn: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "searchFn",
required: false
}]
}],
_trackByFn: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "trackByFn",
required: false
}]
}],
_clearOnBackspace: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "clearOnBackspace",
required: false
}]
}],
_labelForId: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "labelForId",
required: false
}]
}],
_inputAttrs: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "inputAttrs",
required: false
}]
}],
_tabIndex: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "tabIndex",
required: false
}]
}],
_readonly: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "readonly",
required: false
}]
}],
_searchWhileComposing: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "searchWhileComposing",
required: false
}]
}],
_minTermLength: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "minTermLength",
required: false
}]
}],
_editableSearchTerm: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "editableSearchTerm",
required: false
}]
}],
_ngClass: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "ngClass",
required: false
}]
}],
_panelClass: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "panelClass",
required: false
}]
}],
_typeahead: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "typeahead",
required: false
}]
}],
_multiple: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "multiple",
required: false
}]
}],
_addTag: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "addTag",
required: false
}]
}],
_searchable: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "searchable",
required: false
}]
}],
_clearable: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "clearable",
required: false
}]
}],
_clearKeepsDisabledOptions: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "clearKeepsDisabledOptions",
required: false
}]
}],
_deselectOnClick: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "deselectOnClick",
required: false
}]
}],
_clearSearchOnAdd: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "clearSearchOnAdd",
required: false
}]
}],
_compareWith: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "compareWith",
required: false
}]
}],
_keyDownFn: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "keyDownFn",
required: false
}]
}],
_popover: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "popover",
required: false
}]
}],
bindLabel: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "bindLabel",
required: false
}]
}, {
type: i0.Output,
args: ["bindLabelChange"]
}],
bindValue: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "bindValue",
required: false
}]
}, {
type: i0.Output,
args: ["bindValueChange"]
}],
appearance: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "appearance",
required: false
}]
}, {
type: i0.Output,
args: ["appearanceChange"]
}],
isOpen: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "isOpen",
required: false
}]
}, {
type: i0.Output,
args: ["isOpenChange"]
}],
items: [{
type: i0.Input,
args: [{
isSignal: true,
alias: "items",
required: false
}]
}, {
type: i0.Output,
args: ["itemsChange"]
}],
blurEvent: [{
type: i0.Output,
args: ["blur"]
}],
focusEvent: [{
type: i0.Output,
args: ["focus"]
}],
changeEvent: [{
type: i0.Output,
args: ["change"]
}],
openEvent: [{
type: i0.Output,
args: ["open"]
}],
closeEvent: [{
type: i0.Output,
args: ["close"]
}],
searchEvent: [{
type: i0.Output,
args: ["search"]
}],
clearEvent: [{
type: i0.Output,
args: ["clear"]
}],
addEvent: [{
type: i0.Output,
args: ["add"]
}],
removeEvent: [{
type: i0.Output,
args: ["remove"]
}],
scroll: [{
type: i0.Output,
args: ["scroll"]
}],
scrollToEnd: [{
type: i0.Output,
args: ["scrollToEnd"]
}],
optionTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgOptionTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
optgroupTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgOptgroupTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
labelTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgLabelTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
multiLabelTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgMultiLabelTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
headerTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgHeaderTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
footerTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgFooterTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
notFoundTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgNotFoundTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
placeholderTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgPlaceholderTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
typeToSearchTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgTypeToSearchTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
loadingTextTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgLoadingTextTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
tagTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgTagTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
loadingSpinnerTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgLoadingSpinnerTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
clearButtonTemplate: [{
type: i0.ContentChild,
args: [i0.forwardRef(() => NgClearButtonTemplateDirective), {
read: TemplateRef,
isSignal: true
}]
}],
ngOptions: [{
type: i0.ContentChildren,
args: [i0.forwardRef(() => NgOptionComponent), {
descendants: true,
isSignal: true
}]
}],
dropdownPanel: [{
type: i0.ViewChild,
args: [forwardRef(() => NgDropdownPanelComponent), { isSignal: true }]
}],
searchInput: [{
type: i0.ViewChild,
args: ["searchInput", { isSignal: true }]
}],
clearButton: [{
type: i0.ViewChild,
args: ["clearButton", { isSignal: true }]
}],
_dropdownTemplate: [{
type: i0.ViewChild,
args: ["dropdownTemplate", { isSignal: true }]
}],
_dropdownOutlet: [{
type: i0.ViewChild,
args: ["dropdownTemplate", {
read: ViewContainerRef,
isSignal: true
}]
}],
_selectContainer: [{
type: i0.ViewChild,
args: ["selectContainer", { isSignal: true }]
}],
handleKeyDown: [{
type: HostListener,
args: ["keydown", ["$event"]]
}]
}
});
var NgSelectModule = class NgSelectModule {
static {
this.ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgSelectModule,
deps: [],
target: i0.ɵɵFactoryTarget.NgModule
});
}
static {
this.ɵmod = i0.ɵɵngDeclareNgModule({
minVersion: "14.0.0",
version: "22.2.0",
ngImport: i0,
type: NgSelectModule,
imports: [
NgDropdownPanelComponent,
NgOptionComponent,
NgSelectComponent,
NgOptgroupTemplateDirective,
NgOptionTemplateDirective,
NgLabelTemplateDirective,
NgMultiLabelTemplateDirective,
NgHeaderTemplateDirective,
NgFooterTemplateDirective,
NgPlaceholderTemplateDirective,
NgClearButtonTemplateDirective,
NgNotFoundTemplateDirective,
NgTypeToSearchTemplateDirective,
NgLoadingTextTemplateDirective,
NgTagTemplateDirective,
NgLoadingSpinnerTemplateDirective,
NgItemLabelDirective
],
exports: [
NgSelectComponent,
NgOptionComponent,
NgOptgroupTemplateDirective,
NgOptionTemplateDirective,
NgLabelTemplateDirective,
NgMultiLabelTemplateDirective,
NgHeaderTemplateDirective,
NgFooterTemplateDirective,
NgPlaceholderTemplateDirective,
NgNotFoundTemplateDirective,
NgTypeToSearchTemplateDirective,
NgLoadingTextTemplateDirective,
NgTagTemplateDirective,
NgLoadingSpinnerTemplateDirective,
NgClearButtonTemplateDirective
]
});
}
static {
this.ɵinj = i0.ɵɵngDeclareInjector({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgSelectModule,
providers: provideNgSelect()
});
}
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.0",
ngImport: i0,
type: NgSelectModule,
decorators: [{
type: NgModule,
args: [{
imports: [
NgDropdownPanelComponent,
NgOptionComponent,
NgSelectComponent,
NgOptgroupTemplateDirective,
NgOptionTemplateDirective,
NgLabelTemplateDirective,
NgMultiLabelTemplateDirective,
NgHeaderTemplateDirective,
NgFooterTemplateDirective,
NgPlaceholderTemplateDirective,
NgClearButtonTemplateDirective,
NgNotFoundTemplateDirective,
NgTypeToSearchTemplateDirective,
NgLoadingTextTemplateDirective,
NgTagTemplateDirective,
NgLoadingSpinnerTemplateDirective,
NgItemLabelDirective
],
exports: [
NgSelectComponent,
NgOptionComponent,
NgOptgroupTemplateDirective,
NgOptionTemplateDirective,
NgLabelTemplateDirective,
NgMultiLabelTemplateDirective,
NgHeaderTemplateDirective,
NgFooterTemplateDirective,
NgPlaceholderTemplateDirective,
NgNotFoundTemplateDirective,
NgTypeToSearchTemplateDirective,
NgLoadingTextTemplateDirective,
NgTagTemplateDirective,
NgLoadingSpinnerTemplateDirective,
NgClearButtonTemplateDirective
],
providers: provideNgSelect()
}]
}]
});
function provideNgSelect() {
return [{
provide: SELECTION_MODEL_FACTORY,
useValue: DefaultSelectionModelFactory
}];
}
export { ConsoleService, DefaultSelectionModel, DefaultSelectionModelFactory, NgClearButtonTemplateDirective, NgDropdownPanelComponent, NgDropdownPanelService, NgFooterTemplateDirective, NgHeaderTemplateDirective, NgItemLabelDirective, NgLabelTemplateDirective, NgLoadingSpinnerTemplateDirective, NgLoadingTextTemplateDirective, NgMultiLabelTemplateDirective, NgNotFoundTemplateDirective, NgOptgroupTemplateDirective, NgOptionComponent, NgOptionTemplateDirective, NgPlaceholderTemplateDirective, NgSelectComponent, NgSelectConfig, NgSelectModule, NgTagTemplateDirective, NgTypeToSearchTemplateDirective, SELECTION_MODEL_FACTORY };
//# sourceMappingURL=ng-select-ng-select.mjs.map