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

angular-2-dropdown-multiselect

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-2-dropdown-multiselect - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

.npmignore

16

package.json
{
"name": "angular-2-dropdown-multiselect",
"version": "0.3.1",
"version": "0.3.2",
"description": "Customizable dropdown multiselect in Angular 2 with bootstrap css.",

@@ -20,3 +20,15 @@ "main": "src/multiselect-dropdown.ts",

},
"homepage": "http://softsimon.github.io/angular-2-dropdown-multiselect"
"homepage": "http://softsimon.github.io/angular-2-dropdown-multiselect",
"devDependencies": {
"@angular/common": "^2.0.0",
"@angular/core": "^2.0.0",
"@angular/forms": "^2.0.0",
"rxjs": "5.0.0-rc.4"
},
"peerDependencies": {
"@angular/common": "^2.0.0",
"@angular/core": "^2.0.0",
"@angular/forms": "^2.0.0",
"rxjs": "5.0.0-rc.4"
}
}

68

src/multiselect-dropdown.ts
/*
* Angular 2 Dropdown Multiselect for Bootstrap
* Current version: 0.3.0
*
* Current version: 0.3.2
*
* Simon Lindh
* https://github.com/softsimon/angular-2-dropdown-multiselect
*/
import { NgModule, Component, Pipe, OnInit, DoCheck, HostListener, Input, ElementRef, Output, EventEmitter, forwardRef, IterableDiffers } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Observable } from 'rxjs/Rx';
import { FormsModule, NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
import {
NgModule,
Component,
Pipe,
OnInit,
DoCheck,
HostListener,
Input,
ElementRef,
Output,
EventEmitter,
forwardRef,
IterableDiffers
} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule, NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';
const MULTISELECT_VALUE_ACCESSOR: any = {

@@ -65,8 +77,11 @@ provide: NG_VALUE_ACCESSOR,

<div class="btn-group">
<button type="button" class="dropdown-toggle" [ngClass]="settings.buttonClasses" (click)="toggleDropdown()">{{ title }}&nbsp;<span class="caret"></span></button>
<ul *ngIf="isVisible" class="dropdown-menu" [class.pull-right]="settings.pullRight" [style.max-height]="settings.maxHeight" style="display: block; height: auto; overflow-y: auto;">
<button type="button" class="dropdown-toggle" [ngClass]="settings.buttonClasses"
(click)="toggleDropdown()">{{ title }}&nbsp;<span class="caret"></span></button>
<ul *ngIf="isVisible" class="dropdown-menu" [class.pull-right]="settings.pullRight"
[style.max-height]="settings.maxHeight" style="display: block; height: auto; overflow-y: auto;">
<li style="margin: 0px 5px 5px 5px;" *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">
<input type="text" class="form-control" placeholder="{{ texts.searchPlaceholder }}"
aria-describedby="sizing-addon3" [(ngModel)]="searchFilterText">
<span class="input-group-btn" *ngIf="searchFilterText.length > 0">

@@ -94,3 +109,4 @@ <button class="btn btn-default" type="button" (click)="clearSearch()"><i class="fa fa-times"></i></button>

<input *ngIf="settings.checkedStyle == 'checkboxes'" type="checkbox" [checked]="isSelected(option)" />
<span *ngIf="settings.checkedStyle == 'glyphicon'" style="width: 16px;" class="glyphicon" [class.glyphicon-ok]="isSelected(option)"></span>
<span *ngIf="settings.checkedStyle == 'glyphicon'" style="width: 16px;"
class="glyphicon" [class.glyphicon-ok]="isSelected(option)"></span>
{{ option.name }}

@@ -109,4 +125,6 @@ </a>

@Output() selectionLimitReached = new EventEmitter();
@Output() dropdownClosed = new EventEmitter();
@HostListener('document: click', ['$event.target'])
onClick(target:HTMLElement) {
onClick(target: HTMLElement) {
let parentFound = false;

@@ -124,4 +142,6 @@ while (target != null && !parentFound) {

onModelChange: Function = (_: any) => {};
onModelTouched: Function = () => {};
onModelChange: Function = (_: any) => {
};
onModelTouched: Function = () => {
};
model: number[];

@@ -155,6 +175,4 @@ title: string;

constructor(
private element: ElementRef,
private differs: IterableDiffers
) {
constructor(private element: ElementRef,
private differs: IterableDiffers) {
this.differ = differs.find([]).create(null);

@@ -169,3 +187,3 @@ }

writeValue(value: any) : void {
writeValue(value: any): void {
if (value !== undefined) {

@@ -198,2 +216,5 @@ this.model = value;

this.isVisible = !this.isVisible;
if (!this.isVisible) {
this.dropdownClosed.emit();
}
}

@@ -206,3 +227,5 @@

setSelected(event: Event, option: IMultiSelectOption) {
if (!this.model) this.model = [];
if (!this.model) {
this.model = [];
}
var index = this.model.indexOf(option.id);

@@ -216,3 +239,3 @@ if (index > -1) {

if (this.settings.autoUnselect) {
this.model.push(option.id)
this.model.push(option.id);
this.model.shift();

@@ -264,2 +287,3 @@ } else {

})
export class MultiselectDropdownModule { }
export class MultiselectDropdownModule {
}
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