@ng-select/ng-select 10.0.3 → 11.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.
Files changed (37) hide show
  1. package/README.md +1 -0
  2. package/esm2022/lib/config.service.mjs +22 -0
  3. package/esm2022/lib/console.service.mjs +15 -0
  4. package/esm2022/lib/ng-dropdown-panel.component.mjs +404 -0
  5. package/esm2022/lib/ng-dropdown-panel.service.mjs +69 -0
  6. package/esm2022/lib/ng-option.component.mjs +55 -0
  7. package/esm2022/lib/ng-select.component.mjs +995 -0
  8. package/esm2022/lib/ng-select.module.mjs +86 -0
  9. package/esm2022/lib/ng-templates.directive.mjs +169 -0
  10. package/{fesm2020 → fesm2022}/ng-select-ng-select.mjs +140 -137
  11. package/fesm2022/ng-select-ng-select.mjs.map +1 -0
  12. package/lib/ng-dropdown-panel.component.d.ts +1 -1
  13. package/lib/ng-option.component.d.ts +1 -1
  14. package/lib/ng-select.component.d.ts +4 -4
  15. package/lib/ng-select.types.d.ts +1 -1
  16. package/lib/ng-templates.directive.d.ts +1 -1
  17. package/lib/selection-model.d.ts +1 -1
  18. package/package.json +10 -16
  19. package/esm2020/lib/config.service.mjs +0 -21
  20. package/esm2020/lib/console.service.mjs +0 -14
  21. package/esm2020/lib/ng-dropdown-panel.component.mjs +0 -403
  22. package/esm2020/lib/ng-dropdown-panel.service.mjs +0 -68
  23. package/esm2020/lib/ng-option.component.mjs +0 -54
  24. package/esm2020/lib/ng-select.component.mjs +0 -991
  25. package/esm2020/lib/ng-select.module.mjs +0 -85
  26. package/esm2020/lib/ng-templates.directive.mjs +0 -157
  27. package/fesm2015/ng-select-ng-select.mjs +0 -3084
  28. package/fesm2015/ng-select-ng-select.mjs.map +0 -1
  29. package/fesm2020/ng-select-ng-select.mjs.map +0 -1
  30. /package/{esm2020 → esm2022}/lib/id.mjs +0 -0
  31. /package/{esm2020 → esm2022}/lib/items-list.mjs +0 -0
  32. /package/{esm2020 → esm2022}/lib/ng-select.types.mjs +0 -0
  33. /package/{esm2020 → esm2022}/lib/search-helper.mjs +0 -0
  34. /package/{esm2020 → esm2022}/lib/selection-model.mjs +0 -0
  35. /package/{esm2020 → esm2022}/lib/value-utils.mjs +0 -0
  36. /package/{esm2020 → esm2022}/ng-select-ng-select.mjs +0 -0
  37. /package/{esm2020 → esm2022}/public-api.mjs +0 -0
