From da696a88f2ccce08e21a2431f7c8634b09078a92 Mon Sep 17 00:00:00 2001 From: huyueb <1062887235@qq.com> Date: Sun, 24 Dec 2017 21:42:58 +0800 Subject: [PATCH] docs(readme.md): update readme --- build/Table.css | 2 ++ build/lib/sum.js | 18 ++++++------------ docs/mixin.md | 2 +- package.json | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/build/Table.css b/build/Table.css index bbef689..0078fcb 100644 --- a/build/Table.css +++ b/build/Table.css @@ -26,6 +26,8 @@ .u-table th, .u-table td { padding: 16px 8px; word-break: break-all; } + .u-table-row-hover { + background: #e3f2fd; } .u-table-scroll { overflow: auto; } .u-table-header { diff --git a/build/lib/sum.js b/build/lib/sum.js index b983173..e4d5a8b 100644 --- a/build/lib/sum.js +++ b/build/lib/sum.js @@ -22,8 +22,6 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } -// import clonedeep from "lodash.clonedeep"; - //创建新列存放 “合计” 字段 var columns2 = { title: "合计", @@ -56,8 +54,8 @@ function sum(Table) { obj[sumCol_index] = 0; if (Array.isArray(data_2)) { for (var _i = 0; _i < data_2.length; _i++) { - if (typeof data_2[_i][sumCol_index] == "number") { - obj[sumCol_index] += data_2[_i][sumCol_index]; + if (typeof data_2[_i][sumCol_index] == "number" || !isNaN(data_2[_i][sumCol_index])) { + obj[sumCol_index] -= -data_2[_i][sumCol_index]; } else { obj[sumCol_index] = ""; } @@ -67,14 +65,10 @@ function sum(Table) { obj.showSum = "合计"; obj = [obj]; //将设置的和用户传入的合并属性 - // if (columns_sum[0].dataIndex === "checkbox") { - // columns_sum[1] = Object.assign({}, columns_sum[1], columns2); - // } else { columns_sum[0] = _extends({}, columns_sum[0], columns2); - // } //除去列为特殊渲染的,避免像a标签这种html代码写入到合计中 columns_sum.map(function (item, index) { - if (typeof item.render == "function") { + if (typeof item.render == "function" && !item.sumCol) { item.render = ""; } return item; @@ -88,14 +82,14 @@ function sum(Table) { SumTable.prototype.render = function render() { - return _react2["default"].createElement(Table, { + return _react2["default"].createElement(Table, _extends({}, this.props, { columns: this.props.columns, data: this.props.data, footer: this.currentFooter - }); + })); }; return SumTable; }(_react2["default"].Component); -}; +} module.exports = exports["default"]; \ No newline at end of file diff --git a/docs/mixin.md b/docs/mixin.md index f41fae2..69ccfe2 100644 --- a/docs/mixin.md +++ b/docs/mixin.md @@ -41,7 +41,7 @@ import multiSelect from "bee-table/build/lib/multiSelect.js" 合计功能 #### Column新增参数 - + | 参数 | 说明 | 类型 | 默认值 | | ------ | ---------- | -------- | ---- | | sumCol | 该列设置为合计列,合计行中会显示合计数据 | boolean | false | diff --git a/package.json b/package.json index 7db9a87..8f02bf9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bee-table", - "version": "1.0.6", + "version": "1.0.7", "description": "Table ui component for react", "keywords": [ "react",