Skip to content

Commit a622b85

Browse files
authored
fix(combos): displayValue as actual string (#13648)
1 parent 7c3d398 commit a622b85

File tree

8 files changed

+106
-109
lines changed

8 files changed

+106
-109
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ All notable changes for each version of this project will be documented in this
3535

3636
Note: In remote data scenarios with `valueKey` set, selected items that are not currently part of the loaded data chunk will be emitted a partial item data object with the `valueKey` property.
3737
- **Breaking Change** The `value` and `selection` properties now correctly return a single value or data item instead of the same wrapped in array and `undefined` instead of empty array, matching the values emitted from selection event and when working with `formControlName`/`ngModel` directives.
38+
- `IgxCombo`,`IgxSimpleCombo`
39+
- **Breaking Change** The `displayValue` property now returns the display text as expected (instead of display values in array).
3840

3941
## 16.1.4
4042
### New Features

projects/igniteui-angular/src/lib/combo/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ Setting `[displayDensity]` affects the control's items' and inputs' css properti
299299
| Name | Description | Type |
300300
|-----------------------|---------------------------------------------------|-----------------------------|
301301
| `id` | combo id | string |
302-
| `data` | combo data source | any |
302+
| `data` | combo data source | any[] |
303303
| `allowCustomValue` | enables/disables combo custom value | boolean |
304304
| `filterable` | enables/disables combo drop down filtering - enabled by default | boolean |
305305
| `showSearchCaseIcon` | defines whether the search case-sensitive icon should be displayed - disabled by default | boolean |
@@ -328,7 +328,9 @@ Setting `[displayDensity]` affects the control's items' and inputs' css properti
328328
### Getters
329329
| Name | Description | Type |
330330
|--------------------------|---------------------------------------------------|-----------------------------|
331-
| `value` | the value of the combo text field | string |
331+
| `displayValue` | the value of the combo text field | string |
332+
| `value` | the value of the combo | any[] |
333+
| `selection` | the selected items of the combo | any[] |
332334

333335
### Outputs
334336

projects/igniteui-angular/src/lib/combo/combo.common.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,8 @@ export abstract class IgxComboBaseDirective extends DisplayDensityBase implement
814814
* let comboDisplayValue = this.combo.displayValue;
815815
* ```
816816
*/
817-
public get displayValue(): string[] {
818-
return this._displayValue ? this._displayValue.split(', ') : [];
817+
public get displayValue(): string {
818+
return this._displayValue;
819819
}
820820

821821
/**
@@ -1076,7 +1076,7 @@ export abstract class IgxComboBaseDirective extends DisplayDensityBase implement
10761076
* let mySelection = this.combo.selection;
10771077
* ```
10781078
*/
1079-
public get selection() {
1079+
public get selection(): any[] {
10801080
const items = Array.from(this.selectionService.get(this.id));
10811081
return this.convertKeysToItems(items);
10821082
}

projects/igniteui-angular/src/lib/combo/combo.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<ng-container ngProjectAs="igx-hint, [igxHint]">
99
<ng-content select="igx-hint, [igxHint]"></ng-content>
1010
</ng-container>
11-
<input igxInput #comboInput name="comboInput" type="text" [value]="displayValue.join(', ')" readonly
11+
<input igxInput #comboInput name="comboInput" type="text" [value]="displayValue" readonly
1212
[attr.placeholder]="placeholder" [disabled]="disabled"
1313
role="combobox" aria-haspopup="listbox"
1414
[attr.aria-expanded]="!dropdown.collapsed" [attr.aria-controls]="dropdown.listId"
@@ -17,7 +17,7 @@
1717
<ng-container ngProjectAs="igx-suffix">
1818
<ng-content select="igx-suffix"></ng-content>
1919
</ng-container>
20-
<igx-suffix *ngIf="displayValue.length" aria-label="Clear Selection" class="igx-combo__clear-button"
20+
<igx-suffix *ngIf="displayValue" aria-label="Clear Selection" class="igx-combo__clear-button"
2121
(click)="handleClearItems($event)">
2222
<ng-container *ngIf="clearIconTemplate">
2323
<ng-container *ngTemplateOutlet="clearIconTemplate"></ng-container>

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 36 additions & 36 deletions
Large diffs are not rendered by default.

projects/igniteui-angular/src/lib/combo/combo.component.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,6 @@ export class IgxComboComponent extends IgxComboBaseDirective implements AfterVie
180180
@ViewChild(IgxComboDropDownComponent, { static: true })
181181
public dropdown: IgxComboDropDownComponent;
182182

183-
/**
184-
* @hidden @internal
185-
*/
186-
public get inputEmpty(): boolean {
187-
return this.displayValue.length === 0 && !this.placeholder;
188-
}
189-
190183
/** @hidden @internal */
191184
public get filteredData(): any[] | null {
192185
return this.filteringOptions.filterable ? this._filteredData : this.data;

projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<ng-content select="igx-hint, [igxHint]"></ng-content>
1313
</ng-container>
1414

15-
<input #comboInput igxInput [value]="displayValue[0]" role="combobox"
15+
<input #comboInput igxInput [value]="displayValue" role="combobox"
1616
aria-haspopup="listbox" aria-autocomplete="list" aria-readonly="false"
1717
[attr.aria-expanded]="!this.dropdown.collapsed" [attr.aria-controls]="this.dropdown.listId"
1818
[attr.aria-labelledby]="this.ariaLabelledBy || this.label?.id || this.placeholder"

0 commit comments

Comments
 (0)