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

@halodigital/table

v1.0.5

Published

This package contains a table with the following features:

Downloads

1

Readme

Table by Halo-Digital

This package contains a table with the following features:

  • Sorting

  • Paging (including page size control)

  • Each column search

  • Global search

  • Horizontal and vertical scrolling

  • Customized buttons

  • Clickable and expandable rows

  • Checkbox for each row (optional)

Enjoy!

Attributes

columns

Declare the table columns
Type: { id: string; title: string; type: 'checkbox' | 'date' | 'number' | 'select' | 'text'; options?: object[] | string[]; optionsEndpoint?: string; min?: number; max?: number; }[] Default: []

rows

Declare the table rows
Type: {[columnId: string]: any}[]
Default: []

totalRows

Declare the rows amount (from all pages)
Type: number
Default: 0

buttons

Declare buttons and related actions at the top of the table
Type: { id: string; caption: string | ((checkedRows: object[]) => string); disableMethod?: (checkedRows: object[]) => boolean; }[]
Default: []

rowMenuItems

Declare a menu column (by declaring the menu rows)
Type: { id: string; caption: string; }[]
Default: []

expandRowsConfig

Declare an expandable row (the 'component' param is a component that extends 'HaloTableExpandedComponent')
Type: { component: Type; fieldId: string; }
Default: null

generalFilter

Declare the general filter value
Type: string
Default: null

columnsFilters

Declare each column filter value
Type: {[columnId: string]: any}
Default: {}

sort

Declare the sort state
Type: { columnId: string; direction: 'asc' | 'desc'; }
Default: null

pageIndex

Declare the current page index (starting from 1)
Type: number
Default: 1

pageSize

Declare the maximum rows amount in each page
Type: number
Default: 20

currentRowIndex

Declare the current row index (starting from 0)
Type: number
Default: null

showGeneralFilter

Show / hide the general filter
Type: boolean
Default: true

showColumnsFilters

Show / hide the columns filters
Type: boolean
Default: true

showPaginator

Show / hide the paginator
Type: boolean
Default: true

showCheckboxes

Show / hide the checkboxes at the beginning of each row
Type: boolean
Default: false

showParamsInURL

Declare if the params state will appear in URL (page size will not appear in URL. param that equals to his default value will not apear in URL also)
Type: boolean
Default: true

isClickableRows

Declare if the rows are clickable
Type: boolean
Default: true

isSortableColumns

Declare if the rows are sortable
Type: boolean
Default: true

isLoadingRows

Declare the rows loading state
Type: boolean
Default: false

Events

tableParamsChange

Triggers on params change (i.e: pageIndex, pageSize, generalFilter etc.)
Event Parameter Type: HaloTableChangeEvent (Declared below)

generalFilterChange

Triggers on general filter change
Event Parameter Type: string

columnsFiltersChange

Triggers on each column filter change
Event Parameter Type: {[columnId: string]: any}

sortChange

Triggers on each column sort change
Event Parameter Type: { columnId: string; direction: 'asc' | 'desc'; }

pageIndexChange

Triggers on page index change (the user performed a paging)
Event Parameter Type: number

pageSizeChange

Triggers on page size change
Event Parameter Type: number

currentRowIndexChange

Triggers on current row index change (the user clicked on a row)
Event Parameter Type: number

buttonClick

Triggers on each button click
Event Parameter Type: HaloTableButtonEvent (Declared below)

rowClick

Triggers on current row index change (the user clicked on a row)
Event Parameter Type: {[columnId: string]: any}

rowMenuItemClick

Triggers on each row inside a menu click
Event Parameter Type: { menuItemId: string; row: object; rowIndex: number; }

Few More Things

HaloTableChangeEvent Declaration
{
    value: any;
    type: 'init' | 'generalFilter' | 'columnsFilters' | 'sort' | 'pageIndex' | 'pageSize';
    allParams: {
        generalFilter: string;
        columnsFilters: {[columnId: string]: any};
        sort: {columnId: string; direction: 'asc' | 'desc'};
        pageIndex: number;
        pageSize: number;
    };
    allParamsAsString: {
        freetext?: string;
        search?: string;
        ordering?: string;
        page?: string;
        size?: string;
    };
}
HaloTableButtonEvent Declaration
{
    id: string;
    checkedRows: {[columnId: string]: any}[];
    allParams: {
        generalFilter: string;
        columnsFilters: {[columnId: string]: any};
        sort: {columnId: string; direction: 'asc' | 'desc'};
        pageIndex: number;
        pageSize: number;
    };
    allParamsAsString: {
        freetext?: string;
        search?: string;
        ordering?: string;
        page?: string;
        size?: string;
    };
}

Example

<halo-table
    [columns]="columns"
    [rows]="rows"
    [totalRows]="100"
    [currentRowIndex]="3"
    [pageSize]="15"
    [isLoadingRows]="false"
    (tableParamsChange)="tableParamsChanged($event)"
    (buttonClick)="buttonClicked($event)"
    (rowClick)="rowClicked($event)">
</halo-table>

<halo-table
    [columns]="columns"
    [rows]="rows"
    [totalRows]="200"
    [showGeneralFilter]="false"
    [showParamsInURL]="false"
    [isClickableRows]="false"
    [isLoadingRows]="true"
    (tableParamsChange)="tableParamsChanged($event)"
    (rowMenuItemClick)="rowMenuItemClicked($event)">
</halo-table>