ng-select2-component 17.3.2 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,17 +1,13 @@
1
1
  {
2
2
  "name": "ng-select2-component",
3
- "version": "17.3.2",
3
+ "version": "19.0.0",
4
4
  "description": "An Angular select2 component.",
5
5
  "author": "York Yao, Célian Veyssière",
6
6
  "license": "MIT",
7
- "dependencies": {
8
- "ngx-infinite-scroll": ">=18.0.0 || >=19.0.0 || >=20.0.0 || >=21.0.0",
9
- "tslib": "^2.3.0"
10
- },
11
7
  "peerDependencies": {
12
- "@angular/cdk": ">=18.1.0 || >=19.0.0 || >=20.0.0 || >=21.0.0",
13
- "@angular/common": ">=18.1.0 || >=19.0.0 || >=20.0.0 || >=21.0.0",
14
- "@angular/core": ">=18.1.0 || >=19.0.0 || >=20.0.0 || >=21.0.0"
8
+ "@angular/cdk": ">=22.0.0",
9
+ "@angular/common": ">=22.0.0",
10
+ "@angular/core": ">=22.0.0"
15
11
  },
16
12
  "repository": {
17
13
  "type": "git",
@@ -34,15 +30,19 @@
34
30
  "select"
35
31
  ],
36
32
  "module": "fesm2022/ng-select2-component.mjs",
37
- "typings": "index.d.ts",
33
+ "typings": "types/ng-select2-component.d.ts",
38
34
  "exports": {
39
35
  "./package.json": {
40
36
  "default": "./package.json"
41
37
  },
42
38
  ".": {
43
- "types": "./index.d.ts",
39
+ "types": "./types/ng-select2-component.d.ts",
44
40
  "default": "./fesm2022/ng-select2-component.mjs"
45
41
  }
46
42
  },
47
- "sideEffects": false
43
+ "sideEffects": false,
44
+ "type": "module",
45
+ "dependencies": {
46
+ "tslib": "^2.3.0"
47
+ }
48
48
  }
