Skip to content

Commit 42c9b6d

Browse files
authored
Merge pull request #2604 from Akshat55/M-t-N
Merge branch 'master' into next
2 parents f5bcfc8 + d9a8de4 commit 42c9b6d

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/combobox/combobox.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ import { Observable } from "rxjs";
6969
<span class="cds--tag__label">{{ pills.length }}</span>
7070
<button
7171
type="button"
72-
(click)="clearSelected()"
72+
(click)="clearSelected($event)"
7373
(blur)="onBlur()"
74-
(keydown.enter)="clearSelected()"
74+
(keydown.enter)="clearSelected($event)"
7575
class="cds--tag__close-icon"
7676
tabindex="0"
7777
[title]="clearSelectionsTitle"
@@ -399,7 +399,7 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
399399
/** Emits the search string from the input */
400400
@Output() search = new EventEmitter<string>();
401401
/** Emits an event when the clear button is clicked. */
402-
@Output() clear = new EventEmitter();
402+
@Output() clear = new EventEmitter<Event>();
403403
/** ContentChild reference to the instantiated dropdown list */
404404
@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;
405405
@ViewChild("dropdownMenu") dropdownMenu;
@@ -657,7 +657,7 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
657657
this.checkForReorder();
658658
}
659659

660-
public clearSelected() {
660+
public clearSelected(event) {
661661
this.items = this.items.map(item => {
662662
if (!item.disabled) {
663663
item.selected = false;
@@ -671,7 +671,7 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
671671
const selected = this.view.getSelected();
672672
this.propagateChangeCallback(selected);
673673
this.selected.emit(selected as any);
674-
this.clear.emit();
674+
this.clear.emit(event);
675675
}
676676

677677
/**
@@ -770,7 +770,7 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
770770
event.preventDefault();
771771

772772
if (this.type === "single") { // don't want to clear selected or close if multi
773-
this.clearSelected();
773+
this.clearSelected(event);
774774
this.closeDropdown();
775775
}
776776

src/combobox/combobox.stories.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ export default {
8989
},
9090
selected: { action: "Selection changed!" },
9191
submit: { action: "Submit" },
92-
search: { action: "Search" }
92+
search: { action: "Search" },
93+
clear: { action: "Clear!" }
9394
},
9495
parameters: {
9596
layout: "centered"
@@ -116,7 +117,8 @@ const Template: Story<ComboBox> = (args) => ({
116117
[dropUp]="dropUp"
117118
(selected)="selected($event)"
118119
(submit)="submit($event)"
119-
(search)="search($event)">
120+
(search)="search($event)"
121+
(clear)="clear($event)">
120122
<cds-dropdown-list></cds-dropdown-list>
121123
</cds-combo-box>
122124
<span>{{model | json}}</span>
@@ -190,7 +192,8 @@ const MultiTemplate: Story<ComboBox> = (args) => ({
190192
[appendInline]="appendInline"
191193
type="multi"
192194
(selected)="selected($event)"
193-
(submit)="submit($event)">
195+
(submit)="submit($event)"
196+
(clear)="clear($event)">
194197
<cds-dropdown-list></cds-dropdown-list>
195198
</cds-combo-box>
196199
`

0 commit comments

Comments
 (0)