ztxkui 3.0.15 → 3.0.16

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.
package/dist/App.js CHANGED
@@ -614,6 +614,9 @@ var summaryConfig = [
614
614
  toFixedNum: 3,
615
615
  },
616
616
  ],
617
+ onClickHandle: function (data) {
618
+ console.log(data);
619
+ },
617
620
  },
618
621
  {
619
622
  type: 'total',
@@ -4,6 +4,7 @@ export interface ISummaryData {
4
4
  key: string;
5
5
  titleIndex: number;
6
6
  list: (string | number | null)[];
7
+ [prop: string]: any;
7
8
  }
8
9
  interface IProps {
9
10
  summaryData: ISummaryData[];
@@ -162,16 +162,25 @@ function Table(props) {
162
162
  ? function (pageData) {
163
163
  var summaryData = getSummaryData(summaryConfig, pageData, newColumns, props.rowSelection ? true : false);
164
164
  return (React.createElement(AntTable.Summary, { fixed: summaryFixed }, summaryData.map(function (summary) {
165
- var title = summary.title, key = summary.key, titleIndex = summary.titleIndex, list = summary.list;
165
+ var title = summary.title, key = summary.key, titleIndex = summary.titleIndex, list = summary.list, columnList = summary.columnList, onClickHandle = summary.onClickHandle;
166
166
  return (React.createElement(AntTable.Summary.Row, { key: key }, Array.isArray(list) &&
167
167
  list.map(function (item, index) {
168
+ var data = {
169
+ index: index,
170
+ column: Array.isArray(columnList)
171
+ ? columnList[index]
172
+ : null,
173
+ num: item,
174
+ };
168
175
  if (titleIndex === index) {
169
- return (React.createElement(AntTable.Summary.Cell, { key: index, index: index }, title));
176
+ return (React.createElement(AntTable.Summary.Cell, { key: index, index: index }, onClickHandle ? (React.createElement("div", { onClick: function () { return onClickHandle === null || onClickHandle === void 0 ? void 0 : onClickHandle(data); } }, title)) : (title)));
170
177
  }
171
178
  else {
172
179
  return (React.createElement(AntTable.Summary.Cell, { key: index, index: index },
173
180
  React.createElement("div", { style: {
174
181
  color: '#ff6666',
182
+ }, onClick: function () {
183
+ return onClickHandle && (onClickHandle === null || onClickHandle === void 0 ? void 0 : onClickHandle(data));
175
184
  } }, item)));
176
185
  }
177
186
  })));
@@ -9,6 +9,8 @@ export interface ISummaryConfig {
9
9
  type: 'subtotal' | 'total';
10
10
  fields: (string | IFields)[];
11
11
  title?: string;
12
+ onClickHandle?: any;
13
+ [prop: string]: any;
12
14
  }
13
15
  /**
14
16
  * @description 获取总结栏数据
@@ -17,7 +17,7 @@ function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
17
17
  var _summaryData = [];
18
18
  if (Array.isArray(summaryConfig)) {
19
19
  summaryConfig.forEach(function (summary) {
20
- var type = summary.type, fields = summary.fields, title = summary.title;
20
+ var type = summary.type, fields = summary.fields, title = summary.title, onClickHandle = summary.onClickHandle;
21
21
  switch (type) {
22
22
  case 'subtotal': // 小计
23
23
  // 如果没有设置 统计字段 那么直接跳出循环
@@ -35,12 +35,19 @@ function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
35
35
  ? subtotalObj_1[col.key || col.dataIndex]
36
36
  : undefined;
37
37
  });
38
+ var columnResult = columns.map(function (col) { return ({
39
+ key: col === null || col === void 0 ? void 0 : col.key,
40
+ dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
41
+ }); });
38
42
  _summaryData.push({
39
43
  title: title || '小计',
40
44
  titleIndex: 0 + (hasRowSelection ? 1 : 0),
41
45
  key: 'subtotal',
42
46
  list: hasRowSelection
43
47
  ? __spreadArray([undefined], subtotalResult) : subtotalResult,
48
+ columnList: hasRowSelection
49
+ ? __spreadArray([undefined], columnResult) : columnResult,
50
+ onClickHandle: onClickHandle,
44
51
  });
45
52
  break;
46
53
  case 'total': // 总计
@@ -59,11 +66,18 @@ function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
59
66
  ? totalObj_1[col.key || col.dataIndex]
60
67
  : undefined;
61
68
  });
69
+ var columnResult_1 = columns.map(function (col) { return ({
70
+ key: col === null || col === void 0 ? void 0 : col.key,
71
+ dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
72
+ }); });
62
73
  _summaryData.push({
63
74
  title: title || '总计',
64
75
  titleIndex: 0 + (hasRowSelection ? 1 : 0),
65
76
  key: 'total',
66
77
  list: hasRowSelection ? __spreadArray([undefined], totalResult) : totalResult,
78
+ columnList: hasRowSelection
79
+ ? __spreadArray([undefined], columnResult_1) : columnResult_1,
80
+ onClickHandle: onClickHandle,
67
81
  });
68
82
  }
69
83
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.0.15",
3
+ "version": "3.0.16",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",