angular-2-dropdown-multiselect
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -162,2 +162,3 @@ (function (global, factory) { | ||
var _this = this; | ||
_event.stopPropagation(); | ||
if (!this.model) { | ||
@@ -216,2 +217,3 @@ this.model = []; | ||
} | ||
this.model = this.model.slice(); | ||
this.onModelChange(this.model); | ||
@@ -218,0 +220,0 @@ this.onModelTouched(); |
@@ -1,1 +0,1 @@ | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/forms","@angular/common"],factory):factory(global.dropdown=global.dropdown||{},global.ng.core,global.ng.forms,global.ng.common)}(this,function(exports,_angular_core,_angular_forms,_angular_common){"use strict";var MultiSelectSearchFilter=function(){function MultiSelectSearchFilter(){}return MultiSelectSearchFilter.prototype.transform=function(options,args){var matchPredicate=function(option){return option.name.toLowerCase().indexOf((args||"").toLowerCase())>-1},getChildren=function(option){return options.filter(function(child){return child.parentId===option.id})},getParent=function(option){return options.find(function(parent){return option.parentId===parent.id})};return options.filter(function(option){return matchPredicate(option)||"undefined"==typeof option.parentId&&getChildren(option).some(matchPredicate)||"undefined"!=typeof option.parentId&&matchPredicate(getParent(option))})},MultiSelectSearchFilter}();MultiSelectSearchFilter.decorators=[{type:_angular_core.Pipe,args:[{name:"searchFilter"}]}],MultiSelectSearchFilter.ctorParameters=function(){return[]};var MULTISELECT_VALUE_ACCESSOR={provide:_angular_forms.NG_VALUE_ACCESSOR,useExisting:_angular_core.forwardRef(function(){return MultiselectDropdown}),multi:!0},MultiselectDropdown=function(){function MultiselectDropdown(element,differs){this.element=element,this.disabled=!1,this.selectionLimitReached=new _angular_core.EventEmitter,this.dropdownClosed=new _angular_core.EventEmitter,this.dropdownOpened=new _angular_core.EventEmitter,this.onAdded=new _angular_core.EventEmitter,this.onRemoved=new _angular_core.EventEmitter,this.numSelected=0,this.isVisible=!1,this.searchFilterText="",this.defaultSettings={pullRight:!1,enableSearch:!1,checkedStyle:"checkboxes",buttonClasses:"btn btn-default btn-secondary",containerClasses:"dropdown-inline",selectionLimit:0,closeOnSelect:!1,autoUnselect:!1,showCheckAll:!1,showUncheckAll:!1,fixedTitle:!1,dynamicTitleMaxItems:3,maxHeight:"300px"},this.defaultTexts={checkAll:"Check all",uncheckAll:"Uncheck all",checked:"checked",checkedPlural:"checked",searchPlaceholder:"Search...",defaultTitle:"Select",allSelected:"All selected"},this.onModelChange=function(){},this.onModelTouched=function(){},this.differ=differs.find([]).create(null)}return MultiselectDropdown.prototype.onClick=function(target){if(this.isVisible){for(var parentFound=!1;null!=target&&!parentFound;)target===this.element.nativeElement&&(parentFound=!0),target=target.parentElement;parentFound||(this.isVisible=!1,this.dropdownClosed.emit())}},MultiselectDropdown.prototype.getItemStyle=function(option){return option.isLabel?void 0:{cursor:"pointer"}},MultiselectDropdown.prototype.ngOnInit=function(){this.settings=Object.assign(this.defaultSettings,this.settings),this.texts=Object.assign(this.defaultTexts,this.texts),this.title=this.texts.defaultTitle||""},MultiselectDropdown.prototype.ngOnChanges=function(changes){changes.options&&(this.options=this.options||[],this.parents=this.options.filter(function(option){return"number"==typeof option.parentId}).map(function(option){return option.parentId})),changes.texts&&!changes.texts.isFirstChange()&&this.updateTitle()},MultiselectDropdown.prototype.writeValue=function(value){this.model=void 0!==value&&null!==value?value:[]},MultiselectDropdown.prototype.registerOnChange=function(fn){this.onModelChange=fn},MultiselectDropdown.prototype.registerOnTouched=function(fn){this.onModelTouched=fn},MultiselectDropdown.prototype.setDisabledState=function(isDisabled){this.disabled=isDisabled},MultiselectDropdown.prototype.ngDoCheck=function(){var changes=this.differ.diff(this.model);changes&&(this.updateNumSelected(),this.updateTitle())},MultiselectDropdown.prototype.validate=function(){return this.model&&this.model.length?null:{required:{valid:!1}}},MultiselectDropdown.prototype.registerOnValidatorChange=function(){throw new Error("Method not implemented.")},MultiselectDropdown.prototype.clearSearch=function(event){event.stopPropagation(),this.searchFilterText=""},MultiselectDropdown.prototype.toggleDropdown=function(){this.isVisible=!this.isVisible,this.isVisible?this.dropdownOpened.emit():this.dropdownClosed.emit()},MultiselectDropdown.prototype.isSelected=function(option){return this.model&&this.model.indexOf(option.id)>-1},MultiselectDropdown.prototype.setSelected=function(_event,option){var _this=this;this.model||(this.model=[]);var index=this.model.indexOf(option.id);if(index>-1){this.model.splice(index,1),this.onRemoved.emit(option.id);var parentIndex=option.parentId&&this.model.indexOf(option.parentId);if(parentIndex>=0)this.model.splice(parentIndex,1),this.onRemoved.emit(option.parentId);else if(this.parents.indexOf(option.id)>-1){var childIds_1=this.options.filter(function(child){return _this.model.indexOf(child.id)>-1&&child.parentId==option.id}).map(function(child){return child.id});this.model=this.model.filter(function(id){return childIds_1.indexOf(id)<0}),childIds_1.forEach(function(childId){return _this.onRemoved.emit(childId)})}}else if(0===this.settings.selectionLimit||this.settings.selectionLimit&&this.model.length<this.settings.selectionLimit){if(this.model.push(option.id),this.onAdded.emit(option.id),option.parentId){var children=this.options.filter(function(child){return child.id!==option.id&&child.parentId==option.parentId});children.every(function(child){return _this.model.indexOf(child.id)>-1})&&(this.model.push(option.parentId),this.onAdded.emit(option.parentId))}else if(this.parents.indexOf(option.id)>-1){var children=this.options.filter(function(child){return _this.model.indexOf(child.id)<0&&child.parentId==option.id});children.forEach(function(child){_this.model.push(child.id),_this.onAdded.emit(child.id)})}}else{if(!this.settings.autoUnselect)return void this.selectionLimitReached.emit(this.model.length);this.model.push(option.id),this.onAdded.emit(option.id);var removedOption=this.model.shift();this.onRemoved.emit(removedOption)}this.settings.closeOnSelect&&this.toggleDropdown(),this.onModelChange(this.model),this.onModelTouched()},MultiselectDropdown.prototype.updateNumSelected=function(){var _this=this;this.numSelected=this.model&&this.model.filter(function(id){return _this.parents.indexOf(id)<0}).length||0},MultiselectDropdown.prototype.updateTitle=function(){var _this=this;this.title=0===this.numSelected||this.settings.fixedTitle?this.texts.defaultTitle||"":this.settings.displayAllSelectedText&&this.model.length===this.options.length?this.texts.allSelected||"":this.settings.dynamicTitleMaxItems&&this.settings.dynamicTitleMaxItems>=this.numSelected?this.options.filter(function(option){return _this.model&&_this.model.indexOf(option.id)>-1}).map(function(option){return option.name}).join(", "):this.numSelected+" "+(1===this.numSelected?this.texts.checked:this.texts.checkedPlural)},MultiselectDropdown.prototype.searchFilterApplied=function(){return this.settings.enableSearch&&this.searchFilterText&&this.searchFilterText.length>0},MultiselectDropdown.prototype.checkAll=function(){var _this=this,checkedOptions=(this.searchFilterApplied()?(new MultiSelectSearchFilter).transform(this.options,this.searchFilterText):this.options).filter(function(option){return-1===_this.model.indexOf(option.id)?(_this.onAdded.emit(option.id),!0):!1}).map(function(option){return option.id});this.model=this.model.concat(checkedOptions),this.onModelChange(this.model),this.onModelTouched()},MultiselectDropdown.prototype.uncheckAll=function(){var _this=this,unCheckedOptions=this.searchFilterApplied()?(new MultiSelectSearchFilter).transform(this.options,this.searchFilterText).map(function(option){return option.id}):this.model;this.model=this.model.filter(function(id){return unCheckedOptions.indexOf(id)<0?!0:(_this.onRemoved.emit(id),!1)}),this.onModelChange(this.model),this.onModelTouched()},MultiselectDropdown.prototype.preventCheckboxCheck=function(event,option){this.settings.selectionLimit&&!this.settings.autoUnselect&&this.model.length>=this.settings.selectionLimit&&-1===this.model.indexOf(option.id)&&event.preventDefault()},MultiselectDropdown}();MultiselectDropdown.decorators=[{type:_angular_core.Component,args:[{selector:"ss-multiselect-dropdown",template:'<div class="dropdown" [ngClass]="settings.containerClasses" [class.open]="isVisible"><button type="button" class="dropdown-toggle" [ngClass]="settings.buttonClasses" (click)="toggleDropdown()" [disabled]="disabled">{{ title }}<span class="caret"></span></button><ul *ngIf="isVisible" class="dropdown-menu" [class.pull-right]="settings.pullRight" [class.dropdown-menu-right]="settings.pullRight" [style.max-height]="settings.maxHeight" style="display: block; height: auto; overflow-y: auto"><li class="dropdown-item search" *ngIf="settings.enableSearch"><div class="input-group input-group-sm"><span class="input-group-addon" id="sizing-addon3"><i class="fa fa-search"></i></span> <input type="text" class="form-control" placeholder="{{ texts.searchPlaceholder }}" aria-describedby="sizing-addon3" [(ngModel)]="searchFilterText" [ngModelOptions]="{standalone: true}" autofocus> <span class="input-group-btn" *ngIf="searchFilterText.length > 0"><button class="btn btn-default btn-secondary" type="button" (click)="clearSearch($event)"><i class="fa fa-times"></i></button></span></div></li><li class="dropdown-divider divider" *ngIf="settings.enableSearch"></li><li class="dropdown-item check-control check-control-check" *ngIf="settings.showCheckAll"><a href="javascript:;" role="menuitem" tabindex="-1" (click)="checkAll()"><span style="width: 16px" [ngClass]="{\'glyphicon glyphicon-ok\': settings.checkedStyle !== \'fontawesome\',\'fa fa-check\': settings.checkedStyle === \'fontawesome\'}"></span> {{ texts.checkAll }}</a></li><li class="dropdown-item check-control check-control-uncheck" *ngIf="settings.showUncheckAll"><a href="javascript:;" role="menuitem" tabindex="-1" (click)="uncheckAll()"><span style="width: 16px" [ngClass]="{\'glyphicon glyphicon-remove\': settings.checkedStyle !== \'fontawesome\',\'fa fa-times\': settings.checkedStyle === \'fontawesome\'}"></span> {{ texts.uncheckAll }}</a></li><li *ngIf="settings.showCheckAll || settings.showUncheckAll" class="dropdown-divider divider"></li><li class="dropdown-item" [ngStyle]="getItemStyle(option)" *ngFor="let option of options | searchFilter:searchFilterText" (click)="!option.isLabel && setSelected($event, option)" [class.dropdown-header]="option.isLabel"><ng-template [ngIf]="option.isLabel">{{ option.name }}</ng-template><a *ngIf="!option.isLabel" href="javascript:;" role="menuitem" tabindex="-1" [style.padding-left]="this.parents.length>0&&this.parents.indexOf(option.id)<0&&\'30px\'"><input *ngIf="settings.checkedStyle === \'checkboxes\'" type="checkbox" [checked]="isSelected(option)" (click)="preventCheckboxCheck($event, option)"> <span *ngIf="settings.checkedStyle === \'glyphicon\'" style="width: 16px" class="glyphicon" [class.glyphicon-ok]="isSelected(option)"></span> <span *ngIf="settings.checkedStyle === \'fontawesome\'" style="width: 16px;display: inline-block"><i *ngIf="isSelected(option)" class="fa fa-check" aria-hidden="true"></i> </span><span [ngClass]="settings.itemClasses" [style.font-weight]="this.parents.indexOf(option.id)>=0?\'bold\':\'normal\'">{{ option.name }}</span></a></li></ul></div>',styles:["a { outline: none !important;}.dropdown-inline { display: inline-block;}.dropdown-toggle .caret { margin-left: 4px; white-space: nowrap; display: inline-block;}"],providers:[MULTISELECT_VALUE_ACCESSOR]}]}],MultiselectDropdown.ctorParameters=function(){return[{type:_angular_core.ElementRef},{type:_angular_core.IterableDiffers}]},MultiselectDropdown.propDecorators={options:[{type:_angular_core.Input}],settings:[{type:_angular_core.Input}],texts:[{type:_angular_core.Input}],disabled:[{type:_angular_core.Input}],selectionLimitReached:[{type:_angular_core.Output}],dropdownClosed:[{type:_angular_core.Output}],dropdownOpened:[{type:_angular_core.Output}],onAdded:[{type:_angular_core.Output}],onRemoved:[{type:_angular_core.Output}],onClick:[{type:_angular_core.HostListener,args:["document: click",["$event.target"]]}]};var MultiselectDropdownModule=function(){function MultiselectDropdownModule(){}return MultiselectDropdownModule}();MultiselectDropdownModule.decorators=[{type:_angular_core.NgModule,args:[{imports:[_angular_common.CommonModule,_angular_forms.FormsModule],exports:[MultiselectDropdown,MultiSelectSearchFilter],declarations:[MultiselectDropdown,MultiSelectSearchFilter]}]}],MultiselectDropdownModule.ctorParameters=function(){return[]},exports.MultiSelectSearchFilter=MultiSelectSearchFilter,exports.MultiselectDropdownModule=MultiselectDropdownModule,exports.MultiselectDropdown=MultiselectDropdown,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/forms","@angular/common"],factory):factory(global.dropdown=global.dropdown||{},global.ng.core,global.ng.forms,global.ng.common)}(this,function(exports,_angular_core,_angular_forms,_angular_common){"use strict";var MultiSelectSearchFilter=function(){function MultiSelectSearchFilter(){}return MultiSelectSearchFilter.prototype.transform=function(options,args){var matchPredicate=function(option){return option.name.toLowerCase().indexOf((args||"").toLowerCase())>-1},getChildren=function(option){return options.filter(function(child){return child.parentId===option.id})},getParent=function(option){return options.find(function(parent){return option.parentId===parent.id})};return options.filter(function(option){return matchPredicate(option)||"undefined"==typeof option.parentId&&getChildren(option).some(matchPredicate)||"undefined"!=typeof option.parentId&&matchPredicate(getParent(option))})},MultiSelectSearchFilter}();MultiSelectSearchFilter.decorators=[{type:_angular_core.Pipe,args:[{name:"searchFilter"}]}],MultiSelectSearchFilter.ctorParameters=function(){return[]};var MULTISELECT_VALUE_ACCESSOR={provide:_angular_forms.NG_VALUE_ACCESSOR,useExisting:_angular_core.forwardRef(function(){return MultiselectDropdown}),multi:!0},MultiselectDropdown=function(){function MultiselectDropdown(element,differs){this.element=element,this.disabled=!1,this.selectionLimitReached=new _angular_core.EventEmitter,this.dropdownClosed=new _angular_core.EventEmitter,this.dropdownOpened=new _angular_core.EventEmitter,this.onAdded=new _angular_core.EventEmitter,this.onRemoved=new _angular_core.EventEmitter,this.numSelected=0,this.isVisible=!1,this.searchFilterText="",this.defaultSettings={pullRight:!1,enableSearch:!1,checkedStyle:"checkboxes",buttonClasses:"btn btn-default btn-secondary",containerClasses:"dropdown-inline",selectionLimit:0,closeOnSelect:!1,autoUnselect:!1,showCheckAll:!1,showUncheckAll:!1,fixedTitle:!1,dynamicTitleMaxItems:3,maxHeight:"300px"},this.defaultTexts={checkAll:"Check all",uncheckAll:"Uncheck all",checked:"checked",checkedPlural:"checked",searchPlaceholder:"Search...",defaultTitle:"Select",allSelected:"All selected"},this.onModelChange=function(){},this.onModelTouched=function(){},this.differ=differs.find([]).create(null)}return MultiselectDropdown.prototype.onClick=function(target){if(this.isVisible){for(var parentFound=!1;null!=target&&!parentFound;)target===this.element.nativeElement&&(parentFound=!0),target=target.parentElement;parentFound||(this.isVisible=!1,this.dropdownClosed.emit())}},MultiselectDropdown.prototype.getItemStyle=function(option){return option.isLabel?void 0:{cursor:"pointer"}},MultiselectDropdown.prototype.ngOnInit=function(){this.settings=Object.assign(this.defaultSettings,this.settings),this.texts=Object.assign(this.defaultTexts,this.texts),this.title=this.texts.defaultTitle||""},MultiselectDropdown.prototype.ngOnChanges=function(changes){changes.options&&(this.options=this.options||[],this.parents=this.options.filter(function(option){return"number"==typeof option.parentId}).map(function(option){return option.parentId})),changes.texts&&!changes.texts.isFirstChange()&&this.updateTitle()},MultiselectDropdown.prototype.writeValue=function(value){this.model=void 0!==value&&null!==value?value:[]},MultiselectDropdown.prototype.registerOnChange=function(fn){this.onModelChange=fn},MultiselectDropdown.prototype.registerOnTouched=function(fn){this.onModelTouched=fn},MultiselectDropdown.prototype.setDisabledState=function(isDisabled){this.disabled=isDisabled},MultiselectDropdown.prototype.ngDoCheck=function(){var changes=this.differ.diff(this.model);changes&&(this.updateNumSelected(),this.updateTitle())},MultiselectDropdown.prototype.validate=function(){return this.model&&this.model.length?null:{required:{valid:!1}}},MultiselectDropdown.prototype.registerOnValidatorChange=function(){throw new Error("Method not implemented.")},MultiselectDropdown.prototype.clearSearch=function(event){event.stopPropagation(),this.searchFilterText=""},MultiselectDropdown.prototype.toggleDropdown=function(){this.isVisible=!this.isVisible,this.isVisible?this.dropdownOpened.emit():this.dropdownClosed.emit()},MultiselectDropdown.prototype.isSelected=function(option){return this.model&&this.model.indexOf(option.id)>-1},MultiselectDropdown.prototype.setSelected=function(_event,option){var _this=this;_event.stopPropagation(),this.model||(this.model=[]);var index=this.model.indexOf(option.id);if(index>-1){this.model.splice(index,1),this.onRemoved.emit(option.id);var parentIndex=option.parentId&&this.model.indexOf(option.parentId);if(parentIndex>=0)this.model.splice(parentIndex,1),this.onRemoved.emit(option.parentId);else if(this.parents.indexOf(option.id)>-1){var childIds_1=this.options.filter(function(child){return _this.model.indexOf(child.id)>-1&&child.parentId==option.id}).map(function(child){return child.id});this.model=this.model.filter(function(id){return childIds_1.indexOf(id)<0}),childIds_1.forEach(function(childId){return _this.onRemoved.emit(childId)})}}else if(0===this.settings.selectionLimit||this.settings.selectionLimit&&this.model.length<this.settings.selectionLimit){if(this.model.push(option.id),this.onAdded.emit(option.id),option.parentId){var children=this.options.filter(function(child){return child.id!==option.id&&child.parentId==option.parentId});children.every(function(child){return _this.model.indexOf(child.id)>-1})&&(this.model.push(option.parentId),this.onAdded.emit(option.parentId))}else if(this.parents.indexOf(option.id)>-1){var children=this.options.filter(function(child){return _this.model.indexOf(child.id)<0&&child.parentId==option.id});children.forEach(function(child){_this.model.push(child.id),_this.onAdded.emit(child.id)})}}else{if(!this.settings.autoUnselect)return void this.selectionLimitReached.emit(this.model.length);this.model.push(option.id),this.onAdded.emit(option.id);var removedOption=this.model.shift();this.onRemoved.emit(removedOption)}this.settings.closeOnSelect&&this.toggleDropdown(),this.model=this.model.slice(),this.onModelChange(this.model),this.onModelTouched()},MultiselectDropdown.prototype.updateNumSelected=function(){var _this=this;this.numSelected=this.model&&this.model.filter(function(id){return _this.parents.indexOf(id)<0}).length||0},MultiselectDropdown.prototype.updateTitle=function(){var _this=this;this.title=0===this.numSelected||this.settings.fixedTitle?this.texts.defaultTitle||"":this.settings.displayAllSelectedText&&this.model.length===this.options.length?this.texts.allSelected||"":this.settings.dynamicTitleMaxItems&&this.settings.dynamicTitleMaxItems>=this.numSelected?this.options.filter(function(option){return _this.model&&_this.model.indexOf(option.id)>-1}).map(function(option){return option.name}).join(", "):this.numSelected+" "+(1===this.numSelected?this.texts.checked:this.texts.checkedPlural)},MultiselectDropdown.prototype.searchFilterApplied=function(){return this.settings.enableSearch&&this.searchFilterText&&this.searchFilterText.length>0},MultiselectDropdown.prototype.checkAll=function(){var _this=this,checkedOptions=(this.searchFilterApplied()?(new MultiSelectSearchFilter).transform(this.options,this.searchFilterText):this.options).filter(function(option){return-1===_this.model.indexOf(option.id)?(_this.onAdded.emit(option.id),!0):!1}).map(function(option){return option.id});this.model=this.model.concat(checkedOptions),this.onModelChange(this.model),this.onModelTouched()},MultiselectDropdown.prototype.uncheckAll=function(){var _this=this,unCheckedOptions=this.searchFilterApplied()?(new MultiSelectSearchFilter).transform(this.options,this.searchFilterText).map(function(option){return option.id}):this.model;this.model=this.model.filter(function(id){return unCheckedOptions.indexOf(id)<0?!0:(_this.onRemoved.emit(id),!1)}),this.onModelChange(this.model),this.onModelTouched()},MultiselectDropdown.prototype.preventCheckboxCheck=function(event,option){this.settings.selectionLimit&&!this.settings.autoUnselect&&this.model.length>=this.settings.selectionLimit&&-1===this.model.indexOf(option.id)&&event.preventDefault()},MultiselectDropdown}();MultiselectDropdown.decorators=[{type:_angular_core.Component,args:[{selector:"ss-multiselect-dropdown",template:'<div class="dropdown" [ngClass]="settings.containerClasses" [class.open]="isVisible"><button type="button" class="dropdown-toggle" [ngClass]="settings.buttonClasses" (click)="toggleDropdown()" [disabled]="disabled">{{ title }}<span class="caret"></span></button><ul *ngIf="isVisible" class="dropdown-menu" [class.pull-right]="settings.pullRight" [class.dropdown-menu-right]="settings.pullRight" [style.max-height]="settings.maxHeight" style="display: block; height: auto; overflow-y: auto"><li class="dropdown-item search" *ngIf="settings.enableSearch"><div class="input-group input-group-sm"><span class="input-group-addon" id="sizing-addon3"><i class="fa fa-search"></i></span> <input type="text" class="form-control" placeholder="{{ texts.searchPlaceholder }}" aria-describedby="sizing-addon3" [(ngModel)]="searchFilterText" [ngModelOptions]="{standalone: true}" autofocus> <span class="input-group-btn" *ngIf="searchFilterText.length > 0"><button class="btn btn-default btn-secondary" type="button" (click)="clearSearch($event)"><i class="fa fa-times"></i></button></span></div></li><li class="dropdown-divider divider" *ngIf="settings.enableSearch"></li><li class="dropdown-item check-control check-control-check" *ngIf="settings.showCheckAll"><a href="javascript:;" role="menuitem" tabindex="-1" (click)="checkAll()"><span style="width: 16px" [ngClass]="{\'glyphicon glyphicon-ok\': settings.checkedStyle !== \'fontawesome\',\'fa fa-check\': settings.checkedStyle === \'fontawesome\'}"></span> {{ texts.checkAll }}</a></li><li class="dropdown-item check-control check-control-uncheck" *ngIf="settings.showUncheckAll"><a href="javascript:;" role="menuitem" tabindex="-1" (click)="uncheckAll()"><span style="width: 16px" [ngClass]="{\'glyphicon glyphicon-remove\': settings.checkedStyle !== \'fontawesome\',\'fa fa-times\': settings.checkedStyle === \'fontawesome\'}"></span> {{ texts.uncheckAll }}</a></li><li *ngIf="settings.showCheckAll || settings.showUncheckAll" class="dropdown-divider divider"></li><li class="dropdown-item" [ngStyle]="getItemStyle(option)" *ngFor="let option of options | searchFilter:searchFilterText" (click)="!option.isLabel && setSelected($event, option)" [class.dropdown-header]="option.isLabel"><ng-template [ngIf]="option.isLabel">{{ option.name }}</ng-template><a *ngIf="!option.isLabel" href="javascript:;" role="menuitem" tabindex="-1" [style.padding-left]="this.parents.length>0&&this.parents.indexOf(option.id)<0&&\'30px\'"><input *ngIf="settings.checkedStyle === \'checkboxes\'" type="checkbox" [checked]="isSelected(option)" (click)="preventCheckboxCheck($event, option)"> <span *ngIf="settings.checkedStyle === \'glyphicon\'" style="width: 16px" class="glyphicon" [class.glyphicon-ok]="isSelected(option)"></span> <span *ngIf="settings.checkedStyle === \'fontawesome\'" style="width: 16px;display: inline-block"><i *ngIf="isSelected(option)" class="fa fa-check" aria-hidden="true"></i> </span><span [ngClass]="settings.itemClasses" [style.font-weight]="this.parents.indexOf(option.id)>=0?\'bold\':\'normal\'">{{ option.name }}</span></a></li></ul></div>',styles:["a { outline: none !important;}.dropdown-inline { display: inline-block;}.dropdown-toggle .caret { margin-left: 4px; white-space: nowrap; display: inline-block;}"],providers:[MULTISELECT_VALUE_ACCESSOR]}]}],MultiselectDropdown.ctorParameters=function(){return[{type:_angular_core.ElementRef},{type:_angular_core.IterableDiffers}]},MultiselectDropdown.propDecorators={options:[{type:_angular_core.Input}],settings:[{type:_angular_core.Input}],texts:[{type:_angular_core.Input}],disabled:[{type:_angular_core.Input}],selectionLimitReached:[{type:_angular_core.Output}],dropdownClosed:[{type:_angular_core.Output}],dropdownOpened:[{type:_angular_core.Output}],onAdded:[{type:_angular_core.Output}],onRemoved:[{type:_angular_core.Output}],onClick:[{type:_angular_core.HostListener,args:["document: click",["$event.target"]]}]};var MultiselectDropdownModule=function(){function MultiselectDropdownModule(){}return MultiselectDropdownModule}();MultiselectDropdownModule.decorators=[{type:_angular_core.NgModule,args:[{imports:[_angular_common.CommonModule,_angular_forms.FormsModule],exports:[MultiselectDropdown,MultiSelectSearchFilter],declarations:[MultiselectDropdown,MultiSelectSearchFilter]}]}],MultiselectDropdownModule.ctorParameters=function(){return[]},exports.MultiSelectSearchFilter=MultiSelectSearchFilter,exports.MultiselectDropdownModule=MultiselectDropdownModule,exports.MultiselectDropdown=MultiselectDropdown,Object.defineProperty(exports,"__esModule",{value:!0})}); |
@@ -138,2 +138,3 @@ /* | ||
var _this = this; | ||
_event.stopPropagation(); | ||
if (!this.model) { | ||
@@ -192,2 +193,3 @@ this.model = []; | ||
} | ||
this.model = this.model.slice(); | ||
this.onModelChange(this.model); | ||
@@ -194,0 +196,0 @@ this.onModelTouched(); |
{ | ||
"name": "angular-2-dropdown-multiselect", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Customizable dropdown multiselect in Angular 2 with bootstrap css.", | ||
@@ -5,0 +5,0 @@ "main": "bundles/dropdown.umd.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
158600
783
0