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

@trendmicro/react-table

v2.0.2

Published

Trend Micro Components: React Table

Downloads

1,602

Readme

react-table build status Coverage Status

NPM

React Table

Demo: https://trendmicro-frontend.github.io/react-table

Version 1.x is no longer maintained by 2019/12/06

[Friendly reminder] Please migrate to 2+ asap.

Installation

  1. Install the latest version of react and react-table:
npm install --save react @trendmicro/react-table @trendmicro/react-paginations
  1. At this point you can import @trendmicro/react-table and its styles in your application as follows:
import TableTemplate, { TableWrapper, TableHeader, TableBody, TableRow, TableCell, TableHeaderCell } from '@trendmicro/react-table';

Usage

Table Template

<TableTemplate
    hoverable
    useFixedHeader
    columns={columns}
    data={data}
    width={500}
/>

Custom render

<TableWrapper
    columns={columns}
    data={data}
    width={800}
    height={320}
>
    {({ cells, data, loader, emptyBody, tableWidth }) => {
        return (
            <Fragment>
                <TableHeader>
                    <TableRow>
                        {
                            cells.map((cell, index) => {
                                const key = `table_header_cell_${index}`;
                                const {
                                    title,
                                    width: cellWidth,
                                } = cell;
                                return (
                                    <TableHeaderCell
                                        key={key}
                                        width={cellWidth}
                                    >
                                        { title }
                                    </TableHeaderCell>
                                );
                            })
                        }
                    </TableRow>
                </TableHeader>
                <TableBody>
                    <Scrollbars
                        style={{
                            width: tableWidth
                        }}
                    >
                        {
                            data.map((row, index) => {
                                const rowKey = `table_row${index}`;
                                return (
                                    <TableRow key={rowKey}>
                                        {
                                            cells.map((cell, index) => {
                                                const key = `${rowKey}_cell${index}`;
                                                const cellValue = _get(row, cell.dataKey);
                                                return (
                                                    <TableCell
                                                        key={key}
                                                        width={cell.width}
                                                    >
                                                        { typeof cell.render === 'function' ? cell.render(cellValue, row, index) : cellValue }
                                                    </TableCell>
                                                );
                                            })
                                        }
                                    </TableRow>
                                );
                            })
                        }
                    </Scrollbars>
                </TableBody>
            </Fragment>
        );
    }}
</TableWrapper>

API

Properties

TableWrapper

Name | Type | Default | Description :--- | :--- | :------ | :---------- minimalist | Boolean | false | Specify whether the table should not be bordered. columns | Object[] | [] | The columns config of table, see Column below for details. data | Object[] | [] | Data record array to be rendered. emptyRender | Function | () => { return 'No Data'; } | Empty content render function. emptyText | String | 'No Data' | The text when data is null. height | Number | | The height of the table. loading | Boolean | false | Whether table is loading. loaderRender | Function | | Loading content render function. width | Number(required) | | The width of the table.

TableHeaderCell

Name | Type | Default | Description :--- | :--- | :------ | :---------- width | Number(required) | | The width of the table.

TableCell

Name | Type | Default | Description :--- | :--- | :------ | :---------- width | Number(required) | | The width of the table.

TableTemplate

Name | Type | Default | Description :--- | :--- | :------ | :---------- minimalist | Boolean | false | Specify whether the table should not be bordered. columns | Object[] | [] | The columns config of table, see Column below for details. data | Object[] | [] | Data record array to be rendered. emptyRender | Function | () => { return 'No Data'; } | Empty content render function. emptyText | String | 'No Data' | The text when data is null. height | Number | | The height of the table. hideHeader | Boolean | false | Whether table head is hiden. hoverable | Boolean | false | Whether use row hover style. loading | Boolean | false | Whether table is loading. loaderRender | Function | | Loading content render function. useFixedHeader | Boolean | false | Whether table head is fixed. width | Number(required) | | The width of the table.

Column

Name | Type | Default | Description :--- | :----- | :------ | :---------- title | React Node or Function(): React Node | | Title of this column. dataKey | String | | Display field of the data record. width | String or Number | 150 | Width of the specific proportion calculation according to the width of the columns. render | Function(value, record, rowIndex) | | The render function of cell, has two params: the text of this cell, the record of this row, it's return a react node.

License

MIT