Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions demo/src/app/pages/modules/select/select.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const exampleStandardTemplate = `
[isSearchable]="searchable"
[isDisabled]="disabled"
[hasLabels]="!hideLabels"
[showCountText]="'Select'"
#multiSelect>
<sui-select-option *ngFor="let option of multiSelect.filteredOptions"
[value]="option">
Expand Down Expand Up @@ -333,6 +334,13 @@ export class SelectPage {
description: "Sets whether the multi select uses labels.",
defaultValue: "true"
},
{
name: "showCountText",
type: "string",
description: "Display text when no value is selected. " +
"Eg:- If we pass a value 'Select', it will display Select selections instead of " +
"0 selections"
},
{
name: "maxSelected",
type: "number",
Expand Down
14 changes: 13 additions & 1 deletion src/modules/select/components/multi-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ export class SuiMultiSelect<T, U> extends SuiSelectBase<T, U> implements ICustom
this._hasLabels = hasLabels;
}

private _showCountText:string;

@Input()
public get showCountText():string {
return this._showCountText;
}

public set showCountText(showCountText:string) {
this._showCountText = showCountText;
}

private _placeholder:string;

@Input()
Expand Down Expand Up @@ -128,7 +139,8 @@ export class SuiMultiSelect<T, U> extends SuiSelectBase<T, U> implements ICustom
public get selectedMessage():string {
return this._localizationService.interpolate(
this.localeValues.multi.selectedMessage,
[["count", this.selectedOptions.length.toString()]]);
[["count", this.selectedOptions.length.toString() === "0" && this._showCountText ?
this._showCountText : this.selectedOptions.length.toString()]]);
}

@HostBinding("class.multiple")
Expand Down