react-table-hoc-fixed-columns
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0-beta.2
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.enableStickyPosition = exports.sortColumns = exports.isNotFixed = exports.isRightFixed = exports.isLeftFixed = exports.getColumnId = void 0; | ||
exports.checkErrors = exports.enableStickyPosition = exports.sortColumns = exports.isNotFixed = exports.isRightFixed = exports.isLeftFixed = exports.getColumnId = void 0; | ||
@@ -58,2 +58,34 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
exports.enableStickyPosition = enableStickyPosition; | ||
exports.enableStickyPosition = enableStickyPosition; | ||
var checkErrors = function checkErrors(columns) { | ||
var hasGroups = !!columns.find(function (column) { | ||
return column.columns; | ||
}); | ||
var fixedColumnsWithoutGroup = columns.filter(function (column) { | ||
return column.fixed && !column.columns; | ||
}).map(function (_ref) { | ||
var Header = _ref.Header; | ||
return "'".concat(Header, "'"); | ||
}); | ||
if (hasGroups && fixedColumnsWithoutGroup.length) { | ||
throw new Error("WARNING react-table-hoc-fixed-column:\n \nYour ReactTable has group and fixed columns outside groups, and that will break UI.\n \nYou must place ".concat(fixedColumnsWithoutGroup.join(' and '), " columns into a group (even a group with an empty Header label)\n")); | ||
} | ||
var bugWithUnderColumnsFixed = columns.find(function (parentCol) { | ||
return !parentCol.fixed && parentCol.columns && parentCol.columns.find(function (col) { | ||
return col.fixed; | ||
}); | ||
}); | ||
if (bugWithUnderColumnsFixed) { | ||
var childBugs = bugWithUnderColumnsFixed.columns.find(function (_ref2) { | ||
var fixed = _ref2.fixed; | ||
return fixed; | ||
}); | ||
throw new Error("WARNING react-table-hoc-fixed-column:\n \nYour ReactTable contain columns group with at least one child columns fixed.\n \nWhen ReactTable has columns groups, only columns groups can be fixed\n \nYou must set fixed: 'left' | 'right' for the '".concat(bugWithUnderColumnsFixed.Header, "' column, or remove the fixed property of '").concat(childBugs.Header, "' column.")); | ||
} | ||
}; | ||
exports.checkErrors = checkErrors; |
@@ -92,3 +92,3 @@ "use strict"; | ||
fixed: fixed | ||
}) && 'rthfc-td-fixed-right', isLastFixed && 'rthfc-td-fixed-left-last', isFirstFixed && 'rthfc-td-fixed-right-last'), | ||
}) && 'rthfc-td-fixed-right', isLastFixed && 'rthfc-td-fixed-left-last', isFirstFixed && 'rthfc-td-fixed-right-first'), | ||
headerClassName: (0, _classnames.default)(column.headerClassName, fixed && 'rthfc-th-fixed', (0, _helpers.isLeftFixed)({ | ||
@@ -98,3 +98,3 @@ fixed: fixed | ||
fixed: fixed | ||
}) && 'rthfc-th-fixed-right', (_parentIsLastFixed || parentIsLastFixed && isLastFixed) && 'rthfc-th-fixed-left-last', (_parentIsFirstFixed || parentIsFirstFixed && isFirstFixed) && 'rthfc-th-fixed-right-last'), | ||
}) && 'rthfc-th-fixed-right', (_parentIsLastFixed || parentIsLastFixed && isLastFixed) && 'rthfc-th-fixed-left-last', (_parentIsFirstFixed || parentIsFirstFixed && isFirstFixed) && 'rthfc-th-fixed-right-first'), | ||
columns: column.columns && _this.getColumnsWithFixed(column.columns, fixed, _parentIsLastFixed, _parentIsFirstFixed) | ||
@@ -112,16 +112,3 @@ }); | ||
var hasGroups = !!props.columns.find(function (column) { | ||
return column.columns; | ||
}); | ||
var fixedColumnsWithoutGroup = props.columns.filter(function (column) { | ||
return column.fixed && !column.columns; | ||
}).map(function (_ref) { | ||
var Header = _ref.Header; | ||
return "'".concat(Header, "'"); | ||
}); | ||
if (hasGroups && fixedColumnsWithoutGroup.length) { | ||
console.warn(['WARNING react-table-hoc-fixed-column: ReactTable has fixed columns outside groups.', "For a better UI render, place ".concat(fixedColumnsWithoutGroup.join(' and '), " columns into a group (even a group with an empty Header label)")].join('\n\n')); | ||
} | ||
(0, _helpers.checkErrors)(_this.props.columns); | ||
_this.uniqClassName = (0, _uniqid.default)('rthfc-'); | ||
@@ -128,0 +115,0 @@ _this.onChangePropertyList = { |
@@ -75,17 +75,3 @@ "use strict"; | ||
var hasGroups = !!props.columns.find(function (column) { | ||
return column.columns; | ||
}); | ||
var fixedColumnsWithoutGroup = props.columns.filter(function (column) { | ||
return column.fixed && !column.columns; | ||
}).map(function (_ref2) { | ||
var Header = _ref2.Header; | ||
return "'".concat(Header, "'"); | ||
}); | ||
if (hasGroups && fixedColumnsWithoutGroup.length) { | ||
console.warn(['WARNING react-table-hoc-fixed-column: ReactTable has fixed columns outside groups.', "For a better UI render, place ".concat(fixedColumnsWithoutGroup.join(' and '), " columns into a group (even a group with an empty Header label)")].join('\n\n')); | ||
} // this.tableClassName = getTableClassName(this.props); | ||
(0, _helpers.checkErrors)(_this.props.columns); | ||
_this.columnsWidth = {}; | ||
@@ -165,3 +151,3 @@ _this.uniqClassName = (0, _uniqid.default)('rthfc-'); | ||
fixed: fixed, | ||
className: (0, _classnames.default)(column.className, fixed && 'rthfc-td-fixed', columnIsLeftFixed && 'rthfc-td-fixed-left', columnIsRightFixed && 'rthfc-td-fixed-right', isLastFixed && 'rthfc-td-fixed-left-last', isFirstFixed && 'rthfc-td-fixed-right-last'), | ||
className: (0, _classnames.default)(column.className, fixed && 'rthfc-td-fixed', columnIsLeftFixed && 'rthfc-td-fixed-left', columnIsRightFixed && 'rthfc-td-fixed-right', isLastFixed && 'rthfc-td-fixed-left-last', isFirstFixed && 'rthfc-td-fixed-right-first'), | ||
style: _objectSpread({}, column.style, { | ||
@@ -171,3 +157,3 @@ left: left, | ||
}), | ||
headerClassName: (0, _classnames.default)(column.headerClassName, fixed && 'rthfc-th-fixed', columnIsLeftFixed && 'rthfc-th-fixed-left', columnIsRightFixed && 'rthfc-th-fixed-right', (_parentIsLastFixed || parentIsLastFixed && isLastFixed) && 'rthfc-th-fixed-left-last', (_parentIsFirstFixed || parentIsFirstFixed && isFirstFixed) && 'rthfc-th-fixed-right-last'), | ||
headerClassName: (0, _classnames.default)(column.headerClassName, fixed && 'rthfc-th-fixed', columnIsLeftFixed && 'rthfc-th-fixed-left', columnIsRightFixed && 'rthfc-th-fixed-right', (_parentIsLastFixed || parentIsLastFixed && isLastFixed) && 'rthfc-th-fixed-left-last', (_parentIsFirstFixed || parentIsFirstFixed && isFirstFixed) && 'rthfc-th-fixed-right-first'), | ||
headerStyle: _objectSpread({}, column.headerStyle, { | ||
@@ -174,0 +160,0 @@ left: left, |
{ | ||
"name": "react-table-hoc-fixed-columns", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0-beta.2", | ||
"description": "ReactTable HOC for fixed columns", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
34895
490