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

@appcarvers/ngx-unitelist

v0.1.10

Published

This library is for Angular (2+) projects to build a list from passed data and provide pagination and filters and their callbacks after proper configuration.

Downloads

68

Readme

ngx-unitelist

This library is for Angular (2+) projects to build a list from passed data and provide pagination and filters and their callbacks after proper configuration.

Installing

npm install @appcarvers/ngx-unitelist --save

To use pagination and filters of unitelist, you will also need to install few dependencies as listed below

npm install ngx-bootstrap --save
npm install ng2-select --save

Implementation

Simply first import the module in your app.module.ts as shown below

import { UniteModule } from '@appcarvers/ngx-unitelist/unite.module';
imports : [UniteModule]

Now, pass proper configuration so as to render pagination, filters, table-view. You will also get various callback like pageChanged and filterChanged so that you can update the data based on changes.

Displying complete uniteList i.e. with pagination, filters, table

Code in component.html

user.component.html

<ngx-unite-sort [sortDataArray]='userSortArray' sortCoverClass='my-sorting-class' (sortChanged)='updateSort($event)'></ngx-unite-sort>
<ngx-unite-list
    [data]="usersData"
    [tableHeaders] = 'usersHeaders'
    [totalPages] = 'userTotalPages'
    [currentPage] = 'userCurrentPage'
    [filters] = 'userFilters'
    [searchBox] = 'true'
    (pageChanged)='checkPageChanged($event)'
    (filterChanged)='jobsFilterChanged($event)'
    (searchInput)='jobsSearched($event)'
    table-class='table-bordered table'
    filter-class='my-col col-xs-2'
    filter-cover-class='my-filters'
> </ngx-unite-list>

Code in component.ts

user.component.ts

import { Component, OnInit } from '@angular/core';
import { FakedataService } from '../fakedata.service';

@Component({
selector: 'app-userlist',
templateUrl: './userlist.component.html',
styleUrls: ['./userlist.component.css'],
providers : [FakedataService]
})
export class UserlistComponent implements OnInit {

    usersData;
    usersHeaders;
    userTotalPages;
    userCurrentPage;
    userFilters;
    userSortArray;

    constructor(private _fService : FakedataService) { }

    ngOnInit() {
        this.userSortArray = [
                            {name : 'sort-1', label : 'Sort 1 new'},
                            {name : 'sort-2', label : 'Sort 2 new'},
                            {name : 'sort-3', label : 'Sort 3 new'},
                            {name : 'sort-4', label : 'Sort 4 new'},
                          ];

        this.usersHeaders = [
                                {label : "Id", identifier : ['id']},
                                {label : "Name", identifierCombo : [['first_name'],['last_name']]},
                                {label : "Avatar", identifier : ['avatar'], displayType : 'image'}
                            ];

        this.userFilters =  [
                                {
                                    label     : 'Filter 1',
                                    name  : 'filter-1',
                                    options   : [{id: 'a', text: 'Alpha'},{id: 'b', text: 'Beta'},{id: 'c', text: 'Gamma'},]
                                },
                                {
                                    label : 'Filter 2',
                                    name : 'filter-2',
                                    options : [{id: 'a', text: 'xyz'},{id: 'b', text: 'abc'},{id: 'c', text: 'syz'},]
                                } 
                            ];

        this.loadUsers();
    }

    loadUsers(pageNo? : number){
        this._fService.getUsers(pageNo).subscribe(usersData => {
        this.usersData      = usersData['data'];
        this.userTotalPages = usersData['total_pages'];
        this.userCurrentPage = usersData['page'];
        console.log(usersData);
        });
    }

    checkPageChanged(e){
        if(typeof e.newPage === 'number')
        {
            this.loadUsers(e.newPage);
        }
    }

    checkFilterChanged(e){
        console.log('filter changed event captuire ', e);
    }

    updateSort(e){
        console.log("change event ", e);
    }
}

Displying Pagination separately without unitelist or filters

Code in component.html

user.component.html

<ngx-unite-pagination
    [totalPages] = 'userTotalPages'
    [currentPage] = 'userCurrentPage'
    (pageChanged)='checkPageChanged($event)'
> </ngx-unite-pagination>

Code in component.ts

user.component.ts

import { Component, OnInit } from '@angular/core';
import { FakedataService } from '../fakedata.service';

@Component({
selector: 'app-userlist',
templateUrl: './userlist.component.html',
styleUrls: ['./userlist.component.css'],
providers : [FakedataService]
})
export class UserlistComponent implements OnInit {

    userTotalPages;
    userCurrentPage;

    constructor(private _fService : FakedataService) { }

    ngOnInit() {
        this.loadUsers();
    }

    loadUsers(pageNo? : number){
        this._fService.getUsers(pageNo).subscribe(usersData => {
            this.userTotalPages = usersData['total_pages'];
            this.userCurrentPage = usersData['page'];
            console.log(usersData);
        });
    }

    checkPageChanged(e){
        if(typeof e.newPage === 'number')
        {
            this.loadUsers(e.newPage);
        }
    }

}

Releases

v.0.1.10

  • Documentation for UnitSort updated

v.0.1.9

  • UnitSort compoment to give power for sorting
  • Flexibility to provide custom class to filter cover div

v.0.1.8

  • Pagination bug fixes.(https://github.com/appcarvers/ngx-unite-list/issues/1, https://github.com/appcarvers/ngx-unite-list/issues/4)

v.0.1.7

  • Added Cancel button for date filters.

v.0.1.6

  • Pagination bug fixes.

v.0.1.5

  • Pagination page-numbers are now limited to display only 10 pages at once if there are more.
  • Pagination : First, previous, next, last buttons will now update the pagenumber out of box.

v.0.1.4

  • Bug Fixes

v.0.1.3

  • Bug Fixes

v.0.1.2

  • Seperate attribute to assign class for search-box viz. searchbox-class.
  • Removed margin from pagination.

Docs in progress