@@ -58,9 +58,25 @@ export const MAT_SELECTION_LIST_VALUE_ACCESSOR: any = {
58
58
multi : true
59
59
} ;
60
60
61
+ /**
62
+ * Change event object emitted by MatListOption whenever the selected state changes.
63
+ * @deprecated Use the `MatSelectionListChange` event on the selection list instead.
64
+ */
65
+ export class MatListOptionChange {
66
+ constructor (
67
+ /** Reference to the list option that changed. */
68
+ public source : MatListOption ,
69
+ /** The new selected state of the option. */
70
+ public selected : boolean ) { }
71
+ }
72
+
61
73
/** Change event that is being fired whenever the selected state of an option changes. */
62
74
export class MatSelectionListChange {
63
- constructor ( public source : MatSelectionList , public option : MatListOption ) { }
75
+ constructor (
76
+ /** Reference to the selection list that emitted the event. */
77
+ public source : MatSelectionList ,
78
+ /** Reference to the option that has been changed. */
79
+ public option : MatListOption ) { }
64
80
}
65
81
66
82
/**
@@ -136,8 +152,8 @@ export class MatListOption extends _MatListOptionMixinBase
136
152
* Emits a change event whenever the selected state of an option changes.
137
153
* @deprecated Use the `selectionChange` event on the `<mat-selection-list>` instead.
138
154
*/
139
- @Output ( ) selectionChange : EventEmitter < MatSelectionListChange > =
140
- new EventEmitter < MatSelectionListChange > ( ) ;
155
+ @Output ( ) selectionChange : EventEmitter < MatListOptionChange > =
156
+ new EventEmitter < MatListOptionChange > ( ) ;
141
157
142
158
constructor ( private _element : ElementRef ,
143
159
private _changeDetector : ChangeDetectorRef ,
@@ -227,7 +243,7 @@ export class MatListOption extends _MatListOptionMixinBase
227
243
/** Emits a selectionChange event for this option. */
228
244
_emitDeprecatedChangeEvent ( ) {
229
245
// TODO: the `selectionChange` event on the option is deprecated. Remove that in the future.
230
- this . selectionChange . emit ( new MatSelectionListChange ( this . selectionList , this ) ) ;
246
+ this . selectionChange . emit ( new MatListOptionChange ( this , this . selected ) ) ;
231
247
}
232
248
}
233
249
0 commit comments