ng-select2-component 12.0.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
1
  import * as i4 from '@angular/cdk/overlay';
2
2
  import { CdkConnectedOverlay, OverlayModule } from '@angular/cdk/overlay';
3
3
  import * as i0 from '@angular/core';
4
- import { EventEmitter, TemplateRef, Component, Optional, Self, Attribute, Input, Output, HostBinding, ViewChild, ViewChildren, Directive, NgModule } from '@angular/core';
4
+ import { EventEmitter, TemplateRef, numberAttribute, booleanAttribute, Component, Optional, Self, Attribute, Input, HostBinding, Output, ViewChild, ViewChildren, HostListener, Directive, NgModule } from '@angular/core';
5
5
  import { Subject } from 'rxjs';
6
+ import { coerceBooleanProperty } from '@angular/cdk/coercion';
6
7
  import * as i1 from '@angular/cdk/scrolling';
7
8
  import * as i2 from '@angular/forms';
8
9
  import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -11,1260 +12,1228 @@ import { CommonModule } from '@angular/common';
11
12
  import * as i5 from 'ngx-infinite-scroll';
12
13
  import { InfiniteScrollModule } from 'ngx-infinite-scroll';
13
14
 
14
- const timeout = 200;
15
- const unicodePatterns = [
16
- { l: 'a', s: /[ⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ]/gi },
17
- { l: 'aa', s: /ꜳ/gi },
18
- { l: 'ae', s: /[æǽǣ]/gi },
19
- { l: 'ao', s: /ꜵ/gi },
20
- { l: 'au', s: /ꜷ/gi },
21
- { l: 'av', s: /[ꜹꜻ]/gi },
22
- { l: 'ay', s: /ꜽ/gi },
23
- { l: 'b', s: /[ⓑbḃḅḇƀƃɓ]/gi },
24
- { l: 'c', s: /[ⓒcćĉċčçḉƈȼꜿↄ]/gi },
25
- { l: 'd', s: /[ⓓdḋďḍḑḓḏđƌɖɗꝺ]/gi },
26
- { l: 'dz', s: /[dzdž]/gi },
27
- { l: 'e', s: /[ⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ]/gi },
28
- { l: 'f', s: /[ⓕfḟƒꝼ]/gi },
29
- { l: 'g', s: /[ⓖgǵĝḡğġǧģǥɠꞡᵹꝿ]/gi },
30
- { l: 'h', s: /[ⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ]/gi },
31
- { l: 'hv', s: /ƕ/gi },
32
- { l: 'i', s: /[ⓘiìíîĩīĭİïḯỉǐȉȋịįḭɨı]/gi },
33
- { l: 'j', s: /[ⓙjĵǰɉ]/gi },
34
- { l: 'k', s: /[ⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ]/gi },
35
- { l: 'l', s: /[ⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇꝆ]/gi },
36
- { l: 'lj', s: /lj/gi },
37
- { l: 'm', s: /[ⓜmḿṁṃɱɯ]/gi },
38
- { l: 'n', s: /[ⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ]/gi },
39
- { l: 'nj', s: /nj/gi },
40
- { l: 'o', s: /[ⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔƟꝋꝍɵ]/gi },
41
- { l: 'oi', s: /ƣ/gi },
42
- { l: 'oe', s: /œ/gi },
43
- { l: 'oo', s: /ꝏ/gi },
44
- { l: 'ou', s: /ȣ/gi },
45
- { l: 'p', s: /[ⓟpṕṗƥᵽꝑꝓꝕ]/gi },
46
- { l: 'q', s: /[ⓠqɋꝗꝙ]/gi },
47
- { l: 'r', s: /[ⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ]/gi },
48
- { l: 's', s: /[ⓢsßẞśṥŝṡšṧṣṩșşȿꞩꞅẛ]/gi },
49
- { l: 't', s: /[ⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ]/gi },
50
- { l: 'tz', s: /ꜩ/gi },
51
- { l: 'u', s: /[ⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ]/gi },
52
- { l: 'v', s: /[ⓥvṽṿʋꝟʌ]/gi },
53
- { l: 'vy', s: /ꝡ/gi },
54
- { l: 'w', s: /[ⓦwẁẃŵẇẅẘẉⱳ]/gi },
55
- { l: 'x', s: /[ⓧxẋẍ]/gi },
56
- { l: 'y', s: /[ⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ]/gi },
57
- { l: 'z', s: /[ⓩzźẑżžẓẕƶȥɀⱬꝣ]/gi },
58
- ];
59
- const defaultMinCountForSearch = 6;
15
+ const timeout = 200;
16
+ const unicodePatterns = [
17
+ { l: 'a', s: /[ⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ]/gi },
18
+ { l: 'aa', s: /ꜳ/gi },
19
+ { l: 'ae', s: /[æǽǣ]/gi },
20
+ { l: 'ao', s: /ꜵ/gi },
21
+ { l: 'au', s: /ꜷ/gi },
22
+ { l: 'av', s: /[ꜹꜻ]/gi },
23
+ { l: 'ay', s: /ꜽ/gi },
24
+ { l: 'b', s: /[ⓑbḃḅḇƀƃɓ]/gi },
25
+ { l: 'c', s: /[ⓒcćĉċčçḉƈȼꜿↄ]/gi },
26
+ { l: 'd', s: /[ⓓdḋďḍḑḓḏđƌɖɗꝺ]/gi },
27
+ { l: 'dz', s: /[dzdž]/gi },
28
+ { l: 'e', s: /[ⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ]/gi },
29
+ { l: 'f', s: /[ⓕfḟƒꝼ]/gi },
30
+ { l: 'g', s: /[ⓖgǵĝḡğġǧģǥɠꞡᵹꝿ]/gi },
31
+ { l: 'h', s: /[ⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ]/gi },
32
+ { l: 'hv', s: /ƕ/gi },
33
+ { l: 'i', s: /[ⓘiìíîĩīĭİïḯỉǐȉȋịįḭɨı]/gi },
34
+ { l: 'j', s: /[ⓙjĵǰɉ]/gi },
35
+ { l: 'k', s: /[ⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ]/gi },
36
+ { l: 'l', s: /[ⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇꝆ]/gi },
37
+ { l: 'lj', s: /lj/gi },
38
+ { l: 'm', s: /[ⓜmḿṁṃɱɯ]/gi },
39
+ { l: 'n', s: /[ⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ]/gi },
40
+ { l: 'nj', s: /nj/gi },
41
+ { l: 'o', s: /[ⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔƟꝋꝍɵ]/gi },
42
+ { l: 'oi', s: /ƣ/gi },
43
+ { l: 'oe', s: /œ/gi },
44
+ { l: 'oo', s: /ꝏ/gi },
45
+ { l: 'ou', s: /ȣ/gi },
46
+ { l: 'p', s: /[ⓟpṕṗƥᵽꝑꝓꝕ]/gi },
47
+ { l: 'q', s: /[ⓠqɋꝗꝙ]/gi },
48
+ { l: 'r', s: /[ⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ]/gi },
49
+ { l: 's', s: /[ⓢsßẞśṥŝṡšṧṣṩșşȿꞩꞅẛ]/gi },
50
+ { l: 't', s: /[ⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ]/gi },
51
+ { l: 'tz', s: /ꜩ/gi },
52
+ { l: 'u', s: /[ⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ]/gi },
53
+ { l: 'v', s: /[ⓥvṽṿʋꝟʌ]/gi },
54
+ { l: 'vy', s: /ꝡ/gi },
55
+ { l: 'w', s: /[ⓦwẁẃŵẇẅẘẉⱳ]/gi },
56
+ { l: 'x', s: /[ⓧxẋẍ]/gi },
57
+ { l: 'y', s: /[ⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ]/gi },
58
+ { l: 'z', s: /[ⓩzźẑżžẓẕƶȥɀⱬꝣ]/gi },
59
+ ];
60
+ const defaultMinCountForSearch = 6;
60
61
  const protectRegexp = new RegExp('[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]', 'g');
61
62
 
