New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-table-hoc-fixed-columns

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-table-hoc-fixed-columns - npm Package Compare versions

Comparing version

to
2.3.2

15

lib/scrollEvent/index.js

@@ -73,5 +73,5 @@ "use strict";

_this.getColumnsWithFixed = function (columns, parentIsfixed, parentIsLastFixed, parentIsFirstFixed) {
_this.getColumnsWithFixedFeature = function (columns, columnProps, parentIsfixed, parentIsLastFixed, parentIsFirstFixed) {
return columns.map(function (column, index) {
var defaultColumn = _this.props.column;
var defaultColumn = columnProps;
var fixed = column.fixed || parentIsfixed || false;

@@ -104,3 +104,3 @@ var nextColumn = (0, _helpers.findNextColumnNotHidden)(columns, index);

if (column.columns) {
output.columns = _this.getColumnsWithFixed(column.columns, fixed, _parentIsLastFixed, _parentIsFirstFixed);
output.columns = _this.getColumnsWithFixedFeature(column.columns, columnProps, fixed, _parentIsLastFixed, _parentIsFirstFixed);
}

@@ -112,8 +112,5 @@

_this.getColumns = (0, _helpers.memoize)(function (columns) {
_this.getColumns = (0, _helpers.memoize)(function (columns, columnProps) {
var sortedColumns = (0, _helpers.sortColumns)(columns);
var columnsWithFixed = _this.getColumnsWithFixed(sortedColumns);
return columnsWithFixed;
return _this.getColumnsWithFixedFeature(sortedColumns, columnProps);
});

@@ -192,3 +189,3 @@

className: (0, _classnames.default)(className, 'rthfc', '-se', this.uniqClassName),
columns: this.getColumns(columns),
columns: this.getColumns(columns, this.props.column),
getProps: this.getProps

@@ -195,0 +192,0 @@ }, this.onChangePropertyList));

114

lib/stickyPosition/index.js

@@ -32,2 +32,6 @@ "use strict";

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -37,6 +41,2 @@

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

@@ -50,2 +50,38 @@

_createClass(ReactTableFixedColumns, null, [{
key: "getLeftOffsetColumns",
value: function getLeftOffsetColumns(columns, index, columnsWidth) {
var offset = 0;
for (var i = 0; i < index; i += 1) {
var column = columns[i];
if (column.show !== false) {
var id = (0, _helpers.getColumnId)(column);
var width = columnsWidth[id] || column.width || column.minWidth || 100;
offset += width;
}
}
return offset;
}
}, {
key: "getRightOffsetColumns",
value: function getRightOffsetColumns(columns, index, columnsWidth) {
var offset = 0;
for (var i = index + 1; i < columns.length; i += 1) {
var column = columns[i];
if (column.show !== false) {
var id = (0, _helpers.getColumnId)(column);
var width = columnsWidth[id] || column.width || column.minWidth || 100;
offset += width;
}
}
return offset;
}
}]);
function ReactTableFixedColumns(props) {

@@ -72,18 +108,20 @@ var _this;

value = _ref.value;
_this.columnsWidth[id] = value;
_this.setState(function (prevState) {
return {
columnsWidth: _objectSpread({}, prevState.columnsWidth, _defineProperty({}, id, value))
};
});
});
_this.forceUpdate();
};
_this.getColumns = (0, _helpers.memoize)(function (columns) {
_this.getColumns = (0, _helpers.memoize)(function (columns, columnProps, columnsWidth) {
var sortedColumns = (0, _helpers.sortColumns)(columns);
var columnsWithFixed = _this.getColumnsWithFixed(sortedColumns);
return columnsWithFixed;
return _this.getColumnsWithFixedFeature(sortedColumns, columnProps, columnsWidth);
});
(0, _helpers.checkErrors)(_this.props.columns);
_this.columnsWidth = {};
_this.uniqClassName = _this.props.uniqClassName || (0, _uniqid.default)('rthfc-');
_this.state = {
columnsWidth: {}
};
return _this;

@@ -116,41 +154,7 @@ }

}, {
key: "getLeftOffsetColumns",
value: function getLeftOffsetColumns(columns, index) {
var offset = 0;
for (var i = 0; i < index; i += 1) {
var column = columns[i];
if (column.show !== false) {
var id = (0, _helpers.getColumnId)(column);
var width = this.columnsWidth[id] || column.width || column.minWidth || 100;
offset += width;
}
}
return offset;
}
}, {
key: "getRightOffsetColumns",
value: function getRightOffsetColumns(columns, index) {
var offset = 0;
for (var i = index + 1; i < columns.length; i += 1) {
var column = columns[i];
if (column.show !== false) {
var id = (0, _helpers.getColumnId)(column);
var width = this.columnsWidth[id] || column.width || column.minWidth || 100;
offset += width;
}
}
return offset;
}
}, {
key: "getColumnsWithFixed",
value: function getColumnsWithFixed(columns, parentIsfixed, parentIsLastFixed, parentIsFirstFixed) {
key: "getColumnsWithFixedFeature",
value: function getColumnsWithFixedFeature(columns, columnProps, columnsWidth, parentIsfixed, parentIsLastFixed, parentIsFirstFixed) {
var _this2 = this;
var defaultColumn = this.props.column;
var defaultColumn = columnProps;
return columns.map(function (column, index) {

@@ -174,7 +178,5 @@ var fixed = column.fixed || parentIsfixed || false;

});
var left = columnIsLeftFixed && ReactTableFixedColumns.getLeftOffsetColumns(columns, index, columnsWidth);
var right = columnIsRightFixed && ReactTableFixedColumns.getRightOffsetColumns(columns, index, columnsWidth);
var left = columnIsLeftFixed && _this2.getLeftOffsetColumns(columns, index);
var right = columnIsRightFixed && _this2.getRightOffsetColumns(columns, index);
var output = _objectSpread({}, column, {

@@ -195,3 +197,3 @@ fixed: fixed,

if (column.columns) {
output.columns = _this2.getColumnsWithFixed(column.columns, fixed, _parentIsLastFixed, _parentIsFirstFixed);
output.columns = _this2.getColumnsWithFixedFeature(column.columns, columnProps, columnsWidth, fixed, _parentIsLastFixed, _parentIsFirstFixed);
}

@@ -214,3 +216,3 @@

className: (0, _classnames.default)(className, this.uniqClassName, 'rthfc', '-sp'),
columns: this.getColumns(columns),
columns: this.getColumns(columns, this.props.column, this.state.columnsWidth),
onResizedChange: this.onResizedChange

@@ -217,0 +219,0 @@ }));

{
"name": "react-table-hoc-fixed-columns",
"version": "2.3.1",
"version": "2.3.2",
"description": "ReactTable HOC for fixed columns",

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