Skip to content

Commit 10eb33f

Browse files
authored
Merge pull request #2600 from Akshat55/combobox-clear-event
fix: Bubble click event
2 parents c1380b5 + 1f263a8 commit 10eb33f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/combobox/combobox.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ import { Observable } from "rxjs";
7070
<span class="bx--tag__label">{{ pills.length }}</span>
7171
<button
7272
type="button"
73-
(click)="clearSelected()"
73+
(click)="clearSelected($event)"
7474
(blur)="onBlur()"
75-
(keydown.enter)="clearSelected()"
75+
(keydown.enter)="clearSelected($event)"
7676
class="bx--tag__close-icon"
7777
tabindex="0"
7878
[title]="clearSelectionsTitle"
@@ -402,7 +402,7 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
402402
/** Emits the search string from the input */
403403
@Output() search = new EventEmitter<string>();
404404
/** Emits an event when the clear button is clicked. */
405-
@Output() clear = new EventEmitter();
405+
@Output() clear = new EventEmitter<Event>();
406406
/** ContentChild reference to the instantiated dropdown list */
407407
// @ts-ignore
408408
@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;
@@ -664,7 +664,7 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
664664
this.checkForReorder();
665665
}
666666

667-
public clearSelected() {
667+
public clearSelected(event) {
668668
this.items = this.items.map(item => {
669669
if (!item.disabled) {
670670
item.selected = false;
@@ -678,7 +678,7 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
678678
const selected = this.view.getSelected();
679679
this.propagateChangeCallback(selected);
680680
this.selected.emit(selected as any);
681-
this.clear.emit();
681+
this.clear.emit(event);
682682
}
683683

684684
/**
@@ -777,7 +777,7 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
777777
event.preventDefault();
778778

779779
if (this.type === "single") { // don't want to clear selected or close if multi
780-
this.clearSelected();
780+
this.clearSelected(event);
781781
this.closeDropdown();
782782
}
783783

src/combobox/combobox.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ storiesOf("Components|Combobox", module)
296296
(selected)="selected($event)"
297297
(submit)="submit($event)"
298298
(search)="search($event)"
299-
(clear)="clear()">
299+
(clear)="clear($event)">
300300
<ibm-dropdown-list></ibm-dropdown-list>
301301
</ibm-combo-box>
302302
`,
@@ -432,7 +432,7 @@ storiesOf("Components|Combobox", module)
432432
type="multi"
433433
(selected)="selected($event)"
434434
(submit)="submit($event)"
435-
(clear)="clear()">
435+
(clear)="clear($event)">
436436
<ibm-dropdown-list></ibm-dropdown-list>
437437
</ibm-combo-box>
438438
</div>

0 commit comments

Comments
 (0)