62
- class Select2Utils {
63
- static getOptionByValue(data, value) {
64
- if (Array.isArray(data)) {
65
- for (const groupOrOption of data) {
66
- const options = groupOrOption.options;
67
- if (options) {
68
- for (const option of options) {
69
- if (option.value === value) {
70
- return option;
71
- }
72
- }
73
- }
74
- else if (groupOrOption.value === value) {
75
- return groupOrOption;
76
- }
77
- }
78
- }
79
- return null;
80
- }
81
- static getOptionsByValue(data, value, multiple) {
82
- if (multiple) {
83
- const values = Array.isArray(value) ? value : [];
84
- const result = [];
85
- for (const v of values) {
86
- const option = Select2Utils.getOptionByValue(data, v);
87
- if (option) {
88
- result.push(option);
89
- }
90
- }
91
- return result;
92
- }
93
- return Select2Utils.getOptionByValue(data, value);
94
- }
95
- static getFirstAvailableOption(data) {
96
- if (Array.isArray(data)) {
97
- for (const groupOrOption of data) {
98
- const options = groupOrOption.options;
99
- if (options) {
100
- for (const option of options) {
101
- if (!option.disabled) {
102
- return option.value;
103
- }
104
- }
105
- }
106
- else {
107
- const option = groupOrOption;
108
- if (!option.disabled) {
109
- return option.value;
110
- }
111
- }
112
- }
113
- }
114
- return null;
115
- }
116
- static valueIsNotInFilteredData(filteredData, value) {
117
- if (Select2Utils.isNullOrUndefined(value)) {
118
- return true;
119
- }
120
- for (const groupOrOption of filteredData) {
121
- const options = groupOrOption.options;
122
- if (options) {
123
- for (const option of options) {
124
- if (option.value === value) {
125
- return false;
126
- }
127
- }
128
- }
129
- else if (groupOrOption.value === value) {
130
- return false;
131
- }
132
- }
133
- return true;
134
- }
135
- // eslint-disable-next-line
136
- static getPreviousOption(filteredData, hoveringValue) {
137
- let findIt = Select2Utils.isNullOrUndefined(hoveringValue);
138
- for (let i = filteredData.length - 1; i >= 0; i--) {
139
- const groupOrOption = filteredData[i];
140
- const options = groupOrOption.options;
141
- if (options) {
142
- for (let j = options.length - 1; j >= 0; j--) {
143
- const option = options[j];
144
- if (findIt && !option.disabled && !option.hide) {
145
- return option;
146
- }
147
- if (!findIt) {
148
- findIt = option.value === hoveringValue;
149
- }
150
- }
151
- }
152
- else {
153
- const option = groupOrOption;
154
- if (findIt && !option.disabled && !option.hide) {
155
- return option;
156
- }
157
- if (!findIt) {
158
- findIt = option.value === hoveringValue;
159
- }
160
- }
161
- }
162
- return null;
163
- }
164
- // eslint-disable-next-line
165
- static getNextOption(filteredData, hoveringValue) {
166
- let findIt = Select2Utils.isNullOrUndefined(hoveringValue);
167
- for (const groupOrOption of filteredData) {
168
- const options = groupOrOption.options;
169
- if (options) {
170
- for (const option of options) {
171
- if (findIt) {
172
- if (!option.disabled && !option.hide) {
173
- return option;
174
- }
175
- }
176
- else if (!findIt) {
177
- findIt = option.value === hoveringValue;
178
- }
179
- }
180
- }
181
- else {
182
- const option = groupOrOption;
183
- if (findIt) {
184
- if (!option.disabled && !option.hide) {
185
- return option;
186
- }
187
- }
188
- else if (!findIt) {
189
- findIt = option.value === hoveringValue;
190
- }
191
- }
192
- }
193
- return null;
194
- }
195
- static getReduceData(data, maxResults = 0) {
196
- if (maxResults > 0) {
197
- let counter = 0;
198
- const result = [];
199
- // debugger;
200
- for (const groupOrOption of data) {
201
- const options = groupOrOption.options;
202
- if (options) {
203
- const group = {
204
- ...groupOrOption,
205
- options: [],
206
- };
207
- result.push(group);
208
- for (const item of options) {
209
- group.options.push(item);
210
- counter++;
211
- if (counter === maxResults) {
212
- return { result, reduce: true };
213
- }
214
- }
215
- }
216
- else {
217
- result.push(groupOrOption);
218
- counter++;
219
- }
220
- if (counter === maxResults) {
221
- return { result, reduce: true };
222
- }
223
- }
224
- return { result, reduce: false };
225
- }
226
- else {
227
- return { result: data, reduce: false };
228
- }
229
- }
230
- static getFilteredData(data, searchText, editPattern) {
231
- if (searchText) {
232
- const result = [];
233
- for (const groupOrOption of data) {
234
- const options = groupOrOption.options;
235
- if (options) {
236
- if (options.some(group => Select2Utils.containSearchText(group.label, searchText, editPattern))) {
237
- const filteredOptions = options.filter(group => Select2Utils.containSearchText(group.label, searchText, editPattern));
238
- result.push({
239
- ...groupOrOption,
240
- options: filteredOptions,
241
- });
242
- }
243
- }
244
- else if (Select2Utils.containSearchText(groupOrOption.label, searchText, editPattern)) {
245
- result.push(groupOrOption);
246
- }
247
- }
248
- return result;
249
- }
250
- else {
251
- return data;
252
- }
253
- }
254
- static getFilteredSelectedData(data, selectedOptions) {
255
- const result = [];
256
- for (const groupOrOption of data) {
257
- const options = groupOrOption.options;
258
- if (options) {
259
- const filteredOptions = options.filter(group => Select2Utils.isSelected(selectedOptions, group, true) === 'false');
260
- if (filteredOptions.length) {
261
- result.push({
262
- ...groupOrOption,
263
- options: filteredOptions,
264
- });
265
- }
266
- }
267
- else if (Select2Utils.isSelected(selectedOptions, groupOrOption, true) === 'false') {
268
- result.push(groupOrOption);
269
- }
270
- }
271
- return result;
272
- }
273
- static isSearchboxHiddex(data, minCountForSearch) {
274
- if (minCountForSearch === '' ||
275
- minCountForSearch === undefined ||
276
- minCountForSearch === null ||
277
- isNaN(+minCountForSearch)) {
278
- minCountForSearch = defaultMinCountForSearch;
279
- }
280
- const optionCount = Select2Utils.getOptionsCount(data);
281
- return optionCount < +minCountForSearch;
282
- }
283
- static isSelected(options, option, multiple) {
284
- return multiple
285
- ? options && options.some(op => op.value === option.value)
286
- ? 'true'
287
- : 'false'
288
- : options && option.value === options.value
289
- ? 'true'
290
- : 'false';
291
- }
292
- static removeSelection(options, option) {
293
- for (let i = 0; i < options.length; i++) {
294
- if (options[i].value === option.value) {
295
- options.splice(i, 1);
296
- return;
297
- }
298
- }
299
- }
300
- static getOptionsCount(data) {
301
- let count = 0;
302
- if (Array.isArray(data)) {
303
- for (const groupOrOption of data) {
304
- const options = groupOrOption.options;
305
- if (options) {
306
- count += options.length;
307
- }
308
- else {
309
- count++;
310
- }
311
- }
312
- }
313
- return count;
314
- }
315
- static isNullOrUndefined(value) {
316
- return value === null || value === undefined;
317
- }
318
- static containSearchText(label, searchText, editPattern) {
319
- return searchText
320
- ? Select2Utils.formatSansUnicode(label).match(new RegExp(Select2Utils.formatPattern(searchText, editPattern), 'i')) !== null
321
- : true;
322
- }
323
- static protectPattern(str) {
324
- return str.replace(protectRegexp, '\\$&');
325
- }
326
- static formatSansUnicode(str) {
327
- for (const unicodePattern of unicodePatterns) {
328
- str = str.replace(unicodePattern.s, unicodePattern.l);
329
- }
330
- return str;
331
- }
332
- static formatPattern(str, editPattern) {
333
- str = Select2Utils.formatSansUnicode(Select2Utils.protectPattern(str));
334
- if (editPattern && typeof editPattern === 'function') {
335
- str = editPattern(str);
336
- }
337
- return str;
338
- }
63
+ class Select2Utils {
64
+ static getOptionByValue(data, value) {
65
+ if (Array.isArray(data)) {
66
+ for (const groupOrOption of data) {
67
+ const options = groupOrOption.options;
68
+ if (options) {
69
+ for (const option of options) {
70
+ if (option.value === value) {
71
+ return option;
72
+ }
73
+ }
74
+ }
75
+ else if (groupOrOption.value === value) {
76
+ return groupOrOption;
77
+ }
78
+ }
79
+ }
80
+ return null;
81
+ }
82
+ static getOptionsByValue(data, value, multiple) {
83
+ if (multiple) {
84
+ const values = Array.isArray(value) ? value : [];
85
+ const result = [];
86
+ for (const v of values) {
87
+ const option = Select2Utils.getOptionByValue(data, v);
88
+ if (option) {
89
+ result.push(option);
90
+ }
91
+ }
92
+ return result;
93
+ }
94
+ return Select2Utils.getOptionByValue(data, value);
95
+ }
96
+ static getFirstAvailableOption(data) {
97
+ if (Array.isArray(data)) {
98
+ for (const groupOrOption of data) {
99
+ const options = groupOrOption.options;
100
+ if (options) {
101
+ for (const option of options) {
102
+ if (!option.disabled) {
103
+ return option.value;
104
+ }
105
+ }
106
+ }
107
+ else {
108
+ const option = groupOrOption;
109
+ if (!option.disabled) {
110
+ return option.value;
111
+ }
112
+ }
113
+ }
114
+ }
115
+ return null;
116
+ }
117
+ static valueIsNotInFilteredData(filteredData, value) {
118
+ if (Select2Utils.isNullOrUndefined(value)) {
119
+ return true;
120
+ }
121
+ for (const groupOrOption of filteredData) {
122
+ const options = groupOrOption.options;
123
+ if (options) {
124
+ for (const option of options) {
125
+ if (option.value === value) {
126
+ return false;
127
+ }
128
+ }
129
+ }
130
+ else if (groupOrOption.value === value) {
131
+ return false;
132
+ }
133
+ }
134
+ return true;
135
+ }
136
+ // eslint-disable-next-line
137
+ static getPreviousOption(filteredData, hoveringValue) {
138
+ let findIt = Select2Utils.isNullOrUndefined(hoveringValue);
139
+ for (let i = filteredData.length - 1; i >= 0; i--) {
140
+ const groupOrOption = filteredData[i];
141
+ const options = groupOrOption.options;
142
+ if (options) {
143
+ for (let j = options.length - 1; j >= 0; j--) {
144
+ const option = options[j];
145
+ if (findIt && !option.disabled && !option.hide) {
146
+ return option;
147
+ }
148
+ if (!findIt) {
149
+ findIt = option.value === hoveringValue;
150
+ }
151
+ }
152
+ }
153
+ else {
154
+ const option = groupOrOption;
155
+ if (findIt && !option.disabled && !option.hide) {
156
+ return option;
157
+ }
158
+ if (!findIt) {
159
+ findIt = option.value === hoveringValue;
160
+ }
161
+ }
162
+ }
163
+ return null;
164
+ }
165
+ // eslint-disable-next-line
166
+ static getNextOption(filteredData, hoveringValue) {
167
+ let findIt = Select2Utils.isNullOrUndefined(hoveringValue);
168
+ for (const groupOrOption of filteredData) {
169
+ const options = groupOrOption.options;
170
+ if (options) {
171
+ for (const option of options) {
172
+ if (findIt) {
173
+ if (!option.disabled && !option.hide) {
174
+ return option;
175
+ }
176
+ }
177
+ else if (!findIt) {
178
+ findIt = option.value === hoveringValue;
179
+ }
180
+ }
181
+ }
182
+ else {
183
+ const option = groupOrOption;
184
+ if (findIt) {
185
+ if (!option.disabled && !option.hide) {
186
+ return option;
187
+ }
188
+ }
189
+ else if (!findIt) {
190
+ findIt = option.value === hoveringValue;
191
+ }
192
+ }
193
+ }
194
+ return null;
195
+ }
196
+ static getReduceData(data, maxResults = 0) {
197
+ if (maxResults > 0) {
198
+ let counter = 0;
199
+ const result = [];
200
+ // debugger;
201
+ for (const groupOrOption of data) {
202
+ const options = groupOrOption.options;
203
+ if (options) {
204
+ const group = {
205
+ ...groupOrOption,
206
+ options: [],
207
+ };
208
+ result.push(group);
209
+ for (const item of options) {
210
+ group.options.push(item);
211
+ counter++;
212
+ if (counter === maxResults) {
213
+ return { result, reduce: true };
214
+ }
215
+ }
216
+ }
217
+ else {
218
+ result.push(groupOrOption);
219
+ counter++;
220
+ }
221
+ if (counter === maxResults) {
222
+ return { result, reduce: true };
223
+ }
224
+ }
225
+ return { result, reduce: false };
226
+ }
227
+ else {
228
+ return { result: data, reduce: false };
229
+ }
230
+ }
231
+ static getFilteredData(data, searchText, editPattern) {
232
+ if (searchText) {
233
+ const result = [];
234
+ for (const groupOrOption of data) {
235
+ const options = groupOrOption.options;
236
+ if (options) {
237
+ if (options.some(group => Select2Utils.containSearchText(group.label, searchText, editPattern))) {
238
+ const filteredOptions = options.filter(group => Select2Utils.containSearchText(group.label, searchText, editPattern));
239
+ result.push({
240
+ ...groupOrOption,
241
+ options: filteredOptions,
242
+ });
243
+ }
244
+ }
245
+ else if (Select2Utils.containSearchText(groupOrOption.label, searchText, editPattern)) {
246
+ result.push(groupOrOption);
247
+ }
248
+ }
249
+ return result;
250
+ }
251
+ else {
252
+ return data;
253
+ }
254
+ }
255
+ static getFilteredSelectedData(data, selectedOptions) {
256
+ const result = [];
257
+ for (const groupOrOption of data) {
258
+ const options = groupOrOption.options;
259
+ if (options) {
260
+ const filteredOptions = options.filter(group => Select2Utils.isSelected(selectedOptions, group, true) === 'false');
261
+ if (filteredOptions.length) {
262
+ result.push({
263
+ ...groupOrOption,
264
+ options: filteredOptions,
265
+ });
266
+ }
267
+ }
268
+ else if (Select2Utils.isSelected(selectedOptions, groupOrOption, true) === 'false') {
269
+ result.push(groupOrOption);
270
+ }
271
+ }
272
+ return result;
273
+ }
274
+ static isSearchboxHiddex(data, minCountForSearch) {
275
+ if (minCountForSearch === '' ||
276
+ minCountForSearch === undefined ||
277
+ minCountForSearch === null ||
278
+ isNaN(+minCountForSearch)) {
279
+ minCountForSearch = defaultMinCountForSearch;
280
+ }
281
+ const optionCount = Select2Utils.getOptionsCount(data);
282
+ return optionCount < +minCountForSearch;
283
+ }
284
+ static isSelected(options, option, multiple) {
285
+ return multiple
286
+ ? options && options.some(op => op.value === option.value)
287
+ ? 'true'
288
+ : 'false'
289
+ : options && option.value === options.value
290
+ ? 'true'
291
+ : 'false';
292
+ }
293
+ static removeSelection(options, option) {
294
+ for (let i = 0; i < options.length; i++) {
295
+ if (options[i].value === option.value) {
296
+ options.splice(i, 1);
297
+ return;
298
+ }
299
+ }
300
+ }
301
+ static getOptionsCount(data) {
302
+ let count = 0;
303
+ if (Array.isArray(data)) {
304
+ for (const groupOrOption of data) {
305
+ const options = groupOrOption.options;
306
+ if (options) {
307
+ count += options.length;
308
+ }
309
+ else {
310
+ count++;
311
+ }
312
+ }
313
+ }
314
+ return count;
315
+ }
316
+ static isNullOrUndefined(value) {
317
+ return value === null || value === undefined;
318
+ }
319
+ static containSearchText(label, searchText, editPattern) {
320
+ return searchText
321
+ ? Select2Utils.formatSansUnicode(label).match(new RegExp(Select2Utils.formatPattern(searchText, editPattern), 'i')) !== null
322
+ : true;
323
+ }
324
+ static protectPattern(str) {
325
+ return str.replace(protectRegexp, '\\$&');
326
+ }
327
+ static formatSansUnicode(str) {
328
+ for (const unicodePattern of unicodePatterns) {
329
+ str = str.replace(unicodePattern.s, unicodePattern.l);
330
+ }
331
+ return str;
332
+ }
333
+ static formatPattern(str, editPattern) {
334
+ str = Select2Utils.formatSansUnicode(Select2Utils.protectPattern(str));
335
+ if (editPattern && typeof editPattern === 'function') {
336
+ str = editPattern(str);
337
+ }
338
+ return str;
339
+ }
339
340
  }
340
341
 
341
- let nextUniqueId = 0;
342
- const displaySearchStatusList = ['default', 'hidden', 'always'];
343
- class Select2 {
344
- /** data of options & optiongrps */
345
- set data(data) {
346
- this._data = data;
347
- this.updateFilteredData();
348
- }
349
- get multiple() {
350
- return this._multiple;
351
- }
352
- set multiple(value) {
353
- this._multiple = this._coerceBooleanProperty(value);
354
- this.ngOnInit();
355
- }
356
- /** use the material style */
357
- get overlay() {
358
- return this._overlay;
359
- }
360
- set overlay(value) {
361
- this._overlay = this._coerceBooleanProperty(value);
362
- }
363
- /** infinite scroll activated */
364
- get infiniteScroll() {
365
- return this._infiniteScroll;
366
- }
367
- set infiniteScroll(value) {
368
- this._infiniteScroll = this._coerceBooleanProperty(value);
369
- }
370
- /** auto create if not existe */
371
- get autoCreate() {
372
- return this._autoCreate;
373
- }
374
- set autoCreate(value) {
375
- this._autoCreate = this._coerceBooleanProperty(value);
376
- }
377
- /** no template for label selection */
378
- get noLabelTemplate() {
379
- return this._noLabelTemplate;
380
- }
381
- set noLabelTemplate(value) {
382
- this._noLabelTemplate = this._coerceBooleanProperty(value);
383
- }
384
- get select2Options() {
385
- return this.multiple ? this.option : null;
386
- }
387
- get select2Option() {
388
- return this.multiple ? null : this.option;
389
- }
390
- get searchText() {
391
- return this.innerSearchText;
392
- }
393
- set searchText(text) {
394
- if (this.customSearchEnabled) {
395
- this.search.emit({
396
- component: this,
397
- value: this._value,
398
- search: text,
399
- });
400
- }
401
- this.innerSearchText = text;
402
- }
403
- /** minimal data of show the search field */
404
- get minCountForSearch() {
405
- return this._minCountForSearch;
406
- }
407
- set minCountForSearch(value) {
408
- this._minCountForSearch = value;
409
- this.updateSearchBox();
410
- }
411
- /** Unique id of the element. */
412
- get id() {
413
- return this._id;
414
- }
415
- set id(value) {
416
- this._id = value || this._uid;
417
- }
418
- /** Whether the element is required. */
419
- get required() {
420
- return this._required;
421
- }
422
- set required(value) {
423
- this._required = this._coerceBooleanProperty(value);
424
- }
425
- /** Whether selected items should be hidden. */
426
- get disabled() {
427
- return this._control ? this._control.disabled : this._disabled;
428
- }
429
- set disabled(value) {
430
- this._disabled = this._coerceBooleanProperty(value);
431
- }
432
- /** Whether items are hidden when has. */
433
- get hideSelectedItems() {
434
- return this._hideSelectedItems;
435
- }
436
- set hideSelectedItems(value) {
437
- this._hideSelectedItems = this._coerceBooleanProperty(value);
438
- }
439
- /** Whether the element is readonly. */
440
- get readonly() {
441
- return this._readonly;
442
- }
443
- set readonly(value) {
444
- this._readonly = this._coerceBooleanProperty(value);
445
- }
446
- /** The input element's value. */
447
- get value() {
448
- return this._value;
449
- }
450
- set value(value) {
451
- if (this.testValueChange(this._value, value)) {
452
- setTimeout(() => {
453
- this._value = value;
454
- this.writeValue(value);
455
- }, 10);
456
- }
457
- }
458
- /** Tab index for the select2 element. */
459
- get tabIndex() {
460
- return this.disabled ? -1 : this._tabIndex;
461
- }
462
- set tabIndex(value) {
463
- if (typeof value !== 'undefined') {
464
- this._tabIndex = value;
465
- }
466
- }
467
- /** reset with no selected value */
468
- get resettable() {
469
- return this._resettable;
470
- }
471
- set resettable(value) {
472
- this._resettable = this._coerceBooleanProperty(value);
473
- }
474
- get ariaInvalid() {
475
- return this._isErrorState();
476
- }
477
- get classMaterial() {
478
- return this.styleMode === 'material';
479
- }
480
- get classNostyle() {
481
- return this.styleMode === 'noStyle';
482
- }
483
- get select2above() {
484
- return !this.overlay ? this.listPosition === 'above' : this._isAbobeOverlay();
485
- }
486
- get _positions() {
487
- return this.listPosition === 'auto' ? undefined : null;
488
- }
489
- get resultsElement() {
490
- return this.resultContainer?.nativeElement;
491
- }
492
- constructor(_viewportRuler, _changeDetectorRef, _parentForm, _parentFormGroup, _control, tabIndex) {
493
- this._viewportRuler = _viewportRuler;
494
- this._changeDetectorRef = _changeDetectorRef;
495
- this._parentForm = _parentForm;
496
- this._parentFormGroup = _parentFormGroup;
497
- this._control = _control;
498
- this.minCharForSearch = 0;
499
- this.limitSelection = 0;
500
- this.listPosition = 'below';
501
- /** use the material style */
502
- this.styleMode = 'default';
503
- /** maximum results limit (0 = no limit) */
504
- this.maxResults = 0;
505
- /** message when maximum results */
506
- this.maxResultsMessage = 'Too many results…';
507
- /** infinite scroll distance */
508
- this.infiniteScrollDistance = 1.5;
509
- /** infinite scroll distance */
510
- this.infiniteScrollThrottle = 150;
511
- /** the max height of the results container when opening the select */
512
- this.resultMaxHeight = '200px';
513
- this.update = new EventEmitter();
514
- this.open = new EventEmitter();
515
- this.close = new EventEmitter();
516
- this.focus = new EventEmitter();
517
- this.blur = new EventEmitter();
518
- this.search = new EventEmitter();
519
- this.scroll = new EventEmitter();
520
- this.removeOption = new EventEmitter();
521
- this.option = null;
522
- this.isOpen = false;
523
- /** Whether the element is focused or not. */
524
- this.focused = false;
525
- this.hoveringValue = null;
526
- this.innerSearchText = '';
527
- this._stateChanges = new Subject();
528
- this._disabled = false;
529
- this._required = false;
530
- this._readonly = false;
531
- this._multiple = false;
532
- this._overlay = false;
533
- this._resettable = false;
534
- this._hideSelectedItems = false;
535
- this._clickDetection = false;
536
- this._uid = `select2-${nextUniqueId++}`;
537
- this._infiniteScroll = true;
538
- this._autoCreate = true;
539
- this._noLabelTemplate = true;
540
- /** View -> model callback called when select has been touched */
541
- this._onTouched = () => {
542
- // do nothing
543
- };
544
- /** View -> model callback called when value changes */
545
- this._onChange = () => {
546
- // do nothing
547
- };
548
- // eslint-disable-next-line no-self-assign
549
- this.id = this.id;
550
- this._tabIndex = parseInt(tabIndex, 10) || 0;
551
- if (this._control) {
552
- this._control.valueAccessor = this;
553
- }
554
- this._clickDetectionFc = this.clickDetection.bind(this);
555
- }
556
- ngOnInit() {
557
- this._viewportRuler.change(100).subscribe(() => {
558
- if (this.isOpen) {
559
- this.triggerRect();
560
- }
561
- });
562
- const option = Select2Utils.getOptionsByValue(this._data, this._control ? this._control.value : this.value, this.multiple);
563
- if (option !== null) {
564
- this.option = option;
565
- }
566
- if (!Array.isArray(option)) {
567
- this.hoveringValue = this.value;
568
- }
569
- this.updateSearchBox();
570
- }
571
- ngAfterViewInit() {
572
- this.cdkConnectedOverlay.positionChange.subscribe((posChange) => {
573
- if (this.listPosition === 'auto' &&
574
- posChange.connectionPair?.originY &&
575
- this._overlayPosition !== posChange.connectionPair.originY) {
576
- this.triggerRect();
577
- this._overlayPosition = posChange.connectionPair.originY;
578
- this._changeDetectorRef.detectChanges();
579
- }
580
- });
581
- this.selectionElement = this.selection.nativeElement;
582
- this.triggerRect();
583
- }
584
- ngDoCheck() {
585
- this.updateSearchBox();
586
- this._dirtyCheckNativeValue();
587
- if (this._triggerRect) {
588
- if (this.overlayWidth !== this._triggerRect.width) {
589
- this.overlayWidth = this._triggerRect.width;
590
- }
591
- if (this._dropdownRect?.height > 0 && this.overlayHeight !== this._dropdownRect.height) {
592
- this.overlayHeight = this.listPosition === 'auto' ? this._dropdownRect.height : 0;
593
- }
594
- }
595
- }
596
- ngOnDestroy() {
597
- window.document.body.removeEventListener('click', this._clickDetectionFc);
598
- }
599
- updateSearchBox() {
600
- const hidden = this.customSearchEnabled
601
- ? false
602
- : Select2Utils.isSearchboxHiddex(this._data, this._minCountForSearch);
603
- if (this.isSearchboxHidden !== hidden) {
604
- this.isSearchboxHidden = hidden;
605
- }
606
- }
607
- hideSearch() {
608
- const displaySearchStatus = displaySearchStatusList.indexOf(this.displaySearchStatus) > -1 ? this.displaySearchStatus : 'default';
609
- return (displaySearchStatus === 'default' && this.isSearchboxHidden) || displaySearchStatus === 'hidden';
610
- }
611
- getOptionStyle(option) {
612
- return ('select2-results__option ' +
613
- (option.hide ? 'select2-results__option--hide ' : '') +
614
- (option.value === this.hoveringValue ? 'select2-results__option--highlighted ' : '') +
615
- (option.classes || ''));
616
- }
617
- mouseenter(option) {
618
- if (!option.disabled) {
619
- this.hoveringValue = option.value;
620
- }
621
- }
622
- click(option) {
623
- if (this.testSelection(option)) {
624
- this.select(option);
625
- }
626
- }
627
- reset(event) {
628
- this.select(null);
629
- this.stopEvent(event);
630
- }
631
- prevChange(event) {
632
- event.stopPropagation();
633
- }
634
- stopEvent(event) {
635
- event.preventDefault();
636
- event.stopPropagation();
637
- }
638
- toggleOpenAndClose(focus = true, open) {
639
- if (this.disabled) {
640
- return;
641
- }
642
- this._focus(focus);
643
- this.isOpen = open ?? !this.isOpen;
644
- if (this.isOpen) {
645
- this.innerSearchText = '';
646
- this.updateFilteredData();
647
- this._focusSearchboxOrResultsElement(focus);
648
- setTimeout(() => {
649
- if (this.option) {
650
- const option = this.option instanceof Array ? this.option[0] : this.option;
651
- this.updateScrollFromOption(option);
652
- }
653
- else if (this.resultsElement) {
654
- this.resultsElement.scrollTop = 0;
655
- }
656
- setTimeout(() => {
657
- this.triggerRect();
658
- this.cdkConnectedOverlay?.overlayRef?.updatePosition();
659
- }, 100);
660
- });
661
- this.open.emit(this);
662
- }
663
- else {
664
- this.close.emit(this);
665
- }
666
- if (this.isOpen && !this._clickDetection && focus) {
667
- setTimeout(() => {
668
- window.document.body.addEventListener('click', this._clickDetectionFc, false);
669
- this._clickDetection = true;
670
- }, timeout);
671
- }
672
- this._changeDetectorRef.markForCheck();
673
- }
674
- hasTemplate(option, defaut) {
675
- return (this.templates instanceof TemplateRef ||
676
- this.templates?.[option.templateId] instanceof TemplateRef ||
677
- this.templates?.[defaut] instanceof TemplateRef);
678
- }
679
- getTemplate(option, defaut) {
680
- return this.hasTemplate(option, defaut)
681
- ? this.templates[option.templateId] || this.templates[defaut] || this.templates
682
- : undefined;
683
- }
684
- triggerRect() {
685
- this._triggerRect = this.selectionElement.getBoundingClientRect();
686
- this._dropdownRect = this.dropdown?.nativeElement
687
- ? this.dropdown.nativeElement.getBoundingClientRect()
688
- : undefined;
689
- }
690
- testSelection(option) {
691
- if (option.disabled) {
692
- return false;
693
- }
694
- return (!this.multiple ||
695
- !this.limitSelection ||
696
- (Array.isArray(this._value) && this._value.length < this.limitSelection));
697
- }
698
- testValueChange(value1, value2) {
699
- if (((value1 === null || value1 === undefined) && (value2 === null || value2 === undefined)) ||
700
- value1 === value2) {
701
- return false;
702
- }
703
- if (this.multiple &&
704
- value1?.length &&
705
- value2?.length &&
706
- value1.length === value2.length) {
707
- for (const e1 of value1) {
708
- const test = value2.indexOf(e1) > -1;
709
- if (!test) {
710
- return true;
711
- }
712
- }
713
- return false;
714
- }
715
- return true;
716
- }
717
- updateFilteredData() {
718
- setTimeout(() => {
719
- let result = this._data;
720
- if (this.multiple && this.hideSelectedItems) {
721
- result = Select2Utils.getFilteredSelectedData(result, this.option);
722
- }
723
- if (!this.customSearchEnabled && this.searchText && this.searchText.length >= +this.minCharForSearch) {
724
- result = Select2Utils.getFilteredData(result, this.searchText, this.editPattern);
725
- }
726
- if (this.maxResults > 0) {
727
- const data = Select2Utils.getReduceData(result, +this.maxResults);
728
- result = data.result;
729
- this.maxResultsExceeded = data.reduce;
730
- }
731
- else {
732
- this.maxResultsExceeded = false;
733
- }
734
- if (Select2Utils.valueIsNotInFilteredData(result, this.hoveringValue)) {
735
- this.hoveringValue = Select2Utils.getFirstAvailableOption(result);
736
- }
737
- this.filteredData = result;
738
- this._changeDetectorRef.markForCheck();
739
- });
740
- }
741
- clickDetection(e) {
742
- if (!this.ifParentContainsClass(e.target, 'selection')) {
743
- if (this.isOpen && !this.ifParentContainsClass(e.target, 'select2-dropdown')) {
744
- this.toggleOpenAndClose();
745
- }
746
- if (!this.ifParentContainsId(e.target, this._id)) {
747
- this.clickExit();
748
- }
749
- }
750
- else if (this.isOpen && !this.ifParentContainsId(e.target, this._id)) {
751
- this.toggleOpenAndClose();
752
- this.clickExit();
753
- }
754
- }
755
- clickExit() {
756
- this._focus(false);
757
- window.document.body.removeEventListener('click', this._clickDetectionFc);
758
- this._clickDetection = false;
759
- }
760
- ifParentContainsClass(element, cssClass) {
761
- return this.getParentElementByClass(element, cssClass) !== null;
762
- }
763
- ifParentContainsId(element, id) {
764
- return this.getParentElementById(element, id) !== null;
765
- }
766
- getParentElementByClass(element, cssClass) {
767
- return this.containClasses(element, cssClass.trim().split(/\s+/))
768
- ? element
769
- : element.parentElement
770
- ? this.getParentElementByClass(element.parentElement, cssClass)
771
- : null;
772
- }
773
- getParentElementById(element, id) {
774
- return element.id === id
775
- ? element
776
- : element.parentElement
777
- ? this.getParentElementById(element.parentElement, id)
778
- : null;
779
- }
780
- containClasses(element, cssClasses) {
781
- if (!element.classList) {
782
- return false;
783
- }
784
- for (const cssClass of cssClasses) {
785
- if (!element.classList.contains(cssClass)) {
786
- return false;
787
- }
788
- }
789
- return true;
790
- }
791
- focusin() {
792
- if (!this.disabled) {
793
- this._focus(true);
794
- }
795
- }
796
- focusout() {
797
- if (this.selectionElement && !this.selectionElement.classList.contains('select2-focused')) {
798
- this._focus(false);
799
- this._onTouched();
800
- }
801
- }
802
- select(option) {
803
- let value;
804
- if (option !== null) {
805
- if (this.multiple) {
806
- const options = this.option;
807
- const index = options.findIndex(op => op.value === option.value);
808
- if (index === -1) {
809
- options.push(option);
810
- }
811
- else {
812
- options.splice(index, 1);
813
- }
814
- value = this.option.map(op => op.value);
815
- }
816
- else {
817
- this.option = option;
818
- if (this.isOpen) {
819
- this.isOpen = false;
820
- this.close.emit(this);
821
- this.selectionElement?.focus();
822
- }
823
- value = this.option.value;
824
- }
825
- }
826
- else {
827
- this.option = null;
828
- }
829
- if (this.multiple && this.hideSelectedItems) {
830
- this.updateFilteredData();
831
- }
832
- if (this._control) {
833
- this._onChange(value);
834
- }
835
- else {
836
- this._value = value;
837
- }
838
- this.update.emit({
839
- component: this,
840
- value: value,
841
- options: Array.isArray(this.option) ? this.option : this.option ? [this.option] : null,
842
- });
843
- }
844
- keyDown(e, create = false) {
845
- if (create && this._testKey(e, ['Enter', 13])) {
846
- this.createAndAdd(e);
847
- return;
848
- }
849
- if (this._testKey(e, ['ArrowDown', 40])) {
850
- this.moveDown();
851
- e.preventDefault();
852
- }
853
- else if (this._testKey(e, ['ArrowUp', 38])) {
854
- this.moveUp();
855
- e.preventDefault();
856
- }
857
- else if (this._testKey(e, ['Enter', 13])) {
858
- this.selectByEnter();
859
- e.preventDefault();
860
- }
861
- else if (this._testKey(e, ['Escape', 'Tab', 9, 27]) && this.isOpen) {
862
- this.toggleOpenAndClose();
863
- this._focus(false);
864
- }
865
- }
866
- openKey(e, create = false) {
867
- if (create && this._testKey(e, ['Enter', 13])) {
868
- this.createAndAdd(e);
869
- return;
870
- }
871
- if (this._testKey(e, ['ArrowDown', 'ArrowUp', 'Enter', 40, 38, 13])) {
872
- this.toggleOpenAndClose();
873
- e.preventDefault();
874
- }
875
- else if (this._testKey(e, ['Escape', 'Tab', 9, 27])) {
876
- this._focus(false);
877
- this._onTouched();
878
- }
879
- }
880
- searchUpdate(e) {
881
- this.searchText = e.target.value;
882
- this.updateFilteredData();
883
- }
884
- trackBy(_index, item) {
885
- return item.value;
886
- }
887
- isSelected(option) {
888
- return Select2Utils.isSelected(this.option, option, this.multiple);
889
- }
890
- isDisabled(option) {
891
- return option.disabled ? 'true' : 'false';
892
- }
893
- removeSelection(e, option) {
894
- Select2Utils.removeSelection(this.option, option);
895
- if (this.multiple && this.hideSelectedItems) {
896
- this.updateFilteredData();
897
- }
898
- const value = this.option.map(op => op.value);
899
- if (this._control) {
900
- this._onChange(value);
901
- }
902
- else {
903
- this._value = value;
904
- }
905
- this.update.emit({
906
- component: this,
907
- value: value,
908
- options: Array.isArray(this.option) ? this.option : this.option ? [this.option] : null,
909
- });
910
- this.removeOption.emit({
911
- component: this,
912
- value: value,
913
- removedOption: option,
914
- });
915
- e.preventDefault();
916
- e.stopPropagation();
917
- if (this.isOpen) {
918
- this._focusSearchboxOrResultsElement();
919
- }
920
- }
921
- /**
922
- * Sets the model value. Implemented as part of ControlValueAccessor.
923
- * @param value
924
- */
925
- writeValue(value) {
926
- this._setSelectionByValue(value);
927
- }
928
- /**
929
- * Saves a callback function to be invoked when the select's value
930
- * changes from user input. Part of the ControlValueAccessor interface
931
- * required to integrate with Angular's core forms API.
932
- *
933
- * @param fn Callback to be triggered when the value changes.
934
- */
935
- registerOnChange(fn) {
936
- this._onChange = fn;
937
- }
938
- /**
939
- * Saves a callback function to be invoked when the select is blurred
940
- * by the user. Part of the ControlValueAccessor interface required
941
- * to integrate with Angular's core forms API.
942
- *
943
- * @param fn Callback to be triggered when the component has been touched.
944
- */
945
- registerOnTouched(fn) {
946
- this._onTouched = fn;
947
- }
948
- /**
949
- * Sets whether the component should be disabled.
950
- * Implemented as part of ControlValueAccessor.
951
- * @param isDisabled
952
- */
953
- setDisabledState(isDisabled) {
954
- this.disabled = isDisabled;
955
- }
956
- onScroll(way) {
957
- this.scroll.emit({
958
- component: this,
959
- way,
960
- search: this.innerSearchText,
961
- });
962
- }
963
- _isErrorState() {
964
- const isInvalid = this._control?.invalid;
965
- const isTouched = this._control?.touched;
966
- const isSubmitted = this._parentFormGroup?.submitted || this._parentForm?.submitted;
967
- return !!(isInvalid && (isTouched || isSubmitted));
968
- }
969
- addItem(value) {
970
- let item = Select2Utils.getOptionByValue(this._data, value);
971
- if (!item) {
972
- item = {
973
- value,
974
- label: value,
975
- };
976
- this._data.push(item);
977
- }
978
- return item;
979
- }
980
- createAndAdd(e) {
981
- const value = e.target.value;
982
- if (value.trim()) {
983
- const item = this.addItem(value.trim());
984
- this.click(item);
985
- e.target.value = '';
986
- }
987
- this.stopEvent(e);
988
- }
989
- moveUp() {
990
- this.updateScrollFromOption(Select2Utils.getPreviousOption(this.filteredData, this.hoveringValue));
991
- }
992
- moveDown() {
993
- this.updateScrollFromOption(Select2Utils.getNextOption(this.filteredData, this.hoveringValue));
994
- }
995
- updateScrollFromOption(option) {
996
- if (option) {
997
- this.hoveringValue = option.value;
998
- const domElement = this.results.find(r => r.nativeElement.innerText.trim() === option.label);
999
- if (domElement && this.resultsElement) {
1000
- this.resultsElement.scrollTop = 0;
1001
- const listClientRect = this.resultsElement.getBoundingClientRect();
1002
- const optionClientRect = domElement.nativeElement.getBoundingClientRect();
1003
- this.resultsElement.scrollTop = optionClientRect.top - listClientRect.top;
1004
- }
1005
- }
1006
- }
1007
- selectByEnter() {
1008
- if (this.hoveringValue) {
1009
- const option = Select2Utils.getOptionByValue(this._data, this.hoveringValue);
1010
- this.select(option);
1011
- }
1012
- }
1013
- _testKey(event, refs = []) {
1014
- return this._isKey(this._getKey(event), refs);
1015
- }
1016
- _getKey(event) {
1017
- let code;
1018
- if (event.key !== undefined) {
1019
- code = event.key;
1020
- }
1021
- else if (event['keyIdentifier'] !== undefined) {
1022
- code = event['keyIdentifier'];
1023
- }
1024
- else if (event['keyCode'] !== undefined) {
1025
- code = event['keyCode'];
1026
- }
1027
- else {
1028
- event.preventDefault();
1029
- }
1030
- return code;
1031
- }
1032
- _isKey(code, refs = []) {
1033
- return refs && refs.length > 0 ? refs.indexOf(code) !== -1 : false;
1034
- }
1035
- /**
1036
- * Sets the selected option based on a value. If no option can be
1037
- * found with the designated value, the select trigger is cleared.
1038
- */
1039
- _setSelectionByValue(value) {
1040
- if (this.option || (value !== undefined && value !== null)) {
1041
- const isArray = Array.isArray(value);
1042
- if (this.multiple && value && !isArray) {
1043
- throw new Error('Non array value.');
1044
- }
1045
- else if (this._data) {
1046
- if (this.multiple) {
1047
- this.option = []; // if value is null, then empty option and return
1048
- if (isArray) {
1049
- // value is not null. Preselect value
1050
- const selectedValues = Select2Utils.getOptionsByValue(this._data, value, this.multiple);
1051
- selectedValues.map(item => this.select(item));
1052
- }
1053
- }
1054
- else {
1055
- this.select(Select2Utils.getOptionByValue(this._data, value));
1056
- }
1057
- }
1058
- else if (this._control) {
1059
- this._control.viewToModelUpdate(value);
1060
- }
1061
- this._changeDetectorRef.markForCheck();
1062
- }
1063
- }
1064
- /** Does some manual dirty checking on the native input `value` property. */
1065
- _dirtyCheckNativeValue() {
1066
- const newValue = this.value;
1067
- if (this._previousNativeValue !== newValue) {
1068
- this._previousNativeValue = newValue;
1069
- this._stateChanges.next();
1070
- }
1071
- }
1072
- _coerceBooleanProperty(value) {
1073
- return value != null && `${value}` !== 'false';
1074
- }
1075
- _focusSearchboxOrResultsElement(focus = true) {
1076
- if (!this.isSearchboxHidden) {
1077
- setTimeout(() => {
1078
- if (this.searchInput && this.searchInput.nativeElement && focus) {
1079
- this.searchInput.nativeElement.focus();
1080
- }
1081
- });
1082
- }
1083
- else if (this.resultsElement) {
1084
- this.resultsElement.focus();
1085
- }
1086
- }
1087
- _focus(state) {
1088
- if (!state && this.focused) {
1089
- this.focused = state;
1090
- this.blur.emit(this);
1091
- }
1092
- else if (state && !this.focused) {
1093
- this.focused = state;
1094
- this.focus.emit(this);
1095
- }
1096
- }
1097
- _isAbobeOverlay() {
1098
- return this.overlay && this._overlayPosition && this.listPosition === 'auto'
1099
- ? this._overlayPosition === 'top'
1100
- : this.listPosition === 'above';
1101
- }
1102
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Select2, deps: [{ token: i1.ViewportRuler }, { token: i0.ChangeDetectorRef }, { token: i2.NgForm, optional: true }, { token: i2.FormGroupDirective, optional: true }, { token: i2.NgControl, optional: true, self: true }, { token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component }); }
1103
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.4", type: Select2, selector: "select2", inputs: { data: "data", minCharForSearch: "minCharForSearch", displaySearchStatus: "displaySearchStatus", placeholder: "placeholder", customSearchEnabled: "customSearchEnabled", limitSelection: "limitSelection", listPosition: "listPosition", multiple: "multiple", overlay: "overlay", styleMode: "styleMode", noResultMessage: "noResultMessage", maxResults: "maxResults", maxResultsMessage: "maxResultsMessage", infiniteScrollDistance: "infiniteScrollDistance", infiniteScrollThrottle: "infiniteScrollThrottle", infiniteScroll: "infiniteScroll", autoCreate: "autoCreate", noLabelTemplate: "noLabelTemplate", editPattern: "editPattern", templates: "templates", resultMaxHeight: "resultMaxHeight", minCountForSearch: "minCountForSearch", id: "id", required: "required", disabled: "disabled", hideSelectedItems: "hideSelectedItems", readonly: "readonly", value: "value", tabIndex: "tabIndex", resettable: "resettable" }, outputs: { update: "update", open: "open", close: "close", focus: "focus", blur: "blur", search: "search", scroll: "scroll", removeOption: "removeOption" }, host: { properties: { "id": "this.id", "attr.aria-invalid": "this.ariaInvalid", "class.material": "this.classMaterial", "class.nostyle": "this.classNostyle", "class.select2-above": "this.select2above" } }, viewQueries: [{ propertyName: "cdkConnectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true }, { propertyName: "selection", first: true, predicate: ["selection"], descendants: true, static: true }, { propertyName: "resultContainer", first: true, predicate: ["results"], descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }, { propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true }, { propertyName: "results", predicate: ["result"], descendants: true }], ngImport: i0, template: "<div class=\"select2-label\" (click)=\"toggleOpenAndClose()\">\n <ng-content select=\"select2-label\"></ng-content>\n <span *ngIf=\"required\" class=\"select2-required\"></span>\n</div>\n<div\n class=\"select2 select2-container select2-container--default\"\n [class.select2-container--focus]=\"focused\"\n [class.select2-container--below]=\"!select2above\"\n [class.select2-container--above]=\"select2above\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-container--disabled]=\"disabled\"\n>\n <div\n class=\"selection\"\n #selection\n #trigger=\"cdkOverlayOrigin\"\n [tabindex]=\"!this.isOpen ? tabIndex : '-1'\"\n (click)=\"toggleOpenAndClose()\"\n (focus)=\"focusin()\"\n (blur)=\"focusout()\"\n (keydown)=\"openKey($event)\"\n cdkOverlayOrigin\n [class.select2-focused]=\"focused\"\n >\n <div\n class=\"select2-selection\"\n [class.select2-selection--multiple]=\"multiple\"\n [class.select2-selection--single]=\"!multiple\"\n role=\"combobox\"\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__rendered\" [title]=\"select2Option?.label || ''\">\n <span *ngIf=\"!select2Option\">&nbsp;</span>\n <ng-container *ngIf=\"select2Option\">\n <span\n *ngIf=\"!hasTemplate(select2Option, 'option') || noLabelTemplate; else template\"\n [innerHTML]=\"select2Option.label\"\n ></span>\n <ng-template #template>\n <ng-container *ngTemplateOutlet=\"getTemplate(select2Option, 'option'); context: select2Option\">\n </ng-container>\n </ng-template>\n </ng-container>\n <span [class.select2-selection__placeholder__option]=\"option\" class=\"select2-selection__placeholder\">{{\n placeholder\n }}</span>\n </span>\n <span\n (click)=\"reset($event)\"\n *ngIf=\"!multiple && resettable && select2Option && !(disabled || readonly)\"\n class=\"select2-selection__reset\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__arrow\" role=\"presentation\"> </span>\n <ul *ngIf=\"multiple\" class=\"select2-selection__rendered\">\n <span\n *ngIf=\"!autoCreate\"\n [class.select2-selection__placeholder__option]=\"select2Options?.length > 0\"\n class=\"select2-selection__placeholder\"\n >{{ placeholder }}</span\n >\n <li\n *ngFor=\"let op of option; trackBy: trackBy\"\n class=\"select2-selection__choice\"\n [title]=\"op.label\"\n tabindex=\"0\"\n (keydown.enter)=\"removeSelection($event, op)\"\n >\n <span\n *ngIf=\"!(disabled || readonly)\"\n (click)=\"removeSelection($event, op)\"\n class=\"select2-selection__choice__remove\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span [innerHTML]=\"op.label\"></span>\n </li>\n <li\n *ngIf=\"autoCreate\"\n class=\"select2-selection__auto-create\"\n (focus)=\"stopEvent($event)\"\n (blur)=\"stopEvent($event)\"\n >\n <input\n [id]=\"id + '-create-field'\"\n (click)=\"toggleOpenAndClose(false, true); stopEvent($event)\"\n (keydown)=\"keyDown($event, true)\"\n (keyup)=\"searchUpdate($event)\"\n (change)=\"prevChange($event)\"\n class=\"select2-create__field\"\n type=\"search\"\n role=\"textbox\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n </li>\n </ul>\n </div>\n </div>\n <ng-container *ngIf=\"!overlay\">\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n </ng-container>\n\n <div class=\"select2-subscript-wrapper\">\n <ng-content select=\"select2-hint\"></ng-content>\n </div>\n</div>\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayHasBackdrop\n cdkConnectedOverlayBackdropClass=\"select2-overlay-backdrop\"\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"this.isOpen && overlay\"\n [cdkConnectedOverlayMinWidth]=\"overlayWidth\"\n [cdkConnectedOverlayHeight]=\"overlayHeight\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n (backdropClick)=\"toggleOpenAndClose()\"\n>\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #containerTemplate>\n <div\n class=\"select2-container select2-container--default select2-container-dropdown\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-overlay]=\"overlay\"\n [class.select2-position-auto]=\"listPosition === 'auto'\"\n >\n <div\n #dropdown\n class=\"select2-dropdown\"\n [class.select2-dropdown--below]=\"!select2above\"\n [class.select2-dropdown--above]=\"select2above\"\n >\n <div class=\"select2-search select2-search--dropdown\" [class.select2-search--hide]=\"hideSearch()\">\n <input\n #searchInput\n [id]=\"id + '-search-field'\"\n [value]=\"searchText\"\n (keydown)=\"keyDown($event)\"\n (keyup)=\"searchUpdate($event)\"\n (change)=\"prevChange($event)\"\n class=\"select2-search__field\"\n type=\"search\"\n role=\"textbox\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [attr.tabindex]=\"this.isOpen ? tabIndex : '-1'\"\n />\n </div>\n <div class=\"select2-results\">\n <ul\n #results\n class=\"select2-results__options\"\n [style.max-height]=\"resultMaxHeight\"\n role=\"tree\"\n tabindex=\"-1\"\n infiniteScroll\n [infiniteScrollDisabled]=\"!infiniteScroll && !isOpen\"\n [infiniteScrollDistance]=\"infiniteScrollDistance\"\n [infiniteScrollThrottle]=\"infiniteScrollThrottle\"\n [infiniteScrollContainer]=\"results\"\n (scrolled)=\"onScroll('down')\"\n (scrolledUp)=\"onScroll('up')\"\n (keydown)=\"keyDown($event)\"\n >\n <ng-container *ngFor=\"let groupOrOption of filteredData; index as i; trackBy: trackBy\">\n <li *ngIf=\"groupOrOption.options\" class=\"select2-results__option\" role=\"group\">\n <strong\n *ngIf=\"!hasTemplate(groupOrOption, 'group'); else optGroup\"\n [attr.class]=\"\n 'select2-results__group' +\n (groupOrOption.classes ? ' ' + groupOrOption.classes : '')\n \"\n [innerHTML]=\"groupOrOption.label\"\n ></strong>\n <ng-template #optGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'group'); context: groupOrOption\"\n >\n </ng-container>\n </ng-template>\n\n <ul class=\"select2-results__options select2-results__options--nested\">\n <li\n *ngFor=\"let option of groupOrOption.options; index as j; trackBy: trackBy\"\n #result\n [id]=\"option.id || id + '-option-' + i + '-' + j\"\n [class]=\"getOptionStyle(option)\"\n role=\"treeitem\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"isDisabled(option)\"\n (mouseenter)=\"mouseenter(option)\"\n (click)=\"click(option)\"\n >\n <div\n *ngIf=\"!hasTemplate(option, 'option'); else liGroup\"\n class=\"select2-label-content\"\n [innerHTML]=\"option.label\"\n ></div>\n <ng-template #liGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(option, 'option'); context: option\"\n >\n </ng-container>\n </ng-template>\n </li>\n </ul>\n </li>\n <li\n *ngIf=\"!groupOrOption.options\"\n #result\n [id]=\"groupOrOption.id || id + '-option-' + i\"\n [class]=\"getOptionStyle(groupOrOption)\"\n role=\"treeitem\"\n [attr.aria-selected]=\"isSelected(groupOrOption)\"\n [attr.aria-disabled]=\"isDisabled(groupOrOption)\"\n (mouseenter)=\"mouseenter(groupOrOption)\"\n (click)=\"click(groupOrOption)\"\n >\n <div\n *ngIf=\"!hasTemplate(groupOrOption, 'option'); else li\"\n [innerHTML]=\"groupOrOption.label\"\n class=\"select2-label-content\"\n ></div>\n <ng-template #li>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'option'); context: groupOrOption\"\n >\n </ng-container>\n </ng-template>\n </li>\n </ng-container>\n <li\n class=\"select2-no-result select2-results__option\"\n *ngIf=\"!filteredData?.length && noResultMessage\"\n [innerHTML]=\"noResultMessage\"\n ></li>\n <li\n class=\"select2-too-much-result select2-results__option\"\n *ngIf=\"maxResultsExceeded\"\n [innerHTML]=\"maxResultsMessage\"\n ></li>\n </ul>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: [".select2-label{color:var(--select2-label-text-color, #000)}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;width:100%}.select2-container .select2-container-dropdown{position:absolute;width:0px;opacity:0}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:var(--select2-single-height, 28px);-webkit-user-select:none;user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding:0 0 0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1 1 auto}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:var(--select2-multiple-height, 28px);-webkit-user-select:none;user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-flex;overflow:hidden;padding-left:8px;padding-bottom:2px;text-overflow:ellipsis;white-space:nowrap;flex-wrap:wrap;gap:5px}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-selection__auto-create{flex:1 1 150px;min-width:150px;display:flex}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-create__field{width:100%;border:0}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-create__field:focus{border:0;outline:0}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background:var(--select2-dropdown-background, white);border:1px solid var(--select2-dropdown-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);box-sizing:border-box;display:block;position:absolute;width:100%;z-index:1051;height:0;overflow:hidden}.select2-dropdown .select2-label-content{display:contents}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;-webkit-user-select:none;user-select:none;color:var(--select2-option-text-color, #000)}.select2-results__option[aria-selected]{cursor:pointer}.select2-container.select2-container-dropdown.select2-container--open{width:100%;opacity:1}.select2-container--open .select2-dropdown{overflow:auto;height:auto}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:27px;display:flex;flex-direction:column-reverse}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99}.select2-required:before{content:\"*\";color:var(--select2-required-color, red)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}.select2-container--default .select2-selection--single{background:var(--select2-selection-background, #fff);border:1px solid var(--select2-selection-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);display:flex}.select2-container--default .select2-selection--single .select2-selection__rendered{color:var(--select2-selection-text-color, #111);line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:var(--select2-placeholder-color, #999)}.select2-container--default .select2-selection--single .select2-selection__placeholder span{overflow:hidden;white-space:nowrap;text-overflow:var(--select2-placeholder-overflow, ellipsis)}.select2-container--default .select2-selection--single .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--single .select2-selection__reset,.select2-container--default .select2-selection--single .select2-selection__arrow{display:flex;width:20px;align-items:center;justify-content:center}.select2-container--default .select2-selection--single .select2-selection__arrow:before{content:\" \";border-color:var(--select2-arrow-color, #888) transparent;border-style:solid;border-width:5px 4px 0;height:0;width:0}.select2-container--default .select2-selection--single .select2-selection__reset{color:var(--select2-reset-color, #999)}.select2-container--default.select2-container--disabled .select2-selection--single{background:var(--select2-selection-disabled-background, #eee);cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow:before{border-color:transparent transparent var(--select2-arrow-color, #888);border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background:var(--select2-selection-background, #fff);border:1px solid var(--select2-selection-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{flex:1 1 auto;box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{display:block;width:100%;color:var(--select2-placeholder-color, #999);margin-top:5px;float:left;overflow:hidden;white-space:nowrap;text-overflow:var(--select2-placeholder-overflow, ellipsis)}.select2-container--default .select2-selection--multiple .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{color:var(--select2-selection-choice-text-color, #000);background:var(--select2-selection-choice-background, #e4e4e4);border:1px solid var(--select2-selection-choice-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);cursor:default;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:var(--select2-selection-choice-close-color, #999);cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:var(--select2-selection-choice-hover-close-color, #333)}.select2-container--default.select2-container--focused .select2-selection--multiple{border:solid var(--select2-selection-focus-border-color, #000) 1px;outline:none}.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple{border:solid var(--select2-selection-focus-border-color, #000) 1px;outline:none}.select2-container--default.select2-container--disabled .select2-selection--multiple{background:var(--select2-selection-disabled-background, #eee);cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid var(--select2-search-border-color, #aaa);background:1px solid var(--select2-search-background, #fff);border-radius:var(--select2-search-border-radius, 0px)}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:none;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:var(--select2-option-disabled-text-color, #999);background:var(--select2-option-disabled-background, transparent)}.select2-container--default .select2-results__option[aria-selected=true]{color:var(--select2-option-selected-text-color, #000);background:var(--select2-option-selected-background, #ddd)}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background:var(--select2-option-highlighted-background, #5897fb);color:var(--select2-option-highlighted-text-color, #fff)}.select2-container--default .select2-results__option--hide{display:none}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;color:var(--select2-option-group-text-color, gray);background:var(--select2-option-group-background, transparent)}.select2-no-result{color:var(--select2-no-result-color, #888);font-style:var(--select2-no-result-font-style, italic)}.select2-too-much-result{color:var(--select2-too-much-result-color, #888);font-style:var(--select2-too-much-font-style, italic)}:host.nostyle .select2-dropdown{border-color:transparent}:host.nostyle .select2-selection--single,:host.nostyle .select2-selection--multiple{background:transparent;border-color:transparent}:host.nostyle .select2-container--default .select2-focused .select2-selection--single,:host.nostyle .select2-container--default .select2-focused .select2-selection--multiple,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple{background:transparent;border-color:transparent}:host.material{display:inline-block;width:300px}:host.material>.select2-container{padding-bottom:1.29688em;vertical-align:inherit}:host.material>.select2-container .selection{padding:.4375em 0;border-top:.84375em solid transparent;display:inline-flex;align-items:baseline;width:100%;height:auto}:host.material .select2-container--default .select2-selection--single,:host.material .select2-container--default .select2-selection--multiple{width:100%;border:0;border-radius:0;height:24px;box-sizing:border-box}:host.material .select2-container--default .select2-selection--single:before,:host.material .select2-container--default .select2-selection--multiple:before{content:\" \";display:block;position:absolute;bottom:1.65em;background:var(--select2-material-underline, #ddd);height:1px;width:100%}:host.material .select2-container--default .select2-selection--single:after,:host.material .select2-container--default .select2-selection--multiple:after{content:\" \";display:block;position:absolute;bottom:1.63em;background:var(--select2-material-underline-active, #5a419e);height:2px;width:0%;left:50%;transition:none}:host.material .select2-container--default .select2-selection--single .select2-selection__rendered,:host.material .select2-container--default .select2-selection--multiple .select2-selection__rendered{padding-left:1px;line-height:inherit}:host.material .select2-container--default .select2-selection--single .select2-selection__placeholder,:host.material .select2-container--default .select2-selection--multiple .select2-selection__placeholder{display:block;color:var(--select2-material-placeholder-color, rgba(0, 0, 0, .38));transition:transform .3s;position:absolute;transform-origin:0 21px;left:0;top:20px}:host.material .select2-container--default .select2-container--open{left:0;bottom:1.6em}:host.material .select2-container--default .select2-selection__placeholder__option{transform:translateY(-1.5em) scale(.75) perspective(100px) translateZ(.001px);width:133.33333%}:host.material .select2-container--default .select2-selection__arrow{top:20px}:host.material .select2-container--default.select2-container--open .select2-selection--single:after,:host.material .select2-container--default.select2-container--open .select2-selection--multiple:after,:host.material .select2-container--default .select2-focused .select2-selection--single:after,:host.material .select2-container--default .select2-focused .select2-selection--multiple:after{transition:width .3s cubic-bezier(.12,1,.77,1),left .3s cubic-bezier(.12,1,.77,1);width:100%;left:0%}:host.material .select2-container--default .select2-dropdown{border-radius:0;border:0;box-shadow:0 5px 5px #00000080}:host.material .select2-container--default .select2-results__option[aria-selected=true],:host.material .select2-container--default .select2-results__option--highlighted[aria-selected]{background:var(--select2-material-option-selected-background, rgba(0, 0, 0, .04));color:var(--select2-material-option-highlighted-text-color, #000)}:host.material .select2-container--default .select2-results__option[aria-selected=true]{color:var(--select2-material-option-selected-text-color, #ff5722)}:host.material .select2-container--default.select2-container--disabled .select2-selection--single,:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple{background:transparent}:host.material .select2-container--default.select2-container--disabled .select2-selection--single:before,:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple:before{background:var(--select2-material-underline-disabled, linear-gradient(to right, rgba(0, 0, 0, .26) 0, rgba(0, 0, 0, .26) 33%, transparent 0));background-size:4px 1px;background-repeat:repeat-x;background-position:0 bottom}:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:before,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:after,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple:before,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple:after{background:var(--select2-material-underline-invalid, red)}:host.material:not(.select2-container--open) .select2-focused .select2-selection--single,:host.material:not(.select2-container--open) .select2-focused .select2-selection--multiple{border:0}:host.material .select2-subscript-wrapper{position:absolute;top:calc(100% - 1.72917em);font-size:75%;color:var(--select2-hint-text-color, #888)}::ng-deep .select2-overlay-backdrop{background:var(--select2-overlay-backdrop, transparent)}::ng-deep .cdk-overlay-container .select2-container .select2-dropdown.select2-dropdown--above{bottom:28px}::ng-deep .cdk-overlay-container .select2-container--open.select2-position-auto .select2-dropdown{margin-bottom:28px}::ng-deep .cdk-overlay-container .select2-container--open.select2-position-auto .select2-dropdown.select2-dropdown--above{bottom:0;margin-bottom:0;margin-top:28px}@supports (-moz-appearance: none){select2.material .select2-container--default .select2-selection--single,select2.material .select2-container--default .select2-selection--multiple{height:26px}}\n"], dependencies: [{ 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: "directive", type: i4.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i4.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: i5.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }] }); }
1104
- }
1105
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Select2, decorators: [{
1106
- type: Component,
1107
- args: [{ selector: 'select2', template: "<div class=\"select2-label\" (click)=\"toggleOpenAndClose()\">\n <ng-content select=\"select2-label\"></ng-content>\n <span *ngIf=\"required\" class=\"select2-required\"></span>\n</div>\n<div\n class=\"select2 select2-container select2-container--default\"\n [class.select2-container--focus]=\"focused\"\n [class.select2-container--below]=\"!select2above\"\n [class.select2-container--above]=\"select2above\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-container--disabled]=\"disabled\"\n>\n <div\n class=\"selection\"\n #selection\n #trigger=\"cdkOverlayOrigin\"\n [tabindex]=\"!this.isOpen ? tabIndex : '-1'\"\n (click)=\"toggleOpenAndClose()\"\n (focus)=\"focusin()\"\n (blur)=\"focusout()\"\n (keydown)=\"openKey($event)\"\n cdkOverlayOrigin\n [class.select2-focused]=\"focused\"\n >\n <div\n class=\"select2-selection\"\n [class.select2-selection--multiple]=\"multiple\"\n [class.select2-selection--single]=\"!multiple\"\n role=\"combobox\"\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__rendered\" [title]=\"select2Option?.label || ''\">\n <span *ngIf=\"!select2Option\">&nbsp;</span>\n <ng-container *ngIf=\"select2Option\">\n <span\n *ngIf=\"!hasTemplate(select2Option, 'option') || noLabelTemplate; else template\"\n [innerHTML]=\"select2Option.label\"\n ></span>\n <ng-template #template>\n <ng-container *ngTemplateOutlet=\"getTemplate(select2Option, 'option'); context: select2Option\">\n </ng-container>\n </ng-template>\n </ng-container>\n <span [class.select2-selection__placeholder__option]=\"option\" class=\"select2-selection__placeholder\">{{\n placeholder\n }}</span>\n </span>\n <span\n (click)=\"reset($event)\"\n *ngIf=\"!multiple && resettable && select2Option && !(disabled || readonly)\"\n class=\"select2-selection__reset\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__arrow\" role=\"presentation\"> </span>\n <ul *ngIf=\"multiple\" class=\"select2-selection__rendered\">\n <span\n *ngIf=\"!autoCreate\"\n [class.select2-selection__placeholder__option]=\"select2Options?.length > 0\"\n class=\"select2-selection__placeholder\"\n >{{ placeholder }}</span\n >\n <li\n *ngFor=\"let op of option; trackBy: trackBy\"\n class=\"select2-selection__choice\"\n [title]=\"op.label\"\n tabindex=\"0\"\n (keydown.enter)=\"removeSelection($event, op)\"\n >\n <span\n *ngIf=\"!(disabled || readonly)\"\n (click)=\"removeSelection($event, op)\"\n class=\"select2-selection__choice__remove\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span [innerHTML]=\"op.label\"></span>\n </li>\n <li\n *ngIf=\"autoCreate\"\n class=\"select2-selection__auto-create\"\n (focus)=\"stopEvent($event)\"\n (blur)=\"stopEvent($event)\"\n >\n <input\n [id]=\"id + '-create-field'\"\n (click)=\"toggleOpenAndClose(false, true); stopEvent($event)\"\n (keydown)=\"keyDown($event, true)\"\n (keyup)=\"searchUpdate($event)\"\n (change)=\"prevChange($event)\"\n class=\"select2-create__field\"\n type=\"search\"\n role=\"textbox\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n </li>\n </ul>\n </div>\n </div>\n <ng-container *ngIf=\"!overlay\">\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n </ng-container>\n\n <div class=\"select2-subscript-wrapper\">\n <ng-content select=\"select2-hint\"></ng-content>\n </div>\n</div>\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayHasBackdrop\n cdkConnectedOverlayBackdropClass=\"select2-overlay-backdrop\"\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"this.isOpen && overlay\"\n [cdkConnectedOverlayMinWidth]=\"overlayWidth\"\n [cdkConnectedOverlayHeight]=\"overlayHeight\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n (backdropClick)=\"toggleOpenAndClose()\"\n>\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #containerTemplate>\n <div\n class=\"select2-container select2-container--default select2-container-dropdown\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-overlay]=\"overlay\"\n [class.select2-position-auto]=\"listPosition === 'auto'\"\n >\n <div\n #dropdown\n class=\"select2-dropdown\"\n [class.select2-dropdown--below]=\"!select2above\"\n [class.select2-dropdown--above]=\"select2above\"\n >\n <div class=\"select2-search select2-search--dropdown\" [class.select2-search--hide]=\"hideSearch()\">\n <input\n #searchInput\n [id]=\"id + '-search-field'\"\n [value]=\"searchText\"\n (keydown)=\"keyDown($event)\"\n (keyup)=\"searchUpdate($event)\"\n (change)=\"prevChange($event)\"\n class=\"select2-search__field\"\n type=\"search\"\n role=\"textbox\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [attr.tabindex]=\"this.isOpen ? tabIndex : '-1'\"\n />\n </div>\n <div class=\"select2-results\">\n <ul\n #results\n class=\"select2-results__options\"\n [style.max-height]=\"resultMaxHeight\"\n role=\"tree\"\n tabindex=\"-1\"\n infiniteScroll\n [infiniteScrollDisabled]=\"!infiniteScroll && !isOpen\"\n [infiniteScrollDistance]=\"infiniteScrollDistance\"\n [infiniteScrollThrottle]=\"infiniteScrollThrottle\"\n [infiniteScrollContainer]=\"results\"\n (scrolled)=\"onScroll('down')\"\n (scrolledUp)=\"onScroll('up')\"\n (keydown)=\"keyDown($event)\"\n >\n <ng-container *ngFor=\"let groupOrOption of filteredData; index as i; trackBy: trackBy\">\n <li *ngIf=\"groupOrOption.options\" class=\"select2-results__option\" role=\"group\">\n <strong\n *ngIf=\"!hasTemplate(groupOrOption, 'group'); else optGroup\"\n [attr.class]=\"\n 'select2-results__group' +\n (groupOrOption.classes ? ' ' + groupOrOption.classes : '')\n \"\n [innerHTML]=\"groupOrOption.label\"\n ></strong>\n <ng-template #optGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'group'); context: groupOrOption\"\n >\n </ng-container>\n </ng-template>\n\n <ul class=\"select2-results__options select2-results__options--nested\">\n <li\n *ngFor=\"let option of groupOrOption.options; index as j; trackBy: trackBy\"\n #result\n [id]=\"option.id || id + '-option-' + i + '-' + j\"\n [class]=\"getOptionStyle(option)\"\n role=\"treeitem\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"isDisabled(option)\"\n (mouseenter)=\"mouseenter(option)\"\n (click)=\"click(option)\"\n >\n <div\n *ngIf=\"!hasTemplate(option, 'option'); else liGroup\"\n class=\"select2-label-content\"\n [innerHTML]=\"option.label\"\n ></div>\n <ng-template #liGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(option, 'option'); context: option\"\n >\n </ng-container>\n </ng-template>\n </li>\n </ul>\n </li>\n <li\n *ngIf=\"!groupOrOption.options\"\n #result\n [id]=\"groupOrOption.id || id + '-option-' + i\"\n [class]=\"getOptionStyle(groupOrOption)\"\n role=\"treeitem\"\n [attr.aria-selected]=\"isSelected(groupOrOption)\"\n [attr.aria-disabled]=\"isDisabled(groupOrOption)\"\n (mouseenter)=\"mouseenter(groupOrOption)\"\n (click)=\"click(groupOrOption)\"\n >\n <div\n *ngIf=\"!hasTemplate(groupOrOption, 'option'); else li\"\n [innerHTML]=\"groupOrOption.label\"\n class=\"select2-label-content\"\n ></div>\n <ng-template #li>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'option'); context: groupOrOption\"\n >\n </ng-container>\n </ng-template>\n </li>\n </ng-container>\n <li\n class=\"select2-no-result select2-results__option\"\n *ngIf=\"!filteredData?.length && noResultMessage\"\n [innerHTML]=\"noResultMessage\"\n ></li>\n <li\n class=\"select2-too-much-result select2-results__option\"\n *ngIf=\"maxResultsExceeded\"\n [innerHTML]=\"maxResultsMessage\"\n ></li>\n </ul>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: [".select2-label{color:var(--select2-label-text-color, #000)}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;width:100%}.select2-container .select2-container-dropdown{position:absolute;width:0px;opacity:0}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:var(--select2-single-height, 28px);-webkit-user-select:none;user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding:0 0 0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1 1 auto}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:var(--select2-multiple-height, 28px);-webkit-user-select:none;user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-flex;overflow:hidden;padding-left:8px;padding-bottom:2px;text-overflow:ellipsis;white-space:nowrap;flex-wrap:wrap;gap:5px}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-selection__auto-create{flex:1 1 150px;min-width:150px;display:flex}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-create__field{width:100%;border:0}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-create__field:focus{border:0;outline:0}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background:var(--select2-dropdown-background, white);border:1px solid var(--select2-dropdown-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);box-sizing:border-box;display:block;position:absolute;width:100%;z-index:1051;height:0;overflow:hidden}.select2-dropdown .select2-label-content{display:contents}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;-webkit-user-select:none;user-select:none;color:var(--select2-option-text-color, #000)}.select2-results__option[aria-selected]{cursor:pointer}.select2-container.select2-container-dropdown.select2-container--open{width:100%;opacity:1}.select2-container--open .select2-dropdown{overflow:auto;height:auto}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:27px;display:flex;flex-direction:column-reverse}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99}.select2-required:before{content:\"*\";color:var(--select2-required-color, red)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}.select2-container--default .select2-selection--single{background:var(--select2-selection-background, #fff);border:1px solid var(--select2-selection-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);display:flex}.select2-container--default .select2-selection--single .select2-selection__rendered{color:var(--select2-selection-text-color, #111);line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:var(--select2-placeholder-color, #999)}.select2-container--default .select2-selection--single .select2-selection__placeholder span{overflow:hidden;white-space:nowrap;text-overflow:var(--select2-placeholder-overflow, ellipsis)}.select2-container--default .select2-selection--single .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--single .select2-selection__reset,.select2-container--default .select2-selection--single .select2-selection__arrow{display:flex;width:20px;align-items:center;justify-content:center}.select2-container--default .select2-selection--single .select2-selection__arrow:before{content:\" \";border-color:var(--select2-arrow-color, #888) transparent;border-style:solid;border-width:5px 4px 0;height:0;width:0}.select2-container--default .select2-selection--single .select2-selection__reset{color:var(--select2-reset-color, #999)}.select2-container--default.select2-container--disabled .select2-selection--single{background:var(--select2-selection-disabled-background, #eee);cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow:before{border-color:transparent transparent var(--select2-arrow-color, #888);border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background:var(--select2-selection-background, #fff);border:1px solid var(--select2-selection-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{flex:1 1 auto;box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{display:block;width:100%;color:var(--select2-placeholder-color, #999);margin-top:5px;float:left;overflow:hidden;white-space:nowrap;text-overflow:var(--select2-placeholder-overflow, ellipsis)}.select2-container--default .select2-selection--multiple .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{color:var(--select2-selection-choice-text-color, #000);background:var(--select2-selection-choice-background, #e4e4e4);border:1px solid var(--select2-selection-choice-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);cursor:default;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:var(--select2-selection-choice-close-color, #999);cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:var(--select2-selection-choice-hover-close-color, #333)}.select2-container--default.select2-container--focused .select2-selection--multiple{border:solid var(--select2-selection-focus-border-color, #000) 1px;outline:none}.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple{border:solid var(--select2-selection-focus-border-color, #000) 1px;outline:none}.select2-container--default.select2-container--disabled .select2-selection--multiple{background:var(--select2-selection-disabled-background, #eee);cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid var(--select2-search-border-color, #aaa);background:1px solid var(--select2-search-background, #fff);border-radius:var(--select2-search-border-radius, 0px)}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:none;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:var(--select2-option-disabled-text-color, #999);background:var(--select2-option-disabled-background, transparent)}.select2-container--default .select2-results__option[aria-selected=true]{color:var(--select2-option-selected-text-color, #000);background:var(--select2-option-selected-background, #ddd)}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background:var(--select2-option-highlighted-background, #5897fb);color:var(--select2-option-highlighted-text-color, #fff)}.select2-container--default .select2-results__option--hide{display:none}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;color:var(--select2-option-group-text-color, gray);background:var(--select2-option-group-background, transparent)}.select2-no-result{color:var(--select2-no-result-color, #888);font-style:var(--select2-no-result-font-style, italic)}.select2-too-much-result{color:var(--select2-too-much-result-color, #888);font-style:var(--select2-too-much-font-style, italic)}:host.nostyle .select2-dropdown{border-color:transparent}:host.nostyle .select2-selection--single,:host.nostyle .select2-selection--multiple{background:transparent;border-color:transparent}:host.nostyle .select2-container--default .select2-focused .select2-selection--single,:host.nostyle .select2-container--default .select2-focused .select2-selection--multiple,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple{background:transparent;border-color:transparent}:host.material{display:inline-block;width:300px}:host.material>.select2-container{padding-bottom:1.29688em;vertical-align:inherit}:host.material>.select2-container .selection{padding:.4375em 0;border-top:.84375em solid transparent;display:inline-flex;align-items:baseline;width:100%;height:auto}:host.material .select2-container--default .select2-selection--single,:host.material .select2-container--default .select2-selection--multiple{width:100%;border:0;border-radius:0;height:24px;box-sizing:border-box}:host.material .select2-container--default .select2-selection--single:before,:host.material .select2-container--default .select2-selection--multiple:before{content:\" \";display:block;position:absolute;bottom:1.65em;background:var(--select2-material-underline, #ddd);height:1px;width:100%}:host.material .select2-container--default .select2-selection--single:after,:host.material .select2-container--default .select2-selection--multiple:after{content:\" \";display:block;position:absolute;bottom:1.63em;background:var(--select2-material-underline-active, #5a419e);height:2px;width:0%;left:50%;transition:none}:host.material .select2-container--default .select2-selection--single .select2-selection__rendered,:host.material .select2-container--default .select2-selection--multiple .select2-selection__rendered{padding-left:1px;line-height:inherit}:host.material .select2-container--default .select2-selection--single .select2-selection__placeholder,:host.material .select2-container--default .select2-selection--multiple .select2-selection__placeholder{display:block;color:var(--select2-material-placeholder-color, rgba(0, 0, 0, .38));transition:transform .3s;position:absolute;transform-origin:0 21px;left:0;top:20px}:host.material .select2-container--default .select2-container--open{left:0;bottom:1.6em}:host.material .select2-container--default .select2-selection__placeholder__option{transform:translateY(-1.5em) scale(.75) perspective(100px) translateZ(.001px);width:133.33333%}:host.material .select2-container--default .select2-selection__arrow{top:20px}:host.material .select2-container--default.select2-container--open .select2-selection--single:after,:host.material .select2-container--default.select2-container--open .select2-selection--multiple:after,:host.material .select2-container--default .select2-focused .select2-selection--single:after,:host.material .select2-container--default .select2-focused .select2-selection--multiple:after{transition:width .3s cubic-bezier(.12,1,.77,1),left .3s cubic-bezier(.12,1,.77,1);width:100%;left:0%}:host.material .select2-container--default .select2-dropdown{border-radius:0;border:0;box-shadow:0 5px 5px #00000080}:host.material .select2-container--default .select2-results__option[aria-selected=true],:host.material .select2-container--default .select2-results__option--highlighted[aria-selected]{background:var(--select2-material-option-selected-background, rgba(0, 0, 0, .04));color:var(--select2-material-option-highlighted-text-color, #000)}:host.material .select2-container--default .select2-results__option[aria-selected=true]{color:var(--select2-material-option-selected-text-color, #ff5722)}:host.material .select2-container--default.select2-container--disabled .select2-selection--single,:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple{background:transparent}:host.material .select2-container--default.select2-container--disabled .select2-selection--single:before,:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple:before{background:var(--select2-material-underline-disabled, linear-gradient(to right, rgba(0, 0, 0, .26) 0, rgba(0, 0, 0, .26) 33%, transparent 0));background-size:4px 1px;background-repeat:repeat-x;background-position:0 bottom}:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:before,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:after,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple:before,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple:after{background:var(--select2-material-underline-invalid, red)}:host.material:not(.select2-container--open) .select2-focused .select2-selection--single,:host.material:not(.select2-container--open) .select2-focused .select2-selection--multiple{border:0}:host.material .select2-subscript-wrapper{position:absolute;top:calc(100% - 1.72917em);font-size:75%;color:var(--select2-hint-text-color, #888)}::ng-deep .select2-overlay-backdrop{background:var(--select2-overlay-backdrop, transparent)}::ng-deep .cdk-overlay-container .select2-container .select2-dropdown.select2-dropdown--above{bottom:28px}::ng-deep .cdk-overlay-container .select2-container--open.select2-position-auto .select2-dropdown{margin-bottom:28px}::ng-deep .cdk-overlay-container .select2-container--open.select2-position-auto .select2-dropdown.select2-dropdown--above{bottom:0;margin-bottom:0;margin-top:28px}@supports (-moz-appearance: none){select2.material .select2-container--default .select2-selection--single,select2.material .select2-container--default .select2-selection--multiple{height:26px}}\n"] }]
1108
- }], ctorParameters: function () { return [{ type: i1.ViewportRuler }, { type: i0.ChangeDetectorRef }, { type: i2.NgForm, decorators: [{
1109
- type: Optional
1110
- }] }, { type: i2.FormGroupDirective, decorators: [{
1111
- type: Optional
1112
- }] }, { type: i2.NgControl, decorators: [{
1113
- type: Self
1114
- }, {
1115
- type: Optional
1116
- }] }, { type: undefined, decorators: [{
1117
- type: Attribute,
1118
- args: ['tabindex']
1119
- }] }]; }, propDecorators: { data: [{
1120
- type: Input
1121
- }], minCharForSearch: [{
1122
- type: Input
1123
- }], displaySearchStatus: [{
1124
- type: Input
1125
- }], placeholder: [{
1126
- type: Input
1127
- }], customSearchEnabled: [{
1128
- type: Input
1129
- }], limitSelection: [{
1130
- type: Input
1131
- }], listPosition: [{
1132
- type: Input
1133
- }], multiple: [{
1134
- type: Input
1135
- }], overlay: [{
1136
- type: Input
1137
- }], styleMode: [{
1138
- type: Input
1139
- }], noResultMessage: [{
1140
- type: Input
1141
- }], maxResults: [{
1142
- type: Input
1143
- }], maxResultsMessage: [{
1144
- type: Input
1145
- }], infiniteScrollDistance: [{
1146
- type: Input
1147
- }], infiniteScrollThrottle: [{
1148
- type: Input
1149
- }], infiniteScroll: [{
1150
- type: Input
1151
- }], autoCreate: [{
1152
- type: Input
1153
- }], noLabelTemplate: [{
1154
- type: Input
1155
- }], editPattern: [{
1156
- type: Input
1157
- }], templates: [{
1158
- type: Input
1159
- }], resultMaxHeight: [{
1160
- type: Input
1161
- }], update: [{
1162
- type: Output
1163
- }], open: [{
1164
- type: Output
1165
- }], close: [{
1166
- type: Output
1167
- }], focus: [{
1168
- type: Output
1169
- }], blur: [{
1170
- type: Output
1171
- }], search: [{
1172
- type: Output
1173
- }], scroll: [{
1174
- type: Output
1175
- }], removeOption: [{
1176
- type: Output
1177
- }], minCountForSearch: [{
1178
- type: Input
1179
- }], id: [{
1180
- type: Input
1181
- }, {
1182
- type: HostBinding,
1183
- args: ['id']
1184
- }], required: [{
1185
- type: Input
1186
- }], disabled: [{
1187
- type: Input
1188
- }], hideSelectedItems: [{
1189
- type: Input
1190
- }], readonly: [{
1191
- type: Input
1192
- }], value: [{
1193
- type: Input
1194
- }], tabIndex: [{
1195
- type: Input
1196
- }], resettable: [{
1197
- type: Input
1198
- }], ariaInvalid: [{
1199
- type: HostBinding,
1200
- args: ['attr.aria-invalid']
1201
- }], classMaterial: [{
1202
- type: HostBinding,
1203
- args: ['class.material']
1204
- }], classNostyle: [{
1205
- type: HostBinding,
1206
- args: ['class.nostyle']
1207
- }], select2above: [{
1208
- type: HostBinding,
1209
- args: ['class.select2-above']
1210
- }], cdkConnectedOverlay: [{
1211
- type: ViewChild,
1212
- args: [CdkConnectedOverlay]
1213
- }], selection: [{
1214
- type: ViewChild,
1215
- args: ['selection', { static: true }]
1216
- }], resultContainer: [{
1217
- type: ViewChild,
1218
- args: ['results']
1219
- }], results: [{
1220
- type: ViewChildren,
1221
- args: ['result']
1222
- }], searchInput: [{
1223
- type: ViewChild,
1224
- args: ['searchInput']
1225
- }], dropdown: [{
1226
- type: ViewChild,
1227
- args: ['dropdown']
342
+ let nextUniqueId = 0;
343
+ const displaySearchStatusList = ['default', 'hidden', 'always'];
344
+ class Select2 {
345
+ /** data of options & optiongrps */
346
+ set data(data) {
347
+ this._data = data;
348
+ this.updateFilteredData();
349
+ }
350
+ get multiple() {
351
+ return this._multiple;
352
+ }
353
+ set multiple(value) {
354
+ this._multiple = coerceBooleanProperty(value);
355
+ this.ngOnInit();
356
+ }
357
+ /** minimal data of show the search field */
358
+ get minCountForSearch() {
359
+ return this._minCountForSearch;
360
+ }
361
+ set minCountForSearch(value) {
362
+ this._minCountForSearch = value;
363
+ this.updateSearchBox();
364
+ }
365
+ /** Unique id of the element. */
366
+ get id() {
367
+ return this._id;
368
+ }
369
+ set id(value) {
370
+ this._id = value || this._uid;
371
+ }
372
+ /** Whether selected items should be hidden. */
373
+ get disabled() {
374
+ return this._control ? this._control.disabled : this._disabled;
375
+ }
376
+ set disabled(value) {
377
+ this._disabled = value;
378
+ }
379
+ /** The input element's value. */
380
+ get value() {
381
+ return this._value;
382
+ }
383
+ set value(value) {
384
+ if (this.testValueChange(this._value, value)) {
385
+ setTimeout(() => {
386
+ this._value = value;
387
+ this.writeValue(value);
388
+ }, 10);
389
+ }
390
+ }
391
+ /** Tab index for the select2 element. */
392
+ get tabIndex() {
393
+ return this.disabled ? -1 : this._tabIndex;
394
+ }
395
+ set tabIndex(value) {
396
+ this._tabIndex = value;
397
+ }
398
+ get select2Options() {
399
+ return this.multiple ? this.option : null;
400
+ }
401
+ get select2Option() {
402
+ return this.multiple ? null : this.option;
403
+ }
404
+ get searchText() {
405
+ return this.innerSearchText;
406
+ }
407
+ set searchText(text) {
408
+ this.innerSearchText = text;
409
+ }
410
+ get ariaInvalid() {
411
+ return this._isErrorState();
412
+ }
413
+ get classMaterial() {
414
+ return this.styleMode === 'material';
415
+ }
416
+ get classNostyle() {
417
+ return this.styleMode === 'noStyle';
418
+ }
419
+ get select2above() {
420
+ return !this.overlay ? this.listPosition === 'above' : this._isAbobeOverlay();
421
+ }
422
+ get _positions() {
423
+ return this.listPosition === 'auto' ? undefined : null;
424
+ }
425
+ get resultsElement() {
426
+ return this.resultContainer?.nativeElement;
427
+ }
428
+ constructor(_viewportRuler, _changeDetectorRef, _parentForm, _parentFormGroup, _control, tabIndex) {
429
+ this._viewportRuler = _viewportRuler;
430
+ this._changeDetectorRef = _changeDetectorRef;
431
+ this._parentForm = _parentForm;
432
+ this._parentFormGroup = _parentFormGroup;
433
+ this._control = _control;
434
+ this.minCharForSearch = 0;
435
+ this.limitSelection = 0;
436
+ this.listPosition = 'below';
437
+ /** use the material style */
438
+ this.overlay = false;
439
+ /** use the material style */
440
+ this.styleMode = 'default';
441
+ /** maximum results limit (0 = no limit) */
442
+ this.maxResults = 0;
443
+ /** message when maximum results */
444
+ this.maxResultsMessage = 'Too many results…';
445
+ /** infinite scroll distance */
446
+ this.infiniteScrollDistance = 1.5;
447
+ /** infinite scroll distance */
448
+ this.infiniteScrollThrottle = 150;
449
+ /** infinite scroll activated */
450
+ this.infiniteScroll = false;
451
+ /** auto create if not existe */
452
+ this.autoCreate = false;
453
+ /** no template for label selection */
454
+ this.noLabelTemplate = false;
455
+ /** the max height of the results container when opening the select */
456
+ this.resultMaxHeight = '200px';
457
+ /** Active Search event */
458
+ this.customSearchEnabled = false;
459
+ /** Whether the element is required. */
460
+ this.required = false;
461
+ /** Whether items are hidden when has. */
462
+ this.hideSelectedItems = false;
463
+ /** Whether the element is readonly. */
464
+ this.readonly = false;
465
+ /** reset with no selected value */
466
+ this.resettable = false;
467
+ this.update = new EventEmitter();
468
+ this.open = new EventEmitter();
469
+ this.close = new EventEmitter();
470
+ this.focus = new EventEmitter();
471
+ this.blur = new EventEmitter();
472
+ this.search = new EventEmitter();
473
+ this.scroll = new EventEmitter();
474
+ this.removeOption = new EventEmitter();
475
+ this.option = null;
476
+ this.isOpen = false;
477
+ /** Whether the element is focused or not. */
478
+ this.focused = false;
479
+ this.hoveringValue = null;
480
+ this.innerSearchText = '';
481
+ this._stateChanges = new Subject();
482
+ this._disabled = false;
483
+ this._multiple = false;
484
+ this._uid = `select2-${nextUniqueId++}`;
485
+ /** View -> model callback called when select has been touched */
486
+ this._onTouched = () => {
487
+ // do nothing
488
+ };
489
+ /** View -> model callback called when value changes */
490
+ this._onChange = () => {
491
+ // do nothing
492
+ };
493
+ // eslint-disable-next-line no-self-assign
494
+ this.id = this.id;
495
+ this._tabIndex = parseInt(tabIndex, 10) || 0;
496
+ if (this._control) {
497
+ this._control.valueAccessor = this;
498
+ }
499
+ }
500
+ clickDetection(e) {
501
+ if (this.isOpen && focus) {
502
+ const target = e.target;
503
+ if (!this.ifParentContainsClass(target, 'selection')) {
504
+ if (!this.ifParentContainsClass(target, 'select2-dropdown')) {
505
+ this.toggleOpenAndClose();
506
+ }
507
+ if (!this.ifParentContainsId(target, this._id)) {
508
+ this.clickExit();
509
+ }
510
+ }
511
+ else if (!this.ifParentContainsId(target, this._id)) {
512
+ this.toggleOpenAndClose();
513
+ this.clickExit();
514
+ }
515
+ }
516
+ }
517
+ ngOnInit() {
518
+ this._viewportRuler.change(100).subscribe(() => {
519
+ if (this.isOpen) {
520
+ this.triggerRect();
521
+ }
522
+ });
523
+ const option = Select2Utils.getOptionsByValue(this._data, this._control ? this._control.value : this.value, this.multiple);
524
+ if (option !== null) {
525
+ this.option = option;
526
+ }
527
+ if (!Array.isArray(option)) {
528
+ this.hoveringValue = this.value;
529
+ }
530
+ this.updateSearchBox();
531
+ }
532
+ ngAfterViewInit() {
533
+ this.cdkConnectedOverlay.positionChange.subscribe((posChange) => {
534
+ if (this.listPosition === 'auto' &&
535
+ posChange.connectionPair?.originY &&
536
+ this._overlayPosition !== posChange.connectionPair.originY) {
537
+ this.triggerRect();
538
+ this._overlayPosition = posChange.connectionPair.originY;
539
+ this._changeDetectorRef.detectChanges();
540
+ }
541
+ });
542
+ this.selectionElement = this.selection.nativeElement;
543
+ this.triggerRect();
544
+ }
545
+ ngDoCheck() {
546
+ this.updateSearchBox();
547
+ this._dirtyCheckNativeValue();
548
+ if (this._triggerRect) {
549
+ if (this.overlayWidth !== this._triggerRect.width) {
550
+ this.overlayWidth = this._triggerRect.width;
551
+ }
552
+ if (this._dropdownRect?.height > 0 && this.overlayHeight !== this._dropdownRect.height) {
553
+ this.overlayHeight = this.listPosition === 'auto' ? this._dropdownRect.height : 0;
554
+ }
555
+ }
556
+ }
557
+ updateSearchBox() {
558
+ const hidden = this.customSearchEnabled
559
+ ? false
560
+ : Select2Utils.isSearchboxHiddex(this._data, this._minCountForSearch);
561
+ if (this.isSearchboxHidden !== hidden) {
562
+ this.isSearchboxHidden = hidden;
563
+ }
564
+ }
565
+ hideSearch() {
566
+ const displaySearchStatus = displaySearchStatusList.indexOf(this.displaySearchStatus) > -1 ? this.displaySearchStatus : 'default';
567
+ return (displaySearchStatus === 'default' && this.isSearchboxHidden) || displaySearchStatus === 'hidden';
568
+ }
569
+ getOptionStyle(option) {
570
+ return ('select2-results__option ' +
571
+ (option.hide ? 'select2-results__option--hide ' : '') +
572
+ (option.value === this.hoveringValue ? 'select2-results__option--highlighted ' : '') +
573
+ (option.classes || ''));
574
+ }
575
+ mouseenter(option) {
576
+ if (!option.disabled) {
577
+ this.hoveringValue = option.value;
578
+ }
579
+ }
580
+ click(option) {
581
+ if (this.testSelection(option)) {
582
+ this.select(option);
583
+ }
584
+ }
585
+ reset(event) {
586
+ this.select(null);
587
+ this.stopEvent(event);
588
+ }
589
+ prevChange(event) {
590
+ event.stopPropagation();
591
+ }
592
+ stopEvent(event) {
593
+ event.preventDefault();
594
+ event.stopPropagation();
595
+ }
596
+ toggleOpenAndClose(focus = true, open) {
597
+ if (this.disabled) {
598
+ return;
599
+ }
600
+ this._focus(focus);
601
+ this.isOpen = open ?? !this.isOpen;
602
+ if (this.isOpen) {
603
+ this.innerSearchText = '';
604
+ this.updateFilteredData();
605
+ this._focusSearchboxOrResultsElement(focus);
606
+ setTimeout(() => {
607
+ if (this.option) {
608
+ const option = this.option instanceof Array ? this.option[0] : this.option;
609
+ this.updateScrollFromOption(option);
610
+ }
611
+ else if (this.resultsElement) {
612
+ this.resultsElement.scrollTop = 0;
613
+ }
614
+ setTimeout(() => {
615
+ this.triggerRect();
616
+ this.cdkConnectedOverlay?.overlayRef?.updatePosition();
617
+ }, 100);
618
+ });
619
+ this.open.emit(this);
620
+ }
621
+ else {
622
+ this.close.emit(this);
623
+ }
624
+ this._changeDetectorRef.markForCheck();
625
+ }
626
+ hasTemplate(option, defaut) {
627
+ return (this.templates instanceof TemplateRef ||
628
+ this.templates?.[option.templateId] instanceof TemplateRef ||
629
+ this.templates?.[defaut] instanceof TemplateRef);
630
+ }
631
+ getTemplate(option, defaut) {
632
+ return this.hasTemplate(option, defaut)
633
+ ? this.templates[option.templateId] || this.templates[defaut] || this.templates
634
+ : undefined;
635
+ }
636
+ triggerRect() {
637
+ this._triggerRect = this.selectionElement.getBoundingClientRect();
638
+ this._dropdownRect = this.dropdown?.nativeElement
639
+ ? this.dropdown.nativeElement.getBoundingClientRect()
640
+ : undefined;
641
+ }
642
+ testSelection(option) {
643
+ if (option.disabled) {
644
+ return false;
645
+ }
646
+ return (!this.multiple ||
647
+ !this.limitSelection ||
648
+ (Array.isArray(this._value) && this._value.length < this.limitSelection));
649
+ }
650
+ testValueChange(value1, value2) {
651
+ if (((value1 === null || value1 === undefined) && (value2 === null || value2 === undefined)) ||
652
+ value1 === value2) {
653
+ return false;
654
+ }
655
+ if (this.multiple &&
656
+ value1?.length &&
657
+ value2?.length &&
658
+ value1.length === value2.length) {
659
+ for (const e1 of value1) {
660
+ const test = value2.indexOf(e1) > -1;
661
+ if (!test) {
662
+ return true;
663
+ }
664
+ }
665
+ return false;
666
+ }
667
+ return true;
668
+ }
669
+ updateFilteredData() {
670
+ setTimeout(() => {
671
+ let result = this._data;
672
+ if (this.multiple && this.hideSelectedItems) {
673
+ result = Select2Utils.getFilteredSelectedData(result, this.option);
674
+ }
675
+ if (!this.customSearchEnabled && this.searchText && this.searchText.length >= +this.minCharForSearch) {
676
+ result = Select2Utils.getFilteredData(result, this.searchText, this.editPattern);
677
+ }
678
+ if (this.maxResults > 0) {
679
+ const data = Select2Utils.getReduceData(result, +this.maxResults);
680
+ result = data.result;
681
+ this.maxResultsExceeded = data.reduce;
682
+ }
683
+ else {
684
+ this.maxResultsExceeded = false;
685
+ }
686
+ if (Select2Utils.valueIsNotInFilteredData(result, this.hoveringValue)) {
687
+ this.hoveringValue = Select2Utils.getFirstAvailableOption(result);
688
+ }
689
+ this.filteredData = result;
690
+ this._changeDetectorRef.markForCheck();
691
+ });
692
+ }
693
+ clickExit() {
694
+ this._focus(false);
695
+ }
696
+ ifParentContainsClass(element, cssClass) {
697
+ return this.getParentElementByClass(element, cssClass) !== null;
698
+ }
699
+ ifParentContainsId(element, id) {
700
+ return this.getParentElementById(element, id) !== null;
701
+ }
702
+ getParentElementByClass(element, cssClass) {
703
+ return this.containClasses(element, cssClass.trim().split(/\s+/))
704
+ ? element
705
+ : element.parentElement
706
+ ? this.getParentElementByClass(element.parentElement, cssClass)
707
+ : null;
708
+ }
709
+ getParentElementById(element, id) {
710
+ return element.id === id
711
+ ? element
712
+ : element.parentElement
713
+ ? this.getParentElementById(element.parentElement, id)
714
+ : null;
715
+ }
716
+ containClasses(element, cssClasses) {
717
+ if (!element.classList) {
718
+ return false;
719
+ }
720
+ for (const cssClass of cssClasses) {
721
+ if (!element.classList.contains(cssClass)) {
722
+ return false;
723
+ }
724
+ }
725
+ return true;
726
+ }
727
+ focusin() {
728
+ if (!this.disabled) {
729
+ this._focus(true);
730
+ }
731
+ }
732
+ focusout() {
733
+ if (this.selectionElement && !this.selectionElement.classList.contains('select2-focused')) {
734
+ this._focus(false);
735
+ this._onTouched();
736
+ }
737
+ }
738
+ select(option) {
739
+ let value;
740
+ if (option !== null) {
741
+ if (this.multiple) {
742
+ const options = this.option;
743
+ const index = options.findIndex(op => op.value === option.value);
744
+ if (index === -1) {
745
+ options.push(option);
746
+ }
747
+ else {
748
+ options.splice(index, 1);
749
+ }
750
+ value = this.option.map(op => op.value);
751
+ }
752
+ else {
753
+ this.option = option;
754
+ if (this.isOpen) {
755
+ this.isOpen = false;
756
+ this.close.emit(this);
757
+ this.selectionElement?.focus();
758
+ }
759
+ value = this.option.value;
760
+ }
761
+ }
762
+ else {
763
+ this.option = null;
764
+ }
765
+ if (this.multiple && this.hideSelectedItems) {
766
+ this.updateFilteredData();
767
+ }
768
+ if (this._control) {
769
+ this._onChange(value);
770
+ }
771
+ else {
772
+ this._value = value;
773
+ }
774
+ this.update.emit({
775
+ component: this,
776
+ value: value,
777
+ options: Array.isArray(this.option) ? this.option : this.option ? [this.option] : null,
778
+ });
779
+ }
780
+ keyDown(e, create = false) {
781
+ if (create && this._testKey(e, ['Enter', 13])) {
782
+ this.createAndAdd(e);
783
+ return;
784
+ }
785
+ if (this._testKey(e, ['ArrowDown', 40])) {
786
+ this.moveDown();
787
+ e.preventDefault();
788
+ }
789
+ else if (this._testKey(e, ['ArrowUp', 38])) {
790
+ this.moveUp();
791
+ e.preventDefault();
792
+ }
793
+ else if (this._testKey(e, ['Enter', 13])) {
794
+ this.selectByEnter();
795
+ e.preventDefault();
796
+ }
797
+ else if (this._testKey(e, ['Escape', 'Tab', 9, 27]) && this.isOpen) {
798
+ this.toggleOpenAndClose();
799
+ this._focus(false);
800
+ }
801
+ }
802
+ openKey(e, create = false) {
803
+ if (create && this._testKey(e, ['Enter', 13])) {
804
+ this.createAndAdd(e);
805
+ return;
806
+ }
807
+ if (this._testKey(e, ['ArrowDown', 'ArrowUp', 'Enter', 40, 38, 13])) {
808
+ this.toggleOpenAndClose();
809
+ e.preventDefault();
810
+ }
811
+ else if (this._testKey(e, ['Escape', 'Tab', 9, 27])) {
812
+ this._focus(false);
813
+ this._onTouched();
814
+ }
815
+ }
816
+ searchUpdate(e) {
817
+ this.searchText = e.target.value;
818
+ if (!this._customSearchEnabled) {
819
+ this.updateFilteredData();
820
+ }
821
+ else {
822
+ this.search.emit({
823
+ component: this,
824
+ value: this._value,
825
+ search: this.searchText,
826
+ data: this._data,
827
+ filteredData: (data) => {
828
+ this.filteredData = data;
829
+ this._changeDetectorRef.markForCheck();
830
+ },
831
+ });
832
+ }
833
+ }
834
+ trackBy(_index, item) {
835
+ return item.value;
836
+ }
837
+ isSelected(option) {
838
+ return Select2Utils.isSelected(this.option, option, this.multiple);
839
+ }
840
+ isDisabled(option) {
841
+ return option.disabled ? 'true' : 'false';
842
+ }
843
+ removeSelection(e, option) {
844
+ Select2Utils.removeSelection(this.option, option);
845
+ if (this.multiple && this.hideSelectedItems) {
846
+ this.updateFilteredData();
847
+ }
848
+ const value = this.option.map(op => op.value);
849
+ if (this._control) {
850
+ this._onChange(value);
851
+ }
852
+ else {
853
+ this._value = value;
854
+ }
855
+ this.update.emit({
856
+ component: this,
857
+ value: value,
858
+ options: Array.isArray(this.option) ? this.option : this.option ? [this.option] : null,
859
+ });
860
+ this.removeOption.emit({
861
+ component: this,
862
+ value: value,
863
+ removedOption: option,
864
+ });
865
+ e.preventDefault();
866
+ e.stopPropagation();
867
+ if (this.isOpen) {
868
+ this._focusSearchboxOrResultsElement();
869
+ }
870
+ }
871
+ /**
872
+ * Sets the model value. Implemented as part of ControlValueAccessor.
873
+ * @param value
874
+ */
875
+ writeValue(value) {
876
+ this._setSelectionByValue(value);
877
+ }
878
+ /**
879
+ * Saves a callback function to be invoked when the select's value
880
+ * changes from user input. Part of the ControlValueAccessor interface
881
+ * required to integrate with Angular's core forms API.
882
+ *
883
+ * @param fn Callback to be triggered when the value changes.
884
+ */
885
+ registerOnChange(fn) {
886
+ this._onChange = fn;
887
+ }
888
+ /**
889
+ * Saves a callback function to be invoked when the select is blurred
890
+ * by the user. Part of the ControlValueAccessor interface required
891
+ * to integrate with Angular's core forms API.
892
+ *
893
+ * @param fn Callback to be triggered when the component has been touched.
894
+ */
895
+ registerOnTouched(fn) {
896
+ this._onTouched = fn;
897
+ }
898
+ /**
899
+ * Sets whether the component should be disabled.
900
+ * Implemented as part of ControlValueAccessor.
901
+ * @param isDisabled
902
+ */
903
+ setDisabledState(isDisabled) {
904
+ this.disabled = isDisabled;
905
+ }
906
+ onScroll(way) {
907
+ this.scroll.emit({
908
+ component: this,
909
+ way,
910
+ search: this.innerSearchText,
911
+ data: this._data,
912
+ });
913
+ }
914
+ _isErrorState() {
915
+ const isInvalid = this._control?.invalid;
916
+ const isTouched = this._control?.touched;
917
+ const isSubmitted = this._parentFormGroup?.submitted || this._parentForm?.submitted;
918
+ return !!(isInvalid && (isTouched || isSubmitted));
919
+ }
920
+ addItem(value) {
921
+ let item = Select2Utils.getOptionByValue(this._data, value);
922
+ if (!item) {
923
+ item = {
924
+ value,
925
+ label: value,
926
+ };
927
+ this._data.push(item);
928
+ }
929
+ return item;
930
+ }
931
+ createAndAdd(e) {
932
+ const value = e.target.value;
933
+ if (value.trim()) {
934
+ const item = this.addItem(value.trim());
935
+ this.click(item);
936
+ e.target.value = '';
937
+ }
938
+ this.stopEvent(e);
939
+ }
940
+ moveUp() {
941
+ this.updateScrollFromOption(Select2Utils.getPreviousOption(this.filteredData, this.hoveringValue));
942
+ }
943
+ moveDown() {
944
+ this.updateScrollFromOption(Select2Utils.getNextOption(this.filteredData, this.hoveringValue));
945
+ }
946
+ updateScrollFromOption(option) {
947
+ if (option) {
948
+ this.hoveringValue = option.value;
949
+ const domElement = this.results.find(r => r.nativeElement.innerText.trim() === option.label);
950
+ if (domElement && this.resultsElement) {
951
+ this.resultsElement.scrollTop = 0;
952
+ const listClientRect = this.resultsElement.getBoundingClientRect();
953
+ const optionClientRect = domElement.nativeElement.getBoundingClientRect();
954
+ this.resultsElement.scrollTop = optionClientRect.top - listClientRect.top;
955
+ }
956
+ }
957
+ }
958
+ selectByEnter() {
959
+ if (this.hoveringValue) {
960
+ const option = Select2Utils.getOptionByValue(this._data, this.hoveringValue);
961
+ this.select(option);
962
+ }
963
+ }
964
+ _testKey(event, refs = []) {
965
+ return this._isKey(this._getKey(event), refs);
966
+ }
967
+ _getKey(event) {
968
+ let code;
969
+ if (event.key !== undefined) {
970
+ code = event.key;
971
+ }
972
+ else if (event['keyIdentifier'] !== undefined) {
973
+ code = event['keyIdentifier'];
974
+ }
975
+ else if (event['keyCode'] !== undefined) {
976
+ code = event['keyCode'];
977
+ }
978
+ else {
979
+ event.preventDefault();
980
+ }
981
+ return code;
982
+ }
983
+ _isKey(code, refs = []) {
984
+ return refs && refs.length > 0 ? refs.indexOf(code) !== -1 : false;
985
+ }
986
+ /**
987
+ * Sets the selected option based on a value. If no option can be
988
+ * found with the designated value, the select trigger is cleared.
989
+ */
990
+ _setSelectionByValue(value) {
991
+ if (this.option || (value !== undefined && value !== null)) {
992
+ const isArray = Array.isArray(value);
993
+ if (this.multiple && value && !isArray) {
994
+ throw new Error('Non array value.');
995
+ }
996
+ else if (this._data) {
997
+ if (this.multiple) {
998
+ this.option = []; // if value is null, then empty option and return
999
+ if (isArray) {
1000
+ // value is not null. Preselect value
1001
+ const selectedValues = Select2Utils.getOptionsByValue(this._data, value, this.multiple);
1002
+ selectedValues.map(item => this.select(item));
1003
+ }
1004
+ }
1005
+ else {
1006
+ this.select(Select2Utils.getOptionByValue(this._data, value));
1007
+ }
1008
+ }
1009
+ else if (this._control) {
1010
+ this._control.viewToModelUpdate(value);
1011
+ }
1012
+ this._changeDetectorRef.markForCheck();
1013
+ }
1014
+ }
1015
+ /** Does some manual dirty checking on the native input `value` property. */
1016
+ _dirtyCheckNativeValue() {
1017
+ const newValue = this.value;
1018
+ if (this._previousNativeValue !== newValue) {
1019
+ this._previousNativeValue = newValue;
1020
+ this._stateChanges.next();
1021
+ }
1022
+ }
1023
+ _focusSearchboxOrResultsElement(focus = true) {
1024
+ if (!this.isSearchboxHidden) {
1025
+ setTimeout(() => {
1026
+ if (this.searchInput && this.searchInput.nativeElement && focus) {
1027
+ this.searchInput.nativeElement.focus();
1028
+ }
1029
+ });
1030
+ }
1031
+ else if (this.resultsElement) {
1032
+ this.resultsElement.focus();
1033
+ }
1034
+ }
1035
+ _focus(state) {
1036
+ if (!state && this.focused) {
1037
+ this.focused = state;
1038
+ this.blur.emit(this);
1039
+ }
1040
+ else if (state && !this.focused) {
1041
+ this.focused = state;
1042
+ this.focus.emit(this);
1043
+ }
1044
+ }
1045
+ _isAbobeOverlay() {
1046
+ return this.overlay && this._overlayPosition && this.listPosition === 'auto'
1047
+ ? this._overlayPosition === 'top'
1048
+ : this.listPosition === 'above';
1049
+ }
1050
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Select2, deps: [{ token: i1.ViewportRuler }, { token: i0.ChangeDetectorRef }, { token: i2.NgForm, optional: true }, { token: i2.FormGroupDirective, optional: true }, { token: i2.NgControl, optional: true, self: true }, { token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component }); }
1051
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: Select2, selector: "select2", inputs: { data: "data", minCharForSearch: ["minCharForSearch", "minCharForSearch", numberAttribute], displaySearchStatus: "displaySearchStatus", placeholder: "placeholder", limitSelection: ["limitSelection", "limitSelection", numberAttribute], listPosition: "listPosition", multiple: "multiple", overlay: ["overlay", "overlay", booleanAttribute], styleMode: "styleMode", noResultMessage: "noResultMessage", maxResults: ["maxResults", "maxResults", numberAttribute], maxResultsMessage: "maxResultsMessage", infiniteScrollDistance: ["infiniteScrollDistance", "infiniteScrollDistance", numberAttribute], infiniteScrollThrottle: ["infiniteScrollThrottle", "infiniteScrollThrottle", numberAttribute], infiniteScroll: ["infiniteScroll", "infiniteScroll", booleanAttribute], autoCreate: ["autoCreate", "autoCreate", booleanAttribute], noLabelTemplate: ["noLabelTemplate", "noLabelTemplate", booleanAttribute], editPattern: "editPattern", templates: "templates", resultMaxHeight: "resultMaxHeight", customSearchEnabled: ["customSearchEnabled", "customSearchEnabled", booleanAttribute], minCountForSearch: ["minCountForSearch", "minCountForSearch", numberAttribute], id: "id", required: ["required", "required", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], hideSelectedItems: ["hideSelectedItems", "hideSelectedItems", booleanAttribute], readonly: ["readonly", "readonly", booleanAttribute], value: "value", tabIndex: ["tabIndex", "tabIndex", numberAttribute], resettable: ["resettable", "resettable", booleanAttribute] }, outputs: { update: "update", open: "open", close: "close", focus: "focus", blur: "blur", search: "search", scroll: "scroll", removeOption: "removeOption" }, host: { listeners: { "document:click": "clickDetection($event)" }, properties: { "id": "this.id", "attr.aria-invalid": "this.ariaInvalid", "class.material": "this.classMaterial", "class.nostyle": "this.classNostyle", "class.select2-above": "this.select2above" } }, viewQueries: [{ propertyName: "cdkConnectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true }, { propertyName: "selection", first: true, predicate: ["selection"], descendants: true, static: true }, { propertyName: "resultContainer", first: true, predicate: ["results"], descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }, { propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true }, { propertyName: "results", predicate: ["result"], descendants: true }], ngImport: i0, template: "<div class=\"select2-label\" (click)=\"toggleOpenAndClose()\">\n <ng-content select=\"select2-label\"></ng-content>\n <span *ngIf=\"required\" class=\"select2-required\"></span>\n</div>\n<div\n class=\"select2 select2-container select2-container--default\"\n [class.select2-container--focus]=\"focused\"\n [class.select2-container--below]=\"!select2above\"\n [class.select2-container--above]=\"select2above\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-container--disabled]=\"disabled\"\n>\n <div\n class=\"selection\"\n #selection\n #trigger=\"cdkOverlayOrigin\"\n [tabindex]=\"!this.isOpen ? tabIndex : '-1'\"\n (click)=\"toggleOpenAndClose()\"\n (focus)=\"focusin()\"\n (blur)=\"focusout()\"\n (keydown)=\"openKey($event)\"\n cdkOverlayOrigin\n [class.select2-focused]=\"focused\"\n >\n <div\n class=\"select2-selection\"\n [class.select2-selection--multiple]=\"multiple\"\n [class.select2-selection--single]=\"!multiple\"\n role=\"combobox\"\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__rendered\" [title]=\"select2Option?.label || ''\">\n <span *ngIf=\"!select2Option\">&nbsp;</span>\n <ng-container *ngIf=\"select2Option\">\n <span\n *ngIf=\"!hasTemplate(select2Option, 'option') || noLabelTemplate; else template\"\n [innerHTML]=\"select2Option.label\"\n ></span>\n <ng-template #template>\n <ng-container *ngTemplateOutlet=\"getTemplate(select2Option, 'option'); context: select2Option\">\n </ng-container>\n </ng-template>\n </ng-container>\n <span [class.select2-selection__placeholder__option]=\"option\" class=\"select2-selection__placeholder\">{{\n placeholder\n }}</span>\n </span>\n <span\n (click)=\"reset($event)\"\n *ngIf=\"!multiple && resettable && select2Option && !(disabled || readonly)\"\n class=\"select2-selection__reset\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__arrow\" role=\"presentation\"> </span>\n <ul *ngIf=\"multiple\" class=\"select2-selection__rendered\">\n <span\n *ngIf=\"!autoCreate\"\n [class.select2-selection__placeholder__option]=\"select2Options?.length > 0\"\n class=\"select2-selection__placeholder\"\n >{{ placeholder }}</span\n >\n <li\n *ngFor=\"let op of option; trackBy: trackBy\"\n class=\"select2-selection__choice\"\n [title]=\"op.label\"\n tabindex=\"0\"\n (keydown.enter)=\"removeSelection($event, op)\"\n >\n <span\n *ngIf=\"!(disabled || readonly)\"\n (click)=\"removeSelection($event, op)\"\n class=\"select2-selection__choice__remove\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span\n *ngIf=\"!hasTemplate(op, 'option') || noLabelTemplate; else templateMultiple\"\n [innerHTML]=\"op.label\"\n ></span>\n <ng-template #templateMultiple>\n <ng-container *ngTemplateOutlet=\"getTemplate(op, 'option'); context: op\"></ng-container>\n </ng-template>\n </li>\n <li\n *ngIf=\"autoCreate\"\n class=\"select2-selection__auto-create\"\n (focus)=\"stopEvent($event)\"\n (blur)=\"stopEvent($event)\"\n >\n <input\n [id]=\"id + '-create-field'\"\n (click)=\"toggleOpenAndClose(false, true); stopEvent($event)\"\n (keydown)=\"keyDown($event, true)\"\n (keyup)=\"searchUpdate($event)\"\n (change)=\"prevChange($event)\"\n class=\"select2-create__field\"\n type=\"search\"\n role=\"textbox\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n </li>\n </ul>\n </div>\n </div>\n <ng-container *ngIf=\"!overlay\">\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n </ng-container>\n\n <div class=\"select2-subscript-wrapper\">\n <ng-content select=\"select2-hint\"></ng-content>\n </div>\n</div>\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayHasBackdrop\n cdkConnectedOverlayBackdropClass=\"select2-overlay-backdrop\"\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"this.isOpen && overlay\"\n [cdkConnectedOverlayMinWidth]=\"overlayWidth\"\n [cdkConnectedOverlayHeight]=\"overlayHeight\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n (backdropClick)=\"toggleOpenAndClose()\"\n>\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #containerTemplate>\n <div\n class=\"select2-container select2-container--default select2-container-dropdown\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-overlay]=\"overlay\"\n [class.select2-position-auto]=\"listPosition === 'auto'\"\n >\n <div\n #dropdown\n class=\"select2-dropdown\"\n [class.select2-dropdown--below]=\"!select2above\"\n [class.select2-dropdown--above]=\"select2above\"\n >\n <div class=\"select2-search select2-search--dropdown\" [class.select2-search--hide]=\"hideSearch()\">\n <input\n #searchInput\n [id]=\"id + '-search-field'\"\n [value]=\"searchText\"\n (keydown)=\"keyDown($event)\"\n (keyup)=\"searchUpdate($event)\"\n (change)=\"prevChange($event)\"\n class=\"select2-search__field\"\n type=\"search\"\n role=\"textbox\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [attr.tabindex]=\"this.isOpen ? tabIndex : '-1'\"\n />\n </div>\n <div class=\"select2-results\">\n <ul\n #results\n class=\"select2-results__options\"\n [style.max-height]=\"resultMaxHeight\"\n role=\"tree\"\n tabindex=\"-1\"\n infiniteScroll\n [infiniteScrollDisabled]=\"!infiniteScroll && !isOpen\"\n [infiniteScrollDistance]=\"infiniteScrollDistance\"\n [infiniteScrollThrottle]=\"infiniteScrollThrottle\"\n [infiniteScrollContainer]=\"results\"\n (scrolled)=\"onScroll('down')\"\n (scrolledUp)=\"onScroll('up')\"\n (keydown)=\"keyDown($event)\"\n >\n <ng-container *ngFor=\"let groupOrOption of filteredData; index as i; trackBy: trackBy\">\n <li *ngIf=\"groupOrOption.options\" class=\"select2-results__option\" role=\"group\">\n <strong\n *ngIf=\"!hasTemplate(groupOrOption, 'group'); else optGroup\"\n [attr.class]=\"\n 'select2-results__group' +\n (groupOrOption.classes ? ' ' + groupOrOption.classes : '')\n \"\n [innerHTML]=\"groupOrOption.label\"\n ></strong>\n <ng-template #optGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'group'); context: groupOrOption\"\n >\n </ng-container>\n </ng-template>\n\n <ul class=\"select2-results__options select2-results__options--nested\">\n <li\n *ngFor=\"let option of groupOrOption.options; index as j; trackBy: trackBy\"\n #result\n [id]=\"option.id || id + '-option-' + i + '-' + j\"\n [class]=\"getOptionStyle(option)\"\n role=\"treeitem\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"isDisabled(option)\"\n (mouseenter)=\"mouseenter(option)\"\n (click)=\"click(option)\"\n >\n <div\n *ngIf=\"!hasTemplate(option, 'option'); else liGroup\"\n class=\"select2-label-content\"\n [innerHTML]=\"option.label\"\n ></div>\n <ng-template #liGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(option, 'option'); context: option\"\n >\n </ng-container>\n </ng-template>\n </li>\n </ul>\n </li>\n <li\n *ngIf=\"!groupOrOption.options\"\n #result\n [id]=\"groupOrOption.id || id + '-option-' + i\"\n [class]=\"getOptionStyle(groupOrOption)\"\n role=\"treeitem\"\n [attr.aria-selected]=\"isSelected(groupOrOption)\"\n [attr.aria-disabled]=\"isDisabled(groupOrOption)\"\n (mouseenter)=\"mouseenter(groupOrOption)\"\n (click)=\"click(groupOrOption)\"\n >\n <div\n *ngIf=\"!hasTemplate(groupOrOption, 'option'); else li\"\n [innerHTML]=\"groupOrOption.label\"\n class=\"select2-label-content\"\n ></div>\n <ng-template #li>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'option'); context: groupOrOption\"\n >\n </ng-container>\n </ng-template>\n </li>\n </ng-container>\n <li\n class=\"select2-no-result select2-results__option\"\n *ngIf=\"!filteredData?.length && noResultMessage\"\n [innerHTML]=\"noResultMessage\"\n ></li>\n <li\n class=\"select2-too-much-result select2-results__option\"\n *ngIf=\"maxResultsExceeded\"\n [innerHTML]=\"maxResultsMessage\"\n ></li>\n </ul>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: [".select2-label{color:var(--select2-label-text-color, #000)}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;width:100%}.select2-container .select2-container-dropdown{position:absolute;width:0px;opacity:0}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:var(--select2-single-height, 28px);-webkit-user-select:none;user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding:0 0 0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1 1 auto}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:var(--select2-multiple-height, 28px);-webkit-user-select:none;user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-flex;overflow:hidden;padding-left:8px;padding-bottom:2px;text-overflow:ellipsis;white-space:nowrap;flex-wrap:wrap;gap:5px}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-selection__auto-create{flex:1 1 150px;min-width:150px;display:flex}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-create__field{width:100%;border:0}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-create__field:focus{border:0;outline:0}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background:var(--select2-dropdown-background, white);border:1px solid var(--select2-dropdown-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);box-sizing:border-box;display:block;position:absolute;width:100%;z-index:1051;height:0;overflow:hidden}.select2-dropdown .select2-label-content{display:contents}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;-webkit-user-select:none;user-select:none;color:var(--select2-option-text-color, #000)}.select2-results__option[aria-selected]{cursor:pointer}.select2-container.select2-container-dropdown.select2-container--open{width:100%;opacity:1}.select2-container--open .select2-dropdown{overflow:auto;height:auto}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:27px;display:flex;flex-direction:column-reverse}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99}.select2-required:before{content:\"*\";color:var(--select2-required-color, red)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}.select2-container--default .select2-selection--single{background:var(--select2-selection-background, #fff);border:1px solid var(--select2-selection-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);display:flex}.select2-container--default .select2-selection--single .select2-selection__rendered{color:var(--select2-selection-text-color, #111);line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:var(--select2-placeholder-color, #999)}.select2-container--default .select2-selection--single .select2-selection__placeholder span{overflow:hidden;white-space:nowrap;text-overflow:var(--select2-placeholder-overflow, ellipsis)}.select2-container--default .select2-selection--single .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--single .select2-selection__reset,.select2-container--default .select2-selection--single .select2-selection__arrow{display:flex;width:20px;align-items:center;justify-content:center}.select2-container--default .select2-selection--single .select2-selection__arrow:before{content:\" \";border-color:var(--select2-arrow-color, #888) transparent;border-style:solid;border-width:5px 4px 0;height:0;width:0}.select2-container--default .select2-selection--single .select2-selection__reset{color:var(--select2-reset-color, #999)}.select2-container--default.select2-container--disabled .select2-selection--single{background:var(--select2-selection-disabled-background, #eee);cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow:before{border-color:transparent transparent var(--select2-arrow-color, #888);border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background:var(--select2-selection-background, #fff);border:1px solid var(--select2-selection-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{flex:1 1 auto;box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{display:block;width:100%;color:var(--select2-placeholder-color, #999);margin-top:5px;float:left;overflow:hidden;white-space:nowrap;text-overflow:var(--select2-placeholder-overflow, ellipsis)}.select2-container--default .select2-selection--multiple .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{color:var(--select2-selection-choice-text-color, #000);background:var(--select2-selection-choice-background, #e4e4e4);border:1px solid var(--select2-selection-choice-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);cursor:default;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:var(--select2-selection-choice-close-color, #999);cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:var(--select2-selection-choice-hover-close-color, #333)}.select2-container--default.select2-container--focused .select2-selection--multiple{border:solid var(--select2-selection-focus-border-color, #000) 1px;outline:none}.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple{border:solid var(--select2-selection-focus-border-color, #000) 1px;outline:none}.select2-container--default.select2-container--disabled .select2-selection--multiple{background:var(--select2-selection-disabled-background, #eee);cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid var(--select2-search-border-color, #aaa);background:1px solid var(--select2-search-background, #fff);border-radius:var(--select2-search-border-radius, 0px)}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:none;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:var(--select2-option-disabled-text-color, #999);background:var(--select2-option-disabled-background, transparent)}.select2-container--default .select2-results__option[aria-selected=true]{color:var(--select2-option-selected-text-color, #000);background:var(--select2-option-selected-background, #ddd)}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background:var(--select2-option-highlighted-background, #5897fb);color:var(--select2-option-highlighted-text-color, #fff)}.select2-container--default .select2-results__option--hide{display:none}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;color:var(--select2-option-group-text-color, gray);background:var(--select2-option-group-background, transparent)}.select2-no-result{color:var(--select2-no-result-color, #888);font-style:var(--select2-no-result-font-style, italic)}.select2-too-much-result{color:var(--select2-too-much-result-color, #888);font-style:var(--select2-too-much-font-style, italic)}:host.nostyle .select2-dropdown{border-color:transparent}:host.nostyle .select2-selection--single,:host.nostyle .select2-selection--multiple{background:transparent;border-color:transparent}:host.nostyle .select2-container--default .select2-focused .select2-selection--single,:host.nostyle .select2-container--default .select2-focused .select2-selection--multiple,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple{background:transparent;border-color:transparent}:host.material{display:inline-block;width:300px}:host.material>.select2-container{padding-bottom:1.29688em;vertical-align:inherit}:host.material>.select2-container .selection{padding:.4375em 0;border-top:.84375em solid transparent;display:inline-flex;align-items:baseline;width:100%;height:auto}:host.material .select2-container--default .select2-selection--single,:host.material .select2-container--default .select2-selection--multiple{width:100%;border:0;border-radius:0;height:24px;box-sizing:border-box}:host.material .select2-container--default .select2-selection--single:before,:host.material .select2-container--default .select2-selection--multiple:before{content:\" \";display:block;position:absolute;bottom:1.65em;background:var(--select2-material-underline, #ddd);height:1px;width:100%}:host.material .select2-container--default .select2-selection--single:after,:host.material .select2-container--default .select2-selection--multiple:after{content:\" \";display:block;position:absolute;bottom:1.63em;background:var(--select2-material-underline-active, #5a419e);height:2px;width:0%;left:50%;transition:none}:host.material .select2-container--default .select2-selection--single .select2-selection__rendered,:host.material .select2-container--default .select2-selection--multiple .select2-selection__rendered{padding-left:1px;line-height:inherit}:host.material .select2-container--default .select2-selection--single .select2-selection__placeholder,:host.material .select2-container--default .select2-selection--multiple .select2-selection__placeholder{display:block;color:var(--select2-material-placeholder-color, rgba(0, 0, 0, .38));transition:transform .3s;position:absolute;transform-origin:0 21px;left:0;top:20px}:host.material .select2-container--default .select2-container--open{left:0;bottom:1.6em}:host.material .select2-container--default .select2-selection__placeholder__option{transform:translateY(-1.5em) scale(.75) perspective(100px) translateZ(.001px);width:133.33333%}:host.material .select2-container--default .select2-selection__arrow{top:20px}:host.material .select2-container--default.select2-container--open .select2-selection--single:after,:host.material .select2-container--default.select2-container--open .select2-selection--multiple:after,:host.material .select2-container--default .select2-focused .select2-selection--single:after,:host.material .select2-container--default .select2-focused .select2-selection--multiple:after{transition:width .3s cubic-bezier(.12,1,.77,1),left .3s cubic-bezier(.12,1,.77,1);width:100%;left:0%}:host.material .select2-container--default .select2-dropdown{border-radius:0;border:0;box-shadow:0 5px 5px #00000080}:host.material .select2-container--default .select2-results__option[aria-selected=true],:host.material .select2-container--default .select2-results__option--highlighted[aria-selected]{background:var(--select2-material-option-selected-background, rgba(0, 0, 0, .04));color:var(--select2-material-option-highlighted-text-color, #000)}:host.material .select2-container--default .select2-results__option[aria-selected=true]{color:var(--select2-material-option-selected-text-color, #ff5722)}:host.material .select2-container--default.select2-container--disabled .select2-selection--single,:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple{background:transparent}:host.material .select2-container--default.select2-container--disabled .select2-selection--single:before,:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple:before{background:var(--select2-material-underline-disabled, linear-gradient(to right, rgba(0, 0, 0, .26) 0, rgba(0, 0, 0, .26) 33%, transparent 0));background-size:4px 1px;background-repeat:repeat-x;background-position:0 bottom}:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:before,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:after,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple:before,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple:after{background:var(--select2-material-underline-invalid, red)}:host.material:not(.select2-container--open) .select2-focused .select2-selection--single,:host.material:not(.select2-container--open) .select2-focused .select2-selection--multiple{border:0}:host.material .select2-subscript-wrapper{position:absolute;top:calc(100% - 1.72917em);font-size:75%;color:var(--select2-hint-text-color, #888)}::ng-deep .select2-overlay-backdrop{background:var(--select2-overlay-backdrop, transparent)}::ng-deep .cdk-overlay-container .select2-container .select2-dropdown.select2-dropdown--above{bottom:28px}::ng-deep .cdk-overlay-container .select2-container--open.select2-position-auto .select2-dropdown{margin-bottom:28px}::ng-deep .cdk-overlay-container .select2-container--open.select2-position-auto .select2-dropdown.select2-dropdown--above{bottom:0;margin-bottom:0;margin-top:28px}@supports (-moz-appearance: none){select2.material .select2-container--default .select2-selection--single,select2.material .select2-container--default .select2-selection--multiple{height:26px}}\n"], dependencies: [{ 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: "directive", type: i4.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i4.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: i5.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }] }); }
1052
+ }
1053
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Select2, decorators: [{
1054
+ type: Component,
1055
+ args: [{ selector: 'select2', template: "<div class=\"select2-label\" (click)=\"toggleOpenAndClose()\">\n <ng-content select=\"select2-label\"></ng-content>\n <span *ngIf=\"required\" class=\"select2-required\"></span>\n</div>\n<div\n class=\"select2 select2-container select2-container--default\"\n [class.select2-container--focus]=\"focused\"\n [class.select2-container--below]=\"!select2above\"\n [class.select2-container--above]=\"select2above\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-container--disabled]=\"disabled\"\n>\n <div\n class=\"selection\"\n #selection\n #trigger=\"cdkOverlayOrigin\"\n [tabindex]=\"!this.isOpen ? tabIndex : '-1'\"\n (click)=\"toggleOpenAndClose()\"\n (focus)=\"focusin()\"\n (blur)=\"focusout()\"\n (keydown)=\"openKey($event)\"\n cdkOverlayOrigin\n [class.select2-focused]=\"focused\"\n >\n <div\n class=\"select2-selection\"\n [class.select2-selection--multiple]=\"multiple\"\n [class.select2-selection--single]=\"!multiple\"\n role=\"combobox\"\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__rendered\" [title]=\"select2Option?.label || ''\">\n <span *ngIf=\"!select2Option\">&nbsp;</span>\n <ng-container *ngIf=\"select2Option\">\n <span\n *ngIf=\"!hasTemplate(select2Option, 'option') || noLabelTemplate; else template\"\n [innerHTML]=\"select2Option.label\"\n ></span>\n <ng-template #template>\n <ng-container *ngTemplateOutlet=\"getTemplate(select2Option, 'option'); context: select2Option\">\n </ng-container>\n </ng-template>\n </ng-container>\n <span [class.select2-selection__placeholder__option]=\"option\" class=\"select2-selection__placeholder\">{{\n placeholder\n }}</span>\n </span>\n <span\n (click)=\"reset($event)\"\n *ngIf=\"!multiple && resettable && select2Option && !(disabled || readonly)\"\n class=\"select2-selection__reset\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__arrow\" role=\"presentation\"> </span>\n <ul *ngIf=\"multiple\" class=\"select2-selection__rendered\">\n <span\n *ngIf=\"!autoCreate\"\n [class.select2-selection__placeholder__option]=\"select2Options?.length > 0\"\n class=\"select2-selection__placeholder\"\n >{{ placeholder }}</span\n >\n <li\n *ngFor=\"let op of option; trackBy: trackBy\"\n class=\"select2-selection__choice\"\n [title]=\"op.label\"\n tabindex=\"0\"\n (keydown.enter)=\"removeSelection($event, op)\"\n >\n <span\n *ngIf=\"!(disabled || readonly)\"\n (click)=\"removeSelection($event, op)\"\n class=\"select2-selection__choice__remove\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span\n *ngIf=\"!hasTemplate(op, 'option') || noLabelTemplate; else templateMultiple\"\n [innerHTML]=\"op.label\"\n ></span>\n <ng-template #templateMultiple>\n <ng-container *ngTemplateOutlet=\"getTemplate(op, 'option'); context: op\"></ng-container>\n </ng-template>\n </li>\n <li\n *ngIf=\"autoCreate\"\n class=\"select2-selection__auto-create\"\n (focus)=\"stopEvent($event)\"\n (blur)=\"stopEvent($event)\"\n >\n <input\n [id]=\"id + '-create-field'\"\n (click)=\"toggleOpenAndClose(false, true); stopEvent($event)\"\n (keydown)=\"keyDown($event, true)\"\n (keyup)=\"searchUpdate($event)\"\n (change)=\"prevChange($event)\"\n class=\"select2-create__field\"\n type=\"search\"\n role=\"textbox\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n </li>\n </ul>\n </div>\n </div>\n <ng-container *ngIf=\"!overlay\">\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n </ng-container>\n\n <div class=\"select2-subscript-wrapper\">\n <ng-content select=\"select2-hint\"></ng-content>\n </div>\n</div>\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayHasBackdrop\n cdkConnectedOverlayBackdropClass=\"select2-overlay-backdrop\"\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"this.isOpen && overlay\"\n [cdkConnectedOverlayMinWidth]=\"overlayWidth\"\n [cdkConnectedOverlayHeight]=\"overlayHeight\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n (backdropClick)=\"toggleOpenAndClose()\"\n>\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #containerTemplate>\n <div\n class=\"select2-container select2-container--default select2-container-dropdown\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-overlay]=\"overlay\"\n [class.select2-position-auto]=\"listPosition === 'auto'\"\n >\n <div\n #dropdown\n class=\"select2-dropdown\"\n [class.select2-dropdown--below]=\"!select2above\"\n [class.select2-dropdown--above]=\"select2above\"\n >\n <div class=\"select2-search select2-search--dropdown\" [class.select2-search--hide]=\"hideSearch()\">\n <input\n #searchInput\n [id]=\"id + '-search-field'\"\n [value]=\"searchText\"\n (keydown)=\"keyDown($event)\"\n (keyup)=\"searchUpdate($event)\"\n (change)=\"prevChange($event)\"\n class=\"select2-search__field\"\n type=\"search\"\n role=\"textbox\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [attr.tabindex]=\"this.isOpen ? tabIndex : '-1'\"\n />\n </div>\n <div class=\"select2-results\">\n <ul\n #results\n class=\"select2-results__options\"\n [style.max-height]=\"resultMaxHeight\"\n role=\"tree\"\n tabindex=\"-1\"\n infiniteScroll\n [infiniteScrollDisabled]=\"!infiniteScroll && !isOpen\"\n [infiniteScrollDistance]=\"infiniteScrollDistance\"\n [infiniteScrollThrottle]=\"infiniteScrollThrottle\"\n [infiniteScrollContainer]=\"results\"\n (scrolled)=\"onScroll('down')\"\n (scrolledUp)=\"onScroll('up')\"\n (keydown)=\"keyDown($event)\"\n >\n <ng-container *ngFor=\"let groupOrOption of filteredData; index as i; trackBy: trackBy\">\n <li *ngIf=\"groupOrOption.options\" class=\"select2-results__option\" role=\"group\">\n <strong\n *ngIf=\"!hasTemplate(groupOrOption, 'group'); else optGroup\"\n [attr.class]=\"\n 'select2-results__group' +\n (groupOrOption.classes ? ' ' + groupOrOption.classes : '')\n \"\n [innerHTML]=\"groupOrOption.label\"\n ></strong>\n <ng-template #optGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'group'); context: groupOrOption\"\n >\n </ng-container>\n </ng-template>\n\n <ul class=\"select2-results__options select2-results__options--nested\">\n <li\n *ngFor=\"let option of groupOrOption.options; index as j; trackBy: trackBy\"\n #result\n [id]=\"option.id || id + '-option-' + i + '-' + j\"\n [class]=\"getOptionStyle(option)\"\n role=\"treeitem\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"isDisabled(option)\"\n (mouseenter)=\"mouseenter(option)\"\n (click)=\"click(option)\"\n >\n <div\n *ngIf=\"!hasTemplate(option, 'option'); else liGroup\"\n class=\"select2-label-content\"\n [innerHTML]=\"option.label\"\n ></div>\n <ng-template #liGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(option, 'option'); context: option\"\n >\n </ng-container>\n </ng-template>\n </li>\n </ul>\n </li>\n <li\n *ngIf=\"!groupOrOption.options\"\n #result\n [id]=\"groupOrOption.id || id + '-option-' + i\"\n [class]=\"getOptionStyle(groupOrOption)\"\n role=\"treeitem\"\n [attr.aria-selected]=\"isSelected(groupOrOption)\"\n [attr.aria-disabled]=\"isDisabled(groupOrOption)\"\n (mouseenter)=\"mouseenter(groupOrOption)\"\n (click)=\"click(groupOrOption)\"\n >\n <div\n *ngIf=\"!hasTemplate(groupOrOption, 'option'); else li\"\n [innerHTML]=\"groupOrOption.label\"\n class=\"select2-label-content\"\n ></div>\n <ng-template #li>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'option'); context: groupOrOption\"\n >\n </ng-container>\n </ng-template>\n </li>\n </ng-container>\n <li\n class=\"select2-no-result select2-results__option\"\n *ngIf=\"!filteredData?.length && noResultMessage\"\n [innerHTML]=\"noResultMessage\"\n ></li>\n <li\n class=\"select2-too-much-result select2-results__option\"\n *ngIf=\"maxResultsExceeded\"\n [innerHTML]=\"maxResultsMessage\"\n ></li>\n </ul>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: [".select2-label{color:var(--select2-label-text-color, #000)}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;width:100%}.select2-container .select2-container-dropdown{position:absolute;width:0px;opacity:0}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:var(--select2-single-height, 28px);-webkit-user-select:none;user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding:0 0 0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1 1 auto}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:var(--select2-multiple-height, 28px);-webkit-user-select:none;user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-flex;overflow:hidden;padding-left:8px;padding-bottom:2px;text-overflow:ellipsis;white-space:nowrap;flex-wrap:wrap;gap:5px}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-selection__auto-create{flex:1 1 150px;min-width:150px;display:flex}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-create__field{width:100%;border:0}.select2-container .select2-selection--multiple .select2-selection__rendered .select2-create__field:focus{border:0;outline:0}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background:var(--select2-dropdown-background, white);border:1px solid var(--select2-dropdown-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);box-sizing:border-box;display:block;position:absolute;width:100%;z-index:1051;height:0;overflow:hidden}.select2-dropdown .select2-label-content{display:contents}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;-webkit-user-select:none;user-select:none;color:var(--select2-option-text-color, #000)}.select2-results__option[aria-selected]{cursor:pointer}.select2-container.select2-container-dropdown.select2-container--open{width:100%;opacity:1}.select2-container--open .select2-dropdown{overflow:auto;height:auto}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:27px;display:flex;flex-direction:column-reverse}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99}.select2-required:before{content:\"*\";color:var(--select2-required-color, red)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}.select2-container--default .select2-selection--single{background:var(--select2-selection-background, #fff);border:1px solid var(--select2-selection-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);display:flex}.select2-container--default .select2-selection--single .select2-selection__rendered{color:var(--select2-selection-text-color, #111);line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:var(--select2-placeholder-color, #999)}.select2-container--default .select2-selection--single .select2-selection__placeholder span{overflow:hidden;white-space:nowrap;text-overflow:var(--select2-placeholder-overflow, ellipsis)}.select2-container--default .select2-selection--single .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--single .select2-selection__reset,.select2-container--default .select2-selection--single .select2-selection__arrow{display:flex;width:20px;align-items:center;justify-content:center}.select2-container--default .select2-selection--single .select2-selection__arrow:before{content:\" \";border-color:var(--select2-arrow-color, #888) transparent;border-style:solid;border-width:5px 4px 0;height:0;width:0}.select2-container--default .select2-selection--single .select2-selection__reset{color:var(--select2-reset-color, #999)}.select2-container--default.select2-container--disabled .select2-selection--single{background:var(--select2-selection-disabled-background, #eee);cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow:before{border-color:transparent transparent var(--select2-arrow-color, #888);border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background:var(--select2-selection-background, #fff);border:1px solid var(--select2-selection-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{flex:1 1 auto;box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{display:block;width:100%;color:var(--select2-placeholder-color, #999);margin-top:5px;float:left;overflow:hidden;white-space:nowrap;text-overflow:var(--select2-placeholder-overflow, ellipsis)}.select2-container--default .select2-selection--multiple .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{color:var(--select2-selection-choice-text-color, #000);background:var(--select2-selection-choice-background, #e4e4e4);border:1px solid var(--select2-selection-choice-border-color, #aaa);border-radius:var(--select2-selection-border-radius, 4px);cursor:default;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:var(--select2-selection-choice-close-color, #999);cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:var(--select2-selection-choice-hover-close-color, #333)}.select2-container--default.select2-container--focused .select2-selection--multiple{border:solid var(--select2-selection-focus-border-color, #000) 1px;outline:none}.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple{border:solid var(--select2-selection-focus-border-color, #000) 1px;outline:none}.select2-container--default.select2-container--disabled .select2-selection--multiple{background:var(--select2-selection-disabled-background, #eee);cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid var(--select2-search-border-color, #aaa);background:1px solid var(--select2-search-background, #fff);border-radius:var(--select2-search-border-radius, 0px)}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:none;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:var(--select2-option-disabled-text-color, #999);background:var(--select2-option-disabled-background, transparent)}.select2-container--default .select2-results__option[aria-selected=true]{color:var(--select2-option-selected-text-color, #000);background:var(--select2-option-selected-background, #ddd)}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background:var(--select2-option-highlighted-background, #5897fb);color:var(--select2-option-highlighted-text-color, #fff)}.select2-container--default .select2-results__option--hide{display:none}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;color:var(--select2-option-group-text-color, gray);background:var(--select2-option-group-background, transparent)}.select2-no-result{color:var(--select2-no-result-color, #888);font-style:var(--select2-no-result-font-style, italic)}.select2-too-much-result{color:var(--select2-too-much-result-color, #888);font-style:var(--select2-too-much-font-style, italic)}:host.nostyle .select2-dropdown{border-color:transparent}:host.nostyle .select2-selection--single,:host.nostyle .select2-selection--multiple{background:transparent;border-color:transparent}:host.nostyle .select2-container--default .select2-focused .select2-selection--single,:host.nostyle .select2-container--default .select2-focused .select2-selection--multiple,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple{background:transparent;border-color:transparent}:host.material{display:inline-block;width:300px}:host.material>.select2-container{padding-bottom:1.29688em;vertical-align:inherit}:host.material>.select2-container .selection{padding:.4375em 0;border-top:.84375em solid transparent;display:inline-flex;align-items:baseline;width:100%;height:auto}:host.material .select2-container--default .select2-selection--single,:host.material .select2-container--default .select2-selection--multiple{width:100%;border:0;border-radius:0;height:24px;box-sizing:border-box}:host.material .select2-container--default .select2-selection--single:before,:host.material .select2-container--default .select2-selection--multiple:before{content:\" \";display:block;position:absolute;bottom:1.65em;background:var(--select2-material-underline, #ddd);height:1px;width:100%}:host.material .select2-container--default .select2-selection--single:after,:host.material .select2-container--default .select2-selection--multiple:after{content:\" \";display:block;position:absolute;bottom:1.63em;background:var(--select2-material-underline-active, #5a419e);height:2px;width:0%;left:50%;transition:none}:host.material .select2-container--default .select2-selection--single .select2-selection__rendered,:host.material .select2-container--default .select2-selection--multiple .select2-selection__rendered{padding-left:1px;line-height:inherit}:host.material .select2-container--default .select2-selection--single .select2-selection__placeholder,:host.material .select2-container--default .select2-selection--multiple .select2-selection__placeholder{display:block;color:var(--select2-material-placeholder-color, rgba(0, 0, 0, .38));transition:transform .3s;position:absolute;transform-origin:0 21px;left:0;top:20px}:host.material .select2-container--default .select2-container--open{left:0;bottom:1.6em}:host.material .select2-container--default .select2-selection__placeholder__option{transform:translateY(-1.5em) scale(.75) perspective(100px) translateZ(.001px);width:133.33333%}:host.material .select2-container--default .select2-selection__arrow{top:20px}:host.material .select2-container--default.select2-container--open .select2-selection--single:after,:host.material .select2-container--default.select2-container--open .select2-selection--multiple:after,:host.material .select2-container--default .select2-focused .select2-selection--single:after,:host.material .select2-container--default .select2-focused .select2-selection--multiple:after{transition:width .3s cubic-bezier(.12,1,.77,1),left .3s cubic-bezier(.12,1,.77,1);width:100%;left:0%}:host.material .select2-container--default .select2-dropdown{border-radius:0;border:0;box-shadow:0 5px 5px #00000080}:host.material .select2-container--default .select2-results__option[aria-selected=true],:host.material .select2-container--default .select2-results__option--highlighted[aria-selected]{background:var(--select2-material-option-selected-background, rgba(0, 0, 0, .04));color:var(--select2-material-option-highlighted-text-color, #000)}:host.material .select2-container--default .select2-results__option[aria-selected=true]{color:var(--select2-material-option-selected-text-color, #ff5722)}:host.material .select2-container--default.select2-container--disabled .select2-selection--single,:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple{background:transparent}:host.material .select2-container--default.select2-container--disabled .select2-selection--single:before,:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple:before{background:var(--select2-material-underline-disabled, linear-gradient(to right, rgba(0, 0, 0, .26) 0, rgba(0, 0, 0, .26) 33%, transparent 0));background-size:4px 1px;background-repeat:repeat-x;background-position:0 bottom}:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:before,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:after,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple:before,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple:after{background:var(--select2-material-underline-invalid, red)}:host.material:not(.select2-container--open) .select2-focused .select2-selection--single,:host.material:not(.select2-container--open) .select2-focused .select2-selection--multiple{border:0}:host.material .select2-subscript-wrapper{position:absolute;top:calc(100% - 1.72917em);font-size:75%;color:var(--select2-hint-text-color, #888)}::ng-deep .select2-overlay-backdrop{background:var(--select2-overlay-backdrop, transparent)}::ng-deep .cdk-overlay-container .select2-container .select2-dropdown.select2-dropdown--above{bottom:28px}::ng-deep .cdk-overlay-container .select2-container--open.select2-position-auto .select2-dropdown{margin-bottom:28px}::ng-deep .cdk-overlay-container .select2-container--open.select2-position-auto .select2-dropdown.select2-dropdown--above{bottom:0;margin-bottom:0;margin-top:28px}@supports (-moz-appearance: none){select2.material .select2-container--default .select2-selection--single,select2.material .select2-container--default .select2-selection--multiple{height:26px}}\n"] }]
1056
+ }], ctorParameters: function () { return [{ type: i1.ViewportRuler }, { type: i0.ChangeDetectorRef }, { type: i2.NgForm, decorators: [{
1057
+ type: Optional
1058
+ }] }, { type: i2.FormGroupDirective, decorators: [{
1059
+ type: Optional
1060
+ }] }, { type: i2.NgControl, decorators: [{
1061
+ type: Self
1062
+ }, {
1063
+ type: Optional
1064
+ }] }, { type: undefined, decorators: [{
1065
+ type: Attribute,
1066
+ args: ['tabindex']
1067
+ }] }]; }, propDecorators: { data: [{
1068
+ type: Input,
1069
+ args: [{ required: true }]
1070
+ }], minCharForSearch: [{
1071
+ type: Input,
1072
+ args: [{ transform: numberAttribute }]
1073
+ }], displaySearchStatus: [{
1074
+ type: Input
1075
+ }], placeholder: [{
1076
+ type: Input
1077
+ }], limitSelection: [{
1078
+ type: Input,
1079
+ args: [{ transform: numberAttribute }]
1080
+ }], listPosition: [{
1081
+ type: Input
1082
+ }], multiple: [{
1083
+ type: Input
1084
+ }], overlay: [{
1085
+ type: Input,
1086
+ args: [{ transform: booleanAttribute }]
1087
+ }], styleMode: [{
1088
+ type: Input
1089
+ }], noResultMessage: [{
1090
+ type: Input
1091
+ }], maxResults: [{
1092
+ type: Input,
1093
+ args: [{ transform: numberAttribute }]
1094
+ }], maxResultsMessage: [{
1095
+ type: Input
1096
+ }], infiniteScrollDistance: [{
1097
+ type: Input,
1098
+ args: [{ transform: numberAttribute }]
1099
+ }], infiniteScrollThrottle: [{
1100
+ type: Input,
1101
+ args: [{ transform: numberAttribute }]
1102
+ }], infiniteScroll: [{
1103
+ type: Input,
1104
+ args: [{ transform: booleanAttribute }]
1105
+ }], autoCreate: [{
1106
+ type: Input,
1107
+ args: [{ transform: booleanAttribute }]
1108
+ }], noLabelTemplate: [{
1109
+ type: Input,
1110
+ args: [{ transform: booleanAttribute }]
1111
+ }], editPattern: [{
1112
+ type: Input
1113
+ }], templates: [{
1114
+ type: Input
1115
+ }], resultMaxHeight: [{
1116
+ type: Input
1117
+ }], customSearchEnabled: [{
1118
+ type: Input,
1119
+ args: [{ transform: booleanAttribute }]
1120
+ }], minCountForSearch: [{
1121
+ type: Input,
1122
+ args: [{ transform: numberAttribute }]
1123
+ }], id: [{
1124
+ type: Input
1125
+ }, {
1126
+ type: HostBinding,
1127
+ args: ['id']
1128
+ }], required: [{
1129
+ type: Input,
1130
+ args: [{ transform: booleanAttribute }]
1131
+ }], disabled: [{
1132
+ type: Input,
1133
+ args: [{ transform: booleanAttribute }]
1134
+ }], hideSelectedItems: [{
1135
+ type: Input,
1136
+ args: [{ transform: booleanAttribute }]
1137
+ }], readonly: [{
1138
+ type: Input,
1139
+ args: [{ transform: booleanAttribute }]
1140
+ }], value: [{
1141
+ type: Input
1142
+ }], tabIndex: [{
1143
+ type: Input,
1144
+ args: [{ transform: numberAttribute }]
1145
+ }], resettable: [{
1146
+ type: Input,
1147
+ args: [{ transform: booleanAttribute }]
1148
+ }], update: [{
1149
+ type: Output
1150
+ }], open: [{
1151
+ type: Output
1152
+ }], close: [{
1153
+ type: Output
1154
+ }], focus: [{
1155
+ type: Output
1156
+ }], blur: [{
1157
+ type: Output
1158
+ }], search: [{
1159
+ type: Output
1160
+ }], scroll: [{
1161
+ type: Output
1162
+ }], removeOption: [{
1163
+ type: Output
1164
+ }], ariaInvalid: [{
1165
+ type: HostBinding,
1166
+ args: ['attr.aria-invalid']
1167
+ }], classMaterial: [{
1168
+ type: HostBinding,
1169
+ args: ['class.material']
1170
+ }], classNostyle: [{
1171
+ type: HostBinding,
1172
+ args: ['class.nostyle']
1173
+ }], select2above: [{
1174
+ type: HostBinding,
1175
+ args: ['class.select2-above']
1176
+ }], cdkConnectedOverlay: [{
1177
+ type: ViewChild,
1178
+ args: [CdkConnectedOverlay]
1179
+ }], selection: [{
1180
+ type: ViewChild,
1181
+ args: ['selection', { static: true }]
1182
+ }], resultContainer: [{
1183
+ type: ViewChild,
1184
+ args: ['results']
1185
+ }], results: [{
1186
+ type: ViewChildren,
1187
+ args: ['result']
1188
+ }], searchInput: [{
1189
+ type: ViewChild,
1190
+ args: ['searchInput']
1191
+ }], dropdown: [{
1192
+ type: ViewChild,
1193
+ args: ['dropdown']
1194
+ }], clickDetection: [{
1195
+ type: HostListener,
1196
+ args: ['document:click', ['$event']]
1228
1197
  }] } });
1229
1198
 
1230
- class Select2Hint {
1231
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Select2Hint, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1232
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.4", type: Select2Hint, selector: "select2-hint", ngImport: i0 }); }
1233
- }
1234
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Select2Hint, decorators: [{
1235
- type: Directive,
1236
- args: [{ selector: 'select2-hint' }]
1199
+ class Select2Hint {
1200
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Select2Hint, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1201
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.6", type: Select2Hint, selector: "select2-hint", ngImport: i0 }); }
1202
+ }
1203
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Select2Hint, decorators: [{
1204
+ type: Directive,
1205
+ args: [{ selector: 'select2-hint' }]
1237
1206
  }] });
1238
1207
 
1239
- class Select2Label {
1240
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Select2Label, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1241
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.4", type: Select2Label, selector: "select2-label", ngImport: i0 }); }
1242
- }
1243
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Select2Label, decorators: [{
1244
- type: Directive,
1245
- args: [{ selector: 'select2-label' }]
1208
+ class Select2Label {
1209
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Select2Label, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1210
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.6", type: Select2Label, selector: "select2-label", ngImport: i0 }); }
1211
+ }
1212
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Select2Label, decorators: [{
1213
+ type: Directive,
1214
+ args: [{ selector: 'select2-label' }]
1246
1215
  }] });
1247
1216
 
1248
- class Select2Module {
1249
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Select2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1250
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.4", ngImport: i0, type: Select2Module, declarations: [Select2Hint, Select2Label, Select2], imports: [CommonModule, FormsModule, OverlayModule, ReactiveFormsModule, InfiniteScrollModule], exports: [FormsModule, ReactiveFormsModule, Select2Hint, Select2Label, Select2] }); }
1251
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Select2Module, imports: [CommonModule, FormsModule, OverlayModule, ReactiveFormsModule, InfiniteScrollModule, FormsModule, ReactiveFormsModule] }); }
1252
- }
1253
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Select2Module, decorators: [{
1254
- type: NgModule,
1255
- args: [{
1256
- imports: [CommonModule, FormsModule, OverlayModule, ReactiveFormsModule, InfiniteScrollModule],
1257
- declarations: [Select2Hint, Select2Label, Select2],
1258
- exports: [FormsModule, ReactiveFormsModule, Select2Hint, Select2Label, Select2],
1259
- }]
1217
+ class Select2Module {
1218
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Select2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1219
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.6", ngImport: i0, type: Select2Module, declarations: [Select2Hint, Select2Label, Select2], imports: [CommonModule, FormsModule, OverlayModule, ReactiveFormsModule, InfiniteScrollModule], exports: [FormsModule, ReactiveFormsModule, Select2Hint, Select2Label, Select2] }); }
1220
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Select2Module, imports: [CommonModule, FormsModule, OverlayModule, ReactiveFormsModule, InfiniteScrollModule, FormsModule, ReactiveFormsModule] }); }
1221
+ }
1222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Select2Module, decorators: [{
1223
+ type: NgModule,
1224
+ args: [{
1225
+ imports: [CommonModule, FormsModule, OverlayModule, ReactiveFormsModule, InfiniteScrollModule],
1226
+ declarations: [Select2Hint, Select2Label, Select2],
1227
+ exports: [FormsModule, ReactiveFormsModule, Select2Hint, Select2Label, Select2],
1228
+ }]
1260
1229
  }] });
1261
1230
 
1262
- /*
1263
- * Public API Surface of ng-select2-component
1231
+ /*
1232
+ * Public API Surface of ng-select2-component
1264
1233
  */
1265
1234
 
1266
- /**
1267
- * Generated bundle index. Do not edit.
1235
+ /**
1236
+ * Generated bundle index. Do not edit.
1268
1237
  */
1269
1238
 
1270
1239
  export { Select2, Select2Hint, Select2Label, Select2Module, Select2Utils, defaultMinCountForSearch, protectRegexp, timeout, unicodePatterns };