66 * found in the LICENSE file at https://angular.io/license
77 */
88
9+ import { BooleanInput } from '@angular/cdk/coercion' ;
10+ import { SelectionModel } from '@angular/cdk/collections' ;
911import { Platform } from '@angular/cdk/platform' ;
1012import {
1113 ChangeDetectionStrategy ,
1214 Component ,
1315 ContentChildren ,
1416 ElementRef ,
17+ EventEmitter ,
1518 forwardRef ,
19+ Input ,
1620 NgZone ,
21+ Output ,
1722 QueryList ,
1823 ViewEncapsulation
1924} from '@angular/core' ;
20- import { NG_VALUE_ACCESSOR } from '@angular/forms' ;
21- import { MatLine } from '@angular/material/core' ;
25+ import { ControlValueAccessor , NG_VALUE_ACCESSOR } from '@angular/forms' ;
26+ import { MatLine , ThemePalette } from '@angular/material/core' ;
2227import { MatListBase , MatListItemBase } from './list-base' ;
2328
2429const MAT_SELECTION_LIST_VALUE_ACCESSOR : any = {
@@ -40,9 +45,10 @@ export class MatSelectionListChange {
4045 selector : 'mat-selection-list' ,
4146 exportAs : 'matSelectionList' ,
4247 host : {
43- 'class' : 'mat-mdc-selection-list mat-mdc-list-base'
48+ 'class' : 'mat-mdc-selection-list mat-mdc-list-base mdc-list' ,
49+ 'role' : 'listbox' ,
4450 } ,
45- templateUrl : 'selection-list.html ' ,
51+ template : '<ng-content></ng-content> ' ,
4652 styleUrls : [ 'list.css' ] ,
4753 encapsulation : ViewEncapsulation . None ,
4854 providers : [
@@ -51,23 +57,68 @@ export class MatSelectionListChange {
5157 ] ,
5258 changeDetection : ChangeDetectionStrategy . OnPush ,
5359} )
54- export class MatSelectionList extends MatListBase { }
60+ export class MatSelectionList extends MatListBase implements ControlValueAccessor {
61+ // TODO: Implement these inputs.
62+ @Input ( ) disableRipple : boolean ;
63+ @Input ( ) tabIndex : number ;
64+ @Input ( ) color : ThemePalette ;
65+ @Input ( ) compareWith : ( o1 : any , o2 : any ) => boolean ;
66+ @Input ( ) disabled : boolean ;
67+ @Input ( ) multiple : boolean ;
68+
69+ // TODO: Implement these inputs.
70+ @Output ( ) readonly selectionChange = new EventEmitter < MatSelectionListChange > ( ) ;
71+
72+ @ContentChildren ( forwardRef ( ( ) => MatListOption ) , { descendants : true } ) options :
73+ QueryList < MatListOption > ;
74+
75+ // TODO: Implement these properties.
76+ selectedOptions : SelectionModel < MatListOption > ;
77+
78+ // TODO: Implement these methods.
79+ focus ( options ?: FocusOptions ) { }
80+ selectAll ( ) { }
81+ deselectAll ( ) { }
82+ registerOnChange ( fn : any ) { }
83+ registerOnTouched ( fn : any ) { }
84+ writeValue ( obj : any ) { }
85+ }
5586
5687@Component ( {
5788 selector : 'mat-list-option' ,
5889 exportAs : 'matListOption' ,
5990 host : {
60- 'class' : 'mat-mdc-list-item mat-mdc-list-option' ,
91+ 'class' : 'mat-mdc-list-item mat-mdc-list-option mdc-list-item' ,
92+ 'role' : 'option' ,
93+ 'tabindex' : '-1' ,
6194 } ,
6295 templateUrl : 'list-option.html' ,
6396 encapsulation : ViewEncapsulation . None ,
6497 changeDetection : ChangeDetectionStrategy . OnPush ,
6598} )
6699export class MatListOption extends MatListItemBase {
100+ static ngAcceptInputType_disabled : BooleanInput ;
101+ static ngAcceptInputType_selected : BooleanInput ;
102+ static ngAcceptInputType_disableRipple : BooleanInput ;
103+
67104 @ContentChildren ( MatLine , { read : ElementRef , descendants : true } ) lines :
68105 QueryList < ElementRef < Element > > ;
69106
70- constructor ( element : ElementRef , ngZone : NgZone , listBase : MatListBase , platform : Platform ) {
107+ // TODO: Implement these inputs.
108+ @Input ( ) disableRipple : boolean ;
109+ @Input ( ) checkboxPosition : 'before' | 'after' = 'before' ;
110+ @Input ( ) color : ThemePalette ;
111+ @Input ( ) value : any ;
112+ @Input ( ) disabled : boolean ;
113+ @Input ( ) selected : boolean ;
114+
115+ constructor ( element : ElementRef , ngZone : NgZone , listBase : MatListBase , platform : Platform ,
116+ public selectionList : MatSelectionList ) {
71117 super ( element , ngZone , listBase , platform ) ;
72118 }
119+
120+ // TODO: Implement these methods.
121+ getLabel ( ) { return '' ; }
122+ focus ( ) { }
123+ toggle ( ) { }
73124}
0 commit comments