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

ngx-select-dropdown

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-select-dropdown - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

4

bundles/ngx-select-dropdown.umd.js

@@ -790,2 +790,6 @@ (function (global, factory) {

this.availableItems = __spread(sortedItems);
/* istanbul ignore else */
if (!Array.isArray(this.value)) {
this.value = [];
}
this.valueChanged();

@@ -792,0 +796,0 @@ this.resetArrowKeyActiveElement();

2

bundles/ngx-select-dropdown.umd.min.js

@@ -15,3 +15,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-select-dropdown",["exports","@angular/core","@angular/forms","@angular/common"],t):t((e=e||self)["ngx-select-dropdown"]={},e.ng.core,e.ng.forms,e.ng.common)}(this,(function(e,t,n,o){"use strict";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var i=function(){return(i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,i,s=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)r.push(o.value)}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return r}function a(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e}var l=function(){function e(){this._isOpen=!1}return Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!0,configurable:!0}),e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();var c=function(){function e(){}return e.prototype.transform=function(e,t,n){return e&&t&&Array.isArray(e)?"string"==typeof e[0]?e.filter((function(e){return e.toLowerCase().indexOf(t.toLowerCase())>-1})):n?e.filter((function(e){return"object"!=typeof e[n]&&e[n].toString().toLowerCase().indexOf(t.toLowerCase())>-1})):e.filter((function(e){for(var n in e)if("object"!=typeof e[n]&&e[n].toString().toLowerCase().indexOf(t.toLowerCase())>-1)return!0;return!1})):e},e.decorators=[{type:t.Pipe,args:[{name:"filterBy"}]}],e}(),d=function(){function e(e,n){this.cdref=e,this._elementRef=n,this.options=[],this.config={},this.multiple=!1,this.change=new t.EventEmitter,this.searchChange=new t.EventEmitter,this.open=new t.EventEmitter,this.close=new t.EventEmitter,this.toggleDropdown=!1,this.availableItems=[],this.selectedItems=[],this.selectedDisplayText="Select",this.clickedInside=!1,this.insideKeyPress=!1,this.focusedItemIndex=null,this.showNotFound=!1,this.onChange=function(){},this.onTouched=function(){},this.multiple=!1}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e,this.onChange(e),this.onTouched()},enumerable:!0,configurable:!0}),e.prototype.clickInsideComponent=function(){this.clickedInside=!0},e.prototype.blur=function(){this.toggleDropdown=!1},e.prototype.focus=function(){this.disabled||this.toggleSelectDropdown()},e.prototype.clickOutsideComponent=function(){this.clickedInside||(this.toggleDropdown=!1,this.resetArrowKeyActiveElement(),this.searchText=null,this.close.emit()),this.clickedInside=!1},e.prototype.KeyPressOutsideComponent=function(){this.insideKeyPress||(this.toggleDropdown=!1,this.resetArrowKeyActiveElement()),this.insideKeyPress=!1},e.prototype.handleKeyboardEvent=function(e){if(this.insideKeyPress=!0,27===e.keyCode||this.disabled)return this.toggleDropdown=!1,void(this.insideKeyPress=!1);var t=this.availableOptions.toArray();if(9===e.keyCode||0!==t.length||this.toggleDropdown||(this.toggleDropdown=!0),40===e.keyCode&&t.length>0&&(this.onArrowKeyDown(),this.focusedItemIndex>=t.length&&(this.focusedItemIndex=0),t[this.focusedItemIndex].nativeElement.focus(),e.preventDefault()),38===e.keyCode&&t.length&&(this.onArrowKeyUp(),this.focusedItemIndex>=t.length&&(this.focusedItemIndex=t.length-1),t[this.focusedItemIndex].nativeElement.focus(),e.preventDefault()),13===e.keyCode&&null!==this.focusedItemIndex){var n=(new c).transform(this.availableItems,this.searchText,this.config.searchOnKey);return this.selectItem(n[this.focusedItemIndex],this.availableItems.indexOf(n[this.focusedItemIndex])),!1}},e.prototype.ngOnInit=function(){void 0!==this.options&&Array.isArray(this.options)&&(this.availableItems=a(this.options.sort(this.config.customComparator)),this.initDropdownValuesAndOptions())},e.prototype.ngAfterViewInit=function(){this.availableOptions.changes.subscribe(this.setNotFoundState.bind(this))},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){this.disabled=e},e.prototype.writeValue=function(e,t){e?(Array.isArray(e)?this.multiple?this.value=e:e.length>0&&(this.value=e[0]):this.value=e,0===this.selectedItems.length&&(Array.isArray(e)?this.selectedItems=e:this.selectedItems.push(e),this.initDropdownValuesAndOptions())):(this.value=[],t||this.reset()),t||this.reset()},e.prototype.reset=function(){this.selectedItems=[],this.availableItems=a(this.options.sort(this.config.customComparator)),this.initDropdownValuesAndOptions()},e.prototype.setNotFoundState=function(){0===this.availableOptions.length?this.showNotFound=!0:this.showNotFound=!1,this.cdref.detectChanges()},e.prototype.ngOnChanges=function(e){this.selectedItems=[],this.options=this.options||[],e.options&&(this.availableItems=a(this.options.sort(this.config.customComparator))),e.value&&(JSON.stringify(e.value.currentValue)!==JSON.stringify([])&&""!==e.value.currentValue&&null!==e.value.currentValue||(this.availableItems=a(this.options.sort(this.config.customComparator)))),this.initDropdownValuesAndOptions()},e.prototype.deselectItem=function(e,t){var n=this;this.selectedItems.forEach((function(t,o){e===t&&n.selectedItems.splice(o,1)}));var o=a(this.availableItems);this.availableItems.includes(e)||(this.availableItems.push(e),o=this.availableItems.sort(this.config.customComparator)),this.selectedItems=a(this.selectedItems),this.availableItems=a(o),this.valueChanged(),this.resetArrowKeyActiveElement()},e.prototype.selectItem=function(e,t){var n=this;this.multiple||(this.selectedItems.length>0&&this.availableItems.push(this.selectedItems[0]),this.selectedItems=[],this.toggleDropdown=!1),this.availableItems.forEach((function(t,o){e===t&&(n.selectedItems.push(e),n.availableItems.splice(o,1))})),this.config.clearOnSelection&&(this.searchText=null),this.selectedItems=a(this.selectedItems),this.availableItems=a(this.availableItems),this.selectedItems.sort(this.config.customComparator),this.availableItems.sort(this.config.customComparator),this.valueChanged(),this.resetArrowKeyActiveElement()},e.prototype.valueChanged=function(){this.writeValue(this.selectedItems,!0),this.change.emit({value:this.value}),this.setSelectedDisplayText()},e.prototype.toggleSelectDropdown=function(){this.toggleDropdown=!this.toggleDropdown,this.toggleDropdown?this.open.emit():(this.searchText=null,this.close.emit()),this.resetArrowKeyActiveElement()},e.prototype.searchTextChanged=function(){this.searchChange.emit(this.searchText)},e.prototype.changeSearchText=function(e){e.stopPropagation()},e.prototype.initDropdownValuesAndOptions=function(){var e,t,n=this,o={displayKey:"description",height:"auto",search:!1,placeholder:"Select",searchPlaceholder:"Search...",limitTo:0,customComparator:void 0,noResultsFound:"No results found!",moreText:"more",searchOnKey:null,clearOnSelection:!1,inputDirection:"ltr"};"undefined"!==this.config&&0!==Object.keys(this.config).length||(this.config=i({},o));try{for(var r=s(Object.keys(o)),a=r.next();!a.done;a=r.next()){var l=a.value;this.config[l]=this.config[l]?this.config[l]:o[l]}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.config=i({},this.config),this.selectedDisplayText=this.config.placeholder,""!==this.value&&void 0!==this.value&&(Array.isArray(this.value)?this.selectedItems=this.value:""!==this.value&&null!==this.value?this.selectedItems[0]=this.value:(this.selectedItems=[],this.value=[]),this.selectedItems.forEach((function(e){var t=n.availableItems.findIndex((function(t){return JSON.stringify(e)===JSON.stringify(t)}));-1!==t&&n.availableItems.splice(t,1)}))),this.setSelectedDisplayText()},e.prototype.setSelectedDisplayText=function(){var e=this.selectedItems[0];"object"==typeof this.selectedItems[0]&&(e=this.config.displayFn?this.config.displayFn(this.selectedItems[0]):this.selectedItems[0][this.config.displayKey]),this.multiple&&this.selectedItems.length>0?this.selectedDisplayText=1===this.selectedItems.length?e:e+" + "+(this.selectedItems.length-1)+" "+this.config.moreText:this.selectedDisplayText=0===this.selectedItems.length?this.config.placeholder:e},e.prototype.onArrowKeyUp=function(){0!==this.focusedItemIndex?this.onArrowKey()&&this.focusedItemIndex--:this.focusedItemIndex=this.availableItems.length-1},e.prototype.onArrowKeyDown=function(){this.focusedItemIndex!==this.availableItems.length-1?this.onArrowKey()&&this.focusedItemIndex++:this.focusedItemIndex=0},e.prototype.onArrowKey=function(){return null!==this.focusedItemIndex||(this.focusedItemIndex=0,!1)},e.prototype.resetArrowKeyActiveElement=function(){this.focusedItemIndex=null},e.decorators=[{type:t.Component,args:[{selector:"ngx-select-dropdown",template:'<div class="ngx-dropdown-container" tabindex="0">\n <button type="button" tabindex="-1" class="ngx-dropdown-button" [ngClass]="{ \'ngx-disabled\': disabled }"\n [disabled]="disabled" (click)="toggleSelectDropdown()">\n <span class="display-text">{{ selectedDisplayText }} </span>\n <span class="nsdicon-angle-down"></span>\n </button>\n <div class="ngx-dropdown-list-container" *ngIf="toggleDropdown" [style.maxHeight]="config.height">\n <div class="search-container" *ngIf="config.search">\n <input (change)="changeSearchText($event)" [style.direction]="config.inputDirection" name="search-text"\n (input)="searchTextChanged()" [(ngModel)]="searchText" tabindex="-1" autocomplete="off" />\n <label [ngClass]="{ active: searchText }">\n <span class="nsdicon-search"></span>\n {{ config.searchPlaceholder }}</label>\n </div>\n <ul class="selected-items">\n <li tabindex="-1" *ngFor="let selected of selectedItems; let i = index" (click)="deselectItem(selected, i)">\n <span class="nsdicon-close">x</span>\n <span>\n {{\n config.displayFn\n ? config.displayFn(selected)\n : selected[config.displayKey] || selected\n }}\n </span>\n </li>\n </ul>\n <hr *ngIf="selectedItems.length > 0 && availableItems.length > 0" />\n <ul class="available-items">\n <li #availableOption *ngFor="\n let item of availableItems\n | filterBy: searchText:config.searchOnKey\n | limitTo: config.limitTo;\n let i = index\n " tabindex="-1" [ngClass]="{\n active: focusedItemIndex == i && !item.disabled,\n disabled: item.disabled\n }" (click)="selectItem(item, i)">\n {{\n config.displayFn\n ? config.displayFn(item)\n : item[config.displayKey] || item\n }}\n </li>\n <li *ngIf="showNotFound">{{ config.noResultsFound }}</li>\n </ul>\n </div>\n</div>',providers:[{provide:n.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return e})),multi:!0}],styles:['.ngx-dropdown-container{width:100%;position:relative}.ngx-dropdown-container button{display:inline-block;margin-bottom:0;font-weight:400;line-height:1.42857143;vertical-align:middle;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid #ccc;border-radius:4px;color:#333;background-color:#fff;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;text-align:left}.ngx-dropdown-container button span{display:inline;vertical-align:middle}.ngx-dropdown-container button .nsdicon-angle-down{right:5px;position:relative;float:right}.ngx-dropdown-container button .nsdicon-angle-down::before{border-style:solid;border-width:.1em .1em 0 0;content:"";display:inline-block;height:10px;position:relative;vertical-align:text-top;width:10px;top:0;transform:rotate(135deg)}.ngx-dropdown-container .ngx-dropdown-button{width:100%;min-height:30px;padding:5px 10px;background-color:#fff}.ngx-dropdown-container .ngx-dropdown-button .display-text{display:inline-block;width:calc(100% - 20px)}.ngx-dropdown-container .ngx-dropdown-list-container{box-sizing:border-box;border:1px solid rgba(0,0,0,.15);border-radius:4px;padding-left:10px;padding-right:10px;z-index:999999999;width:100%;background:#fff;position:absolute;box-shadow:5px 5px 5px 0 rgba(0,0,0,.21);overflow-y:auto}.ngx-dropdown-container .ngx-dropdown-list-container .search-container{position:relative;padding-top:10px;margin-top:5px}.ngx-dropdown-container .ngx-dropdown-list-container .search-container input{background-color:transparent;border:none;border-bottom:1px solid #9e9e9e;border-radius:0;outline:0;height:2rem;width:100%;font-size:13px;margin:0;padding:0;box-shadow:none;box-sizing:content-box;transition:.3s}.ngx-dropdown-container .ngx-dropdown-list-container .search-container input:focus{border-bottom:1px solid #26a69a}.ngx-dropdown-container .ngx-dropdown-list-container .search-container input:focus+label{transform:translateY(-2px) scale(.8);transform-origin:0 0}.ngx-dropdown-container .ngx-dropdown-list-container .search-container label{color:#9e9e9e;position:absolute;top:0;left:0;height:100%;font-size:1rem;cursor:text;transition:transform .2s ease-out;transform-origin:0 100%;text-align:initial;transform:translateY(12px);pointer-events:none}.ngx-dropdown-container .ngx-dropdown-list-container .search-container label.active{transform:translateY(-2px) scale(.8);transform-origin:0 0}.ngx-dropdown-container .ngx-dropdown-list-container ul{margin-top:1rem;margin-bottom:1rem;list-style-type:none;padding-left:0}.ngx-dropdown-container .ngx-dropdown-list-container ul.selected-items li{background-color:#337ab7;color:#fff;margin-bottom:2px}.ngx-dropdown-container .ngx-dropdown-list-container ul.selected-items li .nsdicon-close{font-weight:700;font-size:large}.ngx-dropdown-container .ngx-dropdown-list-container ul.available-items li.active{background-color:#337ab7;color:#ffff}.ngx-dropdown-container .ngx-dropdown-list-container ul li{font-size:inherit;cursor:pointer;display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:normal}.ngx-dropdown-container .ngx-disabled{pointer-events:none;background-color:#e9ecef;opacity:1;cursor:no-drop}']}]}],e.ctorParameters=function(){return[{type:t.ChangeDetectorRef},{type:t.ElementRef}]},e.propDecorators={_value:[{type:t.Input}],options:[{type:t.Input}],config:[{type:t.Input}],multiple:[{type:t.Input}],disabled:[{type:t.Input}],change:[{type:t.Output}],searchChange:[{type:t.Output}],open:[{type:t.Output}],close:[{type:t.Output}],availableOptions:[{type:t.ViewChildren,args:["availableOption"]}],clickInsideComponent:[{type:t.HostListener,args:["click"]}],blur:[{type:t.HostListener,args:["blur"]}],focus:[{type:t.HostListener,args:["focus"]}],clickOutsideComponent:[{type:t.HostListener,args:["document:click"]}],KeyPressOutsideComponent:[{type:t.HostListener,args:["document:keydown"]}],handleKeyboardEvent:[{type:t.HostListener,args:["keydown",["$event"]]}]},e}();var p=function(){function e(){}return e.prototype.transform=function(e,t,n){return void 0===n&&(n=0),Array.isArray(e)&&0!==t?e.slice(n,n+t):e},e.decorators=[{type:t.Pipe,args:[{name:"limitTo"}]}],e}(),h=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{declarations:[d,c,p],imports:[o.CommonModule,n.FormsModule],exports:[d,c,p]}]}],e}();e.FilterByPipe=c,e.LimitToPipe=p,e.NgxSelectDropdownComponent=d,e.SelectDropDownModule=h,e.SelectDropDownService=l,Object.defineProperty(e,"__esModule",{value:!0})}));
***************************************************************************** */var i=function(){return(i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,i,s=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)r.push(o.value)}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return r}function a(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e}var l=function(){function e(){this._isOpen=!1}return Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!0,configurable:!0}),e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();var c=function(){function e(){}return e.prototype.transform=function(e,t,n){return e&&t&&Array.isArray(e)?"string"==typeof e[0]?e.filter((function(e){return e.toLowerCase().indexOf(t.toLowerCase())>-1})):n?e.filter((function(e){return"object"!=typeof e[n]&&e[n].toString().toLowerCase().indexOf(t.toLowerCase())>-1})):e.filter((function(e){for(var n in e)if("object"!=typeof e[n]&&e[n].toString().toLowerCase().indexOf(t.toLowerCase())>-1)return!0;return!1})):e},e.decorators=[{type:t.Pipe,args:[{name:"filterBy"}]}],e}(),d=function(){function e(e,n){this.cdref=e,this._elementRef=n,this.options=[],this.config={},this.multiple=!1,this.change=new t.EventEmitter,this.searchChange=new t.EventEmitter,this.open=new t.EventEmitter,this.close=new t.EventEmitter,this.toggleDropdown=!1,this.availableItems=[],this.selectedItems=[],this.selectedDisplayText="Select",this.clickedInside=!1,this.insideKeyPress=!1,this.focusedItemIndex=null,this.showNotFound=!1,this.onChange=function(){},this.onTouched=function(){},this.multiple=!1}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e,this.onChange(e),this.onTouched()},enumerable:!0,configurable:!0}),e.prototype.clickInsideComponent=function(){this.clickedInside=!0},e.prototype.blur=function(){this.toggleDropdown=!1},e.prototype.focus=function(){this.disabled||this.toggleSelectDropdown()},e.prototype.clickOutsideComponent=function(){this.clickedInside||(this.toggleDropdown=!1,this.resetArrowKeyActiveElement(),this.searchText=null,this.close.emit()),this.clickedInside=!1},e.prototype.KeyPressOutsideComponent=function(){this.insideKeyPress||(this.toggleDropdown=!1,this.resetArrowKeyActiveElement()),this.insideKeyPress=!1},e.prototype.handleKeyboardEvent=function(e){if(this.insideKeyPress=!0,27===e.keyCode||this.disabled)return this.toggleDropdown=!1,void(this.insideKeyPress=!1);var t=this.availableOptions.toArray();if(9===e.keyCode||0!==t.length||this.toggleDropdown||(this.toggleDropdown=!0),40===e.keyCode&&t.length>0&&(this.onArrowKeyDown(),this.focusedItemIndex>=t.length&&(this.focusedItemIndex=0),t[this.focusedItemIndex].nativeElement.focus(),e.preventDefault()),38===e.keyCode&&t.length&&(this.onArrowKeyUp(),this.focusedItemIndex>=t.length&&(this.focusedItemIndex=t.length-1),t[this.focusedItemIndex].nativeElement.focus(),e.preventDefault()),13===e.keyCode&&null!==this.focusedItemIndex){var n=(new c).transform(this.availableItems,this.searchText,this.config.searchOnKey);return this.selectItem(n[this.focusedItemIndex],this.availableItems.indexOf(n[this.focusedItemIndex])),!1}},e.prototype.ngOnInit=function(){void 0!==this.options&&Array.isArray(this.options)&&(this.availableItems=a(this.options.sort(this.config.customComparator)),this.initDropdownValuesAndOptions())},e.prototype.ngAfterViewInit=function(){this.availableOptions.changes.subscribe(this.setNotFoundState.bind(this))},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){this.disabled=e},e.prototype.writeValue=function(e,t){e?(Array.isArray(e)?this.multiple?this.value=e:e.length>0&&(this.value=e[0]):this.value=e,0===this.selectedItems.length&&(Array.isArray(e)?this.selectedItems=e:this.selectedItems.push(e),this.initDropdownValuesAndOptions())):(this.value=[],t||this.reset()),t||this.reset()},e.prototype.reset=function(){this.selectedItems=[],this.availableItems=a(this.options.sort(this.config.customComparator)),this.initDropdownValuesAndOptions()},e.prototype.setNotFoundState=function(){0===this.availableOptions.length?this.showNotFound=!0:this.showNotFound=!1,this.cdref.detectChanges()},e.prototype.ngOnChanges=function(e){this.selectedItems=[],this.options=this.options||[],e.options&&(this.availableItems=a(this.options.sort(this.config.customComparator))),e.value&&(JSON.stringify(e.value.currentValue)!==JSON.stringify([])&&""!==e.value.currentValue&&null!==e.value.currentValue||(this.availableItems=a(this.options.sort(this.config.customComparator)))),this.initDropdownValuesAndOptions()},e.prototype.deselectItem=function(e,t){var n=this;this.selectedItems.forEach((function(t,o){e===t&&n.selectedItems.splice(o,1)}));var o=a(this.availableItems);this.availableItems.includes(e)||(this.availableItems.push(e),o=this.availableItems.sort(this.config.customComparator)),this.selectedItems=a(this.selectedItems),this.availableItems=a(o),Array.isArray(this.value)||(this.value=[]),this.valueChanged(),this.resetArrowKeyActiveElement()},e.prototype.selectItem=function(e,t){var n=this;this.multiple||(this.selectedItems.length>0&&this.availableItems.push(this.selectedItems[0]),this.selectedItems=[],this.toggleDropdown=!1),this.availableItems.forEach((function(t,o){e===t&&(n.selectedItems.push(e),n.availableItems.splice(o,1))})),this.config.clearOnSelection&&(this.searchText=null),this.selectedItems=a(this.selectedItems),this.availableItems=a(this.availableItems),this.selectedItems.sort(this.config.customComparator),this.availableItems.sort(this.config.customComparator),this.valueChanged(),this.resetArrowKeyActiveElement()},e.prototype.valueChanged=function(){this.writeValue(this.selectedItems,!0),this.change.emit({value:this.value}),this.setSelectedDisplayText()},e.prototype.toggleSelectDropdown=function(){this.toggleDropdown=!this.toggleDropdown,this.toggleDropdown?this.open.emit():(this.searchText=null,this.close.emit()),this.resetArrowKeyActiveElement()},e.prototype.searchTextChanged=function(){this.searchChange.emit(this.searchText)},e.prototype.changeSearchText=function(e){e.stopPropagation()},e.prototype.initDropdownValuesAndOptions=function(){var e,t,n=this,o={displayKey:"description",height:"auto",search:!1,placeholder:"Select",searchPlaceholder:"Search...",limitTo:0,customComparator:void 0,noResultsFound:"No results found!",moreText:"more",searchOnKey:null,clearOnSelection:!1,inputDirection:"ltr"};"undefined"!==this.config&&0!==Object.keys(this.config).length||(this.config=i({},o));try{for(var r=s(Object.keys(o)),a=r.next();!a.done;a=r.next()){var l=a.value;this.config[l]=this.config[l]?this.config[l]:o[l]}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.config=i({},this.config),this.selectedDisplayText=this.config.placeholder,""!==this.value&&void 0!==this.value&&(Array.isArray(this.value)?this.selectedItems=this.value:""!==this.value&&null!==this.value?this.selectedItems[0]=this.value:(this.selectedItems=[],this.value=[]),this.selectedItems.forEach((function(e){var t=n.availableItems.findIndex((function(t){return JSON.stringify(e)===JSON.stringify(t)}));-1!==t&&n.availableItems.splice(t,1)}))),this.setSelectedDisplayText()},e.prototype.setSelectedDisplayText=function(){var e=this.selectedItems[0];"object"==typeof this.selectedItems[0]&&(e=this.config.displayFn?this.config.displayFn(this.selectedItems[0]):this.selectedItems[0][this.config.displayKey]),this.multiple&&this.selectedItems.length>0?this.selectedDisplayText=1===this.selectedItems.length?e:e+" + "+(this.selectedItems.length-1)+" "+this.config.moreText:this.selectedDisplayText=0===this.selectedItems.length?this.config.placeholder:e},e.prototype.onArrowKeyUp=function(){0!==this.focusedItemIndex?this.onArrowKey()&&this.focusedItemIndex--:this.focusedItemIndex=this.availableItems.length-1},e.prototype.onArrowKeyDown=function(){this.focusedItemIndex!==this.availableItems.length-1?this.onArrowKey()&&this.focusedItemIndex++:this.focusedItemIndex=0},e.prototype.onArrowKey=function(){return null!==this.focusedItemIndex||(this.focusedItemIndex=0,!1)},e.prototype.resetArrowKeyActiveElement=function(){this.focusedItemIndex=null},e.decorators=[{type:t.Component,args:[{selector:"ngx-select-dropdown",template:'<div class="ngx-dropdown-container" tabindex="0">\n <button type="button" tabindex="-1" class="ngx-dropdown-button" [ngClass]="{ \'ngx-disabled\': disabled }"\n [disabled]="disabled" (click)="toggleSelectDropdown()">\n <span class="display-text">{{ selectedDisplayText }} </span>\n <span class="nsdicon-angle-down"></span>\n </button>\n <div class="ngx-dropdown-list-container" *ngIf="toggleDropdown" [style.maxHeight]="config.height">\n <div class="search-container" *ngIf="config.search">\n <input (change)="changeSearchText($event)" [style.direction]="config.inputDirection" name="search-text"\n (input)="searchTextChanged()" [(ngModel)]="searchText" tabindex="-1" autocomplete="off" />\n <label [ngClass]="{ active: searchText }">\n <span class="nsdicon-search"></span>\n {{ config.searchPlaceholder }}</label>\n </div>\n <ul class="selected-items">\n <li tabindex="-1" *ngFor="let selected of selectedItems; let i = index" (click)="deselectItem(selected, i)">\n <span class="nsdicon-close">x</span>\n <span>\n {{\n config.displayFn\n ? config.displayFn(selected)\n : selected[config.displayKey] || selected\n }}\n </span>\n </li>\n </ul>\n <hr *ngIf="selectedItems.length > 0 && availableItems.length > 0" />\n <ul class="available-items">\n <li #availableOption *ngFor="\n let item of availableItems\n | filterBy: searchText:config.searchOnKey\n | limitTo: config.limitTo;\n let i = index\n " tabindex="-1" [ngClass]="{\n active: focusedItemIndex == i && !item.disabled,\n disabled: item.disabled\n }" (click)="selectItem(item, i)">\n {{\n config.displayFn\n ? config.displayFn(item)\n : item[config.displayKey] || item\n }}\n </li>\n <li *ngIf="showNotFound">{{ config.noResultsFound }}</li>\n </ul>\n </div>\n</div>',providers:[{provide:n.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return e})),multi:!0}],styles:['.ngx-dropdown-container{width:100%;position:relative}.ngx-dropdown-container button{display:inline-block;margin-bottom:0;font-weight:400;line-height:1.42857143;vertical-align:middle;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid #ccc;border-radius:4px;color:#333;background-color:#fff;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;text-align:left}.ngx-dropdown-container button span{display:inline;vertical-align:middle}.ngx-dropdown-container button .nsdicon-angle-down{right:5px;position:relative;float:right}.ngx-dropdown-container button .nsdicon-angle-down::before{border-style:solid;border-width:.1em .1em 0 0;content:"";display:inline-block;height:10px;position:relative;vertical-align:text-top;width:10px;top:0;transform:rotate(135deg)}.ngx-dropdown-container .ngx-dropdown-button{width:100%;min-height:30px;padding:5px 10px;background-color:#fff}.ngx-dropdown-container .ngx-dropdown-button .display-text{display:inline-block;width:calc(100% - 20px)}.ngx-dropdown-container .ngx-dropdown-list-container{box-sizing:border-box;border:1px solid rgba(0,0,0,.15);border-radius:4px;padding-left:10px;padding-right:10px;z-index:999999999;width:100%;background:#fff;position:absolute;box-shadow:5px 5px 5px 0 rgba(0,0,0,.21);overflow-y:auto}.ngx-dropdown-container .ngx-dropdown-list-container .search-container{position:relative;padding-top:10px;margin-top:5px}.ngx-dropdown-container .ngx-dropdown-list-container .search-container input{background-color:transparent;border:none;border-bottom:1px solid #9e9e9e;border-radius:0;outline:0;height:2rem;width:100%;font-size:13px;margin:0;padding:0;box-shadow:none;box-sizing:content-box;transition:.3s}.ngx-dropdown-container .ngx-dropdown-list-container .search-container input:focus{border-bottom:1px solid #26a69a}.ngx-dropdown-container .ngx-dropdown-list-container .search-container input:focus+label{transform:translateY(-2px) scale(.8);transform-origin:0 0}.ngx-dropdown-container .ngx-dropdown-list-container .search-container label{color:#9e9e9e;position:absolute;top:0;left:0;height:100%;font-size:1rem;cursor:text;transition:transform .2s ease-out;transform-origin:0 100%;text-align:initial;transform:translateY(12px);pointer-events:none}.ngx-dropdown-container .ngx-dropdown-list-container .search-container label.active{transform:translateY(-2px) scale(.8);transform-origin:0 0}.ngx-dropdown-container .ngx-dropdown-list-container ul{margin-top:1rem;margin-bottom:1rem;list-style-type:none;padding-left:0}.ngx-dropdown-container .ngx-dropdown-list-container ul.selected-items li{background-color:#337ab7;color:#fff;margin-bottom:2px}.ngx-dropdown-container .ngx-dropdown-list-container ul.selected-items li .nsdicon-close{font-weight:700;font-size:large}.ngx-dropdown-container .ngx-dropdown-list-container ul.available-items li.active{background-color:#337ab7;color:#ffff}.ngx-dropdown-container .ngx-dropdown-list-container ul li{font-size:inherit;cursor:pointer;display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:normal}.ngx-dropdown-container .ngx-disabled{pointer-events:none;background-color:#e9ecef;opacity:1;cursor:no-drop}']}]}],e.ctorParameters=function(){return[{type:t.ChangeDetectorRef},{type:t.ElementRef}]},e.propDecorators={_value:[{type:t.Input}],options:[{type:t.Input}],config:[{type:t.Input}],multiple:[{type:t.Input}],disabled:[{type:t.Input}],change:[{type:t.Output}],searchChange:[{type:t.Output}],open:[{type:t.Output}],close:[{type:t.Output}],availableOptions:[{type:t.ViewChildren,args:["availableOption"]}],clickInsideComponent:[{type:t.HostListener,args:["click"]}],blur:[{type:t.HostListener,args:["blur"]}],focus:[{type:t.HostListener,args:["focus"]}],clickOutsideComponent:[{type:t.HostListener,args:["document:click"]}],KeyPressOutsideComponent:[{type:t.HostListener,args:["document:keydown"]}],handleKeyboardEvent:[{type:t.HostListener,args:["keydown",["$event"]]}]},e}();var p=function(){function e(){}return e.prototype.transform=function(e,t,n){return void 0===n&&(n=0),Array.isArray(e)&&0!==t?e.slice(n,n+t):e},e.decorators=[{type:t.Pipe,args:[{name:"limitTo"}]}],e}(),h=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{declarations:[d,c,p],imports:[o.CommonModule,n.FormsModule],exports:[d,c,p]}]}],e}();e.FilterByPipe=c,e.LimitToPipe=p,e.NgxSelectDropdownComponent=d,e.SelectDropDownModule=h,e.SelectDropDownService=l,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-select-dropdown.umd.min.js.map

