0.1.1 • Published 2 years ago

gw-custom-select v0.1.1

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Angular gw-custom-select : Lightweight all in one UI Dropdown


Features

  • Custom binding to property or object
  • Custom option
  • Virtual Scroll support with large data sets (>5000 items).
  • Single select
  • Multiselect
  • Custom search
  • Group items

Getting started

Step 1: Install gw-custom-select:

NPM

npm i gw-custom-select

Step 2: Import the CustomSelectModule module:

import { CustomSelectModule } from 'gw-custom-select';

@NgModule({
  declarations: [AppComponent],
  imports: [CustomSelectModule],
  bootstrap: [AppComponent]
})
export class AppModule {}

Step 3 : Configuration

Below is the JSON for configuration of dropdown

 multiSelect: any = { 'selectType' : 'multi-select', 'valueKey' : 'label', 'enableSearch' : true, 'icon' : 'plusMinus'};

Usage

Define options in your app component:

@Component({...})
export class AppComponent {

    selectedItem: number;
    items = [
        { id: 1, label: 'Date' },
        { id: 2, label: 'MultiSelect' },
        { id: 3, label: 'Select' }
    ];
}

HTML file

<lib-custom-select [selectConfig]="dateSelect" [options]="items" (selectChange)="change($event)"></lib-custom-select>

<lib-custom-select [selectConfig]="normalSelect" [options]="items" (selectChange)="change($event)"></lib-custom-select>

API

Inputs and Outputs

Input/OutputTypeDefaultRequiredDescription
modelngModel-NoBind the value to model
idKeystringidNoUnique reference key for each object of dropdown
optionsJSON Array-YesData which need to iterate in dropdown.
selectConfigJSON Object-YesConfig for the dropdown for which user wants to create.
(selectChange)Function-YesWhen the dropdown value changes this function will be called in the parent component

For more

Use ng help command or go check out the Angular CLI Overview and Command Reference page.

0.1.1

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago