-
Notifications
You must be signed in to change notification settings - Fork 6.8k
/
selection-list.ts
738 lines (628 loc) · 23.9 KB
/
selection-list.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {FocusableOption, FocusKeyManager, FocusMonitor} from '@angular/cdk/a11y';
import {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';
import {SelectionModel} from '@angular/cdk/collections';
import {
A,
DOWN_ARROW,
ENTER,
hasModifierKey,
SPACE,
UP_ARROW,
} from '@angular/cdk/keycodes';
import {
AfterContentInit,
Attribute,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ContentChild,
ContentChildren,
ElementRef,
EventEmitter,
forwardRef,
Inject,
Input,
OnChanges,
OnDestroy,
OnInit,
Output,
QueryList,
SimpleChanges,
ViewChild,
ViewEncapsulation,
} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
import {
CanDisableRipple,
CanDisableRippleCtor,
MatLine,
mixinDisableRipple,
setLines,
ThemePalette,
} from '@angular/material/core';
import {Subject} from 'rxjs';
import {startWith, takeUntil} from 'rxjs/operators';
import {MatListAvatarCssMatStyler, MatListIconCssMatStyler} from './list';
class MatSelectionListBase {}
const _MatSelectionListMixinBase: CanDisableRippleCtor & typeof MatSelectionListBase =
mixinDisableRipple(MatSelectionListBase);
class MatListOptionBase {}
const _MatListOptionMixinBase: CanDisableRippleCtor & typeof MatListOptionBase =
mixinDisableRipple(MatListOptionBase);
/** @docs-private */
export const MAT_SELECTION_LIST_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => MatSelectionList),
multi: true
};
/** Change event that is being fired whenever the selected state of an option changes. */
export class MatSelectionListChange {
constructor(
/** Reference to the selection list that emitted the event. */
public source: MatSelectionList,
/**
* Reference to the option that has been changed.
* @deprecated Use `options` instead, because some events may change more than one option.
* @breaking-change 12.0.0
*/
public option: MatListOption,
/** Reference to the options that have been changed. */
public options: MatListOption[]) {}
}
/**
* Type describing possible positions of a checkbox in a list option
* with respect to the list item's text.
*/
export type MatListOptionCheckboxPosition = 'before'|'after';
/**
* Component for list-options of selection-list. Each list-option can automatically
* generate a checkbox and can put current item into the selectionModel of selection-list
* if the current item is selected.
*/
@Component({
selector: 'mat-list-option',
exportAs: 'matListOption',
inputs: ['disableRipple'],
host: {
'role': 'option',
'class': 'mat-list-item mat-list-option mat-focus-indicator',
'(focus)': '_handleFocus()',
'(blur)': '_handleBlur()',
'(click)': '_handleClick()',
'[class.mat-list-item-disabled]': 'disabled',
'[class.mat-list-item-with-avatar]': '_avatar || _icon',
// Manually set the "primary" or "warn" class if the color has been explicitly
// set to "primary" or "warn". The pseudo checkbox picks up these classes for
// its theme.
'[class.mat-primary]': 'color === "primary"',
// Even though accent is the default, we need to set this class anyway, because the list might
// be placed inside a parent that has one of the other colors with a higher specificity.
'[class.mat-accent]': 'color !== "primary" && color !== "warn"',
'[class.mat-warn]': 'color === "warn"',
'[class.mat-list-single-selected-option]': 'selected && !selectionList.multiple',
'[attr.aria-selected]': 'selected',
'[attr.aria-disabled]': 'disabled',
'[attr.tabindex]': '-1',
},
templateUrl: 'list-option.html',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MatListOption extends _MatListOptionMixinBase implements AfterContentInit, OnDestroy,
OnInit, FocusableOption,
CanDisableRipple {
private _selected = false;
private _disabled = false;
private _hasFocus = false;
@ContentChild(MatListAvatarCssMatStyler) _avatar: MatListAvatarCssMatStyler;
@ContentChild(MatListIconCssMatStyler) _icon: MatListIconCssMatStyler;
@ContentChildren(MatLine, {descendants: true}) _lines: QueryList<MatLine>;
/** DOM element containing the item's text. */
@ViewChild('text') _text: ElementRef;
/** Whether the label should appear before or after the checkbox. Defaults to 'after' */
@Input() checkboxPosition: MatListOptionCheckboxPosition = 'after';
/** Theme color of the list option. This sets the color of the checkbox. */
@Input()
get color(): ThemePalette { return this._color || this.selectionList.color; }
set color(newValue: ThemePalette) { this._color = newValue; }
private _color: ThemePalette;
/**
* This is set to true after the first OnChanges cycle so we don't clear the value of `selected`
* in the first cycle.
*/
private _inputsInitialized = false;
/** Value of the option */
@Input()
get value(): any { return this._value; }
set value(newValue: any) {
if (
this.selected &&
!this.selectionList.compareWith(newValue, this.value) &&
this._inputsInitialized
) {
this.selected = false;
}
this._value = newValue;
}
private _value: any;
/** Whether the option is disabled. */
@Input()
get disabled() { return this._disabled || (this.selectionList && this.selectionList.disabled); }
set disabled(value: any) {
const newValue = coerceBooleanProperty(value);
if (newValue !== this._disabled) {
this._disabled = newValue;
this._changeDetector.markForCheck();
}
}
/** Whether the option is selected. */
@Input()
get selected(): boolean { return this.selectionList.selectedOptions.isSelected(this); }
set selected(value: boolean) {
const isSelected = coerceBooleanProperty(value);
if (isSelected !== this._selected) {
this._setSelected(isSelected);
this.selectionList._reportValueChange();
}
}
constructor(private _element: ElementRef<HTMLElement>,
private _changeDetector: ChangeDetectorRef,
/** @docs-private */
@Inject(forwardRef(() => MatSelectionList)) public selectionList: MatSelectionList) {
super();
}
ngOnInit() {
const list = this.selectionList;
if (list._value && list._value.some(value => list.compareWith(value, this._value))) {
this._setSelected(true);
}
const wasSelected = this._selected;
// List options that are selected at initialization can't be reported properly to the form
// control. This is because it takes some time until the selection-list knows about all
// available options. Also it can happen that the ControlValueAccessor has an initial value
// that should be used instead. Deferring the value change report to the next tick ensures
// that the form control value is not being overwritten.
Promise.resolve().then(() => {
if (this._selected || wasSelected) {
this.selected = true;
this._changeDetector.markForCheck();
}
});
this._inputsInitialized = true;
}
ngAfterContentInit() {
setLines(this._lines, this._element);
}
ngOnDestroy(): void {
if (this.selected) {
// We have to delay this until the next tick in order
// to avoid changed after checked errors.
Promise.resolve().then(() => {
this.selected = false;
});
}
const hadFocus = this._hasFocus;
const newActiveItem = this.selectionList._removeOptionFromList(this);
// Only move focus if this option was focused at the time it was destroyed.
if (hadFocus && newActiveItem) {
newActiveItem.focus();
}
}
/** Toggles the selection state of the option. */
toggle(): void {
this.selected = !this.selected;
}
/** Allows for programmatic focusing of the option. */
focus(): void {
this._element.nativeElement.focus();
}
/**
* Returns the list item's text label. Implemented as a part of the FocusKeyManager.
* @docs-private
*/
getLabel() {
return this._text ? (this._text.nativeElement.textContent || '') : '';
}
/** Whether this list item should show a ripple effect when clicked. */
_isRippleDisabled() {
return this.disabled || this.disableRipple || this.selectionList.disableRipple;
}
_handleClick() {
if (!this.disabled && (this.selectionList.multiple || !this.selected)) {
this.toggle();
// Emit a change event if the selected state of the option changed through user interaction.
this.selectionList._emitChangeEvent([this]);
}
}
_handleFocus() {
this.selectionList._setFocusedOption(this);
this._hasFocus = true;
}
_handleBlur() {
this.selectionList._onTouched();
this._hasFocus = false;
}
/** Retrieves the DOM element of the component host. */
_getHostElement(): HTMLElement {
return this._element.nativeElement;
}
/** Sets the selected state of the option. Returns whether the value has changed. */
_setSelected(selected: boolean): boolean {
if (selected === this._selected) {
return false;
}
this._selected = selected;
if (selected) {
this.selectionList.selectedOptions.select(this);
} else {
this.selectionList.selectedOptions.deselect(this);
}
this._changeDetector.markForCheck();
return true;
}
/**
* Notifies Angular that the option needs to be checked in the next change detection run. Mainly
* used to trigger an update of the list option if the disabled state of the selection list
* changed.
*/
_markForCheck() {
this._changeDetector.markForCheck();
}
static ngAcceptInputType_disabled: BooleanInput;
static ngAcceptInputType_selected: BooleanInput;
static ngAcceptInputType_disableRipple: BooleanInput;
}
/**
* Material Design list component where each item is a selectable option. Behaves as a listbox.
*/
@Component({
selector: 'mat-selection-list',
exportAs: 'matSelectionList',
inputs: ['disableRipple'],
host: {
'role': 'listbox',
'class': 'mat-selection-list mat-list-base',
'(keydown)': '_keydown($event)',
'[attr.aria-multiselectable]': 'multiple',
'[attr.aria-disabled]': 'disabled.toString()',
'[attr.tabindex]': '_tabIndex',
},
template: '<ng-content></ng-content>',
styleUrls: ['list.css'],
encapsulation: ViewEncapsulation.None,
providers: [MAT_SELECTION_LIST_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MatSelectionList extends _MatSelectionListMixinBase implements CanDisableRipple,
AfterContentInit, ControlValueAccessor, OnDestroy, OnChanges {
private _multiple = true;
private _contentInitialized = false;
/** The FocusKeyManager which handles focus. */
_keyManager: FocusKeyManager<MatListOption>;
/** The option components contained within this selection-list. */
@ContentChildren(MatListOption, {descendants: true}) options: QueryList<MatListOption>;
/** Emits a change event whenever the selected state of an option changes. */
@Output() readonly selectionChange: EventEmitter<MatSelectionListChange> =
new EventEmitter<MatSelectionListChange>();
/**
* Tabindex of the selection list.
* @breaking-change 11.0.0 Remove `tabIndex` input.
*/
@Input() tabIndex: number = 0;
/** Theme color of the selection list. This sets the checkbox color for all list options. */
@Input() color: ThemePalette = 'accent';
/**
* Function used for comparing an option against the selected value when determining which
* options should appear as selected. The first argument is the value of an options. The second
* one is a value from the selected value. A boolean must be returned.
*/
@Input() compareWith: (o1: any, o2: any) => boolean = (a1, a2) => a1 === a2;
/** Whether the selection list is disabled. */
@Input()
get disabled(): boolean { return this._disabled; }
set disabled(value: boolean) {
this._disabled = coerceBooleanProperty(value);
// The `MatSelectionList` and `MatListOption` are using the `OnPush` change detection
// strategy. Therefore the options will not check for any changes if the `MatSelectionList`
// changed its state. Since we know that a change to `disabled` property of the list affects
// the state of the options, we manually mark each option for check.
this._markOptionsForCheck();
}
private _disabled: boolean = false;
/** Whether selection is limited to one or multiple items (default multiple). */
@Input()
get multiple(): boolean { return this._multiple; }
set multiple(value: boolean) {
const newValue = coerceBooleanProperty(value);
if (newValue !== this._multiple) {
if (this._contentInitialized && (typeof ngDevMode === 'undefined' || ngDevMode)) {
throw new Error(
'Cannot change `multiple` mode of mat-selection-list after initialization.');
}
this._multiple = newValue;
this.selectedOptions = new SelectionModel(this._multiple, this.selectedOptions.selected);
}
}
/** The currently selected options. */
selectedOptions = new SelectionModel<MatListOption>(this._multiple);
/** The tabindex of the selection list. */
_tabIndex = -1;
/** View to model callback that should be called whenever the selected options change. */
private _onChange: (value: any) => void = (_: any) => {};
/** Keeps track of the currently-selected value. */
_value: string[]|null;
/** Emits when the list has been destroyed. */
private _destroyed = new Subject<void>();
/** View to model callback that should be called if the list or its options lost focus. */
_onTouched: () => void = () => {};
/** Whether the list has been destroyed. */
private _isDestroyed: boolean;
constructor(private _element: ElementRef<HTMLElement>,
// @breaking-change 11.0.0 Remove `tabIndex` parameter.
@Attribute('tabindex') tabIndex: string,
private _changeDetector: ChangeDetectorRef,
// @breaking-change 11.0.0 `_focusMonitor` parameter to become required.
private _focusMonitor?: FocusMonitor) {
super();
}
ngAfterContentInit(): void {
this._contentInitialized = true;
this._keyManager = new FocusKeyManager<MatListOption>(this.options)
.withWrap()
.withTypeAhead()
.withHomeAndEnd()
// Allow disabled items to be focusable. For accessibility reasons, there must be a way for
// screenreader users, that allows reading the different options of the list.
.skipPredicate(() => false)
.withAllowedModifierKeys(['shiftKey']);
if (this._value) {
this._setOptionsFromValues(this._value);
}
// If the user attempts to tab out of the selection list, allow focus to escape.
this._keyManager.tabOut.pipe(takeUntil(this._destroyed)).subscribe(() => {
this._allowFocusEscape();
});
// When the number of options change, update the tabindex of the selection list.
this.options.changes.pipe(startWith(null), takeUntil(this._destroyed)).subscribe(() => {
this._updateTabIndex();
});
// Sync external changes to the model back to the options.
this.selectedOptions.changed.pipe(takeUntil(this._destroyed)).subscribe(event => {
if (event.added) {
for (let item of event.added) {
item.selected = true;
}
}
if (event.removed) {
for (let item of event.removed) {
item.selected = false;
}
}
});
// @breaking-change 11.0.0 Remove null assertion once _focusMonitor is required.
this._focusMonitor?.monitor(this._element)
.pipe(takeUntil(this._destroyed))
.subscribe(origin => {
if (origin === 'keyboard' || origin === 'program') {
const activeIndex = this._keyManager.activeItemIndex;
if (!activeIndex || activeIndex === -1) {
// If there is no active index, set focus to the first option.
this._keyManager.setFirstItemActive();
} else {
// Otherwise, set focus to the active option.
this._keyManager.setActiveItem(activeIndex);
}
}
});
}
ngOnChanges(changes: SimpleChanges) {
const disableRippleChanges = changes['disableRipple'];
const colorChanges = changes['color'];
if ((disableRippleChanges && !disableRippleChanges.firstChange) ||
(colorChanges && !colorChanges.firstChange)) {
this._markOptionsForCheck();
}
}
ngOnDestroy() {
// @breaking-change 11.0.0 Remove null assertion once _focusMonitor is required.
this._focusMonitor?.stopMonitoring(this._element);
this._destroyed.next();
this._destroyed.complete();
this._isDestroyed = true;
}
/** Focuses the selection list. */
focus(options?: FocusOptions) {
this._element.nativeElement.focus(options);
}
/** Selects all of the options. */
selectAll() {
this._setAllOptionsSelected(true);
}
/** Deselects all of the options. */
deselectAll() {
this._setAllOptionsSelected(false);
}
/** Sets the focused option of the selection-list. */
_setFocusedOption(option: MatListOption) {
this._keyManager.updateActiveItem(option);
}
/**
* Removes an option from the selection list and updates the active item.
* @returns Currently-active item.
*/
_removeOptionFromList(option: MatListOption): MatListOption | null {
const optionIndex = this._getOptionIndex(option);
if (optionIndex > -1 && this._keyManager.activeItemIndex === optionIndex) {
// Check whether the option is the last item
if (optionIndex > 0) {
this._keyManager.updateActiveItem(optionIndex - 1);
} else if (optionIndex === 0 && this.options.length > 1) {
this._keyManager.updateActiveItem(Math.min(optionIndex + 1, this.options.length - 1));
}
}
return this._keyManager.activeItem;
}
/** Passes relevant key presses to our key manager. */
_keydown(event: KeyboardEvent) {
const keyCode = event.keyCode;
const manager = this._keyManager;
const previousFocusIndex = manager.activeItemIndex;
const hasModifier = hasModifierKey(event);
switch (keyCode) {
case SPACE:
case ENTER:
if (!hasModifier && !manager.isTyping()) {
this._toggleFocusedOption();
// Always prevent space from scrolling the page since the list has focus
event.preventDefault();
}
break;
default:
// The "A" key gets special treatment, because it's used for the "select all" functionality.
if (keyCode === A && this.multiple && hasModifierKey(event, 'ctrlKey') &&
!manager.isTyping()) {
const shouldSelect = this.options.some(option => !option.disabled && !option.selected);
this._setAllOptionsSelected(shouldSelect, true, true);
event.preventDefault();
} else {
manager.onKeydown(event);
}
}
if (this.multiple && (keyCode === UP_ARROW || keyCode === DOWN_ARROW) && event.shiftKey &&
manager.activeItemIndex !== previousFocusIndex) {
this._toggleFocusedOption();
}
}
/** Reports a value change to the ControlValueAccessor */
_reportValueChange() {
// Stop reporting value changes after the list has been destroyed. This avoids
// cases where the list might wrongly reset its value once it is removed, but
// the form control is still live.
if (this.options && !this._isDestroyed) {
const value = this._getSelectedOptionValues();
this._onChange(value);
this._value = value;
}
}
/** Emits a change event if the selected state of an option changed. */
_emitChangeEvent(options: MatListOption[]) {
this.selectionChange.emit(new MatSelectionListChange(this, options[0], options));
}
/** Implemented as part of ControlValueAccessor. */
writeValue(values: string[]): void {
this._value = values;
if (this.options) {
this._setOptionsFromValues(values || []);
}
}
/** Implemented as a part of ControlValueAccessor. */
setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled;
}
/** Implemented as part of ControlValueAccessor. */
registerOnChange(fn: (value: any) => void): void {
this._onChange = fn;
}
/** Implemented as part of ControlValueAccessor. */
registerOnTouched(fn: () => void): void {
this._onTouched = fn;
}
/** Sets the selected options based on the specified values. */
private _setOptionsFromValues(values: string[]) {
this.options.forEach(option => option._setSelected(false));
values.forEach(value => {
const correspondingOption = this.options.find(option => {
// Skip options that are already in the model. This allows us to handle cases
// where the same primitive value is selected multiple times.
return option.selected ? false : this.compareWith(option.value, value);
});
if (correspondingOption) {
correspondingOption._setSelected(true);
}
});
}
/** Returns the values of the selected options. */
private _getSelectedOptionValues(): string[] {
return this.options.filter(option => option.selected).map(option => option.value);
}
/** Toggles the state of the currently focused option if enabled. */
private _toggleFocusedOption(): void {
let focusedIndex = this._keyManager.activeItemIndex;
if (focusedIndex != null && this._isValidIndex(focusedIndex)) {
let focusedOption: MatListOption = this.options.toArray()[focusedIndex];
if (focusedOption && !focusedOption.disabled && (this._multiple || !focusedOption.selected)) {
focusedOption.toggle();
// Emit a change event because the focused option changed its state through user
// interaction.
this._emitChangeEvent([focusedOption]);
}
}
}
/**
* Sets the selected state on all of the options
* and emits an event if anything changed.
*/
private _setAllOptionsSelected(
isSelected: boolean,
skipDisabled?: boolean,
isUserInput?: boolean) {
// Keep track of whether anything changed, because we only want to
// emit the changed event when something actually changed.
const changedOptions: MatListOption[] = [];
this.options.forEach(option => {
if ((!skipDisabled || !option.disabled) && option._setSelected(isSelected)) {
changedOptions.push(option);
}
});
if (changedOptions.length) {
this._reportValueChange();
if (isUserInput) {
this._emitChangeEvent(changedOptions);
}
}
}
/**
* Utility to ensure all indexes are valid.
* @param index The index to be checked.
* @returns True if the index is valid for our list of options.
*/
private _isValidIndex(index: number): boolean {
return index >= 0 && index < this.options.length;
}
/** Returns the index of the specified list option. */
private _getOptionIndex(option: MatListOption): number {
return this.options.toArray().indexOf(option);
}
/** Marks all the options to be checked in the next change detection run. */
private _markOptionsForCheck() {
if (this.options) {
this.options.forEach(option => option._markForCheck());
}
}
/**
* Removes the tabindex from the selection list and resets it back afterwards, allowing the user
* to tab out of it. This prevents the list from capturing focus and redirecting it back within
* the list, creating a focus trap if it user tries to tab away.
*/
private _allowFocusEscape() {
this._tabIndex = -1;
setTimeout(() => {
this._tabIndex = 0;
this._changeDetector.markForCheck();
});
}
/** Updates the tabindex based upon if the selection list is empty. */
private _updateTabIndex(): void {
this._tabIndex = (this.options.length === 0) ? -1 : 0;
}
static ngAcceptInputType_disabled: BooleanInput;
static ngAcceptInputType_disableRipple: BooleanInput;
static ngAcceptInputType_multiple: BooleanInput;
}