@@ -461,2 +461,6 @@ import { Injectable, ɵɵdefineInjectable, Pipe, EventEmitter, Component, forwardRef, ChangeDetectorRef, ElementRef, Input, Output, ViewChildren, HostListener, NgModule } from '@angular/core';

this.availableItems = [...sortedItems];
/* istanbul ignore else */
if (!Array.isArray(this.value)) {
this.value = [];
}
this.valueChanged();

@@ -463,0 +467,0 @@ this.resetArrowKeyActiveElement();

@@ -570,2 +570,6 @@ import { Injectable, ɵɵdefineInjectable, Pipe, EventEmitter, Component, forwardRef, ChangeDetectorRef, ElementRef, Input, Output, ViewChildren, HostListener, NgModule } from '@angular/core';

this.availableItems = __spread(sortedItems);
/* istanbul ignore else */
if (!Array.isArray(this.value)) {
this.value = [];
}
this.valueChanged();

@@ -572,0 +576,0 @@ this.resetArrowKeyActiveElement();

{
"name": "ngx-select-dropdown",
"version": "2.0.0",
"version": "2.1.0",
"description": "A angular(4+) select dropdown for single select or multiselct module.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -191,2 +191,7 @@ # ngx-select-dropdown

````
* v2.0.0
````
Angular library approach opted for development
Angular Ivy compatibility
````
## Help Improve

@@ -193,0 +198,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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