ztxkui 3.0.14 → 3.0.17

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',
package/dist/Demo.js CHANGED
@@ -16,6 +16,7 @@ function Demo() {
16
16
  var _a = useState([]), list = _a[0], setList = _a[1];
17
17
  var _b = useState([]), setDefaultList = _b[1];
18
18
  var _c = useState(), value = _c[0], setValue = _c[1];
19
+ var _d = useState(0), selectVal = _d[0], setSelectVal = _d[1];
19
20
  var params = useState({
20
21
  tenantId: '000000',
21
22
  isCreateUser: 0,
@@ -25,7 +26,7 @@ function Demo() {
25
26
  var timeoutId = setTimeout(function () {
26
27
  console.log('获取数据');
27
28
  setList(new Array(10000).fill(1).map(function (item, index) { return ({
28
- id: index + '',
29
+ id: index,
29
30
  name: '你好' + index,
30
31
  test1: 'test1' + index,
31
32
  test2: 'test2' + index,
@@ -50,12 +51,14 @@ function Demo() {
50
51
  }
51
52
  };
52
53
  }, []);
54
+ console.log(list);
53
55
  return (React.createElement("div", { style: { height: 2000 } },
54
56
  React.createElement(Link, { to: "/test" }, "test"),
55
57
  React.createElement("h1", null, "\u4F5C\u4E3A\u6F14\u793A\u4F7F\u7528"),
56
58
  React.createElement("h2", null, "\u5982\u679C\u6570\u636E\u662F\u901A\u8FC7\u5916\u90E8\u83B7\u53D6\u7684\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4F20\u9012list\u5C5E\u6027"),
57
- React.createElement(EnhanceSelect, { style: selectStyle, list: list, showAll: true, joinKey: "test1", lineFeedKey: "test1", onChange: function (value, option, fullData) {
58
- console.log(value, option, fullData);
59
+ React.createElement(EnhanceSelect, { style: selectStyle, list: list, showAll: true, joinKey: "test1", lineFeedKey: "test1", value: selectVal, onChange: function (value, option, fullData) {
60
+ console.log(typeof value, option, fullData);
61
+ setSelectVal(value);
59
62
  } }),
60
63
  React.createElement(EnhanceSelect, { style: selectStyle, list: list, joinKey: "test1", showAll: true, onChange: function (value, option, fullData) {
61
64
  console.log(value, option, fullData);
@@ -147,7 +147,7 @@ var FormDemo = function () {
147
147
  React.createElement(Select, null)),
148
148
  React.createElement(SearchItem, { name: "type4", width: "half", noLabel: true },
149
149
  React.createElement(Select, null)),
150
- React.createElement(SearchItem, { name: "type4", width: "all", label: "\u4F60\u597D" },
150
+ React.createElement(SearchItem, { name: "type4", width: "half", label: "\u4F60\u597D" },
151
151
  React.createElement(Select, null))))),
152
152
  React.createElement("button", { onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
153
153
  var err_1, errorFields;
@@ -33,7 +33,7 @@ function useGetTableRecords() {
33
33
  var newItem = {
34
34
  id: "" + (index + 1),
35
35
  test1: index + 1 + "-test1",
36
- test2: index + 1 + "-test2",
36
+ test2: index,
37
37
  test3: index + 1 + "-test3",
38
38
  materialId: 1,
39
39
  // brand: '123',
@@ -525,6 +525,12 @@ var TableDemo = function () {
525
525
  width: 120,
526
526
  dataIndex: 'test2',
527
527
  key: 'test2',
528
+ sorter: {
529
+ compare: function (a, b) {
530
+ console.log(a, b);
531
+ return a.test2 - b.test2;
532
+ },
533
+ },
528
534
  },
529
535
  {
530
536
  title: '编辑字段1',
@@ -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;
@@ -39,15 +39,15 @@ function getWidthStr(width) {
39
39
  // }
40
40
  switch (width) {
41
41
  case 'half':
42
- return '16.667%';
42
+ return '16.6%';
43
43
  case 'all':
44
44
  return '100%';
45
45
  case 'double':
46
- return '66.667%';
46
+ return '66.6%';
47
47
  case 'halfAll':
48
48
  return '50%';
49
49
  default:
50
- return '33.333%';
50
+ return '33.3%';
51
51
  }
52
52
  }
53
53
  var SearchItem = function (_a) {
package/dist/index.css CHANGED
@@ -1752,12 +1752,12 @@ template {
1752
1752
  }
1753
1753
 
1754
1754
  .print-container--content {
1755
- margin-top: 42px;
1756
1755
  width: 1000px;
1757
- min-height: 90vh;
1756
+ min-height: 100vh;
1758
1757
  margin-right: auto;
1759
1758
  margin-left: auto;
1760
1759
  padding: 10px 15px;
1760
+ padding-top: 52px;
1761
1761
  }
1762
1762
  .print-container--content .ant-table {
1763
1763
  background: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.0.14",
3
+ "version": "3.0.17",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",
@@ -67,6 +67,7 @@
67
67
  "@types/react": "^17.0.0",
68
68
  "@types/react-dom": "^17.0.0",
69
69
  "@types/react-router-dom": "^5.1.8",
70
+ "cross-env": "^7.0.3",
70
71
  "eslint-config-prettier": "^8.0.0",
71
72
  "eslint-plugin-prettier": "^3.3.1",
72
73
  "html2canvas": "^1.4.1",