Skip to content

Commit 7db7b20

Browse files
authored
Merge pull request #186 from cal-smith/combobox
Combobox fixes
2 parents 12f16a5 + 2ecca18 commit 7db7b20

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/combobox/combobox.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import { NG_VALUE_ACCESSOR } from "@angular/forms";
6767
class="bx--text-input"
6868
aria-label="ListBox input field"
6969
autocomplete="off"
70-
placeholder="Filter..."/>
70+
[placeholder]="placeholder"/>
7171
<div
7272
[ngClass]="{'bx--list-box__menu-icon--open': open}"
7373
class="bx--list-box__menu-icon">
@@ -132,7 +132,7 @@ export class ComboBox implements OnChanges, OnInit, AfterViewInit, AfterContentI
132132
* Text to show when nothing is selected.
133133
* @memberof ComboBox
134134
*/
135-
@Input() placeholder = "";
135+
@Input() placeholder = "Filter...";
136136
/**
137137
* Combo box type (supporting single or multi selection of items).
138138
* @type {("single" | "multi")}
@@ -351,6 +351,9 @@ export class ComboBox implements OnChanges, OnInit, AfterViewInit, AfterContentI
351351
});
352352
this.view["updateList"](this.items);
353353
this.updatePills();
354+
// clearSelected can only fire on type=multi
355+
// so we just emit getSelected() (just in case there's any disabled but selected items)
356+
this.selected.emit(this.view.getSelected() as any);
354357
}
355358

356359
/**

src/combobox/combobox.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ storiesOf("Combobox", module)
1616
.addDecorator(withKnobs)
1717
.add("Basic", () => ({
1818
template: `
19-
<ibm-combo-box [items]="items">
19+
<ibm-combo-box [items]="items" (selected)="selected($event)">
2020
<ibm-dropdown-list></ibm-dropdown-list>
2121
</ibm-combo-box>
2222
`,
@@ -40,7 +40,7 @@ storiesOf("Combobox", module)
4040
}))
4141
.add("Multi-select", () => ({
4242
template: `
43-
<ibm-combo-box [items]="items" type="multi">
43+
<ibm-combo-box [items]="items" type="multi" (selected)="selected($event)">
4444
<ibm-dropdown-list></ibm-dropdown-list>
4545
</ibm-combo-box>
4646
`,

0 commit comments

Comments
 (0)