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

@nhsoft/table

v7.12.4-beta.1

Published

table ui component for react

Downloads

5

Readme

rc-table

React table component with useful functions.

NPM version dumi build status Test coverage Dependencies DevDependencies npm download bundle size

install

rc-table

Development

npm install
npm start

Example

https://table.react-component.now.sh/

Usage

import Table from 'rc-table';

const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
    key: 'name',
    width: 100,
  },
  {
    title: 'Age',
    dataIndex: 'age',
    key: 'age',
    width: 100,
  },
  {
    title: 'Address',
    dataIndex: 'address',
    key: 'address',
    width: 200,
  },
  {
    title: 'Operations',
    dataIndex: '',
    key: 'operations',
    render: () => <a href="#">Delete</a>,
  },
];

const data = [
  { name: 'Jack', age: 28, address: 'some where', key: '1' },
  { name: 'Rose', age: 36, address: 'some where', key: '2' },
];

React.render(<Table columns={columns} data={data} />, mountNode);

API

Properties

| Name | Type | Default | Description | | --- | --- | --- | --- | | tableLayout | auto | fixed | auto | fixed for any columns is fixed or ellipsis or header is fixed | https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout | | prefixCls | String | rc-table | | | className | String | | additional className | | id | String | | identifier of the container div | | useFixedHeader | Boolean | false | whether use separator table for header. better set width for columns | | scroll | Object | {x: false, y: false} | whether table can be scroll in x/y direction, x or y can be a number that indicated the width and height of table body | | expandable | Object | | Config expand props | | expandable.defaultExpandAllRows | Boolean | false | Expand All Rows initially | | expandable.defaultExpandedRowKeys | String[] | [] | initial expanded rows keys | | expandable.expandedRowKeys | String[] | | current expanded rows keys | | expandable.expandedRowRender | Function(recode, index, indent, expanded):ReactNode | | Content render to expanded row | | expandable.expandedRowClassName | Function(recode, index, indent):string | | get expanded row's className | | expandable.expandRowByClick | boolean | | Support expand by click row | | expandable.expandIconColumnIndex | Number | 0 | The index of expandIcon which column will be inserted when expandIconAsCell is false | | expandable.expandIcon | props => ReactNode | | Customize expand icon | | expandable.indentSize | Number | 15 | indentSize for every level of data.i.children, better using with column.width specified | | expandable.rowExpandable | (record) => boolean | | Config row support expandable | | expandable.onExpand | Function(expanded, record) | | function to call when click expand icon | | expandable.onExpandedRowsChange | Function(expandedRows) | | function to call when the expanded rows change | | rowKey | string or Function(record):string | 'key' | If rowKey is string, record[rowKey] will be used as key. If rowKey is function, the return value of rowKey(record) will be use as key. | | rowClassName | string or Function(record, index, indent):string | | get row's className | | rowRef | Function(record, index, indent):string | | get row's ref key | | data | Object[] | | data record array to be rendered | | onRow | Function(record, index) | | Set custom props per each row. | | onHeaderRow | Function(record, index) | | Set custom props per each header row. | | showHeader | Boolean | true | whether table head is shown | | title | Function(currentData) | | table title render function | | footer | Function(currentData) | | table footer render function | | emptyText | React.Node or Function | No Data | Display text when data is empty | | columns | Object[] | | The columns config of table, see table below | | components | Object | | Override table elements, see #171 for more details | | sticky | boolean | {offsetHeader?: number, offsetScroll?: number, getContainer?: () => Window | HTMLElement } | false | stick header and scroll bar |

Column Props

| Name | Type | Default | Description | | --- | --- | --- | --- | | key | String | | key of this column | | className | String | | className of this column | | colSpan | Number | | thead colSpan of this column | | title | React Node | | title of this column | | dataIndex | String | | display field of the data record | | width | String | Number | | width of the specific proportion calculation according to the width of the columns | | fixed | String | Boolean | | this column will be fixed when table scroll horizontally: true or 'left' or 'right' | | align | String | | specify how cell content is aligned | | ellipsis | Boolean | | specify whether cell content be ellipsized | | onCell | Function(record, index) | | Set custom props per each cell. | | onHeaderCell | Function(record) | | Set custom props per each header cell. | | render | Function(value, row, index) | | The render function of cell, has three params: the text of this cell, the record of this row, the index of this row, it's return an object:{ children: value, props: { colSpan: 1, rowSpan:1 } } ==> 'children' is the text of this cell, props is some setting of this cell, eg: 'colspan' set td colspan, 'rowspan' set td rowspan |

License

rc-table is released under the MIT license.