mirror of
https://github.com/gosticks/react-table.git
synced 2026-10-04 23:06:56 +00:00
Compare commits
48
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49eb999821 | ||
|
|
8cec156d13 | ||
|
|
5c531095a9 | ||
|
|
8d4deb3496 | ||
|
|
646b701f93 | ||
|
|
3043cbe4b4 | ||
|
|
fcb82694bb | ||
|
|
e8c557d70e | ||
|
|
ff95c21440 | ||
|
|
2630161222 | ||
|
|
e67072edae | ||
|
|
fb569ad592 | ||
|
|
b957503612 | ||
|
|
3d9b7b1186 | ||
|
|
e3528fef38 | ||
|
|
6b192bd363 | ||
|
|
0725f2159d | ||
|
|
5d2deda246 | ||
|
|
2961eb8a18 | ||
|
|
d170adb6a7 | ||
|
|
d8aec06496 | ||
|
|
8efeef3b8b | ||
|
|
8004e7a85f | ||
|
|
84af88916a | ||
|
|
9846bf1905 | ||
|
|
bf88dda5dc | ||
|
|
7f5779a833 | ||
|
|
8792bd95a0 | ||
|
|
098b1fec51 | ||
|
|
750cfe3ac4 | ||
|
|
370f443347 | ||
|
|
67f8c9adf1 | ||
|
|
867cc25899 | ||
|
|
639630946c | ||
|
|
688afd2947 | ||
|
|
bbebf02a55 | ||
|
|
f4d3c2d7bb | ||
|
|
f8634e771e | ||
|
|
ba74ab3ce8 | ||
|
|
30ed0c82fc | ||
|
|
62f19aecf0 | ||
|
|
8dc4caff45 | ||
|
|
c2e935d75b | ||
|
|
f9a1cfae1e | ||
|
|
5ac2c1779d | ||
|
|
3b2432f535 | ||
|
|
7aa98887ef | ||
|
|
d26d82ecfb |
+5
-2
@@ -4,11 +4,14 @@ module.exports = {
|
|||||||
ecmaFeatures: {
|
ecmaFeatures: {
|
||||||
experimentalObjectRestSpread: true,
|
experimentalObjectRestSpread: true,
|
||||||
jsx: true,
|
jsx: true,
|
||||||
node: false
|
node: false,
|
||||||
|
classes: true
|
||||||
},
|
},
|
||||||
sourceType: 'module'
|
sourceType: 'module'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
parser: 'babel-eslint',
|
||||||
|
|
||||||
extends: ['standard'],
|
extends: ['standard'],
|
||||||
|
|
||||||
plugins: ['react'],
|
plugins: ['react'],
|
||||||
@@ -48,7 +51,7 @@ module.exports = {
|
|||||||
'react/no-did-update-set-state': 2,
|
'react/no-did-update-set-state': 2,
|
||||||
'react/no-unknown-property': 2,
|
'react/no-unknown-property': 2,
|
||||||
'react/react-in-jsx-scope': 2,
|
'react/react-in-jsx-scope': 2,
|
||||||
'react/jsx-closing-bracket-location': [2, 'tag-aligned'],
|
'react/jsx-closing-bracket-location': [0, 'tag-aligned'],
|
||||||
'react/jsx-tag-spacing': [2, { beforeSelfClosing: 'always' }],
|
'react/jsx-tag-spacing': [2, { beforeSelfClosing: 'always' }],
|
||||||
'react/jsx-wrap-multilines': 2,
|
'react/jsx-wrap-multilines': 2,
|
||||||
'react/self-closing-comp': 2,
|
'react/self-closing-comp': 2,
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
## 6.5.0
|
||||||
|
##### New Features
|
||||||
|
- `column.filterAll` - defaults to `false`, but when set to `true` will provide the entire array of rows to `filterMethod` as opposed to one row at a time. This allows for more fine-grained filtering using any method you can dream up. See the [Custom Filtering example](https://react-table.js.org/#/story/custom-filtering) for more info.
|
||||||
|
|
||||||
## 6.4.0
|
## 6.4.0
|
||||||
##### New Features
|
##### New Features
|
||||||
- `PadRowComponent` - the content rendered inside of a padding row. Defaults to a react component that renders ` `
|
- `PadRowComponent` - the content rendered inside of a padding row. Defaults to a react component that renders ` `
|
||||||
|
|||||||
+11
-12
@@ -1,15 +1,14 @@
|
|||||||
## Problem Description
|
## What version of React-Table are you using?
|
||||||
include a detailed explanation of the problem here...
|
Your bug may already be fixed in the latest release. Run `yarn upgrade react-table`!
|
||||||
|
Place your version here...
|
||||||
|
|
||||||
## Code Snippet(s) or Codepen (http://codepen.io/tannerlinsley/pen/QpeZBa?editors=0010)
|
## What bug are you experiencing, or what feature are you proposing?
|
||||||
|
Please include a detailed explanation here...
|
||||||
|
|
||||||
## Steps to Reproduce
|
## Use https://codesandbox.io/s/X6npLXPRW (by clicking the "Fork" button) to reproduce the issue.
|
||||||
|
Then paste a link to your newly forked codesandbox here...
|
||||||
|
|
||||||
|
## What are the steps to reproduce the issue?
|
||||||
1. list the steps
|
1. list the steps
|
||||||
2. to reproduce the issue
|
2. to reproduce
|
||||||
|
3. the issue
|
||||||
## System Information
|
|
||||||
* **Browser & Browser Version:**
|
|
||||||
* **Node Version:**
|
|
||||||
* **OS Version:**
|
|
||||||
* **NPM Version:**
|
|
||||||
* **Yarn Version:**
|
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
<div align="center">
|
<div style="text-align:center;">
|
||||||
<a href="https://github.com/tannerlinsley/react-table" target="\_parent"><img src="https://github.com/tannerlinsley/react-table/raw/master/media/Banner.png" alt="React Table Logo" style="width:450px;"/></a>
|
<a href="https://github.com/react-tools/react-table" target="\_parent"><img src="https://github.com/react-tools/media/raw/master/logo-react-table.png" alt="React Table Logo" style="width:450px;"/></a>
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
# React Table
|
# React Table
|
||||||
`react-table` is a **lightweight, fast and extendable datagrid** built for React
|
`react-table` is a **lightweight, fast and extendable datagrid** built for React
|
||||||
|
|
||||||
|
<a href="https://travis-ci.org/react-tools/react-table" target="\_parent">
|
||||||
<a href="https://travis-ci.org/tannerlinsley/react-table" target="\_parent">
|
<img alt="" src="https://travis-ci.org/react-tools/react-table.svg?branch=master" />
|
||||||
<img alt="" src="https://travis-ci.org/tannerlinsley/react-table.svg?branch=master" />
|
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npmjs.com/package/react-table" target="\_parent">
|
<a href="https://npmjs.com/package/react-table" target="\_parent">
|
||||||
<img alt="" src="https://img.shields.io/npm/dm/react-table.svg" />
|
<img alt="" src="https://img.shields.io/npm/dm/react-table.svg" />
|
||||||
@@ -18,8 +14,8 @@
|
|||||||
<a href="https://react-chat-signup.herokuapp.com/" target="\_parent">
|
<a href="https://react-chat-signup.herokuapp.com/" target="\_parent">
|
||||||
<img alt="" src="https://img.shields.io/badge/slack-react--chat-blue.svg" />
|
<img alt="" src="https://img.shields.io/badge/slack-react--chat-blue.svg" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/tannerlinsley/react-table" target="\_parent">
|
<a href="https://github.com/react-tools/react-table" target="\_parent">
|
||||||
<img alt="" src="https://img.shields.io/github/stars/tannerlinsley/react-table.svg?style=social&label=Star" />
|
<img alt="" src="https://img.shields.io/github/stars/react-tools/react-table.svg?style=social&label=Star" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://twitter.com/tannerlinsley" target="\_parent">
|
<a href="https://twitter.com/tannerlinsley" target="\_parent">
|
||||||
<img alt="" src="https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow" />
|
<img alt="" src="https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow" />
|
||||||
@@ -28,25 +24,29 @@
|
|||||||
<img alt="" src="https://img.shields.io/badge/%24-Donate-brightgreen.svg" />
|
<img alt="" src="https://img.shields.io/badge/%24-Donate-brightgreen.svg" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
## Versions
|
<br />
|
||||||
This document refers to version 6.x.x of react-table.
|
<br />
|
||||||
|
|
||||||
Previous versions:
|
[](https://app.codesponsor.io/link/zpmS8V9r31sBSCeVzP7Wm6Sr/react-tools/react-table)
|
||||||
|
|
||||||
[5.x.x Readme](https://github.com/tannerlinsley/react-table/blob/ad7d31cd3978eb45da7c6194dbab93c1e9a8594d/README.md)
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Lightweight at 7kb (and just 2kb more for styles)
|
- Lightweight at 11kb (and just 2kb more for styles)
|
||||||
- Fully customizable JSX templating
|
- Fully customizable (JSX, templates, state, styles, callbacks)
|
||||||
- Supports both Client-side & Server-side pagination and multi-sorting
|
- Client-side & Server-side pagination
|
||||||
- Column Pivoting & Aggregation
|
- Multi-sort
|
||||||
|
- Filters
|
||||||
|
- Pivoting & Aggregation
|
||||||
- Minimal design & easily themeable
|
- Minimal design & easily themeable
|
||||||
- Fully controllable via optional props and callbacks
|
- Fully controllable via optional props and callbacks
|
||||||
- <a href="https://medium.com/@tannerlinsley/why-i-wrote-react-table-and-the-problems-it-has-solved-for-nozzle-others-445c4e93d4a8#.axza4ixba" target="\_parent">"Why I wrote React Table and the problems it has solved for Nozzle.io</a> by Tanner Linsley
|
- <a href="https://medium.com/@tannerlinsley/why-i-wrote-react-table-and-the-problems-it-has-solved-for-nozzle-others-445c4e93d4a8#.axza4ixba" target="\_parent">"Why I wrote React Table and the problems it has solved for Nozzle.io</a> by Tanner Linsley
|
||||||
|
|
||||||
## Demos and examples
|
## [Demos and examples](http://react-table.js.org/#/story/simple-table)
|
||||||
- <a href="http://codepen.io/tannerlinsley/pen/QpeZBa?editors=0010" target="\_blank">Codepen</a>
|
|
||||||
- <a href="http://react-table.js.org/#/story/simple-table" target="\_parent">Storybook</a>
|
## Versions
|
||||||
|
- This documentation is for version 6 of react-table.
|
||||||
|
- [View the Changelog](https://github.com/react-tools/react-table/blob/master/CHANGELOG.md)
|
||||||
|
- Previous versions:
|
||||||
|
- [5.x.x Readme](https://github.com/react-tools/react-table/blob/ad7d31cd3978eb45da7c6194dbab93c1e9a8594d/README.md)
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
@@ -287,6 +287,7 @@ These are all of the available props (and their default values) for the main `<R
|
|||||||
footerClassName: '',
|
footerClassName: '',
|
||||||
footerStyle: {},
|
footerStyle: {},
|
||||||
getFooterProps: () => ({}),
|
getFooterProps: () => ({}),
|
||||||
|
filterAll: false,
|
||||||
filterMethod: undefined,
|
filterMethod: undefined,
|
||||||
sortMethod: undefined,
|
sortMethod: undefined,
|
||||||
defaultSortDesc: undefined,
|
defaultSortDesc: undefined,
|
||||||
@@ -307,7 +308,7 @@ These are all of the available props (and their default values) for the main `<R
|
|||||||
previousText: 'Previous',
|
previousText: 'Previous',
|
||||||
nextText: 'Next',
|
nextText: 'Next',
|
||||||
loadingText: 'Loading...',
|
loadingText: 'Loading...',
|
||||||
noDataText: 'No rows found',
|
noDataText: 'No rows found',
|
||||||
pageText: 'Page',
|
pageText: 'Page',
|
||||||
ofText: 'of',
|
ofText: 'of',
|
||||||
rowsText: 'rows',
|
rowsText: 'rows',
|
||||||
@@ -397,10 +398,11 @@ Or just define them as props
|
|||||||
getFooterProps: (state, rowInfo, column, instance) => ({}), // A function that returns props to decorate the `td` element of the column's footer
|
getFooterProps: (state, rowInfo, column, instance) => ({}), // A function that returns props to decorate the `td` element of the column's footer
|
||||||
|
|
||||||
// Filtering
|
// Filtering
|
||||||
filterMethod: (filter, row, column) => {return true}, // A function returning a boolean that specifies the filtering logic for the column
|
filterMethod: (filter, row || rows, column) => {return true}, // A function returning a boolean that specifies the filtering logic for the column
|
||||||
// filter == an object specifying which filter is being applied. Format: {id: [the filter column's id], value: [the value the user typed in the filter field], pivotId: [if filtering on a pivot column, the pivotId will be set to the pivot column's id and the `id` field will be set to the top level pivoting column]}
|
// 'filter' == an object specifying which filter is being applied. Format: {id: [the filter column's id], value: [the value the user typed in the filter field], pivotId: [if filtering on a pivot column, the pivotId will be set to the pivot column's id and the `id` field will be set to the top level pivoting column]}
|
||||||
// row == the row of data supplied to the table
|
// 'row' || 'rows' == the row (or rows, if filterAll is set to true) of data supplied to the table
|
||||||
// column == the column that the filter is on
|
// 'column' == the column that the filter is on
|
||||||
|
filterAll: false
|
||||||
}]
|
}]
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -574,6 +576,8 @@ Every single built-in component's props can be dynamically extended using any on
|
|||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If used, **a callback prop must return an valid object**, even if it's an empty one.
|
||||||
|
|
||||||
These callbacks are executed with each render of the element with four parameters:
|
These callbacks are executed with each render of the element with four parameters:
|
||||||
1. Table State
|
1. Table State
|
||||||
2. RowInfo (undefined if not applicable)
|
2. RowInfo (undefined if not applicable)
|
||||||
@@ -586,12 +590,21 @@ This makes it extremely easy to add, say... a row click callback!
|
|||||||
<ReactTable
|
<ReactTable
|
||||||
getTdProps={(state, rowInfo, column, instance) => {
|
getTdProps={(state, rowInfo, column, instance) => {
|
||||||
return {
|
return {
|
||||||
onClick: e => {
|
onClick: (e, handleOriginal) => {
|
||||||
console.log('A Td Element was clicked!')
|
console.log('A Td Element was clicked!')
|
||||||
console.log('it produced this event:', e)
|
console.log('it produced this event:', e)
|
||||||
console.log('It was in this column:', column)
|
console.log('It was in this column:', column)
|
||||||
console.log('It was in this row:', rowInfo)
|
console.log('It was in this row:', rowInfo)
|
||||||
console.log('It was in this table instance:', instance)
|
console.log('It was in this table instance:', instance)
|
||||||
|
|
||||||
|
// IMPORTANT! React-Table uses onClick internally to trigger
|
||||||
|
// events like expanding SubComponents and pivots.
|
||||||
|
// By default a custom 'onClick' handler will override this functionality.
|
||||||
|
// If you want to fire the original onClick handler, call the
|
||||||
|
// 'handleOriginal' function.
|
||||||
|
if (handleOriginal) {
|
||||||
|
handleOriginal()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -724,7 +737,7 @@ If you want to handle pagination, sorting, and filtering on the server, `react-t
|
|||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
For a detailed example, take a peek at our <a href="https://github.com/tannerlinsley/react-table/blob/master/stories/ServerSide.js" target="\_parent">async table mockup</a>
|
For a detailed example, take a peek at our <a href="https://github.com/react-tools/react-table/blob/master/stories/ServerSide.js" target="\_parent">async table mockup</a>
|
||||||
|
|
||||||
## Fully Controlled Component
|
## Fully Controlled Component
|
||||||
React Table by default works fantastically out of the box, but you can achieve even more control and customization if you choose to maintain the state yourself. It is very easy to do, even if you only want to manage *parts* of the state.
|
React Table by default works fantastically out of the box, but you can achieve even more control and customization if you choose to maintain the state yourself. It is very easy to do, even if you only want to manage *parts* of the state.
|
||||||
@@ -742,7 +755,7 @@ Here are the props and their corresponding callbacks that control the state of t
|
|||||||
id: 'firstName',
|
id: 'firstName',
|
||||||
desc: true
|
desc: true
|
||||||
}]}
|
}]}
|
||||||
expandedRows={{ // The nested row indexes on the current page that should appear expanded
|
expanded={{ // The nested row indexes on the current page that should appear expanded
|
||||||
1: true,
|
1: true,
|
||||||
4: true,
|
4: true,
|
||||||
5: {
|
5: {
|
||||||
@@ -750,11 +763,11 @@ Here are the props and their corresponding callbacks that control the state of t
|
|||||||
3: true
|
3: true
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
filters={[{ // the current filters model
|
filtered={[{ // the current filters model
|
||||||
id: 'lastName',
|
id: 'lastName',
|
||||||
value: 'linsley'
|
value: 'linsley'
|
||||||
}]}
|
}]}
|
||||||
resizing={[{ // the current resized column model
|
resized={[{ // the current resized column model
|
||||||
"id": "lastName",
|
"id": "lastName",
|
||||||
"value": 446.25
|
"value": 446.25
|
||||||
}]}
|
}]}
|
||||||
@@ -763,8 +776,8 @@ Here are the props and their corresponding callbacks that control the state of t
|
|||||||
onPageChange={(pageIndex) => {...}} // Called when the page index is changed by the user
|
onPageChange={(pageIndex) => {...}} // Called when the page index is changed by the user
|
||||||
onPageSizeChange={(pageSize, pageIndex) => {...}} // Called when the pageSize is changed by the user. The resolve page is also sent to maintain approximate position in the data
|
onPageSizeChange={(pageSize, pageIndex) => {...}} // Called when the pageSize is changed by the user. The resolve page is also sent to maintain approximate position in the data
|
||||||
onSortedChange={(newSorted, column, shiftKey) => {...}} // Called when a sortable column header is clicked with the column itself and if the shiftkey was held. If the column is a pivoted column, `column` will be an array of columns
|
onSortedChange={(newSorted, column, shiftKey) => {...}} // Called when a sortable column header is clicked with the column itself and if the shiftkey was held. If the column is a pivoted column, `column` will be an array of columns
|
||||||
onExpandedChange={(newExpanded, index, event) => {...}} // Called when an expander is clicked. Use this to manage `expandedRows`
|
onExpandedChange={(newExpanded, index, event) => {...}} // Called when an expander is clicked. Use this to manage `expanded`
|
||||||
onFilteredChange={(column, value) => {...}} // Called when a user enters a value into a filter input field or the value passed to the onFiltersChange handler by the filterRender option.
|
onFilteredChange={(column, value) => {...}} // Called when a user enters a value into a filter input field or the value passed to the onFiltersChange handler by the Filter option.
|
||||||
onResizedChange={(newResized, event) => {...}} // Called when a user clicks on a resizing component (the right edge of a column header)
|
onResizedChange={(newResized, event) => {...}} // Called when a user clicks on a resizing component (the right edge of a column header)
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
@@ -854,6 +867,10 @@ By default the table tries to filter by checking if the row's value starts with
|
|||||||
|
|
||||||
If you want to override a particular column's filtering method, you can set the `filterMethod` option on a column.
|
If you want to override a particular column's filtering method, you can set the `filterMethod` option on a column.
|
||||||
|
|
||||||
|
By default, `filterMethod` is passed a single row of data at a time, and you are responsible for returning `true` or `false`, indicating whether it should be shown.
|
||||||
|
|
||||||
|
Alternatively, you can set `filterAll` to `true`, and `filterMethod` will be passed the entire array of rows to be filtered, and you will then be responsible for returning the new filtered array. This is extremely handy when you need to utilize a utility like fuzzy matching that requires the entire array of items.
|
||||||
|
|
||||||
To completely override the filter that is shown, you can set the `Filter` column option. Using this option you can specify the JSX that is shown. The option is passed an `onChange` method which must be called with the the value that you wan't to pass to the `filterMethod` option whenever the filter has changed.
|
To completely override the filter that is shown, you can set the `Filter` column option. Using this option you can specify the JSX that is shown. The option is passed an `onChange` method which must be called with the the value that you wan't to pass to the `filterMethod` option whenever the filter has changed.
|
||||||
|
|
||||||
See <a href="http://react-table.js.org/#/story/custom-filtering" target="\_parent">Custom Filtering</a> demo for examples.
|
See <a href="http://react-table.js.org/#/story/custom-filtering" target="\_parent">Custom Filtering</a> demo for examples.
|
||||||
@@ -893,7 +910,7 @@ Object.assign(ReactTableDefaults, {
|
|||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
If you choose to change the core components React-Table uses to render, you must make sure your replacement components consume and utilize all of the supplied and inherited props that are needed for that component to function properly. We would suggest investigating <a href="https://github.com/tannerlinsley/react-table/blob/master/src/index.js" target="\_parent">the source</a> for the component you wish to replace.
|
If you choose to change the core components React-Table uses to render, you must make sure your replacement components consume and utilize all of the supplied and inherited props that are needed for that component to function properly. We would suggest investigating <a href="https://github.com/react-tools/react-table/blob/master/src/index.js" target="\_parent">the source</a> for the component you wish to replace.
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
module.exports = {
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 8,
|
||||||
|
ecmaFeatures: {
|
||||||
|
experimentalObjectRestSpread: true,
|
||||||
|
jsx: true,
|
||||||
|
node: false,
|
||||||
|
classes: true
|
||||||
|
},
|
||||||
|
sourceType: 'module'
|
||||||
|
},
|
||||||
|
|
||||||
|
parser: 'babel-eslint',
|
||||||
|
|
||||||
|
extends: ['standard'],
|
||||||
|
|
||||||
|
plugins: ['react'],
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
// Nozzle
|
||||||
|
'jsx-quotes': [2, 'prefer-single'],
|
||||||
|
'comma-dangle': [2, 'always-multiline'],
|
||||||
|
|
||||||
|
// // React
|
||||||
|
'react/jsx-boolean-value': 2,
|
||||||
|
'react/jsx-curly-spacing': [2, 'never'],
|
||||||
|
'react/jsx-equals-spacing': [2, 'never'],
|
||||||
|
// 'react/jsx-indent': 2,
|
||||||
|
'react/jsx-indent-props': [2, 2],
|
||||||
|
'react/jsx-no-duplicate-props': 2,
|
||||||
|
'react/jsx-no-undef': 2,
|
||||||
|
'react/jsx-tag-spacing': [
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
closingSlash: 'never',
|
||||||
|
beforeSelfClosing: 'always',
|
||||||
|
afterOpening: 'never'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'react/jsx-uses-react': 2,
|
||||||
|
'react/jsx-uses-vars': 2,
|
||||||
|
'react/self-closing-comp': 2,
|
||||||
|
'react/jsx-no-bind': [
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
allowArrowFunctions: true,
|
||||||
|
allowBind: false,
|
||||||
|
ignoreRefs: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'react/no-did-update-set-state': 2,
|
||||||
|
'react/no-unknown-property': 2,
|
||||||
|
'react/react-in-jsx-scope': 2,
|
||||||
|
'react/jsx-closing-bracket-location': [0, 'tag-aligned'],
|
||||||
|
'react/jsx-tag-spacing': [2, { beforeSelfClosing: 'always' }],
|
||||||
|
'react/jsx-wrap-multilines': 2,
|
||||||
|
'react/self-closing-comp': 2,
|
||||||
|
'react/jsx-key': 2,
|
||||||
|
'react/jsx-no-comment-textnodes': 2,
|
||||||
|
'react/jsx-no-duplicate-props': 2,
|
||||||
|
'react/jsx-no-target-blank': 2,
|
||||||
|
'react/jsx-no-undef': 2,
|
||||||
|
'react/jsx-uses-react': 2,
|
||||||
|
'react/jsx-uses-vars': 2,
|
||||||
|
'react/no-danger-with-children': 2,
|
||||||
|
'react/no-deprecated': 2,
|
||||||
|
'react/no-direct-mutation-state': 2,
|
||||||
|
'react/no-find-dom-node': 2,
|
||||||
|
'react/no-is-mounted': 2,
|
||||||
|
'react/no-render-return-value': 2,
|
||||||
|
'react/no-string-refs': 2,
|
||||||
|
'react/no-unknown-property': 2,
|
||||||
|
'react/react-in-jsx-scope': 2,
|
||||||
|
'react/require-render-return': 2
|
||||||
|
// 'react/jsx-max-props-per-line': [2, { maximum: 1 }]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
react-table.js.org
|
||||||
+19
-1
@@ -4,7 +4,25 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"react-scripts": "0.9.5",
|
"react-scripts": "0.9.5",
|
||||||
"standard": "^10.0.2"
|
"standard": "^10.0.2",
|
||||||
|
"autoprefixer": "^6.7.0",
|
||||||
|
"babel-cli": "6.14.0",
|
||||||
|
"babel-eslint": "6.1.2",
|
||||||
|
"babel-preset-es2015": "6.14.0",
|
||||||
|
"babel-preset-react": "6.11.1",
|
||||||
|
"babel-preset-stage-2": "6.13.0",
|
||||||
|
"eslint": "^4.1.1",
|
||||||
|
"match-sorter": "^1.8.0",
|
||||||
|
"npm-run-all": "^3.1.1",
|
||||||
|
"onchange": "^3.0.2",
|
||||||
|
"postcss-cli": "^2.6.0",
|
||||||
|
"react": "^15.4.2",
|
||||||
|
"react-dom": "^15.4.2",
|
||||||
|
"react-json-tree": "^0.10.9",
|
||||||
|
"rimraf": "^2.6.1",
|
||||||
|
"standard": "^10.0.2",
|
||||||
|
"stylus": "^0.54.5",
|
||||||
|
"webpack": "^2.5.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"github-markdown-css": "^2.6.0",
|
"github-markdown-css": "^2.6.0",
|
||||||
|
|||||||
+64
-71
@@ -1,109 +1,102 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
//
|
//
|
||||||
import ReactStory, { defaultProps } from 'react-story'
|
import ReactStory, { defaultProps } from 'react-story'
|
||||||
|
import CodeSandbox from './CodeSandbox.js'
|
||||||
import './stories/utils/prism.css'
|
import './stories/utils/prism.css'
|
||||||
import '../../react-table.css'
|
import '../../react-table.css'
|
||||||
|
|
||||||
import Readme from './stories/Readme.js'
|
import Readme from './stories/Readme.js'
|
||||||
import Simple from './stories/Simple.js'
|
|
||||||
import CellRenderers from './stories/CellRenderers.js'
|
const stories = [
|
||||||
import DefaultSorting from './stories/DefaultSorting.js'
|
{ name: 'Readme', component: Readme },
|
||||||
import CustomSorting from './stories/CustomSorting.js'
|
{ name: 'Simple Table', component: CodeSandbox('X6npLXPRW') },
|
||||||
import CustomWidths from './stories/CustomWidths.js'
|
{
|
||||||
import CustomComponentProps from './stories/CustomComponentProps.js'
|
name: 'Cell Renderers & Custom Components',
|
||||||
import ServerSide from './stories/ServerSide.js'
|
component: CodeSandbox('OyRL04Z4Y'),
|
||||||
import SubComponents from './stories/SubComponents.js'
|
},
|
||||||
import Pivoting from './stories/Pivoting.js'
|
{ name: 'Default Sorting', component: CodeSandbox('gLwmmjzA3') },
|
||||||
import PivotingSubComponents from './stories/PivotingSubComponents.js'
|
{
|
||||||
import OneHundredKRows from './stories/OneHundredKRows.js'
|
name: 'Custom Sorting',
|
||||||
import FunctionalRendering from './stories/FunctionalRendering.js'
|
component: CodeSandbox('VGx67J35'),
|
||||||
import CustomExpanderPosition from './stories/CustomExpanderPosition.js'
|
},
|
||||||
import NoDataText from './stories/NoDataText.js'
|
{ name: 'Custom Column Widths', component: CodeSandbox('o2OORXNXN') },
|
||||||
import Footers from './stories/Footers.js'
|
{ name: 'Custom Component Props', component: CodeSandbox('nZW3L0wp4') },
|
||||||
import Filtering from './stories/Filtering.js'
|
{ name: 'Server-side Data', component: CodeSandbox('wjrn8wy3R') },
|
||||||
import ControlledTable from './stories/ControlledTable.js'
|
{ name: 'Sub Components', component: CodeSandbox('n2gqAxl7') },
|
||||||
import PivotingOptions from './stories/PivotingOptions.js'
|
{ name: 'Pivoting & Aggregation', component: CodeSandbox('oNY9z8xN') },
|
||||||
import EditableTable from './stories/EditableTable.js'
|
{
|
||||||
import FixedHeader from './stories/FixedHeader.js'
|
name: 'Pivoting & Aggregation w/ Sub Components',
|
||||||
import MultiplePagers from './stories/MultiplePagers';
|
component: CodeSandbox('p0kEVBgQ'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '100k Rows w/ Pivoting & Sub Components',
|
||||||
|
component: CodeSandbox('DRmKj0XyK'),
|
||||||
|
},
|
||||||
|
{ name: 'Pivoting Options', component: CodeSandbox('kZKmNBK6r') },
|
||||||
|
{ name: 'Functional Rendering', component: CodeSandbox('VPZ0Bzv8X') },
|
||||||
|
{
|
||||||
|
name: 'Custom Expander Position',
|
||||||
|
component: CodeSandbox('1jj2XrPEV'),
|
||||||
|
},
|
||||||
|
{ name: 'Custom "No Data" Text', component: CodeSandbox('RgRpRDv80') },
|
||||||
|
{ name: 'Footers', component: CodeSandbox('KOqQXn3p8') },
|
||||||
|
{ name: 'Custom Filtering', component: CodeSandbox('5Eyxxxyx') },
|
||||||
|
{ name: 'Controlled Component', component: CodeSandbox('r7XEZRK2') },
|
||||||
|
{ name: 'Editable Table', component: CodeSandbox('n5r19gzQP') },
|
||||||
|
{
|
||||||
|
name: 'Fixed Header w/ Vertical Scroll',
|
||||||
|
component: CodeSandbox('7LY0gjA8O'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Multiple Pagers (Top and Bottom)',
|
||||||
|
component: CodeSandbox('VEZ8OgvX'),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
export default class App extends React.Component {
|
export default class App extends React.Component {
|
||||||
render() {
|
render () {
|
||||||
return (
|
return (
|
||||||
<ReactStory
|
<ReactStory
|
||||||
style={{
|
style={{
|
||||||
display: 'block',
|
display: 'block',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%'
|
height: '100%',
|
||||||
}}
|
}}
|
||||||
pathPrefix="story/"
|
pathPrefix='story/'
|
||||||
StoryWrapper={props => (
|
StoryWrapper={props =>
|
||||||
<defaultProps.StoryWrapper
|
<defaultProps.StoryWrapper
|
||||||
css={{
|
css={{
|
||||||
padding: 0
|
padding: 0,
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href="//github.com/tannerlinsley/react-table"
|
href='//github.com/react-tools/react-table'
|
||||||
style={{
|
style={{
|
||||||
display: 'block',
|
display: 'block',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
borderBottom: 'solid 3px #cccccc'
|
borderBottom: 'solid 3px #cccccc',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src="//npmcdn.com/react-table/media/Banner.png"
|
src='https://github.com/react-tools/media/raw/master/logo-react-table.png'
|
||||||
alt="React Table Logo"
|
alt='React Table Logo'
|
||||||
style={{
|
style={{
|
||||||
width: '100px'
|
width: '150px',
|
||||||
|
padding: '10px',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<div
|
<div
|
||||||
{...props}
|
{...props}
|
||||||
style={{
|
style={{
|
||||||
padding: '10px'
|
flex: '1 0 auto',
|
||||||
|
position: 'relative',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</defaultProps.StoryWrapper>
|
</defaultProps.StoryWrapper>}
|
||||||
)}
|
stories={stories}
|
||||||
stories={[
|
|
||||||
{ name: 'Readme', component: Readme },
|
|
||||||
{ name: 'Simple Table', component: Simple },
|
|
||||||
{
|
|
||||||
name: 'Cell Renderers & Custom Components',
|
|
||||||
component: CellRenderers
|
|
||||||
},
|
|
||||||
{ name: 'Default Sorting', component: DefaultSorting },
|
|
||||||
{ name: 'Custom Sorting', component: CustomSorting },
|
|
||||||
{ name: 'Custom Column Widths', component: CustomWidths },
|
|
||||||
{ name: 'Custom Component Props', component: CustomComponentProps },
|
|
||||||
{ name: 'Server-side Data', component: ServerSide },
|
|
||||||
{ name: 'Sub Components', component: SubComponents },
|
|
||||||
{ name: 'Pivoting & Aggregation', component: Pivoting },
|
|
||||||
{
|
|
||||||
name: 'Pivoting & Aggregation w/ Sub Components',
|
|
||||||
component: PivotingSubComponents
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '100k Rows w/ Pivoting & Sub Components',
|
|
||||||
component: OneHundredKRows
|
|
||||||
},
|
|
||||||
{ name: 'Pivoting Options', component: PivotingOptions },
|
|
||||||
{ name: 'Functional Rendering', component: FunctionalRendering },
|
|
||||||
{
|
|
||||||
name: 'Custom Expander Position',
|
|
||||||
component: CustomExpanderPosition
|
|
||||||
},
|
|
||||||
{ name: 'Custom "No Data" Text', component: NoDataText },
|
|
||||||
{ name: 'Footers', component: Footers },
|
|
||||||
{ name: 'Custom Filtering', component: Filtering },
|
|
||||||
{ name: 'Controlled Component', component: ControlledTable },
|
|
||||||
{ name: 'Editable Table', component: EditableTable },
|
|
||||||
{ name: 'Fixed Header w/ Vertical Scroll', component: FixedHeader },
|
|
||||||
{ name: 'Multiple Pagers (Top and Bottom)', component: MultiplePagers}
|
|
||||||
]}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
export default id => () => {
|
||||||
|
return (
|
||||||
|
<iframe
|
||||||
|
src={`https://codesandbox.io/embed/${id}?autoresize=1&hidenavigation=1&view=${global.innerWidth <
|
||||||
|
1000
|
||||||
|
? 'preview'
|
||||||
|
: 'split'}`}
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
width: `100%`,
|
||||||
|
height: `100%`,
|
||||||
|
border: 0,
|
||||||
|
overflow: `hidden`,
|
||||||
|
}}
|
||||||
|
sandbox='allow-modals allow-forms allow-popups allow-scripts allow-same-origin'
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
const statusChance = Math.random()
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
progress: Math.floor(Math.random() * 100),
|
|
||||||
status: statusChance > 0.66 ? 'relationship'
|
|
||||||
: statusChance > 0.33 ? 'complicated'
|
|
||||||
: 'single'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Profile Progress',
|
|
||||||
accessor: 'progress',
|
|
||||||
Cell: row => (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
backgroundColor: '#dadada',
|
|
||||||
borderRadius: '2px'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
width: `${row.value}%`,
|
|
||||||
height: '100%',
|
|
||||||
backgroundColor: row.value > 66 ? '#85cc00'
|
|
||||||
: row.value > 33 ? '#ffbf00'
|
|
||||||
: '#ff2e00',
|
|
||||||
borderRadius: '2px',
|
|
||||||
transition: 'all .2s ease-out'
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}, {
|
|
||||||
Header: 'Status',
|
|
||||||
accessor: 'status',
|
|
||||||
Cell: row => (
|
|
||||||
<span>
|
|
||||||
<span style={{
|
|
||||||
color: row.value === 'relationship' ? '#ff2e00'
|
|
||||||
: row.value === 'complicated' ? '#ffbf00'
|
|
||||||
: '#57d500',
|
|
||||||
transition: 'all .3s ease'
|
|
||||||
}}>
|
|
||||||
●
|
|
||||||
</span> {
|
|
||||||
row.value === 'relationship' ? 'In a relationship'
|
|
||||||
: row.value === 'complicated' ? `It's complicated`
|
|
||||||
: 'Single'
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./CellRenderers')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
constructor () {
|
|
||||||
super()
|
|
||||||
this.state = {
|
|
||||||
sorted: [],
|
|
||||||
page: 0,
|
|
||||||
pageSize: 10,
|
|
||||||
expanded: {},
|
|
||||||
resized: [],
|
|
||||||
filtered: []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
render () {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
pivotBy={['lastName']}
|
|
||||||
filterable
|
|
||||||
// Controlled Props
|
|
||||||
sorted={this.state.sorted}
|
|
||||||
page={this.state.page}
|
|
||||||
pageSize={this.state.pageSize}
|
|
||||||
expanded={this.state.expanded}
|
|
||||||
resized={this.state.resized}
|
|
||||||
filtered={this.state.filtered}
|
|
||||||
// Callbacks
|
|
||||||
onSortedChange={sorted => this.setState({sorted})}
|
|
||||||
onPageChange={page => this.setState({page})}
|
|
||||||
onPageSizeChange={(pageSize, page) => this.setState({page, pageSize})}
|
|
||||||
onExpandedChange={expanded => this.setState({expanded})}
|
|
||||||
onResizedChange={resized => this.setState({resized})}
|
|
||||||
onFilteredChange={filtered => this.setState({filtered})}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<pre><code><strong>this.state ===</strong> {JSON.stringify(this.state, null, 2)}</code></pre>
|
|
||||||
<br />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./ControlledTable')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<strong>Hey!</strong> Open your console! :)
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
getTdProps={(state, rowInfo, column, instance) => {
|
|
||||||
return {
|
|
||||||
onMouseEnter: e => console.log('Cell - onMouseEnter', {
|
|
||||||
state,
|
|
||||||
rowInfo,
|
|
||||||
column,
|
|
||||||
instance,
|
|
||||||
event: e
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./CustomComponentProps')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({words: 1, numbers: 0}),
|
|
||||||
lastName: namor.generate({words: 1, numbers: 0}),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName',
|
|
||||||
Footer: () => <div style={{textAlign: 'center'}}>First Name</div>
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
accessor: 'lastName',
|
|
||||||
Footer: () => <div style={{textAlign: 'center'}}>Last Name</div>
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age',
|
|
||||||
Footer: () => <div style={{textAlign: 'center'}}>Age</div>
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Expand',
|
|
||||||
columns: [{
|
|
||||||
expander: true,
|
|
||||||
Header: () => (<strong>More</strong>),
|
|
||||||
width: 65,
|
|
||||||
Expander: ({isExpanded, ...rest}) => (
|
|
||||||
<div>
|
|
||||||
{isExpanded ? <span>⊙</span> : <span>⊕</span>}
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
style: {cursor: 'pointer', fontSize: 25, padding: '0', textAlign: 'center', userSelect: 'none'},
|
|
||||||
Footer: () => <span>♥</span>
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
SubComponent={() => <span>Hello</span>}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./CustomExpanderPosition')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name (Sorted by Length, A-Z)',
|
|
||||||
accessor: 'firstName',
|
|
||||||
sortMethod: (a, b) => {
|
|
||||||
if (a.length === b.length) {
|
|
||||||
return a > b ? 1 : -1
|
|
||||||
}
|
|
||||||
return a.length > b.length ? 1 : -1
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name (Sorted in reverse, A-Z)',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName,
|
|
||||||
sortMethod: (a, b) => {
|
|
||||||
if (a === b) {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
const aReverse = a.split('').reverse().join('')
|
|
||||||
const bReverse = b.split('').reverse().join('')
|
|
||||||
return aReverse > bReverse ? 1 : -1
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./CustomSorting')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName',
|
|
||||||
maxWidth: 200
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName,
|
|
||||||
width: 300
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age',
|
|
||||||
minWidth: 400
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./CustomWidths')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
defaultSorted={[{
|
|
||||||
id: 'age',
|
|
||||||
desc: true
|
|
||||||
}]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./DefaultSorting')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
constructor (props, context) {
|
|
||||||
super(props, context)
|
|
||||||
this.renderEditable = this.renderEditable.bind(this)
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
data: [
|
|
||||||
{ firstName: 'Lucy', lastName: 'Marks' },
|
|
||||||
{ firstName: 'Bejamin', lastName: 'Pike' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
this.columns = [
|
|
||||||
{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName',
|
|
||||||
Cell: this.renderEditable
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Header: 'Last Name',
|
|
||||||
accessor: 'lastName',
|
|
||||||
Cell: this.renderEditable
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Header: 'Full Name',
|
|
||||||
id: 'full',
|
|
||||||
accessor: d => d.firstName + ' ' + d.lastName
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
renderEditable (cellInfo) {
|
|
||||||
return (<div style={{ backgroundColor: '#fafafa' }} contentEditable suppressContentEditableWarning onBlur={(e) => {
|
|
||||||
const data = [...this.state.data]
|
|
||||||
data[cellInfo.index][cellInfo.column.id] = e.target.textContent
|
|
||||||
this.setState({data: data})
|
|
||||||
}}>{this.state.data[cellInfo.index][cellInfo.column.id]}</div>)
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
|
||||||
return (
|
|
||||||
<div className='table-wrap' style={{marginBottom: '20px'}}>
|
|
||||||
<p>First two columns are editable just by clicking into them using the <code>contentEditable</code> attribute. Last column (Full Name) is computed from the first two.</p>
|
|
||||||
<ReactTable
|
|
||||||
data={this.state.data}
|
|
||||||
columns={this.columns}
|
|
||||||
defaultPageSize={2}
|
|
||||||
showPageSizeOptions={false}
|
|
||||||
showPagination={false}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./EditableTable')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,194 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import CodeHighlight from './components/codeHighlight'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
constructor (props) {
|
|
||||||
super(props)
|
|
||||||
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({words: 1, numbers: 0}),
|
|
||||||
lastName: namor.generate({words: 1, numbers: 0}),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
tableOptions: {
|
|
||||||
loading: false,
|
|
||||||
showPagination: true,
|
|
||||||
showPageSizeOptions: true,
|
|
||||||
showPageJump: true,
|
|
||||||
collapseOnSortingChange: true,
|
|
||||||
collapseOnPageChange: true,
|
|
||||||
collapseOnDataChange: true,
|
|
||||||
freezeWhenExpanded: false,
|
|
||||||
filterable: true,
|
|
||||||
sortable: true,
|
|
||||||
resizable: true
|
|
||||||
},
|
|
||||||
data: data
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setTableOption = this.setTableOption.bind(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName',
|
|
||||||
filterMethod: (filter, row) => (row[filter.id].startsWith(filter.value) && row[filter.id].endsWith(filter.value))
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName,
|
|
||||||
filterMethod: (filter, row) => (row[filter.id].includes(filter.value))
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}, {
|
|
||||||
Header: 'Over 21',
|
|
||||||
accessor: 'age',
|
|
||||||
id: 'over',
|
|
||||||
Cell: ({value}) => (value >= 21 ? 'Yes' : 'No'),
|
|
||||||
filterMethod: (filter, row) => {
|
|
||||||
if (filter.value === 'all') {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if (filter.value === 'true') {
|
|
||||||
return row[filter.id] >= 21
|
|
||||||
}
|
|
||||||
return row[filter.id] < 21
|
|
||||||
},
|
|
||||||
Filter: ({filter, onChange}) => (
|
|
||||||
<select
|
|
||||||
onChange={event => onChange(event.target.value)}
|
|
||||||
style={{width: '100%'}}
|
|
||||||
value={filter ? filter.value : 'all'}
|
|
||||||
>
|
|
||||||
<option value='all' />
|
|
||||||
<option value='true'>Can Drink</option>
|
|
||||||
<option value='false'>Can't Drink</option>
|
|
||||||
</select>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div>
|
|
||||||
<h1>Table Options</h1>
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
{
|
|
||||||
Object.keys(this.state.tableOptions).map(optionKey => {
|
|
||||||
const optionValue = this.state.tableOptions[optionKey]
|
|
||||||
return (
|
|
||||||
<tr key={optionKey}>
|
|
||||||
<td>{optionKey}</td>
|
|
||||||
<td style={{paddingLeft: 10, paddingTop: 5}}>
|
|
||||||
<input type='checkbox'
|
|
||||||
name={optionKey}
|
|
||||||
checked={optionValue}
|
|
||||||
onChange={this.setTableOption}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={this.state.data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
defaultFilterMethod={(filter, row) => (String(row[filter.id]) === filter.value)}
|
|
||||||
{...this.state.tableOptions}
|
|
||||||
SubComponent={(row) => {
|
|
||||||
return (
|
|
||||||
<div style={{padding: '20px'}}>
|
|
||||||
<em>You can put any component you want here, even another React Table!</em>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<ReactTable
|
|
||||||
data={this.state.data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={3}
|
|
||||||
showPagination={false}
|
|
||||||
SubComponent={(row) => {
|
|
||||||
return (
|
|
||||||
<div style={{padding: '20px'}}>
|
|
||||||
<em>It even has access to the row data: </em>
|
|
||||||
<CodeHighlight>{() => JSON.stringify(row, null, 2)}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h1>Custom Filters In This Example</h1>
|
|
||||||
<p>The default filter for all columns of a table if it is not specified in the configuration is set to match
|
|
||||||
on values that start with the filter text. Example: age.startsWith("2").</p>
|
|
||||||
<p>This example overrides the default filter behavior by setting
|
|
||||||
the <strong>defaultFilterMethod</strong> table option to match on values that are exactly equal to the
|
|
||||||
filter text. Example: age == "23")</p>
|
|
||||||
<p>Each column can also be customized with the column <strong>filterMethod</strong> option:</p>
|
|
||||||
<p>In this example the firstName column filters on the value starting with and ending with the filter
|
|
||||||
value.</p>
|
|
||||||
<p>In this example the lastName column filters on the value including the filter value anywhere in its
|
|
||||||
text.</p>
|
|
||||||
<p>To completely override the filter that is shown, you can set the <strong>Filter</strong> column
|
|
||||||
option. Using this option you can specify the JSX that is shown. The option is passed
|
|
||||||
an <strong>onChange</strong> method that must be called with the value that you wan't to
|
|
||||||
pass to the <strong>filterMethod</strong> option whenever the filter has changed.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
setTableOption (event) {
|
|
||||||
const target = event.target
|
|
||||||
const value = target.type === 'checkbox' ? target.checked : target.value
|
|
||||||
const name = target.name
|
|
||||||
this.setState({
|
|
||||||
tableOptions: {
|
|
||||||
...this.state.tableOptions,
|
|
||||||
[name]: value
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const source = require('!raw!./Filtering')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render() {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30),
|
|
||||||
children: _.map(_.range(10), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className="table-wrap">
|
|
||||||
<ReactTable
|
|
||||||
className="-striped -highlight"
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={20}
|
|
||||||
style={{
|
|
||||||
height: '400px' // This will force the table body to overflow and scroll, since there is not enough room
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{ textAlign: 'center' }}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./Simple')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName',
|
|
||||||
Footer: (
|
|
||||||
<span><strong>Popular:</strong> {
|
|
||||||
_.first(
|
|
||||||
_.reduce(
|
|
||||||
_.map(
|
|
||||||
_.groupBy(
|
|
||||||
data, d => d.firstName
|
|
||||||
)
|
|
||||||
),
|
|
||||||
(a, b) => a.length > b.length ? a : b
|
|
||||||
)
|
|
||||||
).firstName}
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName,
|
|
||||||
Footer: (
|
|
||||||
<span><strong>Longest:</strong> {
|
|
||||||
_.reduce(
|
|
||||||
_.map(
|
|
||||||
_.groupBy(
|
|
||||||
data, d => d.lastName
|
|
||||||
),
|
|
||||||
(d, key) => key
|
|
||||||
),
|
|
||||||
(a, b) => a.length > b.length ? a : b
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age',
|
|
||||||
Footer: <span><strong>Average:</strong> {_.round(_.mean(_.map(data, d => d.age)))}</span>
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./Footers')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
import JSONTree from 'react-json-tree'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
const JSONtheme = {
|
|
||||||
scheme: 'monokai',
|
|
||||||
author: 'wimer hazenberg (http://www.monokai.nl)',
|
|
||||||
base00: '#272822',
|
|
||||||
base01: '#383830',
|
|
||||||
base02: '#49483e',
|
|
||||||
base03: '#75715e',
|
|
||||||
base04: '#a59f85',
|
|
||||||
base05: '#f8f8f2',
|
|
||||||
base06: '#f5f4f1',
|
|
||||||
base07: '#f9f8f5',
|
|
||||||
base08: '#f92672',
|
|
||||||
base09: '#fd971f',
|
|
||||||
base0A: '#f4bf75',
|
|
||||||
base0B: '#a6e22e',
|
|
||||||
base0C: '#a1efe4',
|
|
||||||
base0D: '#66d9ef',
|
|
||||||
base0E: '#ae81ff',
|
|
||||||
base0F: '#cc6633'
|
|
||||||
}
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName',
|
|
||||||
Footer: 'Footer'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName,
|
|
||||||
Footer: 'Footer'
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age',
|
|
||||||
Footer: 'Footer'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<strong>Functional rendering</strong> simply means that you have all of the building blocks to render your own React Table however you'd like.
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<strong>Decorating the standard table output</strong>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
>
|
|
||||||
{(state, makeTable, instance) => {
|
|
||||||
return (
|
|
||||||
<div style={{
|
|
||||||
background: '#ffcf00',
|
|
||||||
borderRadius: '5px',
|
|
||||||
overflow: 'hidden',
|
|
||||||
padding: '5px'
|
|
||||||
}}>
|
|
||||||
<pre><code>state.allVisibleColumns === {JSON.stringify(state.allVisibleColumns, null, 4)}</code></pre>
|
|
||||||
{makeTable()}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</ReactTable>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<strong>Need more control? This is the entire table state and component instance at your disposal!</strong>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
>
|
|
||||||
{(state, StandardTable, instance) => {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<JSONTree
|
|
||||||
data={Object.assign({}, state, {children: 'function () {...}'})}
|
|
||||||
theme={JSONtheme}
|
|
||||||
invertTheme
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</ReactTable>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./FunctionalRendering')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30),
|
|
||||||
children: _.map(_.range(10), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
showPagination
|
|
||||||
showPaginationTop
|
|
||||||
showPaginationBottom
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./MultiplePagers')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={[]}
|
|
||||||
noDataText='Oh Noes!'
|
|
||||||
// noDataText={() => 'Oh Noes!'} // Supports functions
|
|
||||||
// noDataText={() => <span>Oh Noes!</span>} // Supports JSX / React Components
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./NoDataText')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(100000), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30),
|
|
||||||
visits: Math.floor(Math.random() * 100)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age',
|
|
||||||
aggregate: vals => _.round(_.mean(vals)),
|
|
||||||
Aggregated: row => {
|
|
||||||
return <span>{row.value} (avg)</span>
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
Header: 'Visits',
|
|
||||||
accessor: 'visits',
|
|
||||||
aggregate: vals => _.sum(vals)
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
className='-striped -highlight'
|
|
||||||
defaultPageSize={10}
|
|
||||||
pivotBy={['firstName', 'lastName']}
|
|
||||||
SubComponent={(row) => {
|
|
||||||
return (
|
|
||||||
<div style={{padding: '20px'}}>
|
|
||||||
<em>You can put any component you want here, even another React Table!</em>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<ReactTable
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={3}
|
|
||||||
showPagination={false}
|
|
||||||
SubComponent={(row) => {
|
|
||||||
return (
|
|
||||||
<div style={{padding: '20px'}}>
|
|
||||||
<em>It even has access to the row data: </em>
|
|
||||||
<CodeHighlight>{() => JSON.stringify(row, null, 2)}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./OneHundredKRows')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(1000), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30),
|
|
||||||
visits: Math.floor(Math.random() * 100)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age',
|
|
||||||
aggregate: vals => _.round(_.mean(vals)),
|
|
||||||
Aggregated: row => {
|
|
||||||
return <span>{row.value} (avg)</span>
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
Header: 'Visits',
|
|
||||||
accessor: 'visits',
|
|
||||||
aggregate: vals => _.sum(vals)
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
className='-striped -highlight'
|
|
||||||
defaultPageSize={10}
|
|
||||||
pivotBy={['firstName', 'lastName']}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./Pivoting')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(1000), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({words: 1, numbers: 0}),
|
|
||||||
lastName: namor.generate({words: 1, numbers: 0}),
|
|
||||||
age: Math.floor(Math.random() * 30),
|
|
||||||
visits: Math.floor(Math.random() * 100)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName',
|
|
||||||
PivotValue: ({value}) => <span style={{color: 'darkred'}}>{value}</span>
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName,
|
|
||||||
PivotValue: ({value}) => <span style={{color: 'darkblue'}}>{value}</span>,
|
|
||||||
Footer: () => <div style={{textAlign: 'center'}}><strong>Pivot Column Footer</strong></div>
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age',
|
|
||||||
aggregate: vals => {
|
|
||||||
return _.round(_.mean(vals))
|
|
||||||
},
|
|
||||||
Aggregated: row => <span>{row.value} (avg)</span>
|
|
||||||
}, {
|
|
||||||
Header: 'Visits',
|
|
||||||
accessor: 'visits',
|
|
||||||
aggregate: vals => _.sum(vals),
|
|
||||||
filterable: false
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
pivot: true,
|
|
||||||
Header: () => <strong>Overridden Pivot Column Header Group</strong>
|
|
||||||
}, {
|
|
||||||
expander: true
|
|
||||||
}]
|
|
||||||
|
|
||||||
const subtableColumns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName'
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}, {
|
|
||||||
Header: 'Visits',
|
|
||||||
accessor: 'visits'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
className='-striped -highlight'
|
|
||||||
pivotBy={['firstName', 'lastName']}
|
|
||||||
defaultSorted={[{id: 'firstName', desc: false}, {id: 'lastName', desc: true}]}
|
|
||||||
collapseOnSortingChange={false}
|
|
||||||
filterable
|
|
||||||
ExpanderComponent={({isExpanded, ...rest}) => (
|
|
||||||
isExpanded ? <span> ➘ </span> : <span> ➙ </span>
|
|
||||||
)}
|
|
||||||
SubComponent={(row) => {
|
|
||||||
return (
|
|
||||||
<div style={{padding: '20px'}}>
|
|
||||||
<em>You can put any component you want here, even another React Table!</em>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<ReactTable
|
|
||||||
data={data}
|
|
||||||
columns={subtableColumns}
|
|
||||||
defaultPageSize={3}
|
|
||||||
showPagination={false}
|
|
||||||
SubComponent={(row) => {
|
|
||||||
return (
|
|
||||||
<div style={{padding: '20px'}}>
|
|
||||||
<em>It even has access to the row data: </em>
|
|
||||||
<CodeHighlight>{() => JSON.stringify(row, null, 2)}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./PivotingOptions')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(1000), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30),
|
|
||||||
visits: Math.floor(Math.random() * 100)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age',
|
|
||||||
aggregate: vals => _.round(_.mean(vals)),
|
|
||||||
Aggregated: row => {
|
|
||||||
return <span>{row.value} (avg)</span>
|
|
||||||
},
|
|
||||||
filterMethod: (filter, row) => (filter.value === `${row[filter.id]} (avg)`)
|
|
||||||
}, {
|
|
||||||
Header: 'Visits',
|
|
||||||
accessor: 'visits',
|
|
||||||
aggregate: vals => _.sum(vals),
|
|
||||||
filterable: false
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
className='-striped -highlight'
|
|
||||||
pivotBy={['firstName', 'lastName']}
|
|
||||||
filterable
|
|
||||||
SubComponent={(row) => {
|
|
||||||
return (
|
|
||||||
<div style={{padding: '20px'}}>
|
|
||||||
<em>You can put any component you want here, even another React Table!</em>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<ReactTable
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={3}
|
|
||||||
showPagination={false}
|
|
||||||
SubComponent={(row) => {
|
|
||||||
return (
|
|
||||||
<div style={{padding: '20px'}}>
|
|
||||||
<em>It even has access to the row data: </em>
|
|
||||||
<CodeHighlight>{() => JSON.stringify(row, null, 2)}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./PivotingSubComponents')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -4,17 +4,20 @@ import marked from 'marked'
|
|||||||
//
|
//
|
||||||
import Readme from '!raw!../../../README.md'
|
import Readme from '!raw!../../../README.md'
|
||||||
import 'github-markdown-css/github-markdown.css'
|
import 'github-markdown-css/github-markdown.css'
|
||||||
|
import './utils/prism.js'
|
||||||
|
|
||||||
export default class Story extends React.Component {
|
export default class Story extends React.Component {
|
||||||
render() {
|
render () {
|
||||||
return (
|
return (
|
||||||
<span
|
<div style={{ padding: '10px' }}>
|
||||||
className="markdown-body"
|
<span
|
||||||
dangerouslySetInnerHTML={{ __html: marked(Readme) }}
|
className='markdown-body'
|
||||||
/>
|
dangerouslySetInnerHTML={{ __html: marked(Readme) }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount () {
|
||||||
global.Prism.highlightAll()
|
global.Prism && global.Prism.highlightAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,121 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
const rawData = _.map(_.range(3424), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Now let's mock the server. It's job is simple: use the table model to sort and return the page data
|
|
||||||
const requestData = (pageSize, page, sorted, filtered) => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
// On the server, you'll likely use SQL or noSQL or some other query language to do this.
|
|
||||||
// For this mock, we'll just use lodash
|
|
||||||
let filteredData = rawData
|
|
||||||
if (filtered.length) {
|
|
||||||
filteredData = filtered.reduce(
|
|
||||||
(filteredSoFar, nextFilter) => {
|
|
||||||
return filteredSoFar.filter(
|
|
||||||
(row) => {
|
|
||||||
return (row[nextFilter.id] + '').includes(nextFilter.value)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
, filteredData)
|
|
||||||
}
|
|
||||||
const sortedData = _.orderBy(filteredData, sorted.map(sort => {
|
|
||||||
return row => {
|
|
||||||
if (row[sort.id] === null || row[sort.id] === undefined) {
|
|
||||||
return -Infinity
|
|
||||||
}
|
|
||||||
return typeof row[sort.id] === 'string' ? row[sort.id].toLowerCase() : row[sort.id]
|
|
||||||
}
|
|
||||||
}), sorted.map(d => d.desc ? 'desc' : 'asc'))
|
|
||||||
|
|
||||||
// Be sure to send back the rows to be displayed and any other pertinent information, like how many pages there are total.
|
|
||||||
const res = {
|
|
||||||
rows: sortedData.slice(pageSize * page, (pageSize * page) + pageSize),
|
|
||||||
pages: Math.ceil(filteredData.length / pageSize)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Here we'll simulate a server response with 500ms of delay.
|
|
||||||
setTimeout(() => resolve(res), 500)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
constructor () {
|
|
||||||
super()
|
|
||||||
this.state = {
|
|
||||||
data: [],
|
|
||||||
pages: null,
|
|
||||||
loading: true
|
|
||||||
}
|
|
||||||
this.fetchData = this.fetchData.bind(this)
|
|
||||||
}
|
|
||||||
fetchData (state, instance) {
|
|
||||||
// Whenever the table model changes, or the user sorts or changes pages, this method gets called and passed the current table model.
|
|
||||||
// You can set the `loading` prop of the table to true to use the built-in one or show you're own loading bar if you want.
|
|
||||||
this.setState({loading: true})
|
|
||||||
// Request the data however you want. Here, we'll use our mocked service we created earlier
|
|
||||||
requestData(state.pageSize, state.page, state.sorted, state.filtered)
|
|
||||||
.then((res) => {
|
|
||||||
// Now just get the rows of data to your React Table (and update anything else like total pages or loading)
|
|
||||||
this.setState({
|
|
||||||
data: res.rows,
|
|
||||||
pages: res.pages,
|
|
||||||
loading: false
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
render () {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
columns={[{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}, {
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}]}
|
|
||||||
manual // Forces table not to paginate or sort automatically, so we can handle it server-side
|
|
||||||
defaultPageSize={10}
|
|
||||||
filterable
|
|
||||||
data={this.state.data} // Set the rows to be displayed
|
|
||||||
pages={this.state.pages} // Display the total number of pages
|
|
||||||
loading={this.state.loading} // Display the loading overlay when we need it
|
|
||||||
onFetchData={this.fetchData} // Request new data when things change
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./ServerSide')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render() {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30),
|
|
||||||
children: _.map(_.range(10), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className="table-wrap">
|
|
||||||
<ReactTable
|
|
||||||
className="-striped -highlight"
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{ textAlign: 'center' }}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./Simple')
|
|
||||||
|
|
||||||
export default () =>
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
constructor (props) {
|
|
||||||
super(props)
|
|
||||||
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({words: 1, numbers: 0}),
|
|
||||||
lastName: namor.generate({words: 1, numbers: 0}),
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
tableOptions: {
|
|
||||||
loading: false,
|
|
||||||
showPagination: true,
|
|
||||||
showPageSizeOptions: true,
|
|
||||||
showPageJump: true,
|
|
||||||
collapseOnSortingChange: true,
|
|
||||||
collapseOnPageChange: true,
|
|
||||||
collapseOnDataChange: true,
|
|
||||||
freezeWhenExpanded: false,
|
|
||||||
filterable: false,
|
|
||||||
sortable: true,
|
|
||||||
resizable: true
|
|
||||||
},
|
|
||||||
data: data
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setTableOption = this.setTableOption.bind(this)
|
|
||||||
}
|
|
||||||
render () {
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName'
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
id: 'lastName',
|
|
||||||
accessor: d => d.lastName
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div>
|
|
||||||
<h1>Table Options</h1>
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
{
|
|
||||||
Object.keys(this.state.tableOptions).map(optionKey => {
|
|
||||||
const optionValue = this.state.tableOptions[optionKey]
|
|
||||||
return (
|
|
||||||
<tr key={optionKey}>
|
|
||||||
<td>{optionKey}</td>
|
|
||||||
<td style={{paddingLeft: 10, paddingTop: 5}}>
|
|
||||||
<input type='checkbox'
|
|
||||||
name={optionKey}
|
|
||||||
checked={optionValue}
|
|
||||||
onChange={this.setTableOption}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={this.state.data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
{...this.state.tableOptions}
|
|
||||||
SubComponent={(row) => {
|
|
||||||
return (
|
|
||||||
<div style={{padding: '20px'}}>
|
|
||||||
<em>You can put any component you want here, even another React Table!</em>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<ReactTable
|
|
||||||
data={this.state.data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={3}
|
|
||||||
showPagination={false}
|
|
||||||
SubComponent={(row) => {
|
|
||||||
return (
|
|
||||||
<div style={{padding: '20px'}}>
|
|
||||||
<em>It even has access to the row data: </em>
|
|
||||||
<CodeHighlight>{() => JSON.stringify(row, null, 2)}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
setTableOption (event) {
|
|
||||||
const target = event.target
|
|
||||||
const value = target.type === 'checkbox' ? target.checked : target.value
|
|
||||||
const name = target.name
|
|
||||||
this.setState({
|
|
||||||
tableOptions: {
|
|
||||||
...this.state.tableOptions,
|
|
||||||
[name]: value
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./SubComponents')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
import React from 'react'
|
|
||||||
import _ from 'lodash'
|
|
||||||
import namor from 'namor'
|
|
||||||
|
|
||||||
import ReactTable from '../../../lib/index'
|
|
||||||
|
|
||||||
class Story extends React.PureComponent {
|
|
||||||
render () {
|
|
||||||
const data = _.map(_.range(5553), d => {
|
|
||||||
const children = _.map(_.range(10), d => {
|
|
||||||
const grandChildren = _.map(_.range(10), d => {
|
|
||||||
return {
|
|
||||||
age: Math.floor(Math.random() * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return {
|
|
||||||
firstName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
age: Math.floor(Math.random() * 30),
|
|
||||||
children: grandChildren
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return {
|
|
||||||
lastName: namor.generate({ words: 1, numbers: 0 }),
|
|
||||||
firstName: children.map(d => d.firstName),
|
|
||||||
age: Math.floor(Math.random() * 30),
|
|
||||||
children
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const columns = [{
|
|
||||||
Header: 'Name',
|
|
||||||
columns: [{
|
|
||||||
Header: 'First Name',
|
|
||||||
accessor: 'firstName',
|
|
||||||
expander: true
|
|
||||||
}, {
|
|
||||||
Header: 'Last Name',
|
|
||||||
accessor: 'lastName'
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
Header: 'Info',
|
|
||||||
columns: [{
|
|
||||||
Header: 'Age',
|
|
||||||
accessor: 'age'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className='table-wrap'>
|
|
||||||
<ReactTable
|
|
||||||
className='-striped -highlight'
|
|
||||||
data={data}
|
|
||||||
columns={columns}
|
|
||||||
defaultPageSize={10}
|
|
||||||
subRowsKey='children'
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{textAlign: 'center'}}>
|
|
||||||
<br />
|
|
||||||
<em>Tip: Hold shift when sorting to multi-sort!</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Source Code
|
|
||||||
const CodeHighlight = require('./components/codeHighlight').default
|
|
||||||
const source = require('!raw!./SubRows')
|
|
||||||
|
|
||||||
export default () => (
|
|
||||||
<div>
|
|
||||||
<Story />
|
|
||||||
<CodeHighlight>{() => source}</CodeHighlight>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import '../utils/prism'
|
|
||||||
|
|
||||||
export default class CodeHighlight extends React.Component {
|
|
||||||
render () {
|
|
||||||
const { language, children } = this.props
|
|
||||||
return (
|
|
||||||
<pre>
|
|
||||||
<code className={'language-' + (language || 'jsx')}>
|
|
||||||
{children()}
|
|
||||||
</code>
|
|
||||||
</pre>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
componentDidMount () {
|
|
||||||
window.Prism.highlightAll()
|
|
||||||
}
|
|
||||||
componentDidUpdate () {
|
|
||||||
window.Prism.highlightAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
+1242
-73
File diff suppressed because it is too large
Load Diff
+9
-19
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "react-table",
|
"name": "react-table",
|
||||||
"version": "6.4.0",
|
"version": "6.5.3",
|
||||||
"description": "A fast, lightweight, opinionated table and datagrid built on React",
|
"description": "A fast, lightweight, opinionated table and datagrid built on React",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://github.com/tannerlinsley/react-table#readme",
|
"homepage": "https://github.com/react-tools/react-table#readme",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/tannerlinsley/react-table.git"
|
"url": "git+https://github.com/react-tools/react-table.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
"watch": "npm-run-all --parallel watch:*",
|
"watch": "npm-run-all --parallel watch:*",
|
||||||
"watch:node": "onchange 'src/**/*.js' -i -- npm run build:node",
|
"watch:node": "onchange 'src/**/*.js' -i -- npm run build:node",
|
||||||
"watch:css": "onchange 'src/**/*.styl' -i -- npm run build:css",
|
"watch:css": "onchange 'src/**/*.styl' -i -- npm run build:css",
|
||||||
"test": "standard",
|
"test": "eslint src",
|
||||||
"umd": "rimraf react-table.js && webpack --config umd.webpack.js",
|
"umd": "rimraf react-table.js && webpack --config umd.webpack.js",
|
||||||
"build": "npm-run-all build:*",
|
"build": "npm-run-all build:*",
|
||||||
"prepublish": "npm run build && npm run umd",
|
"prepublish": "npm run build && npm run umd",
|
||||||
@@ -38,11 +38,10 @@
|
|||||||
"docs:build": "yarn build && cd docs && yarn && yarn run build"
|
"docs:build": "yarn build && cd docs && yarn && yarn run build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.5"
|
||||||
"react-json-tree": "^0.10.9"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^15.x.x"
|
"react": "^15.x.x || ^16.x.x"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^6.7.0",
|
"autoprefixer": "^6.7.0",
|
||||||
@@ -51,28 +50,19 @@
|
|||||||
"babel-preset-es2015": "6.14.0",
|
"babel-preset-es2015": "6.14.0",
|
||||||
"babel-preset-react": "6.11.1",
|
"babel-preset-react": "6.11.1",
|
||||||
"babel-preset-stage-2": "6.13.0",
|
"babel-preset-stage-2": "6.13.0",
|
||||||
|
"eslint": "^4.1.1",
|
||||||
|
"match-sorter": "^1.8.0",
|
||||||
"npm-run-all": "^3.1.1",
|
"npm-run-all": "^3.1.1",
|
||||||
"onchange": "^3.0.2",
|
"onchange": "^3.0.2",
|
||||||
"postcss-cli": "^2.6.0",
|
"postcss-cli": "^2.6.0",
|
||||||
"react": "^15.4.2",
|
"react": "^15.4.2",
|
||||||
"react-dom": "^15.4.2",
|
"react-dom": "^15.4.2",
|
||||||
|
"react-json-tree": "^0.10.9",
|
||||||
"rimraf": "^2.6.1",
|
"rimraf": "^2.6.1",
|
||||||
"standard": "^10.0.2",
|
"standard": "^10.0.2",
|
||||||
"stylus": "^0.54.5",
|
"stylus": "^0.54.5",
|
||||||
"webpack": "^2.5.1"
|
"webpack": "^2.5.1"
|
||||||
},
|
},
|
||||||
"standard": {
|
|
||||||
"parser": "babel-eslint",
|
|
||||||
"ignore": [
|
|
||||||
"node_modules",
|
|
||||||
"dist",
|
|
||||||
"lib",
|
|
||||||
"example",
|
|
||||||
"react-table.js",
|
|
||||||
"stories",
|
|
||||||
"docs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"babel": {
|
"babel": {
|
||||||
"presets": [
|
"presets": [
|
||||||
"es2015",
|
"es2015",
|
||||||
|
|||||||
+20
-12
@@ -145,6 +145,7 @@ export default {
|
|||||||
footerStyle: {},
|
footerStyle: {},
|
||||||
getFooterProps: emptyObj,
|
getFooterProps: emptyObj,
|
||||||
filterMethod: undefined,
|
filterMethod: undefined,
|
||||||
|
filterAll: false,
|
||||||
sortMethod: undefined,
|
sortMethod: undefined,
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -170,11 +171,11 @@ export default {
|
|||||||
rowsText: 'rows',
|
rowsText: 'rows',
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
TableComponent: _.makeTemplateComponent('rt-table'),
|
TableComponent: _.makeTemplateComponent('rt-table', 'Table'),
|
||||||
TheadComponent: _.makeTemplateComponent('rt-thead'),
|
TheadComponent: _.makeTemplateComponent('rt-thead', 'Thead'),
|
||||||
TbodyComponent: _.makeTemplateComponent('rt-tbody'),
|
TbodyComponent: _.makeTemplateComponent('rt-tbody', 'Tbody'),
|
||||||
TrGroupComponent: _.makeTemplateComponent('rt-tr-group'),
|
TrGroupComponent: _.makeTemplateComponent('rt-tr-group', 'TrGroup'),
|
||||||
TrComponent: _.makeTemplateComponent('rt-tr'),
|
TrComponent: _.makeTemplateComponent('rt-tr', 'Tr'),
|
||||||
ThComponent: ({ toggleSort, className, children, ...rest }) => {
|
ThComponent: ({ toggleSort, className, children, ...rest }) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -188,8 +189,8 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
TdComponent: _.makeTemplateComponent('rt-td'),
|
TdComponent: _.makeTemplateComponent('rt-td', 'Td'),
|
||||||
TfootComponent: _.makeTemplateComponent('rt-tfoot'),
|
TfootComponent: _.makeTemplateComponent('rt-tfoot', 'Tfoot'),
|
||||||
FilterComponent: ({ filter, onChange }) =>
|
FilterComponent: ({ filter, onChange }) =>
|
||||||
<input
|
<input
|
||||||
type='text'
|
type='text'
|
||||||
@@ -204,16 +205,23 @@ export default {
|
|||||||
•
|
•
|
||||||
</div>,
|
</div>,
|
||||||
PivotValueComponent: ({ subRows, value }) =>
|
PivotValueComponent: ({ subRows, value }) =>
|
||||||
<span>{value} {subRows && `(${subRows.length})`}</span>,
|
<span>
|
||||||
|
{value} {subRows && `(${subRows.length})`}
|
||||||
|
</span>,
|
||||||
AggregatedComponent: ({ subRows, column }) => {
|
AggregatedComponent: ({ subRows, column }) => {
|
||||||
const previewValues = subRows
|
const previewValues = subRows
|
||||||
.filter(d => typeof d[column.id] !== 'undefined')
|
.filter(d => typeof d[column.id] !== 'undefined')
|
||||||
.map((row, i) =>
|
.map((row, i) =>
|
||||||
<span key={i}>
|
<span key={i}>
|
||||||
{row[column.id]}{i < subRows.length - 1 ? ', ' : ''}
|
{row[column.id]}
|
||||||
|
{i < subRows.length - 1 ? ', ' : ''}
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
return <span>{previewValues}</span>
|
return (
|
||||||
|
<span>
|
||||||
|
{previewValues}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
},
|
},
|
||||||
PivotComponent: undefined, // this is a computed default generated using
|
PivotComponent: undefined, // this is a computed default generated using
|
||||||
// the ExpanderComponent and PivotValueComponent at run-time in methods.js
|
// the ExpanderComponent and PivotValueComponent at run-time in methods.js
|
||||||
@@ -229,7 +237,7 @@ export default {
|
|||||||
{loadingText}
|
{loadingText}
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
NoDataComponent: _.makeTemplateComponent('rt-noData'),
|
NoDataComponent: _.makeTemplateComponent('rt-noData', 'NoData'),
|
||||||
ResizerComponent: _.makeTemplateComponent('rt-resizer'),
|
ResizerComponent: _.makeTemplateComponent('rt-resizer', 'Resizer'),
|
||||||
PadRowComponent: () => <span> </span>,
|
PadRowComponent: () => <span> </span>,
|
||||||
}
|
}
|
||||||
|
|||||||
+103
-92
@@ -11,7 +11,7 @@ export const ReactTableDefaults = defaultProps
|
|||||||
export default class ReactTable extends Methods(Lifecycle(Component)) {
|
export default class ReactTable extends Methods(Lifecycle(Component)) {
|
||||||
static defaultProps = defaultProps
|
static defaultProps = defaultProps
|
||||||
|
|
||||||
constructor(props) {
|
constructor (props) {
|
||||||
super()
|
super()
|
||||||
|
|
||||||
this.getResolvedState = this.getResolvedState.bind(this)
|
this.getResolvedState = this.getResolvedState.bind(this)
|
||||||
@@ -39,11 +39,11 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
filtered: props.defaultFiltered,
|
filtered: props.defaultFiltered,
|
||||||
resized: props.defaultResized,
|
resized: props.defaultResized,
|
||||||
currentlyResizing: false,
|
currentlyResizing: false,
|
||||||
skipNextSort: false
|
skipNextSort: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render () {
|
||||||
const resolvedState = this.getResolvedState()
|
const resolvedState = this.getResolvedState()
|
||||||
const {
|
const {
|
||||||
children,
|
children,
|
||||||
@@ -126,7 +126,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
hasHeaderGroups,
|
hasHeaderGroups,
|
||||||
// Sorted Data
|
// Sorted Data
|
||||||
sortedData,
|
sortedData,
|
||||||
currentlyResizing
|
currentlyResizing,
|
||||||
} = resolvedState
|
} = resolvedState
|
||||||
|
|
||||||
// Pagination
|
// Pagination
|
||||||
@@ -145,7 +145,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
index++
|
index++
|
||||||
const rowWithViewIndex = {
|
const rowWithViewIndex = {
|
||||||
...row,
|
...row,
|
||||||
_viewIndex: index
|
_viewIndex: index,
|
||||||
}
|
}
|
||||||
const newPath = path.concat([i])
|
const newPath = path.concat([i])
|
||||||
if (rowWithViewIndex[subRowsKey] && _.get(expanded, newPath)) {
|
if (rowWithViewIndex[subRowsKey] && _.get(expanded, newPath)) {
|
||||||
@@ -157,7 +157,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
}
|
}
|
||||||
return rowWithViewIndex
|
return rowWithViewIndex
|
||||||
}),
|
}),
|
||||||
index
|
index,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
;[pageRows] = recurseRowsViewIndex(pageRows)
|
;[pageRows] = recurseRowsViewIndex(pageRows)
|
||||||
@@ -184,7 +184,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
hasColumnFooter,
|
hasColumnFooter,
|
||||||
canPrevious,
|
canPrevious,
|
||||||
canNext,
|
canNext,
|
||||||
rowMinWidth
|
rowMinWidth,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visual Components
|
// Visual Components
|
||||||
@@ -201,7 +201,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
className={classnames('-headerGroups', theadGroupProps.className)}
|
className={classnames('-headerGroups', theadGroupProps.className)}
|
||||||
style={{
|
style={{
|
||||||
...theadGroupProps.style,
|
...theadGroupProps.style,
|
||||||
minWidth: `${rowMinWidth}px`
|
minWidth: `${rowMinWidth}px`,
|
||||||
}}
|
}}
|
||||||
{...theadGroupProps.rest}
|
{...theadGroupProps.rest}
|
||||||
>
|
>
|
||||||
@@ -245,24 +245,24 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
const classes = [
|
const classes = [
|
||||||
column.headerClassName,
|
column.headerClassName,
|
||||||
theadGroupThProps.className,
|
theadGroupThProps.className,
|
||||||
columnHeaderProps.className
|
columnHeaderProps.className,
|
||||||
]
|
]
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
...column.headerStyle,
|
...column.headerStyle,
|
||||||
...theadGroupThProps.style,
|
...theadGroupThProps.style,
|
||||||
...columnHeaderProps.style
|
...columnHeaderProps.style,
|
||||||
}
|
}
|
||||||
|
|
||||||
const rest = {
|
const rest = {
|
||||||
...theadGroupThProps.rest,
|
...theadGroupThProps.rest,
|
||||||
...columnHeaderProps.rest
|
...columnHeaderProps.rest,
|
||||||
}
|
}
|
||||||
|
|
||||||
const flexStyles = {
|
const flexStyles = {
|
||||||
flex: `${flex} 0 auto`,
|
flex: `${flex} 0 auto`,
|
||||||
width: `${width}px`,
|
width: _.asPx(width),
|
||||||
maxWidth: `${maxWidth}px`
|
maxWidth: _.asPx(maxWidth),
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -271,13 +271,13 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
className={classnames(classes)}
|
className={classnames(classes)}
|
||||||
style={{
|
style={{
|
||||||
...styles,
|
...styles,
|
||||||
...flexStyles
|
...flexStyles,
|
||||||
}}
|
}}
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
{_.normalizeComponent(column.Header, {
|
{_.normalizeComponent(column.Header, {
|
||||||
data: sortedData,
|
data: sortedData,
|
||||||
column: column
|
column: column,
|
||||||
})}
|
})}
|
||||||
</ThComponent>
|
</ThComponent>
|
||||||
)
|
)
|
||||||
@@ -295,7 +295,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
className={classnames('-header', theadProps.className)}
|
className={classnames('-header', theadProps.className)}
|
||||||
style={{
|
style={{
|
||||||
...theadProps.style,
|
...theadProps.style,
|
||||||
minWidth: `${rowMinWidth}px`
|
minWidth: `${rowMinWidth}px`,
|
||||||
}}
|
}}
|
||||||
{...theadProps.rest}
|
{...theadProps.rest}
|
||||||
>
|
>
|
||||||
@@ -313,9 +313,8 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
const makeHeader = (column, i) => {
|
const makeHeader = (column, i) => {
|
||||||
const resizedCol = resized.find(x => x.id === column.id) || {}
|
const resizedCol = resized.find(x => x.id === column.id) || {}
|
||||||
const sort = sorted.find(d => d.id === column.id)
|
const sort = sorted.find(d => d.id === column.id)
|
||||||
const show = typeof column.show === 'function'
|
const show =
|
||||||
? column.show()
|
typeof column.show === 'function' ? column.show() : column.show
|
||||||
: column.show
|
|
||||||
const width = _.getFirstDefined(
|
const width = _.getFirstDefined(
|
||||||
resizedCol.value,
|
resizedCol.value,
|
||||||
column.width,
|
column.width,
|
||||||
@@ -336,27 +335,27 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
const classes = [
|
const classes = [
|
||||||
column.headerClassName,
|
column.headerClassName,
|
||||||
theadThProps.className,
|
theadThProps.className,
|
||||||
columnHeaderProps.className
|
columnHeaderProps.className,
|
||||||
]
|
]
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
...column.headerStyle,
|
...column.headerStyle,
|
||||||
...theadThProps.style,
|
...theadThProps.style,
|
||||||
...columnHeaderProps.style
|
...columnHeaderProps.style,
|
||||||
}
|
}
|
||||||
|
|
||||||
const rest = {
|
const rest = {
|
||||||
...theadThProps.rest,
|
...theadThProps.rest,
|
||||||
...columnHeaderProps.rest
|
...columnHeaderProps.rest,
|
||||||
}
|
}
|
||||||
|
|
||||||
const isResizable = _.getFirstDefined(column.resizable, resizable, false)
|
const isResizable = _.getFirstDefined(column.resizable, resizable, false)
|
||||||
const resizer = isResizable
|
const resizer = isResizable
|
||||||
? <ResizerComponent
|
? (<ResizerComponent
|
||||||
onMouseDown={e => this.resizeColumnStart(column, e, false)}
|
onMouseDown={e => this.resizeColumnStart(e, column, false)}
|
||||||
onTouchStart={e => this.resizeColumnStart(column, e, true)}
|
onTouchStart={e => this.resizeColumnStart(e, column, true)}
|
||||||
{...resizerProps}
|
{...resizerProps}
|
||||||
/>
|
/>)
|
||||||
: null
|
: null
|
||||||
|
|
||||||
const isSortable = _.getFirstDefined(column.sortable, sortable, false)
|
const isSortable = _.getFirstDefined(column.sortable, sortable, false)
|
||||||
@@ -366,7 +365,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
key={i + '-' + column.id}
|
key={i + '-' + column.id}
|
||||||
className={classnames(
|
className={classnames(
|
||||||
classes,
|
classes,
|
||||||
'rt-resizable-header',
|
isResizable && 'rt-resizable-header',
|
||||||
sort ? (sort.desc ? '-sort-desc' : '-sort-asc') : '',
|
sort ? (sort.desc ? '-sort-desc' : '-sort-asc') : '',
|
||||||
isSortable && '-cursor-pointer',
|
isSortable && '-cursor-pointer',
|
||||||
!show && '-hidden',
|
!show && '-hidden',
|
||||||
@@ -377,18 +376,18 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
style={{
|
style={{
|
||||||
...styles,
|
...styles,
|
||||||
flex: `${width} 0 auto`,
|
flex: `${width} 0 auto`,
|
||||||
width: `${width}px`,
|
width: _.asPx(width),
|
||||||
maxWidth: `${maxWidth}px`
|
maxWidth: _.asPx(maxWidth),
|
||||||
}}
|
}}
|
||||||
toggleSort={e => {
|
toggleSort={e => {
|
||||||
isSortable && this.sortColumn(column, e.shiftKey)
|
isSortable && this.sortColumn(column, e.shiftKey)
|
||||||
}}
|
}}
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
<div className="rt-resizable-header-content">
|
<div className={classnames(isResizable && 'rt-resizable-header-content')}>
|
||||||
{_.normalizeComponent(column.Header, {
|
{_.normalizeComponent(column.Header, {
|
||||||
data: sortedData,
|
data: sortedData,
|
||||||
column: column
|
column: column,
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
{resizer}
|
{resizer}
|
||||||
@@ -408,7 +407,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
className={classnames('-filters', theadFilterProps.className)}
|
className={classnames('-filters', theadFilterProps.className)}
|
||||||
style={{
|
style={{
|
||||||
...theadFilterProps.style,
|
...theadFilterProps.style,
|
||||||
minWidth: `${rowMinWidth}px`
|
minWidth: `${rowMinWidth}px`,
|
||||||
}}
|
}}
|
||||||
{...theadFilterProps.rest}
|
{...theadFilterProps.rest}
|
||||||
>
|
>
|
||||||
@@ -445,18 +444,18 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
const classes = [
|
const classes = [
|
||||||
column.headerClassName,
|
column.headerClassName,
|
||||||
theadFilterThProps.className,
|
theadFilterThProps.className,
|
||||||
columnHeaderProps.className
|
columnHeaderProps.className,
|
||||||
]
|
]
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
...column.headerStyle,
|
...column.headerStyle,
|
||||||
...theadFilterThProps.style,
|
...theadFilterThProps.style,
|
||||||
...columnHeaderProps.style
|
...columnHeaderProps.style,
|
||||||
}
|
}
|
||||||
|
|
||||||
const rest = {
|
const rest = {
|
||||||
...theadFilterThProps.rest,
|
...theadFilterThProps.rest,
|
||||||
...columnHeaderProps.rest
|
...columnHeaderProps.rest,
|
||||||
}
|
}
|
||||||
|
|
||||||
const filter = filtered.find(filter => filter.id === column.id)
|
const filter = filtered.find(filter => filter.id === column.id)
|
||||||
@@ -476,21 +475,21 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
style={{
|
style={{
|
||||||
...styles,
|
...styles,
|
||||||
flex: `${width} 0 auto`,
|
flex: `${width} 0 auto`,
|
||||||
width: `${width}px`,
|
width: _.asPx(width),
|
||||||
maxWidth: `${maxWidth}px`
|
maxWidth: _.asPx(maxWidth),
|
||||||
}}
|
}}
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
{isFilterable
|
{isFilterable
|
||||||
? _.normalizeComponent(
|
? _.normalizeComponent(
|
||||||
ResolvedFilterComponent,
|
ResolvedFilterComponent,
|
||||||
{
|
{
|
||||||
column,
|
column,
|
||||||
filter,
|
filter,
|
||||||
onChange: value => this.filterColumn(column, value)
|
onChange: value => this.filterColumn(column, value),
|
||||||
},
|
},
|
||||||
defaultProps.column.Filter
|
defaultProps.column.Filter
|
||||||
)
|
)
|
||||||
: null}
|
: null}
|
||||||
</ThComponent>
|
</ThComponent>
|
||||||
)
|
)
|
||||||
@@ -506,7 +505,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
nestingPath: path.concat([i]),
|
nestingPath: path.concat([i]),
|
||||||
aggregated: row[aggregatedKey],
|
aggregated: row[aggregatedKey],
|
||||||
groupedByPivot: row[groupedByPivotKey],
|
groupedByPivot: row[groupedByPivotKey],
|
||||||
subRows: row[subRowsKey]
|
subRows: row[subRowsKey],
|
||||||
}
|
}
|
||||||
const isExpanded = _.get(expanded, rowInfo.nestingPath)
|
const isExpanded = _.get(expanded, rowInfo.nestingPath)
|
||||||
const trGroupProps = getTrGroupProps(finalState, rowInfo, undefined, this)
|
const trGroupProps = getTrGroupProps(finalState, rowInfo, undefined, this)
|
||||||
@@ -525,9 +524,8 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
>
|
>
|
||||||
{allVisibleColumns.map((column, i2) => {
|
{allVisibleColumns.map((column, i2) => {
|
||||||
const resizedCol = resized.find(x => x.id === column.id) || {}
|
const resizedCol = resized.find(x => x.id === column.id) || {}
|
||||||
const show = typeof column.show === 'function'
|
const show =
|
||||||
? column.show()
|
typeof column.show === 'function' ? column.show() : column.show
|
||||||
: column.show
|
|
||||||
const width = _.getFirstDefined(
|
const width = _.getFirstDefined(
|
||||||
resizedCol.value,
|
resizedCol.value,
|
||||||
column.width,
|
column.width,
|
||||||
@@ -548,13 +546,13 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
const classes = [
|
const classes = [
|
||||||
tdProps.className,
|
tdProps.className,
|
||||||
column.className,
|
column.className,
|
||||||
columnProps.className
|
columnProps.className,
|
||||||
]
|
]
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
...tdProps.style,
|
...tdProps.style,
|
||||||
...column.style,
|
...column.style,
|
||||||
...columnProps.style
|
...columnProps.style,
|
||||||
}
|
}
|
||||||
|
|
||||||
const cellInfo = {
|
const cellInfo = {
|
||||||
@@ -571,12 +569,12 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
tdProps,
|
tdProps,
|
||||||
columnProps,
|
columnProps,
|
||||||
classes,
|
classes,
|
||||||
styles
|
styles,
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = cellInfo.value
|
const value = cellInfo.value
|
||||||
|
|
||||||
let interactionProps
|
let useOnExpanderClick
|
||||||
let isBranch
|
let isBranch
|
||||||
let isPreview
|
let isPreview
|
||||||
|
|
||||||
@@ -590,7 +588,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
|
|
||||||
return this.setStateWithData(
|
return this.setStateWithData(
|
||||||
{
|
{
|
||||||
expanded: newExpanded
|
expanded: newExpanded,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
onExpandedChange &&
|
onExpandedChange &&
|
||||||
@@ -628,17 +626,10 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
if (cellInfo.pivoted || cellInfo.expander) {
|
if (cellInfo.pivoted || cellInfo.expander) {
|
||||||
// Make it expandable by defualt
|
// Make it expandable by defualt
|
||||||
cellInfo.expandable = true
|
cellInfo.expandable = true
|
||||||
interactionProps = {
|
useOnExpanderClick = true
|
||||||
onClick: onExpanderClick
|
|
||||||
}
|
|
||||||
// If pivoted, has no subRows, and does not have a subComponent, do not make expandable
|
// If pivoted, has no subRows, and does not have a subComponent, do not make expandable
|
||||||
if (cellInfo.pivoted) {
|
if (cellInfo.pivoted && !cellInfo.subRows && !SubComponent) {
|
||||||
if (!cellInfo.subRows) {
|
cellInfo.expandable = false
|
||||||
if (!SubComponent) {
|
|
||||||
cellInfo.expandable = false
|
|
||||||
interactionProps = {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,7 +648,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
ResolvedPivotComponent,
|
ResolvedPivotComponent,
|
||||||
{
|
{
|
||||||
...cellInfo,
|
...cellInfo,
|
||||||
value: row[pivotValKey]
|
value: row[pivotValKey],
|
||||||
},
|
},
|
||||||
row[pivotValKey]
|
row[pivotValKey]
|
||||||
)
|
)
|
||||||
@@ -695,6 +686,27 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resolvedOnExpanderClick = useOnExpanderClick
|
||||||
|
? onExpanderClick
|
||||||
|
: () => {}
|
||||||
|
|
||||||
|
// If there are multiple onClick events, make sure they don't override eachother. This should maybe be expanded to handle all function attributes
|
||||||
|
const interactionProps = {
|
||||||
|
onClick: resolvedOnExpanderClick,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tdProps.rest.onClick) {
|
||||||
|
interactionProps.onClick = e => {
|
||||||
|
tdProps.rest.onClick(e, () => resolvedOnExpanderClick(e))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (columnProps.rest.onClick) {
|
||||||
|
interactionProps.onClick = e => {
|
||||||
|
columnProps.rest.onClick(e, () => resolvedOnExpanderClick(e))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Return the cell
|
// Return the cell
|
||||||
return (
|
return (
|
||||||
<TdComponent
|
<TdComponent
|
||||||
@@ -708,10 +720,11 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
style={{
|
style={{
|
||||||
...styles,
|
...styles,
|
||||||
flex: `${width} 0 auto`,
|
flex: `${width} 0 auto`,
|
||||||
width: `${width}px`,
|
width: _.asPx(width),
|
||||||
maxWidth: `${maxWidth}px`
|
maxWidth: _.asPx(maxWidth),
|
||||||
}}
|
}}
|
||||||
{...tdProps.rest}
|
{...tdProps.rest}
|
||||||
|
{...columnProps.rest}
|
||||||
{...interactionProps}
|
{...interactionProps}
|
||||||
>
|
>
|
||||||
{resolvedCell}
|
{resolvedCell}
|
||||||
@@ -760,9 +773,8 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
|
|
||||||
const makePadColumn = (column, i) => {
|
const makePadColumn = (column, i) => {
|
||||||
const resizedCol = resized.find(x => x.id === column.id) || {}
|
const resizedCol = resized.find(x => x.id === column.id) || {}
|
||||||
const show = typeof column.show === 'function'
|
const show =
|
||||||
? column.show()
|
typeof column.show === 'function' ? column.show() : column.show
|
||||||
: column.show
|
|
||||||
let width = _.getFirstDefined(
|
let width = _.getFirstDefined(
|
||||||
resizedCol.value,
|
resizedCol.value,
|
||||||
column.width,
|
column.width,
|
||||||
@@ -784,13 +796,13 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
const classes = [
|
const classes = [
|
||||||
tdProps.className,
|
tdProps.className,
|
||||||
column.className,
|
column.className,
|
||||||
columnProps.className
|
columnProps.className,
|
||||||
]
|
]
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
...tdProps.style,
|
...tdProps.style,
|
||||||
...column.style,
|
...column.style,
|
||||||
...columnProps.style
|
...columnProps.style,
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -800,8 +812,8 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
style={{
|
style={{
|
||||||
...styles,
|
...styles,
|
||||||
flex: `${flex} 0 auto`,
|
flex: `${flex} 0 auto`,
|
||||||
width: `${width}px`,
|
width: _.asPx(width),
|
||||||
maxWidth: `${maxWidth}px`
|
maxWidth: _.asPx(maxWidth),
|
||||||
}}
|
}}
|
||||||
{...tdProps.rest}
|
{...tdProps.rest}
|
||||||
>
|
>
|
||||||
@@ -820,7 +832,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
className={tFootProps.className}
|
className={tFootProps.className}
|
||||||
style={{
|
style={{
|
||||||
...tFootProps.style,
|
...tFootProps.style,
|
||||||
minWidth: `${rowMinWidth}px`
|
minWidth: `${rowMinWidth}px`,
|
||||||
}}
|
}}
|
||||||
{...tFootProps.rest}
|
{...tFootProps.rest}
|
||||||
>
|
>
|
||||||
@@ -837,9 +849,8 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
|
|
||||||
const makeColumnFooter = (column, i) => {
|
const makeColumnFooter = (column, i) => {
|
||||||
const resizedCol = resized.find(x => x.id === column.id) || {}
|
const resizedCol = resized.find(x => x.id === column.id) || {}
|
||||||
const show = typeof column.show === 'function'
|
const show =
|
||||||
? column.show()
|
typeof column.show === 'function' ? column.show() : column.show
|
||||||
: column.show
|
|
||||||
const width = _.getFirstDefined(
|
const width = _.getFirstDefined(
|
||||||
resizedCol.value,
|
resizedCol.value,
|
||||||
column.width,
|
column.width,
|
||||||
@@ -864,14 +875,14 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
tFootTdProps.className,
|
tFootTdProps.className,
|
||||||
column.className,
|
column.className,
|
||||||
columnProps.className,
|
columnProps.className,
|
||||||
columnFooterProps.className
|
columnFooterProps.className,
|
||||||
]
|
]
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
...tFootTdProps.style,
|
...tFootTdProps.style,
|
||||||
...column.style,
|
...column.style,
|
||||||
...columnProps.style,
|
...columnProps.style,
|
||||||
...columnFooterProps.style
|
...columnFooterProps.style,
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -881,8 +892,8 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
style={{
|
style={{
|
||||||
...styles,
|
...styles,
|
||||||
flex: `${width} 0 auto`,
|
flex: `${width} 0 auto`,
|
||||||
width: `${width}px`,
|
width: _.asPx(width),
|
||||||
maxWidth: `${maxWidth}px`
|
maxWidth: _.asPx(maxWidth),
|
||||||
}}
|
}}
|
||||||
{...columnProps.rest}
|
{...columnProps.rest}
|
||||||
{...tFootTdProps.rest}
|
{...tFootTdProps.rest}
|
||||||
@@ -890,7 +901,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
>
|
>
|
||||||
{_.normalizeComponent(column.Footer, {
|
{_.normalizeComponent(column.Footer, {
|
||||||
data: sortedData,
|
data: sortedData,
|
||||||
column: column
|
column: column,
|
||||||
})}
|
})}
|
||||||
</TdComponent>
|
</TdComponent>
|
||||||
)
|
)
|
||||||
@@ -935,14 +946,14 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
className={classnames('ReactTable', className, rootProps.className)}
|
className={classnames('ReactTable', className, rootProps.className)}
|
||||||
style={{
|
style={{
|
||||||
...style,
|
...style,
|
||||||
...rootProps.style
|
...rootProps.style,
|
||||||
}}
|
}}
|
||||||
{...rootProps.rest}
|
{...rootProps.rest}
|
||||||
>
|
>
|
||||||
{showPagination && showPaginationTop
|
{showPagination && showPaginationTop
|
||||||
? <div className="pagination-top">
|
? <div className='pagination-top'>
|
||||||
{pagination}
|
{pagination}
|
||||||
</div>
|
</div>
|
||||||
: null}
|
: null}
|
||||||
<TableComponent
|
<TableComponent
|
||||||
className={classnames(
|
className={classnames(
|
||||||
@@ -959,7 +970,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
className={classnames(tBodyProps.className)}
|
className={classnames(tBodyProps.className)}
|
||||||
style={{
|
style={{
|
||||||
...tBodyProps.style,
|
...tBodyProps.style,
|
||||||
minWidth: `${rowMinWidth}px`
|
minWidth: `${rowMinWidth}px`,
|
||||||
}}
|
}}
|
||||||
{...tBodyProps.rest}
|
{...tBodyProps.rest}
|
||||||
>
|
>
|
||||||
@@ -969,9 +980,9 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
{hasColumnFooter ? makeColumnFooters() : null}
|
{hasColumnFooter ? makeColumnFooters() : null}
|
||||||
</TableComponent>
|
</TableComponent>
|
||||||
{showPagination && showPaginationBottom
|
{showPagination && showPaginationBottom
|
||||||
? <div className="pagination-bottom">
|
? <div className='pagination-bottom'>
|
||||||
{pagination}
|
{pagination}
|
||||||
</div>
|
</div>
|
||||||
: null}
|
: null}
|
||||||
{!pageRows.length &&
|
{!pageRows.length &&
|
||||||
<NoDataComponent {...noDataProps}>
|
<NoDataComponent {...noDataProps}>
|
||||||
|
|||||||
+14
-35
@@ -10,7 +10,7 @@ $expandSize = 7px
|
|||||||
*
|
*
|
||||||
box-sizing: border-box
|
box-sizing: border-box
|
||||||
.rt-table
|
.rt-table
|
||||||
flex: 1
|
flex: auto 1
|
||||||
display: flex
|
display: flex
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
align-items: stretch
|
align-items: stretch
|
||||||
@@ -21,7 +21,6 @@ $expandSize = 7px
|
|||||||
.rt-thead
|
.rt-thead
|
||||||
flex: 1 0 auto
|
flex: 1 0 auto
|
||||||
display: flex
|
display: flex
|
||||||
// overflow-y: scroll
|
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
@@ -169,6 +168,7 @@ $expandSize = 7px
|
|||||||
z-index: 10
|
z-index: 10
|
||||||
|
|
||||||
.rt-tfoot
|
.rt-tfoot
|
||||||
|
flex: 1 0 auto
|
||||||
display: flex
|
display: flex
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
box-shadow: 0 0px 15px 0px alpha(black, .15)
|
box-shadow: 0 0px 15px 0px alpha(black, .15)
|
||||||
@@ -196,6 +196,16 @@ $expandSize = 7px
|
|||||||
box-shadow: 0 0px 15px 0px alpha(black, .1)
|
box-shadow: 0 0px 15px 0px alpha(black, .1)
|
||||||
border-top: 2px solid alpha(black, .1)
|
border-top: 2px solid alpha(black, .1)
|
||||||
|
|
||||||
|
input
|
||||||
|
select
|
||||||
|
border: 1px solid rgba(0,0,0,0.1)
|
||||||
|
background: white
|
||||||
|
padding: 5px 7px
|
||||||
|
font-size: inherit
|
||||||
|
border-radius: 3px
|
||||||
|
font-weight: normal
|
||||||
|
outline:none
|
||||||
|
|
||||||
.-btn
|
.-btn
|
||||||
appearance:none
|
appearance:none
|
||||||
display:block
|
display:block
|
||||||
@@ -270,7 +280,7 @@ $expandSize = 7px
|
|||||||
bottom:0
|
bottom:0
|
||||||
background: alpha(white, .8)
|
background: alpha(white, .8)
|
||||||
transition: all .3s ease
|
transition: all .3s ease
|
||||||
z-index: 2
|
z-index: -1
|
||||||
opacity: 0
|
opacity: 0
|
||||||
pointer-events: none
|
pointer-events: none
|
||||||
|
|
||||||
@@ -288,42 +298,11 @@ $expandSize = 7px
|
|||||||
|
|
||||||
&.-active
|
&.-active
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
z-index: 2
|
||||||
pointer-events: all
|
pointer-events: all
|
||||||
> div
|
> div
|
||||||
transform: translateY(50%)
|
transform: translateY(50%)
|
||||||
|
|
||||||
input
|
|
||||||
select
|
|
||||||
border: 1px solid rgba(0,0,0,0.1)
|
|
||||||
background: white
|
|
||||||
padding: 5px 7px
|
|
||||||
font-size: inherit
|
|
||||||
border-radius: 3px
|
|
||||||
font-weight: normal
|
|
||||||
outline:none
|
|
||||||
|
|
||||||
input:not([type="checkbox"]):not([type="radio"])
|
|
||||||
select
|
|
||||||
appearance: none
|
|
||||||
&::-ms-expand
|
|
||||||
display: none
|
|
||||||
|
|
||||||
.select-wrap
|
|
||||||
position:relative
|
|
||||||
display:inline-block
|
|
||||||
select
|
|
||||||
padding: 5px 15px 5px 7px
|
|
||||||
min-width:100px
|
|
||||||
&:after
|
|
||||||
content: ''
|
|
||||||
position: absolute
|
|
||||||
right: 8px
|
|
||||||
top: 50%
|
|
||||||
transform: translate(0, -50%)
|
|
||||||
border-color: #999 transparent transparent
|
|
||||||
border-style: solid
|
|
||||||
border-width: 5px 5px 2.5px
|
|
||||||
|
|
||||||
.rt-resizing
|
.rt-resizing
|
||||||
.rt-th
|
.rt-th
|
||||||
.rt-td
|
.rt-td
|
||||||
|
|||||||
+20
-4
@@ -88,7 +88,8 @@ export default Base =>
|
|||||||
this.props.collapseOnSortingChange) ||
|
this.props.collapseOnSortingChange) ||
|
||||||
oldState.filtered !== newResolvedState.filtered ||
|
oldState.filtered !== newResolvedState.filtered ||
|
||||||
oldState.showFilters !== newResolvedState.showFilters ||
|
oldState.showFilters !== newResolvedState.showFilters ||
|
||||||
(!newResolvedState.frozen &&
|
(oldState.sortedData &&
|
||||||
|
!newResolvedState.frozen &&
|
||||||
oldState.resolvedData !== newResolvedState.resolvedData &&
|
oldState.resolvedData !== newResolvedState.resolvedData &&
|
||||||
this.props.collapseOnDataChange)
|
this.props.collapseOnDataChange)
|
||||||
) {
|
) {
|
||||||
@@ -98,13 +99,18 @@ export default Base =>
|
|||||||
Object.assign(newResolvedState, this.getSortedData(newResolvedState))
|
Object.assign(newResolvedState, this.getSortedData(newResolvedState))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set page to 0 if filters change
|
||||||
|
if (oldState.filtered !== newResolvedState.filtered) {
|
||||||
|
newResolvedState.page = 0
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate pageSize all the time
|
// Calculate pageSize all the time
|
||||||
if (newResolvedState.sortedData) {
|
if (newResolvedState.sortedData) {
|
||||||
newResolvedState.pages = newResolvedState.manual
|
newResolvedState.pages = newResolvedState.manual
|
||||||
? newResolvedState.pages
|
? newResolvedState.pages
|
||||||
: Math.ceil(
|
: Math.ceil(
|
||||||
newResolvedState.sortedData.length / newResolvedState.pageSize
|
newResolvedState.sortedData.length / newResolvedState.pageSize
|
||||||
)
|
)
|
||||||
newResolvedState.page = Math.max(
|
newResolvedState.page = Math.max(
|
||||||
newResolvedState.page >= newResolvedState.pages
|
newResolvedState.page >= newResolvedState.pages
|
||||||
? newResolvedState.pages - 1
|
? newResolvedState.pages - 1
|
||||||
@@ -113,6 +119,16 @@ export default Base =>
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.setState(newResolvedState, cb)
|
return this.setState(newResolvedState, () => {
|
||||||
|
cb && cb()
|
||||||
|
if (
|
||||||
|
oldState.page !== newResolvedState.page ||
|
||||||
|
oldState.pageSize !== newResolvedState.pageSize ||
|
||||||
|
oldState.sorted !== newResolvedState.sorted ||
|
||||||
|
oldState.filtered !== newResolvedState.filtered
|
||||||
|
) {
|
||||||
|
this.fireFetchData()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+84
-64
@@ -55,7 +55,7 @@ export default Base =>
|
|||||||
columnsWithExpander = [expanderColumn, ...columnsWithExpander]
|
columnsWithExpander = [expanderColumn, ...columnsWithExpander]
|
||||||
}
|
}
|
||||||
|
|
||||||
const makeDecoratedColumn = column => {
|
const makeDecoratedColumn = (column, parentColumn) => {
|
||||||
let dcol
|
let dcol
|
||||||
if (column.expander) {
|
if (column.expander) {
|
||||||
dcol = {
|
dcol = {
|
||||||
@@ -70,6 +70,16 @@ export default Base =>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure minWidth is not greater than maxWidth if set
|
||||||
|
if (dcol.maxWidth < dcol.minWidth) {
|
||||||
|
dcol.minWidth = dcol.maxWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentColumn) {
|
||||||
|
dcol.parentColumn = parentColumn
|
||||||
|
}
|
||||||
|
|
||||||
|
// First check for string accessor
|
||||||
if (typeof dcol.accessor === 'string') {
|
if (typeof dcol.accessor === 'string') {
|
||||||
dcol.id = dcol.id || dcol.accessor
|
dcol.id = dcol.id || dcol.accessor
|
||||||
const accessorString = dcol.accessor
|
const accessorString = dcol.accessor
|
||||||
@@ -77,6 +87,7 @@ export default Base =>
|
|||||||
return dcol
|
return dcol
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fall back to functional accessor (but require an ID)
|
||||||
if (dcol.accessor && !dcol.id) {
|
if (dcol.accessor && !dcol.id) {
|
||||||
console.warn(dcol)
|
console.warn(dcol)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -84,30 +95,26 @@ export default Base =>
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fall back to an undefined accessor
|
||||||
if (!dcol.accessor) {
|
if (!dcol.accessor) {
|
||||||
dcol.accessor = d => undefined
|
dcol.accessor = d => undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure minWidth is not greater than maxWidth if set
|
|
||||||
if (dcol.maxWidth < dcol.minWidth) {
|
|
||||||
dcol.minWidth = dcol.maxWidth
|
|
||||||
}
|
|
||||||
|
|
||||||
return dcol
|
return dcol
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decorate the columns
|
// Decorate the columns
|
||||||
const decorateAndAddToAll = col => {
|
const decorateAndAddToAll = (column, parentColumn) => {
|
||||||
const decoratedColumn = makeDecoratedColumn(col)
|
const decoratedColumn = makeDecoratedColumn(column, parentColumn)
|
||||||
allDecoratedColumns.push(decoratedColumn)
|
allDecoratedColumns.push(decoratedColumn)
|
||||||
return decoratedColumn
|
return decoratedColumn
|
||||||
}
|
}
|
||||||
let allDecoratedColumns = []
|
const allDecoratedColumns = []
|
||||||
const decoratedColumns = columnsWithExpander.map((column, i) => {
|
const decoratedColumns = columnsWithExpander.map((column, i) => {
|
||||||
if (column.columns) {
|
if (column.columns) {
|
||||||
return {
|
return {
|
||||||
...column,
|
...column,
|
||||||
columns: column.columns.map(decorateAndAddToAll),
|
columns: column.columns.map(d => decorateAndAddToAll(d, column)),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return decorateAndAddToAll(column)
|
return decorateAndAddToAll(column)
|
||||||
@@ -156,8 +163,17 @@ export default Base =>
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let PivotParentColumn = pivotColumns.reduce(
|
||||||
|
(prev, current) =>
|
||||||
|
prev && prev === current.parentColumn && current.parentColumn,
|
||||||
|
pivotColumns[0].parentColumn
|
||||||
|
)
|
||||||
|
|
||||||
|
let PivotGroupHeader = hasHeaderGroups && PivotParentColumn.Header
|
||||||
|
PivotGroupHeader = PivotGroupHeader || (() => <strong>Pivoted</strong>)
|
||||||
|
|
||||||
let pivotColumnGroup = {
|
let pivotColumnGroup = {
|
||||||
header: () => <strong>Group</strong>,
|
Header: PivotGroupHeader,
|
||||||
columns: pivotColumns.map(col => ({
|
columns: pivotColumns.map(col => ({
|
||||||
...this.props.pivotDefaults,
|
...this.props.pivotDefaults,
|
||||||
...col,
|
...col,
|
||||||
@@ -309,15 +325,15 @@ export default Base =>
|
|||||||
sortedData: manual
|
sortedData: manual
|
||||||
? resolvedData
|
? resolvedData
|
||||||
: this.sortData(
|
: this.sortData(
|
||||||
this.filterData(
|
this.filterData(
|
||||||
resolvedData,
|
resolvedData,
|
||||||
filtered,
|
filtered,
|
||||||
defaultFilterMethod,
|
defaultFilterMethod,
|
||||||
allVisibleColumns
|
allVisibleColumns
|
||||||
),
|
|
||||||
sorted,
|
|
||||||
sortMethodsByColumnID
|
|
||||||
),
|
),
|
||||||
|
sorted,
|
||||||
|
sortMethodsByColumnID
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,20 +354,23 @@ export default Base =>
|
|||||||
|
|
||||||
if (filtered.length) {
|
if (filtered.length) {
|
||||||
filteredData = filtered.reduce((filteredSoFar, nextFilter) => {
|
filteredData = filtered.reduce((filteredSoFar, nextFilter) => {
|
||||||
return filteredSoFar.filter(row => {
|
const column = allVisibleColumns.find(x => x.id === nextFilter.id)
|
||||||
let column
|
|
||||||
|
|
||||||
column = allVisibleColumns.find(x => x.id === nextFilter.id)
|
// Don't filter hidden columns or columns that have had their filters disabled
|
||||||
|
if (!column || column.filterable === false) {
|
||||||
|
return filteredSoFar
|
||||||
|
}
|
||||||
|
|
||||||
// Don't filter hidden columns or columns that have had their filters disabled
|
const filterMethod = column.filterMethod || defaultFilterMethod
|
||||||
if (!column || column.filterable === false) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
const filterMethod = column.filterMethod || defaultFilterMethod
|
// If 'filterAll' is set to true, pass the entire dataset to the filter method
|
||||||
|
if (column.filterAll) {
|
||||||
return filterMethod(nextFilter, row, column)
|
return filterMethod(nextFilter, filteredSoFar, column)
|
||||||
})
|
} else {
|
||||||
|
return filteredSoFar.filter(row => {
|
||||||
|
return filterMethod(nextFilter, row, column)
|
||||||
|
})
|
||||||
|
}
|
||||||
}, filteredData)
|
}, filteredData)
|
||||||
|
|
||||||
// Apply the filter to the subrows if we are pivoting, and then
|
// Apply the filter to the subrows if we are pivoting, and then
|
||||||
@@ -435,7 +454,6 @@ export default Base =>
|
|||||||
}
|
}
|
||||||
this.setStateWithData(newState, () => {
|
this.setStateWithData(newState, () => {
|
||||||
onPageChange && onPageChange(page)
|
onPageChange && onPageChange(page)
|
||||||
this.fireFetchData()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +472,6 @@ export default Base =>
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
onPageSizeChange && onPageSizeChange(newPageSize, newPage)
|
onPageSizeChange && onPageSizeChange(newPageSize, newPage)
|
||||||
this.fireFetchData()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -559,14 +576,14 @@ export default Base =>
|
|||||||
|
|
||||||
this.setStateWithData(
|
this.setStateWithData(
|
||||||
{
|
{
|
||||||
page: (!sorted.length && newSorted.length) || !additive
|
page:
|
||||||
? 0
|
(!sorted.length && newSorted.length) || !additive
|
||||||
: this.state.page,
|
? 0
|
||||||
|
: this.state.page,
|
||||||
sorted: newSorted,
|
sorted: newSorted,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
onSortedChange && onSortedChange(newSorted, column, additive)
|
onSortedChange && onSortedChange(newSorted, column, additive)
|
||||||
this.fireFetchData()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -595,12 +612,12 @@ export default Base =>
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
onFilteredChange && onFilteredChange(newFiltering, column, value)
|
onFilteredChange && onFilteredChange(newFiltering, column, value)
|
||||||
this.fireFetchData()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeColumnStart (column, event, isTouch) {
|
resizeColumnStart (event, column, isTouch) {
|
||||||
|
event.stopPropagation()
|
||||||
const parentWidth = event.target.parentElement.getBoundingClientRect()
|
const parentWidth = event.target.parentElement.getBoundingClientRect()
|
||||||
.width
|
.width
|
||||||
|
|
||||||
@@ -611,6 +628,7 @@ export default Base =>
|
|||||||
pageX = event.pageX
|
pageX = event.pageX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.trapEvents = true
|
||||||
this.setStateWithData(
|
this.setStateWithData(
|
||||||
{
|
{
|
||||||
currentlyResizing: {
|
currentlyResizing: {
|
||||||
@@ -633,33 +651,8 @@ export default Base =>
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeColumnEnd (event) {
|
|
||||||
let isTouch = event.type === 'touchend' || event.type === 'touchcancel'
|
|
||||||
|
|
||||||
if (isTouch) {
|
|
||||||
document.removeEventListener('touchmove', this.resizeColumnMoving)
|
|
||||||
document.removeEventListener('touchcancel', this.resizeColumnEnd)
|
|
||||||
document.removeEventListener('touchend', this.resizeColumnEnd)
|
|
||||||
}
|
|
||||||
|
|
||||||
// If its a touch event clear the mouse one's as well because sometimes
|
|
||||||
// the mouseDown event gets called as well, but the mouseUp event doesn't
|
|
||||||
document.removeEventListener('mousemove', this.resizeColumnMoving)
|
|
||||||
document.removeEventListener('mouseup', this.resizeColumnEnd)
|
|
||||||
document.removeEventListener('mouseleave', this.resizeColumnEnd)
|
|
||||||
|
|
||||||
// The touch events don't propagate up to the sorting's onMouseDown event so
|
|
||||||
// no need to prevent it from happening or else the first click after a touch
|
|
||||||
// event resize will not sort the column.
|
|
||||||
if (!isTouch) {
|
|
||||||
this.setStateWithData({
|
|
||||||
skipNextSort: true,
|
|
||||||
currentlyResizing: false,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resizeColumnMoving (event) {
|
resizeColumnMoving (event) {
|
||||||
|
event.stopPropagation()
|
||||||
const { onResizedChange } = this.props
|
const { onResizedChange } = this.props
|
||||||
const { resized, currentlyResizing } = this.getResolvedState()
|
const { resized, currentlyResizing } = this.getResolvedState()
|
||||||
|
|
||||||
@@ -694,4 +687,31 @@ export default Base =>
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resizeColumnEnd (event) {
|
||||||
|
event.stopPropagation()
|
||||||
|
let isTouch = event.type === 'touchend' || event.type === 'touchcancel'
|
||||||
|
|
||||||
|
if (isTouch) {
|
||||||
|
document.removeEventListener('touchmove', this.resizeColumnMoving)
|
||||||
|
document.removeEventListener('touchcancel', this.resizeColumnEnd)
|
||||||
|
document.removeEventListener('touchend', this.resizeColumnEnd)
|
||||||
|
}
|
||||||
|
|
||||||
|
// If its a touch event clear the mouse one's as well because sometimes
|
||||||
|
// the mouseDown event gets called as well, but the mouseUp event doesn't
|
||||||
|
document.removeEventListener('mousemove', this.resizeColumnMoving)
|
||||||
|
document.removeEventListener('mouseup', this.resizeColumnEnd)
|
||||||
|
document.removeEventListener('mouseleave', this.resizeColumnEnd)
|
||||||
|
|
||||||
|
// The touch events don't propagate up to the sorting's onMouseDown event so
|
||||||
|
// no need to prevent it from happening or else the first click after a touch
|
||||||
|
// event resize will not sort the column.
|
||||||
|
if (!isTouch) {
|
||||||
|
this.setStateWithData({
|
||||||
|
skipNextSort: true,
|
||||||
|
currentlyResizing: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-21
@@ -4,7 +4,9 @@ import classnames from 'classnames'
|
|||||||
// import _ from './utils'
|
// import _ from './utils'
|
||||||
|
|
||||||
const defaultButton = props =>
|
const defaultButton = props =>
|
||||||
<button type='button' {...props} className='-btn'>{props.children}</button>
|
<button type='button' {...props} className='-btn'>
|
||||||
|
{props.children}
|
||||||
|
</button>
|
||||||
|
|
||||||
export default class ReactTablePagination extends Component {
|
export default class ReactTablePagination extends Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
@@ -83,26 +85,28 @@ export default class ReactTablePagination extends Component {
|
|||||||
{this.props.pageText}{' '}
|
{this.props.pageText}{' '}
|
||||||
{showPageJump
|
{showPageJump
|
||||||
? <div className='-pageJump'>
|
? <div className='-pageJump'>
|
||||||
<input
|
<input
|
||||||
type={this.state.page === '' ? 'text' : 'number'}
|
type={this.state.page === '' ? 'text' : 'number'}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
const val = e.target.value
|
const val = e.target.value
|
||||||
const page = val - 1
|
const page = val - 1
|
||||||
if (val === '') {
|
if (val === '') {
|
||||||
return this.setState({ page: val })
|
return this.setState({ page: val })
|
||||||
}
|
}
|
||||||
this.setState({ page: this.getSafePage(page) })
|
this.setState({ page: this.getSafePage(page) })
|
||||||
}}
|
}}
|
||||||
value={this.state.page === '' ? '' : this.state.page + 1}
|
value={this.state.page === '' ? '' : this.state.page + 1}
|
||||||
onBlur={this.applyPage}
|
onBlur={this.applyPage}
|
||||||
onKeyPress={e => {
|
onKeyPress={e => {
|
||||||
if (e.which === 13 || e.keyCode === 13) {
|
if (e.which === 13 || e.keyCode === 13) {
|
||||||
this.applyPage()
|
this.applyPage()
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
: <span className='-currentPage'>{page + 1}</span>}{' '}
|
: <span className='-currentPage'>
|
||||||
|
{page + 1}
|
||||||
|
</span>}{' '}
|
||||||
{this.props.ofText}{' '}
|
{this.props.ofText}{' '}
|
||||||
<span className='-totalPages'>{pages || 1}</span>
|
<span className='-totalPages'>{pages || 1}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
+16
-5
@@ -19,6 +19,7 @@ export default {
|
|||||||
compactObject,
|
compactObject,
|
||||||
isSortingDesc,
|
isSortingDesc,
|
||||||
normalizeComponent,
|
normalizeComponent,
|
||||||
|
asPx,
|
||||||
}
|
}
|
||||||
|
|
||||||
function get (obj, path, def) {
|
function get (obj, path, def) {
|
||||||
@@ -121,11 +122,16 @@ function sum (arr) {
|
|||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeTemplateComponent (compClass) {
|
function makeTemplateComponent (compClass, displayName) {
|
||||||
return ({ children, className, ...rest }) =>
|
if (!displayName) {
|
||||||
|
throw new Error('No displayName found for template component:', compClass)
|
||||||
|
}
|
||||||
|
const cmp = ({ children, className, ...rest }) =>
|
||||||
<div className={classnames(compClass, className)} {...rest}>
|
<div className={classnames(compClass, className)} {...rest}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
cmp.displayName = displayName
|
||||||
|
return cmp
|
||||||
}
|
}
|
||||||
|
|
||||||
function groupBy (xs, key) {
|
function groupBy (xs, key) {
|
||||||
@@ -137,6 +143,11 @@ function groupBy (xs, key) {
|
|||||||
}, {})
|
}, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function asPx (value) {
|
||||||
|
value = Number(value)
|
||||||
|
return Number.isNaN(value) ? null : value + 'px'
|
||||||
|
}
|
||||||
|
|
||||||
function isArray (a) {
|
function isArray (a) {
|
||||||
return Array.isArray(a)
|
return Array.isArray(a)
|
||||||
}
|
}
|
||||||
@@ -148,8 +159,8 @@ function isArray (a) {
|
|||||||
function makePathArray (obj) {
|
function makePathArray (obj) {
|
||||||
return flattenDeep(obj)
|
return flattenDeep(obj)
|
||||||
.join('.')
|
.join('.')
|
||||||
.replace('[', '.')
|
.replace(/\[/g, '.')
|
||||||
.replace(']', '')
|
.replace(/\]/g, '')
|
||||||
.split('.')
|
.split('.')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +179,7 @@ function splitProps ({ className, style, ...rest }) {
|
|||||||
return {
|
return {
|
||||||
className,
|
className,
|
||||||
style,
|
style,
|
||||||
rest,
|
rest: rest || {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ ansi-escapes@^1.1.0:
|
|||||||
version "1.4.0"
|
version "1.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e"
|
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e"
|
||||||
|
|
||||||
|
ansi-escapes@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-2.0.0.tgz#5bae52be424878dd9783e8910e3fc2922e83c81b"
|
||||||
|
|
||||||
ansi-regex@^2.0.0:
|
ansi-regex@^2.0.0:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
|
||||||
@@ -852,6 +856,10 @@ balanced-match@^0.4.1:
|
|||||||
version "0.4.2"
|
version "0.4.2"
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
|
||||||
|
|
||||||
|
balanced-match@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||||
|
|
||||||
base16@^1.0.0:
|
base16@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/base16/-/base16-1.0.0.tgz#e297f60d7ec1014a7a971a39ebc8a98c0b681e70"
|
resolved "https://registry.yarnpkg.com/base16/-/base16-1.0.0.tgz#e297f60d7ec1014a7a971a39ebc8a98c0b681e70"
|
||||||
@@ -912,6 +920,13 @@ brace-expansion@^1.0.0:
|
|||||||
balanced-match "^0.4.1"
|
balanced-match "^0.4.1"
|
||||||
concat-map "0.0.1"
|
concat-map "0.0.1"
|
||||||
|
|
||||||
|
brace-expansion@^1.1.7:
|
||||||
|
version "1.1.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
|
||||||
|
dependencies:
|
||||||
|
balanced-match "^1.0.0"
|
||||||
|
concat-map "0.0.1"
|
||||||
|
|
||||||
braces@^1.8.2:
|
braces@^1.8.2:
|
||||||
version "1.8.5"
|
version "1.8.5"
|
||||||
resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7"
|
resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7"
|
||||||
@@ -1105,6 +1120,12 @@ cli-cursor@^1.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
restore-cursor "^1.0.1"
|
restore-cursor "^1.0.1"
|
||||||
|
|
||||||
|
cli-cursor@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5"
|
||||||
|
dependencies:
|
||||||
|
restore-cursor "^2.0.0"
|
||||||
|
|
||||||
cli-width@^2.0.0:
|
cli-width@^2.0.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a"
|
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a"
|
||||||
@@ -1149,7 +1170,7 @@ concat-map@0.0.1:
|
|||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||||
|
|
||||||
concat-stream@^1.5.2:
|
concat-stream@^1.5.2, concat-stream@^1.6.0:
|
||||||
version "1.6.0"
|
version "1.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7"
|
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -1272,11 +1293,11 @@ debug-log@^1.0.0:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f"
|
resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f"
|
||||||
|
|
||||||
debug@*, debug@^2.1.1, debug@^2.2.0:
|
debug@*, debug@^2.1.1, debug@^2.2.0, debug@^2.6.8:
|
||||||
version "2.6.0"
|
version "2.6.8"
|
||||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b"
|
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
|
||||||
dependencies:
|
dependencies:
|
||||||
ms "0.7.2"
|
ms "2.0.0"
|
||||||
|
|
||||||
debug@2.2.0, debug@~2.2.0:
|
debug@2.2.0, debug@~2.2.0:
|
||||||
version "2.2.0"
|
version "2.2.0"
|
||||||
@@ -1347,6 +1368,10 @@ detect-indent@^4.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
repeating "^2.0.0"
|
repeating "^2.0.0"
|
||||||
|
|
||||||
|
diacritic@0.0.2:
|
||||||
|
version "0.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/diacritic/-/diacritic-0.0.2.tgz#fc2a887b5a5bc0a0a854fb614c7c2f209061ee04"
|
||||||
|
|
||||||
diffie-hellman@^5.0.0:
|
diffie-hellman@^5.0.0:
|
||||||
version "5.0.2"
|
version "5.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e"
|
resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e"
|
||||||
@@ -1575,6 +1600,51 @@ eslint-plugin-standard@~3.0.1:
|
|||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-3.0.1.tgz#34d0c915b45edc6f010393c7eef3823b08565cf2"
|
resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-3.0.1.tgz#34d0c915b45edc6f010393c7eef3823b08565cf2"
|
||||||
|
|
||||||
|
eslint-scope@^3.7.1:
|
||||||
|
version "3.7.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
|
||||||
|
dependencies:
|
||||||
|
esrecurse "^4.1.0"
|
||||||
|
estraverse "^4.1.1"
|
||||||
|
|
||||||
|
eslint@^4.1.1:
|
||||||
|
version "4.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.1.1.tgz#facbdfcfe3e0facd3a8b80dc98c4e6c13ae582df"
|
||||||
|
dependencies:
|
||||||
|
babel-code-frame "^6.22.0"
|
||||||
|
chalk "^1.1.3"
|
||||||
|
concat-stream "^1.6.0"
|
||||||
|
debug "^2.6.8"
|
||||||
|
doctrine "^2.0.0"
|
||||||
|
eslint-scope "^3.7.1"
|
||||||
|
espree "^3.4.3"
|
||||||
|
esquery "^1.0.0"
|
||||||
|
estraverse "^4.2.0"
|
||||||
|
esutils "^2.0.2"
|
||||||
|
file-entry-cache "^2.0.0"
|
||||||
|
glob "^7.1.2"
|
||||||
|
globals "^9.17.0"
|
||||||
|
ignore "^3.3.3"
|
||||||
|
imurmurhash "^0.1.4"
|
||||||
|
inquirer "^3.0.6"
|
||||||
|
is-my-json-valid "^2.16.0"
|
||||||
|
is-resolvable "^1.0.0"
|
||||||
|
js-yaml "^3.8.4"
|
||||||
|
json-stable-stringify "^1.0.1"
|
||||||
|
levn "^0.3.0"
|
||||||
|
lodash "^4.17.4"
|
||||||
|
minimatch "^3.0.2"
|
||||||
|
mkdirp "^0.5.1"
|
||||||
|
natural-compare "^1.4.0"
|
||||||
|
optionator "^0.8.2"
|
||||||
|
path-is-inside "^1.0.2"
|
||||||
|
pluralize "^4.0.0"
|
||||||
|
progress "^2.0.0"
|
||||||
|
require-uncached "^1.0.3"
|
||||||
|
strip-json-comments "~2.0.1"
|
||||||
|
table "^4.0.1"
|
||||||
|
text-table "~0.2.0"
|
||||||
|
|
||||||
eslint@~3.19.0:
|
eslint@~3.19.0:
|
||||||
version "3.19.0"
|
version "3.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc"
|
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc"
|
||||||
@@ -1615,16 +1685,16 @@ eslint@~3.19.0:
|
|||||||
text-table "~0.2.0"
|
text-table "~0.2.0"
|
||||||
user-home "^2.0.0"
|
user-home "^2.0.0"
|
||||||
|
|
||||||
espree@^3.4.0:
|
espree@^3.4.0, espree@^3.4.3:
|
||||||
version "3.4.3"
|
version "3.4.3"
|
||||||
resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.3.tgz#2910b5ccd49ce893c2ffffaab4fd8b3a31b82374"
|
resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.3.tgz#2910b5ccd49ce893c2ffffaab4fd8b3a31b82374"
|
||||||
dependencies:
|
dependencies:
|
||||||
acorn "^5.0.1"
|
acorn "^5.0.1"
|
||||||
acorn-jsx "^3.0.0"
|
acorn-jsx "^3.0.0"
|
||||||
|
|
||||||
esprima@^2.6.0:
|
esprima@^3.1.1:
|
||||||
version "2.7.3"
|
version "3.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581"
|
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
|
||||||
|
|
||||||
esquery@^1.0.0:
|
esquery@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
@@ -1700,6 +1770,14 @@ extend@~3.0.0:
|
|||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4"
|
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4"
|
||||||
|
|
||||||
|
external-editor@^2.0.4:
|
||||||
|
version "2.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.4.tgz#1ed9199da9cbfe2ef2f7a31b2fde8b0d12368972"
|
||||||
|
dependencies:
|
||||||
|
iconv-lite "^0.4.17"
|
||||||
|
jschardet "^1.4.2"
|
||||||
|
tmp "^0.0.31"
|
||||||
|
|
||||||
extglob@^0.3.1:
|
extglob@^0.3.1:
|
||||||
version "0.3.2"
|
version "0.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1"
|
resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1"
|
||||||
@@ -1745,6 +1823,12 @@ figures@^1.3.5:
|
|||||||
escape-string-regexp "^1.0.5"
|
escape-string-regexp "^1.0.5"
|
||||||
object-assign "^4.1.0"
|
object-assign "^4.1.0"
|
||||||
|
|
||||||
|
figures@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962"
|
||||||
|
dependencies:
|
||||||
|
escape-string-regexp "^1.0.5"
|
||||||
|
|
||||||
file-entry-cache@^2.0.0:
|
file-entry-cache@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361"
|
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361"
|
||||||
@@ -1926,7 +2010,7 @@ glob-parent@^2.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-glob "^2.0.0"
|
is-glob "^2.0.0"
|
||||||
|
|
||||||
glob@7.0.x, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5:
|
glob@7.0.x:
|
||||||
version "7.0.6"
|
version "7.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.6.tgz#211bafaf49e525b8cd93260d14ab136152b3f57a"
|
resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.6.tgz#211bafaf49e525b8cd93260d14ab136152b3f57a"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -1957,9 +2041,24 @@ glob@^6.0.1:
|
|||||||
once "^1.3.0"
|
once "^1.3.0"
|
||||||
path-is-absolute "^1.0.0"
|
path-is-absolute "^1.0.0"
|
||||||
|
|
||||||
globals@^9.0.0, globals@^9.14.0:
|
glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2:
|
||||||
version "9.14.0"
|
version "7.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/globals/-/globals-9.14.0.tgz#8859936af0038741263053b39d0e76ca241e4034"
|
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
|
||||||
|
dependencies:
|
||||||
|
fs.realpath "^1.0.0"
|
||||||
|
inflight "^1.0.4"
|
||||||
|
inherits "2"
|
||||||
|
minimatch "^3.0.4"
|
||||||
|
once "^1.3.0"
|
||||||
|
path-is-absolute "^1.0.0"
|
||||||
|
|
||||||
|
global-object@1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/global-object/-/global-object-1.0.0.tgz#2a1b45e901d55e4773154f12f0cec1ef9aba5f9f"
|
||||||
|
|
||||||
|
globals@^9.0.0, globals@^9.14.0, globals@^9.17.0:
|
||||||
|
version "9.18.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a"
|
||||||
|
|
||||||
globby@^4.1.0:
|
globby@^4.1.0:
|
||||||
version "4.1.0"
|
version "4.1.0"
|
||||||
@@ -2062,17 +2161,17 @@ https-browserify@0.0.1:
|
|||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82"
|
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82"
|
||||||
|
|
||||||
iconv-lite@~0.4.13:
|
iconv-lite@^0.4.17, iconv-lite@~0.4.13:
|
||||||
version "0.4.15"
|
version "0.4.18"
|
||||||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb"
|
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2"
|
||||||
|
|
||||||
ieee754@^1.1.4:
|
ieee754@^1.1.4:
|
||||||
version "1.1.8"
|
version "1.1.8"
|
||||||
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"
|
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"
|
||||||
|
|
||||||
ignore@^3.0.11, ignore@^3.0.9, ignore@^3.2.0:
|
ignore@^3.0.11, ignore@^3.0.9, ignore@^3.2.0, ignore@^3.3.3:
|
||||||
version "3.2.0"
|
version "3.3.3"
|
||||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.0.tgz#8d88f03c3002a0ac52114db25d2c673b0bf1e435"
|
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.3.tgz#432352e57accd87ab3110e82d3fea0e47812156d"
|
||||||
|
|
||||||
imurmurhash@^0.1.4:
|
imurmurhash@^0.1.4:
|
||||||
version "0.1.4"
|
version "0.1.4"
|
||||||
@@ -2125,6 +2224,25 @@ inquirer@^0.12.0:
|
|||||||
strip-ansi "^3.0.0"
|
strip-ansi "^3.0.0"
|
||||||
through "^2.3.6"
|
through "^2.3.6"
|
||||||
|
|
||||||
|
inquirer@^3.0.6:
|
||||||
|
version "3.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.1.1.tgz#87621c4fba4072f48a8dd71c9f9df6f100b2d534"
|
||||||
|
dependencies:
|
||||||
|
ansi-escapes "^2.0.0"
|
||||||
|
chalk "^1.0.0"
|
||||||
|
cli-cursor "^2.1.0"
|
||||||
|
cli-width "^2.0.0"
|
||||||
|
external-editor "^2.0.4"
|
||||||
|
figures "^2.0.0"
|
||||||
|
lodash "^4.3.0"
|
||||||
|
mute-stream "0.0.7"
|
||||||
|
run-async "^2.2.0"
|
||||||
|
rx-lite "^4.0.8"
|
||||||
|
rx-lite-aggregates "^4.0.8"
|
||||||
|
string-width "^2.0.0"
|
||||||
|
strip-ansi "^3.0.0"
|
||||||
|
through "^2.3.6"
|
||||||
|
|
||||||
interpret@^1.0.0:
|
interpret@^1.0.0:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c"
|
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c"
|
||||||
@@ -2207,9 +2325,9 @@ is-glob@^2.0.0, is-glob@^2.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-extglob "^1.0.0"
|
is-extglob "^1.0.0"
|
||||||
|
|
||||||
is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4:
|
is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4, is-my-json-valid@^2.16.0:
|
||||||
version "2.15.0"
|
version "2.16.0"
|
||||||
resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz#936edda3ca3c211fd98f3b2d3e08da43f7b2915b"
|
resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693"
|
||||||
dependencies:
|
dependencies:
|
||||||
generate-function "^2.0.0"
|
generate-function "^2.0.0"
|
||||||
generate-object-property "^1.1.0"
|
generate-object-property "^1.1.0"
|
||||||
@@ -2246,6 +2364,10 @@ is-primitive@^2.0.0:
|
|||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575"
|
resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575"
|
||||||
|
|
||||||
|
is-promise@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
|
||||||
|
|
||||||
is-property@^1.0.0:
|
is-property@^1.0.0:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84"
|
resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84"
|
||||||
@@ -2315,17 +2437,21 @@ js-tokens@^3.0.0:
|
|||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.0.tgz#a2f2a969caae142fb3cd56228358c89366957bd1"
|
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.0.tgz#a2f2a969caae142fb3cd56228358c89366957bd1"
|
||||||
|
|
||||||
js-yaml@^3.5.1:
|
js-yaml@^3.5.1, js-yaml@^3.8.4:
|
||||||
version "3.7.0"
|
version "3.8.4"
|
||||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80"
|
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6"
|
||||||
dependencies:
|
dependencies:
|
||||||
argparse "^1.0.7"
|
argparse "^1.0.7"
|
||||||
esprima "^2.6.0"
|
esprima "^3.1.1"
|
||||||
|
|
||||||
jsbn@~0.1.0:
|
jsbn@~0.1.0:
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd"
|
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd"
|
||||||
|
|
||||||
|
jschardet@^1.4.2:
|
||||||
|
version "1.4.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.4.2.tgz#2aa107f142af4121d145659d44f50830961e699a"
|
||||||
|
|
||||||
jsesc@^1.3.0:
|
jsesc@^1.3.0:
|
||||||
version "1.3.0"
|
version "1.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b"
|
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b"
|
||||||
@@ -2458,7 +2584,7 @@ lodash.pickby@^4.0.0:
|
|||||||
version "4.6.0"
|
version "4.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff"
|
resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff"
|
||||||
|
|
||||||
lodash@^4.0.0, lodash@^4.14.0, lodash@^4.2.0, lodash@^4.3.0:
|
lodash@^4.0.0, lodash@^4.14.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0:
|
||||||
version "4.17.4"
|
version "4.17.4"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||||
|
|
||||||
@@ -2500,6 +2626,13 @@ map-stream@~0.1.0:
|
|||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194"
|
resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194"
|
||||||
|
|
||||||
|
match-sorter@^1.8.0:
|
||||||
|
version "1.8.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/match-sorter/-/match-sorter-1.8.0.tgz#29a2732fd6ea1ae7d3f02e592a533597fee5a38f"
|
||||||
|
dependencies:
|
||||||
|
diacritic "0.0.2"
|
||||||
|
global-object "1.0.0"
|
||||||
|
|
||||||
memory-fs@^0.4.0, memory-fs@~0.4.1:
|
memory-fs@^0.4.0, memory-fs@~0.4.1:
|
||||||
version "0.4.1"
|
version "0.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552"
|
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552"
|
||||||
@@ -2557,16 +2690,26 @@ mime-types@^2.1.12, mime-types@~2.1.7:
|
|||||||
dependencies:
|
dependencies:
|
||||||
mime-db "~1.26.0"
|
mime-db "~1.26.0"
|
||||||
|
|
||||||
|
mimic-fn@^1.0.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"
|
||||||
|
|
||||||
minimalistic-assert@^1.0.0:
|
minimalistic-assert@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3"
|
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3"
|
||||||
|
|
||||||
"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3:
|
"minimatch@2 || 3", minimatch@^3.0.2:
|
||||||
version "3.0.3"
|
version "3.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
||||||
dependencies:
|
dependencies:
|
||||||
brace-expansion "^1.0.0"
|
brace-expansion "^1.0.0"
|
||||||
|
|
||||||
|
minimatch@^3.0.0, minimatch@^3.0.3, minimatch@^3.0.4:
|
||||||
|
version "3.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||||
|
dependencies:
|
||||||
|
brace-expansion "^1.1.7"
|
||||||
|
|
||||||
minimist@0.0.8:
|
minimist@0.0.8:
|
||||||
version "0.0.8"
|
version "0.0.8"
|
||||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
|
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
|
||||||
@@ -2585,14 +2728,18 @@ ms@0.7.1:
|
|||||||
version "0.7.1"
|
version "0.7.1"
|
||||||
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098"
|
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098"
|
||||||
|
|
||||||
ms@0.7.2:
|
ms@2.0.0:
|
||||||
version "0.7.2"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765"
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||||
|
|
||||||
mute-stream@0.0.5:
|
mute-stream@0.0.5:
|
||||||
version "0.0.5"
|
version "0.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0"
|
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0"
|
||||||
|
|
||||||
|
mute-stream@0.0.7:
|
||||||
|
version "0.0.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
|
||||||
|
|
||||||
nan@^2.3.0:
|
nan@^2.3.0:
|
||||||
version "2.5.1"
|
version "2.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.1.tgz#d5b01691253326a97a2bbee9e61c55d8d60351e2"
|
resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.1.tgz#d5b01691253326a97a2bbee9e61c55d8d60351e2"
|
||||||
@@ -2762,6 +2909,12 @@ onetime@^1.0.0:
|
|||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789"
|
resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789"
|
||||||
|
|
||||||
|
onetime@^2.0.0:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"
|
||||||
|
dependencies:
|
||||||
|
mimic-fn "^1.0.0"
|
||||||
|
|
||||||
optionator@^0.8.2:
|
optionator@^0.8.2:
|
||||||
version "0.8.2"
|
version "0.8.2"
|
||||||
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"
|
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"
|
||||||
@@ -2787,7 +2940,7 @@ os-locale@^1.4.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
lcid "^1.0.0"
|
lcid "^1.0.0"
|
||||||
|
|
||||||
os-tmpdir@^1.0.1:
|
os-tmpdir@^1.0.1, os-tmpdir@~1.0.1:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
|
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
|
||||||
|
|
||||||
@@ -2860,7 +3013,7 @@ path-is-absolute@^1.0.0:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
||||||
|
|
||||||
path-is-inside@^1.0.1:
|
path-is-inside@^1.0.1, path-is-inside@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"
|
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"
|
||||||
|
|
||||||
@@ -2929,6 +3082,10 @@ pluralize@^1.2.1:
|
|||||||
version "1.2.1"
|
version "1.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45"
|
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45"
|
||||||
|
|
||||||
|
pluralize@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-4.0.0.tgz#59b708c1c0190a2f692f1c7618c446b052fd1762"
|
||||||
|
|
||||||
postcss-cli@^2.6.0:
|
postcss-cli@^2.6.0:
|
||||||
version "2.6.0"
|
version "2.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/postcss-cli/-/postcss-cli-2.6.0.tgz#f0de393caa026fcfc1b1479822989af508ed515d"
|
resolved "https://registry.yarnpkg.com/postcss-cli/-/postcss-cli-2.6.0.tgz#f0de393caa026fcfc1b1479822989af508ed515d"
|
||||||
@@ -2980,6 +3137,10 @@ progress@^1.1.8:
|
|||||||
version "1.1.8"
|
version "1.1.8"
|
||||||
resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be"
|
resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be"
|
||||||
|
|
||||||
|
progress@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f"
|
||||||
|
|
||||||
promise@^7.1.1:
|
promise@^7.1.1:
|
||||||
version "7.1.1"
|
version "7.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
|
resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
|
||||||
@@ -3257,7 +3418,7 @@ require-main-filename@^1.0.1:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1"
|
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1"
|
||||||
|
|
||||||
require-uncached@^1.0.2:
|
require-uncached@^1.0.2, require-uncached@^1.0.3:
|
||||||
version "1.0.3"
|
version "1.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3"
|
resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3279,6 +3440,13 @@ restore-cursor@^1.0.1:
|
|||||||
exit-hook "^1.0.0"
|
exit-hook "^1.0.0"
|
||||||
onetime "^1.0.0"
|
onetime "^1.0.0"
|
||||||
|
|
||||||
|
restore-cursor@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
|
||||||
|
dependencies:
|
||||||
|
onetime "^2.0.0"
|
||||||
|
signal-exit "^3.0.2"
|
||||||
|
|
||||||
right-align@^0.1.1:
|
right-align@^0.1.1:
|
||||||
version "0.1.3"
|
version "0.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef"
|
resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef"
|
||||||
@@ -3307,10 +3475,26 @@ run-async@^0.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
once "^1.3.0"
|
once "^1.3.0"
|
||||||
|
|
||||||
|
run-async@^2.2.0:
|
||||||
|
version "2.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0"
|
||||||
|
dependencies:
|
||||||
|
is-promise "^2.1.0"
|
||||||
|
|
||||||
run-parallel@^1.1.2:
|
run-parallel@^1.1.2:
|
||||||
version "1.1.6"
|
version "1.1.6"
|
||||||
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.6.tgz#29003c9a2163e01e2d2dfc90575f2c6c1d61a039"
|
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.6.tgz#29003c9a2163e01e2d2dfc90575f2c6c1d61a039"
|
||||||
|
|
||||||
|
rx-lite-aggregates@^4.0.8:
|
||||||
|
version "4.0.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be"
|
||||||
|
dependencies:
|
||||||
|
rx-lite "*"
|
||||||
|
|
||||||
|
rx-lite@*, rx-lite@^4.0.8:
|
||||||
|
version "4.0.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444"
|
||||||
|
|
||||||
rx-lite@^3.1.2:
|
rx-lite@^3.1.2:
|
||||||
version "3.1.2"
|
version "3.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102"
|
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102"
|
||||||
@@ -3372,7 +3556,7 @@ shelljs@^0.7.5:
|
|||||||
interpret "^1.0.0"
|
interpret "^1.0.0"
|
||||||
rechoir "^0.6.2"
|
rechoir "^0.6.2"
|
||||||
|
|
||||||
signal-exit@^3.0.0:
|
signal-exit@^3.0.0, signal-exit@^3.0.2:
|
||||||
version "3.0.2"
|
version "3.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
|
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
|
||||||
|
|
||||||
@@ -3592,6 +3776,17 @@ table@^3.7.8:
|
|||||||
slice-ansi "0.0.4"
|
slice-ansi "0.0.4"
|
||||||
string-width "^2.0.0"
|
string-width "^2.0.0"
|
||||||
|
|
||||||
|
table@^4.0.1:
|
||||||
|
version "4.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/table/-/table-4.0.1.tgz#a8116c133fac2c61f4a420ab6cdf5c4d61f0e435"
|
||||||
|
dependencies:
|
||||||
|
ajv "^4.7.0"
|
||||||
|
ajv-keywords "^1.0.0"
|
||||||
|
chalk "^1.1.1"
|
||||||
|
lodash "^4.0.0"
|
||||||
|
slice-ansi "0.0.4"
|
||||||
|
string-width "^2.0.0"
|
||||||
|
|
||||||
tapable@^0.2.5, tapable@~0.2.5:
|
tapable@^0.2.5, tapable@~0.2.5:
|
||||||
version "0.2.6"
|
version "0.2.6"
|
||||||
resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.6.tgz#206be8e188860b514425375e6f1ae89bfb01fd8d"
|
resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.6.tgz#206be8e188860b514425375e6f1ae89bfb01fd8d"
|
||||||
@@ -3631,6 +3826,12 @@ timers-browserify@^2.0.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
setimmediate "^1.0.4"
|
setimmediate "^1.0.4"
|
||||||
|
|
||||||
|
tmp@^0.0.31:
|
||||||
|
version "0.0.31"
|
||||||
|
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7"
|
||||||
|
dependencies:
|
||||||
|
os-tmpdir "~1.0.1"
|
||||||
|
|
||||||
to-arraybuffer@^1.0.0:
|
to-arraybuffer@^1.0.0:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43"
|
resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43"
|
||||||
|
|||||||
Reference in New Issue
Block a user