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

react-vt-table

v0.8.4

Published

Table realisation based on [react-window](https://github.com/bvaughn/react-window) library.

Downloads

38

Readme

React-VT-Table

Table realisation based on react-window library.

Features

  • Efficiently rendering large tables.
  • Allow custom renderers for row, cell, and header.
  • Built-in resize columns.
  • Built-in auto-scrolling.
  • Easy to add your own sorting and selecting mechanisms (see examples).
  • Works with Immutable.Iterable data lists or native arrays of objects.

Installation

npm install react-vt-table

Demo

Here are some live examples.

Examples

Check out ./src/stories folder to find some code examples.

Styling

You can use built-in CSS style:

import 'react-vt-table/dist/style.css';

or create your own using existing one

API

<Table />

Props

| Property | Type | Required? | Description | | :-------------------- | :----------------- | :-------: | :---------------------------------------------------------------------------------------------------------------------------- | | width | Number | ✓ | Table width. | | height | Number | ✓ | Table height. | | headerHeight | Number or Func | | Table header height (Default: 30). | | rowHeight | Number or Func | | Table row height (Default: 30). Function params: (rowIndex). | | data | Immutable.Iterable | ✓ | Data list for table content. | | rowClassName | Func | | Row className determine function. Function params: (rowIndex). | | rowRenderer | Func | | Personal row renderer function. Function params: see <Row /> props. | | sortIndicatorRenderer | Func | | Sort indicator render function. Function params: ({ dataKey, columnIndex }). | | onHeaderClick | Func | | Click Mouse action on header row. Function params: (event, { dataKey, columnIndex }). | | onHeaderDoubleClick | Func | | Double Click Mouse action on header row. Function params: (event, { dataKey, columnIndex }). | | onHeaderMouseOver | Func | | Mouse Over action on header row. Function params: (event, { dataKey, columnIndex }). | | onHeaderMouseOut | Func | | Mouse Out action on header row. Function params: (event, { dataKey, columnIndex }). | | onHeaderRightClick | Func | | Right Click Mouse action on header row. Function params: (event, { dataKey, columnIndex }). | | onRowClick | Func | | Click Mouse action on table row. Function params: (event, { dataKey, columnIndex }). | | onRowDoubleClick | Func | | Double Click Mouse action on table row. Function params: (event, { dataKey, columnIndex }). | | onRowMouseOver | Func | | Mouse Over action on table row. Function params: (event, { dataKey, columnIndex }). | | onRowMouseOut | Func | | Mouse Out action on table row. Function params: (event, { dataKey, columnIndex }). | | onRowMouseDown | Func | | Mouse Down action on table row. Function params: (event, { dataKey, columnIndex }). | | onRowMouseUp | Func | | Mouse Up action on table row. Function params: (event, { dataKey, columnIndex }). | | onRowRightClick | Func | | Right Click Mouse action on table row. Function params: (event, { dataKey, columnIndex }). | | onScroll | Func | | Action on table scroll. Function params: See React-Window's docs. | | onResizeColumn | Func | | Action on change column width. Function params: ({ dataKey, columnIndex, resizeDiff, newWidth }). | | overflowWidth | Number | | Width of vertical table overflow. | | minColumnWidth | Number | | Minimal column width. | | maxColumnWidth | Number | | Maximum column width. | | dynamicColumnWidth | Bool | | Dynamic width for columns that was not resized. | | listProps | Object | | Props for inner react-window list component. @see See React-Windows docs | | noItemsLabel | Node | | No items in data list label. | | disableHeader | Bool | | Hide table header row. | | autoScroll | Bool | | Auto scroll to list bottom. | | className | String | | Optional custom CSS class name to attach to root container element. | | id | String | | Optional custom id to attach to root container element. |

Methods

scrollTo(scrollOffset: number): void

scrollToItem(index: number, align: string = "auto"): void

For more info see React-Window's docs

<Column />

Props

| Property | Type | Required? | Description | | :----------------------- | :----- | :-------: | :-------------------------------------------------------------------------------------------- | | cellRenderer | Func | | Content cell render function. Function params: ({ dataKey, rowData, columnIndex }). | | columnHeaderCellRenderer | Func | | Column header cell render function. Function params: ({ label, dataKey, columnIndex }). | | dataKey | String | | Field key containing data. | | width | Number | | Default column width in pixels. |

<Row />

Use Row component only if you want to low modify your table rows. (See example ./srs/stories/rowRenderer.js)

Props

| Property | Type | Required? | Description | | :------- | :----- | :-------: | :-------------------------------------------------------------------------------------------------------------------------------- | | index | Number | | Row number | | style | Object | | Row style | | data | Object | | Additional row data ({dataList, rowProps}) where dataList is table data and rowProps is additional row properties (see below) |

Additional row properties

Additional row properties are contained in row's props.data.rowProps

| Property | Type | Required? | Description | | :------------- | :---- | :-------: | :----------------------------------------------------------------------------------- | | columns | array | | Table columns array | | rowClassName | Func | | Row className determine function. Function params: (rowIndex). | | getRowWidth | Func | | Get row actual width. | | getDataRowItem | Func | | Function to get cell value. Function params: ({rowData, dataKey}). | | getColumnWidth | Func | | Function to get column width. Function params: (columnIndex). | | getDataRow | Func | | Function to get row data item. Function params: (rowIndex). | | onClick | Func | | onClick row handler. Function params: (event, { dataKey, columnIndex }). | | onDoubleClick | Func | | onDoubleClick row handler. Function params: (event, { dataKey, columnIndex }). | | onMouseOver | Func | | onMouseOver row handler. Function params: (event, { dataKey, columnIndex }). | | onMouseOut | Func | | onMouseOut row handler. Function params: (event, { dataKey, columnIndex }). | | onRightClick | Func | | onRightClick row handler. Function params: (event, { dataKey, columnIndex }). |

License

MIT © avin