@ng-select/ng-select 5.0.14 → 6.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.
- package/README.md +1 -0
- package/bundles/ng-select-ng-select.umd.js +147 -1981
- package/bundles/ng-select-ng-select.umd.js.map +1 -1
- package/bundles/ng-select-ng-select.umd.min.js +2 -2
- package/bundles/ng-select-ng-select.umd.min.js.map +1 -1
- package/esm2015/lib/config.service.js +2 -31
- package/esm2015/lib/console.service.js +2 -11
- package/esm2015/lib/id.js +3 -16
- package/esm2015/lib/items-list.js +47 -353
- package/esm2015/lib/ng-dropdown-panel.component.js +25 -347
- package/esm2015/lib/ng-dropdown-panel.service.js +1 -72
- package/esm2015/lib/ng-option.component.js +2 -54
- package/esm2015/lib/ng-select.component.js +49 -717
- package/esm2015/lib/ng-select.module.js +1 -6
- package/esm2015/lib/ng-select.types.js +11 -49
- package/esm2015/lib/ng-templates.directive.js +1 -113
- package/esm2015/lib/search-helper.js +3 -18
- package/esm2015/lib/selection-model.js +11 -134
- package/esm2015/lib/value-utils.js +2 -34
- package/esm2015/ng-select-ng-select.js +2 -7
- package/esm2015/public-api.js +1 -6
- package/fesm2015/ng-select-ng-select.js +152 -1950
- package/fesm2015/ng-select-ng-select.js.map +1 -1
- package/lib/config.service.d.ts +1 -0
- package/ng-select-ng-select.metadata.json +1 -1
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('rxjs/operators'), require('rxjs'), require('@angular/common')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@ng-select/ng-select', ['exports', '@angular/core', '@angular/forms', 'rxjs/operators', 'rxjs', '@angular/common'], factory) :
|
|
4
|
-
(global = 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));
|
|
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
5
|
}(this, (function (exports, i0, forms, operators, rxjs, common) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
return extendStatics(d, b);
|
|
29
29
|
};
|
|
30
30
|
function __extends(d, b) {
|
|
31
|
+
if (typeof b !== "function" && b !== null)
|
|
32
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
31
33
|
extendStatics(d, b);
|
|
32
34
|
function __() { this.constructor = d; }
|
|
33
35
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -213,11 +215,13 @@
|
|
|
213
215
|
}
|
|
214
216
|
return ar;
|
|
215
217
|
}
|
|
218
|
+
/** @deprecated */
|
|
216
219
|
function __spread() {
|
|
217
220
|
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
218
221
|
ar = ar.concat(__read(arguments[i]));
|
|
219
222
|
return ar;
|
|
220
223
|
}
|
|
224
|
+
/** @deprecated */
|
|
221
225
|
function __spreadArrays() {
|
|
222
226
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
223
227
|
s += arguments[i].length;
|
|
@@ -226,7 +230,11 @@
|
|
|
226
230
|
r[k] = a[j];
|
|
227
231
|
return r;
|
|
228
232
|
}
|
|
229
|
-
|
|
233
|
+
function __spreadArray(to, from) {
|
|
234
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
235
|
+
to[j] = from[i];
|
|
236
|
+
return to;
|
|
237
|
+
}
|
|
230
238
|
function __await(v) {
|
|
231
239
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
232
240
|
}
|
|
@@ -305,16 +313,8 @@
|
|
|
305
313
|
return value;
|
|
306
314
|
}
|
|
307
315
|
|
|
308
|
-
/**
|
|
309
|
-
* @fileoverview added by tsickle
|
|
310
|
-
* Generated from: lib/value-utils.ts
|
|
311
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
312
|
-
*/
|
|
313
|
-
/** @type {?} */
|
|
314
316
|
var unescapedHTMLExp = /[&<>"']/g;
|
|
315
|
-
/** @type {?} */
|
|
316
317
|
var hasUnescapedHTMLExp = RegExp(unescapedHTMLExp.source);
|
|
317
|
-
/** @type {?} */
|
|
318
318
|
var htmlEscapes = {
|
|
319
319
|
'&': '&',
|
|
320
320
|
'<': '<',
|
|
@@ -322,67 +322,29 @@
|
|
|
322
322
|
'"': '"',
|
|
323
323
|
'\'': '''
|
|
324
324
|
};
|
|
325
|
-
/**
|
|
326
|
-
* @param {?} string
|
|
327
|
-
* @return {?}
|
|
328
|
-
*/
|
|
329
325
|
function escapeHTML(string) {
|
|
330
326
|
return (string && hasUnescapedHTMLExp.test(string)) ?
|
|
331
|
-
string.replace(unescapedHTMLExp, (
|
|
332
|
-
* @param {?} chr
|
|
333
|
-
* @return {?}
|
|
334
|
-
*/function (/**
|
|
335
|
-
* @param {?} chr
|
|
336
|
-
* @return {?}
|
|
337
|
-
*/ chr) { return htmlEscapes[chr]; })) :
|
|
327
|
+
string.replace(unescapedHTMLExp, function (chr) { return htmlEscapes[chr]; }) :
|
|
338
328
|
string;
|
|
339
329
|
}
|
|
340
|
-
/**
|
|
341
|
-
* @param {?} value
|
|
342
|
-
* @return {?}
|
|
343
|
-
*/
|
|
344
330
|
function isDefined(value) {
|
|
345
331
|
return value !== undefined && value !== null;
|
|
346
332
|
}
|
|
347
|
-
/**
|
|
348
|
-
* @param {?} value
|
|
349
|
-
* @return {?}
|
|
350
|
-
*/
|
|
351
333
|
function isObject(value) {
|
|
352
334
|
return typeof value === 'object' && isDefined(value);
|
|
353
335
|
}
|
|
354
|
-
/**
|
|
355
|
-
* @param {?} value
|
|
356
|
-
* @return {?}
|
|
357
|
-
*/
|
|
358
336
|
function isPromise(value) {
|
|
359
337
|
return value instanceof Promise;
|
|
360
338
|
}
|
|
361
|
-
/**
|
|
362
|
-
* @param {?} value
|
|
363
|
-
* @return {?}
|
|
364
|
-
*/
|
|
365
339
|
function isFunction(value) {
|
|
366
340
|
return value instanceof Function;
|
|
367
341
|
}
|
|
368
342
|
|
|
369
|
-
/**
|
|
370
|
-
* @fileoverview added by tsickle
|
|
371
|
-
* Generated from: lib/ng-templates.directive.ts
|
|
372
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
373
|
-
*/
|
|
374
343
|
var NgItemLabelDirective = /** @class */ (function () {
|
|
375
|
-
/**
|
|
376
|
-
* @param {?} element
|
|
377
|
-
*/
|
|
378
344
|
function NgItemLabelDirective(element) {
|
|
379
345
|
this.element = element;
|
|
380
346
|
this.escape = true;
|
|
381
347
|
}
|
|
382
|
-
/**
|
|
383
|
-
* @param {?} changes
|
|
384
|
-
* @return {?}
|
|
385
|
-
*/
|
|
386
348
|
NgItemLabelDirective.prototype.ngOnChanges = function (changes) {
|
|
387
349
|
this.element.nativeElement.innerHTML = this.escape ?
|
|
388
350
|
escapeHTML(this.ngItemLabel) :
|
|
@@ -393,7 +355,6 @@
|
|
|
393
355
|
NgItemLabelDirective.decorators = [
|
|
394
356
|
{ type: i0.Directive, args: [{ selector: '[ngItemLabel]' },] }
|
|
395
357
|
];
|
|
396
|
-
/** @nocollapse */
|
|
397
358
|
NgItemLabelDirective.ctorParameters = function () { return [
|
|
398
359
|
{ type: i0.ElementRef }
|
|
399
360
|
]; };
|
|
@@ -401,21 +362,7 @@
|
|
|
401
362
|
ngItemLabel: [{ type: i0.Input }],
|
|
402
363
|
escape: [{ type: i0.Input }]
|
|
403
364
|
};
|
|
404
|
-
if (false) {
|
|
405
|
-
/** @type {?} */
|
|
406
|
-
NgItemLabelDirective.prototype.ngItemLabel;
|
|
407
|
-
/** @type {?} */
|
|
408
|
-
NgItemLabelDirective.prototype.escape;
|
|
409
|
-
/**
|
|
410
|
-
* @type {?}
|
|
411
|
-
* @private
|
|
412
|
-
*/
|
|
413
|
-
NgItemLabelDirective.prototype.element;
|
|
414
|
-
}
|
|
415
365
|
var NgOptionTemplateDirective = /** @class */ (function () {
|
|
416
|
-
/**
|
|
417
|
-
* @param {?} template
|
|
418
|
-
*/
|
|
419
366
|
function NgOptionTemplateDirective(template) {
|
|
420
367
|
this.template = template;
|
|
421
368
|
}
|
|
@@ -424,18 +371,10 @@
|
|
|
424
371
|
NgOptionTemplateDirective.decorators = [
|
|
425
372
|
{ type: i0.Directive, args: [{ selector: '[ng-option-tmp]' },] }
|
|
426
373
|
];
|
|
427
|
-
/** @nocollapse */
|
|
428
374
|
NgOptionTemplateDirective.ctorParameters = function () { return [
|
|
429
375
|
{ type: i0.TemplateRef }
|
|
430
376
|
]; };
|
|
431
|
-
if (false) {
|
|
432
|
-
/** @type {?} */
|
|
433
|
-
NgOptionTemplateDirective.prototype.template;
|
|
434
|
-
}
|
|
435
377
|
var NgOptgroupTemplateDirective = /** @class */ (function () {
|
|
436
|
-
/**
|
|
437
|
-
* @param {?} template
|
|
438
|
-
*/
|
|
439
378
|
function NgOptgroupTemplateDirective(template) {
|
|
440
379
|
this.template = template;
|
|
441
380
|
}
|
|
@@ -444,18 +383,10 @@
|
|
|
444
383
|
NgOptgroupTemplateDirective.decorators = [
|
|
445
384
|
{ type: i0.Directive, args: [{ selector: '[ng-optgroup-tmp]' },] }
|
|
446
385
|
];
|
|
447
|
-
/** @nocollapse */
|
|
448
386
|
NgOptgroupTemplateDirective.ctorParameters = function () { return [
|
|
449
387
|
{ type: i0.TemplateRef }
|
|
450
388
|
]; };
|
|
451
|
-
if (false) {
|
|
452
|
-
/** @type {?} */
|
|
453
|
-
NgOptgroupTemplateDirective.prototype.template;
|
|
454
|
-
}
|
|
455
389
|
var NgLabelTemplateDirective = /** @class */ (function () {
|
|
456
|
-
/**
|
|
457
|
-
* @param {?} template
|
|
458
|
-
*/
|
|
459
390
|
function NgLabelTemplateDirective(template) {
|
|
460
391
|
this.template = template;
|
|
461
392
|
}
|
|
@@ -464,18 +395,10 @@
|
|
|
464
395
|
NgLabelTemplateDirective.decorators = [
|
|
465
396
|
{ type: i0.Directive, args: [{ selector: '[ng-label-tmp]' },] }
|
|
466
397
|
];
|
|
467
|
-
/** @nocollapse */
|
|
468
398
|
NgLabelTemplateDirective.ctorParameters = function () { return [
|
|
469
399
|
{ type: i0.TemplateRef }
|
|
470
400
|
]; };
|
|
471
|
-
if (false) {
|
|
472
|
-
/** @type {?} */
|
|
473
|
-
NgLabelTemplateDirective.prototype.template;
|
|
474
|
-
}
|
|
475
401
|
var NgMultiLabelTemplateDirective = /** @class */ (function () {
|
|
476
|
-
/**
|
|
477
|
-
* @param {?} template
|
|
478
|
-
*/
|
|
479
402
|
function NgMultiLabelTemplateDirective(template) {
|
|
480
403
|
this.template = template;
|
|
481
404
|
}
|
|
@@ -484,18 +407,10 @@
|
|
|
484
407
|
NgMultiLabelTemplateDirective.decorators = [
|
|
485
408
|
{ type: i0.Directive, args: [{ selector: '[ng-multi-label-tmp]' },] }
|
|
486
409
|
];
|
|
487
|
-
/** @nocollapse */
|
|
488
410
|
NgMultiLabelTemplateDirective.ctorParameters = function () { return [
|
|
489
411
|
{ type: i0.TemplateRef }
|
|
490
412
|
]; };
|
|
491
|
-
if (false) {
|
|
492
|
-
/** @type {?} */
|
|
493
|
-
NgMultiLabelTemplateDirective.prototype.template;
|
|
494
|
-
}
|
|
495
413
|
var NgHeaderTemplateDirective = /** @class */ (function () {
|
|
496
|
-
/**
|
|
497
|
-
* @param {?} template
|
|
498
|
-
*/
|
|
499
414
|
function NgHeaderTemplateDirective(template) {
|
|
500
415
|
this.template = template;
|
|
501
416
|
}
|
|
@@ -504,18 +419,10 @@
|
|
|
504
419
|
NgHeaderTemplateDirective.decorators = [
|
|
505
420
|
{ type: i0.Directive, args: [{ selector: '[ng-header-tmp]' },] }
|
|
506
421
|
];
|
|
507
|
-
/** @nocollapse */
|
|
508
422
|
NgHeaderTemplateDirective.ctorParameters = function () { return [
|
|
509
423
|
{ type: i0.TemplateRef }
|
|
510
424
|
]; };
|
|
511
|
-
if (false) {
|
|
512
|
-
/** @type {?} */
|
|
513
|
-
NgHeaderTemplateDirective.prototype.template;
|
|
514
|
-
}
|
|
515
425
|
var NgFooterTemplateDirective = /** @class */ (function () {
|
|
516
|
-
/**
|
|
517
|
-
* @param {?} template
|
|
518
|
-
*/
|
|
519
426
|
function NgFooterTemplateDirective(template) {
|
|
520
427
|
this.template = template;
|
|
521
428
|
}
|
|
@@ -524,18 +431,10 @@
|
|
|
524
431
|
NgFooterTemplateDirective.decorators = [
|
|
525
432
|
{ type: i0.Directive, args: [{ selector: '[ng-footer-tmp]' },] }
|
|
526
433
|
];
|
|
527
|
-
/** @nocollapse */
|
|
528
434
|
NgFooterTemplateDirective.ctorParameters = function () { return [
|
|
529
435
|
{ type: i0.TemplateRef }
|
|
530
436
|
]; };
|
|
531
|
-
if (false) {
|
|
532
|
-
/** @type {?} */
|
|
533
|
-
NgFooterTemplateDirective.prototype.template;
|
|
534
|
-
}
|
|
535
437
|
var NgNotFoundTemplateDirective = /** @class */ (function () {
|
|
536
|
-
/**
|
|
537
|
-
* @param {?} template
|
|
538
|
-
*/
|
|
539
438
|
function NgNotFoundTemplateDirective(template) {
|
|
540
439
|
this.template = template;
|
|
541
440
|
}
|
|
@@ -544,18 +443,10 @@
|
|
|
544
443
|
NgNotFoundTemplateDirective.decorators = [
|
|
545
444
|
{ type: i0.Directive, args: [{ selector: '[ng-notfound-tmp]' },] }
|
|
546
445
|
];
|
|
547
|
-
/** @nocollapse */
|
|
548
446
|
NgNotFoundTemplateDirective.ctorParameters = function () { return [
|
|
549
447
|
{ type: i0.TemplateRef }
|
|
550
448
|
]; };
|
|
551
|
-
if (false) {
|
|
552
|
-
/** @type {?} */
|
|
553
|
-
NgNotFoundTemplateDirective.prototype.template;
|
|
554
|
-
}
|
|
555
449
|
var NgTypeToSearchTemplateDirective = /** @class */ (function () {
|
|
556
|
-
/**
|
|
557
|
-
* @param {?} template
|
|
558
|
-
*/
|
|
559
450
|
function NgTypeToSearchTemplateDirective(template) {
|
|
560
451
|
this.template = template;
|
|
561
452
|
}
|
|
@@ -564,18 +455,10 @@
|
|
|
564
455
|
NgTypeToSearchTemplateDirective.decorators = [
|
|
565
456
|
{ type: i0.Directive, args: [{ selector: '[ng-typetosearch-tmp]' },] }
|
|
566
457
|
];
|
|
567
|
-
/** @nocollapse */
|
|
568
458
|
NgTypeToSearchTemplateDirective.ctorParameters = function () { return [
|
|
569
459
|
{ type: i0.TemplateRef }
|
|
570
460
|
]; };
|
|
571
|
-
if (false) {
|
|
572
|
-
/** @type {?} */
|
|
573
|
-
NgTypeToSearchTemplateDirective.prototype.template;
|
|
574
|
-
}
|
|
575
461
|
var NgLoadingTextTemplateDirective = /** @class */ (function () {
|
|
576
|
-
/**
|
|
577
|
-
* @param {?} template
|
|
578
|
-
*/
|
|
579
462
|
function NgLoadingTextTemplateDirective(template) {
|
|
580
463
|
this.template = template;
|
|
581
464
|
}
|
|
@@ -584,18 +467,10 @@
|
|
|
584
467
|
NgLoadingTextTemplateDirective.decorators = [
|
|
585
468
|
{ type: i0.Directive, args: [{ selector: '[ng-loadingtext-tmp]' },] }
|
|
586
469
|
];
|
|
587
|
-
/** @nocollapse */
|
|
588
470
|
NgLoadingTextTemplateDirective.ctorParameters = function () { return [
|
|
589
471
|
{ type: i0.TemplateRef }
|
|
590
472
|
]; };
|
|
591
|
-
if (false) {
|
|
592
|
-
/** @type {?} */
|
|
593
|
-
NgLoadingTextTemplateDirective.prototype.template;
|
|
594
|
-
}
|
|
595
473
|
var NgTagTemplateDirective = /** @class */ (function () {
|
|
596
|
-
/**
|
|
597
|
-
* @param {?} template
|
|
598
|
-
*/
|
|
599
474
|
function NgTagTemplateDirective(template) {
|
|
600
475
|
this.template = template;
|
|
601
476
|
}
|
|
@@ -604,18 +479,10 @@
|
|
|
604
479
|
NgTagTemplateDirective.decorators = [
|
|
605
480
|
{ type: i0.Directive, args: [{ selector: '[ng-tag-tmp]' },] }
|
|
606
481
|
];
|
|
607
|
-
/** @nocollapse */
|
|
608
482
|
NgTagTemplateDirective.ctorParameters = function () { return [
|
|
609
483
|
{ type: i0.TemplateRef }
|
|
610
484
|
]; };
|
|
611
|
-
if (false) {
|
|
612
|
-
/** @type {?} */
|
|
613
|
-
NgTagTemplateDirective.prototype.template;
|
|
614
|
-
}
|
|
615
485
|
var NgLoadingSpinnerTemplateDirective = /** @class */ (function () {
|
|
616
|
-
/**
|
|
617
|
-
* @param {?} template
|
|
618
|
-
*/
|
|
619
486
|
function NgLoadingSpinnerTemplateDirective(template) {
|
|
620
487
|
this.template = template;
|
|
621
488
|
}
|
|
@@ -624,64 +491,32 @@
|
|
|
624
491
|
NgLoadingSpinnerTemplateDirective.decorators = [
|
|
625
492
|
{ type: i0.Directive, args: [{ selector: '[ng-loadingspinner-tmp]' },] }
|
|
626
493
|
];
|
|
627
|
-
/** @nocollapse */
|
|
628
494
|
NgLoadingSpinnerTemplateDirective.ctorParameters = function () { return [
|
|
629
495
|
{ type: i0.TemplateRef }
|
|
630
496
|
]; };
|
|
631
|
-
if (false) {
|
|
632
|
-
/** @type {?} */
|
|
633
|
-
NgLoadingSpinnerTemplateDirective.prototype.template;
|
|
634
|
-
}
|
|
635
497
|
|
|
636
|
-
/**
|
|
637
|
-
* @fileoverview added by tsickle
|
|
638
|
-
* Generated from: lib/console.service.ts
|
|
639
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
640
|
-
*/
|
|
641
498
|
var ConsoleService = /** @class */ (function () {
|
|
642
499
|
function ConsoleService() {
|
|
643
500
|
}
|
|
644
|
-
/**
|
|
645
|
-
* @param {?} message
|
|
646
|
-
* @return {?}
|
|
647
|
-
*/
|
|
648
501
|
ConsoleService.prototype.warn = function (message) {
|
|
649
502
|
console.warn(message);
|
|
650
503
|
};
|
|
651
504
|
return ConsoleService;
|
|
652
505
|
}());
|
|
506
|
+
ConsoleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ConsoleService_Factory() { return new ConsoleService(); }, token: ConsoleService, providedIn: "root" });
|
|
653
507
|
ConsoleService.decorators = [
|
|
654
508
|
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
655
509
|
];
|
|
656
|
-
/** @nocollapse */ ConsoleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ConsoleService_Factory() { return new ConsoleService(); }, token: ConsoleService, providedIn: "root" });
|
|
657
510
|
|
|
658
|
-
/**
|
|
659
|
-
* @fileoverview added by tsickle
|
|
660
|
-
* Generated from: lib/id.ts
|
|
661
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
662
|
-
*/
|
|
663
|
-
/**
|
|
664
|
-
* @return {?}
|
|
665
|
-
*/
|
|
666
511
|
function newId() {
|
|
667
512
|
// First character is an 'a', it's good practice to tag id to begin with a letter
|
|
668
|
-
return 'axxxxxxxxxxx'.replace(/[x]/g, (
|
|
669
|
-
* @param {?} _
|
|
670
|
-
* @return {?}
|
|
671
|
-
*/function (_) {
|
|
513
|
+
return 'axxxxxxxxxxx'.replace(/[x]/g, function (_) {
|
|
672
514
|
// tslint:disable-next-line:no-bitwise
|
|
673
|
-
/** @type {?} */
|
|
674
515
|
var val = Math.random() * 16 | 0;
|
|
675
516
|
return val.toString(16);
|
|
676
|
-
})
|
|
517
|
+
});
|
|
677
518
|
}
|
|
678
519
|
|
|
679
|
-
/**
|
|
680
|
-
* @fileoverview added by tsickle
|
|
681
|
-
* Generated from: lib/search-helper.ts
|
|
682
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
683
|
-
*/
|
|
684
|
-
/** @type {?} */
|
|
685
520
|
var diacritics = {
|
|
686
521
|
'\u24B6': 'A',
|
|
687
522
|
'\uFF21': 'A',
|
|
@@ -1523,26 +1358,14 @@
|
|
|
1523
1358
|
'\u03C9': '\u03C9',
|
|
1524
1359
|
'\u03C2': '\u03C3'
|
|
1525
1360
|
};
|
|
1526
|
-
/**
|
|
1527
|
-
* @param {?} text
|
|
1528
|
-
* @return {?}
|
|
1529
|
-
*/
|
|
1530
1361
|
function stripSpecialChars(text) {
|
|
1531
|
-
|
|
1532
|
-
var match = ( /**
|
|
1533
|
-
* @param {?} a
|
|
1534
|
-
* @return {?}
|
|
1535
|
-
*/function (a) {
|
|
1362
|
+
var match = function (a) {
|
|
1536
1363
|
return diacritics[a] || a;
|
|
1537
|
-
}
|
|
1364
|
+
};
|
|
1538
1365
|
return text.replace(/[^\u0000-\u007E]/g, match);
|
|
1539
1366
|
}
|
|
1540
1367
|
|
|
1541
1368
|
var ItemsList = /** @class */ (function () {
|
|
1542
|
-
/**
|
|
1543
|
-
* @param {?} _ngSelect
|
|
1544
|
-
* @param {?} _selectionModel
|
|
1545
|
-
*/
|
|
1546
1369
|
function ItemsList(_ngSelect, _selectionModel) {
|
|
1547
1370
|
this._ngSelect = _ngSelect;
|
|
1548
1371
|
this._selectionModel = _selectionModel;
|
|
@@ -1551,9 +1374,6 @@
|
|
|
1551
1374
|
this._markedIndex = -1;
|
|
1552
1375
|
}
|
|
1553
1376
|
Object.defineProperty(ItemsList.prototype, "items", {
|
|
1554
|
-
/**
|
|
1555
|
-
* @return {?}
|
|
1556
|
-
*/
|
|
1557
1377
|
get: function () {
|
|
1558
1378
|
return this._items;
|
|
1559
1379
|
},
|
|
@@ -1561,9 +1381,6 @@
|
|
|
1561
1381
|
configurable: true
|
|
1562
1382
|
});
|
|
1563
1383
|
Object.defineProperty(ItemsList.prototype, "filteredItems", {
|
|
1564
|
-
/**
|
|
1565
|
-
* @return {?}
|
|
1566
|
-
*/
|
|
1567
1384
|
get: function () {
|
|
1568
1385
|
return this._filteredItems;
|
|
1569
1386
|
},
|
|
@@ -1571,9 +1388,6 @@
|
|
|
1571
1388
|
configurable: true
|
|
1572
1389
|
});
|
|
1573
1390
|
Object.defineProperty(ItemsList.prototype, "markedIndex", {
|
|
1574
|
-
/**
|
|
1575
|
-
* @return {?}
|
|
1576
|
-
*/
|
|
1577
1391
|
get: function () {
|
|
1578
1392
|
return this._markedIndex;
|
|
1579
1393
|
},
|
|
@@ -1581,9 +1395,6 @@
|
|
|
1581
1395
|
configurable: true
|
|
1582
1396
|
});
|
|
1583
1397
|
Object.defineProperty(ItemsList.prototype, "selectedItems", {
|
|
1584
|
-
/**
|
|
1585
|
-
* @return {?}
|
|
1586
|
-
*/
|
|
1587
1398
|
get: function () {
|
|
1588
1399
|
return this._selectionModel.value;
|
|
1589
1400
|
},
|
|
@@ -1591,9 +1402,6 @@
|
|
|
1591
1402
|
configurable: true
|
|
1592
1403
|
});
|
|
1593
1404
|
Object.defineProperty(ItemsList.prototype, "markedItem", {
|
|
1594
|
-
/**
|
|
1595
|
-
* @return {?}
|
|
1596
|
-
*/
|
|
1597
1405
|
get: function () {
|
|
1598
1406
|
return this._filteredItems[this._markedIndex];
|
|
1599
1407
|
},
|
|
@@ -1601,9 +1409,6 @@
|
|
|
1601
1409
|
configurable: true
|
|
1602
1410
|
});
|
|
1603
1411
|
Object.defineProperty(ItemsList.prototype, "noItemsToSelect", {
|
|
1604
|
-
/**
|
|
1605
|
-
* @return {?}
|
|
1606
|
-
*/
|
|
1607
1412
|
get: function () {
|
|
1608
1413
|
return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
|
|
1609
1414
|
},
|
|
@@ -1611,9 +1416,6 @@
|
|
|
1611
1416
|
configurable: true
|
|
1612
1417
|
});
|
|
1613
1418
|
Object.defineProperty(ItemsList.prototype, "maxItemsSelected", {
|
|
1614
|
-
/**
|
|
1615
|
-
* @return {?}
|
|
1616
|
-
*/
|
|
1617
1419
|
get: function () {
|
|
1618
1420
|
return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
|
|
1619
1421
|
},
|
|
@@ -1621,14 +1423,9 @@
|
|
|
1621
1423
|
configurable: true
|
|
1622
1424
|
});
|
|
1623
1425
|
Object.defineProperty(ItemsList.prototype, "lastSelectedItem", {
|
|
1624
|
-
/**
|
|
1625
|
-
* @return {?}
|
|
1626
|
-
*/
|
|
1627
1426
|
get: function () {
|
|
1628
|
-
/** @type {?} */
|
|
1629
1427
|
var i = this.selectedItems.length - 1;
|
|
1630
1428
|
for (; i >= 0; i--) {
|
|
1631
|
-
/** @type {?} */
|
|
1632
1429
|
var item = this.selectedItems[i];
|
|
1633
1430
|
if (!item.disabled) {
|
|
1634
1431
|
return item;
|
|
@@ -1639,17 +1436,9 @@
|
|
|
1639
1436
|
enumerable: false,
|
|
1640
1437
|
configurable: true
|
|
1641
1438
|
});
|
|
1642
|
-
/**
|
|
1643
|
-
* @param {?} items
|
|
1644
|
-
* @return {?}
|
|
1645
|
-
*/
|
|
1646
1439
|
ItemsList.prototype.setItems = function (items) {
|
|
1647
1440
|
var _this = this;
|
|
1648
|
-
this._items = items.map((
|
|
1649
|
-
* @param {?} item
|
|
1650
|
-
* @param {?} index
|
|
1651
|
-
* @return {?}
|
|
1652
|
-
*/function (item, index) { return _this.mapItem(item, index); }));
|
|
1441
|
+
this._items = items.map(function (item, index) { return _this.mapItem(item, index); });
|
|
1653
1442
|
if (this._ngSelect.groupBy) {
|
|
1654
1443
|
this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
|
|
1655
1444
|
this._items = this._flatten(this._groups);
|
|
@@ -1660,15 +1449,10 @@
|
|
|
1660
1449
|
}
|
|
1661
1450
|
this._filteredItems = __spread(this._items);
|
|
1662
1451
|
};
|
|
1663
|
-
/**
|
|
1664
|
-
* @param {?} item
|
|
1665
|
-
* @return {?}
|
|
1666
|
-
*/
|
|
1667
1452
|
ItemsList.prototype.select = function (item) {
|
|
1668
1453
|
if (item.selected || this.maxItemsSelected) {
|
|
1669
1454
|
return;
|
|
1670
1455
|
}
|
|
1671
|
-
/** @type {?} */
|
|
1672
1456
|
var multiple = this._ngSelect.multiple;
|
|
1673
1457
|
if (!multiple) {
|
|
1674
1458
|
this.clearSelected();
|
|
@@ -1678,10 +1462,6 @@
|
|
|
1678
1462
|
this._hideSelected(item);
|
|
1679
1463
|
}
|
|
1680
1464
|
};
|
|
1681
|
-
/**
|
|
1682
|
-
* @param {?} item
|
|
1683
|
-
* @return {?}
|
|
1684
|
-
*/
|
|
1685
1465
|
ItemsList.prototype.unselect = function (item) {
|
|
1686
1466
|
if (!item.selected) {
|
|
1687
1467
|
return;
|
|
@@ -1691,104 +1471,45 @@
|
|
|
1691
1471
|
this._showSelected(item);
|
|
1692
1472
|
}
|
|
1693
1473
|
};
|
|
1694
|
-
/**
|
|
1695
|
-
* @param {?} value
|
|
1696
|
-
* @return {?}
|
|
1697
|
-
*/
|
|
1698
1474
|
ItemsList.prototype.findItem = function (value) {
|
|
1699
1475
|
var _this = this;
|
|
1700
|
-
/** @type {?} */
|
|
1701
1476
|
var findBy;
|
|
1702
1477
|
if (this._ngSelect.compareWith) {
|
|
1703
|
-
findBy = (
|
|
1704
|
-
* @param {?} item
|
|
1705
|
-
* @return {?}
|
|
1706
|
-
*/function (/**
|
|
1707
|
-
* @param {?} item
|
|
1708
|
-
* @return {?}
|
|
1709
|
-
*/ item) { return _this._ngSelect.compareWith(item.value, value); });
|
|
1478
|
+
findBy = function (item) { return _this._ngSelect.compareWith(item.value, value); };
|
|
1710
1479
|
}
|
|
1711
1480
|
else if (this._ngSelect.bindValue) {
|
|
1712
|
-
findBy = (
|
|
1713
|
-
* @param {?} item
|
|
1714
|
-
* @return {?}
|
|
1715
|
-
*/function (/**
|
|
1716
|
-
* @param {?} item
|
|
1717
|
-
* @return {?}
|
|
1718
|
-
*/ item) { return !item.children && _this.resolveNested(item.value, _this._ngSelect.bindValue) === value; });
|
|
1481
|
+
findBy = function (item) { return !item.children && _this.resolveNested(item.value, _this._ngSelect.bindValue) === value; };
|
|
1719
1482
|
}
|
|
1720
1483
|
else {
|
|
1721
|
-
findBy = (
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
* @param {?} item
|
|
1726
|
-
* @return {?}
|
|
1727
|
-
*/ item) { return item.value === value ||
|
|
1728
|
-
!item.children && item.label && item.label === _this.resolveNested(value, _this._ngSelect.bindLabel); });
|
|
1729
|
-
}
|
|
1730
|
-
return this._items.find(( /**
|
|
1731
|
-
* @param {?} item
|
|
1732
|
-
* @return {?}
|
|
1733
|
-
*/function (/**
|
|
1734
|
-
* @param {?} item
|
|
1735
|
-
* @return {?}
|
|
1736
|
-
*/ item) { return findBy(item); }));
|
|
1484
|
+
findBy = function (item) { return item.value === value ||
|
|
1485
|
+
!item.children && item.label && item.label === _this.resolveNested(value, _this._ngSelect.bindLabel); };
|
|
1486
|
+
}
|
|
1487
|
+
return this._items.find(function (item) { return findBy(item); });
|
|
1737
1488
|
};
|
|
1738
|
-
/**
|
|
1739
|
-
* @param {?} item
|
|
1740
|
-
* @return {?}
|
|
1741
|
-
*/
|
|
1742
1489
|
ItemsList.prototype.addItem = function (item) {
|
|
1743
|
-
/** @type {?} */
|
|
1744
1490
|
var option = this.mapItem(item, this._items.length);
|
|
1745
1491
|
this._items.push(option);
|
|
1746
1492
|
this._filteredItems.push(option);
|
|
1747
1493
|
return option;
|
|
1748
1494
|
};
|
|
1749
|
-
/**
|
|
1750
|
-
* @param {?=} keepDisabled
|
|
1751
|
-
* @return {?}
|
|
1752
|
-
*/
|
|
1753
1495
|
ItemsList.prototype.clearSelected = function (keepDisabled) {
|
|
1754
1496
|
if (keepDisabled === void 0) { keepDisabled = false; }
|
|
1755
1497
|
this._selectionModel.clear(keepDisabled);
|
|
1756
|
-
this._items.forEach((
|
|
1757
|
-
* @param {?} item
|
|
1758
|
-
* @return {?}
|
|
1759
|
-
*/function (/**
|
|
1760
|
-
* @param {?} item
|
|
1761
|
-
* @return {?}
|
|
1762
|
-
*/ item) {
|
|
1498
|
+
this._items.forEach(function (item) {
|
|
1763
1499
|
item.selected = keepDisabled && item.selected && item.disabled;
|
|
1764
1500
|
item.marked = false;
|
|
1765
|
-
})
|
|
1501
|
+
});
|
|
1766
1502
|
if (this._ngSelect.hideSelected) {
|
|
1767
1503
|
this.resetFilteredItems();
|
|
1768
1504
|
}
|
|
1769
1505
|
};
|
|
1770
|
-
/**
|
|
1771
|
-
* @param {?} term
|
|
1772
|
-
* @return {?}
|
|
1773
|
-
*/
|
|
1774
1506
|
ItemsList.prototype.findByLabel = function (term) {
|
|
1775
1507
|
term = stripSpecialChars(term).toLocaleLowerCase();
|
|
1776
|
-
return this.filteredItems.find((
|
|
1777
|
-
* @param {?} item
|
|
1778
|
-
* @return {?}
|
|
1779
|
-
*/function (/**
|
|
1780
|
-
* @param {?} item
|
|
1781
|
-
* @return {?}
|
|
1782
|
-
*/ item) {
|
|
1783
|
-
/** @type {?} */
|
|
1508
|
+
return this.filteredItems.find(function (item) {
|
|
1784
1509
|
var label = stripSpecialChars(item.label).toLocaleLowerCase();
|
|
1785
1510
|
return label.substr(0, term.length) === term;
|
|
1786
|
-
})
|
|
1511
|
+
});
|
|
1787
1512
|
};
|
|
1788
|
-
/**
|
|
1789
|
-
* @param {?} term
|
|
1790
|
-
* @return {?}
|
|
1791
|
-
*/
|
|
1792
1513
|
ItemsList.prototype.filter = function (term) {
|
|
1793
1514
|
var e_1, _a;
|
|
1794
1515
|
if (!term) {
|
|
@@ -1797,13 +1518,10 @@
|
|
|
1797
1518
|
}
|
|
1798
1519
|
this._filteredItems = [];
|
|
1799
1520
|
term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();
|
|
1800
|
-
/** @type {?} */
|
|
1801
1521
|
var match = this._ngSelect.searchFn || this._defaultSearchFn;
|
|
1802
|
-
/** @type {?} */
|
|
1803
1522
|
var hideSelected = this._ngSelect.hideSelected;
|
|
1804
1523
|
var _loop_1 = function (key) {
|
|
1805
1524
|
var e_2, _a, _b;
|
|
1806
|
-
/** @type {?} */
|
|
1807
1525
|
var matchedItems = [];
|
|
1808
1526
|
try {
|
|
1809
1527
|
for (var _c = (e_2 = void 0, __values(this_1._groups.get(key))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -1811,7 +1529,6 @@
|
|
|
1811
1529
|
if (hideSelected && (item.parent && item.parent.selected || item.selected)) {
|
|
1812
1530
|
continue;
|
|
1813
1531
|
}
|
|
1814
|
-
/** @type {?} */
|
|
1815
1532
|
var searchItem = this_1._ngSelect.searchFn ? item.value : item;
|
|
1816
1533
|
if (match(term, searchItem)) {
|
|
1817
1534
|
matchedItems.push(item);
|
|
@@ -1828,14 +1545,7 @@
|
|
|
1828
1545
|
if (matchedItems.length > 0) {
|
|
1829
1546
|
var _e = __read(matchedItems.slice(-1), 1), last_1 = _e[0];
|
|
1830
1547
|
if (last_1.parent) {
|
|
1831
|
-
|
|
1832
|
-
var head = this_1._items.find(( /**
|
|
1833
|
-
* @param {?} x
|
|
1834
|
-
* @return {?}
|
|
1835
|
-
*/function (/**
|
|
1836
|
-
* @param {?} x
|
|
1837
|
-
* @return {?}
|
|
1838
|
-
*/ x) { return x === last_1.parent; }));
|
|
1548
|
+
var head = this_1._items.find(function (x) { return x === last_1.parent; });
|
|
1839
1549
|
this_1._filteredItems.push(head);
|
|
1840
1550
|
}
|
|
1841
1551
|
(_b = this_1._filteredItems).push.apply(_b, __spread(matchedItems));
|
|
@@ -1856,79 +1566,41 @@
|
|
|
1856
1566
|
finally { if (e_1) throw e_1.error; }
|
|
1857
1567
|
}
|
|
1858
1568
|
};
|
|
1859
|
-
/**
|
|
1860
|
-
* @return {?}
|
|
1861
|
-
*/
|
|
1862
1569
|
ItemsList.prototype.resetFilteredItems = function () {
|
|
1863
1570
|
if (this._filteredItems.length === this._items.length) {
|
|
1864
1571
|
return;
|
|
1865
1572
|
}
|
|
1866
1573
|
if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
|
|
1867
|
-
this._filteredItems = this._items.filter((
|
|
1868
|
-
* @param {?} x
|
|
1869
|
-
* @return {?}
|
|
1870
|
-
*/function (/**
|
|
1871
|
-
* @param {?} x
|
|
1872
|
-
* @return {?}
|
|
1873
|
-
*/ x) { return !x.selected; }));
|
|
1574
|
+
this._filteredItems = this._items.filter(function (x) { return !x.selected; });
|
|
1874
1575
|
}
|
|
1875
1576
|
else {
|
|
1876
1577
|
this._filteredItems = this._items;
|
|
1877
1578
|
}
|
|
1878
1579
|
};
|
|
1879
|
-
/**
|
|
1880
|
-
* @return {?}
|
|
1881
|
-
*/
|
|
1882
1580
|
ItemsList.prototype.unmarkItem = function () {
|
|
1883
1581
|
this._markedIndex = -1;
|
|
1884
1582
|
};
|
|
1885
|
-
/**
|
|
1886
|
-
* @return {?}
|
|
1887
|
-
*/
|
|
1888
1583
|
ItemsList.prototype.markNextItem = function () {
|
|
1889
1584
|
this._stepToItem(+1);
|
|
1890
1585
|
};
|
|
1891
|
-
/**
|
|
1892
|
-
* @return {?}
|
|
1893
|
-
*/
|
|
1894
1586
|
ItemsList.prototype.markPreviousItem = function () {
|
|
1895
1587
|
this._stepToItem(-1);
|
|
1896
1588
|
};
|
|
1897
|
-
/**
|
|
1898
|
-
* @param {?} item
|
|
1899
|
-
* @return {?}
|
|
1900
|
-
*/
|
|
1901
1589
|
ItemsList.prototype.markItem = function (item) {
|
|
1902
1590
|
this._markedIndex = this._filteredItems.indexOf(item);
|
|
1903
1591
|
};
|
|
1904
|
-
/**
|
|
1905
|
-
* @param {?=} markDefault
|
|
1906
|
-
* @return {?}
|
|
1907
|
-
*/
|
|
1908
1592
|
ItemsList.prototype.markSelectedOrDefault = function (markDefault) {
|
|
1909
1593
|
if (this._filteredItems.length === 0) {
|
|
1910
1594
|
return;
|
|
1911
1595
|
}
|
|
1912
|
-
/** @type {?} */
|
|
1913
1596
|
var lastMarkedIndex = this._getLastMarkedIndex();
|
|
1914
1597
|
if (lastMarkedIndex > -1) {
|
|
1915
1598
|
this._markedIndex = lastMarkedIndex;
|
|
1916
1599
|
}
|
|
1917
1600
|
else {
|
|
1918
|
-
this._markedIndex = markDefault ? this.filteredItems.findIndex((
|
|
1919
|
-
* @param {?} x
|
|
1920
|
-
* @return {?}
|
|
1921
|
-
*/function (/**
|
|
1922
|
-
* @param {?} x
|
|
1923
|
-
* @return {?}
|
|
1924
|
-
*/ x) { return !x.disabled; })) : -1;
|
|
1601
|
+
this._markedIndex = markDefault ? this.filteredItems.findIndex(function (x) { return !x.disabled; }) : -1;
|
|
1925
1602
|
}
|
|
1926
1603
|
};
|
|
1927
|
-
/**
|
|
1928
|
-
* @param {?} option
|
|
1929
|
-
* @param {?} key
|
|
1930
|
-
* @return {?}
|
|
1931
|
-
*/
|
|
1932
1604
|
ItemsList.prototype.resolveNested = function (option, key) {
|
|
1933
1605
|
if (!isObject(option)) {
|
|
1934
1606
|
return option;
|
|
@@ -1937,9 +1609,7 @@
|
|
|
1937
1609
|
return option[key];
|
|
1938
1610
|
}
|
|
1939
1611
|
else {
|
|
1940
|
-
/** @type {?} */
|
|
1941
1612
|
var keys = key.split('.');
|
|
1942
|
-
/** @type {?} */
|
|
1943
1613
|
var value = option;
|
|
1944
1614
|
for (var i = 0, len = keys.length; i < len; ++i) {
|
|
1945
1615
|
if (value == null) {
|
|
@@ -1950,15 +1620,8 @@
|
|
|
1950
1620
|
return value;
|
|
1951
1621
|
}
|
|
1952
1622
|
};
|
|
1953
|
-
/**
|
|
1954
|
-
* @param {?} item
|
|
1955
|
-
* @param {?} index
|
|
1956
|
-
* @return {?}
|
|
1957
|
-
*/
|
|
1958
1623
|
ItemsList.prototype.mapItem = function (item, index) {
|
|
1959
|
-
/** @type {?} */
|
|
1960
1624
|
var label = isDefined(item.$ngOptionLabel) ? item.$ngOptionLabel : this.resolveNested(item, this._ngSelect.bindLabel);
|
|
1961
|
-
/** @type {?} */
|
|
1962
1625
|
var value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
|
|
1963
1626
|
return {
|
|
1964
1627
|
index: index,
|
|
@@ -1968,20 +1631,14 @@
|
|
|
1968
1631
|
htmlId: this._ngSelect.dropdownId + "-" + index,
|
|
1969
1632
|
};
|
|
1970
1633
|
};
|
|
1971
|
-
/**
|
|
1972
|
-
* @return {?}
|
|
1973
|
-
*/
|
|
1974
1634
|
ItemsList.prototype.mapSelectedItems = function () {
|
|
1975
1635
|
var e_3, _a;
|
|
1976
1636
|
var _this = this;
|
|
1977
|
-
/** @type {?} */
|
|
1978
1637
|
var multiple = this._ngSelect.multiple;
|
|
1979
1638
|
try {
|
|
1980
1639
|
for (var _b = __values(this.selectedItems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1981
1640
|
var selected = _c.value;
|
|
1982
|
-
/** @type {?} */
|
|
1983
1641
|
var value = this._ngSelect.bindValue ? this.resolveNested(selected.value, this._ngSelect.bindValue) : selected.value;
|
|
1984
|
-
/** @type {?} */
|
|
1985
1642
|
var item = isDefined(value) ? this.findItem(value) : null;
|
|
1986
1643
|
this._selectionModel.unselect(selected, multiple);
|
|
1987
1644
|
this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
|
|
@@ -1995,34 +1652,15 @@
|
|
|
1995
1652
|
finally { if (e_3) throw e_3.error; }
|
|
1996
1653
|
}
|
|
1997
1654
|
if (this._ngSelect.hideSelected) {
|
|
1998
|
-
this._filteredItems = this.filteredItems.filter((
|
|
1999
|
-
* @param {?} x
|
|
2000
|
-
* @return {?}
|
|
2001
|
-
*/function (/**
|
|
2002
|
-
* @param {?} x
|
|
2003
|
-
* @return {?}
|
|
2004
|
-
*/ x) { return _this.selectedItems.indexOf(x) === -1; }));
|
|
1655
|
+
this._filteredItems = this.filteredItems.filter(function (x) { return _this.selectedItems.indexOf(x) === -1; });
|
|
2005
1656
|
}
|
|
2006
1657
|
};
|
|
2007
|
-
/**
|
|
2008
|
-
* @private
|
|
2009
|
-
* @param {?} item
|
|
2010
|
-
* @return {?}
|
|
2011
|
-
*/
|
|
2012
1658
|
ItemsList.prototype._showSelected = function (item) {
|
|
2013
1659
|
var e_4, _a;
|
|
2014
1660
|
this._filteredItems.push(item);
|
|
2015
1661
|
if (item.parent) {
|
|
2016
|
-
/** @type {?} */
|
|
2017
1662
|
var parent_1 = item.parent;
|
|
2018
|
-
|
|
2019
|
-
var parentExists = this._filteredItems.find(( /**
|
|
2020
|
-
* @param {?} x
|
|
2021
|
-
* @return {?}
|
|
2022
|
-
*/function (/**
|
|
2023
|
-
* @param {?} x
|
|
2024
|
-
* @return {?}
|
|
2025
|
-
*/ x) { return x === parent_1; }));
|
|
1663
|
+
var parentExists = this._filteredItems.find(function (x) { return x === parent_1; });
|
|
2026
1664
|
if (!parentExists) {
|
|
2027
1665
|
this._filteredItems.push(parent_1);
|
|
2028
1666
|
}
|
|
@@ -2043,89 +1681,32 @@
|
|
|
2043
1681
|
finally { if (e_4) throw e_4.error; }
|
|
2044
1682
|
}
|
|
2045
1683
|
}
|
|
2046
|
-
this._filteredItems = __spread(this._filteredItems.sort((
|
|
2047
|
-
* @param {?} a
|
|
2048
|
-
* @param {?} b
|
|
2049
|
-
* @return {?}
|
|
2050
|
-
*/function (a, b) { return (a.index - b.index); })));
|
|
1684
|
+
this._filteredItems = __spread(this._filteredItems.sort(function (a, b) { return (a.index - b.index); }));
|
|
2051
1685
|
};
|
|
2052
|
-
/**
|
|
2053
|
-
* @private
|
|
2054
|
-
* @param {?} item
|
|
2055
|
-
* @return {?}
|
|
2056
|
-
*/
|
|
2057
1686
|
ItemsList.prototype._hideSelected = function (item) {
|
|
2058
|
-
this._filteredItems = this._filteredItems.filter((
|
|
2059
|
-
* @param {?} x
|
|
2060
|
-
* @return {?}
|
|
2061
|
-
*/function (/**
|
|
2062
|
-
* @param {?} x
|
|
2063
|
-
* @return {?}
|
|
2064
|
-
*/ x) { return x !== item; }));
|
|
1687
|
+
this._filteredItems = this._filteredItems.filter(function (x) { return x !== item; });
|
|
2065
1688
|
if (item.parent) {
|
|
2066
|
-
/** @type {?} */
|
|
2067
1689
|
var children = item.parent.children;
|
|
2068
|
-
if (children.every((
|
|
2069
|
-
|
|
2070
|
-
* @return {?}
|
|
2071
|
-
*/function (/**
|
|
2072
|
-
* @param {?} x
|
|
2073
|
-
* @return {?}
|
|
2074
|
-
*/ x) { return x.selected; }))) {
|
|
2075
|
-
this._filteredItems = this._filteredItems.filter(( /**
|
|
2076
|
-
* @param {?} x
|
|
2077
|
-
* @return {?}
|
|
2078
|
-
*/function (/**
|
|
2079
|
-
* @param {?} x
|
|
2080
|
-
* @return {?}
|
|
2081
|
-
*/ x) { return x !== item.parent; }));
|
|
1690
|
+
if (children.every(function (x) { return x.selected; })) {
|
|
1691
|
+
this._filteredItems = this._filteredItems.filter(function (x) { return x !== item.parent; });
|
|
2082
1692
|
}
|
|
2083
1693
|
}
|
|
2084
1694
|
else if (item.children) {
|
|
2085
|
-
this._filteredItems = this.filteredItems.filter((
|
|
2086
|
-
* @param {?} x
|
|
2087
|
-
* @return {?}
|
|
2088
|
-
*/function (/**
|
|
2089
|
-
* @param {?} x
|
|
2090
|
-
* @return {?}
|
|
2091
|
-
*/ x) { return x.parent !== item; }));
|
|
1695
|
+
this._filteredItems = this.filteredItems.filter(function (x) { return x.parent !== item; });
|
|
2092
1696
|
}
|
|
2093
1697
|
};
|
|
2094
|
-
/**
|
|
2095
|
-
* @private
|
|
2096
|
-
* @param {?} search
|
|
2097
|
-
* @param {?} opt
|
|
2098
|
-
* @return {?}
|
|
2099
|
-
*/
|
|
2100
1698
|
ItemsList.prototype._defaultSearchFn = function (search, opt) {
|
|
2101
|
-
/** @type {?} */
|
|
2102
1699
|
var label = stripSpecialChars(opt.label).toLocaleLowerCase();
|
|
2103
1700
|
return label.indexOf(search) > -1;
|
|
2104
1701
|
};
|
|
2105
|
-
/**
|
|
2106
|
-
* @private
|
|
2107
|
-
* @param {?} steps
|
|
2108
|
-
* @return {?}
|
|
2109
|
-
*/
|
|
2110
1702
|
ItemsList.prototype._getNextItemIndex = function (steps) {
|
|
2111
1703
|
if (steps > 0) {
|
|
2112
1704
|
return (this._markedIndex >= this._filteredItems.length - 1) ? 0 : (this._markedIndex + 1);
|
|
2113
1705
|
}
|
|
2114
1706
|
return (this._markedIndex <= 0) ? (this._filteredItems.length - 1) : (this._markedIndex - 1);
|
|
2115
1707
|
};
|
|
2116
|
-
/**
|
|
2117
|
-
* @private
|
|
2118
|
-
* @param {?} steps
|
|
2119
|
-
* @return {?}
|
|
2120
|
-
*/
|
|
2121
1708
|
ItemsList.prototype._stepToItem = function (steps) {
|
|
2122
|
-
if (this._filteredItems.length === 0 || this._filteredItems.every((
|
|
2123
|
-
* @param {?} x
|
|
2124
|
-
* @return {?}
|
|
2125
|
-
*/function (/**
|
|
2126
|
-
* @param {?} x
|
|
2127
|
-
* @return {?}
|
|
2128
|
-
*/ x) { return x.disabled; }))) {
|
|
1709
|
+
if (this._filteredItems.length === 0 || this._filteredItems.every(function (x) { return x.disabled; })) {
|
|
2129
1710
|
return;
|
|
2130
1711
|
}
|
|
2131
1712
|
this._markedIndex = this._getNextItemIndex(steps);
|
|
@@ -2133,10 +1714,6 @@
|
|
|
2133
1714
|
this._stepToItem(steps);
|
|
2134
1715
|
}
|
|
2135
1716
|
};
|
|
2136
|
-
/**
|
|
2137
|
-
* @private
|
|
2138
|
-
* @return {?}
|
|
2139
|
-
*/
|
|
2140
1717
|
ItemsList.prototype._getLastMarkedIndex = function () {
|
|
2141
1718
|
if (this._ngSelect.hideSelected) {
|
|
2142
1719
|
return -1;
|
|
@@ -2144,38 +1721,25 @@
|
|
|
2144
1721
|
if (this._markedIndex > -1 && this.markedItem === undefined) {
|
|
2145
1722
|
return -1;
|
|
2146
1723
|
}
|
|
2147
|
-
/** @type {?} */
|
|
2148
1724
|
var selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
|
|
2149
1725
|
if (this.lastSelectedItem && selectedIndex < 0) {
|
|
2150
1726
|
return -1;
|
|
2151
1727
|
}
|
|
2152
1728
|
return Math.max(this.markedIndex, selectedIndex);
|
|
2153
1729
|
};
|
|
2154
|
-
/**
|
|
2155
|
-
* @private
|
|
2156
|
-
* @param {?} items
|
|
2157
|
-
* @param {?} prop
|
|
2158
|
-
* @return {?}
|
|
2159
|
-
*/
|
|
2160
1730
|
ItemsList.prototype._groupBy = function (items, prop) {
|
|
2161
1731
|
var e_5, _a, e_6, _b;
|
|
2162
1732
|
var _this = this;
|
|
2163
|
-
/** @type {?} */
|
|
2164
1733
|
var groups = new Map();
|
|
2165
1734
|
if (items.length === 0) {
|
|
2166
1735
|
return groups;
|
|
2167
1736
|
}
|
|
2168
1737
|
// Check if items are already grouped by given key.
|
|
2169
|
-
if (Array.isArray(items[0].value[
|
|
1738
|
+
if (Array.isArray(items[0].value[prop])) {
|
|
2170
1739
|
try {
|
|
2171
1740
|
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
|
2172
1741
|
var item = items_1_1.value;
|
|
2173
|
-
|
|
2174
|
-
var children = (item.value[( /** @type {?} */(prop))] || []).map(( /**
|
|
2175
|
-
* @param {?} x
|
|
2176
|
-
* @param {?} index
|
|
2177
|
-
* @return {?}
|
|
2178
|
-
*/function (x, index) { return _this.mapItem(x, index); }));
|
|
1742
|
+
var children = (item.value[prop] || []).map(function (x, index) { return _this.mapItem(x, index); });
|
|
2179
1743
|
groups.set(item, children);
|
|
2180
1744
|
}
|
|
2181
1745
|
}
|
|
@@ -2188,24 +1752,16 @@
|
|
|
2188
1752
|
}
|
|
2189
1753
|
return groups;
|
|
2190
1754
|
}
|
|
2191
|
-
/** @type {?} */
|
|
2192
1755
|
var isFnKey = isFunction(this._ngSelect.groupBy);
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
* @param {?} item
|
|
2196
|
-
* @return {?}
|
|
2197
|
-
*/function (item) {
|
|
2198
|
-
/** @type {?} */
|
|
2199
|
-
var key = isFnKey ? (( /** @type {?} */(prop)))(item.value) : item.value[( /** @type {?} */(prop))];
|
|
1756
|
+
var keyFn = function (item) {
|
|
1757
|
+
var key = isFnKey ? prop(item.value) : item.value[prop];
|
|
2200
1758
|
return isDefined(key) ? key : undefined;
|
|
2201
|
-
}
|
|
1759
|
+
};
|
|
2202
1760
|
try {
|
|
2203
1761
|
// Group items by key.
|
|
2204
1762
|
for (var items_2 = __values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
|
|
2205
1763
|
var item = items_2_1.value;
|
|
2206
|
-
/** @type {?} */
|
|
2207
1764
|
var key = keyFn(item);
|
|
2208
|
-
/** @type {?} */
|
|
2209
1765
|
var group = groups.get(key);
|
|
2210
1766
|
if (group) {
|
|
2211
1767
|
group.push(item);
|
|
@@ -2224,35 +1780,21 @@
|
|
|
2224
1780
|
}
|
|
2225
1781
|
return groups;
|
|
2226
1782
|
};
|
|
2227
|
-
/**
|
|
2228
|
-
* @private
|
|
2229
|
-
* @param {?} groups
|
|
2230
|
-
* @return {?}
|
|
2231
|
-
*/
|
|
2232
1783
|
ItemsList.prototype._flatten = function (groups) {
|
|
2233
1784
|
var e_7, _a;
|
|
2234
|
-
/** @type {?} */
|
|
2235
1785
|
var isGroupByFn = isFunction(this._ngSelect.groupBy);
|
|
2236
|
-
/** @type {?} */
|
|
2237
1786
|
var items = [];
|
|
2238
1787
|
var _loop_2 = function (key) {
|
|
2239
|
-
/** @type {?} */
|
|
2240
1788
|
var i = items.length;
|
|
2241
1789
|
if (key === undefined) {
|
|
2242
|
-
/** @type {?} */
|
|
2243
1790
|
var withoutGroup = groups.get(undefined) || [];
|
|
2244
|
-
items.push.apply(items, __spread(withoutGroup.map((
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
* @param {?} x
|
|
2249
|
-
* @return {?}
|
|
2250
|
-
*/ x) { return (Object.assign(Object.assign({}, x), { index: i++ })); }))));
|
|
1791
|
+
items.push.apply(items, __spread(withoutGroup.map(function (x) {
|
|
1792
|
+
x.index = i++;
|
|
1793
|
+
return x;
|
|
1794
|
+
})));
|
|
2251
1795
|
return "continue";
|
|
2252
1796
|
}
|
|
2253
|
-
/** @type {?} */
|
|
2254
1797
|
var isObjectKey = isObject(key);
|
|
2255
|
-
/** @type {?} */
|
|
2256
1798
|
var parent = {
|
|
2257
1799
|
label: isObjectKey ? '' : String(key),
|
|
2258
1800
|
children: undefined,
|
|
@@ -2261,39 +1803,22 @@
|
|
|
2261
1803
|
disabled: !this_2._ngSelect.selectableGroup,
|
|
2262
1804
|
htmlId: newId(),
|
|
2263
1805
|
};
|
|
2264
|
-
|
|
2265
|
-
var
|
|
2266
|
-
/** @type {?} */
|
|
2267
|
-
var groupValue = this_2._ngSelect.groupValue || (( /**
|
|
2268
|
-
* @return {?}
|
|
2269
|
-
*/function () {
|
|
1806
|
+
var groupKey = isGroupByFn ? this_2._ngSelect.bindLabel : this_2._ngSelect.groupBy;
|
|
1807
|
+
var groupValue = this_2._ngSelect.groupValue || (function () {
|
|
2270
1808
|
var _a;
|
|
2271
1809
|
if (isObjectKey) {
|
|
2272
|
-
return
|
|
1810
|
+
return key.value;
|
|
2273
1811
|
}
|
|
2274
1812
|
return _a = {}, _a[groupKey] = key, _a;
|
|
2275
|
-
})
|
|
2276
|
-
|
|
2277
|
-
var children = groups.get(key).map(( /**
|
|
2278
|
-
* @param {?} x
|
|
2279
|
-
* @return {?}
|
|
2280
|
-
*/function (/**
|
|
2281
|
-
* @param {?} x
|
|
2282
|
-
* @return {?}
|
|
2283
|
-
*/ x) {
|
|
1813
|
+
});
|
|
1814
|
+
var children = groups.get(key).map(function (x) {
|
|
2284
1815
|
x.parent = parent;
|
|
2285
1816
|
x.children = undefined;
|
|
2286
1817
|
x.index = i++;
|
|
2287
1818
|
return x;
|
|
2288
|
-
})
|
|
1819
|
+
});
|
|
2289
1820
|
parent.children = children;
|
|
2290
|
-
parent.value = groupValue(key, children.map((
|
|
2291
|
-
* @param {?} x
|
|
2292
|
-
* @return {?}
|
|
2293
|
-
*/function (/**
|
|
2294
|
-
* @param {?} x
|
|
2295
|
-
* @return {?}
|
|
2296
|
-
*/ x) { return x.value; })));
|
|
1821
|
+
parent.value = groupValue(key, children.map(function (x) { return x.value; }));
|
|
2297
1822
|
items.push(parent);
|
|
2298
1823
|
items.push.apply(items, __spread(children));
|
|
2299
1824
|
};
|
|
@@ -2315,118 +1840,18 @@
|
|
|
2315
1840
|
};
|
|
2316
1841
|
return ItemsList;
|
|
2317
1842
|
}());
|
|
2318
|
-
if (false) {
|
|
2319
|
-
/**
|
|
2320
|
-
* @type {?}
|
|
2321
|
-
* @private
|
|
2322
|
-
*/
|
|
2323
|
-
ItemsList.prototype._groups;
|
|
2324
|
-
/**
|
|
2325
|
-
* @type {?}
|
|
2326
|
-
* @private
|
|
2327
|
-
*/
|
|
2328
|
-
ItemsList.prototype._items;
|
|
2329
|
-
/**
|
|
2330
|
-
* @type {?}
|
|
2331
|
-
* @private
|
|
2332
|
-
*/
|
|
2333
|
-
ItemsList.prototype._filteredItems;
|
|
2334
|
-
/**
|
|
2335
|
-
* @type {?}
|
|
2336
|
-
* @private
|
|
2337
|
-
*/
|
|
2338
|
-
ItemsList.prototype._markedIndex;
|
|
2339
|
-
/**
|
|
2340
|
-
* @type {?}
|
|
2341
|
-
* @private
|
|
2342
|
-
*/
|
|
2343
|
-
ItemsList.prototype._ngSelect;
|
|
2344
|
-
/**
|
|
2345
|
-
* @type {?}
|
|
2346
|
-
* @private
|
|
2347
|
-
*/
|
|
2348
|
-
ItemsList.prototype._selectionModel;
|
|
2349
|
-
}
|
|
2350
1843
|
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
/** @type {?|undefined} */
|
|
2362
|
-
NgOption.prototype.index;
|
|
2363
|
-
/** @type {?|undefined} */
|
|
2364
|
-
NgOption.prototype.htmlId;
|
|
2365
|
-
/** @type {?|undefined} */
|
|
2366
|
-
NgOption.prototype.selected;
|
|
2367
|
-
/** @type {?|undefined} */
|
|
2368
|
-
NgOption.prototype.disabled;
|
|
2369
|
-
/** @type {?|undefined} */
|
|
2370
|
-
NgOption.prototype.marked;
|
|
2371
|
-
/** @type {?|undefined} */
|
|
2372
|
-
NgOption.prototype.label;
|
|
2373
|
-
/** @type {?|undefined} */
|
|
2374
|
-
NgOption.prototype.value;
|
|
2375
|
-
/** @type {?|undefined} */
|
|
2376
|
-
NgOption.prototype.parent;
|
|
2377
|
-
/** @type {?|undefined} */
|
|
2378
|
-
NgOption.prototype.children;
|
|
2379
|
-
/* Skipping unhandled member: [name: string]: any;*/
|
|
2380
|
-
}
|
|
2381
|
-
/** @enum {number} */
|
|
2382
|
-
var KeyCode = {
|
|
2383
|
-
Tab: 9,
|
|
2384
|
-
Enter: 13,
|
|
2385
|
-
Esc: 27,
|
|
2386
|
-
Space: 32,
|
|
2387
|
-
ArrowUp: 38,
|
|
2388
|
-
ArrowDown: 40,
|
|
2389
|
-
Backspace: 8,
|
|
2390
|
-
};
|
|
2391
|
-
KeyCode[KeyCode.Tab] = 'Tab';
|
|
2392
|
-
KeyCode[KeyCode.Enter] = 'Enter';
|
|
2393
|
-
KeyCode[KeyCode.Esc] = 'Esc';
|
|
2394
|
-
KeyCode[KeyCode.Space] = 'Space';
|
|
2395
|
-
KeyCode[KeyCode.ArrowUp] = 'ArrowUp';
|
|
2396
|
-
KeyCode[KeyCode.ArrowDown] = 'ArrowDown';
|
|
2397
|
-
KeyCode[KeyCode.Backspace] = 'Backspace';
|
|
1844
|
+
var KeyCode;
|
|
1845
|
+
(function (KeyCode) {
|
|
1846
|
+
KeyCode[KeyCode["Tab"] = 9] = "Tab";
|
|
1847
|
+
KeyCode[KeyCode["Enter"] = 13] = "Enter";
|
|
1848
|
+
KeyCode[KeyCode["Esc"] = 27] = "Esc";
|
|
1849
|
+
KeyCode[KeyCode["Space"] = 32] = "Space";
|
|
1850
|
+
KeyCode[KeyCode["ArrowUp"] = 38] = "ArrowUp";
|
|
1851
|
+
KeyCode[KeyCode["ArrowDown"] = 40] = "ArrowDown";
|
|
1852
|
+
KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
|
|
1853
|
+
})(KeyCode || (KeyCode = {}));
|
|
2398
1854
|
|
|
2399
|
-
/**
|
|
2400
|
-
* @fileoverview added by tsickle
|
|
2401
|
-
* Generated from: lib/ng-dropdown-panel.service.ts
|
|
2402
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2403
|
-
*/
|
|
2404
|
-
/**
|
|
2405
|
-
* @record
|
|
2406
|
-
*/
|
|
2407
|
-
function ItemsRangeResult() { }
|
|
2408
|
-
if (false) {
|
|
2409
|
-
/** @type {?} */
|
|
2410
|
-
ItemsRangeResult.prototype.scrollHeight;
|
|
2411
|
-
/** @type {?} */
|
|
2412
|
-
ItemsRangeResult.prototype.topPadding;
|
|
2413
|
-
/** @type {?} */
|
|
2414
|
-
ItemsRangeResult.prototype.start;
|
|
2415
|
-
/** @type {?} */
|
|
2416
|
-
ItemsRangeResult.prototype.end;
|
|
2417
|
-
}
|
|
2418
|
-
/**
|
|
2419
|
-
* @record
|
|
2420
|
-
*/
|
|
2421
|
-
function PanelDimensions() { }
|
|
2422
|
-
if (false) {
|
|
2423
|
-
/** @type {?} */
|
|
2424
|
-
PanelDimensions.prototype.itemHeight;
|
|
2425
|
-
/** @type {?} */
|
|
2426
|
-
PanelDimensions.prototype.panelHeight;
|
|
2427
|
-
/** @type {?} */
|
|
2428
|
-
PanelDimensions.prototype.itemsPerViewport;
|
|
2429
|
-
}
|
|
2430
1855
|
var NgDropdownPanelService = /** @class */ (function () {
|
|
2431
1856
|
function NgDropdownPanelService() {
|
|
2432
1857
|
this._dimensions = {
|
|
@@ -2436,39 +1861,21 @@
|
|
|
2436
1861
|
};
|
|
2437
1862
|
}
|
|
2438
1863
|
Object.defineProperty(NgDropdownPanelService.prototype, "dimensions", {
|
|
2439
|
-
/**
|
|
2440
|
-
* @return {?}
|
|
2441
|
-
*/
|
|
2442
1864
|
get: function () {
|
|
2443
1865
|
return this._dimensions;
|
|
2444
1866
|
},
|
|
2445
1867
|
enumerable: false,
|
|
2446
1868
|
configurable: true
|
|
2447
1869
|
});
|
|
2448
|
-
/**
|
|
2449
|
-
* @param {?} scrollPos
|
|
2450
|
-
* @param {?} itemsLength
|
|
2451
|
-
* @param {?} buffer
|
|
2452
|
-
* @return {?}
|
|
2453
|
-
*/
|
|
2454
1870
|
NgDropdownPanelService.prototype.calculateItems = function (scrollPos, itemsLength, buffer) {
|
|
2455
|
-
/** @type {?} */
|
|
2456
1871
|
var d = this._dimensions;
|
|
2457
|
-
/** @type {?} */
|
|
2458
1872
|
var scrollHeight = d.itemHeight * itemsLength;
|
|
2459
|
-
/** @type {?} */
|
|
2460
1873
|
var scrollTop = Math.max(0, scrollPos);
|
|
2461
|
-
/** @type {?} */
|
|
2462
1874
|
var indexByScrollTop = scrollTop / scrollHeight * itemsLength;
|
|
2463
|
-
/** @type {?} */
|
|
2464
1875
|
var end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
|
|
2465
|
-
/** @type {?} */
|
|
2466
1876
|
var maxStartEnd = end;
|
|
2467
|
-
/** @type {?} */
|
|
2468
1877
|
var maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
|
|
2469
|
-
/** @type {?} */
|
|
2470
1878
|
var start = Math.min(maxStart, Math.floor(indexByScrollTop));
|
|
2471
|
-
/** @type {?} */
|
|
2472
1879
|
var topPadding = d.itemHeight * Math.ceil(start) - (d.itemHeight * Math.min(start, buffer));
|
|
2473
1880
|
topPadding = !isNaN(topPadding) ? topPadding : 0;
|
|
2474
1881
|
start = !isNaN(start) ? start : -1;
|
|
@@ -2484,13 +1891,7 @@
|
|
|
2484
1891
|
end: end
|
|
2485
1892
|
};
|
|
2486
1893
|
};
|
|
2487
|
-
/**
|
|
2488
|
-
* @param {?} itemHeight
|
|
2489
|
-
* @param {?} panelHeight
|
|
2490
|
-
* @return {?}
|
|
2491
|
-
*/
|
|
2492
1894
|
NgDropdownPanelService.prototype.setDimensions = function (itemHeight, panelHeight) {
|
|
2493
|
-
/** @type {?} */
|
|
2494
1895
|
var itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
|
|
2495
1896
|
this._dimensions = {
|
|
2496
1897
|
itemHeight: itemHeight,
|
|
@@ -2498,19 +1899,10 @@
|
|
|
2498
1899
|
itemsPerViewport: itemsPerViewport
|
|
2499
1900
|
};
|
|
2500
1901
|
};
|
|
2501
|
-
/**
|
|
2502
|
-
* @param {?} itemTop
|
|
2503
|
-
* @param {?} itemHeight
|
|
2504
|
-
* @param {?} lastScroll
|
|
2505
|
-
* @return {?}
|
|
2506
|
-
*/
|
|
2507
1902
|
NgDropdownPanelService.prototype.getScrollTo = function (itemTop, itemHeight, lastScroll) {
|
|
2508
1903
|
var panelHeight = this.dimensions.panelHeight;
|
|
2509
|
-
/** @type {?} */
|
|
2510
1904
|
var itemBottom = itemTop + itemHeight;
|
|
2511
|
-
/** @type {?} */
|
|
2512
1905
|
var top = lastScroll;
|
|
2513
|
-
/** @type {?} */
|
|
2514
1906
|
var bottom = top + panelHeight;
|
|
2515
1907
|
if (panelHeight >= itemBottom && lastScroll === itemTop) {
|
|
2516
1908
|
return null;
|
|
@@ -2528,28 +1920,11 @@
|
|
|
2528
1920
|
NgDropdownPanelService.decorators = [
|
|
2529
1921
|
{ type: i0.Injectable }
|
|
2530
1922
|
];
|
|
2531
|
-
if (false) {
|
|
2532
|
-
/**
|
|
2533
|
-
* @type {?}
|
|
2534
|
-
* @private
|
|
2535
|
-
*/
|
|
2536
|
-
NgDropdownPanelService.prototype._dimensions;
|
|
2537
|
-
}
|
|
2538
1923
|
|
|
2539
|
-
/** @type {?} */
|
|
2540
1924
|
var TOP_CSS_CLASS = 'ng-select-top';
|
|
2541
|
-
/** @type {?} */
|
|
2542
1925
|
var BOTTOM_CSS_CLASS = 'ng-select-bottom';
|
|
2543
|
-
/** @type {?} */
|
|
2544
1926
|
var SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? rxjs.animationFrameScheduler : rxjs.asapScheduler;
|
|
2545
1927
|
var NgDropdownPanelComponent = /** @class */ (function () {
|
|
2546
|
-
/**
|
|
2547
|
-
* @param {?} _renderer
|
|
2548
|
-
* @param {?} _zone
|
|
2549
|
-
* @param {?} _panelService
|
|
2550
|
-
* @param {?} _elementRef
|
|
2551
|
-
* @param {?} _document
|
|
2552
|
-
*/
|
|
2553
1928
|
function NgDropdownPanelComponent(_renderer, _zone, _panelService, _elementRef, _document) {
|
|
2554
1929
|
this._renderer = _renderer;
|
|
2555
1930
|
this._zone = _zone;
|
|
@@ -2570,9 +1945,6 @@
|
|
|
2570
1945
|
this._dropdown = _elementRef.nativeElement;
|
|
2571
1946
|
}
|
|
2572
1947
|
Object.defineProperty(NgDropdownPanelComponent.prototype, "currentPosition", {
|
|
2573
|
-
/**
|
|
2574
|
-
* @return {?}
|
|
2575
|
-
*/
|
|
2576
1948
|
get: function () {
|
|
2577
1949
|
return this._currentPosition;
|
|
2578
1950
|
},
|
|
@@ -2580,18 +1952,9 @@
|
|
|
2580
1952
|
configurable: true
|
|
2581
1953
|
});
|
|
2582
1954
|
Object.defineProperty(NgDropdownPanelComponent.prototype, "itemsLength", {
|
|
2583
|
-
/**
|
|
2584
|
-
* @private
|
|
2585
|
-
* @return {?}
|
|
2586
|
-
*/
|
|
2587
1955
|
get: function () {
|
|
2588
1956
|
return this._itemsLength;
|
|
2589
1957
|
},
|
|
2590
|
-
/**
|
|
2591
|
-
* @private
|
|
2592
|
-
* @param {?} value
|
|
2593
|
-
* @return {?}
|
|
2594
|
-
*/
|
|
2595
1958
|
set: function (value) {
|
|
2596
1959
|
if (value !== this._itemsLength) {
|
|
2597
1960
|
this._itemsLength = value;
|
|
@@ -2602,14 +1965,9 @@
|
|
|
2602
1965
|
configurable: true
|
|
2603
1966
|
});
|
|
2604
1967
|
Object.defineProperty(NgDropdownPanelComponent.prototype, "_startOffset", {
|
|
2605
|
-
/**
|
|
2606
|
-
* @private
|
|
2607
|
-
* @return {?}
|
|
2608
|
-
*/
|
|
2609
1968
|
get: function () {
|
|
2610
1969
|
if (this.markedItem) {
|
|
2611
1970
|
var _a = this._panelService.dimensions, itemHeight = _a.itemHeight, panelHeight = _a.panelHeight;
|
|
2612
|
-
/** @type {?} */
|
|
2613
1971
|
var offset = this.markedItem.index * itemHeight;
|
|
2614
1972
|
return panelHeight > offset ? 0 : offset;
|
|
2615
1973
|
}
|
|
@@ -2618,21 +1976,13 @@
|
|
|
2618
1976
|
enumerable: false,
|
|
2619
1977
|
configurable: true
|
|
2620
1978
|
});
|
|
2621
|
-
/**
|
|
2622
|
-
* @param {?} $event
|
|
2623
|
-
* @return {?}
|
|
2624
|
-
*/
|
|
2625
1979
|
NgDropdownPanelComponent.prototype.handleMousedown = function ($event) {
|
|
2626
|
-
|
|
2627
|
-
var target = ( /** @type {?} */($event.target));
|
|
1980
|
+
var target = $event.target;
|
|
2628
1981
|
if (target.tagName === 'INPUT') {
|
|
2629
1982
|
return;
|
|
2630
1983
|
}
|
|
2631
1984
|
$event.preventDefault();
|
|
2632
1985
|
};
|
|
2633
|
-
/**
|
|
2634
|
-
* @return {?}
|
|
2635
|
-
*/
|
|
2636
1986
|
NgDropdownPanelComponent.prototype.ngOnInit = function () {
|
|
2637
1987
|
this._select = this._dropdown.parentElement;
|
|
2638
1988
|
this._virtualPadding = this.paddingElementRef.nativeElement;
|
|
@@ -2642,20 +1992,12 @@
|
|
|
2642
1992
|
this._handleOutsideClick();
|
|
2643
1993
|
this._appendDropdown();
|
|
2644
1994
|
};
|
|
2645
|
-
/**
|
|
2646
|
-
* @param {?} changes
|
|
2647
|
-
* @return {?}
|
|
2648
|
-
*/
|
|
2649
1995
|
NgDropdownPanelComponent.prototype.ngOnChanges = function (changes) {
|
|
2650
1996
|
if (changes.items) {
|
|
2651
|
-
/** @type {?} */
|
|
2652
1997
|
var change = changes.items;
|
|
2653
1998
|
this._onItemsChange(change.currentValue, change.firstChange);
|
|
2654
1999
|
}
|
|
2655
2000
|
};
|
|
2656
|
-
/**
|
|
2657
|
-
* @return {?}
|
|
2658
|
-
*/
|
|
2659
2001
|
NgDropdownPanelComponent.prototype.ngOnDestroy = function () {
|
|
2660
2002
|
this._destroy$.next();
|
|
2661
2003
|
this._destroy$.complete();
|
|
@@ -2664,32 +2006,22 @@
|
|
|
2664
2006
|
this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
|
|
2665
2007
|
}
|
|
2666
2008
|
};
|
|
2667
|
-
/**
|
|
2668
|
-
* @param {?} option
|
|
2669
|
-
* @param {?=} startFromOption
|
|
2670
|
-
* @return {?}
|
|
2671
|
-
*/
|
|
2672
2009
|
NgDropdownPanelComponent.prototype.scrollTo = function (option, startFromOption) {
|
|
2673
2010
|
if (startFromOption === void 0) { startFromOption = false; }
|
|
2674
2011
|
if (!option) {
|
|
2675
2012
|
return;
|
|
2676
2013
|
}
|
|
2677
|
-
/** @type {?} */
|
|
2678
2014
|
var index = this.items.indexOf(option);
|
|
2679
2015
|
if (index < 0 || index >= this.itemsLength) {
|
|
2680
2016
|
return;
|
|
2681
2017
|
}
|
|
2682
|
-
/** @type {?} */
|
|
2683
2018
|
var scrollTo;
|
|
2684
2019
|
if (this.virtualScroll) {
|
|
2685
|
-
/** @type {?} */
|
|
2686
2020
|
var itemHeight = this._panelService.dimensions.itemHeight;
|
|
2687
2021
|
scrollTo = this._panelService.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
|
|
2688
2022
|
}
|
|
2689
2023
|
else {
|
|
2690
|
-
/** @type {?} */
|
|
2691
2024
|
var item = this._dropdown.querySelector("#" + option.htmlId);
|
|
2692
|
-
/** @type {?} */
|
|
2693
2025
|
var lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
|
|
2694
2026
|
scrollTo = this._panelService.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
|
|
2695
2027
|
}
|
|
@@ -2697,24 +2029,13 @@
|
|
|
2697
2029
|
this._scrollablePanel.scrollTop = scrollTo;
|
|
2698
2030
|
}
|
|
2699
2031
|
};
|
|
2700
|
-
/**
|
|
2701
|
-
* @return {?}
|
|
2702
|
-
*/
|
|
2703
2032
|
NgDropdownPanelComponent.prototype.scrollToTag = function () {
|
|
2704
|
-
/** @type {?} */
|
|
2705
2033
|
var panel = this._scrollablePanel;
|
|
2706
2034
|
panel.scrollTop = panel.scrollHeight - panel.clientHeight;
|
|
2707
2035
|
};
|
|
2708
|
-
/**
|
|
2709
|
-
* @return {?}
|
|
2710
|
-
*/
|
|
2711
2036
|
NgDropdownPanelComponent.prototype.adjustPosition = function () {
|
|
2712
2037
|
this._updateYPosition();
|
|
2713
2038
|
};
|
|
2714
|
-
/**
|
|
2715
|
-
* @private
|
|
2716
|
-
* @return {?}
|
|
2717
|
-
*/
|
|
2718
2039
|
NgDropdownPanelComponent.prototype._handleDropdownPosition = function () {
|
|
2719
2040
|
this._currentPosition = this._calculateCurrentPosition(this._dropdown);
|
|
2720
2041
|
if (this._currentPosition === 'top') {
|
|
@@ -2734,76 +2055,39 @@
|
|
|
2734
2055
|
}
|
|
2735
2056
|
this._dropdown.style.opacity = '1';
|
|
2736
2057
|
};
|
|
2737
|
-
/**
|
|
2738
|
-
* @private
|
|
2739
|
-
* @return {?}
|
|
2740
|
-
*/
|
|
2741
2058
|
NgDropdownPanelComponent.prototype._handleScroll = function () {
|
|
2742
2059
|
var _this = this;
|
|
2743
|
-
this._zone.runOutsideAngular((
|
|
2744
|
-
* @return {?}
|
|
2745
|
-
*/function () {
|
|
2060
|
+
this._zone.runOutsideAngular(function () {
|
|
2746
2061
|
rxjs.fromEvent(_this.scrollElementRef.nativeElement, 'scroll')
|
|
2747
2062
|
.pipe(operators.takeUntil(_this._destroy$), operators.auditTime(0, SCROLL_SCHEDULER))
|
|
2748
|
-
.subscribe((
|
|
2749
|
-
* @param {?} e
|
|
2750
|
-
* @return {?}
|
|
2751
|
-
*/function (e) {
|
|
2752
|
-
/** @type {?} */
|
|
2063
|
+
.subscribe(function (e) {
|
|
2753
2064
|
var path = e.path || (e.composedPath && e.composedPath());
|
|
2754
|
-
/** @type {?} */
|
|
2755
2065
|
var scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;
|
|
2756
2066
|
_this._onContentScrolled(scrollTop);
|
|
2757
|
-
})
|
|
2758
|
-
})
|
|
2067
|
+
});
|
|
2068
|
+
});
|
|
2759
2069
|
};
|
|
2760
|
-
/**
|
|
2761
|
-
* @private
|
|
2762
|
-
* @return {?}
|
|
2763
|
-
*/
|
|
2764
2070
|
NgDropdownPanelComponent.prototype._handleOutsideClick = function () {
|
|
2765
2071
|
var _this = this;
|
|
2766
2072
|
if (!this._document) {
|
|
2767
2073
|
return;
|
|
2768
2074
|
}
|
|
2769
|
-
this._zone.runOutsideAngular((
|
|
2770
|
-
* @return {?}
|
|
2771
|
-
*/function () {
|
|
2075
|
+
this._zone.runOutsideAngular(function () {
|
|
2772
2076
|
rxjs.merge(rxjs.fromEvent(_this._document, 'touchstart', { capture: true }), rxjs.fromEvent(_this._document, 'mousedown', { capture: true })).pipe(operators.takeUntil(_this._destroy$))
|
|
2773
|
-
.subscribe((
|
|
2774
|
-
|
|
2775
|
-
* @return {?}
|
|
2776
|
-
*/function (/**
|
|
2777
|
-
* @param {?} $event
|
|
2778
|
-
* @return {?}
|
|
2779
|
-
*/ $event) { return _this._checkToClose($event); }));
|
|
2780
|
-
}));
|
|
2077
|
+
.subscribe(function ($event) { return _this._checkToClose($event); });
|
|
2078
|
+
});
|
|
2781
2079
|
};
|
|
2782
|
-
/**
|
|
2783
|
-
* @private
|
|
2784
|
-
* @param {?} $event
|
|
2785
|
-
* @return {?}
|
|
2786
|
-
*/
|
|
2787
2080
|
NgDropdownPanelComponent.prototype._checkToClose = function ($event) {
|
|
2788
2081
|
var _this = this;
|
|
2789
2082
|
if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
|
|
2790
2083
|
return;
|
|
2791
2084
|
}
|
|
2792
|
-
/** @type {?} */
|
|
2793
2085
|
var path = $event.path || ($event.composedPath && $event.composedPath());
|
|
2794
2086
|
if ($event.target && $event.target.shadowRoot && path && path[0] && this._select.contains(path[0])) {
|
|
2795
2087
|
return;
|
|
2796
2088
|
}
|
|
2797
|
-
this._zone.run((
|
|
2798
|
-
* @return {?}
|
|
2799
|
-
*/function () { return _this.outsideClick.emit(); }));
|
|
2089
|
+
this._zone.run(function () { return _this.outsideClick.emit(); });
|
|
2800
2090
|
};
|
|
2801
|
-
/**
|
|
2802
|
-
* @private
|
|
2803
|
-
* @param {?} items
|
|
2804
|
-
* @param {?} firstChange
|
|
2805
|
-
* @return {?}
|
|
2806
|
-
*/
|
|
2807
2091
|
NgDropdownPanelComponent.prototype._onItemsChange = function (items, firstChange) {
|
|
2808
2092
|
this.items = items || [];
|
|
2809
2093
|
this._scrollToEndFired = false;
|
|
@@ -2816,44 +2100,25 @@
|
|
|
2816
2100
|
this._updateItems(firstChange);
|
|
2817
2101
|
}
|
|
2818
2102
|
};
|
|
2819
|
-
/**
|
|
2820
|
-
* @private
|
|
2821
|
-
* @param {?} firstChange
|
|
2822
|
-
* @return {?}
|
|
2823
|
-
*/
|
|
2824
2103
|
NgDropdownPanelComponent.prototype._updateItems = function (firstChange) {
|
|
2825
2104
|
var _this = this;
|
|
2826
2105
|
this.update.emit(this.items);
|
|
2827
2106
|
if (firstChange === false) {
|
|
2828
2107
|
return;
|
|
2829
2108
|
}
|
|
2830
|
-
this._zone.runOutsideAngular((
|
|
2831
|
-
|
|
2832
|
-
*/function () {
|
|
2833
|
-
Promise.resolve().then(( /**
|
|
2834
|
-
* @return {?}
|
|
2835
|
-
*/function () {
|
|
2836
|
-
/** @type {?} */
|
|
2109
|
+
this._zone.runOutsideAngular(function () {
|
|
2110
|
+
Promise.resolve().then(function () {
|
|
2837
2111
|
var panelHeight = _this._scrollablePanel.clientHeight;
|
|
2838
2112
|
_this._panelService.setDimensions(0, panelHeight);
|
|
2839
2113
|
_this._handleDropdownPosition();
|
|
2840
2114
|
_this.scrollTo(_this.markedItem, firstChange);
|
|
2841
|
-
})
|
|
2842
|
-
})
|
|
2115
|
+
});
|
|
2116
|
+
});
|
|
2843
2117
|
};
|
|
2844
|
-
/**
|
|
2845
|
-
* @private
|
|
2846
|
-
* @param {?} firstChange
|
|
2847
|
-
* @return {?}
|
|
2848
|
-
*/
|
|
2849
2118
|
NgDropdownPanelComponent.prototype._updateItemsRange = function (firstChange) {
|
|
2850
2119
|
var _this = this;
|
|
2851
|
-
this._zone.runOutsideAngular((
|
|
2852
|
-
|
|
2853
|
-
*/function () {
|
|
2854
|
-
_this._measureDimensions().then(( /**
|
|
2855
|
-
* @return {?}
|
|
2856
|
-
*/function () {
|
|
2120
|
+
this._zone.runOutsideAngular(function () {
|
|
2121
|
+
_this._measureDimensions().then(function () {
|
|
2857
2122
|
if (firstChange) {
|
|
2858
2123
|
_this._renderItemsRange(_this._startOffset);
|
|
2859
2124
|
_this._handleDropdownPosition();
|
|
@@ -2861,14 +2126,9 @@
|
|
|
2861
2126
|
else {
|
|
2862
2127
|
_this._renderItemsRange();
|
|
2863
2128
|
}
|
|
2864
|
-
})
|
|
2865
|
-
})
|
|
2129
|
+
});
|
|
2130
|
+
});
|
|
2866
2131
|
};
|
|
2867
|
-
/**
|
|
2868
|
-
* @private
|
|
2869
|
-
* @param {?} scrollTop
|
|
2870
|
-
* @return {?}
|
|
2871
|
-
*/
|
|
2872
2132
|
NgDropdownPanelComponent.prototype._onContentScrolled = function (scrollTop) {
|
|
2873
2133
|
if (this.virtualScroll) {
|
|
2874
2134
|
this._renderItemsRange(scrollTop);
|
|
@@ -2876,39 +2136,21 @@
|
|
|
2876
2136
|
this._lastScrollPosition = scrollTop;
|
|
2877
2137
|
this._fireScrollToEnd(scrollTop);
|
|
2878
2138
|
};
|
|
2879
|
-
/**
|
|
2880
|
-
* @private
|
|
2881
|
-
* @param {?} height
|
|
2882
|
-
* @return {?}
|
|
2883
|
-
*/
|
|
2884
2139
|
NgDropdownPanelComponent.prototype._updateVirtualHeight = function (height) {
|
|
2885
2140
|
if (this._updateScrollHeight) {
|
|
2886
2141
|
this._virtualPadding.style.height = height + "px";
|
|
2887
2142
|
this._updateScrollHeight = false;
|
|
2888
2143
|
}
|
|
2889
2144
|
};
|
|
2890
|
-
/**
|
|
2891
|
-
* @private
|
|
2892
|
-
* @return {?}
|
|
2893
|
-
*/
|
|
2894
2145
|
NgDropdownPanelComponent.prototype._setVirtualHeight = function () {
|
|
2895
2146
|
if (!this._virtualPadding) {
|
|
2896
2147
|
return;
|
|
2897
2148
|
}
|
|
2898
2149
|
this._virtualPadding.style.height = "0px";
|
|
2899
2150
|
};
|
|
2900
|
-
/**
|
|
2901
|
-
* @private
|
|
2902
|
-
* @return {?}
|
|
2903
|
-
*/
|
|
2904
2151
|
NgDropdownPanelComponent.prototype._onItemsLengthChanged = function () {
|
|
2905
2152
|
this._updateScrollHeight = true;
|
|
2906
2153
|
};
|
|
2907
|
-
/**
|
|
2908
|
-
* @private
|
|
2909
|
-
* @param {?=} scrollTop
|
|
2910
|
-
* @return {?}
|
|
2911
|
-
*/
|
|
2912
2154
|
NgDropdownPanelComponent.prototype._renderItemsRange = function (scrollTop) {
|
|
2913
2155
|
var _this = this;
|
|
2914
2156
|
if (scrollTop === void 0) { scrollTop = null; }
|
|
@@ -2916,25 +2158,18 @@
|
|
|
2916
2158
|
return;
|
|
2917
2159
|
}
|
|
2918
2160
|
scrollTop = scrollTop || this._scrollablePanel.scrollTop;
|
|
2919
|
-
/** @type {?} */
|
|
2920
2161
|
var range = this._panelService.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);
|
|
2921
2162
|
this._updateVirtualHeight(range.scrollHeight);
|
|
2922
2163
|
this._contentPanel.style.transform = "translateY(" + range.topPadding + "px)";
|
|
2923
|
-
this._zone.run((
|
|
2924
|
-
* @return {?}
|
|
2925
|
-
*/function () {
|
|
2164
|
+
this._zone.run(function () {
|
|
2926
2165
|
_this.update.emit(_this.items.slice(range.start, range.end));
|
|
2927
2166
|
_this.scroll.emit({ start: range.start, end: range.end });
|
|
2928
|
-
})
|
|
2167
|
+
});
|
|
2929
2168
|
if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
|
|
2930
2169
|
this._scrollablePanel.scrollTop = scrollTop;
|
|
2931
2170
|
this._lastScrollPosition = scrollTop;
|
|
2932
2171
|
}
|
|
2933
2172
|
};
|
|
2934
|
-
/**
|
|
2935
|
-
* @private
|
|
2936
|
-
* @return {?}
|
|
2937
|
-
*/
|
|
2938
2173
|
NgDropdownPanelComponent.prototype._measureDimensions = function () {
|
|
2939
2174
|
var _this = this;
|
|
2940
2175
|
if (this._panelService.dimensions.itemHeight > 0 || this.itemsLength === 0) {
|
|
@@ -2942,59 +2177,36 @@
|
|
|
2942
2177
|
}
|
|
2943
2178
|
var _a = __read(this.items, 1), first = _a[0];
|
|
2944
2179
|
this.update.emit([first]);
|
|
2945
|
-
return Promise.resolve().then((
|
|
2946
|
-
* @return {?}
|
|
2947
|
-
*/function () {
|
|
2948
|
-
/** @type {?} */
|
|
2180
|
+
return Promise.resolve().then(function () {
|
|
2949
2181
|
var option = _this._dropdown.querySelector("#" + first.htmlId);
|
|
2950
|
-
/** @type {?} */
|
|
2951
2182
|
var optionHeight = option.clientHeight;
|
|
2952
2183
|
_this._virtualPadding.style.height = optionHeight * _this.itemsLength + "px";
|
|
2953
|
-
/** @type {?} */
|
|
2954
2184
|
var panelHeight = _this._scrollablePanel.clientHeight;
|
|
2955
2185
|
_this._panelService.setDimensions(optionHeight, panelHeight);
|
|
2956
2186
|
return _this._panelService.dimensions;
|
|
2957
|
-
})
|
|
2187
|
+
});
|
|
2958
2188
|
};
|
|
2959
|
-
/**
|
|
2960
|
-
* @private
|
|
2961
|
-
* @param {?} scrollTop
|
|
2962
|
-
* @return {?}
|
|
2963
|
-
*/
|
|
2964
2189
|
NgDropdownPanelComponent.prototype._fireScrollToEnd = function (scrollTop) {
|
|
2965
2190
|
var _this = this;
|
|
2966
2191
|
if (this._scrollToEndFired || scrollTop === 0) {
|
|
2967
2192
|
return;
|
|
2968
2193
|
}
|
|
2969
|
-
/** @type {?} */
|
|
2970
2194
|
var padding = this.virtualScroll ?
|
|
2971
2195
|
this._virtualPadding :
|
|
2972
2196
|
this._contentPanel;
|
|
2973
2197
|
if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight) {
|
|
2974
|
-
this._zone.run((
|
|
2975
|
-
* @return {?}
|
|
2976
|
-
*/function () { return _this.scrollToEnd.emit(); }));
|
|
2198
|
+
this._zone.run(function () { return _this.scrollToEnd.emit(); });
|
|
2977
2199
|
this._scrollToEndFired = true;
|
|
2978
2200
|
}
|
|
2979
2201
|
};
|
|
2980
|
-
/**
|
|
2981
|
-
* @private
|
|
2982
|
-
* @param {?} dropdownEl
|
|
2983
|
-
* @return {?}
|
|
2984
|
-
*/
|
|
2985
2202
|
NgDropdownPanelComponent.prototype._calculateCurrentPosition = function (dropdownEl) {
|
|
2986
2203
|
if (this.position !== 'auto') {
|
|
2987
2204
|
return this.position;
|
|
2988
2205
|
}
|
|
2989
|
-
/** @type {?} */
|
|
2990
2206
|
var selectRect = this._select.getBoundingClientRect();
|
|
2991
|
-
/** @type {?} */
|
|
2992
2207
|
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
2993
|
-
/** @type {?} */
|
|
2994
2208
|
var offsetTop = selectRect.top + window.pageYOffset;
|
|
2995
|
-
/** @type {?} */
|
|
2996
2209
|
var height = selectRect.height;
|
|
2997
|
-
/** @type {?} */
|
|
2998
2210
|
var dropdownHeight = dropdownEl.getBoundingClientRect().height;
|
|
2999
2211
|
if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
|
|
3000
2212
|
return 'top';
|
|
@@ -3003,10 +2215,6 @@
|
|
|
3003
2215
|
return 'bottom';
|
|
3004
2216
|
}
|
|
3005
2217
|
};
|
|
3006
|
-
/**
|
|
3007
|
-
* @private
|
|
3008
|
-
* @return {?}
|
|
3009
|
-
*/
|
|
3010
2218
|
NgDropdownPanelComponent.prototype._appendDropdown = function () {
|
|
3011
2219
|
if (!this.appendTo) {
|
|
3012
2220
|
return;
|
|
@@ -3018,40 +2226,24 @@
|
|
|
3018
2226
|
this._updateXPosition();
|
|
3019
2227
|
this._parent.appendChild(this._dropdown);
|
|
3020
2228
|
};
|
|
3021
|
-
/**
|
|
3022
|
-
* @private
|
|
3023
|
-
* @return {?}
|
|
3024
|
-
*/
|
|
3025
2229
|
NgDropdownPanelComponent.prototype._updateXPosition = function () {
|
|
3026
|
-
/** @type {?} */
|
|
3027
2230
|
var select = this._select.getBoundingClientRect();
|
|
3028
|
-
/** @type {?} */
|
|
3029
2231
|
var parent = this._parent.getBoundingClientRect();
|
|
3030
|
-
/** @type {?} */
|
|
3031
2232
|
var offsetLeft = select.left - parent.left;
|
|
3032
2233
|
this._dropdown.style.left = offsetLeft + 'px';
|
|
3033
2234
|
this._dropdown.style.width = select.width + 'px';
|
|
3034
2235
|
this._dropdown.style.minWidth = select.width + 'px';
|
|
3035
2236
|
};
|
|
3036
|
-
/**
|
|
3037
|
-
* @private
|
|
3038
|
-
* @return {?}
|
|
3039
|
-
*/
|
|
3040
2237
|
NgDropdownPanelComponent.prototype._updateYPosition = function () {
|
|
3041
|
-
/** @type {?} */
|
|
3042
2238
|
var select = this._select.getBoundingClientRect();
|
|
3043
|
-
/** @type {?} */
|
|
3044
2239
|
var parent = this._parent.getBoundingClientRect();
|
|
3045
|
-
/** @type {?} */
|
|
3046
2240
|
var delta = select.height;
|
|
3047
2241
|
if (this._currentPosition === 'top') {
|
|
3048
|
-
/** @type {?} */
|
|
3049
2242
|
var offsetBottom = parent.bottom - select.bottom;
|
|
3050
2243
|
this._dropdown.style.bottom = offsetBottom + delta + 'px';
|
|
3051
2244
|
this._dropdown.style.top = 'auto';
|
|
3052
2245
|
}
|
|
3053
2246
|
else if (this._currentPosition === 'bottom') {
|
|
3054
|
-
/** @type {?} */
|
|
3055
2247
|
var offsetTop = select.top - parent.top;
|
|
3056
2248
|
this._dropdown.style.top = offsetTop + delta + 'px';
|
|
3057
2249
|
this._dropdown.style.bottom = 'auto';
|
|
@@ -3065,9 +2257,8 @@
|
|
|
3065
2257
|
encapsulation: i0.ViewEncapsulation.None,
|
|
3066
2258
|
selector: 'ng-dropdown-panel',
|
|
3067
2259
|
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 "
|
|
3068
|
-
}] }
|
|
2260
|
+
},] }
|
|
3069
2261
|
];
|
|
3070
|
-
/** @nocollapse */
|
|
3071
2262
|
NgDropdownPanelComponent.ctorParameters = function () { return [
|
|
3072
2263
|
{ type: i0.Renderer2 },
|
|
3073
2264
|
{ type: i0.NgZone },
|
|
@@ -3094,162 +2285,26 @@
|
|
|
3094
2285
|
paddingElementRef: [{ type: i0.ViewChild, args: ['padding', { read: i0.ElementRef, static: true },] }],
|
|
3095
2286
|
handleMousedown: [{ type: i0.HostListener, args: ['mousedown', ['$event'],] }]
|
|
3096
2287
|
};
|
|
3097
|
-
if (false) {
|
|
3098
|
-
/** @type {?} */
|
|
3099
|
-
NgDropdownPanelComponent.prototype.items;
|
|
3100
|
-
/** @type {?} */
|
|
3101
|
-
NgDropdownPanelComponent.prototype.markedItem;
|
|
3102
|
-
/** @type {?} */
|
|
3103
|
-
NgDropdownPanelComponent.prototype.position;
|
|
3104
|
-
/** @type {?} */
|
|
3105
|
-
NgDropdownPanelComponent.prototype.appendTo;
|
|
3106
|
-
/** @type {?} */
|
|
3107
|
-
NgDropdownPanelComponent.prototype.bufferAmount;
|
|
3108
|
-
/** @type {?} */
|
|
3109
|
-
NgDropdownPanelComponent.prototype.virtualScroll;
|
|
3110
|
-
/** @type {?} */
|
|
3111
|
-
NgDropdownPanelComponent.prototype.headerTemplate;
|
|
3112
|
-
/** @type {?} */
|
|
3113
|
-
NgDropdownPanelComponent.prototype.footerTemplate;
|
|
3114
|
-
/** @type {?} */
|
|
3115
|
-
NgDropdownPanelComponent.prototype.filterValue;
|
|
3116
|
-
/** @type {?} */
|
|
3117
|
-
NgDropdownPanelComponent.prototype.update;
|
|
3118
|
-
/** @type {?} */
|
|
3119
|
-
NgDropdownPanelComponent.prototype.scroll;
|
|
3120
|
-
/** @type {?} */
|
|
3121
|
-
NgDropdownPanelComponent.prototype.scrollToEnd;
|
|
3122
|
-
/** @type {?} */
|
|
3123
|
-
NgDropdownPanelComponent.prototype.outsideClick;
|
|
3124
|
-
/** @type {?} */
|
|
3125
|
-
NgDropdownPanelComponent.prototype.contentElementRef;
|
|
3126
|
-
/** @type {?} */
|
|
3127
|
-
NgDropdownPanelComponent.prototype.scrollElementRef;
|
|
3128
|
-
/** @type {?} */
|
|
3129
|
-
NgDropdownPanelComponent.prototype.paddingElementRef;
|
|
3130
|
-
/**
|
|
3131
|
-
* @type {?}
|
|
3132
|
-
* @private
|
|
3133
|
-
*/
|
|
3134
|
-
NgDropdownPanelComponent.prototype._destroy$;
|
|
3135
|
-
/**
|
|
3136
|
-
* @type {?}
|
|
3137
|
-
* @private
|
|
3138
|
-
*/
|
|
3139
|
-
NgDropdownPanelComponent.prototype._dropdown;
|
|
3140
|
-
/**
|
|
3141
|
-
* @type {?}
|
|
3142
|
-
* @private
|
|
3143
|
-
*/
|
|
3144
|
-
NgDropdownPanelComponent.prototype._virtualPadding;
|
|
3145
|
-
/**
|
|
3146
|
-
* @type {?}
|
|
3147
|
-
* @private
|
|
3148
|
-
*/
|
|
3149
|
-
NgDropdownPanelComponent.prototype._scrollablePanel;
|
|
3150
|
-
/**
|
|
3151
|
-
* @type {?}
|
|
3152
|
-
* @private
|
|
3153
|
-
*/
|
|
3154
|
-
NgDropdownPanelComponent.prototype._contentPanel;
|
|
3155
|
-
/**
|
|
3156
|
-
* @type {?}
|
|
3157
|
-
* @private
|
|
3158
|
-
*/
|
|
3159
|
-
NgDropdownPanelComponent.prototype._select;
|
|
3160
|
-
/**
|
|
3161
|
-
* @type {?}
|
|
3162
|
-
* @private
|
|
3163
|
-
*/
|
|
3164
|
-
NgDropdownPanelComponent.prototype._parent;
|
|
3165
|
-
/**
|
|
3166
|
-
* @type {?}
|
|
3167
|
-
* @private
|
|
3168
|
-
*/
|
|
3169
|
-
NgDropdownPanelComponent.prototype._scrollToEndFired;
|
|
3170
|
-
/**
|
|
3171
|
-
* @type {?}
|
|
3172
|
-
* @private
|
|
3173
|
-
*/
|
|
3174
|
-
NgDropdownPanelComponent.prototype._updateScrollHeight;
|
|
3175
|
-
/**
|
|
3176
|
-
* @type {?}
|
|
3177
|
-
* @private
|
|
3178
|
-
*/
|
|
3179
|
-
NgDropdownPanelComponent.prototype._lastScrollPosition;
|
|
3180
|
-
/**
|
|
3181
|
-
* @type {?}
|
|
3182
|
-
* @private
|
|
3183
|
-
*/
|
|
3184
|
-
NgDropdownPanelComponent.prototype._currentPosition;
|
|
3185
|
-
/**
|
|
3186
|
-
* @type {?}
|
|
3187
|
-
* @private
|
|
3188
|
-
*/
|
|
3189
|
-
NgDropdownPanelComponent.prototype._itemsLength;
|
|
3190
|
-
/**
|
|
3191
|
-
* @type {?}
|
|
3192
|
-
* @private
|
|
3193
|
-
*/
|
|
3194
|
-
NgDropdownPanelComponent.prototype._renderer;
|
|
3195
|
-
/**
|
|
3196
|
-
* @type {?}
|
|
3197
|
-
* @private
|
|
3198
|
-
*/
|
|
3199
|
-
NgDropdownPanelComponent.prototype._zone;
|
|
3200
|
-
/**
|
|
3201
|
-
* @type {?}
|
|
3202
|
-
* @private
|
|
3203
|
-
*/
|
|
3204
|
-
NgDropdownPanelComponent.prototype._panelService;
|
|
3205
|
-
/**
|
|
3206
|
-
* @type {?}
|
|
3207
|
-
* @private
|
|
3208
|
-
*/
|
|
3209
|
-
NgDropdownPanelComponent.prototype._document;
|
|
3210
|
-
}
|
|
3211
2288
|
|
|
3212
|
-
/**
|
|
3213
|
-
* @fileoverview added by tsickle
|
|
3214
|
-
* Generated from: lib/ng-option.component.ts
|
|
3215
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3216
|
-
*/
|
|
3217
2289
|
var NgOptionComponent = /** @class */ (function () {
|
|
3218
|
-
/**
|
|
3219
|
-
* @param {?} elementRef
|
|
3220
|
-
*/
|
|
3221
2290
|
function NgOptionComponent(elementRef) {
|
|
3222
2291
|
this.elementRef = elementRef;
|
|
3223
2292
|
this.stateChange$ = new rxjs.Subject();
|
|
3224
2293
|
this._disabled = false;
|
|
3225
2294
|
}
|
|
3226
2295
|
Object.defineProperty(NgOptionComponent.prototype, "disabled", {
|
|
3227
|
-
/**
|
|
3228
|
-
* @return {?}
|
|
3229
|
-
*/
|
|
3230
2296
|
get: function () { return this._disabled; },
|
|
3231
|
-
/**
|
|
3232
|
-
* @param {?} value
|
|
3233
|
-
* @return {?}
|
|
3234
|
-
*/
|
|
3235
2297
|
set: function (value) { this._disabled = this._isDisabled(value); },
|
|
3236
2298
|
enumerable: false,
|
|
3237
2299
|
configurable: true
|
|
3238
2300
|
});
|
|
3239
2301
|
Object.defineProperty(NgOptionComponent.prototype, "label", {
|
|
3240
|
-
/**
|
|
3241
|
-
* @return {?}
|
|
3242
|
-
*/
|
|
3243
2302
|
get: function () {
|
|
3244
2303
|
return (this.elementRef.nativeElement.textContent || '').trim();
|
|
3245
2304
|
},
|
|
3246
2305
|
enumerable: false,
|
|
3247
2306
|
configurable: true
|
|
3248
2307
|
});
|
|
3249
|
-
/**
|
|
3250
|
-
* @param {?} changes
|
|
3251
|
-
* @return {?}
|
|
3252
|
-
*/
|
|
3253
2308
|
NgOptionComponent.prototype.ngOnChanges = function (changes) {
|
|
3254
2309
|
if (changes.disabled) {
|
|
3255
2310
|
this.stateChange$.next({
|
|
@@ -3258,9 +2313,6 @@
|
|
|
3258
2313
|
});
|
|
3259
2314
|
}
|
|
3260
2315
|
};
|
|
3261
|
-
/**
|
|
3262
|
-
* @return {?}
|
|
3263
|
-
*/
|
|
3264
2316
|
NgOptionComponent.prototype.ngAfterViewChecked = function () {
|
|
3265
2317
|
if (this.label !== this._previousLabel) {
|
|
3266
2318
|
this._previousLabel = this.label;
|
|
@@ -3271,17 +2323,9 @@
|
|
|
3271
2323
|
});
|
|
3272
2324
|
}
|
|
3273
2325
|
};
|
|
3274
|
-
/**
|
|
3275
|
-
* @return {?}
|
|
3276
|
-
*/
|
|
3277
2326
|
NgOptionComponent.prototype.ngOnDestroy = function () {
|
|
3278
2327
|
this.stateChange$.complete();
|
|
3279
2328
|
};
|
|
3280
|
-
/**
|
|
3281
|
-
* @private
|
|
3282
|
-
* @param {?} value
|
|
3283
|
-
* @return {?}
|
|
3284
|
-
*/
|
|
3285
2329
|
NgOptionComponent.prototype._isDisabled = function (value) {
|
|
3286
2330
|
return value != null && "" + value !== 'false';
|
|
3287
2331
|
};
|
|
@@ -3292,9 +2336,8 @@
|
|
|
3292
2336
|
selector: 'ng-option',
|
|
3293
2337
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
3294
2338
|
template: "<ng-content></ng-content>"
|
|
3295
|
-
}] }
|
|
2339
|
+
},] }
|
|
3296
2340
|
];
|
|
3297
|
-
/** @nocollapse */
|
|
3298
2341
|
NgOptionComponent.ctorParameters = function () { return [
|
|
3299
2342
|
{ type: i0.ElementRef }
|
|
3300
2343
|
]; };
|
|
@@ -3302,30 +2345,7 @@
|
|
|
3302
2345
|
value: [{ type: i0.Input }],
|
|
3303
2346
|
disabled: [{ type: i0.Input }]
|
|
3304
2347
|
};
|
|
3305
|
-
if (false) {
|
|
3306
|
-
/** @type {?} */
|
|
3307
|
-
NgOptionComponent.prototype.value;
|
|
3308
|
-
/** @type {?} */
|
|
3309
|
-
NgOptionComponent.prototype.stateChange$;
|
|
3310
|
-
/**
|
|
3311
|
-
* @type {?}
|
|
3312
|
-
* @private
|
|
3313
|
-
*/
|
|
3314
|
-
NgOptionComponent.prototype._disabled;
|
|
3315
|
-
/**
|
|
3316
|
-
* @type {?}
|
|
3317
|
-
* @private
|
|
3318
|
-
*/
|
|
3319
|
-
NgOptionComponent.prototype._previousLabel;
|
|
3320
|
-
/** @type {?} */
|
|
3321
|
-
NgOptionComponent.prototype.elementRef;
|
|
3322
|
-
}
|
|
3323
2348
|
|
|
3324
|
-
/**
|
|
3325
|
-
* @fileoverview added by tsickle
|
|
3326
|
-
* Generated from: lib/config.service.ts
|
|
3327
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3328
|
-
*/
|
|
3329
2349
|
var NgSelectConfig = /** @class */ (function () {
|
|
3330
2350
|
function NgSelectConfig() {
|
|
3331
2351
|
this.notFoundText = 'No items found';
|
|
@@ -3339,47 +2359,13 @@
|
|
|
3339
2359
|
}
|
|
3340
2360
|
return NgSelectConfig;
|
|
3341
2361
|
}());
|
|
2362
|
+
NgSelectConfig.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgSelectConfig_Factory() { return new NgSelectConfig(); }, token: NgSelectConfig, providedIn: "root" });
|
|
3342
2363
|
NgSelectConfig.decorators = [
|
|
3343
2364
|
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
3344
2365
|
];
|
|
3345
|
-
/** @nocollapse */ NgSelectConfig.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgSelectConfig_Factory() { return new NgSelectConfig(); }, token: NgSelectConfig, providedIn: "root" });
|
|
3346
|
-
if (false) {
|
|
3347
|
-
/** @type {?} */
|
|
3348
|
-
NgSelectConfig.prototype.placeholder;
|
|
3349
|
-
/** @type {?} */
|
|
3350
|
-
NgSelectConfig.prototype.notFoundText;
|
|
3351
|
-
/** @type {?} */
|
|
3352
|
-
NgSelectConfig.prototype.typeToSearchText;
|
|
3353
|
-
/** @type {?} */
|
|
3354
|
-
NgSelectConfig.prototype.addTagText;
|
|
3355
|
-
/** @type {?} */
|
|
3356
|
-
NgSelectConfig.prototype.loadingText;
|
|
3357
|
-
/** @type {?} */
|
|
3358
|
-
NgSelectConfig.prototype.clearAllText;
|
|
3359
|
-
/** @type {?} */
|
|
3360
|
-
NgSelectConfig.prototype.disableVirtualScroll;
|
|
3361
|
-
/** @type {?} */
|
|
3362
|
-
NgSelectConfig.prototype.openOnEnter;
|
|
3363
|
-
/** @type {?} */
|
|
3364
|
-
NgSelectConfig.prototype.appendTo;
|
|
3365
|
-
/** @type {?} */
|
|
3366
|
-
NgSelectConfig.prototype.bindValue;
|
|
3367
|
-
/** @type {?} */
|
|
3368
|
-
NgSelectConfig.prototype.appearance;
|
|
3369
|
-
}
|
|
3370
2366
|
|
|
3371
|
-
/** @type {?} */
|
|
3372
2367
|
var SELECTION_MODEL_FACTORY = new i0.InjectionToken('ng-select-selection-model');
|
|
3373
2368
|
var NgSelectComponent = /** @class */ (function () {
|
|
3374
|
-
/**
|
|
3375
|
-
* @param {?} classes
|
|
3376
|
-
* @param {?} autoFocus
|
|
3377
|
-
* @param {?} config
|
|
3378
|
-
* @param {?} newSelectionModel
|
|
3379
|
-
* @param {?} _elementRef
|
|
3380
|
-
* @param {?} _cd
|
|
3381
|
-
* @param {?} _console
|
|
3382
|
-
*/
|
|
3383
2369
|
function NgSelectComponent(classes, autoFocus, config, newSelectionModel, _elementRef, _cd, _console) {
|
|
3384
2370
|
var _this = this;
|
|
3385
2371
|
this.classes = classes;
|
|
@@ -3404,10 +2390,7 @@
|
|
|
3404
2390
|
this.searchWhileComposing = true;
|
|
3405
2391
|
this.minTermLength = 0;
|
|
3406
2392
|
this.editableSearchTerm = false;
|
|
3407
|
-
this.keyDownFn = (
|
|
3408
|
-
* @param {?} _
|
|
3409
|
-
* @return {?}
|
|
3410
|
-
*/function (_) { return true; });
|
|
2393
|
+
this.keyDownFn = function (_) { return true; };
|
|
3411
2394
|
this.multiple = false;
|
|
3412
2395
|
this.addTag = false;
|
|
3413
2396
|
this.searchable = true;
|
|
@@ -3436,50 +2419,24 @@
|
|
|
3436
2419
|
this._isComposing = false;
|
|
3437
2420
|
this._destroy$ = new rxjs.Subject();
|
|
3438
2421
|
this._keyPress$ = new rxjs.Subject();
|
|
3439
|
-
this._onChange = (
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
this._onTouched = ( /**
|
|
3444
|
-
* @return {?}
|
|
3445
|
-
*/function () { });
|
|
3446
|
-
this.clearItem = ( /**
|
|
3447
|
-
* @param {?} item
|
|
3448
|
-
* @return {?}
|
|
3449
|
-
*/function (item) {
|
|
3450
|
-
/** @type {?} */
|
|
3451
|
-
var option = _this.selectedItems.find(( /**
|
|
3452
|
-
* @param {?} x
|
|
3453
|
-
* @return {?}
|
|
3454
|
-
*/function (/**
|
|
3455
|
-
* @param {?} x
|
|
3456
|
-
* @return {?}
|
|
3457
|
-
*/ x) { return x.value === item; }));
|
|
2422
|
+
this._onChange = function (_) { };
|
|
2423
|
+
this._onTouched = function () { };
|
|
2424
|
+
this.clearItem = function (item) {
|
|
2425
|
+
var option = _this.selectedItems.find(function (x) { return x.value === item; });
|
|
3458
2426
|
_this.unselect(option);
|
|
3459
|
-
}
|
|
3460
|
-
this.trackByOption = (
|
|
3461
|
-
* @param {?} _
|
|
3462
|
-
* @param {?} item
|
|
3463
|
-
* @return {?}
|
|
3464
|
-
*/function (_, item) {
|
|
2427
|
+
};
|
|
2428
|
+
this.trackByOption = function (_, item) {
|
|
3465
2429
|
if (_this.trackByFn) {
|
|
3466
2430
|
return _this.trackByFn(item.value);
|
|
3467
2431
|
}
|
|
3468
2432
|
return item;
|
|
3469
|
-
}
|
|
2433
|
+
};
|
|
3470
2434
|
this._mergeGlobalConfig(config);
|
|
3471
2435
|
this.itemsList = new ItemsList(this, newSelectionModel());
|
|
3472
2436
|
this.element = _elementRef.nativeElement;
|
|
3473
2437
|
}
|
|
3474
2438
|
Object.defineProperty(NgSelectComponent.prototype, "items", {
|
|
3475
|
-
/**
|
|
3476
|
-
* @return {?}
|
|
3477
|
-
*/
|
|
3478
2439
|
get: function () { return this._items; },
|
|
3479
|
-
/**
|
|
3480
|
-
* @param {?} value
|
|
3481
|
-
* @return {?}
|
|
3482
|
-
*/
|
|
3483
2440
|
set: function (value) {
|
|
3484
2441
|
this._itemsAreUsed = true;
|
|
3485
2442
|
this._items = value;
|
|
@@ -3490,16 +2447,9 @@
|
|
|
3490
2447
|
;
|
|
3491
2448
|
;
|
|
3492
2449
|
Object.defineProperty(NgSelectComponent.prototype, "compareWith", {
|
|
3493
|
-
/**
|
|
3494
|
-
* @return {?}
|
|
3495
|
-
*/
|
|
3496
2450
|
get: function () { return this._compareWith; },
|
|
3497
|
-
/**
|
|
3498
|
-
* @param {?} fn
|
|
3499
|
-
* @return {?}
|
|
3500
|
-
*/
|
|
3501
2451
|
set: function (fn) {
|
|
3502
|
-
if (!isFunction(fn)) {
|
|
2452
|
+
if (fn !== undefined && fn !== null && !isFunction(fn)) {
|
|
3503
2453
|
throw Error('`compareWith` must be a function.');
|
|
3504
2454
|
}
|
|
3505
2455
|
this._compareWith = fn;
|
|
@@ -3508,14 +2458,7 @@
|
|
|
3508
2458
|
configurable: true
|
|
3509
2459
|
});
|
|
3510
2460
|
Object.defineProperty(NgSelectComponent.prototype, "clearSearchOnAdd", {
|
|
3511
|
-
/**
|
|
3512
|
-
* @return {?}
|
|
3513
|
-
*/
|
|
3514
2461
|
get: function () { return isDefined(this._clearSearchOnAdd) ? this._clearSearchOnAdd : this.closeOnSelect; },
|
|
3515
|
-
/**
|
|
3516
|
-
* @param {?} value
|
|
3517
|
-
* @return {?}
|
|
3518
|
-
*/
|
|
3519
2462
|
set: function (value) {
|
|
3520
2463
|
this._clearSearchOnAdd = value;
|
|
3521
2464
|
},
|
|
@@ -3525,28 +2468,18 @@
|
|
|
3525
2468
|
;
|
|
3526
2469
|
;
|
|
3527
2470
|
Object.defineProperty(NgSelectComponent.prototype, "disabled", {
|
|
3528
|
-
/**
|
|
3529
|
-
* @return {?}
|
|
3530
|
-
*/
|
|
3531
2471
|
get: function () { return this.readonly || this._disabled; },
|
|
3532
2472
|
enumerable: false,
|
|
3533
2473
|
configurable: true
|
|
3534
2474
|
});
|
|
3535
2475
|
;
|
|
3536
2476
|
Object.defineProperty(NgSelectComponent.prototype, "filtered", {
|
|
3537
|
-
/**
|
|
3538
|
-
* @return {?}
|
|
3539
|
-
*/
|
|
3540
2477
|
get: function () { return (!!this.searchTerm && this.searchable || this._isComposing); },
|
|
3541
2478
|
enumerable: false,
|
|
3542
2479
|
configurable: true
|
|
3543
2480
|
});
|
|
3544
2481
|
;
|
|
3545
2482
|
Object.defineProperty(NgSelectComponent.prototype, "_editableSearchTerm", {
|
|
3546
|
-
/**
|
|
3547
|
-
* @private
|
|
3548
|
-
* @return {?}
|
|
3549
|
-
*/
|
|
3550
2483
|
get: function () {
|
|
3551
2484
|
return this.editableSearchTerm && !this.multiple;
|
|
3552
2485
|
},
|
|
@@ -3554,9 +2487,6 @@
|
|
|
3554
2487
|
configurable: true
|
|
3555
2488
|
});
|
|
3556
2489
|
Object.defineProperty(NgSelectComponent.prototype, "selectedItems", {
|
|
3557
|
-
/**
|
|
3558
|
-
* @return {?}
|
|
3559
|
-
*/
|
|
3560
2490
|
get: function () {
|
|
3561
2491
|
return this.itemsList.selectedItems;
|
|
3562
2492
|
},
|
|
@@ -3564,25 +2494,13 @@
|
|
|
3564
2494
|
configurable: true
|
|
3565
2495
|
});
|
|
3566
2496
|
Object.defineProperty(NgSelectComponent.prototype, "selectedValues", {
|
|
3567
|
-
/**
|
|
3568
|
-
* @return {?}
|
|
3569
|
-
*/
|
|
3570
2497
|
get: function () {
|
|
3571
|
-
return this.selectedItems.map((
|
|
3572
|
-
* @param {?} x
|
|
3573
|
-
* @return {?}
|
|
3574
|
-
*/function (/**
|
|
3575
|
-
* @param {?} x
|
|
3576
|
-
* @return {?}
|
|
3577
|
-
*/ x) { return x.value; }));
|
|
2498
|
+
return this.selectedItems.map(function (x) { return x.value; });
|
|
3578
2499
|
},
|
|
3579
2500
|
enumerable: false,
|
|
3580
2501
|
configurable: true
|
|
3581
2502
|
});
|
|
3582
2503
|
Object.defineProperty(NgSelectComponent.prototype, "hasValue", {
|
|
3583
|
-
/**
|
|
3584
|
-
* @return {?}
|
|
3585
|
-
*/
|
|
3586
2504
|
get: function () {
|
|
3587
2505
|
return this.selectedItems.length > 0;
|
|
3588
2506
|
},
|
|
@@ -3590,9 +2508,6 @@
|
|
|
3590
2508
|
configurable: true
|
|
3591
2509
|
});
|
|
3592
2510
|
Object.defineProperty(NgSelectComponent.prototype, "currentPanelPosition", {
|
|
3593
|
-
/**
|
|
3594
|
-
* @return {?}
|
|
3595
|
-
*/
|
|
3596
2511
|
get: function () {
|
|
3597
2512
|
if (this.dropdownPanel) {
|
|
3598
2513
|
return this.dropdownPanel.currentPosition;
|
|
@@ -3602,17 +2517,10 @@
|
|
|
3602
2517
|
enumerable: false,
|
|
3603
2518
|
configurable: true
|
|
3604
2519
|
});
|
|
3605
|
-
/**
|
|
3606
|
-
* @return {?}
|
|
3607
|
-
*/
|
|
3608
2520
|
NgSelectComponent.prototype.ngOnInit = function () {
|
|
3609
2521
|
this._handleKeyPresses();
|
|
3610
2522
|
this._setInputAttributes();
|
|
3611
2523
|
};
|
|
3612
|
-
/**
|
|
3613
|
-
* @param {?} changes
|
|
3614
|
-
* @return {?}
|
|
3615
|
-
*/
|
|
3616
2524
|
NgSelectComponent.prototype.ngOnChanges = function (changes) {
|
|
3617
2525
|
if (changes.multiple) {
|
|
3618
2526
|
this.itemsList.clearSelected();
|
|
@@ -3624,9 +2532,6 @@
|
|
|
3624
2532
|
this._manualOpen = isDefined(changes.isOpen.currentValue);
|
|
3625
2533
|
}
|
|
3626
2534
|
};
|
|
3627
|
-
/**
|
|
3628
|
-
* @return {?}
|
|
3629
|
-
*/
|
|
3630
2535
|
NgSelectComponent.prototype.ngAfterViewInit = function () {
|
|
3631
2536
|
if (!this._itemsAreUsed) {
|
|
3632
2537
|
this.escapeHTML = false;
|
|
@@ -3636,19 +2541,11 @@
|
|
|
3636
2541
|
this.focus();
|
|
3637
2542
|
}
|
|
3638
2543
|
};
|
|
3639
|
-
/**
|
|
3640
|
-
* @return {?}
|
|
3641
|
-
*/
|
|
3642
2544
|
NgSelectComponent.prototype.ngOnDestroy = function () {
|
|
3643
2545
|
this._destroy$.next();
|
|
3644
2546
|
this._destroy$.complete();
|
|
3645
2547
|
};
|
|
3646
|
-
/**
|
|
3647
|
-
* @param {?} $event
|
|
3648
|
-
* @return {?}
|
|
3649
|
-
*/
|
|
3650
2548
|
NgSelectComponent.prototype.handleKeyDown = function ($event) {
|
|
3651
|
-
/** @type {?} */
|
|
3652
2549
|
var keyCode = KeyCode[$event.which];
|
|
3653
2550
|
if (keyCode) {
|
|
3654
2551
|
if (this.keyDownFn($event) === false) {
|
|
@@ -3660,10 +2557,6 @@
|
|
|
3660
2557
|
this._keyPress$.next($event.key.toLocaleLowerCase());
|
|
3661
2558
|
}
|
|
3662
2559
|
};
|
|
3663
|
-
/**
|
|
3664
|
-
* @param {?} $event
|
|
3665
|
-
* @return {?}
|
|
3666
|
-
*/
|
|
3667
2560
|
NgSelectComponent.prototype.handleKeyCode = function ($event) {
|
|
3668
2561
|
switch ($event.which) {
|
|
3669
2562
|
case KeyCode.ArrowDown:
|
|
@@ -3690,13 +2583,8 @@
|
|
|
3690
2583
|
break;
|
|
3691
2584
|
}
|
|
3692
2585
|
};
|
|
3693
|
-
/**
|
|
3694
|
-
* @param {?} $event
|
|
3695
|
-
* @return {?}
|
|
3696
|
-
*/
|
|
3697
2586
|
NgSelectComponent.prototype.handleMousedown = function ($event) {
|
|
3698
|
-
|
|
3699
|
-
var target = ( /** @type {?} */($event.target));
|
|
2587
|
+
var target = $event.target;
|
|
3700
2588
|
if (target.tagName !== 'INPUT') {
|
|
3701
2589
|
$event.preventDefault();
|
|
3702
2590
|
}
|
|
@@ -3721,9 +2609,6 @@
|
|
|
3721
2609
|
this.toggle();
|
|
3722
2610
|
}
|
|
3723
2611
|
};
|
|
3724
|
-
/**
|
|
3725
|
-
* @return {?}
|
|
3726
|
-
*/
|
|
3727
2612
|
NgSelectComponent.prototype.handleArrowClick = function () {
|
|
3728
2613
|
if (this.isOpen) {
|
|
3729
2614
|
this.close();
|
|
@@ -3732,9 +2617,6 @@
|
|
|
3732
2617
|
this.open();
|
|
3733
2618
|
}
|
|
3734
2619
|
};
|
|
3735
|
-
/**
|
|
3736
|
-
* @return {?}
|
|
3737
|
-
*/
|
|
3738
2620
|
NgSelectComponent.prototype.handleClearClick = function () {
|
|
3739
2621
|
if (this.hasValue) {
|
|
3740
2622
|
this.itemsList.clearSelected(true);
|
|
@@ -3745,9 +2627,6 @@
|
|
|
3745
2627
|
this.clearEvent.emit();
|
|
3746
2628
|
this._onSelectionChanged();
|
|
3747
2629
|
};
|
|
3748
|
-
/**
|
|
3749
|
-
* @return {?}
|
|
3750
|
-
*/
|
|
3751
2630
|
NgSelectComponent.prototype.clearModel = function () {
|
|
3752
2631
|
if (!this.clearable) {
|
|
3753
2632
|
return;
|
|
@@ -3755,40 +2634,21 @@
|
|
|
3755
2634
|
this.itemsList.clearSelected();
|
|
3756
2635
|
this._updateNgModel();
|
|
3757
2636
|
};
|
|
3758
|
-
/**
|
|
3759
|
-
* @param {?} value
|
|
3760
|
-
* @return {?}
|
|
3761
|
-
*/
|
|
3762
2637
|
NgSelectComponent.prototype.writeValue = function (value) {
|
|
3763
2638
|
this.itemsList.clearSelected();
|
|
3764
2639
|
this._handleWriteValue(value);
|
|
3765
2640
|
this._cd.markForCheck();
|
|
3766
2641
|
};
|
|
3767
|
-
/**
|
|
3768
|
-
* @param {?} fn
|
|
3769
|
-
* @return {?}
|
|
3770
|
-
*/
|
|
3771
2642
|
NgSelectComponent.prototype.registerOnChange = function (fn) {
|
|
3772
2643
|
this._onChange = fn;
|
|
3773
2644
|
};
|
|
3774
|
-
/**
|
|
3775
|
-
* @param {?} fn
|
|
3776
|
-
* @return {?}
|
|
3777
|
-
*/
|
|
3778
2645
|
NgSelectComponent.prototype.registerOnTouched = function (fn) {
|
|
3779
2646
|
this._onTouched = fn;
|
|
3780
2647
|
};
|
|
3781
|
-
/**
|
|
3782
|
-
* @param {?} state
|
|
3783
|
-
* @return {?}
|
|
3784
|
-
*/
|
|
3785
2648
|
NgSelectComponent.prototype.setDisabledState = function (state) {
|
|
3786
2649
|
this._disabled = state;
|
|
3787
2650
|
this._cd.markForCheck();
|
|
3788
2651
|
};
|
|
3789
|
-
/**
|
|
3790
|
-
* @return {?}
|
|
3791
|
-
*/
|
|
3792
2652
|
NgSelectComponent.prototype.toggle = function () {
|
|
3793
2653
|
if (!this.isOpen) {
|
|
3794
2654
|
this.open();
|
|
@@ -3797,9 +2657,6 @@
|
|
|
3797
2657
|
this.close();
|
|
3798
2658
|
}
|
|
3799
2659
|
};
|
|
3800
|
-
/**
|
|
3801
|
-
* @return {?}
|
|
3802
|
-
*/
|
|
3803
2660
|
NgSelectComponent.prototype.open = function () {
|
|
3804
2661
|
if (this.disabled || this.isOpen || this.itemsList.maxItemsSelected || this._manualOpen) {
|
|
3805
2662
|
return;
|
|
@@ -3815,9 +2672,6 @@
|
|
|
3815
2672
|
}
|
|
3816
2673
|
this.detectChanges();
|
|
3817
2674
|
};
|
|
3818
|
-
/**
|
|
3819
|
-
* @return {?}
|
|
3820
|
-
*/
|
|
3821
2675
|
NgSelectComponent.prototype.close = function () {
|
|
3822
2676
|
if (!this.isOpen || this._manualOpen) {
|
|
3823
2677
|
return;
|
|
@@ -3835,10 +2689,6 @@
|
|
|
3835
2689
|
this.closeEvent.emit();
|
|
3836
2690
|
this._cd.markForCheck();
|
|
3837
2691
|
};
|
|
3838
|
-
/**
|
|
3839
|
-
* @param {?} item
|
|
3840
|
-
* @return {?}
|
|
3841
|
-
*/
|
|
3842
2692
|
NgSelectComponent.prototype.toggleItem = function (item) {
|
|
3843
2693
|
if (!item || item.disabled || this.disabled) {
|
|
3844
2694
|
return;
|
|
@@ -3854,10 +2704,6 @@
|
|
|
3854
2704
|
}
|
|
3855
2705
|
this._onSelectionChanged();
|
|
3856
2706
|
};
|
|
3857
|
-
/**
|
|
3858
|
-
* @param {?} item
|
|
3859
|
-
* @return {?}
|
|
3860
|
-
*/
|
|
3861
2707
|
NgSelectComponent.prototype.select = function (item) {
|
|
3862
2708
|
if (!item.selected) {
|
|
3863
2709
|
this.itemsList.select(item);
|
|
@@ -3873,22 +2719,12 @@
|
|
|
3873
2719
|
this.close();
|
|
3874
2720
|
}
|
|
3875
2721
|
};
|
|
3876
|
-
/**
|
|
3877
|
-
* @return {?}
|
|
3878
|
-
*/
|
|
3879
2722
|
NgSelectComponent.prototype.focus = function () {
|
|
3880
2723
|
this.searchInput.nativeElement.focus();
|
|
3881
2724
|
};
|
|
3882
|
-
/**
|
|
3883
|
-
* @return {?}
|
|
3884
|
-
*/
|
|
3885
2725
|
NgSelectComponent.prototype.blur = function () {
|
|
3886
2726
|
this.searchInput.nativeElement.blur();
|
|
3887
2727
|
};
|
|
3888
|
-
/**
|
|
3889
|
-
* @param {?} item
|
|
3890
|
-
* @return {?}
|
|
3891
|
-
*/
|
|
3892
2728
|
NgSelectComponent.prototype.unselect = function (item) {
|
|
3893
2729
|
if (!item) {
|
|
3894
2730
|
return;
|
|
@@ -3898,104 +2734,54 @@
|
|
|
3898
2734
|
this._updateNgModel();
|
|
3899
2735
|
this.removeEvent.emit(item);
|
|
3900
2736
|
};
|
|
3901
|
-
/**
|
|
3902
|
-
* @return {?}
|
|
3903
|
-
*/
|
|
3904
2737
|
NgSelectComponent.prototype.selectTag = function () {
|
|
3905
2738
|
var _a;
|
|
3906
2739
|
var _this = this;
|
|
3907
|
-
/** @type {?} */
|
|
3908
2740
|
var tag;
|
|
3909
2741
|
if (isFunction(this.addTag)) {
|
|
3910
|
-
tag =
|
|
2742
|
+
tag = this.addTag(this.searchTerm);
|
|
3911
2743
|
}
|
|
3912
2744
|
else {
|
|
3913
2745
|
tag = this._primitive ? this.searchTerm : (_a = {}, _a[this.bindLabel] = this.searchTerm, _a);
|
|
3914
2746
|
}
|
|
3915
|
-
|
|
3916
|
-
var handleTag = ( /**
|
|
3917
|
-
* @param {?} item
|
|
3918
|
-
* @return {?}
|
|
3919
|
-
*/function (item) { return _this._isTypeahead || !_this.isOpen ? _this.itemsList.mapItem(item, null) : _this.itemsList.addItem(item); });
|
|
2747
|
+
var handleTag = function (item) { return _this._isTypeahead || !_this.isOpen ? _this.itemsList.mapItem(item, null) : _this.itemsList.addItem(item); };
|
|
3920
2748
|
if (isPromise(tag)) {
|
|
3921
|
-
tag.then((
|
|
3922
|
-
* @param {?} item
|
|
3923
|
-
* @return {?}
|
|
3924
|
-
*/function (/**
|
|
3925
|
-
* @param {?} item
|
|
3926
|
-
* @return {?}
|
|
3927
|
-
*/ item) { return _this.select(handleTag(item)); })).catch(( /**
|
|
3928
|
-
* @return {?}
|
|
3929
|
-
*/function () { }));
|
|
2749
|
+
tag.then(function (item) { return _this.select(handleTag(item)); }).catch(function () { });
|
|
3930
2750
|
}
|
|
3931
2751
|
else if (tag) {
|
|
3932
2752
|
this.select(handleTag(tag));
|
|
3933
2753
|
}
|
|
3934
2754
|
};
|
|
3935
|
-
/**
|
|
3936
|
-
* @return {?}
|
|
3937
|
-
*/
|
|
3938
2755
|
NgSelectComponent.prototype.showClear = function () {
|
|
3939
2756
|
return this.clearable && (this.hasValue || this.searchTerm) && !this.disabled;
|
|
3940
2757
|
};
|
|
3941
2758
|
Object.defineProperty(NgSelectComponent.prototype, "showAddTag", {
|
|
3942
|
-
/**
|
|
3943
|
-
* @return {?}
|
|
3944
|
-
*/
|
|
3945
2759
|
get: function () {
|
|
3946
2760
|
if (!this._validTerm) {
|
|
3947
2761
|
return false;
|
|
3948
2762
|
}
|
|
3949
|
-
/** @type {?} */
|
|
3950
2763
|
var term = this.searchTerm.toLowerCase().trim();
|
|
3951
2764
|
return this.addTag &&
|
|
3952
|
-
(!this.itemsList.filteredItems.some((
|
|
3953
|
-
|
|
3954
|
-
* @return {?}
|
|
3955
|
-
*/function (/**
|
|
3956
|
-
* @param {?} x
|
|
3957
|
-
* @return {?}
|
|
3958
|
-
*/ x) { return x.label.toLowerCase() === term; })) &&
|
|
3959
|
-
(!this.hideSelected && this.isOpen || !this.selectedItems.some(( /**
|
|
3960
|
-
* @param {?} x
|
|
3961
|
-
* @return {?}
|
|
3962
|
-
*/function (/**
|
|
3963
|
-
* @param {?} x
|
|
3964
|
-
* @return {?}
|
|
3965
|
-
*/ x) { return x.label.toLowerCase() === term; })))) &&
|
|
2765
|
+
(!this.itemsList.filteredItems.some(function (x) { return x.label.toLowerCase() === term; }) &&
|
|
2766
|
+
(!this.hideSelected && this.isOpen || !this.selectedItems.some(function (x) { return x.label.toLowerCase() === term; }))) &&
|
|
3966
2767
|
!this.loading;
|
|
3967
2768
|
},
|
|
3968
2769
|
enumerable: false,
|
|
3969
2770
|
configurable: true
|
|
3970
2771
|
});
|
|
3971
|
-
/**
|
|
3972
|
-
* @return {?}
|
|
3973
|
-
*/
|
|
3974
2772
|
NgSelectComponent.prototype.showNoItemsFound = function () {
|
|
3975
|
-
/** @type {?} */
|
|
3976
2773
|
var empty = this.itemsList.filteredItems.length === 0;
|
|
3977
2774
|
return ((empty && !this._isTypeahead && !this.loading) ||
|
|
3978
2775
|
(empty && this._isTypeahead && this._validTerm && !this.loading)) &&
|
|
3979
2776
|
!this.showAddTag;
|
|
3980
2777
|
};
|
|
3981
|
-
/**
|
|
3982
|
-
* @return {?}
|
|
3983
|
-
*/
|
|
3984
2778
|
NgSelectComponent.prototype.showTypeToSearch = function () {
|
|
3985
|
-
/** @type {?} */
|
|
3986
2779
|
var empty = this.itemsList.filteredItems.length === 0;
|
|
3987
2780
|
return empty && this._isTypeahead && !this._validTerm && !this.loading;
|
|
3988
2781
|
};
|
|
3989
|
-
/**
|
|
3990
|
-
* @return {?}
|
|
3991
|
-
*/
|
|
3992
2782
|
NgSelectComponent.prototype.onCompositionStart = function () {
|
|
3993
2783
|
this._isComposing = true;
|
|
3994
2784
|
};
|
|
3995
|
-
/**
|
|
3996
|
-
* @param {?} term
|
|
3997
|
-
* @return {?}
|
|
3998
|
-
*/
|
|
3999
2785
|
NgSelectComponent.prototype.onCompositionEnd = function (term) {
|
|
4000
2786
|
this._isComposing = false;
|
|
4001
2787
|
if (this.searchWhileComposing) {
|
|
@@ -4003,10 +2789,6 @@
|
|
|
4003
2789
|
}
|
|
4004
2790
|
this.filter(term);
|
|
4005
2791
|
};
|
|
4006
|
-
/**
|
|
4007
|
-
* @param {?} term
|
|
4008
|
-
* @return {?}
|
|
4009
|
-
*/
|
|
4010
2792
|
NgSelectComponent.prototype.filter = function (term) {
|
|
4011
2793
|
if (this._isComposing && !this.searchWhileComposing) {
|
|
4012
2794
|
return;
|
|
@@ -4021,19 +2803,9 @@
|
|
|
4021
2803
|
this.itemsList.markSelectedOrDefault(this.markFirst);
|
|
4022
2804
|
}
|
|
4023
2805
|
}
|
|
4024
|
-
this.searchEvent.emit({ term: term, items: this.itemsList.filteredItems.map((
|
|
4025
|
-
* @param {?} x
|
|
4026
|
-
* @return {?}
|
|
4027
|
-
*/function (/**
|
|
4028
|
-
* @param {?} x
|
|
4029
|
-
* @return {?}
|
|
4030
|
-
*/ x) { return x.value; })) });
|
|
2806
|
+
this.searchEvent.emit({ term: term, items: this.itemsList.filteredItems.map(function (x) { return x.value; }) });
|
|
4031
2807
|
this.open();
|
|
4032
2808
|
};
|
|
4033
|
-
/**
|
|
4034
|
-
* @param {?} $event
|
|
4035
|
-
* @return {?}
|
|
4036
|
-
*/
|
|
4037
2809
|
NgSelectComponent.prototype.onInputFocus = function ($event) {
|
|
4038
2810
|
if (this.focused) {
|
|
4039
2811
|
return;
|
|
@@ -4045,10 +2817,6 @@
|
|
|
4045
2817
|
this.focusEvent.emit($event);
|
|
4046
2818
|
this.focused = true;
|
|
4047
2819
|
};
|
|
4048
|
-
/**
|
|
4049
|
-
* @param {?} $event
|
|
4050
|
-
* @return {?}
|
|
4051
|
-
*/
|
|
4052
2820
|
NgSelectComponent.prototype.onInputBlur = function ($event) {
|
|
4053
2821
|
this.element.classList.remove('ng-select-focused');
|
|
4054
2822
|
this.blurEvent.emit($event);
|
|
@@ -4060,40 +2828,22 @@
|
|
|
4060
2828
|
}
|
|
4061
2829
|
this.focused = false;
|
|
4062
2830
|
};
|
|
4063
|
-
/**
|
|
4064
|
-
* @param {?} item
|
|
4065
|
-
* @return {?}
|
|
4066
|
-
*/
|
|
4067
2831
|
NgSelectComponent.prototype.onItemHover = function (item) {
|
|
4068
2832
|
if (item.disabled) {
|
|
4069
2833
|
return;
|
|
4070
2834
|
}
|
|
4071
2835
|
this.itemsList.markItem(item);
|
|
4072
2836
|
};
|
|
4073
|
-
/**
|
|
4074
|
-
* @return {?}
|
|
4075
|
-
*/
|
|
4076
2837
|
NgSelectComponent.prototype.detectChanges = function () {
|
|
4077
|
-
if (!
|
|
2838
|
+
if (!this._cd.destroyed) {
|
|
4078
2839
|
this._cd.detectChanges();
|
|
4079
2840
|
}
|
|
4080
2841
|
};
|
|
4081
|
-
/**
|
|
4082
|
-
* @private
|
|
4083
|
-
* @return {?}
|
|
4084
|
-
*/
|
|
4085
2842
|
NgSelectComponent.prototype._setSearchTermFromItems = function () {
|
|
4086
|
-
/** @type {?} */
|
|
4087
2843
|
var selected = this.selectedItems && this.selectedItems[0];
|
|
4088
2844
|
this.searchTerm = (selected && selected.label) || null;
|
|
4089
2845
|
};
|
|
4090
|
-
/**
|
|
4091
|
-
* @private
|
|
4092
|
-
* @param {?} items
|
|
4093
|
-
* @return {?}
|
|
4094
|
-
*/
|
|
4095
2846
|
NgSelectComponent.prototype._setItems = function (items) {
|
|
4096
|
-
/** @type {?} */
|
|
4097
2847
|
var firstItem = items[0];
|
|
4098
2848
|
this.bindLabel = this.bindLabel || this._defaultLabel;
|
|
4099
2849
|
this._primitive = isDefined(firstItem) ? !isObject(firstItem) : this._primitive || this.bindLabel === this._defaultLabel;
|
|
@@ -4108,138 +2858,74 @@
|
|
|
4108
2858
|
this.itemsList.markSelectedOrDefault(this.markFirst);
|
|
4109
2859
|
}
|
|
4110
2860
|
};
|
|
4111
|
-
/**
|
|
4112
|
-
* @private
|
|
4113
|
-
* @return {?}
|
|
4114
|
-
*/
|
|
4115
2861
|
NgSelectComponent.prototype._setItemsFromNgOptions = function () {
|
|
4116
2862
|
var _this = this;
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
* @param {?} options
|
|
4120
|
-
* @return {?}
|
|
4121
|
-
*/function (options) {
|
|
4122
|
-
_this.items = options.map(( /**
|
|
4123
|
-
* @param {?} option
|
|
4124
|
-
* @return {?}
|
|
4125
|
-
*/function (/**
|
|
4126
|
-
* @param {?} option
|
|
4127
|
-
* @return {?}
|
|
4128
|
-
*/ option) { return ({
|
|
2863
|
+
var mapNgOptions = function (options) {
|
|
2864
|
+
_this.items = options.map(function (option) { return ({
|
|
4129
2865
|
$ngOptionValue: option.value,
|
|
4130
2866
|
$ngOptionLabel: option.elementRef.nativeElement.innerHTML,
|
|
4131
2867
|
disabled: option.disabled
|
|
4132
|
-
}); })
|
|
2868
|
+
}); });
|
|
4133
2869
|
_this.itemsList.setItems(_this.items);
|
|
4134
2870
|
if (_this.hasValue) {
|
|
4135
2871
|
_this.itemsList.mapSelectedItems();
|
|
4136
2872
|
}
|
|
4137
2873
|
_this.detectChanges();
|
|
4138
|
-
}
|
|
4139
|
-
|
|
4140
|
-
var handleOptionChange = ( /**
|
|
4141
|
-
* @return {?}
|
|
4142
|
-
*/function () {
|
|
4143
|
-
/** @type {?} */
|
|
2874
|
+
};
|
|
2875
|
+
var handleOptionChange = function () {
|
|
4144
2876
|
var changedOrDestroyed = rxjs.merge(_this.ngOptions.changes, _this._destroy$);
|
|
4145
|
-
rxjs.merge.apply(void 0, __spread(_this.ngOptions.map((
|
|
4146
|
-
|
|
4147
|
-
* @return {?}
|
|
4148
|
-
*/function (/**
|
|
4149
|
-
* @param {?} option
|
|
4150
|
-
* @return {?}
|
|
4151
|
-
*/ option) { return option.stateChange$; })))).pipe(operators.takeUntil(changedOrDestroyed))
|
|
4152
|
-
.subscribe(( /**
|
|
4153
|
-
* @param {?} option
|
|
4154
|
-
* @return {?}
|
|
4155
|
-
*/function (/**
|
|
4156
|
-
* @param {?} option
|
|
4157
|
-
* @return {?}
|
|
4158
|
-
*/ option) {
|
|
4159
|
-
/** @type {?} */
|
|
2877
|
+
rxjs.merge.apply(void 0, __spread(_this.ngOptions.map(function (option) { return option.stateChange$; }))).pipe(operators.takeUntil(changedOrDestroyed))
|
|
2878
|
+
.subscribe(function (option) {
|
|
4160
2879
|
var item = _this.itemsList.findItem(option.value);
|
|
4161
2880
|
item.disabled = option.disabled;
|
|
4162
2881
|
item.label = option.label || item.label;
|
|
4163
2882
|
_this._cd.detectChanges();
|
|
4164
|
-
})
|
|
4165
|
-
}
|
|
2883
|
+
});
|
|
2884
|
+
};
|
|
4166
2885
|
this.ngOptions.changes
|
|
4167
2886
|
.pipe(operators.startWith(this.ngOptions), operators.takeUntil(this._destroy$))
|
|
4168
|
-
.subscribe((
|
|
4169
|
-
* @param {?} options
|
|
4170
|
-
* @return {?}
|
|
4171
|
-
*/function (/**
|
|
4172
|
-
* @param {?} options
|
|
4173
|
-
* @return {?}
|
|
4174
|
-
*/ options) {
|
|
2887
|
+
.subscribe(function (options) {
|
|
4175
2888
|
_this.bindLabel = _this._defaultLabel;
|
|
4176
2889
|
mapNgOptions(options);
|
|
4177
2890
|
handleOptionChange();
|
|
4178
|
-
})
|
|
2891
|
+
});
|
|
4179
2892
|
};
|
|
4180
|
-
/**
|
|
4181
|
-
* @private
|
|
4182
|
-
* @param {?} value
|
|
4183
|
-
* @return {?}
|
|
4184
|
-
*/
|
|
4185
2893
|
NgSelectComponent.prototype._isValidWriteValue = function (value) {
|
|
4186
2894
|
var _this = this;
|
|
4187
2895
|
if (!isDefined(value) || (this.multiple && value === '') || Array.isArray(value) && value.length === 0) {
|
|
4188
2896
|
return false;
|
|
4189
2897
|
}
|
|
4190
|
-
|
|
4191
|
-
var validateBinding = ( /**
|
|
4192
|
-
* @param {?} item
|
|
4193
|
-
* @return {?}
|
|
4194
|
-
*/function (item) {
|
|
2898
|
+
var validateBinding = function (item) {
|
|
4195
2899
|
if (!isDefined(_this.compareWith) && isObject(item) && _this.bindValue) {
|
|
4196
2900
|
_this._console.warn("Setting object(" + JSON.stringify(item) + ") as your model with bindValue is not allowed unless [compareWith] is used.");
|
|
4197
2901
|
return false;
|
|
4198
2902
|
}
|
|
4199
2903
|
return true;
|
|
4200
|
-
}
|
|
2904
|
+
};
|
|
4201
2905
|
if (this.multiple) {
|
|
4202
2906
|
if (!Array.isArray(value)) {
|
|
4203
2907
|
this._console.warn('Multiple select ngModel should be array.');
|
|
4204
2908
|
return false;
|
|
4205
2909
|
}
|
|
4206
|
-
return value.every((
|
|
4207
|
-
* @param {?} item
|
|
4208
|
-
* @return {?}
|
|
4209
|
-
*/function (/**
|
|
4210
|
-
* @param {?} item
|
|
4211
|
-
* @return {?}
|
|
4212
|
-
*/ item) { return validateBinding(item); }));
|
|
2910
|
+
return value.every(function (item) { return validateBinding(item); });
|
|
4213
2911
|
}
|
|
4214
2912
|
else {
|
|
4215
2913
|
return validateBinding(value);
|
|
4216
2914
|
}
|
|
4217
2915
|
};
|
|
4218
|
-
/**
|
|
4219
|
-
* @private
|
|
4220
|
-
* @param {?} ngModel
|
|
4221
|
-
* @return {?}
|
|
4222
|
-
*/
|
|
4223
2916
|
NgSelectComponent.prototype._handleWriteValue = function (ngModel) {
|
|
4224
2917
|
var _this = this;
|
|
4225
2918
|
if (!this._isValidWriteValue(ngModel)) {
|
|
4226
2919
|
return;
|
|
4227
2920
|
}
|
|
4228
|
-
|
|
4229
|
-
var select = ( /**
|
|
4230
|
-
* @param {?} val
|
|
4231
|
-
* @return {?}
|
|
4232
|
-
*/function (val) {
|
|
2921
|
+
var select = function (val) {
|
|
4233
2922
|
var _a;
|
|
4234
|
-
/** @type {?} */
|
|
4235
2923
|
var item = _this.itemsList.findItem(val);
|
|
4236
2924
|
if (item) {
|
|
4237
2925
|
_this.itemsList.select(item);
|
|
4238
2926
|
}
|
|
4239
2927
|
else {
|
|
4240
|
-
/** @type {?} */
|
|
4241
2928
|
var isValObject = isObject(val);
|
|
4242
|
-
/** @type {?} */
|
|
4243
2929
|
var isPrimitive = !isValObject && !_this.bindValue;
|
|
4244
2930
|
if ((isValObject || isPrimitive)) {
|
|
4245
2931
|
_this.itemsList.select(_this.itemsList.mapItem(val, null));
|
|
@@ -4252,49 +2938,22 @@
|
|
|
4252
2938
|
_this.itemsList.select(_this.itemsList.mapItem(item, null));
|
|
4253
2939
|
}
|
|
4254
2940
|
}
|
|
4255
|
-
}
|
|
2941
|
+
};
|
|
4256
2942
|
if (this.multiple) {
|
|
4257
|
-
((
|
|
4258
|
-
* @param {?} item
|
|
4259
|
-
* @return {?}
|
|
4260
|
-
*/function (/**
|
|
4261
|
-
* @param {?} item
|
|
4262
|
-
* @return {?}
|
|
4263
|
-
*/ item) { return select(item); }));
|
|
2943
|
+
ngModel.forEach(function (item) { return select(item); });
|
|
4264
2944
|
}
|
|
4265
2945
|
else {
|
|
4266
2946
|
select(ngModel);
|
|
4267
2947
|
}
|
|
4268
2948
|
};
|
|
4269
|
-
/**
|
|
4270
|
-
* @private
|
|
4271
|
-
* @return {?}
|
|
4272
|
-
*/
|
|
4273
2949
|
NgSelectComponent.prototype._handleKeyPresses = function () {
|
|
4274
2950
|
var _this = this;
|
|
4275
2951
|
if (this.searchable) {
|
|
4276
2952
|
return;
|
|
4277
2953
|
}
|
|
4278
2954
|
this._keyPress$
|
|
4279
|
-
.pipe(operators.takeUntil(this._destroy$), operators.tap((
|
|
4280
|
-
|
|
4281
|
-
* @return {?}
|
|
4282
|
-
*/function (/**
|
|
4283
|
-
* @param {?} letter
|
|
4284
|
-
* @return {?}
|
|
4285
|
-
*/ letter) { return _this._pressedKeys.push(letter); })), operators.debounceTime(200), operators.filter(( /**
|
|
4286
|
-
* @return {?}
|
|
4287
|
-
*/function () { return _this._pressedKeys.length > 0; })), operators.map(( /**
|
|
4288
|
-
* @return {?}
|
|
4289
|
-
*/function () { return _this._pressedKeys.join(''); })))
|
|
4290
|
-
.subscribe(( /**
|
|
4291
|
-
* @param {?} term
|
|
4292
|
-
* @return {?}
|
|
4293
|
-
*/function (/**
|
|
4294
|
-
* @param {?} term
|
|
4295
|
-
* @return {?}
|
|
4296
|
-
*/ term) {
|
|
4297
|
-
/** @type {?} */
|
|
2955
|
+
.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(''); }))
|
|
2956
|
+
.subscribe(function (term) {
|
|
4298
2957
|
var item = _this.itemsList.findByLabel(term);
|
|
4299
2958
|
if (item) {
|
|
4300
2959
|
if (_this.isOpen) {
|
|
@@ -4307,17 +2966,11 @@
|
|
|
4307
2966
|
}
|
|
4308
2967
|
}
|
|
4309
2968
|
_this._pressedKeys = [];
|
|
4310
|
-
})
|
|
2969
|
+
});
|
|
4311
2970
|
};
|
|
4312
|
-
/**
|
|
4313
|
-
* @private
|
|
4314
|
-
* @return {?}
|
|
4315
|
-
*/
|
|
4316
2971
|
NgSelectComponent.prototype._setInputAttributes = function () {
|
|
4317
2972
|
var e_1, _a;
|
|
4318
|
-
/** @type {?} */
|
|
4319
2973
|
var input = this.searchInput.nativeElement;
|
|
4320
|
-
/** @type {?} */
|
|
4321
2974
|
var attributes = Object.assign({ type: 'text', autocorrect: 'off', autocapitalize: 'off', autocomplete: this.labelForId ? 'off' : this.dropdownId }, this.inputAttrs);
|
|
4322
2975
|
try {
|
|
4323
2976
|
for (var _b = __values(Object.keys(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -4333,24 +2986,17 @@
|
|
|
4333
2986
|
finally { if (e_1) throw e_1.error; }
|
|
4334
2987
|
}
|
|
4335
2988
|
};
|
|
4336
|
-
/**
|
|
4337
|
-
* @private
|
|
4338
|
-
* @return {?}
|
|
4339
|
-
*/
|
|
4340
2989
|
NgSelectComponent.prototype._updateNgModel = function () {
|
|
4341
2990
|
var e_2, _a;
|
|
4342
|
-
/** @type {?} */
|
|
4343
2991
|
var model = [];
|
|
4344
2992
|
try {
|
|
4345
2993
|
for (var _b = __values(this.selectedItems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4346
2994
|
var item = _c.value;
|
|
4347
2995
|
if (this.bindValue) {
|
|
4348
|
-
/** @type {?} */
|
|
4349
2996
|
var value = null;
|
|
4350
2997
|
if (item.children) {
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
value = item.value[groupKey || ( /** @type {?} */(this.groupBy))];
|
|
2998
|
+
var groupKey = this.groupValue ? this.bindValue : this.groupBy;
|
|
2999
|
+
value = item.value[groupKey || this.groupBy];
|
|
4354
3000
|
}
|
|
4355
3001
|
else {
|
|
4356
3002
|
value = this.itemsList.resolveNested(item.value, this.bindValue);
|
|
@@ -4369,14 +3015,7 @@
|
|
|
4369
3015
|
}
|
|
4370
3016
|
finally { if (e_2) throw e_2.error; }
|
|
4371
3017
|
}
|
|
4372
|
-
|
|
4373
|
-
var selected = this.selectedItems.map(( /**
|
|
4374
|
-
* @param {?} x
|
|
4375
|
-
* @return {?}
|
|
4376
|
-
*/function (/**
|
|
4377
|
-
* @param {?} x
|
|
4378
|
-
* @return {?}
|
|
4379
|
-
*/ x) { return x.value; }));
|
|
3018
|
+
var selected = this.selectedItems.map(function (x) { return x.value; });
|
|
4380
3019
|
if (this.multiple) {
|
|
4381
3020
|
this._onChange(model);
|
|
4382
3021
|
this.changeEvent.emit(selected);
|
|
@@ -4387,10 +3026,6 @@
|
|
|
4387
3026
|
}
|
|
4388
3027
|
this._cd.markForCheck();
|
|
4389
3028
|
};
|
|
4390
|
-
/**
|
|
4391
|
-
* @private
|
|
4392
|
-
* @return {?}
|
|
4393
|
-
*/
|
|
4394
3029
|
NgSelectComponent.prototype._clearSearch = function () {
|
|
4395
3030
|
if (!this.searchTerm) {
|
|
4396
3031
|
return;
|
|
@@ -4398,41 +3033,24 @@
|
|
|
4398
3033
|
this._changeSearch(null);
|
|
4399
3034
|
this.itemsList.resetFilteredItems();
|
|
4400
3035
|
};
|
|
4401
|
-
/**
|
|
4402
|
-
* @private
|
|
4403
|
-
* @param {?} searchTerm
|
|
4404
|
-
* @return {?}
|
|
4405
|
-
*/
|
|
4406
3036
|
NgSelectComponent.prototype._changeSearch = function (searchTerm) {
|
|
4407
3037
|
this.searchTerm = searchTerm;
|
|
4408
3038
|
if (this._isTypeahead) {
|
|
4409
3039
|
this.typeahead.next(searchTerm);
|
|
4410
3040
|
}
|
|
4411
3041
|
};
|
|
4412
|
-
/**
|
|
4413
|
-
* @private
|
|
4414
|
-
* @return {?}
|
|
4415
|
-
*/
|
|
4416
3042
|
NgSelectComponent.prototype._scrollToMarked = function () {
|
|
4417
3043
|
if (!this.isOpen || !this.dropdownPanel) {
|
|
4418
3044
|
return;
|
|
4419
3045
|
}
|
|
4420
3046
|
this.dropdownPanel.scrollTo(this.itemsList.markedItem);
|
|
4421
3047
|
};
|
|
4422
|
-
/**
|
|
4423
|
-
* @private
|
|
4424
|
-
* @return {?}
|
|
4425
|
-
*/
|
|
4426
3048
|
NgSelectComponent.prototype._scrollToTag = function () {
|
|
4427
3049
|
if (!this.isOpen || !this.dropdownPanel) {
|
|
4428
3050
|
return;
|
|
4429
3051
|
}
|
|
4430
3052
|
this.dropdownPanel.scrollToTag();
|
|
4431
3053
|
};
|
|
4432
|
-
/**
|
|
4433
|
-
* @private
|
|
4434
|
-
* @return {?}
|
|
4435
|
-
*/
|
|
4436
3054
|
NgSelectComponent.prototype._onSelectionChanged = function () {
|
|
4437
3055
|
if (this.isOpen && this.multiple && this.appendTo) {
|
|
4438
3056
|
// Make sure items are rendered.
|
|
@@ -4440,11 +3058,6 @@
|
|
|
4440
3058
|
this.dropdownPanel.adjustPosition();
|
|
4441
3059
|
}
|
|
4442
3060
|
};
|
|
4443
|
-
/**
|
|
4444
|
-
* @private
|
|
4445
|
-
* @param {?} $event
|
|
4446
|
-
* @return {?}
|
|
4447
|
-
*/
|
|
4448
3061
|
NgSelectComponent.prototype._handleTab = function ($event) {
|
|
4449
3062
|
if (this.isOpen === false && !this.addTag) {
|
|
4450
3063
|
return;
|
|
@@ -4466,11 +3079,6 @@
|
|
|
4466
3079
|
this.close();
|
|
4467
3080
|
}
|
|
4468
3081
|
};
|
|
4469
|
-
/**
|
|
4470
|
-
* @private
|
|
4471
|
-
* @param {?} $event
|
|
4472
|
-
* @return {?}
|
|
4473
|
-
*/
|
|
4474
3082
|
NgSelectComponent.prototype._handleEnter = function ($event) {
|
|
4475
3083
|
if (this.isOpen || this._manualOpen) {
|
|
4476
3084
|
if (this.itemsList.markedItem) {
|
|
@@ -4488,11 +3096,6 @@
|
|
|
4488
3096
|
}
|
|
4489
3097
|
$event.preventDefault();
|
|
4490
3098
|
};
|
|
4491
|
-
/**
|
|
4492
|
-
* @private
|
|
4493
|
-
* @param {?} $event
|
|
4494
|
-
* @return {?}
|
|
4495
|
-
*/
|
|
4496
3099
|
NgSelectComponent.prototype._handleSpace = function ($event) {
|
|
4497
3100
|
if (this.isOpen || this._manualOpen) {
|
|
4498
3101
|
return;
|
|
@@ -4500,11 +3103,6 @@
|
|
|
4500
3103
|
this.open();
|
|
4501
3104
|
$event.preventDefault();
|
|
4502
3105
|
};
|
|
4503
|
-
/**
|
|
4504
|
-
* @private
|
|
4505
|
-
* @param {?} $event
|
|
4506
|
-
* @return {?}
|
|
4507
|
-
*/
|
|
4508
3106
|
NgSelectComponent.prototype._handleArrowDown = function ($event) {
|
|
4509
3107
|
if (this._nextItemIsTag(+1)) {
|
|
4510
3108
|
this.itemsList.unmarkItem();
|
|
@@ -4517,11 +3115,6 @@
|
|
|
4517
3115
|
this.open();
|
|
4518
3116
|
$event.preventDefault();
|
|
4519
3117
|
};
|
|
4520
|
-
/**
|
|
4521
|
-
* @private
|
|
4522
|
-
* @param {?} $event
|
|
4523
|
-
* @return {?}
|
|
4524
|
-
*/
|
|
4525
3118
|
NgSelectComponent.prototype._handleArrowUp = function ($event) {
|
|
4526
3119
|
if (!this.isOpen) {
|
|
4527
3120
|
return;
|
|
@@ -4536,22 +3129,12 @@
|
|
|
4536
3129
|
}
|
|
4537
3130
|
$event.preventDefault();
|
|
4538
3131
|
};
|
|
4539
|
-
/**
|
|
4540
|
-
* @private
|
|
4541
|
-
* @param {?} nextStep
|
|
4542
|
-
* @return {?}
|
|
4543
|
-
*/
|
|
4544
3132
|
NgSelectComponent.prototype._nextItemIsTag = function (nextStep) {
|
|
4545
|
-
/** @type {?} */
|
|
4546
3133
|
var nextIndex = this.itemsList.markedIndex + nextStep;
|
|
4547
3134
|
return this.addTag && this.searchTerm
|
|
4548
3135
|
&& this.itemsList.markedItem
|
|
4549
3136
|
&& (nextIndex < 0 || nextIndex === this.itemsList.filteredItems.length);
|
|
4550
3137
|
};
|
|
4551
|
-
/**
|
|
4552
|
-
* @private
|
|
4553
|
-
* @return {?}
|
|
4554
|
-
*/
|
|
4555
3138
|
NgSelectComponent.prototype._handleBackspace = function () {
|
|
4556
3139
|
if (this.searchTerm || !this.clearable || !this.clearOnBackspace || !this.hasValue) {
|
|
4557
3140
|
return;
|
|
@@ -4564,10 +3147,6 @@
|
|
|
4564
3147
|
}
|
|
4565
3148
|
};
|
|
4566
3149
|
Object.defineProperty(NgSelectComponent.prototype, "_isTypeahead", {
|
|
4567
|
-
/**
|
|
4568
|
-
* @private
|
|
4569
|
-
* @return {?}
|
|
4570
|
-
*/
|
|
4571
3150
|
get: function () {
|
|
4572
3151
|
return this.typeahead && this.typeahead.observers.length > 0;
|
|
4573
3152
|
},
|
|
@@ -4575,23 +3154,13 @@
|
|
|
4575
3154
|
configurable: true
|
|
4576
3155
|
});
|
|
4577
3156
|
Object.defineProperty(NgSelectComponent.prototype, "_validTerm", {
|
|
4578
|
-
/**
|
|
4579
|
-
* @private
|
|
4580
|
-
* @return {?}
|
|
4581
|
-
*/
|
|
4582
3157
|
get: function () {
|
|
4583
|
-
/** @type {?} */
|
|
4584
3158
|
var term = this.searchTerm && this.searchTerm.trim();
|
|
4585
3159
|
return term && term.length >= this.minTermLength;
|
|
4586
3160
|
},
|
|
4587
3161
|
enumerable: false,
|
|
4588
3162
|
configurable: true
|
|
4589
3163
|
});
|
|
4590
|
-
/**
|
|
4591
|
-
* @private
|
|
4592
|
-
* @param {?} config
|
|
4593
|
-
* @return {?}
|
|
4594
|
-
*/
|
|
4595
3164
|
NgSelectComponent.prototype._mergeGlobalConfig = function (config) {
|
|
4596
3165
|
this.placeholder = this.placeholder || config.placeholder;
|
|
4597
3166
|
this.notFoundText = this.notFoundText || config.notFoundText;
|
|
@@ -4605,6 +3174,7 @@
|
|
|
4605
3174
|
this.openOnEnter = isDefined(this.openOnEnter) ? this.openOnEnter : config.openOnEnter;
|
|
4606
3175
|
this.appendTo = this.appendTo || config.appendTo;
|
|
4607
3176
|
this.bindValue = this.bindValue || config.bindValue;
|
|
3177
|
+
this.bindLabel = this.bindLabel || config.bindLabel;
|
|
4608
3178
|
this.appearance = this.appearance || config.appearance;
|
|
4609
3179
|
};
|
|
4610
3180
|
return NgSelectComponent;
|
|
@@ -4612,12 +3182,10 @@
|
|
|
4612
3182
|
NgSelectComponent.decorators = [
|
|
4613
3183
|
{ type: i0.Component, args: [{
|
|
4614
3184
|
selector: 'ng-select',
|
|
4615
|
-
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 && 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=\"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",
|
|
3185
|
+
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",
|
|
4616
3186
|
providers: [{
|
|
4617
3187
|
provide: forms.NG_VALUE_ACCESSOR,
|
|
4618
|
-
useExisting: i0.forwardRef((
|
|
4619
|
-
* @return {?}
|
|
4620
|
-
*/function () { return NgSelectComponent; })),
|
|
3188
|
+
useExisting: i0.forwardRef(function () { return NgSelectComponent; }),
|
|
4621
3189
|
multi: true
|
|
4622
3190
|
}, NgDropdownPanelService],
|
|
4623
3191
|
encapsulation: i0.ViewEncapsulation.None,
|
|
@@ -4627,9 +3195,8 @@
|
|
|
4627
3195
|
'[class.ng-select-single]': '!multiple',
|
|
4628
3196
|
},
|
|
4629
3197
|
styles: [".ng-select{display:block;position:relative}.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{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;cursor:default;user-select:none}.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{background:none transparent;border:0;box-shadow:none;box-sizing:content-box;cursor:default;outline:none;padding:0;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]{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;padding:0;user-select:none;width: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{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.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{left:0;position:absolute;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{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;cursor:pointer;position:relative;user-select:none;width:17px}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-spinner-loader{-webkit-animation:load8 .8s linear infinite;animation:load8 .8s linear infinite;border:2px solid rgba(66,66,66,.2);border-left-color:#424242;border-radius:50%;font-size:10px;height:17px;margin-right:5px;position:relative;text-indent:-9999em;transform:translateZ(0);width:17px}.ng-select .ng-spinner-loader:after{border-radius:50%;height:17px;width: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{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;cursor:pointer;position:relative;text-align:center;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{display:inline-block;height:0;pointer-events:none;position:relative;width:0}.ng-dropdown-panel{-webkit-overflow-scrolling:touch;box-sizing:border-box;opacity:0;position:absolute;width:100%;z-index:1050}.ng-dropdown-panel .ng-dropdown-panel-items{box-sizing:border-box;display:block;height:auto;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup,.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.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{-webkit-overflow-scrolling:touch;display:block;overflow:hidden;overflow-y:auto;position:relative}.ng-dropdown-panel .scrollable-content{height:100%;left:0;position:absolute;top:0;width:100%}.ng-dropdown-panel .total-padding{opacity:0;width:1px}"]
|
|
4630
|
-
}] }
|
|
3198
|
+
},] }
|
|
4631
3199
|
];
|
|
4632
|
-
/** @nocollapse */
|
|
4633
3200
|
NgSelectComponent.ctorParameters = function () { return [
|
|
4634
3201
|
{ type: String, decorators: [{ type: i0.Attribute, args: ['class',] }] },
|
|
4635
3202
|
{ type: undefined, decorators: [{ type: i0.Attribute, args: ['autofocus',] }] },
|
|
@@ -4706,320 +3273,28 @@
|
|
|
4706
3273
|
loadingTextTemplate: [{ type: i0.ContentChild, args: [NgLoadingTextTemplateDirective, { read: i0.TemplateRef },] }],
|
|
4707
3274
|
tagTemplate: [{ type: i0.ContentChild, args: [NgTagTemplateDirective, { read: i0.TemplateRef },] }],
|
|
4708
3275
|
loadingSpinnerTemplate: [{ type: i0.ContentChild, args: [NgLoadingSpinnerTemplateDirective, { read: i0.TemplateRef },] }],
|
|
4709
|
-
dropdownPanel: [{ type: i0.ViewChild, args: [i0.forwardRef((
|
|
4710
|
-
* @return {?}
|
|
4711
|
-
*/function () { return NgDropdownPanelComponent; })),] }],
|
|
3276
|
+
dropdownPanel: [{ type: i0.ViewChild, args: [i0.forwardRef(function () { return NgDropdownPanelComponent; }),] }],
|
|
4712
3277
|
searchInput: [{ type: i0.ViewChild, args: ['searchInput', { static: true },] }],
|
|
4713
3278
|
ngOptions: [{ type: i0.ContentChildren, args: [NgOptionComponent, { descendants: true },] }],
|
|
4714
3279
|
disabled: [{ type: i0.HostBinding, args: ['class.ng-select-disabled',] }],
|
|
4715
3280
|
filtered: [{ type: i0.HostBinding, args: ['class.ng-select-filtered',] }],
|
|
4716
3281
|
handleKeyDown: [{ type: i0.HostListener, args: ['keydown', ['$event'],] }]
|
|
4717
3282
|
};
|
|
4718
|
-
if (false) {
|
|
4719
|
-
/** @type {?} */
|
|
4720
|
-
NgSelectComponent.prototype.bindLabel;
|
|
4721
|
-
/** @type {?} */
|
|
4722
|
-
NgSelectComponent.prototype.bindValue;
|
|
4723
|
-
/** @type {?} */
|
|
4724
|
-
NgSelectComponent.prototype.markFirst;
|
|
4725
|
-
/** @type {?} */
|
|
4726
|
-
NgSelectComponent.prototype.placeholder;
|
|
4727
|
-
/** @type {?} */
|
|
4728
|
-
NgSelectComponent.prototype.notFoundText;
|
|
4729
|
-
/** @type {?} */
|
|
4730
|
-
NgSelectComponent.prototype.typeToSearchText;
|
|
4731
|
-
/** @type {?} */
|
|
4732
|
-
NgSelectComponent.prototype.addTagText;
|
|
4733
|
-
/** @type {?} */
|
|
4734
|
-
NgSelectComponent.prototype.loadingText;
|
|
4735
|
-
/** @type {?} */
|
|
4736
|
-
NgSelectComponent.prototype.clearAllText;
|
|
4737
|
-
/** @type {?} */
|
|
4738
|
-
NgSelectComponent.prototype.appearance;
|
|
4739
|
-
/** @type {?} */
|
|
4740
|
-
NgSelectComponent.prototype.dropdownPosition;
|
|
4741
|
-
/** @type {?} */
|
|
4742
|
-
NgSelectComponent.prototype.appendTo;
|
|
4743
|
-
/** @type {?} */
|
|
4744
|
-
NgSelectComponent.prototype.loading;
|
|
4745
|
-
/** @type {?} */
|
|
4746
|
-
NgSelectComponent.prototype.closeOnSelect;
|
|
4747
|
-
/** @type {?} */
|
|
4748
|
-
NgSelectComponent.prototype.hideSelected;
|
|
4749
|
-
/** @type {?} */
|
|
4750
|
-
NgSelectComponent.prototype.selectOnTab;
|
|
4751
|
-
/** @type {?} */
|
|
4752
|
-
NgSelectComponent.prototype.openOnEnter;
|
|
4753
|
-
/** @type {?} */
|
|
4754
|
-
NgSelectComponent.prototype.maxSelectedItems;
|
|
4755
|
-
/** @type {?} */
|
|
4756
|
-
NgSelectComponent.prototype.groupBy;
|
|
4757
|
-
/** @type {?} */
|
|
4758
|
-
NgSelectComponent.prototype.groupValue;
|
|
4759
|
-
/** @type {?} */
|
|
4760
|
-
NgSelectComponent.prototype.bufferAmount;
|
|
4761
|
-
/** @type {?} */
|
|
4762
|
-
NgSelectComponent.prototype.virtualScroll;
|
|
4763
|
-
/** @type {?} */
|
|
4764
|
-
NgSelectComponent.prototype.selectableGroup;
|
|
4765
|
-
/** @type {?} */
|
|
4766
|
-
NgSelectComponent.prototype.selectableGroupAsModel;
|
|
4767
|
-
/** @type {?} */
|
|
4768
|
-
NgSelectComponent.prototype.searchFn;
|
|
4769
|
-
/** @type {?} */
|
|
4770
|
-
NgSelectComponent.prototype.trackByFn;
|
|
4771
|
-
/** @type {?} */
|
|
4772
|
-
NgSelectComponent.prototype.clearOnBackspace;
|
|
4773
|
-
/** @type {?} */
|
|
4774
|
-
NgSelectComponent.prototype.labelForId;
|
|
4775
|
-
/** @type {?} */
|
|
4776
|
-
NgSelectComponent.prototype.inputAttrs;
|
|
4777
|
-
/** @type {?} */
|
|
4778
|
-
NgSelectComponent.prototype.tabIndex;
|
|
4779
|
-
/** @type {?} */
|
|
4780
|
-
NgSelectComponent.prototype.readonly;
|
|
4781
|
-
/** @type {?} */
|
|
4782
|
-
NgSelectComponent.prototype.searchWhileComposing;
|
|
4783
|
-
/** @type {?} */
|
|
4784
|
-
NgSelectComponent.prototype.minTermLength;
|
|
4785
|
-
/** @type {?} */
|
|
4786
|
-
NgSelectComponent.prototype.editableSearchTerm;
|
|
4787
|
-
/** @type {?} */
|
|
4788
|
-
NgSelectComponent.prototype.keyDownFn;
|
|
4789
|
-
/** @type {?} */
|
|
4790
|
-
NgSelectComponent.prototype.typeahead;
|
|
4791
|
-
/** @type {?} */
|
|
4792
|
-
NgSelectComponent.prototype.multiple;
|
|
4793
|
-
/** @type {?} */
|
|
4794
|
-
NgSelectComponent.prototype.addTag;
|
|
4795
|
-
/** @type {?} */
|
|
4796
|
-
NgSelectComponent.prototype.searchable;
|
|
4797
|
-
/** @type {?} */
|
|
4798
|
-
NgSelectComponent.prototype.clearable;
|
|
4799
|
-
/** @type {?} */
|
|
4800
|
-
NgSelectComponent.prototype.isOpen;
|
|
4801
|
-
/** @type {?} */
|
|
4802
|
-
NgSelectComponent.prototype.blurEvent;
|
|
4803
|
-
/** @type {?} */
|
|
4804
|
-
NgSelectComponent.prototype.focusEvent;
|
|
4805
|
-
/** @type {?} */
|
|
4806
|
-
NgSelectComponent.prototype.changeEvent;
|
|
4807
|
-
/** @type {?} */
|
|
4808
|
-
NgSelectComponent.prototype.openEvent;
|
|
4809
|
-
/** @type {?} */
|
|
4810
|
-
NgSelectComponent.prototype.closeEvent;
|
|
4811
|
-
/** @type {?} */
|
|
4812
|
-
NgSelectComponent.prototype.searchEvent;
|
|
4813
|
-
/** @type {?} */
|
|
4814
|
-
NgSelectComponent.prototype.clearEvent;
|
|
4815
|
-
/** @type {?} */
|
|
4816
|
-
NgSelectComponent.prototype.addEvent;
|
|
4817
|
-
/** @type {?} */
|
|
4818
|
-
NgSelectComponent.prototype.removeEvent;
|
|
4819
|
-
/** @type {?} */
|
|
4820
|
-
NgSelectComponent.prototype.scroll;
|
|
4821
|
-
/** @type {?} */
|
|
4822
|
-
NgSelectComponent.prototype.scrollToEnd;
|
|
4823
|
-
/** @type {?} */
|
|
4824
|
-
NgSelectComponent.prototype.optionTemplate;
|
|
4825
|
-
/** @type {?} */
|
|
4826
|
-
NgSelectComponent.prototype.optgroupTemplate;
|
|
4827
|
-
/** @type {?} */
|
|
4828
|
-
NgSelectComponent.prototype.labelTemplate;
|
|
4829
|
-
/** @type {?} */
|
|
4830
|
-
NgSelectComponent.prototype.multiLabelTemplate;
|
|
4831
|
-
/** @type {?} */
|
|
4832
|
-
NgSelectComponent.prototype.headerTemplate;
|
|
4833
|
-
/** @type {?} */
|
|
4834
|
-
NgSelectComponent.prototype.footerTemplate;
|
|
4835
|
-
/** @type {?} */
|
|
4836
|
-
NgSelectComponent.prototype.notFoundTemplate;
|
|
4837
|
-
/** @type {?} */
|
|
4838
|
-
NgSelectComponent.prototype.typeToSearchTemplate;
|
|
4839
|
-
/** @type {?} */
|
|
4840
|
-
NgSelectComponent.prototype.loadingTextTemplate;
|
|
4841
|
-
/** @type {?} */
|
|
4842
|
-
NgSelectComponent.prototype.tagTemplate;
|
|
4843
|
-
/** @type {?} */
|
|
4844
|
-
NgSelectComponent.prototype.loadingSpinnerTemplate;
|
|
4845
|
-
/** @type {?} */
|
|
4846
|
-
NgSelectComponent.prototype.dropdownPanel;
|
|
4847
|
-
/** @type {?} */
|
|
4848
|
-
NgSelectComponent.prototype.searchInput;
|
|
4849
|
-
/** @type {?} */
|
|
4850
|
-
NgSelectComponent.prototype.ngOptions;
|
|
4851
|
-
/** @type {?} */
|
|
4852
|
-
NgSelectComponent.prototype.itemsList;
|
|
4853
|
-
/** @type {?} */
|
|
4854
|
-
NgSelectComponent.prototype.viewPortItems;
|
|
4855
|
-
/** @type {?} */
|
|
4856
|
-
NgSelectComponent.prototype.searchTerm;
|
|
4857
|
-
/** @type {?} */
|
|
4858
|
-
NgSelectComponent.prototype.dropdownId;
|
|
4859
|
-
/** @type {?} */
|
|
4860
|
-
NgSelectComponent.prototype.element;
|
|
4861
|
-
/** @type {?} */
|
|
4862
|
-
NgSelectComponent.prototype.focused;
|
|
4863
|
-
/** @type {?} */
|
|
4864
|
-
NgSelectComponent.prototype.escapeHTML;
|
|
4865
|
-
/** @type {?} */
|
|
4866
|
-
NgSelectComponent.prototype.useDefaultClass;
|
|
4867
|
-
/**
|
|
4868
|
-
* @type {?}
|
|
4869
|
-
* @private
|
|
4870
|
-
*/
|
|
4871
|
-
NgSelectComponent.prototype._items;
|
|
4872
|
-
/**
|
|
4873
|
-
* @type {?}
|
|
4874
|
-
* @private
|
|
4875
|
-
*/
|
|
4876
|
-
NgSelectComponent.prototype._itemsAreUsed;
|
|
4877
|
-
/**
|
|
4878
|
-
* @type {?}
|
|
4879
|
-
* @private
|
|
4880
|
-
*/
|
|
4881
|
-
NgSelectComponent.prototype._defaultLabel;
|
|
4882
|
-
/**
|
|
4883
|
-
* @type {?}
|
|
4884
|
-
* @private
|
|
4885
|
-
*/
|
|
4886
|
-
NgSelectComponent.prototype._primitive;
|
|
4887
|
-
/**
|
|
4888
|
-
* @type {?}
|
|
4889
|
-
* @private
|
|
4890
|
-
*/
|
|
4891
|
-
NgSelectComponent.prototype._manualOpen;
|
|
4892
|
-
/**
|
|
4893
|
-
* @type {?}
|
|
4894
|
-
* @private
|
|
4895
|
-
*/
|
|
4896
|
-
NgSelectComponent.prototype._disabled;
|
|
4897
|
-
/**
|
|
4898
|
-
* @type {?}
|
|
4899
|
-
* @private
|
|
4900
|
-
*/
|
|
4901
|
-
NgSelectComponent.prototype._pressedKeys;
|
|
4902
|
-
/**
|
|
4903
|
-
* @type {?}
|
|
4904
|
-
* @private
|
|
4905
|
-
*/
|
|
4906
|
-
NgSelectComponent.prototype._compareWith;
|
|
4907
|
-
/**
|
|
4908
|
-
* @type {?}
|
|
4909
|
-
* @private
|
|
4910
|
-
*/
|
|
4911
|
-
NgSelectComponent.prototype._clearSearchOnAdd;
|
|
4912
|
-
/**
|
|
4913
|
-
* @type {?}
|
|
4914
|
-
* @private
|
|
4915
|
-
*/
|
|
4916
|
-
NgSelectComponent.prototype._isComposing;
|
|
4917
|
-
/**
|
|
4918
|
-
* @type {?}
|
|
4919
|
-
* @private
|
|
4920
|
-
*/
|
|
4921
|
-
NgSelectComponent.prototype._destroy$;
|
|
4922
|
-
/**
|
|
4923
|
-
* @type {?}
|
|
4924
|
-
* @private
|
|
4925
|
-
*/
|
|
4926
|
-
NgSelectComponent.prototype._keyPress$;
|
|
4927
|
-
/**
|
|
4928
|
-
* @type {?}
|
|
4929
|
-
* @private
|
|
4930
|
-
*/
|
|
4931
|
-
NgSelectComponent.prototype._onChange;
|
|
4932
|
-
/**
|
|
4933
|
-
* @type {?}
|
|
4934
|
-
* @private
|
|
4935
|
-
*/
|
|
4936
|
-
NgSelectComponent.prototype._onTouched;
|
|
4937
|
-
/** @type {?} */
|
|
4938
|
-
NgSelectComponent.prototype.clearItem;
|
|
4939
|
-
/** @type {?} */
|
|
4940
|
-
NgSelectComponent.prototype.trackByOption;
|
|
4941
|
-
/** @type {?} */
|
|
4942
|
-
NgSelectComponent.prototype.classes;
|
|
4943
|
-
/**
|
|
4944
|
-
* @type {?}
|
|
4945
|
-
* @private
|
|
4946
|
-
*/
|
|
4947
|
-
NgSelectComponent.prototype.autoFocus;
|
|
4948
|
-
/**
|
|
4949
|
-
* @type {?}
|
|
4950
|
-
* @private
|
|
4951
|
-
*/
|
|
4952
|
-
NgSelectComponent.prototype._cd;
|
|
4953
|
-
/**
|
|
4954
|
-
* @type {?}
|
|
4955
|
-
* @private
|
|
4956
|
-
*/
|
|
4957
|
-
NgSelectComponent.prototype._console;
|
|
4958
|
-
/* Skipping unhandled member: ;*/
|
|
4959
|
-
/* Skipping unhandled member: ;*/
|
|
4960
|
-
/* Skipping unhandled member: ;*/
|
|
4961
|
-
/* Skipping unhandled member: ;*/
|
|
4962
|
-
/* Skipping unhandled member: ;*/
|
|
4963
|
-
/* Skipping unhandled member: ;*/
|
|
4964
|
-
}
|
|
4965
3283
|
|
|
4966
|
-
/**
|
|
4967
|
-
* @fileoverview added by tsickle
|
|
4968
|
-
* Generated from: lib/selection-model.ts
|
|
4969
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4970
|
-
*/
|
|
4971
|
-
/**
|
|
4972
|
-
* @return {?}
|
|
4973
|
-
*/
|
|
4974
3284
|
function DefaultSelectionModelFactory() {
|
|
4975
3285
|
return new DefaultSelectionModel();
|
|
4976
3286
|
}
|
|
4977
|
-
/**
|
|
4978
|
-
* @record
|
|
4979
|
-
*/
|
|
4980
|
-
function SelectionModel() { }
|
|
4981
|
-
if (false) {
|
|
4982
|
-
/** @type {?} */
|
|
4983
|
-
SelectionModel.prototype.value;
|
|
4984
|
-
/**
|
|
4985
|
-
* @param {?} item
|
|
4986
|
-
* @param {?} multiple
|
|
4987
|
-
* @param {?} selectableGroupAsModel
|
|
4988
|
-
* @return {?}
|
|
4989
|
-
*/
|
|
4990
|
-
SelectionModel.prototype.select = function (item, multiple, selectableGroupAsModel) { };
|
|
4991
|
-
/**
|
|
4992
|
-
* @param {?} item
|
|
4993
|
-
* @param {?} multiple
|
|
4994
|
-
* @return {?}
|
|
4995
|
-
*/
|
|
4996
|
-
SelectionModel.prototype.unselect = function (item, multiple) { };
|
|
4997
|
-
/**
|
|
4998
|
-
* @param {?} keepDisabled
|
|
4999
|
-
* @return {?}
|
|
5000
|
-
*/
|
|
5001
|
-
SelectionModel.prototype.clear = function (keepDisabled) { };
|
|
5002
|
-
}
|
|
5003
3287
|
var DefaultSelectionModel = /** @class */ (function () {
|
|
5004
3288
|
function DefaultSelectionModel() {
|
|
5005
3289
|
this._selected = [];
|
|
5006
3290
|
}
|
|
5007
3291
|
Object.defineProperty(DefaultSelectionModel.prototype, "value", {
|
|
5008
|
-
/**
|
|
5009
|
-
* @return {?}
|
|
5010
|
-
*/
|
|
5011
3292
|
get: function () {
|
|
5012
3293
|
return this._selected;
|
|
5013
3294
|
},
|
|
5014
3295
|
enumerable: false,
|
|
5015
3296
|
configurable: true
|
|
5016
3297
|
});
|
|
5017
|
-
/**
|
|
5018
|
-
* @param {?} item
|
|
5019
|
-
* @param {?} multiple
|
|
5020
|
-
* @param {?} groupAsModel
|
|
5021
|
-
* @return {?}
|
|
5022
|
-
*/
|
|
5023
3298
|
DefaultSelectionModel.prototype.select = function (item, multiple, groupAsModel) {
|
|
5024
3299
|
item.selected = true;
|
|
5025
3300
|
if (!item.children || (!multiple && groupAsModel)) {
|
|
@@ -5027,70 +3302,32 @@
|
|
|
5027
3302
|
}
|
|
5028
3303
|
if (multiple) {
|
|
5029
3304
|
if (item.parent) {
|
|
5030
|
-
/** @type {?} */
|
|
5031
3305
|
var childrenCount = item.parent.children.length;
|
|
5032
|
-
|
|
5033
|
-
var selectedCount = item.parent.children.filter(( /**
|
|
5034
|
-
* @param {?} x
|
|
5035
|
-
* @return {?}
|
|
5036
|
-
*/function (/**
|
|
5037
|
-
* @param {?} x
|
|
5038
|
-
* @return {?}
|
|
5039
|
-
*/ x) { return x.selected; })).length;
|
|
3306
|
+
var selectedCount = item.parent.children.filter(function (x) { return x.selected; }).length;
|
|
5040
3307
|
item.parent.selected = childrenCount === selectedCount;
|
|
5041
3308
|
}
|
|
5042
3309
|
else if (item.children) {
|
|
5043
3310
|
this._setChildrenSelectedState(item.children, true);
|
|
5044
3311
|
this._removeChildren(item);
|
|
5045
3312
|
if (groupAsModel && this._activeChildren(item)) {
|
|
5046
|
-
this._selected = __spread(this._selected.filter((
|
|
5047
|
-
* @param {?} x
|
|
5048
|
-
* @return {?}
|
|
5049
|
-
*/function (/**
|
|
5050
|
-
* @param {?} x
|
|
5051
|
-
* @return {?}
|
|
5052
|
-
*/ x) { return x.parent !== item; })), [item]);
|
|
3313
|
+
this._selected = __spread(this._selected.filter(function (x) { return x.parent !== item; }), [item]);
|
|
5053
3314
|
}
|
|
5054
3315
|
else {
|
|
5055
|
-
this._selected = __spread(this._selected, item.children.filter((
|
|
5056
|
-
* @param {?} x
|
|
5057
|
-
* @return {?}
|
|
5058
|
-
*/function (/**
|
|
5059
|
-
* @param {?} x
|
|
5060
|
-
* @return {?}
|
|
5061
|
-
*/ x) { return !x.disabled; })));
|
|
3316
|
+
this._selected = __spread(this._selected, item.children.filter(function (x) { return !x.disabled; }));
|
|
5062
3317
|
}
|
|
5063
3318
|
}
|
|
5064
3319
|
}
|
|
5065
3320
|
};
|
|
5066
|
-
/**
|
|
5067
|
-
* @param {?} item
|
|
5068
|
-
* @param {?} multiple
|
|
5069
|
-
* @return {?}
|
|
5070
|
-
*/
|
|
5071
3321
|
DefaultSelectionModel.prototype.unselect = function (item, multiple) {
|
|
5072
3322
|
var _a;
|
|
5073
|
-
this._selected = this._selected.filter((
|
|
5074
|
-
* @param {?} x
|
|
5075
|
-
* @return {?}
|
|
5076
|
-
*/function (/**
|
|
5077
|
-
* @param {?} x
|
|
5078
|
-
* @return {?}
|
|
5079
|
-
*/ x) { return x !== item; }));
|
|
3323
|
+
this._selected = this._selected.filter(function (x) { return x !== item; });
|
|
5080
3324
|
item.selected = false;
|
|
5081
3325
|
if (multiple) {
|
|
5082
3326
|
if (item.parent && item.parent.selected) {
|
|
5083
|
-
/** @type {?} */
|
|
5084
3327
|
var children = item.parent.children;
|
|
5085
3328
|
this._removeParent(item.parent);
|
|
5086
3329
|
this._removeChildren(item.parent);
|
|
5087
|
-
(_a = this._selected).push.apply(_a, __spread(children.filter((
|
|
5088
|
-
* @param {?} x
|
|
5089
|
-
* @return {?}
|
|
5090
|
-
*/function (/**
|
|
5091
|
-
* @param {?} x
|
|
5092
|
-
* @return {?}
|
|
5093
|
-
*/ x) { return x !== item && !x.disabled; }))));
|
|
3330
|
+
(_a = this._selected).push.apply(_a, __spread(children.filter(function (x) { return x !== item && !x.disabled; })));
|
|
5094
3331
|
item.parent.selected = false;
|
|
5095
3332
|
}
|
|
5096
3333
|
else if (item.children) {
|
|
@@ -5099,25 +3336,9 @@
|
|
|
5099
3336
|
}
|
|
5100
3337
|
}
|
|
5101
3338
|
};
|
|
5102
|
-
/**
|
|
5103
|
-
* @param {?} keepDisabled
|
|
5104
|
-
* @return {?}
|
|
5105
|
-
*/
|
|
5106
3339
|
DefaultSelectionModel.prototype.clear = function (keepDisabled) {
|
|
5107
|
-
this._selected = keepDisabled ? this._selected.filter((
|
|
5108
|
-
* @param {?} x
|
|
5109
|
-
* @return {?}
|
|
5110
|
-
*/function (/**
|
|
5111
|
-
* @param {?} x
|
|
5112
|
-
* @return {?}
|
|
5113
|
-
*/ x) { return x.disabled; })) : [];
|
|
3340
|
+
this._selected = keepDisabled ? this._selected.filter(function (x) { return x.disabled; }) : [];
|
|
5114
3341
|
};
|
|
5115
|
-
/**
|
|
5116
|
-
* @private
|
|
5117
|
-
* @param {?} children
|
|
5118
|
-
* @param {?} selected
|
|
5119
|
-
* @return {?}
|
|
5120
|
-
*/
|
|
5121
3342
|
DefaultSelectionModel.prototype._setChildrenSelectedState = function (children, selected) {
|
|
5122
3343
|
var e_1, _a;
|
|
5123
3344
|
try {
|
|
@@ -5138,69 +3359,18 @@
|
|
|
5138
3359
|
}
|
|
5139
3360
|
;
|
|
5140
3361
|
};
|
|
5141
|
-
/**
|
|
5142
|
-
* @private
|
|
5143
|
-
* @param {?} parent
|
|
5144
|
-
* @return {?}
|
|
5145
|
-
*/
|
|
5146
3362
|
DefaultSelectionModel.prototype._removeChildren = function (parent) {
|
|
5147
|
-
this._selected = __spread(this._selected.filter((
|
|
5148
|
-
* @param {?} x
|
|
5149
|
-
* @return {?}
|
|
5150
|
-
*/function (/**
|
|
5151
|
-
* @param {?} x
|
|
5152
|
-
* @return {?}
|
|
5153
|
-
*/ x) { return x.parent !== parent; })), parent.children.filter(( /**
|
|
5154
|
-
* @param {?} x
|
|
5155
|
-
* @return {?}
|
|
5156
|
-
*/function (/**
|
|
5157
|
-
* @param {?} x
|
|
5158
|
-
* @return {?}
|
|
5159
|
-
*/ x) { return x.parent === parent && x.disabled && x.selected; })));
|
|
3363
|
+
this._selected = __spread(this._selected.filter(function (x) { return x.parent !== parent; }), parent.children.filter(function (x) { return x.parent === parent && x.disabled && x.selected; }));
|
|
5160
3364
|
};
|
|
5161
|
-
/**
|
|
5162
|
-
* @private
|
|
5163
|
-
* @param {?} parent
|
|
5164
|
-
* @return {?}
|
|
5165
|
-
*/
|
|
5166
3365
|
DefaultSelectionModel.prototype._removeParent = function (parent) {
|
|
5167
|
-
this._selected = this._selected.filter((
|
|
5168
|
-
* @param {?} x
|
|
5169
|
-
* @return {?}
|
|
5170
|
-
*/function (/**
|
|
5171
|
-
* @param {?} x
|
|
5172
|
-
* @return {?}
|
|
5173
|
-
*/ x) { return x !== parent; }));
|
|
3366
|
+
this._selected = this._selected.filter(function (x) { return x !== parent; });
|
|
5174
3367
|
};
|
|
5175
|
-
/**
|
|
5176
|
-
* @private
|
|
5177
|
-
* @param {?} item
|
|
5178
|
-
* @return {?}
|
|
5179
|
-
*/
|
|
5180
3368
|
DefaultSelectionModel.prototype._activeChildren = function (item) {
|
|
5181
|
-
return item.children.every((
|
|
5182
|
-
* @param {?} x
|
|
5183
|
-
* @return {?}
|
|
5184
|
-
*/function (/**
|
|
5185
|
-
* @param {?} x
|
|
5186
|
-
* @return {?}
|
|
5187
|
-
*/ x) { return !x.disabled || x.selected; }));
|
|
3369
|
+
return item.children.every(function (x) { return !x.disabled || x.selected; });
|
|
5188
3370
|
};
|
|
5189
3371
|
return DefaultSelectionModel;
|
|
5190
3372
|
}());
|
|
5191
|
-
if (false) {
|
|
5192
|
-
/**
|
|
5193
|
-
* @type {?}
|
|
5194
|
-
* @private
|
|
5195
|
-
*/
|
|
5196
|
-
DefaultSelectionModel.prototype._selected;
|
|
5197
|
-
}
|
|
5198
3373
|
|
|
5199
|
-
/**
|
|
5200
|
-
* @fileoverview added by tsickle
|
|
5201
|
-
* Generated from: lib/ng-select.module.ts
|
|
5202
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5203
|
-
*/
|
|
5204
3374
|
var ɵ0 = DefaultSelectionModelFactory;
|
|
5205
3375
|
var NgSelectModule = /** @class */ (function () {
|
|
5206
3376
|
function NgSelectModule() {
|
|
@@ -5250,16 +3420,12 @@
|
|
|
5250
3420
|
},] }
|
|
5251
3421
|
];
|
|
5252
3422
|
|
|
5253
|
-
|
|
5254
|
-
*
|
|
5255
|
-
* Generated from: public-api.ts
|
|
5256
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3423
|
+
/*
|
|
3424
|
+
* Public API Surface of ng-select
|
|
5257
3425
|
*/
|
|
5258
3426
|
|
|
5259
3427
|
/**
|
|
5260
|
-
*
|
|
5261
|
-
* Generated from: ng-select-ng-select.ts
|
|
5262
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3428
|
+
* Generated bundle index. Do not edit.
|
|
5263
3429
|
*/
|
|
5264
3430
|
|
|
5265
3431
|
exports.NgSelectComponent = NgSelectComponent;
|