ng-select2-component 8.0.3 → 8.1.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,2026 +1,2186 @@
1
+ import { CdkConnectedOverlay, OverlayModule } from '@angular/cdk/overlay';
1
2
  import { ViewportRuler } from '@angular/cdk/scrolling';
2
3
  import { EventEmitter, TemplateRef, Component, ChangeDetectorRef, Optional, Self, Attribute, Input, Output, HostBinding, ViewChild, ViewChildren, Directive, NgModule } from '@angular/core';
3
4
  import { NgForm, FormGroupDirective, NgControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
4
5
  import { Subject } from 'rxjs';
5
- import { OverlayModule } from '@angular/cdk/overlay';
6
6
  import { CommonModule } from '@angular/common';
7
7
  import { InfiniteScrollModule } from 'ngx-infinite-scroll';
8
8
 
9
- /**
10
- * @fileoverview added by tsickle
11
- * Generated from: lib/select2-interfaces.ts
12
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
13
- */
14
- /**
15
- * @record
16
- */
17
- function Select2Group() { }
18
- if (false) {
19
- /**
20
- * label of group
21
- * @type {?}
22
- */
23
- Select2Group.prototype.label;
24
- /**
25
- * options list
26
- * @type {?}
27
- */
28
- Select2Group.prototype.options;
29
- /**
30
- * add classes
31
- * @type {?|undefined}
32
- */
33
- Select2Group.prototype.classes;
34
- /**
35
- * template id
36
- * @type {?|undefined}
37
- */
38
- Select2Group.prototype.templateId;
39
- /**
40
- * template data
41
- * @type {?|undefined}
42
- */
43
- Select2Group.prototype.data;
44
- }
45
- /**
46
- * @record
47
- */
48
- function Select2Option() { }
49
- if (false) {
50
- /**
51
- * value
52
- * @type {?}
53
- */
54
- Select2Option.prototype.value;
55
- /**
56
- * label of option
57
- * @type {?}
58
- */
59
- Select2Option.prototype.label;
60
- /**
61
- * no selectable is disabled
62
- * @type {?|undefined}
63
- */
64
- Select2Option.prototype.disabled;
65
- /**
66
- * for identification
67
- * @type {?|undefined}
68
- */
69
- Select2Option.prototype.id;
70
- /**
71
- * add classes
72
- * @type {?|undefined}
73
- */
74
- Select2Option.prototype.classes;
75
- /**
76
- * template id
77
- * @type {?|undefined}
78
- */
79
- Select2Option.prototype.templateId;
80
- /**
81
- * template data
82
- * @type {?|undefined}
83
- */
84
- Select2Option.prototype.data;
85
- /**
86
- * hide this option
87
- * @type {?|undefined}
88
- */
89
- Select2Option.prototype.hide;
90
- }
91
- /**
92
- * @record
93
- * @template U
94
- */
95
- function Select2UpdateEvent() { }
96
- if (false) {
97
- /** @type {?} */
98
- Select2UpdateEvent.prototype.component;
99
- /** @type {?} */
100
- Select2UpdateEvent.prototype.value;
101
- /** @type {?} */
102
- Select2UpdateEvent.prototype.options;
103
- }
104
- /**
105
- * @record
106
- * @template U
107
- */
108
- function Select2SearchEvent() { }
109
- if (false) {
110
- /** @type {?} */
111
- Select2SearchEvent.prototype.component;
112
- /** @type {?} */
113
- Select2SearchEvent.prototype.value;
114
- /** @type {?} */
115
- Select2SearchEvent.prototype.search;
116
- }
117
- /**
118
- * @record
119
- * @template U
120
- */
121
- function Select2RemoveEvent() { }
122
- if (false) {
123
- /** @type {?} */
124
- Select2RemoveEvent.prototype.component;
125
- /** @type {?} */
126
- Select2RemoveEvent.prototype.value;
127
- /** @type {?} */
128
- Select2RemoveEvent.prototype.removedOption;
129
- }
130
- /**
131
- * @record
132
- */
133
- function Select2ScrollEvent() { }
134
- if (false) {
135
- /** @type {?} */
136
- Select2ScrollEvent.prototype.component;
137
- /** @type {?} */
138
- Select2ScrollEvent.prototype.way;
139
- /** @type {?} */
140
- Select2ScrollEvent.prototype.search;
9
+ /**
10
+ * @fileoverview added by tsickle
11
+ * Generated from: lib/select2-interfaces.ts
12
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
13
+ */
14
+ /**
15
+ * @record
16
+ */
17
+ function Select2Group() { }
18
+ if (false) {
19
+ /**
20
+ * label of group
21
+ * @type {?}
22
+ */
23
+ Select2Group.prototype.label;
24
+ /**
25
+ * options list
26
+ * @type {?}
27
+ */
28
+ Select2Group.prototype.options;
29
+ /**
30
+ * add classes
31
+ * @type {?|undefined}
32
+ */
33
+ Select2Group.prototype.classes;
34
+ /**
35
+ * template id
36
+ * @type {?|undefined}
37
+ */
38
+ Select2Group.prototype.templateId;
39
+ /**
40
+ * template data
41
+ * @type {?|undefined}
42
+ */
43
+ Select2Group.prototype.data;
44
+ }
45
+ /**
46
+ * @record
47
+ */
48
+ function Select2Option() { }
49
+ if (false) {
50
+ /**
51
+ * value
52
+ * @type {?}
53
+ */
54
+ Select2Option.prototype.value;
55
+ /**
56
+ * label of option
57
+ * @type {?}
58
+ */
59
+ Select2Option.prototype.label;
60
+ /**
61
+ * no selectable is disabled
62
+ * @type {?|undefined}
63
+ */
64
+ Select2Option.prototype.disabled;
65
+ /**
66
+ * for identification
67
+ * @type {?|undefined}
68
+ */
69
+ Select2Option.prototype.id;
70
+ /**
71
+ * add classes
72
+ * @type {?|undefined}
73
+ */
74
+ Select2Option.prototype.classes;
75
+ /**
76
+ * template id
77
+ * @type {?|undefined}
78
+ */
79
+ Select2Option.prototype.templateId;
80
+ /**
81
+ * template data
82
+ * @type {?|undefined}
83
+ */
84
+ Select2Option.prototype.data;
85
+ /**
86
+ * hide this option
87
+ * @type {?|undefined}
88
+ */
89
+ Select2Option.prototype.hide;
90
+ }
91
+ /**
92
+ * @record
93
+ * @template U
94
+ */
95
+ function Select2UpdateEvent() { }
96
+ if (false) {
97
+ /** @type {?} */
98
+ Select2UpdateEvent.prototype.component;
99
+ /** @type {?} */
100
+ Select2UpdateEvent.prototype.value;
101
+ /** @type {?} */
102
+ Select2UpdateEvent.prototype.options;
103
+ }
104
+ /**
105
+ * @record
106
+ * @template U
107
+ */
108
+ function Select2SearchEvent() { }
109
+ if (false) {
110
+ /** @type {?} */
111
+ Select2SearchEvent.prototype.component;
112
+ /** @type {?} */
113
+ Select2SearchEvent.prototype.value;
114
+ /** @type {?} */
115
+ Select2SearchEvent.prototype.search;
116
+ }
117
+ /**
118
+ * @record
119
+ * @template U
120
+ */
121
+ function Select2RemoveEvent() { }
122
+ if (false) {
123
+ /** @type {?} */
124
+ Select2RemoveEvent.prototype.component;
125
+ /** @type {?} */
126
+ Select2RemoveEvent.prototype.value;
127
+ /** @type {?} */
128
+ Select2RemoveEvent.prototype.removedOption;
129
+ }
130
+ /**
131
+ * @record
132
+ */
133
+ function Select2ScrollEvent() { }
134
+ if (false) {
135
+ /** @type {?} */
136
+ Select2ScrollEvent.prototype.component;
137
+ /** @type {?} */
138
+ Select2ScrollEvent.prototype.way;
139
+ /** @type {?} */
140
+ Select2ScrollEvent.prototype.search;
141
141
  }
142
142
 
143
- /**
144
- * @fileoverview added by tsickle
145
- * Generated from: lib/select2-const.ts
146
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
147
- */
148
- /** @type {?} */
149
- const timeout = 200;
150
- /** @type {?} */
151
- const unicodePatterns = [
152
- { l: 'a', s: /[ⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ]/gi },
153
- { l: 'aa', s: /ꜳ/gi },
154
- { l: 'ae', s: /[æǽǣ]/gi },
155
- { l: 'ao', s: /ꜵ/gi },
156
- { l: 'au', s: /ꜷ/gi },
157
- { l: 'av', s: /[ꜹꜻ]/gi },
158
- { l: 'ay', s: /ꜽ/gi },
159
- { l: 'b', s: /[ⓑbḃḅḇƀƃɓ]/gi },
160
- { l: 'c', s: /[ⓒcćĉċčçḉƈȼꜿↄ]/gi },
161
- { l: 'd', s: /[ⓓdḋďḍḑḓḏđƌɖɗꝺ]/gi },
162
- { l: 'dz', s: /[dzdž]/gi },
163
- { l: 'e', s: /[ⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ]/gi },
164
- { l: 'f', s: /[ⓕfḟƒꝼ]/gi },
165
- { l: 'g', s: /[ⓖgǵĝḡğġǧģǥɠꞡᵹꝿ]/gi },
166
- { l: 'h', s: /[ⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ]/gi },
167
- { l: 'hv', s: /ƕ/gi },
168
- { l: 'i', s: /[ⓘiìíîĩīĭİïḯỉǐȉȋịįḭɨı]/gi },
169
- { l: 'j', s: /[ⓙjĵǰɉ]/gi },
170
- { l: 'k', s: /[ⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ]/gi },
171
- { l: 'l', s: /[ⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇꝆ]/gi },
172
- { l: 'lj', s: /lj/gi },
173
- { l: 'm', s: /[ⓜmḿṁṃɱɯ]/gi },
174
- { l: 'n', s: /[ⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ]/gi },
175
- { l: 'nj', s: /nj/gi },
176
- { l: 'o', s: /[ⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔƟꝋꝍɵ]/gi },
177
- { l: 'oi', s: /ƣ/gi },
178
- { l: 'oe', s: /œ/gi },
179
- { l: 'oo', s: /ꝏ/gi },
180
- { l: 'ou', s: /ȣ/gi },
181
- { l: 'p', s: /[ⓟpṕṗƥᵽꝑꝓꝕ]/gi },
182
- { l: 'q', s: /[ⓠqɋꝗꝙ]/gi },
183
- { l: 'r', s: /[ⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ]/gi },
184
- { l: 's', s: /[ⓢsßẞśṥŝṡšṧṣṩșşȿꞩꞅẛ]/gi },
185
- { l: 't', s: /[ⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ]/gi },
186
- { l: 'tz', s: /ꜩ/gi },
187
- { l: 'u', s: /[ⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ]/gi },
188
- { l: 'v', s: /[ⓥvṽṿʋꝟʌ]/gi },
189
- { l: 'vy', s: /ꝡ/gi },
190
- { l: 'w', s: /[ⓦwẁẃŵẇẅẘẉⱳ]/gi },
191
- { l: 'x', s: /[ⓧxẋẍ]/gi },
192
- { l: 'y', s: /[ⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ]/gi },
193
- { l: 'z', s: /[ⓩzźẑżžẓẕƶȥɀⱬꝣ]/gi }
194
- ];
195
- /** @type {?} */
196
- const defaultMinCountForSearch = 6;
197
- /** @type {?} */
143
+ /**
144
+ * @fileoverview added by tsickle
145
+ * Generated from: lib/select2-const.ts
146
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
147
+ */
148
+ /** @type {?} */
149
+ const timeout = 200;
150
+ /** @type {?} */
151
+ const unicodePatterns = [
152
+ { l: 'a', s: /[ⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ]/gi },
153
+ { l: 'aa', s: /ꜳ/gi },
154
+ { l: 'ae', s: /[æǽǣ]/gi },
155
+ { l: 'ao', s: /ꜵ/gi },
156
+ { l: 'au', s: /ꜷ/gi },
157
+ { l: 'av', s: /[ꜹꜻ]/gi },
158
+ { l: 'ay', s: /ꜽ/gi },
159
+ { l: 'b', s: /[ⓑbḃḅḇƀƃɓ]/gi },
160
+ { l: 'c', s: /[ⓒcćĉċčçḉƈȼꜿↄ]/gi },
161
+ { l: 'd', s: /[ⓓdḋďḍḑḓḏđƌɖɗꝺ]/gi },
162
+ { l: 'dz', s: /[dzdž]/gi },
163
+ { l: 'e', s: /[ⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ]/gi },
164
+ { l: 'f', s: /[ⓕfḟƒꝼ]/gi },
165
+ { l: 'g', s: /[ⓖgǵĝḡğġǧģǥɠꞡᵹꝿ]/gi },
166
+ { l: 'h', s: /[ⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ]/gi },
167
+ { l: 'hv', s: /ƕ/gi },
168
+ { l: 'i', s: /[ⓘiìíîĩīĭİïḯỉǐȉȋịįḭɨı]/gi },
169
+ { l: 'j', s: /[ⓙjĵǰɉ]/gi },
170
+ { l: 'k', s: /[ⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ]/gi },
171
+ { l: 'l', s: /[ⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇꝆ]/gi },
172
+ { l: 'lj', s: /lj/gi },
173
+ { l: 'm', s: /[ⓜmḿṁṃɱɯ]/gi },
174
+ { l: 'n', s: /[ⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ]/gi },
175
+ { l: 'nj', s: /nj/gi },
176
+ { l: 'o', s: /[ⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔƟꝋꝍɵ]/gi },
177
+ { l: 'oi', s: /ƣ/gi },
178
+ { l: 'oe', s: /œ/gi },
179
+ { l: 'oo', s: /ꝏ/gi },
180
+ { l: 'ou', s: /ȣ/gi },
181
+ { l: 'p', s: /[ⓟpṕṗƥᵽꝑꝓꝕ]/gi },
182
+ { l: 'q', s: /[ⓠqɋꝗꝙ]/gi },
183
+ { l: 'r', s: /[ⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ]/gi },
184
+ { l: 's', s: /[ⓢsßẞśṥŝṡšṧṣṩșşȿꞩꞅẛ]/gi },
185
+ { l: 't', s: /[ⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ]/gi },
186
+ { l: 'tz', s: /ꜩ/gi },
187
+ { l: 'u', s: /[ⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ]/gi },
188
+ { l: 'v', s: /[ⓥvṽṿʋꝟʌ]/gi },
189
+ { l: 'vy', s: /ꝡ/gi },
190
+ { l: 'w', s: /[ⓦwẁẃŵẇẅẘẉⱳ]/gi },
191
+ { l: 'x', s: /[ⓧxẋẍ]/gi },
192
+ { l: 'y', s: /[ⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ]/gi },
193
+ { l: 'z', s: /[ⓩzźẑżžẓẕƶȥɀⱬꝣ]/gi },
194
+ ];
195
+ /** @type {?} */
196
+ const defaultMinCountForSearch = 6;
197
+ /** @type {?} */
198
198
  const protectRegexp = new RegExp('[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]', 'g');
199
199
 
200
- /**
201
- * @fileoverview added by tsickle
202
- * Generated from: lib/select2-utils.ts
203
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
204
- */
205
- class Select2Utils {
206
- /**
207
- * @param {?} data
208
- * @param {?} value
209
- * @return {?}
210
- */
211
- static getOptionByValue(data, value) {
212
- if (Array.isArray(data)) {
213
- for (const groupOrOption of data) {
214
- /** @type {?} */
215
- const options = ((/** @type {?} */ (groupOrOption))).options;
216
- if (options) {
217
- for (const option of options) {
218
- if (option.value === value) {
219
- return option;
220
- }
221
- }
222
- }
223
- else {
224
- if (((/** @type {?} */ (groupOrOption))).value === value) {
225
- return (/** @type {?} */ (groupOrOption));
226
- }
227
- }
228
- }
229
- }
230
- return null;
231
- }
232
- /**
233
- * @param {?} data
234
- * @param {?} value
235
- * @param {?} multiple
236
- * @return {?}
237
- */
238
- static getOptionsByValue(data, value, multiple) {
239
- if (multiple) {
240
- /** @type {?} */
241
- const values = Array.isArray(value) ? value : [];
242
- /** @type {?} */
243
- const result = [];
244
- for (const v of values) {
245
- /** @type {?} */
246
- const option = Select2Utils.getOptionByValue(data, v);
247
- if (option) {
248
- result.push(option);
249
- }
250
- }
251
- return result;
252
- }
253
- return Select2Utils.getOptionByValue(data, (/** @type {?} */ (value)));
254
- }
255
- /**
256
- * @param {?} data
257
- * @return {?}
258
- */
259
- static getFirstAvailableOption(data) {
260
- if (Array.isArray(data)) {
261
- for (const groupOrOption of data) {
262
- /** @type {?} */
263
- const options = ((/** @type {?} */ (groupOrOption))).options;
264
- if (options) {
265
- for (const option of options) {
266
- if (!option.disabled) {
267
- return option.value;
268
- }
269
- }
270
- }
271
- else {
272
- /** @type {?} */
273
- const option = (/** @type {?} */ (groupOrOption));
274
- if (!option.disabled) {
275
- return option.value;
276
- }
277
- }
278
- }
279
- }
280
- return null;
281
- }
282
- /**
283
- * @private
284
- * @param {?} data
285
- * @return {?}
286
- */
287
- static getOptionsCount(data) {
288
- /** @type {?} */
289
- let count = 0;
290
- if (Array.isArray(data)) {
291
- for (const groupOrOption of data) {
292
- /** @type {?} */
293
- const options = ((/** @type {?} */ (groupOrOption))).options;
294
- if (options) {
295
- count += options.length;
296
- }
297
- else {
298
- count++;
299
- }
300
- }
301
- }
302
- return count;
303
- }
304
- /**
305
- * @param {?} filteredData
306
- * @param {?} value
307
- * @return {?}
308
- */
309
- static valueIsNotInFilteredData(filteredData, value) {
310
- if (Select2Utils.isNullOrUndefined(value)) {
311
- return true;
312
- }
313
- for (const groupOrOption of filteredData) {
314
- /** @type {?} */
315
- const options = ((/** @type {?} */ (groupOrOption))).options;
316
- if (options) {
317
- for (const option of options) {
318
- if (option.value === value) {
319
- return false;
320
- }
321
- }
322
- }
323
- else {
324
- if (((/** @type {?} */ (groupOrOption))).value === value) {
325
- return false;
326
- }
327
- }
328
- }
329
- return true;
330
- }
331
- // tslint:disable-next-line:cognitive-complexity
332
- /**
333
- * @param {?} filteredData
334
- * @param {?} hoveringValue
335
- * @return {?}
336
- */
337
- static getPreviousOption(filteredData, hoveringValue) {
338
- /** @type {?} */
339
- let findIt = Select2Utils.isNullOrUndefined(hoveringValue);
340
- for (let i = filteredData.length - 1; i >= 0; i--) {
341
- /** @type {?} */
342
- const groupOrOption = filteredData[i];
343
- /** @type {?} */
344
- const options = ((/** @type {?} */ (groupOrOption))).options;
345
- if (options) {
346
- for (let j = options.length - 1; j >= 0; j--) {
347
- /** @type {?} */
348
- const option = options[j];
349
- if (findIt) {
350
- if (!option.disabled && !option.hide) {
351
- return option;
352
- }
353
- }
354
- if (!findIt) {
355
- findIt = option.value === hoveringValue;
356
- }
357
- }
358
- }
359
- else {
360
- /** @type {?} */
361
- const option = (/** @type {?} */ (groupOrOption));
362
- if (findIt) {
363
- if (!option.disabled && !option.hide) {
364
- return option;
365
- }
366
- }
367
- if (!findIt) {
368
- findIt = option.value === hoveringValue;
369
- }
370
- }
371
- }
372
- return null;
373
- }
374
- // tslint:disable-next-line:cognitive-complexity
375
- /**
376
- * @param {?} filteredData
377
- * @param {?} hoveringValue
378
- * @return {?}
379
- */
380
- static getNextOption(filteredData, hoveringValue) {
381
- /** @type {?} */
382
- let findIt = Select2Utils.isNullOrUndefined(hoveringValue);
383
- for (const groupOrOption of filteredData) {
384
- /** @type {?} */
385
- const options = ((/** @type {?} */ (groupOrOption))).options;
386
- if (options) {
387
- for (const option of options) {
388
- if (findIt) {
389
- if (!option.disabled && !option.hide) {
390
- return option;
391
- }
392
- }
393
- else if (!findIt) {
394
- findIt = option.value === hoveringValue;
395
- }
396
- }
397
- }
398
- else {
399
- /** @type {?} */
400
- const option = (/** @type {?} */ (groupOrOption));
401
- if (findIt) {
402
- if (!option.disabled && !option.hide) {
403
- return option;
404
- }
405
- }
406
- else if (!findIt) {
407
- findIt = option.value === hoveringValue;
408
- }
409
- }
410
- }
411
- return null;
412
- }
413
- /**
414
- * @private
415
- * @param {?} value
416
- * @return {?}
417
- */
418
- static isNullOrUndefined(value) {
419
- return value === null || value === undefined;
420
- }
421
- /**
422
- * @private
423
- * @param {?} label
424
- * @param {?} searchText
425
- * @param {?} editPattern
426
- * @return {?}
427
- */
428
- static containSearchText(label, searchText, editPattern) {
429
- return searchText
430
- ? Select2Utils
431
- .formatSansUnicode(label)
432
- .match(new RegExp(Select2Utils.formatPattern(searchText, editPattern), 'i')) !== null
433
- : true;
434
- }
435
- /**
436
- * @private
437
- * @param {?} str
438
- * @return {?}
439
- */
440
- static protectPattern(str) {
441
- return str.replace(protectRegexp, '\\$&');
442
- }
443
- /**
444
- * @private
445
- * @param {?} str
446
- * @return {?}
447
- */
448
- static formatSansUnicode(str) {
449
- for (const unicodePattern of unicodePatterns) {
450
- str = str.replace(unicodePattern.s, unicodePattern.l);
451
- }
452
- return str;
453
- }
454
- /**
455
- * @private
456
- * @param {?} str
457
- * @param {?} editPattern
458
- * @return {?}
459
- */
460
- static formatPattern(str, editPattern) {
461
- str = Select2Utils.formatSansUnicode(Select2Utils.protectPattern(str));
462
- if (editPattern && typeof editPattern === 'function') {
463
- str = editPattern(str);
464
- }
465
- return str;
466
- }
467
- /**
468
- * @param {?} data
469
- * @param {?} searchText
470
- * @param {?=} editPattern
471
- * @return {?}
472
- */
473
- static getFilteredData(data, searchText, editPattern) {
474
- if (searchText) {
475
- /** @type {?} */
476
- const result = [];
477
- for (const groupOrOption of data) {
478
- /** @type {?} */
479
- const options = ((/** @type {?} */ (groupOrOption))).options;
480
- if (options) {
481
- if (options.some((/**
482
- * @param {?} group
483
- * @return {?}
484
- */
485
- group => Select2Utils.containSearchText(group.label, searchText, editPattern)))) {
486
- /** @type {?} */
487
- const filteredOptions = options.filter((/**
488
- * @param {?} group
489
- * @return {?}
490
- */
491
- group => Select2Utils.containSearchText(group.label, searchText, editPattern)));
492
- result.push({
493
- label: groupOrOption.label,
494
- options: filteredOptions
495
- });
496
- }
497
- }
498
- else if (Select2Utils.containSearchText(groupOrOption.label, searchText, editPattern)) {
499
- result.push(groupOrOption);
500
- }
501
- }
502
- return result;
503
- }
504
- else {
505
- return data;
506
- }
507
- }
508
- /**
509
- * @param {?} data
510
- * @param {?} selectedOptions
511
- * @return {?}
512
- */
513
- static getFilteredSelectedData(data, selectedOptions) {
514
- /** @type {?} */
515
- const result = [];
516
- for (const groupOrOption of data) {
517
- /** @type {?} */
518
- const options = ((/** @type {?} */ (groupOrOption))).options;
519
- if (options) {
520
- /** @type {?} */
521
- const filteredOptions = options.filter((/**
522
- * @param {?} group
523
- * @return {?}
524
- */
525
- group => Select2Utils.isSelected(selectedOptions, group, true) === 'false'));
526
- if (filteredOptions.length) {
527
- result.push({
528
- label: groupOrOption.label,
529
- options: filteredOptions
530
- });
531
- }
532
- }
533
- else if (Select2Utils.isSelected(selectedOptions, (/** @type {?} */ (groupOrOption)), true) === 'false') {
534
- result.push(groupOrOption);
535
- }
536
- }
537
- return result;
538
- }
539
- /**
540
- * @param {?} data
541
- * @param {?=} minCountForSearch
542
- * @return {?}
543
- */
544
- static isSearchboxHiddex(data, minCountForSearch) {
545
- if (minCountForSearch === '' || minCountForSearch === undefined || minCountForSearch === null || isNaN(+minCountForSearch)) {
546
- minCountForSearch = defaultMinCountForSearch;
547
- }
548
- /** @type {?} */
549
- const optionCount = Select2Utils.getOptionsCount(data);
550
- return optionCount < +minCountForSearch;
551
- }
552
- /**
553
- * @param {?} options
554
- * @param {?} option
555
- * @param {?} multiple
556
- * @return {?}
557
- */
558
- static isSelected(options, option, multiple) {
559
- return multiple
560
- ? options && ((/** @type {?} */ (options)))
561
- .some((/**
562
- * @param {?} op
563
- * @return {?}
564
- */
565
- op => op.value === option.value)) ? 'true' : 'false'
566
- : options && option.value === ((/** @type {?} */ (options))).value ? 'true' : 'false';
567
- }
568
- /**
569
- * @param {?} options
570
- * @param {?} option
571
- * @return {?}
572
- */
573
- static removeSelection(options, option) {
574
- for (let i = 0; i < ((/** @type {?} */ (options))).length; i++) {
575
- if (((/** @type {?} */ (options)))[i].value === option.value) {
576
- ((/** @type {?} */ (options))).splice(i, 1);
577
- return;
578
- }
579
- }
580
- }
200
+ /**
201
+ * @fileoverview added by tsickle
202
+ * Generated from: lib/select2-utils.ts
203
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
204
+ */
205
+ class Select2Utils {
206
+ /**
207
+ * @param {?} data
208
+ * @param {?} value
209
+ * @return {?}
210
+ */
211
+ static getOptionByValue(data, value) {
212
+ if (Array.isArray(data)) {
213
+ for (const groupOrOption of data) {
214
+ /** @type {?} */
215
+ const options = ((/** @type {?} */ (groupOrOption))).options;
216
+ if (options) {
217
+ for (const option of options) {
218
+ if (option.value === value) {
219
+ return option;
220
+ }
221
+ }
222
+ }
223
+ else if (((/** @type {?} */ (groupOrOption))).value === value) {
224
+ return (/** @type {?} */ (groupOrOption));
225
+ }
226
+ }
227
+ }
228
+ return null;
229
+ }
230
+ /**
231
+ * @param {?} data
232
+ * @param {?} value
233
+ * @param {?} multiple
234
+ * @return {?}
235
+ */
236
+ static getOptionsByValue(data, value, multiple) {
237
+ if (multiple) {
238
+ /** @type {?} */
239
+ const values = Array.isArray(value) ? value : [];
240
+ /** @type {?} */
241
+ const result = [];
242
+ for (const v of values) {
243
+ /** @type {?} */
244
+ const option = Select2Utils.getOptionByValue(data, v);
245
+ if (option) {
246
+ result.push(option);
247
+ }
248
+ }
249
+ return result;
250
+ }
251
+ return Select2Utils.getOptionByValue(data, (/** @type {?} */ (value)));
252
+ }
253
+ /**
254
+ * @param {?} data
255
+ * @return {?}
256
+ */
257
+ static getFirstAvailableOption(data) {
258
+ if (Array.isArray(data)) {
259
+ for (const groupOrOption of data) {
260
+ /** @type {?} */
261
+ const options = ((/** @type {?} */ (groupOrOption))).options;
262
+ if (options) {
263
+ for (const option of options) {
264
+ if (!option.disabled) {
265
+ return option.value;
266
+ }
267
+ }
268
+ }
269
+ else {
270
+ /** @type {?} */
271
+ const option = (/** @type {?} */ (groupOrOption));
272
+ if (!option.disabled) {
273
+ return option.value;
274
+ }
275
+ }
276
+ }
277
+ }
278
+ return null;
279
+ }
280
+ /**
281
+ * @param {?} filteredData
282
+ * @param {?} value
283
+ * @return {?}
284
+ */
285
+ static valueIsNotInFilteredData(filteredData, value) {
286
+ if (Select2Utils.isNullOrUndefined(value)) {
287
+ return true;
288
+ }
289
+ for (const groupOrOption of filteredData) {
290
+ /** @type {?} */
291
+ const options = ((/** @type {?} */ (groupOrOption))).options;
292
+ if (options) {
293
+ for (const option of options) {
294
+ if (option.value === value) {
295
+ return false;
296
+ }
297
+ }
298
+ }
299
+ else if (((/** @type {?} */ (groupOrOption))).value === value) {
300
+ return false;
301
+ }
302
+ }
303
+ return true;
304
+ }
305
+ // tslint:disable-next-line:cognitive-complexity
306
+ /**
307
+ * @param {?} filteredData
308
+ * @param {?} hoveringValue
309
+ * @return {?}
310
+ */
311
+ static getPreviousOption(filteredData, hoveringValue) {
312
+ /** @type {?} */
313
+ let findIt = Select2Utils.isNullOrUndefined(hoveringValue);
314
+ for (let i = filteredData.length - 1; i >= 0; i--) {
315
+ /** @type {?} */
316
+ const groupOrOption = filteredData[i];
317
+ /** @type {?} */
318
+ const options = ((/** @type {?} */ (groupOrOption))).options;
319
+ if (options) {
320
+ for (let j = options.length - 1; j >= 0; j--) {
321
+ /** @type {?} */
322
+ const option = options[j];
323
+ if (findIt && !option.disabled && !option.hide) {
324
+ return option;
325
+ }
326
+ if (!findIt) {
327
+ findIt = option.value === hoveringValue;
328
+ }
329
+ }
330
+ }
331
+ else {
332
+ /** @type {?} */
333
+ const option = (/** @type {?} */ (groupOrOption));
334
+ if (findIt && !option.disabled && !option.hide) {
335
+ return option;
336
+ }
337
+ if (!findIt) {
338
+ findIt = option.value === hoveringValue;
339
+ }
340
+ }
341
+ }
342
+ return null;
343
+ }
344
+ // tslint:disable-next-line:cognitive-complexity
345
+ /**
346
+ * @param {?} filteredData
347
+ * @param {?} hoveringValue
348
+ * @return {?}
349
+ */
350
+ static getNextOption(filteredData, hoveringValue) {
351
+ /** @type {?} */
352
+ let findIt = Select2Utils.isNullOrUndefined(hoveringValue);
353
+ for (const groupOrOption of filteredData) {
354
+ /** @type {?} */
355
+ const options = ((/** @type {?} */ (groupOrOption))).options;
356
+ if (options) {
357
+ for (const option of options) {
358
+ if (findIt) {
359
+ if (!option.disabled && !option.hide) {
360
+ return option;
361
+ }
362
+ }
363
+ else if (!findIt) {
364
+ findIt = option.value === hoveringValue;
365
+ }
366
+ }
367
+ }
368
+ else {
369
+ /** @type {?} */
370
+ const option = (/** @type {?} */ (groupOrOption));
371
+ if (findIt) {
372
+ if (!option.disabled && !option.hide) {
373
+ return option;
374
+ }
375
+ }
376
+ else if (!findIt) {
377
+ findIt = option.value === hoveringValue;
378
+ }
379
+ }
380
+ }
381
+ return null;
382
+ }
383
+ /**
384
+ * @param {?} data
385
+ * @param {?=} maxResults
386
+ * @return {?}
387
+ */
388
+ static getReduceData(data, maxResults = 0) {
389
+ if (maxResults > 0) {
390
+ /** @type {?} */
391
+ let counter = 0;
392
+ /** @type {?} */
393
+ const result = [];
394
+ // debugger;
395
+ for (const groupOrOption of data) {
396
+ /** @type {?} */
397
+ const options = ((/** @type {?} */ (groupOrOption))).options;
398
+ if (options) {
399
+ /** @type {?} */
400
+ const group = Object.assign(Object.assign({}, groupOrOption), { options: [] });
401
+ result.push(group);
402
+ for (const item of options) {
403
+ group.options.push(item);
404
+ counter++;
405
+ if (counter === maxResults) {
406
+ return { result, reduce: true };
407
+ }
408
+ }
409
+ }
410
+ else {
411
+ result.push(groupOrOption);
412
+ counter++;
413
+ }
414
+ if (counter === maxResults) {
415
+ return { result, reduce: true };
416
+ }
417
+ }
418
+ return { result, reduce: false };
419
+ }
420
+ else {
421
+ return { result: data, reduce: false };
422
+ }
423
+ }
424
+ /**
425
+ * @param {?} data
426
+ * @param {?} searchText
427
+ * @param {?=} editPattern
428
+ * @return {?}
429
+ */
430
+ static getFilteredData(data, searchText, editPattern) {
431
+ if (searchText) {
432
+ /** @type {?} */
433
+ const result = [];
434
+ for (const groupOrOption of data) {
435
+ /** @type {?} */
436
+ const options = ((/** @type {?} */ (groupOrOption))).options;
437
+ if (options) {
438
+ if (options.some((/**
439
+ * @param {?} group
440
+ * @return {?}
441
+ */
442
+ group => Select2Utils.containSearchText(group.label, searchText, editPattern)))) {
443
+ /** @type {?} */
444
+ const filteredOptions = options.filter((/**
445
+ * @param {?} group
446
+ * @return {?}
447
+ */
448
+ group => Select2Utils.containSearchText(group.label, searchText, editPattern)));
449
+ result.push(Object.assign(Object.assign({}, groupOrOption), { options: filteredOptions }));
450
+ }
451
+ }
452
+ else if (Select2Utils.containSearchText(groupOrOption.label, searchText, editPattern)) {
453
+ result.push(groupOrOption);
454
+ }
455
+ }
456
+ return result;
457
+ }
458
+ else {
459
+ return data;
460
+ }
461
+ }
462
+ /**
463
+ * @param {?} data
464
+ * @param {?} selectedOptions
465
+ * @return {?}
466
+ */
467
+ static getFilteredSelectedData(data, selectedOptions) {
468
+ /** @type {?} */
469
+ const result = [];
470
+ for (const groupOrOption of data) {
471
+ /** @type {?} */
472
+ const options = ((/** @type {?} */ (groupOrOption))).options;
473
+ if (options) {
474
+ /** @type {?} */
475
+ const filteredOptions = options.filter((/**
476
+ * @param {?} group
477
+ * @return {?}
478
+ */
479
+ group => Select2Utils.isSelected(selectedOptions, group, true) === 'false'));
480
+ if (filteredOptions.length) {
481
+ result.push(Object.assign(Object.assign({}, groupOrOption), { options: filteredOptions }));
482
+ }
483
+ }
484
+ else if (Select2Utils.isSelected(selectedOptions, (/** @type {?} */ (groupOrOption)), true) === 'false') {
485
+ result.push(groupOrOption);
486
+ }
487
+ }
488
+ return result;
489
+ }
490
+ /**
491
+ * @param {?} data
492
+ * @param {?=} minCountForSearch
493
+ * @return {?}
494
+ */
495
+ static isSearchboxHiddex(data, minCountForSearch) {
496
+ if (minCountForSearch === '' ||
497
+ minCountForSearch === undefined ||
498
+ minCountForSearch === null ||
499
+ isNaN(+minCountForSearch)) {
500
+ minCountForSearch = defaultMinCountForSearch;
501
+ }
502
+ /** @type {?} */
503
+ const optionCount = Select2Utils.getOptionsCount(data);
504
+ return optionCount < +minCountForSearch;
505
+ }
506
+ /**
507
+ * @param {?} options
508
+ * @param {?} option
509
+ * @param {?} multiple
510
+ * @return {?}
511
+ */
512
+ static isSelected(options, option, multiple) {
513
+ return multiple
514
+ ? options && ((/** @type {?} */ (options))).some((/**
515
+ * @param {?} op
516
+ * @return {?}
517
+ */
518
+ op => op.value === option.value))
519
+ ? 'true'
520
+ : 'false'
521
+ : options && option.value === ((/** @type {?} */ (options))).value
522
+ ? 'true'
523
+ : 'false';
524
+ }
525
+ /**
526
+ * @param {?} options
527
+ * @param {?} option
528
+ * @return {?}
529
+ */
530
+ static removeSelection(options, option) {
531
+ for (let i = 0; i < ((/** @type {?} */ (options))).length; i++) {
532
+ if (((/** @type {?} */ (options)))[i].value === option.value) {
533
+ ((/** @type {?} */ (options))).splice(i, 1);
534
+ return;
535
+ }
536
+ }
537
+ }
538
+ /**
539
+ * @private
540
+ * @param {?} data
541
+ * @return {?}
542
+ */
543
+ static getOptionsCount(data) {
544
+ /** @type {?} */
545
+ let count = 0;
546
+ if (Array.isArray(data)) {
547
+ for (const groupOrOption of data) {
548
+ /** @type {?} */
549
+ const options = ((/** @type {?} */ (groupOrOption))).options;
550
+ if (options) {
551
+ count += options.length;
552
+ }
553
+ else {
554
+ count++;
555
+ }
556
+ }
557
+ }
558
+ return count;
559
+ }
560
+ /**
561
+ * @private
562
+ * @param {?} value
563
+ * @return {?}
564
+ */
565
+ static isNullOrUndefined(value) {
566
+ return value === null || value === undefined;
567
+ }
568
+ /**
569
+ * @private
570
+ * @param {?} label
571
+ * @param {?} searchText
572
+ * @param {?} editPattern
573
+ * @return {?}
574
+ */
575
+ static containSearchText(label, searchText, editPattern) {
576
+ return searchText
577
+ ? Select2Utils.formatSansUnicode(label).match(new RegExp(Select2Utils.formatPattern(searchText, editPattern), 'i')) !== null
578
+ : true;
579
+ }
580
+ /**
581
+ * @private
582
+ * @param {?} str
583
+ * @return {?}
584
+ */
585
+ static protectPattern(str) {
586
+ return str.replace(protectRegexp, '\\$&');
587
+ }
588
+ /**
589
+ * @private
590
+ * @param {?} str
591
+ * @return {?}
592
+ */
593
+ static formatSansUnicode(str) {
594
+ for (const unicodePattern of unicodePatterns) {
595
+ str = str.replace(unicodePattern.s, unicodePattern.l);
596
+ }
597
+ return str;
598
+ }
599
+ /**
600
+ * @private
601
+ * @param {?} str
602
+ * @param {?} editPattern
603
+ * @return {?}
604
+ */
605
+ static formatPattern(str, editPattern) {
606
+ str = Select2Utils.formatSansUnicode(Select2Utils.protectPattern(str));
607
+ if (editPattern && typeof editPattern === 'function') {
608
+ str = editPattern(str);
609
+ }
610
+ return str;
611
+ }
581
612
  }
582
613
 
583
- /**
584
- * @fileoverview added by tsickle
585
- * Generated from: lib/select2.component.ts
586
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
587
- */
588
- /** @type {?} */
589
- let nextUniqueId = 0;
590
- /** @type {?} */
591
- const displaySearchStatusList = ['default', 'hidden', 'always'];
592
- class Select2 {
593
- /**
594
- * @param {?} _viewportRuler
595
- * @param {?} _changeDetectorRef
596
- * @param {?} _parentForm
597
- * @param {?} _parentFormGroup
598
- * @param {?} _control
599
- * @param {?} tabIndex
600
- */
601
- constructor(_viewportRuler, _changeDetectorRef, _parentForm, _parentFormGroup, _control, tabIndex) {
602
- this._viewportRuler = _viewportRuler;
603
- this._changeDetectorRef = _changeDetectorRef;
604
- this._parentForm = _parentForm;
605
- this._parentFormGroup = _parentFormGroup;
606
- this._control = _control;
607
- this.minCharForSearch = 0;
608
- this.limitSelection = 0;
609
- /**
610
- * use the material style
611
- */
612
- this.styleMode = 'default';
613
- /**
614
- * infinite scroll distance
615
- */
616
- this.infiniteScrollDistance = 1.5;
617
- /**
618
- * infinite scroll distance
619
- */
620
- this.infiniteScrollThrottle = 150;
621
- /**
622
- * the max height of the results container when opening the select
623
- */
624
- this.resultMaxHeight = '200px';
625
- this.update = new EventEmitter();
626
- this.open = new EventEmitter();
627
- this.close = new EventEmitter();
628
- this.focus = new EventEmitter();
629
- this.blur = new EventEmitter();
630
- this.search = new EventEmitter();
631
- this.scroll = new EventEmitter();
632
- this.removeOption = new EventEmitter();
633
- this.option = null;
634
- this.isOpen = false;
635
- /**
636
- * Whether the element is focused or not.
637
- */
638
- this.focused = false;
639
- this.hoveringValue = null;
640
- this.innerSearchText = '';
641
- this._stateChanges = new Subject();
642
- this._disabled = false;
643
- this._required = false;
644
- this._readonly = false;
645
- this._multiple = false;
646
- this._overlay = false;
647
- this._resettable = false;
648
- this._hideSelectedItems = false;
649
- this._clickDetection = false;
650
- this._uid = `select2-${nextUniqueId++}`;
651
- this._infiniteScroll = true;
652
- /**
653
- * View -> model callback called when select has been touched
654
- */
655
- this._onTouched = (/**
656
- * @return {?}
657
- */
658
- () => {
659
- // do nothing
660
- });
661
- /**
662
- * View -> model callback called when value changes
663
- */
664
- this._onChange = (/**
665
- * @return {?}
666
- */
667
- () => {
668
- // do nothing
669
- });
670
- this.id = this.id;
671
- this._tabIndex = parseInt(tabIndex, 10) || 0;
672
- if (this._control) {
673
- this._control.valueAccessor = this;
674
- }
675
- this._clickDetectionFc = this.clickDetection.bind(this);
676
- }
677
- /**
678
- * @return {?}
679
- */
680
- get multiple() { return this._multiple; }
681
- /**
682
- * @param {?} value
683
- * @return {?}
684
- */
685
- set multiple(value) { this._multiple = this._coerceBooleanProperty(value); this.ngOnInit(); }
686
- /**
687
- * use the material style
688
- * @return {?}
689
- */
690
- get overlay() { return this._overlay; }
691
- /**
692
- * @param {?} value
693
- * @return {?}
694
- */
695
- set overlay(value) { this._overlay = this._coerceBooleanProperty(value); }
696
- /**
697
- * infinite scroll activated
698
- * @return {?}
699
- */
700
- get infiniteScroll() { return this._infiniteScroll; }
701
- /**
702
- * @param {?} value
703
- * @return {?}
704
- */
705
- set infiniteScroll(value) { this._infiniteScroll = this._coerceBooleanProperty(value); }
706
- /**
707
- * @return {?}
708
- */
709
- get select2Options() {
710
- return this.multiple ? (/** @type {?} */ (this.option)) : null;
711
- }
712
- /**
713
- * @return {?}
714
- */
715
- get select2Option() {
716
- return this.multiple ? null : (/** @type {?} */ (this.option));
717
- }
718
- /**
719
- * @return {?}
720
- */
721
- get searchText() {
722
- return this.innerSearchText;
723
- }
724
- /**
725
- * @param {?} text
726
- * @return {?}
727
- */
728
- set searchText(text) {
729
- if (this.customSearchEnabled) {
730
- this.search.emit({
731
- component: this,
732
- value: this._value,
733
- search: text
734
- });
735
- }
736
- this.innerSearchText = text;
737
- }
738
- /**
739
- * minimal data of show the search field
740
- * @return {?}
741
- */
742
- get minCountForSearch() {
743
- return this._minCountForSearch;
744
- }
745
- /**
746
- * @param {?} value
747
- * @return {?}
748
- */
749
- set minCountForSearch(value) {
750
- this._minCountForSearch = value;
751
- this.updateSearchBox();
752
- }
753
- /**
754
- * Unique id of the element.
755
- * @return {?}
756
- */
757
- get id() { return this._id; }
758
- /**
759
- * @param {?} value
760
- * @return {?}
761
- */
762
- set id(value) { this._id = value || this._uid; }
763
- /**
764
- * Whether the element is required.
765
- * @return {?}
766
- */
767
- get required() { return this._required; }
768
- /**
769
- * @param {?} value
770
- * @return {?}
771
- */
772
- set required(value) { this._required = this._coerceBooleanProperty(value); }
773
- /**
774
- * Whether selected items should be hidden.
775
- * @return {?}
776
- */
777
- get disabled() { return this._control ? this._control.disabled : this._disabled; }
778
- /**
779
- * @param {?} value
780
- * @return {?}
781
- */
782
- set disabled(value) { this._disabled = this._coerceBooleanProperty(value); }
783
- /**
784
- * Whether items are hidden when has.
785
- * @return {?}
786
- */
787
- get hideSelectedItems() { return this._hideSelectedItems; }
788
- /**
789
- * @param {?} value
790
- * @return {?}
791
- */
792
- set hideSelectedItems(value) { this._hideSelectedItems = this._coerceBooleanProperty(value); }
793
- /**
794
- * Whether the element is readonly.
795
- * @return {?}
796
- */
797
- get readonly() { return this._readonly; }
798
- /**
799
- * @param {?} value
800
- * @return {?}
801
- */
802
- set readonly(value) { this._readonly = this._coerceBooleanProperty(value); }
803
- /**
804
- * The input element's value.
805
- * @return {?}
806
- */
807
- get value() {
808
- return this._value;
809
- }
810
- /**
811
- * @param {?} value
812
- * @return {?}
813
- */
814
- set value(value) {
815
- if (this.testValueChange(this._value, value)) {
816
- setTimeout((/**
817
- * @return {?}
818
- */
819
- () => {
820
- this._value = value;
821
- this.writeValue(value);
822
- }), 10);
823
- }
824
- }
825
- /**
826
- * Tab index for the select2 element.
827
- * @return {?}
828
- */
829
- get tabIndex() {
830
- return this.disabled ? -1 : this._tabIndex;
831
- }
832
- /**
833
- * @param {?} value
834
- * @return {?}
835
- */
836
- set tabIndex(value) {
837
- if (typeof value !== 'undefined') {
838
- this._tabIndex = value;
839
- }
840
- }
841
- /**
842
- * reset with no selected value
843
- * @return {?}
844
- */
845
- get resettable() { return this._resettable; }
846
- /**
847
- * @param {?} value
848
- * @return {?}
849
- */
850
- set resettable(value) { this._resettable = this._coerceBooleanProperty(value); }
851
- /**
852
- * @return {?}
853
- */
854
- get ariaInvalid() {
855
- return this._isErrorState();
856
- }
857
- /**
858
- * @return {?}
859
- */
860
- get classMaterial() {
861
- return this.styleMode === 'material';
862
- }
863
- /**
864
- * @return {?}
865
- */
866
- get classNostyle() {
867
- return this.styleMode === 'noStyle';
868
- }
869
- /**
870
- * @return {?}
871
- */
872
- get select2above() {
873
- return this.listPosition === 'above';
874
- }
875
- /**
876
- * @private
877
- * @return {?}
878
- */
879
- get resultsElement() {
880
- var _a;
881
- return (_a = this.resultContainer) === null || _a === void 0 ? void 0 : _a.nativeElement;
882
- }
883
- /**
884
- * @return {?}
885
- */
886
- ngOnInit() {
887
- this._viewportRuler.change(100).subscribe((/**
888
- * @return {?}
889
- */
890
- () => {
891
- if (this.isOpen) {
892
- this.triggerRect();
893
- }
894
- }));
895
- /** @type {?} */
896
- const option = Select2Utils.getOptionsByValue(this.data, this._control ? this._control.value : this.value, this.multiple);
897
- if (option !== null) {
898
- this.option = option;
899
- }
900
- if (!Array.isArray(option)) {
901
- this.hoveringValue = (/** @type {?} */ (this.value));
902
- }
903
- this.updateSearchBox();
904
- }
905
- /**
906
- * @return {?}
907
- */
908
- ngAfterViewInit() {
909
- this.selectionElement = this.selection.nativeElement;
910
- this.triggerRect();
911
- }
912
- /**
913
- * @return {?}
914
- */
915
- ngDoCheck() {
916
- this.updateSearchBox();
917
- this._dirtyCheckNativeValue();
918
- if (this._triggerRect && this.overlayWidth !== this._triggerRect.width) {
919
- this.overlayWidth = this._triggerRect.width;
920
- }
921
- }
922
- /**
923
- * @return {?}
924
- */
925
- ngOnDestroy() {
926
- window.document.body.removeEventListener('click', this._clickDetectionFc);
927
- }
928
- /**
929
- * @return {?}
930
- */
931
- updateSearchBox() {
932
- /** @type {?} */
933
- const hidden = this.customSearchEnabled
934
- ? false
935
- : Select2Utils.isSearchboxHiddex(this.data, this._minCountForSearch);
936
- if (this.isSearchboxHidden !== hidden) {
937
- this.isSearchboxHidden = hidden;
938
- }
939
- }
940
- /**
941
- * @return {?}
942
- */
943
- hideSearch() {
944
- /** @type {?} */
945
- const displaySearchStatus = displaySearchStatusList.indexOf(this.displaySearchStatus) > -1
946
- ? this.displaySearchStatus
947
- : 'default';
948
- return (displaySearchStatus === 'default' && this.isSearchboxHidden) || displaySearchStatus === 'hidden';
949
- }
950
- /**
951
- * @param {?} option
952
- * @return {?}
953
- */
954
- getOptionStyle(option) {
955
- return 'select2-results__option ' +
956
- (option.hide ? 'select2-results__option--hide ' : '') +
957
- (option.value === this.hoveringValue ? 'select2-results__option--highlighted ' : '') +
958
- (option.classes || '');
959
- }
960
- /**
961
- * @param {?} option
962
- * @return {?}
963
- */
964
- mouseenter(option) {
965
- if (!option.disabled) {
966
- this.hoveringValue = option.value;
967
- }
968
- }
969
- /**
970
- * @param {?} option
971
- * @return {?}
972
- */
973
- click(option) {
974
- if (this.testSelection(option)) {
975
- this.select(option);
976
- }
977
- }
978
- /**
979
- * @param {?} e
980
- * @return {?}
981
- */
982
- reset(e) {
983
- this.select(null);
984
- e.preventDefault();
985
- e.stopPropagation();
986
- }
987
- /**
988
- * @param {?} event
989
- * @return {?}
990
- */
991
- prevChange(event) {
992
- event.stopPropagation();
993
- }
994
- /**
995
- * @return {?}
996
- */
997
- toggleOpenAndClose() {
998
- if (this.disabled) {
999
- return;
1000
- }
1001
- this._focus(true);
1002
- this.isOpen = !this.isOpen;
1003
- if (this.isOpen) {
1004
- this.triggerRect();
1005
- this.innerSearchText = '';
1006
- this.updateFilteredData();
1007
- this._focusSearchboxOrResultsElement();
1008
- setTimeout((/**
1009
- * @return {?}
1010
- */
1011
- () => {
1012
- if (this.option) {
1013
- /** @type {?} */
1014
- const option = this.option instanceof Array ? this.option[0] : this.option;
1015
- this.updateScrollFromOption(option);
1016
- }
1017
- else if (this.resultsElement) {
1018
- this.resultsElement.scrollTop = 0;
1019
- }
1020
- }));
1021
- this.open.emit(this);
1022
- }
1023
- else {
1024
- this.close.emit(this);
1025
- }
1026
- if (this.isOpen && !this._clickDetection) {
1027
- setTimeout((/**
1028
- * @return {?}
1029
- */
1030
- () => {
1031
- window.document.body.addEventListener('click', this._clickDetectionFc, false);
1032
- this._clickDetection = true;
1033
- }), timeout);
1034
- }
1035
- this._changeDetectorRef.markForCheck();
1036
- }
1037
- /**
1038
- * @param {?} option
1039
- * @param {?} defaut
1040
- * @return {?}
1041
- */
1042
- hasTemplate(option, defaut) {
1043
- return this.templates instanceof TemplateRef
1044
- || this.templates && this.templates[option.templateId] instanceof TemplateRef
1045
- || this.templates && this.templates[defaut] instanceof TemplateRef;
1046
- }
1047
- /**
1048
- * @param {?} option
1049
- * @param {?} defaut
1050
- * @return {?}
1051
- */
1052
- getTemplate(option, defaut) {
1053
- if (this.hasTemplate(option, defaut)) {
1054
- return this.templates[option.templateId]
1055
- || this.templates[defaut]
1056
- || this.templates;
1057
- }
1058
- return undefined;
1059
- }
1060
- /**
1061
- * @return {?}
1062
- */
1063
- triggerRect() {
1064
- this._triggerRect = this.selectionElement.getBoundingClientRect();
1065
- }
1066
- /**
1067
- * @private
1068
- * @param {?} option
1069
- * @return {?}
1070
- */
1071
- testSelection(option) {
1072
- if (option.disabled) {
1073
- return false;
1074
- }
1075
- if (!this.multiple ||
1076
- !this.limitSelection ||
1077
- Array.isArray(this._value) && this._value.length < this.limitSelection) {
1078
- return true;
1079
- }
1080
- return false;
1081
- }
1082
- /**
1083
- * @private
1084
- * @param {?} value1
1085
- * @param {?} value2
1086
- * @return {?}
1087
- */
1088
- testValueChange(value1, value2) {
1089
- if ((value1 === null || value1 === undefined) && (value2 === null || value2 === undefined) ||
1090
- value1 === value2) {
1091
- return false;
1092
- }
1093
- if (this.multiple
1094
- && value1 && ((/** @type {?} */ (value1))).length
1095
- && value2 && ((/** @type {?} */ (value2))).length
1096
- && ((/** @type {?} */ (value1))).length === ((/** @type {?} */ (value2))).length) {
1097
- for (const e1 of ((/** @type {?} */ (value1)))) {
1098
- /** @type {?} */
1099
- const test = ((/** @type {?} */ (value2))).indexOf(e1) > -1;
1100
- if (!test) {
1101
- return true;
1102
- }
1103
- }
1104
- return false;
1105
- }
1106
- return true;
1107
- }
1108
- /**
1109
- * @private
1110
- * @return {?}
1111
- */
1112
- updateFilteredData() {
1113
- setTimeout((/**
1114
- * @return {?}
1115
- */
1116
- () => {
1117
- /** @type {?} */
1118
- let result = this.data;
1119
- if (this.multiple && this.hideSelectedItems) {
1120
- result = Select2Utils.getFilteredSelectedData(result, this.option);
1121
- }
1122
- if (!this.customSearchEnabled && this.searchText && this.searchText.length >= +this.minCharForSearch) {
1123
- result = Select2Utils.getFilteredData(result, this.searchText, this.editPattern);
1124
- }
1125
- if (Select2Utils.valueIsNotInFilteredData(result, this.hoveringValue)) {
1126
- this.hoveringValue = Select2Utils.getFirstAvailableOption(result);
1127
- }
1128
- this.filteredData = result;
1129
- this._changeDetectorRef.markForCheck();
1130
- }));
1131
- }
1132
- /**
1133
- * @private
1134
- * @param {?} e
1135
- * @return {?}
1136
- */
1137
- clickDetection(e) {
1138
- if (!this.ifParentContainsClass((/** @type {?} */ (e.target)), 'selection')) {
1139
- if (this.isOpen && !this.ifParentContainsClass((/** @type {?} */ (e.target)), 'select2-dropdown')) {
1140
- this.toggleOpenAndClose();
1141
- }
1142
- if (!this.ifParentContainsId((/** @type {?} */ (e.target)), this._id)) {
1143
- this.clickExit();
1144
- }
1145
- }
1146
- else if (this.isOpen && !this.ifParentContainsId((/** @type {?} */ (e.target)), this._id)) {
1147
- this.toggleOpenAndClose();
1148
- this.clickExit();
1149
- }
1150
- }
1151
- /**
1152
- * @private
1153
- * @return {?}
1154
- */
1155
- clickExit() {
1156
- this._focus(false);
1157
- window.document.body.removeEventListener('click', this._clickDetectionFc);
1158
- this._clickDetection = false;
1159
- }
1160
- /**
1161
- * @private
1162
- * @param {?} element
1163
- * @param {?} cssClass
1164
- * @return {?}
1165
- */
1166
- ifParentContainsClass(element, cssClass) {
1167
- return this.getParentElementByClass(element, cssClass) !== null;
1168
- }
1169
- /**
1170
- * @private
1171
- * @param {?} element
1172
- * @param {?} id
1173
- * @return {?}
1174
- */
1175
- ifParentContainsId(element, id) {
1176
- return this.getParentElementById(element, id) !== null;
1177
- }
1178
- /**
1179
- * @private
1180
- * @param {?} element
1181
- * @param {?} cssClass
1182
- * @return {?}
1183
- */
1184
- getParentElementByClass(element, cssClass) {
1185
- if (this.containClasses(element, cssClass.trim().split(/\s+/))) {
1186
- return element;
1187
- }
1188
- return element.parentElement
1189
- ? this.getParentElementByClass(element.parentElement, cssClass)
1190
- : null;
1191
- }
1192
- /**
1193
- * @private
1194
- * @param {?} element
1195
- * @param {?} id
1196
- * @return {?}
1197
- */
1198
- getParentElementById(element, id) {
1199
- if (element.id === id) {
1200
- return element;
1201
- }
1202
- return element.parentElement
1203
- ? this.getParentElementById(element.parentElement, id)
1204
- : null;
1205
- }
1206
- /**
1207
- * @private
1208
- * @param {?} element
1209
- * @param {?} cssClasses
1210
- * @return {?}
1211
- */
1212
- containClasses(element, cssClasses) {
1213
- if (!element.classList) {
1214
- return false;
1215
- }
1216
- for (const cssClass of cssClasses) {
1217
- if (!element.classList.contains(cssClass)) {
1218
- return false;
1219
- }
1220
- }
1221
- return true;
1222
- }
1223
- /**
1224
- * @return {?}
1225
- */
1226
- focusin() {
1227
- if (this.disabled) {
1228
- return;
1229
- }
1230
- this._focus(true);
1231
- }
1232
- /**
1233
- * @return {?}
1234
- */
1235
- focusout() {
1236
- if (this.selectionElement && !this.selectionElement.classList.contains('select2-focused')) {
1237
- this._focus(false);
1238
- this._onTouched();
1239
- }
1240
- }
1241
- /**
1242
- * @private
1243
- * @return {?}
1244
- */
1245
- moveUp() {
1246
- this.updateScrollFromOption(Select2Utils.getPreviousOption(this.filteredData, this.hoveringValue));
1247
- }
1248
- /**
1249
- * @private
1250
- * @return {?}
1251
- */
1252
- moveDown() {
1253
- this.updateScrollFromOption(Select2Utils.getNextOption(this.filteredData, this.hoveringValue));
1254
- }
1255
- /**
1256
- * @private
1257
- * @param {?} option
1258
- * @return {?}
1259
- */
1260
- updateScrollFromOption(option) {
1261
- if (option) {
1262
- this.hoveringValue = option.value;
1263
- /** @type {?} */
1264
- const domElement = this.results.find((/**
1265
- * @param {?} r
1266
- * @return {?}
1267
- */
1268
- r => r.nativeElement.innerText.trim() === option.label));
1269
- if (domElement && this.resultsElement) {
1270
- this.resultsElement.scrollTop = 0;
1271
- /** @type {?} */
1272
- const listClientRect = this.resultsElement.getBoundingClientRect();
1273
- /** @type {?} */
1274
- const optionClientRect = domElement.nativeElement.getBoundingClientRect();
1275
- this.resultsElement.scrollTop = optionClientRect.top - listClientRect.top;
1276
- }
1277
- }
1278
- }
1279
- /**
1280
- * @private
1281
- * @return {?}
1282
- */
1283
- selectByEnter() {
1284
- if (this.hoveringValue) {
1285
- /** @type {?} */
1286
- const option = Select2Utils.getOptionByValue(this.data, this.hoveringValue);
1287
- this.select(option);
1288
- }
1289
- }
1290
- /**
1291
- * @param {?} option
1292
- * @return {?}
1293
- */
1294
- select(option) {
1295
- /** @type {?} */
1296
- let value;
1297
- if (option !== null) {
1298
- if (this.multiple) {
1299
- /** @type {?} */
1300
- const options = (/** @type {?} */ (this.option));
1301
- /** @type {?} */
1302
- const index = options.findIndex((/**
1303
- * @param {?} op
1304
- * @return {?}
1305
- */
1306
- op => op.value === option.value));
1307
- if (index === -1) {
1308
- options.push(option);
1309
- }
1310
- else {
1311
- options.splice(index, 1);
1312
- }
1313
- value = ((/** @type {?} */ (this.option))).map((/**
1314
- * @param {?} op
1315
- * @return {?}
1316
- */
1317
- op => op.value));
1318
- }
1319
- else {
1320
- this.option = option;
1321
- if (this.isOpen) {
1322
- this.isOpen = false;
1323
- this.close.emit(this);
1324
- if (this.selectionElement) {
1325
- this.selectionElement.focus();
1326
- }
1327
- }
1328
- value = this.option.value;
1329
- }
1330
- }
1331
- else {
1332
- this.option = null;
1333
- }
1334
- if (this.multiple && this.hideSelectedItems) {
1335
- this.updateFilteredData();
1336
- }
1337
- if (this._control) {
1338
- this._onChange(value);
1339
- }
1340
- else {
1341
- this._value = value;
1342
- }
1343
- this.update.emit({
1344
- component: this,
1345
- value: value,
1346
- options: Array.isArray(this.option) ? this.option : (this.option ? [this.option] : null)
1347
- });
1348
- }
1349
- /**
1350
- * @param {?} e
1351
- * @return {?}
1352
- */
1353
- keyDown(e) {
1354
- if (this._testKey(e, ['ArrowDown', 40])) {
1355
- this.moveDown();
1356
- e.preventDefault();
1357
- }
1358
- else if (this._testKey(e, ['ArrowUp', 38])) {
1359
- this.moveUp();
1360
- e.preventDefault();
1361
- }
1362
- else if (this._testKey(e, ['Enter', 13])) {
1363
- this.selectByEnter();
1364
- e.preventDefault();
1365
- }
1366
- else if (this._testKey(e, ['Escape', 'Tab', 9, 27]) && this.isOpen) {
1367
- this.toggleOpenAndClose();
1368
- this._focus(false);
1369
- }
1370
- }
1371
- /**
1372
- * @param {?} e
1373
- * @return {?}
1374
- */
1375
- openKey(e) {
1376
- if (this._testKey(e, ['ArrowDown', 'ArrowUp', 'Enter', 40, 38, 13])) {
1377
- this.toggleOpenAndClose();
1378
- e.preventDefault();
1379
- }
1380
- else if (this._testKey(e, ['Escape', 'Tab', 9, 27])) {
1381
- this._focus(false);
1382
- this._onTouched();
1383
- }
1384
- }
1385
- /**
1386
- * @param {?} _index
1387
- * @param {?} item
1388
- * @return {?}
1389
- */
1390
- trackBy(_index, item) {
1391
- return item.value;
1392
- }
1393
- /**
1394
- * @param {?} e
1395
- * @return {?}
1396
- */
1397
- searchUpdate(e) {
1398
- this.searchText = ((/** @type {?} */ (e.target))).value;
1399
- this.updateFilteredData();
1400
- }
1401
- /**
1402
- * @param {?} option
1403
- * @return {?}
1404
- */
1405
- isSelected(option) {
1406
- return Select2Utils.isSelected(this.option, option, this.multiple);
1407
- }
1408
- /**
1409
- * @param {?} option
1410
- * @return {?}
1411
- */
1412
- isDisabled(option) {
1413
- return option.disabled ? 'true' : 'false';
1414
- }
1415
- /**
1416
- * @param {?} e
1417
- * @param {?} option
1418
- * @return {?}
1419
- */
1420
- removeSelection(e, option) {
1421
- Select2Utils.removeSelection(this.option, option);
1422
- if (this.multiple && this.hideSelectedItems) {
1423
- this.updateFilteredData();
1424
- }
1425
- /** @type {?} */
1426
- const value = ((/** @type {?} */ (this.option))).map((/**
1427
- * @param {?} op
1428
- * @return {?}
1429
- */
1430
- op => op.value));
1431
- if (this._control) {
1432
- this._onChange(value);
1433
- }
1434
- else {
1435
- this._value = value;
1436
- }
1437
- this.update.emit({
1438
- component: this,
1439
- value: value,
1440
- options: Array.isArray(this.option) ? this.option : (this.option ? [this.option] : null)
1441
- });
1442
- this.removeOption.emit({
1443
- component: this,
1444
- value: value,
1445
- removedOption: option
1446
- });
1447
- e.preventDefault();
1448
- e.stopPropagation();
1449
- if (this.isOpen) {
1450
- this._focusSearchboxOrResultsElement();
1451
- }
1452
- }
1453
- /**
1454
- * Sets the model value. Implemented as part of ControlValueAccessor.
1455
- * @param {?} value
1456
- * @return {?}
1457
- */
1458
- writeValue(value) {
1459
- this._setSelectionByValue(value);
1460
- }
1461
- /**
1462
- * Saves a callback function to be invoked when the select's value
1463
- * changes from user input. Part of the ControlValueAccessor interface
1464
- * required to integrate with Angular's core forms API.
1465
- *
1466
- * @param {?} fn Callback to be triggered when the value changes.
1467
- * @return {?}
1468
- */
1469
- registerOnChange(fn) {
1470
- this._onChange = fn;
1471
- }
1472
- /**
1473
- * Saves a callback function to be invoked when the select is blurred
1474
- * by the user. Part of the ControlValueAccessor interface required
1475
- * to integrate with Angular's core forms API.
1476
- *
1477
- * @param {?} fn Callback to be triggered when the component has been touched.
1478
- * @return {?}
1479
- */
1480
- registerOnTouched(fn) {
1481
- this._onTouched = fn;
1482
- }
1483
- /**
1484
- * Sets whether the component should be disabled.
1485
- * Implemented as part of ControlValueAccessor.
1486
- * @param {?} isDisabled
1487
- * @return {?}
1488
- */
1489
- setDisabledState(isDisabled) {
1490
- this.disabled = isDisabled;
1491
- }
1492
- /**
1493
- * @return {?}
1494
- */
1495
- _isErrorState() {
1496
- /** @type {?} */
1497
- const isInvalid = this._control && this._control.invalid;
1498
- /** @type {?} */
1499
- const isTouched = this._control && this._control.touched;
1500
- /** @type {?} */
1501
- const isSubmitted = (this._parentFormGroup && this._parentFormGroup.submitted) ||
1502
- (this._parentForm && this._parentForm.submitted);
1503
- return !!(isInvalid && (isTouched || isSubmitted));
1504
- }
1505
- /**
1506
- * @private
1507
- * @param {?} event
1508
- * @param {?=} refs
1509
- * @return {?}
1510
- */
1511
- _testKey(event, refs = []) {
1512
- return this._isKey(this._getKey(event), refs);
1513
- }
1514
- /**
1515
- * @private
1516
- * @param {?} event
1517
- * @return {?}
1518
- */
1519
- _getKey(event) {
1520
- /** @type {?} */
1521
- let code;
1522
- if (event.key !== undefined) {
1523
- code = event.key;
1524
- }
1525
- else if (event['keyIdentifier'] !== undefined) {
1526
- code = event['keyIdentifier'];
1527
- }
1528
- else if (event['keyCode'] !== undefined) {
1529
- code = event['keyCode'];
1530
- }
1531
- else {
1532
- event.preventDefault();
1533
- }
1534
- return code;
1535
- }
1536
- /**
1537
- * @private
1538
- * @param {?} code
1539
- * @param {?=} refs
1540
- * @return {?}
1541
- */
1542
- _isKey(code, refs = []) {
1543
- return refs && refs.length > 0
1544
- ? refs.indexOf(code) !== -1
1545
- : false;
1546
- }
1547
- /**
1548
- * Sets the selected option based on a value. If no option can be
1549
- * found with the designated value, the select trigger is cleared.
1550
- * @private
1551
- * @param {?} value
1552
- * @return {?}
1553
- */
1554
- _setSelectionByValue(value) {
1555
- if (this.option || (value !== undefined && value !== null)) {
1556
- /** @type {?} */
1557
- const isArray = Array.isArray(value);
1558
- if (this.multiple && value && !isArray) {
1559
- throw new Error('Non array value.');
1560
- }
1561
- else if (this.data) {
1562
- if (this.multiple) {
1563
- this.option = []; // if value is null, then empty option and return
1564
- if (isArray) {
1565
- // value is not null. Preselect value
1566
- /** @type {?} */
1567
- const selectedValues = Select2Utils.getOptionsByValue(this.data, value, this.multiple);
1568
- selectedValues.map((/**
1569
- * @param {?} item
1570
- * @return {?}
1571
- */
1572
- item => this.select(item)));
1573
- }
1574
- }
1575
- else {
1576
- this.select(Select2Utils.getOptionByValue(this.data, value));
1577
- }
1578
- }
1579
- else if (this._control) {
1580
- this._control.viewToModelUpdate(value);
1581
- }
1582
- this._changeDetectorRef.markForCheck();
1583
- }
1584
- }
1585
- /**
1586
- * Does some manual dirty checking on the native input `value` property.
1587
- * @private
1588
- * @return {?}
1589
- */
1590
- _dirtyCheckNativeValue() {
1591
- /** @type {?} */
1592
- const newValue = this.value;
1593
- if (this._previousNativeValue !== newValue) {
1594
- this._previousNativeValue = newValue;
1595
- this._stateChanges.next();
1596
- }
1597
- }
1598
- /**
1599
- * @private
1600
- * @param {?} value
1601
- * @return {?}
1602
- */
1603
- _coerceBooleanProperty(value) {
1604
- return value != null && `${value}` !== 'false';
1605
- }
1606
- /**
1607
- * @private
1608
- * @return {?}
1609
- */
1610
- _focusSearchboxOrResultsElement() {
1611
- if (!this.isSearchboxHidden) {
1612
- setTimeout((/**
1613
- * @return {?}
1614
- */
1615
- () => {
1616
- if (this.searchInput && this.searchInput.nativeElement) {
1617
- console.log(this.searchInput.nativeElement);
1618
- this.searchInput.nativeElement.focus();
1619
- }
1620
- }));
1621
- }
1622
- else if (this.resultsElement) {
1623
- this.resultsElement.focus();
1624
- }
1625
- }
1626
- /**
1627
- * @private
1628
- * @param {?} state
1629
- * @return {?}
1630
- */
1631
- _focus(state) {
1632
- if (!state && this.focused) {
1633
- this.focused = state;
1634
- this.blur.emit(this);
1635
- }
1636
- else if (state && !this.focused) {
1637
- this.focused = state;
1638
- this.focus.emit(this);
1639
- }
1640
- }
1641
- /**
1642
- * @param {?} way
1643
- * @return {?}
1644
- */
1645
- onScroll(way) {
1646
- this.scroll.emit({
1647
- component: this,
1648
- way,
1649
- search: this.innerSearchText
1650
- });
1651
- }
1652
- }
1653
- Select2.decorators = [
1654
- { type: Component, args: [{
1655
- selector: 'select2',
1656
- template: "<div class=\"select2-label\"\n (click)=\"toggleOpenAndClose()\">\n <ng-content select=\"select2-label\"></ng-content>\n <span *ngIf=\"required\"\n class=\"select2-required\"></span>\n</div>\n<div class=\"select2 select2-container select2-container--default select2-container--focus\"\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 <div class=\"selection\"\n #selection\n #trigger=\"cdkOverlayOrigin\"\n [attr.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 <div class=\"select2-selection\"\n [class.select2-selection--multiple]=\"multiple\"\n [class.select2-selection--single]=\"!multiple\"\n role=\"combobox\">\n <span *ngIf=\"!multiple\"\n class=\"select2-selection__rendered\"\n [title]=\"select2Option?.label || ''\">\n <span *ngIf=\"!select2Option\">&nbsp;</span>\n <span *ngIf=\"select2Option\"\n [innerHTML]=\"select2Option.label\"></span>\n <span [class.select2-selection__placeholder__option]=\"option\"\n class=\"select2-selection__placeholder\">{{placeholder}}</span>\n </span>\n <span (click)=\"reset($event)\"\n *ngIf=\"!multiple && resettable && select2Option\"\n class=\"select2-selection__reset\"\n role=\"presentation\">\u00D7</span>\n <span *ngIf=\"!multiple\"\n class=\"select2-selection__arrow\"\n role=\"presentation\">\n </span>\n <ul *ngIf=\"multiple\"\n class=\"select2-selection__rendered\">\n <span [class.select2-selection__placeholder__option]=\"select2Options?.length > 0\"\n class=\"select2-selection__placeholder\">{{placeholder}}</span>\n <li *ngFor=\"let op of option; trackBy: trackBy\"\n class=\"select2-selection__choice\"\n [title]=\"op.label\">\n <span (click)=\"removeSelection($event, op)\"\n class=\"select2-selection__choice__remove\"\n role=\"presentation\">\u00D7</span>\n <span [innerHTML]=\"op.label\"></span>\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 cdkConnectedOverlay\n cdkConnectedOverlayHasBackdrop\n cdkConnectedOverlayBackdropClass=\"select2-overlay-backdrop\"\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"this.isOpen && overlay\"\n [cdkConnectedOverlayMinWidth]=\"overlayWidth\"\n (backdropClick)=\"toggleOpenAndClose()\">\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #containerTemplate>\n <div class=\"select2-container select2-container--default select2-container-dropdown\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-overlay]=\"overlay\">\n <div class=\"select2-dropdown\"\n [class.select2-dropdown--below]=\"!select2above\"\n [class.select2-dropdown--above]=\"select2above\">\n <div class=\"select2-search select2-search--dropdown\"\n [class.select2-search--hide]=\"hideSearch()\">\n <input #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 </div>\n <div class=\"select2-results\">\n <ul #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 <ng-container *ngFor=\"let groupOrOption of filteredData; index as i; trackBy:trackBy\">\n <li *ngIf=\"groupOrOption.options\"\n class=\"select2-results__option\"\n role=\"group\">\n <strong *ngIf=\"!hasTemplate(groupOrOption, 'group'); else optGroup\"\n [attr.class]=\"'select2-results__group' + (groupOrOption.classes ? ' ' + groupOrOption.classes : '')\"\n [innerHTML]=\"groupOrOption.label\"></strong>\n <ng-template #optGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'group'); context: groupOrOption\">\n </ng-container>\n </ng-template>\n\n <ul class=\"select2-results__options select2-results__options--nested\">\n <li *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 <div *ngIf=\"!hasTemplate(option, 'option'); else liGroup\"\n class=\"select2-label-content\"\n [innerHTML]=\"option.label\"></div>\n <ng-template #liGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(option, 'option'); context: option\">\n </ng-container>\n </ng-template>\n </li>\n </ul>\n </li>\n <li *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 <div *ngIf=\"!hasTemplate(groupOrOption, 'option'); else li\"\n [innerHTML]=\"groupOrOption.label\"\n class=\"select2-label-content\"></div>\n <ng-template #li>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'option'); context: groupOrOption\">\n </ng-container>\n </ng-template>\n </li>\n </ng-container>\n <li class=\"select2-no-result select2-results__option\"\n *ngIf=\"!filteredData?.length && noResultMessage\"\n [innerHTML]=\"noResultMessage\"></li>\n </ul>\n </div>\n </div>\n </div>\n</ng-template>\n",
1657
- styles: [".select2-label{color:#000;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{opacity:0;position:absolute;width:0}.select2-container .select2-selection--single{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;flex:1 1 auto;overflow:hidden;padding:0 0 0 8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container .select2-selection--multiple{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{border:none;box-sizing:border-box;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:#fff;background:var(--select2-dropdown-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-dropdown-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);box-sizing:border-box;display:block;height:0;overflow:hidden;position:absolute;width:100%;z-index:1051}.select2-dropdown .select2-label-content{display:contents}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;color:#000;color:var(--select2-option-text-color,#000);padding:6px;user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container.select2-container-dropdown.select2-container--open{opacity:1;width:100%}.select2-container--open .select2-dropdown{height:auto;overflow: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{box-sizing:border-box;padding:4px;width:100%}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{background:#fff;border:0;display:block;filter:alpha(opacity=0);height:auto;left:0;margin:0;min-height:100%;min-width:100%;opacity:0;padding:0;position:fixed;top:0;width:auto;z-index:99}.select2-required:before{color:red;color:var(--select2-required-color,red);content:\"*\"}.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:#fff;background:var(--select2-selection-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-selection-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);display:flex}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;color:var(--select2-selection-text-color,#444);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:#999;color:var(--select2-placeholder-color,#999)}.select2-container--default .select2-selection--single .select2-selection__placeholder span{overflow:hidden;text-overflow:ellipsis;text-overflow:var(--select2-placeholder-overflow,ellipsis);white-space:nowrap}.select2-container--default .select2-selection--single .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--single .select2-selection__arrow,.select2-container--default .select2-selection--single .select2-selection__reset{align-items:center;display:flex;justify-content:center;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow:before{border-bottom:0 solid var(--select2-arrow-color,#888);border-color:#888 transparent;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid var(--select2-arrow-color,#888);content:\" \";height:0;width:0}.select2-container--default .select2-selection--single .select2-selection__reset{color:#999;color:var(--select2-reset-color,#999)}.select2-container--default.select2-container--disabled .select2-selection--single{background:#eee;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-bottom-color:var(--select2-arrow-color,#888);border-color:transparent transparent #888;border-right-color:transparent;border-top-color:transparent;border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background:#fff;background:var(--select2-selection-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-selection-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;flex:1 1 auto;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{color:#999;color:var(--select2-placeholder-color,#999);display:block;float:left;margin-top:5px;overflow:hidden;text-overflow:ellipsis;text-overflow:var(--select2-placeholder-overflow,ellipsis);white-space:nowrap;width:100%}.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-right:10px;margin-top:5px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background:#e4e4e4;background:var(--select2-selection-choice-background,#e4e4e4);border:1px solid #aaa;border:1px solid var(--select2-selection-choice-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);color:#000;color:var(--select2-selection-choice-text-color,#000);cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;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:#333;color:var(--select2-selection-choice-hover-close-color,#333)}.select2-container--default.select2-container--focused .select2-selection--multiple,.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple,.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single{border:1px solid #000;border:1px solid var(--select2-selection-focus-border-color,#000);outline:none}.select2-container--default.select2-container--disabled .select2-selection--multiple{background:#eee;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--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{background:#fff;background:1px solid var(--select2-search-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-search-border-color,#aaa);border-radius:0;border-radius:var(--select2-search-border-radius,0)}.select2-container--default .select2-search--inline .select2-search__field{-webkit-appearance:textfield;background:transparent;border:none;box-shadow:none;outline:none}.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]{background:transparent;background:var(--select2-option-disabled-background,transparent);color:#999;color:var(--select2-option-disabled-text-color,#999)}.select2-container--default .select2-results__option[aria-selected=true]{background:#ddd;background:var(--select2-option-selected-background,#ddd);color:#000;color:var(--select2-option-selected-text-color,#000)}.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:#5897fb;background:var(--select2-option-highlighted-background,#5897fb);color:#fff;color:var(--select2-option-highlighted-text-color,#fff)}.select2-container--default .select2-results__option--hide{display:none}.select2-container--default .select2-results__group{background:transparent;background:var(--select2-option-group-background,transparent);color:grey;color:var(--select2-option-group-text-color,grey);cursor:default;display:block;padding:6px}.select2-no-result{color:#888;color:var(--select2-no-result-color,#888);font-style:italic;font-style:var(--select2-font-style-color,italic)}:host.nostyle .select2-dropdown{border-color:transparent}:host.nostyle .select2-container--default .select2-focused .select2-selection--multiple,:host.nostyle .select2-container--default .select2-focused .select2-selection--single,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,:host.nostyle .select2-selection--multiple,:host.nostyle .select2-selection--single{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{align-items:baseline;border-top:.84375em solid transparent;display:inline-flex;height:auto;padding:.4375em 0;width:100%}:host.material .select2-container--default .select2-selection--multiple,:host.material .select2-container--default .select2-selection--single{border:0;border-radius:0;box-sizing:border-box;height:24px;width:100%}:host.material .select2-container--default .select2-selection--multiple:before,:host.material .select2-container--default .select2-selection--single:before{background:#ddd;background:var(--select2-material-underline,#ddd);bottom:1.65em;content:\" \";display:block;height:1px;position:absolute;width:100%}:host.material .select2-container--default .select2-selection--multiple:after,:host.material .select2-container--default .select2-selection--single:after{background:#5a419e;background:var(--select2-material-underline-active,#5a419e);bottom:1.63em;content:\" \";display:block;height:2px;left:50%;position:absolute;transition:none;width:0}:host.material .select2-container--default .select2-selection--multiple .select2-selection__rendered,:host.material .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:inherit;padding-left:1px}:host.material .select2-container--default .select2-selection--multiple .select2-selection__placeholder,:host.material .select2-container--default .select2-selection--single .select2-selection__placeholder{color:rgba(0,0,0,.38);color:var(--select2-material-placeholder-color,rgba(0,0,0,.38));display:block;left:0;position:absolute;top:20px;transform-origin:0 21px;transition:transform .3s}:host.material .select2-container--default .select2-container--open{bottom:1.6em;left:0}: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--multiple:after,:host.material .select2-container--default.select2-container--open .select2-selection--single:after,:host.material .select2-container--default .select2-focused .select2-selection--multiple:after,:host.material .select2-container--default .select2-focused .select2-selection--single:after{left:0;transition:width .3s cubic-bezier(.12,1,.77,1),left .3s cubic-bezier(.12,1,.77,1);width:100%}:host.material .select2-container--default .select2-dropdown{border:0;border-radius:0;box-shadow:0 5px 5px rgba(0,0,0,.5)}:host.material .select2-container--default .select2-results__option--highlighted[aria-selected],:host.material .select2-container--default .select2-results__option[aria-selected=true]{background:rgba(0,0,0,.04);background:var(--select2-material-option-selected-background,rgba(0,0,0,.04));color:#000;color:var(--select2-material-option-highlighted-text-color,#000)}:host.material .select2-container--default .select2-results__option[aria-selected=true]{color:#ff5722;color:var(--select2-material-option-selected-text-color,#ff5722)}:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple,:host.material .select2-container--default.select2-container--disabled .select2-selection--single{background:transparent}:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple:before,:host.material .select2-container--default.select2-container--disabled .select2-selection--single:before{background:linear-gradient(90deg,rgba(0,0,0,.26) 0,rgba(0,0,0,.26) 33%,transparent 0);background:var(--select2-material-underline-disabled,linear-gradient(90deg,rgba(0,0,0,.26) 0,rgba(0,0,0,.26) 33%,transparent 0));background-position:0 bottom;background-repeat:repeat-x;background-size:4px 1px}:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple: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--single:after,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:before{background:red;background:var(--select2-material-underline-invalid,red)}:host.material:not(.select2-container--open) .select2-focused .select2-selection--multiple,:host.material:not(.select2-container--open) .select2-focused .select2-selection--single{border:0}:host.material .select2-subscript-wrapper{color:#888;color:var(--select2-hint-text-color,#888);font-size:75%;position:absolute;top:calc(100% - 1.72917em)}::ng-deep .select2-overlay-backdrop{background:rgba(0,0,0,.32);background:var(--select2-overlay-backdrop,transparent)}@supports (-moz-appearance:none){select2.material .select2-container--default .select2-selection--multiple,select2.material .select2-container--default .select2-selection--single{height:26px}}@supports (-ms-scroll-limit:0){select2.material .select2-container--default .select2-selection--multiple,select2.material .select2-container--default .select2-selection--single{height:25px}}"]
1658
- }] }
1659
- ];
1660
- /** @nocollapse */
1661
- Select2.ctorParameters = () => [
1662
- { type: ViewportRuler },
1663
- { type: ChangeDetectorRef },
1664
- { type: NgForm, decorators: [{ type: Optional }] },
1665
- { type: FormGroupDirective, decorators: [{ type: Optional }] },
1666
- { type: NgControl, decorators: [{ type: Self }, { type: Optional }] },
1667
- { type: String, decorators: [{ type: Attribute, args: ['tabindex',] }] }
1668
- ];
1669
- Select2.propDecorators = {
1670
- data: [{ type: Input }],
1671
- minCharForSearch: [{ type: Input }],
1672
- displaySearchStatus: [{ type: Input }],
1673
- placeholder: [{ type: Input }],
1674
- customSearchEnabled: [{ type: Input }],
1675
- limitSelection: [{ type: Input }],
1676
- listPosition: [{ type: Input }],
1677
- multiple: [{ type: Input }],
1678
- overlay: [{ type: Input }],
1679
- styleMode: [{ type: Input }],
1680
- noResultMessage: [{ type: Input }],
1681
- infiniteScrollDistance: [{ type: Input }],
1682
- infiniteScrollThrottle: [{ type: Input }],
1683
- infiniteScroll: [{ type: Input }],
1684
- editPattern: [{ type: Input }],
1685
- templates: [{ type: Input }],
1686
- resultMaxHeight: [{ type: Input }],
1687
- update: [{ type: Output }],
1688
- open: [{ type: Output }],
1689
- close: [{ type: Output }],
1690
- focus: [{ type: Output }],
1691
- blur: [{ type: Output }],
1692
- search: [{ type: Output }],
1693
- scroll: [{ type: Output }],
1694
- removeOption: [{ type: Output }],
1695
- minCountForSearch: [{ type: Input }],
1696
- id: [{ type: Input }, { type: HostBinding, args: ['id',] }],
1697
- required: [{ type: Input }],
1698
- disabled: [{ type: Input }],
1699
- hideSelectedItems: [{ type: Input }],
1700
- readonly: [{ type: Input }],
1701
- value: [{ type: Input }],
1702
- tabIndex: [{ type: Input }],
1703
- resettable: [{ type: Input }],
1704
- ariaInvalid: [{ type: HostBinding, args: ['attr.aria-invalid',] }],
1705
- classMaterial: [{ type: HostBinding, args: ['class.material',] }],
1706
- classNostyle: [{ type: HostBinding, args: ['class.nostyle',] }],
1707
- select2above: [{ type: HostBinding, args: ['class.select2-above',] }],
1708
- selection: [{ type: ViewChild, args: ['selection', { static: true },] }],
1709
- resultContainer: [{ type: ViewChild, args: ['results',] }],
1710
- results: [{ type: ViewChildren, args: ['result',] }],
1711
- searchInput: [{ type: ViewChild, args: ['searchInput',] }]
1712
- };
1713
- if (false) {
1714
- /**
1715
- * data of options & optiongrps
1716
- * @type {?}
1717
- */
1718
- Select2.prototype.data;
1719
- /** @type {?} */
1720
- Select2.prototype.minCharForSearch;
1721
- /** @type {?} */
1722
- Select2.prototype.displaySearchStatus;
1723
- /** @type {?} */
1724
- Select2.prototype.placeholder;
1725
- /** @type {?} */
1726
- Select2.prototype.customSearchEnabled;
1727
- /** @type {?} */
1728
- Select2.prototype.limitSelection;
1729
- /** @type {?} */
1730
- Select2.prototype.listPosition;
1731
- /**
1732
- * use the material style
1733
- * @type {?}
1734
- */
1735
- Select2.prototype.styleMode;
1736
- /**
1737
- * message when no result
1738
- * @type {?}
1739
- */
1740
- Select2.prototype.noResultMessage;
1741
- /**
1742
- * infinite scroll distance
1743
- * @type {?}
1744
- */
1745
- Select2.prototype.infiniteScrollDistance;
1746
- /**
1747
- * infinite scroll distance
1748
- * @type {?}
1749
- */
1750
- Select2.prototype.infiniteScrollThrottle;
1751
- /**
1752
- * use it for change the pattern of the filter search
1753
- * @type {?}
1754
- */
1755
- Select2.prototype.editPattern;
1756
- /**
1757
- * template for formating
1758
- * @type {?}
1759
- */
1760
- Select2.prototype.templates;
1761
- /**
1762
- * the max height of the results container when opening the select
1763
- * @type {?}
1764
- */
1765
- Select2.prototype.resultMaxHeight;
1766
- /** @type {?} */
1767
- Select2.prototype.update;
1768
- /** @type {?} */
1769
- Select2.prototype.open;
1770
- /** @type {?} */
1771
- Select2.prototype.close;
1772
- /** @type {?} */
1773
- Select2.prototype.focus;
1774
- /** @type {?} */
1775
- Select2.prototype.blur;
1776
- /** @type {?} */
1777
- Select2.prototype.search;
1778
- /** @type {?} */
1779
- Select2.prototype.scroll;
1780
- /** @type {?} */
1781
- Select2.prototype.removeOption;
1782
- /** @type {?} */
1783
- Select2.prototype.option;
1784
- /** @type {?} */
1785
- Select2.prototype.isOpen;
1786
- /** @type {?} */
1787
- Select2.prototype.searchStyle;
1788
- /**
1789
- * Whether the element is focused or not.
1790
- * @type {?}
1791
- */
1792
- Select2.prototype.focused;
1793
- /** @type {?} */
1794
- Select2.prototype.filteredData;
1795
- /** @type {?} */
1796
- Select2.prototype.overlayWidth;
1797
- /** @type {?} */
1798
- Select2.prototype._triggerRect;
1799
- /**
1800
- * @type {?}
1801
- * @private
1802
- */
1803
- Select2.prototype._minCountForSearch;
1804
- /**
1805
- * @type {?}
1806
- * @private
1807
- */
1808
- Select2.prototype.selection;
1809
- /**
1810
- * @type {?}
1811
- * @private
1812
- */
1813
- Select2.prototype.resultContainer;
1814
- /**
1815
- * @type {?}
1816
- * @private
1817
- */
1818
- Select2.prototype.results;
1819
- /**
1820
- * @type {?}
1821
- * @private
1822
- */
1823
- Select2.prototype.searchInput;
1824
- /**
1825
- * @type {?}
1826
- * @private
1827
- */
1828
- Select2.prototype.hoveringValue;
1829
- /**
1830
- * @type {?}
1831
- * @private
1832
- */
1833
- Select2.prototype.innerSearchText;
1834
- /**
1835
- * @type {?}
1836
- * @private
1837
- */
1838
- Select2.prototype.isSearchboxHidden;
1839
- /**
1840
- * @type {?}
1841
- * @private
1842
- */
1843
- Select2.prototype.selectionElement;
1844
- /**
1845
- * @type {?}
1846
- * @private
1847
- */
1848
- Select2.prototype._stateChanges;
1849
- /**
1850
- * Tab index for the element.
1851
- * @type {?}
1852
- * @private
1853
- */
1854
- Select2.prototype._tabIndex;
1855
- /**
1856
- * @type {?}
1857
- * @private
1858
- */
1859
- Select2.prototype._disabled;
1860
- /**
1861
- * @type {?}
1862
- * @private
1863
- */
1864
- Select2.prototype._required;
1865
- /**
1866
- * @type {?}
1867
- * @private
1868
- */
1869
- Select2.prototype._readonly;
1870
- /**
1871
- * @type {?}
1872
- * @private
1873
- */
1874
- Select2.prototype._multiple;
1875
- /**
1876
- * @type {?}
1877
- * @private
1878
- */
1879
- Select2.prototype._overlay;
1880
- /**
1881
- * @type {?}
1882
- * @private
1883
- */
1884
- Select2.prototype._resettable;
1885
- /**
1886
- * @type {?}
1887
- * @private
1888
- */
1889
- Select2.prototype._hideSelectedItems;
1890
- /**
1891
- * @type {?}
1892
- * @private
1893
- */
1894
- Select2.prototype._clickDetection;
1895
- /**
1896
- * @type {?}
1897
- * @private
1898
- */
1899
- Select2.prototype._clickDetectionFc;
1900
- /**
1901
- * @type {?}
1902
- * @private
1903
- */
1904
- Select2.prototype._id;
1905
- /**
1906
- * @type {?}
1907
- * @private
1908
- */
1909
- Select2.prototype._uid;
1910
- /**
1911
- * @type {?}
1912
- * @private
1913
- */
1914
- Select2.prototype._value;
1915
- /**
1916
- * @type {?}
1917
- * @private
1918
- */
1919
- Select2.prototype._previousNativeValue;
1920
- /**
1921
- * @type {?}
1922
- * @private
1923
- */
1924
- Select2.prototype._infiniteScroll;
1925
- /**
1926
- * View -> model callback called when select has been touched
1927
- * @type {?}
1928
- * @private
1929
- */
1930
- Select2.prototype._onTouched;
1931
- /**
1932
- * View -> model callback called when value changes
1933
- * @type {?}
1934
- * @private
1935
- */
1936
- Select2.prototype._onChange;
1937
- /**
1938
- * @type {?}
1939
- * @protected
1940
- */
1941
- Select2.prototype._viewportRuler;
1942
- /**
1943
- * @type {?}
1944
- * @private
1945
- */
1946
- Select2.prototype._changeDetectorRef;
1947
- /**
1948
- * @type {?}
1949
- * @private
1950
- */
1951
- Select2.prototype._parentForm;
1952
- /**
1953
- * @type {?}
1954
- * @private
1955
- */
1956
- Select2.prototype._parentFormGroup;
1957
- /** @type {?} */
1958
- Select2.prototype._control;
614
+ /**
615
+ * @fileoverview added by tsickle
616
+ * Generated from: lib/select2.component.ts
617
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
618
+ */
619
+ /** @type {?} */
620
+ let nextUniqueId = 0;
621
+ /** @type {?} */
622
+ const displaySearchStatusList = ['default', 'hidden', 'always'];
623
+ class Select2 {
624
+ /**
625
+ * @param {?} _viewportRuler
626
+ * @param {?} _changeDetectorRef
627
+ * @param {?} _parentForm
628
+ * @param {?} _parentFormGroup
629
+ * @param {?} _control
630
+ * @param {?} tabIndex
631
+ */
632
+ constructor(_viewportRuler, _changeDetectorRef, _parentForm, _parentFormGroup, _control, tabIndex) {
633
+ this._viewportRuler = _viewportRuler;
634
+ this._changeDetectorRef = _changeDetectorRef;
635
+ this._parentForm = _parentForm;
636
+ this._parentFormGroup = _parentFormGroup;
637
+ this._control = _control;
638
+ this.minCharForSearch = 0;
639
+ this.limitSelection = 0;
640
+ this.listPosition = 'below';
641
+ /**
642
+ * use the material style
643
+ */
644
+ this.styleMode = 'default';
645
+ /**
646
+ * maximum results limit (0 = no limit)
647
+ */
648
+ this.maxResults = 0;
649
+ /**
650
+ * message when maximum results
651
+ */
652
+ this.maxResultsMessage = 'Too many results…';
653
+ /**
654
+ * infinite scroll distance
655
+ */
656
+ this.infiniteScrollDistance = 1.5;
657
+ /**
658
+ * infinite scroll distance
659
+ */
660
+ this.infiniteScrollThrottle = 150;
661
+ /**
662
+ * the max height of the results container when opening the select
663
+ */
664
+ this.resultMaxHeight = '200px';
665
+ this.update = new EventEmitter();
666
+ this.open = new EventEmitter();
667
+ this.close = new EventEmitter();
668
+ this.focus = new EventEmitter();
669
+ this.blur = new EventEmitter();
670
+ this.search = new EventEmitter();
671
+ this.scroll = new EventEmitter();
672
+ this.removeOption = new EventEmitter();
673
+ this.option = null;
674
+ this.isOpen = false;
675
+ /**
676
+ * Whether the element is focused or not.
677
+ */
678
+ this.focused = false;
679
+ this.hoveringValue = null;
680
+ this.innerSearchText = '';
681
+ this._stateChanges = new Subject();
682
+ this._disabled = false;
683
+ this._required = false;
684
+ this._readonly = false;
685
+ this._multiple = false;
686
+ this._overlay = false;
687
+ this._resettable = false;
688
+ this._hideSelectedItems = false;
689
+ this._clickDetection = false;
690
+ this._uid = `select2-${nextUniqueId++}`;
691
+ this._infiniteScroll = true;
692
+ /**
693
+ * View -> model callback called when select has been touched
694
+ */
695
+ this._onTouched = (/**
696
+ * @return {?}
697
+ */
698
+ () => {
699
+ // do nothing
700
+ });
701
+ /**
702
+ * View -> model callback called when value changes
703
+ */
704
+ this._onChange = (/**
705
+ * @return {?}
706
+ */
707
+ () => {
708
+ // do nothing
709
+ });
710
+ this.id = this.id;
711
+ this._tabIndex = parseInt(tabIndex, 10) || 0;
712
+ if (this._control) {
713
+ this._control.valueAccessor = this;
714
+ }
715
+ this._clickDetectionFc = this.clickDetection.bind(this);
716
+ }
717
+ /**
718
+ * data of options & optiongrps
719
+ * @param {?} data
720
+ * @return {?}
721
+ */
722
+ set data(data) {
723
+ this._data = data;
724
+ this.updateFilteredData();
725
+ }
726
+ /**
727
+ * @return {?}
728
+ */
729
+ get multiple() {
730
+ return this._multiple;
731
+ }
732
+ /**
733
+ * @param {?} value
734
+ * @return {?}
735
+ */
736
+ set multiple(value) {
737
+ this._multiple = this._coerceBooleanProperty(value);
738
+ this.ngOnInit();
739
+ }
740
+ /**
741
+ * use the material style
742
+ * @return {?}
743
+ */
744
+ get overlay() {
745
+ return this._overlay;
746
+ }
747
+ /**
748
+ * @param {?} value
749
+ * @return {?}
750
+ */
751
+ set overlay(value) {
752
+ this._overlay = this._coerceBooleanProperty(value);
753
+ }
754
+ /**
755
+ * infinite scroll activated
756
+ * @return {?}
757
+ */
758
+ get infiniteScroll() {
759
+ return this._infiniteScroll;
760
+ }
761
+ /**
762
+ * @param {?} value
763
+ * @return {?}
764
+ */
765
+ set infiniteScroll(value) {
766
+ this._infiniteScroll = this._coerceBooleanProperty(value);
767
+ }
768
+ /**
769
+ * @return {?}
770
+ */
771
+ get select2Options() {
772
+ return this.multiple ? ((/** @type {?} */ (this.option))) : null;
773
+ }
774
+ /**
775
+ * @return {?}
776
+ */
777
+ get select2Option() {
778
+ return this.multiple ? null : ((/** @type {?} */ (this.option)));
779
+ }
780
+ /**
781
+ * @return {?}
782
+ */
783
+ get searchText() {
784
+ return this.innerSearchText;
785
+ }
786
+ /**
787
+ * @param {?} text
788
+ * @return {?}
789
+ */
790
+ set searchText(text) {
791
+ if (this.customSearchEnabled) {
792
+ this.search.emit({
793
+ component: this,
794
+ value: this._value,
795
+ search: text,
796
+ });
797
+ }
798
+ this.innerSearchText = text;
799
+ }
800
+ /**
801
+ * minimal data of show the search field
802
+ * @return {?}
803
+ */
804
+ get minCountForSearch() {
805
+ return this._minCountForSearch;
806
+ }
807
+ /**
808
+ * @param {?} value
809
+ * @return {?}
810
+ */
811
+ set minCountForSearch(value) {
812
+ this._minCountForSearch = value;
813
+ this.updateSearchBox();
814
+ }
815
+ /**
816
+ * Unique id of the element.
817
+ * @return {?}
818
+ */
819
+ get id() {
820
+ return this._id;
821
+ }
822
+ /**
823
+ * @param {?} value
824
+ * @return {?}
825
+ */
826
+ set id(value) {
827
+ this._id = value || this._uid;
828
+ }
829
+ /**
830
+ * Whether the element is required.
831
+ * @return {?}
832
+ */
833
+ get required() {
834
+ return this._required;
835
+ }
836
+ /**
837
+ * @param {?} value
838
+ * @return {?}
839
+ */
840
+ set required(value) {
841
+ this._required = this._coerceBooleanProperty(value);
842
+ }
843
+ /**
844
+ * Whether selected items should be hidden.
845
+ * @return {?}
846
+ */
847
+ get disabled() {
848
+ return this._control ? this._control.disabled : this._disabled;
849
+ }
850
+ /**
851
+ * @param {?} value
852
+ * @return {?}
853
+ */
854
+ set disabled(value) {
855
+ this._disabled = this._coerceBooleanProperty(value);
856
+ }
857
+ /**
858
+ * Whether items are hidden when has.
859
+ * @return {?}
860
+ */
861
+ get hideSelectedItems() {
862
+ return this._hideSelectedItems;
863
+ }
864
+ /**
865
+ * @param {?} value
866
+ * @return {?}
867
+ */
868
+ set hideSelectedItems(value) {
869
+ this._hideSelectedItems = this._coerceBooleanProperty(value);
870
+ }
871
+ /**
872
+ * Whether the element is readonly.
873
+ * @return {?}
874
+ */
875
+ get readonly() {
876
+ return this._readonly;
877
+ }
878
+ /**
879
+ * @param {?} value
880
+ * @return {?}
881
+ */
882
+ set readonly(value) {
883
+ this._readonly = this._coerceBooleanProperty(value);
884
+ }
885
+ /**
886
+ * The input element's value.
887
+ * @return {?}
888
+ */
889
+ get value() {
890
+ return this._value;
891
+ }
892
+ /**
893
+ * @param {?} value
894
+ * @return {?}
895
+ */
896
+ set value(value) {
897
+ if (this.testValueChange(this._value, value)) {
898
+ setTimeout((/**
899
+ * @return {?}
900
+ */
901
+ () => {
902
+ this._value = value;
903
+ this.writeValue(value);
904
+ }), 10);
905
+ }
906
+ }
907
+ /**
908
+ * Tab index for the select2 element.
909
+ * @return {?}
910
+ */
911
+ get tabIndex() {
912
+ return this.disabled ? -1 : this._tabIndex;
913
+ }
914
+ /**
915
+ * @param {?} value
916
+ * @return {?}
917
+ */
918
+ set tabIndex(value) {
919
+ if (typeof value !== 'undefined') {
920
+ this._tabIndex = value;
921
+ }
922
+ }
923
+ /**
924
+ * reset with no selected value
925
+ * @return {?}
926
+ */
927
+ get resettable() {
928
+ return this._resettable;
929
+ }
930
+ /**
931
+ * @param {?} value
932
+ * @return {?}
933
+ */
934
+ set resettable(value) {
935
+ this._resettable = this._coerceBooleanProperty(value);
936
+ }
937
+ /**
938
+ * @return {?}
939
+ */
940
+ get ariaInvalid() {
941
+ return this._isErrorState();
942
+ }
943
+ /**
944
+ * @return {?}
945
+ */
946
+ get classMaterial() {
947
+ return this.styleMode === 'material';
948
+ }
949
+ /**
950
+ * @return {?}
951
+ */
952
+ get classNostyle() {
953
+ return this.styleMode === 'noStyle';
954
+ }
955
+ /**
956
+ * @return {?}
957
+ */
958
+ get select2above() {
959
+ return !this.overlay ? this.listPosition === 'above' : this._isAbobeOverlay();
960
+ }
961
+ /**
962
+ * @return {?}
963
+ */
964
+ get _positions() {
965
+ if (this.listPosition === 'auto') {
966
+ [
967
+ {
968
+ originX: 'start',
969
+ originY: 'bottom',
970
+ overlayX: 'start',
971
+ overlayY: 'bottom',
972
+ },
973
+ {
974
+ originX: 'start',
975
+ originY: 'top',
976
+ overlayX: 'start',
977
+ overlayY: 'top',
978
+ },
979
+ ];
980
+ }
981
+ else {
982
+ return null;
983
+ }
984
+ }
985
+ /**
986
+ * @private
987
+ * @return {?}
988
+ */
989
+ get resultsElement() {
990
+ var _a;
991
+ return (_a = this.resultContainer) === null || _a === void 0 ? void 0 : _a.nativeElement;
992
+ }
993
+ /**
994
+ * @return {?}
995
+ */
996
+ ngOnInit() {
997
+ this._viewportRuler.change(100).subscribe((/**
998
+ * @return {?}
999
+ */
1000
+ () => {
1001
+ if (this.isOpen) {
1002
+ this.triggerRect();
1003
+ }
1004
+ }));
1005
+ /** @type {?} */
1006
+ const option = Select2Utils.getOptionsByValue(this._data, this._control ? this._control.value : this.value, this.multiple);
1007
+ if (option !== null) {
1008
+ this.option = option;
1009
+ }
1010
+ if (!Array.isArray(option)) {
1011
+ this.hoveringValue = (/** @type {?} */ (this.value));
1012
+ }
1013
+ this.updateSearchBox();
1014
+ }
1015
+ /**
1016
+ * @return {?}
1017
+ */
1018
+ ngAfterViewInit() {
1019
+ this.cdkConnectedOverlay.positionChange.subscribe((/**
1020
+ * @param {?} posChange
1021
+ * @return {?}
1022
+ */
1023
+ (posChange) => {
1024
+ var _a;
1025
+ if (this.listPosition === 'auto' && ((_a = posChange.connectionPair) === null || _a === void 0 ? void 0 : _a.originY) &&
1026
+ this._overlayPosition !== posChange.connectionPair.originY) {
1027
+ this.triggerRect();
1028
+ this._overlayPosition = posChange.connectionPair.originY;
1029
+ this._changeDetectorRef.detectChanges();
1030
+ }
1031
+ }));
1032
+ this.selectionElement = this.selection.nativeElement;
1033
+ this.triggerRect();
1034
+ }
1035
+ /**
1036
+ * @return {?}
1037
+ */
1038
+ ngDoCheck() {
1039
+ var _a;
1040
+ this.updateSearchBox();
1041
+ this._dirtyCheckNativeValue();
1042
+ if (this._triggerRect) {
1043
+ if (this.overlayWidth !== this._triggerRect.width) {
1044
+ this.overlayWidth = this._triggerRect.width;
1045
+ }
1046
+ if (((_a = this._dropdownRect) === null || _a === void 0 ? void 0 : _a.height) > 0 && this.overlayHeight !== this._dropdownRect.height) {
1047
+ this.overlayHeight = this.listPosition === 'auto' ? this._dropdownRect.height : 0;
1048
+ }
1049
+ }
1050
+ }
1051
+ /**
1052
+ * @return {?}
1053
+ */
1054
+ ngOnDestroy() {
1055
+ window.document.body.removeEventListener('click', this._clickDetectionFc);
1056
+ }
1057
+ /**
1058
+ * @return {?}
1059
+ */
1060
+ updateSearchBox() {
1061
+ /** @type {?} */
1062
+ const hidden = this.customSearchEnabled
1063
+ ? false
1064
+ : Select2Utils.isSearchboxHiddex(this._data, this._minCountForSearch);
1065
+ if (this.isSearchboxHidden !== hidden) {
1066
+ this.isSearchboxHidden = hidden;
1067
+ }
1068
+ }
1069
+ /**
1070
+ * @return {?}
1071
+ */
1072
+ hideSearch() {
1073
+ /** @type {?} */
1074
+ const displaySearchStatus = displaySearchStatusList.indexOf(this.displaySearchStatus) > -1 ? this.displaySearchStatus : 'default';
1075
+ return (displaySearchStatus === 'default' && this.isSearchboxHidden) || displaySearchStatus === 'hidden';
1076
+ }
1077
+ /**
1078
+ * @param {?} option
1079
+ * @return {?}
1080
+ */
1081
+ getOptionStyle(option) {
1082
+ return ('select2-results__option ' +
1083
+ (option.hide ? 'select2-results__option--hide ' : '') +
1084
+ (option.value === this.hoveringValue ? 'select2-results__option--highlighted ' : '') +
1085
+ (option.classes || ''));
1086
+ }
1087
+ /**
1088
+ * @param {?} option
1089
+ * @return {?}
1090
+ */
1091
+ mouseenter(option) {
1092
+ if (!option.disabled) {
1093
+ this.hoveringValue = option.value;
1094
+ }
1095
+ }
1096
+ /**
1097
+ * @param {?} option
1098
+ * @return {?}
1099
+ */
1100
+ click(option) {
1101
+ if (this.testSelection(option)) {
1102
+ this.select(option);
1103
+ }
1104
+ }
1105
+ /**
1106
+ * @param {?} e
1107
+ * @return {?}
1108
+ */
1109
+ reset(e) {
1110
+ this.select(null);
1111
+ e.preventDefault();
1112
+ e.stopPropagation();
1113
+ }
1114
+ /**
1115
+ * @param {?} event
1116
+ * @return {?}
1117
+ */
1118
+ prevChange(event) {
1119
+ event.stopPropagation();
1120
+ }
1121
+ /**
1122
+ * @return {?}
1123
+ */
1124
+ toggleOpenAndClose() {
1125
+ if (this.disabled) {
1126
+ return;
1127
+ }
1128
+ this._focus(true);
1129
+ this.isOpen = !this.isOpen;
1130
+ if (this.isOpen) {
1131
+ this.innerSearchText = '';
1132
+ this.updateFilteredData();
1133
+ this._focusSearchboxOrResultsElement();
1134
+ setTimeout((/**
1135
+ * @return {?}
1136
+ */
1137
+ () => {
1138
+ if (this.option) {
1139
+ /** @type {?} */
1140
+ const option = this.option instanceof Array ? this.option[0] : this.option;
1141
+ this.updateScrollFromOption(option);
1142
+ }
1143
+ else if (this.resultsElement) {
1144
+ this.resultsElement.scrollTop = 0;
1145
+ }
1146
+ setTimeout((/**
1147
+ * @return {?}
1148
+ */
1149
+ () => {
1150
+ var _a, _b;
1151
+ this.triggerRect();
1152
+ (_b = (_a = this.cdkConnectedOverlay) === null || _a === void 0 ? void 0 : _a.overlayRef) === null || _b === void 0 ? void 0 : _b.updatePosition();
1153
+ }), 100);
1154
+ }));
1155
+ this.open.emit(this);
1156
+ }
1157
+ else {
1158
+ this.close.emit(this);
1159
+ }
1160
+ if (this.isOpen && !this._clickDetection) {
1161
+ setTimeout((/**
1162
+ * @return {?}
1163
+ */
1164
+ () => {
1165
+ window.document.body.addEventListener('click', this._clickDetectionFc, false);
1166
+ this._clickDetection = true;
1167
+ }), timeout);
1168
+ }
1169
+ this._changeDetectorRef.markForCheck();
1170
+ }
1171
+ /**
1172
+ * @param {?} option
1173
+ * @param {?} defaut
1174
+ * @return {?}
1175
+ */
1176
+ hasTemplate(option, defaut) {
1177
+ var _a, _b;
1178
+ return (this.templates instanceof TemplateRef ||
1179
+ ((_a = this.templates) === null || _a === void 0 ? void 0 : _a[option.templateId]) instanceof TemplateRef ||
1180
+ ((_b = this.templates) === null || _b === void 0 ? void 0 : _b[defaut]) instanceof TemplateRef);
1181
+ }
1182
+ /**
1183
+ * @param {?} option
1184
+ * @param {?} defaut
1185
+ * @return {?}
1186
+ */
1187
+ getTemplate(option, defaut) {
1188
+ return this.hasTemplate(option, defaut)
1189
+ ? this.templates[option.templateId] || this.templates[defaut] || this.templates
1190
+ : undefined;
1191
+ }
1192
+ /**
1193
+ * @return {?}
1194
+ */
1195
+ triggerRect() {
1196
+ var _a;
1197
+ this._triggerRect = this.selectionElement.getBoundingClientRect();
1198
+ this._dropdownRect = ((_a = this.dropdown) === null || _a === void 0 ? void 0 : _a.nativeElement) ? this.dropdown.nativeElement.getBoundingClientRect()
1199
+ : undefined;
1200
+ }
1201
+ /**
1202
+ * @private
1203
+ * @param {?} option
1204
+ * @return {?}
1205
+ */
1206
+ testSelection(option) {
1207
+ if (option.disabled) {
1208
+ return false;
1209
+ }
1210
+ if (!this.multiple ||
1211
+ !this.limitSelection ||
1212
+ (Array.isArray(this._value) && this._value.length < this.limitSelection)) {
1213
+ return true;
1214
+ }
1215
+ return false;
1216
+ }
1217
+ /**
1218
+ * @private
1219
+ * @param {?} value1
1220
+ * @param {?} value2
1221
+ * @return {?}
1222
+ */
1223
+ testValueChange(value1, value2) {
1224
+ var _a, _b;
1225
+ if (((value1 === null || value1 === undefined) && (value2 === null || value2 === undefined)) ||
1226
+ value1 === value2) {
1227
+ return false;
1228
+ }
1229
+ if (this.multiple && ((_a = ((/** @type {?} */ (value1)))) === null || _a === void 0 ? void 0 : _a.length) && ((_b = ((/** @type {?} */ (value2)))) === null || _b === void 0 ? void 0 : _b.length) &&
1230
+ ((/** @type {?} */ (value1))).length === ((/** @type {?} */ (value2))).length) {
1231
+ for (const e1 of (/** @type {?} */ (value1))) {
1232
+ /** @type {?} */
1233
+ const test = ((/** @type {?} */ (value2))).indexOf(e1) > -1;
1234
+ if (!test) {
1235
+ return true;
1236
+ }
1237
+ }
1238
+ return false;
1239
+ }
1240
+ return true;
1241
+ }
1242
+ /**
1243
+ * @private
1244
+ * @return {?}
1245
+ */
1246
+ updateFilteredData() {
1247
+ setTimeout((/**
1248
+ * @return {?}
1249
+ */
1250
+ () => {
1251
+ /** @type {?} */
1252
+ let result = this._data;
1253
+ if (this.multiple && this.hideSelectedItems) {
1254
+ result = Select2Utils.getFilteredSelectedData(result, this.option);
1255
+ }
1256
+ if (!this.customSearchEnabled && this.searchText && this.searchText.length >= +this.minCharForSearch) {
1257
+ result = Select2Utils.getFilteredData(result, this.searchText, this.editPattern);
1258
+ }
1259
+ if (this.maxResults > 0) {
1260
+ /** @type {?} */
1261
+ const data = Select2Utils.getReduceData(result, +this.maxResults);
1262
+ result = data.result;
1263
+ this.maxResultsExceeded = data.reduce;
1264
+ }
1265
+ else {
1266
+ this.maxResultsExceeded = false;
1267
+ }
1268
+ if (Select2Utils.valueIsNotInFilteredData(result, this.hoveringValue)) {
1269
+ this.hoveringValue = Select2Utils.getFirstAvailableOption(result);
1270
+ }
1271
+ this.filteredData = result;
1272
+ this._changeDetectorRef.markForCheck();
1273
+ }));
1274
+ }
1275
+ /**
1276
+ * @private
1277
+ * @param {?} e
1278
+ * @return {?}
1279
+ */
1280
+ clickDetection(e) {
1281
+ if (!this.ifParentContainsClass((/** @type {?} */ (e.target)), 'selection')) {
1282
+ if (this.isOpen && !this.ifParentContainsClass((/** @type {?} */ (e.target)), 'select2-dropdown')) {
1283
+ this.toggleOpenAndClose();
1284
+ }
1285
+ if (!this.ifParentContainsId((/** @type {?} */ (e.target)), this._id)) {
1286
+ this.clickExit();
1287
+ }
1288
+ }
1289
+ else if (this.isOpen && !this.ifParentContainsId((/** @type {?} */ (e.target)), this._id)) {
1290
+ this.toggleOpenAndClose();
1291
+ this.clickExit();
1292
+ }
1293
+ }
1294
+ /**
1295
+ * @private
1296
+ * @return {?}
1297
+ */
1298
+ clickExit() {
1299
+ this._focus(false);
1300
+ window.document.body.removeEventListener('click', this._clickDetectionFc);
1301
+ this._clickDetection = false;
1302
+ }
1303
+ /**
1304
+ * @private
1305
+ * @param {?} element
1306
+ * @param {?} cssClass
1307
+ * @return {?}
1308
+ */
1309
+ ifParentContainsClass(element, cssClass) {
1310
+ return this.getParentElementByClass(element, cssClass) !== null;
1311
+ }
1312
+ /**
1313
+ * @private
1314
+ * @param {?} element
1315
+ * @param {?} id
1316
+ * @return {?}
1317
+ */
1318
+ ifParentContainsId(element, id) {
1319
+ return this.getParentElementById(element, id) !== null;
1320
+ }
1321
+ /**
1322
+ * @private
1323
+ * @param {?} element
1324
+ * @param {?} cssClass
1325
+ * @return {?}
1326
+ */
1327
+ getParentElementByClass(element, cssClass) {
1328
+ if (this.containClasses(element, cssClass.trim().split(/\s+/))) {
1329
+ return element;
1330
+ }
1331
+ return element.parentElement ? this.getParentElementByClass(element.parentElement, cssClass) : null;
1332
+ }
1333
+ /**
1334
+ * @private
1335
+ * @param {?} element
1336
+ * @param {?} id
1337
+ * @return {?}
1338
+ */
1339
+ getParentElementById(element, id) {
1340
+ if (element.id === id) {
1341
+ return element;
1342
+ }
1343
+ return element.parentElement ? this.getParentElementById(element.parentElement, id) : null;
1344
+ }
1345
+ /**
1346
+ * @private
1347
+ * @param {?} element
1348
+ * @param {?} cssClasses
1349
+ * @return {?}
1350
+ */
1351
+ containClasses(element, cssClasses) {
1352
+ if (!element.classList) {
1353
+ return false;
1354
+ }
1355
+ for (const cssClass of cssClasses) {
1356
+ if (!element.classList.contains(cssClass)) {
1357
+ return false;
1358
+ }
1359
+ }
1360
+ return true;
1361
+ }
1362
+ /**
1363
+ * @return {?}
1364
+ */
1365
+ focusin() {
1366
+ if (!this.disabled) {
1367
+ this._focus(true);
1368
+ }
1369
+ }
1370
+ /**
1371
+ * @return {?}
1372
+ */
1373
+ focusout() {
1374
+ if (this.selectionElement && !this.selectionElement.classList.contains('select2-focused')) {
1375
+ this._focus(false);
1376
+ this._onTouched();
1377
+ }
1378
+ }
1379
+ /**
1380
+ * @param {?} option
1381
+ * @return {?}
1382
+ */
1383
+ select(option) {
1384
+ /** @type {?} */
1385
+ let value;
1386
+ if (option !== null) {
1387
+ if (this.multiple) {
1388
+ /** @type {?} */
1389
+ const options = (/** @type {?} */ (this.option));
1390
+ /** @type {?} */
1391
+ const index = options.findIndex((/**
1392
+ * @param {?} op
1393
+ * @return {?}
1394
+ */
1395
+ op => op.value === option.value));
1396
+ if (index === -1) {
1397
+ options.push(option);
1398
+ }
1399
+ else {
1400
+ options.splice(index, 1);
1401
+ }
1402
+ value = ((/** @type {?} */ (this.option))).map((/**
1403
+ * @param {?} op
1404
+ * @return {?}
1405
+ */
1406
+ op => op.value));
1407
+ }
1408
+ else {
1409
+ this.option = option;
1410
+ if (this.isOpen) {
1411
+ this.isOpen = false;
1412
+ this.close.emit(this);
1413
+ if (this.selectionElement) {
1414
+ this.selectionElement.focus();
1415
+ }
1416
+ }
1417
+ value = this.option.value;
1418
+ }
1419
+ }
1420
+ else {
1421
+ this.option = null;
1422
+ }
1423
+ if (this.multiple && this.hideSelectedItems) {
1424
+ this.updateFilteredData();
1425
+ }
1426
+ if (this._control) {
1427
+ this._onChange(value);
1428
+ }
1429
+ else {
1430
+ this._value = value;
1431
+ }
1432
+ this.update.emit({
1433
+ component: this,
1434
+ value: value,
1435
+ options: Array.isArray(this.option) ? this.option : this.option ? [this.option] : null,
1436
+ });
1437
+ }
1438
+ /**
1439
+ * @param {?} e
1440
+ * @return {?}
1441
+ */
1442
+ keyDown(e) {
1443
+ if (this._testKey(e, ['ArrowDown', 40])) {
1444
+ this.moveDown();
1445
+ e.preventDefault();
1446
+ }
1447
+ else if (this._testKey(e, ['ArrowUp', 38])) {
1448
+ this.moveUp();
1449
+ e.preventDefault();
1450
+ }
1451
+ else if (this._testKey(e, ['Enter', 13])) {
1452
+ this.selectByEnter();
1453
+ e.preventDefault();
1454
+ }
1455
+ else if (this._testKey(e, ['Escape', 'Tab', 9, 27]) && this.isOpen) {
1456
+ this.toggleOpenAndClose();
1457
+ this._focus(false);
1458
+ }
1459
+ }
1460
+ /**
1461
+ * @param {?} e
1462
+ * @return {?}
1463
+ */
1464
+ openKey(e) {
1465
+ if (this._testKey(e, ['ArrowDown', 'ArrowUp', 'Enter', 40, 38, 13])) {
1466
+ this.toggleOpenAndClose();
1467
+ e.preventDefault();
1468
+ }
1469
+ else if (this._testKey(e, ['Escape', 'Tab', 9, 27])) {
1470
+ this._focus(false);
1471
+ this._onTouched();
1472
+ }
1473
+ }
1474
+ /**
1475
+ * @param {?} _index
1476
+ * @param {?} item
1477
+ * @return {?}
1478
+ */
1479
+ trackBy(_index, item) {
1480
+ return item.value;
1481
+ }
1482
+ /**
1483
+ * @param {?} e
1484
+ * @return {?}
1485
+ */
1486
+ searchUpdate(e) {
1487
+ this.searchText = ((/** @type {?} */ (e.target))).value;
1488
+ this.updateFilteredData();
1489
+ }
1490
+ /**
1491
+ * @param {?} option
1492
+ * @return {?}
1493
+ */
1494
+ isSelected(option) {
1495
+ return Select2Utils.isSelected(this.option, option, this.multiple);
1496
+ }
1497
+ /**
1498
+ * @param {?} option
1499
+ * @return {?}
1500
+ */
1501
+ isDisabled(option) {
1502
+ return option.disabled ? 'true' : 'false';
1503
+ }
1504
+ /**
1505
+ * @param {?} e
1506
+ * @param {?} option
1507
+ * @return {?}
1508
+ */
1509
+ removeSelection(e, option) {
1510
+ Select2Utils.removeSelection(this.option, option);
1511
+ if (this.multiple && this.hideSelectedItems) {
1512
+ this.updateFilteredData();
1513
+ }
1514
+ /** @type {?} */
1515
+ const value = ((/** @type {?} */ (this.option))).map((/**
1516
+ * @param {?} op
1517
+ * @return {?}
1518
+ */
1519
+ op => op.value));
1520
+ if (this._control) {
1521
+ this._onChange(value);
1522
+ }
1523
+ else {
1524
+ this._value = value;
1525
+ }
1526
+ this.update.emit({
1527
+ component: this,
1528
+ value: value,
1529
+ options: Array.isArray(this.option) ? this.option : this.option ? [this.option] : null,
1530
+ });
1531
+ this.removeOption.emit({
1532
+ component: this,
1533
+ value: value,
1534
+ removedOption: option,
1535
+ });
1536
+ e.preventDefault();
1537
+ e.stopPropagation();
1538
+ if (this.isOpen) {
1539
+ this._focusSearchboxOrResultsElement();
1540
+ }
1541
+ }
1542
+ /**
1543
+ * Sets the model value. Implemented as part of ControlValueAccessor.
1544
+ * @param {?} value
1545
+ * @return {?}
1546
+ */
1547
+ writeValue(value) {
1548
+ this._setSelectionByValue(value);
1549
+ }
1550
+ /**
1551
+ * Saves a callback function to be invoked when the select's value
1552
+ * changes from user input. Part of the ControlValueAccessor interface
1553
+ * required to integrate with Angular's core forms API.
1554
+ *
1555
+ * @param {?} fn Callback to be triggered when the value changes.
1556
+ * @return {?}
1557
+ */
1558
+ registerOnChange(fn) {
1559
+ this._onChange = fn;
1560
+ }
1561
+ /**
1562
+ * Saves a callback function to be invoked when the select is blurred
1563
+ * by the user. Part of the ControlValueAccessor interface required
1564
+ * to integrate with Angular's core forms API.
1565
+ *
1566
+ * @param {?} fn Callback to be triggered when the component has been touched.
1567
+ * @return {?}
1568
+ */
1569
+ registerOnTouched(fn) {
1570
+ this._onTouched = fn;
1571
+ }
1572
+ /**
1573
+ * Sets whether the component should be disabled.
1574
+ * Implemented as part of ControlValueAccessor.
1575
+ * @param {?} isDisabled
1576
+ * @return {?}
1577
+ */
1578
+ setDisabledState(isDisabled) {
1579
+ this.disabled = isDisabled;
1580
+ }
1581
+ /**
1582
+ * @param {?} way
1583
+ * @return {?}
1584
+ */
1585
+ onScroll(way) {
1586
+ this.scroll.emit({
1587
+ component: this,
1588
+ way,
1589
+ search: this.innerSearchText,
1590
+ });
1591
+ }
1592
+ /**
1593
+ * @return {?}
1594
+ */
1595
+ _isErrorState() {
1596
+ /** @type {?} */
1597
+ const isInvalid = this._control && this._control.invalid;
1598
+ /** @type {?} */
1599
+ const isTouched = this._control && this._control.touched;
1600
+ /** @type {?} */
1601
+ const isSubmitted = (this._parentFormGroup && this._parentFormGroup.submitted) ||
1602
+ (this._parentForm && this._parentForm.submitted);
1603
+ return !!(isInvalid && (isTouched || isSubmitted));
1604
+ }
1605
+ /**
1606
+ * @private
1607
+ * @return {?}
1608
+ */
1609
+ moveUp() {
1610
+ this.updateScrollFromOption(Select2Utils.getPreviousOption(this.filteredData, this.hoveringValue));
1611
+ }
1612
+ /**
1613
+ * @private
1614
+ * @return {?}
1615
+ */
1616
+ moveDown() {
1617
+ this.updateScrollFromOption(Select2Utils.getNextOption(this.filteredData, this.hoveringValue));
1618
+ }
1619
+ /**
1620
+ * @private
1621
+ * @param {?} option
1622
+ * @return {?}
1623
+ */
1624
+ updateScrollFromOption(option) {
1625
+ if (option) {
1626
+ this.hoveringValue = option.value;
1627
+ /** @type {?} */
1628
+ const domElement = this.results.find((/**
1629
+ * @param {?} r
1630
+ * @return {?}
1631
+ */
1632
+ r => r.nativeElement.innerText.trim() === option.label));
1633
+ if (domElement && this.resultsElement) {
1634
+ this.resultsElement.scrollTop = 0;
1635
+ /** @type {?} */
1636
+ const listClientRect = this.resultsElement.getBoundingClientRect();
1637
+ /** @type {?} */
1638
+ const optionClientRect = domElement.nativeElement.getBoundingClientRect();
1639
+ this.resultsElement.scrollTop = optionClientRect.top - listClientRect.top;
1640
+ }
1641
+ }
1642
+ }
1643
+ /**
1644
+ * @private
1645
+ * @return {?}
1646
+ */
1647
+ selectByEnter() {
1648
+ if (this.hoveringValue) {
1649
+ /** @type {?} */
1650
+ const option = Select2Utils.getOptionByValue(this._data, this.hoveringValue);
1651
+ this.select(option);
1652
+ }
1653
+ }
1654
+ /**
1655
+ * @private
1656
+ * @param {?} event
1657
+ * @param {?=} refs
1658
+ * @return {?}
1659
+ */
1660
+ _testKey(event, refs = []) {
1661
+ return this._isKey(this._getKey(event), refs);
1662
+ }
1663
+ /**
1664
+ * @private
1665
+ * @param {?} event
1666
+ * @return {?}
1667
+ */
1668
+ _getKey(event) {
1669
+ /** @type {?} */
1670
+ let code;
1671
+ if (event.key !== undefined) {
1672
+ code = event.key;
1673
+ }
1674
+ else if (event['keyIdentifier'] !== undefined) {
1675
+ code = event['keyIdentifier'];
1676
+ }
1677
+ else if (event['keyCode'] !== undefined) {
1678
+ code = event['keyCode'];
1679
+ }
1680
+ else {
1681
+ event.preventDefault();
1682
+ }
1683
+ return code;
1684
+ }
1685
+ /**
1686
+ * @private
1687
+ * @param {?} code
1688
+ * @param {?=} refs
1689
+ * @return {?}
1690
+ */
1691
+ _isKey(code, refs = []) {
1692
+ return refs && refs.length > 0 ? refs.indexOf(code) !== -1 : false;
1693
+ }
1694
+ /**
1695
+ * Sets the selected option based on a value. If no option can be
1696
+ * found with the designated value, the select trigger is cleared.
1697
+ * @private
1698
+ * @param {?} value
1699
+ * @return {?}
1700
+ */
1701
+ _setSelectionByValue(value) {
1702
+ if (this.option || (value !== undefined && value !== null)) {
1703
+ /** @type {?} */
1704
+ const isArray = Array.isArray(value);
1705
+ if (this.multiple && value && !isArray) {
1706
+ throw new Error('Non array value.');
1707
+ }
1708
+ else if (this._data) {
1709
+ if (this.multiple) {
1710
+ this.option = []; // if value is null, then empty option and return
1711
+ if (isArray) {
1712
+ // value is not null. Preselect value
1713
+ /** @type {?} */
1714
+ const selectedValues = Select2Utils.getOptionsByValue(this._data, value, this.multiple);
1715
+ selectedValues.map((/**
1716
+ * @param {?} item
1717
+ * @return {?}
1718
+ */
1719
+ item => this.select(item)));
1720
+ }
1721
+ }
1722
+ else {
1723
+ this.select(Select2Utils.getOptionByValue(this._data, value));
1724
+ }
1725
+ }
1726
+ else if (this._control) {
1727
+ this._control.viewToModelUpdate(value);
1728
+ }
1729
+ this._changeDetectorRef.markForCheck();
1730
+ }
1731
+ }
1732
+ /**
1733
+ * Does some manual dirty checking on the native input `value` property.
1734
+ * @private
1735
+ * @return {?}
1736
+ */
1737
+ _dirtyCheckNativeValue() {
1738
+ /** @type {?} */
1739
+ const newValue = this.value;
1740
+ if (this._previousNativeValue !== newValue) {
1741
+ this._previousNativeValue = newValue;
1742
+ this._stateChanges.next();
1743
+ }
1744
+ }
1745
+ /**
1746
+ * @private
1747
+ * @param {?} value
1748
+ * @return {?}
1749
+ */
1750
+ _coerceBooleanProperty(value) {
1751
+ return value != null && `${value}` !== 'false';
1752
+ }
1753
+ /**
1754
+ * @private
1755
+ * @return {?}
1756
+ */
1757
+ _focusSearchboxOrResultsElement() {
1758
+ if (!this.isSearchboxHidden) {
1759
+ setTimeout((/**
1760
+ * @return {?}
1761
+ */
1762
+ () => {
1763
+ if (this.searchInput && this.searchInput.nativeElement) {
1764
+ this.searchInput.nativeElement.focus();
1765
+ }
1766
+ }));
1767
+ }
1768
+ else if (this.resultsElement) {
1769
+ this.resultsElement.focus();
1770
+ }
1771
+ }
1772
+ /**
1773
+ * @private
1774
+ * @param {?} state
1775
+ * @return {?}
1776
+ */
1777
+ _focus(state) {
1778
+ if (!state && this.focused) {
1779
+ this.focused = state;
1780
+ this.blur.emit(this);
1781
+ }
1782
+ else if (state && !this.focused) {
1783
+ this.focused = state;
1784
+ this.focus.emit(this);
1785
+ }
1786
+ }
1787
+ /**
1788
+ * @private
1789
+ * @return {?}
1790
+ */
1791
+ _isAbobeOverlay() {
1792
+ return this.overlay && this._overlayPosition && this.listPosition === 'auto'
1793
+ ? this._overlayPosition === 'top'
1794
+ : this.listPosition === 'above';
1795
+ }
1796
+ }
1797
+ Select2.decorators = [
1798
+ { type: Component, args: [{
1799
+ selector: 'select2',
1800
+ 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 select2-container--focus\"\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 [attr.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 <span *ngIf=\"select2Option\" [innerHTML]=\"select2Option.label\"></span>\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 [class.select2-selection__placeholder__option]=\"select2Options?.length > 0\"\n class=\"select2-selection__placeholder\"\n >{{ placeholder }}</span\n >\n <li *ngFor=\"let op of option; trackBy: trackBy\" class=\"select2-selection__choice\" [title]=\"op.label\">\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 </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",
1801
+ styles: [".select2-label{color:#000;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{opacity:0;position:absolute;width:0}.select2-container .select2-selection--single{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;flex:1 1 auto;overflow:hidden;padding:0 0 0 8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container .select2-selection--multiple{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{border:none;box-sizing:border-box;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:#fff;background:var(--select2-dropdown-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-dropdown-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);box-sizing:border-box;display:block;height:0;overflow:hidden;position:absolute;width:100%;z-index:1051}.select2-dropdown .select2-label-content{display:contents}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;color:#000;color:var(--select2-option-text-color,#000);padding:6px;user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container.select2-container-dropdown.select2-container--open{opacity:1;width:100%}.select2-container--open .select2-dropdown{height:auto;overflow: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{box-sizing:border-box;padding:4px;width:100%}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{background:#fff;border:0;display:block;filter:alpha(opacity=0);height:auto;left:0;margin:0;min-height:100%;min-width:100%;opacity:0;padding:0;position:fixed;top:0;width:auto;z-index:99}.select2-required:before{color:red;color:var(--select2-required-color,red);content:\"*\"}.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:#fff;background:var(--select2-selection-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-selection-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);display:flex}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;color:var(--select2-selection-text-color,#444);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:#999;color:var(--select2-placeholder-color,#999)}.select2-container--default .select2-selection--single .select2-selection__placeholder span{overflow:hidden;text-overflow:ellipsis;text-overflow:var(--select2-placeholder-overflow,ellipsis);white-space:nowrap}.select2-container--default .select2-selection--single .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--single .select2-selection__arrow,.select2-container--default .select2-selection--single .select2-selection__reset{align-items:center;display:flex;justify-content:center;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow:before{border-bottom:0 solid var(--select2-arrow-color,#888);border-color:#888 transparent;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid var(--select2-arrow-color,#888);content:\" \";height:0;width:0}.select2-container--default .select2-selection--single .select2-selection__reset{color:#999;color:var(--select2-reset-color,#999)}.select2-container--default.select2-container--disabled .select2-selection--single{background:#eee;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-bottom-color:var(--select2-arrow-color,#888);border-color:transparent transparent #888;border-right-color:transparent;border-top-color:transparent;border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background:#fff;background:var(--select2-selection-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-selection-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;flex:1 1 auto;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{color:#999;color:var(--select2-placeholder-color,#999);display:block;float:left;margin-top:5px;overflow:hidden;text-overflow:ellipsis;text-overflow:var(--select2-placeholder-overflow,ellipsis);white-space:nowrap;width:100%}.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-right:10px;margin-top:5px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background:#e4e4e4;background:var(--select2-selection-choice-background,#e4e4e4);border:1px solid #aaa;border:1px solid var(--select2-selection-choice-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);color:#000;color:var(--select2-selection-choice-text-color,#000);cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;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:#333;color:var(--select2-selection-choice-hover-close-color,#333)}.select2-container--default.select2-container--focused .select2-selection--multiple,.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple,.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single{border:1px solid #000;border:1px solid var(--select2-selection-focus-border-color,#000);outline:none}.select2-container--default.select2-container--disabled .select2-selection--multiple{background:#eee;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--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{background:#fff;background:1px solid var(--select2-search-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-search-border-color,#aaa);border-radius:0;border-radius:var(--select2-search-border-radius,0)}.select2-container--default .select2-search--inline .select2-search__field{-webkit-appearance:textfield;background:transparent;border:none;box-shadow:none;outline:none}.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]{background:transparent;background:var(--select2-option-disabled-background,transparent);color:#999;color:var(--select2-option-disabled-text-color,#999)}.select2-container--default .select2-results__option[aria-selected=true]{background:#ddd;background:var(--select2-option-selected-background,#ddd);color:#000;color:var(--select2-option-selected-text-color,#000)}.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:#5897fb;background:var(--select2-option-highlighted-background,#5897fb);color:#fff;color:var(--select2-option-highlighted-text-color,#fff)}.select2-container--default .select2-results__option--hide{display:none}.select2-container--default .select2-results__group{background:transparent;background:var(--select2-option-group-background,transparent);color:grey;color:var(--select2-option-group-text-color,grey);cursor:default;display:block;padding:6px}.select2-no-result{color:#888;color:var(--select2-no-result-color,#888);font-style:italic;font-style:var(--select2-no-result-font-style,italic)}.select2-too-much-result{color:#888;color:var(--select2-too-much-result-color,#888);font-style:italic;font-style:var(--select2-too-much-font-style,italic)}:host.nostyle .select2-dropdown{border-color:transparent}:host.nostyle .select2-container--default .select2-focused .select2-selection--multiple,:host.nostyle .select2-container--default .select2-focused .select2-selection--single,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,:host.nostyle .select2-selection--multiple,:host.nostyle .select2-selection--single{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{align-items:baseline;border-top:.84375em solid transparent;display:inline-flex;height:auto;padding:.4375em 0;width:100%}:host.material .select2-container--default .select2-selection--multiple,:host.material .select2-container--default .select2-selection--single{border:0;border-radius:0;box-sizing:border-box;height:24px;width:100%}:host.material .select2-container--default .select2-selection--multiple:before,:host.material .select2-container--default .select2-selection--single:before{background:#ddd;background:var(--select2-material-underline,#ddd);bottom:1.65em;content:\" \";display:block;height:1px;position:absolute;width:100%}:host.material .select2-container--default .select2-selection--multiple:after,:host.material .select2-container--default .select2-selection--single:after{background:#5a419e;background:var(--select2-material-underline-active,#5a419e);bottom:1.63em;content:\" \";display:block;height:2px;left:50%;position:absolute;transition:none;width:0}:host.material .select2-container--default .select2-selection--multiple .select2-selection__rendered,:host.material .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:inherit;padding-left:1px}:host.material .select2-container--default .select2-selection--multiple .select2-selection__placeholder,:host.material .select2-container--default .select2-selection--single .select2-selection__placeholder{color:rgba(0,0,0,.38);color:var(--select2-material-placeholder-color,rgba(0,0,0,.38));display:block;left:0;position:absolute;top:20px;transform-origin:0 21px;transition:transform .3s}:host.material .select2-container--default .select2-container--open{bottom:1.6em;left:0}: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--multiple:after,:host.material .select2-container--default.select2-container--open .select2-selection--single:after,:host.material .select2-container--default .select2-focused .select2-selection--multiple:after,:host.material .select2-container--default .select2-focused .select2-selection--single:after{left:0;transition:width .3s cubic-bezier(.12,1,.77,1),left .3s cubic-bezier(.12,1,.77,1);width:100%}:host.material .select2-container--default .select2-dropdown{border:0;border-radius:0;box-shadow:0 5px 5px rgba(0,0,0,.5)}:host.material .select2-container--default .select2-results__option--highlighted[aria-selected],:host.material .select2-container--default .select2-results__option[aria-selected=true]{background:rgba(0,0,0,.04);background:var(--select2-material-option-selected-background,rgba(0,0,0,.04));color:#000;color:var(--select2-material-option-highlighted-text-color,#000)}:host.material .select2-container--default .select2-results__option[aria-selected=true]{color:#ff5722;color:var(--select2-material-option-selected-text-color,#ff5722)}:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple,:host.material .select2-container--default.select2-container--disabled .select2-selection--single{background:transparent}:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple:before,:host.material .select2-container--default.select2-container--disabled .select2-selection--single:before{background:linear-gradient(90deg,rgba(0,0,0,.26) 0,rgba(0,0,0,.26) 33%,transparent 0);background:var(--select2-material-underline-disabled,linear-gradient(90deg,rgba(0,0,0,.26) 0,rgba(0,0,0,.26) 33%,transparent 0));background-position:0 bottom;background-repeat:repeat-x;background-size:4px 1px}:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple: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--single:after,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:before{background:red;background:var(--select2-material-underline-invalid,red)}:host.material:not(.select2-container--open) .select2-focused .select2-selection--multiple,:host.material:not(.select2-container--open) .select2-focused .select2-selection--single{border:0}:host.material .select2-subscript-wrapper{color:#888;color:var(--select2-hint-text-color,#888);font-size:75%;position:absolute;top:calc(100% - 1.72917em)}::ng-deep .select2-overlay-backdrop{background:rgba(0,0,0,.32);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--multiple,select2.material .select2-container--default .select2-selection--single{height:26px}}@supports (-ms-scroll-limit:0){select2.material .select2-container--default .select2-selection--multiple,select2.material .select2-container--default .select2-selection--single{height:25px}}"]
1802
+ }] }
1803
+ ];
1804
+ /** @nocollapse */
1805
+ Select2.ctorParameters = () => [
1806
+ { type: ViewportRuler },
1807
+ { type: ChangeDetectorRef },
1808
+ { type: NgForm, decorators: [{ type: Optional }] },
1809
+ { type: FormGroupDirective, decorators: [{ type: Optional }] },
1810
+ { type: NgControl, decorators: [{ type: Self }, { type: Optional }] },
1811
+ { type: String, decorators: [{ type: Attribute, args: ['tabindex',] }] }
1812
+ ];
1813
+ Select2.propDecorators = {
1814
+ data: [{ type: Input }],
1815
+ minCharForSearch: [{ type: Input }],
1816
+ displaySearchStatus: [{ type: Input }],
1817
+ placeholder: [{ type: Input }],
1818
+ customSearchEnabled: [{ type: Input }],
1819
+ limitSelection: [{ type: Input }],
1820
+ listPosition: [{ type: Input }],
1821
+ multiple: [{ type: Input }],
1822
+ overlay: [{ type: Input }],
1823
+ styleMode: [{ type: Input }],
1824
+ noResultMessage: [{ type: Input }],
1825
+ maxResults: [{ type: Input }],
1826
+ maxResultsMessage: [{ type: Input }],
1827
+ infiniteScrollDistance: [{ type: Input }],
1828
+ infiniteScrollThrottle: [{ type: Input }],
1829
+ infiniteScroll: [{ type: Input }],
1830
+ editPattern: [{ type: Input }],
1831
+ templates: [{ type: Input }],
1832
+ resultMaxHeight: [{ type: Input }],
1833
+ update: [{ type: Output }],
1834
+ open: [{ type: Output }],
1835
+ close: [{ type: Output }],
1836
+ focus: [{ type: Output }],
1837
+ blur: [{ type: Output }],
1838
+ search: [{ type: Output }],
1839
+ scroll: [{ type: Output }],
1840
+ removeOption: [{ type: Output }],
1841
+ minCountForSearch: [{ type: Input }],
1842
+ id: [{ type: Input }, { type: HostBinding, args: ['id',] }],
1843
+ required: [{ type: Input }],
1844
+ disabled: [{ type: Input }],
1845
+ hideSelectedItems: [{ type: Input }],
1846
+ readonly: [{ type: Input }],
1847
+ value: [{ type: Input }],
1848
+ tabIndex: [{ type: Input }],
1849
+ resettable: [{ type: Input }],
1850
+ ariaInvalid: [{ type: HostBinding, args: ['attr.aria-invalid',] }],
1851
+ classMaterial: [{ type: HostBinding, args: ['class.material',] }],
1852
+ classNostyle: [{ type: HostBinding, args: ['class.nostyle',] }],
1853
+ select2above: [{ type: HostBinding, args: ['class.select2-above',] }],
1854
+ cdkConnectedOverlay: [{ type: ViewChild, args: [CdkConnectedOverlay,] }],
1855
+ selection: [{ type: ViewChild, args: ['selection', { static: true },] }],
1856
+ resultContainer: [{ type: ViewChild, args: ['results',] }],
1857
+ results: [{ type: ViewChildren, args: ['result',] }],
1858
+ searchInput: [{ type: ViewChild, args: ['searchInput',] }],
1859
+ dropdown: [{ type: ViewChild, args: ['dropdown',] }]
1860
+ };
1861
+ if (false) {
1862
+ /** @type {?} */
1863
+ Select2.prototype._data;
1864
+ /** @type {?} */
1865
+ Select2.prototype.minCharForSearch;
1866
+ /** @type {?} */
1867
+ Select2.prototype.displaySearchStatus;
1868
+ /** @type {?} */
1869
+ Select2.prototype.placeholder;
1870
+ /** @type {?} */
1871
+ Select2.prototype.customSearchEnabled;
1872
+ /** @type {?} */
1873
+ Select2.prototype.limitSelection;
1874
+ /** @type {?} */
1875
+ Select2.prototype.listPosition;
1876
+ /**
1877
+ * use the material style
1878
+ * @type {?}
1879
+ */
1880
+ Select2.prototype.styleMode;
1881
+ /**
1882
+ * message when no result
1883
+ * @type {?}
1884
+ */
1885
+ Select2.prototype.noResultMessage;
1886
+ /**
1887
+ * maximum results limit (0 = no limit)
1888
+ * @type {?}
1889
+ */
1890
+ Select2.prototype.maxResults;
1891
+ /**
1892
+ * message when maximum results
1893
+ * @type {?}
1894
+ */
1895
+ Select2.prototype.maxResultsMessage;
1896
+ /**
1897
+ * infinite scroll distance
1898
+ * @type {?}
1899
+ */
1900
+ Select2.prototype.infiniteScrollDistance;
1901
+ /**
1902
+ * infinite scroll distance
1903
+ * @type {?}
1904
+ */
1905
+ Select2.prototype.infiniteScrollThrottle;
1906
+ /**
1907
+ * use it for change the pattern of the filter search
1908
+ * @type {?}
1909
+ */
1910
+ Select2.prototype.editPattern;
1911
+ /**
1912
+ * template for formating
1913
+ * @type {?}
1914
+ */
1915
+ Select2.prototype.templates;
1916
+ /**
1917
+ * the max height of the results container when opening the select
1918
+ * @type {?}
1919
+ */
1920
+ Select2.prototype.resultMaxHeight;
1921
+ /** @type {?} */
1922
+ Select2.prototype.update;
1923
+ /** @type {?} */
1924
+ Select2.prototype.open;
1925
+ /** @type {?} */
1926
+ Select2.prototype.close;
1927
+ /** @type {?} */
1928
+ Select2.prototype.focus;
1929
+ /** @type {?} */
1930
+ Select2.prototype.blur;
1931
+ /** @type {?} */
1932
+ Select2.prototype.search;
1933
+ /** @type {?} */
1934
+ Select2.prototype.scroll;
1935
+ /** @type {?} */
1936
+ Select2.prototype.removeOption;
1937
+ /** @type {?} */
1938
+ Select2.prototype.option;
1939
+ /** @type {?} */
1940
+ Select2.prototype.isOpen;
1941
+ /** @type {?} */
1942
+ Select2.prototype.searchStyle;
1943
+ /**
1944
+ * Whether the element is focused or not.
1945
+ * @type {?}
1946
+ */
1947
+ Select2.prototype.focused;
1948
+ /** @type {?} */
1949
+ Select2.prototype.filteredData;
1950
+ /** @type {?} */
1951
+ Select2.prototype.overlayWidth;
1952
+ /** @type {?} */
1953
+ Select2.prototype.overlayHeight;
1954
+ /** @type {?} */
1955
+ Select2.prototype._triggerRect;
1956
+ /** @type {?} */
1957
+ Select2.prototype._dropdownRect;
1958
+ /** @type {?} */
1959
+ Select2.prototype.maxResultsExceeded;
1960
+ /**
1961
+ * @type {?}
1962
+ * @private
1963
+ */
1964
+ Select2.prototype._minCountForSearch;
1965
+ /**
1966
+ * @type {?}
1967
+ * @private
1968
+ */
1969
+ Select2.prototype.cdkConnectedOverlay;
1970
+ /**
1971
+ * @type {?}
1972
+ * @private
1973
+ */
1974
+ Select2.prototype.selection;
1975
+ /**
1976
+ * @type {?}
1977
+ * @private
1978
+ */
1979
+ Select2.prototype.resultContainer;
1980
+ /**
1981
+ * @type {?}
1982
+ * @private
1983
+ */
1984
+ Select2.prototype.results;
1985
+ /**
1986
+ * @type {?}
1987
+ * @private
1988
+ */
1989
+ Select2.prototype.searchInput;
1990
+ /**
1991
+ * @type {?}
1992
+ * @private
1993
+ */
1994
+ Select2.prototype.dropdown;
1995
+ /**
1996
+ * @type {?}
1997
+ * @private
1998
+ */
1999
+ Select2.prototype.hoveringValue;
2000
+ /**
2001
+ * @type {?}
2002
+ * @private
2003
+ */
2004
+ Select2.prototype.innerSearchText;
2005
+ /**
2006
+ * @type {?}
2007
+ * @private
2008
+ */
2009
+ Select2.prototype.isSearchboxHidden;
2010
+ /**
2011
+ * @type {?}
2012
+ * @private
2013
+ */
2014
+ Select2.prototype.selectionElement;
2015
+ /**
2016
+ * @type {?}
2017
+ * @private
2018
+ */
2019
+ Select2.prototype._stateChanges;
2020
+ /**
2021
+ * Tab index for the element.
2022
+ * @type {?}
2023
+ * @private
2024
+ */
2025
+ Select2.prototype._tabIndex;
2026
+ /**
2027
+ * @type {?}
2028
+ * @private
2029
+ */
2030
+ Select2.prototype._disabled;
2031
+ /**
2032
+ * @type {?}
2033
+ * @private
2034
+ */
2035
+ Select2.prototype._required;
2036
+ /**
2037
+ * @type {?}
2038
+ * @private
2039
+ */
2040
+ Select2.prototype._readonly;
2041
+ /**
2042
+ * @type {?}
2043
+ * @private
2044
+ */
2045
+ Select2.prototype._multiple;
2046
+ /**
2047
+ * @type {?}
2048
+ * @private
2049
+ */
2050
+ Select2.prototype._overlay;
2051
+ /**
2052
+ * @type {?}
2053
+ * @private
2054
+ */
2055
+ Select2.prototype._resettable;
2056
+ /**
2057
+ * @type {?}
2058
+ * @private
2059
+ */
2060
+ Select2.prototype._hideSelectedItems;
2061
+ /**
2062
+ * @type {?}
2063
+ * @private
2064
+ */
2065
+ Select2.prototype._clickDetection;
2066
+ /**
2067
+ * @type {?}
2068
+ * @private
2069
+ */
2070
+ Select2.prototype._clickDetectionFc;
2071
+ /**
2072
+ * @type {?}
2073
+ * @private
2074
+ */
2075
+ Select2.prototype._id;
2076
+ /**
2077
+ * @type {?}
2078
+ * @private
2079
+ */
2080
+ Select2.prototype._uid;
2081
+ /**
2082
+ * @type {?}
2083
+ * @private
2084
+ */
2085
+ Select2.prototype._value;
2086
+ /**
2087
+ * @type {?}
2088
+ * @private
2089
+ */
2090
+ Select2.prototype._previousNativeValue;
2091
+ /**
2092
+ * @type {?}
2093
+ * @private
2094
+ */
2095
+ Select2.prototype._infiniteScroll;
2096
+ /**
2097
+ * @type {?}
2098
+ * @private
2099
+ */
2100
+ Select2.prototype._overlayPosition;
2101
+ /**
2102
+ * View -> model callback called when select has been touched
2103
+ * @type {?}
2104
+ * @private
2105
+ */
2106
+ Select2.prototype._onTouched;
2107
+ /**
2108
+ * View -> model callback called when value changes
2109
+ * @type {?}
2110
+ * @private
2111
+ */
2112
+ Select2.prototype._onChange;
2113
+ /**
2114
+ * @type {?}
2115
+ * @protected
2116
+ */
2117
+ Select2.prototype._viewportRuler;
2118
+ /**
2119
+ * @type {?}
2120
+ * @private
2121
+ */
2122
+ Select2.prototype._changeDetectorRef;
2123
+ /**
2124
+ * @type {?}
2125
+ * @private
2126
+ */
2127
+ Select2.prototype._parentForm;
2128
+ /**
2129
+ * @type {?}
2130
+ * @private
2131
+ */
2132
+ Select2.prototype._parentFormGroup;
2133
+ /** @type {?} */
2134
+ Select2.prototype._control;
1959
2135
  }
1960
2136
 
1961
- /**
1962
- * @fileoverview added by tsickle
1963
- * Generated from: lib/select2-hint.component.ts
1964
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1965
- */
1966
- class Select2Hint {
1967
- }
1968
- Select2Hint.decorators = [
1969
- { type: Directive, args: [{ selector: 'select2-hint' },] }
2137
+ /**
2138
+ * @fileoverview added by tsickle
2139
+ * Generated from: lib/select2-hint.component.ts
2140
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2141
+ */
2142
+ class Select2Hint {
2143
+ }
2144
+ Select2Hint.decorators = [
2145
+ { type: Directive, args: [{ selector: 'select2-hint' },] }
1970
2146
  ];
1971
2147
 
1972
- /**
1973
- * @fileoverview added by tsickle
1974
- * Generated from: lib/select2-label.component.ts
1975
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1976
- */
1977
- class Select2Label {
1978
- }
1979
- Select2Label.decorators = [
1980
- { type: Directive, args: [{ selector: 'select2-label' },] }
2148
+ /**
2149
+ * @fileoverview added by tsickle
2150
+ * Generated from: lib/select2-label.component.ts
2151
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2152
+ */
2153
+ class Select2Label {
2154
+ }
2155
+ Select2Label.decorators = [
2156
+ { type: Directive, args: [{ selector: 'select2-label' },] }
1981
2157
  ];
1982
2158
 
1983
- /**
1984
- * @fileoverview added by tsickle
1985
- * Generated from: lib/select2.module.ts
1986
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1987
- */
1988
- class Select2Module {
1989
- }
1990
- Select2Module.decorators = [
1991
- { type: NgModule, args: [{
1992
- imports: [
1993
- CommonModule,
1994
- FormsModule,
1995
- OverlayModule,
1996
- ReactiveFormsModule,
1997
- InfiniteScrollModule
1998
- ],
1999
- declarations: [
2000
- Select2Hint,
2001
- Select2Label,
2002
- Select2
2003
- ],
2004
- exports: [
2005
- FormsModule,
2006
- ReactiveFormsModule,
2007
- Select2Hint,
2008
- Select2Label,
2009
- Select2
2010
- ]
2011
- },] }
2159
+ /**
2160
+ * @fileoverview added by tsickle
2161
+ * Generated from: lib/select2.module.ts
2162
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2163
+ */
2164
+ class Select2Module {
2165
+ }
2166
+ Select2Module.decorators = [
2167
+ { type: NgModule, args: [{
2168
+ imports: [CommonModule, FormsModule, OverlayModule, ReactiveFormsModule, InfiniteScrollModule],
2169
+ declarations: [Select2Hint, Select2Label, Select2],
2170
+ exports: [FormsModule, ReactiveFormsModule, Select2Hint, Select2Label, Select2],
2171
+ },] }
2012
2172
  ];
2013
2173
 
2014
- /**
2015
- * @fileoverview added by tsickle
2016
- * Generated from: public_api.ts
2017
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2174
+ /**
2175
+ * @fileoverview added by tsickle
2176
+ * Generated from: public_api.ts
2177
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2018
2178
  */
2019
2179
 
2020
- /**
2021
- * @fileoverview added by tsickle
2022
- * Generated from: ng-select2-component.ts
2023
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2180
+ /**
2181
+ * @fileoverview added by tsickle
2182
+ * Generated from: ng-select2-component.ts
2183
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2024
2184
  */
2025
2185
 
2026
2186
  export { Select2, Select2Hint, Select2Label, Select2Module, Select2Utils, defaultMinCountForSearch, protectRegexp, timeout, unicodePatterns };