diff --git a/build/lib/sort.js b/build/lib/sort.js index e4b53d3..991c36d 100644 --- a/build/lib/sort.js +++ b/build/lib/sort.js @@ -292,7 +292,7 @@ function sort(Table, Icon) { } else { data = oldData.concat(); } - typeof sort.sortFun === "function" && sort.sortFun(sortCol, data); + typeof sort.sortFun === "function" && sort.sortFun(sortCol, data, oldData); } } else { seleObj = flatColumns.find(function (da) { @@ -310,7 +310,7 @@ function sort(Table, Icon) { sort.sortFun(sortCol); } else { data = _this3.multiSort(flatColumns); - typeof sort.sortFun === "function" && sort.sortFun(sortCol, data); + typeof sort.sortFun === "function" && sort.sortFun(sortCol, data, oldData); } } _this3.setState({ data: data, oldData: oldData, flatColumns: flatColumns }); diff --git a/build/lib/sum.js b/build/lib/sum.js index 713364e..5351612 100644 --- a/build/lib/sum.js +++ b/build/lib/sum.js @@ -25,6 +25,8 @@ 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); } function sum(Table) { + var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; + return function (_React$Component) { _inherits(SumTable, _React$Component); @@ -91,7 +93,7 @@ function sum(Table) { count += _num; } }); - sumdata[column.dataIndex] = (0, _utils.DicimalFormater)(count, 2); + sumdata[column.dataIndex] = (0, _utils.DicimalFormater)(count, precision); } if (index == 0) { sumdata[column.dataIndex] = "合计 " + sumdata[column.dataIndex]; diff --git a/src/lib/sort.js b/src/lib/sort.js index 6979d2f..4b2b3ad 100644 --- a/src/lib/sort.js +++ b/src/lib/sort.js @@ -195,7 +195,7 @@ export default function sort(Table, Icon) { } else { data = oldData.concat(); } - typeof sort.sortFun === "function" && sort.sortFun(sortCol,data); + typeof sort.sortFun === "function" && sort.sortFun(sortCol,data,oldData); } } else { seleObj = flatColumns.find(da => da.key == column.key); @@ -211,7 +211,7 @@ export default function sort(Table, Icon) { sort.sortFun(sortCol); } else { data = this.multiSort(flatColumns); - typeof sort.sortFun === "function" && sort.sortFun(sortCol,data); + typeof sort.sortFun === "function" && sort.sortFun(sortCol,data,oldData); } } this.setState({ data, oldData, flatColumns });