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