ztxkui 3.6.11 → 3.6.14

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.
@@ -193,9 +193,23 @@ var EditableTable = function () {
193
193
  },
194
194
  {
195
195
  title: '测试5',
196
- width: 100,
197
- dataIndex: 'test5',
198
- key: 'test5',
196
+ // width: 100,
197
+ // dataIndex: 'test5',
198
+ // key: 'test5',
199
+ children: [
200
+ {
201
+ title: '测试5-001',
202
+ width: 100,
203
+ dataIndex: 'test5-001',
204
+ key: 'test5-001',
205
+ },
206
+ {
207
+ title: '测试5-002',
208
+ width: 100,
209
+ dataIndex: 'test5-002',
210
+ key: 'test5-002',
211
+ },
212
+ ],
199
213
  },
200
214
  {
201
215
  title: '测试6',
@@ -351,6 +365,34 @@ var EditableTable = function () {
351
365
  key: 'test2',
352
366
  toFixedNum: 2,
353
367
  },
368
+ {
369
+ key: 'test5-001',
370
+ toFixedNum: 2,
371
+ },
372
+ {
373
+ key: 'test5-002',
374
+ toFixedNum: 2,
375
+ },
376
+ ],
377
+ },
378
+ {
379
+ type: 'total',
380
+ fields: [
381
+ {
382
+ key: 'test2',
383
+ toFixedNum: 2,
384
+ value: 0,
385
+ },
386
+ {
387
+ key: 'test5-001',
388
+ toFixedNum: 2,
389
+ value: 222,
390
+ },
391
+ {
392
+ key: 'test5-002',
393
+ toFixedNum: 2,
394
+ value: 333322.22,
395
+ },
354
396
  ],
355
397
  },
356
398
  ] })));
