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

ngd-dropdown

v0.3.38

Published

NGD-DROPDOWN is an Angular library for multiselectable and singleselectable dropdown component. The goal is to create a simple core library that makes option selection process nice and easy.

Downloads

243

Readme

NGD-DROPDOWN

NGD-DROPDOWN is an Angular library for multiselectable and singleselectable dropdown component. The goal is to create a simple core library that makes option selection process nice and easy.

Current Version (0.3.10)

Changelog

  • Placeholder input for dropdown placeholder
  • Search Placeholder input for search input placeholder

Current Version (0.3.0)

Changelog

  • Dropdown closes if clicked outside
  • Major Bug Fixes
  • Performance upgrade

Version (0.2.0)

Changelog

  • Select all button
  • Now only selected option's value is emitted (before it was selected object)
  • New configs (checkout for more)
  • New Outputs
  • Minor Bug Fixes
  • Performance upgrade

Version (0.1.0)

Changelog

  • Support for Angular version 7
  • Support for Reactive Forms
  • Support for [(ngModel)] 2 way data binding
  • Minor Bug Fixes
  • Huge Performance upgrade

Install

npm

npm install ngd-dropdown --save 

Usage

Dropdown selector is easy to integrate In your app.module.ts (bootstrap module)

import {DropdownModule} from 'dropdown';
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    DropdownModule
  ]
})

in your component.ts file

@Component({
    selector: 'desired-components',
    template: './desired-component.component.html'  
})
export class DesireComponent {
  public configs: NgdDropdownConfigs = {
        theme: 'default',
        placeholder: 'Select item',
        noData: 'No data was found!',
        selectAll: true,
        selectAllText: 'Select all',
        multiple: true,
        jsSearch: true,
        serverSearch: true,
        searchTimeout: 200,
        option: {
          name: 'text',
          value: 'id'
        }
  }
  
  public options: any[] = [
    {text: 'Text 1', id: 1},
    {text: 'Text 2', id: 2},
    {text: 'Text 3', id: 3},
  ]
  
  public value: any;
}

in yout template.html file

<ngd-dropdown [options]="options" [(ngModel)]="value" [configs]="configs"></ngd-dropdown>

Inputs

Configurations [configs]

The configurations are for customization. All the default values are provided. See table below to be able to correctly configure component

| property | type | default | description | | --------------------- | ------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------- | | theme | default | 'default' | Component theme; | | placeholder | string | 'Select item' | The placeholder will be displayed on the selectbox area, if there is not any value selected or provided to display; | | noData | string | 'No data was found!' | Message will be shown if no option provided to display; | | selectAll | boolean | 'false' | Select all button will be displayed; | | selectAllText | boolean | 'false' | Select all button text; | | multiple | boolean | false | If multiple selection required or not | | jsSearch | boolean | false | Activates client side search mechanism | | serverSearch | boolean | false | Use for server side search | | searchTimeout | number | 0 | if serverSearch is true will emit search term after given time | | option | {name: string, value: string} | {name: 'text', value: 'id'} | name will be used as option name value will be used as value of the option | |

Options [options]

type: any[]
default: []
description: The array of options [reactive]. Will be displayed as selectable options in the dropdown

Value [(ngModel)]

type: any | any[]
default: null
description: Two way data binded value of select object. If multiple selection enabled value will be array else will be string or number

placeholder

type: string default: null description: Placeholder for select dropdown

searchPlaceholder

type: string default: null description: Placeholder for search input

Outputs

Dropdown Opened (dropdownOpened)

type: void
description: This event only triggers when dropdown is opened

Dropdown Closed (dropdownClosed)

type: void
description: This event only triggers when dropdown is closed

Dropdown Toggle (dropdownToggle)

type: boolean
description: This event triggers when dropdown is both closed and opened. If dropdown opened the true value will be emitted. If dropdown closed the false value will be emitted

Selected (selected)

type: any
description: This event triggers when option is selected and emits the value of selected object

Unselected (unselected)

type: any
description: This event triggers when option is deselected and emits the value of deselected object

AllSelected (allSelected)

type: any
description: This event triggers whenSelect all button clicked and all the options were selected

All Unselected (allUnselected)

type: any
description: This event triggers when select all button clicked and all the previously selected options were deselected

Search (search)

type: string
description: This event triggers when server side search is enabled and emits search term of search box

Raw Data (rawData)

type: {action: string, payload: any}
description: This event triggers when selected and unselected option. But the tricky part is it emits both action and raw data of selected object

Support

Tested in Chrome , Firefox , IE 9-11 , Edge , Safari

Copyright

Copyright © 2018 - 2019