From b6bb586e72a27ddedfce112d3cb9cfdfdd6ce00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Fatay=20=C3=87ivici?= Date: Thu, 27 Apr 2017 11:54:01 +0300 Subject: [PATCH] Refactor --- components/multiselect/multiselect.ts | 4 ++-- showcase/demo/multiselect/multiselectdemo.html | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/multiselect/multiselect.ts b/components/multiselect/multiselect.ts index acfc1d38c17..3e4bd35fc52 100644 --- a/components/multiselect/multiselect.ts +++ b/components/multiselect/multiselect.ts @@ -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'; @@ -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 { diff --git a/showcase/demo/multiselect/multiselectdemo.html b/showcase/demo/multiselect/multiselectdemo.html index 0ceb7414f92..83eb17ddff4 100644 --- a/showcase/demo/multiselect/multiselectdemo.html +++ b/showcase/demo/multiselect/multiselectdemo.html @@ -90,12 +90,6 @@

Attributes

Choose Label to display when there are no selections. - - displaySelectedLabel - boolean - true - Specifies the visibility of the selected labels in container. - appendTo any @@ -145,16 +139,22 @@

Attributes

Identifier of the focus input to match a label defined for the component. - maxItems + displaySelectedLabel + boolean + true + Whether to show labels of selected item labels or use default label. + + + maxSelectedLabels number 3 - Decides how many items to show in container. + Decides how many selected item labels to show at most. selectedItemsLabel string {0} items selected - After reaching maxItems, it decides label message to show in container.(It replaces {0} with the length of selected items using regexp) + Label to display after exceeding max selected labels.