Skip to content

Commit

Permalink
chore(release): 2.2.0 [skip ci]
Browse files Browse the repository at this point in the history
# [2.2.0](v2.1.0...v2.2.0) (2019-08-20)

### Features

* add arbitrary full length row support ([b683fe7](b683fe7))
  • Loading branch information
semantic-release-bot committed Aug 20, 2019
1 parent b683fe7 commit d061ce4
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 39 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [2.2.0](https://github.com/ClearC2/c2-table/compare/v2.1.0...v2.2.0) (2019-08-20)


### Features

* add arbitrary full length row support ([b683fe7](https://github.com/ClearC2/c2-table/commit/b683fe7))

# [2.1.0](https://github.com/ClearC2/c2-table/compare/v2.0.0...v2.1.0) (2019-04-26)


Expand Down
61 changes: 47 additions & 14 deletions dist/cjs/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,9 @@ function (_Component5) {
children = _this$props3.children,
rowId = _this$props3.rowId,
onExpand = _this$props3.onExpand,
onEmpty = _this$props3.onEmpty;
onEmpty = _this$props3.onEmpty,
isFullLength = _this$props3.isFullLength,
fullLengthCell = _this$props3.fullLengthCell;
var tableId = this.props.id;
var columns = flattenColumns(children);
var data = this.props.data || [];
Expand All @@ -512,16 +514,27 @@ function (_Component5) {

var id = getRowId(rowId, row, index);
var rId = "".concat(tableId, "-").concat(id);
rows.push(_react.default.createElement("tr", {
key: "tr-".concat(rId),
id: "tr-".concat(rId),
className: rowClassName
}, onExpand ? _this6.expandCell(row, index) : null, columns.map(function (column) {
return _react.default.createElement("td", {
key: "td-".concat(rId, "-").concat(column.props.id),
className: _this6.cellClassName(column, row, index)
}, tdContent(column, row, index));
})));

if (isFullLength && isFullLength(row, index)) {
rows.push(_react.default.createElement("tr", {
key: "tr-".concat(rId),
id: "tr-".concat(rId),
className: rowClassName
}, _react.default.createElement("td", {
colSpan: columns.length + (onExpand ? 1 : 0)
}, fullLengthCell(row, index))));
} else {
rows.push(_react.default.createElement("tr", {
key: "tr-".concat(rId),
id: "tr-".concat(rId),
className: rowClassName
}, onExpand ? _this6.expandCell(row, index) : null, columns.map(function (column) {
return _react.default.createElement("td", {
key: "td-".concat(rId, "-").concat(column.props.id),
className: _this6.cellClassName(column, row, index)
}, tdContent(column, row, index));
})));
}

if (onExpand && _this6.state.expanded[id]) {
rows.push(_react.default.createElement("tr", {
Expand Down Expand Up @@ -564,7 +577,9 @@ _defineProperty(Tbody, "propTypes", {
collapsedIcon: _propTypes.default.any,
expanded: _propTypes.default.array,
onEmpty: _propTypes.default.node,
rowClassName: StringOrFunc
rowClassName: StringOrFunc,
isFullLength: _propTypes.default.func,
fullLengthCell: _propTypes.default.func
});

function getRowId(rowId, row, index) {
Expand Down Expand Up @@ -618,13 +633,16 @@ function (_Component6) {
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this7)), "state", {});

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this7)), "setOrderColumn", function (column) {
if (!_this7.props.sortEnabled) return;

_this7.setState({
orderColumn: column
});
});

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this7)), "setOrderDir", function () {
var dir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'desc';
if (!_this7.props.sortEnabled) return;

_this7.setState({
orderDir: dir
Expand Down Expand Up @@ -713,7 +731,7 @@ function (_Component6) {
children: this.props.children,
onExpand: this.props.onExpand,
expandClassName: this.props.expandClassName,
clickableClass: this.props.clickableClass,
clickableClass: this.props.sortEnabled ? this.props.clickableClass : 'c2-table-disabled',
sortDescIcon: this.props.sortDescIcon,
sortAscIcon: this.props.sortAscIcon,
onSort: this.props.onSort
Expand All @@ -729,6 +747,8 @@ function (_Component6) {
expanded: this.props.expanded,
onEmpty: this.props.onEmpty,
rowClassName: this.props.rowClassName,
isFullLength: this.props.isFullLength,
fullLengthCell: this.props.fullLengthCell,
data: pagedData
}), _react.default.createElement(Tfoot, {
children: this.props.children,
Expand Down Expand Up @@ -759,6 +779,9 @@ _defineProperty(Table, "propTypes", {
/** The default column direction */
defaultOrderDir: _propTypes.default.oneOf(['asc', 'desc']),

/** If sorting should be enabled */
sortEnabled: _propTypes.default.bool,

/** Columns/ColumnGroups */
children: ColumnOrColumnGroup,

Expand Down Expand Up @@ -805,7 +828,17 @@ _defineProperty(Table, "propTypes", {
sortAscIcon: _propTypes.default.any,

/** Function that is called on sort, (columnId, dir) => {} */
onSort: _propTypes.default.func
onSort: _propTypes.default.func,

/** Function that receives the row object and should bool for is full length */
isFullLength: _propTypes.default.func,

/** Full length cell renderer */
fullLengthCell: _propTypes.default.func
});

_defineProperty(Table, "defaultProps", {
sortEnabled: true
});

var Tfoot =
Expand Down
61 changes: 47 additions & 14 deletions dist/es/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@ function (_Component5) {
children = _this$props3.children,
rowId = _this$props3.rowId,
onExpand = _this$props3.onExpand,
onEmpty = _this$props3.onEmpty;
onEmpty = _this$props3.onEmpty,
isFullLength = _this$props3.isFullLength,
fullLengthCell = _this$props3.fullLengthCell;
var tableId = this.props.id;
var columns = flattenColumns(children);
var data = this.props.data || [];
Expand All @@ -488,16 +490,27 @@ function (_Component5) {

var id = getRowId(rowId, row, index);
var rId = "".concat(tableId, "-").concat(id);
rows.push(React.createElement("tr", {
key: "tr-".concat(rId),
id: "tr-".concat(rId),
className: rowClassName
}, onExpand ? _this6.expandCell(row, index) : null, columns.map(function (column) {
return React.createElement("td", {
key: "td-".concat(rId, "-").concat(column.props.id),
className: _this6.cellClassName(column, row, index)
}, tdContent(column, row, index));
})));

if (isFullLength && isFullLength(row, index)) {
rows.push(React.createElement("tr", {
key: "tr-".concat(rId),
id: "tr-".concat(rId),
className: rowClassName
}, React.createElement("td", {
colSpan: columns.length + (onExpand ? 1 : 0)
}, fullLengthCell(row, index))));
} else {
rows.push(React.createElement("tr", {
key: "tr-".concat(rId),
id: "tr-".concat(rId),
className: rowClassName
}, onExpand ? _this6.expandCell(row, index) : null, columns.map(function (column) {
return React.createElement("td", {
key: "td-".concat(rId, "-").concat(column.props.id),
className: _this6.cellClassName(column, row, index)
}, tdContent(column, row, index));
})));
}

if (onExpand && _this6.state.expanded[id]) {
rows.push(React.createElement("tr", {
Expand Down Expand Up @@ -540,7 +553,9 @@ _defineProperty(Tbody, "propTypes", {
collapsedIcon: PropTypes.any,
expanded: PropTypes.array,
onEmpty: PropTypes.node,
rowClassName: StringOrFunc
rowClassName: StringOrFunc,
isFullLength: PropTypes.func,
fullLengthCell: PropTypes.func
});

function getRowId(rowId, row, index) {
Expand Down Expand Up @@ -594,13 +609,16 @@ function (_Component6) {
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this7)), "state", {});

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this7)), "setOrderColumn", function (column) {
if (!_this7.props.sortEnabled) return;

_this7.setState({
orderColumn: column
});
});

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this7)), "setOrderDir", function () {
var dir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'desc';
if (!_this7.props.sortEnabled) return;

_this7.setState({
orderDir: dir
Expand Down Expand Up @@ -689,7 +707,7 @@ function (_Component6) {
children: this.props.children,
onExpand: this.props.onExpand,
expandClassName: this.props.expandClassName,
clickableClass: this.props.clickableClass,
clickableClass: this.props.sortEnabled ? this.props.clickableClass : 'c2-table-disabled',
sortDescIcon: this.props.sortDescIcon,
sortAscIcon: this.props.sortAscIcon,
onSort: this.props.onSort
Expand All @@ -705,6 +723,8 @@ function (_Component6) {
expanded: this.props.expanded,
onEmpty: this.props.onEmpty,
rowClassName: this.props.rowClassName,
isFullLength: this.props.isFullLength,
fullLengthCell: this.props.fullLengthCell,
data: pagedData
}), React.createElement(Tfoot, {
children: this.props.children,
Expand Down Expand Up @@ -733,6 +753,9 @@ _defineProperty(Table, "propTypes", {
/** The default column direction */
defaultOrderDir: PropTypes.oneOf(['asc', 'desc']),

/** If sorting should be enabled */
sortEnabled: PropTypes.bool,

/** Columns/ColumnGroups */
children: ColumnOrColumnGroup,

Expand Down Expand Up @@ -779,7 +802,17 @@ _defineProperty(Table, "propTypes", {
sortAscIcon: PropTypes.any,

/** Function that is called on sort, (columnId, dir) => {} */
onSort: PropTypes.func
onSort: PropTypes.func,

/** Function that receives the row object and should bool for is full length */
isFullLength: PropTypes.func,

/** Full length cell renderer */
fullLengthCell: PropTypes.func
});

_defineProperty(Table, "defaultProps", {
sortEnabled: true
});

var Tfoot =
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/c2-table.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/assets.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"vendors.js": "/c2-table/static/js/vendors.e4c5d68e.js",
"app.js": "/c2-table/static/js/app.b358d307.js",
"docz-index.js": "/c2-table/static/js/docz-index.2120e158.js",
"vendors.js": "/c2-table/static/js/vendors.3b6b005b.js",
"app.js": "/c2-table/static/js/app.cfe6ad1f.js",
"docz-index.js": "/c2-table/static/js/docz-index.da56f80e.js",
"docz-props.js": "/c2-table/static/js/docz-props.06081f5f.js",
"runtime~app.js": "/c2-table/static/js/runtime~app.443e2163e2a5564c0d83.js",
"runtime~app.js": "/c2-table/static/js/runtime~app.004660bc05432dadda1e.js",
"index.html": "/c2-table/index.html"
}
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="description" content="a reactjs table component"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>C2 Table</title></head><body><div id="root"/><script src="/c2-table/static/js/runtime~app.443e2163e2a5564c0d83.js"></script><script src="/c2-table/static/js/vendors.e4c5d68e.js"></script><script src="/c2-table/static/js/app.b358d307.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="description" content="a reactjs table component"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>C2 Table</title></head><body><div id="root"/><script src="/c2-table/static/js/runtime~app.004660bc05432dadda1e.js"></script><script src="/c2-table/static/js/vendors.3b6b005b.js"></script><script src="/c2-table/static/js/app.cfe6ad1f.js"></script></body></html>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/static/js/docz-index.2120e158.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/static/js/docz-index.da56f80e.js

Large diffs are not rendered by default.

Loading

0 comments on commit d061ce4

Please sign in to comment.