ztxkui 3.8.13 → 3.8.15

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.
@@ -26,11 +26,12 @@ import axios from 'axios';
26
26
  import water from '../assets/img/water.png';
27
27
  import { createDownloadUrl } from 'ztxkutils/dist/fileOperation';
28
28
  import './print.scss';
29
+ import { token } from '../constants';
29
30
  function request(options) {
30
31
  return axios({
31
32
  baseURL: options.baseURL ? options.baseURL : 'http://192.168.0.83:8000',
32
33
  url: options.url,
33
- headers: __assign({ 'Zmdms-Auth': 'bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiZW1wX25hbWUiOm51bGwsImVtcF9udW1iZXIiOm51bGwsImltdF9pZCI6IiIsInJlYWxfbmFtZSI6IumZiOS6mumbhCIsImNsaWVudF90eXBlIjoid2ViIiwiZGF0YV9yb2xlX2lkIjoiMTM0NTk3ODUwNTMwMjA1Njk2MiwxNDY4MDM1MzUxNjI1Mjg1NjM0LDE1NDIwNzYzMDg1NzgwMjU0NzQiLCJjbGllbnRfaWQiOiJzd29yZCIsInVzZXJfdHlwZSI6IndlYiIsInJvbGVfaWQiOiIxMTIzNTk4ODE2NzM4Njc1MjAxLDE0NjcwMTU5NzU0ODQ3NjAwNjYsMTQ2ODAzNDQzNzE1Nzk2MTcyOSwxNDgwODI5MzM3OTM5MTMyNDE3IiwicG9zdF9uYW1lIjpudWxsLCJzY29wZSI6WyJhbGwiXSwiaW50ZXJ2aWV3X2lkIjoiIiwiZXhwIjoxNjY2MTQzMTg5LCJvcmdfbmFtZSI6bnVsbCwianRpIjoiNzlhZjczN2YtMTgyMi00ZWU0LTljNmQtZThkNjhjYzQxNTg0IiwibWVtYmVyX2lkIjoiMSIsImNvbXBhbnlfaWQiOiIiLCJzeXN0ZW1faWQiOm51bGwsImRlcHRfbmFtZSI6bnVsbCwiYXZhdGFyIjoiIiwiZGF0YV9yb2xlX25hbWUiOiJhZG1pbixhZG1pbixhZG1pbiIsImF1dGhvcml0aWVzIjpbImFkbWluIiwidXNlciIsImFkbWluaXN0cmF0b3IiXSwicm9sZV9uYW1lIjoiYWRtaW5pc3RyYXRvcix1c2VyLGFkbWluLGFkbWluIiwicmVzdW1lX3RlbXBsYXRlIjpudWxsLCJsaWNlbnNlIjoicG93ZXJlZCBieSB6bWRtcyIsInBvc3RfaWQiOiIiLCJ1c2VyX2lkIjoiMTQxMjk1MzgwNDMzMzU1NTcxNCIsIm9yZ19pZCI6IiIsIm5pY2tfbmFtZSI6IumZiOS6mumbhCIsImNvbXBhbnlfbmFtZSI6bnVsbCwiZGVwdF9pZCI6IiIsImhhbmRsZV9ocl9uYW1lIjpudWxsLCJhY2NvdW50IjoiY2hlbnl4IiwicmVzdW1lX2lkIjoiIn0.u0Q6shXH7jdznAjGcEwW-xpbzKoAhLz2ZSbdYic5QjE' }, options.headers),
34
+ headers: __assign({ 'Zmdms-Auth': "bearer " + token }, options.headers),
34
35
  method: options.method,
35
36
  data: options.data,
36
37
  params: options.params,
@@ -98,7 +99,7 @@ var PrintContainerDemo = function () {
98
99
  }, []);
99
100
  return (React.createElement(PrintContainer, { isAddExportPage: true, loading: loading, request: request, deptId: "1414852847035002881", flowId: "scm_print_tdtd", fileId: "1551733945007517697",
100
101
  // keywordList={keywordList}
101
- imgWaterBg: water, showPrintMessage: true, showAddSeal: true, apiUrl: "http://192.168.0.83:8000", fileBaseUrl: "http://192.168.0.83:88" },
102
+ imgWaterBg: water, isSetPosition: false, showPrintMessage: true, showAddSeal: true, apiUrl: "http://192.168.0.83:8000", fileBaseUrl: "http://192.168.0.83:88" },
102
103
  React.createElement("div", { className: "html2canvas-container-page simple-print", "data-title": "\u6D4B\u8BD5\u6807\u98981" },
103
104
  React.createElement("div", { className: "print-header" },
104
105
  React.createElement("img", { src: base64Img, alt: "" }),
@@ -79,6 +79,7 @@ var EditableTable = function () {
79
79
  setTimeout(function () {
80
80
  setTableConfig({
81
81
  test1: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
82
+ test111: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
82
83
  test2: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
83
84
  });
84
85
  }, 5000);
@@ -114,6 +115,29 @@ var EditableTable = function () {
114
115
  return record.test1 !== preRecord.test1;
115
116
  },
116
117
  },
118
+ {
119
+ title: '测试111',
120
+ width: 100,
121
+ dataIndex: 'test111',
122
+ key: 'test111',
123
+ editable: true,
124
+ validate: {},
125
+ shouldCellUpdate: function (record, preRecord) {
126
+ if (firstRender) {
127
+ setFirstRender(false);
128
+ return true;
129
+ }
130
+ if (lengthChange) {
131
+ setLengthChange(false);
132
+ return true;
133
+ }
134
+ if (moveChange) {
135
+ setMoveChange(false);
136
+ return true;
137
+ }
138
+ return record.test111 !== preRecord.test111;
139
+ },
140
+ },
117
141
  {
118
142
  title: '测试2',
119
143
  width: 150,
@@ -187,62 +211,62 @@ var EditableTable = function () {
187
211
  } }));
188
212
  },
189
213
  },
190
- {
191
- title: '测试4',
192
- width: 100,
193
- dataIndex: 'test4',
194
- key: 'test4',
195
- },
196
- {
197
- title: '测试5',
198
- // width: 100,
199
- // dataIndex: 'test5',
200
- // key: 'test5',
201
- children: [
202
- {
203
- title: '测试5-001',
204
- width: 100,
205
- dataIndex: 'test5-001',
206
- key: 'test5-001',
207
- },
208
- {
209
- title: '测试5-002',
210
- width: 100,
211
- dataIndex: 'test5-002',
212
- key: 'test5-002',
213
- },
214
- ],
215
- },
216
- {
217
- title: '测试6',
218
- width: 100,
219
- dataIndex: 'test6',
220
- key: 'test6',
221
- },
222
- {
223
- title: '测试7',
224
- width: 100,
225
- dataIndex: 'test7',
226
- key: 'test7',
227
- },
228
- {
229
- title: '测试8',
230
- width: 100,
231
- dataIndex: 'test8',
232
- key: 'test8',
233
- },
234
- {
235
- title: '测试9',
236
- width: 100,
237
- dataIndex: 'test9',
238
- key: 'test9',
239
- },
240
- {
241
- title: '测试10',
242
- width: 100,
243
- dataIndex: 'test10',
244
- key: 'test10',
245
- },
214
+ // {
215
+ // title: '测试4',
216
+ // width: 100,
217
+ // dataIndex: 'test4',
218
+ // key: 'test4',
219
+ // },
220
+ // {
221
+ // title: '测试5',
222
+ // // width: 100,
223
+ // // dataIndex: 'test5',
224
+ // // key: 'test5',
225
+ // children: [
226
+ // {
227
+ // title: '测试5-001',
228
+ // width: 100,
229
+ // dataIndex: 'test5-001',
230
+ // key: 'test5-001',
231
+ // },
232
+ // {
233
+ // title: '测试5-002',
234
+ // width: 100,
235
+ // dataIndex: 'test5-002',
236
+ // key: 'test5-002',
237
+ // },
238
+ // ],
239
+ // },
240
+ // {
241
+ // title: '测试6',
242
+ // width: 100,
243
+ // dataIndex: 'test6',
244
+ // key: 'test6',
245
+ // },
246
+ // {
247
+ // title: '测试7',
248
+ // width: 100,
249
+ // dataIndex: 'test7',
250
+ // key: 'test7',
251
+ // },
252
+ // {
253
+ // title: '测试8',
254
+ // width: 100,
255
+ // dataIndex: 'test8',
256
+ // key: 'test8',
257
+ // },
258
+ // {
259
+ // title: '测试9',
260
+ // width: 100,
261
+ // dataIndex: 'test9',
262
+ // key: 'test9',
263
+ // },
264
+ // {
265
+ // title: '测试10',
266
+ // width: 100,
267
+ // dataIndex: 'test10',
268
+ // key: 'test10',
269
+ // },
246
270
  ];
