Socket
Socket
Sign inDemoInstall

react-base-table

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-base-table - npm Package Compare versions

Comparing version 1.10.0 to 1.10.1

5

CHANGELOG.md

@@ -5,2 +5,7 @@ # CHANGELOG

## v1.10.1 (2020-06-24)
- fix: dynamic rowHeight is not calculated correctly with frozen columns
- fix: dynamic rowHeight is not updated when resizing column
## v1.10.0 (2020-06-22)

@@ -7,0 +12,0 @@

36

es/BaseTable.js

@@ -104,2 +104,5 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";

_this._rowHeightMapBuffer = {};
_this._mainRowHeightMap = {};
_this._leftRowHeightMap = {};
_this._rightRowHeightMap = {};
_this._getRowHeight = _this._getRowHeight.bind(_assertThisInitialized(_this));

@@ -269,2 +272,15 @@ _this._updateRowHeights = debounce(function () {

/**
* Reset cached row heights, should be used only in dynamic mode(estimatedRowHeight is provided)
*/
;
_proto.resetRowHeightCache = function resetRowHeightCache() {
this._resetIndex = null;
this._rowHeightMap = {};
this._rowHeightMapBuffer = {};
this._mainRowHeightMap = {};
this._leftRowHeightMap = {};
this._rightRowHeightMap = {};
}
/**
* Scroll to the specified offset.

@@ -1101,3 +1117,3 @@ * Useful for animating position changes.

if (this.props.estimatedRowHeight && this.props.fixed) {
this.resetColumnWidthCache(false);
this.resetColumnWidthCache();
}

@@ -1157,7 +1173,19 @@

_proto._handleRowHeightMeasured = function _handleRowHeightMeasured(rowKey, size, rowIndex) {
_proto._handleRowHeightMeasured = function _handleRowHeightMeasured(rowKey, size, rowIndex, frozen) {
if (this._resetIndex === null) this._resetIndex = rowIndex;else if (this._resetIndex > rowIndex) this._resetIndex = rowIndex;
if (!this._rowHeightMapBuffer[rowKey] || this._rowHeightMapBuffer[rowKey] < size) {
this._rowHeightMapBuffer[rowKey] = size;
if (this.columnManager.hasFrozenColumns()) {
if (!frozen) {
this._mainRowHeightMap[rowKey] = size;
} else if (frozen === FrozenDirection.RIGHT) {
this._rightRowHeightMap[rowKey] = size;
} else {
this._leftRowHeightMap[rowKey] = size;
}
this._rowHeightMapBuffer[rowKey] = Math.max(this._mainRowHeightMap[rowKey] || 0, this._leftRowHeightMap[rowKey] || 0, this._rightRowHeightMap[rowKey] || 0);
} else {
if (!this._rowHeightMap[rowKey] || this._rowHeightMap[rowKey] !== size) {
this._rowHeightMapBuffer[rowKey] = size;
}
}

@@ -1164,0 +1192,0 @@

5

es/TableRow.js

@@ -140,3 +140,4 @@ import _extends from "@babel/runtime/helpers/extends";

onRowHeightMeasured = _this$props3.onRowHeightMeasured,
rowIndex = _this$props3.rowIndex;
rowIndex = _this$props3.rowIndex,
columns = _this$props3.columns;
var height = this.ref.getBoundingClientRect().height;

@@ -146,3 +147,3 @@ this.setState({

}, function () {
onRowHeightMeasured(rowKey, height, rowIndex);
onRowHeightMeasured(rowKey, height, rowIndex, !columns[0].__placeholder__ && columns[0].frozen);
});

@@ -149,0 +150,0 @@ }

@@ -144,2 +144,5 @@ "use strict";

_this._rowHeightMapBuffer = {};
_this._mainRowHeightMap = {};
_this._leftRowHeightMap = {};
_this._rightRowHeightMap = {};
_this._getRowHeight = _this._getRowHeight.bind((0, _assertThisInitialized2["default"])(_this));

@@ -310,2 +313,16 @@ _this._updateRowHeights = (0, _utils.debounce)(function () {

/**
* Reset cached row heights, should be used only in dynamic mode(estimatedRowHeight is provided)
*/
}, {
key: "resetRowHeightCache",
value: function resetRowHeightCache() {
this._resetIndex = null;
this._rowHeightMap = {};
this._rowHeightMapBuffer = {};
this._mainRowHeightMap = {};
this._leftRowHeightMap = {};
this._rightRowHeightMap = {};
}
/**
* Scroll to the specified offset.

@@ -1173,3 +1190,3 @@ * Useful for animating position changes.

if (this.props.estimatedRowHeight && this.props.fixed) {
this.resetColumnWidthCache(false);
this.resetColumnWidthCache();
}

@@ -1233,7 +1250,19 @@

key: "_handleRowHeightMeasured",
value: function _handleRowHeightMeasured(rowKey, size, rowIndex) {
value: function _handleRowHeightMeasured(rowKey, size, rowIndex, frozen) {
if (this._resetIndex === null) this._resetIndex = rowIndex;else if (this._resetIndex > rowIndex) this._resetIndex = rowIndex;
if (!this._rowHeightMapBuffer[rowKey] || this._rowHeightMapBuffer[rowKey] < size) {
this._rowHeightMapBuffer[rowKey] = size;
if (this.columnManager.hasFrozenColumns()) {
if (!frozen) {
this._mainRowHeightMap[rowKey] = size;
} else if (frozen === _Column.FrozenDirection.RIGHT) {
this._rightRowHeightMap[rowKey] = size;
} else {
this._leftRowHeightMap[rowKey] = size;
}
this._rowHeightMapBuffer[rowKey] = Math.max(this._mainRowHeightMap[rowKey] || 0, this._leftRowHeightMap[rowKey] || 0, this._rightRowHeightMap[rowKey] || 0);
} else {
if (!this._rowHeightMap[rowKey] || this._rowHeightMap[rowKey] !== size) {
this._rowHeightMapBuffer[rowKey] = size;
}
}

@@ -1240,0 +1269,0 @@

@@ -167,3 +167,4 @@ "use strict";

onRowHeightMeasured = _this$props3.onRowHeightMeasured,
rowIndex = _this$props3.rowIndex;
rowIndex = _this$props3.rowIndex,
columns = _this$props3.columns;
var height = this.ref.getBoundingClientRect().height;

@@ -173,3 +174,3 @@ this.setState({

}, function () {
onRowHeightMeasured(rowKey, height, rowIndex);
onRowHeightMeasured(rowKey, height, rowIndex, !columns[0].__placeholder__ && columns[0].frozen);
});

@@ -176,0 +177,0 @@ }

{
"name": "react-base-table",
"version": "1.10.0",
"version": "1.10.1",
"description": "a react table component to display large data set with high performance and flexibility",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc