@ng-select/ng-select 7.4.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +2 -1
  2. package/esm2020/lib/config.service.mjs +21 -0
  3. package/esm2020/lib/console.service.mjs +14 -0
  4. package/{esm2015/lib/id.js → esm2020/lib/id.mjs} +3 -3
  5. package/esm2020/lib/items-list.mjs +356 -0
  6. package/esm2020/lib/ng-dropdown-panel.component.mjs +403 -0
  7. package/esm2020/lib/ng-dropdown-panel.service.mjs +68 -0
  8. package/esm2020/lib/ng-option.component.mjs +54 -0
  9. package/esm2020/lib/ng-select.component.mjs +991 -0
  10. package/esm2020/lib/ng-select.module.mjs +87 -0
  11. package/{esm2015/lib/ng-select.types.js → esm2020/lib/ng-select.types.mjs} +1 -1
  12. package/esm2020/lib/ng-templates.directive.mjs +157 -0
  13. package/{esm2015/lib/search-helper.js → esm2020/lib/search-helper.mjs} +2 -4
  14. package/{esm2015/lib/selection-model.js → esm2020/lib/selection-model.mjs} +0 -0
  15. package/{esm2015/lib/value-utils.js → esm2020/lib/value-utils.mjs} +5 -5
  16. package/esm2020/ng-select-ng-select.mjs +5 -0
  17. package/esm2020/public-api.mjs +9 -0
  18. package/fesm2015/{ng-select-ng-select.js → ng-select-ng-select.mjs} +507 -303
  19. package/fesm2015/ng-select-ng-select.mjs.map +1 -0
  20. package/fesm2020/ng-select-ng-select.mjs +3088 -0
  21. package/fesm2020/ng-select-ng-select.mjs.map +1 -0
  22. package/lib/config.service.d.ts +3 -0
  23. package/lib/console.service.d.ts +3 -0
  24. package/lib/ng-dropdown-panel.component.d.ts +4 -1
  25. package/lib/ng-dropdown-panel.service.d.ts +3 -0
  26. package/lib/ng-option.component.d.ts +3 -0
  27. package/lib/ng-select.component.d.ts +11 -8
  28. package/lib/ng-select.module.d.ts +9 -0
  29. package/lib/ng-select.types.d.ts +2 -1
  30. package/lib/ng-templates.directive.d.ts +25 -0
  31. package/lib/value-utils.d.ts +1 -1
  32. package/ng-select-ng-select.d.ts +1 -6
  33. package/package.json +24 -12
  34. package/public-api.d.ts +4 -2
  35. package/bundles/ng-select-ng-select.umd.js +0 -3508
  36. package/bundles/ng-select-ng-select.umd.js.map +0 -1
  37. package/esm2015/lib/config.service.js +0 -19
  38. package/esm2015/lib/console.service.js +0 -12
  39. package/esm2015/lib/items-list.js +0 -356
  40. package/esm2015/lib/ng-dropdown-panel.component.js +0 -370
  41. package/esm2015/lib/ng-dropdown-panel.service.js +0 -65
  42. package/esm2015/lib/ng-option.component.js +0 -53
  43. package/esm2015/lib/ng-select.component.js +0 -861
  44. package/esm2015/lib/ng-select.module.js +0 -54
  45. package/esm2015/lib/ng-templates.directive.js +0 -145
  46. package/esm2015/ng-select-ng-select.js +0 -11
  47. package/esm2015/public-api.js +0 -7
  48. package/fesm2015/ng-select-ng-select.js.map +0 -1
  49. package/ng-select-ng-select.metadata.json +0 -1
