0.3.38 • Published 4 years ago

ngd-dropdown v0.3.38

Weekly downloads
220
License
-
Repository
github
Last release
4 years ago

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

propertytypedefaultdescription
themedefault'default'Component theme;
placeholderstring'Select item'The placeholder will be displayed on the selectbox area, if there is not any value selected or provided to display;
noDatastring'No data was found!'Message will be shown if no option provided to display;
selectAllboolean'false'Select all button will be displayed;
selectAllTextboolean'false'Select all button text;
multiplebooleanfalseIf multiple selection required or not
jsSearchbooleanfalseActivates client side search mechanism
serverSearchbooleanfalseUse for server side search
searchTimeoutnumber0if 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

0.3.38

4 years ago

0.3.37

4 years ago

0.3.36

4 years ago

0.3.35

4 years ago

0.3.34

4 years ago

0.3.33

4 years ago

0.3.32

4 years ago

0.3.31

4 years ago

0.3.30

5 years ago

0.3.29

5 years ago

0.3.28

5 years ago

0.3.27

5 years ago

0.3.26

5 years ago

0.3.25

5 years ago

0.3.24

5 years ago

0.3.23

5 years ago

0.3.22

5 years ago

0.3.21

5 years ago

0.3.20

5 years ago

0.3.19

5 years ago

0.3.18

5 years ago

0.3.17

5 years ago

0.3.16

5 years ago

0.3.15

5 years ago

0.3.14

5 years ago

0.3.13

5 years ago

0.3.12

5 years ago

0.3.11

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.5

5 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago