diff --git a/docs/src/App.js b/docs/src/App.js index 8845a6d..327190a 100644 --- a/docs/src/App.js +++ b/docs/src/App.js @@ -25,9 +25,10 @@ import Filtering from './stories/Filtering.js' import ControlledTable from './stories/ControlledTable.js' import PivotingOptions from './stories/PivotingOptions.js' import EditableTable from './stories/EditableTable.js' +import FixedHeader from './stories/FixedHeader.js' export default class App extends React.Component { - render () { + render() { return ( ( + pathPrefix="story/" + StoryWrapper={props => ( React Table Logo ) diff --git a/docs/src/stories/FixedHeader.js b/docs/src/stories/FixedHeader.js new file mode 100644 index 0000000..a7350f6 --- /dev/null +++ b/docs/src/stories/FixedHeader.js @@ -0,0 +1,81 @@ +/* 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, numLen: 0 }), + lastName: namor.generate({ words: 1, numLen: 0 }), + age: Math.floor(Math.random() * 30), + children: _.map(_.range(10), d => { + return { + firstName: namor.generate({ words: 1, numLen: 0 }), + lastName: namor.generate({ words: 1, numLen: 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 ( +
+
+ +
+
+
+ Tip: Hold shift when sorting to multi-sort! +
+
+ ) + } +} + +const CodeHighlight = require('./components/codeHighlight').default +const source = require('!raw!./Simple') + +export default () => ( +
+ + {() => source} +
+) diff --git a/src/index.styl b/src/index.styl index 8deecf8..ad1665d 100644 --- a/src/index.styl +++ b/src/index.styl @@ -4,10 +4,13 @@ $expandSize = 7px .ReactTable position:relative + display: flex + flex-direction: column border: 1px solid alpha(black, .1) * box-sizing: border-box .rt-table + flex: 1 display: flex flex-direction: column align-items: stretch @@ -16,6 +19,7 @@ $expandSize = 7px overflow: auto .rt-thead + flex: 1 0 auto display: flex flex-direction: column -webkit-user-select: none; @@ -91,8 +95,10 @@ $expandSize = 7px margin-top: -10px .rt-tbody + flex: 99999 1 auto display: flex flex-direction: column + overflow: auto // z-index:0 .rt-tr-group border-bottom: solid 1px alpha(black, .05) @@ -105,10 +111,12 @@ $expandSize = 7px .rt-expandable cursor: pointer .rt-tr-group + flex: 1 0 auto display: flex flex-direction: column align-items: stretch .rt-tr + flex: 1 0 auto display: inline-flex .rt-th .rt-td @@ -191,6 +199,7 @@ $expandSize = 7px appearance:none display:block width:100% + height:100% border: 0 border-radius: 3px padding: 6px