fixed-data-table-2
Advanced tools
Comparing version 1.0.0-beta.11 to 1.0.0-beta.12
@@ -28,2 +28,6 @@ /** | ||
var _clamp = require('lodash/clamp'); | ||
var _clamp2 = _interopRequireDefault(_clamp); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -57,9 +61,6 @@ | ||
// if scrollX changed due to scrollLeft or scrollToColumn, then set scrollJumpedX | ||
var scrollJumpedX = scrollX != state.scrollX; | ||
var _columnWidths = (0, _columnWidths6.default)(state), | ||
maxScrollX = _columnWidths.maxScrollX; | ||
scrollX = Math.min(scrollX, maxScrollX); | ||
scrollX = (0, _clamp2.default)(scrollX, 0, maxScrollX); | ||
@@ -70,2 +71,4 @@ // isColumnResizing should be overwritten by value from props if available | ||
var scrollJumpedX = scrollX != state.scrollX; | ||
return _extends({}, state, { | ||
@@ -72,0 +75,0 @@ columnResizingData: columnResizingData, |
@@ -22,2 +22,6 @@ /** | ||
var _clamp = require('lodash/clamp'); | ||
var _clamp2 = _interopRequireDefault(_clamp); | ||
var _updateRowHeight = require('./updateRowHeight'); | ||
@@ -53,2 +57,3 @@ | ||
* lastIndex: number, | ||
* scrollJumpedY: boolean, | ||
* }} scrollAnchor | ||
@@ -88,7 +93,9 @@ * @return {!Object} The updated state object | ||
} | ||
scrollY = Math.min(scrollY, maxScrollY); | ||
var scrollJumpedY = scrollAnchor.scrollJumpedY === true && scrollY !== state.scrollY; | ||
scrollY = (0, _clamp2.default)(scrollY, 0, maxScrollY); | ||
return _extends(newState, { | ||
maxScrollY: maxScrollY, | ||
scrollY: scrollY | ||
scrollY: scrollY, | ||
scrollJumpedY: scrollJumpedY | ||
}); | ||
@@ -95,0 +102,0 @@ } |
@@ -55,2 +55,6 @@ 'use strict'; | ||
var _isNaN = require('lodash/isNaN'); | ||
var _isNaN2 = _interopRequireDefault(_isNaN); | ||
var _joinClasses = require('./joinClasses'); | ||
@@ -415,21 +419,35 @@ | ||
} | ||
}, _this._didScrollJump = function ( /* ?object */nextProps) { | ||
var _ref2 = nextProps || _this.props, | ||
firstRowIndex = _ref2.firstRowIndex, | ||
onScrollEnd = _ref2.onScrollEnd, | ||
scrollActions = _ref2.scrollActions, | ||
scrollX = _ref2.scrollX, | ||
scrollY = _ref2.scrollY, | ||
scrollJumpedX = _ref2.scrollJumpedX, | ||
scrollJumpedY = _ref2.scrollJumpedY, | ||
onHorizontalScroll = _ref2.onHorizontalScroll, | ||
onVerticalScroll = _ref2.onVerticalScroll; | ||
}, _this._didControlledScroll = function ( /* !object */nextProps) { | ||
var firstRowIndex = nextProps.firstRowIndex, | ||
onScrollStart = nextProps.onScrollStart, | ||
onScrollEnd = nextProps.onScrollEnd, | ||
scrollActions = nextProps.scrollActions, | ||
scrollX = nextProps.scrollX, | ||
scrollY = nextProps.scrollY, | ||
scrollJumpedX = nextProps.scrollJumpedX, | ||
scrollJumpedY = nextProps.scrollJumpedY, | ||
onHorizontalScroll = nextProps.onHorizontalScroll, | ||
onVerticalScroll = nextProps.onVerticalScroll, | ||
ownerHeight = nextProps.tableSize.ownerHeight; | ||
var _this$props8 = _this.props, | ||
oldFirstRowIndex = _this$props8.firstRowIndex, | ||
oldScrollX = _this$props8.scrollX, | ||
oldScrollY = _this$props8.scrollY, | ||
oldOwnerHeight = _this$props8.tableSize.ownerHeight; | ||
// no jump happened, so just return | ||
// we have an extra check on NaN because (NaN !== NaN) | ||
var ownerHeightChanged = ownerHeight !== oldOwnerHeight && !((0, _isNaN2.default)(ownerHeight) && (0, _isNaN2.default)(oldOwnerHeight)); | ||
if (!scrollJumpedX && !scrollJumpedY) { | ||
// Only check for owner height changes if no scroll jump occurred. This prevents the scroll handlers from | ||
// being called when an owner height change and scroll jump occurs in the same update. | ||
if (!scrollJumpedX && !scrollJumpedY && !ownerHeightChanged) { | ||
return; | ||
} | ||
// any jump must have happened, so call onScrollStart | ||
if (onScrollStart) { | ||
onScrollStart(oldScrollX, oldScrollY, oldFirstRowIndex); | ||
} | ||
if (scrollJumpedX) { | ||
@@ -449,10 +467,12 @@ scrollActions.jumpScrollX(); | ||
} | ||
return true; | ||
}, _this._didScrollStopSync = function () { | ||
var _this$props8 = _this.props, | ||
firstRowIndex = _this$props8.firstRowIndex, | ||
onScrollEnd = _this$props8.onScrollEnd, | ||
scrollActions = _this$props8.scrollActions, | ||
scrollX = _this$props8.scrollX, | ||
scrollY = _this$props8.scrollY, | ||
scrolling = _this$props8.scrolling; | ||
var _this$props9 = _this.props, | ||
firstRowIndex = _this$props9.firstRowIndex, | ||
onScrollEnd = _this$props9.onScrollEnd, | ||
scrollActions = _this$props9.scrollActions, | ||
scrollX = _this$props9.scrollX, | ||
scrollY = _this$props9.scrollY, | ||
scrolling = _this$props9.scrolling; | ||
@@ -550,9 +570,3 @@ | ||
value: function componentWillReceiveProps( /*object*/nextProps) { | ||
// In the case of controlled scrolling, notify. | ||
if (this.props.tableSize.ownerHeight !== nextProps.tableSize.ownerHeight || this.props.scrollTop !== nextProps.scrollTop || this.props.scrollLeft !== nextProps.scrollLeft) { | ||
this._didScrollStart(); | ||
} | ||
this._didScrollJump(nextProps); | ||
this._didControlledScroll(nextProps); | ||
} | ||
@@ -788,2 +802,9 @@ }, { | ||
/* | ||
A controlled scroll can occur due to a scroll jump or a change in owner height. | ||
This function also resets the jump state if any jump had occurred. | ||
Handlers onScrollStart, onScrollEnd, onHorizontalScroll, and onVerticalScroll are called appropriately. | ||
*/ | ||
// We need two versions of this function, one to finish up synchronously (for | ||
@@ -790,0 +811,0 @@ // example, in componentWillUnmount), and a debounced version for normal |
@@ -39,3 +39,3 @@ /** | ||
FixedDataTableRoot.version = '1.0.0-beta.11'; | ||
FixedDataTableRoot.version = '1.0.0-beta.12'; | ||
module.exports = FixedDataTableRoot; |
@@ -178,4 +178,2 @@ /** | ||
_newState.scrollJumpedY = _scrollAnchor.didScrollToRow; | ||
_newState = _columnStateHelper2.default.initialize(_newState, newProps, oldProps); | ||
@@ -182,0 +180,0 @@ |
@@ -51,3 +51,3 @@ /** | ||
* changed: boolean, | ||
* didScrollToRow: (boolean|undefined), | ||
* scrollJumpedY: boolean, | ||
* }} | ||
@@ -58,7 +58,10 @@ */ | ||
var scrollAnchor = scrollToRow(state, newProps.scrollToRow); | ||
return (0, _set2.default)(scrollAnchor, 'didScrollToRow', scrollAnchor.changed); | ||
return (0, _set2.default)(scrollAnchor, 'scrollJumpedY', scrollAnchor.changed); | ||
} | ||
if (newProps.scrollTop !== undefined && newProps.scrollTop !== null && (!oldProps || newProps.scrollTop !== oldProps.scrollTop)) { | ||
return scrollTo(state, newProps.scrollTop); | ||
var _scrollAnchor = scrollTo(state, newProps.scrollTop); | ||
// 'changed' might give false positives to scrollJumpedY, | ||
// but that's fine as the final value is determined by computeRenderedRows. | ||
return (0, _set2.default)(_scrollAnchor, 'scrollJumpedY', _scrollAnchor.changed); | ||
} | ||
@@ -70,3 +73,4 @@ | ||
lastIndex: undefined, | ||
changed: false | ||
changed: false, | ||
scrollJumpedY: false | ||
}; | ||
@@ -73,0 +77,0 @@ } |
{ | ||
"name": "fixed-data-table-2", | ||
"version": "1.0.0-beta.11", | ||
"version": "1.0.0-beta.12", | ||
"description": "A React table component designed to allow presenting thousands of rows of data.", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -241,2 +241,3 @@ /** | ||
scrollX: 400, | ||
scrollJumpedX: true, | ||
})); | ||
@@ -243,0 +244,0 @@ }); |
@@ -51,2 +51,3 @@ /** | ||
scrollContentHeight: 10000, | ||
scrollJumpedY: false, | ||
}; | ||
@@ -53,0 +54,0 @@ }); |
@@ -40,2 +40,3 @@ /** | ||
changed: true, | ||
scrollJumpedY: true, | ||
}); | ||
@@ -51,2 +52,3 @@ }); | ||
changed: true, | ||
scrollJumpedY: true, | ||
}); | ||
@@ -62,2 +64,3 @@ }); | ||
changed: true, | ||
scrollJumpedY: true, | ||
}); | ||
@@ -75,2 +78,3 @@ }); | ||
changed: true, | ||
scrollJumpedY: true, | ||
}); | ||
@@ -109,3 +113,3 @@ }); | ||
changed: true, | ||
didScrollToRow: true, | ||
scrollJumpedY: true, | ||
}); | ||
@@ -123,3 +127,3 @@ }); | ||
changed: true, | ||
didScrollToRow: true, | ||
scrollJumpedY: true, | ||
}); | ||
@@ -139,3 +143,3 @@ }); | ||
changed: false, | ||
didScrollToRow: false, | ||
scrollJumpedY: false, | ||
}); | ||
@@ -155,3 +159,3 @@ }); | ||
changed: true, | ||
didScrollToRow: true, | ||
scrollJumpedY: true, | ||
}); | ||
@@ -169,3 +173,3 @@ }); | ||
changed: true, | ||
didScrollToRow: true, | ||
scrollJumpedY: true, | ||
}); | ||
@@ -183,3 +187,3 @@ }); | ||
changed: true, | ||
didScrollToRow: true, | ||
scrollJumpedY: true, | ||
}); | ||
@@ -186,0 +190,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
1639818
136
28663