@@ -1,3508 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('rxjs/operators'), require('rxjs'), require('@angular/common')) :
3
- typeof define === 'function' && define.amd ? define('@ng-select/ng-select', ['exports', '@angular/core', '@angular/forms', 'rxjs/operators', 'rxjs', '@angular/common'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["ng-select"] = global["ng-select"] || {}, global["ng-select"]["ng-select"] = {}), global.ng.core, global.ng.forms, global.rxjs.operators, global.rxjs, global.ng.common));
5
- })(this, (function (exports, i0, forms, operators, rxjs, common) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
-
27
- /*! *****************************************************************************
28
- Copyright (c) Microsoft Corporation.
29
-
30
- Permission to use, copy, modify, and/or distribute this software for any
31
- purpose with or without fee is hereby granted.
32
-
33
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
34
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
35
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
36
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
37
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
38
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39
- PERFORMANCE OF THIS SOFTWARE.
40
- ***************************************************************************** */
41
- /* global Reflect, Promise */
42
- var extendStatics = function (d, b) {
43
- extendStatics = Object.setPrototypeOf ||
44
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45
- function (d, b) { for (var p in b)
46
- if (Object.prototype.hasOwnProperty.call(b, p))
47
- d[p] = b[p]; };
48
- return extendStatics(d, b);
49
- };
50
- function __extends(d, b) {
51
- if (typeof b !== "function" && b !== null)
52
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
53
- extendStatics(d, b);
54
- function __() { this.constructor = d; }
55
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
56
- }
57
- var __assign = function () {
58
- __assign = Object.assign || function __assign(t) {
59
- for (var s, i = 1, n = arguments.length; i < n; i++) {
60
- s = arguments[i];
61
- for (var p in s)
62
- if (Object.prototype.hasOwnProperty.call(s, p))
63
- t[p] = s[p];
64
- }
65
- return t;
66
- };
67
- return __assign.apply(this, arguments);
68
- };
69
- function __rest(s, e) {
70
- var t = {};
71
- for (var p in s)
72
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
73
- t[p] = s[p];
74
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
75
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
76
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
77
- t[p[i]] = s[p[i]];
78
- }
79
- return t;
80
- }
81
- function __decorate(decorators, target, key, desc) {
82
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
83
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
84
- r = Reflect.decorate(decorators, target, key, desc);
85
- else
86
- for (var i = decorators.length - 1; i >= 0; i--)
87
- if (d = decorators[i])
88
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
89
- return c > 3 && r && Object.defineProperty(target, key, r), r;
90
- }
91
- function __param(paramIndex, decorator) {
92
- return function (target, key) { decorator(target, key, paramIndex); };
93
- }
94
- function __metadata(metadataKey, metadataValue) {
95
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
96
- return Reflect.metadata(metadataKey, metadataValue);
97
- }
98
- function __awaiter(thisArg, _arguments, P, generator) {
99
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
100
- return new (P || (P = Promise))(function (resolve, reject) {
101
- function fulfilled(value) { try {
102
- step(generator.next(value));
103
- }
104
- catch (e) {
105
- reject(e);
106
- } }
107
- function rejected(value) { try {
108
- step(generator["throw"](value));
109
- }
110
- catch (e) {
111
- reject(e);
112
- } }
113
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
114
- step((generator = generator.apply(thisArg, _arguments || [])).next());
115
- });
116
- }
117
- function __generator(thisArg, body) {
118
- var _ = { label: 0, sent: function () { if (t[0] & 1)
119
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
120
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
121
- function verb(n) { return function (v) { return step([n, v]); }; }
122
- function step(op) {
123
- if (f)
124
- throw new TypeError("Generator is already executing.");
125
- while (_)
126
- try {
127
- 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)
128
- return t;
129
- if (y = 0, t)
130
- op = [op[0] & 2, t.value];
131
- switch (op[0]) {
132
- case 0:
133
- case 1:
134
- t = op;
135
- break;
136
- case 4:
137
- _.label++;
138
- return { value: op[1], done: false };
139
- case 5:
140
- _.label++;
141
- y = op[1];
142
- op = [0];
143
- continue;
144
- case 7:
145
- op = _.ops.pop();
146
- _.trys.pop();
147
- continue;
148
- default:
149
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
150
- _ = 0;
151
- continue;
152
- }
153
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
154
- _.label = op[1];
155
- break;
156
- }
157
- if (op[0] === 6 && _.label < t[1]) {
158
- _.label = t[1];
159
- t = op;
160
- break;
161
- }
162
- if (t && _.label < t[2]) {
163
- _.label = t[2];
164
- _.ops.push(op);
165
- break;
166
- }
167
- if (t[2])
168
- _.ops.pop();
169
- _.trys.pop();
170
- continue;
171
- }
172
- op = body.call(thisArg, _);
173
- }
174
- catch (e) {
175
- op = [6, e];
176
- y = 0;
177
- }
178
- finally {
179
- f = t = 0;
180
- }
181
- if (op[0] & 5)
182
- throw op[1];
183
- return { value: op[0] ? op[1] : void 0, done: true };
184
- }
185
- }
186
- var __createBinding = Object.create ? (function (o, m, k, k2) {
187
- if (k2 === undefined)
188
- k2 = k;
189
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
190
- }) : (function (o, m, k, k2) {
191
- if (k2 === undefined)
192
- k2 = k;
193
- o[k2] = m[k];
194
- });
195
- function __exportStar(m, o) {
196
- for (var p in m)
197
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
198
- __createBinding(o, m, p);
199
- }
200
- function __values(o) {
201
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
202
- if (m)
203
- return m.call(o);
204
- if (o && typeof o.length === "number")
205
- return {
206
- next: function () {
207
- if (o && i >= o.length)
208
- o = void 0;
209
- return { value: o && o[i++], done: !o };
210
- }
211
- };
212
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
213
- }
214
- function __read(o, n) {
215
- var m = typeof Symbol === "function" && o[Symbol.iterator];
216
- if (!m)
217
- return o;
218
- var i = m.call(o), r, ar = [], e;
219
- try {
220
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
221
- ar.push(r.value);
222
- }
223
- catch (error) {
224
- e = { error: error };
225
- }
226
- finally {
227
- try {
228
- if (r && !r.done && (m = i["return"]))
229
- m.call(i);
230
- }
231
- finally {
232
- if (e)
233
- throw e.error;
234
- }
235
- }
236
- return ar;
237
- }
238
- /** @deprecated */
239
- function __spread() {
240
- for (var ar = [], i = 0; i < arguments.length; i++)
241
- ar = ar.concat(__read(arguments[i]));
242
- return ar;
243
- }
244
- /** @deprecated */
245
- function __spreadArrays() {
246
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
247
- s += arguments[i].length;
248
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
249
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
250
- r[k] = a[j];
251
- return r;
252
- }
253
- function __spreadArray(to, from, pack) {
254
- if (pack || arguments.length === 2)
255
- for (var i = 0, l = from.length, ar; i < l; i++) {
256
- if (ar || !(i in from)) {
257
- if (!ar)
258
- ar = Array.prototype.slice.call(from, 0, i);
259
- ar[i] = from[i];
260
- }
261
- }
262
- return to.concat(ar || Array.prototype.slice.call(from));
263
- }
264
- function __await(v) {
265
- return this instanceof __await ? (this.v = v, this) : new __await(v);
266
- }
267
- function __asyncGenerator(thisArg, _arguments, generator) {
268
- if (!Symbol.asyncIterator)
269
- throw new TypeError("Symbol.asyncIterator is not defined.");
270
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
271
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
272
- function verb(n) { if (g[n])
273
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
274
- function resume(n, v) { try {
275
- step(g[n](v));
276
- }
277
- catch (e) {
278
- settle(q[0][3], e);
279
- } }
280
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
281
- function fulfill(value) { resume("next", value); }
282
- function reject(value) { resume("throw", value); }
283
- function settle(f, v) { if (f(v), q.shift(), q.length)
284
- resume(q[0][0], q[0][1]); }
285
- }
286
- function __asyncDelegator(o) {
287
- var i, p;
288
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
289
- 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; }
290
- }
291
- function __asyncValues(o) {
292
- if (!Symbol.asyncIterator)
293
- throw new TypeError("Symbol.asyncIterator is not defined.");
294
- var m = o[Symbol.asyncIterator], i;
295
- 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);
296
- 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); }); }; }
297
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
298
- }
299
- function __makeTemplateObject(cooked, raw) {
300
- if (Object.defineProperty) {
301
- Object.defineProperty(cooked, "raw", { value: raw });
302
- }
303
- else {
304
- cooked.raw = raw;
305
- }
306
- return cooked;
307
- }
308
- ;
309
- var __setModuleDefault = Object.create ? (function (o, v) {
310
- Object.defineProperty(o, "default", { enumerable: true, value: v });
311
- }) : function (o, v) {
312
- o["default"] = v;
313
- };
314
- function __importStar(mod) {
315
- if (mod && mod.__esModule)
316
- return mod;
317
- var result = {};
318
- if (mod != null)
319
- for (var k in mod)
320
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
321
- __createBinding(result, mod, k);
322
- __setModuleDefault(result, mod);
323
- return result;
324
- }
325
- function __importDefault(mod) {
326
- return (mod && mod.__esModule) ? mod : { default: mod };
327
- }
328
- function __classPrivateFieldGet(receiver, state, kind, f) {
329
- if (kind === "a" && !f)
330
- throw new TypeError("Private accessor was defined without a getter");
331
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
332
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
333
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
334
- }
335
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
336
- if (kind === "m")
337
- throw new TypeError("Private method is not writable");
338
- if (kind === "a" && !f)
339
- throw new TypeError("Private accessor was defined without a setter");
340
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
341
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
342
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
343
- }
344
-
345
- var unescapedHTMLExp = /[&<>"']/g;
346
- var hasUnescapedHTMLExp = RegExp(unescapedHTMLExp.source);
347
- var htmlEscapes = {
348
- '&': '&amp;',
349
- '<': '&lt;',
350
- '>': '&gt;',
351
- '"': '&quot;',
352
- '\'': '&#39;'
353
- };
354
- function escapeHTML(string) {
355
- return (string && hasUnescapedHTMLExp.test(string)) ?
356
- string.replace(unescapedHTMLExp, function (chr) { return htmlEscapes[chr]; }) :
357
- string;
358
- }
359
- function isDefined(value) {
360
- return value !== undefined && value !== null;
361
- }
362
- function isObject(value) {
363
- return typeof value === 'object' && isDefined(value);
364
- }
365
- function isPromise(value) {
366
- return value instanceof Promise;
367
- }
368
- function isFunction(value) {
369
- return value instanceof Function;
370
- }
371
-
372
- var NgItemLabelDirective = /** @class */ (function () {
373
- function NgItemLabelDirective(element) {
374
- this.element = element;
375
- this.escape = true;
376
- }
377
- NgItemLabelDirective.prototype.ngOnChanges = function (changes) {
378
- this.element.nativeElement.innerHTML = this.escape ?
379
- escapeHTML(this.ngItemLabel) :
380
- this.ngItemLabel;
381
- };
382
- return NgItemLabelDirective;
383
- }());
384
- NgItemLabelDirective.decorators = [
385
- { type: i0.Directive, args: [{ selector: '[ngItemLabel]' },] }
386
- ];
387
- NgItemLabelDirective.ctorParameters = function () { return [
388
- { type: i0.ElementRef }
389
- ]; };
390
- NgItemLabelDirective.propDecorators = {
391
- ngItemLabel: [{ type: i0.Input }],
392
- escape: [{ type: i0.Input }]
393
- };
394
- var NgOptionTemplateDirective = /** @class */ (function () {
395
- function NgOptionTemplateDirective(template) {
396
- this.template = template;
397
- }
398
- return NgOptionTemplateDirective;
399
- }());
400
- NgOptionTemplateDirective.decorators = [
401
- { type: i0.Directive, args: [{ selector: '[ng-option-tmp]' },] }
402
- ];
403
- NgOptionTemplateDirective.ctorParameters = function () { return [
404
- { type: i0.TemplateRef }
405
- ]; };
406
- var NgOptgroupTemplateDirective = /** @class */ (function () {
407
- function NgOptgroupTemplateDirective(template) {
408
- this.template = template;
409
- }
410
- return NgOptgroupTemplateDirective;
411
- }());
412
- NgOptgroupTemplateDirective.decorators = [
413
- { type: i0.Directive, args: [{ selector: '[ng-optgroup-tmp]' },] }
414
- ];
415
- NgOptgroupTemplateDirective.ctorParameters = function () { return [
416
- { type: i0.TemplateRef }
417
- ]; };
418
- var NgLabelTemplateDirective = /** @class */ (function () {
419
- function NgLabelTemplateDirective(template) {
420
- this.template = template;
421
- }
422
- return NgLabelTemplateDirective;
423
- }());
424
- NgLabelTemplateDirective.decorators = [
425
- { type: i0.Directive, args: [{ selector: '[ng-label-tmp]' },] }
426
- ];
427
- NgLabelTemplateDirective.ctorParameters = function () { return [
428
- { type: i0.TemplateRef }
429
- ]; };
430
- var NgMultiLabelTemplateDirective = /** @class */ (function () {
431
- function NgMultiLabelTemplateDirective(template) {
432
- this.template = template;
433
- }
434
- return NgMultiLabelTemplateDirective;
435
- }());
436
- NgMultiLabelTemplateDirective.decorators = [
437
- { type: i0.Directive, args: [{ selector: '[ng-multi-label-tmp]' },] }
438
- ];
439
- NgMultiLabelTemplateDirective.ctorParameters = function () { return [
440
- { type: i0.TemplateRef }
441
- ]; };
442
- var NgHeaderTemplateDirective = /** @class */ (function () {
443
- function NgHeaderTemplateDirective(template) {
444
- this.template = template;
445
- }
446
- return NgHeaderTemplateDirective;
447
- }());
448
- NgHeaderTemplateDirective.decorators = [
449
- { type: i0.Directive, args: [{ selector: '[ng-header-tmp]' },] }
450
- ];
451
- NgHeaderTemplateDirective.ctorParameters = function () { return [
452
- { type: i0.TemplateRef }
453
- ]; };
454
- var NgFooterTemplateDirective = /** @class */ (function () {
455
- function NgFooterTemplateDirective(template) {
456
- this.template = template;
457
- }
458
- return NgFooterTemplateDirective;
459
- }());
460
- NgFooterTemplateDirective.decorators = [
461
- { type: i0.Directive, args: [{ selector: '[ng-footer-tmp]' },] }
462
- ];
463
- NgFooterTemplateDirective.ctorParameters = function () { return [
464
- { type: i0.TemplateRef }
465
- ]; };
466
- var NgNotFoundTemplateDirective = /** @class */ (function () {
467
- function NgNotFoundTemplateDirective(template) {
468
- this.template = template;
469
- }
470
- return NgNotFoundTemplateDirective;
471
- }());
472
- NgNotFoundTemplateDirective.decorators = [
473
- { type: i0.Directive, args: [{ selector: '[ng-notfound-tmp]' },] }
474
- ];
475
- NgNotFoundTemplateDirective.ctorParameters = function () { return [
476
- { type: i0.TemplateRef }
477
- ]; };
478
- var NgTypeToSearchTemplateDirective = /** @class */ (function () {
479
- function NgTypeToSearchTemplateDirective(template) {
480
- this.template = template;
481
- }
482
- return NgTypeToSearchTemplateDirective;
483
- }());
484
- NgTypeToSearchTemplateDirective.decorators = [
485
- { type: i0.Directive, args: [{ selector: '[ng-typetosearch-tmp]' },] }
486
- ];
487
- NgTypeToSearchTemplateDirective.ctorParameters = function () { return [
488
- { type: i0.TemplateRef }
489
- ]; };
490
- var NgLoadingTextTemplateDirective = /** @class */ (function () {
491
- function NgLoadingTextTemplateDirective(template) {
492
- this.template = template;
493
- }
494
- return NgLoadingTextTemplateDirective;
495
- }());
496
- NgLoadingTextTemplateDirective.decorators = [
497
- { type: i0.Directive, args: [{ selector: '[ng-loadingtext-tmp]' },] }
498
- ];
499
- NgLoadingTextTemplateDirective.ctorParameters = function () { return [
500
- { type: i0.TemplateRef }
501
- ]; };
502
- var NgTagTemplateDirective = /** @class */ (function () {
503
- function NgTagTemplateDirective(template) {
504
- this.template = template;
505
- }
506
- return NgTagTemplateDirective;
507
- }());
508
- NgTagTemplateDirective.decorators = [
509
- { type: i0.Directive, args: [{ selector: '[ng-tag-tmp]' },] }
510
- ];
511
- NgTagTemplateDirective.ctorParameters = function () { return [
512
- { type: i0.TemplateRef }
513
- ]; };
514
- var NgLoadingSpinnerTemplateDirective = /** @class */ (function () {
515
- function NgLoadingSpinnerTemplateDirective(template) {
516
- this.template = template;
517
- }
518
- return NgLoadingSpinnerTemplateDirective;
519
- }());
520
- NgLoadingSpinnerTemplateDirective.decorators = [
521
- { type: i0.Directive, args: [{ selector: '[ng-loadingspinner-tmp]' },] }
522
- ];
523
- NgLoadingSpinnerTemplateDirective.ctorParameters = function () { return [
524
- { type: i0.TemplateRef }
525
- ]; };
526
-
527
- var ConsoleService = /** @class */ (function () {
528
- function ConsoleService() {
529
- }
530
- ConsoleService.prototype.warn = function (message) {
531
- console.warn(message);
532
- };
533
- return ConsoleService;
534
- }());
535
- ConsoleService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ConsoleService_Factory() { return new ConsoleService(); }, token: ConsoleService, providedIn: "root" });
536
- ConsoleService.decorators = [
537
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
538
- ];
539
-
540
- function newId() {
541
- // First character is an 'a', it's good practice to tag id to begin with a letter
542
- return 'axxxxxxxxxxx'.replace(/[x]/g, function (_) {
543
- // tslint:disable-next-line:no-bitwise
544
- var val = Math.random() * 16 | 0;
545
- return val.toString(16);
546
- });
547
- }
548
-
549
- var diacritics = {
550
- '\u24B6': 'A',
551
- '\uFF21': 'A',
552
- '\u00C0': 'A',
553
- '\u00C1': 'A',
554
- '\u00C2': 'A',
555
- '\u1EA6': 'A',
556
- '\u1EA4': 'A',
557
- '\u1EAA': 'A',
558
- '\u1EA8': 'A',
559
- '\u00C3': 'A',
560
- '\u0100': 'A',
561
- '\u0102': 'A',
562
- '\u1EB0': 'A',
563
- '\u1EAE': 'A',
564
- '\u1EB4': 'A',
565
- '\u1EB2': 'A',
566
- '\u0226': 'A',
567
- '\u01E0': 'A',
568
- '\u00C4': 'A',
569
- '\u01DE': 'A',
570
- '\u1EA2': 'A',
571
- '\u00C5': 'A',
572
- '\u01FA': 'A',
573
- '\u01CD': 'A',
574
- '\u0200': 'A',
575
- '\u0202': 'A',
576
- '\u1EA0': 'A',
577
- '\u1EAC': 'A',
578
- '\u1EB6': 'A',
579
- '\u1E00': 'A',
580
- '\u0104': 'A',
581
- '\u023A': 'A',
582
- '\u2C6F': 'A',
583
- '\uA732': 'AA',
584
- '\u00C6': 'AE',
585
- '\u01FC': 'AE',
586
- '\u01E2': 'AE',
587
- '\uA734': 'AO',
588
- '\uA736': 'AU',
589
- '\uA738': 'AV',
590
- '\uA73A': 'AV',
591
- '\uA73C': 'AY',
592
- '\u24B7': 'B',
593
- '\uFF22': 'B',
594
- '\u1E02': 'B',
595
- '\u1E04': 'B',
596
- '\u1E06': 'B',
597
- '\u0243': 'B',
598
- '\u0182': 'B',
599
- '\u0181': 'B',
600
- '\u24B8': 'C',
601
- '\uFF23': 'C',
602
- '\u0106': 'C',
603
- '\u0108': 'C',
604
- '\u010A': 'C',
605
- '\u010C': 'C',
606
- '\u00C7': 'C',
607
- '\u1E08': 'C',
608
- '\u0187': 'C',
609
- '\u023B': 'C',
610
- '\uA73E': 'C',
611
- '\u24B9': 'D',
612
- '\uFF24': 'D',
613
- '\u1E0A': 'D',
614
- '\u010E': 'D',
615
- '\u1E0C': 'D',
616
- '\u1E10': 'D',
617
- '\u1E12': 'D',
618
- '\u1E0E': 'D',
619
- '\u0110': 'D',
620
- '\u018B': 'D',
621
- '\u018A': 'D',
622
- '\u0189': 'D',
623
- '\uA779': 'D',
624
- '\u01F1': 'DZ',
625
- '\u01C4': 'DZ',
626
- '\u01F2': 'Dz',
627
- '\u01C5': 'Dz',
628
- '\u24BA': 'E',
629
- '\uFF25': 'E',
630
- '\u00C8': 'E',
631
- '\u00C9': 'E',
632
- '\u00CA': 'E',
633
- '\u1EC0': 'E',
634
- '\u1EBE': 'E',
635
- '\u1EC4': 'E',
636
- '\u1EC2': 'E',
637
- '\u1EBC': 'E',
638
- '\u0112': 'E',
639
- '\u1E14': 'E',
640
- '\u1E16': 'E',
641
- '\u0114': 'E',
642
- '\u0116': 'E',
643
- '\u00CB': 'E',
644
- '\u1EBA': 'E',
645
- '\u011A': 'E',
646
- '\u0204': 'E',
647
- '\u0206': 'E',
648
- '\u1EB8': 'E',
649
- '\u1EC6': 'E',
650
- '\u0228': 'E',
651
- '\u1E1C': 'E',
652
- '\u0118': 'E',
653
- '\u1E18': 'E',
654
- '\u1E1A': 'E',
655
- '\u0190': 'E',
656
- '\u018E': 'E',
657
- '\u24BB': 'F',
658
- '\uFF26': 'F',
659
- '\u1E1E': 'F',
660
- '\u0191': 'F',
661
- '\uA77B': 'F',
662
- '\u24BC': 'G',
663
- '\uFF27': 'G',
664
- '\u01F4': 'G',
665
- '\u011C': 'G',
666
- '\u1E20': 'G',
667
- '\u011E': 'G',
668
- '\u0120': 'G',
669
- '\u01E6': 'G',
670
- '\u0122': 'G',
671
- '\u01E4': 'G',
672
- '\u0193': 'G',
673
- '\uA7A0': 'G',
674
- '\uA77D': 'G',
675
- '\uA77E': 'G',
676
- '\u24BD': 'H',
677
- '\uFF28': 'H',
678
- '\u0124': 'H',
679
- '\u1E22': 'H',
680
- '\u1E26': 'H',
681
- '\u021E': 'H',
682
- '\u1E24': 'H',
683
- '\u1E28': 'H',
684
- '\u1E2A': 'H',
685
- '\u0126': 'H',
686
- '\u2C67': 'H',
687
- '\u2C75': 'H',
688
- '\uA78D': 'H',
689
- '\u24BE': 'I',
690
- '\uFF29': 'I',
691
- '\u00CC': 'I',
692
- '\u00CD': 'I',
693
- '\u00CE': 'I',
694
- '\u0128': 'I',
695
- '\u012A': 'I',
696
- '\u012C': 'I',
697
- '\u0130': 'I',
698
- '\u00CF': 'I',
699
- '\u1E2E': 'I',
700
- '\u1EC8': 'I',
701
- '\u01CF': 'I',
702
- '\u0208': 'I',
703
- '\u020A': 'I',
704
- '\u1ECA': 'I',
705
- '\u012E': 'I',
706
- '\u1E2C': 'I',
707
- '\u0197': 'I',
708
- '\u24BF': 'J',
709
- '\uFF2A': 'J',
710
- '\u0134': 'J',
711
- '\u0248': 'J',
712
- '\u24C0': 'K',
713
- '\uFF2B': 'K',
714
- '\u1E30': 'K',
715
- '\u01E8': 'K',
716
- '\u1E32': 'K',
717
- '\u0136': 'K',
718
- '\u1E34': 'K',
719
- '\u0198': 'K',
720
- '\u2C69': 'K',
721
- '\uA740': 'K',
722
- '\uA742': 'K',
723
- '\uA744': 'K',
724
- '\uA7A2': 'K',
725
- '\u24C1': 'L',
726
- '\uFF2C': 'L',
727
- '\u013F': 'L',
728
- '\u0139': 'L',
729
- '\u013D': 'L',
730
- '\u1E36': 'L',
731
- '\u1E38': 'L',
732
- '\u013B': 'L',
733
- '\u1E3C': 'L',
734
- '\u1E3A': 'L',
735
- '\u0141': 'L',
736
- '\u023D': 'L',
737
- '\u2C62': 'L',
738
- '\u2C60': 'L',
739
- '\uA748': 'L',
740
- '\uA746': 'L',
741
- '\uA780': 'L',
742
- '\u01C7': 'LJ',
743
- '\u01C8': 'Lj',
744
- '\u24C2': 'M',
745
- '\uFF2D': 'M',
746
- '\u1E3E': 'M',
747
- '\u1E40': 'M',
748
- '\u1E42': 'M',
749
- '\u2C6E': 'M',
750
- '\u019C': 'M',
751
- '\u24C3': 'N',
752
- '\uFF2E': 'N',
753
- '\u01F8': 'N',
754
- '\u0143': 'N',
755
- '\u00D1': 'N',
756
- '\u1E44': 'N',
757
- '\u0147': 'N',
758
- '\u1E46': 'N',
759
- '\u0145': 'N',
760
- '\u1E4A': 'N',
761
- '\u1E48': 'N',
762
- '\u0220': 'N',
763
- '\u019D': 'N',
764
- '\uA790': 'N',
765
- '\uA7A4': 'N',
766
- '\u01CA': 'NJ',
767
- '\u01CB': 'Nj',
768
- '\u24C4': 'O',
769
- '\uFF2F': 'O',
770
- '\u00D2': 'O',
771
- '\u00D3': 'O',
772
- '\u00D4': 'O',
773
- '\u1ED2': 'O',
774
- '\u1ED0': 'O',
775
- '\u1ED6': 'O',
776
- '\u1ED4': 'O',
777
- '\u00D5': 'O',
778
- '\u1E4C': 'O',
779
- '\u022C': 'O',
780
- '\u1E4E': 'O',
781
- '\u014C': 'O',
782
- '\u1E50': 'O',
783
- '\u1E52': 'O',
784
- '\u014E': 'O',
785
- '\u022E': 'O',
786
- '\u0230': 'O',
787
- '\u00D6': 'O',
788
- '\u022A': 'O',
789
- '\u1ECE': 'O',
790
- '\u0150': 'O',
791
- '\u01D1': 'O',
792
- '\u020C': 'O',
793
- '\u020E': 'O',
794
- '\u01A0': 'O',
795
- '\u1EDC': 'O',
796
- '\u1EDA': 'O',
797
- '\u1EE0': 'O',
798
- '\u1EDE': 'O',
799
- '\u1EE2': 'O',
800
- '\u1ECC': 'O',
801
- '\u1ED8': 'O',
802
- '\u01EA': 'O',
803
- '\u01EC': 'O',
804
- '\u00D8': 'O',
805
- '\u01FE': 'O',
806
- '\u0186': 'O',
807
- '\u019F': 'O',
808
- '\uA74A': 'O',
809
- '\uA74C': 'O',
810
- '\u01A2': 'OI',
811
- '\uA74E': 'OO',
812
- '\u0222': 'OU',
813
- '\u24C5': 'P',
814
- '\uFF30': 'P',
815
- '\u1E54': 'P',
816
- '\u1E56': 'P',
817
- '\u01A4': 'P',
818
- '\u2C63': 'P',
819
- '\uA750': 'P',
820
- '\uA752': 'P',
821
- '\uA754': 'P',
822
- '\u24C6': 'Q',
823
- '\uFF31': 'Q',
824
- '\uA756': 'Q',
825
- '\uA758': 'Q',
826
- '\u024A': 'Q',
827
- '\u24C7': 'R',
828
- '\uFF32': 'R',
829
- '\u0154': 'R',
830
- '\u1E58': 'R',
831
- '\u0158': 'R',
832
- '\u0210': 'R',
833
- '\u0212': 'R',
834
- '\u1E5A': 'R',
835
- '\u1E5C': 'R',
836
- '\u0156': 'R',
837
- '\u1E5E': 'R',
838
- '\u024C': 'R',
839
- '\u2C64': 'R',
840
- '\uA75A': 'R',
841
- '\uA7A6': 'R',
842
- '\uA782': 'R',
843
- '\u24C8': 'S',
844
- '\uFF33': 'S',
845
- '\u1E9E': 'S',
846
- '\u015A': 'S',
847
- '\u1E64': 'S',
848
- '\u015C': 'S',
849
- '\u1E60': 'S',
850
- '\u0160': 'S',
851
- '\u1E66': 'S',
852
- '\u1E62': 'S',
853
- '\u1E68': 'S',
854
- '\u0218': 'S',
855
- '\u015E': 'S',
856
- '\u2C7E': 'S',
857
- '\uA7A8': 'S',
858
- '\uA784': 'S',
859
- '\u24C9': 'T',
860
- '\uFF34': 'T',
861
- '\u1E6A': 'T',
862
- '\u0164': 'T',
863
- '\u1E6C': 'T',
864
- '\u021A': 'T',
865
- '\u0162': 'T',
866
- '\u1E70': 'T',
867
- '\u1E6E': 'T',
868
- '\u0166': 'T',
869
- '\u01AC': 'T',
870
- '\u01AE': 'T',
871
- '\u023E': 'T',
872
- '\uA786': 'T',
873
- '\uA728': 'TZ',
874
- '\u24CA': 'U',
875
- '\uFF35': 'U',
876
- '\u00D9': 'U',
877
- '\u00DA': 'U',
878
- '\u00DB': 'U',
879
- '\u0168': 'U',
880
- '\u1E78': 'U',
881
- '\u016A': 'U',
882
- '\u1E7A': 'U',
883
- '\u016C': 'U',
884
- '\u00DC': 'U',
885
- '\u01DB': 'U',
886
- '\u01D7': 'U',
887
- '\u01D5': 'U',
888
- '\u01D9': 'U',
889
- '\u1EE6': 'U',
890
- '\u016E': 'U',
891
- '\u0170': 'U',
892
- '\u01D3': 'U',
893
- '\u0214': 'U',
894
- '\u0216': 'U',
895
- '\u01AF': 'U',
896
- '\u1EEA': 'U',
897
- '\u1EE8': 'U',
898
- '\u1EEE': 'U',
899
- '\u1EEC': 'U',
900
- '\u1EF0': 'U',
901
- '\u1EE4': 'U',
902
- '\u1E72': 'U',
903
- '\u0172': 'U',
904
- '\u1E76': 'U',
905
- '\u1E74': 'U',
906
- '\u0244': 'U',
907
- '\u24CB': 'V',
908
- '\uFF36': 'V',
909
- '\u1E7C': 'V',
910
- '\u1E7E': 'V',
911
- '\u01B2': 'V',
912
- '\uA75E': 'V',
913
- '\u0245': 'V',
914
- '\uA760': 'VY',
915
- '\u24CC': 'W',
916
- '\uFF37': 'W',
917
- '\u1E80': 'W',
918
- '\u1E82': 'W',
919
- '\u0174': 'W',
920
- '\u1E86': 'W',
921
- '\u1E84': 'W',
922
- '\u1E88': 'W',
923
- '\u2C72': 'W',
924
- '\u24CD': 'X',
925
- '\uFF38': 'X',
926
- '\u1E8A': 'X',
927
- '\u1E8C': 'X',
928
- '\u24CE': 'Y',
929
- '\uFF39': 'Y',
930
- '\u1EF2': 'Y',
931
- '\u00DD': 'Y',
932
- '\u0176': 'Y',
933
- '\u1EF8': 'Y',
934
- '\u0232': 'Y',
935
- '\u1E8E': 'Y',
936
- '\u0178': 'Y',
937
- '\u1EF6': 'Y',
938
- '\u1EF4': 'Y',
939
- '\u01B3': 'Y',
940
- '\u024E': 'Y',
941
- '\u1EFE': 'Y',
942
- '\u24CF': 'Z',
943
- '\uFF3A': 'Z',
944
- '\u0179': 'Z',
945
- '\u1E90': 'Z',
946
- '\u017B': 'Z',
947
- '\u017D': 'Z',
948
- '\u1E92': 'Z',
949
- '\u1E94': 'Z',
950
- '\u01B5': 'Z',
951
- '\u0224': 'Z',
952
- '\u2C7F': 'Z',
953
- '\u2C6B': 'Z',
954
- '\uA762': 'Z',
955
- '\u24D0': 'a',
956
- '\uFF41': 'a',
957
- '\u1E9A': 'a',
958
- '\u00E0': 'a',
959
- '\u00E1': 'a',
960
- '\u00E2': 'a',
961
- '\u1EA7': 'a',
962
- '\u1EA5': 'a',
963
- '\u1EAB': 'a',
964
- '\u1EA9': 'a',
965
- '\u00E3': 'a',
966
- '\u0101': 'a',
967
- '\u0103': 'a',
968
- '\u1EB1': 'a',
969
- '\u1EAF': 'a',
970
- '\u1EB5': 'a',
971
- '\u1EB3': 'a',
972
- '\u0227': 'a',
973
- '\u01E1': 'a',
974
- '\u00E4': 'a',
975
- '\u01DF': 'a',
976
- '\u1EA3': 'a',
977
- '\u00E5': 'a',
978
- '\u01FB': 'a',
979
- '\u01CE': 'a',
980
- '\u0201': 'a',
981
- '\u0203': 'a',
982
- '\u1EA1': 'a',
983
- '\u1EAD': 'a',
984
- '\u1EB7': 'a',
985
- '\u1E01': 'a',
986
- '\u0105': 'a',
987
- '\u2C65': 'a',
988
- '\u0250': 'a',
989
- '\uA733': 'aa',
990
- '\u00E6': 'ae',
991
- '\u01FD': 'ae',
992
- '\u01E3': 'ae',
993
- '\uA735': 'ao',
994
- '\uA737': 'au',
995
- '\uA739': 'av',
996
- '\uA73B': 'av',
997
- '\uA73D': 'ay',
998
- '\u24D1': 'b',
999
- '\uFF42': 'b',
1000
- '\u1E03': 'b',
1001
- '\u1E05': 'b',
1002
- '\u1E07': 'b',
1003
- '\u0180': 'b',
1004
- '\u0183': 'b',
1005
- '\u0253': 'b',
1006
- '\u24D2': 'c',
1007
- '\uFF43': 'c',
1008
- '\u0107': 'c',
1009
- '\u0109': 'c',
1010
- '\u010B': 'c',
1011
- '\u010D': 'c',
1012
- '\u00E7': 'c',
1013
- '\u1E09': 'c',
1014
- '\u0188': 'c',
1015
- '\u023C': 'c',
1016
- '\uA73F': 'c',
1017
- '\u2184': 'c',
1018
- '\u24D3': 'd',
1019
- '\uFF44': 'd',
1020
- '\u1E0B': 'd',
1021
- '\u010F': 'd',
1022
- '\u1E0D': 'd',
1023
- '\u1E11': 'd',
1024
- '\u1E13': 'd',
1025
- '\u1E0F': 'd',
1026
- '\u0111': 'd',
1027
- '\u018C': 'd',
1028
- '\u0256': 'd',
1029
- '\u0257': 'd',
1030
- '\uA77A': 'd',
1031
- '\u01F3': 'dz',
1032
- '\u01C6': 'dz',
1033
- '\u24D4': 'e',
1034
- '\uFF45': 'e',
1035
- '\u00E8': 'e',
1036
- '\u00E9': 'e',
1037
- '\u00EA': 'e',
1038
- '\u1EC1': 'e',
1039
- '\u1EBF': 'e',
1040
- '\u1EC5': 'e',
1041
- '\u1EC3': 'e',
1042
- '\u1EBD': 'e',
1043
- '\u0113': 'e',
1044
- '\u1E15': 'e',
1045
- '\u1E17': 'e',
1046
- '\u0115': 'e',
1047
- '\u0117': 'e',
1048
- '\u00EB': 'e',
1049
- '\u1EBB': 'e',
1050
- '\u011B': 'e',
1051
- '\u0205': 'e',
1052
- '\u0207': 'e',
1053
- '\u1EB9': 'e',
1054
- '\u1EC7': 'e',
1055
- '\u0229': 'e',
1056
- '\u1E1D': 'e',
1057
- '\u0119': 'e',
1058
- '\u1E19': 'e',
1059
- '\u1E1B': 'e',
1060
- '\u0247': 'e',
1061
- '\u025B': 'e',
1062
- '\u01DD': 'e',
1063
- '\u24D5': 'f',
1064
- '\uFF46': 'f',
1065
- '\u1E1F': 'f',
1066
- '\u0192': 'f',
1067
- '\uA77C': 'f',
1068
- '\u24D6': 'g',
1069
- '\uFF47': 'g',
1070
- '\u01F5': 'g',
1071
- '\u011D': 'g',
1072
- '\u1E21': 'g',
1073
- '\u011F': 'g',
1074
- '\u0121': 'g',
1075
- '\u01E7': 'g',
1076
- '\u0123': 'g',
1077
- '\u01E5': 'g',
1078
- '\u0260': 'g',
1079
- '\uA7A1': 'g',
1080
- '\u1D79': 'g',
1081
- '\uA77F': 'g',
1082
- '\u24D7': 'h',
1083
- '\uFF48': 'h',
1084
- '\u0125': 'h',
1085
- '\u1E23': 'h',
1086
- '\u1E27': 'h',
1087
- '\u021F': 'h',
1088
- '\u1E25': 'h',
1089
- '\u1E29': 'h',
1090
- '\u1E2B': 'h',
1091
- '\u1E96': 'h',
1092
- '\u0127': 'h',
1093
- '\u2C68': 'h',
1094
- '\u2C76': 'h',
1095
- '\u0265': 'h',
1096
- '\u0195': 'hv',
1097
- '\u24D8': 'i',
1098
- '\uFF49': 'i',
1099
- '\u00EC': 'i',
1100
- '\u00ED': 'i',
1101
- '\u00EE': 'i',
1102
- '\u0129': 'i',
1103
- '\u012B': 'i',
1104
- '\u012D': 'i',
1105
- '\u00EF': 'i',
1106
- '\u1E2F': 'i',
1107
- '\u1EC9': 'i',
1108
- '\u01D0': 'i',
1109
- '\u0209': 'i',
1110
- '\u020B': 'i',
1111
- '\u1ECB': 'i',
1112
- '\u012F': 'i',
1113
- '\u1E2D': 'i',
1114
- '\u0268': 'i',
1115
- '\u0131': 'i',
1116
- '\u24D9': 'j',
1117
- '\uFF4A': 'j',
1118
- '\u0135': 'j',
1119
- '\u01F0': 'j',
1120
- '\u0249': 'j',
1121
- '\u24DA': 'k',
1122
- '\uFF4B': 'k',
1123
- '\u1E31': 'k',
1124
- '\u01E9': 'k',
1125
- '\u1E33': 'k',
1126
- '\u0137': 'k',
1127
- '\u1E35': 'k',
1128
- '\u0199': 'k',
1129
- '\u2C6A': 'k',
1130
- '\uA741': 'k',
1131
- '\uA743': 'k',
1132
- '\uA745': 'k',
1133
- '\uA7A3': 'k',
1134
- '\u24DB': 'l',
1135
- '\uFF4C': 'l',
1136
- '\u0140': 'l',
1137
- '\u013A': 'l',
1138
- '\u013E': 'l',
1139
- '\u1E37': 'l',
1140
- '\u1E39': 'l',
1141
- '\u013C': 'l',
1142
- '\u1E3D': 'l',
1143
- '\u1E3B': 'l',
1144
- '\u017F': 'l',
1145
- '\u0142': 'l',
1146
- '\u019A': 'l',
1147
- '\u026B': 'l',
1148
- '\u2C61': 'l',
1149
- '\uA749': 'l',
1150
- '\uA781': 'l',
1151
- '\uA747': 'l',
1152
- '\u01C9': 'lj',
1153
- '\u24DC': 'm',
1154
- '\uFF4D': 'm',
1155
- '\u1E3F': 'm',
1156
- '\u1E41': 'm',
1157
- '\u1E43': 'm',
1158
- '\u0271': 'm',
1159
- '\u026F': 'm',
1160
- '\u24DD': 'n',
1161
- '\uFF4E': 'n',
1162
- '\u01F9': 'n',
1163
- '\u0144': 'n',
1164
- '\u00F1': 'n',
1165
- '\u1E45': 'n',
1166
- '\u0148': 'n',
1167
- '\u1E47': 'n',
1168
- '\u0146': 'n',
1169
- '\u1E4B': 'n',
1170
- '\u1E49': 'n',
1171
- '\u019E': 'n',
1172
- '\u0272': 'n',
1173
- '\u0149': 'n',
1174
- '\uA791': 'n',
1175
- '\uA7A5': 'n',
1176
- '\u01CC': 'nj',
1177
- '\u24DE': 'o',
1178
- '\uFF4F': 'o',
1179
- '\u00F2': 'o',
1180
- '\u00F3': 'o',
1181
- '\u00F4': 'o',
1182
- '\u1ED3': 'o',
1183
- '\u1ED1': 'o',
1184
- '\u1ED7': 'o',
1185
- '\u1ED5': 'o',
1186
- '\u00F5': 'o',
1187
- '\u1E4D': 'o',
1188
- '\u022D': 'o',
1189
- '\u1E4F': 'o',
1190
- '\u014D': 'o',
1191
- '\u1E51': 'o',
1192
- '\u1E53': 'o',
1193
- '\u014F': 'o',
1194
- '\u022F': 'o',
1195
- '\u0231': 'o',
1196
- '\u00F6': 'o',
1197
- '\u022B': 'o',
1198
- '\u1ECF': 'o',
1199
- '\u0151': 'o',
1200
- '\u01D2': 'o',
1201
- '\u020D': 'o',
1202
- '\u020F': 'o',
1203
- '\u01A1': 'o',
1204
- '\u1EDD': 'o',
1205
- '\u1EDB': 'o',
1206
- '\u1EE1': 'o',
1207
- '\u1EDF': 'o',
1208
- '\u1EE3': 'o',
1209
- '\u1ECD': 'o',
1210
- '\u1ED9': 'o',
1211
- '\u01EB': 'o',
1212
- '\u01ED': 'o',
1213
- '\u00F8': 'o',
1214
- '\u01FF': 'o',
1215
- '\u0254': 'o',
1216
- '\uA74B': 'o',
1217
- '\uA74D': 'o',
1218
- '\u0275': 'o',
1219
- '\u01A3': 'oi',
1220
- '\u0223': 'ou',
1221
- '\uA74F': 'oo',
1222
- '\u24DF': 'p',
1223
- '\uFF50': 'p',
1224
- '\u1E55': 'p',
1225
- '\u1E57': 'p',
1226
- '\u01A5': 'p',
1227
- '\u1D7D': 'p',
1228
- '\uA751': 'p',
1229
- '\uA753': 'p',
1230
- '\uA755': 'p',
1231
- '\u24E0': 'q',
1232
- '\uFF51': 'q',
1233
- '\u024B': 'q',
1234
- '\uA757': 'q',
1235
- '\uA759': 'q',
1236
- '\u24E1': 'r',
1237
- '\uFF52': 'r',
1238
- '\u0155': 'r',
1239
- '\u1E59': 'r',
1240
- '\u0159': 'r',
1241
- '\u0211': 'r',
1242
- '\u0213': 'r',
1243
- '\u1E5B': 'r',
1244
- '\u1E5D': 'r',
1245
- '\u0157': 'r',
1246
- '\u1E5F': 'r',
1247
- '\u024D': 'r',
1248
- '\u027D': 'r',
1249
- '\uA75B': 'r',
1250
- '\uA7A7': 'r',
1251
- '\uA783': 'r',
1252
- '\u24E2': 's',
1253
- '\uFF53': 's',
1254
- '\u00DF': 's',
1255
- '\u015B': 's',
1256
- '\u1E65': 's',
1257
- '\u015D': 's',
1258
- '\u1E61': 's',
1259
- '\u0161': 's',
1260
- '\u1E67': 's',
1261
- '\u1E63': 's',
1262
- '\u1E69': 's',
1263
- '\u0219': 's',
1264
- '\u015F': 's',
1265
- '\u023F': 's',
1266
- '\uA7A9': 's',
1267
- '\uA785': 's',
1268
- '\u1E9B': 's',
1269
- '\u24E3': 't',
1270
- '\uFF54': 't',
1271
- '\u1E6B': 't',
1272
- '\u1E97': 't',
1273
- '\u0165': 't',
1274
- '\u1E6D': 't',
1275
- '\u021B': 't',
1276
- '\u0163': 't',
1277
- '\u1E71': 't',
1278
- '\u1E6F': 't',
1279
- '\u0167': 't',
1280
- '\u01AD': 't',
1281
- '\u0288': 't',
1282
- '\u2C66': 't',
1283
- '\uA787': 't',
1284
- '\uA729': 'tz',
1285
- '\u24E4': 'u',
1286
- '\uFF55': 'u',
1287
- '\u00F9': 'u',
1288
- '\u00FA': 'u',
1289
- '\u00FB': 'u',
1290
- '\u0169': 'u',
1291
- '\u1E79': 'u',
1292
- '\u016B': 'u',
1293
- '\u1E7B': 'u',
1294
- '\u016D': 'u',
1295
- '\u00FC': 'u',
1296
- '\u01DC': 'u',
1297
- '\u01D8': 'u',
1298
- '\u01D6': 'u',
1299
- '\u01DA': 'u',
1300
- '\u1EE7': 'u',
1301
- '\u016F': 'u',
1302
- '\u0171': 'u',
1303
- '\u01D4': 'u',
1304
- '\u0215': 'u',
1305
- '\u0217': 'u',
1306
- '\u01B0': 'u',
1307
- '\u1EEB': 'u',
1308
- '\u1EE9': 'u',
1309
- '\u1EEF': 'u',
1310
- '\u1EED': 'u',
1311
- '\u1EF1': 'u',
1312
- '\u1EE5': 'u',
1313
- '\u1E73': 'u',
1314
- '\u0173': 'u',
1315
- '\u1E77': 'u',
1316
- '\u1E75': 'u',
1317
- '\u0289': 'u',
1318
- '\u24E5': 'v',
1319
- '\uFF56': 'v',
1320
- '\u1E7D': 'v',
1321
- '\u1E7F': 'v',
1322
- '\u028B': 'v',
1323
- '\uA75F': 'v',
1324
- '\u028C': 'v',
1325
- '\uA761': 'vy',
1326
- '\u24E6': 'w',
1327
- '\uFF57': 'w',
1328
- '\u1E81': 'w',
1329
- '\u1E83': 'w',
1330
- '\u0175': 'w',
1331
- '\u1E87': 'w',
1332
- '\u1E85': 'w',
1333
- '\u1E98': 'w',
1334
- '\u1E89': 'w',
1335
- '\u2C73': 'w',
1336
- '\u24E7': 'x',
1337
- '\uFF58': 'x',
1338
- '\u1E8B': 'x',
1339
- '\u1E8D': 'x',
1340
- '\u24E8': 'y',
1341
- '\uFF59': 'y',
1342
- '\u1EF3': 'y',
1343
- '\u00FD': 'y',
1344
- '\u0177': 'y',
1345
- '\u1EF9': 'y',
1346
- '\u0233': 'y',
1347
- '\u1E8F': 'y',
1348
- '\u00FF': 'y',
1349
- '\u1EF7': 'y',
1350
- '\u1E99': 'y',
1351
- '\u1EF5': 'y',
1352
- '\u01B4': 'y',
1353
- '\u024F': 'y',
1354
- '\u1EFF': 'y',
1355
- '\u24E9': 'z',
1356
- '\uFF5A': 'z',
1357
- '\u017A': 'z',
1358
- '\u1E91': 'z',
1359
- '\u017C': 'z',
1360
- '\u017E': 'z',
1361
- '\u1E93': 'z',
1362
- '\u1E95': 'z',
1363
- '\u01B6': 'z',
1364
- '\u0225': 'z',
1365
- '\u0240': 'z',
1366
- '\u2C6C': 'z',
1367
- '\uA763': 'z',
1368
- '\u0386': '\u0391',
1369
- '\u0388': '\u0395',
1370
- '\u0389': '\u0397',
1371
- '\u038A': '\u0399',
1372
- '\u03AA': '\u0399',
1373
- '\u038C': '\u039F',
1374
- '\u038E': '\u03A5',
1375
- '\u03AB': '\u03A5',
1376
- '\u038F': '\u03A9',
1377
- '\u03AC': '\u03B1',
1378
- '\u03AD': '\u03B5',
1379
- '\u03AE': '\u03B7',
1380
- '\u03AF': '\u03B9',
1381
- '\u03CA': '\u03B9',
1382
- '\u0390': '\u03B9',
1383
- '\u03CC': '\u03BF',
1384
- '\u03CD': '\u03C5',
1385
- '\u03CB': '\u03C5',
1386
- '\u03B0': '\u03C5',
1387
- '\u03C9': '\u03C9',
1388
- '\u03C2': '\u03C3'
1389
- };
1390
- function stripSpecialChars(text) {
1391
- var match = function (a) {
1392
- return diacritics[a] || a;
1393
- };
1394
- return text.replace(/[^\u0000-\u007E]/g, match);
1395
- }
1396
-
1397
- var ItemsList = /** @class */ (function () {
1398
- function ItemsList(_ngSelect, _selectionModel) {
1399
- this._ngSelect = _ngSelect;
1400
- this._selectionModel = _selectionModel;
1401
- this._items = [];
1402
- this._filteredItems = [];
1403
- this._markedIndex = -1;
1404
- }
1405
- Object.defineProperty(ItemsList.prototype, "items", {
1406
- get: function () {
1407
- return this._items;
1408
- },
1409
- enumerable: false,
1410
- configurable: true
1411
- });
1412
- Object.defineProperty(ItemsList.prototype, "filteredItems", {
1413
- get: function () {
1414
- return this._filteredItems;
1415
- },
1416
- enumerable: false,
1417
- configurable: true
1418
- });
1419
- Object.defineProperty(ItemsList.prototype, "markedIndex", {
1420
- get: function () {
1421
- return this._markedIndex;
1422
- },
1423
- enumerable: false,
1424
- configurable: true
1425
- });
1426
- Object.defineProperty(ItemsList.prototype, "selectedItems", {
1427
- get: function () {
1428
- return this._selectionModel.value;
1429
- },
1430
- enumerable: false,
1431
- configurable: true
1432
- });
1433
- Object.defineProperty(ItemsList.prototype, "markedItem", {
1434
- get: function () {
1435
- return this._filteredItems[this._markedIndex];
1436
- },
1437
- enumerable: false,
1438
- configurable: true
1439
- });
1440
- Object.defineProperty(ItemsList.prototype, "noItemsToSelect", {
1441
- get: function () {
1442
- return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
1443
- },
1444
- enumerable: false,
1445
- configurable: true
1446
- });
1447
- Object.defineProperty(ItemsList.prototype, "maxItemsSelected", {
1448
- get: function () {
1449
- return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
1450
- },
1451
- enumerable: false,
1452
- configurable: true
1453
- });
1454
- Object.defineProperty(ItemsList.prototype, "lastSelectedItem", {
1455
- get: function () {
1456
- var i = this.selectedItems.length - 1;
1457
- for (; i >= 0; i--) {
1458
- var item = this.selectedItems[i];
1459
- if (!item.disabled) {
1460
- return item;
1461
- }
1462
- }
1463
- return null;
1464
- },
1465
- enumerable: false,
1466
- configurable: true
1467
- });
1468
- ItemsList.prototype.setItems = function (items) {
1469
- var _this = this;
1470
- this._items = items.map(function (item, index) { return _this.mapItem(item, index); });
1471
- if (this._ngSelect.groupBy) {
1472
- this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
1473
- this._items = this._flatten(this._groups);
1474
- }
1475
- else {
1476
- this._groups = new Map();
1477
- this._groups.set(undefined, this._items);
1478
- }
1479
- this._filteredItems = __spreadArray([], __read(this._items));
1480
- };
1481
- ItemsList.prototype.select = function (item) {
1482
- if (item.selected || this.maxItemsSelected) {
1483
- return;
1484
- }
1485
- var multiple = this._ngSelect.multiple;
1486
- if (!multiple) {
1487
- this.clearSelected();
1488
- }
1489
- this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
1490
- if (this._ngSelect.hideSelected) {
1491
- this._hideSelected(item);
1492
- }
1493
- };
1494
- ItemsList.prototype.unselect = function (item) {
1495
- if (!item.selected) {
1496
- return;
1497
- }
1498
- this._selectionModel.unselect(item, this._ngSelect.multiple);
1499
- if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {
1500
- this._showSelected(item);
1501
- }
1502
- };
1503
- ItemsList.prototype.findItem = function (value) {
1504
- var _this = this;
1505
- var findBy;
1506
- if (this._ngSelect.compareWith) {
1507
- findBy = function (item) { return _this._ngSelect.compareWith(item.value, value); };
1508
- }
1509
- else if (this._ngSelect.bindValue) {
1510
- findBy = function (item) { return !item.children && _this.resolveNested(item.value, _this._ngSelect.bindValue) === value; };
1511
- }
1512
- else {
1513
- findBy = function (item) { return item.value === value ||
1514
- !item.children && item.label && item.label === _this.resolveNested(value, _this._ngSelect.bindLabel); };
1515
- }
1516
- return this._items.find(function (item) { return findBy(item); });
1517
- };
1518
- ItemsList.prototype.addItem = function (item) {
1519
- var option = this.mapItem(item, this._items.length);
1520
- this._items.push(option);
1521
- this._filteredItems.push(option);
1522
- return option;
1523
- };
1524
- ItemsList.prototype.clearSelected = function (keepDisabled) {
1525
- if (keepDisabled === void 0) { keepDisabled = false; }
1526
- this._selectionModel.clear(keepDisabled);
1527
- this._items.forEach(function (item) {
1528
- item.selected = keepDisabled && item.selected && item.disabled;
1529
- item.marked = false;
1530
- });
1531
- if (this._ngSelect.hideSelected) {
1532
- this.resetFilteredItems();
1533
- }
1534
- };
1535
- ItemsList.prototype.findByLabel = function (term) {
1536
- term = stripSpecialChars(term).toLocaleLowerCase();
1537
- return this.filteredItems.find(function (item) {
1538
- var label = stripSpecialChars(item.label).toLocaleLowerCase();
1539
- return label.substr(0, term.length) === term;
1540
- });
1541
- };
1542
- ItemsList.prototype.filter = function (term) {
1543
- var e_1, _a;
1544
- if (!term) {
1545
- this.resetFilteredItems();
1546
- return;
1547
- }
1548
- this._filteredItems = [];
1549
- term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();
1550
- var match = this._ngSelect.searchFn || this._defaultSearchFn;
1551
- var hideSelected = this._ngSelect.hideSelected;
1552
- var _loop_1 = function (key) {
1553
- var e_2, _d, _e;
1554
- var matchedItems = [];
1555
- try {
1556
- for (var _f = (e_2 = void 0, __values(this_1._groups.get(key))), _g = _f.next(); !_g.done; _g = _f.next()) {
1557
- var item = _g.value;
1558
- if (hideSelected && (item.parent && item.parent.selected || item.selected)) {
1559
- continue;
1560
- }
1561
- var searchItem = this_1._ngSelect.searchFn ? item.value : item;
1562
- if (match(term, searchItem)) {
1563
- matchedItems.push(item);
1564
- }
1565
- }
1566
- }
1567
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1568
- finally {
1569
- try {
1570
- if (_g && !_g.done && (_d = _f.return)) _d.call(_f);
1571
- }
1572
- finally { if (e_2) throw e_2.error; }
1573
- }
1574
- if (matchedItems.length > 0) {
1575
- var _h = __read(matchedItems.slice(-1), 1), last_1 = _h[0];
1576
- if (last_1.parent) {
1577
- var head = this_1._items.find(function (x) { return x === last_1.parent; });
1578
- this_1._filteredItems.push(head);
1579
- }
1580
- (_e = this_1._filteredItems).push.apply(_e, __spreadArray([], __read(matchedItems)));
1581
- }
1582
- };
1583
- var this_1 = this;
1584
- try {
1585
- for (var _b = __values(Array.from(this._groups.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
1586
- var key = _c.value;
1587
- _loop_1(key);
1588
- }
1589
- }
1590
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1591
- finally {
1592
- try {
1593
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1594
- }
1595
- finally { if (e_1) throw e_1.error; }
1596
- }
1597
- };
1598
- ItemsList.prototype.resetFilteredItems = function () {
1599
- if (this._filteredItems.length === this._items.length) {
1600
- return;
1601
- }
1602
- if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
1603
- this._filteredItems = this._items.filter(function (x) { return !x.selected; });
1604
- }
1605
- else {
1606
- this._filteredItems = this._items;
1607
- }
1608
- };
1609
- ItemsList.prototype.unmarkItem = function () {
1610
- this._markedIndex = -1;
1611
- };
1612
- ItemsList.prototype.markNextItem = function () {
1613
- this._stepToItem(+1);
1614
- };
1615
- ItemsList.prototype.markPreviousItem = function () {
1616
- this._stepToItem(-1);
1617
- };
1618
- ItemsList.prototype.markItem = function (item) {
1619
- this._markedIndex = this._filteredItems.indexOf(item);
1620
- };
1621
- ItemsList.prototype.markSelectedOrDefault = function (markDefault) {
1622
- if (this._filteredItems.length === 0) {
1623
- return;
1624
- }
1625
- var lastMarkedIndex = this._getLastMarkedIndex();
1626
- if (lastMarkedIndex > -1) {
1627
- this._markedIndex = lastMarkedIndex;
1628
- }
1629
- else {
1630
- this._markedIndex = markDefault ? this.filteredItems.findIndex(function (x) { return !x.disabled; }) : -1;
1631
- }
1632
- };
1633
- ItemsList.prototype.resolveNested = function (option, key) {
1634
- if (!isObject(option)) {
1635
- return option;
1636
- }
1637
- if (key.indexOf('.') === -1) {
1638
- return option[key];
1639
- }
1640
- else {
1641
- var keys = key.split('.');
1642
- var value = option;
1643
- for (var i = 0, len = keys.length; i < len; ++i) {
1644
- if (value == null) {
1645
- return null;
1646
- }
1647
- value = value[keys[i]];
1648
- }
1649
- return value;
1650
- }
1651
- };
1652
- ItemsList.prototype.mapItem = function (item, index) {
1653
- var label = isDefined(item.$ngOptionLabel) ? item.$ngOptionLabel : this.resolveNested(item, this._ngSelect.bindLabel);
1654
- var value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
1655
- return {
1656
- index: index,
1657
- label: isDefined(label) ? label.toString() : '',
1658
- value: value,
1659
- disabled: item.disabled,
1660
- htmlId: this._ngSelect.dropdownId + "-" + index,
1661
- };
1662
- };
1663
- ItemsList.prototype.mapSelectedItems = function () {
1664
- var e_3, _a;
1665
- var _this = this;
1666
- var multiple = this._ngSelect.multiple;
1667
- try {
1668
- for (var _b = __values(this.selectedItems), _c = _b.next(); !_c.done; _c = _b.next()) {
1669
- var selected = _c.value;
1670
- var value = this._ngSelect.bindValue ? this.resolveNested(selected.value, this._ngSelect.bindValue) : selected.value;
1671
- var item = isDefined(value) ? this.findItem(value) : null;
1672
- this._selectionModel.unselect(selected, multiple);
1673
- this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
1674
- }
1675
- }
1676
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1677
- finally {
1678
- try {
1679
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1680
- }
1681
- finally { if (e_3) throw e_3.error; }
1682
- }
1683
- if (this._ngSelect.hideSelected) {
1684
- this._filteredItems = this.filteredItems.filter(function (x) { return _this.selectedItems.indexOf(x) === -1; });
1685
- }
1686
- };
1687
- ItemsList.prototype._showSelected = function (item) {
1688
- var e_4, _a;
1689
- this._filteredItems.push(item);
1690
- if (item.parent) {
1691
- var parent_1 = item.parent;
1692
- var parentExists = this._filteredItems.find(function (x) { return x === parent_1; });
1693
- if (!parentExists) {
1694
- this._filteredItems.push(parent_1);
1695
- }
1696
- }
1697
- else if (item.children) {
1698
- try {
1699
- for (var _b = __values(item.children), _c = _b.next(); !_c.done; _c = _b.next()) {
1700
- var child = _c.value;
1701
- child.selected = false;
1702
- this._filteredItems.push(child);
1703
- }
1704
- }
1705
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1706
- finally {
1707
- try {
1708
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1709
- }
1710
- finally { if (e_4) throw e_4.error; }
1711
- }
1712
- }
1713
- this._filteredItems = __spreadArray([], __read(this._filteredItems.sort(function (a, b) { return (a.index - b.index); })));
1714
- };
1715
- ItemsList.prototype._hideSelected = function (item) {
1716
- this._filteredItems = this._filteredItems.filter(function (x) { return x !== item; });
1717
- if (item.parent) {
1718
- var children = item.parent.children;
1719
- if (children.every(function (x) { return x.selected; })) {
1720
- this._filteredItems = this._filteredItems.filter(function (x) { return x !== item.parent; });
1721
- }
1722
- }
1723
- else if (item.children) {
1724
- this._filteredItems = this.filteredItems.filter(function (x) { return x.parent !== item; });
1725
- }
1726
- };
1727
- ItemsList.prototype._defaultSearchFn = function (search, opt) {
1728
- var label = stripSpecialChars(opt.label).toLocaleLowerCase();
1729
- return label.indexOf(search) > -1;
1730
- };
1731
- ItemsList.prototype._getNextItemIndex = function (steps) {
1732
- if (steps > 0) {
1733
- return (this._markedIndex >= this._filteredItems.length - 1) ? 0 : (this._markedIndex + 1);
1734
- }
1735
- return (this._markedIndex <= 0) ? (this._filteredItems.length - 1) : (this._markedIndex - 1);
1736
- };
1737
- ItemsList.prototype._stepToItem = function (steps) {
1738
- if (this._filteredItems.length === 0 || this._filteredItems.every(function (x) { return x.disabled; })) {
1739
- return;
1740
- }
1741
- this._markedIndex = this._getNextItemIndex(steps);
1742
- if (this.markedItem.disabled) {
1743
- this._stepToItem(steps);
1744
- }
1745
- };
1746
- ItemsList.prototype._getLastMarkedIndex = function () {
1747
- if (this._ngSelect.hideSelected) {
1748
- return -1;
1749
- }
1750
- if (this._markedIndex > -1 && this.markedItem === undefined) {
1751
- return -1;
1752
- }
1753
- var selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
1754
- if (this.lastSelectedItem && selectedIndex < 0) {
1755
- return -1;
1756
- }
1757
- return Math.max(this.markedIndex, selectedIndex);
1758
- };
1759
- ItemsList.prototype._groupBy = function (items, prop) {
1760
- var e_5, _a, e_6, _b;
1761
- var _this = this;
1762
- var groups = new Map();
1763
- if (items.length === 0) {
1764
- return groups;
1765
- }
1766
- // Check if items are already grouped by given key.
1767
- if (Array.isArray(items[0].value[prop])) {
1768
- try {
1769
- for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
1770
- var item = items_1_1.value;
1771
- var children = (item.value[prop] || []).map(function (x, index) { return _this.mapItem(x, index); });
1772
- groups.set(item, children);
1773
- }
1774
- }
1775
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1776
- finally {
1777
- try {
1778
- if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
1779
- }
1780
- finally { if (e_5) throw e_5.error; }
1781
- }
1782
- return groups;
1783
- }
1784
- var isFnKey = isFunction(this._ngSelect.groupBy);
1785
- var keyFn = function (item) {
1786
- var key = isFnKey ? prop(item.value) : item.value[prop];
1787
- return isDefined(key) ? key : undefined;
1788
- };
1789
- try {
1790
- // Group items by key.
1791
- for (var items_2 = __values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
1792
- var item = items_2_1.value;
1793
- var key = keyFn(item);
1794
- var group = groups.get(key);
1795
- if (group) {
1796
- group.push(item);
1797
- }
1798
- else {
1799
- groups.set(key, [item]);
1800
- }
1801
- }
1802
- }
1803
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1804
- finally {
1805
- try {
1806
- if (items_2_1 && !items_2_1.done && (_b = items_2.return)) _b.call(items_2);
1807
- }
1808
- finally { if (e_6) throw e_6.error; }
1809
- }
1810
- return groups;
1811
- };
1812
- ItemsList.prototype._flatten = function (groups) {
1813
- var e_7, _a;
1814
- var isGroupByFn = isFunction(this._ngSelect.groupBy);
1815
- var items = [];
1816
- var _loop_2 = function (key) {
1817
- var i = items.length;
1818
- if (key === undefined) {
1819
- var withoutGroup = groups.get(undefined) || [];
1820
- items.push.apply(items, __spreadArray([], __read(withoutGroup.map(function (x) {
1821
- x.index = i++;
1822
- return x;
1823
- }))));
1824
- return "continue";
1825
- }
1826
- var isObjectKey = isObject(key);
1827
- var parent = {
1828
- label: isObjectKey ? '' : String(key),
1829
- children: undefined,
1830
- parent: null,
1831
- index: i++,
1832
- disabled: !this_2._ngSelect.selectableGroup,
1833
- htmlId: newId(),
1834
- };
1835
- var groupKey = isGroupByFn ? this_2._ngSelect.bindLabel : this_2._ngSelect.groupBy;
1836
- var groupValue = this_2._ngSelect.groupValue || (function () {
1837
- var _a;
1838
- if (isObjectKey) {
1839
- return key.value;
1840
- }
1841
- return _a = {}, _a[groupKey] = key, _a;
1842
- });
1843
- var children = groups.get(key).map(function (x) {
1844
- x.parent = parent;
1845
- x.children = undefined;
1846
- x.index = i++;
1847
- return x;
1848
- });
1849
- parent.children = children;
1850
- parent.value = groupValue(key, children.map(function (x) { return x.value; }));
1851
- items.push(parent);
1852
- items.push.apply(items, __spreadArray([], __read(children)));
1853
- };
1854
- var this_2 = this;
1855
- try {
1856
- for (var _b = __values(Array.from(groups.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
1857
- var key = _c.value;
1858
- _loop_2(key);
1859
- }
1860
- }
1861
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
1862
- finally {
1863
- try {
1864
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1865
- }
1866
- finally { if (e_7) throw e_7.error; }
1867
- }
1868
- return items;
1869
- };
1870
- return ItemsList;
1871
- }());
1872
-
1873
- var KeyCode;
1874
- (function (KeyCode) {
1875
- KeyCode[KeyCode["Tab"] = 9] = "Tab";
1876
- KeyCode[KeyCode["Enter"] = 13] = "Enter";
1877
- KeyCode[KeyCode["Esc"] = 27] = "Esc";
1878
- KeyCode[KeyCode["Space"] = 32] = "Space";
1879
- KeyCode[KeyCode["ArrowUp"] = 38] = "ArrowUp";
1880
- KeyCode[KeyCode["ArrowDown"] = 40] = "ArrowDown";
1881
- KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
1882
- })(KeyCode || (KeyCode = {}));
1883
-
1884
- var NgDropdownPanelService = /** @class */ (function () {
1885
- function NgDropdownPanelService() {
1886
- this._dimensions = {
1887
- itemHeight: 0,
1888
- panelHeight: 0,
1889
- itemsPerViewport: 0
1890
- };
1891
- }
1892
- Object.defineProperty(NgDropdownPanelService.prototype, "dimensions", {
1893
- get: function () {
1894
- return this._dimensions;
1895
- },
1896
- enumerable: false,
1897
- configurable: true
1898
- });
1899
- NgDropdownPanelService.prototype.calculateItems = function (scrollPos, itemsLength, buffer) {
1900
- var d = this._dimensions;
1901
- var scrollHeight = d.itemHeight * itemsLength;
1902
- var scrollTop = Math.max(0, scrollPos);
1903
- var indexByScrollTop = scrollTop / scrollHeight * itemsLength;
1904
- var end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
1905
- var maxStartEnd = end;
1906
- var maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
1907
- var start = Math.min(maxStart, Math.floor(indexByScrollTop));
1908
- var topPadding = d.itemHeight * Math.ceil(start) - (d.itemHeight * Math.min(start, buffer));
1909
- topPadding = !isNaN(topPadding) ? topPadding : 0;
1910
- start = !isNaN(start) ? start : -1;
1911
- end = !isNaN(end) ? end : -1;
1912
- start -= buffer;
1913
- start = Math.max(0, start);
1914
- end += buffer;
1915
- end = Math.min(itemsLength, end);
1916
- return {
1917
- topPadding: topPadding,
1918
- scrollHeight: scrollHeight,
1919
- start: start,
1920
- end: end
1921
- };
1922
- };
1923
- NgDropdownPanelService.prototype.setDimensions = function (itemHeight, panelHeight) {
1924
- var itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
1925
- this._dimensions = {
1926
- itemHeight: itemHeight,
1927
- panelHeight: panelHeight,
1928
- itemsPerViewport: itemsPerViewport
1929
- };
1930
- };
1931
- NgDropdownPanelService.prototype.getScrollTo = function (itemTop, itemHeight, lastScroll) {
1932
- var panelHeight = this.dimensions.panelHeight;
1933
- var itemBottom = itemTop + itemHeight;
1934
- var top = lastScroll;
1935
- var bottom = top + panelHeight;
1936
- if (panelHeight >= itemBottom && lastScroll === itemTop) {
1937
- return null;
1938
- }
1939
- if (itemBottom > bottom) {
1940
- return top + itemBottom - bottom;
1941
- }
1942
- else if (itemTop <= top) {
1943
- return itemTop;
1944
- }
1945
- return null;
1946
- };
1947
- return NgDropdownPanelService;
1948
- }());
1949
- NgDropdownPanelService.decorators = [
1950
- { type: i0.Injectable }
1951
- ];
1952
-
1953
- var CSS_POSITIONS = ['top', 'right', 'bottom', 'left'];
1954
- var SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? rxjs.animationFrameScheduler : rxjs.asapScheduler;
1955
- var NgDropdownPanelComponent = /** @class */ (function () {
1956
- function NgDropdownPanelComponent(_renderer, _zone, _panelService, _elementRef, _document) {
1957
- this._renderer = _renderer;
1958
- this._zone = _zone;
1959
- this._panelService = _panelService;
1960
- this._document = _document;
1961
- this.items = [];
1962
- this.position = 'auto';
1963
- this.virtualScroll = false;
1964
- this.filterValue = null;
1965
- this.update = new i0.EventEmitter();
1966
- this.scroll = new i0.EventEmitter();
1967
- this.scrollToEnd = new i0.EventEmitter();
1968
- this.outsideClick = new i0.EventEmitter();
1969
- this._destroy$ = new rxjs.Subject();
1970
- this._scrollToEndFired = false;
1971
- this._updateScrollHeight = false;
1972
- this._lastScrollPosition = 0;
1973
- this._dropdown = _elementRef.nativeElement;
1974
- }
1975
- Object.defineProperty(NgDropdownPanelComponent.prototype, "currentPosition", {
1976
- get: function () {
1977
- return this._currentPosition;
1978
- },
1979
- enumerable: false,
1980
- configurable: true
1981
- });
1982
- Object.defineProperty(NgDropdownPanelComponent.prototype, "itemsLength", {
1983
- get: function () {
1984
- return this._itemsLength;
1985
- },
1986
- set: function (value) {
1987
- if (value !== this._itemsLength) {
1988
- this._itemsLength = value;
1989
- this._onItemsLengthChanged();
1990
- }
1991
- },
1992
- enumerable: false,
1993
- configurable: true
1994
- });
1995
- Object.defineProperty(NgDropdownPanelComponent.prototype, "_startOffset", {
1996
- get: function () {
1997
- if (this.markedItem) {
1998
- var _a = this._panelService.dimensions, itemHeight = _a.itemHeight, panelHeight = _a.panelHeight;
1999
- var offset = this.markedItem.index * itemHeight;
2000
- return panelHeight > offset ? 0 : offset;
2001
- }
2002
- return 0;
2003
- },
2004
- enumerable: false,
2005
- configurable: true
2006
- });
2007
- NgDropdownPanelComponent.prototype.ngOnInit = function () {
2008
- this._select = this._dropdown.parentElement;
2009
- this._virtualPadding = this.paddingElementRef.nativeElement;
2010
- this._scrollablePanel = this.scrollElementRef.nativeElement;
2011
- this._contentPanel = this.contentElementRef.nativeElement;
2012
- this._handleScroll();
2013
- this._handleOutsideClick();
2014
- this._appendDropdown();
2015
- this._setupMousedownListener();
2016
- };
2017
- NgDropdownPanelComponent.prototype.ngOnChanges = function (changes) {
2018
- if (changes.items) {
2019
- var change = changes.items;
2020
- this._onItemsChange(change.currentValue, change.firstChange);
2021
- }
2022
- };
2023
- NgDropdownPanelComponent.prototype.ngOnDestroy = function () {
2024
- this._destroy$.next();
2025
- this._destroy$.complete();
2026
- this._destroy$.unsubscribe();
2027
- if (this.appendTo) {
2028
- this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
2029
- }
2030
- };
2031
- NgDropdownPanelComponent.prototype.scrollTo = function (option, startFromOption) {
2032
- if (startFromOption === void 0) { startFromOption = false; }
2033
- if (!option) {
2034
- return;
2035
- }
2036
- var index = this.items.indexOf(option);
2037
- if (index < 0 || index >= this.itemsLength) {
2038
- return;
2039
- }
2040
- var scrollTo;
2041
- if (this.virtualScroll) {
2042
- var itemHeight = this._panelService.dimensions.itemHeight;
2043
- scrollTo = this._panelService.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
2044
- }
2045
- else {
2046
- var item = this._dropdown.querySelector("#" + option.htmlId);
2047
- var lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
2048
- scrollTo = this._panelService.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
2049
- }
2050
- if (isDefined(scrollTo)) {
2051
- this._scrollablePanel.scrollTop = scrollTo;
2052
- }
2053
- };
2054
- NgDropdownPanelComponent.prototype.scrollToTag = function () {
2055
- var panel = this._scrollablePanel;
2056
- panel.scrollTop = panel.scrollHeight - panel.clientHeight;
2057
- };
2058
- NgDropdownPanelComponent.prototype.adjustPosition = function () {
2059
- this._updateYPosition();
2060
- };
2061
- NgDropdownPanelComponent.prototype._handleDropdownPosition = function () {
2062
- this._currentPosition = this._calculateCurrentPosition(this._dropdown);
2063
- if (CSS_POSITIONS.includes(this._currentPosition)) {
2064
- this._updateDropdownClass(this._currentPosition);
2065
- }
2066
- else {
2067
- this._updateDropdownClass('bottom');
2068
- }
2069
- if (this.appendTo) {
2070
- this._updateYPosition();
2071
- }
2072
- this._dropdown.style.opacity = '1';
2073
- };
2074
- NgDropdownPanelComponent.prototype._updateDropdownClass = function (currentPosition) {
2075
- var _this = this;
2076
- CSS_POSITIONS.forEach(function (position) {
2077
- var REMOVE_CSS_CLASS = "ng-select-" + position;
2078
- _this._renderer.removeClass(_this._dropdown, REMOVE_CSS_CLASS);
2079
- _this._renderer.removeClass(_this._select, REMOVE_CSS_CLASS);
2080
- });
2081
- var ADD_CSS_CLASS = "ng-select-" + currentPosition;
2082
- this._renderer.addClass(this._dropdown, ADD_CSS_CLASS);
2083
- this._renderer.addClass(this._select, ADD_CSS_CLASS);
2084
- };
2085
- NgDropdownPanelComponent.prototype._handleScroll = function () {
2086
- var _this = this;
2087
- this._zone.runOutsideAngular(function () {
2088
- rxjs.fromEvent(_this.scrollElementRef.nativeElement, 'scroll')
2089
- .pipe(operators.takeUntil(_this._destroy$), operators.auditTime(0, SCROLL_SCHEDULER))
2090
- .subscribe(function (e) {
2091
- var path = e.path || (e.composedPath && e.composedPath());
2092
- var scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;
2093
- _this._onContentScrolled(scrollTop);
2094
- });
2095
- });
2096
- };
2097
- NgDropdownPanelComponent.prototype._handleOutsideClick = function () {
2098
- var _this = this;
2099
- if (!this._document) {
2100
- return;
2101
- }
2102
- this._zone.runOutsideAngular(function () {
2103
- rxjs.merge(rxjs.fromEvent(_this._document, 'touchstart', { capture: true }), rxjs.fromEvent(_this._document, 'mousedown', { capture: true })).pipe(operators.takeUntil(_this._destroy$))
2104
- .subscribe(function ($event) { return _this._checkToClose($event); });
2105
- });
2106
- };
2107
- NgDropdownPanelComponent.prototype._checkToClose = function ($event) {
2108
- var _this = this;
2109
- if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
2110
- return;
2111
- }
2112
- var path = $event.path || ($event.composedPath && $event.composedPath());
2113
- if ($event.target && $event.target.shadowRoot && path && path[0] && this._select.contains(path[0])) {
2114
- return;
2115
- }
2116
- this._zone.run(function () { return _this.outsideClick.emit(); });
2117
- };
2118
- NgDropdownPanelComponent.prototype._onItemsChange = function (items, firstChange) {
2119
- this.items = items || [];
2120
- this._scrollToEndFired = false;
2121
- this.itemsLength = items.length;
2122
- if (this.virtualScroll) {
2123
- this._updateItemsRange(firstChange);
2124
- }
2125
- else {
2126
- this._setVirtualHeight();
2127
- this._updateItems(firstChange);
2128
- }
2129
- };
2130
- NgDropdownPanelComponent.prototype._updateItems = function (firstChange) {
2131
- var _this = this;
2132
- this.update.emit(this.items);
2133
- if (firstChange === false) {
2134
- return;
2135
- }
2136
- this._zone.runOutsideAngular(function () {
2137
- Promise.resolve().then(function () {
2138
- var panelHeight = _this._scrollablePanel.clientHeight;
2139
- _this._panelService.setDimensions(0, panelHeight);
2140
- _this._handleDropdownPosition();
2141
- _this.scrollTo(_this.markedItem, firstChange);
2142
- });
2143
- });
2144
- };
2145
- NgDropdownPanelComponent.prototype._updateItemsRange = function (firstChange) {
2146
- var _this = this;
2147
- this._zone.runOutsideAngular(function () {
2148
- _this._measureDimensions().then(function () {
2149
- if (firstChange) {
2150
- _this._renderItemsRange(_this._startOffset);
2151
- _this._handleDropdownPosition();
2152
- }
2153
- else {
2154
- _this._renderItemsRange();
2155
- }
2156
- });
2157
- });
2158
- };
2159
- NgDropdownPanelComponent.prototype._onContentScrolled = function (scrollTop) {
2160
- if (this.virtualScroll) {
2161
- this._renderItemsRange(scrollTop);
2162
- }
2163
- this._lastScrollPosition = scrollTop;
2164
- this._fireScrollToEnd(scrollTop);
2165
- };
2166
- NgDropdownPanelComponent.prototype._updateVirtualHeight = function (height) {
2167
- if (this._updateScrollHeight) {
2168
- this._virtualPadding.style.height = height + "px";
2169
- this._updateScrollHeight = false;
2170
- }
2171
- };
2172
- NgDropdownPanelComponent.prototype._setVirtualHeight = function () {
2173
- if (!this._virtualPadding) {
2174
- return;
2175
- }
2176
- this._virtualPadding.style.height = "0px";
2177
- };
2178
- NgDropdownPanelComponent.prototype._onItemsLengthChanged = function () {
2179
- this._updateScrollHeight = true;
2180
- };
2181
- NgDropdownPanelComponent.prototype._renderItemsRange = function (scrollTop) {
2182
- var _this = this;
2183
- if (scrollTop === void 0) { scrollTop = null; }
2184
- if (scrollTop && this._lastScrollPosition === scrollTop) {
2185
- return;
2186
- }
2187
- scrollTop = scrollTop || this._scrollablePanel.scrollTop;
2188
- var range = this._panelService.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);
2189
- this._updateVirtualHeight(range.scrollHeight);
2190
- this._contentPanel.style.transform = "translateY(" + range.topPadding + "px)";
2191
- this._zone.run(function () {
2192
- _this.update.emit(_this.items.slice(range.start, range.end));
2193
- _this.scroll.emit({ start: range.start, end: range.end });
2194
- });
2195
- if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
2196
- this._scrollablePanel.scrollTop = scrollTop;
2197
- this._lastScrollPosition = scrollTop;
2198
- }
2199
- };
2200
- NgDropdownPanelComponent.prototype._measureDimensions = function () {
2201
- var _this = this;
2202
- if (this._panelService.dimensions.itemHeight > 0 || this.itemsLength === 0) {
2203
- return Promise.resolve(this._panelService.dimensions);
2204
- }
2205
- var _a = __read(this.items, 1), first = _a[0];
2206
- this.update.emit([first]);
2207
- return Promise.resolve().then(function () {
2208
- var option = _this._dropdown.querySelector("#" + first.htmlId);
2209
- var optionHeight = option.clientHeight;
2210
- _this._virtualPadding.style.height = optionHeight * _this.itemsLength + "px";
2211
- var panelHeight = _this._scrollablePanel.clientHeight;
2212
- _this._panelService.setDimensions(optionHeight, panelHeight);
2213
- return _this._panelService.dimensions;
2214
- });
2215
- };
2216
- NgDropdownPanelComponent.prototype._fireScrollToEnd = function (scrollTop) {
2217
- var _this = this;
2218
- if (this._scrollToEndFired || scrollTop === 0) {
2219
- return;
2220
- }
2221
- var padding = this.virtualScroll ?
2222
- this._virtualPadding :
2223
- this._contentPanel;
2224
- if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight - 1) {
2225
- this._zone.run(function () { return _this.scrollToEnd.emit(); });
2226
- this._scrollToEndFired = true;
2227
- }
2228
- };
2229
- NgDropdownPanelComponent.prototype._calculateCurrentPosition = function (dropdownEl) {
2230
- if (this.position !== 'auto') {
2231
- return this.position;
2232
- }
2233
- var selectRect = this._select.getBoundingClientRect();
2234
- var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
2235
- var offsetTop = selectRect.top + window.pageYOffset;
2236
- var height = selectRect.height;
2237
- var dropdownHeight = dropdownEl.getBoundingClientRect().height;
2238
- if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
2239
- return 'top';
2240
- }
2241
- else {
2242
- return 'bottom';
2243
- }
2244
- };
2245
- NgDropdownPanelComponent.prototype._appendDropdown = function () {
2246
- if (!this.appendTo) {
2247
- return;
2248
- }
2249
- this._parent = document.querySelector(this.appendTo);
2250
- if (!this._parent) {
2251
- throw new Error("appendTo selector " + this.appendTo + " did not found any parent element");
2252
- }
2253
- this._updateXPosition();
2254
- this._parent.appendChild(this._dropdown);
2255
- };
2256
- NgDropdownPanelComponent.prototype._updateXPosition = function () {
2257
- var select = this._select.getBoundingClientRect();
2258
- var parent = this._parent.getBoundingClientRect();
2259
- var offsetLeft = select.left - parent.left;
2260
- this._dropdown.style.left = offsetLeft + 'px';
2261
- this._dropdown.style.width = select.width + 'px';
2262
- this._dropdown.style.minWidth = select.width + 'px';
2263
- };
2264
- NgDropdownPanelComponent.prototype._updateYPosition = function () {
2265
- var select = this._select.getBoundingClientRect();
2266
- var parent = this._parent.getBoundingClientRect();
2267
- var delta = select.height;
2268
- if (this._currentPosition === 'top') {
2269
- var offsetBottom = parent.bottom - select.bottom;
2270
- this._dropdown.style.bottom = offsetBottom + delta + 'px';
2271
- this._dropdown.style.top = 'auto';
2272
- }
2273
- else if (this._currentPosition === 'bottom') {
2274
- var offsetTop = select.top - parent.top;
2275
- this._dropdown.style.top = offsetTop + delta + 'px';
2276
- this._dropdown.style.bottom = 'auto';
2277
- }
2278
- };
2279
- NgDropdownPanelComponent.prototype._setupMousedownListener = function () {
2280
- var _this = this;
2281
- this._zone.runOutsideAngular(function () {
2282
- rxjs.fromEvent(_this._dropdown, 'mousedown')
2283
- .pipe(operators.takeUntil(_this._destroy$))
2284
- .subscribe(function (event) {
2285
- var target = event.target;
2286
- if (target.tagName === 'INPUT') {
2287
- return;
2288
- }
2289
- event.preventDefault();
2290
- });
2291
- });
2292
- };
2293
- return NgDropdownPanelComponent;
2294
- }());
2295
- NgDropdownPanelComponent.decorators = [
2296
- { type: i0.Component, args: [{
2297
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
2298
- encapsulation: i0.ViewEncapsulation.None,
2299
- selector: 'ng-dropdown-panel',
2300
- template: "\n <div *ngIf=\"headerTemplate\" class=\"ng-dropdown-header\">\n <ng-container [ngTemplateOutlet]=\"headerTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: filterValue }\"></ng-container>\n </div>\n <div #scroll class=\"ng-dropdown-panel-items scroll-host\">\n <div #padding [class.total-padding]=\"virtualScroll\"></div>\n <div #content [class.scrollable-content]=\"virtualScroll && items.length\">\n <ng-content></ng-content>\n </div>\n </div>\n <div *ngIf=\"footerTemplate\" class=\"ng-dropdown-footer\">\n <ng-container [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: filterValue }\"></ng-container>\n </div>\n "
2301
- },] }
2302
- ];
2303
- NgDropdownPanelComponent.ctorParameters = function () { return [
2304
- { type: i0.Renderer2 },
2305
- { type: i0.NgZone },
2306
- { type: NgDropdownPanelService },
2307
- { type: i0.ElementRef },
2308
- { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [common.DOCUMENT,] }] }
2309
- ]; };
2310
- NgDropdownPanelComponent.propDecorators = {
2311
- items: [{ type: i0.Input }],
2312
- markedItem: [{ type: i0.Input }],
2313
- position: [{ type: i0.Input }],
2314
- appendTo: [{ type: i0.Input }],
2315
- bufferAmount: [{ type: i0.Input }],
2316
- virtualScroll: [{ type: i0.Input }],
2317
- headerTemplate: [{ type: i0.Input }],
2318
- footerTemplate: [{ type: i0.Input }],
2319
- filterValue: [{ type: i0.Input }],
2320
- update: [{ type: i0.Output }],
2321
- scroll: [{ type: i0.Output }],
2322
- scrollToEnd: [{ type: i0.Output }],
2323
- outsideClick: [{ type: i0.Output }],
2324
- contentElementRef: [{ type: i0.ViewChild, args: ['content', { read: i0.ElementRef, static: true },] }],
2325
- scrollElementRef: [{ type: i0.ViewChild, args: ['scroll', { read: i0.ElementRef, static: true },] }],
2326
- paddingElementRef: [{ type: i0.ViewChild, args: ['padding', { read: i0.ElementRef, static: true },] }]
2327
- };
2328
-
2329
- var NgOptionComponent = /** @class */ (function () {
2330
- function NgOptionComponent(elementRef) {
2331
- this.elementRef = elementRef;
2332
- this.stateChange$ = new rxjs.Subject();
2333
- this._disabled = false;
2334
- }
2335
- Object.defineProperty(NgOptionComponent.prototype, "disabled", {
2336
- get: function () { return this._disabled; },
2337
- set: function (value) { this._disabled = this._isDisabled(value); },
2338
- enumerable: false,
2339
- configurable: true
2340
- });
2341
- Object.defineProperty(NgOptionComponent.prototype, "label", {
2342
- get: function () {
2343
- return (this.elementRef.nativeElement.textContent || '').trim();
2344
- },
2345
- enumerable: false,
2346
- configurable: true
2347
- });
2348
- NgOptionComponent.prototype.ngOnChanges = function (changes) {
2349
- if (changes.disabled) {
2350
- this.stateChange$.next({
2351
- value: this.value,
2352
- disabled: this._disabled
2353
- });
2354
- }
2355
- };
2356
- NgOptionComponent.prototype.ngAfterViewChecked = function () {
2357
- if (this.label !== this._previousLabel) {
2358
- this._previousLabel = this.label;
2359
- this.stateChange$.next({
2360
- value: this.value,
2361
- disabled: this._disabled,
2362
- label: this.elementRef.nativeElement.innerHTML
2363
- });
2364
- }
2365
- };
2366
- NgOptionComponent.prototype.ngOnDestroy = function () {
2367
- this.stateChange$.complete();
2368
- };
2369
- NgOptionComponent.prototype._isDisabled = function (value) {
2370
- return value != null && "" + value !== 'false';
2371
- };
2372
- return NgOptionComponent;
2373
- }());
2374
- NgOptionComponent.decorators = [
2375
- { type: i0.Component, args: [{
2376
- selector: 'ng-option',
2377
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
2378
- template: "<ng-content></ng-content>"
2379
- },] }
2380
- ];
2381
- NgOptionComponent.ctorParameters = function () { return [
2382
- { type: i0.ElementRef }
2383
- ]; };
2384
- NgOptionComponent.propDecorators = {
2385
- value: [{ type: i0.Input }],
2386
- disabled: [{ type: i0.Input }]
2387
- };
2388
-
2389
- var NgSelectConfig = /** @class */ (function () {
2390
- function NgSelectConfig() {
2391
- this.notFoundText = 'No items found';
2392
- this.typeToSearchText = 'Type to search';
2393
- this.addTagText = 'Add item';
2394
- this.loadingText = 'Loading...';
2395
- this.clearAllText = 'Clear all';
2396
- this.disableVirtualScroll = true;
2397
- this.openOnEnter = true;
2398
- this.appearance = 'underline';
2399
- }
2400
- return NgSelectConfig;
2401
- }());
2402
- NgSelectConfig.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function NgSelectConfig_Factory() { return new NgSelectConfig(); }, token: NgSelectConfig, providedIn: "root" });
2403
- NgSelectConfig.decorators = [
2404
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
2405
- ];
2406
-
2407
- var SELECTION_MODEL_FACTORY = new i0.InjectionToken('ng-select-selection-model');
2408
- var NgSelectComponent = /** @class */ (function () {
2409
- function NgSelectComponent(classes, autoFocus, config, newSelectionModel, _elementRef, _cd, _console) {
2410
- var _this = this;
2411
- this.classes = classes;
2412
- this.autoFocus = autoFocus;
2413
- this.config = config;
2414
- this._cd = _cd;
2415
- this._console = _console;
2416
- this.markFirst = true;
2417
- this.dropdownPosition = 'auto';
2418
- this.loading = false;
2419
- this.closeOnSelect = true;
2420
- this.hideSelected = false;
2421
- this.selectOnTab = false;
2422
- this.bufferAmount = 4;
2423
- this.selectableGroup = false;
2424
- this.selectableGroupAsModel = true;
2425
- this.searchFn = null;
2426
- this.trackByFn = null;
2427
- this.clearOnBackspace = true;
2428
- this.labelForId = null;
2429
- this.inputAttrs = {};
2430
- this.readonly = false;
2431
- this.searchWhileComposing = true;
2432
- this.minTermLength = 0;
2433
- this.editableSearchTerm = false;
2434
- this.keyDownFn = function (_) { return true; };
2435
- this.multiple = false;
2436
- this.addTag = false;
2437
- this.searchable = true;
2438
- this.clearable = true;
2439
- this.isOpen = false;
2440
- // output events
2441
- this.blurEvent = new i0.EventEmitter();
2442
- this.focusEvent = new i0.EventEmitter();
2443
- this.changeEvent = new i0.EventEmitter();
2444
- this.openEvent = new i0.EventEmitter();
2445
- this.closeEvent = new i0.EventEmitter();
2446
- this.searchEvent = new i0.EventEmitter();
2447
- this.clearEvent = new i0.EventEmitter();
2448
- this.addEvent = new i0.EventEmitter();
2449
- this.removeEvent = new i0.EventEmitter();
2450
- this.scroll = new i0.EventEmitter();
2451
- this.scrollToEnd = new i0.EventEmitter();
2452
- this.viewPortItems = [];
2453
- this.searchTerm = null;
2454
- this.dropdownId = newId();
2455
- this.escapeHTML = true;
2456
- this.useDefaultClass = true;
2457
- this._items = [];
2458
- this._defaultLabel = 'label';
2459
- this._pressedKeys = [];
2460
- this._isComposing = false;
2461
- this._destroy$ = new rxjs.Subject();
2462
- this._keyPress$ = new rxjs.Subject();
2463
- this._onChange = function (_) { };
2464
- this._onTouched = function () { };
2465
- this.clearItem = function (item) {
2466
- var option = _this.selectedItems.find(function (x) { return x.value === item; });
2467
- _this.unselect(option);
2468
- };
2469
- this.trackByOption = function (_, item) {
2470
- if (_this.trackByFn) {
2471
- return _this.trackByFn(item.value);
2472
- }
2473
- return item;
2474
- };
2475
- this._mergeGlobalConfig(config);
2476
- this.itemsList = new ItemsList(this, newSelectionModel());
2477
- this.element = _elementRef.nativeElement;
2478
- }
2479
- Object.defineProperty(NgSelectComponent.prototype, "items", {
2480
- get: function () { return this._items; },
2481
- set: function (value) {
2482
- if (value === null) {
2483
- value = [];
2484
- }
2485
- this._itemsAreUsed = true;
2486
- this._items = value;
2487
- },
2488
- enumerable: false,
2489
- configurable: true
2490
- });
2491
- ;
2492
- ;
2493
- Object.defineProperty(NgSelectComponent.prototype, "compareWith", {
2494
- get: function () { return this._compareWith; },
2495
- set: function (fn) {
2496
- if (fn !== undefined && fn !== null && !isFunction(fn)) {
2497
- throw Error('`compareWith` must be a function.');
2498
- }
2499
- this._compareWith = fn;
2500
- },
2501
- enumerable: false,
2502
- configurable: true
2503
- });
2504
- Object.defineProperty(NgSelectComponent.prototype, "clearSearchOnAdd", {
2505
- get: function () {
2506
- if (isDefined(this._clearSearchOnAdd)) {
2507
- return this._clearSearchOnAdd;
2508
- }
2509
- else if (isDefined(this.config.clearSearchOnAdd)) {
2510
- return this.config.clearSearchOnAdd;
2511
- }
2512
- return this.closeOnSelect;
2513
- },
2514
- set: function (value) {
2515
- this._clearSearchOnAdd = value;
2516
- },
2517
- enumerable: false,
2518
- configurable: true
2519
- });
2520
- ;
2521
- ;
2522
- Object.defineProperty(NgSelectComponent.prototype, "disabled", {
2523
- get: function () { return this.readonly || this._disabled; },
2524
- enumerable: false,
2525
- configurable: true
2526
- });
2527
- ;
2528
- Object.defineProperty(NgSelectComponent.prototype, "filtered", {
2529
- get: function () { return (!!this.searchTerm && this.searchable || this._isComposing); },
2530
- enumerable: false,
2531
- configurable: true
2532
- });
2533
- ;
2534
- Object.defineProperty(NgSelectComponent.prototype, "_editableSearchTerm", {
2535
- get: function () {
2536
- return this.editableSearchTerm && !this.multiple;
2537
- },
2538
- enumerable: false,
2539
- configurable: true
2540
- });
2541
- Object.defineProperty(NgSelectComponent.prototype, "selectedItems", {
2542
- get: function () {
2543
- return this.itemsList.selectedItems;
2544
- },
2545
- enumerable: false,
2546
- configurable: true
2547
- });
2548
- Object.defineProperty(NgSelectComponent.prototype, "selectedValues", {
2549
- get: function () {
2550
- return this.selectedItems.map(function (x) { return x.value; });
2551
- },
2552
- enumerable: false,
2553
- configurable: true
2554
- });
2555
- Object.defineProperty(NgSelectComponent.prototype, "hasValue", {
2556
- get: function () {
2557
- return this.selectedItems.length > 0;
2558
- },
2559
- enumerable: false,
2560
- configurable: true
2561
- });
2562
- Object.defineProperty(NgSelectComponent.prototype, "currentPanelPosition", {
2563
- get: function () {
2564
- if (this.dropdownPanel) {
2565
- return this.dropdownPanel.currentPosition;
2566
- }
2567
- return undefined;
2568
- },
2569
- enumerable: false,
2570
- configurable: true
2571
- });
2572
- NgSelectComponent.prototype.ngOnInit = function () {
2573
- this._handleKeyPresses();
2574
- this._setInputAttributes();
2575
- };
2576
- NgSelectComponent.prototype.ngOnChanges = function (changes) {
2577
- if (changes.multiple) {
2578
- this.itemsList.clearSelected();
2579
- }
2580
- if (changes.items) {
2581
- this._setItems(changes.items.currentValue || []);
2582
- }
2583
- if (changes.isOpen) {
2584
- this._manualOpen = isDefined(changes.isOpen.currentValue);
2585
- }
2586
- };
2587
- NgSelectComponent.prototype.ngAfterViewInit = function () {
2588
- if (!this._itemsAreUsed) {
2589
- this.escapeHTML = false;
2590
- this._setItemsFromNgOptions();
2591
- }
2592
- if (isDefined(this.autoFocus)) {
2593
- this.focus();
2594
- }
2595
- };
2596
- NgSelectComponent.prototype.ngOnDestroy = function () {
2597
- this._destroy$.next();
2598
- this._destroy$.complete();
2599
- };
2600
- NgSelectComponent.prototype.handleKeyDown = function ($event) {
2601
- var keyCode = KeyCode[$event.which];
2602
- if (keyCode) {
2603
- if (this.keyDownFn($event) === false) {
2604
- return;
2605
- }
2606
- this.handleKeyCode($event);
2607
- }
2608
- else if ($event.key && $event.key.length === 1) {
2609
- this._keyPress$.next($event.key.toLocaleLowerCase());
2610
- }
2611
- };
2612
- NgSelectComponent.prototype.handleKeyCode = function ($event) {
2613
- switch ($event.which) {
2614
- case KeyCode.ArrowDown:
2615
- this._handleArrowDown($event);
2616
- break;
2617
- case KeyCode.ArrowUp:
2618
- this._handleArrowUp($event);
2619
- break;
2620
- case KeyCode.Space:
2621
- this._handleSpace($event);
2622
- break;
2623
- case KeyCode.Enter:
2624
- this._handleEnter($event);
2625
- break;
2626
- case KeyCode.Tab:
2627
- this._handleTab($event);
2628
- break;
2629
- case KeyCode.Esc:
2630
- this.close();
2631
- $event.preventDefault();
2632
- break;
2633
- case KeyCode.Backspace:
2634
- this._handleBackspace();
2635
- break;
2636
- }
2637
- };
2638
- NgSelectComponent.prototype.handleMousedown = function ($event) {
2639
- var target = $event.target;
2640
- if (target.tagName !== 'INPUT') {
2641
- $event.preventDefault();
2642
- }
2643
- if (target.classList.contains('ng-clear-wrapper')) {
2644
- this.handleClearClick();
2645
- return;
2646
- }
2647
- if (target.classList.contains('ng-arrow-wrapper')) {
2648
- this.handleArrowClick();
2649
- return;
2650
- }
2651
- if (target.classList.contains('ng-value-icon')) {
2652
- return;
2653
- }
2654
- if (!this.focused) {
2655
- this.focus();
2656
- }
2657
- if (this.searchable) {
2658
- this.open();
2659
- }
2660
- else {
2661
- this.toggle();
2662
- }
2663
- };
2664
- NgSelectComponent.prototype.handleArrowClick = function () {
2665
- if (this.isOpen) {
2666
- this.close();
2667
- }
2668
- else {
2669
- this.open();
2670
- }
2671
- };
2672
- NgSelectComponent.prototype.handleClearClick = function () {
2673
- if (this.hasValue) {
2674
- this.itemsList.clearSelected(true);
2675
- this._updateNgModel();
2676
- }
2677
- this._clearSearch();
2678
- this.focus();
2679
- this.clearEvent.emit();
2680
- this._onSelectionChanged();
2681
- };
2682
- NgSelectComponent.prototype.clearModel = function () {
2683
- if (!this.clearable) {
2684
- return;
2685
- }
2686
- this.itemsList.clearSelected();
2687
- this._updateNgModel();
2688
- };
2689
- NgSelectComponent.prototype.writeValue = function (value) {
2690
- this.itemsList.clearSelected();
2691
- this._handleWriteValue(value);
2692
- this._cd.markForCheck();
2693
- };
2694
- NgSelectComponent.prototype.registerOnChange = function (fn) {
2695
- this._onChange = fn;
2696
- };
2697
- NgSelectComponent.prototype.registerOnTouched = function (fn) {
2698
- this._onTouched = fn;
2699
- };
2700
- NgSelectComponent.prototype.setDisabledState = function (state) {
2701
- this._disabled = state;
2702
- this._cd.markForCheck();
2703
- };
2704
- NgSelectComponent.prototype.toggle = function () {
2705
- if (!this.isOpen) {
2706
- this.open();
2707
- }
2708
- else {
2709
- this.close();
2710
- }
2711
- };
2712
- NgSelectComponent.prototype.open = function () {
2713
- if (this.disabled || this.isOpen || this.itemsList.maxItemsSelected || this._manualOpen) {
2714
- return;
2715
- }
2716
- if (!this._isTypeahead && !this.addTag && this.itemsList.noItemsToSelect) {
2717
- return;
2718
- }
2719
- this.isOpen = true;
2720
- this.itemsList.markSelectedOrDefault(this.markFirst);
2721
- this.openEvent.emit();
2722
- if (!this.searchTerm) {
2723
- this.focus();
2724
- }
2725
- this.detectChanges();
2726
- };
2727
- NgSelectComponent.prototype.close = function () {
2728
- if (!this.isOpen || this._manualOpen) {
2729
- return;
2730
- }
2731
- this.isOpen = false;
2732
- this._isComposing = false;
2733
- if (!this._editableSearchTerm) {
2734
- this._clearSearch();
2735
- }
2736
- else {
2737
- this.itemsList.resetFilteredItems();
2738
- }
2739
- this.itemsList.unmarkItem();
2740
- this._onTouched();
2741
- this.closeEvent.emit();
2742
- this._cd.markForCheck();
2743
- };
2744
- NgSelectComponent.prototype.toggleItem = function (item) {
2745
- if (!item || item.disabled || this.disabled) {
2746
- return;
2747
- }
2748
- if (this.multiple && item.selected) {
2749
- this.unselect(item);
2750
- }
2751
- else {
2752
- this.select(item);
2753
- }
2754
- if (this._editableSearchTerm) {
2755
- this._setSearchTermFromItems();
2756
- }
2757
- this._onSelectionChanged();
2758
- };
2759
- NgSelectComponent.prototype.select = function (item) {
2760
- if (!item.selected) {
2761
- this.itemsList.select(item);
2762
- if (this.clearSearchOnAdd && !this._editableSearchTerm) {
2763
- this._clearSearch();
2764
- }
2765
- this._updateNgModel();
2766
- if (this.multiple) {
2767
- this.addEvent.emit(item.value);
2768
- }
2769
- }
2770
- if (this.closeOnSelect || this.itemsList.noItemsToSelect) {
2771
- this.close();
2772
- }
2773
- };
2774
- NgSelectComponent.prototype.focus = function () {
2775
- this.searchInput.nativeElement.focus();
2776
- };
2777
- NgSelectComponent.prototype.blur = function () {
2778
- this.searchInput.nativeElement.blur();
2779
- };
2780
- NgSelectComponent.prototype.unselect = function (item) {
2781
- if (!item) {
2782
- return;
2783
- }
2784
- this.itemsList.unselect(item);
2785
- this.focus();
2786
- this._updateNgModel();
2787
- this.removeEvent.emit(item);
2788
- };
2789
- NgSelectComponent.prototype.selectTag = function () {
2790
- var _a;
2791
- var _this = this;
2792
- var tag;
2793
- if (isFunction(this.addTag)) {
2794
- tag = this.addTag(this.searchTerm);
2795
- }
2796
- else {
2797
- tag = this._primitive ? this.searchTerm : (_a = {}, _a[this.bindLabel] = this.searchTerm, _a);
2798
- }
2799
- var handleTag = function (item) { return _this._isTypeahead || !_this.isOpen ? _this.itemsList.mapItem(item, null) : _this.itemsList.addItem(item); };
2800
- if (isPromise(tag)) {
2801
- tag.then(function (item) { return _this.select(handleTag(item)); }).catch(function () { });
2802
- }
2803
- else if (tag) {
2804
- this.select(handleTag(tag));
2805
- }
2806
- };
2807
- NgSelectComponent.prototype.showClear = function () {
2808
- return this.clearable && (this.hasValue || this.searchTerm) && !this.disabled;
2809
- };
2810
- Object.defineProperty(NgSelectComponent.prototype, "showAddTag", {
2811
- get: function () {
2812
- if (!this._validTerm) {
2813
- return false;
2814
- }
2815
- var term = this.searchTerm.toLowerCase().trim();
2816
- return this.addTag &&
2817
- (!this.itemsList.filteredItems.some(function (x) { return x.label.toLowerCase() === term; }) &&
2818
- (!this.hideSelected && this.isOpen || !this.selectedItems.some(function (x) { return x.label.toLowerCase() === term; }))) &&
2819
- !this.loading;
2820
- },
2821
- enumerable: false,
2822
- configurable: true
2823
- });
2824
- NgSelectComponent.prototype.showNoItemsFound = function () {
2825
- var empty = this.itemsList.filteredItems.length === 0;
2826
- return ((empty && !this._isTypeahead && !this.loading) ||
2827
- (empty && this._isTypeahead && this._validTerm && !this.loading)) &&
2828
- !this.showAddTag;
2829
- };
2830
- NgSelectComponent.prototype.showTypeToSearch = function () {
2831
- var empty = this.itemsList.filteredItems.length === 0;
2832
- return empty && this._isTypeahead && !this._validTerm && !this.loading;
2833
- };
2834
- NgSelectComponent.prototype.onCompositionStart = function () {
2835
- this._isComposing = true;
2836
- };
2837
- NgSelectComponent.prototype.onCompositionEnd = function (term) {
2838
- this._isComposing = false;
2839
- if (this.searchWhileComposing) {
2840
- return;
2841
- }
2842
- this.filter(term);
2843
- };
2844
- NgSelectComponent.prototype.filter = function (term) {
2845
- if (this._isComposing && !this.searchWhileComposing) {
2846
- return;
2847
- }
2848
- this.searchTerm = term;
2849
- if (this._isTypeahead && (this._validTerm || this.minTermLength === 0)) {
2850
- this.typeahead.next(term);
2851
- }
2852
- if (!this._isTypeahead) {
2853
- this.itemsList.filter(this.searchTerm);
2854
- if (this.isOpen) {
2855
- this.itemsList.markSelectedOrDefault(this.markFirst);
2856
- }
2857
- }
2858
- this.searchEvent.emit({ term: term, items: this.itemsList.filteredItems.map(function (x) { return x.value; }) });
2859
- this.open();
2860
- };
2861
- NgSelectComponent.prototype.onInputFocus = function ($event) {
2862
- if (this.focused) {
2863
- return;
2864
- }
2865
- if (this._editableSearchTerm) {
2866
- this._setSearchTermFromItems();
2867
- }
2868
- this.element.classList.add('ng-select-focused');
2869
- this.focusEvent.emit($event);
2870
- this.focused = true;
2871
- };
2872
- NgSelectComponent.prototype.onInputBlur = function ($event) {
2873
- this.element.classList.remove('ng-select-focused');
2874
- this.blurEvent.emit($event);
2875
- if (!this.isOpen && !this.disabled) {
2876
- this._onTouched();
2877
- }
2878
- if (this._editableSearchTerm) {
2879
- this._setSearchTermFromItems();
2880
- }
2881
- this.focused = false;
2882
- };
2883
- NgSelectComponent.prototype.onItemHover = function (item) {
2884
- if (item.disabled) {
2885
- return;
2886
- }
2887
- this.itemsList.markItem(item);
2888
- };
2889
- NgSelectComponent.prototype.detectChanges = function () {
2890
- if (!this._cd.destroyed) {
2891
- this._cd.detectChanges();
2892
- }
2893
- };
2894
- NgSelectComponent.prototype._setSearchTermFromItems = function () {
2895
- var selected = this.selectedItems && this.selectedItems[0];
2896
- this.searchTerm = (selected && selected.label) || null;
2897
- };
2898
- NgSelectComponent.prototype._setItems = function (items) {
2899
- var firstItem = items[0];
2900
- this.bindLabel = this.bindLabel || this._defaultLabel;
2901
- this._primitive = isDefined(firstItem) ? !isObject(firstItem) : this._primitive || this.bindLabel === this._defaultLabel;
2902
- this.itemsList.setItems(items);
2903
- if (items.length > 0 && this.hasValue) {
2904
- this.itemsList.mapSelectedItems();
2905
- }
2906
- if (this.isOpen && isDefined(this.searchTerm) && !this._isTypeahead) {
2907
- this.itemsList.filter(this.searchTerm);
2908
- }
2909
- if (this._isTypeahead || this.isOpen) {
2910
- this.itemsList.markSelectedOrDefault(this.markFirst);
2911
- }
2912
- };
2913
- NgSelectComponent.prototype._setItemsFromNgOptions = function () {
2914
- var _this = this;
2915
- var mapNgOptions = function (options) {
2916
- _this.items = options.map(function (option) { return ({
2917
- $ngOptionValue: option.value,
2918
- $ngOptionLabel: option.elementRef.nativeElement.innerHTML,
2919
- disabled: option.disabled
2920
- }); });
2921
- _this.itemsList.setItems(_this.items);
2922
- if (_this.hasValue) {
2923
- _this.itemsList.mapSelectedItems();
2924
- }
2925
- _this.detectChanges();
2926
- };
2927
- var handleOptionChange = function () {
2928
- var changedOrDestroyed = rxjs.merge(_this.ngOptions.changes, _this._destroy$);
2929
- rxjs.merge.apply(void 0, __spreadArray([], __read(_this.ngOptions.map(function (option) { return option.stateChange$; })))).pipe(operators.takeUntil(changedOrDestroyed))
2930
- .subscribe(function (option) {
2931
- var item = _this.itemsList.findItem(option.value);
2932
- item.disabled = option.disabled;
2933
- item.label = option.label || item.label;
2934
- _this._cd.detectChanges();
2935
- });
2936
- };
2937
- this.ngOptions.changes
2938
- .pipe(operators.startWith(this.ngOptions), operators.takeUntil(this._destroy$))
2939
- .subscribe(function (options) {
2940
- _this.bindLabel = _this._defaultLabel;
2941
- mapNgOptions(options);
2942
- handleOptionChange();
2943
- });
2944
- };
2945
- NgSelectComponent.prototype._isValidWriteValue = function (value) {
2946
- var _this = this;
2947
- if (!isDefined(value) || (this.multiple && value === '') || Array.isArray(value) && value.length === 0) {
2948
- return false;
2949
- }
2950
- var validateBinding = function (item) {
2951
- if (!isDefined(_this.compareWith) && isObject(item) && _this.bindValue) {
2952
- _this._console.warn("Setting object(" + JSON.stringify(item) + ") as your model with bindValue is not allowed unless [compareWith] is used.");
2953
- return false;
2954
- }
2955
- return true;
2956
- };
2957
- if (this.multiple) {
2958
- if (!Array.isArray(value)) {
2959
- this._console.warn('Multiple select ngModel should be array.');
2960
- return false;
2961
- }
2962
- return value.every(function (item) { return validateBinding(item); });
2963
- }
2964
- else {
2965
- return validateBinding(value);
2966
- }
2967
- };
2968
- NgSelectComponent.prototype._handleWriteValue = function (ngModel) {
2969
- var _this = this;
2970
- if (!this._isValidWriteValue(ngModel)) {
2971
- return;
2972
- }
2973
- var select = function (val) {
2974
- var _a;
2975
- var item = _this.itemsList.findItem(val);
2976
- if (item) {
2977
- _this.itemsList.select(item);
2978
- }
2979
- else {
2980
- var isValObject = isObject(val);
2981
- var isPrimitive = !isValObject && !_this.bindValue;
2982
- if ((isValObject || isPrimitive)) {
2983
- _this.itemsList.select(_this.itemsList.mapItem(val, null));
2984
- }
2985
- else if (_this.bindValue) {
2986
- item = (_a = {},
2987
- _a[_this.bindLabel] = null,
2988
- _a[_this.bindValue] = val,
2989
- _a);
2990
- _this.itemsList.select(_this.itemsList.mapItem(item, null));
2991
- }
2992
- }
2993
- };
2994
- if (this.multiple) {
2995
- ngModel.forEach(function (item) { return select(item); });
2996
- }
2997
- else {
2998
- select(ngModel);
2999
- }
3000
- };
3001
- NgSelectComponent.prototype._handleKeyPresses = function () {
3002
- var _this = this;
3003
- if (this.searchable) {
3004
- return;
3005
- }
3006
- this._keyPress$
3007
- .pipe(operators.takeUntil(this._destroy$), operators.tap(function (letter) { return _this._pressedKeys.push(letter); }), operators.debounceTime(200), operators.filter(function () { return _this._pressedKeys.length > 0; }), operators.map(function () { return _this._pressedKeys.join(''); }))
3008
- .subscribe(function (term) {
3009
- var item = _this.itemsList.findByLabel(term);
3010
- if (item) {
3011
- if (_this.isOpen) {
3012
- _this.itemsList.markItem(item);
3013
- _this._scrollToMarked();
3014
- _this._cd.markForCheck();
3015
- }
3016
- else {
3017
- _this.select(item);
3018
- }
3019
- }
3020
- _this._pressedKeys = [];
3021
- });
3022
- };
3023
- NgSelectComponent.prototype._setInputAttributes = function () {
3024
- var e_1, _a;
3025
- var input = this.searchInput.nativeElement;
3026
- var attributes = Object.assign({ type: 'text', autocorrect: 'off', autocapitalize: 'off', autocomplete: this.labelForId ? 'off' : this.dropdownId }, this.inputAttrs);
3027
- try {
3028
- for (var _b = __values(Object.keys(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
3029
- var key = _c.value;
3030
- input.setAttribute(key, attributes[key]);
3031
- }
3032
- }
3033
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3034
- finally {
3035
- try {
3036
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3037
- }
3038
- finally { if (e_1) throw e_1.error; }
3039
- }
3040
- };
3041
- NgSelectComponent.prototype._updateNgModel = function () {
3042
- var e_2, _a;
3043
- var model = [];
3044
- try {
3045
- for (var _b = __values(this.selectedItems), _c = _b.next(); !_c.done; _c = _b.next()) {
3046
- var item = _c.value;
3047
- if (this.bindValue) {
3048
- var value = null;
3049
- if (item.children) {
3050
- var groupKey = this.groupValue ? this.bindValue : this.groupBy;
3051
- value = item.value[groupKey || this.groupBy];
3052
- }
3053
- else {
3054
- value = this.itemsList.resolveNested(item.value, this.bindValue);
3055
- }
3056
- model.push(value);
3057
- }
3058
- else {
3059
- model.push(item.value);
3060
- }
3061
- }
3062
- }
3063
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
3064
- finally {
3065
- try {
3066
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3067
- }
3068
- finally { if (e_2) throw e_2.error; }
3069
- }
3070
- var selected = this.selectedItems.map(function (x) { return x.value; });
3071
- if (this.multiple) {
3072
- this._onChange(model);
3073
- this.changeEvent.emit(selected);
3074
- }
3075
- else {
3076
- this._onChange(isDefined(model[0]) ? model[0] : null);
3077
- this.changeEvent.emit(selected[0]);
3078
- }
3079
- this._cd.markForCheck();
3080
- };
3081
- NgSelectComponent.prototype._clearSearch = function () {
3082
- if (!this.searchTerm) {
3083
- return;
3084
- }
3085
- this._changeSearch(null);
3086
- this.itemsList.resetFilteredItems();
3087
- };
3088
- NgSelectComponent.prototype._changeSearch = function (searchTerm) {
3089
- this.searchTerm = searchTerm;
3090
- if (this._isTypeahead) {
3091
- this.typeahead.next(searchTerm);
3092
- }
3093
- };
3094
- NgSelectComponent.prototype._scrollToMarked = function () {
3095
- if (!this.isOpen || !this.dropdownPanel) {
3096
- return;
3097
- }
3098
- this.dropdownPanel.scrollTo(this.itemsList.markedItem);
3099
- };
3100
- NgSelectComponent.prototype._scrollToTag = function () {
3101
- if (!this.isOpen || !this.dropdownPanel) {
3102
- return;
3103
- }
3104
- this.dropdownPanel.scrollToTag();
3105
- };
3106
- NgSelectComponent.prototype._onSelectionChanged = function () {
3107
- if (this.isOpen && this.multiple && this.appendTo) {
3108
- // Make sure items are rendered.
3109
- this._cd.detectChanges();
3110
- this.dropdownPanel.adjustPosition();
3111
- }
3112
- };
3113
- NgSelectComponent.prototype._handleTab = function ($event) {
3114
- if (this.isOpen === false && !this.addTag) {
3115
- return;
3116
- }
3117
- if (this.selectOnTab) {
3118
- if (this.itemsList.markedItem) {
3119
- this.toggleItem(this.itemsList.markedItem);
3120
- $event.preventDefault();
3121
- }
3122
- else if (this.showAddTag) {
3123
- this.selectTag();
3124
- $event.preventDefault();
3125
- }
3126
- else {
3127
- this.close();
3128
- }
3129
- }
3130
- else {
3131
- this.close();
3132
- }
3133
- };
3134
- NgSelectComponent.prototype._handleEnter = function ($event) {
3135
- if (this.isOpen || this._manualOpen) {
3136
- if (this.itemsList.markedItem) {
3137
- this.toggleItem(this.itemsList.markedItem);
3138
- }
3139
- else if (this.showAddTag) {
3140
- this.selectTag();
3141
- }
3142
- }
3143
- else if (this.openOnEnter) {
3144
- this.open();
3145
- }
3146
- else {
3147
- return;
3148
- }
3149
- $event.preventDefault();
3150
- };
3151
- NgSelectComponent.prototype._handleSpace = function ($event) {
3152
- if (this.isOpen || this._manualOpen) {
3153
- return;
3154
- }
3155
- this.open();
3156
- $event.preventDefault();
3157
- };
3158
- NgSelectComponent.prototype._handleArrowDown = function ($event) {
3159
- if (this._nextItemIsTag(+1)) {
3160
- this.itemsList.unmarkItem();
3161
- this._scrollToTag();
3162
- }
3163
- else {
3164
- this.itemsList.markNextItem();
3165
- this._scrollToMarked();
3166
- }
3167
- this.open();
3168
- $event.preventDefault();
3169
- };
3170
- NgSelectComponent.prototype._handleArrowUp = function ($event) {
3171
- if (!this.isOpen) {
3172
- return;
3173
- }
3174
- if (this._nextItemIsTag(-1)) {
3175
- this.itemsList.unmarkItem();
3176
- this._scrollToTag();
3177
- }
3178
- else {
3179
- this.itemsList.markPreviousItem();
3180
- this._scrollToMarked();
3181
- }
3182
- $event.preventDefault();
3183
- };
3184
- NgSelectComponent.prototype._nextItemIsTag = function (nextStep) {
3185
- var nextIndex = this.itemsList.markedIndex + nextStep;
3186
- return this.addTag && this.searchTerm
3187
- && this.itemsList.markedItem
3188
- && (nextIndex < 0 || nextIndex === this.itemsList.filteredItems.length);
3189
- };
3190
- NgSelectComponent.prototype._handleBackspace = function () {
3191
- if (this.searchTerm || !this.clearable || !this.clearOnBackspace || !this.hasValue) {
3192
- return;
3193
- }
3194
- if (this.multiple) {
3195
- this.unselect(this.itemsList.lastSelectedItem);
3196
- }
3197
- else {
3198
- this.clearModel();
3199
- }
3200
- };
3201
- Object.defineProperty(NgSelectComponent.prototype, "_isTypeahead", {
3202
- get: function () {
3203
- return this.typeahead && this.typeahead.observers.length > 0;
3204
- },
3205
- enumerable: false,
3206
- configurable: true
3207
- });
3208
- Object.defineProperty(NgSelectComponent.prototype, "_validTerm", {
3209
- get: function () {
3210
- var term = this.searchTerm && this.searchTerm.trim();
3211
- return term && term.length >= this.minTermLength;
3212
- },
3213
- enumerable: false,
3214
- configurable: true
3215
- });
3216
- NgSelectComponent.prototype._mergeGlobalConfig = function (config) {
3217
- this.placeholder = this.placeholder || config.placeholder;
3218
- this.notFoundText = this.notFoundText || config.notFoundText;
3219
- this.typeToSearchText = this.typeToSearchText || config.typeToSearchText;
3220
- this.addTagText = this.addTagText || config.addTagText;
3221
- this.loadingText = this.loadingText || config.loadingText;
3222
- this.clearAllText = this.clearAllText || config.clearAllText;
3223
- this.virtualScroll = isDefined(this.virtualScroll)
3224
- ? this.virtualScroll
3225
- : isDefined(config.disableVirtualScroll) ? !config.disableVirtualScroll : false;
3226
- this.openOnEnter = isDefined(this.openOnEnter) ? this.openOnEnter : config.openOnEnter;
3227
- this.appendTo = this.appendTo || config.appendTo;
3228
- this.bindValue = this.bindValue || config.bindValue;
3229
- this.bindLabel = this.bindLabel || config.bindLabel;
3230
- this.appearance = this.appearance || config.appearance;
3231
- };
3232
- return NgSelectComponent;
3233
- }());
3234
- NgSelectComponent.decorators = [
3235
- { type: i0.Component, args: [{
3236
- selector: 'ng-select',
3237
- template: "<div\n (mousedown)=\"handleMousedown($event)\"\n [class.ng-appearance-outline]=\"appearance === 'outline'\"\n [class.ng-has-value]=\"hasValue\"\n class=\"ng-select-container\">\n\n <div class=\"ng-value-container\">\n <div class=\"ng-placeholder\">{{placeholder}}</div>\n\n <ng-container *ngIf=\"(!multiLabelTemplate || !multiple ) && selectedItems.length > 0\">\n <div [class.ng-value-disabled]=\"item.disabled\" class=\"ng-value\" *ngFor=\"let item of selectedItems; trackBy: trackByOption\">\n <ng-template #defaultLabelTemplate>\n <span class=\"ng-value-icon left\" (click)=\"unselect(item);\" aria-hidden=\"true\">\u00D7</span>\n <span class=\"ng-value-label\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n </ng-template>\n </div>\n </ng-container>\n\n <ng-template *ngIf=\"multiple && multiLabelTemplate && selectedValues.length > 0\"\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\">\n </ng-template>\n\n <div class=\"ng-input\"\n role=\"combobox\" \n [attr.aria-expanded]=\"isOpen\" \n [attr.aria-owns]=\"isOpen ? dropdownId : null\" \n aria-haspopup=\"listbox\">\n\n <input #searchInput\n [attr.id]=\"labelForId\"\n [attr.tabindex]=\"tabIndex\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [disabled]=\"disabled\"\n [value]=\"searchTerm ? searchTerm : ''\"\n (input)=\"filter(searchInput.value)\"\n (compositionstart)=\"onCompositionStart()\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (change)=\"$event.stopPropagation()\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList?.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen ? dropdownId : null\">\n </div>\n </div>\n\n <ng-container *ngIf=\"loading\">\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-spinner-loader\"></div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"loadingSpinnerTemplate || defaultLoadingSpinnerTemplate\">\n </ng-template>\n </ng-container>\n\n <span *ngIf=\"showClear()\" class=\"ng-clear-wrapper\" title=\"{{clearAllText}}\">\n <span class=\"ng-clear\" aria-hidden=\"true\">\u00D7</span>\n </span>\n\n <span class=\"ng-arrow-wrapper\">\n <span class=\"ng-arrow\"></span>\n </span>\n</div>\n\n<ng-dropdown-panel *ngIf=\"isOpen\"\n class=\"ng-dropdown-panel\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"dropdownPosition\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit($event)\"\n (outsideClick)=\"close()\"\n [class.ng-select-multiple]=\"multiple\"\n [ngClass]=\"appendTo ? classes : null\"\n [id]=\"dropdownId\"\n role=\"listbox\"\n aria-label=\"Options list\">\n\n <ng-container>\n <div class=\"ng-option\" [attr.role]=\"item.children ? 'group' : 'option'\" (click)=\"toggleItem(item)\" (mouseover)=\"onItemHover(item)\"\n *ngFor=\"let item of viewPortItems; trackBy: trackByOption\"\n [class.ng-option-disabled]=\"item.disabled\"\n [class.ng-option-selected]=\"item.selected\"\n [class.ng-optgroup]=\"item.children\"\n [class.ng-option]=\"!item.children\"\n [class.ng-option-child]=\"!!item.parent\"\n [class.ng-option-marked]=\"item === itemsList.markedItem\"\n [attr.aria-selected]=\"item.selected\"\n [attr.id]=\"item?.htmlId\">\n\n <ng-template #defaultOptionTemplate>\n <span class=\"ng-option-label\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"item.children ? (optgroupTemplate || defaultOptionTemplate) : (optionTemplate || defaultOptionTemplate)\"\n [ngTemplateOutletContext]=\"{ item: item.value, item$:item, index: item.index, searchTerm: searchTerm }\">\n </ng-template>\n </div>\n\n <div class=\"ng-option\" [class.ng-option-marked]=\"!itemsList.markedItem\" (mouseover)=\"itemsList.unmarkItem()\" role=\"option\" (click)=\"selectTag()\" *ngIf=\"showAddTag\">\n <ng-template #defaultTagTemplate>\n <span><span class=\"ng-tag-label\">{{addTagText}}</span>\"{{searchTerm}}\"</span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"showNoItemsFound()\">\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{notFoundText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"showTypeToSearch()\">\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{typeToSearchText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\">\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"loading && itemsList.filteredItems.length === 0\">\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{loadingText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-container>\n\n</ng-dropdown-panel>\n",
3238
- providers: [{
3239
- provide: forms.NG_VALUE_ACCESSOR,
3240
- useExisting: i0.forwardRef(function () { return NgSelectComponent; }),
3241
- multi: true
3242
- }, NgDropdownPanelService],
3243
- encapsulation: i0.ViewEncapsulation.None,
3244
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
3245
- host: {
3246
- '[class.ng-select]': 'useDefaultClass',
3247
- '[class.ng-select-single]': '!multiple',
3248
- },
3249
- styles: [".ng-select{position:relative;display:block;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-value{-webkit-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder{display:none}.ng-select .ng-select-container{cursor:default;display:flex;outline:none;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:flex;flex:1}.ng-select .ng-select-container .ng-value-container .ng-input{opacity:0}.ng-select .ng-select-container .ng-value-container .ng-input>input{box-sizing:content-box;background:none transparent;border:0 none;box-shadow:none;outline:none;padding:0;cursor:default;width:100%}.ng-select .ng-select-container .ng-value-container .ng-input>input::-ms-clear{display:none}.ng-select .ng-select-container .ng-value-container .ng-input>input[readonly]{-webkit-user-select:none;user-select:none;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-select-container .ng-value-container .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-select-container .ng-value-container{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{position:absolute}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{cursor:pointer}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;user-select:none}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-spinner-loader{border-radius:50%;width:17px;height:17px;margin-right:5px;font-size:10px;position:relative;text-indent:-9999em;border-top:2px solid rgba(66,66,66,.2);border-right:2px solid rgba(66,66,66,.2);border-bottom:2px solid rgba(66,66,66,.2);border-left:2px solid #424242;transform:translateZ(0);animation:load8 .8s infinite linear}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@keyframes load8{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-user-select:none;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{pointer-events:none;display:inline-block;height:0;width:0;position:relative}.ng-dropdown-panel{box-sizing:border-box;position:absolute;opacity:0;width:100%;z-index:1050;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;box-sizing:border-box;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{box-sizing:border-box;cursor:pointer;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .ng-option-label:empty:before{content:\"\\200b\"}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .highlighted{font-weight:bold;text-decoration:underline}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option.disabled{cursor:default}.ng-dropdown-panel .scroll-host{overflow:hidden;overflow-y:auto;position:relative;display:block;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .scrollable-content{top:0;left:0;width:100%;height:100%;position:absolute}.ng-dropdown-panel .total-padding{width:1px;opacity:0}\n"]
3250
- },] }
3251
- ];
3252
- NgSelectComponent.ctorParameters = function () { return [
3253
- { type: String, decorators: [{ type: i0.Attribute, args: ['class',] }] },
3254
- { type: undefined, decorators: [{ type: i0.Attribute, args: ['autofocus',] }] },
3255
- { type: NgSelectConfig },
3256
- { type: undefined, decorators: [{ type: i0.Inject, args: [SELECTION_MODEL_FACTORY,] }] },
3257
- { type: i0.ElementRef },
3258
- { type: i0.ChangeDetectorRef },
3259
- { type: ConsoleService }
3260
- ]; };
3261
- NgSelectComponent.propDecorators = {
3262
- bindLabel: [{ type: i0.Input }],
3263
- bindValue: [{ type: i0.Input }],
3264
- markFirst: [{ type: i0.Input }],
3265
- placeholder: [{ type: i0.Input }],
3266
- notFoundText: [{ type: i0.Input }],
3267
- typeToSearchText: [{ type: i0.Input }],
3268
- addTagText: [{ type: i0.Input }],
3269
- loadingText: [{ type: i0.Input }],
3270
- clearAllText: [{ type: i0.Input }],
3271
- appearance: [{ type: i0.Input }],
3272
- dropdownPosition: [{ type: i0.Input }],
3273
- appendTo: [{ type: i0.Input }],
3274
- loading: [{ type: i0.Input }],
3275
- closeOnSelect: [{ type: i0.Input }],
3276
- hideSelected: [{ type: i0.Input }],
3277
- selectOnTab: [{ type: i0.Input }],
3278
- openOnEnter: [{ type: i0.Input }],
3279
- maxSelectedItems: [{ type: i0.Input }],
3280
- groupBy: [{ type: i0.Input }],
3281
- groupValue: [{ type: i0.Input }],
3282
- bufferAmount: [{ type: i0.Input }],
3283
- virtualScroll: [{ type: i0.Input }],
3284
- selectableGroup: [{ type: i0.Input }],
3285
- selectableGroupAsModel: [{ type: i0.Input }],
3286
- searchFn: [{ type: i0.Input }],
3287
- trackByFn: [{ type: i0.Input }],
3288
- clearOnBackspace: [{ type: i0.Input }],
3289
- labelForId: [{ type: i0.Input }],
3290
- inputAttrs: [{ type: i0.Input }],
3291
- tabIndex: [{ type: i0.Input }],
3292
- readonly: [{ type: i0.Input }],
3293
- searchWhileComposing: [{ type: i0.Input }],
3294
- minTermLength: [{ type: i0.Input }],
3295
- editableSearchTerm: [{ type: i0.Input }],
3296
- keyDownFn: [{ type: i0.Input }],
3297
- typeahead: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.ng-select-typeahead',] }],
3298
- multiple: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.ng-select-multiple',] }],
3299
- addTag: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.ng-select-taggable',] }],
3300
- searchable: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.ng-select-searchable',] }],
3301
- clearable: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.ng-select-clearable',] }],
3302
- isOpen: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.ng-select-opened',] }],
3303
- items: [{ type: i0.Input }],
3304
- compareWith: [{ type: i0.Input }],
3305
- clearSearchOnAdd: [{ type: i0.Input }],
3306
- blurEvent: [{ type: i0.Output, args: ['blur',] }],
3307
- focusEvent: [{ type: i0.Output, args: ['focus',] }],
3308
- changeEvent: [{ type: i0.Output, args: ['change',] }],
3309
- openEvent: [{ type: i0.Output, args: ['open',] }],
3310
- closeEvent: [{ type: i0.Output, args: ['close',] }],
3311
- searchEvent: [{ type: i0.Output, args: ['search',] }],
3312
- clearEvent: [{ type: i0.Output, args: ['clear',] }],
3313
- addEvent: [{ type: i0.Output, args: ['add',] }],
3314
- removeEvent: [{ type: i0.Output, args: ['remove',] }],
3315
- scroll: [{ type: i0.Output, args: ['scroll',] }],
3316
- scrollToEnd: [{ type: i0.Output, args: ['scrollToEnd',] }],
3317
- optionTemplate: [{ type: i0.ContentChild, args: [NgOptionTemplateDirective, { read: i0.TemplateRef },] }],
3318
- optgroupTemplate: [{ type: i0.ContentChild, args: [NgOptgroupTemplateDirective, { read: i0.TemplateRef },] }],
3319
- labelTemplate: [{ type: i0.ContentChild, args: [NgLabelTemplateDirective, { read: i0.TemplateRef },] }],
3320
- multiLabelTemplate: [{ type: i0.ContentChild, args: [NgMultiLabelTemplateDirective, { read: i0.TemplateRef },] }],
3321
- headerTemplate: [{ type: i0.ContentChild, args: [NgHeaderTemplateDirective, { read: i0.TemplateRef },] }],
3322
- footerTemplate: [{ type: i0.ContentChild, args: [NgFooterTemplateDirective, { read: i0.TemplateRef },] }],
3323
- notFoundTemplate: [{ type: i0.ContentChild, args: [NgNotFoundTemplateDirective, { read: i0.TemplateRef },] }],
3324
- typeToSearchTemplate: [{ type: i0.ContentChild, args: [NgTypeToSearchTemplateDirective, { read: i0.TemplateRef },] }],
3325
- loadingTextTemplate: [{ type: i0.ContentChild, args: [NgLoadingTextTemplateDirective, { read: i0.TemplateRef },] }],
3326
- tagTemplate: [{ type: i0.ContentChild, args: [NgTagTemplateDirective, { read: i0.TemplateRef },] }],
3327
- loadingSpinnerTemplate: [{ type: i0.ContentChild, args: [NgLoadingSpinnerTemplateDirective, { read: i0.TemplateRef },] }],
3328
- dropdownPanel: [{ type: i0.ViewChild, args: [i0.forwardRef(function () { return NgDropdownPanelComponent; }),] }],
3329
- searchInput: [{ type: i0.ViewChild, args: ['searchInput', { static: true },] }],
3330
- ngOptions: [{ type: i0.ContentChildren, args: [NgOptionComponent, { descendants: true },] }],
3331
- disabled: [{ type: i0.HostBinding, args: ['class.ng-select-disabled',] }],
3332
- filtered: [{ type: i0.HostBinding, args: ['class.ng-select-filtered',] }],
3333
- handleKeyDown: [{ type: i0.HostListener, args: ['keydown', ['$event'],] }]
3334
- };
3335
-
3336
- function DefaultSelectionModelFactory() {
3337
- return new DefaultSelectionModel();
3338
- }
3339
- var DefaultSelectionModel = /** @class */ (function () {
3340
- function DefaultSelectionModel() {
3341
- this._selected = [];
3342
- }
3343
- Object.defineProperty(DefaultSelectionModel.prototype, "value", {
3344
- get: function () {
3345
- return this._selected;
3346
- },
3347
- enumerable: false,
3348
- configurable: true
3349
- });
3350
- DefaultSelectionModel.prototype.select = function (item, multiple, groupAsModel) {
3351
- item.selected = true;
3352
- if (!item.children || (!multiple && groupAsModel)) {
3353
- this._selected.push(item);
3354
- }
3355
- if (multiple) {
3356
- if (item.parent) {
3357
- var childrenCount = item.parent.children.length;
3358
- var selectedCount = item.parent.children.filter(function (x) { return x.selected; }).length;
3359
- item.parent.selected = childrenCount === selectedCount;
3360
- }
3361
- else if (item.children) {
3362
- this._setChildrenSelectedState(item.children, true);
3363
- this._removeChildren(item);
3364
- if (groupAsModel && this._activeChildren(item)) {
3365
- this._selected = __spreadArray(__spreadArray([], __read(this._selected.filter(function (x) { return x.parent !== item; }))), [item]);
3366
- }
3367
- else {
3368
- this._selected = __spreadArray(__spreadArray([], __read(this._selected)), __read(item.children.filter(function (x) { return !x.disabled; })));
3369
- }
3370
- }
3371
- }
3372
- };
3373
- DefaultSelectionModel.prototype.unselect = function (item, multiple) {
3374
- var _a;
3375
- this._selected = this._selected.filter(function (x) { return x !== item; });
3376
- item.selected = false;
3377
- if (multiple) {
3378
- if (item.parent && item.parent.selected) {
3379
- var children = item.parent.children;
3380
- this._removeParent(item.parent);
3381
- this._removeChildren(item.parent);
3382
- (_a = this._selected).push.apply(_a, __spreadArray([], __read(children.filter(function (x) { return x !== item && !x.disabled; }))));
3383
- item.parent.selected = false;
3384
- }
3385
- else if (item.children) {
3386
- this._setChildrenSelectedState(item.children, false);
3387
- this._removeChildren(item);
3388
- }
3389
- }
3390
- };
3391
- DefaultSelectionModel.prototype.clear = function (keepDisabled) {
3392
- this._selected = keepDisabled ? this._selected.filter(function (x) { return x.disabled; }) : [];
3393
- };
3394
- DefaultSelectionModel.prototype._setChildrenSelectedState = function (children, selected) {
3395
- var e_1, _a;
3396
- try {
3397
- for (var children_1 = __values(children), children_1_1 = children_1.next(); !children_1_1.done; children_1_1 = children_1.next()) {
3398
- var child = children_1_1.value;
3399
- if (child.disabled) {
3400
- continue;
3401
- }
3402
- child.selected = selected;
3403
- }
3404
- }
3405
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3406
- finally {
3407
- try {
3408
- if (children_1_1 && !children_1_1.done && (_a = children_1.return)) _a.call(children_1);
3409
- }
3410
- finally { if (e_1) throw e_1.error; }
3411
- }
3412
- };
3413
- DefaultSelectionModel.prototype._removeChildren = function (parent) {
3414
- this._selected = __spreadArray(__spreadArray([], __read(this._selected.filter(function (x) { return x.parent !== parent; }))), __read(parent.children.filter(function (x) { return x.parent === parent && x.disabled && x.selected; })));
3415
- };
3416
- DefaultSelectionModel.prototype._removeParent = function (parent) {
3417
- this._selected = this._selected.filter(function (x) { return x !== parent; });
3418
- };
3419
- DefaultSelectionModel.prototype._activeChildren = function (item) {
3420
- return item.children.every(function (x) { return !x.disabled || x.selected; });
3421
- };
3422
- return DefaultSelectionModel;
3423
- }());
3424
-
3425
- var ɵ0 = DefaultSelectionModelFactory;
3426
- var NgSelectModule = /** @class */ (function () {
3427
- function NgSelectModule() {
3428
- }
3429
- return NgSelectModule;
3430
- }());
3431
- NgSelectModule.decorators = [
3432
- { type: i0.NgModule, args: [{
3433
- declarations: [
3434
- NgDropdownPanelComponent,
3435
- NgOptionComponent,
3436
- NgSelectComponent,
3437
- NgOptgroupTemplateDirective,
3438
- NgOptionTemplateDirective,
3439
- NgLabelTemplateDirective,
3440
- NgMultiLabelTemplateDirective,
3441
- NgHeaderTemplateDirective,
3442
- NgFooterTemplateDirective,
3443
- NgNotFoundTemplateDirective,
3444
- NgTypeToSearchTemplateDirective,
3445
- NgLoadingTextTemplateDirective,
3446
- NgTagTemplateDirective,
3447
- NgLoadingSpinnerTemplateDirective,
3448
- NgItemLabelDirective
3449
- ],
3450
- imports: [
3451
- common.CommonModule
3452
- ],
3453
- exports: [
3454
- NgSelectComponent,
3455
- NgOptionComponent,
3456
- NgOptgroupTemplateDirective,
3457
- NgOptionTemplateDirective,
3458
- NgLabelTemplateDirective,
3459
- NgMultiLabelTemplateDirective,
3460
- NgHeaderTemplateDirective,
3461
- NgFooterTemplateDirective,
3462
- NgNotFoundTemplateDirective,
3463
- NgTypeToSearchTemplateDirective,
3464
- NgLoadingTextTemplateDirective,
3465
- NgTagTemplateDirective,
3466
- NgLoadingSpinnerTemplateDirective
3467
- ],
3468
- providers: [
3469
- { provide: SELECTION_MODEL_FACTORY, useValue: ɵ0 }
3470
- ]
3471
- },] }
3472
- ];
3473
-
3474
- /*
3475
- * Public API Surface of ng-select
3476
- */
3477
-
3478
- /**
3479
- * Generated bundle index. Do not edit.
3480
- */
3481
-
3482
- exports.NgSelectComponent = NgSelectComponent;
3483
- exports.NgSelectConfig = NgSelectConfig;
3484
- exports.NgSelectModule = NgSelectModule;
3485
- exports.SELECTION_MODEL_FACTORY = SELECTION_MODEL_FACTORY;
3486
- exports["ɵb"] = DefaultSelectionModelFactory;
3487
- exports["ɵc"] = DefaultSelectionModel;
3488
- exports["ɵd"] = NgDropdownPanelService;
3489
- exports["ɵe"] = NgItemLabelDirective;
3490
- exports["ɵf"] = NgOptionTemplateDirective;
3491
- exports["ɵg"] = NgOptgroupTemplateDirective;
3492
- exports["ɵh"] = NgLabelTemplateDirective;
3493
- exports["ɵi"] = NgMultiLabelTemplateDirective;
3494
- exports["ɵj"] = NgHeaderTemplateDirective;
3495
- exports["ɵk"] = NgFooterTemplateDirective;
3496
- exports["ɵl"] = NgNotFoundTemplateDirective;
3497
- exports["ɵm"] = NgTypeToSearchTemplateDirective;
3498
- exports["ɵn"] = NgLoadingTextTemplateDirective;
3499
- exports["ɵo"] = NgTagTemplateDirective;
3500
- exports["ɵp"] = NgLoadingSpinnerTemplateDirective;
3501
- exports["ɵq"] = NgDropdownPanelComponent;
3502
- exports["ɵr"] = NgOptionComponent;
3503
- exports["ɵs"] = ConsoleService;
3504
-
3505
- Object.defineProperty(exports, '__esModule', { value: true });
3506
-
3507
- }));
3508
- //# sourceMappingURL=ng-select-ng-select.umd.js.map