@zat-design/sisyphus-react 3.13.20-beta.7 → 3.13.21-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
|
|
1
1
|
import "antd/es/table/style";
|
2
2
|
import _Table from "antd/es/table";
|
3
|
-
import { get } from 'lodash';
|
3
|
+
import { get, isObject } from 'lodash';
|
4
4
|
import { tools } from '@zat-design/utils';
|
5
5
|
import { valueTypeRender } from "../../../ProUtils/utils";
|
6
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -18,11 +18,12 @@ var renderSummary = props => {
|
|
18
18
|
if (!(dataSource !== null && dataSource !== void 0 && dataSource.length)) {
|
19
19
|
return null;
|
20
20
|
}
|
21
|
-
return
|
21
|
+
return isObject(summary) ? /*#__PURE__*/_jsx(_Table.Summary, {
|
22
22
|
fixed: fixed,
|
23
23
|
children: /*#__PURE__*/_jsx(_Table.Summary.Row, {
|
24
24
|
children: columns === null || columns === void 0 ? void 0 : columns.map(_ref2 => {
|
25
25
|
var key = _ref2.key,
|
26
|
+
dataIndex = _ref2.dataIndex,
|
26
27
|
index = _ref2.index,
|
27
28
|
colSpan = _ref2.colSpan,
|
28
29
|
prefix = _ref2.prefix,
|
@@ -30,19 +31,19 @@ var renderSummary = props => {
|
|
30
31
|
title = _ref2.title,
|
31
32
|
precision = _ref2.precision,
|
32
33
|
valueType = _ref2.valueType;
|
34
|
+
var _key = key || dataIndex;
|
33
35
|
var text = null;
|
34
36
|
if (title) {
|
35
37
|
text = title;
|
36
|
-
} else if (total &&
|
38
|
+
} else if (total && _key) {
|
37
39
|
var _dataSource$reduce;
|
38
40
|
var format = valueTypeRender === null || valueTypeRender === void 0 ? void 0 : valueTypeRender[valueType];
|
39
41
|
var sum = dataSource === null || dataSource === void 0 || (_dataSource$reduce = dataSource.reduce) === null || _dataSource$reduce === void 0 ? void 0 : _dataSource$reduce.call(dataSource, (pre, cur) => {
|
40
42
|
var _get;
|
41
|
-
return tools.calc(pre, '+', (_get = get(cur,
|
43
|
+
return tools.calc(pre, '+', (_get = get(cur, _key)) !== null && _get !== void 0 ? _get : 0);
|
42
44
|
}, 0);
|
43
45
|
text = format ? format(sum, precision !== null && precision !== void 0 ? precision : 2) : sum;
|
44
46
|
}
|
45
|
-
var _key = key;
|
46
47
|
return /*#__PURE__*/_jsxs(_Table.Summary.Cell, {
|
47
48
|
index: index,
|
48
49
|
colSpan: colSpan,
|
@@ -9,12 +9,18 @@ import type { TabsProps } from 'antd/es/tabs';
|
|
9
9
|
* 合计栏的每列配置参数
|
10
10
|
*/
|
11
11
|
interface ProTableSummaryColumnType {
|
12
|
+
/**
|
13
|
+
* 配置列的 key
|
14
|
+
* @description 对应表格列的 key
|
15
|
+
* @default undefined
|
16
|
+
*/
|
17
|
+
key?: string | string[];
|
12
18
|
/**
|
13
19
|
* 配置列的 dataIndex
|
14
20
|
* @description 对应表格列的 dataIndex
|
15
21
|
* @default undefined
|
16
22
|
*/
|
17
|
-
|
23
|
+
dataIndex?: string | string[];
|
18
24
|
/**
|
19
25
|
* 配置列的下标
|
20
26
|
* @description 列在表格中的索引位置
|
@@ -192,7 +198,7 @@ export interface ProTableColumnType extends Omit<ColumnType<any>, 'dataIndex'> {
|
|
192
198
|
* @description 用于开启比对时,自定义 render 渲染初始值,触发条件必须写render
|
193
199
|
* @default undefined
|
194
200
|
*/
|
195
|
-
viewRender?: ({ value, record, index, originValue, originRecord
|
201
|
+
viewRender?: ({ value, record, index, originValue, originRecord }: any) => 'same' | 'changed' | 'add' | undefined;
|
196
202
|
/**
|
197
203
|
* 是否已更改
|
198
204
|
* @description 标记列值是否已变更
|
@@ -24,11 +24,12 @@ var renderSummary = props => {
|
|
24
24
|
if (!(dataSource !== null && dataSource !== void 0 && dataSource.length)) {
|
25
25
|
return null;
|
26
26
|
}
|
27
|
-
return
|
27
|
+
return (0, _lodash.isObject)(summary) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_table.default.Summary, {
|
28
28
|
fixed: fixed,
|
29
29
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_table.default.Summary.Row, {
|
30
30
|
children: columns === null || columns === void 0 ? void 0 : columns.map(_ref2 => {
|
31
31
|
var key = _ref2.key,
|
32
|
+
dataIndex = _ref2.dataIndex,
|
32
33
|
index = _ref2.index,
|
33
34
|
colSpan = _ref2.colSpan,
|
34
35
|
prefix = _ref2.prefix,
|
@@ -36,19 +37,19 @@ var renderSummary = props => {
|
|
36
37
|
title = _ref2.title,
|
37
38
|
precision = _ref2.precision,
|
38
39
|
valueType = _ref2.valueType;
|
40
|
+
var _key = key || dataIndex;
|
39
41
|
var text = null;
|
40
42
|
if (title) {
|
41
43
|
text = title;
|
42
|
-
} else if (total &&
|
44
|
+
} else if (total && _key) {
|
43
45
|
var _dataSource$reduce;
|
44
46
|
var format = _utils2.valueTypeRender === null || _utils2.valueTypeRender === void 0 ? void 0 : _utils2.valueTypeRender[valueType];
|
45
47
|
var sum = dataSource === null || dataSource === void 0 || (_dataSource$reduce = dataSource.reduce) === null || _dataSource$reduce === void 0 ? void 0 : _dataSource$reduce.call(dataSource, (pre, cur) => {
|
46
48
|
var _get;
|
47
|
-
return _utils.tools.calc(pre, '+', (_get = (0, _lodash.get)(cur,
|
49
|
+
return _utils.tools.calc(pre, '+', (_get = (0, _lodash.get)(cur, _key)) !== null && _get !== void 0 ? _get : 0);
|
48
50
|
}, 0);
|
49
51
|
text = format ? format(sum, precision !== null && precision !== void 0 ? precision : 2) : sum;
|
50
52
|
}
|
51
|
-
var _key = key;
|
52
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_table.default.Summary.Cell, {
|
53
54
|
index: index,
|
54
55
|
colSpan: colSpan,
|
@@ -9,12 +9,18 @@ import type { TabsProps } from 'antd/es/tabs';
|
|
9
9
|
* 合计栏的每列配置参数
|
10
10
|
*/
|
11
11
|
interface ProTableSummaryColumnType {
|
12
|
+
/**
|
13
|
+
* 配置列的 key
|
14
|
+
* @description 对应表格列的 key
|
15
|
+
* @default undefined
|
16
|
+
*/
|
17
|
+
key?: string | string[];
|
12
18
|
/**
|
13
19
|
* 配置列的 dataIndex
|
14
20
|
* @description 对应表格列的 dataIndex
|
15
21
|
* @default undefined
|
16
22
|
*/
|
17
|
-
|
23
|
+
dataIndex?: string | string[];
|
18
24
|
/**
|
19
25
|
* 配置列的下标
|
20
26
|
* @description 列在表格中的索引位置
|
@@ -192,7 +198,7 @@ export interface ProTableColumnType extends Omit<ColumnType<any>, 'dataIndex'> {
|
|
192
198
|
* @description 用于开启比对时,自定义 render 渲染初始值,触发条件必须写render
|
193
199
|
* @default undefined
|
194
200
|
*/
|
195
|
-
viewRender?: ({ value, record, index, originValue, originRecord
|
201
|
+
viewRender?: ({ value, record, index, originValue, originRecord }: any) => 'same' | 'changed' | 'add' | undefined;
|
196
202
|
/**
|
197
203
|
* 是否已更改
|
198
204
|
* @description 标记列值是否已变更
|