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-abstract-table

v0.0.6

Published

NgxAbstractTable is an angular library build for customizing angular material tables with passable configuration. The library supports both server-side and client-side pagination, filtering and sorting by using polymorphic data sources. CustomTableComponen

Downloads

9

Readme

NgxAbstractTable

NgxAbstractTable is an angular library build for customizing angular material tables with passable configuration. The library supports both server-side and client-side pagination, filtering and sorting by using polymorphic data sources. CustomTableComponent expects multiple input variables for certain options to be activated. Table is then displayed and can be interacted with certain events, such as: rowClick, childClick and CRUD operations.

Configuration

CustomTableComponent expects input as shown below:

  data?: TableData[];
  details?: TableData[] | any;
  fetch?: (filter? : string,
            sortDirection?: string,
            pageIndex?: number,
            pageSize?: number) => void;
  rowClicked?: (row: TableData | null) => void;
  childClicked?: (row: TableData | null) => void;
  configuration: Configuration;
  filterConfiguration?: FilterConfiguration;
  sortConfiguration?: SortConfiguration;
  paginatorConfiguration?: PaginatorConfiguration;
  footerConfiguration?: FooterConfiguration;
  headerConfiguration?: HeaderConfiguration;
  styleConfiguration?: StyleConfiguration;
  customChildComponent?: TemplateRef<any>;

AbstractCustomTable interface can be implement on parent component of CustomTableComponent implementation. Let's go over all configurable options:

Data

Main data array to be displayed. This should be a class of choice which implements TableData interface. TableData interface includes column meta-data which is mandatory for table to be functioning properly.

Details

Details data array or object to be displayed. This can be a child table class which also implements TableData interface, or an any object to be passed as data for CustomChildComponent.

Fetch function

Fetch function specifies the function to be called from within the CustomTableComponent to fetch server-side data with included parameters specifying filter, sort, and pagination data.

Row click event function

Row click event function is called when parent table row is clicked.

Child click event function

Child click event function is called when child table is clicked.

Configuration

Main configuration specifying the data source implementation which is either server-side or client-side. Server-side implementation will use fetch function to fetch new data on sort, filter and pagination events. Client-side implementation will wait for new data to be passed to display new data. Sort, filter and pagination events happen on already passed data.

Filter configuration

Filter configuration specifies mat-form-field options and its documentation can be found here

Sort configuration

Sort configuration specifies mat-sort-header options and its documentation can be found here

Paginator configuration

Paginator configuration specifies mat-paginator options and its documentation can be found here

Footer configuration

Footer configuration specifies mat-footer-row options and its documentation can be found here

Header configuration

Header configuration specifies mat-header-row options and its documentation can be found here

Style configuration

Style configuration specifies styling options and its documentation can be found here

Custom child component

Custom child component specifies the child component to be displayed for each row

Examples of passing the input

<ngx-custom-table
  [configuration]="configuration"
  [data]="items$ | async"
  [details]="details$ | async"
  [filterConfiguration]="filterConfiguration"
  [paginatorConfiguration]="paginatorConfiguration"
  [sortConfiguration]="sortingConfiguration"
  [styleConfiguration]="styleConfiguration"
  [fetch]="fetchAllItemsPages.bind(this)"
  (rowClicked)="itemClicked($event)"
  (childClicked)="childClicked($event)">
</ngx-custom-table>
<ngx-custom-table
  [configuration]="configuration"
  [data]="items$ | async"
  [details]="details$ | async"
  (rowClicked)="itemClicked($event)"
  [filterConfiguration]="filterConfiguration"
  [sortConfiguration]="sortingConfiguration"
  [styleConfiguration]="styleConfiguration"
  [customChildComponent]="customChild">
</ngx-custom-table>

<ng-template #customChild>
  <app-cart-item-details [details]="details$ | async"></app-cart-item-details>
</ng-template>

End result

Homepage-Image

Updates

Library will get new updates depending on if there is any need for them. For now, I hope anyone that uses it gets a good use out of it.

Non-commercial use

This library is my personal project, and it does not have direct or indirect income-generating use. It will not be marketed or sold.

Links