ng-select2-component 8.0.5 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +44 -36
  3. package/{esm2015/lib/select2-const.js → esm2020/lib/select2-const.mjs} +48 -57
  4. package/esm2020/lib/select2-hint.component.mjs +11 -0
  5. package/esm2020/lib/select2-interfaces.mjs +2 -0
  6. package/esm2020/lib/select2-label.component.mjs +11 -0
  7. package/esm2020/lib/select2-utils.mjs +280 -0
  8. package/esm2020/lib/select2.component.mjs +871 -0
  9. package/esm2020/lib/select2.module.mjs +23 -0
  10. package/esm2020/ng-select2-component.mjs +5 -0
  11. package/esm2020/public_api.mjs +12 -0
  12. package/fesm2015/ng-select2-component.mjs +1241 -0
  13. package/fesm2015/ng-select2-component.mjs.map +1 -0
  14. package/fesm2020/ng-select2-component.mjs +1242 -0
  15. package/fesm2020/ng-select2-component.mjs.map +1 -0
  16. package/lib/select2-const.d.ts +8 -7
  17. package/lib/select2-const.d.ts.map +1 -0
  18. package/lib/select2-hint.component.d.ts +6 -2
  19. package/lib/select2-hint.component.d.ts.map +1 -0
  20. package/lib/select2-interfaces.d.ts +55 -54
  21. package/lib/select2-interfaces.d.ts.map +1 -0
  22. package/lib/select2-label.component.d.ts +6 -2
  23. package/lib/select2-label.component.d.ts.map +1 -0
  24. package/lib/select2-utils.d.ts +25 -20
  25. package/lib/select2-utils.d.ts.map +1 -0
  26. package/lib/select2.component.d.ts +225 -215
  27. package/lib/select2.component.d.ts.map +1 -0
  28. package/lib/select2.module.d.ts +14 -2
  29. package/lib/select2.module.d.ts.map +1 -0
  30. package/ng-select2-component.d.ts +6 -4
  31. package/ng-select2-component.d.ts.map +1 -0
  32. package/package.json +25 -13
  33. package/public_api.d.ts +9 -8
  34. package/public_api.d.ts.map +1 -0
  35. package/bundles/ng-select2-component.umd.js +0 -2577
  36. package/bundles/ng-select2-component.umd.js.map +0 -1
  37. package/bundles/ng-select2-component.umd.min.js +0 -2
  38. package/bundles/ng-select2-component.umd.min.js.map +0 -1
  39. package/esm2015/lib/select2-hint.component.js +0 -12
  40. package/esm2015/lib/select2-interfaces.js +0 -134
  41. package/esm2015/lib/select2-label.component.js +0 -12
  42. package/esm2015/lib/select2-utils.js +0 -388
  43. package/esm2015/lib/select2.component.js +0 -1494
  44. package/esm2015/lib/select2.module.js +0 -23
  45. package/esm2015/ng-select2-component.js +0 -10
  46. package/esm2015/public_api.js +0 -17
  47. package/fesm2015/ng-select2-component.js +0 -2124
  48. package/fesm2015/ng-select2-component.js.map +0 -1
  49. package/ng-select2-component.metadata.json +0 -1
