ng-select2-component 8.0.6 → 10.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 (51) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/README.md +46 -38
  3. package/esm2020/lib/select2-const.mjs +48 -0
  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/index.d.ts +6 -0
  17. package/lib/select2-const.d.ts +1 -0
  18. package/lib/select2-const.d.ts.map +1 -0
  19. package/lib/select2-hint.component.d.ts +4 -0
  20. package/lib/select2-hint.component.d.ts.map +1 -0
  21. package/lib/select2-interfaces.d.ts +1 -0
  22. package/lib/select2-interfaces.d.ts.map +1 -0
  23. package/lib/select2-label.component.d.ts +4 -0
  24. package/lib/select2-label.component.d.ts.map +1 -0
  25. package/lib/select2-utils.d.ts +11 -6
  26. package/lib/select2-utils.d.ts.map +1 -0
  27. package/lib/select2.component.d.ts +15 -6
  28. package/lib/select2.component.d.ts.map +1 -0
  29. package/lib/select2.module.d.ts +12 -0
  30. package/lib/select2.module.d.ts.map +1 -0
  31. package/ng-select2-component.d.ts.map +1 -0
  32. package/package.json +26 -14
  33. package/public_api.d.ts +1 -0
  34. package/public_api.d.ts.map +1 -0
  35. package/bundles/ng-select2-component.umd.js +0 -2587
  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-const.js +0 -57
  40. package/esm2015/lib/select2-hint.component.js +0 -12
  41. package/esm2015/lib/select2-interfaces.js +0 -134
  42. package/esm2015/lib/select2-label.component.js +0 -12
  43. package/esm2015/lib/select2-utils.js +0 -388
  44. package/esm2015/lib/select2.component.js +0 -1500
  45. package/esm2015/lib/select2.module.js +0 -23
  46. package/esm2015/ng-select2-component.js +0 -10
  47. package/esm2015/public_api.js +0 -17
  48. package/fesm2015/ng-select2-component.js +0 -2130
  49. package/fesm2015/ng-select2-component.js.map +0 -1
  50. package/ng-select2-component.d.ts +0 -4
  51. package/ng-select2-component.metadata.json +0 -1