@@ -5,6 +5,8 @@ export declare const dataSource: {
5
5
  test3: string;
6
6
  test4: string;
7
7
  test5: string;
8
+ 'test5-001': number;
9
+ 'test5-002': number;
8
10
  test6: string;
9
11
  test7: string;
10
12
  test8: string;
@@ -6,6 +6,8 @@ export var dataSource = new Array(10).fill(1).map(function (item, index) {
6
6
  test3: "test3-" + index,
7
7
  test4: "test4-" + index,
8
8
  test5: "test5-" + index,
9
+ 'test5-001': index + 10,
10
+ 'test5-002': index + 20,
9
11
  test6: "test6-" + index,
10
12
  test7: "test7-" + index,
11
13
  test8: "test8-" + index,
@@ -52,6 +52,10 @@ export interface IProps {
52
52
  localKey?: string;
53
53
  /** 是否显示导出按钮 */
54
54
  showExportBtn?: boolean;
55
+ /** 是否显示设置文字 */
56
+ showSetFontBtn?: boolean;
57
+ /** 设置是否需要偏移 */
58
+ isSetPosition?: boolean;
55
59
  }
56
60
  declare const PrintContainer: React.FC<IProps>;
57
61
  export default PrintContainer;
@@ -94,25 +94,25 @@ function downloadFontTTF(_a) {
94
94
  });
95
95
  }
96
96
  var PrintContainer = function (_a) {
97
- var children = _a.children, waterText = _a.waterText, onFonsizeChange = _a.onFonsizeChange, hiddenClassName = _a.hiddenClassName, _b = _a.isAddExportPage, isAddExportPage = _b === void 0 ? false : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, _d = _a.pdfName, pdfName = _d === void 0 ? 'pdf文件' : _d, request = _a.request, sealIdList = _a.sealIdList, _e = _a.showHandSeal, showHandSeal = _e === void 0 ? true : _e, _f = _a.showAutoSeal, showAutoSeal = _f === void 0 ? true : _f, _g = _a.needWatermark, needWatermark = _g === void 0 ? 0 : _g, fileId = _a.fileId, deptId = _a.deptId, flowId = _a.flowId, imgWaterBg = _a.imgWaterBg, onPrintCallback = _a.onPrintCallback, showPrintMessage = _a.showPrintMessage, onPrintBeforeCallback = _a.onPrintBeforeCallback, _h = _a.showPrintBtn, showPrintBtn = _h === void 0 ? true : _h, isUseXy = _a.isUseXy, localKey = _a.localKey, _j = _a.showExportBtn, showExportBtn = _j === void 0 ? true : _j;
98
- var _k = useState(false), showWater = _k[0], setShowWater = _k[1];
97
+ var children = _a.children, waterText = _a.waterText, onFonsizeChange = _a.onFonsizeChange, hiddenClassName = _a.hiddenClassName, _b = _a.isAddExportPage, isAddExportPage = _b === void 0 ? false : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, _d = _a.pdfName, pdfName = _d === void 0 ? 'pdf文件' : _d, request = _a.request, sealIdList = _a.sealIdList, _e = _a.showHandSeal, showHandSeal = _e === void 0 ? true : _e, _f = _a.showAutoSeal, showAutoSeal = _f === void 0 ? true : _f, _g = _a.needWatermark, needWatermark = _g === void 0 ? 0 : _g, fileId = _a.fileId, deptId = _a.deptId, flowId = _a.flowId, imgWaterBg = _a.imgWaterBg, onPrintCallback = _a.onPrintCallback, showPrintMessage = _a.showPrintMessage, onPrintBeforeCallback = _a.onPrintBeforeCallback, _h = _a.showPrintBtn, showPrintBtn = _h === void 0 ? true : _h, isUseXy = _a.isUseXy, localKey = _a.localKey, _j = _a.showExportBtn, showExportBtn = _j === void 0 ? true : _j, showSetFontBtn = _a.showSetFontBtn, _k = _a.isSetPosition, isSetPosition = _k === void 0 ? true : _k;
98
+ var _l = useState(false), showWater = _l[0], setShowWater = _l[1];
99
99
  var containerRef = useRef();
100
100
  var allDomRef = useRef();
101
- var _l = useState(false), spinning = _l[0], setSpinning = _l[1];
101
+ var _m = useState(false), spinning = _m[0], setSpinning = _m[1];
102
102
  // 确认盖章后,会得到一个合同id 这个之后盖章要用
103
- var _m = useState(), currentContractId = _m[0], setCurrentContractId = _m[1];
103
+ var _o = useState(), currentContractId = _o[0], setCurrentContractId = _o[1];
104
104
  // 盖章后会得到一个预览地址,这个地址耀保存,同一个合同id,不能重复盖章接口
105
- var _o = useState(), currentViewUrl = _o[0], setCurrentViewUrl = _o[1];
105
+ var _p = useState(), currentViewUrl = _p[0], setCurrentViewUrl = _p[1];
106
106
  // 收到盖章-印章列表
107
- var _p = useState(), _sealIdList = _p[0], setSealIdList = _p[1];
107
+ var _q = useState(), _sealIdList = _q[0], setSealIdList = _q[1];
108
108
  // 自动盖章-印章列表
109
- var _q = useState(), autoSealList = _q[0], setAutoSealList = _q[1];
109
+ var _r = useState(), autoSealList = _r[0], setAutoSealList = _r[1];
110
110
  // 边距调整相关
111
- var _r = useState(false), visible = _r[0], setVisible = _r[1];
112
- var _s = useState({
111
+ var _s = useState(false), visible = _s[0], setVisible = _s[1];
112
+ var _t = useState({
113
113
  top: 0,
114
114
  left: 0,
115
- }), value = _s[0], setValue = _s[1];
115
+ }), value = _t[0], setValue = _t[1];
116
116
  useEffect(function () {
117
117
  var v = getPositionLocal(localKey);
118
118
  setValue(v);
@@ -487,7 +487,9 @@ var PrintContainer = function (_a) {
487
487
  }); };
488
488
  function createPdf() {
489
489
  setTimeout(function () {
490
- setPositionDom(setPositionDeviation(value));
490
+ if (isSetPosition) {
491
+ setPositionDom(setPositionDeviation(value));
492
+ }
491
493
  htmlToPdfNoCanvas({
492
494
  dom: containerRef.current,
493
495
  fileBinary: fontTTF,
@@ -562,7 +564,9 @@ var PrintContainer = function (_a) {
562
564
  };
563
565
  function surePdfLoad() {
564
566
  setTimeout(function () {
565
- setPositionDom(setPositionDeviation(value));
567
+ if (isSetPosition) {
568
+ setPositionDom(setPositionDeviation(value));
569
+ }
566
570
  htmlToPdfNoCanvas({
567
571
  dom: containerRef.current,
568
572
  isShowPage: isAddExportPage,
@@ -719,7 +723,9 @@ var PrintContainer = function (_a) {
719
723
  };
720
724
  function pdfLoad() {
721
725
  setTimeout(function () {
722
- setPositionDom(setPositionDeviation(value));
726
+ if (isSetPosition) {
727
+ setPositionDom(setPositionDeviation(value));
728
+ }
723
729
  htmlToPdfNoCanvas({
724
730
  dom: containerRef.current,
725
731
  isShowPage: isAddExportPage,
@@ -799,8 +805,8 @@ var PrintContainer = function (_a) {
799
805
  return (React.createElement(Spin, { spinning: spinning },
800
806
  React.createElement("div", { className: "print-container--header" },
801
807
  React.createElement("div", { className: "print-container--header__content" },
802
- React.createElement(Button, { type: "primary", onClick: function () { return onFontsizeHandle('add'); } }, "\u653E\u5927\u6587\u5B57"),
803
- React.createElement(Button, { type: "primary", onClick: function () { return onFontsizeHandle('reduce'); } }, "\u7F29\u5C0F\u6587\u5B57"),
808
+ showSetFontBtn && (React.createElement(Button, { type: "primary", onClick: function () { return onFontsizeHandle('add'); } }, "\u653E\u5927\u6587\u5B57")),
809
+ showSetFontBtn && (React.createElement(Button, { type: "primary", onClick: function () { return onFontsizeHandle('reduce'); } }, "\u7F29\u5C0F\u6587\u5B57")),
804
810
  React.createElement(Button, { type: "primary", onClick: function () { return onAdjustPadding(); } }, "\u8C03\u6574\u8FB9\u8DDD"),
805
811
  React.createElement(Button, { type: "primary", onClick: onWaterHandle }, !showWater ? '添加水印' : '移除水印'),
806
812
  showPrintBtn && (React.createElement(Button, { type: "primary", onClick: onPrintHandle }, "\u6253\u5370")),
@@ -44,6 +44,9 @@ export var getTableLayoutFullData = function (columns, tableLayout) {
44
44
  }
45
45
  // 如果没有在原始数据中找到对应的值,那说明这个应该删除,不应该添加进去
46
46
  }
47
+ else if (item.children && !item.fixed) {
48
+ middleColumns_1.push(__assign({}, item));
49
+ }
47
50
  // 如果没有key 或者dataIndex 则说明该值不应该存在
48
51
  // return {
49
52
  // ...item,
@@ -369,6 +369,7 @@ function Table(props) {
369
369
  : undefined, summary: summaryConfig
370
370
  ? function (pageData) {
371
371
  var summaryData = getSummaryData(summaryConfig, pageData, newColumns, props.rowSelection ? true : false);
372
+ console.log(summaryData);
372
373
  return (React.createElement(AntTable.Summary, { fixed: summaryFixed }, summaryData.map(function (summary) {
373
374
  var title = summary.title, key = summary.key, titleIndex = summary.titleIndex, list = summary.list, columnList = summary.columnList, onClickHandle = summary.onClickHandle;
374
375
  return (React.createElement(AntTable.Summary.Row, { key: key }, Array.isArray(list) &&
@@ -14,6 +14,7 @@ import { plus, round } from 'number-precision';
14
14
  */
15
15
  function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
16
16
  if (hasRowSelection === void 0) { hasRowSelection = false; }
17
+ console.log(columns);
17
18
  var _summaryData = [];
18
19
  if (Array.isArray(summaryConfig)) {
19
20
  summaryConfig.forEach(function (summary) {
@@ -30,23 +31,58 @@ function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
30
31
  // 拿到统计数据
31
32
  var subtotalObj_1 = getSubtotalObj(fields, pageData);
32
33
  // 得到小计行数据
33
- var subtotalResult = columns.map(function (col) {
34
- return col.key || col.dataIndex
35
- ? subtotalObj_1[col.key || col.dataIndex]
36
- : undefined;
34
+ // const subtotalResult = columns.map((col: any) =>
35
+ // col.key || col.dataIndex
36
+ // ? subtotalObj[col.key || col.dataIndex]
37
+ // : undefined
38
+ // );
39
+ // 修改逻辑
40
+ var subtotalResult_1 = [];
41
+ columns.forEach(function (col) {
42
+ if (col.children) {
43
+ col.children.forEach(function (col) {
44
+ subtotalResult_1.push(col.key || col.dataIndex
45
+ ? subtotalObj_1[col.key || col.dataIndex]
46
+ : undefined);
47
+ });
48
+ }
49
+ else {
50
+ subtotalResult_1.push(col.key || col.dataIndex
51
+ ? subtotalObj_1[col.key || col.dataIndex]
52
+ : undefined);
53
+ }
54
+ });
55
+ // 得到column
56
+ // const columnResult = columns.map((col: any) => ({
57
+ // key: col?.key,
58
+ // dataIndex: col?.dataIndex,
59
+ // }));
60
+ // 修改逻辑
61
+ var columnResult_1 = [];
62
+ columns.forEach(function (col) {
63
+ if (col.children) {
64
+ col.children.forEach(function (col) {
65
+ columnResult_1.push({
66
+ key: col === null || col === void 0 ? void 0 : col.key,
67
+ dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
68
+ });
69
+ });
70
+ }
71
+ else {
72
+ columnResult_1.push({
73
+ key: col === null || col === void 0 ? void 0 : col.key,
74
+ dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
75
+ });
76
+ }
37
77
  });
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
- }); });
42
78
  _summaryData.push({
43
79
  title: title || '小计',
44
80
  titleIndex: 0 + (hasRowSelection ? 1 : 0),
45
81
  key: 'subtotal',
46
82
  list: hasRowSelection
47
- ? __spreadArray([undefined], subtotalResult) : subtotalResult,
83
+ ? __spreadArray([undefined], subtotalResult_1) : subtotalResult_1,
48
84
  columnList: hasRowSelection
49
- ? __spreadArray([undefined], columnResult) : columnResult,
85
+ ? __spreadArray([undefined], columnResult_1) : columnResult_1,
50
86
  onClickHandle: onClickHandle,
51
87
  });
52
88
  break;
@@ -61,22 +97,57 @@ function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
61
97
  }
62
98
  var totalObj_1 = getTotalObj(fields);
63
99
  // 得到小计行数据
64
- var totalResult = columns.map(function (col) {
65
- return col.key || col.dataIndex
66
- ? totalObj_1[col.key || col.dataIndex]
67
- : undefined;
100
+ // const totalResult = columns.map((col: any) =>
101
+ // col.key || col.dataIndex
102
+ // ? totalObj[col.key || col.dataIndex]
103
+ // : undefined
104
+ // );
105
+ // 修改逻辑
106
+ var totalResult_1 = [];
107
+ columns.forEach(function (col) {
108
+ if (col.children) {
109
+ col.children.forEach(function (col) {
110
+ totalResult_1.push(col.key || col.dataIndex
111
+ ? totalObj_1[col.key || col.dataIndex]
112
+ : undefined);
113
+ });
114
+ }
115
+ else {
116
+ totalResult_1.push(col.key || col.dataIndex
117
+ ? totalObj_1[col.key || col.dataIndex]
118
+ : undefined);
119
+ }
120
+ });
121
+ // 得到column
122
+ // const columnResult = columns.map((col: any) => ({
123
+ // key: col?.key,
124
+ // dataIndex: col?.dataIndex,
125
+ // }));
126
+ // 修改逻辑
127
+ var columnResult_2 = [];
128
+ columns.forEach(function (col) {
129
+ if (col.children) {
130
+ col.children.forEach(function (col) {
131
+ columnResult_2.push({
132
+ key: col === null || col === void 0 ? void 0 : col.key,
133
+ dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
134
+ });
135
+ });
136
+ }
137
+ else {
138
+ columnResult_2.push({
139
+ key: col === null || col === void 0 ? void 0 : col.key,
140
+ dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
141
+ });
142
+ }
68
143
  });
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
- }); });
73
144
  _summaryData.push({
74
145
  title: title || '总计',
75
146
  titleIndex: 0 + (hasRowSelection ? 1 : 0),
76
147
  key: 'total',
77
- list: hasRowSelection ? __spreadArray([undefined], totalResult) : totalResult,
148
+ list: hasRowSelection ? __spreadArray([undefined], totalResult_1) : totalResult_1,
78
149
  columnList: hasRowSelection
79
- ? __spreadArray([undefined], columnResult_1) : columnResult_1,
150
+ ? __spreadArray([undefined], columnResult_2) : columnResult_2,
80
151
  onClickHandle: onClickHandle,
81
152
  });
82
153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.6.11",
3
+ "version": "3.6.14",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",