@@ -1,2577 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/overlay'), require('@angular/cdk/scrolling'), require('@angular/core'), require('@angular/forms'), require('rxjs'), require('@angular/common'), require('ngx-infinite-scroll')) :
3
- typeof define === 'function' && define.amd ? define('ng-select2-component', ['exports', '@angular/cdk/overlay', '@angular/cdk/scrolling', '@angular/core', '@angular/forms', 'rxjs', '@angular/common', 'ngx-infinite-scroll'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['ng-select2-component'] = {}, global.ng.cdk.overlay, global.ng.cdk.scrolling, global.ng.core, global.ng.forms, global.rxjs, global.ng.common, global.ngxInfiniteScroll));
5
- }(this, (function (exports, overlay, scrolling, core, forms, rxjs, common, ngxInfiniteScroll) { 'use strict';
6
-
7
- /**
8
- * @fileoverview added by tsickle
9
- * Generated from: lib/select2-const.ts
10
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
11
- */
12
- /** @type {?} */
13
- var timeout = 200;
14
- /** @type {?} */
15
- var 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
- /** @type {?} */
60
- var defaultMinCountForSearch = 6;
61
- /** @type {?} */
62
- var protectRegexp = new RegExp('[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]', 'g');
63
-
64
- /*! *****************************************************************************
65
- Copyright (c) Microsoft Corporation.
66
-
67
- Permission to use, copy, modify, and/or distribute this software for any
68
- purpose with or without fee is hereby granted.
69
-
70
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
71
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
72
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
73
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
74
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
75
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
76
- PERFORMANCE OF THIS SOFTWARE.
77
- ***************************************************************************** */
78
- /* global Reflect, Promise */
79
- var extendStatics = function (d, b) {
80
- extendStatics = Object.setPrototypeOf ||
81
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
82
- function (d, b) { for (var p in b)
83
- if (Object.prototype.hasOwnProperty.call(b, p))
84
- d[p] = b[p]; };
85
- return extendStatics(d, b);
86
- };
87
- function __extends(d, b) {
88
- if (typeof b !== "function" && b !== null)
89
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
90
- extendStatics(d, b);
91
- function __() { this.constructor = d; }
92
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
93
- }
94
- var __assign = function () {
95
- __assign = Object.assign || function __assign(t) {
96
- for (var s, i = 1, n = arguments.length; i < n; i++) {
97
- s = arguments[i];
98
- for (var p in s)
99
- if (Object.prototype.hasOwnProperty.call(s, p))
100
- t[p] = s[p];
101
- }
102
- return t;
103
- };
104
- return __assign.apply(this, arguments);
105
- };
106
- function __rest(s, e) {
107
- var t = {};
108
- for (var p in s)
109
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
110
- t[p] = s[p];
111
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
112
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
113
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
114
- t[p[i]] = s[p[i]];
115
- }
116
- return t;
117
- }
118
- function __decorate(decorators, target, key, desc) {
119
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
120
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
121
- r = Reflect.decorate(decorators, target, key, desc);
122
- else
123
- for (var i = decorators.length - 1; i >= 0; i--)
124
- if (d = decorators[i])
125
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
126
- return c > 3 && r && Object.defineProperty(target, key, r), r;
127
- }
128
- function __param(paramIndex, decorator) {
129
- return function (target, key) { decorator(target, key, paramIndex); };
130
- }
131
- function __metadata(metadataKey, metadataValue) {
132
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
133
- return Reflect.metadata(metadataKey, metadataValue);
134
- }
135
- function __awaiter(thisArg, _arguments, P, generator) {
136
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
137
- return new (P || (P = Promise))(function (resolve, reject) {
138
- function fulfilled(value) { try {
139
- step(generator.next(value));
140
- }
141
- catch (e) {
142
- reject(e);
143
- } }
144
- function rejected(value) { try {
145
- step(generator["throw"](value));
146
- }
147
- catch (e) {
148
- reject(e);
149
- } }
150
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
151
- step((generator = generator.apply(thisArg, _arguments || [])).next());
152
- });
153
- }
154
- function __generator(thisArg, body) {
155
- var _ = { label: 0, sent: function () { if (t[0] & 1)
156
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
157
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
158
- function verb(n) { return function (v) { return step([n, v]); }; }
159
- function step(op) {
160
- if (f)
161
- throw new TypeError("Generator is already executing.");
162
- while (_)
163
- try {
164
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
165
- return t;
166
- if (y = 0, t)
167
- op = [op[0] & 2, t.value];
168
- switch (op[0]) {
169
- case 0:
170
- case 1:
171
- t = op;
172
- break;
173
- case 4:
174
- _.label++;
175
- return { value: op[1], done: false };
176
- case 5:
177
- _.label++;
178
- y = op[1];
179
- op = [0];
180
- continue;
181
- case 7:
182
- op = _.ops.pop();
183
- _.trys.pop();
184
- continue;
185
- default:
186
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
187
- _ = 0;
188
- continue;
189
- }
190
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
191
- _.label = op[1];
192
- break;
193
- }
194
- if (op[0] === 6 && _.label < t[1]) {
195
- _.label = t[1];
196
- t = op;
197
- break;
198
- }
199
- if (t && _.label < t[2]) {
200
- _.label = t[2];
201
- _.ops.push(op);
202
- break;
203
- }
204
- if (t[2])
205
- _.ops.pop();
206
- _.trys.pop();
207
- continue;
208
- }
209
- op = body.call(thisArg, _);
210
- }
211
- catch (e) {
212
- op = [6, e];
213
- y = 0;
214
- }
215
- finally {
216
- f = t = 0;
217
- }
218
- if (op[0] & 5)
219
- throw op[1];
220
- return { value: op[0] ? op[1] : void 0, done: true };
221
- }
222
- }
223
- var __createBinding = Object.create ? (function (o, m, k, k2) {
224
- if (k2 === undefined)
225
- k2 = k;
226
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
227
- }) : (function (o, m, k, k2) {
228
- if (k2 === undefined)
229
- k2 = k;
230
- o[k2] = m[k];
231
- });
232
- function __exportStar(m, o) {
233
- for (var p in m)
234
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
235
- __createBinding(o, m, p);
236
- }
237
- function __values(o) {
238
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
239
- if (m)
240
- return m.call(o);
241
- if (o && typeof o.length === "number")
242
- return {
243
- next: function () {
244
- if (o && i >= o.length)
245
- o = void 0;
246
- return { value: o && o[i++], done: !o };
247
- }
248
- };
249
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
250
- }
251
- function __read(o, n) {
252
- var m = typeof Symbol === "function" && o[Symbol.iterator];
253
- if (!m)
254
- return o;
255
- var i = m.call(o), r, ar = [], e;
256
- try {
257
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
258
- ar.push(r.value);
259
- }
260
- catch (error) {
261
- e = { error: error };
262
- }
263
- finally {
264
- try {
265
- if (r && !r.done && (m = i["return"]))
266
- m.call(i);
267
- }
268
- finally {
269
- if (e)
270
- throw e.error;
271
- }
272
- }
273
- return ar;
274
- }
275
- /** @deprecated */
276
- function __spread() {
277
- for (var ar = [], i = 0; i < arguments.length; i++)
278
- ar = ar.concat(__read(arguments[i]));
279
- return ar;
280
- }
281
- /** @deprecated */
282
- function __spreadArrays() {
283
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
284
- s += arguments[i].length;
285
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
286
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
287
- r[k] = a[j];
288
- return r;
289
- }
290
- function __spreadArray(to, from, pack) {
291
- if (pack || arguments.length === 2)
292
- for (var i = 0, l = from.length, ar; i < l; i++) {
293
- if (ar || !(i in from)) {
294
- if (!ar)
295
- ar = Array.prototype.slice.call(from, 0, i);
296
- ar[i] = from[i];
297
- }
298
- }
299
- return to.concat(ar || from);
300
- }
301
- function __await(v) {
302
- return this instanceof __await ? (this.v = v, this) : new __await(v);
303
- }
304
- function __asyncGenerator(thisArg, _arguments, generator) {
305
- if (!Symbol.asyncIterator)
306
- throw new TypeError("Symbol.asyncIterator is not defined.");
307
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
308
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
309
- function verb(n) { if (g[n])
310
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
311
- function resume(n, v) { try {
312
- step(g[n](v));
313
- }
314
- catch (e) {
315
- settle(q[0][3], e);
316
- } }
317
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
318
- function fulfill(value) { resume("next", value); }
319
- function reject(value) { resume("throw", value); }
320
- function settle(f, v) { if (f(v), q.shift(), q.length)
321
- resume(q[0][0], q[0][1]); }
322
- }
323
- function __asyncDelegator(o) {
324
- var i, p;
325
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
326
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
327
- }
328
- function __asyncValues(o) {
329
- if (!Symbol.asyncIterator)
330
- throw new TypeError("Symbol.asyncIterator is not defined.");
331
- var m = o[Symbol.asyncIterator], i;
332
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
333
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
334
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
335
- }
336
- function __makeTemplateObject(cooked, raw) {
337
- if (Object.defineProperty) {
338
- Object.defineProperty(cooked, "raw", { value: raw });
339
- }
340
- else {
341
- cooked.raw = raw;
342
- }
343
- return cooked;
344
- }
345
- ;
346
- var __setModuleDefault = Object.create ? (function (o, v) {
347
- Object.defineProperty(o, "default", { enumerable: true, value: v });
348
- }) : function (o, v) {
349
- o["default"] = v;
350
- };
351
- function __importStar(mod) {
352
- if (mod && mod.__esModule)
353
- return mod;
354
- var result = {};
355
- if (mod != null)
356
- for (var k in mod)
357
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
358
- __createBinding(result, mod, k);
359
- __setModuleDefault(result, mod);
360
- return result;
361
- }
362
- function __importDefault(mod) {
363
- return (mod && mod.__esModule) ? mod : { default: mod };
364
- }
365
- function __classPrivateFieldGet(receiver, state, kind, f) {
366
- if (kind === "a" && !f)
367
- throw new TypeError("Private accessor was defined without a getter");
368
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
369
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
370
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
371
- }
372
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
373
- if (kind === "m")
374
- throw new TypeError("Private method is not writable");
375
- if (kind === "a" && !f)
376
- throw new TypeError("Private accessor was defined without a setter");
377
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
378
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
379
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
380
- }
381
-
382
- var Select2Utils = /** @class */ (function () {
383
- function Select2Utils() {
384
- }
385
- /**
386
- * @param {?} data
387
- * @param {?} value
388
- * @return {?}
389
- */
390
- Select2Utils.getOptionByValue = function (data, value) {
391
- var e_1, _a, e_2, _b;
392
- if (Array.isArray(data)) {
393
- try {
394
- for (var data_1 = __values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
395
- var groupOrOption = data_1_1.value;
396
- /** @type {?} */
397
- var options = (( /** @type {?} */(groupOrOption))).options;
398
- if (options) {
399
- try {
400
- for (var options_1 = (e_2 = void 0, __values(options)), options_1_1 = options_1.next(); !options_1_1.done; options_1_1 = options_1.next()) {
401
- var option = options_1_1.value;
402
- if (option.value === value) {
403
- return option;
404
- }
405
- }
406
- }
407
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
408
- finally {
409
- try {
410
- if (options_1_1 && !options_1_1.done && (_b = options_1.return)) _b.call(options_1);
411
- }
412
- finally { if (e_2) throw e_2.error; }
413
- }
414
- }
415
- else {
416
- if ((( /** @type {?} */(groupOrOption))).value === value) {
417
- return ( /** @type {?} */(groupOrOption));
418
- }
419
- }
420
- }
421
- }
422
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
423
- finally {
424
- try {
425
- if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1);
426
- }
427
- finally { if (e_1) throw e_1.error; }
428
- }
429
- }
430
- return null;
431
- };
432
- /**
433
- * @param {?} data
434
- * @param {?} value
435
- * @param {?} multiple
436
- * @return {?}
437
- */
438
- Select2Utils.getOptionsByValue = function (data, value, multiple) {
439
- var e_3, _a;
440
- if (multiple) {
441
- /** @type {?} */
442
- var values = Array.isArray(value) ? value : [];
443
- /** @type {?} */
444
- var result = [];
445
- try {
446
- for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
447
- var v = values_1_1.value;
448
- /** @type {?} */
449
- var option = Select2Utils.getOptionByValue(data, v);
450
- if (option) {
451
- result.push(option);
452
- }
453
- }
454
- }
455
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
456
- finally {
457
- try {
458
- if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
459
- }
460
- finally { if (e_3) throw e_3.error; }
461
- }
462
- return result;
463
- }
464
- return Select2Utils.getOptionByValue(data, ( /** @type {?} */(value)));
465
- };
466
- /**
467
- * @param {?} data
468
- * @return {?}
469
- */
470
- Select2Utils.getFirstAvailableOption = function (data) {
471
- var e_4, _a, e_5, _b;
472
- if (Array.isArray(data)) {
473
- try {
474
- for (var data_2 = __values(data), data_2_1 = data_2.next(); !data_2_1.done; data_2_1 = data_2.next()) {
475
- var groupOrOption = data_2_1.value;
476
- /** @type {?} */
477
- var options = (( /** @type {?} */(groupOrOption))).options;
478
- if (options) {
479
- try {
480
- for (var options_2 = (e_5 = void 0, __values(options)), options_2_1 = options_2.next(); !options_2_1.done; options_2_1 = options_2.next()) {
481
- var option = options_2_1.value;
482
- if (!option.disabled) {
483
- return option.value;
484
- }
485
- }
486
- }
487
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
488
- finally {
489
- try {
490
- if (options_2_1 && !options_2_1.done && (_b = options_2.return)) _b.call(options_2);
491
- }
492
- finally { if (e_5) throw e_5.error; }
493
- }
494
- }
495
- else {
496
- /** @type {?} */
497
- var option = ( /** @type {?} */(groupOrOption));
498
- if (!option.disabled) {
499
- return option.value;
500
- }
501
- }
502
- }
503
- }
504
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
505
- finally {
506
- try {
507
- if (data_2_1 && !data_2_1.done && (_a = data_2.return)) _a.call(data_2);
508
- }
509
- finally { if (e_4) throw e_4.error; }
510
- }
511
- }
512
- return null;
513
- };
514
- /**
515
- * @private
516
- * @param {?} data
517
- * @return {?}
518
- */
519
- Select2Utils.getOptionsCount = function (data) {
520
- var e_6, _a;
521
- /** @type {?} */
522
- var count = 0;
523
- if (Array.isArray(data)) {
524
- try {
525
- for (var data_3 = __values(data), data_3_1 = data_3.next(); !data_3_1.done; data_3_1 = data_3.next()) {
526
- var groupOrOption = data_3_1.value;
527
- /** @type {?} */
528
- var options = (( /** @type {?} */(groupOrOption))).options;
529
- if (options) {
530
- count += options.length;
531
- }
532
- else {
533
- count++;
534
- }
535
- }
536
- }
537
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
538
- finally {
539
- try {
540
- if (data_3_1 && !data_3_1.done && (_a = data_3.return)) _a.call(data_3);
541
- }
542
- finally { if (e_6) throw e_6.error; }
543
- }
544
- }
545
- return count;
546
- };
547
- /**
548
- * @param {?} filteredData
549
- * @param {?} value
550
- * @return {?}
551
- */
552
- Select2Utils.valueIsNotInFilteredData = function (filteredData, value) {
553
- var e_7, _a, e_8, _b;
554
- if (Select2Utils.isNullOrUndefined(value)) {
555
- return true;
556
- }
557
- try {
558
- for (var filteredData_1 = __values(filteredData), filteredData_1_1 = filteredData_1.next(); !filteredData_1_1.done; filteredData_1_1 = filteredData_1.next()) {
559
- var groupOrOption = filteredData_1_1.value;
560
- /** @type {?} */
561
- var options = (( /** @type {?} */(groupOrOption))).options;
562
- if (options) {
563
- try {
564
- for (var options_3 = (e_8 = void 0, __values(options)), options_3_1 = options_3.next(); !options_3_1.done; options_3_1 = options_3.next()) {
565
- var option = options_3_1.value;
566
- if (option.value === value) {
567
- return false;
568
- }
569
- }
570
- }
571
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
572
- finally {
573
- try {
574
- if (options_3_1 && !options_3_1.done && (_b = options_3.return)) _b.call(options_3);
575
- }
576
- finally { if (e_8) throw e_8.error; }
577
- }
578
- }
579
- else {
580
- if ((( /** @type {?} */(groupOrOption))).value === value) {
581
- return false;
582
- }
583
- }
584
- }
585
- }
586
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
587
- finally {
588
- try {
589
- if (filteredData_1_1 && !filteredData_1_1.done && (_a = filteredData_1.return)) _a.call(filteredData_1);
590
- }
591
- finally { if (e_7) throw e_7.error; }
592
- }
593
- return true;
594
- };
595
- // tslint:disable-next-line:cognitive-complexity
596
- /**
597
- * @param {?} filteredData
598
- * @param {?} hoveringValue
599
- * @return {?}
600
- */
601
- Select2Utils.getPreviousOption = function (filteredData, hoveringValue) {
602
- /** @type {?} */
603
- var findIt = Select2Utils.isNullOrUndefined(hoveringValue);
604
- for (var i = filteredData.length - 1; i >= 0; i--) {
605
- /** @type {?} */
606
- var groupOrOption = filteredData[i];
607
- /** @type {?} */
608
- var options = (( /** @type {?} */(groupOrOption))).options;
609
- if (options) {
610
- for (var j = options.length - 1; j >= 0; j--) {
611
- /** @type {?} */
612
- var option = options[j];
613
- if (findIt) {
614
- if (!option.disabled && !option.hide) {
615
- return option;
616
- }
617
- }
618
- if (!findIt) {
619
- findIt = option.value === hoveringValue;
620
- }
621
- }
622
- }
623
- else {
624
- /** @type {?} */
625
- var option = ( /** @type {?} */(groupOrOption));
626
- if (findIt) {
627
- if (!option.disabled && !option.hide) {
628
- return option;
629
- }
630
- }
631
- if (!findIt) {
632
- findIt = option.value === hoveringValue;
633
- }
634
- }
635
- }
636
- return null;
637
- };
638
- // tslint:disable-next-line:cognitive-complexity
639
- /**
640
- * @param {?} filteredData
641
- * @param {?} hoveringValue
642
- * @return {?}
643
- */
644
- Select2Utils.getNextOption = function (filteredData, hoveringValue) {
645
- var e_9, _a, e_10, _b;
646
- /** @type {?} */
647
- var findIt = Select2Utils.isNullOrUndefined(hoveringValue);
648
- try {
649
- for (var filteredData_2 = __values(filteredData), filteredData_2_1 = filteredData_2.next(); !filteredData_2_1.done; filteredData_2_1 = filteredData_2.next()) {
650
- var groupOrOption = filteredData_2_1.value;
651
- /** @type {?} */
652
- var options = (( /** @type {?} */(groupOrOption))).options;
653
- if (options) {
654
- try {
655
- for (var options_4 = (e_10 = void 0, __values(options)), options_4_1 = options_4.next(); !options_4_1.done; options_4_1 = options_4.next()) {
656
- var option = options_4_1.value;
657
- if (findIt) {
658
- if (!option.disabled && !option.hide) {
659
- return option;
660
- }
661
- }
662
- else if (!findIt) {
663
- findIt = option.value === hoveringValue;
664
- }
665
- }
666
- }
667
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
668
- finally {
669
- try {
670
- if (options_4_1 && !options_4_1.done && (_b = options_4.return)) _b.call(options_4);
671
- }
672
- finally { if (e_10) throw e_10.error; }
673
- }
674
- }
675
- else {
676
- /** @type {?} */
677
- var option = ( /** @type {?} */(groupOrOption));
678
- if (findIt) {
679
- if (!option.disabled && !option.hide) {
680
- return option;
681
- }
682
- }
683
- else if (!findIt) {
684
- findIt = option.value === hoveringValue;
685
- }
686
- }
687
- }
688
- }
689
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
690
- finally {
691
- try {
692
- if (filteredData_2_1 && !filteredData_2_1.done && (_a = filteredData_2.return)) _a.call(filteredData_2);
693
- }
694
- finally { if (e_9) throw e_9.error; }
695
- }
696
- return null;
697
- };
698
- /**
699
- * @private
700
- * @param {?} value
701
- * @return {?}
702
- */
703
- Select2Utils.isNullOrUndefined = function (value) {
704
- return value === null || value === undefined;
705
- };
706
- /**
707
- * @private
708
- * @param {?} label
709
- * @param {?} searchText
710
- * @param {?} editPattern
711
- * @return {?}
712
- */
713
- Select2Utils.containSearchText = function (label, searchText, editPattern) {
714
- return searchText
715
- ? Select2Utils.formatSansUnicode(label).match(new RegExp(Select2Utils.formatPattern(searchText, editPattern), 'i')) !== null
716
- : true;
717
- };
718
- /**
719
- * @private
720
- * @param {?} str
721
- * @return {?}
722
- */
723
- Select2Utils.protectPattern = function (str) {
724
- return str.replace(protectRegexp, '\\$&');
725
- };
726
- /**
727
- * @private
728
- * @param {?} str
729
- * @return {?}
730
- */
731
- Select2Utils.formatSansUnicode = function (str) {
732
- var e_11, _a;
733
- try {
734
- for (var unicodePatterns_1 = __values(unicodePatterns), unicodePatterns_1_1 = unicodePatterns_1.next(); !unicodePatterns_1_1.done; unicodePatterns_1_1 = unicodePatterns_1.next()) {
735
- var unicodePattern = unicodePatterns_1_1.value;
736
- str = str.replace(unicodePattern.s, unicodePattern.l);
737
- }
738
- }
739
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
740
- finally {
741
- try {
742
- if (unicodePatterns_1_1 && !unicodePatterns_1_1.done && (_a = unicodePatterns_1.return)) _a.call(unicodePatterns_1);
743
- }
744
- finally { if (e_11) throw e_11.error; }
745
- }
746
- return str;
747
- };
748
- /**
749
- * @private
750
- * @param {?} str
751
- * @param {?} editPattern
752
- * @return {?}
753
- */
754
- Select2Utils.formatPattern = function (str, editPattern) {
755
- str = Select2Utils.formatSansUnicode(Select2Utils.protectPattern(str));
756
- if (editPattern && typeof editPattern === 'function') {
757
- str = editPattern(str);
758
- }
759
- return str;
760
- };
761
- /**
762
- * @param {?} data
763
- * @param {?} searchText
764
- * @param {?=} editPattern
765
- * @return {?}
766
- */
767
- Select2Utils.getFilteredData = function (data, searchText, editPattern) {
768
- var e_12, _a;
769
- if (searchText) {
770
- /** @type {?} */
771
- var result = [];
772
- try {
773
- for (var data_4 = __values(data), data_4_1 = data_4.next(); !data_4_1.done; data_4_1 = data_4.next()) {
774
- var groupOrOption = data_4_1.value;
775
- /** @type {?} */
776
- var options = (( /** @type {?} */(groupOrOption))).options;
777
- if (options) {
778
- if (options.some(( /**
779
- * @param {?} group
780
- * @return {?}
781
- */function (/**
782
- * @param {?} group
783
- * @return {?}
784
- */ group) { return Select2Utils.containSearchText(group.label, searchText, editPattern); }))) {
785
- /** @type {?} */
786
- var filteredOptions = options.filter(( /**
787
- * @param {?} group
788
- * @return {?}
789
- */function (/**
790
- * @param {?} group
791
- * @return {?}
792
- */ group) { return Select2Utils.containSearchText(group.label, searchText, editPattern); }));
793
- result.push({
794
- label: groupOrOption.label,
795
- options: filteredOptions,
796
- });
797
- }
798
- }
799
- else if (Select2Utils.containSearchText(groupOrOption.label, searchText, editPattern)) {
800
- result.push(groupOrOption);
801
- }
802
- }
803
- }
804
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
805
- finally {
806
- try {
807
- if (data_4_1 && !data_4_1.done && (_a = data_4.return)) _a.call(data_4);
808
- }
809
- finally { if (e_12) throw e_12.error; }
810
- }
811
- return result;
812
- }
813
- else {
814
- return data;
815
- }
816
- };
817
- /**
818
- * @param {?} data
819
- * @param {?} selectedOptions
820
- * @return {?}
821
- */
822
- Select2Utils.getFilteredSelectedData = function (data, selectedOptions) {
823
- var e_13, _a;
824
- /** @type {?} */
825
- var result = [];
826
- try {
827
- for (var data_5 = __values(data), data_5_1 = data_5.next(); !data_5_1.done; data_5_1 = data_5.next()) {
828
- var groupOrOption = data_5_1.value;
829
- /** @type {?} */
830
- var options = (( /** @type {?} */(groupOrOption))).options;
831
- if (options) {
832
- /** @type {?} */
833
- var filteredOptions = options.filter(( /**
834
- * @param {?} group
835
- * @return {?}
836
- */function (/**
837
- * @param {?} group
838
- * @return {?}
839
- */ group) { return Select2Utils.isSelected(selectedOptions, group, true) === 'false'; }));
840
- if (filteredOptions.length) {
841
- result.push({
842
- label: groupOrOption.label,
843
- options: filteredOptions,
844
- });
845
- }
846
- }
847
- else if (Select2Utils.isSelected(selectedOptions, ( /** @type {?} */(groupOrOption)), true) === 'false') {
848
- result.push(groupOrOption);
849
- }
850
- }
851
- }
852
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
853
- finally {
854
- try {
855
- if (data_5_1 && !data_5_1.done && (_a = data_5.return)) _a.call(data_5);
856
- }
857
- finally { if (e_13) throw e_13.error; }
858
- }
859
- return result;
860
- };
861
- /**
862
- * @param {?} data
863
- * @param {?=} minCountForSearch
864
- * @return {?}
865
- */
866
- Select2Utils.isSearchboxHiddex = function (data, minCountForSearch) {
867
- if (minCountForSearch === '' ||
868
- minCountForSearch === undefined ||
869
- minCountForSearch === null ||
870
- isNaN(+minCountForSearch)) {
871
- minCountForSearch = defaultMinCountForSearch;
872
- }
873
- /** @type {?} */
874
- var optionCount = Select2Utils.getOptionsCount(data);
875
- return optionCount < +minCountForSearch;
876
- };
877
- /**
878
- * @param {?} options
879
- * @param {?} option
880
- * @param {?} multiple
881
- * @return {?}
882
- */
883
- Select2Utils.isSelected = function (options, option, multiple) {
884
- return multiple
885
- ? options && (( /** @type {?} */(options))).some(( /**
886
- * @param {?} op
887
- * @return {?}
888
- */function (/**
889
- * @param {?} op
890
- * @return {?}
891
- */ op) { return op.value === option.value; }))
892
- ? 'true'
893
- : 'false'
894
- : options && option.value === (( /** @type {?} */(options))).value
895
- ? 'true'
896
- : 'false';
897
- };
898
- /**
899
- * @param {?} options
900
- * @param {?} option
901
- * @return {?}
902
- */
903
- Select2Utils.removeSelection = function (options, option) {
904
- for (var i = 0; i < (( /** @type {?} */(options))).length; i++) {
905
- if ((( /** @type {?} */(options)))[i].value === option.value) {
906
- (( /** @type {?} */(options))).splice(i, 1);
907
- return;
908
- }
909
- }
910
- };
911
- return Select2Utils;
912
- }());
913
-
914
- /** @type {?} */
915
- var nextUniqueId = 0;
916
- /** @type {?} */
917
- var displaySearchStatusList = ['default', 'hidden', 'always'];
918
- var Select2 = /** @class */ (function () {
919
- /**
920
- * @param {?} _viewportRuler
921
- * @param {?} _changeDetectorRef
922
- * @param {?} _parentForm
923
- * @param {?} _parentFormGroup
924
- * @param {?} _control
925
- * @param {?} tabIndex
926
- */
927
- function Select2(_viewportRuler, _changeDetectorRef, _parentForm, _parentFormGroup, _control, tabIndex) {
928
- this._viewportRuler = _viewportRuler;
929
- this._changeDetectorRef = _changeDetectorRef;
930
- this._parentForm = _parentForm;
931
- this._parentFormGroup = _parentFormGroup;
932
- this._control = _control;
933
- this.minCharForSearch = 0;
934
- this.limitSelection = 0;
935
- this.listPosition = 'below';
936
- /**
937
- * use the material style
938
- */
939
- this.styleMode = 'default';
940
- /**
941
- * infinite scroll distance
942
- */
943
- this.infiniteScrollDistance = 1.5;
944
- /**
945
- * infinite scroll distance
946
- */
947
- this.infiniteScrollThrottle = 150;
948
- /**
949
- * the max height of the results container when opening the select
950
- */
951
- this.resultMaxHeight = '200px';
952
- this.update = new core.EventEmitter();
953
- this.open = new core.EventEmitter();
954
- this.close = new core.EventEmitter();
955
- this.focus = new core.EventEmitter();
956
- this.blur = new core.EventEmitter();
957
- this.search = new core.EventEmitter();
958
- this.scroll = new core.EventEmitter();
959
- this.removeOption = new core.EventEmitter();
960
- this.option = null;
961
- this.isOpen = false;
962
- /**
963
- * Whether the element is focused or not.
964
- */
965
- this.focused = false;
966
- this.hoveringValue = null;
967
- this.innerSearchText = '';
968
- this._stateChanges = new rxjs.Subject();
969
- this._disabled = false;
970
- this._required = false;
971
- this._readonly = false;
972
- this._multiple = false;
973
- this._overlay = false;
974
- this._resettable = false;
975
- this._hideSelectedItems = false;
976
- this._clickDetection = false;
977
- this._uid = "select2-" + nextUniqueId++;
978
- this._infiniteScroll = true;
979
- /**
980
- * View -> model callback called when select has been touched
981
- */
982
- this._onTouched = ( /**
983
- * @return {?}
984
- */function () {
985
- // do nothing
986
- });
987
- /**
988
- * View -> model callback called when value changes
989
- */
990
- this._onChange = ( /**
991
- * @return {?}
992
- */function () {
993
- // do nothing
994
- });
995
- this.id = this.id;
996
- this._tabIndex = parseInt(tabIndex, 10) || 0;
997
- if (this._control) {
998
- this._control.valueAccessor = this;
999
- }
1000
- this._clickDetectionFc = this.clickDetection.bind(this);
1001
- }
1002
- Object.defineProperty(Select2.prototype, "multiple", {
1003
- /**
1004
- * @return {?}
1005
- */
1006
- get: function () {
1007
- return this._multiple;
1008
- },
1009
- /**
1010
- * @param {?} value
1011
- * @return {?}
1012
- */
1013
- set: function (value) {
1014
- this._multiple = this._coerceBooleanProperty(value);
1015
- this.ngOnInit();
1016
- },
1017
- enumerable: false,
1018
- configurable: true
1019
- });
1020
- Object.defineProperty(Select2.prototype, "overlay", {
1021
- /**
1022
- * use the material style
1023
- * @return {?}
1024
- */
1025
- get: function () {
1026
- return this._overlay;
1027
- },
1028
- /**
1029
- * @param {?} value
1030
- * @return {?}
1031
- */
1032
- set: function (value) {
1033
- this._overlay = this._coerceBooleanProperty(value);
1034
- },
1035
- enumerable: false,
1036
- configurable: true
1037
- });
1038
- Object.defineProperty(Select2.prototype, "infiniteScroll", {
1039
- /**
1040
- * infinite scroll activated
1041
- * @return {?}
1042
- */
1043
- get: function () {
1044
- return this._infiniteScroll;
1045
- },
1046
- /**
1047
- * @param {?} value
1048
- * @return {?}
1049
- */
1050
- set: function (value) {
1051
- this._infiniteScroll = this._coerceBooleanProperty(value);
1052
- },
1053
- enumerable: false,
1054
- configurable: true
1055
- });
1056
- Object.defineProperty(Select2.prototype, "select2Options", {
1057
- /**
1058
- * @return {?}
1059
- */
1060
- get: function () {
1061
- return this.multiple ? (( /** @type {?} */(this.option))) : null;
1062
- },
1063
- enumerable: false,
1064
- configurable: true
1065
- });
1066
- Object.defineProperty(Select2.prototype, "select2Option", {
1067
- /**
1068
- * @return {?}
1069
- */
1070
- get: function () {
1071
- return this.multiple ? null : (( /** @type {?} */(this.option)));
1072
- },
1073
- enumerable: false,
1074
- configurable: true
1075
- });
1076
- Object.defineProperty(Select2.prototype, "searchText", {
1077
- /**
1078
- * @return {?}
1079
- */
1080
- get: function () {
1081
- return this.innerSearchText;
1082
- },
1083
- /**
1084
- * @param {?} text
1085
- * @return {?}
1086
- */
1087
- set: function (text) {
1088
- if (this.customSearchEnabled) {
1089
- this.search.emit({
1090
- component: this,
1091
- value: this._value,
1092
- search: text,
1093
- });
1094
- }
1095
- this.innerSearchText = text;
1096
- },
1097
- enumerable: false,
1098
- configurable: true
1099
- });
1100
- Object.defineProperty(Select2.prototype, "minCountForSearch", {
1101
- /**
1102
- * minimal data of show the search field
1103
- * @return {?}
1104
- */
1105
- get: function () {
1106
- return this._minCountForSearch;
1107
- },
1108
- /**
1109
- * @param {?} value
1110
- * @return {?}
1111
- */
1112
- set: function (value) {
1113
- this._minCountForSearch = value;
1114
- this.updateSearchBox();
1115
- },
1116
- enumerable: false,
1117
- configurable: true
1118
- });
1119
- Object.defineProperty(Select2.prototype, "id", {
1120
- /**
1121
- * Unique id of the element.
1122
- * @return {?}
1123
- */
1124
- get: function () {
1125
- return this._id;
1126
- },
1127
- /**
1128
- * @param {?} value
1129
- * @return {?}
1130
- */
1131
- set: function (value) {
1132
- this._id = value || this._uid;
1133
- },
1134
- enumerable: false,
1135
- configurable: true
1136
- });
1137
- Object.defineProperty(Select2.prototype, "required", {
1138
- /**
1139
- * Whether the element is required.
1140
- * @return {?}
1141
- */
1142
- get: function () {
1143
- return this._required;
1144
- },
1145
- /**
1146
- * @param {?} value
1147
- * @return {?}
1148
- */
1149
- set: function (value) {
1150
- this._required = this._coerceBooleanProperty(value);
1151
- },
1152
- enumerable: false,
1153
- configurable: true
1154
- });
1155
- Object.defineProperty(Select2.prototype, "disabled", {
1156
- /**
1157
- * Whether selected items should be hidden.
1158
- * @return {?}
1159
- */
1160
- get: function () {
1161
- return this._control ? this._control.disabled : this._disabled;
1162
- },
1163
- /**
1164
- * @param {?} value
1165
- * @return {?}
1166
- */
1167
- set: function (value) {
1168
- this._disabled = this._coerceBooleanProperty(value);
1169
- },
1170
- enumerable: false,
1171
- configurable: true
1172
- });
1173
- Object.defineProperty(Select2.prototype, "hideSelectedItems", {
1174
- /**
1175
- * Whether items are hidden when has.
1176
- * @return {?}
1177
- */
1178
- get: function () {
1179
- return this._hideSelectedItems;
1180
- },
1181
- /**
1182
- * @param {?} value
1183
- * @return {?}
1184
- */
1185
- set: function (value) {
1186
- this._hideSelectedItems = this._coerceBooleanProperty(value);
1187
- },
1188
- enumerable: false,
1189
- configurable: true
1190
- });
1191
- Object.defineProperty(Select2.prototype, "readonly", {
1192
- /**
1193
- * Whether the element is readonly.
1194
- * @return {?}
1195
- */
1196
- get: function () {
1197
- return this._readonly;
1198
- },
1199
- /**
1200
- * @param {?} value
1201
- * @return {?}
1202
- */
1203
- set: function (value) {
1204
- this._readonly = this._coerceBooleanProperty(value);
1205
- },
1206
- enumerable: false,
1207
- configurable: true
1208
- });
1209
- Object.defineProperty(Select2.prototype, "value", {
1210
- /**
1211
- * The input element's value.
1212
- * @return {?}
1213
- */
1214
- get: function () {
1215
- return this._value;
1216
- },
1217
- /**
1218
- * @param {?} value
1219
- * @return {?}
1220
- */
1221
- set: function (value) {
1222
- var _this = this;
1223
- if (this.testValueChange(this._value, value)) {
1224
- setTimeout(( /**
1225
- * @return {?}
1226
- */function () {
1227
- _this._value = value;
1228
- _this.writeValue(value);
1229
- }), 10);
1230
- }
1231
- },
1232
- enumerable: false,
1233
- configurable: true
1234
- });
1235
- Object.defineProperty(Select2.prototype, "tabIndex", {
1236
- /**
1237
- * Tab index for the select2 element.
1238
- * @return {?}
1239
- */
1240
- get: function () {
1241
- return this.disabled ? -1 : this._tabIndex;
1242
- },
1243
- /**
1244
- * @param {?} value
1245
- * @return {?}
1246
- */
1247
- set: function (value) {
1248
- if (typeof value !== 'undefined') {
1249
- this._tabIndex = value;
1250
- }
1251
- },
1252
- enumerable: false,
1253
- configurable: true
1254
- });
1255
- Object.defineProperty(Select2.prototype, "resettable", {
1256
- /**
1257
- * reset with no selected value
1258
- * @return {?}
1259
- */
1260
- get: function () {
1261
- return this._resettable;
1262
- },
1263
- /**
1264
- * @param {?} value
1265
- * @return {?}
1266
- */
1267
- set: function (value) {
1268
- this._resettable = this._coerceBooleanProperty(value);
1269
- },
1270
- enumerable: false,
1271
- configurable: true
1272
- });
1273
- Object.defineProperty(Select2.prototype, "ariaInvalid", {
1274
- /**
1275
- * @return {?}
1276
- */
1277
- get: function () {
1278
- return this._isErrorState();
1279
- },
1280
- enumerable: false,
1281
- configurable: true
1282
- });
1283
- Object.defineProperty(Select2.prototype, "classMaterial", {
1284
- /**
1285
- * @return {?}
1286
- */
1287
- get: function () {
1288
- return this.styleMode === 'material';
1289
- },
1290
- enumerable: false,
1291
- configurable: true
1292
- });
1293
- Object.defineProperty(Select2.prototype, "classNostyle", {
1294
- /**
1295
- * @return {?}
1296
- */
1297
- get: function () {
1298
- return this.styleMode === 'noStyle';
1299
- },
1300
- enumerable: false,
1301
- configurable: true
1302
- });
1303
- Object.defineProperty(Select2.prototype, "select2above", {
1304
- /**
1305
- * @return {?}
1306
- */
1307
- get: function () {
1308
- return !this.overlay ? this.listPosition === 'above' : this._isAbobeOverlay();
1309
- },
1310
- enumerable: false,
1311
- configurable: true
1312
- });
1313
- Object.defineProperty(Select2.prototype, "_positions", {
1314
- /**
1315
- * @return {?}
1316
- */
1317
- get: function () {
1318
- if (this.listPosition === 'auto') {
1319
- [
1320
- {
1321
- originX: 'start',
1322
- originY: 'bottom',
1323
- overlayX: 'start',
1324
- overlayY: 'bottom',
1325
- },
1326
- {
1327
- originX: 'start',
1328
- originY: 'top',
1329
- overlayX: 'start',
1330
- overlayY: 'top',
1331
- },
1332
- ];
1333
- }
1334
- else {
1335
- return null;
1336
- }
1337
- },
1338
- enumerable: false,
1339
- configurable: true
1340
- });
1341
- Object.defineProperty(Select2.prototype, "resultsElement", {
1342
- /**
1343
- * @private
1344
- * @return {?}
1345
- */
1346
- get: function () {
1347
- var _a;
1348
- return (_a = this.resultContainer) === null || _a === void 0 ? void 0 : _a.nativeElement;
1349
- },
1350
- enumerable: false,
1351
- configurable: true
1352
- });
1353
- /**
1354
- * @return {?}
1355
- */
1356
- Select2.prototype.ngOnInit = function () {
1357
- var _this = this;
1358
- this._viewportRuler.change(100).subscribe(( /**
1359
- * @return {?}
1360
- */function () {
1361
- if (_this.isOpen) {
1362
- _this.triggerRect();
1363
- }
1364
- }));
1365
- /** @type {?} */
1366
- var option = Select2Utils.getOptionsByValue(this.data, this._control ? this._control.value : this.value, this.multiple);
1367
- if (option !== null) {
1368
- this.option = option;
1369
- }
1370
- if (!Array.isArray(option)) {
1371
- this.hoveringValue = ( /** @type {?} */(this.value));
1372
- }
1373
- this.updateSearchBox();
1374
- };
1375
- /**
1376
- * @return {?}
1377
- */
1378
- Select2.prototype.ngAfterViewInit = function () {
1379
- var _this = this;
1380
- this.cdkConnectedOverlay.positionChange.subscribe(( /**
1381
- * @param {?} posChange
1382
- * @return {?}
1383
- */function (posChange) {
1384
- var _a;
1385
- if (_this.listPosition === 'auto' && ((_a = posChange.connectionPair) === null || _a === void 0 ? void 0 : _a.originY) &&
1386
- _this._overlayPosition !== posChange.connectionPair.originY) {
1387
- _this.triggerRect();
1388
- _this._overlayPosition = posChange.connectionPair.originY;
1389
- _this._changeDetectorRef.detectChanges();
1390
- }
1391
- }));
1392
- this.selectionElement = this.selection.nativeElement;
1393
- this.triggerRect();
1394
- };
1395
- /**
1396
- * @return {?}
1397
- */
1398
- Select2.prototype.ngDoCheck = function () {
1399
- var _a;
1400
- this.updateSearchBox();
1401
- this._dirtyCheckNativeValue();
1402
- if (this._triggerRect) {
1403
- if (this.overlayWidth !== this._triggerRect.width) {
1404
- this.overlayWidth = this._triggerRect.width;
1405
- }
1406
- if (((_a = this._dropdownRect) === null || _a === void 0 ? void 0 : _a.height) > 0 && this.overlayHeight !== this._dropdownRect.height) {
1407
- this.overlayHeight = this.listPosition === 'auto' ? this._dropdownRect.height : 0;
1408
- }
1409
- }
1410
- };
1411
- /**
1412
- * @return {?}
1413
- */
1414
- Select2.prototype.ngOnDestroy = function () {
1415
- window.document.body.removeEventListener('click', this._clickDetectionFc);
1416
- };
1417
- /**
1418
- * @return {?}
1419
- */
1420
- Select2.prototype.updateSearchBox = function () {
1421
- /** @type {?} */
1422
- var hidden = this.customSearchEnabled
1423
- ? false
1424
- : Select2Utils.isSearchboxHiddex(this.data, this._minCountForSearch);
1425
- if (this.isSearchboxHidden !== hidden) {
1426
- this.isSearchboxHidden = hidden;
1427
- }
1428
- };
1429
- /**
1430
- * @return {?}
1431
- */
1432
- Select2.prototype.hideSearch = function () {
1433
- /** @type {?} */
1434
- var displaySearchStatus = displaySearchStatusList.indexOf(this.displaySearchStatus) > -1 ? this.displaySearchStatus : 'default';
1435
- return (displaySearchStatus === 'default' && this.isSearchboxHidden) || displaySearchStatus === 'hidden';
1436
- };
1437
- /**
1438
- * @param {?} option
1439
- * @return {?}
1440
- */
1441
- Select2.prototype.getOptionStyle = function (option) {
1442
- return ('select2-results__option ' +
1443
- (option.hide ? 'select2-results__option--hide ' : '') +
1444
- (option.value === this.hoveringValue ? 'select2-results__option--highlighted ' : '') +
1445
- (option.classes || ''));
1446
- };
1447
- /**
1448
- * @param {?} option
1449
- * @return {?}
1450
- */
1451
- Select2.prototype.mouseenter = function (option) {
1452
- if (!option.disabled) {
1453
- this.hoveringValue = option.value;
1454
- }
1455
- };
1456
- /**
1457
- * @param {?} option
1458
- * @return {?}
1459
- */
1460
- Select2.prototype.click = function (option) {
1461
- if (this.testSelection(option)) {
1462
- this.select(option);
1463
- }
1464
- };
1465
- /**
1466
- * @param {?} e
1467
- * @return {?}
1468
- */
1469
- Select2.prototype.reset = function (e) {
1470
- this.select(null);
1471
- e.preventDefault();
1472
- e.stopPropagation();
1473
- };
1474
- /**
1475
- * @param {?} event
1476
- * @return {?}
1477
- */
1478
- Select2.prototype.prevChange = function (event) {
1479
- event.stopPropagation();
1480
- };
1481
- /**
1482
- * @return {?}
1483
- */
1484
- Select2.prototype.toggleOpenAndClose = function () {
1485
- var _this = this;
1486
- if (this.disabled) {
1487
- return;
1488
- }
1489
- this._focus(true);
1490
- this.isOpen = !this.isOpen;
1491
- if (this.isOpen) {
1492
- this.innerSearchText = '';
1493
- this.updateFilteredData();
1494
- this._focusSearchboxOrResultsElement();
1495
- setTimeout(( /**
1496
- * @return {?}
1497
- */function () {
1498
- if (_this.option) {
1499
- /** @type {?} */
1500
- var option = _this.option instanceof Array ? _this.option[0] : _this.option;
1501
- _this.updateScrollFromOption(option);
1502
- }
1503
- else if (_this.resultsElement) {
1504
- _this.resultsElement.scrollTop = 0;
1505
- }
1506
- setTimeout(( /**
1507
- * @return {?}
1508
- */function () {
1509
- var _a, _b;
1510
- _this.triggerRect();
1511
- (_b = (_a = _this.cdkConnectedOverlay) === null || _a === void 0 ? void 0 : _a.overlayRef) === null || _b === void 0 ? void 0 : _b.updatePosition();
1512
- }), 100);
1513
- }));
1514
- this.open.emit(this);
1515
- }
1516
- else {
1517
- this.close.emit(this);
1518
- }
1519
- if (this.isOpen && !this._clickDetection) {
1520
- setTimeout(( /**
1521
- * @return {?}
1522
- */function () {
1523
- window.document.body.addEventListener('click', _this._clickDetectionFc, false);
1524
- _this._clickDetection = true;
1525
- }), timeout);
1526
- }
1527
- this._changeDetectorRef.markForCheck();
1528
- };
1529
- /**
1530
- * @param {?} option
1531
- * @param {?} defaut
1532
- * @return {?}
1533
- */
1534
- Select2.prototype.hasTemplate = function (option, defaut) {
1535
- var _a, _b;
1536
- return (this.templates instanceof core.TemplateRef ||
1537
- ((_a = this.templates) === null || _a === void 0 ? void 0 : _a[option.templateId]) instanceof core.TemplateRef ||
1538
- ((_b = this.templates) === null || _b === void 0 ? void 0 : _b[defaut]) instanceof core.TemplateRef);
1539
- };
1540
- /**
1541
- * @param {?} option
1542
- * @param {?} defaut
1543
- * @return {?}
1544
- */
1545
- Select2.prototype.getTemplate = function (option, defaut) {
1546
- return this.hasTemplate(option, defaut)
1547
- ? this.templates[option.templateId] || this.templates[defaut] || this.templates
1548
- : undefined;
1549
- };
1550
- /**
1551
- * @return {?}
1552
- */
1553
- Select2.prototype.triggerRect = function () {
1554
- var _a;
1555
- this._triggerRect = this.selectionElement.getBoundingClientRect();
1556
- this._dropdownRect = ((_a = this.dropdown) === null || _a === void 0 ? void 0 : _a.nativeElement) ? this.dropdown.nativeElement.getBoundingClientRect()
1557
- : undefined;
1558
- };
1559
- /**
1560
- * @private
1561
- * @param {?} option
1562
- * @return {?}
1563
- */
1564
- Select2.prototype.testSelection = function (option) {
1565
- if (option.disabled) {
1566
- return false;
1567
- }
1568
- if (!this.multiple ||
1569
- !this.limitSelection ||
1570
- (Array.isArray(this._value) && this._value.length < this.limitSelection)) {
1571
- return true;
1572
- }
1573
- return false;
1574
- };
1575
- /**
1576
- * @private
1577
- * @param {?} value1
1578
- * @param {?} value2
1579
- * @return {?}
1580
- */
1581
- Select2.prototype.testValueChange = function (value1, value2) {
1582
- var e_1, _c;
1583
- var _a, _b;
1584
- if (((value1 === null || value1 === undefined) && (value2 === null || value2 === undefined)) ||
1585
- value1 === value2) {
1586
- return false;
1587
- }
1588
- if (this.multiple && ((_a = (( /** @type {?} */(value1)))) === null || _a === void 0 ? void 0 : _a.length) && ((_b = (( /** @type {?} */(value2)))) === null || _b === void 0 ? void 0 : _b.length) &&
1589
- (( /** @type {?} */(value1))).length === (( /** @type {?} */(value2))).length) {
1590
- try {
1591
- for (var _d = __values(( /** @type {?} */(value1))), _e = _d.next(); !_e.done; _e = _d.next()) {
1592
- var e1 = _e.value;
1593
- /** @type {?} */
1594
- var test = (( /** @type {?} */(value2))).indexOf(e1) > -1;
1595
- if (!test) {
1596
- return true;
1597
- }
1598
- }
1599
- }
1600
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1601
- finally {
1602
- try {
1603
- if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
1604
- }
1605
- finally { if (e_1) throw e_1.error; }
1606
- }
1607
- return false;
1608
- }
1609
- return true;
1610
- };
1611
- /**
1612
- * @private
1613
- * @return {?}
1614
- */
1615
- Select2.prototype.updateFilteredData = function () {
1616
- var _this = this;
1617
- setTimeout(( /**
1618
- * @return {?}
1619
- */function () {
1620
- /** @type {?} */
1621
- var result = _this.data;
1622
- if (_this.multiple && _this.hideSelectedItems) {
1623
- result = Select2Utils.getFilteredSelectedData(result, _this.option);
1624
- }
1625
- if (!_this.customSearchEnabled && _this.searchText && _this.searchText.length >= +_this.minCharForSearch) {
1626
- result = Select2Utils.getFilteredData(result, _this.searchText, _this.editPattern);
1627
- }
1628
- if (Select2Utils.valueIsNotInFilteredData(result, _this.hoveringValue)) {
1629
- _this.hoveringValue = Select2Utils.getFirstAvailableOption(result);
1630
- }
1631
- _this.filteredData = result;
1632
- _this._changeDetectorRef.markForCheck();
1633
- }));
1634
- };
1635
- /**
1636
- * @private
1637
- * @param {?} e
1638
- * @return {?}
1639
- */
1640
- Select2.prototype.clickDetection = function (e) {
1641
- if (!this.ifParentContainsClass(( /** @type {?} */(e.target)), 'selection')) {
1642
- if (this.isOpen && !this.ifParentContainsClass(( /** @type {?} */(e.target)), 'select2-dropdown')) {
1643
- this.toggleOpenAndClose();
1644
- }
1645
- if (!this.ifParentContainsId(( /** @type {?} */(e.target)), this._id)) {
1646
- this.clickExit();
1647
- }
1648
- }
1649
- else if (this.isOpen && !this.ifParentContainsId(( /** @type {?} */(e.target)), this._id)) {
1650
- this.toggleOpenAndClose();
1651
- this.clickExit();
1652
- }
1653
- };
1654
- /**
1655
- * @private
1656
- * @return {?}
1657
- */
1658
- Select2.prototype.clickExit = function () {
1659
- this._focus(false);
1660
- window.document.body.removeEventListener('click', this._clickDetectionFc);
1661
- this._clickDetection = false;
1662
- };
1663
- /**
1664
- * @private
1665
- * @param {?} element
1666
- * @param {?} cssClass
1667
- * @return {?}
1668
- */
1669
- Select2.prototype.ifParentContainsClass = function (element, cssClass) {
1670
- return this.getParentElementByClass(element, cssClass) !== null;
1671
- };
1672
- /**
1673
- * @private
1674
- * @param {?} element
1675
- * @param {?} id
1676
- * @return {?}
1677
- */
1678
- Select2.prototype.ifParentContainsId = function (element, id) {
1679
- return this.getParentElementById(element, id) !== null;
1680
- };
1681
- /**
1682
- * @private
1683
- * @param {?} element
1684
- * @param {?} cssClass
1685
- * @return {?}
1686
- */
1687
- Select2.prototype.getParentElementByClass = function (element, cssClass) {
1688
- if (this.containClasses(element, cssClass.trim().split(/\s+/))) {
1689
- return element;
1690
- }
1691
- return element.parentElement ? this.getParentElementByClass(element.parentElement, cssClass) : null;
1692
- };
1693
- /**
1694
- * @private
1695
- * @param {?} element
1696
- * @param {?} id
1697
- * @return {?}
1698
- */
1699
- Select2.prototype.getParentElementById = function (element, id) {
1700
- if (element.id === id) {
1701
- return element;
1702
- }
1703
- return element.parentElement ? this.getParentElementById(element.parentElement, id) : null;
1704
- };
1705
- /**
1706
- * @private
1707
- * @param {?} element
1708
- * @param {?} cssClasses
1709
- * @return {?}
1710
- */
1711
- Select2.prototype.containClasses = function (element, cssClasses) {
1712
- var e_2, _c;
1713
- if (!element.classList) {
1714
- return false;
1715
- }
1716
- try {
1717
- for (var cssClasses_1 = __values(cssClasses), cssClasses_1_1 = cssClasses_1.next(); !cssClasses_1_1.done; cssClasses_1_1 = cssClasses_1.next()) {
1718
- var cssClass = cssClasses_1_1.value;
1719
- if (!element.classList.contains(cssClass)) {
1720
- return false;
1721
- }
1722
- }
1723
- }
1724
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1725
- finally {
1726
- try {
1727
- if (cssClasses_1_1 && !cssClasses_1_1.done && (_c = cssClasses_1.return)) _c.call(cssClasses_1);
1728
- }
1729
- finally { if (e_2) throw e_2.error; }
1730
- }
1731
- return true;
1732
- };
1733
- /**
1734
- * @return {?}
1735
- */
1736
- Select2.prototype.focusin = function () {
1737
- if (this.disabled) {
1738
- return;
1739
- }
1740
- this._focus(true);
1741
- };
1742
- /**
1743
- * @return {?}
1744
- */
1745
- Select2.prototype.focusout = function () {
1746
- if (this.selectionElement && !this.selectionElement.classList.contains('select2-focused')) {
1747
- this._focus(false);
1748
- this._onTouched();
1749
- }
1750
- };
1751
- /**
1752
- * @private
1753
- * @return {?}
1754
- */
1755
- Select2.prototype.moveUp = function () {
1756
- this.updateScrollFromOption(Select2Utils.getPreviousOption(this.filteredData, this.hoveringValue));
1757
- };
1758
- /**
1759
- * @private
1760
- * @return {?}
1761
- */
1762
- Select2.prototype.moveDown = function () {
1763
- this.updateScrollFromOption(Select2Utils.getNextOption(this.filteredData, this.hoveringValue));
1764
- };
1765
- /**
1766
- * @private
1767
- * @param {?} option
1768
- * @return {?}
1769
- */
1770
- Select2.prototype.updateScrollFromOption = function (option) {
1771
- if (option) {
1772
- this.hoveringValue = option.value;
1773
- /** @type {?} */
1774
- var domElement = this.results.find(( /**
1775
- * @param {?} r
1776
- * @return {?}
1777
- */function (/**
1778
- * @param {?} r
1779
- * @return {?}
1780
- */ r) { return r.nativeElement.innerText.trim() === option.label; }));
1781
- if (domElement && this.resultsElement) {
1782
- this.resultsElement.scrollTop = 0;
1783
- /** @type {?} */
1784
- var listClientRect = this.resultsElement.getBoundingClientRect();
1785
- /** @type {?} */
1786
- var optionClientRect = domElement.nativeElement.getBoundingClientRect();
1787
- this.resultsElement.scrollTop = optionClientRect.top - listClientRect.top;
1788
- }
1789
- }
1790
- };
1791
- /**
1792
- * @private
1793
- * @return {?}
1794
- */
1795
- Select2.prototype.selectByEnter = function () {
1796
- if (this.hoveringValue) {
1797
- /** @type {?} */
1798
- var option = Select2Utils.getOptionByValue(this.data, this.hoveringValue);
1799
- this.select(option);
1800
- }
1801
- };
1802
- /**
1803
- * @param {?} option
1804
- * @return {?}
1805
- */
1806
- Select2.prototype.select = function (option) {
1807
- /** @type {?} */
1808
- var value;
1809
- if (option !== null) {
1810
- if (this.multiple) {
1811
- /** @type {?} */
1812
- var options = ( /** @type {?} */(this.option));
1813
- /** @type {?} */
1814
- var index = options.findIndex(( /**
1815
- * @param {?} op
1816
- * @return {?}
1817
- */function (/**
1818
- * @param {?} op
1819
- * @return {?}
1820
- */ op) { return op.value === option.value; }));
1821
- if (index === -1) {
1822
- options.push(option);
1823
- }
1824
- else {
1825
- options.splice(index, 1);
1826
- }
1827
- value = (( /** @type {?} */(this.option))).map(( /**
1828
- * @param {?} op
1829
- * @return {?}
1830
- */function (/**
1831
- * @param {?} op
1832
- * @return {?}
1833
- */ op) { return op.value; }));
1834
- }
1835
- else {
1836
- this.option = option;
1837
- if (this.isOpen) {
1838
- this.isOpen = false;
1839
- this.close.emit(this);
1840
- if (this.selectionElement) {
1841
- this.selectionElement.focus();
1842
- }
1843
- }
1844
- value = this.option.value;
1845
- }
1846
- }
1847
- else {
1848
- this.option = null;
1849
- }
1850
- if (this.multiple && this.hideSelectedItems) {
1851
- this.updateFilteredData();
1852
- }
1853
- if (this._control) {
1854
- this._onChange(value);
1855
- }
1856
- else {
1857
- this._value = value;
1858
- }
1859
- this.update.emit({
1860
- component: this,
1861
- value: value,
1862
- options: Array.isArray(this.option) ? this.option : this.option ? [this.option] : null,
1863
- });
1864
- };
1865
- /**
1866
- * @param {?} e
1867
- * @return {?}
1868
- */
1869
- Select2.prototype.keyDown = function (e) {
1870
- if (this._testKey(e, ['ArrowDown', 40])) {
1871
- this.moveDown();
1872
- e.preventDefault();
1873
- }
1874
- else if (this._testKey(e, ['ArrowUp', 38])) {
1875
- this.moveUp();
1876
- e.preventDefault();
1877
- }
1878
- else if (this._testKey(e, ['Enter', 13])) {
1879
- this.selectByEnter();
1880
- e.preventDefault();
1881
- }
1882
- else if (this._testKey(e, ['Escape', 'Tab', 9, 27]) && this.isOpen) {
1883
- this.toggleOpenAndClose();
1884
- this._focus(false);
1885
- }
1886
- };
1887
- /**
1888
- * @param {?} e
1889
- * @return {?}
1890
- */
1891
- Select2.prototype.openKey = function (e) {
1892
- if (this._testKey(e, ['ArrowDown', 'ArrowUp', 'Enter', 40, 38, 13])) {
1893
- this.toggleOpenAndClose();
1894
- e.preventDefault();
1895
- }
1896
- else if (this._testKey(e, ['Escape', 'Tab', 9, 27])) {
1897
- this._focus(false);
1898
- this._onTouched();
1899
- }
1900
- };
1901
- /**
1902
- * @param {?} _index
1903
- * @param {?} item
1904
- * @return {?}
1905
- */
1906
- Select2.prototype.trackBy = function (_index, item) {
1907
- return item.value;
1908
- };
1909
- /**
1910
- * @param {?} e
1911
- * @return {?}
1912
- */
1913
- Select2.prototype.searchUpdate = function (e) {
1914
- this.searchText = (( /** @type {?} */(e.target))).value;
1915
- this.updateFilteredData();
1916
- };
1917
- /**
1918
- * @param {?} option
1919
- * @return {?}
1920
- */
1921
- Select2.prototype.isSelected = function (option) {
1922
- return Select2Utils.isSelected(this.option, option, this.multiple);
1923
- };
1924
- /**
1925
- * @param {?} option
1926
- * @return {?}
1927
- */
1928
- Select2.prototype.isDisabled = function (option) {
1929
- return option.disabled ? 'true' : 'false';
1930
- };
1931
- /**
1932
- * @param {?} e
1933
- * @param {?} option
1934
- * @return {?}
1935
- */
1936
- Select2.prototype.removeSelection = function (e, option) {
1937
- Select2Utils.removeSelection(this.option, option);
1938
- if (this.multiple && this.hideSelectedItems) {
1939
- this.updateFilteredData();
1940
- }
1941
- /** @type {?} */
1942
- var value = (( /** @type {?} */(this.option))).map(( /**
1943
- * @param {?} op
1944
- * @return {?}
1945
- */function (/**
1946
- * @param {?} op
1947
- * @return {?}
1948
- */ op) { return op.value; }));
1949
- if (this._control) {
1950
- this._onChange(value);
1951
- }
1952
- else {
1953
- this._value = value;
1954
- }
1955
- this.update.emit({
1956
- component: this,
1957
- value: value,
1958
- options: Array.isArray(this.option) ? this.option : this.option ? [this.option] : null,
1959
- });
1960
- this.removeOption.emit({
1961
- component: this,
1962
- value: value,
1963
- removedOption: option,
1964
- });
1965
- e.preventDefault();
1966
- e.stopPropagation();
1967
- if (this.isOpen) {
1968
- this._focusSearchboxOrResultsElement();
1969
- }
1970
- };
1971
- /**
1972
- * Sets the model value. Implemented as part of ControlValueAccessor.
1973
- * @param {?} value
1974
- * @return {?}
1975
- */
1976
- Select2.prototype.writeValue = function (value) {
1977
- this._setSelectionByValue(value);
1978
- };
1979
- /**
1980
- * Saves a callback function to be invoked when the select's value
1981
- * changes from user input. Part of the ControlValueAccessor interface
1982
- * required to integrate with Angular's core forms API.
1983
- *
1984
- * @param {?} fn Callback to be triggered when the value changes.
1985
- * @return {?}
1986
- */
1987
- Select2.prototype.registerOnChange = function (fn) {
1988
- this._onChange = fn;
1989
- };
1990
- /**
1991
- * Saves a callback function to be invoked when the select is blurred
1992
- * by the user. Part of the ControlValueAccessor interface required
1993
- * to integrate with Angular's core forms API.
1994
- *
1995
- * @param {?} fn Callback to be triggered when the component has been touched.
1996
- * @return {?}
1997
- */
1998
- Select2.prototype.registerOnTouched = function (fn) {
1999
- this._onTouched = fn;
2000
- };
2001
- /**
2002
- * Sets whether the component should be disabled.
2003
- * Implemented as part of ControlValueAccessor.
2004
- * @param {?} isDisabled
2005
- * @return {?}
2006
- */
2007
- Select2.prototype.setDisabledState = function (isDisabled) {
2008
- this.disabled = isDisabled;
2009
- };
2010
- /**
2011
- * @param {?} way
2012
- * @return {?}
2013
- */
2014
- Select2.prototype.onScroll = function (way) {
2015
- this.scroll.emit({
2016
- component: this,
2017
- way: way,
2018
- search: this.innerSearchText,
2019
- });
2020
- };
2021
- /**
2022
- * @return {?}
2023
- */
2024
- Select2.prototype._isErrorState = function () {
2025
- /** @type {?} */
2026
- var isInvalid = this._control && this._control.invalid;
2027
- /** @type {?} */
2028
- var isTouched = this._control && this._control.touched;
2029
- /** @type {?} */
2030
- var isSubmitted = (this._parentFormGroup && this._parentFormGroup.submitted) ||
2031
- (this._parentForm && this._parentForm.submitted);
2032
- return !!(isInvalid && (isTouched || isSubmitted));
2033
- };
2034
- /**
2035
- * @private
2036
- * @param {?} event
2037
- * @param {?=} refs
2038
- * @return {?}
2039
- */
2040
- Select2.prototype._testKey = function (event, refs) {
2041
- if (refs === void 0) { refs = []; }
2042
- return this._isKey(this._getKey(event), refs);
2043
- };
2044
- /**
2045
- * @private
2046
- * @param {?} event
2047
- * @return {?}
2048
- */
2049
- Select2.prototype._getKey = function (event) {
2050
- /** @type {?} */
2051
- var code;
2052
- if (event.key !== undefined) {
2053
- code = event.key;
2054
- }
2055
- else if (event['keyIdentifier'] !== undefined) {
2056
- code = event['keyIdentifier'];
2057
- }
2058
- else if (event['keyCode'] !== undefined) {
2059
- code = event['keyCode'];
2060
- }
2061
- else {
2062
- event.preventDefault();
2063
- }
2064
- return code;
2065
- };
2066
- /**
2067
- * @private
2068
- * @param {?} code
2069
- * @param {?=} refs
2070
- * @return {?}
2071
- */
2072
- Select2.prototype._isKey = function (code, refs) {
2073
- if (refs === void 0) { refs = []; }
2074
- return refs && refs.length > 0 ? refs.indexOf(code) !== -1 : false;
2075
- };
2076
- /**
2077
- * Sets the selected option based on a value. If no option can be
2078
- * found with the designated value, the select trigger is cleared.
2079
- * @private
2080
- * @param {?} value
2081
- * @return {?}
2082
- */
2083
- Select2.prototype._setSelectionByValue = function (value) {
2084
- var _this = this;
2085
- if (this.option || (value !== undefined && value !== null)) {
2086
- /** @type {?} */
2087
- var isArray = Array.isArray(value);
2088
- if (this.multiple && value && !isArray) {
2089
- throw new Error('Non array value.');
2090
- }
2091
- else if (this.data) {
2092
- if (this.multiple) {
2093
- this.option = []; // if value is null, then empty option and return
2094
- if (isArray) {
2095
- // value is not null. Preselect value
2096
- /** @type {?} */
2097
- var selectedValues = Select2Utils.getOptionsByValue(this.data, value, this.multiple);
2098
- selectedValues.map(( /**
2099
- * @param {?} item
2100
- * @return {?}
2101
- */function (/**
2102
- * @param {?} item
2103
- * @return {?}
2104
- */ item) { return _this.select(item); }));
2105
- }
2106
- }
2107
- else {
2108
- this.select(Select2Utils.getOptionByValue(this.data, value));
2109
- }
2110
- }
2111
- else if (this._control) {
2112
- this._control.viewToModelUpdate(value);
2113
- }
2114
- this._changeDetectorRef.markForCheck();
2115
- }
2116
- };
2117
- /**
2118
- * Does some manual dirty checking on the native input `value` property.
2119
- * @private
2120
- * @return {?}
2121
- */
2122
- Select2.prototype._dirtyCheckNativeValue = function () {
2123
- /** @type {?} */
2124
- var newValue = this.value;
2125
- if (this._previousNativeValue !== newValue) {
2126
- this._previousNativeValue = newValue;
2127
- this._stateChanges.next();
2128
- }
2129
- };
2130
- /**
2131
- * @private
2132
- * @param {?} value
2133
- * @return {?}
2134
- */
2135
- Select2.prototype._coerceBooleanProperty = function (value) {
2136
- return value != null && "" + value !== 'false';
2137
- };
2138
- /**
2139
- * @private
2140
- * @return {?}
2141
- */
2142
- Select2.prototype._focusSearchboxOrResultsElement = function () {
2143
- var _this = this;
2144
- if (!this.isSearchboxHidden) {
2145
- setTimeout(( /**
2146
- * @return {?}
2147
- */function () {
2148
- if (_this.searchInput && _this.searchInput.nativeElement) {
2149
- _this.searchInput.nativeElement.focus();
2150
- }
2151
- }));
2152
- }
2153
- else if (this.resultsElement) {
2154
- this.resultsElement.focus();
2155
- }
2156
- };
2157
- /**
2158
- * @private
2159
- * @param {?} state
2160
- * @return {?}
2161
- */
2162
- Select2.prototype._focus = function (state) {
2163
- if (!state && this.focused) {
2164
- this.focused = state;
2165
- this.blur.emit(this);
2166
- }
2167
- else if (state && !this.focused) {
2168
- this.focused = state;
2169
- this.focus.emit(this);
2170
- }
2171
- };
2172
- /**
2173
- * @private
2174
- * @return {?}
2175
- */
2176
- Select2.prototype._isAbobeOverlay = function () {
2177
- return this.overlay && this._overlayPosition && this.listPosition === 'auto'
2178
- ? this._overlayPosition === 'top'
2179
- : this.listPosition === 'above';
2180
- };
2181
- return Select2;
2182
- }());
2183
- Select2.decorators = [
2184
- { type: core.Component, args: [{
2185
- selector: 'select2',
2186
- template: "<div class=\"select2-label\" (click)=\"toggleOpenAndClose()\">\n <ng-content select=\"select2-label\"></ng-content>\n <span *ngIf=\"required\" class=\"select2-required\"></span>\n</div>\n<div\n class=\"select2 select2-container select2-container--default select2-container--focus\"\n [class.select2-container--below]=\"!select2above\"\n [class.select2-container--above]=\"select2above\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-container--disabled]=\"disabled\"\n>\n <div\n class=\"selection\"\n #selection\n #trigger=\"cdkOverlayOrigin\"\n [attr.tabindex]=\"!this.isOpen ? tabIndex : '-1'\"\n (click)=\"toggleOpenAndClose()\"\n (focus)=\"focusin()\"\n (blur)=\"focusout()\"\n (keydown)=\"openKey($event)\"\n cdkOverlayOrigin\n [class.select2-focused]=\"focused\"\n >\n <div\n class=\"select2-selection\"\n [class.select2-selection--multiple]=\"multiple\"\n [class.select2-selection--single]=\"!multiple\"\n role=\"combobox\"\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__rendered\" [title]=\"select2Option?.label || ''\">\n <span *ngIf=\"!select2Option\">&nbsp;</span>\n <span *ngIf=\"select2Option\" [innerHTML]=\"select2Option.label\"></span>\n <span [class.select2-selection__placeholder__option]=\"option\" class=\"select2-selection__placeholder\">{{\n placeholder\n }}</span>\n </span>\n <span\n (click)=\"reset($event)\"\n *ngIf=\"!multiple && resettable && select2Option\"\n class=\"select2-selection__reset\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__arrow\" role=\"presentation\"> </span>\n <ul *ngIf=\"multiple\" class=\"select2-selection__rendered\">\n <span\n [class.select2-selection__placeholder__option]=\"select2Options?.length > 0\"\n class=\"select2-selection__placeholder\"\n >{{ placeholder }}</span\n >\n <li *ngFor=\"let op of option; trackBy: trackBy\" class=\"select2-selection__choice\" [title]=\"op.label\">\n <span\n (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 </ul>\n </div>\n </div>\n </div>\n</ng-template>\n",
2187
- styles: [".select2-label{color:#000;color:var(--select2-label-text-color,#000)}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;width:100%}.select2-container .select2-container-dropdown{opacity:0;position:absolute;width:0}.select2-container .select2-selection--single{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;flex:1 1 auto;overflow:hidden;padding:0 0 0 8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container .select2-selection--multiple{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{border:none;box-sizing:border-box;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background:#fff;background:var(--select2-dropdown-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-dropdown-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);box-sizing:border-box;display:block;height:0;overflow:hidden;position:absolute;width:100%;z-index:1051}.select2-dropdown .select2-label-content{display:contents}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;color:#000;color:var(--select2-option-text-color,#000);padding:6px;user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container.select2-container-dropdown.select2-container--open{opacity:1;width:100%}.select2-container--open .select2-dropdown{height:auto;overflow:auto}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:27px;display:flex;flex-direction:column-reverse}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{box-sizing:border-box;padding:4px;width:100%}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{background:#fff;border:0;display:block;filter:alpha(opacity=0);height:auto;left:0;margin:0;min-height:100%;min-width:100%;opacity:0;padding:0;position:fixed;top:0;width:auto;z-index:99}.select2-required:before{color:red;color:var(--select2-required-color,red);content:\"*\"}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}.select2-container--default .select2-selection--single{background:#fff;background:var(--select2-selection-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-selection-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);display:flex}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;color:var(--select2-selection-text-color,#444);line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999;color:var(--select2-placeholder-color,#999)}.select2-container--default .select2-selection--single .select2-selection__placeholder span{overflow:hidden;text-overflow:ellipsis;text-overflow:var(--select2-placeholder-overflow,ellipsis);white-space:nowrap}.select2-container--default .select2-selection--single .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--single .select2-selection__arrow,.select2-container--default .select2-selection--single .select2-selection__reset{align-items:center;display:flex;justify-content:center;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow:before{border-bottom:0 solid var(--select2-arrow-color,#888);border-color:#888 transparent;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid var(--select2-arrow-color,#888);content:\" \";height:0;width:0}.select2-container--default .select2-selection--single .select2-selection__reset{color:#999;color:var(--select2-reset-color,#999)}.select2-container--default.select2-container--disabled .select2-selection--single{background:#eee;background:var(--select2-selection-disabled-background,#eee);cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow:before{border-bottom-color:var(--select2-arrow-color,#888);border-color:transparent transparent #888;border-right-color:transparent;border-top-color:transparent;border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background:#fff;background:var(--select2-selection-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-selection-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;flex:1 1 auto;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;color:var(--select2-placeholder-color,#999);display:block;float:left;margin-top:5px;overflow:hidden;text-overflow:ellipsis;text-overflow:var(--select2-placeholder-overflow,ellipsis);white-space:nowrap;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__placeholder__option{display:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px;margin-top:5px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background:#e4e4e4;background:var(--select2-selection-choice-background,#e4e4e4);border:1px solid #aaa;border:1px solid var(--select2-selection-choice-border-color,#aaa);border-radius:4px;border-radius:var(--select2-selection-border-radius,4px);color:#000;color:var(--select2-selection-choice-text-color,#000);cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;color:var(--select2-selection-choice-close-color,#999);cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333;color:var(--select2-selection-choice-hover-close-color,#333)}.select2-container--default.select2-container--focused .select2-selection--multiple,.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple,.select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single{border:1px solid #000;border:1px solid var(--select2-selection-focus-border-color,#000);outline:none}.select2-container--default.select2-container--disabled .select2-selection--multiple{background:#eee;background:var(--select2-selection-disabled-background,#eee);cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{background:#fff;background:1px solid var(--select2-search-background,#fff);border:1px solid #aaa;border:1px solid var(--select2-search-border-color,#aaa);border-radius:0;border-radius:var(--select2-search-border-radius,0)}.select2-container--default .select2-search--inline .select2-search__field{-webkit-appearance:textfield;background:transparent;border:none;box-shadow:none;outline:none}.select2-container--default .select2-results>.select2-results__options{overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{background:transparent;background:var(--select2-option-disabled-background,transparent);color:#999;color:var(--select2-option-disabled-text-color,#999)}.select2-container--default .select2-results__option[aria-selected=true]{background:#ddd;background:var(--select2-option-selected-background,#ddd);color:#000;color:var(--select2-option-selected-text-color,#000)}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background:#5897fb;background:var(--select2-option-highlighted-background,#5897fb);color:#fff;color:var(--select2-option-highlighted-text-color,#fff)}.select2-container--default .select2-results__option--hide{display:none}.select2-container--default .select2-results__group{background:transparent;background:var(--select2-option-group-background,transparent);color:grey;color:var(--select2-option-group-text-color,grey);cursor:default;display:block;padding:6px}.select2-no-result{color:#888;color:var(--select2-no-result-color,#888);font-style:italic;font-style:var(--select2-font-style-color,italic)}:host.nostyle .select2-dropdown{border-color:transparent}:host.nostyle .select2-container--default .select2-focused .select2-selection--multiple,:host.nostyle .select2-container--default .select2-focused .select2-selection--single,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--multiple,:host.nostyle .select2-container--default:not(.select2-container--open) .select2-focused .select2-selection--single,:host.nostyle .select2-selection--multiple,:host.nostyle .select2-selection--single{background:transparent;border-color:transparent}:host.material{display:inline-block;width:300px}:host.material>.select2-container{padding-bottom:1.29688em;vertical-align:inherit}:host.material>.select2-container .selection{align-items:baseline;border-top:.84375em solid transparent;display:inline-flex;height:auto;padding:.4375em 0;width:100%}:host.material .select2-container--default .select2-selection--multiple,:host.material .select2-container--default .select2-selection--single{border:0;border-radius:0;box-sizing:border-box;height:24px;width:100%}:host.material .select2-container--default .select2-selection--multiple:before,:host.material .select2-container--default .select2-selection--single:before{background:#ddd;background:var(--select2-material-underline,#ddd);bottom:1.65em;content:\" \";display:block;height:1px;position:absolute;width:100%}:host.material .select2-container--default .select2-selection--multiple:after,:host.material .select2-container--default .select2-selection--single:after{background:#5a419e;background:var(--select2-material-underline-active,#5a419e);bottom:1.63em;content:\" \";display:block;height:2px;left:50%;position:absolute;transition:none;width:0}:host.material .select2-container--default .select2-selection--multiple .select2-selection__rendered,:host.material .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:inherit;padding-left:1px}:host.material .select2-container--default .select2-selection--multiple .select2-selection__placeholder,:host.material .select2-container--default .select2-selection--single .select2-selection__placeholder{color:rgba(0,0,0,.38);color:var(--select2-material-placeholder-color,rgba(0,0,0,.38));display:block;left:0;position:absolute;top:20px;transform-origin:0 21px;transition:transform .3s}:host.material .select2-container--default .select2-container--open{bottom:1.6em;left:0}:host.material .select2-container--default .select2-selection__placeholder__option{transform:translateY(-1.5em) scale(.75) perspective(100px) translateZ(.001px);width:133.33333%}:host.material .select2-container--default .select2-selection__arrow{top:20px}:host.material .select2-container--default.select2-container--open .select2-selection--multiple:after,:host.material .select2-container--default.select2-container--open .select2-selection--single:after,:host.material .select2-container--default .select2-focused .select2-selection--multiple:after,:host.material .select2-container--default .select2-focused .select2-selection--single:after{left:0;transition:width .3s cubic-bezier(.12,1,.77,1),left .3s cubic-bezier(.12,1,.77,1);width:100%}:host.material .select2-container--default .select2-dropdown{border:0;border-radius:0;box-shadow:0 5px 5px rgba(0,0,0,.5)}:host.material .select2-container--default .select2-results__option--highlighted[aria-selected],:host.material .select2-container--default .select2-results__option[aria-selected=true]{background:rgba(0,0,0,.04);background:var(--select2-material-option-selected-background,rgba(0,0,0,.04));color:#000;color:var(--select2-material-option-highlighted-text-color,#000)}:host.material .select2-container--default .select2-results__option[aria-selected=true]{color:#ff5722;color:var(--select2-material-option-selected-text-color,#ff5722)}:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple,:host.material .select2-container--default.select2-container--disabled .select2-selection--single{background:transparent}:host.material .select2-container--default.select2-container--disabled .select2-selection--multiple:before,:host.material .select2-container--default.select2-container--disabled .select2-selection--single:before{background:linear-gradient(90deg,rgba(0,0,0,.26) 0,rgba(0,0,0,.26) 33%,transparent 0);background:var(--select2-material-underline-disabled,linear-gradient(90deg,rgba(0,0,0,.26) 0,rgba(0,0,0,.26) 33%,transparent 0));background-position:0 bottom;background-repeat:repeat-x;background-size:4px 1px}:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple:after,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--multiple:before,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:after,:host.material.ng-invalid.ng-touched .select2-container--default .select2-selection--single:before{background:red;background:var(--select2-material-underline-invalid,red)}:host.material:not(.select2-container--open) .select2-focused .select2-selection--multiple,:host.material:not(.select2-container--open) .select2-focused .select2-selection--single{border:0}:host.material .select2-subscript-wrapper{color:#888;color:var(--select2-hint-text-color,#888);font-size:75%;position:absolute;top:calc(100% - 1.72917em)}::ng-deep .select2-overlay-backdrop{background:rgba(0,0,0,.32);background:var(--select2-overlay-backdrop,transparent)}::ng-deep .cdk-overlay-container .select2-container .select2-dropdown.select2-dropdown--above{bottom:28px}::ng-deep .cdk-overlay-container .select2-container--open.select2-position-auto .select2-dropdown{margin-bottom:28px}::ng-deep .cdk-overlay-container .select2-container--open.select2-position-auto .select2-dropdown.select2-dropdown--above{bottom:0;margin-bottom:0;margin-top:28px}@supports (-moz-appearance:none){select2.material .select2-container--default .select2-selection--multiple,select2.material .select2-container--default .select2-selection--single{height:26px}}@supports (-ms-scroll-limit:0){select2.material .select2-container--default .select2-selection--multiple,select2.material .select2-container--default .select2-selection--single{height:25px}}"]
2188
- }] }
2189
- ];
2190
- /** @nocollapse */
2191
- Select2.ctorParameters = function () { return [
2192
- { type: scrolling.ViewportRuler },
2193
- { type: core.ChangeDetectorRef },
2194
- { type: forms.NgForm, decorators: [{ type: core.Optional }] },
2195
- { type: forms.FormGroupDirective, decorators: [{ type: core.Optional }] },
2196
- { type: forms.NgControl, decorators: [{ type: core.Self }, { type: core.Optional }] },
2197
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
2198
- ]; };
2199
- Select2.propDecorators = {
2200
- data: [{ type: core.Input }],
2201
- minCharForSearch: [{ type: core.Input }],
2202
- displaySearchStatus: [{ type: core.Input }],
2203
- placeholder: [{ type: core.Input }],
2204
- customSearchEnabled: [{ type: core.Input }],
2205
- limitSelection: [{ type: core.Input }],
2206
- listPosition: [{ type: core.Input }],
2207
- multiple: [{ type: core.Input }],
2208
- overlay: [{ type: core.Input }],
2209
- styleMode: [{ type: core.Input }],
2210
- noResultMessage: [{ type: core.Input }],
2211
- infiniteScrollDistance: [{ type: core.Input }],
2212
- infiniteScrollThrottle: [{ type: core.Input }],
2213
- infiniteScroll: [{ type: core.Input }],
2214
- editPattern: [{ type: core.Input }],
2215
- templates: [{ type: core.Input }],
2216
- resultMaxHeight: [{ type: core.Input }],
2217
- update: [{ type: core.Output }],
2218
- open: [{ type: core.Output }],
2219
- close: [{ type: core.Output }],
2220
- focus: [{ type: core.Output }],
2221
- blur: [{ type: core.Output }],
2222
- search: [{ type: core.Output }],
2223
- scroll: [{ type: core.Output }],
2224
- removeOption: [{ type: core.Output }],
2225
- minCountForSearch: [{ type: core.Input }],
2226
- id: [{ type: core.Input }, { type: core.HostBinding, args: ['id',] }],
2227
- required: [{ type: core.Input }],
2228
- disabled: [{ type: core.Input }],
2229
- hideSelectedItems: [{ type: core.Input }],
2230
- readonly: [{ type: core.Input }],
2231
- value: [{ type: core.Input }],
2232
- tabIndex: [{ type: core.Input }],
2233
- resettable: [{ type: core.Input }],
2234
- ariaInvalid: [{ type: core.HostBinding, args: ['attr.aria-invalid',] }],
2235
- classMaterial: [{ type: core.HostBinding, args: ['class.material',] }],
2236
- classNostyle: [{ type: core.HostBinding, args: ['class.nostyle',] }],
2237
- select2above: [{ type: core.HostBinding, args: ['class.select2-above',] }],
2238
- cdkConnectedOverlay: [{ type: core.ViewChild, args: [overlay.CdkConnectedOverlay,] }],
2239
- selection: [{ type: core.ViewChild, args: ['selection', { static: true },] }],
2240
- resultContainer: [{ type: core.ViewChild, args: ['results',] }],
2241
- results: [{ type: core.ViewChildren, args: ['result',] }],
2242
- searchInput: [{ type: core.ViewChild, args: ['searchInput',] }],
2243
- dropdown: [{ type: core.ViewChild, args: ['dropdown',] }]
2244
- };
2245
- if (false) {
2246
- /**
2247
- * data of options & optiongrps
2248
- * @type {?}
2249
- */
2250
- Select2.prototype.data;
2251
- /** @type {?} */
2252
- Select2.prototype.minCharForSearch;
2253
- /** @type {?} */
2254
- Select2.prototype.displaySearchStatus;
2255
- /** @type {?} */
2256
- Select2.prototype.placeholder;
2257
- /** @type {?} */
2258
- Select2.prototype.customSearchEnabled;
2259
- /** @type {?} */
2260
- Select2.prototype.limitSelection;
2261
- /** @type {?} */
2262
- Select2.prototype.listPosition;
2263
- /**
2264
- * use the material style
2265
- * @type {?}
2266
- */
2267
- Select2.prototype.styleMode;
2268
- /**
2269
- * message when no result
2270
- * @type {?}
2271
- */
2272
- Select2.prototype.noResultMessage;
2273
- /**
2274
- * infinite scroll distance
2275
- * @type {?}
2276
- */
2277
- Select2.prototype.infiniteScrollDistance;
2278
- /**
2279
- * infinite scroll distance
2280
- * @type {?}
2281
- */
2282
- Select2.prototype.infiniteScrollThrottle;
2283
- /**
2284
- * use it for change the pattern of the filter search
2285
- * @type {?}
2286
- */
2287
- Select2.prototype.editPattern;
2288
- /**
2289
- * template for formating
2290
- * @type {?}
2291
- */
2292
- Select2.prototype.templates;
2293
- /**
2294
- * the max height of the results container when opening the select
2295
- * @type {?}
2296
- */
2297
- Select2.prototype.resultMaxHeight;
2298
- /** @type {?} */
2299
- Select2.prototype.update;
2300
- /** @type {?} */
2301
- Select2.prototype.open;
2302
- /** @type {?} */
2303
- Select2.prototype.close;
2304
- /** @type {?} */
2305
- Select2.prototype.focus;
2306
- /** @type {?} */
2307
- Select2.prototype.blur;
2308
- /** @type {?} */
2309
- Select2.prototype.search;
2310
- /** @type {?} */
2311
- Select2.prototype.scroll;
2312
- /** @type {?} */
2313
- Select2.prototype.removeOption;
2314
- /** @type {?} */
2315
- Select2.prototype.option;
2316
- /** @type {?} */
2317
- Select2.prototype.isOpen;
2318
- /** @type {?} */
2319
- Select2.prototype.searchStyle;
2320
- /**
2321
- * Whether the element is focused or not.
2322
- * @type {?}
2323
- */
2324
- Select2.prototype.focused;
2325
- /** @type {?} */
2326
- Select2.prototype.filteredData;
2327
- /** @type {?} */
2328
- Select2.prototype.overlayWidth;
2329
- /** @type {?} */
2330
- Select2.prototype.overlayHeight;
2331
- /** @type {?} */
2332
- Select2.prototype._triggerRect;
2333
- /** @type {?} */
2334
- Select2.prototype._dropdownRect;
2335
- /**
2336
- * @type {?}
2337
- * @private
2338
- */
2339
- Select2.prototype._minCountForSearch;
2340
- /**
2341
- * @type {?}
2342
- * @private
2343
- */
2344
- Select2.prototype.cdkConnectedOverlay;
2345
- /**
2346
- * @type {?}
2347
- * @private
2348
- */
2349
- Select2.prototype.selection;
2350
- /**
2351
- * @type {?}
2352
- * @private
2353
- */
2354
- Select2.prototype.resultContainer;
2355
- /**
2356
- * @type {?}
2357
- * @private
2358
- */
2359
- Select2.prototype.results;
2360
- /**
2361
- * @type {?}
2362
- * @private
2363
- */
2364
- Select2.prototype.searchInput;
2365
- /**
2366
- * @type {?}
2367
- * @private
2368
- */
2369
- Select2.prototype.dropdown;
2370
- /**
2371
- * @type {?}
2372
- * @private
2373
- */
2374
- Select2.prototype.hoveringValue;
2375
- /**
2376
- * @type {?}
2377
- * @private
2378
- */
2379
- Select2.prototype.innerSearchText;
2380
- /**
2381
- * @type {?}
2382
- * @private
2383
- */
2384
- Select2.prototype.isSearchboxHidden;
2385
- /**
2386
- * @type {?}
2387
- * @private
2388
- */
2389
- Select2.prototype.selectionElement;
2390
- /**
2391
- * @type {?}
2392
- * @private
2393
- */
2394
- Select2.prototype._stateChanges;
2395
- /**
2396
- * Tab index for the element.
2397
- * @type {?}
2398
- * @private
2399
- */
2400
- Select2.prototype._tabIndex;
2401
- /**
2402
- * @type {?}
2403
- * @private
2404
- */
2405
- Select2.prototype._disabled;
2406
- /**
2407
- * @type {?}
2408
- * @private
2409
- */
2410
- Select2.prototype._required;
2411
- /**
2412
- * @type {?}
2413
- * @private
2414
- */
2415
- Select2.prototype._readonly;
2416
- /**
2417
- * @type {?}
2418
- * @private
2419
- */
2420
- Select2.prototype._multiple;
2421
- /**
2422
- * @type {?}
2423
- * @private
2424
- */
2425
- Select2.prototype._overlay;
2426
- /**
2427
- * @type {?}
2428
- * @private
2429
- */
2430
- Select2.prototype._resettable;
2431
- /**
2432
- * @type {?}
2433
- * @private
2434
- */
2435
- Select2.prototype._hideSelectedItems;
2436
- /**
2437
- * @type {?}
2438
- * @private
2439
- */
2440
- Select2.prototype._clickDetection;
2441
- /**
2442
- * @type {?}
2443
- * @private
2444
- */
2445
- Select2.prototype._clickDetectionFc;
2446
- /**
2447
- * @type {?}
2448
- * @private
2449
- */
2450
- Select2.prototype._id;
2451
- /**
2452
- * @type {?}
2453
- * @private
2454
- */
2455
- Select2.prototype._uid;
2456
- /**
2457
- * @type {?}
2458
- * @private
2459
- */
2460
- Select2.prototype._value;
2461
- /**
2462
- * @type {?}
2463
- * @private
2464
- */
2465
- Select2.prototype._previousNativeValue;
2466
- /**
2467
- * @type {?}
2468
- * @private
2469
- */
2470
- Select2.prototype._infiniteScroll;
2471
- /**
2472
- * @type {?}
2473
- * @private
2474
- */
2475
- Select2.prototype._overlayPosition;
2476
- /**
2477
- * View -> model callback called when select has been touched
2478
- * @type {?}
2479
- * @private
2480
- */
2481
- Select2.prototype._onTouched;
2482
- /**
2483
- * View -> model callback called when value changes
2484
- * @type {?}
2485
- * @private
2486
- */
2487
- Select2.prototype._onChange;
2488
- /**
2489
- * @type {?}
2490
- * @protected
2491
- */
2492
- Select2.prototype._viewportRuler;
2493
- /**
2494
- * @type {?}
2495
- * @private
2496
- */
2497
- Select2.prototype._changeDetectorRef;
2498
- /**
2499
- * @type {?}
2500
- * @private
2501
- */
2502
- Select2.prototype._parentForm;
2503
- /**
2504
- * @type {?}
2505
- * @private
2506
- */
2507
- Select2.prototype._parentFormGroup;
2508
- /** @type {?} */
2509
- Select2.prototype._control;
2510
- }
2511
-
2512
- /**
2513
- * @fileoverview added by tsickle
2514
- * Generated from: lib/select2-hint.component.ts
2515
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2516
- */
2517
- var Select2Hint = /** @class */ (function () {
2518
- function Select2Hint() {
2519
- }
2520
- return Select2Hint;
2521
- }());
2522
- Select2Hint.decorators = [
2523
- { type: core.Directive, args: [{ selector: 'select2-hint' },] }
2524
- ];
2525
-
2526
- /**
2527
- * @fileoverview added by tsickle
2528
- * Generated from: lib/select2-label.component.ts
2529
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2530
- */
2531
- var Select2Label = /** @class */ (function () {
2532
- function Select2Label() {
2533
- }
2534
- return Select2Label;
2535
- }());
2536
- Select2Label.decorators = [
2537
- { type: core.Directive, args: [{ selector: 'select2-label' },] }
2538
- ];
2539
-
2540
- /**
2541
- * @fileoverview added by tsickle
2542
- * Generated from: lib/select2.module.ts
2543
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2544
- */
2545
- var Select2Module = /** @class */ (function () {
2546
- function Select2Module() {
2547
- }
2548
- return Select2Module;
2549
- }());
2550
- Select2Module.decorators = [
2551
- { type: core.NgModule, args: [{
2552
- imports: [common.CommonModule, forms.FormsModule, overlay.OverlayModule, forms.ReactiveFormsModule, ngxInfiniteScroll.InfiniteScrollModule],
2553
- declarations: [Select2Hint, Select2Label, Select2],
2554
- exports: [forms.FormsModule, forms.ReactiveFormsModule, Select2Hint, Select2Label, Select2],
2555
- },] }
2556
- ];
2557
-
2558
- /**
2559
- * @fileoverview added by tsickle
2560
- * Generated from: ng-select2-component.ts
2561
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2562
- */
2563
-
2564
- exports.Select2 = Select2;
2565
- exports.Select2Hint = Select2Hint;
2566
- exports.Select2Label = Select2Label;
2567
- exports.Select2Module = Select2Module;
2568
- exports.Select2Utils = Select2Utils;
2569
- exports.defaultMinCountForSearch = defaultMinCountForSearch;
2570
- exports.protectRegexp = protectRegexp;
2571
- exports.timeout = timeout;
2572
- exports.unicodePatterns = unicodePatterns;
2573
-
2574
- Object.defineProperty(exports, '__esModule', { value: true });
2575
-
2576
- })));
2577
- //# sourceMappingURL=ng-select2-component.umd.js.map