ztxkui 4.1.14 → 4.2.0
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/DemoCom/SinaturesDemo.js +1 -0
- package/dist/TableDemo/EditableTable.js +11 -4
- package/dist/TableDemo/data.js +1 -1
- package/dist/TableDemo/index.js +1 -5
- package/dist/components/Table/hooks/useColumns.d.ts +2 -0
- package/dist/components/Table/hooks/useColumns.js +7 -2
- package/dist/components/Table/hooks/useInnerPagination.d.ts +21 -0
- package/dist/components/Table/hooks/useInnerPagination.js +49 -0
- package/dist/components/Table/table-enhance-cell.d.ts +2 -0
- package/dist/components/Table/table-enhance-cell.js +23 -12
- package/dist/components/Table/table.d.ts +7 -0
- package/dist/components/Table/table.js +33 -6
- package/dist/components/Table/utils/validate.js +136 -71
- package/dist/components/business/Signatures/components/DetailTable.js +1 -1
- package/dist/components/business/Signatures/index.js +8 -2
- package/dist/components/business/Signatures/props.d.ts +2 -0
- package/package.json +1 -1
|
@@ -168,6 +168,7 @@ var EditableTable = function () {
|
|
|
168
168
|
test1: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
|
|
169
169
|
test111: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
|
|
170
170
|
test2: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
|
|
171
|
+
test3: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
|
|
171
172
|
});
|
|
172
173
|
}, 5000);
|
|
173
174
|
}, []);
|
|
@@ -282,8 +283,8 @@ var EditableTable = function () {
|
|
|
282
283
|
{
|
|
283
284
|
title: "\u91D1\u989D(\u542B\u7A0E)",
|
|
284
285
|
width: 130,
|
|
285
|
-
dataIndex: '
|
|
286
|
-
key: '
|
|
286
|
+
dataIndex: 'test2222',
|
|
287
|
+
key: 'test2222',
|
|
287
288
|
align: 'center',
|
|
288
289
|
editable: false,
|
|
289
290
|
shouldCellUpdate: function (record, preRecord) {
|
|
@@ -325,12 +326,14 @@ var EditableTable = function () {
|
|
|
325
326
|
validate: {},
|
|
326
327
|
render: function (text, record, index) {
|
|
327
328
|
return (React.createElement(EnhanceSelect, { value: text, list: list1, dataKey: "id", titleKey: "name", dropdownMatchSelectWidth: 130, onChange: function (value, option, fullData) {
|
|
329
|
+
var _a, _b;
|
|
328
330
|
tableHandleRef.current.clearErrorClass(index);
|
|
329
331
|
var newRecord = {
|
|
330
332
|
test3: value,
|
|
331
333
|
test3Name: fullData === null || fullData === void 0 ? void 0 : fullData.name,
|
|
332
334
|
};
|
|
333
|
-
|
|
335
|
+
var realyIndex = (_b = (_a = tableHandleRef.current) === null || _a === void 0 ? void 0 : _a.getRealyIndex) === null || _b === void 0 ? void 0 : _b.call(_a, index);
|
|
336
|
+
onEditableSaveHandle(newRecord, realyIndex);
|
|
334
337
|
} }));
|
|
335
338
|
},
|
|
336
339
|
},
|
|
@@ -436,6 +439,7 @@ var EditableTable = function () {
|
|
|
436
439
|
}, [setRecords]);
|
|
437
440
|
// 表格拖拽排序功能函数
|
|
438
441
|
var onMoveRowHandle = useCallback(function (dragIndex, hoverIndex) {
|
|
442
|
+
console.log(dragIndex, hoverIndex);
|
|
439
443
|
var newRecords = recordsRef.current.slice();
|
|
440
444
|
var dragRow = newRecords[dragIndex];
|
|
441
445
|
var newDataSource = update(newRecords, {
|
|
@@ -515,6 +519,9 @@ var EditableTable = function () {
|
|
|
515
519
|
});
|
|
516
520
|
})();
|
|
517
521
|
} }, "\u9A8C\u8BC1"),
|
|
522
|
+
React.createElement(Button, { onClick: function () {
|
|
523
|
+
console.log(records);
|
|
524
|
+
} }, "\u83B7\u53D6\u6570\u636E"),
|
|
518
525
|
React.createElement(Table, { dataSource: records, columns: columns, rowKey: "id",
|
|
519
526
|
// 表格项可输入
|
|
520
527
|
onEditableSave: onEditableSaveHandle,
|
|
@@ -525,7 +532,7 @@ var EditableTable = function () {
|
|
|
525
532
|
// tableValidate
|
|
526
533
|
tableHandleRef: tableHandleRef, tableName: "\u6211\u662F\u4E00\u4E2A\u8868\u683C",
|
|
527
534
|
// 显隐配置
|
|
528
|
-
configInfo: tableConfig, showColumnDynamic: true, showColumnDynamicKey: "test-o-0011", onTableChange: onTableChange, expandable: {
|
|
535
|
+
configInfo: tableConfig, showColumnDynamic: true, showColumnDynamicKey: "test-o-0011", onTableChange: onTableChange, showInnerPagination: true, expandable: {
|
|
529
536
|
expandedRowRender: function (record) { return React.createElement("p", { style: { margin: 0 } }, "111"); },
|
|
530
537
|
rowExpandable: function (record) { return true; },
|
|
531
538
|
}, rowSelection: {
|
package/dist/TableDemo/data.js
CHANGED
package/dist/TableDemo/index.js
CHANGED
|
@@ -8,16 +8,12 @@ import React from 'react';
|
|
|
8
8
|
// 路由配置
|
|
9
9
|
// store
|
|
10
10
|
// 自定义组件
|
|
11
|
-
import BasicTable from './BasicTable';
|
|
11
|
+
// import BasicTable from './BasicTable';
|
|
12
12
|
import EditableTable from './EditableTable';
|
|
13
13
|
import ModalTable from './ModalTable';
|
|
14
14
|
// 其他文件
|
|
15
15
|
var TableDemo = function () {
|
|
16
16
|
return (React.createElement("div", null,
|
|
17
|
-
React.createElement(BasicTable, null),
|
|
18
|
-
React.createElement(BasicTable, { dynamicKey: "symbol-id-2" }),
|
|
19
|
-
React.createElement(BasicTable, { dynamicKey: "symbol-id-3" }),
|
|
20
|
-
React.createElement(BasicTable, { dynamicKey: "symbol-id-4" }),
|
|
21
17
|
React.createElement(EditableTable, null),
|
|
22
18
|
React.createElement(ModalTable, null)));
|
|
23
19
|
};
|
|
@@ -28,6 +28,8 @@ interface IProps<RecordType> {
|
|
|
28
28
|
configInfo?: IConfigInfo;
|
|
29
29
|
copyByKey?: any;
|
|
30
30
|
onTableChange?: any;
|
|
31
|
+
/** 当前页 */
|
|
32
|
+
currentPage?: any;
|
|
31
33
|
}
|
|
32
34
|
export declare const getTableLayoutFullData: (columns: any, tableLayout: any) => any;
|
|
33
35
|
export declare const LOCALSTORAGE_KEY = "ztui_dynamic_table_key";
|
|
@@ -18,6 +18,7 @@ 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';
|
|
21
|
+
import { getInnerIndex } from './useInnerPagination';
|
|
21
22
|
// 获取表格columns完整数据
|
|
22
23
|
export var getTableLayoutFullData = function (columns, tableLayout) {
|
|
23
24
|
if (Array.isArray(tableLayout) && tableLayout.length > 0) {
|
|
@@ -152,7 +153,7 @@ export function setDynamicKey(dynamicStorageKey, value) {
|
|
|
152
153
|
localStorage.setItem(LOCALSTORAGE_LRU_KEY, JSON.stringify(lruKeys));
|
|
153
154
|
}
|
|
154
155
|
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, onTableChange = props.onTableChange;
|
|
156
|
+
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, currentPage = props.currentPage;
|
|
156
157
|
var tableLayout = getStorage(showColumnDynamicKey);
|
|
157
158
|
var newColumnsRef = useRef();
|
|
158
159
|
// 新的columns
|
|
@@ -224,6 +225,7 @@ function useColumns(props) {
|
|
|
224
225
|
handleSave: onEditableSave,
|
|
225
226
|
columns: function () { return newColumnsRef.current; },
|
|
226
227
|
onTableChange: onTableChange,
|
|
228
|
+
currentpage: currentPage,
|
|
227
229
|
});
|
|
228
230
|
} });
|
|
229
231
|
// 兼容下拉框滚动行为
|
|
@@ -305,7 +307,10 @@ function useColumns(props) {
|
|
|
305
307
|
width: 52,
|
|
306
308
|
fixed: 'left',
|
|
307
309
|
align: 'center',
|
|
308
|
-
render: function (text, render, index) { return (React.createElement(TableAddDelColumn, { onAddAndDelHandle: function (type) {
|
|
310
|
+
render: function (text, render, index) { return (React.createElement(TableAddDelColumn, { onAddAndDelHandle: function (type) {
|
|
311
|
+
var innerIndex = getInnerIndex(currentPage, index);
|
|
312
|
+
onAddAndDelHandle(type, innerIndex);
|
|
313
|
+
}, hideAddIcon: hideAddIcon, addIconText: addIconText, hideDelIcon: hideDelIcon, delIconText: delIconText })); },
|
|
309
314
|
};
|
|
310
315
|
_newColumns.unshift(newColumn);
|
|
311
316
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author 陈亚雄
|
|
3
|
+
* @description 内部分页的相关配置
|
|
4
|
+
*/
|
|
5
|
+
import { TablePaginationConfig } from 'antd';
|
|
6
|
+
import { MutableRefObject } from 'react';
|
|
7
|
+
export declare type ICurrentPage = MutableRefObject<{
|
|
8
|
+
page: number;
|
|
9
|
+
pageSize: number;
|
|
10
|
+
} | null>;
|
|
11
|
+
export declare function getInnerIndex(currentPage: ICurrentPage, index?: number): number;
|
|
12
|
+
export default function useInnerPagination(isShow?: boolean): {
|
|
13
|
+
paginationConfig: false | TablePaginationConfig;
|
|
14
|
+
currentPage: MutableRefObject<{
|
|
15
|
+
page: number;
|
|
16
|
+
pageSize: number;
|
|
17
|
+
}>;
|
|
18
|
+
setCurrent: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
19
|
+
pageSize: number;
|
|
20
|
+
current: number;
|
|
21
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useMemo, useRef, useEffect, useState } from 'react';
|
|
2
|
+
// 获取内部当前索引位置
|
|
3
|
+
export function getInnerIndex(currentPage, index) {
|
|
4
|
+
// 得到当前修改索引相对于 整体数据源 的索引
|
|
5
|
+
var currentPageObj = currentPage === null || currentPage === void 0 ? void 0 : currentPage.current;
|
|
6
|
+
if (!currentPageObj) {
|
|
7
|
+
return isNaN(Number(index)) ? 0 : Number(index);
|
|
8
|
+
}
|
|
9
|
+
var innerIndex = currentPageObj.pageSize * (currentPageObj.page - 1) + (index ? index : 0);
|
|
10
|
+
return innerIndex;
|
|
11
|
+
}
|
|
12
|
+
export default function useInnerPagination(isShow) {
|
|
13
|
+
var currentPage = useRef(null);
|
|
14
|
+
var _a = useState(1), current = _a[0], setCurrent = _a[1];
|
|
15
|
+
var _b = useState(10), pageSize = _b[0], setPageSize = _b[1];
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
if (isShow) {
|
|
18
|
+
currentPage.current = {
|
|
19
|
+
page: current,
|
|
20
|
+
pageSize: isNaN(Number(pageSize)) ? 10 : Number(pageSize),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}, [isShow, current, pageSize]);
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
if (!isShow) {
|
|
26
|
+
currentPage.current = null;
|
|
27
|
+
}
|
|
28
|
+
}, [isShow]);
|
|
29
|
+
var paginationConfig = useMemo(function () { return ({
|
|
30
|
+
current: current,
|
|
31
|
+
pageSize: pageSize,
|
|
32
|
+
onChange: function (page, pageSize) {
|
|
33
|
+
if (isShow) {
|
|
34
|
+
setCurrent(page);
|
|
35
|
+
setPageSize(pageSize);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
hideOnSinglePage: true,
|
|
39
|
+
defaultPageSize: 10,
|
|
40
|
+
pageSizeOptions: ['10', '20'],
|
|
41
|
+
}); }, [isShow, current, pageSize]);
|
|
42
|
+
return {
|
|
43
|
+
paginationConfig: paginationConfig,
|
|
44
|
+
currentPage: currentPage,
|
|
45
|
+
setCurrent: setCurrent,
|
|
46
|
+
pageSize: pageSize,
|
|
47
|
+
current: current,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IFormatterType, ICurrencySymbol } from '../../hooks/useFormatter';
|
|
3
|
+
import { ICurrentPage } from './hooks/useInnerPagination';
|
|
3
4
|
/**配置列属性 */
|
|
4
5
|
export interface IEditableConfig {
|
|
5
6
|
type: 'input' | 'select' | 'inputNumber' | 'textArea';
|
|
@@ -35,6 +36,7 @@ interface IEditableCellProps {
|
|
|
35
36
|
handleSave: (record: any, index: number | undefined, dataIndex: string) => void;
|
|
36
37
|
columns: any;
|
|
37
38
|
onTableChange: any;
|
|
39
|
+
currentpage: ICurrentPage;
|
|
38
40
|
}
|
|
39
41
|
declare const TableEnhanceCell: React.FC<IEditableCellProps>;
|
|
40
42
|
export default TableEnhanceCell;
|
|
@@ -60,8 +60,9 @@ import React, { useContext, useEffect, memo, useRef } from 'react';
|
|
|
60
60
|
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
|
+
import { getInnerIndex } from './hooks/useInnerPagination';
|
|
63
64
|
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, onTableChange = _a.onTableChange, columns = _a.columns, restProps = __rest(_a, ["title", "index", "editable", "editableConfig", "children", "dataIndex", "record", "handleSave", "onTableChange", "columns"]);
|
|
65
|
+
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, currentpage = _a.currentpage, restProps = __rest(_a, ["title", "index", "editable", "editableConfig", "children", "dataIndex", "record", "handleSave", "onTableChange", "columns", "currentpage"]);
|
|
65
66
|
var form = useContext(EditableContext);
|
|
66
67
|
var tdRef = useRef();
|
|
67
68
|
useEffect(function () {
|
|
@@ -74,14 +75,17 @@ var TableEnhanceCell = memo(function (_a) {
|
|
|
74
75
|
* @description 保存事件
|
|
75
76
|
*/
|
|
76
77
|
var save = function (info) { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
|
-
var values, result, currentInputNumberValue, result, currentInputNumberValue, err_1;
|
|
78
|
+
var innerIndex, values, result, currentInputNumberValue, result, currentInputNumberValue, err_1;
|
|
78
79
|
var _a, _b;
|
|
79
80
|
return __generator(this, function (_c) {
|
|
80
81
|
switch (_c.label) {
|
|
81
82
|
case 0:
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
innerIndex = getInnerIndex(currentpage, index);
|
|
84
|
+
_c.label = 1;
|
|
84
85
|
case 1:
|
|
86
|
+
_c.trys.push([1, 3, , 4]);
|
|
87
|
+
return [4 /*yield*/, (form === null || form === void 0 ? void 0 : form.validateFields())];
|
|
88
|
+
case 2:
|
|
85
89
|
values = _c.sent();
|
|
86
90
|
if (!handleSave) {
|
|
87
91
|
console.error('Table props onEditableSave is not a function');
|
|
@@ -91,7 +95,9 @@ var TableEnhanceCell = memo(function (_a) {
|
|
|
91
95
|
currentInputNumberValue = values[dataIndex];
|
|
92
96
|
if (currentInputNumberValue > (result === null || result === void 0 ? void 0 : result.number)) {
|
|
93
97
|
message.warning((result.tableName ? "\u60A8\u4FEE\u6539" + result.tableName + "\u8868\u683C\u7684" : '表格') + " \u7B2C" + (typeof index === 'number' ? index + 1 : index) + "\u884C \u7684" + title + "\u5B57\u6BB5\uFF0C\u8F93\u5165\u7684\u6570\u503C\uFF0C\u5DF2\u8D85\u8FC7\u6700\u5927\u503C\uFF0C\u5DF2\u5E2E\u60A8\u4FEE\u6539\u4E3A\u6700\u5927\u503C!");
|
|
94
|
-
handleSave(__assign(__assign(__assign({}, record), values), (_a = {}, _a[dataIndex] = result === null || result === void 0 ? void 0 : result.number, _a)),
|
|
98
|
+
handleSave(__assign(__assign(__assign({}, record), values), (_a = {}, _a[dataIndex] = result === null || result === void 0 ? void 0 : result.number, _a)),
|
|
99
|
+
// index,
|
|
100
|
+
innerIndex, dataIndex);
|
|
95
101
|
return [2 /*return*/];
|
|
96
102
|
}
|
|
97
103
|
}
|
|
@@ -100,17 +106,20 @@ var TableEnhanceCell = memo(function (_a) {
|
|
|
100
106
|
currentInputNumberValue = values[dataIndex];
|
|
101
107
|
if (currentInputNumberValue < (result === null || result === void 0 ? void 0 : result.number)) {
|
|
102
108
|
message.warning((result.tableName ? "\u60A8\u4FEE\u6539" + result.tableName + "\u8868\u683C\u7684" : '表格') + " \u7B2C" + (index ? index + 1 : index) + "\u884C \u7684" + title + "\u5B57\u6BB5\uFF0C\u8F93\u5165\u7684\u6570\u503C\uFF0C\u5DF2\u4F4E\u4E8E\u6700\u5C0F\u503C\uFF0C\u5DF2\u5E2E\u60A8\u4FEE\u6539\u4E3A\u6700\u5C0F\u503C!");
|
|
103
|
-
handleSave(__assign(__assign(__assign({}, record), values), (_b = {}, _b[dataIndex] = result === null || result === void 0 ? void 0 : result.number, _b)),
|
|
109
|
+
handleSave(__assign(__assign(__assign({}, record), values), (_b = {}, _b[dataIndex] = result === null || result === void 0 ? void 0 : result.number, _b)),
|
|
110
|
+
// index,
|
|
111
|
+
innerIndex, dataIndex);
|
|
104
112
|
return [2 /*return*/];
|
|
105
113
|
}
|
|
106
114
|
}
|
|
107
|
-
handleSave(
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
// handleSave({ ...record, ...values }, index, dataIndex);
|
|
116
|
+
handleSave(__assign(__assign({}, record), values), innerIndex, dataIndex);
|
|
117
|
+
return [3 /*break*/, 4];
|
|
118
|
+
case 3:
|
|
110
119
|
err_1 = _c.sent();
|
|
111
120
|
console.error('Save failed:', err_1);
|
|
112
|
-
return [3 /*break*/,
|
|
113
|
-
case
|
|
121
|
+
return [3 /*break*/, 4];
|
|
122
|
+
case 4: return [2 /*return*/];
|
|
114
123
|
}
|
|
115
124
|
});
|
|
116
125
|
}); };
|
|
@@ -126,6 +135,7 @@ var TableEnhanceCell = memo(function (_a) {
|
|
|
126
135
|
var text = e.clipboardData.getData('text/plain');
|
|
127
136
|
// 首先判断是否有换行符
|
|
128
137
|
if (text) {
|
|
138
|
+
var innerIndex = getInnerIndex(currentpage, index);
|
|
129
139
|
// 兼容多种换行模式
|
|
130
140
|
var textList = [];
|
|
131
141
|
if (text.indexOf('\r\n') !== -1) {
|
|
@@ -169,7 +179,8 @@ var TableEnhanceCell = memo(function (_a) {
|
|
|
169
179
|
});
|
|
170
180
|
return result;
|
|
171
181
|
});
|
|
172
|
-
onTableChange && onTableChange(resultTextList, index, record);
|
|
182
|
+
// onTableChange && onTableChange(resultTextList, index, record);
|
|
183
|
+
onTableChange && onTableChange(resultTextList, innerIndex, record);
|
|
173
184
|
}
|
|
174
185
|
}
|
|
175
186
|
}
|
|
@@ -38,7 +38,12 @@ export interface IProps<RecordType> extends Omit<TableProps<RecordType>, 'column
|
|
|
38
38
|
tableHandleRef?: React.Ref<{
|
|
39
39
|
validate: () => Promise<any>;
|
|
40
40
|
clearErrorClass: (index: number) => void;
|
|
41
|
+
getCurrentPage: () => {
|
|
42
|
+
page: number;
|
|
43
|
+
pageSize: number;
|
|
44
|
+
} | null;
|
|
41
45
|
[prop: string]: any;
|
|
46
|
+
getRealyIndex: (index: number) => number;
|
|
42
47
|
}>;
|
|
43
48
|
/** 表格组件名字 */
|
|
44
49
|
tableName?: string;
|
|
@@ -46,6 +51,8 @@ export interface IProps<RecordType> extends Omit<TableProps<RecordType>, 'column
|
|
|
46
51
|
isFlex?: boolean;
|
|
47
52
|
/** 表格change */
|
|
48
53
|
onTableChange?: any;
|
|
54
|
+
/** 是否开启内部分页。需要处理 修改数据,插入 删除数据。处理批量粘贴数据 */
|
|
55
|
+
showInnerPagination?: boolean;
|
|
49
56
|
}
|
|
50
57
|
/**
|
|
51
58
|
* TodoList
|
|
@@ -77,6 +77,8 @@ import { tableValidate } from './utils/validate';
|
|
|
77
77
|
import classNames from 'classnames';
|
|
78
78
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
79
79
|
import { DndProvider } from 'react-dnd';
|
|
80
|
+
// import update from 'immutability-helper';
|
|
81
|
+
import useInnerPagination, { getInnerIndex } from './hooks/useInnerPagination';
|
|
80
82
|
/**默认scroll配置 */
|
|
81
83
|
// const _scroll = { y: 500, x: 1000 };
|
|
82
84
|
var _scroll = { x: 1000 };
|
|
@@ -102,7 +104,7 @@ var components = {
|
|
|
102
104
|
*/
|
|
103
105
|
function Table(props) {
|
|
104
106
|
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, onTableChange = props.onTableChange, rowSelection = props.rowSelection, 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", "rowSelection"]);
|
|
107
|
+
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, rowSelection = props.rowSelection, showInnerPagination = props.showInnerPagination, 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", "rowSelection", "showInnerPagination"]);
|
|
106
108
|
// console.log('table render');
|
|
107
109
|
var classes = classNames('zt-table', className, {
|
|
108
110
|
'zt-table--flex': isFlex,
|
|
@@ -112,6 +114,8 @@ function Table(props) {
|
|
|
112
114
|
var showDynamicHandle = useCallback(function () { return setDynamicVisible(true); }, []);
|
|
113
115
|
var hideDynamicHandle = useCallback(function () { return setDynamicVisible(false); }, []);
|
|
114
116
|
var dataSourceRef = useRef();
|
|
117
|
+
// 内部分页相关配置
|
|
118
|
+
var _f = useInnerPagination(showInnerPagination), paginationConfig = _f.paginationConfig, currentPage = _f.currentPage, setCurrent = _f.setCurrent, pageSize = _f.pageSize;
|
|
115
119
|
var rowSelectionDataSource = useRef({});
|
|
116
120
|
var myScroll = useMemo(function () {
|
|
117
121
|
if (scroll) {
|
|
@@ -161,7 +165,7 @@ function Table(props) {
|
|
|
161
165
|
* @description 根据配置生成一个新的columns
|
|
162
166
|
* 以及一个需要动态列配置的columns
|
|
163
167
|
*/
|
|
164
|
-
var
|
|
168
|
+
var _g = useColumns({
|
|
165
169
|
columns: _columns,
|
|
166
170
|
showColumnDynamic: showColumnDynamic,
|
|
167
171
|
showColumnDynamicKey: showColumnDynamicKey,
|
|
@@ -180,7 +184,8 @@ function Table(props) {
|
|
|
180
184
|
onTableChange && onTableChange(resultTextList, startIndex);
|
|
181
185
|
}
|
|
182
186
|
: undefined,
|
|
183
|
-
|
|
187
|
+
currentPage: currentPage,
|
|
188
|
+
}), newColumns = _g.newColumns, dynamicColumns = _g.dynamicColumns, setNewColumns = _g.setNewColumns;
|
|
184
189
|
/**
|
|
185
190
|
* @description 保存列配置
|
|
186
191
|
*/
|
|
@@ -271,7 +276,9 @@ function Table(props) {
|
|
|
271
276
|
* @description 切换行位置
|
|
272
277
|
*/
|
|
273
278
|
var moveRowHandle = useCallback(function (dragIndex, hoverIndex) {
|
|
274
|
-
|
|
279
|
+
var innerDragIndex = getInnerIndex(currentPage, dragIndex);
|
|
280
|
+
var innerHoverIndex = getInnerIndex(currentPage, hoverIndex);
|
|
281
|
+
onMoveRow && onMoveRow(innerDragIndex, innerHoverIndex);
|
|
275
282
|
// if (dataSource) {
|
|
276
283
|
// const dragRow = dataSource[dragIndex];
|
|
277
284
|
// const newDataSource = update(dataSource, {
|
|
@@ -282,7 +289,9 @@ function Table(props) {
|
|
|
282
289
|
// });
|
|
283
290
|
// onMoveRow && onMoveRow(newDataSource);
|
|
284
291
|
// }
|
|
285
|
-
},
|
|
292
|
+
},
|
|
293
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
294
|
+
[onMoveRow]);
|
|
286
295
|
/** 伸缩列 */
|
|
287
296
|
var handleResize = function (index) {
|
|
288
297
|
return function (_, _a) {
|
|
@@ -390,6 +399,9 @@ function Table(props) {
|
|
|
390
399
|
rowSelection: props.rowSelection,
|
|
391
400
|
expandable: props.expandable,
|
|
392
401
|
tableName: tableName,
|
|
402
|
+
showInnerPagination: showInnerPagination,
|
|
403
|
+
setCurrent: setCurrent,
|
|
404
|
+
pageSize: pageSize,
|
|
393
405
|
})];
|
|
394
406
|
case 1:
|
|
395
407
|
_a.sent();
|
|
@@ -403,6 +415,17 @@ function Table(props) {
|
|
|
403
415
|
},
|
|
404
416
|
/** 移除错误样式 */
|
|
405
417
|
clearErrorClass: clearErrorClass,
|
|
418
|
+
/** 暴露内部分页提供给外部的一些方法 */
|
|
419
|
+
getCurrentPage: function () {
|
|
420
|
+
return currentPage.current;
|
|
421
|
+
},
|
|
422
|
+
/** 对于自定义render 可以通过这个方法 得到真正更改的行数据 */
|
|
423
|
+
getRealyIndex: function (index) {
|
|
424
|
+
if (currentPage.current && showInnerPagination) {
|
|
425
|
+
return ((currentPage.current.page - 1) * currentPage.current.pageSize + index);
|
|
426
|
+
}
|
|
427
|
+
return index;
|
|
428
|
+
},
|
|
406
429
|
}); });
|
|
407
430
|
var tableResizableTitle = useMemo(function () {
|
|
408
431
|
return {
|
|
@@ -415,7 +438,11 @@ function Table(props) {
|
|
|
415
438
|
? { position: 'relative', overflow: 'hidden', flex: 1 }
|
|
416
439
|
: { position: 'relative', overflow: 'hidden' }, ref: tableRef },
|
|
417
440
|
React.createElement(DndProvider, { backend: HTML5Backend, context: window },
|
|
418
|
-
React.createElement(AntTable, __assign({ className: classes, bordered: bordered, pagination:
|
|
441
|
+
React.createElement(AntTable, __assign({ className: classes, bordered: bordered, pagination: showInnerPagination
|
|
442
|
+
? pagination
|
|
443
|
+
? pagination
|
|
444
|
+
: paginationConfig
|
|
445
|
+
: pagination, scroll: myScroll, columns: mergeColumns, dataSource: dataSource, components: onMoveRow || onEditableSave
|
|
419
446
|
? components
|
|
420
447
|
: isResizableColumn
|
|
421
448
|
? tableResizableTitle
|
|
@@ -40,13 +40,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
40
40
|
*/
|
|
41
41
|
import { ERROR_TD_CLASSNAME } from '../index';
|
|
42
42
|
export function tableValidate(dataSource, mergeColumns, restParams) {
|
|
43
|
-
var _a, _b, _c, _d
|
|
43
|
+
var _a, _b, _c, _d;
|
|
44
44
|
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
-
var getCurrentTable, rowSelection, tableName, expandable,
|
|
46
|
-
return __generator(this, function (
|
|
47
|
-
switch (
|
|
45
|
+
var getCurrentTable, rowSelection, tableName, expandable, showInnerPagination, setCurrent, pageSize, requiredFileds, i, item, _loop_1, j, state_1;
|
|
46
|
+
return __generator(this, function (_e) {
|
|
47
|
+
switch (_e.label) {
|
|
48
48
|
case 0:
|
|
49
|
-
getCurrentTable = restParams.getCurrentTable, rowSelection = restParams.rowSelection, tableName = restParams.tableName, expandable = restParams.expandable;
|
|
49
|
+
getCurrentTable = restParams.getCurrentTable, rowSelection = restParams.rowSelection, tableName = restParams.tableName, expandable = restParams.expandable, showInnerPagination = restParams.showInnerPagination, setCurrent = restParams.setCurrent, pageSize = restParams.pageSize;
|
|
50
50
|
if (!Array.isArray(dataSource) || dataSource.length === 0) {
|
|
51
51
|
console.info('没有数据,无需验证!');
|
|
52
52
|
return [2 /*return*/];
|
|
@@ -68,83 +68,148 @@ export function tableValidate(dataSource, mergeColumns, restParams) {
|
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
resultTr = getCurrentTable().resultTr;
|
|
72
71
|
i = 0;
|
|
73
|
-
|
|
72
|
+
_e.label = 1;
|
|
74
73
|
case 1:
|
|
75
|
-
if (!(i < dataSource.length)) return [3 /*break*/,
|
|
74
|
+
if (!(i < dataSource.length)) return [3 /*break*/, 6];
|
|
76
75
|
item = dataSource[i];
|
|
76
|
+
_loop_1 = function (j) {
|
|
77
|
+
var _f, dataIndex, title, validate, index, value, setElementState, innerCurrentI, currentPage, err_1;
|
|
78
|
+
return __generator(this, function (_g) {
|
|
79
|
+
switch (_g.label) {
|
|
80
|
+
case 0:
|
|
81
|
+
_f = requiredFileds[j], dataIndex = _f.dataIndex, title = _f.title, validate = _f.validate, index = _f.index;
|
|
82
|
+
if (!dataIndex) {
|
|
83
|
+
return [2 /*return*/, "break"];
|
|
84
|
+
}
|
|
85
|
+
value = item[dataIndex];
|
|
86
|
+
if (dataIndex === 'test3') {
|
|
87
|
+
console.log(value);
|
|
88
|
+
}
|
|
89
|
+
setElementState = function (i, index, className) {
|
|
90
|
+
var _a, _b, _c;
|
|
91
|
+
// 获取表格元素
|
|
92
|
+
var resultTr = getCurrentTable().resultTr;
|
|
93
|
+
var errorTr = resultTr[i];
|
|
94
|
+
var errorTds = Array.prototype.slice.call(errorTr === null || errorTr === void 0 ? void 0 : errorTr.children);
|
|
95
|
+
var errorTd = typeof index === 'number' ? errorTds[index] : null;
|
|
96
|
+
(_b = (_a = errorTd === null || errorTd === void 0 ? void 0 : errorTd.classList) === null || _a === void 0 ? void 0 : _a.add) === null || _b === void 0 ? void 0 : _b.call(_a, className);
|
|
97
|
+
(_c = errorTd === null || errorTd === void 0 ? void 0 : errorTd.scrollIntoView) === null || _c === void 0 ? void 0 : _c.call(errorTd);
|
|
98
|
+
};
|
|
99
|
+
innerCurrentI = i;
|
|
100
|
+
currentPage = 1;
|
|
101
|
+
if (showInnerPagination) {
|
|
102
|
+
currentPage = Math.ceil((i + 1) / pageSize);
|
|
103
|
+
innerCurrentI = innerCurrentI - pageSize * (currentPage - 1);
|
|
104
|
+
}
|
|
105
|
+
if (!validate) return [3 /*break*/, 10];
|
|
106
|
+
if (!(typeof validate === 'function')) return [3 /*break*/, 5];
|
|
107
|
+
_g.label = 1;
|
|
108
|
+
case 1:
|
|
109
|
+
_g.trys.push([1, 3, , 4]);
|
|
110
|
+
return [4 /*yield*/, validate(value, item, innerCurrentI + 1, title)];
|
|
111
|
+
case 2:
|
|
112
|
+
_g.sent();
|
|
113
|
+
return [3 /*break*/, 4];
|
|
114
|
+
case 3:
|
|
115
|
+
err_1 = _g.sent();
|
|
116
|
+
if (showInnerPagination) {
|
|
117
|
+
setCurrent(currentPage);
|
|
118
|
+
setTimeout(function () {
|
|
119
|
+
setElementState(innerCurrentI, index, ERROR_TD_CLASSNAME);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
setElementState(i, index, ERROR_TD_CLASSNAME);
|
|
124
|
+
}
|
|
125
|
+
return [2 /*return*/, { value: Promise.reject(err_1) }];
|
|
126
|
+
case 4: return [3 /*break*/, 9];
|
|
127
|
+
case 5:
|
|
128
|
+
if (!!((_b = (_a = validate) === null || _a === void 0 ? void 0 : _a.pattern) === null || _b === void 0 ? void 0 : _b.test(value))) return [3 /*break*/, 9];
|
|
129
|
+
if (!showInnerPagination) return [3 /*break*/, 7];
|
|
130
|
+
setCurrent(currentPage);
|
|
131
|
+
setTimeout(function () {
|
|
132
|
+
setElementState(innerCurrentI, index, ERROR_TD_CLASSNAME);
|
|
133
|
+
});
|
|
134
|
+
return [4 /*yield*/, Promise.reject({
|
|
135
|
+
errorFields: [
|
|
136
|
+
{
|
|
137
|
+
errors: (tableName || '') + " \u7B2C" + (innerCurrentI + 1) + "\u884C " + title + " " + (((_c = validate) === null || _c === void 0 ? void 0 : _c.message) || '填写错误!'),
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
})];
|
|
141
|
+
case 6:
|
|
142
|
+
_g.sent();
|
|
143
|
+
return [3 /*break*/, 9];
|
|
144
|
+
case 7:
|
|
145
|
+
setElementState(i, index, ERROR_TD_CLASSNAME);
|
|
146
|
+
return [4 /*yield*/, Promise.reject({
|
|
147
|
+
errorFields: [
|
|
148
|
+
{
|
|
149
|
+
errors: (tableName || '') + " \u7B2C" + (i + 1) + "\u884C " + title + " " + (((_d = validate) === null || _d === void 0 ? void 0 : _d.message) || '填写错误!'),
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
})];
|
|
153
|
+
case 8:
|
|
154
|
+
_g.sent();
|
|
155
|
+
_g.label = 9;
|
|
156
|
+
case 9: return [3 /*break*/, 14];
|
|
157
|
+
case 10:
|
|
158
|
+
if (!(value === '' || value == null)) return [3 /*break*/, 14];
|
|
159
|
+
if (!showInnerPagination) return [3 /*break*/, 12];
|
|
160
|
+
setCurrent(currentPage);
|
|
161
|
+
setTimeout(function () {
|
|
162
|
+
setElementState(innerCurrentI, index, ERROR_TD_CLASSNAME);
|
|
163
|
+
});
|
|
164
|
+
return [4 /*yield*/, Promise.reject({
|
|
165
|
+
errorFields: [
|
|
166
|
+
{
|
|
167
|
+
errors: (tableName || '') + " \u7B2C" + (innerCurrentI + 1) + "\u884C " + title + " \u4E3A\u7A7A!",
|
|
168
|
+
rowIndex: i,
|
|
169
|
+
colIndex: index,
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
})];
|
|
173
|
+
case 11:
|
|
174
|
+
_g.sent();
|
|
175
|
+
return [3 /*break*/, 14];
|
|
176
|
+
case 12:
|
|
177
|
+
setElementState(i, index, ERROR_TD_CLASSNAME);
|
|
178
|
+
return [4 /*yield*/, Promise.reject({
|
|
179
|
+
errorFields: [
|
|
180
|
+
{
|
|
181
|
+
errors: (tableName || '') + " \u7B2C" + (i + 1) + "\u884C " + title + " \u4E3A\u7A7A!",
|
|
182
|
+
rowIndex: i,
|
|
183
|
+
colIndex: index,
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
})];
|
|
187
|
+
case 13:
|
|
188
|
+
_g.sent();
|
|
189
|
+
_g.label = 14;
|
|
190
|
+
case 14: return [2 /*return*/];
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
};
|
|
77
194
|
j = 0;
|
|
78
|
-
|
|
195
|
+
_e.label = 2;
|
|
79
196
|
case 2:
|
|
80
|
-
if (!(j < requiredFileds.length)) return [3 /*break*/,
|
|
81
|
-
|
|
82
|
-
if (!dataIndex) {
|
|
83
|
-
return [3 /*break*/, 13];
|
|
84
|
-
}
|
|
85
|
-
value = item[dataIndex];
|
|
86
|
-
if (!validate) return [3 /*break*/, 10];
|
|
87
|
-
if (!(typeof validate === 'function')) return [3 /*break*/, 7];
|
|
88
|
-
_p.label = 3;
|
|
197
|
+
if (!(j < requiredFileds.length)) return [3 /*break*/, 5];
|
|
198
|
+
return [5 /*yield**/, _loop_1(j)];
|
|
89
199
|
case 3:
|
|
90
|
-
|
|
91
|
-
|
|
200
|
+
state_1 = _e.sent();
|
|
201
|
+
if (typeof state_1 === "object")
|
|
202
|
+
return [2 /*return*/, state_1.value];
|
|
203
|
+
if (state_1 === "break")
|
|
204
|
+
return [3 /*break*/, 5];
|
|
205
|
+
_e.label = 4;
|
|
92
206
|
case 4:
|
|
93
|
-
_p.sent();
|
|
94
|
-
return [3 /*break*/, 6];
|
|
95
|
-
case 5:
|
|
96
|
-
err_1 = _p.sent();
|
|
97
|
-
errorTr = resultTr[i];
|
|
98
|
-
errorTds = Array.prototype.slice.call(errorTr === null || errorTr === void 0 ? void 0 : errorTr.children);
|
|
99
|
-
errorTd = typeof index === 'number' ? errorTds[index] : null;
|
|
100
|
-
(_b = (_a = errorTd === null || errorTd === void 0 ? void 0 : errorTd.classList) === null || _a === void 0 ? void 0 : _a.add) === null || _b === void 0 ? void 0 : _b.call(_a, ERROR_TD_CLASSNAME);
|
|
101
|
-
(_c = errorTd === null || errorTd === void 0 ? void 0 : errorTd.scrollIntoView) === null || _c === void 0 ? void 0 : _c.call(errorTd);
|
|
102
|
-
return [2 /*return*/, Promise.reject(err_1)];
|
|
103
|
-
case 6: return [3 /*break*/, 9];
|
|
104
|
-
case 7:
|
|
105
|
-
if (!!((_e = (_d = validate) === null || _d === void 0 ? void 0 : _d.pattern) === null || _e === void 0 ? void 0 : _e.test(value))) return [3 /*break*/, 9];
|
|
106
|
-
errorTr = resultTr[i];
|
|
107
|
-
errorTds = Array.prototype.slice.call(errorTr === null || errorTr === void 0 ? void 0 : errorTr.children);
|
|
108
|
-
errorTd = typeof index === 'number' ? errorTds[index] : null;
|
|
109
|
-
(_g = (_f = errorTd === null || errorTd === void 0 ? void 0 : errorTd.classList) === null || _f === void 0 ? void 0 : _f.add) === null || _g === void 0 ? void 0 : _g.call(_f, ERROR_TD_CLASSNAME);
|
|
110
|
-
(_h = errorTd === null || errorTd === void 0 ? void 0 : errorTd.scrollIntoView) === null || _h === void 0 ? void 0 : _h.call(errorTd);
|
|
111
|
-
return [4 /*yield*/, Promise.reject({
|
|
112
|
-
errorFields: [
|
|
113
|
-
{
|
|
114
|
-
errors: (tableName || '') + " \u7B2C" + (i + 1) + "\u884C " + title + " " + (((_j = validate) === null || _j === void 0 ? void 0 : _j.message) || '填写错误!'),
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
})];
|
|
118
|
-
case 8:
|
|
119
|
-
_p.sent();
|
|
120
|
-
_p.label = 9;
|
|
121
|
-
case 9: return [3 /*break*/, 12];
|
|
122
|
-
case 10:
|
|
123
|
-
if (!(value === '' || value == null)) return [3 /*break*/, 12];
|
|
124
|
-
errorTr = resultTr[i];
|
|
125
|
-
errorTds = Array.prototype.slice.call(errorTr === null || errorTr === void 0 ? void 0 : errorTr.children);
|
|
126
|
-
errorTd = typeof index === 'number' ? errorTds[index] : null;
|
|
127
|
-
(_l = (_k = errorTd === null || errorTd === void 0 ? void 0 : errorTd.classList) === null || _k === void 0 ? void 0 : _k.add) === null || _l === void 0 ? void 0 : _l.call(_k, ERROR_TD_CLASSNAME);
|
|
128
|
-
(_m = errorTd === null || errorTd === void 0 ? void 0 : errorTd.scrollIntoView) === null || _m === void 0 ? void 0 : _m.call(errorTd);
|
|
129
|
-
return [4 /*yield*/, Promise.reject({
|
|
130
|
-
errorFields: [
|
|
131
|
-
{
|
|
132
|
-
errors: (tableName || '') + " \u7B2C" + (i + 1) + "\u884C " + title + " \u4E3A\u7A7A!",
|
|
133
|
-
rowIndex: i,
|
|
134
|
-
colIndex: index,
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
})];
|
|
138
|
-
case 11:
|
|
139
|
-
_p.sent();
|
|
140
|
-
_p.label = 12;
|
|
141
|
-
case 12:
|
|
142
207
|
j++;
|
|
143
208
|
return [3 /*break*/, 2];
|
|
144
|
-
case
|
|
209
|
+
case 5:
|
|
145
210
|
i++;
|
|
146
211
|
return [3 /*break*/, 1];
|
|
147
|
-
case
|
|
212
|
+
case 6: return [2 /*return*/];
|
|
148
213
|
}
|
|
149
214
|
});
|
|
150
215
|
});
|
|
@@ -386,6 +386,6 @@ var DetailTable = function (_a) {
|
|
|
386
386
|
React.createElement("div", { style: { marginBottom: '10px' } },
|
|
387
387
|
createDownloadBtn(),
|
|
388
388
|
createDownloadGzBtn()),
|
|
389
|
-
React.createElement(Table, { columns: columnsLast, rowKey: "attachId", dataSource: records, scroll: { x: 'max-content' }, rowSelection: myRowSelection })));
|
|
389
|
+
React.createElement(Table, { columns: columnsLast, rowKey: "attachId", dataSource: records, scroll: { x: 'max-content', y: 300 }, rowSelection: myRowSelection })));
|
|
390
390
|
};
|
|
391
391
|
export default memo(DetailTable);
|
|
@@ -102,7 +102,8 @@ var FLOW_IDS = [
|
|
|
102
102
|
var Sinatures = function (_a) {
|
|
103
103
|
var isUpload = _a.isUpload, qunjSealChange = _a.qunjSealChange, electronicSealChange = _a.electronicSealChange, onSigValuesChange = _a.onSigValuesChange, handleRef = _a.handleRef, ZT_API_BASEURL = _a.ZT_API_BASEURL, ZT_FILE_BASEURL = _a.ZT_FILE_BASEURL, systemCode = _a.systemCode, token = _a.token, openCustomerModalHandle = _a.openCustomerModalHandle, request = _a.request, showDeleteBtn = _a.showDeleteBtn, batchDownloadZipName = _a.batchDownloadZipName, otherParams = __rest(_a, ["isUpload", "qunjSealChange", "electronicSealChange", "onSigValuesChange", "handleRef", "ZT_API_BASEURL", "ZT_FILE_BASEURL", "systemCode", "token", "openCustomerModalHandle", "request", "showDeleteBtn", "batchDownloadZipName"]);
|
|
104
104
|
var canEdit = otherParams.canEdit, needQj = otherParams.needQj, needDg = otherParams.needDg, needQys = otherParams.needQys, fileList = otherParams.fileList, qunjSeal = otherParams.qunjSeal, electronicSeal = otherParams.electronicSealIdList, flowId = otherParams.flowId, deptId = otherParams.deptId, flowStatus = otherParams.flowStatus, caseId = otherParams.caseId, contract_id = otherParams.contractId, docAttachMap = otherParams.docAttachMap, checkAttachIdList = otherParams.checkAttachIdList, // 已盖章附件id
|
|
105
|
-
documentIdList = otherParams.documentIdList
|
|
105
|
+
documentIdList = otherParams.documentIdList, // 文档id列表
|
|
106
|
+
cancelDefaultCheckedQj = otherParams.cancelDefaultCheckedQj;
|
|
106
107
|
var authToken = token || '';
|
|
107
108
|
// 是否可编辑 1可编辑 0不可编辑
|
|
108
109
|
var isEdit = canEdit === 1;
|
|
@@ -160,6 +161,11 @@ var Sinatures = function (_a) {
|
|
|
160
161
|
var _y = useState([]), unSealList = _y[0], setUnSealList = _y[1];
|
|
161
162
|
// 需重新确认盖章位置的电子印章
|
|
162
163
|
var _z = useState([]), needReSealList = _z[0], setNeedReSealList = _z[1];
|
|
164
|
+
useEffect(function () {
|
|
165
|
+
if (cancelDefaultCheckedQj) {
|
|
166
|
+
setChecked(false);
|
|
167
|
+
}
|
|
168
|
+
}, [cancelDefaultCheckedQj]);
|
|
163
169
|
useEffect(function () {
|
|
164
170
|
fnRef.current = onSigValuesChange;
|
|
165
171
|
}, [onSigValuesChange]);
|
|
@@ -1066,7 +1072,7 @@ var Sinatures = function (_a) {
|
|
|
1066
1072
|
docAttachMap: attachMap,
|
|
1067
1073
|
};
|
|
1068
1074
|
return (React.createElement(React.Fragment, null,
|
|
1069
|
-
isEdit ? (React.createElement(Table, { columns: columnsLast, rowKey: "attachId", loading: tbloading, dataSource: records, scroll: { x: 'max-content' } })) : (React.createElement(DetailTable, __assign({}, detail, { batchDownloadZipName: batchDownloadZipName }))),
|
|
1075
|
+
isEdit ? (React.createElement(Table, { columns: columnsLast, rowKey: "attachId", loading: tbloading, dataSource: records, scroll: { x: 'max-content', y: 400 } })) : (React.createElement(DetailTable, __assign({}, detail, { batchDownloadZipName: batchDownloadZipName }))),
|
|
1070
1076
|
React.createElement(Modal, { title: "\u4E0B\u5217\u5370\u7AE0\u672A\u786E\u8BA4\u76D6\u7AE0\u4F4D\u7F6E\uFF0C\u5982\u4E0D\u9700\u8981\u8BF7\u53D6\u6D88\u52FE\u9009\u3002", width: 800, closable: false, visible: visible, loading: false, onCancel: function () {
|
|
1071
1077
|
setVisible(false);
|
|
1072
1078
|
}, footer: React.createElement(React.Fragment, null,
|