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

@airglow/prefab-table

v0.8.0

Published

Prefab for Table Implementations

Downloads

28

Readme

Prefab-Table

A custom Prefab to help UI applications maintain table component states.

Installation

npm install --save @airglow/prefab @airglow/prefab-table

Getting Started

To add the Table Prefab, you simply need to import the prefab somewhere in your code:

import '@airglow/prefab-table';

Usage

import prefabFactory from '@airglow/prefab';

export default prefabFactory({
  table: {
    type: 'table',
    dataSelector: state => [state.todos],
    columns: {
      text: {
        sorter: 'default'
      },
      assignee: {
        sorter: myCustomNameSorter
      }
    }
  }
});

In the above example, the table has two columns: text and assignee. Text column is sorted with default alphabatic order. Assignee is sorted with myCustomNameSorter, which is a custom sorter implemented somewhere else from the UI application.

Selectors

The table provides the following selectors:

| Selector | Input | Description | | -------- | ----- | ----------- | | state | state | returns the full state of the table, columns, sort direction, and selected rows (see below) | handlers | dispatch | returns all the handlers for the rows and columns (see below) | addColumnAction | columnName, column configuration | adds a new column for the table to use for sorting | deselectRowsAction | null | rowData | [rowData] | Toggles the selection of a row in the table. If no input is provided then all the selected rows will be cleared | removeColumnAction | columnName, column configuration | removes added columns only | toggleRowAction | rowData | Toggles the selection or a row in the table | selectedData | state | returns the selected rows data

Table State

| Key | Description | | --- | ----------- | | columns | an object containing the visible column prefabs, including any added | data | The array of data that populates the rows in the table | hiddenColumns | an object containing hidden column prefabs | selectedData | an array of data that is contained in the selected rows | selectedRows | an array of indices that represent the selected rows according to the current sort direction | sortBy | the name of the column being used to sort the table | sortDirection | a number representing whether the sort is ascending or descending

Table Handlers

| Key | Description | | --- | ----------- | | hideColumn | hides a column | onHeaderClick | callback for when a column header is clicked | onRowClick | callback for when a row is clicked | showColumn | unhides a column