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

ngx-filter-btn

v0.0.1

Published

Simple to implement filter button that filters your data.

Downloads

7

Readme

Ngx Filter Btn

Simple to implement filter button that filters your data.

Demo Link

demo image

Index

Installation Steps

  1. Install by running npm install ngx-table-operations
  2. Add import { NgxFilterBtnModule } from 'ngx-filter-btn' in your module class.
  3. Add NgxFilterBtnModule in your module class.
  4. Add <ngx-filter-btn [data]="yourData" (filtered)="yourData = $event">Your button name</ngx-filter-btn> in your component html.

Installation Example

  1. Install by running npm install ngx-table-operations

  2. In app.module.ts file.

    import { NgxFilterBtnModule } from 'ngx-filter-btn';
    
    @NgModule({
    ....
    imports: [NgxFilterBtnModule, ....],
    ....
    ....
    })
  3. In app.component.html file.

    <ngx-filter-btn
            [data]="userList"
            [numberKeys]="['empId', 'salary', 'fte']"
            [booleanKeys]="['isNewJoiner']"
            [dateKeys]="['dateOfJoining']"
            (filtered)="userList = $event"
          >
            Filter
    </ngx-filter-btn>
  4. Some sample data in app.component.ts file.

    export class AppComponent {
    
    userList: SampleData[] = [];
    constructor() {
        this.userList = [
        {
            empId: 7151,
            name: 'Jarret Chesson',
            email: '[email protected]',
            gender: 'M',
            assetType: 'Desktop',
            assetDetail: 'VXYJ59531',
            dateOfJoining: '11-04-2017',
            salary: 68093,
            isNewJoiner: true,
            grade: 'A3',
            location: 'Kolkata',
            skills: 'Java',
            billablityStatus: 'DEPLOYABLE_BENCH',
            accountName: 'Hudson LLC',
            projectName: 'Span',
            fte: 75,
          },
          { ..... },
          { ..... }
    
        }
    }

Parameters Available

| Type | Name | Description | Data Type | Example | | ------- | ----------- | ----------------------------------------------------------------------------- | --------- | --------------------------------- | | @Input | data | Pass your actual data of array in it | any[] | [data]="userList" | | @Input | numberKeys | Pass keys who has data of type number so that number filters can be applied | string[] | [numberKeys]="['empId','salary']" | | @Input | booleanKeys | Pass keys who has data of type boolean so that boolean filters can be applied | string[] | [booleanKeys]="['isNewJoiner']" | | @Input | dateKeys | Pass keys who has data of type Date so that Date filters can be applied | string[] | [dateKeys]="['dateOfJoining']" | | @Output | filtered | Returns the filtered array of your data in $event | | (filtered)="userList = $event" |

Available Conditions

  1. String Conditions
    • contains
    • does not contain
    • starts with
    • ends with
    • is
    • is not
    • is empty
    • is not empty
  2. Number & Date Conditions
    • =
    • !=
    • >
    • <
    • >=
    • <=
    • is empty
    • is not empty
  3. Boolean Conditions
    • true
    • false
    • is empty
    • is not empty

Styling the component

  • The css class names are same as bootstrap classes.
  • Customizing the css is simple.
  • You can find all the css classes I used here.
  • Use the same class name in style.css to override according to your css.

If you want to keep the css to component only, then use :host ::ng-deep before declaring the css class.

Example :

:host ::ng-deep .dropdown-menu{
        background-color: white
    }