diff --git a/docs/src/App.js b/docs/src/App.js index 3efcc39..4a5d4d6 100644 --- a/docs/src/App.js +++ b/docs/src/App.js @@ -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 }, diff --git a/docs/src/examples/expander/index.js b/docs/src/examples/expander/index.js index 31c08eb..5403e25 100644 --- a/docs/src/examples/expander/index.js +++ b/docs/src/examples/expander/index.js @@ -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 ( -
- • -
- ) +export default class ComponentTest extends React.component { + render () { + return
Bozo
} } -class SubComponent extends React.Component { - render() - { - return
Nothing
- } -} - -export default class ComponentTest extends React.Component { - render() - { - const rtProps = { - data, - columns, - ExpanderComponent: (props)=>, - SubComponent: (props)=>, - multiSort: false, - } - return ( - - ) - } -} +// 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 ( +//
+// • +//
+// ) +// } +// } +// +// class SubComponent extends React.Component { +// render() +// { +// return
Nothing
+// } +// } +// +// export default class ComponentTest extends React.Component { +// render() +// { +// const rtProps = { +// data, +// columns, +// // ExpanderComponent: (props)=>, +// // SubComponent: (props)=>, +// // multiSort: false, +// } +// return ( +// +// ) +// } +// } diff --git a/docs/src/stories/test.js b/docs/src/stories/test.js new file mode 100644 index 0000000..5e98633 --- /dev/null +++ b/docs/src/stories/test.js @@ -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 ( +
+ Test + +
+ ) + } +} diff --git a/src/utils.js b/src/utils.js index 3848f47..6a46465 100644 --- a/src/utils.js +++ b/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 }