Skip to content

Commit c120a2b

Browse files
committed
feat(material/chips): expose _chipGrid in MatChipInput and add a stream of chip removal events (#28012)
1 parent 17ea8e7 commit c120a2b

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/material/chips/chip-input.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,19 @@ export class MatChipInput implements MatChipTextControl, AfterContentInit, OnCha
7575

7676
/** Whether the control is focused. */
7777
focused: boolean = false;
78-
_chipGrid: MatChipGrid;
7978

8079
/** Register input for chip list */
8180
@Input('matChipInputFor')
81+
get chipGrid(): MatChipGrid {
82+
return this._chipGrid;
83+
}
8284
set chipGrid(value: MatChipGrid) {
8385
if (value) {
8486
this._chipGrid = value;
8587
this._chipGrid.registerInput(this);
8688
}
8789
}
90+
_chipGrid: MatChipGrid;
8891

8992
/**
9093
* Whether or not the chipEnd event will be emitted when the input is blurred.

src/material/chips/chip-set.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,16 @@ export class MatChipSet
8080
return this._getChipStream(chip => chip._onFocus);
8181
}
8282

83-
/** Combined stream of all of the child chips' remove events. */
83+
/** Combined stream of all of the child chips' destroy events. */
8484
get chipDestroyedChanges(): Observable<MatChipEvent> {
8585
return this._getChipStream(chip => chip.destroyed);
8686
}
8787

88+
/** Combined stream of all of the child chips' remove events. */
89+
get chipRemovedChanges(): Observable<MatChipEvent> {
90+
return this._getChipStream(chip => chip.removed);
91+
}
92+
8893
/** Whether the chip set is disabled. */
8994
@Input()
9095
get disabled(): boolean {

tools/public_api_guard/material/chips.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ export class MatChipInput implements MatChipTextControl, AfterContentInit, OnCha
243243
_addOnBlur: boolean;
244244
_blur(): void;
245245
readonly chipEnd: EventEmitter<MatChipInputEvent>;
246+
get chipGrid(): MatChipGrid;
246247
set chipGrid(value: MatChipGrid);
247248
// (undocumented)
248249
_chipGrid: MatChipGrid;
@@ -443,6 +444,7 @@ export class MatChipSet extends _MatChipSetMixinBase implements AfterViewInit, H
443444
_chipActions: QueryList<MatChipAction>;
444445
get chipDestroyedChanges(): Observable<MatChipEvent>;
445446
get chipFocusChanges(): Observable<MatChipEvent>;
447+
get chipRemovedChanges(): Observable<MatChipEvent>;
446448
_chips: QueryList<MatChip>;
447449
protected _defaultRole: string;
448450
protected _destroyed: Subject<void>;

0 commit comments

Comments
 (0)