npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngu-multiselect-dropdown

v0.0.4

Published

Angular multiselect dropdown component for web applications. Easy to integrate and use. It can be bind to any custom data source and custom filter.

Downloads

5

Readme

Angular Multiselect Dropdown

Angular multiselect dropdown component for web applications. Easy to integrate and use. It can be bind to any custom data source and custom filter.

Getting Started

Features

  • dropdown with single/multiple selction option
  • bind to any custom data source
  • search item with custom placeholder text
  • limit selection
  • select/de-select all items

Installation

npm install ngu-multiselect-dropdown
import { NuMultiSelectDropDownModule } from 'ngu-multiselect-dropdown';
// ...

@NgModule({
  imports: [
    NuMultiSelectDropDownModule.forRoot()
    // ...
  ]
  // ...
})
export class AppModule {}

Usage

import { Component, OnInit } from '@angular/core';
import { IDropdownSettings } from 'ngu-multiselect-dropdown';

export class AppComponent implements OnInit {
  dropdownList = [];
  selectedItems = [];
  dropdownSettings = {};
  ngOnInit() {
    this.dropdownList = [
      { item_id: 1, item_text: 'Mumbai' },
      { item_id: 2, item_text: 'Bangaluru' },
      { item_id: 3, item_text: 'Pune' },
      { item_id: 4, item_text: 'Navsari' },
      { item_id: 5, item_text: 'New Delhi' }
    ];
    this.selectedItems = [
      { item_id: 3, item_text: 'Pune' },
      { item_id: 4, item_text: 'Navsari' }
    ];
    this.dropdownSettings:IDropdownSettings = {
      singleSelection: false,
      idField: 'item_id',
      textField: 'item_text',
      selectAllText: 'Select All',
      unSelectAllText: 'UnSelect All',
      itemsShowLimit: 3,
      allowSearchFilter: true
    };
  }
  onItemSelect(item: any) {
    console.log(item);
  }
  onSelectAll(items: any) {
    console.log(items);
  }
}
<nu-multiselect-dropdown
  [placeholder]="'custom placeholder'"
  [data]="dropdownList"
  [(ngModel)]="selectedItems"
  [settings]="dropdownSettings"
  (onSelect)="onItemSelect($event)"
  (onSelectAll)="onSelectAll($event)"
>
</nu-multiselect-dropdown>

Settings

| Setting | Type | Description | Default Value | | :----------------------------- | :--------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------ | | singleSelection | Boolean | Mode of this component. If set true user can select more than one option. | false | | placeholder | String | Text to be show in the dropdown, when no items are selected. | 'Select' | | disabled | Boolean | Disable the dropdown | false | | data | Array | Array of items from which to select. Should be an array of objects with id and text properties. You can also use custom properties. In that case you need to map idField and textField properties. As convenience, you may also pass an array of strings, in which case the same string is used for both the ID and the text(no mapping is required) | n/a | | idField | String | map id field in case of custom array of object | 'id' | | textField | String | map text field in case of custom array of object | 'text' | | enableCheckAll | Boolean | Enable the option to select all items in list | false | | selectAllText | String | Text to display as the label of select all option | Select All | | unSelectAllText | String | Text to display as the label of unSelect option | UnSelect All | | allowSearchFilter | Boolean | Enable filter option for the list. | false | | searchPlaceholderText | String | custom search placeholder | Search | | clearSearchFilter | Boolean | clear search filter on dropdown close | true | | maxHeight | Number | Set maximum height of the dropdown list in px. | 197 | | itemsShowLimit | Number | Limit the number of items to show in the input field. If not set will show all selected. | All | | limitSelection | Number | Limit the selection of number of items from the dropdown list. Once the limit is reached, all unselected items gets disabled. | none | | searchPlaceholderText | String | Custom text for the search placeholder text. Default value would be 'Search' | 'Search' | | noDataAvailablePlaceholderText | String | Custom text when no data is available. | 'No data available' | | closeDropDownOnSelection | Boolean | Closes the dropdown when item is selected. applicable only in cas of single selection | false | | defaultOpen | Boolean | open state of dropdown | false | | allowRemoteDataSearch | Boolean | allow search remote api if no data is present. | false |

Callback Methods

  • onSelect - Return the selected item when an item is checked. Example : (onSelect)="onItemSelect($event)"
  • onSelectAll - Return the all items. Example : (onSelectAll)="onSelectAll($event)".
  • onDeSelect - Return the unselected item when an item is unchecked. Example : (onDeSelect)="onItemDeSelect($event)"
  • onFilterChange - Return the key press. Example : (onFilterChange)="onFilterChange($event)"
  • onDropDownClose- Example : (onDropDownClose)="onDropDownClose()"

Development

This project was generated with Angular CLI version 8.3.15.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.