From 035b5168dc7b173a2d404907456487f0f448238d Mon Sep 17 00:00:00 2001 From: wanghaoo Date: Wed, 26 Dec 2018 16:33:36 +0800 Subject: [PATCH] 1 --- build/Table.js | 8 ++++---- build/TableRow.js | 3 ++- src/Table.js | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/build/Table.js b/build/Table.js index 49334a3..9fdeb1d 100644 --- a/build/Table.js +++ b/build/Table.js @@ -635,16 +635,17 @@ var Table = function (_Component) { rst.push(_react2["default"].createElement(_TableRow2["default"], { height: props.lazyLoad.preHeight, columns: [], className: '', store: this.store, visible: true })); } var lazyCurrentIndex = props.lazyLoad && props.lazyLoad.startIndex ? props.lazyLoad.startIndex : 0; - var expandedContentHeight = 0; + for (var i = 0; i < data.length; i++) { var record = data[i]; var key = this.getRowKey(record, i); var childrenColumn = record[childrenColumnName]; var isRowExpanded = this.isRowExpanded(record, i); var expandedRowContent = void 0; + var expandedContentHeight = 0; if (expandedRowRender && isRowExpanded) { expandedRowContent = expandedRowRender(record, i, indent); - expandedContentHeight = parseInt(expandedRowContent.props.style ? expandedRowContent.props.style.height : 0); + expandedContentHeight = parseInt(expandedRowContent.props.style && expandedRowContent.props.style.height ? expandedRowContent.props.style.height : 0); } //只有当使用expandedRowRender参数的时候才去识别isHiddenExpandIcon(隐藏行展开的icon) if (expandedRowRender && typeof props.haveExpandIcon == 'function') { @@ -1144,8 +1145,7 @@ var Table = function (_Component) { } this.lastScrollTop = e.target.scrollTop; if (handleScroll) { - var scrollTop = e.target.scrollTop; - (0, _utils.debounce)(handleScroll(scrollTop), 200); + (0, _utils.debounce)(handleScroll(this.lastScrollTop), 500); } } diff --git a/build/TableRow.js b/build/TableRow.js index ab70bc5..67ce338 100644 --- a/build/TableRow.js +++ b/build/TableRow.js @@ -141,7 +141,8 @@ var TableRow = function (_Component) { TableRow.prototype.setRowHeight = function setRowHeight() { var _props3 = this.props, setRowHeight = _props3.setRowHeight, - expandedContentHeight = _props3.expandedContentHeight, + _props3$expandedConte = _props3.expandedContentHeight, + expandedContentHeight = _props3$expandedConte === undefined ? 0 : _props3$expandedConte, _props3$lazyCurrentIn = _props3.lazyCurrentIndex, lazyCurrentIndex = _props3$lazyCurrentIn === undefined ? 0 : _props3$lazyCurrentIn, fixed = _props3.fixed; diff --git a/src/Table.js b/src/Table.js index e61cb5c..321e670 100644 --- a/src/Table.js +++ b/src/Table.js @@ -508,13 +508,14 @@ class Table extends Component { ) } const lazyCurrentIndex = props.lazyLoad && props.lazyLoad.startIndex ?props.lazyLoad.startIndex :0; - let expandedContentHeight = 0; + for (let i = 0; i < data.length; i++) { const record = data[i]; const key = this.getRowKey(record, i); const childrenColumn = record[childrenColumnName]; const isRowExpanded = this.isRowExpanded(record, i); let expandedRowContent; + let expandedContentHeight = 0; if (expandedRowRender && isRowExpanded) { expandedRowContent = expandedRowRender(record, i, indent); expandedContentHeight = parseInt(expandedRowContent.props.style && expandedRowContent.props.style.height?expandedRowContent.props.style.height:0);