Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-table

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-table

react table fast

  • 1.4.8-beta.41
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by16.67%
Maintainers
1
Weekly downloads
 
Created
Source

Fast Table

React 表格组件,支持多数据首次快速渲染

npm package NPM downloads Dependencies DevDependencies Gitter Codecov Issues need help

在线 Demo

https://paul-long.github.io/react-components/

安装

rc-select

npm install fast-table --save-dev

支持

  • 多数据快速渲染,虚拟渲染
  • 固定表头
  • 固定列
  • 表头排序
  • 表头分组
  • 树形数据展示
  • 固定行至顶部或者底部
  • 子表格订制
  • 表头自由排序
  • 表格数据选择

API

Table Props

propsdescribetypedefault value
borderedshow borderedBooleanfalse
bodyMaxHeightbody max heightNumber or String
classNamecustom classString
colMinWidthmin column widthNumber100
columnsset table headerArray[]-
dataSourcedataArray[]
defaultShowCountdefault show rowsNumber30
emptyTextempty showFunction() => '暂无数据'
expandedRowByClickon click row expandedBooleantrue
expandedRowKeysexpanded rowsString[]
expandedRowRenderexpanded renderFunction
fixedHeaderfixed headerBooleantrue
footerHeightFooter heightNumber30
getRowHeightspan rowFunction(record, index):Number() => 1
headerRowHeightheader row heightNumber35
headerSortableheader sortableBooleanfalse
pullDownpull dataBooleanfalse
indentSizeexpanded indent sizeNumber17
onExpandedRowsChangeon expanded changeFunction
onHeaderSortableon header sort endFunction
onHeaderRowheader row event listenerFunction
onScrollEndscroll to bottomFunction
onSorton sortFunction
onRowrow events listenerFunction
refreshEnableuse scroll endBooleantrue
rowClassNamerow classNameFunction() => ''
rowHeightdefault row heightNumber30
scrollEndPositionscroll to bottom px to refreshNumber60
scrollSizeset scroll default sizeObject{x: 8, y: 8}
showHeadershow headerBooleantrue
sortMultimulti sort enableBooleanfalse
styletable styleObject{}
useScrollYuse y ScrollBooleantrue
rowSelectionRow selection, configObjectnull

Column Props

propsdescribetypedefault value
alignalignmentString(left or center or right)left
classNameset classNameStringorFunction(column, record, index):String
childrenchild columnsObject:Column
dataIndexdata key,use a.b.cString-
fixedfixed columnString(left or right)
keyunique identifier
(can ignore)
String-
onCellcustom cell styleFunction(column, record):Object
onHeaderCellcustom header cell styleFunction(column):Object
orderdefault orderString(desc or asc)
renderrender cellFunction(text, record, index) {}-
sortEnablesort enableBoolean
titleheader cell textString or ReactNode
widthwidthString or Number-

DataSource Props

propsdescribetypedefault value
isFixedfixed rowtrue or String(top or bottom )-

Row Selection

propsdescribetypedefault value
selectedKeyscontrolled selected row keysstring[][]
onSelectcallback executed when select one rowFunction(record, selected, selkectedKeys)
typeselect model, checkbox(multi-select) or radio(radio-select)checkbox or radiocheckbox
useSelectAllselect all enablebooleanfalse

bordered

show border , default false.

bodyMaxHeight

set table body max height, not default.

className

set className.

colMinWidth

header cell min width, default 100.

dataSource

table data.

defaultShowCount

show count, default 30

emptyText

empty show content.

expandedRowByClick

whether expanded when click on a row, default true.

expandedRowKeys

expanded keys.

expandedRowRender

custom expanded row.

fixedHeader

wherther fixed header. default true

footerHeight

footer height, default 30.

getRowHeight

custom row height.

headerRowHeight

header row height. default 35.

headerSortable

header sortable enabled, default false.

pulldown

default false

是否向前添加数据

indentSize

expanded indent size, default 17.

onExpandedRowsChange

expanded on row changed.

onHeaderSortable

header on sortable end.

onHeaderRow

listen on header row events.

onScrollEnd

listen on scroll bottom.

onSort

listen on sort header.

onRow

listen on row events.

refreshEnable

scroll to bottom for refresh.

rowClassName

row className.

rowHeight

row height, default 30.

scrollEndPosition

Scroll to the bottom how many pixels from the bottom trigger the refresh.

scrollSize

setting scroll size, default {x: 8, y: 8}.

showHeader

show header, default true.

sortMulti

sort multi, default false.

style

table style.

useScrollY

use scroll Y.

rowselection

Row selection

示例

import Table from 'fast-table';
const columns = [
  {
    title: '第一列',
    align: 'left',
    dataIndex: 'key',
    sortEnable: true,
    order: true,
    fixed: 'left',
    width: 100,
    render: (text) => <span>{text}</span>,
    onCell: () => ({color: '#F9C152'})
  },
  {
    title: '第二列',
    dataIndex: 'key0',
    width: 100,
    fixed: 'left',
    sortEnable: true
  },
  {
    title: '第三列',
    dataIndex: 'key1',
    width: 100,
    bodyStyle: {background: '#122024', color: '#11A1FF'}
  },
  {
    title: '第四列',
    align: 'left',
    dataIndex: 'key2',
    width: 130
  },
  {
    title: '第五列',
    align: 'left',
    dataIndex: 'key3',
    width: 120
  },
  {
    title: '第六列',
    align: 'left',
    fixed: 'right',
    dataIndex: 'key4',
    width: 100
  }
];

const dataSource = [
  {key: 0, key0: 'a', key1: 'b', key2: 'c', key3: 'd', key4: 'e'}
];
const otherProps = {};
ReactDOM.render(
  <Table columns={columns} dataSource={dataSource} {...otherProps} />,
  mountNode
);

查看更多实例

Version Log

  • 1.4.8-beta.17
    • 添加向前添加数据滚动条位置设置
  • 1.4.8-beta.16
    • fixed onClick bug

Keywords

FAQs

Package last updated on 27 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc