rsuite-table
Advanced tools
Comparing version 3.8.3 to 3.8.4
@@ -0,1 +1,5 @@ | ||
# 3.8.4 | ||
- Fixed an issue where `scrollTop` would not work | ||
# 3.8.3 | ||
@@ -2,0 +6,0 @@ |
@@ -606,3 +606,3 @@ 'use strict'; | ||
prevProps.height !== height || prevProps.data !== this.props.data) && this.scrollY !== 0) { | ||
this.scrollTop(Math.abs(this.scrollY) + prevProps.height - headerHeight); | ||
this.scrollTop(Math.abs(this.scrollY)); | ||
this.updatePosition(); | ||
@@ -624,3 +624,3 @@ } | ||
if (Math.abs(this.scrollY) + height - headerHeight > nextContentHeight + _constants.SCROLLBAR_WIDTH) { | ||
this.scrollTop(nextContentHeight + _constants.SCROLLBAR_WIDTH); | ||
this.scrollTop(this.scrollY); | ||
} | ||
@@ -1534,23 +1534,6 @@ } | ||
var top = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; | ||
var _props18 = _this4.props, | ||
height = _props18.height, | ||
headerHeight = _props18.headerHeight; | ||
var contentHeight = _this4.state.contentHeight; | ||
var scrollY = Math.max(0, top - (height - headerHeight)); | ||
_this4.scrollY = -scrollY; | ||
if (_this4.scrollbarY) { | ||
var y = 0; | ||
if (top !== 0) { | ||
// 滚动条的高度 | ||
var scrollbarHeight = Math.max((height - headerHeight) / (contentHeight + _constants.SCROLLBAR_WIDTH) * (height - headerHeight), _constants.SCROLLBAR_MIN_WIDTH); | ||
y = Math.max(0, top / (contentHeight + _constants.SCROLLBAR_WIDTH) * (height - headerHeight) - scrollbarHeight); | ||
} | ||
_this4.scrollbarY.resetScrollBarPosition(y); | ||
} | ||
_this4.setState({ | ||
scrollY: -scrollY | ||
}); | ||
_this4.scrollY = -top; | ||
_this4.scrollbarY && _this4.scrollbarY.resetScrollBarPosition(top); | ||
_this4.updatePosition(); | ||
}; | ||
@@ -1557,0 +1540,0 @@ |
{ | ||
"name": "rsuite-table", | ||
"version": "3.8.3", | ||
"version": "3.8.4", | ||
"description": "A React table component", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -22,3 +22,3 @@ // @flow | ||
import Scrollbar from './Scrollbar'; | ||
import { SCROLLBAR_MIN_WIDTH, SCROLLBAR_WIDTH, CELL_PADDING_HEIGHT } from './constants'; | ||
import { SCROLLBAR_WIDTH, CELL_PADDING_HEIGHT } from './constants'; | ||
import { | ||
@@ -863,3 +863,3 @@ getTotalByColumns, | ||
) { | ||
this.scrollTop(Math.abs(this.scrollY) + prevProps.height - headerHeight); | ||
this.scrollTop(Math.abs(this.scrollY)); | ||
this.updatePosition(); | ||
@@ -881,3 +881,3 @@ } | ||
if (Math.abs(this.scrollY) + height - headerHeight > nextContentHeight + SCROLLBAR_WIDTH) { | ||
this.scrollTop(nextContentHeight + SCROLLBAR_WIDTH); | ||
this.scrollTop(this.scrollY); | ||
} | ||
@@ -891,26 +891,5 @@ } | ||
scrollTop = (top: number = 0) => { | ||
const { height, headerHeight } = this.props; | ||
const { contentHeight } = this.state; | ||
const scrollY = Math.max(0, top - (height - headerHeight)); | ||
this.scrollY = -scrollY; | ||
if (this.scrollbarY) { | ||
let y = 0; | ||
if (top !== 0) { | ||
// 滚动条的高度 | ||
const scrollbarHeight = Math.max( | ||
((height - headerHeight) / (contentHeight + SCROLLBAR_WIDTH)) * (height - headerHeight), | ||
SCROLLBAR_MIN_WIDTH | ||
); | ||
y = Math.max( | ||
0, | ||
(top / (contentHeight + SCROLLBAR_WIDTH)) * (height - headerHeight) - scrollbarHeight | ||
); | ||
} | ||
this.scrollbarY.resetScrollBarPosition(y); | ||
} | ||
this.setState({ | ||
scrollY: -scrollY | ||
}); | ||
this.scrollY = -top; | ||
this.scrollbarY && this.scrollbarY.resetScrollBarPosition(top); | ||
this.updatePosition(); | ||
}; | ||
@@ -917,0 +896,0 @@ |
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
253997
5272