@@ -1,3084 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Directive, Input, Injectable, EventEmitter, ElementRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Optional, Inject, Output, ViewChild, InjectionToken, forwardRef, TemplateRef, Attribute, HostBinding, ContentChild, ContentChildren, HostListener, NgModule } from '@angular/core';
3
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
- import { takeUntil, auditTime, startWith, tap, debounceTime, filter, map } from 'rxjs/operators';
5
- import { animationFrameScheduler, asapScheduler, Subject, fromEvent, merge } from 'rxjs';
6
- import * as i3 from '@angular/common';
7
- import { DOCUMENT, CommonModule } from '@angular/common';
8
-
9
- const unescapedHTMLExp = /[&<>"']/g;
10
- const hasUnescapedHTMLExp = RegExp(unescapedHTMLExp.source);
11
- const htmlEscapes = {
12
- '&': '&amp;',
13
- '<': '&lt;',
14
- '>': '&gt;',
15
- '"': '&quot;',
16
- '\'': '&#39;'
17
- };
18
- function escapeHTML(value) {
19
- return (value && hasUnescapedHTMLExp.test(value)) ?
20
- value.replace(unescapedHTMLExp, chr => htmlEscapes[chr]) :
21
- value;
22
- }
23
- function isDefined(value) {
24
- return value !== undefined && value !== null;
25
- }
26
- function isObject(value) {
27
- return typeof value === 'object' && isDefined(value);
28
- }
29
- function isPromise(value) {
30
- return value instanceof Promise;
31
- }
32
- function isFunction(value) {
33
- return value instanceof Function;
34
- }
35
-
36
- class NgItemLabelDirective {
37
- constructor(element) {
38
- this.element = element;
39
- this.escape = true;
40
- }
41
- ngOnChanges(changes) {
42
- this.element.nativeElement.innerHTML = this.escape ?
43
- escapeHTML(this.ngItemLabel) :
44
- this.ngItemLabel;
45
- }
46
- }
47
- NgItemLabelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgItemLabelDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
48
- NgItemLabelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgItemLabelDirective, selector: "[ngItemLabel]", inputs: { ngItemLabel: "ngItemLabel", escape: "escape" }, usesOnChanges: true, ngImport: i0 });
49
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgItemLabelDirective, decorators: [{
50
- type: Directive,
51
- args: [{ selector: '[ngItemLabel]' }]
52
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { ngItemLabel: [{
53
- type: Input
54
- }], escape: [{
55
- type: Input
56
- }] } });
57
- // eslint-disable-next-line @angular-eslint/directive-selector
58
- class NgOptionTemplateDirective {
59
- constructor(template) {
60
- this.template = template;
61
- }
62
- }
63
- NgOptionTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgOptionTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
64
- NgOptionTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgOptionTemplateDirective, selector: "[ng-option-tmp]", ngImport: i0 });
65
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgOptionTemplateDirective, decorators: [{
66
- type: Directive,
67
- args: [{ selector: '[ng-option-tmp]' }]
68
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
69
- // eslint-disable-next-line @angular-eslint/directive-selector
70
- class NgOptgroupTemplateDirective {
71
- constructor(template) {
72
- this.template = template;
73
- }
74
- }
75
- NgOptgroupTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgOptgroupTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
76
- NgOptgroupTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgOptgroupTemplateDirective, selector: "[ng-optgroup-tmp]", ngImport: i0 });
77
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgOptgroupTemplateDirective, decorators: [{
78
- type: Directive,
79
- args: [{ selector: '[ng-optgroup-tmp]' }]
80
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
81
- // eslint-disable-next-line @angular-eslint/directive-selector
82
- class NgLabelTemplateDirective {
83
- constructor(template) {
84
- this.template = template;
85
- }
86
- }
87
- NgLabelTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgLabelTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
88
- NgLabelTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgLabelTemplateDirective, selector: "[ng-label-tmp]", ngImport: i0 });
89
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgLabelTemplateDirective, decorators: [{
90
- type: Directive,
91
- args: [{ selector: '[ng-label-tmp]' }]
92
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
93
- // eslint-disable-next-line @angular-eslint/directive-selector
94
- class NgMultiLabelTemplateDirective {
95
- constructor(template) {
96
- this.template = template;
97
- }
98
- }
99
- NgMultiLabelTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgMultiLabelTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
100
- NgMultiLabelTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgMultiLabelTemplateDirective, selector: "[ng-multi-label-tmp]", ngImport: i0 });
101
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgMultiLabelTemplateDirective, decorators: [{
102
- type: Directive,
103
- args: [{ selector: '[ng-multi-label-tmp]' }]
104
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
105
- // eslint-disable-next-line @angular-eslint/directive-selector
106
- class NgHeaderTemplateDirective {
107
- constructor(template) {
108
- this.template = template;
109
- }
110
- }
111
- NgHeaderTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgHeaderTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
112
- NgHeaderTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgHeaderTemplateDirective, selector: "[ng-header-tmp]", ngImport: i0 });
113
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgHeaderTemplateDirective, decorators: [{
114
- type: Directive,
115
- args: [{ selector: '[ng-header-tmp]' }]
116
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
117
- // eslint-disable-next-line @angular-eslint/directive-selector
118
- class NgFooterTemplateDirective {
119
- constructor(template) {
120
- this.template = template;
121
- }
122
- }
123
- NgFooterTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgFooterTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
124
- NgFooterTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgFooterTemplateDirective, selector: "[ng-footer-tmp]", ngImport: i0 });
125
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgFooterTemplateDirective, decorators: [{
126
- type: Directive,
127
- args: [{ selector: '[ng-footer-tmp]' }]
128
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
129
- // eslint-disable-next-line @angular-eslint/directive-selector
130
- class NgNotFoundTemplateDirective {
131
- constructor(template) {
132
- this.template = template;
133
- }
134
- }
135
- NgNotFoundTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgNotFoundTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
136
- NgNotFoundTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgNotFoundTemplateDirective, selector: "[ng-notfound-tmp]", ngImport: i0 });
137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgNotFoundTemplateDirective, decorators: [{
138
- type: Directive,
139
- args: [{ selector: '[ng-notfound-tmp]' }]
140
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
141
- // eslint-disable-next-line @angular-eslint/directive-selector
142
- class NgTypeToSearchTemplateDirective {
143
- constructor(template) {
144
- this.template = template;
145
- }
146
- }
147
- NgTypeToSearchTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgTypeToSearchTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
148
- NgTypeToSearchTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgTypeToSearchTemplateDirective, selector: "[ng-typetosearch-tmp]", ngImport: i0 });
149
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgTypeToSearchTemplateDirective, decorators: [{
150
- type: Directive,
151
- args: [{ selector: '[ng-typetosearch-tmp]' }]
152
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
153
- // eslint-disable-next-line @angular-eslint/directive-selector
154
- class NgLoadingTextTemplateDirective {
155
- constructor(template) {
156
- this.template = template;
157
- }
158
- }
159
- NgLoadingTextTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgLoadingTextTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
160
- NgLoadingTextTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgLoadingTextTemplateDirective, selector: "[ng-loadingtext-tmp]", ngImport: i0 });
161
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgLoadingTextTemplateDirective, decorators: [{
162
- type: Directive,
163
- args: [{ selector: '[ng-loadingtext-tmp]' }]
164
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
165
- // eslint-disable-next-line @angular-eslint/directive-selector
166
- class NgTagTemplateDirective {
167
- constructor(template) {
168
- this.template = template;
169
- }
170
- }
171
- NgTagTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgTagTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
172
- NgTagTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgTagTemplateDirective, selector: "[ng-tag-tmp]", ngImport: i0 });
173
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgTagTemplateDirective, decorators: [{
174
- type: Directive,
175
- args: [{ selector: '[ng-tag-tmp]' }]
176
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
177
- // eslint-disable-next-line @angular-eslint/directive-selector
178
- class NgLoadingSpinnerTemplateDirective {
179
- constructor(template) {
180
- this.template = template;
181
- }
182
- }
183
- NgLoadingSpinnerTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgLoadingSpinnerTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
184
- NgLoadingSpinnerTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgLoadingSpinnerTemplateDirective, selector: "[ng-loadingspinner-tmp]", ngImport: i0 });
185
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgLoadingSpinnerTemplateDirective, decorators: [{
186
- type: Directive,
187
- args: [{ selector: '[ng-loadingspinner-tmp]' }]
188
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
189
-
190
- function newId() {
191
- // First character is an 'a', it's good practice to tag id to begin with a letter
192
- return 'axxxxxxxxxxx'.replace(/[x]/g, () => {
193
- // eslint-disable-next-line no-bitwise
194
- const val = Math.random() * 16 | 0;
195
- return val.toString(16);
196
- });
197
- }
198
-
199
- const diacritics = {
200
- '\u24B6': 'A',
201
- '\uFF21': 'A',
202
- '\u00C0': 'A',
203
- '\u00C1': 'A',
204
- '\u00C2': 'A',
205
- '\u1EA6': 'A',
206
- '\u1EA4': 'A',
207
- '\u1EAA': 'A',
208
- '\u1EA8': 'A',
209
- '\u00C3': 'A',
210
- '\u0100': 'A',
211
- '\u0102': 'A',
212
- '\u1EB0': 'A',
213
- '\u1EAE': 'A',
214
- '\u1EB4': 'A',
215
- '\u1EB2': 'A',
216
- '\u0226': 'A',
217
- '\u01E0': 'A',
218
- '\u00C4': 'A',
219
- '\u01DE': 'A',
220
- '\u1EA2': 'A',
221
- '\u00C5': 'A',
222
- '\u01FA': 'A',
223
- '\u01CD': 'A',
224
- '\u0200': 'A',
225
- '\u0202': 'A',
226
- '\u1EA0': 'A',
227
- '\u1EAC': 'A',
228
- '\u1EB6': 'A',
229
- '\u1E00': 'A',
230
- '\u0104': 'A',
231
- '\u023A': 'A',
232
- '\u2C6F': 'A',
233
- '\uA732': 'AA',
234
- '\u00C6': 'AE',
235
- '\u01FC': 'AE',
236
- '\u01E2': 'AE',
237
- '\uA734': 'AO',
238
- '\uA736': 'AU',
239
- '\uA738': 'AV',
240
- '\uA73A': 'AV',
241
- '\uA73C': 'AY',
242
- '\u24B7': 'B',
243
- '\uFF22': 'B',
244
- '\u1E02': 'B',
245
- '\u1E04': 'B',
246
- '\u1E06': 'B',
247
- '\u0243': 'B',
248
- '\u0182': 'B',
249
- '\u0181': 'B',
250
- '\u24B8': 'C',
251
- '\uFF23': 'C',
252
- '\u0106': 'C',
253
- '\u0108': 'C',
254
- '\u010A': 'C',
255
- '\u010C': 'C',
256
- '\u00C7': 'C',
257
- '\u1E08': 'C',
258
- '\u0187': 'C',
259
- '\u023B': 'C',
260
- '\uA73E': 'C',
261
- '\u24B9': 'D',
262
- '\uFF24': 'D',
263
- '\u1E0A': 'D',
264
- '\u010E': 'D',
265
- '\u1E0C': 'D',
266
- '\u1E10': 'D',
267
- '\u1E12': 'D',
268
- '\u1E0E': 'D',
269
- '\u0110': 'D',
270
- '\u018B': 'D',
271
- '\u018A': 'D',
272
- '\u0189': 'D',
273
- '\uA779': 'D',
274
- '\u01F1': 'DZ',
275
- '\u01C4': 'DZ',
276
- '\u01F2': 'Dz',
277
- '\u01C5': 'Dz',
278
- '\u24BA': 'E',
279
- '\uFF25': 'E',
280
- '\u00C8': 'E',
281
- '\u00C9': 'E',
282
- '\u00CA': 'E',
283
- '\u1EC0': 'E',
284
- '\u1EBE': 'E',
285
- '\u1EC4': 'E',
286
- '\u1EC2': 'E',
287
- '\u1EBC': 'E',
288
- '\u0112': 'E',
289
- '\u1E14': 'E',
290
- '\u1E16': 'E',
291
- '\u0114': 'E',
292
- '\u0116': 'E',
293
- '\u00CB': 'E',
294
- '\u1EBA': 'E',
295
- '\u011A': 'E',
296
- '\u0204': 'E',
297
- '\u0206': 'E',
298
- '\u1EB8': 'E',
299
- '\u1EC6': 'E',
300
- '\u0228': 'E',
301
- '\u1E1C': 'E',
302
- '\u0118': 'E',
303
- '\u1E18': 'E',
304
- '\u1E1A': 'E',
305
- '\u0190': 'E',
306
- '\u018E': 'E',
307
- '\u24BB': 'F',
308
- '\uFF26': 'F',
309
- '\u1E1E': 'F',
310
- '\u0191': 'F',
311
- '\uA77B': 'F',
312
- '\u24BC': 'G',
313
- '\uFF27': 'G',
314
- '\u01F4': 'G',
315
- '\u011C': 'G',
316
- '\u1E20': 'G',
317
- '\u011E': 'G',
318
- '\u0120': 'G',
319
- '\u01E6': 'G',
320
- '\u0122': 'G',
321
- '\u01E4': 'G',
322
- '\u0193': 'G',
323
- '\uA7A0': 'G',
324
- '\uA77D': 'G',
325
- '\uA77E': 'G',
326
- '\u24BD': 'H',
327
- '\uFF28': 'H',
328
- '\u0124': 'H',
329
- '\u1E22': 'H',
330
- '\u1E26': 'H',
331
- '\u021E': 'H',
332
- '\u1E24': 'H',
333
- '\u1E28': 'H',
334
- '\u1E2A': 'H',
335
- '\u0126': 'H',
336
- '\u2C67': 'H',
337
- '\u2C75': 'H',
338
- '\uA78D': 'H',
339
- '\u24BE': 'I',
340
- '\uFF29': 'I',
341
- '\u00CC': 'I',
342
- '\u00CD': 'I',
343
- '\u00CE': 'I',
344
- '\u0128': 'I',
345
- '\u012A': 'I',
346
- '\u012C': 'I',
347
- '\u0130': 'I',
348
- '\u00CF': 'I',
349
- '\u1E2E': 'I',
350
- '\u1EC8': 'I',
351
- '\u01CF': 'I',
352
- '\u0208': 'I',
353
- '\u020A': 'I',
354
- '\u1ECA': 'I',
355
- '\u012E': 'I',
356
- '\u1E2C': 'I',
357
- '\u0197': 'I',
358
- '\u24BF': 'J',
359
- '\uFF2A': 'J',
360
- '\u0134': 'J',
361
- '\u0248': 'J',
362
- '\u24C0': 'K',
363
- '\uFF2B': 'K',
364
- '\u1E30': 'K',
365
- '\u01E8': 'K',
366
- '\u1E32': 'K',
367
- '\u0136': 'K',
368
- '\u1E34': 'K',
369
- '\u0198': 'K',
370
- '\u2C69': 'K',
371
- '\uA740': 'K',
372
- '\uA742': 'K',
373
- '\uA744': 'K',
374
- '\uA7A2': 'K',
375
- '\u24C1': 'L',
376
- '\uFF2C': 'L',
377
- '\u013F': 'L',
378
- '\u0139': 'L',
379
- '\u013D': 'L',
380
- '\u1E36': 'L',
381
- '\u1E38': 'L',
382
- '\u013B': 'L',
383
- '\u1E3C': 'L',
384
- '\u1E3A': 'L',
385
- '\u0141': 'L',
386
- '\u023D': 'L',
387
- '\u2C62': 'L',
388
- '\u2C60': 'L',
389
- '\uA748': 'L',
390
- '\uA746': 'L',
391
- '\uA780': 'L',
392
- '\u01C7': 'LJ',
393
- '\u01C8': 'Lj',
394
- '\u24C2': 'M',
395
- '\uFF2D': 'M',
396
- '\u1E3E': 'M',
397
- '\u1E40': 'M',
398
- '\u1E42': 'M',
399
- '\u2C6E': 'M',
400
- '\u019C': 'M',
401
- '\u24C3': 'N',
402
- '\uFF2E': 'N',
403
- '\u01F8': 'N',
404
- '\u0143': 'N',
405
- '\u00D1': 'N',
406
- '\u1E44': 'N',
407
- '\u0147': 'N',
408
- '\u1E46': 'N',
409
- '\u0145': 'N',
410
- '\u1E4A': 'N',
411
- '\u1E48': 'N',
412
- '\u0220': 'N',
413
- '\u019D': 'N',
414
- '\uA790': 'N',
415
- '\uA7A4': 'N',
416
- '\u01CA': 'NJ',
417
- '\u01CB': 'Nj',
418
- '\u24C4': 'O',
419
- '\uFF2F': 'O',
420
- '\u00D2': 'O',
421
- '\u00D3': 'O',
422
- '\u00D4': 'O',
423
- '\u1ED2': 'O',
424
- '\u1ED0': 'O',
425
- '\u1ED6': 'O',
426
- '\u1ED4': 'O',
427
- '\u00D5': 'O',
428
- '\u1E4C': 'O',
429
- '\u022C': 'O',
430
- '\u1E4E': 'O',
431
- '\u014C': 'O',
432
- '\u1E50': 'O',
433
- '\u1E52': 'O',
434
- '\u014E': 'O',
435
- '\u022E': 'O',
436
- '\u0230': 'O',
437
- '\u00D6': 'O',
438
- '\u022A': 'O',
439
- '\u1ECE': 'O',
440
- '\u0150': 'O',
441
- '\u01D1': 'O',
442
- '\u020C': 'O',
443
- '\u020E': 'O',
444
- '\u01A0': 'O',
445
- '\u1EDC': 'O',
446
- '\u1EDA': 'O',
447
- '\u1EE0': 'O',
448
- '\u1EDE': 'O',
449
- '\u1EE2': 'O',
450
- '\u1ECC': 'O',
451
- '\u1ED8': 'O',
452
- '\u01EA': 'O',
453
- '\u01EC': 'O',
454
- '\u00D8': 'O',
455
- '\u01FE': 'O',
456
- '\u0186': 'O',
457
- '\u019F': 'O',
458
- '\uA74A': 'O',
459
- '\uA74C': 'O',
460
- '\u01A2': 'OI',
461
- '\uA74E': 'OO',
462
- '\u0222': 'OU',
463
- '\u24C5': 'P',
464
- '\uFF30': 'P',
465
- '\u1E54': 'P',
466
- '\u1E56': 'P',
467
- '\u01A4': 'P',
468
- '\u2C63': 'P',
469
- '\uA750': 'P',
470
- '\uA752': 'P',
471
- '\uA754': 'P',
472
- '\u24C6': 'Q',
473
- '\uFF31': 'Q',
474
- '\uA756': 'Q',
475
- '\uA758': 'Q',
476
- '\u024A': 'Q',
477
- '\u24C7': 'R',
478
- '\uFF32': 'R',
479
- '\u0154': 'R',
480
- '\u1E58': 'R',
481
- '\u0158': 'R',
482
- '\u0210': 'R',
483
- '\u0212': 'R',
484
- '\u1E5A': 'R',
485
- '\u1E5C': 'R',
486
- '\u0156': 'R',
487
- '\u1E5E': 'R',
488
- '\u024C': 'R',
489
- '\u2C64': 'R',
490
- '\uA75A': 'R',
491
- '\uA7A6': 'R',
492
- '\uA782': 'R',
493
- '\u24C8': 'S',
494
- '\uFF33': 'S',
495
- '\u1E9E': 'S',
496
- '\u015A': 'S',
497
- '\u1E64': 'S',
498
- '\u015C': 'S',
499
- '\u1E60': 'S',
500
- '\u0160': 'S',
501
- '\u1E66': 'S',
502
- '\u1E62': 'S',
503
- '\u1E68': 'S',
504
- '\u0218': 'S',
505
- '\u015E': 'S',
506
- '\u2C7E': 'S',
507
- '\uA7A8': 'S',
508
- '\uA784': 'S',
509
- '\u24C9': 'T',
510
- '\uFF34': 'T',
511
- '\u1E6A': 'T',
512
- '\u0164': 'T',
513
- '\u1E6C': 'T',
514
- '\u021A': 'T',
515
- '\u0162': 'T',
516
- '\u1E70': 'T',
517
- '\u1E6E': 'T',
518
- '\u0166': 'T',
519
- '\u01AC': 'T',
520
- '\u01AE': 'T',
521
- '\u023E': 'T',
522
- '\uA786': 'T',
523
- '\uA728': 'TZ',
524
- '\u24CA': 'U',
525
- '\uFF35': 'U',
526
- '\u00D9': 'U',
527
- '\u00DA': 'U',
528
- '\u00DB': 'U',
529
- '\u0168': 'U',
530
- '\u1E78': 'U',
531
- '\u016A': 'U',
532
- '\u1E7A': 'U',
533
- '\u016C': 'U',
534
- '\u00DC': 'U',
535
- '\u01DB': 'U',
536
- '\u01D7': 'U',
537
- '\u01D5': 'U',
538
- '\u01D9': 'U',
539
- '\u1EE6': 'U',
540
- '\u016E': 'U',
541
- '\u0170': 'U',
542
- '\u01D3': 'U',
543
- '\u0214': 'U',
544
- '\u0216': 'U',
545
- '\u01AF': 'U',
546
- '\u1EEA': 'U',
547
- '\u1EE8': 'U',
548
- '\u1EEE': 'U',
549
- '\u1EEC': 'U',
550
- '\u1EF0': 'U',
551
- '\u1EE4': 'U',
552
- '\u1E72': 'U',
553
- '\u0172': 'U',
554
- '\u1E76': 'U',
555
- '\u1E74': 'U',
556
- '\u0244': 'U',
557
- '\u24CB': 'V',
558
- '\uFF36': 'V',
559
- '\u1E7C': 'V',
560
- '\u1E7E': 'V',
561
- '\u01B2': 'V',
562
- '\uA75E': 'V',
563
- '\u0245': 'V',
564
- '\uA760': 'VY',
565
- '\u24CC': 'W',
566
- '\uFF37': 'W',
567
- '\u1E80': 'W',
568
- '\u1E82': 'W',
569
- '\u0174': 'W',
570
- '\u1E86': 'W',
571
- '\u1E84': 'W',
572
- '\u1E88': 'W',
573
- '\u2C72': 'W',
574
- '\u24CD': 'X',
575
- '\uFF38': 'X',
576
- '\u1E8A': 'X',
577
- '\u1E8C': 'X',
578
- '\u24CE': 'Y',
579
- '\uFF39': 'Y',
580
- '\u1EF2': 'Y',
581
- '\u00DD': 'Y',
582
- '\u0176': 'Y',
583
- '\u1EF8': 'Y',
584
- '\u0232': 'Y',
585
- '\u1E8E': 'Y',
586
- '\u0178': 'Y',
587
- '\u1EF6': 'Y',
588
- '\u1EF4': 'Y',
589
- '\u01B3': 'Y',
590
- '\u024E': 'Y',
591
- '\u1EFE': 'Y',
592
- '\u24CF': 'Z',
593
- '\uFF3A': 'Z',
594
- '\u0179': 'Z',
595
- '\u1E90': 'Z',
596
- '\u017B': 'Z',
597
- '\u017D': 'Z',
598
- '\u1E92': 'Z',
599
- '\u1E94': 'Z',
600
- '\u01B5': 'Z',
601
- '\u0224': 'Z',
602
- '\u2C7F': 'Z',
603
- '\u2C6B': 'Z',
604
- '\uA762': 'Z',
605
- '\u24D0': 'a',
606
- '\uFF41': 'a',
607
- '\u1E9A': 'a',
608
- '\u00E0': 'a',
609
- '\u00E1': 'a',
610
- '\u00E2': 'a',
611
- '\u1EA7': 'a',
612
- '\u1EA5': 'a',
613
- '\u1EAB': 'a',
614
- '\u1EA9': 'a',
615
- '\u00E3': 'a',
616
- '\u0101': 'a',
617
- '\u0103': 'a',
618
- '\u1EB1': 'a',
619
- '\u1EAF': 'a',
620
- '\u1EB5': 'a',
621
- '\u1EB3': 'a',
622
- '\u0227': 'a',
623
- '\u01E1': 'a',
624
- '\u00E4': 'a',
625
- '\u01DF': 'a',
626
- '\u1EA3': 'a',
627
- '\u00E5': 'a',
628
- '\u01FB': 'a',
629
- '\u01CE': 'a',
630
- '\u0201': 'a',
631
- '\u0203': 'a',
632
- '\u1EA1': 'a',
633
- '\u1EAD': 'a',
634
- '\u1EB7': 'a',
635
- '\u1E01': 'a',
636
- '\u0105': 'a',
637
- '\u2C65': 'a',
638
- '\u0250': 'a',
639
- '\uA733': 'aa',
640
- '\u00E6': 'ae',
641
- '\u01FD': 'ae',
642
- '\u01E3': 'ae',
643
- '\uA735': 'ao',
644
- '\uA737': 'au',
645
- '\uA739': 'av',
646
- '\uA73B': 'av',
647
- '\uA73D': 'ay',
648
- '\u24D1': 'b',
649
- '\uFF42': 'b',
650
- '\u1E03': 'b',
651
- '\u1E05': 'b',
652
- '\u1E07': 'b',
653
- '\u0180': 'b',
654
- '\u0183': 'b',
655
- '\u0253': 'b',
656
- '\u24D2': 'c',
657
- '\uFF43': 'c',
658
- '\u0107': 'c',
659
- '\u0109': 'c',
660
- '\u010B': 'c',
661
- '\u010D': 'c',
662
- '\u00E7': 'c',
663
- '\u1E09': 'c',
664
- '\u0188': 'c',
665
- '\u023C': 'c',
666
- '\uA73F': 'c',
667
- '\u2184': 'c',
668
- '\u24D3': 'd',
669
- '\uFF44': 'd',
670
- '\u1E0B': 'd',
671
- '\u010F': 'd',
672
- '\u1E0D': 'd',
673
- '\u1E11': 'd',
674
- '\u1E13': 'd',
675
- '\u1E0F': 'd',
676
- '\u0111': 'd',
677
- '\u018C': 'd',
678
- '\u0256': 'd',
679
- '\u0257': 'd',
680
- '\uA77A': 'd',
681
- '\u01F3': 'dz',
682
- '\u01C6': 'dz',
683
- '\u24D4': 'e',
684
- '\uFF45': 'e',
685
- '\u00E8': 'e',
686
- '\u00E9': 'e',
687
- '\u00EA': 'e',
688
- '\u1EC1': 'e',
689
- '\u1EBF': 'e',
690
- '\u1EC5': 'e',
691
- '\u1EC3': 'e',
692
- '\u1EBD': 'e',
693
- '\u0113': 'e',
694
- '\u1E15': 'e',
695
- '\u1E17': 'e',
696
- '\u0115': 'e',
697
- '\u0117': 'e',
698
- '\u00EB': 'e',
699
- '\u1EBB': 'e',
700
- '\u011B': 'e',
701
- '\u0205': 'e',
702
- '\u0207': 'e',
703
- '\u1EB9': 'e',
704
- '\u1EC7': 'e',
705
- '\u0229': 'e',
706
- '\u1E1D': 'e',
707
- '\u0119': 'e',
708
- '\u1E19': 'e',
709
- '\u1E1B': 'e',
710
- '\u0247': 'e',
711
- '\u025B': 'e',
712
- '\u01DD': 'e',
713
- '\u24D5': 'f',
714
- '\uFF46': 'f',
715
- '\u1E1F': 'f',
716
- '\u0192': 'f',
717
- '\uA77C': 'f',
718
- '\u24D6': 'g',
719
- '\uFF47': 'g',
720
- '\u01F5': 'g',
721
- '\u011D': 'g',
722
- '\u1E21': 'g',
723
- '\u011F': 'g',
724
- '\u0121': 'g',
725
- '\u01E7': 'g',
726
- '\u0123': 'g',
727
- '\u01E5': 'g',
728
- '\u0260': 'g',
729
- '\uA7A1': 'g',
730
- '\u1D79': 'g',
731
- '\uA77F': 'g',
732
- '\u24D7': 'h',
733
- '\uFF48': 'h',
734
- '\u0125': 'h',
735
- '\u1E23': 'h',
736
- '\u1E27': 'h',
737
- '\u021F': 'h',
738
- '\u1E25': 'h',
739
- '\u1E29': 'h',
740
- '\u1E2B': 'h',
741
- '\u1E96': 'h',
742
- '\u0127': 'h',
743
- '\u2C68': 'h',
744
- '\u2C76': 'h',
745
- '\u0265': 'h',
746
- '\u0195': 'hv',
747
- '\u24D8': 'i',
748
- '\uFF49': 'i',
749
- '\u00EC': 'i',
750
- '\u00ED': 'i',
751
- '\u00EE': 'i',
752
- '\u0129': 'i',
753
- '\u012B': 'i',
754
- '\u012D': 'i',
755
- '\u00EF': 'i',
756
- '\u1E2F': 'i',
757
- '\u1EC9': 'i',
758
- '\u01D0': 'i',
759
- '\u0209': 'i',
760
- '\u020B': 'i',
761
- '\u1ECB': 'i',
762
- '\u012F': 'i',
763
- '\u1E2D': 'i',
764
- '\u0268': 'i',
765
- '\u0131': 'i',
766
- '\u24D9': 'j',
767
- '\uFF4A': 'j',
768
- '\u0135': 'j',
769
- '\u01F0': 'j',
770
- '\u0249': 'j',
771
- '\u24DA': 'k',
772
- '\uFF4B': 'k',
773
- '\u1E31': 'k',
774
- '\u01E9': 'k',
775
- '\u1E33': 'k',
776
- '\u0137': 'k',
777
- '\u1E35': 'k',
778
- '\u0199': 'k',
779
- '\u2C6A': 'k',
780
- '\uA741': 'k',
781
- '\uA743': 'k',
782
- '\uA745': 'k',
783
- '\uA7A3': 'k',
784
- '\u24DB': 'l',
785
- '\uFF4C': 'l',
786
- '\u0140': 'l',
787
- '\u013A': 'l',
788
- '\u013E': 'l',
789
- '\u1E37': 'l',
790
- '\u1E39': 'l',
791
- '\u013C': 'l',
792
- '\u1E3D': 'l',
793
- '\u1E3B': 'l',
794
- '\u017F': 'l',
795
- '\u0142': 'l',
796
- '\u019A': 'l',
797
- '\u026B': 'l',
798
- '\u2C61': 'l',
799
- '\uA749': 'l',
800
- '\uA781': 'l',
801
- '\uA747': 'l',
802
- '\u01C9': 'lj',
803
- '\u24DC': 'm',
804
- '\uFF4D': 'm',
805
- '\u1E3F': 'm',
806
- '\u1E41': 'm',
807
- '\u1E43': 'm',
808
- '\u0271': 'm',
809
- '\u026F': 'm',
810
- '\u24DD': 'n',
811
- '\uFF4E': 'n',
812
- '\u01F9': 'n',
813
- '\u0144': 'n',
814
- '\u00F1': 'n',
815
- '\u1E45': 'n',
816
- '\u0148': 'n',
817
- '\u1E47': 'n',
818
- '\u0146': 'n',
819
- '\u1E4B': 'n',
820
- '\u1E49': 'n',
821
- '\u019E': 'n',
822
- '\u0272': 'n',
823
- '\u0149': 'n',
824
- '\uA791': 'n',
825
- '\uA7A5': 'n',
826
- '\u01CC': 'nj',
827
- '\u24DE': 'o',
828
- '\uFF4F': 'o',
829
- '\u00F2': 'o',
830
- '\u00F3': 'o',
831
- '\u00F4': 'o',
832
- '\u1ED3': 'o',
833
- '\u1ED1': 'o',
834
- '\u1ED7': 'o',
835
- '\u1ED5': 'o',
836
- '\u00F5': 'o',
837
- '\u1E4D': 'o',
838
- '\u022D': 'o',
839
- '\u1E4F': 'o',
840
- '\u014D': 'o',
841
- '\u1E51': 'o',
842
- '\u1E53': 'o',
843
- '\u014F': 'o',
844
- '\u022F': 'o',
845
- '\u0231': 'o',
846
- '\u00F6': 'o',
847
- '\u022B': 'o',
848
- '\u1ECF': 'o',
849
- '\u0151': 'o',
850
- '\u01D2': 'o',
851
- '\u020D': 'o',
852
- '\u020F': 'o',
853
- '\u01A1': 'o',
854
- '\u1EDD': 'o',
855
- '\u1EDB': 'o',
856
- '\u1EE1': 'o',
857
- '\u1EDF': 'o',
858
- '\u1EE3': 'o',
859
- '\u1ECD': 'o',
860
- '\u1ED9': 'o',
861
- '\u01EB': 'o',
862
- '\u01ED': 'o',
863
- '\u00F8': 'o',
864
- '\u01FF': 'o',
865
- '\u0254': 'o',
866
- '\uA74B': 'o',
867
- '\uA74D': 'o',
868
- '\u0275': 'o',
869
- '\u01A3': 'oi',
870
- '\u0223': 'ou',
871
- '\uA74F': 'oo',
872
- '\u24DF': 'p',
873
- '\uFF50': 'p',
874
- '\u1E55': 'p',
875
- '\u1E57': 'p',
876
- '\u01A5': 'p',
877
- '\u1D7D': 'p',
878
- '\uA751': 'p',
879
- '\uA753': 'p',
880
- '\uA755': 'p',
881
- '\u24E0': 'q',
882
- '\uFF51': 'q',
883
- '\u024B': 'q',
884
- '\uA757': 'q',
885
- '\uA759': 'q',
886
- '\u24E1': 'r',
887
- '\uFF52': 'r',
888
- '\u0155': 'r',
889
- '\u1E59': 'r',
890
- '\u0159': 'r',
891
- '\u0211': 'r',
892
- '\u0213': 'r',
893
- '\u1E5B': 'r',
894
- '\u1E5D': 'r',
895
- '\u0157': 'r',
896
- '\u1E5F': 'r',
897
- '\u024D': 'r',
898
- '\u027D': 'r',
899
- '\uA75B': 'r',
900
- '\uA7A7': 'r',
901
- '\uA783': 'r',
902
- '\u24E2': 's',
903
- '\uFF53': 's',
904
- '\u00DF': 's',
905
- '\u015B': 's',
906
- '\u1E65': 's',
907
- '\u015D': 's',
908
- '\u1E61': 's',
909
- '\u0161': 's',
910
- '\u1E67': 's',
911
- '\u1E63': 's',
912
- '\u1E69': 's',
913
- '\u0219': 's',
914
- '\u015F': 's',
915
- '\u023F': 's',
916
- '\uA7A9': 's',
917
- '\uA785': 's',
918
- '\u1E9B': 's',
919
- '\u24E3': 't',
920
- '\uFF54': 't',
921
- '\u1E6B': 't',
922
- '\u1E97': 't',
923
- '\u0165': 't',
924
- '\u1E6D': 't',
925
- '\u021B': 't',
926
- '\u0163': 't',
927
- '\u1E71': 't',
928
- '\u1E6F': 't',
929
- '\u0167': 't',
930
- '\u01AD': 't',
931
- '\u0288': 't',
932
- '\u2C66': 't',
933
- '\uA787': 't',
934
- '\uA729': 'tz',
935
- '\u24E4': 'u',
936
- '\uFF55': 'u',
937
- '\u00F9': 'u',
938
- '\u00FA': 'u',
939
- '\u00FB': 'u',
940
- '\u0169': 'u',
941
- '\u1E79': 'u',
942
- '\u016B': 'u',
943
- '\u1E7B': 'u',
944
- '\u016D': 'u',
945
- '\u00FC': 'u',
946
- '\u01DC': 'u',
947
- '\u01D8': 'u',
948
- '\u01D6': 'u',
949
- '\u01DA': 'u',
950
- '\u1EE7': 'u',
951
- '\u016F': 'u',
952
- '\u0171': 'u',
953
- '\u01D4': 'u',
954
- '\u0215': 'u',
955
- '\u0217': 'u',
956
- '\u01B0': 'u',
957
- '\u1EEB': 'u',
958
- '\u1EE9': 'u',
959
- '\u1EEF': 'u',
960
- '\u1EED': 'u',
961
- '\u1EF1': 'u',
962
- '\u1EE5': 'u',
963
- '\u1E73': 'u',
964
- '\u0173': 'u',
965
- '\u1E77': 'u',
966
- '\u1E75': 'u',
967
- '\u0289': 'u',
968
- '\u24E5': 'v',
969
- '\uFF56': 'v',
970
- '\u1E7D': 'v',
971
- '\u1E7F': 'v',
972
- '\u028B': 'v',
973
- '\uA75F': 'v',
974
- '\u028C': 'v',
975
- '\uA761': 'vy',
976
- '\u24E6': 'w',
977
- '\uFF57': 'w',
978
- '\u1E81': 'w',
979
- '\u1E83': 'w',
980
- '\u0175': 'w',
981
- '\u1E87': 'w',
982
- '\u1E85': 'w',
983
- '\u1E98': 'w',
984
- '\u1E89': 'w',
985
- '\u2C73': 'w',
986
- '\u24E7': 'x',
987
- '\uFF58': 'x',
988
- '\u1E8B': 'x',
989
- '\u1E8D': 'x',
990
- '\u24E8': 'y',
991
- '\uFF59': 'y',
992
- '\u1EF3': 'y',
993
- '\u00FD': 'y',
994
- '\u0177': 'y',
995
- '\u1EF9': 'y',
996
- '\u0233': 'y',
997
- '\u1E8F': 'y',
998
- '\u00FF': 'y',
999
- '\u1EF7': 'y',
1000
- '\u1E99': 'y',
1001
- '\u1EF5': 'y',
1002
- '\u01B4': 'y',
1003
- '\u024F': 'y',
1004
- '\u1EFF': 'y',
1005
- '\u24E9': 'z',
1006
- '\uFF5A': 'z',
1007
- '\u017A': 'z',
1008
- '\u1E91': 'z',
1009
- '\u017C': 'z',
1010
- '\u017E': 'z',
1011
- '\u1E93': 'z',
1012
- '\u1E95': 'z',
1013
- '\u01B6': 'z',
1014
- '\u0225': 'z',
1015
- '\u0240': 'z',
1016
- '\u2C6C': 'z',
1017
- '\uA763': 'z',
1018
- '\u0386': '\u0391',
1019
- '\u0388': '\u0395',
1020
- '\u0389': '\u0397',
1021
- '\u038A': '\u0399',
1022
- '\u03AA': '\u0399',
1023
- '\u038C': '\u039F',
1024
- '\u038E': '\u03A5',
1025
- '\u03AB': '\u03A5',
1026
- '\u038F': '\u03A9',
1027
- '\u03AC': '\u03B1',
1028
- '\u03AD': '\u03B5',
1029
- '\u03AE': '\u03B7',
1030
- '\u03AF': '\u03B9',
1031
- '\u03CA': '\u03B9',
1032
- '\u0390': '\u03B9',
1033
- '\u03CC': '\u03BF',
1034
- '\u03CD': '\u03C5',
1035
- '\u03CB': '\u03C5',
1036
- '\u03B0': '\u03C5',
1037
- '\u03C9': '\u03C9',
1038
- '\u03C2': '\u03C3'
1039
- };
1040
- function stripSpecialChars(text) {
1041
- const match = (a) => diacritics[a] || a;
1042
- return text.replace(/[^\u0000-\u007E]/g, match);
1043
- }
1044
-
1045
- class ItemsList {
1046
- constructor(_ngSelect, _selectionModel) {
1047
- this._ngSelect = _ngSelect;
1048
- this._selectionModel = _selectionModel;
1049
- this._items = [];
1050
- this._filteredItems = [];
1051
- this._markedIndex = -1;
1052
- }
1053
- get items() {
1054
- return this._items;
1055
- }
1056
- get filteredItems() {
1057
- return this._filteredItems;
1058
- }
1059
- get markedIndex() {
1060
- return this._markedIndex;
1061
- }
1062
- get selectedItems() {
1063
- return this._selectionModel.value;
1064
- }
1065
- get markedItem() {
1066
- return this._filteredItems[this._markedIndex];
1067
- }
1068
- get noItemsToSelect() {
1069
- return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
1070
- }
1071
- get maxItemsSelected() {
1072
- return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
1073
- }
1074
- get lastSelectedItem() {
1075
- let i = this.selectedItems.length - 1;
1076
- for (; i >= 0; i--) {
1077
- const item = this.selectedItems[i];
1078
- if (!item.disabled) {
1079
- return item;
1080
- }
1081
- }
1082
- return null;
1083
- }
1084
- setItems(items) {
1085
- this._items = items.map((item, index) => this.mapItem(item, index));
1086
- if (this._ngSelect.groupBy) {
1087
- this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
1088
- this._items = this._flatten(this._groups);
1089
- }
1090
- else {
1091
- this._groups = new Map();
1092
- this._groups.set(undefined, this._items);
1093
- }
1094
- this._filteredItems = [...this._items];
1095
- }
1096
- select(item) {
1097
- if (item.selected || this.maxItemsSelected) {
1098
- return;
1099
- }
1100
- const multiple = this._ngSelect.multiple;
1101
- if (!multiple) {
1102
- this.clearSelected();
1103
- }
1104
- this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
1105
- if (this._ngSelect.hideSelected) {
1106
- this._hideSelected(item);
1107
- }
1108
- }
1109
- unselect(item) {
1110
- if (!item.selected) {
1111
- return;
1112
- }
1113
- this._selectionModel.unselect(item, this._ngSelect.multiple);
1114
- if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {
1115
- this._showSelected(item);
1116
- }
1117
- }
1118
- findItem(value) {
1119
- let findBy;
1120
- if (this._ngSelect.compareWith) {
1121
- findBy = item => this._ngSelect.compareWith(item.value, value);
1122
- }
1123
- else if (this._ngSelect.bindValue) {
1124
- findBy = item => !item.children && this.resolveNested(item.value, this._ngSelect.bindValue) === value;
1125
- }
1126
- else {
1127
- findBy = item => item.value === value ||
1128
- !item.children && item.label && item.label === this.resolveNested(value, this._ngSelect.bindLabel);
1129
- }
1130
- return this._items.find(item => findBy(item));
1131
- }
1132
- addItem(item) {
1133
- const option = this.mapItem(item, this._items.length);
1134
- this._items.push(option);
1135
- this._filteredItems.push(option);
1136
- return option;
1137
- }
1138
- clearSelected(keepDisabled = false) {
1139
- this._selectionModel.clear(keepDisabled);
1140
- this._items.forEach(item => {
1141
- item.selected = keepDisabled && item.selected && item.disabled;
1142
- item.marked = false;
1143
- });
1144
- if (this._ngSelect.hideSelected) {
1145
- this.resetFilteredItems();
1146
- }
1147
- }
1148
- findByLabel(term) {
1149
- term = stripSpecialChars(term).toLocaleLowerCase();
1150
- return this.filteredItems.find(item => {
1151
- const label = stripSpecialChars(item.label).toLocaleLowerCase();
1152
- return label.substr(0, term.length) === term;
1153
- });
1154
- }
1155
- filter(term) {
1156
- if (!term) {
1157
- this.resetFilteredItems();
1158
- return;
1159
- }
1160
- this._filteredItems = [];
1161
- term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();
1162
- const match = this._ngSelect.searchFn || this._defaultSearchFn;
1163
- const hideSelected = this._ngSelect.hideSelected;
1164
- for (const key of Array.from(this._groups.keys())) {
1165
- const matchedItems = [];
1166
- for (const item of this._groups.get(key)) {
1167
- if (hideSelected && (item.parent && item.parent.selected || item.selected)) {
1168
- continue;
1169
- }
1170
- const searchItem = this._ngSelect.searchFn ? item.value : item;
1171
- if (match(term, searchItem)) {
1172
- matchedItems.push(item);
1173
- }
1174
- }
1175
- if (matchedItems.length > 0) {
1176
- const [last] = matchedItems.slice(-1);
1177
- if (last.parent) {
1178
- const head = this._items.find(x => x === last.parent);
1179
- this._filteredItems.push(head);
1180
- }
1181
- this._filteredItems.push(...matchedItems);
1182
- }
1183
- }
1184
- }
1185
- resetFilteredItems() {
1186
- if (this._filteredItems.length === this._items.length) {
1187
- return;
1188
- }
1189
- if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
1190
- this._filteredItems = this._items.filter(x => !x.selected);
1191
- }
1192
- else {
1193
- this._filteredItems = this._items;
1194
- }
1195
- }
1196
- unmarkItem() {
1197
- this._markedIndex = -1;
1198
- }
1199
- markNextItem() {
1200
- this._stepToItem(+1);
1201
- }
1202
- markPreviousItem() {
1203
- this._stepToItem(-1);
1204
- }
1205
- markItem(item) {
1206
- this._markedIndex = this._filteredItems.indexOf(item);
1207
- }
1208
- markSelectedOrDefault(markDefault) {
1209
- if (this._filteredItems.length === 0) {
1210
- return;
1211
- }
1212
- const lastMarkedIndex = this._getLastMarkedIndex();
1213
- if (lastMarkedIndex > -1) {
1214
- this._markedIndex = lastMarkedIndex;
1215
- }
1216
- else {
1217
- this._markedIndex = markDefault ? this.filteredItems.findIndex(x => !x.disabled) : -1;
1218
- }
1219
- }
1220
- resolveNested(option, key) {
1221
- if (!isObject(option)) {
1222
- return option;
1223
- }
1224
- if (key.indexOf('.') === -1) {
1225
- return option[key];
1226
- }
1227
- else {
1228
- const keys = key.split('.');
1229
- let value = option;
1230
- for (let i = 0, len = keys.length; i < len; ++i) {
1231
- if (value == null) {
1232
- return null;
1233
- }
1234
- value = value[keys[i]];
1235
- }
1236
- return value;
1237
- }
1238
- }
1239
- mapItem(item, index) {
1240
- const label = isDefined(item.$ngOptionLabel) ? item.$ngOptionLabel : this.resolveNested(item, this._ngSelect.bindLabel);
1241
- const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
1242
- return {
1243
- index,
1244
- label: isDefined(label) ? label.toString() : '',
1245
- value,
1246
- disabled: item.disabled,
1247
- htmlId: `${this._ngSelect.dropdownId}-${index}`,
1248
- };
1249
- }
1250
- mapSelectedItems() {
1251
- const multiple = this._ngSelect.multiple;
1252
- for (const selected of this.selectedItems) {
1253
- const value = this._ngSelect.bindValue ? this.resolveNested(selected.value, this._ngSelect.bindValue) : selected.value;
1254
- const item = isDefined(value) ? this.findItem(value) : null;
1255
- this._selectionModel.unselect(selected, multiple);
1256
- this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
1257
- }
1258
- if (this._ngSelect.hideSelected) {
1259
- this._filteredItems = this.filteredItems.filter(x => this.selectedItems.indexOf(x) === -1);
1260
- }
1261
- }
1262
- _showSelected(item) {
1263
- this._filteredItems.push(item);
1264
- if (item.parent) {
1265
- const parent = item.parent;
1266
- const parentExists = this._filteredItems.find(x => x === parent);
1267
- if (!parentExists) {
1268
- this._filteredItems.push(parent);
1269
- }
1270
- }
1271
- else if (item.children) {
1272
- for (const child of item.children) {
1273
- child.selected = false;
1274
- this._filteredItems.push(child);
1275
- }
1276
- }
1277
- this._filteredItems = [...this._filteredItems.sort((a, b) => (a.index - b.index))];
1278
- }
1279
- _hideSelected(item) {
1280
- this._filteredItems = this._filteredItems.filter(x => x !== item);
1281
- if (item.parent) {
1282
- const children = item.parent.children;
1283
- if (children.every(x => x.selected)) {
1284
- this._filteredItems = this._filteredItems.filter(x => x !== item.parent);
1285
- }
1286
- }
1287
- else if (item.children) {
1288
- this._filteredItems = this.filteredItems.filter(x => x.parent !== item);
1289
- }
1290
- }
1291
- _defaultSearchFn(search, opt) {
1292
- const label = stripSpecialChars(opt.label).toLocaleLowerCase();
1293
- return label.indexOf(search) > -1;
1294
- }
1295
- _getNextItemIndex(steps) {
1296
- if (steps > 0) {
1297
- return (this._markedIndex >= this._filteredItems.length - 1) ? 0 : (this._markedIndex + 1);
1298
- }
1299
- return (this._markedIndex <= 0) ? (this._filteredItems.length - 1) : (this._markedIndex - 1);
1300
- }
1301
- _stepToItem(steps) {
1302
- if (this._filteredItems.length === 0 || this._filteredItems.every(x => x.disabled)) {
1303
- return;
1304
- }
1305
- this._markedIndex = this._getNextItemIndex(steps);
1306
- if (this.markedItem.disabled) {
1307
- this._stepToItem(steps);
1308
- }
1309
- }
1310
- _getLastMarkedIndex() {
1311
- if (this._ngSelect.hideSelected) {
1312
- return -1;
1313
- }
1314
- if (this._markedIndex > -1 && this.markedItem === undefined) {
1315
- return -1;
1316
- }
1317
- const selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
1318
- if (this.lastSelectedItem && selectedIndex < 0) {
1319
- return -1;
1320
- }
1321
- return Math.max(this.markedIndex, selectedIndex);
1322
- }
1323
- _groupBy(items, prop) {
1324
- const groups = new Map();
1325
- if (items.length === 0) {
1326
- return groups;
1327
- }
1328
- // Check if items are already grouped by given key.
1329
- if (Array.isArray(items[0].value[prop])) {
1330
- for (const item of items) {
1331
- const children = (item.value[prop] || []).map((x, index) => this.mapItem(x, index));
1332
- groups.set(item, children);
1333
- }
1334
- return groups;
1335
- }
1336
- const isFnKey = isFunction(this._ngSelect.groupBy);
1337
- const keyFn = (item) => {
1338
- const key = isFnKey ? prop(item.value) : item.value[prop];
1339
- return isDefined(key) ? key : undefined;
1340
- };
1341
- // Group items by key.
1342
- for (const item of items) {
1343
- const key = keyFn(item);
1344
- const group = groups.get(key);
1345
- if (group) {
1346
- group.push(item);
1347
- }
1348
- else {
1349
- groups.set(key, [item]);
1350
- }
1351
- }
1352
- return groups;
1353
- }
1354
- _flatten(groups) {
1355
- const isGroupByFn = isFunction(this._ngSelect.groupBy);
1356
- const items = [];
1357
- for (const key of Array.from(groups.keys())) {
1358
- let i = items.length;
1359
- if (key === undefined) {
1360
- const withoutGroup = groups.get(undefined) || [];
1361
- items.push(...withoutGroup.map(x => {
1362
- x.index = i++;
1363
- return x;
1364
- }));
1365
- continue;
1366
- }
1367
- const isObjectKey = isObject(key);
1368
- const parent = {
1369
- label: isObjectKey ? '' : String(key),
1370
- children: undefined,
1371
- parent: null,
1372
- index: i++,
1373
- disabled: !this._ngSelect.selectableGroup,
1374
- htmlId: newId(),
1375
- };
1376
- const groupKey = isGroupByFn ? this._ngSelect.bindLabel : this._ngSelect.groupBy;
1377
- const groupValue = this._ngSelect.groupValue || (() => {
1378
- if (isObjectKey) {
1379
- return key.value;
1380
- }
1381
- return { [groupKey]: key };
1382
- });
1383
- const children = groups.get(key).map(x => {
1384
- x.parent = parent;
1385
- x.children = undefined;
1386
- x.index = i++;
1387
- return x;
1388
- });
1389
- parent.children = children;
1390
- parent.value = groupValue(key, children.map(x => x.value));
1391
- items.push(parent);
1392
- items.push(...children);
1393
- }
1394
- return items;
1395
- }
1396
- }
1397
-
1398
- var KeyCode;
1399
- (function (KeyCode) {
1400
- KeyCode[KeyCode["Tab"] = 9] = "Tab";
1401
- KeyCode[KeyCode["Enter"] = 13] = "Enter";
1402
- KeyCode[KeyCode["Esc"] = 27] = "Esc";
1403
- KeyCode[KeyCode["Space"] = 32] = "Space";
1404
- KeyCode[KeyCode["ArrowUp"] = 38] = "ArrowUp";
1405
- KeyCode[KeyCode["ArrowDown"] = 40] = "ArrowDown";
1406
- KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
1407
- })(KeyCode || (KeyCode = {}));
1408
-
1409
- class NgDropdownPanelService {
1410
- constructor() {
1411
- this._dimensions = {
1412
- itemHeight: 0,
1413
- panelHeight: 0,
1414
- itemsPerViewport: 0
1415
- };
1416
- }
1417
- get dimensions() {
1418
- return this._dimensions;
1419
- }
1420
- calculateItems(scrollPos, itemsLength, buffer) {
1421
- const d = this._dimensions;
1422
- const scrollHeight = d.itemHeight * itemsLength;
1423
- const scrollTop = Math.max(0, scrollPos);
1424
- const indexByScrollTop = scrollTop / scrollHeight * itemsLength;
1425
- let end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
1426
- const maxStartEnd = end;
1427
- const maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
1428
- let start = Math.min(maxStart, Math.floor(indexByScrollTop));
1429
- let topPadding = d.itemHeight * Math.ceil(start) - (d.itemHeight * Math.min(start, buffer));
1430
- topPadding = !isNaN(topPadding) ? topPadding : 0;
1431
- start = !isNaN(start) ? start : -1;
1432
- end = !isNaN(end) ? end : -1;
1433
- start -= buffer;
1434
- start = Math.max(0, start);
1435
- end += buffer;
1436
- end = Math.min(itemsLength, end);
1437
- return {
1438
- topPadding,
1439
- scrollHeight,
1440
- start,
1441
- end
1442
- };
1443
- }
1444
- setDimensions(itemHeight, panelHeight) {
1445
- const itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
1446
- this._dimensions = {
1447
- itemHeight,
1448
- panelHeight,
1449
- itemsPerViewport
1450
- };
1451
- }
1452
- getScrollTo(itemTop, itemHeight, lastScroll) {
1453
- const { panelHeight } = this.dimensions;
1454
- const itemBottom = itemTop + itemHeight;
1455
- const top = lastScroll;
1456
- const bottom = top + panelHeight;
1457
- if (panelHeight >= itemBottom && lastScroll === itemTop) {
1458
- return null;
1459
- }
1460
- if (itemBottom > bottom) {
1461
- return top + itemBottom - bottom;
1462
- }
1463
- else if (itemTop <= top) {
1464
- return itemTop;
1465
- }
1466
- return null;
1467
- }
1468
- }
1469
- NgDropdownPanelService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgDropdownPanelService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1470
- NgDropdownPanelService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgDropdownPanelService });
1471
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgDropdownPanelService, decorators: [{
1472
- type: Injectable
1473
- }] });
1474
-
1475
- const CSS_POSITIONS = ['top', 'right', 'bottom', 'left'];
1476
- const SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? animationFrameScheduler : asapScheduler;
1477
- class NgDropdownPanelComponent {
1478
- constructor(_renderer, _zone, _panelService, _elementRef, _document) {
1479
- this._renderer = _renderer;
1480
- this._zone = _zone;
1481
- this._panelService = _panelService;
1482
- this._document = _document;
1483
- this.items = [];
1484
- this.position = 'auto';
1485
- this.virtualScroll = false;
1486
- this.filterValue = null;
1487
- this.update = new EventEmitter();
1488
- this.scroll = new EventEmitter();
1489
- this.scrollToEnd = new EventEmitter();
1490
- this.outsideClick = new EventEmitter();
1491
- this._destroy$ = new Subject();
1492
- this._scrollToEndFired = false;
1493
- this._updateScrollHeight = false;
1494
- this._lastScrollPosition = 0;
1495
- this._dropdown = _elementRef.nativeElement;
1496
- }
1497
- get currentPosition() {
1498
- return this._currentPosition;
1499
- }
1500
- get itemsLength() {
1501
- return this._itemsLength;
1502
- }
1503
- set itemsLength(value) {
1504
- if (value !== this._itemsLength) {
1505
- this._itemsLength = value;
1506
- this._onItemsLengthChanged();
1507
- }
1508
- }
1509
- get _startOffset() {
1510
- if (this.markedItem) {
1511
- const { itemHeight, panelHeight } = this._panelService.dimensions;
1512
- const offset = this.markedItem.index * itemHeight;
1513
- return panelHeight > offset ? 0 : offset;
1514
- }
1515
- return 0;
1516
- }
1517
- ngOnInit() {
1518
- this._select = this._dropdown.parentElement;
1519
- this._virtualPadding = this.paddingElementRef.nativeElement;
1520
- this._scrollablePanel = this.scrollElementRef.nativeElement;
1521
- this._contentPanel = this.contentElementRef.nativeElement;
1522
- this._handleScroll();
1523
- this._handleOutsideClick();
1524
- this._appendDropdown();
1525
- this._setupMousedownListener();
1526
- }
1527
- ngOnChanges(changes) {
1528
- if (changes.items) {
1529
- const change = changes.items;
1530
- this._onItemsChange(change.currentValue, change.firstChange);
1531
- }
1532
- }
1533
- ngOnDestroy() {
1534
- this._destroy$.next();
1535
- this._destroy$.complete();
1536
- this._destroy$.unsubscribe();
1537
- if (this.appendTo) {
1538
- this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
1539
- }
1540
- }
1541
- scrollTo(option, startFromOption = false) {
1542
- if (!option) {
1543
- return;
1544
- }
1545
- const index = this.items.indexOf(option);
1546
- if (index < 0 || index >= this.itemsLength) {
1547
- return;
1548
- }
1549
- let scrollTo;
1550
- if (this.virtualScroll) {
1551
- const itemHeight = this._panelService.dimensions.itemHeight;
1552
- scrollTo = this._panelService.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
1553
- }
1554
- else {
1555
- const item = this._dropdown.querySelector(`#${option.htmlId}`);
1556
- const lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
1557
- scrollTo = this._panelService.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
1558
- }
1559
- if (isDefined(scrollTo)) {
1560
- this._scrollablePanel.scrollTop = scrollTo;
1561
- }
1562
- }
1563
- scrollToTag() {
1564
- const panel = this._scrollablePanel;
1565
- panel.scrollTop = panel.scrollHeight - panel.clientHeight;
1566
- }
1567
- adjustPosition() {
1568
- this._updateYPosition();
1569
- }
1570
- _handleDropdownPosition() {
1571
- this._currentPosition = this._calculateCurrentPosition(this._dropdown);
1572
- if (CSS_POSITIONS.includes(this._currentPosition)) {
1573
- this._updateDropdownClass(this._currentPosition);
1574
- }
1575
- else {
1576
- this._updateDropdownClass('bottom');
1577
- }
1578
- if (this.appendTo) {
1579
- this._updateYPosition();
1580
- }
1581
- this._dropdown.style.opacity = '1';
1582
- }
1583
- _updateDropdownClass(currentPosition) {
1584
- CSS_POSITIONS.forEach((position) => {
1585
- const REMOVE_CSS_CLASS = `ng-select-${position}`;
1586
- this._renderer.removeClass(this._dropdown, REMOVE_CSS_CLASS);
1587
- this._renderer.removeClass(this._select, REMOVE_CSS_CLASS);
1588
- });
1589
- const ADD_CSS_CLASS = `ng-select-${currentPosition}`;
1590
- this._renderer.addClass(this._dropdown, ADD_CSS_CLASS);
1591
- this._renderer.addClass(this._select, ADD_CSS_CLASS);
1592
- }
1593
- _handleScroll() {
1594
- this._zone.runOutsideAngular(() => {
1595
- fromEvent(this.scrollElementRef.nativeElement, 'scroll')
1596
- .pipe(takeUntil(this._destroy$), auditTime(0, SCROLL_SCHEDULER))
1597
- .subscribe((e) => {
1598
- const path = e.path || (e.composedPath && e.composedPath());
1599
- const scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;
1600
- this._onContentScrolled(scrollTop);
1601
- });
1602
- });
1603
- }
1604
- _handleOutsideClick() {
1605
- if (!this._document) {
1606
- return;
1607
- }
1608
- this._zone.runOutsideAngular(() => {
1609
- merge(fromEvent(this._document, 'touchstart', { capture: true }), fromEvent(this._document, 'mousedown', { capture: true })).pipe(takeUntil(this._destroy$))
1610
- .subscribe($event => this._checkToClose($event));
1611
- });
1612
- }
1613
- _checkToClose($event) {
1614
- if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
1615
- return;
1616
- }
1617
- const path = $event.path || ($event.composedPath && $event.composedPath());
1618
- if ($event.target && $event.target.shadowRoot && path && path[0] && this._select.contains(path[0])) {
1619
- return;
1620
- }
1621
- this._zone.run(() => this.outsideClick.emit());
1622
- }
1623
- _onItemsChange(items, firstChange) {
1624
- this.items = items || [];
1625
- this._scrollToEndFired = false;
1626
- this.itemsLength = items.length;
1627
- if (this.virtualScroll) {
1628
- this._updateItemsRange(firstChange);
1629
- }
1630
- else {
1631
- this._setVirtualHeight();
1632
- this._updateItems(firstChange);
1633
- }
1634
- }
1635
- _updateItems(firstChange) {
1636
- this.update.emit(this.items);
1637
- if (firstChange === false) {
1638
- return;
1639
- }
1640
- this._zone.runOutsideAngular(() => {
1641
- Promise.resolve().then(() => {
1642
- const panelHeight = this._scrollablePanel.clientHeight;
1643
- this._panelService.setDimensions(0, panelHeight);
1644
- this._handleDropdownPosition();
1645
- this.scrollTo(this.markedItem, firstChange);
1646
- });
1647
- });
1648
- }
1649
- _updateItemsRange(firstChange) {
1650
- this._zone.runOutsideAngular(() => {
1651
- this._measureDimensions().then(() => {
1652
- if (firstChange) {
1653
- this._renderItemsRange(this._startOffset);
1654
- this._handleDropdownPosition();
1655
- }
1656
- else {
1657
- this._renderItemsRange();
1658
- }
1659
- });
1660
- });
1661
- }
1662
- _onContentScrolled(scrollTop) {
1663
- if (this.virtualScroll) {
1664
- this._renderItemsRange(scrollTop);
1665
- }
1666
- this._lastScrollPosition = scrollTop;
1667
- this._fireScrollToEnd(scrollTop);
1668
- }
1669
- _updateVirtualHeight(height) {
1670
- if (this._updateScrollHeight) {
1671
- this._virtualPadding.style.height = `${height}px`;
1672
- this._updateScrollHeight = false;
1673
- }
1674
- }
1675
- _setVirtualHeight() {
1676
- if (!this._virtualPadding) {
1677
- return;
1678
- }
1679
- this._virtualPadding.style.height = `0px`;
1680
- }
1681
- _onItemsLengthChanged() {
1682
- this._updateScrollHeight = true;
1683
- }
1684
- _renderItemsRange(scrollTop = null) {
1685
- if (scrollTop && this._lastScrollPosition === scrollTop) {
1686
- return;
1687
- }
1688
- scrollTop = scrollTop || this._scrollablePanel.scrollTop;
1689
- const range = this._panelService.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);
1690
- this._updateVirtualHeight(range.scrollHeight);
1691
- this._contentPanel.style.transform = `translateY(${range.topPadding}px)`;
1692
- this._zone.run(() => {
1693
- this.update.emit(this.items.slice(range.start, range.end));
1694
- this.scroll.emit({ start: range.start, end: range.end });
1695
- });
1696
- if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
1697
- this._scrollablePanel.scrollTop = scrollTop;
1698
- this._lastScrollPosition = scrollTop;
1699
- }
1700
- }
1701
- _measureDimensions() {
1702
- if (this._panelService.dimensions.itemHeight > 0 || this.itemsLength === 0) {
1703
- return Promise.resolve(this._panelService.dimensions);
1704
- }
1705
- const [first] = this.items;
1706
- this.update.emit([first]);
1707
- return Promise.resolve().then(() => {
1708
- const option = this._dropdown.querySelector(`#${first.htmlId}`);
1709
- const optionHeight = option.clientHeight;
1710
- this._virtualPadding.style.height = `${optionHeight * this.itemsLength}px`;
1711
- const panelHeight = this._scrollablePanel.clientHeight;
1712
- this._panelService.setDimensions(optionHeight, panelHeight);
1713
- return this._panelService.dimensions;
1714
- });
1715
- }
1716
- _fireScrollToEnd(scrollTop) {
1717
- if (this._scrollToEndFired || scrollTop === 0) {
1718
- return;
1719
- }
1720
- const padding = this.virtualScroll ?
1721
- this._virtualPadding :
1722
- this._contentPanel;
1723
- if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight - 1) {
1724
- this._zone.run(() => this.scrollToEnd.emit());
1725
- this._scrollToEndFired = true;
1726
- }
1727
- }
1728
- _calculateCurrentPosition(dropdownEl) {
1729
- if (this.position !== 'auto') {
1730
- return this.position;
1731
- }
1732
- const selectRect = this._select.getBoundingClientRect();
1733
- const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
1734
- const offsetTop = selectRect.top + window.pageYOffset;
1735
- const height = selectRect.height;
1736
- const dropdownHeight = dropdownEl.getBoundingClientRect().height;
1737
- if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
1738
- return 'top';
1739
- }
1740
- else {
1741
- return 'bottom';
1742
- }
1743
- }
1744
- _appendDropdown() {
1745
- if (!this.appendTo) {
1746
- return;
1747
- }
1748
- this._parent = document.querySelector(this.appendTo);
1749
- if (!this._parent) {
1750
- throw new Error(`appendTo selector ${this.appendTo} did not found any parent element`);
1751
- }
1752
- this._updateXPosition();
1753
- this._parent.appendChild(this._dropdown);
1754
- }
1755
- _updateXPosition() {
1756
- const select = this._select.getBoundingClientRect();
1757
- const parent = this._parent.getBoundingClientRect();
1758
- const offsetLeft = select.left - parent.left;
1759
- this._dropdown.style.left = offsetLeft + 'px';
1760
- this._dropdown.style.width = select.width + 'px';
1761
- this._dropdown.style.minWidth = select.width + 'px';
1762
- }
1763
- _updateYPosition() {
1764
- const select = this._select.getBoundingClientRect();
1765
- const parent = this._parent.getBoundingClientRect();
1766
- const delta = select.height;
1767
- if (this._currentPosition === 'top') {
1768
- const offsetBottom = parent.bottom - select.bottom;
1769
- this._dropdown.style.bottom = offsetBottom + delta + 'px';
1770
- this._dropdown.style.top = 'auto';
1771
- }
1772
- else if (this._currentPosition === 'bottom') {
1773
- const offsetTop = select.top - parent.top;
1774
- this._dropdown.style.top = offsetTop + delta + 'px';
1775
- this._dropdown.style.bottom = 'auto';
1776
- }
1777
- }
1778
- _setupMousedownListener() {
1779
- this._zone.runOutsideAngular(() => {
1780
- fromEvent(this._dropdown, 'mousedown')
1781
- .pipe(takeUntil(this._destroy$))
1782
- .subscribe((event) => {
1783
- const target = event.target;
1784
- if (target.tagName === 'INPUT') {
1785
- return;
1786
- }
1787
- event.preventDefault();
1788
- });
1789
- });
1790
- }
1791
- }
1792
- NgDropdownPanelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgDropdownPanelComponent, deps: [{ token: i0.Renderer2 }, { token: i0.NgZone }, { token: NgDropdownPanelService }, { token: i0.ElementRef }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1793
- NgDropdownPanelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: NgDropdownPanelComponent, selector: "ng-dropdown-panel", inputs: { items: "items", markedItem: "markedItem", position: "position", appendTo: "appendTo", bufferAmount: "bufferAmount", virtualScroll: "virtualScroll", headerTemplate: "headerTemplate", footerTemplate: "footerTemplate", filterValue: "filterValue" }, outputs: { update: "update", scroll: "scroll", scrollToEnd: "scrollToEnd", outsideClick: "outsideClick" }, viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true, read: ElementRef, static: true }, { propertyName: "scrollElementRef", first: true, predicate: ["scroll"], descendants: true, read: ElementRef, static: true }, { propertyName: "paddingElementRef", first: true, predicate: ["padding"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
1794
- <div *ngIf="headerTemplate" class="ng-dropdown-header">
1795
- <ng-container [ngTemplateOutlet]="headerTemplate" [ngTemplateOutletContext]="{ searchTerm: filterValue }"></ng-container>
1796
- </div>
1797
- <div #scroll class="ng-dropdown-panel-items scroll-host">
1798
- <div #padding [class.total-padding]="virtualScroll"></div>
1799
- <div #content [class.scrollable-content]="virtualScroll && items.length">
1800
- <ng-content></ng-content>
1801
- </div>
1802
- </div>
1803
- <div *ngIf="footerTemplate" class="ng-dropdown-footer">
1804
- <ng-container [ngTemplateOutlet]="footerTemplate" [ngTemplateOutletContext]="{ searchTerm: filterValue }"></ng-container>
1805
- </div>
1806
- `, isInline: true, dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1807
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgDropdownPanelComponent, decorators: [{
1808
- type: Component,
1809
- args: [{
1810
- changeDetection: ChangeDetectionStrategy.OnPush,
1811
- encapsulation: ViewEncapsulation.None,
1812
- selector: 'ng-dropdown-panel',
1813
- template: `
1814
- <div *ngIf="headerTemplate" class="ng-dropdown-header">
1815
- <ng-container [ngTemplateOutlet]="headerTemplate" [ngTemplateOutletContext]="{ searchTerm: filterValue }"></ng-container>
1816
- </div>
1817
- <div #scroll class="ng-dropdown-panel-items scroll-host">
1818
- <div #padding [class.total-padding]="virtualScroll"></div>
1819
- <div #content [class.scrollable-content]="virtualScroll && items.length">
1820
- <ng-content></ng-content>
1821
- </div>
1822
- </div>
1823
- <div *ngIf="footerTemplate" class="ng-dropdown-footer">
1824
- <ng-container [ngTemplateOutlet]="footerTemplate" [ngTemplateOutletContext]="{ searchTerm: filterValue }"></ng-container>
1825
- </div>
1826
- `
1827
- }]
1828
- }], ctorParameters: function () {
1829
- return [{ type: i0.Renderer2 }, { type: i0.NgZone }, { type: NgDropdownPanelService }, { type: i0.ElementRef }, { type: undefined, decorators: [{
1830
- type: Optional
1831
- }, {
1832
- type: Inject,
1833
- args: [DOCUMENT]
1834
- }] }];
1835
- }, propDecorators: { items: [{
1836
- type: Input
1837
- }], markedItem: [{
1838
- type: Input
1839
- }], position: [{
1840
- type: Input
1841
- }], appendTo: [{
1842
- type: Input
1843
- }], bufferAmount: [{
1844
- type: Input
1845
- }], virtualScroll: [{
1846
- type: Input
1847
- }], headerTemplate: [{
1848
- type: Input
1849
- }], footerTemplate: [{
1850
- type: Input
1851
- }], filterValue: [{
1852
- type: Input
1853
- }], update: [{
1854
- type: Output
1855
- }], scroll: [{
1856
- type: Output
1857
- }], scrollToEnd: [{
1858
- type: Output
1859
- }], outsideClick: [{
1860
- type: Output
1861
- }], contentElementRef: [{
1862
- type: ViewChild,
1863
- args: ['content', { read: ElementRef, static: true }]
1864
- }], scrollElementRef: [{
1865
- type: ViewChild,
1866
- args: ['scroll', { read: ElementRef, static: true }]
1867
- }], paddingElementRef: [{
1868
- type: ViewChild,
1869
- args: ['padding', { read: ElementRef, static: true }]
1870
- }] } });
1871
-
1872
- class NgOptionComponent {
1873
- constructor(elementRef) {
1874
- this.elementRef = elementRef;
1875
- this.stateChange$ = new Subject();
1876
- this._disabled = false;
1877
- }
1878
- get disabled() { return this._disabled; }
1879
- set disabled(value) { this._disabled = this._isDisabled(value); }
1880
- get label() {
1881
- return (this.elementRef.nativeElement.textContent || '').trim();
1882
- }
1883
- ngOnChanges(changes) {
1884
- if (changes.disabled) {
1885
- this.stateChange$.next({
1886
- value: this.value,
1887
- disabled: this._disabled
1888
- });
1889
- }
1890
- }
1891
- ngAfterViewChecked() {
1892
- if (this.label !== this._previousLabel) {
1893
- this._previousLabel = this.label;
1894
- this.stateChange$.next({
1895
- value: this.value,
1896
- disabled: this._disabled,
1897
- label: this.elementRef.nativeElement.innerHTML
1898
- });
1899
- }
1900
- }
1901
- ngOnDestroy() {
1902
- this.stateChange$.complete();
1903
- }
1904
- _isDisabled(value) {
1905
- return value != null && `${value}` !== 'false';
1906
- }
1907
- }
1908
- NgOptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgOptionComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1909
- NgOptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: NgOptionComponent, selector: "ng-option", inputs: { value: "value", disabled: "disabled" }, usesOnChanges: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1910
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgOptionComponent, decorators: [{
1911
- type: Component,
1912
- args: [{
1913
- selector: 'ng-option',
1914
- changeDetection: ChangeDetectionStrategy.OnPush,
1915
- template: `<ng-content></ng-content>`
1916
- }]
1917
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { value: [{
1918
- type: Input
1919
- }], disabled: [{
1920
- type: Input
1921
- }] } });
1922
-
1923
- class NgSelectConfig {
1924
- constructor() {
1925
- this.notFoundText = 'No items found';
1926
- this.typeToSearchText = 'Type to search';
1927
- this.addTagText = 'Add item';
1928
- this.loadingText = 'Loading...';
1929
- this.clearAllText = 'Clear all';
1930
- this.disableVirtualScroll = true;
1931
- this.openOnEnter = true;
1932
- this.appearance = 'underline';
1933
- }
1934
- }
1935
- NgSelectConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgSelectConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1936
- NgSelectConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgSelectConfig, providedIn: 'root' });
1937
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgSelectConfig, decorators: [{
1938
- type: Injectable,
1939
- args: [{ providedIn: 'root' }]
1940
- }] });
1941
-
1942
- class ConsoleService {
1943
- warn(message) {
1944
- console.warn(message);
1945
- }
1946
- }
1947
- ConsoleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ConsoleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1948
- ConsoleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ConsoleService, providedIn: 'root' });
1949
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ConsoleService, decorators: [{
1950
- type: Injectable,
1951
- args: [{ providedIn: 'root' }]
1952
- }] });
1953
-
1954
- const SELECTION_MODEL_FACTORY = new InjectionToken('ng-select-selection-model');
1955
- class NgSelectComponent {
1956
- constructor(classes, autoFocus, config, newSelectionModel, _elementRef, _cd, _console) {
1957
- this.classes = classes;
1958
- this.autoFocus = autoFocus;
1959
- this.config = config;
1960
- this._cd = _cd;
1961
- this._console = _console;
1962
- this.markFirst = true;
1963
- this.dropdownPosition = 'auto';
1964
- this.loading = false;
1965
- this.closeOnSelect = true;
1966
- this.hideSelected = false;
1967
- this.selectOnTab = false;
1968
- this.bufferAmount = 4;
1969
- this.selectableGroup = false;
1970
- this.selectableGroupAsModel = true;
1971
- this.searchFn = null;
1972
- this.trackByFn = null;
1973
- this.clearOnBackspace = true;
1974
- this.labelForId = null;
1975
- this.inputAttrs = {};
1976
- this.readonly = false;
1977
- this.searchWhileComposing = true;
1978
- this.minTermLength = 0;
1979
- this.editableSearchTerm = false;
1980
- this.keyDownFn = (_) => true;
1981
- this.multiple = false;
1982
- this.addTag = false;
1983
- this.searchable = true;
1984
- this.clearable = true;
1985
- this.isOpen = false;
1986
- // output events
1987
- this.blurEvent = new EventEmitter();
1988
- this.focusEvent = new EventEmitter();
1989
- this.changeEvent = new EventEmitter();
1990
- this.openEvent = new EventEmitter();
1991
- this.closeEvent = new EventEmitter();
1992
- this.searchEvent = new EventEmitter();
1993
- this.clearEvent = new EventEmitter();
1994
- this.addEvent = new EventEmitter();
1995
- this.removeEvent = new EventEmitter();
1996
- this.scroll = new EventEmitter();
1997
- this.scrollToEnd = new EventEmitter();
1998
- this.useDefaultClass = true;
1999
- this.viewPortItems = [];
2000
- this.searchTerm = null;
2001
- this.dropdownId = newId();
2002
- this.escapeHTML = true;
2003
- this._items = [];
2004
- this._defaultLabel = 'label';
2005
- this._pressedKeys = [];
2006
- this._isComposing = false;
2007
- this._destroy$ = new Subject();
2008
- this._keyPress$ = new Subject();
2009
- this._onChange = (_) => { };
2010
- this._onTouched = () => { };
2011
- this.clearItem = (item) => {
2012
- const option = this.selectedItems.find(x => x.value === item);
2013
- this.unselect(option);
2014
- };
2015
- this.trackByOption = (_, item) => {
2016
- if (this.trackByFn) {
2017
- return this.trackByFn(item.value);
2018
- }
2019
- return item;
2020
- };
2021
- this._mergeGlobalConfig(config);
2022
- this.itemsList = new ItemsList(this, newSelectionModel());
2023
- this.element = _elementRef.nativeElement;
2024
- }
2025
- get items() { return this._items; }
2026
- ;
2027
- set items(value) {
2028
- if (value === null) {
2029
- value = [];
2030
- }
2031
- this._itemsAreUsed = true;
2032
- this._items = value;
2033
- }
2034
- ;
2035
- get compareWith() { return this._compareWith; }
2036
- set compareWith(fn) {
2037
- if (fn !== undefined && fn !== null && !isFunction(fn)) {
2038
- throw Error('`compareWith` must be a function.');
2039
- }
2040
- this._compareWith = fn;
2041
- }
2042
- get clearSearchOnAdd() {
2043
- if (isDefined(this._clearSearchOnAdd)) {
2044
- return this._clearSearchOnAdd;
2045
- }
2046
- else if (isDefined(this.config.clearSearchOnAdd)) {
2047
- return this.config.clearSearchOnAdd;
2048
- }
2049
- return this.closeOnSelect;
2050
- }
2051
- ;
2052
- set clearSearchOnAdd(value) {
2053
- this._clearSearchOnAdd = value;
2054
- }
2055
- ;
2056
- get disabled() { return this.readonly || this._disabled; }
2057
- ;
2058
- get filtered() { return (!!this.searchTerm && this.searchable || this._isComposing); }
2059
- ;
2060
- get single() { return !this.multiple; }
2061
- ;
2062
- get _editableSearchTerm() {
2063
- return this.editableSearchTerm && !this.multiple;
2064
- }
2065
- get selectedItems() {
2066
- return this.itemsList.selectedItems;
2067
- }
2068
- get selectedValues() {
2069
- return this.selectedItems.map(x => x.value);
2070
- }
2071
- get hasValue() {
2072
- return this.selectedItems.length > 0;
2073
- }
2074
- get currentPanelPosition() {
2075
- if (this.dropdownPanel) {
2076
- return this.dropdownPanel.currentPosition;
2077
- }
2078
- return undefined;
2079
- }
2080
- ngOnInit() {
2081
- this._handleKeyPresses();
2082
- this._setInputAttributes();
2083
- }
2084
- ngOnChanges(changes) {
2085
- if (changes.multiple) {
2086
- this.itemsList.clearSelected();
2087
- }
2088
- if (changes.items) {
2089
- this._setItems(changes.items.currentValue || []);
2090
- }
2091
- if (changes.isOpen) {
2092
- this._manualOpen = isDefined(changes.isOpen.currentValue);
2093
- }
2094
- }
2095
- ngAfterViewInit() {
2096
- if (!this._itemsAreUsed) {
2097
- this.escapeHTML = false;
2098
- this._setItemsFromNgOptions();
2099
- }
2100
- if (isDefined(this.autoFocus)) {
2101
- this.focus();
2102
- }
2103
- }
2104
- ngOnDestroy() {
2105
- this._destroy$.next();
2106
- this._destroy$.complete();
2107
- }
2108
- handleKeyDown($event) {
2109
- const keyCode = KeyCode[$event.which];
2110
- if (keyCode) {
2111
- if (this.keyDownFn($event) === false) {
2112
- return;
2113
- }
2114
- this.handleKeyCode($event);
2115
- }
2116
- else if ($event.key && $event.key.length === 1) {
2117
- this._keyPress$.next($event.key.toLocaleLowerCase());
2118
- }
2119
- }
2120
- handleKeyCode($event) {
2121
- switch ($event.which) {
2122
- case KeyCode.ArrowDown:
2123
- this._handleArrowDown($event);
2124
- break;
2125
- case KeyCode.ArrowUp:
2126
- this._handleArrowUp($event);
2127
- break;
2128
- case KeyCode.Space:
2129
- this._handleSpace($event);
2130
- break;
2131
- case KeyCode.Enter:
2132
- this._handleEnter($event);
2133
- break;
2134
- case KeyCode.Tab:
2135
- this._handleTab($event);
2136
- break;
2137
- case KeyCode.Esc:
2138
- this.close();
2139
- $event.preventDefault();
2140
- break;
2141
- case KeyCode.Backspace:
2142
- this._handleBackspace();
2143
- break;
2144
- }
2145
- }
2146
- handleMousedown($event) {
2147
- const target = $event.target;
2148
- if (target.tagName !== 'INPUT') {
2149
- $event.preventDefault();
2150
- }
2151
- if (target.classList.contains('ng-clear-wrapper')) {
2152
- this.handleClearClick();
2153
- return;
2154
- }
2155
- if (target.classList.contains('ng-arrow-wrapper')) {
2156
- this.handleArrowClick();
2157
- return;
2158
- }
2159
- if (target.classList.contains('ng-value-icon')) {
2160
- return;
2161
- }
2162
- if (!this.focused) {
2163
- this.focus();
2164
- }
2165
- if (this.searchable) {
2166
- this.open();
2167
- }
2168
- else {
2169
- this.toggle();
2170
- }
2171
- }
2172
- handleArrowClick() {
2173
- if (this.isOpen) {
2174
- this.close();
2175
- }
2176
- else {
2177
- this.open();
2178
- }
2179
- }
2180
- handleClearClick() {
2181
- if (this.hasValue) {
2182
- this.itemsList.clearSelected(true);
2183
- this._updateNgModel();
2184
- }
2185
- this._clearSearch();
2186
- this.focus();
2187
- this.clearEvent.emit();
2188
- this._onSelectionChanged();
2189
- }
2190
- clearModel() {
2191
- if (!this.clearable) {
2192
- return;
2193
- }
2194
- this.itemsList.clearSelected();
2195
- this._updateNgModel();
2196
- }
2197
- writeValue(value) {
2198
- this.itemsList.clearSelected();
2199
- this._handleWriteValue(value);
2200
- this._cd.markForCheck();
2201
- }
2202
- registerOnChange(fn) {
2203
- this._onChange = fn;
2204
- }
2205
- registerOnTouched(fn) {
2206
- this._onTouched = fn;
2207
- }
2208
- setDisabledState(state) {
2209
- this._disabled = state;
2210
- this._cd.markForCheck();
2211
- }
2212
- toggle() {
2213
- if (!this.isOpen) {
2214
- this.open();
2215
- }
2216
- else {
2217
- this.close();
2218
- }
2219
- }
2220
- open() {
2221
- if (this.disabled || this.isOpen || this._manualOpen) {
2222
- return;
2223
- }
2224
- if (!this._isTypeahead && !this.addTag && this.itemsList.noItemsToSelect) {
2225
- return;
2226
- }
2227
- this.isOpen = true;
2228
- this.itemsList.markSelectedOrDefault(this.markFirst);
2229
- this.openEvent.emit();
2230
- if (!this.searchTerm) {
2231
- this.focus();
2232
- }
2233
- this.detectChanges();
2234
- }
2235
- close() {
2236
- if (!this.isOpen || this._manualOpen) {
2237
- return;
2238
- }
2239
- this.isOpen = false;
2240
- this._isComposing = false;
2241
- if (!this._editableSearchTerm) {
2242
- this._clearSearch();
2243
- }
2244
- else {
2245
- this.itemsList.resetFilteredItems();
2246
- }
2247
- this.itemsList.unmarkItem();
2248
- this._onTouched();
2249
- this.closeEvent.emit();
2250
- this._cd.markForCheck();
2251
- }
2252
- toggleItem(item) {
2253
- if (!item || item.disabled || this.disabled) {
2254
- return;
2255
- }
2256
- if (this.multiple && item.selected) {
2257
- this.unselect(item);
2258
- }
2259
- else {
2260
- this.select(item);
2261
- }
2262
- if (this._editableSearchTerm) {
2263
- this._setSearchTermFromItems();
2264
- }
2265
- this._onSelectionChanged();
2266
- }
2267
- select(item) {
2268
- if (!item.selected) {
2269
- this.itemsList.select(item);
2270
- if (this.clearSearchOnAdd && !this._editableSearchTerm) {
2271
- this._clearSearch();
2272
- }
2273
- this._updateNgModel();
2274
- if (this.multiple) {
2275
- this.addEvent.emit(item.value);
2276
- }
2277
- }
2278
- if (this.closeOnSelect || this.itemsList.noItemsToSelect) {
2279
- this.close();
2280
- }
2281
- }
2282
- focus() {
2283
- this.searchInput.nativeElement.focus();
2284
- }
2285
- blur() {
2286
- this.searchInput.nativeElement.blur();
2287
- }
2288
- unselect(item) {
2289
- if (!item) {
2290
- return;
2291
- }
2292
- this.itemsList.unselect(item);
2293
- this.focus();
2294
- this._updateNgModel();
2295
- this.removeEvent.emit(item);
2296
- }
2297
- selectTag() {
2298
- let tag;
2299
- if (isFunction(this.addTag)) {
2300
- tag = this.addTag(this.searchTerm);
2301
- }
2302
- else {
2303
- tag = this._primitive ? this.searchTerm : { [this.bindLabel]: this.searchTerm };
2304
- }
2305
- const handleTag = (item) => this._isTypeahead || !this.isOpen ? this.itemsList.mapItem(item, null) : this.itemsList.addItem(item);
2306
- if (isPromise(tag)) {
2307
- tag.then(item => this.select(handleTag(item))).catch(() => { });
2308
- }
2309
- else if (tag) {
2310
- this.select(handleTag(tag));
2311
- }
2312
- }
2313
- showClear() {
2314
- return this.clearable && (this.hasValue || this.searchTerm) && !this.disabled;
2315
- }
2316
- get showAddTag() {
2317
- if (!this._validTerm) {
2318
- return false;
2319
- }
2320
- const term = this.searchTerm.toLowerCase().trim();
2321
- return this.addTag &&
2322
- (!this.itemsList.filteredItems.some(x => x.label.toLowerCase() === term) &&
2323
- (!this.hideSelected && this.isOpen || !this.selectedItems.some(x => x.label.toLowerCase() === term))) &&
2324
- !this.loading;
2325
- }
2326
- showNoItemsFound() {
2327
- const empty = this.itemsList.filteredItems.length === 0;
2328
- return ((empty && !this._isTypeahead && !this.loading) ||
2329
- (empty && this._isTypeahead && this._validTerm && !this.loading)) &&
2330
- !this.showAddTag;
2331
- }
2332
- showTypeToSearch() {
2333
- const empty = this.itemsList.filteredItems.length === 0;
2334
- return empty && this._isTypeahead && !this._validTerm && !this.loading;
2335
- }
2336
- onCompositionStart() {
2337
- this._isComposing = true;
2338
- }
2339
- onCompositionEnd(term) {
2340
- this._isComposing = false;
2341
- if (this.searchWhileComposing) {
2342
- return;
2343
- }
2344
- this.filter(term);
2345
- }
2346
- filter(term) {
2347
- if (this._isComposing && !this.searchWhileComposing) {
2348
- return;
2349
- }
2350
- this.searchTerm = term;
2351
- if (this._isTypeahead && (this._validTerm || this.minTermLength === 0)) {
2352
- this.typeahead.next(term);
2353
- }
2354
- if (!this._isTypeahead) {
2355
- this.itemsList.filter(this.searchTerm);
2356
- if (this.isOpen) {
2357
- this.itemsList.markSelectedOrDefault(this.markFirst);
2358
- }
2359
- }
2360
- this.searchEvent.emit({ term, items: this.itemsList.filteredItems.map(x => x.value) });
2361
- this.open();
2362
- }
2363
- onInputFocus($event) {
2364
- if (this.focused) {
2365
- return;
2366
- }
2367
- if (this._editableSearchTerm) {
2368
- this._setSearchTermFromItems();
2369
- }
2370
- this.element.classList.add('ng-select-focused');
2371
- this.focusEvent.emit($event);
2372
- this.focused = true;
2373
- }
2374
- onInputBlur($event) {
2375
- this.element.classList.remove('ng-select-focused');
2376
- this.blurEvent.emit($event);
2377
- if (!this.isOpen && !this.disabled) {
2378
- this._onTouched();
2379
- }
2380
- if (this._editableSearchTerm) {
2381
- this._setSearchTermFromItems();
2382
- }
2383
- this.focused = false;
2384
- }
2385
- onItemHover(item) {
2386
- if (item.disabled) {
2387
- return;
2388
- }
2389
- this.itemsList.markItem(item);
2390
- }
2391
- detectChanges() {
2392
- if (!this._cd.destroyed) {
2393
- this._cd.detectChanges();
2394
- }
2395
- }
2396
- _setSearchTermFromItems() {
2397
- const selected = this.selectedItems && this.selectedItems[0];
2398
- this.searchTerm = (selected && selected.label) || null;
2399
- }
2400
- _setItems(items) {
2401
- const firstItem = items[0];
2402
- this.bindLabel = this.bindLabel || this._defaultLabel;
2403
- this._primitive = isDefined(firstItem) ? !isObject(firstItem) : this._primitive || this.bindLabel === this._defaultLabel;
2404
- this.itemsList.setItems(items);
2405
- if (items.length > 0 && this.hasValue) {
2406
- this.itemsList.mapSelectedItems();
2407
- }
2408
- if (this.isOpen && isDefined(this.searchTerm) && !this._isTypeahead) {
2409
- this.itemsList.filter(this.searchTerm);
2410
- }
2411
- if (this._isTypeahead || this.isOpen) {
2412
- this.itemsList.markSelectedOrDefault(this.markFirst);
2413
- }
2414
- }
2415
- _setItemsFromNgOptions() {
2416
- const mapNgOptions = (options) => {
2417
- this.items = options.map(option => ({
2418
- $ngOptionValue: option.value,
2419
- $ngOptionLabel: option.elementRef.nativeElement.innerHTML,
2420
- disabled: option.disabled
2421
- }));
2422
- this.itemsList.setItems(this.items);
2423
- if (this.hasValue) {
2424
- this.itemsList.mapSelectedItems();
2425
- }
2426
- this.detectChanges();
2427
- };
2428
- const handleOptionChange = () => {
2429
- const changedOrDestroyed = merge(this.ngOptions.changes, this._destroy$);
2430
- merge(...this.ngOptions.map(option => option.stateChange$))
2431
- .pipe(takeUntil(changedOrDestroyed))
2432
- .subscribe(option => {
2433
- const item = this.itemsList.findItem(option.value);
2434
- item.disabled = option.disabled;
2435
- item.label = option.label || item.label;
2436
- this._cd.detectChanges();
2437
- });
2438
- };
2439
- this.ngOptions.changes
2440
- .pipe(startWith(this.ngOptions), takeUntil(this._destroy$))
2441
- .subscribe(options => {
2442
- this.bindLabel = this._defaultLabel;
2443
- mapNgOptions(options);
2444
- handleOptionChange();
2445
- });
2446
- }
2447
- _isValidWriteValue(value) {
2448
- if (!isDefined(value) || (this.multiple && value === '') || Array.isArray(value) && value.length === 0) {
2449
- return false;
2450
- }
2451
- const validateBinding = (item) => {
2452
- if (!isDefined(this.compareWith) && isObject(item) && this.bindValue) {
2453
- this._console.warn(`Setting object(${JSON.stringify(item)}) as your model with bindValue is not allowed unless [compareWith] is used.`);
2454
- return false;
2455
- }
2456
- return true;
2457
- };
2458
- if (this.multiple) {
2459
- if (!Array.isArray(value)) {
2460
- this._console.warn('Multiple select ngModel should be array.');
2461
- return false;
2462
- }
2463
- return value.every(item => validateBinding(item));
2464
- }
2465
- else {
2466
- return validateBinding(value);
2467
- }
2468
- }
2469
- _handleWriteValue(ngModel) {
2470
- if (!this._isValidWriteValue(ngModel)) {
2471
- return;
2472
- }
2473
- const select = (val) => {
2474
- let item = this.itemsList.findItem(val);
2475
- if (item) {
2476
- this.itemsList.select(item);
2477
- }
2478
- else {
2479
- const isValObject = isObject(val);
2480
- const isPrimitive = !isValObject && !this.bindValue;
2481
- if ((isValObject || isPrimitive)) {
2482
- this.itemsList.select(this.itemsList.mapItem(val, null));
2483
- }
2484
- else if (this.bindValue) {
2485
- item = {
2486
- [this.bindLabel]: null,
2487
- [this.bindValue]: val
2488
- };
2489
- this.itemsList.select(this.itemsList.mapItem(item, null));
2490
- }
2491
- }
2492
- };
2493
- if (this.multiple) {
2494
- ngModel.forEach(item => select(item));
2495
- }
2496
- else {
2497
- select(ngModel);
2498
- }
2499
- }
2500
- _handleKeyPresses() {
2501
- if (this.searchable) {
2502
- return;
2503
- }
2504
- this._keyPress$
2505
- .pipe(takeUntil(this._destroy$), tap(letter => this._pressedKeys.push(letter)), debounceTime(200), filter(() => this._pressedKeys.length > 0), map(() => this._pressedKeys.join('')))
2506
- .subscribe(term => {
2507
- const item = this.itemsList.findByLabel(term);
2508
- if (item) {
2509
- if (this.isOpen) {
2510
- this.itemsList.markItem(item);
2511
- this._scrollToMarked();
2512
- this._cd.markForCheck();
2513
- }
2514
- else {
2515
- this.select(item);
2516
- }
2517
- }
2518
- this._pressedKeys = [];
2519
- });
2520
- }
2521
- _setInputAttributes() {
2522
- const input = this.searchInput.nativeElement;
2523
- const attributes = Object.assign({ type: 'text', autocorrect: 'off', autocapitalize: 'off', autocomplete: this.labelForId ? 'off' : this.dropdownId }, this.inputAttrs);
2524
- for (const key of Object.keys(attributes)) {
2525
- input.setAttribute(key, attributes[key]);
2526
- }
2527
- }
2528
- _updateNgModel() {
2529
- const model = [];
2530
- for (const item of this.selectedItems) {
2531
- if (this.bindValue) {
2532
- let value = null;
2533
- if (item.children) {
2534
- const groupKey = this.groupValue ? this.bindValue : this.groupBy;
2535
- value = item.value[groupKey || this.groupBy];
2536
- }
2537
- else {
2538
- value = this.itemsList.resolveNested(item.value, this.bindValue);
2539
- }
2540
- model.push(value);
2541
- }
2542
- else {
2543
- model.push(item.value);
2544
- }
2545
- }
2546
- const selected = this.selectedItems.map(x => x.value);
2547
- if (this.multiple) {
2548
- this._onChange(model);
2549
- this.changeEvent.emit(selected);
2550
- }
2551
- else {
2552
- this._onChange(isDefined(model[0]) ? model[0] : null);
2553
- this.changeEvent.emit(selected[0]);
2554
- }
2555
- this._cd.markForCheck();
2556
- }
2557
- _clearSearch() {
2558
- if (!this.searchTerm) {
2559
- return;
2560
- }
2561
- this._changeSearch(null);
2562
- this.itemsList.resetFilteredItems();
2563
- }
2564
- _changeSearch(searchTerm) {
2565
- this.searchTerm = searchTerm;
2566
- if (this._isTypeahead) {
2567
- this.typeahead.next(searchTerm);
2568
- }
2569
- }
2570
- _scrollToMarked() {
2571
- if (!this.isOpen || !this.dropdownPanel) {
2572
- return;
2573
- }
2574
- this.dropdownPanel.scrollTo(this.itemsList.markedItem);
2575
- }
2576
- _scrollToTag() {
2577
- if (!this.isOpen || !this.dropdownPanel) {
2578
- return;
2579
- }
2580
- this.dropdownPanel.scrollToTag();
2581
- }
2582
- _onSelectionChanged() {
2583
- if (this.isOpen && this.multiple && this.appendTo) {
2584
- // Make sure items are rendered.
2585
- this._cd.detectChanges();
2586
- this.dropdownPanel.adjustPosition();
2587
- }
2588
- }
2589
- _handleTab($event) {
2590
- if (this.isOpen === false && !this.addTag) {
2591
- return;
2592
- }
2593
- if (this.selectOnTab) {
2594
- if (this.itemsList.markedItem) {
2595
- this.toggleItem(this.itemsList.markedItem);
2596
- $event.preventDefault();
2597
- }
2598
- else if (this.showAddTag) {
2599
- this.selectTag();
2600
- $event.preventDefault();
2601
- }
2602
- else {
2603
- this.close();
2604
- }
2605
- }
2606
- else {
2607
- this.close();
2608
- }
2609
- }
2610
- _handleEnter($event) {
2611
- if (this.isOpen || this._manualOpen) {
2612
- if (this.itemsList.markedItem) {
2613
- this.toggleItem(this.itemsList.markedItem);
2614
- }
2615
- else if (this.showAddTag) {
2616
- this.selectTag();
2617
- }
2618
- }
2619
- else if (this.openOnEnter) {
2620
- this.open();
2621
- }
2622
- else {
2623
- return;
2624
- }
2625
- $event.preventDefault();
2626
- }
2627
- _handleSpace($event) {
2628
- if (this.isOpen || this._manualOpen) {
2629
- return;
2630
- }
2631
- this.open();
2632
- $event.preventDefault();
2633
- }
2634
- _handleArrowDown($event) {
2635
- if (this._nextItemIsTag(+1)) {
2636
- this.itemsList.unmarkItem();
2637
- this._scrollToTag();
2638
- }
2639
- else {
2640
- this.itemsList.markNextItem();
2641
- this._scrollToMarked();
2642
- }
2643
- this.open();
2644
- $event.preventDefault();
2645
- }
2646
- _handleArrowUp($event) {
2647
- if (!this.isOpen) {
2648
- return;
2649
- }
2650
- if (this._nextItemIsTag(-1)) {
2651
- this.itemsList.unmarkItem();
2652
- this._scrollToTag();
2653
- }
2654
- else {
2655
- this.itemsList.markPreviousItem();
2656
- this._scrollToMarked();
2657
- }
2658
- $event.preventDefault();
2659
- }
2660
- _nextItemIsTag(nextStep) {
2661
- const nextIndex = this.itemsList.markedIndex + nextStep;
2662
- return this.addTag && this.searchTerm
2663
- && this.itemsList.markedItem
2664
- && (nextIndex < 0 || nextIndex === this.itemsList.filteredItems.length);
2665
- }
2666
- _handleBackspace() {
2667
- if (this.searchTerm || !this.clearable || !this.clearOnBackspace || !this.hasValue) {
2668
- return;
2669
- }
2670
- if (this.multiple) {
2671
- this.unselect(this.itemsList.lastSelectedItem);
2672
- }
2673
- else {
2674
- this.clearModel();
2675
- }
2676
- }
2677
- get _isTypeahead() {
2678
- return this.typeahead && this.typeahead.observers.length > 0;
2679
- }
2680
- get _validTerm() {
2681
- const term = this.searchTerm && this.searchTerm.trim();
2682
- return term && term.length >= this.minTermLength;
2683
- }
2684
- _mergeGlobalConfig(config) {
2685
- this.placeholder = this.placeholder || config.placeholder;
2686
- this.notFoundText = this.notFoundText || config.notFoundText;
2687
- this.typeToSearchText = this.typeToSearchText || config.typeToSearchText;
2688
- this.addTagText = this.addTagText || config.addTagText;
2689
- this.loadingText = this.loadingText || config.loadingText;
2690
- this.clearAllText = this.clearAllText || config.clearAllText;
2691
- this.virtualScroll = isDefined(this.virtualScroll)
2692
- ? this.virtualScroll
2693
- : isDefined(config.disableVirtualScroll) ? !config.disableVirtualScroll : false;
2694
- this.openOnEnter = isDefined(this.openOnEnter) ? this.openOnEnter : config.openOnEnter;
2695
- this.appendTo = this.appendTo || config.appendTo;
2696
- this.bindValue = this.bindValue || config.bindValue;
2697
- this.bindLabel = this.bindLabel || config.bindLabel;
2698
- this.appearance = this.appearance || config.appearance;
2699
- }
2700
- }
2701
- NgSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgSelectComponent, deps: [{ token: 'class', attribute: true }, { token: 'autofocus', attribute: true }, { token: NgSelectConfig }, { token: SELECTION_MODEL_FACTORY }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: ConsoleService }], target: i0.ɵɵFactoryTarget.Component });
2702
- NgSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: NgSelectComponent, selector: "ng-select", inputs: { bindLabel: "bindLabel", bindValue: "bindValue", markFirst: "markFirst", placeholder: "placeholder", notFoundText: "notFoundText", typeToSearchText: "typeToSearchText", addTagText: "addTagText", loadingText: "loadingText", clearAllText: "clearAllText", appearance: "appearance", dropdownPosition: "dropdownPosition", appendTo: "appendTo", loading: "loading", closeOnSelect: "closeOnSelect", hideSelected: "hideSelected", selectOnTab: "selectOnTab", openOnEnter: "openOnEnter", maxSelectedItems: "maxSelectedItems", groupBy: "groupBy", groupValue: "groupValue", bufferAmount: "bufferAmount", virtualScroll: "virtualScroll", selectableGroup: "selectableGroup", selectableGroupAsModel: "selectableGroupAsModel", searchFn: "searchFn", trackByFn: "trackByFn", clearOnBackspace: "clearOnBackspace", labelForId: "labelForId", inputAttrs: "inputAttrs", tabIndex: "tabIndex", readonly: "readonly", searchWhileComposing: "searchWhileComposing", minTermLength: "minTermLength", editableSearchTerm: "editableSearchTerm", keyDownFn: "keyDownFn", typeahead: "typeahead", multiple: "multiple", addTag: "addTag", searchable: "searchable", clearable: "clearable", isOpen: "isOpen", items: "items", compareWith: "compareWith", clearSearchOnAdd: "clearSearchOnAdd" }, outputs: { blurEvent: "blur", focusEvent: "focus", changeEvent: "change", openEvent: "open", closeEvent: "close", searchEvent: "search", clearEvent: "clear", addEvent: "add", removeEvent: "remove", scroll: "scroll", scrollToEnd: "scrollToEnd" }, host: { listeners: { "keydown": "handleKeyDown($event)" }, properties: { "class.ng-select-typeahead": "this.typeahead", "class.ng-select-multiple": "this.multiple", "class.ng-select-taggable": "this.addTag", "class.ng-select-searchable": "this.searchable", "class.ng-select-clearable": "this.clearable", "class.ng-select-opened": "this.isOpen", "class.ng-select": "this.useDefaultClass", "class.ng-select-disabled": "this.disabled", "class.ng-select-filtered": "this.filtered", "class.ng-select-single": "this.single" } }, providers: [{
2703
- provide: NG_VALUE_ACCESSOR,
2704
- useExisting: forwardRef(() => NgSelectComponent),
2705
- multi: true
2706
- }, NgDropdownPanelService], queries: [{ propertyName: "optionTemplate", first: true, predicate: NgOptionTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "optgroupTemplate", first: true, predicate: NgOptgroupTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "labelTemplate", first: true, predicate: NgLabelTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "multiLabelTemplate", first: true, predicate: NgMultiLabelTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "headerTemplate", first: true, predicate: NgHeaderTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "footerTemplate", first: true, predicate: NgFooterTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "notFoundTemplate", first: true, predicate: NgNotFoundTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "typeToSearchTemplate", first: true, predicate: NgTypeToSearchTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "loadingTextTemplate", first: true, predicate: NgLoadingTextTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "tagTemplate", first: true, predicate: NgTagTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "loadingSpinnerTemplate", first: true, predicate: NgLoadingSpinnerTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "ngOptions", predicate: NgOptionComponent, descendants: true }], viewQueries: [{ propertyName: "dropdownPanel", first: true, predicate: i0.forwardRef(function () { return NgDropdownPanelComponent; }), descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div\n (mousedown)=\"handleMousedown($event)\"\n [class.ng-appearance-outline]=\"appearance === 'outline'\"\n [class.ng-has-value]=\"hasValue\"\n class=\"ng-select-container\">\n\n <div class=\"ng-value-container\">\n <div class=\"ng-placeholder\">{{placeholder}}</div>\n\n <ng-container *ngIf=\"(!multiLabelTemplate || !multiple ) && selectedItems.length > 0\">\n <div [class.ng-value-disabled]=\"item.disabled\" class=\"ng-value\" *ngFor=\"let item of selectedItems; trackBy: trackByOption\">\n <ng-template #defaultLabelTemplate>\n <span class=\"ng-value-icon left\" (click)=\"unselect(item);\" aria-hidden=\"true\">\u00D7</span>\n <span class=\"ng-value-label\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n </ng-template>\n </div>\n </ng-container>\n\n <ng-template *ngIf=\"multiple && multiLabelTemplate && selectedValues.length > 0\"\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\">\n </ng-template>\n\n <div class=\"ng-input\"\n role=\"combobox\" \n [attr.aria-expanded]=\"isOpen\" \n [attr.aria-owns]=\"isOpen ? dropdownId : null\" \n aria-haspopup=\"listbox\">\n\n <input #searchInput\n [attr.id]=\"labelForId\"\n [attr.tabindex]=\"tabIndex\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [disabled]=\"disabled\"\n [value]=\"searchTerm ? searchTerm : ''\"\n (input)=\"filter(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (change)=\"$event.stopPropagation()\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList?.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen ? dropdownId : null\">\n </div>\n </div>\n\n <ng-container *ngIf=\"loading\">\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-spinner-loader\"></div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"loadingSpinnerTemplate || defaultLoadingSpinnerTemplate\">\n </ng-template>\n </ng-container>\n\n <span *ngIf=\"showClear()\" class=\"ng-clear-wrapper\" title=\"{{clearAllText}}\">\n <span class=\"ng-clear\" aria-hidden=\"true\">\u00D7</span>\n </span>\n\n <span class=\"ng-arrow-wrapper\">\n <span class=\"ng-arrow\"></span>\n </span>\n</div>\n\n<ng-dropdown-panel *ngIf=\"isOpen\"\n class=\"ng-dropdown-panel\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"dropdownPosition\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit($event)\"\n (outsideClick)=\"close()\"\n [class.ng-select-multiple]=\"multiple\"\n [ngClass]=\"appendTo ? classes : null\"\n [id]=\"dropdownId\"\n role=\"listbox\"\n aria-label=\"Options list\">\n\n <ng-container>\n <div class=\"ng-option\" [attr.role]=\"item.children ? 'group' : 'option'\" (click)=\"toggleItem(item)\" (mouseover)=\"onItemHover(item)\"\n *ngFor=\"let item of viewPortItems; trackBy: trackByOption\"\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\n <ng-template #defaultOptionTemplate>\n <span class=\"ng-option-label\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></span>\n </ng-template>\n\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 <div class=\"ng-option\" [class.ng-option-marked]=\"!itemsList.markedItem\" (mouseover)=\"itemsList.unmarkItem()\" role=\"option\" (click)=\"selectTag()\" *ngIf=\"showAddTag\">\n <ng-template #defaultTagTemplate>\n <span><span class=\"ng-tag-label\">{{addTagText}}</span>\"{{searchTerm}}\"</span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"showNoItemsFound()\">\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{notFoundText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"showTypeToSearch()\">\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{typeToSearchText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\">\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"loading && itemsList.filteredItems.length === 0\">\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{loadingText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-container>\n\n</ng-dropdown-panel>\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{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.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:none;user-select:none;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}@keyframes load8{0%{transform:rotate(0)}to{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:absolute;opacity:0;width:100%;z-index:1050;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;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}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NgDropdownPanelComponent, selector: "ng-dropdown-panel", inputs: ["items", "markedItem", "position", "appendTo", "bufferAmount", "virtualScroll", "headerTemplate", "footerTemplate", "filterValue"], outputs: ["update", "scroll", "scrollToEnd", "outsideClick"] }, { kind: "directive", type: NgItemLabelDirective, selector: "[ngItemLabel]", inputs: ["ngItemLabel", "escape"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2707
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgSelectComponent, decorators: [{
2708
- type: Component,
2709
- args: [{ selector: 'ng-select', providers: [{
2710
- provide: NG_VALUE_ACCESSOR,
2711
- useExisting: forwardRef(() => NgSelectComponent),
2712
- multi: true
2713
- }, NgDropdownPanelService], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n (mousedown)=\"handleMousedown($event)\"\n [class.ng-appearance-outline]=\"appearance === 'outline'\"\n [class.ng-has-value]=\"hasValue\"\n class=\"ng-select-container\">\n\n <div class=\"ng-value-container\">\n <div class=\"ng-placeholder\">{{placeholder}}</div>\n\n <ng-container *ngIf=\"(!multiLabelTemplate || !multiple ) && selectedItems.length > 0\">\n <div [class.ng-value-disabled]=\"item.disabled\" class=\"ng-value\" *ngFor=\"let item of selectedItems; trackBy: trackByOption\">\n <ng-template #defaultLabelTemplate>\n <span class=\"ng-value-icon left\" (click)=\"unselect(item);\" aria-hidden=\"true\">\u00D7</span>\n <span class=\"ng-value-label\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n </ng-template>\n </div>\n </ng-container>\n\n <ng-template *ngIf=\"multiple && multiLabelTemplate && selectedValues.length > 0\"\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\">\n </ng-template>\n\n <div class=\"ng-input\"\n role=\"combobox\" \n [attr.aria-expanded]=\"isOpen\" \n [attr.aria-owns]=\"isOpen ? dropdownId : null\" \n aria-haspopup=\"listbox\">\n\n <input #searchInput\n [attr.id]=\"labelForId\"\n [attr.tabindex]=\"tabIndex\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [disabled]=\"disabled\"\n [value]=\"searchTerm ? searchTerm : ''\"\n (input)=\"filter(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (change)=\"$event.stopPropagation()\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList?.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen ? dropdownId : null\">\n </div>\n </div>\n\n <ng-container *ngIf=\"loading\">\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-spinner-loader\"></div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"loadingSpinnerTemplate || defaultLoadingSpinnerTemplate\">\n </ng-template>\n </ng-container>\n\n <span *ngIf=\"showClear()\" class=\"ng-clear-wrapper\" title=\"{{clearAllText}}\">\n <span class=\"ng-clear\" aria-hidden=\"true\">\u00D7</span>\n </span>\n\n <span class=\"ng-arrow-wrapper\">\n <span class=\"ng-arrow\"></span>\n </span>\n</div>\n\n<ng-dropdown-panel *ngIf=\"isOpen\"\n class=\"ng-dropdown-panel\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"dropdownPosition\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit($event)\"\n (outsideClick)=\"close()\"\n [class.ng-select-multiple]=\"multiple\"\n [ngClass]=\"appendTo ? classes : null\"\n [id]=\"dropdownId\"\n role=\"listbox\"\n aria-label=\"Options list\">\n\n <ng-container>\n <div class=\"ng-option\" [attr.role]=\"item.children ? 'group' : 'option'\" (click)=\"toggleItem(item)\" (mouseover)=\"onItemHover(item)\"\n *ngFor=\"let item of viewPortItems; trackBy: trackByOption\"\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\n <ng-template #defaultOptionTemplate>\n <span class=\"ng-option-label\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></span>\n </ng-template>\n\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 <div class=\"ng-option\" [class.ng-option-marked]=\"!itemsList.markedItem\" (mouseover)=\"itemsList.unmarkItem()\" role=\"option\" (click)=\"selectTag()\" *ngIf=\"showAddTag\">\n <ng-template #defaultTagTemplate>\n <span><span class=\"ng-tag-label\">{{addTagText}}</span>\"{{searchTerm}}\"</span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"showNoItemsFound()\">\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{notFoundText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"showTypeToSearch()\">\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{typeToSearchText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\">\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"loading && itemsList.filteredItems.length === 0\">\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{loadingText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-container>\n\n</ng-dropdown-panel>\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{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.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:none;user-select:none;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}@keyframes load8{0%{transform:rotate(0)}to{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:absolute;opacity:0;width:100%;z-index:1050;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;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}\n"] }]
2714
- }], ctorParameters: function () {
2715
- return [{ type: undefined, decorators: [{
2716
- type: Attribute,
2717
- args: ['class']
2718
- }] }, { type: undefined, decorators: [{
2719
- type: Attribute,
2720
- args: ['autofocus']
2721
- }] }, { type: NgSelectConfig }, { type: undefined, decorators: [{
2722
- type: Inject,
2723
- args: [SELECTION_MODEL_FACTORY]
2724
- }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: ConsoleService }];
2725
- }, propDecorators: { bindLabel: [{
2726
- type: Input
2727
- }], bindValue: [{
2728
- type: Input
2729
- }], markFirst: [{
2730
- type: Input
2731
- }], placeholder: [{
2732
- type: Input
2733
- }], notFoundText: [{
2734
- type: Input
2735
- }], typeToSearchText: [{
2736
- type: Input
2737
- }], addTagText: [{
2738
- type: Input
2739
- }], loadingText: [{
2740
- type: Input
2741
- }], clearAllText: [{
2742
- type: Input
2743
- }], appearance: [{
2744
- type: Input
2745
- }], dropdownPosition: [{
2746
- type: Input
2747
- }], appendTo: [{
2748
- type: Input
2749
- }], loading: [{
2750
- type: Input
2751
- }], closeOnSelect: [{
2752
- type: Input
2753
- }], hideSelected: [{
2754
- type: Input
2755
- }], selectOnTab: [{
2756
- type: Input
2757
- }], openOnEnter: [{
2758
- type: Input
2759
- }], maxSelectedItems: [{
2760
- type: Input
2761
- }], groupBy: [{
2762
- type: Input
2763
- }], groupValue: [{
2764
- type: Input
2765
- }], bufferAmount: [{
2766
- type: Input
2767
- }], virtualScroll: [{
2768
- type: Input
2769
- }], selectableGroup: [{
2770
- type: Input
2771
- }], selectableGroupAsModel: [{
2772
- type: Input
2773
- }], searchFn: [{
2774
- type: Input
2775
- }], trackByFn: [{
2776
- type: Input
2777
- }], clearOnBackspace: [{
2778
- type: Input
2779
- }], labelForId: [{
2780
- type: Input
2781
- }], inputAttrs: [{
2782
- type: Input
2783
- }], tabIndex: [{
2784
- type: Input
2785
- }], readonly: [{
2786
- type: Input
2787
- }], searchWhileComposing: [{
2788
- type: Input
2789
- }], minTermLength: [{
2790
- type: Input
2791
- }], editableSearchTerm: [{
2792
- type: Input
2793
- }], keyDownFn: [{
2794
- type: Input
2795
- }], typeahead: [{
2796
- type: Input
2797
- }, {
2798
- type: HostBinding,
2799
- args: ['class.ng-select-typeahead']
2800
- }], multiple: [{
2801
- type: Input
2802
- }, {
2803
- type: HostBinding,
2804
- args: ['class.ng-select-multiple']
2805
- }], addTag: [{
2806
- type: Input
2807
- }, {
2808
- type: HostBinding,
2809
- args: ['class.ng-select-taggable']
2810
- }], searchable: [{
2811
- type: Input
2812
- }, {
2813
- type: HostBinding,
2814
- args: ['class.ng-select-searchable']
2815
- }], clearable: [{
2816
- type: Input
2817
- }, {
2818
- type: HostBinding,
2819
- args: ['class.ng-select-clearable']
2820
- }], isOpen: [{
2821
- type: Input
2822
- }, {
2823
- type: HostBinding,
2824
- args: ['class.ng-select-opened']
2825
- }], items: [{
2826
- type: Input
2827
- }], compareWith: [{
2828
- type: Input
2829
- }], clearSearchOnAdd: [{
2830
- type: Input
2831
- }], blurEvent: [{
2832
- type: Output,
2833
- args: ['blur']
2834
- }], focusEvent: [{
2835
- type: Output,
2836
- args: ['focus']
2837
- }], changeEvent: [{
2838
- type: Output,
2839
- args: ['change']
2840
- }], openEvent: [{
2841
- type: Output,
2842
- args: ['open']
2843
- }], closeEvent: [{
2844
- type: Output,
2845
- args: ['close']
2846
- }], searchEvent: [{
2847
- type: Output,
2848
- args: ['search']
2849
- }], clearEvent: [{
2850
- type: Output,
2851
- args: ['clear']
2852
- }], addEvent: [{
2853
- type: Output,
2854
- args: ['add']
2855
- }], removeEvent: [{
2856
- type: Output,
2857
- args: ['remove']
2858
- }], scroll: [{
2859
- type: Output,
2860
- args: ['scroll']
2861
- }], scrollToEnd: [{
2862
- type: Output,
2863
- args: ['scrollToEnd']
2864
- }], optionTemplate: [{
2865
- type: ContentChild,
2866
- args: [NgOptionTemplateDirective, { read: TemplateRef }]
2867
- }], optgroupTemplate: [{
2868
- type: ContentChild,
2869
- args: [NgOptgroupTemplateDirective, { read: TemplateRef }]
2870
- }], labelTemplate: [{
2871
- type: ContentChild,
2872
- args: [NgLabelTemplateDirective, { read: TemplateRef }]
2873
- }], multiLabelTemplate: [{
2874
- type: ContentChild,
2875
- args: [NgMultiLabelTemplateDirective, { read: TemplateRef }]
2876
- }], headerTemplate: [{
2877
- type: ContentChild,
2878
- args: [NgHeaderTemplateDirective, { read: TemplateRef }]
2879
- }], footerTemplate: [{
2880
- type: ContentChild,
2881
- args: [NgFooterTemplateDirective, { read: TemplateRef }]
2882
- }], notFoundTemplate: [{
2883
- type: ContentChild,
2884
- args: [NgNotFoundTemplateDirective, { read: TemplateRef }]
2885
- }], typeToSearchTemplate: [{
2886
- type: ContentChild,
2887
- args: [NgTypeToSearchTemplateDirective, { read: TemplateRef }]
2888
- }], loadingTextTemplate: [{
2889
- type: ContentChild,
2890
- args: [NgLoadingTextTemplateDirective, { read: TemplateRef }]
2891
- }], tagTemplate: [{
2892
- type: ContentChild,
2893
- args: [NgTagTemplateDirective, { read: TemplateRef }]
2894
- }], loadingSpinnerTemplate: [{
2895
- type: ContentChild,
2896
- args: [NgLoadingSpinnerTemplateDirective, { read: TemplateRef }]
2897
- }], dropdownPanel: [{
2898
- type: ViewChild,
2899
- args: [forwardRef(() => NgDropdownPanelComponent)]
2900
- }], searchInput: [{
2901
- type: ViewChild,
2902
- args: ['searchInput', { static: true }]
2903
- }], ngOptions: [{
2904
- type: ContentChildren,
2905
- args: [NgOptionComponent, { descendants: true }]
2906
- }], useDefaultClass: [{
2907
- type: HostBinding,
2908
- args: ['class.ng-select']
2909
- }], disabled: [{
2910
- type: HostBinding,
2911
- args: ['class.ng-select-disabled']
2912
- }], filtered: [{
2913
- type: HostBinding,
2914
- args: ['class.ng-select-filtered']
2915
- }], single: [{
2916
- type: HostBinding,
2917
- args: ['class.ng-select-single']
2918
- }], handleKeyDown: [{
2919
- type: HostListener,
2920
- args: ['keydown', ['$event']]
2921
- }] } });
2922
-
2923
- function DefaultSelectionModelFactory() {
2924
- return new DefaultSelectionModel();
2925
- }
2926
- class DefaultSelectionModel {
2927
- constructor() {
2928
- this._selected = [];
2929
- }
2930
- get value() {
2931
- return this._selected;
2932
- }
2933
- select(item, multiple, groupAsModel) {
2934
- item.selected = true;
2935
- if (!item.children || (!multiple && groupAsModel)) {
2936
- this._selected.push(item);
2937
- }
2938
- if (multiple) {
2939
- if (item.parent) {
2940
- const childrenCount = item.parent.children.length;
2941
- const selectedCount = item.parent.children.filter(x => x.selected).length;
2942
- item.parent.selected = childrenCount === selectedCount;
2943
- }
2944
- else if (item.children) {
2945
- this._setChildrenSelectedState(item.children, true);
2946
- this._removeChildren(item);
2947
- if (groupAsModel && this._activeChildren(item)) {
2948
- this._selected = [...this._selected.filter(x => x.parent !== item), item];
2949
- }
2950
- else {
2951
- this._selected = [...this._selected, ...item.children.filter(x => !x.disabled)];
2952
- }
2953
- }
2954
- }
2955
- }
2956
- unselect(item, multiple) {
2957
- this._selected = this._selected.filter(x => x !== item);
2958
- item.selected = false;
2959
- if (multiple) {
2960
- if (item.parent && item.parent.selected) {
2961
- const children = item.parent.children;
2962
- this._removeParent(item.parent);
2963
- this._removeChildren(item.parent);
2964
- this._selected.push(...children.filter(x => x !== item && !x.disabled));
2965
- item.parent.selected = false;
2966
- }
2967
- else if (item.children) {
2968
- this._setChildrenSelectedState(item.children, false);
2969
- this._removeChildren(item);
2970
- }
2971
- }
2972
- }
2973
- clear(keepDisabled) {
2974
- this._selected = keepDisabled ? this._selected.filter(x => x.disabled) : [];
2975
- }
2976
- _setChildrenSelectedState(children, selected) {
2977
- for (const child of children) {
2978
- if (child.disabled) {
2979
- continue;
2980
- }
2981
- child.selected = selected;
2982
- }
2983
- }
2984
- _removeChildren(parent) {
2985
- this._selected = [
2986
- ...this._selected.filter(x => x.parent !== parent),
2987
- ...parent.children.filter(x => x.parent === parent && x.disabled && x.selected)
2988
- ];
2989
- }
2990
- _removeParent(parent) {
2991
- this._selected = this._selected.filter(x => x !== parent);
2992
- }
2993
- _activeChildren(item) {
2994
- return item.children.every(x => !x.disabled || x.selected);
2995
- }
2996
- }
2997
-
2998
- class NgSelectModule {
2999
- }
3000
- NgSelectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3001
- NgSelectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: NgSelectModule, declarations: [NgDropdownPanelComponent,
3002
- NgOptionComponent,
3003
- NgSelectComponent,
3004
- NgOptgroupTemplateDirective,
3005
- NgOptionTemplateDirective,
3006
- NgLabelTemplateDirective,
3007
- NgMultiLabelTemplateDirective,
3008
- NgHeaderTemplateDirective,
3009
- NgFooterTemplateDirective,
3010
- NgNotFoundTemplateDirective,
3011
- NgTypeToSearchTemplateDirective,
3012
- NgLoadingTextTemplateDirective,
3013
- NgTagTemplateDirective,
3014
- NgLoadingSpinnerTemplateDirective,
3015
- NgItemLabelDirective], imports: [CommonModule], exports: [NgSelectComponent,
3016
- NgOptionComponent,
3017
- NgOptgroupTemplateDirective,
3018
- NgOptionTemplateDirective,
3019
- NgLabelTemplateDirective,
3020
- NgMultiLabelTemplateDirective,
3021
- NgHeaderTemplateDirective,
3022
- NgFooterTemplateDirective,
3023
- NgNotFoundTemplateDirective,
3024
- NgTypeToSearchTemplateDirective,
3025
- NgLoadingTextTemplateDirective,
3026
- NgTagTemplateDirective,
3027
- NgLoadingSpinnerTemplateDirective] });
3028
- NgSelectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgSelectModule, providers: [
3029
- { provide: SELECTION_MODEL_FACTORY, useValue: DefaultSelectionModelFactory }
3030
- ], imports: [CommonModule] });
3031
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgSelectModule, decorators: [{
3032
- type: NgModule,
3033
- args: [{
3034
- declarations: [
3035
- NgDropdownPanelComponent,
3036
- NgOptionComponent,
3037
- NgSelectComponent,
3038
- NgOptgroupTemplateDirective,
3039
- NgOptionTemplateDirective,
3040
- NgLabelTemplateDirective,
3041
- NgMultiLabelTemplateDirective,
3042
- NgHeaderTemplateDirective,
3043
- NgFooterTemplateDirective,
3044
- NgNotFoundTemplateDirective,
3045
- NgTypeToSearchTemplateDirective,
3046
- NgLoadingTextTemplateDirective,
3047
- NgTagTemplateDirective,
3048
- NgLoadingSpinnerTemplateDirective,
3049
- NgItemLabelDirective
3050
- ],
3051
- imports: [
3052
- CommonModule
3053
- ],
3054
- exports: [
3055
- NgSelectComponent,
3056
- NgOptionComponent,
3057
- NgOptgroupTemplateDirective,
3058
- NgOptionTemplateDirective,
3059
- NgLabelTemplateDirective,
3060
- NgMultiLabelTemplateDirective,
3061
- NgHeaderTemplateDirective,
3062
- NgFooterTemplateDirective,
3063
- NgNotFoundTemplateDirective,
3064
- NgTypeToSearchTemplateDirective,
3065
- NgLoadingTextTemplateDirective,
3066
- NgTagTemplateDirective,
3067
- NgLoadingSpinnerTemplateDirective
3068
- ],
3069
- providers: [
3070
- { provide: SELECTION_MODEL_FACTORY, useValue: DefaultSelectionModelFactory }
3071
- ]
3072
- }]
3073
- }] });
3074
-
3075
- /*
3076
- * Public API Surface of ng-select
3077
- */
3078
-
3079
- /**
3080
- * Generated bundle index. Do not edit.
3081
- */
3082
-
3083
- export { NgFooterTemplateDirective, NgHeaderTemplateDirective, NgItemLabelDirective, NgLabelTemplateDirective, NgLoadingSpinnerTemplateDirective, NgLoadingTextTemplateDirective, NgMultiLabelTemplateDirective, NgNotFoundTemplateDirective, NgOptgroupTemplateDirective, NgOptionComponent, NgOptionTemplateDirective, NgSelectComponent, NgSelectConfig, NgSelectModule, NgTagTemplateDirective, NgTypeToSearchTemplateDirective, SELECTION_MODEL_FACTORY };
3084
- //# sourceMappingURL=ng-select-ng-select.mjs.map