@@ -44,8 +44,14 @@ import {
4444} from '../core' ;
4545import { Subject , Subscription , merge } from 'rxjs' ;
4646import { MatChipAction } from './chip-action' ;
47- import { MatChipAvatar , MatChipRemove , MatChipTrailingIcon } from './chip-icons' ;
48- import { MAT_CHIP , MAT_CHIP_AVATAR , MAT_CHIP_REMOVE , MAT_CHIP_TRAILING_ICON } from './tokens' ;
47+ import { MatChipAvatar , MatChipEdit , MatChipRemove , MatChipTrailingIcon } from './chip-icons' ;
48+ import {
49+ MAT_CHIP ,
50+ MAT_CHIP_AVATAR ,
51+ MAT_CHIP_EDIT ,
52+ MAT_CHIP_REMOVE ,
53+ MAT_CHIP_TRAILING_ICON ,
54+ } from './tokens' ;
4955
5056/** Represents an event fired on an individual `mat-chip`. */
5157export interface MatChipEvent {
@@ -133,6 +139,10 @@ export class MatChip implements OnInit, AfterViewInit, AfterContentInit, DoCheck
133139 @ContentChildren ( MAT_CHIP_TRAILING_ICON , { descendants : true } )
134140 protected _allTrailingIcons : QueryList < MatChipTrailingIcon > ;
135141
142+ /** All edit icons present in the chip. */
143+ @ContentChildren ( MAT_CHIP_EDIT , { descendants : true } )
144+ protected _allEditIcons : QueryList < MatChipEdit > ;
145+
136146 /** All remove icons present in the chip. */
137147 @ContentChildren ( MAT_CHIP_REMOVE , { descendants : true } )
138148 protected _allRemoveIcons : QueryList < MatChipRemove > ;
@@ -225,6 +235,9 @@ export class MatChip implements OnInit, AfterViewInit, AfterContentInit, DoCheck
225235 /** The chip's leading icon. */
226236 @ContentChild ( MAT_CHIP_AVATAR ) leadingIcon : MatChipAvatar ;
227237
238+ /** The chip's leading edit icon. */
239+ @ContentChild ( MAT_CHIP_EDIT ) editIcon : MatChipEdit ;
240+
228241 /** The chip's trailing icon. */
229242 @ContentChild ( MAT_CHIP_TRAILING_ICON ) trailingIcon : MatChipTrailingIcon ;
230243
@@ -279,6 +292,7 @@ export class MatChip implements OnInit, AfterViewInit, AfterContentInit, DoCheck
279292 this . _actionChanges = merge (
280293 this . _allLeadingIcons . changes ,
281294 this . _allTrailingIcons . changes ,
295+ this . _allEditIcons . changes ,
282296 this . _allRemoveIcons . changes ,
283297 ) . subscribe ( ( ) => this . _changeDetectorRef . markForCheck ( ) ) ;
284298 }
@@ -358,6 +372,10 @@ export class MatChip implements OnInit, AfterViewInit, AfterContentInit, DoCheck
358372 _getActions ( ) : MatChipAction [ ] {
359373 const result : MatChipAction [ ] = [ ] ;
360374
375+ if ( this . editIcon ) {
376+ result . push ( this . editIcon ) ;
377+ }
378+
361379 if ( this . primaryAction ) {
362380 result . push ( this . primaryAction ) ;
363381 }
@@ -378,6 +396,11 @@ export class MatChip implements OnInit, AfterViewInit, AfterContentInit, DoCheck
378396 // Empty here, but is overwritten in child classes.
379397 }
380398
399+ /** Handles interactions with the edit action of the chip. */
400+ _edit ( event : Event ) {
401+ // Empty here, but is overwritten in child classes.
402+ }
403+
381404 /** Starts the focus monitoring process on the chip. */
382405 private _monitorFocus ( ) {
383406 this . _focusMonitor . monitor ( this . _elementRef , true ) . subscribe ( origin => {
0 commit comments