@@ -0,0 +1,599 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { ElementRef, OnInit, DoCheck, AfterViewInit, OnDestroy, OnChanges, TemplateRef, SimpleChanges, PipeTransform } from '@angular/core';
3
+ import { CdkDragDrop } from '@angular/cdk/drag-drop';
4
+ import { CdkConnectedOverlay, ConnectionPositionPair } from '@angular/cdk/overlay';
5
+ import { ViewportRuler } from '@angular/cdk/scrolling';
6
+ import { ControlValueAccessor, NgControl } from '@angular/forms';
7
+ import { SafeHtml } from '@angular/platform-browser';
8
+
9
+ declare const timeout = 200;
10
+ /**
11
+ * Latin - `[\u0300-\u036F]` matches combining diacritical marks:
12
+ * - `\u0300-\u036F`: grave, acute, circumflex, tilde, macron, breve, dot above, diaeresis, ring above, etc.
13
+ */
14
+ declare const latinDiacritical: {
15
+ tmp: string;
16
+ pattern: string;
17
+ };
18
+ /**
19
+ * Arabic - `[\u064B-\u0652\u0670]` matches Arabic diacritics (harakat):
20
+ * - `\u064B-\u0652`: fatha, damma, kasra, sukun, shadda, tanwin, etc.
21
+ * - `\u0670`: alif khanjariyah (superscript alif)
22
+ */
23
+ declare const arabicDiacritical: {
24
+ tmp: string;
25
+ pattern: string;
26
+ };
27
+ /**
28
+ * Hebrew - `[\u05B0-\u05BC\u05C1\u05C2]` matches Hebrew diacritics (niqqud):
29
+ * - `\u05B0-\u05BC`: vowel points (sheva, hataf, hiriq, tsere, segol, patah, qamats, holam, qubuts, dagesh, etc.)
30
+ * - `\u05C1-\u05C2`: shin dot (right) and sin dot (left)
31
+ */
32
+ declare const hebrewDiacritical: {
33
+ tmp: string;
34
+ pattern: string;
35
+ };
36
+ declare const unicodePatterns: {
37
+ l: string;
38
+ s: RegExp;
39
+ e?: string;
40
+ d?: {
41
+ tmp: string;
42
+ pattern: string;
43
+ };
44
+ }[];
45
+ declare const defaultMinCountForSearch = 6;
46
+ declare const protectRegexp: RegExp;
47
+
48
+ /**
49
+ * Shared base for the <ng-option> and <ng-group> directives.
50
+ *
51
+ * Holds the inputs common to both (classes, templateId, data, dir) and the projected-content
52
+ * reactivity: plain text content (interpolation in the element body) is not a tracked signal, so
53
+ * the host component dirty-checks it in ngDoCheck and pushes changes into {@link _projectedContent},
54
+ * which the rebuild effect depends on through {@link _resolveLabel}.
55
+ */
56
+ declare abstract class Select2ContentDirective {
57
+ protected readonly _elementRef: ElementRef<any>;
58
+ /** Additional CSS classes */
59
+ readonly classes: _angular_core.InputSignal<string | undefined>;
60
+ /** Template id */
61
+ readonly templateId: _angular_core.InputSignal<string | undefined>;
62
+ /** Arbitrary data attached to the option/group */
63
+ readonly data: _angular_core.InputSignal<any>;
64
+ /** Force text direction */
65
+ readonly dir: _angular_core.InputSignal<"ltr" | "rtl" | undefined>;
66
+ /**
67
+ * Reactive trigger for the projected text content (interpolation in the element body).
68
+ * The host component dirty-checks the DOM in its ngDoCheck and updates this signal when the
69
+ * rendered text changes, so the component's rebuild effect re-runs even though plain text
70
+ * content is not otherwise a tracked dependency.
71
+ */
72
+ readonly _projectedContent: _angular_core.WritableSignal<string | undefined>;
73
+ /** Read the host element's rendered text content (innerHTML, then textContent, then ''). */
74
+ private _readContent;
75
+ /**
76
+ * Re-read the host element's rendered content and update {@link _projectedContent} when it
77
+ * changed. Returns true if a change was detected. Called from the host component's ngDoCheck.
78
+ */
79
+ _refreshProjectedContent(): boolean;
80
+ /**
81
+ * Resolve the label: prefer the explicit [label] input, then the cached projected content,
82
+ * then a one-off DOM read. Reading _projectedContent() registers it as a dependency of the
83
+ * rebuild effect so interpolation/content changes propagate; the cached value avoids a second
84
+ * DOM read, and _readContent() only runs on the initial pass.
85
+ */
86
+ protected _resolveLabel(label: string | undefined): string;
87
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Select2ContentDirective, never>;
88
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Select2ContentDirective, never, never, { "classes": { "alias": "classes"; "required": false; "isSignal": true; }; "templateId": { "alias": "templateId"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "dir": { "alias": "dir"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
89
+ }
90
+
91
+ /**
92
+ * Directive representing a single option inside a <ng-select2> or <ng-group>.
93
+ *
94
+ * Usage:
95
+ * ```html
96
+ * <ng-select2>
97
+ * <ng-option value="foo">Foo</ng-option>
98
+ * <ng-option value="bar" [disabled]="true">Bar</ng-option>
99
+ * </ng-select2>
100
+ * ```
101
+ */
102
+ declare class Select2OptionDirective extends Select2ContentDirective {
103
+ /** The option value */
104
+ readonly value: _angular_core.InputSignal<Select2Value>;
105
+ /** Explicit label — falls back to the element's text content if omitted */
106
+ readonly label: _angular_core.InputSignal<string | undefined>;
107
+ /** Whether the option is disabled */
108
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
109
+ /** Template selection id */
110
+ readonly templateSelectionId: _angular_core.InputSignal<string | undefined>;
111
+ /** Hide this option */
112
+ readonly hide: _angular_core.InputSignalWithTransform<boolean, unknown>;
113
+ /** Build a plain Select2Option object from the current input values */
114
+ toOption(): Select2Option;
115
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Select2OptionDirective, never>;
116
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Select2OptionDirective, "ng-option", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "templateSelectionId": { "alias": "templateSelectionId"; "required": false; "isSignal": true; }; "hide": { "alias": "hide"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
117
+ }
118
+
119
+ declare class Select2 implements ControlValueAccessor, OnInit, DoCheck, AfterViewInit, OnDestroy, OnChanges {
120
+ protected _viewportRuler: ViewportRuler;
121
+ private _changeDetectorRef;
122
+ private _parentForm;
123
+ private _parentFormGroup;
124
+ _control: NgControl | null;
125
+ readonly _uid: string;
126
+ /** data of options & option groups */
127
+ readonly data: _angular_core.InputSignal<Select2Data>;
128
+ /** minimum characters to start filter search */
129
+ readonly minCharForSearch: _angular_core.InputSignalWithTransform<number, unknown>;
130
+ /** text placeholder */
131
+ readonly displaySearchStatus: _angular_core.InputSignal<"default" | "hidden" | "always" | undefined>;
132
+ /** text placeholder */
133
+ readonly placeholder: _angular_core.InputSignal<string | undefined>;
134
+ /** in multiple: maximum selection element (0 = no limit) */
135
+ readonly limitSelection: _angular_core.InputSignalWithTransform<number, unknown>;
136
+ /** dropdown position */
137
+ readonly listPosition: _angular_core.InputSignal<"above" | "below" | "auto">;
138
+ /** overlay with CDK Angular position */
139
+ readonly overlay: _angular_core.InputSignalWithTransform<boolean, unknown>;
140
+ /** select one or more item */
141
+ readonly multiple: _angular_core.InputSignalWithTransform<boolean, unknown>;
142
+ /** drag'n drop list of items in multiple */
143
+ readonly multipleDrag: _angular_core.InputSignalWithTransform<boolean, unknown>;
144
+ /** use the material style */
145
+ readonly styleMode: _angular_core.InputSignal<"default" | "material" | "noStyle" | "borderless">;
146
+ /** message when no result */
147
+ readonly noResultMessage: _angular_core.InputSignal<string | undefined>;
148
+ /** maximum results limit (0 = no limit) */
149
+ readonly maxResults: _angular_core.InputSignalWithTransform<number, unknown>;
150
+ /** message when maximum results */
151
+ readonly maxResultsMessage: _angular_core.InputSignal<string>;
152
+ /** infinite scroll distance */
153
+ readonly infiniteScrollDistance: _angular_core.InputSignalWithTransform<number, unknown>;
154
+ /** infinite scroll distance */
155
+ readonly infiniteScrollThrottle: _angular_core.InputSignalWithTransform<number, unknown>;
156
+ /** infinite scroll activated */
157
+ readonly infiniteScroll: _angular_core.InputSignalWithTransform<boolean, unknown>;
158
+ /** auto create if not exist */
159
+ readonly autoCreate: _angular_core.InputSignalWithTransform<boolean, unknown>;
160
+ /** no template for label selection */
161
+ readonly noLabelTemplate: _angular_core.InputSignalWithTransform<boolean, unknown>;
162
+ /** use it for change the pattern of the filter search */
163
+ readonly editPattern: _angular_core.InputSignal<((str: string) => string) | undefined>;
164
+ /** template(s) for formatting */
165
+ readonly templates: _angular_core.InputSignal<Select2Template>;
166
+ /** template for formatting selected option */
167
+ readonly templateSelection: _angular_core.InputSignal<TemplateRef<any> | undefined>;
168
+ /** the max height of the results container when opening the select */
169
+ readonly resultMaxHeight: _angular_core.InputSignal<string>;
170
+ /** Active Search event */
171
+ readonly customSearchEnabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
172
+ /** minimal data of show the search field */
173
+ readonly minCountForSearch: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
174
+ /** Unique id of the element. */
175
+ readonly id: _angular_core.InputSignal<string>;
176
+ /** Unique id of label element. */
177
+ readonly idLabel: _angular_core.Signal<string>;
178
+ /** Unique id of combo element. */
179
+ readonly idCombo: _angular_core.Signal<string>;
180
+ /** Unique id of options element. */
181
+ readonly idOptions: _angular_core.Signal<string>;
182
+ /** Unique id of overlay element. */
183
+ readonly idOverlay: _angular_core.Signal<string>;
184
+ /** Whether the element is required. */
185
+ readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
186
+ /** Whether selected items should be hidden. */
187
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
188
+ /** Whether items are hidden when has. */
189
+ readonly hideSelectedItems: _angular_core.InputSignalWithTransform<boolean, unknown>;
190
+ /** Whether the element is readonly. */
191
+ readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
192
+ /** The input element's value. */
193
+ readonly value: _angular_core.InputSignal<Select2UpdateValue>;
194
+ /** Tab index for the select2 element. */
195
+ readonly tabIndex: _angular_core.InputSignalWithTransform<number, unknown>;
196
+ /** reset with no selected value */
197
+ readonly resettable: _angular_core.InputSignalWithTransform<boolean, unknown>;
198
+ /** selected value when × is clicked */
199
+ readonly resetSelectedValue: _angular_core.InputSignal<any>;
200
+ /** like native select keyboard navigation (only single mode) */
201
+ readonly nativeKeyboard: _angular_core.InputSignalWithTransform<boolean, unknown>;
202
+ /** highlight search text */
203
+ readonly highlightText: _angular_core.InputSignalWithTransform<boolean, unknown>;
204
+ /** grid: item by line
205
+ * * 0 = no grid
206
+ * * number = item by line (4)
207
+ * * string = minimal size item (100px)
208
+ */
209
+ readonly grid: _angular_core.InputSignal<string>;
210
+ /**
211
+ * Replace selection by a text
212
+ * * if string: `%size%` = total selected options
213
+ * * if function: juste show the string
214
+ */
215
+ readonly selectionOverride: _angular_core.InputSignal<Select2SelectionOverride | undefined>;
216
+ /** force selection on one line */
217
+ readonly selectionNoWrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
218
+ /** Add an option to select or remove all (if all is selected) */
219
+ readonly showSelectAll: _angular_core.InputSignalWithTransform<boolean, unknown>;
220
+ /** Show a checkbox next to each option */
221
+ readonly showOptionCheckbox: _angular_core.InputSignalWithTransform<boolean, unknown>;
222
+ /** Text for remove all options */
223
+ readonly removeAllText: _angular_core.InputSignal<string>;
224
+ /** Text for select all options */
225
+ readonly selectAllText: _angular_core.InputSignal<string>;
226
+ /** title attribute applied to the input */
227
+ readonly title: _angular_core.InputSignal<string | undefined>;
228
+ /** aria-labelledby attribute applied to the input, to specify en external label */
229
+ readonly ariaLabelledby: _angular_core.InputSignal<string | undefined>;
230
+ /** aria-describedby attribute applied to the input */
231
+ readonly ariaDescribedby: _angular_core.InputSignal<string | undefined>;
232
+ /** aria-invalid attribute applied to the input, to force error state */
233
+ readonly ariaInvalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
234
+ /** description of the reset button when using 'resettable'. Default value : 'Reset' */
235
+ readonly ariaResetButtonDescription: _angular_core.InputSignal<string>;
236
+ readonly update: _angular_core.OutputEmitterRef<Select2UpdateEvent<Select2UpdateValue>>;
237
+ readonly autoCreateItem: _angular_core.OutputEmitterRef<Select2AutoCreateEvent<Select2UpdateValue>>;
238
+ readonly open: _angular_core.OutputEmitterRef<Select2>;
239
+ readonly close: _angular_core.OutputEmitterRef<Select2>;
240
+ readonly focus: _angular_core.OutputEmitterRef<Select2>;
241
+ readonly blur: _angular_core.OutputEmitterRef<Select2>;
242
+ readonly search: _angular_core.OutputEmitterRef<Select2SearchEvent<Select2UpdateValue>>;
243
+ readonly scroll: _angular_core.OutputEmitterRef<Select2ScrollEvent>;
244
+ readonly removeOption: _angular_core.OutputEmitterRef<Select2RemoveEvent<Select2UpdateValue>>;
245
+ readonly cdkConnectedOverlay: _angular_core.Signal<CdkConnectedOverlay>;
246
+ readonly selection: _angular_core.Signal<ElementRef<HTMLElement>>;
247
+ readonly resultContainer: _angular_core.Signal<ElementRef<HTMLElement> | undefined>;
248
+ readonly results: _angular_core.Signal<readonly ElementRef<any>[]>;
249
+ readonly searchInput: _angular_core.Signal<ElementRef<HTMLElement> | undefined>;
250
+ readonly dropdown: _angular_core.Signal<ElementRef<HTMLElement> | undefined>;
251
+ /** Top-level <ng-option> elements (not inside a <ng-group>) */
252
+ readonly _ngOptions: _angular_core.Signal<readonly Select2OptionDirective[]>;
253
+ /** <ng-group> elements */
254
+ readonly _ngGroups: _angular_core.Signal<readonly Select2GroupDirective[]>;
255
+ readonly classMaterial: _angular_core.Signal<boolean>;
256
+ readonly classNostyle: _angular_core.Signal<boolean>;
257
+ readonly classBorderless: _angular_core.Signal<boolean>;
258
+ readonly select2above: _angular_core.Signal<boolean>;
259
+ selectedOption: Select2Option | Select2Option[] | null;
260
+ isOpen: boolean;
261
+ searchStyle: string | undefined;
262
+ /** Whether the element is focused or not. */
263
+ focused: boolean;
264
+ filteredData: _angular_core.WritableSignal<Select2Data | undefined>;
265
+ get select2Options(): Select2Option[];
266
+ get select2Option(): Select2Option | null;
267
+ get searchText(): string;
268
+ protected set searchText(text: string);
269
+ get disabledState(): boolean;
270
+ protected overlayWidth: number | string;
271
+ protected overlayHeight: number | string;
272
+ protected _triggerRect: DOMRect | undefined;
273
+ protected _dropdownRect: DOMRect | undefined;
274
+ protected readonly _positions: _angular_core.Signal<ConnectionPositionPair[]>;
275
+ protected maxResultsExceeded: boolean | undefined;
276
+ private hoveringOption;
277
+ hoveringOptionId: _angular_core.Signal<string | null>;
278
+ private innerSearchText;
279
+ protected isSearchboxHidden: boolean | undefined;
280
+ private selectionElement;
281
+ private get resultsElement();
282
+ private _stateChanges;
283
+ /** Tab index for the element. */
284
+ protected get _tabIndex(): number;
285
+ private _data;
286
+ private _disabled;
287
+ private _destroyed;
288
+ protected _value: Select2UpdateValue | null;
289
+ private _previousNativeValue;
290
+ private _overlayPosition;
291
+ private toObservable;
292
+ constructor();
293
+ ngOnChanges(changes: SimpleChanges): void;
294
+ clickDetection(e: MouseEvent): void;
295
+ /** View -> model callback called when select has been touched */
296
+ private _onTouched;
297
+ /** View -> model callback called when value changes */
298
+ private _onChange;
299
+ _onViewportChange(): void;
300
+ ngOnInit(): void;
301
+ ngAfterViewInit(): void;
302
+ ngDoCheck(): void;
303
+ ngOnDestroy(): void;
304
+ /**
305
+ * Template mode only: dirty-check the rendered text content of every projected <ng-option>
306
+ * (top-level and nested in <ng-group>) so interpolation changes ({{ }}) are picked up.
307
+ * Updating an option's _projectedContent signal re-triggers the data rebuild effect.
308
+ */
309
+ private _refreshProjectedContent;
310
+ fixValue(): void;
311
+ updateSearchBox(): void;
312
+ getOptionStyle(option: Select2Option): string;
313
+ mouseenter(option: Select2Option): void;
314
+ click(option: Select2Option): void;
315
+ reset(event?: MouseEvent): void;
316
+ prevChange(event: Event): void;
317
+ stopEvent(event: Event): void;
318
+ toggleOpenAndClose(focus?: boolean, open?: boolean, event?: KeyboardEvent): void;
319
+ hasTemplate(option: Select2Option | Select2Group, defaultValue: string, select?: boolean): boolean;
320
+ getTemplate(option: Select2Option | Select2Group, defaultValue: string, select?: boolean): any;
321
+ getContext(option: Select2Option): {
322
+ searchText: string;
323
+ highlightText: boolean;
324
+ value: Select2Value;
325
+ label: string;
326
+ disabled?: boolean;
327
+ id?: string;
328
+ classes?: string;
329
+ templateId?: string;
330
+ templateSelectionId?: string;
331
+ data?: any;
332
+ hide?: boolean;
333
+ dir?: "ltr" | "rtl";
334
+ };
335
+ triggerRect(): void;
336
+ isNumber(o: any): boolean;
337
+ selectAll(): void;
338
+ selectAllTest(): boolean;
339
+ private testSelection;
340
+ private testValueChange;
341
+ private updateFilteredData;
342
+ private clickExit;
343
+ private isInSelect;
344
+ private ifParentContainsClass;
345
+ private ifParentContainsId;
346
+ private getParentElementByClass;
347
+ private getParentElementById;
348
+ private containClasses;
349
+ private containAlmostOneClasses;
350
+ private clickOnSelect2Element;
351
+ focusin(options?: FocusOptions): void;
352
+ focusout(event: FocusEvent): void;
353
+ select(option: Select2Option | null, emit?: boolean, closeOnSelect?: boolean): void;
354
+ private testDiffValue;
355
+ keyDown(event: KeyboardEvent, create?: boolean): void;
356
+ private actionAfterKeyDownMoveAction;
357
+ openKey(event: KeyboardEvent, create?: boolean): void;
358
+ private _closeOnKey;
359
+ private _shouldKeyDownOnOpen;
360
+ private _handleOnOpenAction;
361
+ private _scrollToInitialOption;
362
+ searchUpdate(e: Event): void;
363
+ isSelected(option: Select2Option): "true" | "false";
364
+ isDisabled(option: Select2Option): "true" | "false";
365
+ removeSelection(e: MouseEvent | KeyboardEvent | Event, option: Select2Option): void;
366
+ /**
367
+ * Sets the model value. Implemented as part of ControlValueAccessor.
368
+ * @param value
369
+ */
370
+ writeValue(value: any): void;
371
+ /**
372
+ * Saves a callback function to be invoked when the select's value
373
+ * changes from user input. Part of the ControlValueAccessor interface
374
+ * required to integrate with Angular's core forms API.
375
+ *
376
+ * @param fn Callback to be triggered when the value changes.
377
+ */
378
+ registerOnChange(fn: (value: any) => void): void;
379
+ /**
380
+ * Saves a callback function to be invoked when the select is blurred
381
+ * by the user. Part of the ControlValueAccessor interface required
382
+ * to integrate with Angular's core forms API.
383
+ *
384
+ * @param fn Callback to be triggered when the component has been touched.
385
+ */
386
+ registerOnTouched(fn: () => void): void;
387
+ /**
388
+ * Sets whether the component should be disabled.
389
+ * Implemented as part of ControlValueAccessor.
390
+ * @param isDisabled
391
+ */
392
+ setDisabledState(isDisabled: boolean): void;
393
+ onScroll(way: 'up' | 'down'): void;
394
+ private _setupScrollListener;
395
+ _onScrollEvent(scrollTop: number, clientHeight: number, scrollHeight: number): void;
396
+ drop(event: CdkDragDrop<string[], string[], any>): void;
397
+ _isErrorState(): boolean;
398
+ private _isFormSubmitted;
399
+ _selectionOverrideLabel(): string | undefined;
400
+ getElementId(elt: Select2Group | Select2Option | null): string | null;
401
+ private _toSuffix;
402
+ _getElementPath(elt: Select2Group | Select2Option): number[];
403
+ _toGroup(group: Select2Option | Select2Group): Select2Group;
404
+ _toOption(option: Select2Option | Select2Group): Select2Option;
405
+ private updateEvent;
406
+ private optionsSize;
407
+ private addItem;
408
+ private createAndAdd;
409
+ private moveUp;
410
+ private moveDown;
411
+ private moveStart;
412
+ private moveEnd;
413
+ private updateScrollFromOption;
414
+ private selectByEnter;
415
+ private _testKey;
416
+ /**
417
+ * Sets the selected option based on a value. If no option can be
418
+ * found with the designated value, the select trigger is cleared.
419
+ */
420
+ private _setSelectionByValue;
421
+ private _preselectArrayValue;
422
+ /** Does some manual dirty checking on the native input `value` property. */
423
+ private _dirtyCheckNativeValue;
424
+ private _focusSearchbox;
425
+ private _focus;
426
+ private _isAbobeOverlay;
427
+ _updateFocusState(state: boolean): void;
428
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Select2, never>;
429
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<Select2, "select2, ng-select2", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "minCharForSearch": { "alias": "minCharForSearch"; "required": false; "isSignal": true; }; "displaySearchStatus": { "alias": "displaySearchStatus"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "limitSelection": { "alias": "limitSelection"; "required": false; "isSignal": true; }; "listPosition": { "alias": "listPosition"; "required": false; "isSignal": true; }; "overlay": { "alias": "overlay"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "multipleDrag": { "alias": "multipleDrag"; "required": false; "isSignal": true; }; "styleMode": { "alias": "styleMode"; "required": false; "isSignal": true; }; "noResultMessage": { "alias": "noResultMessage"; "required": false; "isSignal": true; }; "maxResults": { "alias": "maxResults"; "required": false; "isSignal": true; }; "maxResultsMessage": { "alias": "maxResultsMessage"; "required": false; "isSignal": true; }; "infiniteScrollDistance": { "alias": "infiniteScrollDistance"; "required": false; "isSignal": true; }; "infiniteScrollThrottle": { "alias": "infiniteScrollThrottle"; "required": false; "isSignal": true; }; "infiniteScroll": { "alias": "infiniteScroll"; "required": false; "isSignal": true; }; "autoCreate": { "alias": "autoCreate"; "required": false; "isSignal": true; }; "noLabelTemplate": { "alias": "noLabelTemplate"; "required": false; "isSignal": true; }; "editPattern": { "alias": "editPattern"; "required": false; "isSignal": true; }; "templates": { "alias": "templates"; "required": false; "isSignal": true; }; "templateSelection": { "alias": "templateSelection"; "required": false; "isSignal": true; }; "resultMaxHeight": { "alias": "resultMaxHeight"; "required": false; "isSignal": true; }; "customSearchEnabled": { "alias": "customSearchEnabled"; "required": false; "isSignal": true; }; "minCountForSearch": { "alias": "minCountForSearch"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "hideSelectedItems": { "alias": "hideSelectedItems"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "tabIndex": { "alias": "tabIndex"; "required": false; "isSignal": true; }; "resettable": { "alias": "resettable"; "required": false; "isSignal": true; }; "resetSelectedValue": { "alias": "resetSelectedValue"; "required": false; "isSignal": true; }; "nativeKeyboard": { "alias": "nativeKeyboard"; "required": false; "isSignal": true; }; "highlightText": { "alias": "highlightText"; "required": false; "isSignal": true; }; "grid": { "alias": "grid"; "required": false; "isSignal": true; }; "selectionOverride": { "alias": "selectionOverride"; "required": false; "isSignal": true; }; "selectionNoWrap": { "alias": "selectionNoWrap"; "required": false; "isSignal": true; }; "showSelectAll": { "alias": "showSelectAll"; "required": false; "isSignal": true; }; "showOptionCheckbox": { "alias": "showOptionCheckbox"; "required": false; "isSignal": true; }; "removeAllText": { "alias": "removeAllText"; "required": false; "isSignal": true; }; "selectAllText": { "alias": "selectAllText"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "ariaLabelledby"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "ariaDescribedby"; "required": false; "isSignal": true; }; "ariaInvalid": { "alias": "ariaInvalid"; "required": false; "isSignal": true; }; "ariaResetButtonDescription": { "alias": "ariaResetButtonDescription"; "required": false; "isSignal": true; }; }, { "update": "update"; "autoCreateItem": "autoCreateItem"; "open": "open"; "close": "close"; "focus": "focus"; "blur": "blur"; "search": "search"; "scroll": "scroll"; "removeOption": "removeOption"; }, ["_ngOptions", "_ngGroups"], ["select2-label, ng-select2-label", "select2-hint, ng-select2-hint"], true, never>;
430
+ }
431
+
432
+ interface Select2Group {
433
+ /** for identification */
434
+ id?: string;
435
+ /** label of group */
436
+ label: string;
437
+ /** options list */
438
+ options: Select2Option[];
439
+ /** add classes */
440
+ classes?: string;
441
+ /** template id dropdown & selection if no templateSelectionId */
442
+ templateId?: string;
443
+ /** template data */
444
+ data?: any;
445
+ /** force left to right or right to left */
446
+ dir?: 'ltr' | 'rtl';
447
+ }
448
+ interface Select2Option {
449
+ /** value */
450
+ value: Select2Value;
451
+ /** label of option */
452
+ label: string;
453
+ /** no selectable is disabled */
454
+ disabled?: boolean;
455
+ /** for identification */
456
+ id?: string;
457
+ /** add classes */
458
+ classes?: string;
459
+ /** template id dropdown & selection if no templateSelectionId */
460
+ templateId?: string;
461
+ /** template id for selection */
462
+ templateSelectionId?: string;
463
+ /** template data */
464
+ data?: any;
465
+ /** hide this option */
466
+ hide?: boolean;
467
+ /** force left to right or right to left */
468
+ dir?: 'ltr' | 'rtl';
469
+ }
470
+ type Select2Value = string | number | boolean | object | null | undefined;
471
+ type Select2UpdateValue = Select2Value | Select2Value[] | undefined | null;
472
+ type Select2Data = (Select2Group | Select2Option)[];
473
+ interface Select2UpdateEvent<U extends Select2UpdateValue = Select2Value> {
474
+ /** component */
475
+ readonly component: Select2;
476
+ /** current selected value */
477
+ readonly value: U | null;
478
+ /** selected option */
479
+ readonly options: Select2Option[] | null;
480
+ }
481
+ interface Select2AutoCreateEvent<U extends Select2UpdateValue = Select2Value> {
482
+ /** component */
483
+ readonly component: Select2;
484
+ /** current selected value */
485
+ readonly value: U;
486
+ /** selected option */
487
+ readonly options: Select2Option[] | null;
488
+ }
489
+ interface Select2SearchEvent<U extends Select2UpdateValue = Select2Value> {
490
+ /** component */
491
+ readonly component: Select2;
492
+ /** current selected value */
493
+ readonly value: U | null;
494
+ /** search text */
495
+ readonly search: string;
496
+ /** current data source */
497
+ readonly data: Select2Data;
498
+ /** method to call to update the data */
499
+ readonly filteredData: (data: Select2Data) => void;
500
+ }
501
+ interface Select2RemoveEvent<U extends Select2UpdateValue = Select2Value> {
502
+ /** component */
503
+ readonly component: Select2;
504
+ /** current selected value */
505
+ readonly value: U;
506
+ /** remove */
507
+ readonly removedOption: Select2Option;
508
+ }
509
+ interface Select2ScrollEvent {
510
+ /** component */
511
+ readonly component: Select2;
512
+ /** scroll way */
513
+ readonly way: 'up' | 'down';
514
+ /** search text */
515
+ readonly search: string;
516
+ /** current data */
517
+ readonly data: Select2Data;
518
+ }
519
+ type Select2SelectionOverride = string | ((params: {
520
+ size: number;
521
+ options: Select2Option[] | null;
522
+ }) => string);
523
+ type Select2Template = TemplateRef<any> | {
524
+ [key: string]: TemplateRef<any>;
525
+ } | undefined;
526
+
527
+ /**
528
+ * Directive representing an option group inside a <ng-select2>.
529
+ *
530
+ * Usage:
531
+ * ```html
532
+ * <ng-select2>
533
+ * <ng-group label="Fruits">
534
+ * <ng-option value="apple">Apple</ng-option>
535
+ * <ng-option value="banana">Banana</ng-option>
536
+ * </ng-group>
537
+ * </ng-select2>
538
+ * ```
539
+ */
540
+ declare class Select2GroupDirective extends Select2ContentDirective {
541
+ /** The group label (required) */
542
+ readonly label: _angular_core.InputSignal<string>;
543
+ /** Child <ng-option> directives nested inside this group */
544
+ readonly _ngOptions: _angular_core.Signal<readonly Select2OptionDirective[]>;
545
+ /** Build a plain Select2Group object from the current input values */
546
+ toGroup(): Select2Group;
547
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Select2GroupDirective, never>;
548
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Select2GroupDirective, "ng-group", never, { "label": { "alias": "label"; "required": true; "isSignal": true; }; }, {}, ["_ngOptions"], never, true, never>;
549
+ }
550
+
551
+ declare class Select2HighlightPipe implements PipeTransform {
552
+ private readonly sanitizer;
553
+ transform(value: string | null | undefined, search: string | null | undefined, disabled?: boolean): SafeHtml | string;
554
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Select2HighlightPipe, never>;
555
+ static ɵpipe: _angular_core.ɵɵPipeDeclaration<Select2HighlightPipe, "highlightText", true>;
556
+ }
557
+
558
+ declare class Select2Hint {
559
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Select2Hint, never>;
560
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Select2Hint, "select2-hint, ng-select2-hint", never, {}, {}, never, never, true, never>;
561
+ }
562
+
563
+ declare class Select2Label {
564
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Select2Label, never>;
565
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Select2Label, "select2-label, ng-select2-label", never, {}, {}, never, never, true, never>;
566
+ }
567
+
568
+ declare class Select2Utils {
569
+ static getOptionByValue(data: Select2Data, value: Select2Value): Select2Option | null;
570
+ static getOptionsByValue(data: Select2Data, value: Select2UpdateValue | null | undefined, multiple: boolean | null | undefined): Select2Option | Select2Option[] | null;
571
+ static getFirstAvailableOption(data: Select2Data): Select2Option | null;
572
+ static optionIsNotInFilteredData(filteredData: Select2Data, option: Select2Option | null): boolean;
573
+ static getPreviousOption(filteredData: Select2Data, hoveringOption: Select2Option | null): Select2Option | null;
574
+ static getNextOption(filteredData: Select2Data | null, hoveringOption: Select2Option | null): Select2Option | null;
575
+ static getFirstOption(filteredData: Select2Data): Select2Option | null;
576
+ static getLastOption(filteredData: Select2Data): Select2Option | null;
577
+ static isGroup(element: Select2Group | Select2Option): element is Select2Group;
578
+ static isOption(element: Select2Group | Select2Option): element is Select2Option;
579
+ static getReduceData(data: Select2Data, maxResults?: number): {
580
+ result: Select2Data;
581
+ reduce: boolean;
582
+ };
583
+ static getFilteredData(data: Select2Data, searchText: string | null, editPattern?: (str: string) => string): Select2Data;
584
+ static getFilteredSelectedData(data: Select2Data, selectedOptions: Select2Option | Select2Option[] | null): Select2Data;
585
+ static isSearchboxHidden(data: Select2Data, minCountForSearch?: number): boolean;
586
+ static isSelected(options: Select2Option | Select2Option[] | null, option: Select2Option, multiple: boolean | null | undefined): "true" | "false";
587
+ static removeSelection(options: Select2Option | Select2Option[] | null, option: Select2Option): void;
588
+ private static getOptionsCount;
589
+ private static isNullOrUndefined;
590
+ private static containSearchText;
591
+ static protectPattern(str: string): string;
592
+ private static formatSansUnicode;
593
+ static patternUnicode(str: string): string;
594
+ static formatPattern(str: string, editPattern?: (str: string) => string): string;
595
+ }
596
+
597
+ export { Select2, Select2ContentDirective, Select2GroupDirective, Select2HighlightPipe, Select2Hint, Select2Label, Select2OptionDirective, Select2Utils, arabicDiacritical, defaultMinCountForSearch, hebrewDiacritical, latinDiacritical, protectRegexp, timeout, unicodePatterns };
598
+ export type { Select2AutoCreateEvent, Select2Data, Select2Group, Select2Option, Select2RemoveEvent, Select2ScrollEvent, Select2SearchEvent, Select2SelectionOverride, Select2Template, Select2UpdateEvent, Select2UpdateValue, Select2Value };
599
+ //# sourceMappingURL=ng-select2-component.d.ts.map