@@ -1,2587 +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 || Array.prototype.slice.call(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, "data", {
1003
- /**
1004
- * data of options & optiongrps
1005
- * @param {?} data
1006
- * @return {?}
1007
- */
1008
- set: function (data) {
1009
- this._data = data;
1010
- this.updateFilteredData();
1011
- },
1012
- enumerable: false,
1013
- configurable: true
1014
- });
1015
- Object.defineProperty(Select2.prototype, "multiple", {
1016
- /**
1017
- * @return {?}
1018
- */
1019
- get: function () {
1020
- return this._multiple;
1021
- },
1022
- /**
1023
- * @param {?} value
1024
- * @return {?}
1025
- */
1026
- set: function (value) {
1027
- this._multiple = this._coerceBooleanProperty(value);
1028
- this.ngOnInit();
1029
- },
1030
- enumerable: false,
1031
- configurable: true
1032
- });
1033
- Object.defineProperty(Select2.prototype, "overlay", {
1034
- /**
1035
- * use the material style
1036
- * @return {?}
1037
- */
1038
- get: function () {
1039
- return this._overlay;
1040
- },
1041
- /**
1042
- * @param {?} value
1043
- * @return {?}
1044
- */
1045
- set: function (value) {
1046
- this._overlay = this._coerceBooleanProperty(value);
1047
- },
1048
- enumerable: false,
1049
- configurable: true
1050
- });
1051
- Object.defineProperty(Select2.prototype, "infiniteScroll", {
1052
- /**
1053
- * infinite scroll activated
1054
- * @return {?}
1055
- */
1056
- get: function () {
1057
- return this._infiniteScroll;
1058
- },
1059
- /**
1060
- * @param {?} value
1061
- * @return {?}
1062
- */
1063
- set: function (value) {
1064
- this._infiniteScroll = this._coerceBooleanProperty(value);
1065
- },
1066
- enumerable: false,
1067
- configurable: true
1068
- });
1069
- Object.defineProperty(Select2.prototype, "select2Options", {
1070
- /**
1071
- * @return {?}
1072
- */
1073
- get: function () {
1074
- return this.multiple ? (( /** @type {?} */(this.option))) : null;
1075
- },
1076
- enumerable: false,
1077
- configurable: true
1078
- });
1079
- Object.defineProperty(Select2.prototype, "select2Option", {
1080
- /**
1081
- * @return {?}
1082
- */
1083
- get: function () {
1084
- return this.multiple ? null : (( /** @type {?} */(this.option)));
1085
- },
1086
- enumerable: false,
1087
- configurable: true
1088
- });
1089
- Object.defineProperty(Select2.prototype, "searchText", {
1090
- /**
1091
- * @return {?}
1092
- */
1093
- get: function () {
1094
- return this.innerSearchText;
1095
- },
1096
- /**
1097
- * @param {?} text
1098
- * @return {?}
1099
- */
1100
- set: function (text) {
1101
- if (this.customSearchEnabled) {
1102
- this.search.emit({
1103
- component: this,
1104
- value: this._value,
1105
- search: text,
1106
- });
1107
- }
1108
- this.innerSearchText = text;
1109
- },
1110
- enumerable: false,
1111
- configurable: true
1112
- });
1113
- Object.defineProperty(Select2.prototype, "minCountForSearch", {
1114
- /**
1115
- * minimal data of show the search field
1116
- * @return {?}
1117
- */
1118
- get: function () {
1119
- return this._minCountForSearch;
1120
- },
1121
- /**
1122
- * @param {?} value
1123
- * @return {?}
1124
- */
1125
- set: function (value) {
1126
- this._minCountForSearch = value;
1127
- this.updateSearchBox();
1128
- },
1129
- enumerable: false,
1130
- configurable: true
1131
- });
1132
- Object.defineProperty(Select2.prototype, "id", {
1133
- /**
1134
- * Unique id of the element.
1135
- * @return {?}
1136
- */
1137
- get: function () {
1138
- return this._id;
1139
- },
1140
- /**
1141
- * @param {?} value
1142
- * @return {?}
1143
- */
1144
- set: function (value) {
1145
- this._id = value || this._uid;
1146
- },
1147
- enumerable: false,
1148
- configurable: true
1149
- });
1150
- Object.defineProperty(Select2.prototype, "required", {
1151
- /**
1152
- * Whether the element is required.
1153
- * @return {?}
1154
- */
1155
- get: function () {
1156
- return this._required;
1157
- },
1158
- /**
1159
- * @param {?} value
1160
- * @return {?}
1161
- */
1162
- set: function (value) {
1163
- this._required = this._coerceBooleanProperty(value);
1164
- },
1165
- enumerable: false,
1166
- configurable: true
1167
- });
1168
- Object.defineProperty(Select2.prototype, "disabled", {
1169
- /**
1170
- * Whether selected items should be hidden.
1171
- * @return {?}
1172
- */
1173
- get: function () {
1174
- return this._control ? this._control.disabled : this._disabled;
1175
- },
1176
- /**
1177
- * @param {?} value
1178
- * @return {?}
1179
- */
1180
- set: function (value) {
1181
- this._disabled = this._coerceBooleanProperty(value);
1182
- },
1183
- enumerable: false,
1184
- configurable: true
1185
- });
1186
- Object.defineProperty(Select2.prototype, "hideSelectedItems", {
1187
- /**
1188
- * Whether items are hidden when has.
1189
- * @return {?}
1190
- */
1191
- get: function () {
1192
- return this._hideSelectedItems;
1193
- },
1194
- /**
1195
- * @param {?} value
1196
- * @return {?}
1197
- */
1198
- set: function (value) {
1199
- this._hideSelectedItems = this._coerceBooleanProperty(value);
1200
- },
1201
- enumerable: false,
1202
- configurable: true
1203
- });
1204
- Object.defineProperty(Select2.prototype, "readonly", {
1205
- /**
1206
- * Whether the element is readonly.
1207
- * @return {?}
1208
- */
1209
- get: function () {
1210
- return this._readonly;
1211
- },
1212
- /**
1213
- * @param {?} value
1214
- * @return {?}
1215
- */
1216
- set: function (value) {
1217
- this._readonly = this._coerceBooleanProperty(value);
1218
- },
1219
- enumerable: false,
1220
- configurable: true
1221
- });
1222
- Object.defineProperty(Select2.prototype, "value", {
1223
- /**
1224
- * The input element's value.
1225
- * @return {?}
1226
- */
1227
- get: function () {
1228
- return this._value;
1229
- },
1230
- /**
1231
- * @param {?} value
1232
- * @return {?}
1233
- */
1234
- set: function (value) {
1235
- var _this = this;
1236
- if (this.testValueChange(this._value, value)) {
1237
- setTimeout(( /**
1238
- * @return {?}
1239
- */function () {
1240
- _this._value = value;
1241
- _this.writeValue(value);
1242
- }), 10);
1243
- }
1244
- },
1245
- enumerable: false,
1246
- configurable: true
1247
- });
1248
- Object.defineProperty(Select2.prototype, "tabIndex", {
1249
- /**
1250
- * Tab index for the select2 element.
1251
- * @return {?}
1252
- */
1253
- get: function () {
1254
- return this.disabled ? -1 : this._tabIndex;
1255
- },
1256
- /**
1257
- * @param {?} value
1258
- * @return {?}
1259
- */
1260
- set: function (value) {
1261
- if (typeof value !== 'undefined') {
1262
- this._tabIndex = value;
1263
- }
1264
- },
1265
- enumerable: false,
1266
- configurable: true
1267
- });
1268
- Object.defineProperty(Select2.prototype, "resettable", {
1269
- /**
1270
- * reset with no selected value
1271
- * @return {?}
1272
- */
1273
- get: function () {
1274
- return this._resettable;
1275
- },
1276
- /**
1277
- * @param {?} value
1278
- * @return {?}
1279
- */
1280
- set: function (value) {
1281
- this._resettable = this._coerceBooleanProperty(value);
1282
- },
1283
- enumerable: false,
1284
- configurable: true
1285
- });
1286
- Object.defineProperty(Select2.prototype, "ariaInvalid", {
1287
- /**
1288
- * @return {?}
1289
- */
1290
- get: function () {
1291
- return this._isErrorState();
1292
- },
1293
- enumerable: false,
1294
- configurable: true
1295
- });
1296
- Object.defineProperty(Select2.prototype, "classMaterial", {
1297
- /**
1298
- * @return {?}
1299
- */
1300
- get: function () {
1301
- return this.styleMode === 'material';
1302
- },
1303
- enumerable: false,
1304
- configurable: true
1305
- });
1306
- Object.defineProperty(Select2.prototype, "classNostyle", {
1307
- /**
1308
- * @return {?}
1309
- */
1310
- get: function () {
1311
- return this.styleMode === 'noStyle';
1312
- },
1313
- enumerable: false,
1314
- configurable: true
1315
- });
1316
- Object.defineProperty(Select2.prototype, "select2above", {
1317
- /**
1318
- * @return {?}
1319
- */
1320
- get: function () {
1321
- return !this.overlay ? this.listPosition === 'above' : this._isAbobeOverlay();
1322
- },
1323
- enumerable: false,
1324
- configurable: true
1325
- });
1326
- Object.defineProperty(Select2.prototype, "_positions", {
1327
- /**
1328
- * @return {?}
1329
- */
1330
- get: function () {
1331
- if (this.listPosition === 'auto') {
1332
- [
1333
- {
1334
- originX: 'start',
1335
- originY: 'bottom',
1336
- overlayX: 'start',
1337
- overlayY: 'bottom',
1338
- },
1339
- {
1340
- originX: 'start',
1341
- originY: 'top',
1342
- overlayX: 'start',
1343
- overlayY: 'top',
1344
- },
1345
- ];
1346
- }
1347
- else {
1348
- return null;
1349
- }
1350
- },
1351
- enumerable: false,
1352
- configurable: true
1353
- });
1354
- Object.defineProperty(Select2.prototype, "resultsElement", {
1355
- /**
1356
- * @private
1357
- * @return {?}
1358
- */
1359
- get: function () {
1360
- var _a;
1361
- return (_a = this.resultContainer) === null || _a === void 0 ? void 0 : _a.nativeElement;
1362
- },
1363
- enumerable: false,
1364
- configurable: true
1365
- });
1366
- /**
1367
- * @return {?}
1368
- */
1369
- Select2.prototype.ngOnInit = function () {
1370
- var _this = this;
1371
- this._viewportRuler.change(100).subscribe(( /**
1372
- * @return {?}
1373
- */function () {
1374
- if (_this.isOpen) {
1375
- _this.triggerRect();
1376
- }
1377
- }));
1378
- /** @type {?} */
1379
- var option = Select2Utils.getOptionsByValue(this._data, this._control ? this._control.value : this.value, this.multiple);
1380
- if (option !== null) {
1381
- this.option = option;
1382
- }
1383
- if (!Array.isArray(option)) {
1384
- this.hoveringValue = ( /** @type {?} */(this.value));
1385
- }
1386
- this.updateSearchBox();
1387
- };
1388
- /**
1389
- * @return {?}
1390
- */
1391
- Select2.prototype.ngAfterViewInit = function () {
1392
- var _this = this;
1393
- this.cdkConnectedOverlay.positionChange.subscribe(( /**
1394
- * @param {?} posChange
1395
- * @return {?}
1396
- */function (posChange) {
1397
- var _a;
1398
- if (_this.listPosition === 'auto' && ((_a = posChange.connectionPair) === null || _a === void 0 ? void 0 : _a.originY) &&
1399
- _this._overlayPosition !== posChange.connectionPair.originY) {
1400
- _this.triggerRect();
1401
- _this._overlayPosition = posChange.connectionPair.originY;
1402
- _this._changeDetectorRef.detectChanges();
1403
- }
1404
- }));
1405
- this.selectionElement = this.selection.nativeElement;
1406
- this.triggerRect();
1407
- };
1408
- /**
1409
- * @return {?}
1410
- */
1411
- Select2.prototype.ngDoCheck = function () {
1412
- var _a;
1413
- this.updateSearchBox();
1414
- this._dirtyCheckNativeValue();
1415
- if (this._triggerRect) {
1416
- if (this.overlayWidth !== this._triggerRect.width) {
1417
- this.overlayWidth = this._triggerRect.width;
1418
- }
1419
- if (((_a = this._dropdownRect) === null || _a === void 0 ? void 0 : _a.height) > 0 && this.overlayHeight !== this._dropdownRect.height) {
1420
- this.overlayHeight = this.listPosition === 'auto' ? this._dropdownRect.height : 0;
1421
- }
1422
- }
1423
- };
1424
- /**
1425
- * @return {?}
1426
- */
1427
- Select2.prototype.ngOnDestroy = function () {
1428
- window.document.body.removeEventListener('click', this._clickDetectionFc);
1429
- };
1430
- /**
1431
- * @return {?}
1432
- */
1433
- Select2.prototype.updateSearchBox = function () {
1434
- /** @type {?} */
1435
- var hidden = this.customSearchEnabled
1436
- ? false
1437
- : Select2Utils.isSearchboxHiddex(this._data, this._minCountForSearch);
1438
- if (this.isSearchboxHidden !== hidden) {
1439
- this.isSearchboxHidden = hidden;
1440
- }
1441
- };
1442
- /**
1443
- * @return {?}
1444
- */
1445
- Select2.prototype.hideSearch = function () {
1446
- /** @type {?} */
1447
- var displaySearchStatus = displaySearchStatusList.indexOf(this.displaySearchStatus) > -1 ? this.displaySearchStatus : 'default';
1448
- return (displaySearchStatus === 'default' && this.isSearchboxHidden) || displaySearchStatus === 'hidden';
1449
- };
1450
- /**
1451
- * @param {?} option
1452
- * @return {?}
1453
- */
1454
- Select2.prototype.getOptionStyle = function (option) {
1455
- return ('select2-results__option ' +
1456
- (option.hide ? 'select2-results__option--hide ' : '') +
1457
- (option.value === this.hoveringValue ? 'select2-results__option--highlighted ' : '') +
1458
- (option.classes || ''));
1459
- };
1460
- /**
1461
- * @param {?} option
1462
- * @return {?}
1463
- */
1464
- Select2.prototype.mouseenter = function (option) {
1465
- if (!option.disabled) {
1466
- this.hoveringValue = option.value;
1467
- }
1468
- };
1469
- /**
1470
- * @param {?} option
1471
- * @return {?}
1472
- */
1473
- Select2.prototype.click = function (option) {
1474
- if (this.testSelection(option)) {
1475
- this.select(option);
1476
- }
1477
- };
1478
- /**
1479
- * @param {?} e
1480
- * @return {?}
1481
- */
1482
- Select2.prototype.reset = function (e) {
1483
- this.select(null);
1484
- e.preventDefault();
1485
- e.stopPropagation();
1486
- };
1487
- /**
1488
- * @param {?} event
1489
- * @return {?}
1490
- */
1491
- Select2.prototype.prevChange = function (event) {
1492
- event.stopPropagation();
1493
- };
1494
- /**
1495
- * @return {?}
1496
- */
1497
- Select2.prototype.toggleOpenAndClose = function () {
1498
- var _this = this;
1499
- if (this.disabled) {
1500
- return;
1501
- }
1502
- this._focus(true);
1503
- this.isOpen = !this.isOpen;
1504
- if (this.isOpen) {
1505
- this.innerSearchText = '';
1506
- this.updateFilteredData();
1507
- this._focusSearchboxOrResultsElement();
1508
- setTimeout(( /**
1509
- * @return {?}
1510
- */function () {
1511
- if (_this.option) {
1512
- /** @type {?} */
1513
- var option = _this.option instanceof Array ? _this.option[0] : _this.option;
1514
- _this.updateScrollFromOption(option);
1515
- }
1516
- else if (_this.resultsElement) {
1517
- _this.resultsElement.scrollTop = 0;
1518
- }
1519
- setTimeout(( /**
1520
- * @return {?}
1521
- */function () {
1522
- var _a, _b;
1523
- _this.triggerRect();
1524
- (_b = (_a = _this.cdkConnectedOverlay) === null || _a === void 0 ? void 0 : _a.overlayRef) === null || _b === void 0 ? void 0 : _b.updatePosition();
1525
- }), 100);
1526
- }));
1527
- this.open.emit(this);
1528
- }
1529
- else {
1530
- this.close.emit(this);
1531
- }
1532
- if (this.isOpen && !this._clickDetection) {
1533
- setTimeout(( /**
1534
- * @return {?}
1535
- */function () {
1536
- window.document.body.addEventListener('click', _this._clickDetectionFc, false);
1537
- _this._clickDetection = true;
1538
- }), timeout);
1539
- }
1540
- this._changeDetectorRef.markForCheck();
1541
- };
1542
- /**
1543
- * @param {?} option
1544
- * @param {?} defaut
1545
- * @return {?}
1546
- */
1547
- Select2.prototype.hasTemplate = function (option, defaut) {
1548
- var _a, _b;
1549
- return (this.templates instanceof core.TemplateRef ||
1550
- ((_a = this.templates) === null || _a === void 0 ? void 0 : _a[option.templateId]) instanceof core.TemplateRef ||
1551
- ((_b = this.templates) === null || _b === void 0 ? void 0 : _b[defaut]) instanceof core.TemplateRef);
1552
- };
1553
- /**
1554
- * @param {?} option
1555
- * @param {?} defaut
1556
- * @return {?}
1557
- */
1558
- Select2.prototype.getTemplate = function (option, defaut) {
1559
- return this.hasTemplate(option, defaut)
1560
- ? this.templates[option.templateId] || this.templates[defaut] || this.templates
1561
- : undefined;
1562
- };
1563
- /**
1564
- * @return {?}
1565
- */
1566
- Select2.prototype.triggerRect = function () {
1567
- var _a;
1568
- this._triggerRect = this.selectionElement.getBoundingClientRect();
1569
- this._dropdownRect = ((_a = this.dropdown) === null || _a === void 0 ? void 0 : _a.nativeElement) ? this.dropdown.nativeElement.getBoundingClientRect()
1570
- : undefined;
1571
- };
1572
- /**
1573
- * @private
1574
- * @param {?} option
1575
- * @return {?}
1576
- */
1577
- Select2.prototype.testSelection = function (option) {
1578
- if (option.disabled) {
1579
- return false;
1580
- }
1581
- if (!this.multiple ||
1582
- !this.limitSelection ||
1583
- (Array.isArray(this._value) && this._value.length < this.limitSelection)) {
1584
- return true;
1585
- }
1586
- return false;
1587
- };
1588
- /**
1589
- * @private
1590
- * @param {?} value1
1591
- * @param {?} value2
1592
- * @return {?}
1593
- */
1594
- Select2.prototype.testValueChange = function (value1, value2) {
1595
- var e_1, _c;
1596
- var _a, _b;
1597
- if (((value1 === null || value1 === undefined) && (value2 === null || value2 === undefined)) ||
1598
- value1 === value2) {
1599
- return false;
1600
- }
1601
- 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) &&
1602
- (( /** @type {?} */(value1))).length === (( /** @type {?} */(value2))).length) {
1603
- try {
1604
- for (var _d = __values(( /** @type {?} */(value1))), _e = _d.next(); !_e.done; _e = _d.next()) {
1605
- var e1 = _e.value;
1606
- /** @type {?} */
1607
- var test = (( /** @type {?} */(value2))).indexOf(e1) > -1;
1608
- if (!test) {
1609
- return true;
1610
- }
1611
- }
1612
- }
1613
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1614
- finally {
1615
- try {
1616
- if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
1617
- }
1618
- finally { if (e_1) throw e_1.error; }
1619
- }
1620
- return false;
1621
- }
1622
- return true;
1623
- };
1624
- /**
1625
- * @private
1626
- * @return {?}
1627
- */
1628
- Select2.prototype.updateFilteredData = function () {
1629
- var _this = this;
1630
- setTimeout(( /**
1631
- * @return {?}
1632
- */function () {
1633
- /** @type {?} */
1634
- var result = _this._data;
1635
- if (_this.multiple && _this.hideSelectedItems) {
1636
- result = Select2Utils.getFilteredSelectedData(result, _this.option);
1637
- }
1638
- if (!_this.customSearchEnabled && _this.searchText && _this.searchText.length >= +_this.minCharForSearch) {
1639
- result = Select2Utils.getFilteredData(result, _this.searchText, _this.editPattern);
1640
- }
1641
- if (Select2Utils.valueIsNotInFilteredData(result, _this.hoveringValue)) {
1642
- _this.hoveringValue = Select2Utils.getFirstAvailableOption(result);
1643
- }
1644
- _this.filteredData = result;
1645
- _this._changeDetectorRef.markForCheck();
1646
- }));
1647
- };
1648
- /**
1649
- * @private
1650
- * @param {?} e
1651
- * @return {?}
1652
- */
1653
- Select2.prototype.clickDetection = function (e) {
1654
- if (!this.ifParentContainsClass(( /** @type {?} */(e.target)), 'selection')) {
1655
- if (this.isOpen && !this.ifParentContainsClass(( /** @type {?} */(e.target)), 'select2-dropdown')) {
1656
- this.toggleOpenAndClose();
1657
- }
1658
- if (!this.ifParentContainsId(( /** @type {?} */(e.target)), this._id)) {
1659
- this.clickExit();
1660
- }
1661
- }
1662
- else if (this.isOpen && !this.ifParentContainsId(( /** @type {?} */(e.target)), this._id)) {
1663
- this.toggleOpenAndClose();
1664
- this.clickExit();
1665
- }
1666
- };
1667
- /**
1668
- * @private
1669
- * @return {?}
1670
- */
1671
- Select2.prototype.clickExit = function () {
1672
- this._focus(false);
1673
- window.document.body.removeEventListener('click', this._clickDetectionFc);
1674
- this._clickDetection = false;
1675
- };
1676
- /**
1677
- * @private
1678
- * @param {?} element
1679
- * @param {?} cssClass
1680
- * @return {?}
1681
- */
1682
- Select2.prototype.ifParentContainsClass = function (element, cssClass) {
1683
- return this.getParentElementByClass(element, cssClass) !== null;
1684
- };
1685
- /**
1686
- * @private
1687
- * @param {?} element
1688
- * @param {?} id
1689
- * @return {?}
1690
- */
1691
- Select2.prototype.ifParentContainsId = function (element, id) {
1692
- return this.getParentElementById(element, id) !== null;
1693
- };
1694
- /**
1695
- * @private
1696
- * @param {?} element
1697
- * @param {?} cssClass
1698
- * @return {?}
1699
- */
1700
- Select2.prototype.getParentElementByClass = function (element, cssClass) {
1701
- if (this.containClasses(element, cssClass.trim().split(/\s+/))) {
1702
- return element;
1703
- }
1704
- return element.parentElement ? this.getParentElementByClass(element.parentElement, cssClass) : null;
1705
- };
1706
- /**
1707
- * @private
1708
- * @param {?} element
1709
- * @param {?} id
1710
- * @return {?}
1711
- */
1712
- Select2.prototype.getParentElementById = function (element, id) {
1713
- if (element.id === id) {
1714
- return element;
1715
- }
1716
- return element.parentElement ? this.getParentElementById(element.parentElement, id) : null;
1717
- };
1718
- /**
1719
- * @private
1720
- * @param {?} element
1721
- * @param {?} cssClasses
1722
- * @return {?}
1723
- */
1724
- Select2.prototype.containClasses = function (element, cssClasses) {
1725
- var e_2, _c;
1726
- if (!element.classList) {
1727
- return false;
1728
- }
1729
- try {
1730
- for (var cssClasses_1 = __values(cssClasses), cssClasses_1_1 = cssClasses_1.next(); !cssClasses_1_1.done; cssClasses_1_1 = cssClasses_1.next()) {
1731
- var cssClass = cssClasses_1_1.value;
1732
- if (!element.classList.contains(cssClass)) {
1733
- return false;
1734
- }
1735
- }
1736
- }
1737
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1738
- finally {
1739
- try {
1740
- if (cssClasses_1_1 && !cssClasses_1_1.done && (_c = cssClasses_1.return)) _c.call(cssClasses_1);
1741
- }
1742
- finally { if (e_2) throw e_2.error; }
1743
- }
1744
- return true;
1745
- };
1746
- /**
1747
- * @return {?}
1748
- */
1749
- Select2.prototype.focusin = function () {
1750
- if (this.disabled) {
1751
- return;
1752
- }
1753
- this._focus(true);
1754
- };
1755
- /**
1756
- * @return {?}
1757
- */
1758
- Select2.prototype.focusout = function () {
1759
- if (this.selectionElement && !this.selectionElement.classList.contains('select2-focused')) {
1760
- this._focus(false);
1761
- this._onTouched();
1762
- }
1763
- };
1764
- /**
1765
- * @private
1766
- * @return {?}
1767
- */
1768
- Select2.prototype.moveUp = function () {
1769
- this.updateScrollFromOption(Select2Utils.getPreviousOption(this.filteredData, this.hoveringValue));
1770
- };
1771
- /**
1772
- * @private
1773
- * @return {?}
1774
- */
1775
- Select2.prototype.moveDown = function () {
1776
- this.updateScrollFromOption(Select2Utils.getNextOption(this.filteredData, this.hoveringValue));
1777
- };
1778
- /**
1779
- * @private
1780
- * @param {?} option
1781
- * @return {?}
1782
- */
1783
- Select2.prototype.updateScrollFromOption = function (option) {
1784
- if (option) {
1785
- this.hoveringValue = option.value;
1786
- /** @type {?} */
1787
- var domElement = this.results.find(( /**
1788
- * @param {?} r
1789
- * @return {?}
1790
- */function (/**
1791
- * @param {?} r
1792
- * @return {?}
1793
- */ r) { return r.nativeElement.innerText.trim() === option.label; }));
1794
- if (domElement && this.resultsElement) {
1795
- this.resultsElement.scrollTop = 0;
1796
- /** @type {?} */
1797
- var listClientRect = this.resultsElement.getBoundingClientRect();
1798
- /** @type {?} */
1799
- var optionClientRect = domElement.nativeElement.getBoundingClientRect();
1800
- this.resultsElement.scrollTop = optionClientRect.top - listClientRect.top;
1801
- }
1802
- }
1803
- };
1804
- /**
1805
- * @private
1806
- * @return {?}
1807
- */
1808
- Select2.prototype.selectByEnter = function () {
1809
- if (this.hoveringValue) {
1810
- /** @type {?} */
1811
- var option = Select2Utils.getOptionByValue(this._data, this.hoveringValue);
1812
- this.select(option);
1813
- }
1814
- };
1815
- /**
1816
- * @param {?} option
1817
- * @return {?}
1818
- */
1819
- Select2.prototype.select = function (option) {
1820
- /** @type {?} */
1821
- var value;
1822
- if (option !== null) {
1823
- if (this.multiple) {
1824
- /** @type {?} */
1825
- var options = ( /** @type {?} */(this.option));
1826
- /** @type {?} */
1827
- var index = options.findIndex(( /**
1828
- * @param {?} op
1829
- * @return {?}
1830
- */function (/**
1831
- * @param {?} op
1832
- * @return {?}
1833
- */ op) { return op.value === option.value; }));
1834
- if (index === -1) {
1835
- options.push(option);
1836
- }
1837
- else {
1838
- options.splice(index, 1);
1839
- }
1840
- value = (( /** @type {?} */(this.option))).map(( /**
1841
- * @param {?} op
1842
- * @return {?}
1843
- */function (/**
1844
- * @param {?} op
1845
- * @return {?}
1846
- */ op) { return op.value; }));
1847
- }
1848
- else {
1849
- this.option = option;
1850
- if (this.isOpen) {
1851
- this.isOpen = false;
1852
- this.close.emit(this);
1853
- if (this.selectionElement) {
1854
- this.selectionElement.focus();
1855
- }
1856
- }
1857
- value = this.option.value;
1858
- }
1859
- }
1860
- else {
1861
- this.option = null;
1862
- }
1863
- if (this.multiple && this.hideSelectedItems) {
1864
- this.updateFilteredData();
1865
- }
1866
- if (this._control) {
1867
- this._onChange(value);
1868
- }
1869
- else {
1870
- this._value = value;
1871
- }
1872
- this.update.emit({
1873
- component: this,
1874
- value: value,
1875
- options: Array.isArray(this.option) ? this.option : this.option ? [this.option] : null,
1876
- });
1877
- };
1878
- /**
1879
- * @param {?} e
1880
- * @return {?}
1881
- */
1882
- Select2.prototype.keyDown = function (e) {
1883
- if (this._testKey(e, ['ArrowDown', 40])) {
1884
- this.moveDown();
1885
- e.preventDefault();
1886
- }
1887
- else if (this._testKey(e, ['ArrowUp', 38])) {
1888
- this.moveUp();
1889
- e.preventDefault();
1890
- }
1891
- else if (this._testKey(e, ['Enter', 13])) {
1892
- this.selectByEnter();
1893
- e.preventDefault();
1894
- }
1895
- else if (this._testKey(e, ['Escape', 'Tab', 9, 27]) && this.isOpen) {
1896
- this.toggleOpenAndClose();
1897
- this._focus(false);
1898
- }
1899
- };
1900
- /**
1901
- * @param {?} e
1902
- * @return {?}
1903
- */
1904
- Select2.prototype.openKey = function (e) {
1905
- if (this._testKey(e, ['ArrowDown', 'ArrowUp', 'Enter', 40, 38, 13])) {
1906
- this.toggleOpenAndClose();
1907
- e.preventDefault();
1908
- }
1909
- else if (this._testKey(e, ['Escape', 'Tab', 9, 27])) {
1910
- this._focus(false);
1911
- this._onTouched();
1912
- }
1913
- };
1914
- /**
1915
- * @param {?} _index
1916
- * @param {?} item
1917
- * @return {?}
1918
- */
1919
- Select2.prototype.trackBy = function (_index, item) {
1920
- return item.value;
1921
- };
1922
- /**
1923
- * @param {?} e
1924
- * @return {?}
1925
- */
1926
- Select2.prototype.searchUpdate = function (e) {
1927
- this.searchText = (( /** @type {?} */(e.target))).value;
1928
- this.updateFilteredData();
1929
- };
1930
- /**
1931
- * @param {?} option
1932
- * @return {?}
1933
- */
1934
- Select2.prototype.isSelected = function (option) {
1935
- return Select2Utils.isSelected(this.option, option, this.multiple);
1936
- };
1937
- /**
1938
- * @param {?} option
1939
- * @return {?}
1940
- */
1941
- Select2.prototype.isDisabled = function (option) {
1942
- return option.disabled ? 'true' : 'false';
1943
- };
1944
- /**
1945
- * @param {?} e
1946
- * @param {?} option
1947
- * @return {?}
1948
- */
1949
- Select2.prototype.removeSelection = function (e, option) {
1950
- Select2Utils.removeSelection(this.option, option);
1951
- if (this.multiple && this.hideSelectedItems) {
1952
- this.updateFilteredData();
1953
- }
1954
- /** @type {?} */
1955
- var value = (( /** @type {?} */(this.option))).map(( /**
1956
- * @param {?} op
1957
- * @return {?}
1958
- */function (/**
1959
- * @param {?} op
1960
- * @return {?}
1961
- */ op) { return op.value; }));
1962
- if (this._control) {
1963
- this._onChange(value);
1964
- }
1965
- else {
1966
- this._value = value;
1967
- }
1968
- this.update.emit({
1969
- component: this,
1970
- value: value,
1971
- options: Array.isArray(this.option) ? this.option : this.option ? [this.option] : null,
1972
- });
1973
- this.removeOption.emit({
1974
- component: this,
1975
- value: value,
1976
- removedOption: option,
1977
- });
1978
- e.preventDefault();
1979
- e.stopPropagation();
1980
- if (this.isOpen) {
1981
- this._focusSearchboxOrResultsElement();
1982
- }
1983
- };
1984
- /**
1985
- * Sets the model value. Implemented as part of ControlValueAccessor.
1986
- * @param {?} value
1987
- * @return {?}
1988
- */
1989
- Select2.prototype.writeValue = function (value) {
1990
- this._setSelectionByValue(value);
1991
- };
1992
- /**
1993
- * Saves a callback function to be invoked when the select's value
1994
- * changes from user input. Part of the ControlValueAccessor interface
1995
- * required to integrate with Angular's core forms API.
1996
- *
1997
- * @param {?} fn Callback to be triggered when the value changes.
1998
- * @return {?}
1999
- */
2000
- Select2.prototype.registerOnChange = function (fn) {
2001
- this._onChange = fn;
2002
- };
2003
- /**
2004
- * Saves a callback function to be invoked when the select is blurred
2005
- * by the user. Part of the ControlValueAccessor interface required
2006
- * to integrate with Angular's core forms API.
2007
- *
2008
- * @param {?} fn Callback to be triggered when the component has been touched.
2009
- * @return {?}
2010
- */
2011
- Select2.prototype.registerOnTouched = function (fn) {
2012
- this._onTouched = fn;
2013
- };
2014
- /**
2015
- * Sets whether the component should be disabled.
2016
- * Implemented as part of ControlValueAccessor.
2017
- * @param {?} isDisabled
2018
- * @return {?}
2019
- */
2020
- Select2.prototype.setDisabledState = function (isDisabled) {
2021
- this.disabled = isDisabled;
2022
- };
2023
- /**
2024
- * @param {?} way
2025
- * @return {?}
2026
- */
2027
- Select2.prototype.onScroll = function (way) {
2028
- this.scroll.emit({
2029
- component: this,
2030
- way: way,
2031
- search: this.innerSearchText,
2032
- });
2033
- };
2034
- /**
2035
- * @return {?}
2036
- */
2037
- Select2.prototype._isErrorState = function () {
2038
- /** @type {?} */
2039
- var isInvalid = this._control && this._control.invalid;
2040
- /** @type {?} */
2041
- var isTouched = this._control && this._control.touched;
2042
- /** @type {?} */
2043
- var isSubmitted = (this._parentFormGroup && this._parentFormGroup.submitted) ||
2044
- (this._parentForm && this._parentForm.submitted);
2045
- return !!(isInvalid && (isTouched || isSubmitted));
2046
- };
2047
- /**
2048
- * @private
2049
- * @param {?} event
2050
- * @param {?=} refs
2051
- * @return {?}
2052
- */
2053
- Select2.prototype._testKey = function (event, refs) {
2054
- if (refs === void 0) { refs = []; }
2055
- return this._isKey(this._getKey(event), refs);
2056
- };
2057
- /**
2058
- * @private
2059
- * @param {?} event
2060
- * @return {?}
2061
- */
2062
- Select2.prototype._getKey = function (event) {
2063
- /** @type {?} */
2064
- var code;
2065
- if (event.key !== undefined) {
2066
- code = event.key;
2067
- }
2068
- else if (event['keyIdentifier'] !== undefined) {
2069
- code = event['keyIdentifier'];
2070
- }
2071
- else if (event['keyCode'] !== undefined) {
2072
- code = event['keyCode'];
2073
- }
2074
- else {
2075
- event.preventDefault();
2076
- }
2077
- return code;
2078
- };
2079
- /**
2080
- * @private
2081
- * @param {?} code
2082
- * @param {?=} refs
2083
- * @return {?}
2084
- */
2085
- Select2.prototype._isKey = function (code, refs) {
2086
- if (refs === void 0) { refs = []; }
2087
- return refs && refs.length > 0 ? refs.indexOf(code) !== -1 : false;
2088
- };
2089
- /**
2090
- * Sets the selected option based on a value. If no option can be
2091
- * found with the designated value, the select trigger is cleared.
2092
- * @private
2093
- * @param {?} value
2094
- * @return {?}
2095
- */
2096
- Select2.prototype._setSelectionByValue = function (value) {
2097
- var _this = this;
2098
- if (this.option || (value !== undefined && value !== null)) {
2099
- /** @type {?} */
2100
- var isArray = Array.isArray(value);
2101
- if (this.multiple && value && !isArray) {
2102
- throw new Error('Non array value.');
2103
- }
2104
- else if (this._data) {
2105
- if (this.multiple) {
2106
- this.option = []; // if value is null, then empty option and return
2107
- if (isArray) {
2108
- // value is not null. Preselect value
2109
- /** @type {?} */
2110
- var selectedValues = Select2Utils.getOptionsByValue(this._data, value, this.multiple);
2111
- selectedValues.map(( /**
2112
- * @param {?} item
2113
- * @return {?}
2114
- */function (/**
2115
- * @param {?} item
2116
- * @return {?}
2117
- */ item) { return _this.select(item); }));
2118
- }
2119
- }
2120
- else {
2121
- this.select(Select2Utils.getOptionByValue(this._data, value));
2122
- }
2123
- }
2124
- else if (this._control) {
2125
- this._control.viewToModelUpdate(value);
2126
- }
2127
- this._changeDetectorRef.markForCheck();
2128
- }
2129
- };
2130
- /**
2131
- * Does some manual dirty checking on the native input `value` property.
2132
- * @private
2133
- * @return {?}
2134
- */
2135
- Select2.prototype._dirtyCheckNativeValue = function () {
2136
- /** @type {?} */
2137
- var newValue = this.value;
2138
- if (this._previousNativeValue !== newValue) {
2139
- this._previousNativeValue = newValue;
2140
- this._stateChanges.next();
2141
- }
2142
- };
2143
- /**
2144
- * @private
2145
- * @param {?} value
2146
- * @return {?}
2147
- */
2148
- Select2.prototype._coerceBooleanProperty = function (value) {
2149
- return value != null && "" + value !== 'false';
2150
- };
2151
- /**
2152
- * @private
2153
- * @return {?}
2154
- */
2155
- Select2.prototype._focusSearchboxOrResultsElement = function () {
2156
- var _this = this;
2157
- if (!this.isSearchboxHidden) {
2158
- setTimeout(( /**
2159
- * @return {?}
2160
- */function () {
2161
- if (_this.searchInput && _this.searchInput.nativeElement) {
2162
- _this.searchInput.nativeElement.focus();
2163
- }
2164
- }));
2165
- }
2166
- else if (this.resultsElement) {
2167
- this.resultsElement.focus();
2168
- }
2169
- };
2170
- /**
2171
- * @private
2172
- * @param {?} state
2173
- * @return {?}
2174
- */
2175
- Select2.prototype._focus = function (state) {
2176
- if (!state && this.focused) {
2177
- this.focused = state;
2178
- this.blur.emit(this);
2179
- }
2180
- else if (state && !this.focused) {
2181
- this.focused = state;
2182
- this.focus.emit(this);
2183
- }
2184
- };
2185
- /**
2186
- * @private
2187
- * @return {?}
2188
- */
2189
- Select2.prototype._isAbobeOverlay = function () {
2190
- return this.overlay && this._overlayPosition && this.listPosition === 'auto'
2191
- ? this._overlayPosition === 'top'
2192
- : this.listPosition === 'above';
2193
- };
2194
- return Select2;
2195
- }());
2196
- Select2.decorators = [
2197
- { type: core.Component, args: [{
2198
- selector: 'select2',
2199
- template: "<div class=\"select2-label\" (click)=\"toggleOpenAndClose()\">\n <ng-content select=\"select2-label\"></ng-content>\n <span *ngIf=\"required\" class=\"select2-required\"></span>\n</div>\n<div\n class=\"select2 select2-container select2-container--default select2-container--focus\"\n [class.select2-container--below]=\"!select2above\"\n [class.select2-container--above]=\"select2above\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-container--disabled]=\"disabled\"\n>\n <div\n class=\"selection\"\n #selection\n #trigger=\"cdkOverlayOrigin\"\n [attr.tabindex]=\"!this.isOpen ? tabIndex : '-1'\"\n (click)=\"toggleOpenAndClose()\"\n (focus)=\"focusin()\"\n (blur)=\"focusout()\"\n (keydown)=\"openKey($event)\"\n cdkOverlayOrigin\n [class.select2-focused]=\"focused\"\n >\n <div\n class=\"select2-selection\"\n [class.select2-selection--multiple]=\"multiple\"\n [class.select2-selection--single]=\"!multiple\"\n role=\"combobox\"\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__rendered\" [title]=\"select2Option?.label || ''\">\n <span *ngIf=\"!select2Option\">&nbsp;</span>\n <span *ngIf=\"select2Option\" [innerHTML]=\"select2Option.label\"></span>\n <span [class.select2-selection__placeholder__option]=\"option\" class=\"select2-selection__placeholder\">{{\n placeholder\n }}</span>\n </span>\n <span\n (click)=\"reset($event)\"\n *ngIf=\"!multiple && resettable && select2Option && !(disabled || readonly)\"\n class=\"select2-selection__reset\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span *ngIf=\"!multiple\" class=\"select2-selection__arrow\" role=\"presentation\"> </span>\n <ul *ngIf=\"multiple\" class=\"select2-selection__rendered\">\n <span\n [class.select2-selection__placeholder__option]=\"select2Options?.length > 0\"\n class=\"select2-selection__placeholder\"\n >{{ placeholder }}</span\n >\n <li *ngFor=\"let op of option; trackBy: trackBy\" class=\"select2-selection__choice\" [title]=\"op.label\">\n <span\n *ngIf=\"!(disabled || readonly)\"\n (click)=\"removeSelection($event, op)\"\n class=\"select2-selection__choice__remove\"\n role=\"presentation\"\n >\u00D7</span\n >\n <span [innerHTML]=\"op.label\"></span>\n </li>\n </ul>\n </div>\n </div>\n <ng-container *ngIf=\"!overlay\">\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n </ng-container>\n\n <div class=\"select2-subscript-wrapper\">\n <ng-content select=\"select2-hint\"></ng-content>\n </div>\n</div>\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayHasBackdrop\n cdkConnectedOverlayBackdropClass=\"select2-overlay-backdrop\"\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"this.isOpen && overlay\"\n [cdkConnectedOverlayMinWidth]=\"overlayWidth\"\n [cdkConnectedOverlayHeight]=\"overlayHeight\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n (backdropClick)=\"toggleOpenAndClose()\"\n>\n <ng-container *ngTemplateOutlet=\"containerTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #containerTemplate>\n <div\n class=\"select2-container select2-container--default select2-container-dropdown\"\n [class.select2-container--open]=\"isOpen\"\n [class.select2-overlay]=\"overlay\"\n [class.select2-position-auto]=\"listPosition === 'auto'\"\n >\n <div\n #dropdown\n class=\"select2-dropdown\"\n [class.select2-dropdown--below]=\"!select2above\"\n [class.select2-dropdown--above]=\"select2above\"\n >\n <div class=\"select2-search select2-search--dropdown\" [class.select2-search--hide]=\"hideSearch()\">\n <input\n #searchInput\n [id]=\"id + '-search-field'\"\n [value]=\"searchText\"\n (keydown)=\"keyDown($event)\"\n (keyup)=\"searchUpdate($event)\"\n (change)=\"prevChange($event)\"\n class=\"select2-search__field\"\n type=\"search\"\n role=\"textbox\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [attr.tabindex]=\"this.isOpen ? tabIndex : '-1'\"\n />\n </div>\n <div class=\"select2-results\">\n <ul\n #results\n class=\"select2-results__options\"\n [style.max-height]=\"resultMaxHeight\"\n role=\"tree\"\n tabindex=\"-1\"\n infiniteScroll\n [infiniteScrollDisabled]=\"!infiniteScroll && !isOpen\"\n [infiniteScrollDistance]=\"infiniteScrollDistance\"\n [infiniteScrollThrottle]=\"infiniteScrollThrottle\"\n [infiniteScrollContainer]=\"results\"\n (scrolled)=\"onScroll('down')\"\n (scrolledUp)=\"onScroll('up')\"\n (keydown)=\"keyDown($event)\"\n >\n <ng-container *ngFor=\"let groupOrOption of filteredData; index as i; trackBy: trackBy\">\n <li *ngIf=\"groupOrOption.options\" class=\"select2-results__option\" role=\"group\">\n <strong\n *ngIf=\"!hasTemplate(groupOrOption, 'group'); else optGroup\"\n [attr.class]=\"\n 'select2-results__group' +\n (groupOrOption.classes ? ' ' + groupOrOption.classes : '')\n \"\n [innerHTML]=\"groupOrOption.label\"\n ></strong>\n <ng-template #optGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'group'); context: groupOrOption\"\n >\n </ng-container>\n </ng-template>\n\n <ul class=\"select2-results__options select2-results__options--nested\">\n <li\n *ngFor=\"let option of groupOrOption.options; index as j; trackBy: trackBy\"\n #result\n [id]=\"option.id || id + '-option-' + i + '-' + j\"\n [class]=\"getOptionStyle(option)\"\n role=\"treeitem\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"isDisabled(option)\"\n (mouseenter)=\"mouseenter(option)\"\n (click)=\"click(option)\"\n >\n <div\n *ngIf=\"!hasTemplate(option, 'option'); else liGroup\"\n class=\"select2-label-content\"\n [innerHTML]=\"option.label\"\n ></div>\n <ng-template #liGroup>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(option, 'option'); context: option\"\n >\n </ng-container>\n </ng-template>\n </li>\n </ul>\n </li>\n <li\n *ngIf=\"!groupOrOption.options\"\n #result\n [id]=\"groupOrOption.id || id + '-option-' + i\"\n [class]=\"getOptionStyle(groupOrOption)\"\n role=\"treeitem\"\n [attr.aria-selected]=\"isSelected(groupOrOption)\"\n [attr.aria-disabled]=\"isDisabled(groupOrOption)\"\n (mouseenter)=\"mouseenter(groupOrOption)\"\n (click)=\"click(groupOrOption)\"\n >\n <div\n *ngIf=\"!hasTemplate(groupOrOption, 'option'); else li\"\n [innerHTML]=\"groupOrOption.label\"\n class=\"select2-label-content\"\n ></div>\n <ng-template #li>\n <ng-container\n *ngTemplateOutlet=\"getTemplate(groupOrOption, 'option'); context: groupOrOption\"\n >\n </ng-container>\n </ng-template>\n </li>\n </ng-container>\n <li\n class=\"select2-no-result select2-results__option\"\n *ngIf=\"!filteredData?.length && noResultMessage\"\n [innerHTML]=\"noResultMessage\"\n ></li>\n </ul>\n </div>\n </div>\n </div>\n</ng-template>\n",
2200
- 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}}"]
2201
- }] }
2202
- ];
2203
- /** @nocollapse */
2204
- Select2.ctorParameters = function () { return [
2205
- { type: scrolling.ViewportRuler },
2206
- { type: core.ChangeDetectorRef },
2207
- { type: forms.NgForm, decorators: [{ type: core.Optional }] },
2208
- { type: forms.FormGroupDirective, decorators: [{ type: core.Optional }] },
2209
- { type: forms.NgControl, decorators: [{ type: core.Self }, { type: core.Optional }] },
2210
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
2211
- ]; };
2212
- Select2.propDecorators = {
2213
- data: [{ type: core.Input }],
2214
- minCharForSearch: [{ type: core.Input }],
2215
- displaySearchStatus: [{ type: core.Input }],
2216
- placeholder: [{ type: core.Input }],
2217
- customSearchEnabled: [{ type: core.Input }],
2218
- limitSelection: [{ type: core.Input }],
2219
- listPosition: [{ type: core.Input }],
2220
- multiple: [{ type: core.Input }],
2221
- overlay: [{ type: core.Input }],
2222
- styleMode: [{ type: core.Input }],
2223
- noResultMessage: [{ type: core.Input }],
2224
- infiniteScrollDistance: [{ type: core.Input }],
2225
- infiniteScrollThrottle: [{ type: core.Input }],
2226
- infiniteScroll: [{ type: core.Input }],
2227
- editPattern: [{ type: core.Input }],
2228
- templates: [{ type: core.Input }],
2229
- resultMaxHeight: [{ type: core.Input }],
2230
- update: [{ type: core.Output }],
2231
- open: [{ type: core.Output }],
2232
- close: [{ type: core.Output }],
2233
- focus: [{ type: core.Output }],
2234
- blur: [{ type: core.Output }],
2235
- search: [{ type: core.Output }],
2236
- scroll: [{ type: core.Output }],
2237
- removeOption: [{ type: core.Output }],
2238
- minCountForSearch: [{ type: core.Input }],
2239
- id: [{ type: core.Input }, { type: core.HostBinding, args: ['id',] }],
2240
- required: [{ type: core.Input }],
2241
- disabled: [{ type: core.Input }],
2242
- hideSelectedItems: [{ type: core.Input }],
2243
- readonly: [{ type: core.Input }],
2244
- value: [{ type: core.Input }],
2245
- tabIndex: [{ type: core.Input }],
2246
- resettable: [{ type: core.Input }],
2247
- ariaInvalid: [{ type: core.HostBinding, args: ['attr.aria-invalid',] }],
2248
- classMaterial: [{ type: core.HostBinding, args: ['class.material',] }],
2249
- classNostyle: [{ type: core.HostBinding, args: ['class.nostyle',] }],
2250
- select2above: [{ type: core.HostBinding, args: ['class.select2-above',] }],
2251
- cdkConnectedOverlay: [{ type: core.ViewChild, args: [overlay.CdkConnectedOverlay,] }],
2252
- selection: [{ type: core.ViewChild, args: ['selection', { static: true },] }],
2253
- resultContainer: [{ type: core.ViewChild, args: ['results',] }],
2254
- results: [{ type: core.ViewChildren, args: ['result',] }],
2255
- searchInput: [{ type: core.ViewChild, args: ['searchInput',] }],
2256
- dropdown: [{ type: core.ViewChild, args: ['dropdown',] }]
2257
- };
2258
- if (false) {
2259
- /** @type {?} */
2260
- Select2.prototype._data;
2261
- /** @type {?} */
2262
- Select2.prototype.minCharForSearch;
2263
- /** @type {?} */
2264
- Select2.prototype.displaySearchStatus;
2265
- /** @type {?} */
2266
- Select2.prototype.placeholder;
2267
- /** @type {?} */
2268
- Select2.prototype.customSearchEnabled;
2269
- /** @type {?} */
2270
- Select2.prototype.limitSelection;
2271
- /** @type {?} */
2272
- Select2.prototype.listPosition;
2273
- /**
2274
- * use the material style
2275
- * @type {?}
2276
- */
2277
- Select2.prototype.styleMode;
2278
- /**
2279
- * message when no result
2280
- * @type {?}
2281
- */
2282
- Select2.prototype.noResultMessage;
2283
- /**
2284
- * infinite scroll distance
2285
- * @type {?}
2286
- */
2287
- Select2.prototype.infiniteScrollDistance;
2288
- /**
2289
- * infinite scroll distance
2290
- * @type {?}
2291
- */
2292
- Select2.prototype.infiniteScrollThrottle;
2293
- /**
2294
- * use it for change the pattern of the filter search
2295
- * @type {?}
2296
- */
2297
- Select2.prototype.editPattern;
2298
- /**
2299
- * template for formating
2300
- * @type {?}
2301
- */
2302
- Select2.prototype.templates;
2303
- /**
2304
- * the max height of the results container when opening the select
2305
- * @type {?}
2306
- */
2307
- Select2.prototype.resultMaxHeight;
2308
- /** @type {?} */
2309
- Select2.prototype.update;
2310
- /** @type {?} */
2311
- Select2.prototype.open;
2312
- /** @type {?} */
2313
- Select2.prototype.close;
2314
- /** @type {?} */
2315
- Select2.prototype.focus;
2316
- /** @type {?} */
2317
- Select2.prototype.blur;
2318
- /** @type {?} */
2319
- Select2.prototype.search;
2320
- /** @type {?} */
2321
- Select2.prototype.scroll;
2322
- /** @type {?} */
2323
- Select2.prototype.removeOption;
2324
- /** @type {?} */
2325
- Select2.prototype.option;
2326
- /** @type {?} */
2327
- Select2.prototype.isOpen;
2328
- /** @type {?} */
2329
- Select2.prototype.searchStyle;
2330
- /**
2331
- * Whether the element is focused or not.
2332
- * @type {?}
2333
- */
2334
- Select2.prototype.focused;
2335
- /** @type {?} */
2336
- Select2.prototype.filteredData;
2337
- /** @type {?} */
2338
- Select2.prototype.overlayWidth;
2339
- /** @type {?} */
2340
- Select2.prototype.overlayHeight;
2341
- /** @type {?} */
2342
- Select2.prototype._triggerRect;
2343
- /** @type {?} */
2344
- Select2.prototype._dropdownRect;
2345
- /**
2346
- * @type {?}
2347
- * @private
2348
- */
2349
- Select2.prototype._minCountForSearch;
2350
- /**
2351
- * @type {?}
2352
- * @private
2353
- */
2354
- Select2.prototype.cdkConnectedOverlay;
2355
- /**
2356
- * @type {?}
2357
- * @private
2358
- */
2359
- Select2.prototype.selection;
2360
- /**
2361
- * @type {?}
2362
- * @private
2363
- */
2364
- Select2.prototype.resultContainer;
2365
- /**
2366
- * @type {?}
2367
- * @private
2368
- */
2369
- Select2.prototype.results;
2370
- /**
2371
- * @type {?}
2372
- * @private
2373
- */
2374
- Select2.prototype.searchInput;
2375
- /**
2376
- * @type {?}
2377
- * @private
2378
- */
2379
- Select2.prototype.dropdown;
2380
- /**
2381
- * @type {?}
2382
- * @private
2383
- */
2384
- Select2.prototype.hoveringValue;
2385
- /**
2386
- * @type {?}
2387
- * @private
2388
- */
2389
- Select2.prototype.innerSearchText;
2390
- /**
2391
- * @type {?}
2392
- * @private
2393
- */
2394
- Select2.prototype.isSearchboxHidden;
2395
- /**
2396
- * @type {?}
2397
- * @private
2398
- */
2399
- Select2.prototype.selectionElement;
2400
- /**
2401
- * @type {?}
2402
- * @private
2403
- */
2404
- Select2.prototype._stateChanges;
2405
- /**
2406
- * Tab index for the element.
2407
- * @type {?}
2408
- * @private
2409
- */
2410
- Select2.prototype._tabIndex;
2411
- /**
2412
- * @type {?}
2413
- * @private
2414
- */
2415
- Select2.prototype._disabled;
2416
- /**
2417
- * @type {?}
2418
- * @private
2419
- */
2420
- Select2.prototype._required;
2421
- /**
2422
- * @type {?}
2423
- * @private
2424
- */
2425
- Select2.prototype._readonly;
2426
- /**
2427
- * @type {?}
2428
- * @private
2429
- */
2430
- Select2.prototype._multiple;
2431
- /**
2432
- * @type {?}
2433
- * @private
2434
- */
2435
- Select2.prototype._overlay;
2436
- /**
2437
- * @type {?}
2438
- * @private
2439
- */
2440
- Select2.prototype._resettable;
2441
- /**
2442
- * @type {?}
2443
- * @private
2444
- */
2445
- Select2.prototype._hideSelectedItems;
2446
- /**
2447
- * @type {?}
2448
- * @private
2449
- */
2450
- Select2.prototype._clickDetection;
2451
- /**
2452
- * @type {?}
2453
- * @private
2454
- */
2455
- Select2.prototype._clickDetectionFc;
2456
- /**
2457
- * @type {?}
2458
- * @private
2459
- */
2460
- Select2.prototype._id;
2461
- /**
2462
- * @type {?}
2463
- * @private
2464
- */
2465
- Select2.prototype._uid;
2466
- /**
2467
- * @type {?}
2468
- * @private
2469
- */
2470
- Select2.prototype._value;
2471
- /**
2472
- * @type {?}
2473
- * @private
2474
- */
2475
- Select2.prototype._previousNativeValue;
2476
- /**
2477
- * @type {?}
2478
- * @private
2479
- */
2480
- Select2.prototype._infiniteScroll;
2481
- /**
2482
- * @type {?}
2483
- * @private
2484
- */
2485
- Select2.prototype._overlayPosition;
2486
- /**
2487
- * View -> model callback called when select has been touched
2488
- * @type {?}
2489
- * @private
2490
- */
2491
- Select2.prototype._onTouched;
2492
- /**
2493
- * View -> model callback called when value changes
2494
- * @type {?}
2495
- * @private
2496
- */
2497
- Select2.prototype._onChange;
2498
- /**
2499
- * @type {?}
2500
- * @protected
2501
- */
2502
- Select2.prototype._viewportRuler;
2503
- /**
2504
- * @type {?}
2505
- * @private
2506
- */
2507
- Select2.prototype._changeDetectorRef;
2508
- /**
2509
- * @type {?}
2510
- * @private
2511
- */
2512
- Select2.prototype._parentForm;
2513
- /**
2514
- * @type {?}
2515
- * @private
2516
- */
2517
- Select2.prototype._parentFormGroup;
2518
- /** @type {?} */
2519
- Select2.prototype._control;
2520
- }
2521
-
2522
- /**
2523
- * @fileoverview added by tsickle
2524
- * Generated from: lib/select2-hint.component.ts
2525
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2526
- */
2527
- var Select2Hint = /** @class */ (function () {
2528
- function Select2Hint() {
2529
- }
2530
- return Select2Hint;
2531
- }());
2532
- Select2Hint.decorators = [
2533
- { type: core.Directive, args: [{ selector: 'select2-hint' },] }
2534
- ];
2535
-
2536
- /**
2537
- * @fileoverview added by tsickle
2538
- * Generated from: lib/select2-label.component.ts
2539
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2540
- */
2541
- var Select2Label = /** @class */ (function () {
2542
- function Select2Label() {
2543
- }
2544
- return Select2Label;
2545
- }());
2546
- Select2Label.decorators = [
2547
- { type: core.Directive, args: [{ selector: 'select2-label' },] }
2548
- ];
2549
-
2550
- /**
2551
- * @fileoverview added by tsickle
2552
- * Generated from: lib/select2.module.ts
2553
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2554
- */
2555
- var Select2Module = /** @class */ (function () {
2556
- function Select2Module() {
2557
- }
2558
- return Select2Module;
2559
- }());
2560
- Select2Module.decorators = [
2561
- { type: core.NgModule, args: [{
2562
- imports: [common.CommonModule, forms.FormsModule, overlay.OverlayModule, forms.ReactiveFormsModule, ngxInfiniteScroll.InfiniteScrollModule],
2563
- declarations: [Select2Hint, Select2Label, Select2],
2564
- exports: [forms.FormsModule, forms.ReactiveFormsModule, Select2Hint, Select2Label, Select2],
2565
- },] }
2566
- ];
2567
-
2568
- /**
2569
- * @fileoverview added by tsickle
2570
- * Generated from: ng-select2-component.ts
2571
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2572
- */
2573
-
2574
- exports.Select2 = Select2;
2575
- exports.Select2Hint = Select2Hint;
2576
- exports.Select2Label = Select2Label;
2577
- exports.Select2Module = Select2Module;
2578
- exports.Select2Utils = Select2Utils;
2579
- exports.defaultMinCountForSearch = defaultMinCountForSearch;
2580
- exports.protectRegexp = protectRegexp;
2581
- exports.timeout = timeout;
2582
- exports.unicodePatterns = unicodePatterns;
2583
-
2584
- Object.defineProperty(exports, '__esModule', { value: true });
2585
-
2586
- })));
2587
- //# sourceMappingURL=ng-select2-component.umd.js.map