mirror of
https://github.com/gosticks/react-table.git
synced 2026-06-28 17:10:01 +00:00
Merge branch 'master' into master
This commit is contained in:
@@ -10,25 +10,10 @@ import '../../react-table.css'
|
||||
import Readme from './stories/Readme.js'
|
||||
import HOCReadme from './stories/HOCReadme.js'
|
||||
|
||||
// import Test from './stories/test.js'
|
||||
|
||||
// import Tester from './examples/expander';
|
||||
|
||||
// import { TreeTable, SelectTable, SelectTreeTable } from './examples/index'
|
||||
//
|
||||
// const exampleStories = [
|
||||
// // examples
|
||||
// { name: 'TreeTable', component: TreeTable },
|
||||
// { name: 'SelectTable', component: SelectTable },
|
||||
// { name: 'SelectTreeTable', component: SelectTreeTable },
|
||||
// ]
|
||||
|
||||
import { TreeTable, CheckboxTable } from './examples/index'
|
||||
|
||||
const exampleStories = [
|
||||
// examples
|
||||
{ name: 'TreeTable', component: TreeTable },
|
||||
{ name: 'CheckboxTable', component: CheckboxTable },
|
||||
];
|
||||
|
||||
const stories = [
|
||||
{ name: 'Readme', component: Readme },
|
||||
{ name: 'HOC Readme', component: HOCReadme },
|
||||
|
||||
@@ -1,54 +1,61 @@
|
||||
/* eslint-disable */
|
||||
|
||||
import React from 'react';
|
||||
import React from 'react'
|
||||
|
||||
import ReactTable from '../../../../lib/index'
|
||||
import '../../../../react-table.css'
|
||||
|
||||
const data = [
|
||||
{one:"1.1",two:"1.2"},
|
||||
{one:"2.1",two:"2.2"},
|
||||
{one:"3.1",two:"3.2"},
|
||||
{one:"4.1",two:"4.2"},
|
||||
]
|
||||
|
||||
const columns = [
|
||||
{accessor:'one', Header: 'One'},
|
||||
{accessor:'two', Header: 'Two'},
|
||||
]
|
||||
|
||||
class ExpanderComponent extends React.Component {
|
||||
render()
|
||||
{
|
||||
return (
|
||||
<div className={`rt-expander ${this.props.isExpanded ? '-open' : ''}`}>
|
||||
•
|
||||
</div>
|
||||
)
|
||||
export default class ComponentTest extends React.component {
|
||||
render () {
|
||||
return <div>Bozo</div>
|
||||
}
|
||||
}
|
||||
|
||||
class SubComponent extends React.Component {
|
||||
render()
|
||||
{
|
||||
return <div>Nothing</div>
|
||||
}
|
||||
}
|
||||
|
||||
export default class ComponentTest extends React.Component {
|
||||
render()
|
||||
{
|
||||
const rtProps = {
|
||||
data,
|
||||
columns,
|
||||
ExpanderComponent: (props)=><ExpanderComponent {...props} />,
|
||||
SubComponent: (props)=><SubComponent {...props} />,
|
||||
multiSort: false,
|
||||
}
|
||||
return (
|
||||
<ReactTable
|
||||
{...rtProps}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
// import ReactTable from '../../../../lib/index'
|
||||
// import '../../../../react-table.css'
|
||||
//
|
||||
// console.log('ReactTable:',ReactTable)
|
||||
//
|
||||
// const data = [
|
||||
// {one:"1.1",two:"1.2"},
|
||||
// {one:"2.1",two:"2.2"},
|
||||
// {one:"3.1",two:"3.2"},
|
||||
// {one:"4.1",two:"4.2"},
|
||||
// ]
|
||||
//
|
||||
// const columns = [
|
||||
// {accessor:'one', Header: 'One'},
|
||||
// {accessor:'two', Header: 'Two'},
|
||||
// ]
|
||||
//
|
||||
// class ExpanderComponent extends React.Component {
|
||||
// render()
|
||||
// {
|
||||
// return (
|
||||
// <div className={`rt-expander ${this.props.isExpanded ? '-open' : ''}`}>
|
||||
// •
|
||||
// </div>
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class SubComponent extends React.Component {
|
||||
// render()
|
||||
// {
|
||||
// return <div>Nothing</div>
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// export default class ComponentTest extends React.Component {
|
||||
// render()
|
||||
// {
|
||||
// const rtProps = {
|
||||
// data,
|
||||
// columns,
|
||||
// // ExpanderComponent: (props)=><ExpanderComponent {...props} />,
|
||||
// // SubComponent: (props)=><SubComponent {...props} />,
|
||||
// // multiSort: false,
|
||||
// }
|
||||
// return (
|
||||
// <ReactTable
|
||||
// {...rtProps}
|
||||
// />
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
31
docs/src/stories/test.js
Normal file
31
docs/src/stories/test.js
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
import React from 'react'
|
||||
|
||||
import ReactTable from '../../../lib/index'
|
||||
import '../../../react-table.css'
|
||||
|
||||
const data = [
|
||||
{ one: '1.1', two: '1.2' },
|
||||
{ one: '2.1', two: '2.2' },
|
||||
{ one: '3.1', two: '3.2' },
|
||||
{ one: '4.1', two: '4.2' },
|
||||
]
|
||||
|
||||
const columns = [
|
||||
{ accessor: 'one', Header: 'One' },
|
||||
{ accessor: 'two', Header: 'Two' },
|
||||
]
|
||||
|
||||
export default class Story extends React.Component {
|
||||
render () {
|
||||
return (
|
||||
<div>
|
||||
Test
|
||||
<ReactTable
|
||||
data={data}
|
||||
columns={columns}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
22
src/utils.js
22
src/utils.js
@@ -188,16 +188,18 @@ function splitProps ({ className, style, ...rest }) {
|
||||
|
||||
function compactObject (obj) {
|
||||
const newObj = {}
|
||||
Object.keys(obj).map(key => {
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(obj, key) &&
|
||||
obj[key] !== undefined &&
|
||||
typeof obj[key] !== 'undefined'
|
||||
) {
|
||||
newObj[key] = obj[key]
|
||||
}
|
||||
return true
|
||||
})
|
||||
if (obj) {
|
||||
Object.keys(obj).map(key => {
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(obj, key) &&
|
||||
obj[key] !== undefined &&
|
||||
typeof obj[key] !== 'undefined'
|
||||
) {
|
||||
newObj[key] = obj[key]
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
return newObj
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user