Skip to content

Commit 6719168

Browse files
authored
feat(material/chips): expose _chipGrid in MatChipInput and add a stream of chip removal events (#28012) (#28013)
1 parent 58ecb18 commit 6719168

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
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+
private _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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,8 @@ 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);
247-
// (undocumented)
248-
_chipGrid: MatChipGrid;
249248
clear(): void;
250249
get disabled(): boolean;
251250
set disabled(value: BooleanInput);
@@ -443,6 +442,7 @@ export class MatChipSet extends _MatChipSetMixinBase implements AfterViewInit, H
443442
_chipActions: QueryList<MatChipAction>;
444443
get chipDestroyedChanges(): Observable<MatChipEvent>;
445444
get chipFocusChanges(): Observable<MatChipEvent>;
445+
get chipRemovedChanges(): Observable<MatChipEvent>;
446446
_chips: QueryList<MatChip>;
447447
protected _defaultRole: string;
448448
protected _destroyed: Subject<void>;

0 commit comments

Comments
 (0)