Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular2-multiselect-dropdown

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-multiselect-dropdown - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

tsconfig.json

3

package.json
{
"name": "angular2-multiselect-dropdown",
"version": "1.1.1",
"version": "1.1.2",
"license": "MIT",

@@ -19,3 +19,4 @@ "angular-cli": {},

"devDependencies": {
}
}

@@ -112,2 +112,3 @@ # Angular2 Multiselect Dropdown

| classes | String | Custom classes to the dropdown component. Classes are added to the dropdown selector tag. To add multiple classes, the value should be space separated class names.| '' |
| limitSelection | Number | Limit the selection of number of items from the dropdown list. Once the limit is reached, all unselected items gets disabled. | none |

@@ -114,0 +115,0 @@ ### Callback Methods

@@ -73,18 +73,29 @@ import { Component, OnInit, NgModule, OnChanges, ViewEncapsulation,forwardRef, Input, Output, EventEmitter, ElementRef, AfterViewInit, Pipe, PipeTransform } from '@angular/core';

onItemClick(item: ListItem,index){
let found = this.isSelected(item);
let found = this.isSelected(item);
let limit = this.selectedItems.length < this.settings.limitSelection ? true : false;
if(!found){
this.addSelected(item);
this.onSelect.emit(item);
}
else{
this.removeSelected(item);
this.onDeSelect.emit(item);
}
if(this.isSelectAll || this.data.length > this.selectedItems.length){
this.isSelectAll = false;
}
if(this.data.length == this.selectedItems.length){
this.isSelectAll = true;
}
if(!found){
if(this.settings.limitSelection){
if(limit){
this.addSelected(item);
this.onSelect.emit(item);
}
}
else{
this.addSelected(item);
this.onSelect.emit(item);
}
}
else{
this.removeSelected(item);
this.onDeSelect.emit(item);
}
if(this.isSelectAll || this.data.length > this.selectedItems.length){
this.isSelectAll = false;
}
if(this.data.length == this.selectedItems.length){
this.isSelectAll = true;
}
}

@@ -111,4 +122,10 @@ private onTouchedCallback: () => void = noop;

}
else
this.selectedItems = value;
else{
if(this.settings.limitSelection){
this.selectedItems = value.splice(0,this.settings.limitSelection);
}
else{
this.selectedItems = value;
}
}
} else {

@@ -115,0 +132,0 @@ this.selectedItems = [];

@@ -11,2 +11,3 @@ export interface DropdownSettings{

classes: String;
limitSelection?: Number;
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc