Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Apr 27, 2017
1 parent 2861394 commit b6bb586
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterViewChecked,DoChec

@Input() displaySelectedLabel: boolean = true;

@Input() maxItems: number = 3;
@Input() maxSelectedLabels: number = 3;

@Input() selectedItemsLabel: string = '{0} items selected';

Expand Down Expand Up @@ -310,7 +310,7 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterViewChecked,DoChec
label = label + this.findLabelByValue(this.value[i]);
}

if(this.value.length <= this.maxItems) {
if(this.value.length <= this.maxSelectedLabels) {
this.valuesAsString = label;
}
else {
Expand Down
18 changes: 9 additions & 9 deletions showcase/demo/multiselect/multiselectdemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ <h3>Attributes</h3>
<td>Choose</td>
<td>Label to display when there are no selections.</td>
</tr>
<tr>
<td>displaySelectedLabel</td>
<td>boolean</td>
<td>true</td>
<td>Specifies the visibility of the selected labels in container.</td>
</tr>
<tr>
<td>appendTo</td>
<td>any</td>
Expand Down Expand Up @@ -145,16 +139,22 @@ <h3>Attributes</h3>
<td>Identifier of the focus input to match a label defined for the component.</td>
</tr>
<tr>
<td>maxItems</td>
<td>displaySelectedLabel</td>
<td>boolean</td>
<td>true</td>
<td>Whether to show labels of selected item labels or use default label.</td>
</tr>
<tr>
<td>maxSelectedLabels</td>
<td>number</td>
<td>3</td>
<td>Decides how many items to show in container.</td>
<td>Decides how many selected item labels to show at most.</td>
</tr>
<tr>
<td>selectedItemsLabel</td>
<td>string</td>
<td>&#123;0&#125; items selected</td>
<td>After reaching maxItems, it decides label message to show in container.(It replaces &#123;0&#125; with the length of selected items using regexp)</td>
<td>Label to display after exceeding max selected labels.</td>
</tr>
</tbody>
</table>
Expand Down

0 comments on commit b6bb586

Please sign in to comment.