@ng-select/ng-select 7.2.0 → 8.1.0

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