fixed-data-table-2
Advanced tools
Comparing version 0.7.4 to 0.7.5
@@ -373,17 +373,5 @@ 'use strict'; | ||
var scrollToRow = props.scrollToRow; | ||
if (scrollToRow !== undefined && scrollToRow !== null) { | ||
this._rowToScrollTo = scrollToRow; | ||
} | ||
var scrollToColumn = props.scrollToColumn; | ||
if (scrollToColumn !== undefined && scrollToColumn !== null) { | ||
this._columnToScrollTo = scrollToColumn; | ||
} | ||
var viewportHeight = (props.height === undefined ? props.maxHeight : props.height) - (props.headerHeight || 0) - (props.footerHeight || 0) - (props.groupHeaderHeight || 0); | ||
this._scrollHelper = new _FixedDataTableScrollHelper2.default(props.rowsCount, props.rowHeight, viewportHeight, props.rowHeightGetter); | ||
if (props.scrollTop) { | ||
this._scrollHelper.scrollTo(props.scrollTop); | ||
} | ||
this._didScrollStop = (0, _debounceCore2.default)(this._didScrollStop, 200, this); | ||
@@ -444,11 +432,2 @@ | ||
componentWillReceiveProps: function componentWillReceiveProps( /*object*/nextProps) { | ||
var scrollToRow = nextProps.scrollToRow; | ||
if (scrollToRow !== undefined && scrollToRow !== null) { | ||
this._rowToScrollTo = scrollToRow; | ||
} | ||
var scrollToColumn = nextProps.scrollToColumn; | ||
if (scrollToColumn !== undefined && scrollToColumn !== null) { | ||
this._columnToScrollTo = scrollToColumn; | ||
} | ||
var newOverflowX = nextProps.overflowX; | ||
@@ -844,18 +823,13 @@ var newOverflowY = nextProps.overflowY; | ||
var scrollState; | ||
var firstRowIndex = oldState && oldState.firstRowIndex || 0; | ||
var firstRowOffset = oldState && oldState.firstRowOffset || 0; | ||
var scrollX, scrollY, scrollState; | ||
var scrollY = oldState ? oldState.scrollY : 0; | ||
var scrollX = oldState ? oldState.scrollX : 0; | ||
scrollX = oldState ? oldState.scrollX : 0; | ||
if (props.scrollLeft !== this.props.scrollLeft) { | ||
var lastScrollLeft = oldState ? oldState.scrollLeft : 0; | ||
if (props.scrollLeft !== undefined && props.scrollLeft !== lastScrollLeft) { | ||
scrollX = props.scrollLeft; | ||
} | ||
scrollY = oldState ? oldState.scrollY : 0; | ||
if (props.scrollTop !== this.props.scrollTop) { | ||
scrollState = this._scrollHelper.scrollTo(props.scrollTop); | ||
firstRowIndex = scrollState.index; | ||
firstRowOffset = scrollState.offset; | ||
scrollY = scrollState.position; | ||
} | ||
var groupHeaderHeight = useGroupHeader ? props.groupHeaderHeight : 0; | ||
@@ -876,10 +850,18 @@ | ||
if (this._rowToScrollTo !== undefined) { | ||
scrollState = this._scrollHelper.scrollRowIntoView(this._rowToScrollTo); | ||
var lastScrollToRow = oldState ? oldState.scrollToRow : undefined; | ||
if (props.scrollToRow !== lastScrollToRow) { | ||
scrollState = this._scrollHelper.scrollRowIntoView(props.scrollToRow); | ||
firstRowIndex = scrollState.index; | ||
firstRowOffset = scrollState.offset; | ||
scrollY = scrollState.position; | ||
delete this._rowToScrollTo; | ||
} | ||
var lastScrollTop = oldState ? oldState.scrollTop : undefined; | ||
if (props.scrollTop !== lastScrollTop) { | ||
scrollState = this._scrollHelper.scrollTo(props.scrollTop); | ||
firstRowIndex = scrollState.index; | ||
firstRowOffset = scrollState.offset; | ||
scrollY = scrollState.position; | ||
} | ||
var columnResizingData; | ||
@@ -905,6 +887,7 @@ if (props.isColumnResizing) { | ||
if (this._columnToScrollTo !== undefined) { | ||
var lastScrollToColumn = oldState ? oldState.scrollToColumn : undefined; | ||
if (props.scrollToColumn !== null && props.scrollToColumn !== lastScrollToColumn) { | ||
// If selected column is a fixed column, don't scroll | ||
var fixedColumnsCount = columnInfo.bodyFixedColumns.length; | ||
if (this._columnToScrollTo >= fixedColumnsCount) { | ||
if (props.scrollToColumn >= fixedColumnsCount) { | ||
var totalFixedColumnsWidth = 0; | ||
@@ -917,3 +900,3 @@ var i, column; | ||
var scrollableColumnIndex = Math.min(this._columnToScrollTo - fixedColumnsCount, columnInfo.bodyScrollableColumns.length - 1); | ||
var scrollableColumnIndex = Math.min(props.scrollToColumn - fixedColumnsCount, columnInfo.bodyScrollableColumns.length - 1); | ||
@@ -938,3 +921,2 @@ var previousColumnsWidth = 0; | ||
} | ||
delete this._columnToScrollTo; | ||
} | ||
@@ -941,0 +923,0 @@ |
@@ -39,3 +39,3 @@ /** | ||
FixedDataTableRoot.version = '0.7.4'; | ||
FixedDataTableRoot.version = '0.7.5'; | ||
module.exports = FixedDataTableRoot; |
@@ -164,3 +164,3 @@ /** | ||
}); | ||
var columnsShadow = this._renderColumnsShadow(fixedColumnsWidth); | ||
var columnsLeftShadow = this._renderColumnsLeftShadow(fixedColumnsWidth); | ||
var scrollableColumns = _React2.default.createElement(_FixedDataTableCellGroup2.default, { | ||
@@ -184,2 +184,4 @@ key: 'scrollable_cells', | ||
}); | ||
var scrollableColumnsWidth = this._getColumnsWidth(this.props.scrollableColumns); | ||
var columnsRightShadow = this._renderColumnsRightShadow(fixedColumnsWidth + scrollableColumnsWidth); | ||
@@ -201,4 +203,5 @@ return _React2.default.createElement( | ||
scrollableColumns, | ||
columnsShadow | ||
) | ||
columnsLeftShadow | ||
), | ||
columnsRightShadow | ||
); | ||
@@ -213,12 +216,19 @@ }, | ||
}, | ||
_renderColumnsShadow: function _renderColumnsShadow( /*number*/left) /*?object*/{ | ||
if (left > 0) { | ||
var className = (0, _cx2.default)({ | ||
'fixedDataTableRowLayout/fixedColumnsDivider': true, | ||
'fixedDataTableRowLayout/columnsShadow': this.props.scrollLeft > 0, | ||
'public/fixedDataTableRow/fixedColumnsDivider': true, | ||
'public/fixedDataTableRow/columnsShadow': this.props.scrollLeft > 0 | ||
}); | ||
_renderColumnsLeftShadow: function _renderColumnsLeftShadow( /*number*/left) /*?object*/{ | ||
var className = (0, _cx2.default)({ | ||
'fixedDataTableRowLayout/fixedColumnsDivider': left > 0, | ||
'fixedDataTableRowLayout/columnsShadow': this.props.scrollLeft > 0, | ||
'public/fixedDataTableRow/fixedColumnsDivider': left > 0, | ||
'public/fixedDataTableRow/columnsShadow': this.props.scrollLeft > 0 | ||
}); | ||
var style = { | ||
left: left, | ||
height: this.props.height | ||
}; | ||
return _React2.default.createElement('div', { className: className, style: style }); | ||
}, | ||
_renderColumnsRightShadow: function _renderColumnsRightShadow( /*number*/totalWidth) /*?object*/{ | ||
if (Math.ceil(this.props.scrollLeft + this.props.width) < totalWidth) { | ||
var className = (0, _cx2.default)('fixedDataTableRowLayout/columnsShadow', 'fixedDataTableRowLayout/columnsRightShadow', 'public/fixedDataTableRow/columnsShadow', 'public/fixedDataTableRow/columnsRightShadow'); | ||
var style = { | ||
left: left, | ||
height: this.props.height | ||
@@ -225,0 +235,0 @@ }; |
{ | ||
"name": "fixed-data-table-2", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"description": "A React table component designed to allow presenting thousands of rows of data.", | ||
@@ -32,2 +32,3 @@ "main": "main.js", | ||
"mocha": "^2.5.3", | ||
"mocha-loader": "^1.0.0", | ||
"mocha-webpack": "^0.4.0", | ||
@@ -34,0 +35,0 @@ "null-loader": "^0.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3050282
100
23758
35