Giter Site home page Giter Site logo

bhaghyaxmedia / alphabet-filter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ericferreira1992/alphabet-filter

0.0 0.0 0.0 37.17 MB

Angular component for filtering contents in alphabetical listing

Home Page: https://ericferreira1992.github.io/alphabet-filter

HTML 16.34% TypeScript 48.66% JavaScript 4.33% SCSS 30.67%

alphabet-filter's Introduction

AlphabetFilter | Angular 10+

Angular component for filtering contents in alphabetical listing, using default or custom templates. Ideal to build contact lists.

Compatible with previous versions of Angular, except AngularJS.

Demo

See a live demo.

Simple use

<alphabet-filter 
    propAlphaOrder="name"
    propsSearch="name"
    placeholder="digite o nome do contato"
    height="100%"
    [data]="contacts"
    (onClick)="selected($event)">
</alphabet-filter>

Custom use (with ng-template)

<alphabet-filter 
    propAlphaOrder="name"
    propsSearch="name"
    placeholder="digite o nome do contato"
    listClass="search-list"
    height="500px"
    [data]="contacts"
    (onClick)="selected($event)"
    [withTemplate]="true"
>
    <ng-template let-item>
      <div class="search-list-item">
        <img [src]="item.image">
        <span>{{item.name}}</span>
      </div>
    </ng-template>
</alphabet-filter>

Usage

Install

npm install alphabet-filter

Import into Module

import { AlphabetFilterModule } from 'alphabet-filter';

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

Insert into styles of angular.json

...
"styles": [
  "...",
  "node_modules/alphabet-filter/alphabet-filter.scss"
],
...

API

Inputs/Outputs (Required)

Name Type Description
data any[] Data to be listed.(ex .: <... [data]="contacts"></...>).
propAlphaOrder string Property for name of the property to be ordered alphabetically.(ex .: <... propAlphaOrder="name"></...>).
propsSearch string or string[] Property(ies) to be filtered.(ex .: <... [propsSearch]="['name']"></...>).
onClick EventEmitter<any> Emit on item click.(ex .: <... (onClick)="selected($event)"></...>).

Inputs/Outputs (Optional)

Name Type Description
placeholder string Placeholder of input filter. (ex .: <... []=""></...>).
listClass string Class name for list element. (ex .: <... listClass="search-list"></...>).
height string Height to be used throughout the component. (ex .: <... height="100%"></...>).
withTemplate boolean Used when to need of customize using ng-template. (ex .: <... [withTemplate]="true"></...>).
onCancel EventEmitter<any> Used to enable "close" button.(ex .: <... (onCancel)="cancel()"></...>).

alphabet-filter's People

Contributors

ericferreira1992 avatar raphaelbs avatar dependabot[bot] avatar jwitheford avatar natsudzn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.