|
@@ -27,7 +27,7 @@ export interface SimpleScrollGridSection extends SectionConfig {
|
|
|
|
|
|
|
|
interface SimpleScrollGridState {
|
|
interface SimpleScrollGridState {
|
|
|
shrinkWidth: number | null
|
|
shrinkWidth: number | null
|
|
|
- forceYScrollbars: boolean
|
|
|
|
|
|
|
+ forceYScrollbars: boolean | null
|
|
|
scrollerClientWidths: { [index: string]: number }
|
|
scrollerClientWidths: { [index: string]: number }
|
|
|
scrollerClientHeights: { [index: string]: number }
|
|
scrollerClientHeights: { [index: string]: number }
|
|
|
sizingId: string
|
|
sizingId: string
|
|
@@ -41,9 +41,9 @@ export default class SimpleScrollGrid extends BaseComponent<SimpleScrollGridProp
|
|
|
scrollerRefs = new RefMap<Scroller>()
|
|
scrollerRefs = new RefMap<Scroller>()
|
|
|
scrollerElRefs = new RefMap<HTMLElement, [ChunkConfig]>(this._handleScrollerEl.bind(this))
|
|
scrollerElRefs = new RefMap<HTMLElement, [ChunkConfig]>(this._handleScrollerEl.bind(this))
|
|
|
|
|
|
|
|
- state = {
|
|
|
|
|
|
|
+ state: SimpleScrollGridState = {
|
|
|
shrinkWidth: null,
|
|
shrinkWidth: null,
|
|
|
- forceYScrollbars: false,
|
|
|
|
|
|
|
+ forceYScrollbars: null,
|
|
|
scrollerClientWidths: {},
|
|
scrollerClientWidths: {},
|
|
|
scrollerClientHeights: {},
|
|
scrollerClientHeights: {},
|
|
|
sizingId: ''
|
|
sizingId: ''
|
|
@@ -93,10 +93,14 @@ export default class SimpleScrollGrid extends BaseComponent<SimpleScrollGridProp
|
|
|
|
|
|
|
|
let { state } = this
|
|
let { state } = this
|
|
|
|
|
|
|
|
- let needsYScrolling = getNeedsYScrolling(this.props, sectionConfig, chunkConfig) // TODO: do lazily
|
|
|
|
|
- let overflowY: OverflowValue = state.forceYScrollbars ? 'scroll' : (needsYScrolling ? 'auto' : 'hidden')
|
|
|
|
|
|
|
+ let needsYScrolling = getAllowYScrolling(this.props, sectionConfig, chunkConfig) // TODO: do lazily
|
|
|
let vGrow = getChunkVGrow(this.props, sectionConfig, chunkConfig)
|
|
let vGrow = getChunkVGrow(this.props, sectionConfig, chunkConfig)
|
|
|
|
|
|
|
|
|
|
+ let overflowY: OverflowValue =
|
|
|
|
|
+ state.forceYScrollbars === true ? 'scroll' :
|
|
|
|
|
+ (state.forceYScrollbars === false || !needsYScrolling) ? 'hidden' :
|
|
|
|
|
+ 'auto'
|
|
|
|
|
+
|
|
|
let content = renderChunkContent(sectionConfig, chunkConfig, {
|
|
let content = renderChunkContent(sectionConfig, chunkConfig, {
|
|
|
tableColGroupNode: microColGroupNode,
|
|
tableColGroupNode: microColGroupNode,
|
|
|
tableMinWidth: '',
|
|
tableMinWidth: '',
|
|
@@ -150,9 +154,9 @@ export default class SimpleScrollGrid extends BaseComponent<SimpleScrollGridProp
|
|
|
let sizingId = guid()
|
|
let sizingId = guid()
|
|
|
this.setState({
|
|
this.setState({
|
|
|
sizingId,
|
|
sizingId,
|
|
|
- shrinkWidth: // will create each chunk's <colgroup>
|
|
|
|
|
- hasShrinkWidth(this.props.cols) ?
|
|
|
|
|
- computeShrinkWidth(this.scrollerElRefs.getAll())
|
|
|
|
|
|
|
+ shrinkWidth: // will create each chunk's <colgroup>. TODO: precompute hasShrinkWidth
|
|
|
|
|
+ hasShrinkWidth(this.props.cols)
|
|
|
|
|
+ ? computeShrinkWidth(this.scrollerElRefs.getAll())
|
|
|
: 0
|
|
: 0
|
|
|
}, () => {
|
|
}, () => {
|
|
|
if (sizingId === this.state.sizingId) {
|
|
if (sizingId === this.state.sizingId) {
|