mirror of
https://github.com/gosticks/react-table.git
synced 2026-10-05 23:36:54 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49eb999821 |
+75
-1
@@ -1,3 +1,77 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
extends: 'react-tools'
|
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 }]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,11 +74,7 @@
|
|||||||
## Installation
|
## Installation
|
||||||
1. Install React Table as a dependency
|
1. Install React Table as a dependency
|
||||||
```bash
|
```bash
|
||||||
# Yarn
|
|
||||||
$ yarn add react-table
|
$ yarn add react-table
|
||||||
|
|
||||||
# NPM
|
|
||||||
$ npm install react-table
|
|
||||||
```
|
```
|
||||||
2. Import the `react-table` module
|
2. Import the `react-table` module
|
||||||
```javascript
|
```javascript
|
||||||
@@ -182,7 +178,7 @@ These are all of the available props (and their default values) for the main `<R
|
|||||||
const id = filter.pivotId || filter.id
|
const id = filter.pivotId || filter.id
|
||||||
return row[id] !== undefined ? String(row[id]).startsWith(filter.value) : true
|
return row[id] !== undefined ? String(row[id]).startsWith(filter.value) : true
|
||||||
},
|
},
|
||||||
defaultSortMethod: (a, b, desc) => {
|
defaultSortMethod: (a, b) => {
|
||||||
// force null and undefined to the bottom
|
// force null and undefined to the bottom
|
||||||
a = (a === null || a === undefined) ? -Infinity : a
|
a = (a === null || a === undefined) ? -Infinity : a
|
||||||
b = (b === null || b === undefined) ? -Infinity : b
|
b = (b === null || b === undefined) ? -Infinity : b
|
||||||
@@ -490,7 +486,7 @@ const columns = [{
|
|||||||
}, {
|
}, {
|
||||||
Header: 'Food',
|
Header: 'Food',
|
||||||
accessor: 'favorites.food'
|
accessor: 'favorites.food'
|
||||||
}, {
|
} {
|
||||||
Header: 'Actor',
|
Header: 'Actor',
|
||||||
accessor: 'favorites.actor'
|
accessor: 'favorites.actor'
|
||||||
}]
|
}]
|
||||||
@@ -841,9 +837,9 @@ To override the sorting algorithm for a single column, use the `sortMethod` colu
|
|||||||
Supply a function that implements the native javascript [`Array.sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) interface. This is React Table's default sorting algorithm:
|
Supply a function that implements the native javascript [`Array.sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) interface. This is React Table's default sorting algorithm:
|
||||||
- `a` the first value to compare
|
- `a` the first value to compare
|
||||||
- `b` the second value to compare
|
- `b` the second value to compare
|
||||||
- `desc` true if sort is descending, false if ascending
|
- `dir` the
|
||||||
```javascript
|
```javascript
|
||||||
defaultSortMethod = (a, b, desc) => {
|
defaultSortMethod = (a, b) => {
|
||||||
// force null and undefined to the bottom
|
// force null and undefined to the bottom
|
||||||
a = (a === null || a === undefined) ? -Infinity : a
|
a = (a === null || a === undefined) ? -Infinity : a
|
||||||
b = (b === null || b === undefined) ? -Infinity : b
|
b = (b === null || b === undefined) ? -Infinity : b
|
||||||
@@ -875,7 +871,7 @@ By default, `filterMethod` is passed a single row of data at a time, and you are
|
|||||||
|
|
||||||
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.
|
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 want 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.
|
||||||
|
|
||||||
@@ -890,7 +886,7 @@ Object.assign(ReactTableDefaults, {
|
|||||||
TbodyComponent: component,
|
TbodyComponent: component,
|
||||||
TrGroupComponent: component,
|
TrGroupComponent: component,
|
||||||
TrComponent: component,
|
TrComponent: component,
|
||||||
ThComponent: component,
|
ThComponent: component
|
||||||
TdComponent: component,
|
TdComponent: component,
|
||||||
TfootComponent: component,
|
TfootComponent: component,
|
||||||
ExpanderComponent: component,
|
ExpanderComponent: component,
|
||||||
|
|||||||
+4
-4
@@ -3,6 +3,8 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"react-scripts": "0.9.5",
|
||||||
|
"standard": "^10.0.2",
|
||||||
"autoprefixer": "^6.7.0",
|
"autoprefixer": "^6.7.0",
|
||||||
"babel-cli": "6.14.0",
|
"babel-cli": "6.14.0",
|
||||||
"babel-eslint": "6.1.2",
|
"babel-eslint": "6.1.2",
|
||||||
@@ -19,10 +21,10 @@
|
|||||||
"react-json-tree": "^0.10.9",
|
"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"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"eslint-config-react-tools": "^1.0.10",
|
|
||||||
"github-markdown-css": "^2.6.0",
|
"github-markdown-css": "^2.6.0",
|
||||||
"marked": "^0.3.6",
|
"marked": "^0.3.6",
|
||||||
"namor": "^1.0.1",
|
"namor": "^1.0.1",
|
||||||
@@ -30,8 +32,6 @@
|
|||||||
"react": "^15.5.4",
|
"react": "^15.5.4",
|
||||||
"react-dom": "^15.5.4",
|
"react-dom": "^15.5.4",
|
||||||
"react-json-tree": "^0.10.9",
|
"react-json-tree": "^0.10.9",
|
||||||
"react-script": "^2.0.5",
|
|
||||||
"react-scripts": "^0.9.5",
|
|
||||||
"react-story": "^0.0.10"
|
"react-story": "^0.0.10"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+2
-3
@@ -63,7 +63,7 @@ export default class App extends React.Component {
|
|||||||
height: '100%',
|
height: '100%',
|
||||||
}}
|
}}
|
||||||
pathPrefix='story/'
|
pathPrefix='story/'
|
||||||
StoryWrapper={props => (
|
StoryWrapper={props =>
|
||||||
<defaultProps.StoryWrapper
|
<defaultProps.StoryWrapper
|
||||||
css={{
|
css={{
|
||||||
padding: 0,
|
padding: 0,
|
||||||
@@ -95,8 +95,7 @@ export default class App extends React.Component {
|
|||||||
position: 'relative',
|
position: 'relative',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</defaultProps.StoryWrapper>
|
</defaultProps.StoryWrapper>}
|
||||||
)}
|
|
||||||
stories={stories}
|
stories={stories}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
+762
-1080
File diff suppressed because it is too large
Load Diff
+3
-10
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-table",
|
"name": "react-table",
|
||||||
"version": "6.7.2",
|
"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/react-tools/react-table#readme",
|
"homepage": "https://github.com/react-tools/react-table#readme",
|
||||||
@@ -35,14 +35,13 @@
|
|||||||
"prepublish": "npm run build && npm run umd",
|
"prepublish": "npm run build && npm run umd",
|
||||||
"postpublish": "git push --tags",
|
"postpublish": "git push --tags",
|
||||||
"docs": "yarn watch & cd docs && yarn && yarn start",
|
"docs": "yarn watch & cd docs && yarn && yarn start",
|
||||||
"docs:build": "yarn build && cd docs && yarn && yarn build"
|
"docs:build": "yarn build && cd docs && yarn && yarn run build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"classnames": "^2.2.5"
|
"classnames": "^2.2.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^15.x.x || ^16.x.x",
|
"react": "^15.x.x || ^16.x.x"
|
||||||
"eslint-config-react-tools": "^1.0.10"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^6.7.0",
|
"autoprefixer": "^6.7.0",
|
||||||
@@ -52,16 +51,10 @@
|
|||||||
"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",
|
"eslint": "^4.1.1",
|
||||||
"eslint-config-standard": "^10.2.1",
|
|
||||||
"eslint-plugin-import": "^2.7.0",
|
|
||||||
"eslint-plugin-node": "^5.2.0",
|
|
||||||
"eslint-plugin-react": "^7.4.0",
|
|
||||||
"eslint-plugin-standard": "^3.0.1",
|
|
||||||
"match-sorter": "^1.8.0",
|
"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",
|
||||||
"prop-types": "^15.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",
|
"react-json-tree": "^0.10.9",
|
||||||
|
|||||||
+11
-15
@@ -35,7 +35,7 @@ export default {
|
|||||||
? String(row[id]).startsWith(filter.value)
|
? String(row[id]).startsWith(filter.value)
|
||||||
: true
|
: true
|
||||||
},
|
},
|
||||||
defaultSortMethod: (a, b, desc) => {
|
defaultSortMethod: (a, b) => {
|
||||||
// force null and undefined to the bottom
|
// force null and undefined to the bottom
|
||||||
a = a === null || a === undefined ? '' : a
|
a = a === null || a === undefined ? '' : a
|
||||||
b = b === null || b === undefined ? '' : b
|
b = b === null || b === undefined ? '' : b
|
||||||
@@ -191,7 +191,7 @@ export default {
|
|||||||
},
|
},
|
||||||
TdComponent: _.makeTemplateComponent('rt-td', 'Td'),
|
TdComponent: _.makeTemplateComponent('rt-td', 'Td'),
|
||||||
TfootComponent: _.makeTemplateComponent('rt-tfoot', 'Tfoot'),
|
TfootComponent: _.makeTemplateComponent('rt-tfoot', 'Tfoot'),
|
||||||
FilterComponent: ({ filter, onChange }) => (
|
FilterComponent: ({ filter, onChange }) =>
|
||||||
<input
|
<input
|
||||||
type='text'
|
type='text'
|
||||||
style={{
|
style={{
|
||||||
@@ -199,27 +199,24 @@ export default {
|
|||||||
}}
|
}}
|
||||||
value={filter ? filter.value : ''}
|
value={filter ? filter.value : ''}
|
||||||
onChange={event => onChange(event.target.value)}
|
onChange={event => onChange(event.target.value)}
|
||||||
/>
|
/>,
|
||||||
),
|
ExpanderComponent: ({ isExpanded }) =>
|
||||||
ExpanderComponent: ({ isExpanded }) => (
|
|
||||||
<div className={classnames('rt-expander', isExpanded && '-open')}>
|
<div className={classnames('rt-expander', isExpanded && '-open')}>
|
||||||
•
|
•
|
||||||
</div>
|
</div>,
|
||||||
),
|
PivotValueComponent: ({ subRows, value }) =>
|
||||||
PivotValueComponent: ({ subRows, value }) => (
|
|
||||||
<span>
|
<span>
|
||||||
{value} {subRows && `(${subRows.length})`}
|
{value} {subRows && `(${subRows.length})`}
|
||||||
</span>
|
</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]}
|
{row[column.id]}
|
||||||
{i < subRows.length - 1 ? ', ' : ''}
|
{i < subRows.length - 1 ? ', ' : ''}
|
||||||
</span>
|
</span>
|
||||||
))
|
)
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
{previewValues}
|
{previewValues}
|
||||||
@@ -231,7 +228,7 @@ export default {
|
|||||||
PaginationComponent: Pagination,
|
PaginationComponent: Pagination,
|
||||||
PreviousComponent: undefined,
|
PreviousComponent: undefined,
|
||||||
NextComponent: undefined,
|
NextComponent: undefined,
|
||||||
LoadingComponent: ({ className, loading, loadingText, ...rest }) => (
|
LoadingComponent: ({ className, loading, loadingText, ...rest }) =>
|
||||||
<div
|
<div
|
||||||
className={classnames('-loading', { '-active': loading }, className)}
|
className={classnames('-loading', { '-active': loading }, className)}
|
||||||
{...rest}
|
{...rest}
|
||||||
@@ -239,8 +236,7 @@ export default {
|
|||||||
<div className='-loading-inner'>
|
<div className='-loading-inner'>
|
||||||
{loadingText}
|
{loadingText}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>,
|
||||||
),
|
|
||||||
NoDataComponent: _.makeTemplateComponent('rt-noData', 'NoData'),
|
NoDataComponent: _.makeTemplateComponent('rt-noData', 'NoData'),
|
||||||
ResizerComponent: _.makeTemplateComponent('rt-resizer', 'Resizer'),
|
ResizerComponent: _.makeTemplateComponent('rt-resizer', 'Resizer'),
|
||||||
PadRowComponent: () => <span> </span>,
|
PadRowComponent: () => <span> </span>,
|
||||||
|
|||||||
+2
-7
@@ -5,12 +5,10 @@ import _ from './utils'
|
|||||||
import Lifecycle from './lifecycle'
|
import Lifecycle from './lifecycle'
|
||||||
import Methods from './methods'
|
import Methods from './methods'
|
||||||
import defaultProps from './defaultProps'
|
import defaultProps from './defaultProps'
|
||||||
import propTypes from './propTypes'
|
|
||||||
|
|
||||||
export const ReactTableDefaults = defaultProps
|
export const ReactTableDefaults = defaultProps
|
||||||
|
|
||||||
export default class ReactTable extends Methods(Lifecycle(Component)) {
|
export default class ReactTable extends Methods(Lifecycle(Component)) {
|
||||||
static propTypes = propTypes
|
|
||||||
static defaultProps = defaultProps
|
static defaultProps = defaultProps
|
||||||
|
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
@@ -503,8 +501,6 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
row: row,
|
row: row,
|
||||||
index: row[indexKey],
|
index: row[indexKey],
|
||||||
viewIndex: ++rowIndex,
|
viewIndex: ++rowIndex,
|
||||||
pageSize: pageSize,
|
|
||||||
page: page,
|
|
||||||
level: path.length,
|
level: path.length,
|
||||||
nestingPath: path.concat([i]),
|
nestingPath: path.concat([i]),
|
||||||
aggregated: row[aggregatedKey],
|
aggregated: row[aggregatedKey],
|
||||||
@@ -618,12 +614,11 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
|||||||
column.PivotValue || PivotValueComponent
|
column.PivotValue || PivotValueComponent
|
||||||
const DefaultResolvedPivotComponent =
|
const DefaultResolvedPivotComponent =
|
||||||
PivotComponent ||
|
PivotComponent ||
|
||||||
(props => (
|
(props =>
|
||||||
<div>
|
<div>
|
||||||
<ResolvedExpanderComponent {...props} />
|
<ResolvedExpanderComponent {...props} />
|
||||||
<ResolvedPivotValueComponent {...props} />
|
<ResolvedPivotValueComponent {...props} />
|
||||||
</div>
|
</div>)
|
||||||
))
|
|
||||||
const ResolvedPivotComponent =
|
const ResolvedPivotComponent =
|
||||||
column.Pivot || DefaultResolvedPivotComponent
|
column.Pivot || DefaultResolvedPivotComponent
|
||||||
|
|
||||||
|
|||||||
+7
-14
@@ -2,15 +2,6 @@ $easeOutQuad = cubic-bezier(0.250, 0.460, 0.450, 0.940)
|
|||||||
$easeOutBack = cubic-bezier(0.175, 0.885, 0.320, 1.275)
|
$easeOutBack = cubic-bezier(0.175, 0.885, 0.320, 1.275)
|
||||||
$expandSize = 7px
|
$expandSize = 7px
|
||||||
|
|
||||||
input-select-style()
|
|
||||||
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
|
|
||||||
|
|
||||||
.ReactTable
|
.ReactTable
|
||||||
position:relative
|
position:relative
|
||||||
display: flex
|
display: flex
|
||||||
@@ -43,10 +34,6 @@ input-select-style()
|
|||||||
&.-filters
|
&.-filters
|
||||||
border-bottom: 1px solid alpha(black, 0.05)
|
border-bottom: 1px solid alpha(black, 0.05)
|
||||||
|
|
||||||
input
|
|
||||||
select
|
|
||||||
input-select-style();
|
|
||||||
|
|
||||||
.rt-th
|
.rt-th
|
||||||
border-right: 1px solid alpha(black, 0.02)
|
border-right: 1px solid alpha(black, 0.02)
|
||||||
|
|
||||||
@@ -211,7 +198,13 @@ input-select-style()
|
|||||||
|
|
||||||
input
|
input
|
||||||
select
|
select
|
||||||
input-select-style()
|
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
|
||||||
|
|||||||
+2
-2
@@ -412,11 +412,11 @@ export default Base =>
|
|||||||
// Support custom sorting methods for each column
|
// Support custom sorting methods for each column
|
||||||
if (sortMethodsByColumnID[sort.id]) {
|
if (sortMethodsByColumnID[sort.id]) {
|
||||||
return (a, b) => {
|
return (a, b) => {
|
||||||
return sortMethodsByColumnID[sort.id](a[sort.id], b[sort.id], sort.desc)
|
return sortMethodsByColumnID[sort.id](a[sort.id], b[sort.id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (a, b) => {
|
return (a, b) => {
|
||||||
return this.props.defaultSortMethod(a[sort.id], b[sort.id], sort.desc)
|
return this.props.defaultSortMethod(a[sort.id], b[sort.id])
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
sorted.map(d => !d.desc),
|
sorted.map(d => !d.desc),
|
||||||
|
|||||||
+1
-2
@@ -3,11 +3,10 @@ import classnames from 'classnames'
|
|||||||
//
|
//
|
||||||
// import _ from './utils'
|
// import _ from './utils'
|
||||||
|
|
||||||
const defaultButton = props => (
|
const defaultButton = props =>
|
||||||
<button type='button' {...props} className='-btn'>
|
<button type='button' {...props} className='-btn'>
|
||||||
{props.children}
|
{props.children}
|
||||||
</button>
|
</button>
|
||||||
)
|
|
||||||
|
|
||||||
export default class ReactTablePagination extends Component {
|
export default class ReactTablePagination extends Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
|
|||||||
@@ -1,191 +0,0 @@
|
|||||||
import PropTypes from "prop-types";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
// General
|
|
||||||
data: PropTypes.array,
|
|
||||||
loading: PropTypes.bool,
|
|
||||||
showPagination: PropTypes.bool,
|
|
||||||
showPaginationTop: PropTypes.bool,
|
|
||||||
showPaginationBottom: PropTypes.bool,
|
|
||||||
showPageSizeOptions: PropTypes.bool,
|
|
||||||
pageSizeOptions: PropTypes.array,
|
|
||||||
defaultPageSize: PropTypes.number,
|
|
||||||
showPageJump: PropTypes.bool,
|
|
||||||
collapseOnSortingChange: PropTypes.bool,
|
|
||||||
collapseOnPageChange: PropTypes.bool,
|
|
||||||
collapseOnDataChange: PropTypes.bool,
|
|
||||||
freezeWhenExpanded: PropTypes.bool,
|
|
||||||
sortable: PropTypes.bool,
|
|
||||||
resizable: PropTypes.bool,
|
|
||||||
filterable: PropTypes.bool,
|
|
||||||
defaultSortDesc: PropTypes.bool,
|
|
||||||
defaultSorted: PropTypes.array,
|
|
||||||
defaultFiltered: PropTypes.array,
|
|
||||||
defaultResized: PropTypes.array,
|
|
||||||
defaultExpanded: PropTypes.object,
|
|
||||||
defaultFilterMethod: PropTypes.func,
|
|
||||||
defaultSortMethod: PropTypes.func,
|
|
||||||
|
|
||||||
// Controlled State Callbacks
|
|
||||||
onPageChange: PropTypes.func,
|
|
||||||
onPageSizeChange: PropTypes.func,
|
|
||||||
onSortedChange: PropTypes.func,
|
|
||||||
onFilteredChange: PropTypes.func,
|
|
||||||
onResizedChange: PropTypes.func,
|
|
||||||
onExpandedChange: PropTypes.func,
|
|
||||||
|
|
||||||
// Pivoting
|
|
||||||
pivotBy: PropTypes.array,
|
|
||||||
|
|
||||||
// Key Constants
|
|
||||||
pivotValKey: PropTypes.string,
|
|
||||||
pivotIDKey: PropTypes.string,
|
|
||||||
subRowsKey: PropTypes.string,
|
|
||||||
aggregatedKey: PropTypes.string,
|
|
||||||
nestingLevelKey: PropTypes.string,
|
|
||||||
originalKey: PropTypes.string,
|
|
||||||
indexKey: PropTypes.string,
|
|
||||||
groupedByPivotKey: PropTypes.string,
|
|
||||||
|
|
||||||
// Server-side Callbacks
|
|
||||||
onFetchData: PropTypes.func,
|
|
||||||
|
|
||||||
// Classes
|
|
||||||
className: PropTypes.string,
|
|
||||||
style: PropTypes.object,
|
|
||||||
|
|
||||||
// Component decorators
|
|
||||||
getProps: PropTypes.func,
|
|
||||||
getTableProps: PropTypes.func,
|
|
||||||
getTheadGroupProps: PropTypes.func,
|
|
||||||
getTheadGroupTrProps: PropTypes.func,
|
|
||||||
getTheadGroupThProps: PropTypes.func,
|
|
||||||
getTheadProps: PropTypes.func,
|
|
||||||
getTheadTrProps: PropTypes.func,
|
|
||||||
getTheadThProps: PropTypes.func,
|
|
||||||
getTheadFilterProps: PropTypes.func,
|
|
||||||
getTheadFilterTrProps: PropTypes.func,
|
|
||||||
getTheadFilterThProps: PropTypes.func,
|
|
||||||
getTbodyProps: PropTypes.func,
|
|
||||||
getTrGroupProps: PropTypes.func,
|
|
||||||
getTrProps: PropTypes.func,
|
|
||||||
getTdProps: PropTypes.func,
|
|
||||||
getTfootProps: PropTypes.func,
|
|
||||||
getTfootTrProps: PropTypes.func,
|
|
||||||
getTfootTdProps: PropTypes.func,
|
|
||||||
getPaginationProps: PropTypes.func,
|
|
||||||
getLoadingProps: PropTypes.func,
|
|
||||||
getNoDataProps: PropTypes.func,
|
|
||||||
getResizerProps: PropTypes.func,
|
|
||||||
|
|
||||||
// Global Column Defaults
|
|
||||||
columns: PropTypes.shape({
|
|
||||||
// Renderers
|
|
||||||
Cell: PropTypes.oneOfType([
|
|
||||||
PropTypes.element,
|
|
||||||
PropTypes.string,
|
|
||||||
PropTypes.func
|
|
||||||
]),
|
|
||||||
Header: PropTypes.oneOfType([
|
|
||||||
PropTypes.element,
|
|
||||||
PropTypes.string,
|
|
||||||
PropTypes.func
|
|
||||||
]),
|
|
||||||
Footer: PropTypes.oneOfType([
|
|
||||||
PropTypes.element,
|
|
||||||
PropTypes.string,
|
|
||||||
PropTypes.func
|
|
||||||
]),
|
|
||||||
Aggregated: PropTypes.oneOfType([
|
|
||||||
PropTypes.element,
|
|
||||||
PropTypes.string,
|
|
||||||
PropTypes.func
|
|
||||||
]),
|
|
||||||
Pivot: PropTypes.oneOfType([
|
|
||||||
PropTypes.element,
|
|
||||||
PropTypes.string,
|
|
||||||
PropTypes.func
|
|
||||||
]),
|
|
||||||
PivotValue: PropTypes.oneOfType([
|
|
||||||
PropTypes.element,
|
|
||||||
PropTypes.string,
|
|
||||||
PropTypes.func
|
|
||||||
]),
|
|
||||||
Expander: PropTypes.oneOfType([
|
|
||||||
PropTypes.element,
|
|
||||||
PropTypes.string,
|
|
||||||
PropTypes.func
|
|
||||||
]),
|
|
||||||
Filter: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
||||||
|
|
||||||
// All Columns
|
|
||||||
sortable: PropTypes.bool, // use table default
|
|
||||||
resizable: PropTypes.bool, // use table default
|
|
||||||
filterable: PropTypes.bool, // use table default
|
|
||||||
show: PropTypes.bool,
|
|
||||||
minWidth: PropTypes.number,
|
|
||||||
|
|
||||||
// Cells only
|
|
||||||
className: PropTypes.string,
|
|
||||||
style: PropTypes.object,
|
|
||||||
getProps: PropTypes.object,
|
|
||||||
|
|
||||||
// Pivot only
|
|
||||||
aggregate: PropTypes.func,
|
|
||||||
|
|
||||||
// Headers only
|
|
||||||
headerClassName: PropTypes.string,
|
|
||||||
headerStyle: PropTypes.object,
|
|
||||||
getHeaderProps: PropTypes.object,
|
|
||||||
|
|
||||||
// Footers only
|
|
||||||
footerClassName: PropTypes.string,
|
|
||||||
footerStyle: PropTypes.object,
|
|
||||||
getFooterProps: PropTypes.object,
|
|
||||||
filterMethod: PropTypes.func,
|
|
||||||
filterAll: PropTypes.bool,
|
|
||||||
sortMethod: PropTypes.func
|
|
||||||
}),
|
|
||||||
|
|
||||||
// Global Expander Column Defaults
|
|
||||||
expanderDefaults: PropTypes.shape({
|
|
||||||
sortable: PropTypes.bool,
|
|
||||||
resizable: PropTypes.bool,
|
|
||||||
filterable: PropTypes.bool,
|
|
||||||
width: PropTypes.number
|
|
||||||
}),
|
|
||||||
|
|
||||||
pivotDefaults: PropTypes.object,
|
|
||||||
|
|
||||||
// Text
|
|
||||||
previousText: PropTypes.string,
|
|
||||||
nextText: PropTypes.string,
|
|
||||||
loadingText: PropTypes.string,
|
|
||||||
noDataText: PropTypes.string,
|
|
||||||
pageText: PropTypes.string,
|
|
||||||
ofText: PropTypes.string,
|
|
||||||
rowsText: PropTypes.string,
|
|
||||||
|
|
||||||
// Components
|
|
||||||
TableComponent: PropTypes.element,
|
|
||||||
TheadComponent: PropTypes.element,
|
|
||||||
TbodyComponent: PropTypes.element,
|
|
||||||
TrGroupComponent: PropTypes.element,
|
|
||||||
TrComponent: PropTypes.element,
|
|
||||||
ThComponent: PropTypes.element,
|
|
||||||
TdComponent: PropTypes.element,
|
|
||||||
TfootComponent: PropTypes.element,
|
|
||||||
FilterComponent: PropTypes.element,
|
|
||||||
ExpanderComponent: PropTypes.element,
|
|
||||||
PivotValueComponent: PropTypes.element,
|
|
||||||
AggregatedComponent: PropTypes.element,
|
|
||||||
PivotComponent: PropTypes.element, // this is a computed default generated using
|
|
||||||
// the ExpanderComponent and PivotValueComponent at run-time in methods.js
|
|
||||||
PaginationComponent: PropTypes.element,
|
|
||||||
PreviousComponent: PropTypes.element,
|
|
||||||
NextComponent: PropTypes.element,
|
|
||||||
LoadingComponent: PropTypes.element,
|
|
||||||
NoDataComponent: PropTypes.element,
|
|
||||||
ResizerComponent: PropTypes.element,
|
|
||||||
PadRowComponent: PropTypes.element
|
|
||||||
};
|
|
||||||
+1
-2
@@ -126,11 +126,10 @@ function makeTemplateComponent (compClass, displayName) {
|
|||||||
if (!displayName) {
|
if (!displayName) {
|
||||||
throw new Error('No displayName found for template component:', compClass)
|
throw new Error('No displayName found for template component:', compClass)
|
||||||
}
|
}
|
||||||
const cmp = ({ children, className, ...rest }) => (
|
const cmp = ({ children, className, ...rest }) =>
|
||||||
<div className={classnames(compClass, className)} {...rest}>
|
<div className={classnames(compClass, className)} {...rest}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
)
|
|
||||||
cmp.displayName = displayName
|
cmp.displayName = displayName
|
||||||
return cmp
|
return cmp
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user