@@ -90,9 +90,6 @@ export class MatChipRow extends MatChip implements AfterViewInit {
90
90
/** The default chip edit input that is used if none is projected into this chip row. */
91
91
@ViewChild ( MatChipEditInput ) defaultEditInput ?: MatChipEditInput ;
92
92
93
- /** The chip's leading edit icon. */
94
- @ContentChild ( MAT_CHIP_EDIT ) editIcon : MatChipEdit ;
95
-
96
93
/** The projected chip edit input. */
97
94
@ContentChild ( MatChipEditInput ) contentEditInput ?: MatChipEditInput ;
98
95
@@ -113,7 +110,7 @@ export class MatChipRow extends MatChip implements AfterViewInit {
113
110
114
111
/** Returns whether the chip has a leading icon. */
115
112
_hasLeadingIcon ( ) {
116
- return ! ! ( this . editIcon || this . leadingIcon ) ;
113
+ return ! this . _isEditing && ! ! ( this . editIcon || this . leadingIcon ) ;
117
114
}
118
115
119
116
override _hasTrailingIcon ( ) {
@@ -144,16 +141,26 @@ export class MatChipRow extends MatChip implements AfterViewInit {
144
141
}
145
142
}
146
143
147
- _handleDoubleclick ( event : MouseEvent ) {
144
+ _handleDoubleclick ( event : Event ) {
148
145
if ( ! this . disabled && this . editable ) {
149
146
this . _startEditing ( event ) ;
150
147
}
151
148
}
152
149
153
- private _startEditing ( event : Event ) {
150
+ override _edit ( ) : void {
151
+ if ( ! this . disabled && this . editable ) {
152
+ // markForCheck necessary for edit input to be rendered
153
+ this . _changeDetectorRef . markForCheck ( ) ;
154
+ this . _startEditing ( ) ;
155
+ }
156
+ }
157
+
158
+ private _startEditing ( event ?: Event ) {
154
159
if (
155
160
! this . primaryAction ||
156
- ( this . removeIcon && this . _getSourceAction ( event . target as Node ) === this . removeIcon )
161
+ ( this . removeIcon &&
162
+ ! ! event &&
163
+ this . _getSourceAction ( event . target as Node ) === this . removeIcon )
157
164
) {
158
165
return ;
159
166
}
@@ -167,7 +174,7 @@ export class MatChipRow extends MatChip implements AfterViewInit {
167
174
afterNextRender (
168
175
( ) => {
169
176
this . _getEditInput ( ) . initialize ( value ) ;
170
- this . _editStartPending = false ;
177
+ setTimeout ( ( ) => this . _ngZone . run ( ( ) => ( this . _editStartPending = false ) ) ) ;
171
178
} ,
172
179
{ injector : this . _injector } ,
173
180
) ;
0 commit comments