Gathering detailed insights and metrics for react-base-table
Gathering detailed insights and metrics for react-base-table
Gathering detailed insights and metrics for react-base-table
Gathering detailed insights and metrics for react-base-table
@trackunit/react-table-base-components
The `@trackunit/react-table-base-components` package contains basic react components for Tables as part of Trackunits public UI library.
react-base-table-extends
## 在线 demo
@sage-bionetworks/react-base-table
Sage Bionetworks fork of Autodesk/react-base-table
react-base-datagrid
table virtualized tree-table
npm install react-base-table
Typescript
Module System
83.1
Supply Chain
94.7
Quality
78.9
Maintenance
100
Vulnerability
100
License
JavaScript (96.05%)
SCSS (3.34%)
CSS (0.61%)
Total Downloads
5,145,006
Last Day
339
Last Week
16,502
Last Month
69,826
Last Year
1,038,927
1,507 Stars
181 Commits
164 Forks
29 Watching
21 Branches
11 Contributors
Minified
Minified + Gzipped
Latest Version
1.13.5
Package Id
react-base-table@1.13.5
Unpacked Size
912.83 kB
Size
166.14 kB
File Count
82
Publised On
24 May 2024
Cumulative downloads
Total Downloads
Last day
27%
339
Compared to previous day
Last week
-10.3%
16,502
Compared to previous week
Last month
-20.6%
69,826
Compared to previous month
Last year
-29.8%
1,038,927
Compared to previous year
31
BaseTable is a react table component to display large datasets with high performance and flexibility
1# npm 2npm install react-base-table --save 3 4# yarn 5yarn add react-base-table
1import BaseTable, { Column } from 'react-base-table' 2import 'react-base-table/styles.css' 3// Important: if you fail to import react-base-table/styles.css then 4// BaseTable will not render as advertised in the included examples. 5// For advanced styling see link below: 6// https://github.com/Autodesk/react-base-table#advance 7 ... 8<BaseTable data={data} width={600} height={400}> 9 <Column key="col0" dataKey="col0" width={100} /> 10 <Column key="col1" dataKey="col1" width={100} /> 11 ... 12</BaseTable> 13...
Learn more at the website
key
is required for column definition or the column will be ignored
Make sure each item in data
is unique by a key, the default key is id
, you can customize it via rowKey
width
is required for column definition, but in flex mode(fixed={false}
), you can set width={0}
and flexGrow={1}
to achieve flexible column width, checkout the Flex Column example
width
and height
(or maxHeight
) are required to display the table properly
In the examples
we are using a wrapper const Table = props => <BaseTable width={700} height={400} {...props} />
to do that
If you want it responsive, you can use the AutoResizer
to make the table fill the container, checkout the Auto Resize example
In practice we tend to write inline functions for custom renderers, which would make shouldUpdateComponent
always true as the inline function will create a new instance on every re-render, to avoid "unnecessary" re-renders, BaseTable
ignores functions when comparing column definition by default, it works well in most cases before, but if we use external data instead of reference state in custom renderers, we always get the staled initial value although the data has changed
It's recommended to inject the external data in column definition to solve the problem, like <Column foo={foo} bar={bar} cellRenderer={({ column: { foo, bar }}) => { ... } } />
, the column definition will update on external data change, with this pattern we can easily move the custom renderers out of column definition for sharing, the downside is it would bloat the column definition and bug prone
Things getting worse with the introduction of React hooks, we use primitive state instead of this.state
, so it's easy to encounter the closure problem, but with React hooks, we can easily memoize functions via useCallback
or useMemo
, so the implicit optimization could be replaced with user land optimization which is more intuitive, to turn off the implicit optimization, set ignoreFunctionInColumnCompare
to false
which is introduced since v1.11.0
Here is an example to demonstrate
BaseTable
is well tested on all modern browsers and IE11. You have to polyfill Array.prototype.findIndex
to make it works on IE
The examples don't work on IE as they are powered by react-runner which is a react-live
like library but only for modern browsers.
BaseTable is designed to be the base component to build your own complex table component
The simplest way is overriding the default styles (assuming you are using scss
)
1// override default variables for BaseTable 2$table-prefix: AdvanceTable; 3 4$table-font-size: 13px; 5$table-padding-left: 15px; 6$table-padding-right: 15px; 7$column-padding: 7.5px; 8... 9$show-frozen-rows-shadow: false; 10$show-frozen-columns-shadow: true; 11 12@import '~react-base-table/es/_BaseTable.scss'; 13 14.#{$table-prefix} { 15 &:not(.#{$table-prefix}--show-left-shadow) { 16 .#{$table-prefix}__table-frozen-left { 17 box-shadow: none; 18 } 19 } 20 21 &:not(.#{$table-prefix}--show-right-shadow) { 22 .#{$table-prefix}__table-frozen-right { 23 box-shadow: none; 24 } 25 } 26 27 ... 28}
You can write your own styles from scratch or use CSS-in-JS solutions to achieve that
1<BaseTable 2 classPrefix="AdvanceTable" 3 components={{ 4 TableCell: AdvanceTableCell, 5 TableHeaderCell: AdvanceTableHeaderCell, 6 ExpandIcon: AdvanceExpandIcon, 7 SortIndicator: AdvanceSortIndicator, 8 }} 9 ... 10/>
There are a lot of highly flexible props like xxxRenderer
and xxxProps
for you to build your own table component, please check the api and examples for more details
We are using a advanced table component based on BaseTable
internally, with much more features, including row selection, row grouping, data aggregation, column settings, column reordering, and column grouping, tooltip, inline editing.
We use Yarn
as the package manager, checkout this repo and run yarn
under both root folder and website
folder in install packages, then run yarn start
to start the demo site powered by Gatsby
Please check guidelines for more details
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 12/24 approved changesets -- score normalized to 5
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
165 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More