247
271
  // 初始化渲染,针对配置了editable、editableConfig的列配置
248
272
  useEffect(function () {
@@ -300,6 +324,30 @@ var EditableTable = function () {
300
324
  setRecords(newDataSource);
301
325
  setMoveChange(true);
302
326
  }, [setRecords]);
327
+ // 表格改变
328
+ var onTableChange = useCallback(function (changeRecords, startIndex) {
329
+ if (!Array.isArray(changeRecords)) {
330
+ return;
331
+ }
332
+ var endIndex = startIndex + changeRecords.length - 1;
333
+ var currentRecords = Array.isArray(recordsRef.current)
334
+ ? recordsRef.current.slice()
335
+ : [];
336
+ if (endIndex > currentRecords.length - 1) {
337
+ endIndex = currentRecords.length - 1;
338
+ }
339
+ var currentIndex = 0;
340
+ console.log(changeRecords, startIndex, endIndex);
341
+ var newRecords = currentRecords.map(function (record, index) {
342
+ if (index >= startIndex && index <= endIndex) {
343
+ var obj = __assign(__assign({}, record), changeRecords[currentIndex]);
344
+ currentIndex++;
345
+ return obj;
346
+ }
347
+ return record;
348
+ });
349
+ setRecords(newRecords);
350
+ }, []);
303
351
  return (React.createElement("div", null,
304
352
  React.createElement("div", null,
305
353
  "\u53EF\u7F16\u8F91\u8868\u683C\uFF1B\u5982\u679C\u662F\u8F93\u5165\u6846\uFF0C\u53EF\u4F7F\u7528\u8868\u683C\u9ED8\u8BA4\u63D0\u4F9B\u7684\u7F16\u8F91\u6846\uFF1B \u914D\u7F6Eeditable\u4E3Atrue\u5373\u53EF\uFF0C\u8FD8\u53EF\u914D\u7F6EeditableConfig\u914D\u7F6E\u6267\u884C\u7C7B\u578B\u7B49\uFF1B\u5177\u4F53editableConfig\u53EF\u67E5\u770B\u8BE6\u7EC6\u7B7E\u540D",
@@ -315,6 +363,7 @@ var EditableTable = function () {
315
363
  React.createElement("p", null, "1.\u7F16\u5199\u9A8C\u8BC1\u89C4\u5219\uFF0C\u5728\u5217\u91CC\u9762\u7F16\u5199\uFF0C\u901A\u8FC7\u4F20\u5165validate\u5C5E\u6027\u914D\u7F6E,\u5177\u4F53\u53EF\u67E5\u770B\u7B7E\u540D \u5982\u679C\u53EA\u662F\u7B80\u5355\u7684\u975E\u7A7A\u9A8C\u8BC1\uFF0C\u90A3\u4E48\u53EF\u4F20\u5165\u4E00\u4E2A\u7A7A\u5BF9\u8C61\u5373\u53EF \u5982\u679C\u662F\u590D\u6742\u9A8C\u8BC1\u53EF\u901A\u8FC7validate\u4F20\u5165\u66F4\u591A\u914D\u7F6E"),
316
364
  React.createElement("p", null, "2.\u5982\u679C\u4F20\u5165\u4E86\u81EA\u5B9A\u4E49render\u51FD\u6570\uFF0C\u7EC4\u4EF6\u65E0\u6CD5\u638C\u63E1\u5728\u4F55\u65F6\u6E05\u7A7A\u9519\u8BEF\u4FE1\u606F\uFF0C\u6240\u4EE5\u9700\u8981\u8C03\u7528\u65B9\u4E3B\u52A8\u6E05\u7A7A\u9519\u8BEF\u4FE1\u606F")),
317
365
  React.createElement(Button, { onClick: function () {
366
+ console.log(records);
318
367
  (function () {
319
368
  var _a;
320
369
  return __awaiter(this, void 0, void 0, function () {
@@ -351,15 +400,12 @@ var EditableTable = function () {
351
400
  // tableValidate
352
401
  tableHandleRef: tableHandleRef, tableName: "\u6211\u662F\u4E00\u4E2A\u8868\u683C",
353
402
  // 显隐配置
354
- configInfo: tableConfig, showColumnDynamic: true, showColumnDynamicKey: "test-o-0011",
355
- // expandable={{
356
- // expandedRowRender: (record) => <p style={{ margin: 0 }}>111</p>,
357
- // rowExpandable: (record) => true,
358
- // }}
359
- // rowSelection={{
360
- // type: 'checkbox',
361
- // }}
362
- summaryConfig: [
403
+ configInfo: tableConfig, showColumnDynamic: true, showColumnDynamicKey: "test-o-0011", onTableChange: onTableChange, expandable: {
404
+ expandedRowRender: function (record) { return React.createElement("p", { style: { margin: 0 } }, "111"); },
405
+ rowExpandable: function (record) { return true; },
406
+ }, rowSelection: {
407
+ type: 'checkbox',
408
+ }, summaryConfig: [
363
409
  {
364
410
  type: 'subtotal',
365
411
  fields: [
@@ -93,28 +93,29 @@ function downloadFontTTF(_a) {
93
93
  });
94
94
  }
95
95
  var PrintContainer = function (_a) {
96
- 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, _j = _a.showPluginPrintBtn, showPluginPrintBtn = _j === void 0 ? true : _j, isUseXy = _a.isUseXy, localKey = _a.localKey, _k = _a.showExportBtn, showExportBtn = _k === void 0 ? true : _k, showSetFontBtn = _a.showSetFontBtn, _l = _a.isSetPosition, isSetPosition = _l === void 0 ? true : _l, showAddSeal = _a.showAddSeal, apiUrl = _a.apiUrl, defaultAddWater = _a.defaultAddWater, fileBaseUrl = _a.fileBaseUrl;
97
- var _m = useState(false), showWater = _m[0], setShowWater = _m[1];
98
- var _o = useState(false), showSeal = _o[0], setShowSeal = _o[1];
96
+ 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, _j = _a.showPluginPrintBtn, showPluginPrintBtn = _j === void 0 ? true : _j, isUseXy = _a.isUseXy, localKey = _a.localKey, _k = _a.showExportBtn, showExportBtn = _k === void 0 ? true : _k, showSetFontBtn = _a.showSetFontBtn, isSetPosition = _a.isSetPosition, // 默认不需要偏移
97
+ showAddSeal = _a.showAddSeal, apiUrl = _a.apiUrl, defaultAddWater = _a.defaultAddWater, fileBaseUrl = _a.fileBaseUrl;
98
+ var _l = useState(false), showWater = _l[0], setShowWater = _l[1];
99
+ var _m = useState(false), showSeal = _m[0], setShowSeal = _m[1];
99
100
  var containerRef = useRef();
100
101
  var allDomRef = useRef();
101
- var _p = useState(false), spinning = _p[0], setSpinning = _p[1];
102
+ var _o = useState(false), spinning = _o[0], setSpinning = _o[1];
102
103
  // 确认盖章后,会得到一个合同id 这个之后盖章要用
103
- var _q = useState(), currentContractId = _q[0], setCurrentContractId = _q[1];
104
+ var _p = useState(), currentContractId = _p[0], setCurrentContractId = _p[1];
104
105
  // 盖章后会得到一个预览地址,这个地址耀保存,同一个合同id,不能重复盖章接口
105
- var _r = useState(), currentViewUrl = _r[0], setCurrentViewUrl = _r[1];
106
+ var _q = useState(), currentViewUrl = _q[0], setCurrentViewUrl = _q[1];
106
107
  // 收到盖章-印章列表
107
- var _s = useState(), _sealIdList = _s[0], setSealIdList = _s[1];
108
+ var _r = useState(), _sealIdList = _r[0], setSealIdList = _r[1];
108
109
  // 自动盖章-印章列表
109
- var _t = useState(), autoSealList = _t[0], setAutoSealList = _t[1];
110
+ var _s = useState(), autoSealList = _s[0], setAutoSealList = _s[1];
110
111
  // 印章id
111
- var _u = useState(), sealFileIdList = _u[0], setSealFileIdList = _u[1];
112
+ var _t = useState(), sealFileIdList = _t[0], setSealFileIdList = _t[1];
112
113
  // 边距调整相关
113
- var _v = useState(false), visible = _v[0], setVisible = _v[1];
114
- var _w = useState({
114
+ var _u = useState(false), visible = _u[0], setVisible = _u[1];
115
+ var _v = useState({
115
116
  top: 0,
116
117
  left: 0,
117
- }), value = _w[0], setValue = _w[1];
118
+ }), value = _v[0], setValue = _v[1];
118
119
  useNeedLodop();
119
120
  useEffect(function () {
120
121
  var v = getPositionLocal(localKey);
@@ -551,8 +552,8 @@ var PrintContainer = function (_a) {
551
552
  pdfOption: {
552
553
  pageFormat: options.pdfOptions.format,
553
554
  // 因为生成的pdf需要打印,所以边距需要去掉
554
- pageMarginX: 0,
555
- pageMarginY: 0,
555
+ pageMarginX: isSetPosition ? 0 : 20,
556
+ pageMarginY: isSetPosition ? 0 : 10,
556
557
  pageOrient: options.pdfOptions.orientation,
557
558
  },
558
559
  })
@@ -27,6 +27,7 @@ interface IProps<RecordType> {
27
27
  /** 表格列配置相关信息 */
28
28
  configInfo?: IConfigInfo;
29
29
  copyByKey?: any;
30
+ onTableChange?: any;
30
31
  }
31
32
  export declare const getTableLayoutFullData: (columns: any, tableLayout: any) => any;
32
33
  export declare const LOCALSTORAGE_KEY = "ztui_dynamic_table_key";
@@ -14,7 +14,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
14
14
  to[j] = from[i];
15
15
  return to;
16
16
  };
17
- import React, { useCallback, useEffect, useState } from 'react';
17
+ import React, { useCallback, useEffect, useState, useRef } from 'react';
18
18
  import Button from '../../Button';
19
19
  import { PicRightOutlined } from '@ant-design/icons';
20
20
  import TableAddDelColumn from '../table-adddel-column';
@@ -152,8 +152,9 @@ export function setDynamicKey(dynamicStorageKey, value) {
152
152
  localStorage.setItem(LOCALSTORAGE_LRU_KEY, JSON.stringify(lruKeys));
153
153
  }
154
154
  function useColumns(props) {
155
- var columns = props.columns, showColumnDynamic = props.showColumnDynamic, showColumnDynamicKey = props.showColumnDynamicKey, onAddAndDelHandle = props.onAddAndDelHandle, hideAddIcon = props.hideAddIcon, addIconText = props.addIconText, hideDelIcon = props.hideDelIcon, delIconText = props.delIconText, showDynamicHandle = props.showDynamicHandle, onEditableSave = props.onEditableSave, configInfo = props.configInfo, copyByKey = props.copyByKey;
155
+ var columns = props.columns, showColumnDynamic = props.showColumnDynamic, showColumnDynamicKey = props.showColumnDynamicKey, onAddAndDelHandle = props.onAddAndDelHandle, hideAddIcon = props.hideAddIcon, addIconText = props.addIconText, hideDelIcon = props.hideDelIcon, delIconText = props.delIconText, showDynamicHandle = props.showDynamicHandle, onEditableSave = props.onEditableSave, configInfo = props.configInfo, copyByKey = props.copyByKey, onTableChange = props.onTableChange;
156
156
  var tableLayout = getStorage(showColumnDynamicKey);
157
+ var newColumnsRef = useRef();
157
158
  // 新的columns
158
159
  var _a = useState(getTableLayoutFullData(columns, tableLayout)), newColumns = _a[0], setNewColumns = _a[1];
159
160
  // 需要动态配置的列
@@ -221,6 +222,8 @@ function useColumns(props) {
221
222
  dataIndex: dataIndex_1,
222
223
  title: title_1,
223
224
  handleSave: onEditableSave,
225
+ columns: function () { return newColumnsRef.current; },
226
+ onTableChange: onTableChange,
224
227
  });
225
228
  } });
226
229
  // 兼容下拉框滚动行为
@@ -313,6 +316,7 @@ function useColumns(props) {
313
316
  }
314
317
  setNewColumns(_newColumns);
315
318
  setDynamicColumns(_dynamicColumns);
319
+ newColumnsRef.current = _newColumns;
316
320
  // eslint-disable-next-line react-hooks/exhaustive-deps
317
321
  }, [
318
322
  columns,
@@ -33,6 +33,8 @@ interface IEditableCellProps {
33
33
  dataIndex: string;
34
34
  record: any;
35
35
  handleSave: (record: any, index: number | undefined, dataIndex: string) => void;
36
+ columns: any;
37
+ onTableChange: any;
36
38
  }
37
39
  declare const TableEnhanceCell: React.FC<IEditableCellProps>;
38
40
  export default TableEnhanceCell;
@@ -61,7 +61,7 @@ import { EditableContext } from './table-enhance-row';
61
61
  import { Form, Input, InputNumber, Select, message } from '../../index';
62
62
  import { ERROR_TD_CLASSNAME } from './index';
63
63
  var TableEnhanceCell = memo(function (_a) {
64
- var title = _a.title, index = _a.index, editable = _a.editable, editableConfig = _a.editableConfig, children = _a.children, dataIndex = _a.dataIndex, record = _a.record, handleSave = _a.handleSave, restProps = __rest(_a, ["title", "index", "editable", "editableConfig", "children", "dataIndex", "record", "handleSave"]);
64
+ var title = _a.title, index = _a.index, editable = _a.editable, editableConfig = _a.editableConfig, children = _a.children, dataIndex = _a.dataIndex, record = _a.record, handleSave = _a.handleSave, onTableChange = _a.onTableChange, columns = _a.columns, restProps = __rest(_a, ["title", "index", "editable", "editableConfig", "children", "dataIndex", "record", "handleSave", "onTableChange", "columns"]);
65
65
  var form = useContext(EditableContext);
66
66
  var tdRef = useRef();
67
67
  useEffect(function () {
@@ -119,13 +119,67 @@ var TableEnhanceCell = memo(function (_a) {
119
119
  tdRef.current.classList.remove(ERROR_TD_CLASSNAME);
120
120
  }
121
121
  }
122
+ function onPasteHandle(e) {
123
+ if (!onTableChange) {
124
+ return;
125
+ }
126
+ var text = e.clipboardData.getData('text/plain');
127
+ // 首先判断是否有换行符
128
+ if (text) {
129
+ // 兼容多种换行模式
130
+ var textList = [];
131
+ if (text.indexOf('\r\n') !== -1) {
132
+ textList = text.split('\r\n');
133
+ }
134
+ else if (text.indexOf('\r') !== -1) {
135
+ textList = text.split('\r');
136
+ }
137
+ else if (text.indexOf('\n') !== -1) {
138
+ textList = text.split('\n');
139
+ }
140
+ if (textList.length > 0) {
141
+ var newColumns_1 = columns ? columns() : [];
142
+ var currentColumnIndex_1 = newColumns_1.findIndex(function (column) { return (column === null || column === void 0 ? void 0 : column.dataIndex) === dataIndex; });
143
+ // 去掉最后的空字符
144
+ if (textList[textList.length - 1] === '') {
145
+ textList.pop();
146
+ }
147
+ if (textList.length === 1 && textList[0].indexOf('\t') === -1) {
148
+ return;
149
+ }
150
+ e.preventDefault();
151
+ // 说明有换行
152
+ var resultTextList = textList.map(function (textItem) {
153
+ var resultItemList = textItem.split('\t');
154
+ var result = {};
155
+ resultItemList.forEach(function (resultItem, index) {
156
+ var _a;
157
+ if (resultItem === '' || resultItem == null) {
158
+ return;
159
+ }
160
+ if (index === 0) {
161
+ result[dataIndex] = resultItem;
162
+ }
163
+ else {
164
+ var key = (_a = newColumns_1[currentColumnIndex_1 + index]) === null || _a === void 0 ? void 0 : _a.dataIndex;
165
+ if (key) {
166
+ result[key] = resultItem;
167
+ }
168
+ }
169
+ });
170
+ return result;
171
+ });
172
+ onTableChange && onTableChange(resultTextList, index);
173
+ }
174
+ }
175
+ }
122
176
  /**
123
177
  * @description 生成编辑框
124
178
  */
125
179
  var createEditableDom = function (editableConfig) {
126
180
  if (!editableConfig) {
127
181
  return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
128
- React.createElement(Input, { autoComplete: "new-password", maxLength: 50, onPressEnter: save, onBlur: save, allowClear: true, onChange: function (e) {
182
+ React.createElement(Input, { autoComplete: "new-password", maxLength: 50, onPressEnter: save, onBlur: save, allowClear: true, onPaste: onPasteHandle, onChange: function (e) {
129
183
  removeErrorClass();
130
184
  if (!e.target.value) {
131
185
  e.target.focus();
@@ -202,13 +256,13 @@ var TableEnhanceCell = memo(function (_a) {
202
256
  }, onFocus: function (e) {
203
257
  var _a;
204
258
  editableProps.onFocus && ((_a = editableProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(editableProps, e));
205
- }, onChange: function () {
259
+ }, onPaste: onPasteHandle, onChange: function () {
206
260
  removeErrorClass();
207
261
  } }))));
208
262
  }
209
263
  else if (type === 'textArea') {
210
264
  return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
211
- React.createElement(Input.TextArea, __assign({ autoComplete: "new-password", maxLength: 200, autoSize: { maxRows: 3 } }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, onChange: function (e) {
265
+ React.createElement(Input.TextArea, __assign({ autoComplete: "new-password", maxLength: 200, autoSize: { maxRows: 3 } }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, onPaste: onPasteHandle, onChange: function (e) {
212
266
  removeErrorClass();
213
267
  if (!e.target.value) {
214
268
  e.target.focus();
@@ -217,7 +271,7 @@ var TableEnhanceCell = memo(function (_a) {
217
271
  }
218
272
  else {
219
273
  return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
220
- React.createElement(Input, __assign({ autoComplete: "new-password", maxLength: 50 }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, allowClear: true, onChange: function (e) {
274
+ React.createElement(Input, __assign({ autoComplete: "new-password", maxLength: 50 }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, allowClear: true, onPaste: onPasteHandle, onChange: function (e) {
221
275
  removeErrorClass();
222
276
  if (!e.target.value) {
223
277
  e.target.focus();
@@ -44,6 +44,8 @@ export interface IProps<RecordType> extends Omit<TableProps<RecordType>, 'column
44
44
  tableName?: string;
45
45
  /** 表格是否flex布局 */
46
46
  isFlex?: boolean;
47
+ /** 表格change */
48
+ onTableChange?: any;
47
49
  }
48
50
  /**
49
51
  * TodoList
@@ -102,7 +102,7 @@ var components = {
102
102
  */
103
103
  function Table(props) {
104
104
  var _this = this;
105
- var className = props.className, scroll = props.scroll, _a = props.pagination, pagination = _a === void 0 ? false : _a, _b = props.bordered, bordered = _b === void 0 ? true : _b, columns = props.columns, initColumns = props.initColumns, dataSource = props.dataSource, onAddAndDelHandle = props.onAddAndDelHandle, hideAddIcon = props.hideAddIcon, addIconText = props.addIconText, hideDelIcon = props.hideDelIcon, delIconText = props.delIconText, showColumnDynamic = props.showColumnDynamic, showColumnDynamicKey = props.showColumnDynamicKey, summaryConfig = props.summaryConfig, summaryFixed = props.summaryFixed, summary = props.summary, onMoveRow = props.onMoveRow, onEditableSave = props.onEditableSave, onDynamicChange = props.onDynamicChange, _c = props.isResizableColumn, isResizableColumn = _c === void 0 ? true : _c, configInfo = props.configInfo, tableHandleRef = props.tableHandleRef, tableName = props.tableName, isFlex = props.isFlex, restProps = __rest(props, ["className", "scroll", "pagination", "bordered", "columns", "initColumns", "dataSource", "onAddAndDelHandle", "hideAddIcon", "addIconText", "hideDelIcon", "delIconText", "showColumnDynamic", "showColumnDynamicKey", "summaryConfig", "summaryFixed", "summary", "onMoveRow", "onEditableSave", "onDynamicChange", "isResizableColumn", "configInfo", "tableHandleRef", "tableName", "isFlex"]);
105
+ var className = props.className, scroll = props.scroll, _a = props.pagination, pagination = _a === void 0 ? false : _a, _b = props.bordered, bordered = _b === void 0 ? true : _b, columns = props.columns, initColumns = props.initColumns, dataSource = props.dataSource, onAddAndDelHandle = props.onAddAndDelHandle, hideAddIcon = props.hideAddIcon, addIconText = props.addIconText, hideDelIcon = props.hideDelIcon, delIconText = props.delIconText, showColumnDynamic = props.showColumnDynamic, showColumnDynamicKey = props.showColumnDynamicKey, summaryConfig = props.summaryConfig, summaryFixed = props.summaryFixed, summary = props.summary, onMoveRow = props.onMoveRow, onEditableSave = props.onEditableSave, onDynamicChange = props.onDynamicChange, _c = props.isResizableColumn, isResizableColumn = _c === void 0 ? true : _c, configInfo = props.configInfo, tableHandleRef = props.tableHandleRef, tableName = props.tableName, isFlex = props.isFlex, onTableChange = props.onTableChange, restProps = __rest(props, ["className", "scroll", "pagination", "bordered", "columns", "initColumns", "dataSource", "onAddAndDelHandle", "hideAddIcon", "addIconText", "hideDelIcon", "delIconText", "showColumnDynamic", "showColumnDynamicKey", "summaryConfig", "summaryFixed", "summary", "onMoveRow", "onEditableSave", "onDynamicChange", "isResizableColumn", "configInfo", "tableHandleRef", "tableName", "isFlex", "onTableChange"]);
106
106
  // console.log('table render');
107
107
  var classes = classNames('zt-table', className, {
108
108
  'zt-table--flex': isFlex,
@@ -169,6 +169,12 @@ function Table(props) {
169
169
  onEditableSave: onEditableSave,
170
170
  configInfo: configInfo,
171
171
  copyByKey: copyByKey,
172
+ onTableChange: onTableChange
173
+ ? function (resultTextList, startIndex) {
174
+ clearErrorClass();
175
+ onTableChange && onTableChange(resultTextList, startIndex);
176
+ }
177
+ : undefined,
172
178
  }), newColumns = _f.newColumns, dynamicColumns = _f.dynamicColumns, setNewColumns = _f.setNewColumns;
173
179
  /**
174
180
  * @description 保存列配置
@@ -414,7 +420,10 @@ function Table(props) {
414
420
  }
415
421
  : undefined, summary: summaryConfig
416
422
  ? function (pageData) {
417
- var summaryData = getSummaryData(summaryConfig, pageData, newColumns, props.rowSelection ? true : false);
423
+ var summaryData = getSummaryData(summaryConfig, pageData, newColumns, {
424
+ hasRowSelection: props.rowSelection ? true : false,
425
+ hasExpandable: props.expandable ? true : false,
426
+ });
418
427
  return (React.createElement(AntTable.Summary, { fixed: summaryFixed }, summaryData.map(function (summary) {
419
428
  var title = summary.title, key = summary.key, titleIndex = summary.titleIndex, list = summary.list, columnList = summary.columnList, onClickHandle = summary.onClickHandle;
420
429
  return (React.createElement(AntTable.Summary.Row, { key: key }, Array.isArray(list) &&
@@ -22,5 +22,8 @@ export interface ISummaryConfig {
22
22
  * @param hasRowSelection 是否有选择列
23
23
  * @returns any[]
24
24
  */
25
- declare function getSummaryData(summaryConfig: ISummaryConfig[] | undefined, pageData: any, columns: any, hasRowSelection?: boolean): ISummaryData[];
25
+ declare function getSummaryData(summaryConfig: ISummaryConfig[] | undefined, pageData: any, columns: any, { hasRowSelection, hasExpandable, }: {
26
+ hasRowSelection: boolean;
27
+ hasExpandable: boolean;
28
+ }): ISummaryData[];
26
29
  export default getSummaryData;
@@ -12,8 +12,8 @@ import { plus, round } from 'number-precision';
12
12
  * @param hasRowSelection 是否有选择列
13
13
  * @returns any[]
14
14
  */
15
- function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
16
- if (hasRowSelection === void 0) { hasRowSelection = false; }
15
+ function getSummaryData(summaryConfig, pageData, columns, _a) {
16
+ var hasRowSelection = _a.hasRowSelection, hasExpandable = _a.hasExpandable;
17
17
  var _summaryData = [];
18
18
  if (Array.isArray(summaryConfig)) {
19
19
  summaryConfig.forEach(function (summary) {
@@ -76,11 +76,13 @@ function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
76
76
  });
77
77
  _summaryData.push({
78
78
  title: title || '小计',
79
- titleIndex: 0 + (hasRowSelection ? 1 : 0),
79
+ titleIndex: 0 + (hasRowSelection ? 1 : 0) + (hasExpandable ? 1 : 0),
80
80
  key: 'subtotal',
81
- list: hasRowSelection
81
+ list: hasRowSelection && hasExpandable
82
+ ? __spreadArray([undefined, undefined], subtotalResult_1) : hasRowSelection || hasExpandable
82
83
  ? __spreadArray([undefined], subtotalResult_1) : subtotalResult_1,
83
- columnList: hasRowSelection
84
+ columnList: hasRowSelection && hasExpandable
85
+ ? __spreadArray([undefined, undefined], columnResult_1) : hasRowSelection || hasExpandable
84
86
  ? __spreadArray([undefined], columnResult_1) : columnResult_1,
85
87
  onClickHandle: onClickHandle,
86
88
  });
@@ -142,10 +144,13 @@ function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
142
144
  });
143
145
  _summaryData.push({
144
146
  title: title || '总计',
145
- titleIndex: 0 + (hasRowSelection ? 1 : 0),
147
+ titleIndex: 0 + (hasRowSelection ? 1 : 0) + (hasExpandable ? 1 : 0),
146
148
  key: 'total',
147
- list: hasRowSelection ? __spreadArray([undefined], totalResult_1) : totalResult_1,
148
- columnList: hasRowSelection
149
+ list: hasRowSelection && hasExpandable
150
+ ? __spreadArray([undefined, undefined], totalResult_1) : hasRowSelection || hasExpandable
151
+ ? __spreadArray([undefined], totalResult_1) : totalResult_1,
152
+ columnList: hasRowSelection && hasExpandable
153
+ ? __spreadArray([undefined, undefined], columnResult_2) : hasRowSelection || hasExpandable
149
154
  ? __spreadArray([undefined], columnResult_2) : columnResult_2,
150
155
  onClickHandle: onClickHandle,
151
156
  });
@@ -0,0 +1 @@
1
+ export declare const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiZW1wX25hbWUiOm51bGwsImVtcF9udW1iZXIiOm51bGwsImltdF9pZCI6IiIsInJlYWxfbmFtZSI6IumZiOS6mumbhCIsImNsaWVudF90eXBlIjoid2ViIiwiZGF0YV9yb2xlX2lkI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oicG93ZXJlZCBieSB6bWRtcyIsInBvc3RfaWQiOiIiLCJ1c2VyX2lkIjoiMTQxMjk1MzgwNDMzMzU1NTcxNCIsIm9yZ19pZCI6IiIsIm5pY2tfbmFtZSI6IumZiOS6mumbhCIsImNvbXBhbnlfbmFtZSI6bnVsbCwiZGVwdF9pZCI6IiIsImhhbmRsZV9ocl9uYW1lIjpudWxsLCJhY2NvdW50IjoiY2hlbnl4IiwicmVzdW1lX2lkIjoiIn0.FAVrciGMDRE-npF2wFLv30CIs9po2EOCPXbCb65__Ak';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.8.13",
3
+ "version": "3.8.15",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",