react-table-hoc-fixed-columns
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.enableStickyPosition = exports.sortColumns = exports.isNotFixed = exports.isRightFixed = exports.isLeftFixed = exports.getColumnId = void 0; | ||
exports.findPrevColumnNotHidden = exports.findNextColumnNotHidden = exports.enableStickyPosition = exports.sortColumns = exports.isNotFixed = exports.isRightFixed = exports.isLeftFixed = exports.getColumnId = void 0; | ||
@@ -58,2 +58,24 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
exports.enableStickyPosition = enableStickyPosition; | ||
exports.enableStickyPosition = enableStickyPosition; | ||
var findNextColumnNotHidden = function findNextColumnNotHidden(columns, currentIndex) { | ||
for (var i = currentIndex + 1; i < columns.length; i += 1) { | ||
var column = columns[i]; | ||
if (column.show !== false) return column; | ||
} | ||
return undefined; | ||
}; | ||
exports.findNextColumnNotHidden = findNextColumnNotHidden; | ||
var findPrevColumnNotHidden = function findPrevColumnNotHidden(columns, currentIndex) { | ||
for (var i = currentIndex - 1; i >= 0; i -= 1) { | ||
var column = columns[i]; | ||
if (column.show !== false) return column; | ||
} | ||
return undefined; | ||
}; | ||
exports.findPrevColumnNotHidden = findPrevColumnNotHidden; |
@@ -80,3 +80,3 @@ "use strict"; | ||
var fixed = column.fixed || parentIsfixed || false; | ||
var nextColumn = columns[index + 1]; | ||
var nextColumn = (0, _helpers.findNextColumnNotHidden)(columns, index); | ||
@@ -86,3 +86,3 @@ var _parentIsLastFixed = fixed && parentIsfixed === undefined && nextColumn && !nextColumn.fixed; | ||
var isLastFixed = fixed && (parentIsfixed ? [true, 'left'].includes(parentIsfixed) && parentIsLastFixed : true) && (parentIsfixed && !nextColumn || !parentIsfixed && nextColumn && !nextColumn.fixed); | ||
var prevColumn = columns[index - 1]; | ||
var prevColumn = (0, _helpers.findPrevColumnNotHidden)(columns, index); | ||
@@ -89,0 +89,0 @@ var _parentIsFirstFixed = fixed && parentIsfixed === undefined && prevColumn && !prevColumn.fixed; |
@@ -117,5 +117,8 @@ "use strict"; | ||
var column = columns[i]; | ||
var id = (0, _helpers.getColumnId)(column); | ||
var width = this.columnsWidth[id] || column.width || column.minWidth || 100; | ||
offset += width; | ||
if (column.show !== false) { | ||
var id = (0, _helpers.getColumnId)(column); | ||
var width = this.columnsWidth[id] || column.width || column.minWidth || 100; | ||
offset += width; | ||
} | ||
} | ||
@@ -132,5 +135,8 @@ | ||
var column = columns[i]; | ||
var id = (0, _helpers.getColumnId)(column); | ||
var width = this.columnsWidth[id] || column.width || column.minWidth || 100; | ||
offset += width; | ||
if (column.show !== false) { | ||
var id = (0, _helpers.getColumnId)(column); | ||
var width = this.columnsWidth[id] || column.width || column.minWidth || 100; | ||
offset += width; | ||
} | ||
} | ||
@@ -147,3 +153,3 @@ | ||
var fixed = column.fixed || parentIsfixed || false; | ||
var nextColumn = columns[index + 1]; | ||
var nextColumn = (0, _helpers.findNextColumnNotHidden)(columns, index); | ||
@@ -153,3 +159,3 @@ var _parentIsLastFixed = fixed && parentIsfixed === undefined && nextColumn && !nextColumn.fixed; | ||
var isLastFixed = fixed && (parentIsfixed ? [true, 'left'].includes(parentIsfixed) && parentIsLastFixed : true) && (parentIsfixed && !nextColumn || !parentIsfixed && nextColumn && !nextColumn.fixed); | ||
var prevColumn = columns[index - 1]; | ||
var prevColumn = (0, _helpers.findPrevColumnNotHidden)(columns, index); | ||
@@ -156,0 +162,0 @@ var _parentIsFirstFixed = fixed && parentIsfixed === undefined && prevColumn && !prevColumn.fixed; |
{ | ||
"name": "react-table-hoc-fixed-columns", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "ReactTable HOC for fixed columns", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -155,2 +155,5 @@ | ||
### ES7 requirement | ||
If your browser doesn't support ES7, please import [es7-shim](https://www.npmjs.com/package/es7-shim). Alternatively, you could just use the [polyfill](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes#Polyfill) for the Array `includes` method. | ||
## Migrate `v0` to `v1` | ||
@@ -157,0 +160,0 @@ For migration to `v0.1.x` to `v1.x.x` , `fixed: true` is equivalent to `fixed: left`, no need to change the value. |
40599
11
583
170