linkmore-design 1.1.27 → 1.1.28-alpha.6
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/LmEditTable/DndContainer.d.ts +6 -3
- package/dist/LmEditTable/EditTable.d.ts +15 -5
- package/dist/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/dist/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/dist/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/dist/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/dist/LmEditTable/components/index.d.ts +17 -0
- package/dist/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/dist/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/dist/LmEditTable/sortableItem.d.ts +3 -2
- package/dist/LmEditTable/util.d.ts +10 -0
- package/dist/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/dist/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
- package/dist/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/dist/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/dist/LmEditTable/virtual/context.d.ts +13 -0
- package/dist/LmEditTable/virtual/index.d.ts +4 -0
- package/dist/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.umd.js +1909 -679
- package/dist/index.umd.min.js +21 -21
- package/dist/variables.css +115 -2
- package/es/CardTable/style/index.css +3 -2
- package/es/CardTable/style/variables.css +3 -2
- package/es/CustomTableOption/columnsSort.js +41 -18
- package/es/CustomTableOption/filterSort.js +14 -6
- package/es/CustomTableOption/style/index.css +3 -0
- package/es/CustomTableOption/style/variables.css +3 -0
- package/es/Form/FormItem/index.js +5 -1
- package/es/InputNumber/index.js +7 -9
- package/es/LmEditTable/DndContainer.d.ts +6 -3
- package/es/LmEditTable/DndContainer.js +70 -10
- package/es/LmEditTable/DragHandle.js +1 -1
- package/es/LmEditTable/EditTable.d.ts +15 -5
- package/es/LmEditTable/EditTable.js +696 -361
- package/es/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/es/LmEditTable/components/DraggableContainer.js +39 -0
- package/es/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/es/LmEditTable/components/QuickOpetate.js +82 -0
- package/es/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/es/LmEditTable/components/bottomOpetateComponent.js +23 -0
- package/es/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/es/LmEditTable/components/customRenderEmpty.js +20 -0
- package/es/LmEditTable/components/index.d.ts +17 -0
- package/es/LmEditTable/components/index.js +8 -0
- package/es/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/es/LmEditTable/hooks/useForkRef.js +22 -0
- package/es/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/es/LmEditTable/rowSort/DndContainerRow.js +83 -0
- package/es/LmEditTable/sortableItem.d.ts +3 -2
- package/es/LmEditTable/sortableItem.js +16 -4
- package/es/LmEditTable/sortableItemCol.js +40 -10
- package/es/LmEditTable/style/index.css +109 -0
- package/es/LmEditTable/style/variables.css +109 -0
- package/es/LmEditTable/util.d.ts +10 -0
- package/es/LmEditTable/util.js +158 -9
- package/es/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/es/LmEditTable/virtual/VirtualRow.js +148 -0
- package/es/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
- package/es/LmEditTable/virtual/VirtualRow2.js +62 -0
- package/es/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/es/LmEditTable/virtual/VirtualTable.js +64 -0
- package/es/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/es/LmEditTable/virtual/VirtualWrapper.js +60 -0
- package/es/LmEditTable/virtual/context.d.ts +13 -0
- package/es/LmEditTable/virtual/context.js +66 -0
- package/es/LmEditTable/virtual/index.d.ts +4 -0
- package/es/LmEditTable/virtual/index.js +4 -0
- package/es/LmFilter/baseFilter/index.js +3 -2
- package/es/LmFilter/filterFns/index.js +4 -2
- package/es/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/es/LmTable/virTual/VirtualRow.js +82 -48
- package/es/LmTable/virTual/VirtualTable.js +17 -9
- package/es/LmTable/virTual/context.js +14 -2
- package/es/LmUpload/body/UploadCore.js +1 -1
- package/es/LmUpload/fns/index.js +1 -1
- package/es/Radio/index.js +9 -1
- package/es/Switch/index.js +7 -2
- package/es/hooks/useEvent/index.js +1 -1
- package/es/index.d.ts +1 -2
- package/es/styles/variables.css +115 -2
- package/lib/CardTable/style/index.css +3 -2
- package/lib/CardTable/style/variables.css +3 -2
- package/lib/CustomTableOption/columnsSort.js +48 -22
- package/lib/CustomTableOption/filterSort.js +19 -10
- package/lib/CustomTableOption/style/index.css +3 -0
- package/lib/CustomTableOption/style/variables.css +3 -0
- package/lib/Form/FormItem/index.js +5 -1
- package/lib/InputNumber/index.js +9 -9
- package/lib/LmEditTable/DndContainer.d.ts +6 -3
- package/lib/LmEditTable/DndContainer.js +74 -9
- package/lib/LmEditTable/DragHandle.js +1 -1
- package/lib/LmEditTable/EditTable.d.ts +15 -5
- package/lib/LmEditTable/EditTable.js +694 -358
- package/lib/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/lib/LmEditTable/components/DraggableContainer.js +52 -0
- package/lib/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/lib/LmEditTable/components/QuickOpetate.js +96 -0
- package/lib/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/lib/LmEditTable/components/bottomOpetateComponent.js +34 -0
- package/lib/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/lib/LmEditTable/components/customRenderEmpty.js +32 -0
- package/lib/LmEditTable/components/index.d.ts +17 -0
- package/lib/LmEditTable/components/index.js +45 -0
- package/lib/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/lib/LmEditTable/hooks/useForkRef.js +29 -0
- package/lib/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/lib/LmEditTable/rowSort/DndContainerRow.js +100 -0
- package/lib/LmEditTable/sortableItem.d.ts +3 -2
- package/lib/LmEditTable/sortableItem.js +19 -5
- package/lib/LmEditTable/sortableItemCol.js +37 -8
- package/lib/LmEditTable/style/index.css +109 -0
- package/lib/LmEditTable/style/variables.css +109 -0
- package/lib/LmEditTable/util.d.ts +10 -0
- package/lib/LmEditTable/util.js +167 -8
- package/lib/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/lib/LmEditTable/virtual/VirtualRow.js +164 -0
- package/lib/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
- package/lib/LmEditTable/virtual/VirtualRow2.js +78 -0
- package/lib/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/lib/LmEditTable/virtual/VirtualTable.js +81 -0
- package/lib/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/lib/LmEditTable/virtual/VirtualWrapper.js +73 -0
- package/lib/LmEditTable/virtual/context.d.ts +13 -0
- package/lib/LmEditTable/virtual/context.js +76 -0
- package/lib/LmEditTable/virtual/index.d.ts +4 -0
- package/lib/LmEditTable/virtual/index.js +31 -0
- package/lib/LmFilter/baseFilter/index.js +3 -2
- package/lib/LmFilter/filterFns/index.js +4 -2
- package/lib/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/lib/LmTable/virTual/VirtualRow.js +81 -48
- package/lib/LmTable/virTual/VirtualTable.js +16 -8
- package/lib/LmTable/virTual/context.js +14 -2
- package/lib/LmUpload/body/UploadCore.js +1 -1
- package/lib/LmUpload/fns/index.js +1 -1
- package/lib/Radio/index.js +9 -1
- package/lib/Switch/index.js +9 -2
- package/lib/hooks/useEvent/index.js +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/styles/variables.css +115 -2
- package/package.json +7 -9
|
@@ -47,43 +47,47 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
47
47
|
}
|
|
48
48
|
return t;
|
|
49
49
|
};
|
|
50
|
-
/* eslint-disable no-unused-vars */
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
import { PlusCircleOutlined } from '@ant-design/icons';
|
|
54
51
|
import moment from 'moment';
|
|
55
52
|
import { arrayMove } from '@dnd-kit/sortable';
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
53
|
+
import { Checkbox, IconFont, Input, InputNumber, Radio, Select, Table, Switch, DatePicker, Form } from 'linkmore-design';
|
|
54
|
+
import { isFunction, omit, isEqual, pick, isBoolean, isObject, debounce } from 'lodash';
|
|
58
55
|
import React, { forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, memo, useCallback } from 'react';
|
|
59
56
|
import { useControllableValue } from 'ahooks';
|
|
60
57
|
import { produce } from 'immer';
|
|
61
58
|
import DndContainer from './DndContainer';
|
|
62
|
-
import SortableBox from './sortableBox';
|
|
63
59
|
import SortableBoxCol from './sortableBoxCol';
|
|
64
60
|
import SortableItem from './sortableItem';
|
|
65
61
|
import ColSortableItem from './sortableItemCol';
|
|
66
62
|
import DragHandle from './DragHandle';
|
|
67
63
|
import UploadOss from '../UploadOss';
|
|
68
|
-
import { isObjEmpty, deepDataSourcePreKeys, isExpandRow, checkRowKeyByDataSource } from './util';
|
|
69
|
-
import
|
|
64
|
+
import { isObjEmpty, deepDataSourcePreKeys, isExpandRow, checkRowKeyByDataSource, checkMemoShouldUploadSpecialFun, checkExpandIconColumnIndex, checkDataSourceIsEmpty, checkTableRowIsDisable } from './util';
|
|
65
|
+
import { DraggableContainer, BottomOpetateComponent, QuickOpetate, CustomizeRenderEmpty } from './components';
|
|
66
|
+
import cls from 'classnames';
|
|
67
|
+
import ConfigProvider from '../ConfigProvider';
|
|
68
|
+
import { VirtualTable, VirtualWrapper, VirtualRow } from './virtual';
|
|
70
69
|
var UploadBtn = UploadOss.UploadBtn;
|
|
71
70
|
var EditableContext = /*#__PURE__*/React.createContext(null); // 表格行
|
|
72
71
|
|
|
73
72
|
var EditableRow = function EditableRow(_a) {
|
|
74
73
|
var index = _a.index,
|
|
75
|
-
|
|
74
|
+
virtual = _a.virtual,
|
|
75
|
+
props = __rest(_a, ["index", "virtual"]);
|
|
76
76
|
|
|
77
77
|
var _Form$useForm = Form.useForm(),
|
|
78
78
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
79
79
|
form = _Form$useForm2[0];
|
|
80
80
|
|
|
81
|
+
var dataKey = props.dataKey,
|
|
82
|
+
pushAllForm = props.pushAllForm;
|
|
83
|
+
pushAllForm === null || pushAllForm === void 0 ? void 0 : pushAllForm(form, dataKey, index);
|
|
81
84
|
return /*#__PURE__*/React.createElement(Form, {
|
|
82
85
|
form: form,
|
|
86
|
+
disabled: props.disabled || false,
|
|
83
87
|
component: false
|
|
84
88
|
}, /*#__PURE__*/React.createElement(EditableContext.Provider, {
|
|
85
89
|
value: form
|
|
86
|
-
}, /*#__PURE__*/React.createElement("tr", Object.assign({}, props))));
|
|
90
|
+
}, virtual ? /*#__PURE__*/React.createElement(VirtualRow, Object.assign({}, props)) : /*#__PURE__*/React.createElement("tr", Object.assign({}, props))));
|
|
87
91
|
};
|
|
88
92
|
|
|
89
93
|
var EditableSortRow = function EditableSortRow(_a) {
|
|
@@ -94,8 +98,12 @@ var EditableSortRow = function EditableSortRow(_a) {
|
|
|
94
98
|
_Form$useForm4 = _slicedToArray(_Form$useForm3, 1),
|
|
95
99
|
form = _Form$useForm4[0];
|
|
96
100
|
|
|
101
|
+
var dataKey = props.dataKey,
|
|
102
|
+
pushAllForm = props.pushAllForm;
|
|
103
|
+
pushAllForm === null || pushAllForm === void 0 ? void 0 : pushAllForm(form, dataKey, index);
|
|
97
104
|
return /*#__PURE__*/React.createElement(Form, {
|
|
98
105
|
form: form,
|
|
106
|
+
disabled: props.disabled || false,
|
|
99
107
|
component: false
|
|
100
108
|
}, /*#__PURE__*/React.createElement(EditableContext.Provider, {
|
|
101
109
|
value: form
|
|
@@ -226,88 +234,7 @@ var InputRange = function InputRange(_a) {
|
|
|
226
234
|
return handleInput(e, 'next');
|
|
227
235
|
}
|
|
228
236
|
}, editEnum))));
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
var Opetate = function Opetate(_ref) {
|
|
233
|
-
var record = _ref.record,
|
|
234
|
-
rowKey = _ref.rowKey,
|
|
235
|
-
handleAdd = _ref.handleAdd,
|
|
236
|
-
handleDelete = _ref.handleDelete,
|
|
237
|
-
_ref$options = _ref.options,
|
|
238
|
-
options = _ref$options === void 0 ? ['add', 'delete'] : _ref$options,
|
|
239
|
-
getLength = _ref.getLength,
|
|
240
|
-
quickOpetateClearAll = _ref.quickOpetateClearAll;
|
|
241
|
-
|
|
242
|
-
var appendChildren = function appendChildren() {
|
|
243
|
-
handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record, true);
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
var appendAdd = function appendAdd() {
|
|
247
|
-
handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record);
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
251
|
-
style: {
|
|
252
|
-
display: 'flex',
|
|
253
|
-
alignItems: 'center',
|
|
254
|
-
justifyContent: 'flex-start',
|
|
255
|
-
marginLeft: '-4px'
|
|
256
|
-
}
|
|
257
|
-
}, options.includes('delete') && /*#__PURE__*/React.createElement(Button, {
|
|
258
|
-
type: "link",
|
|
259
|
-
size: "small",
|
|
260
|
-
disabled: !quickOpetateClearAll && getLength < 2,
|
|
261
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
262
|
-
type: "lmweb-minus-circle",
|
|
263
|
-
style: {
|
|
264
|
-
fontSize: 16
|
|
265
|
-
}
|
|
266
|
-
}),
|
|
267
|
-
onClick: function onClick() {
|
|
268
|
-
return handleDelete(record[rowKey]);
|
|
269
|
-
}
|
|
270
|
-
}), (options === null || options === void 0 ? void 0 : options.includes('add')) && (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/React.createElement(Popover, {
|
|
271
|
-
placement: "bottom",
|
|
272
|
-
overlayClassName: 'lm_table_append_add_popover',
|
|
273
|
-
open: open,
|
|
274
|
-
title: null,
|
|
275
|
-
content: /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", {
|
|
276
|
-
onClick: appendAdd
|
|
277
|
-
}, "\u6DFB\u52A0\u5E73\u7EA7"), /*#__PURE__*/React.createElement("li", {
|
|
278
|
-
onClick: appendChildren
|
|
279
|
-
}, "\u6DFB\u52A0\u5B50\u7EA7")),
|
|
280
|
-
trigger: "hover"
|
|
281
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
282
|
-
type: "link",
|
|
283
|
-
size: "small",
|
|
284
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
285
|
-
type: "lmweb-plus-circle-fill",
|
|
286
|
-
style: {
|
|
287
|
-
fontSize: 16
|
|
288
|
-
}
|
|
289
|
-
})
|
|
290
|
-
})) : (options === null || options === void 0 ? void 0 : options.includes('add')) || (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/React.createElement(Button, {
|
|
291
|
-
type: "link",
|
|
292
|
-
size: "small",
|
|
293
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
294
|
-
type: "lmweb-plus-circle-fill",
|
|
295
|
-
style: {
|
|
296
|
-
fontSize: 16
|
|
297
|
-
}
|
|
298
|
-
}),
|
|
299
|
-
onClick: function onClick() {
|
|
300
|
-
return handleAdd(record, (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? true : false);
|
|
301
|
-
}
|
|
302
|
-
}) : null);
|
|
303
|
-
}; // const isValidValue = (verifyValue) => {
|
|
304
|
-
// const toStringValue = JSON.stringify(verifyValue);
|
|
305
|
-
// if (verifyValue === undefined || verifyValue === null || verifyValue === '' || toStringValue === '[]' || toStringValue === '{}') {
|
|
306
|
-
// return false;
|
|
307
|
-
// }
|
|
308
|
-
// return true;
|
|
309
|
-
// }
|
|
310
|
-
|
|
237
|
+
};
|
|
311
238
|
/*
|
|
312
239
|
表格单元格
|
|
313
240
|
editEnum: 下拉框时的数据数组(非数组时是配置设置)
|
|
@@ -337,9 +264,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
337
264
|
handleDelete = props.handleDelete,
|
|
338
265
|
handleCopy = props.handleCopy,
|
|
339
266
|
itemProps = props.itemProps,
|
|
340
|
-
|
|
341
|
-
reWriteOriginSource = props.reWriteOriginSource,
|
|
342
|
-
restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "rowIndex", "colIndex", "handleTableRowDelete", "handleTableRowAdd", "quickOpetateClearAll", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "handleCopy", "itemProps", "setValid", "reWriteOriginSource"]);
|
|
267
|
+
restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "rowIndex", "colIndex", "handleTableRowDelete", "handleTableRowAdd", "quickOpetateClearAll", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "handleCopy", "itemProps"]);
|
|
343
268
|
/** 去除移入移出功能,保留最纯粹的功能,优化性能 */
|
|
344
269
|
|
|
345
270
|
|
|
@@ -359,6 +284,12 @@ var EditableCell = function EditableCell(props) {
|
|
|
359
284
|
|
|
360
285
|
var inputRef = useRef(null);
|
|
361
286
|
var form = useContext(EditableContext);
|
|
287
|
+
|
|
288
|
+
var _useState5 = useState(false),
|
|
289
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
290
|
+
hoverStatus = _useState6[0],
|
|
291
|
+
setHoverStatus = _useState6[1];
|
|
292
|
+
|
|
362
293
|
useEffect(function () {
|
|
363
294
|
var _a;
|
|
364
295
|
|
|
@@ -369,13 +300,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
369
300
|
|
|
370
301
|
var toggleEdit = function toggleEdit() {
|
|
371
302
|
setEditing(!editing); // form.setFieldsValue({ [dataIndex]: record[dataIndex] });
|
|
372
|
-
}; //
|
|
373
|
-
// const focusCapturedRef = useRef(false);
|
|
374
|
-
// const curValue = useMemo(() => {
|
|
375
|
-
// return record?.dataIndex
|
|
376
|
-
// }, [record])
|
|
377
|
-
// const curValueIsValid = isValidValue(curValue);
|
|
378
|
-
// 校验保存
|
|
303
|
+
}; // 校验保存
|
|
379
304
|
|
|
380
305
|
|
|
381
306
|
var save = function save(row) {
|
|
@@ -427,13 +352,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
427
352
|
case 13:
|
|
428
353
|
if (col === null || col === void 0 ? void 0 : col.hoverEdit) {
|
|
429
354
|
toggleEdit();
|
|
430
|
-
}
|
|
431
|
-
// setValid((old) => {
|
|
432
|
-
// const obj = { ...old }
|
|
433
|
-
// delete obj[record[rowKey]]
|
|
434
|
-
// return obj
|
|
435
|
-
// })
|
|
436
|
-
|
|
355
|
+
}
|
|
437
356
|
|
|
438
357
|
_context.next = 18;
|
|
439
358
|
break;
|
|
@@ -458,15 +377,14 @@ var EditableCell = function EditableCell(props) {
|
|
|
458
377
|
/** 快捷刷子,把当前的所有列的值,刷成当前的选中的列 */
|
|
459
378
|
|
|
460
379
|
|
|
461
|
-
var copyKey = function copyKey(e) {
|
|
380
|
+
var copyKey = function copyKey(e, type) {
|
|
462
381
|
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
463
382
|
var dataIndex = col.dataIndex;
|
|
464
|
-
handleCopy === null || handleCopy === void 0 ? void 0 : handleCopy(dataIndex, record[dataIndex]);
|
|
383
|
+
handleCopy === null || handleCopy === void 0 ? void 0 : handleCopy(dataIndex, record[dataIndex], type, props.rowIndex);
|
|
465
384
|
};
|
|
466
385
|
|
|
467
386
|
var Control = function Control(con) {
|
|
468
|
-
var _a;
|
|
469
|
-
|
|
387
|
+
var _a;
|
|
470
388
|
|
|
471
389
|
var resultComponentProps = isFunction(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
|
|
472
390
|
|
|
@@ -476,7 +394,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
476
394
|
});
|
|
477
395
|
}
|
|
478
396
|
|
|
479
|
-
var clearAttrComponentProps = omit(resultComponentProps, ['optionOnly', 'isOnlyValue']);
|
|
397
|
+
var clearAttrComponentProps = omit(resultComponentProps, ['optionOnly', 'isOnlyValue', 'quickcopy']);
|
|
480
398
|
|
|
481
399
|
switch (con) {
|
|
482
400
|
case 'input':
|
|
@@ -497,19 +415,12 @@ var EditableCell = function EditableCell(props) {
|
|
|
497
415
|
noStyle: true
|
|
498
416
|
}, /*#__PURE__*/React.cloneElement(resultComponentProps.addonAfter, {
|
|
499
417
|
onChange: handleFormItemChange
|
|
500
|
-
})) : null,
|
|
501
|
-
suffix: resultComponentProps.quickcopy ? /*#__PURE__*/React.createElement("span", {
|
|
502
|
-
className: 'lm_table_quickcopy'
|
|
503
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
504
|
-
onClick: copyKey,
|
|
505
|
-
type: 'lmweb-icon_m_brush'
|
|
506
418
|
})) : null
|
|
507
419
|
}));
|
|
508
420
|
|
|
509
421
|
case 'inputRange':
|
|
510
422
|
return /*#__PURE__*/React.createElement(InputRange, Object.assign({
|
|
511
|
-
onChange: handleFormItemChange
|
|
512
|
-
ref: inputRef
|
|
423
|
+
onChange: handleFormItemChange
|
|
513
424
|
}, resultComponentProps, {
|
|
514
425
|
record: record,
|
|
515
426
|
rowIndex: rowIndex,
|
|
@@ -573,8 +484,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
573
484
|
|
|
574
485
|
case 'radio':
|
|
575
486
|
return /*#__PURE__*/React.createElement(Radio, Object.assign({
|
|
576
|
-
onChange: handleFormItemChange
|
|
577
|
-
ref: inputRef
|
|
487
|
+
onChange: handleFormItemChange
|
|
578
488
|
}, clearAttrComponentProps));
|
|
579
489
|
|
|
580
490
|
case 'radioGroup':
|
|
@@ -585,7 +495,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
585
495
|
|
|
586
496
|
case 'switch':
|
|
587
497
|
return /*#__PURE__*/React.createElement(Switch, Object.assign({
|
|
588
|
-
size:
|
|
498
|
+
size: "small"
|
|
589
499
|
}, clearAttrComponentProps, {
|
|
590
500
|
onChange: handleFormItemChange
|
|
591
501
|
}));
|
|
@@ -599,10 +509,9 @@ var EditableCell = function EditableCell(props) {
|
|
|
599
509
|
|
|
600
510
|
case 'operate':
|
|
601
511
|
case 'lm_edit_opetate':
|
|
602
|
-
return /*#__PURE__*/React.createElement(
|
|
512
|
+
return /*#__PURE__*/React.createElement(QuickOpetate, Object.assign({
|
|
603
513
|
record: record,
|
|
604
514
|
rowKey: rowKey,
|
|
605
|
-
ref: inputRef,
|
|
606
515
|
handleAdd: handleTableRowAdd,
|
|
607
516
|
handleDelete: handleTableRowDelete,
|
|
608
517
|
getLength: getLength,
|
|
@@ -616,7 +525,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
616
525
|
var fromData = form.getFieldsValue();
|
|
617
526
|
return render === null || render === void 0 ? void 0 : render(Object.assign(Object.assign({}, !isObjEmpty(fromData) ? Object.assign(Object.assign({}, record), _defineProperty({}, dataIndex, fromData[dataIndex])) : record), {
|
|
618
527
|
onChange: save
|
|
619
|
-
}));
|
|
528
|
+
}), rowIndex);
|
|
620
529
|
}
|
|
621
530
|
|
|
622
531
|
default:
|
|
@@ -653,7 +562,8 @@ var EditableCell = function EditableCell(props) {
|
|
|
653
562
|
valuePropName: editable === 'switch' ? 'checked' : 'value',
|
|
654
563
|
style: {
|
|
655
564
|
margin: 0
|
|
656
|
-
}
|
|
565
|
+
},
|
|
566
|
+
noStyle: formProps ? false : true
|
|
657
567
|
}, formProps, {
|
|
658
568
|
name: dataIndex
|
|
659
569
|
}), Control(editable)));
|
|
@@ -665,6 +575,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
665
575
|
margin: 0
|
|
666
576
|
}
|
|
667
577
|
}, formProps, {
|
|
578
|
+
noStyle: formProps ? false : true,
|
|
668
579
|
name: [dataIndex, 'value']
|
|
669
580
|
}), Control(editable)));
|
|
670
581
|
}
|
|
@@ -675,31 +586,68 @@ var EditableCell = function EditableCell(props) {
|
|
|
675
586
|
}
|
|
676
587
|
|
|
677
588
|
return childNode;
|
|
678
|
-
}, [col, isEdit, editing, getLength]); //
|
|
679
|
-
// 出现死循环找我
|
|
589
|
+
}, [col, isEdit, editing, getLength, record]); // 出现死循环找我
|
|
680
590
|
|
|
681
591
|
useEffect(function () {
|
|
682
592
|
var editable = col.editable,
|
|
683
593
|
dataIndex = col.dataIndex;
|
|
684
594
|
|
|
685
595
|
if (isEdit && editable) {
|
|
686
|
-
form.setFieldsValue(_defineProperty({}, dataIndex, editable === 'date' ? moment(record[dataIndex]) : record[dataIndex]));
|
|
687
|
-
}
|
|
688
|
-
// (isEdit && editable && record[dataIndex]) ||
|
|
689
|
-
// (isHoverEdit && editable && record[dataIndex])
|
|
690
|
-
// ) {
|
|
691
|
-
// form.setFieldsValue({
|
|
692
|
-
// [dataIndex]: editable === 'date' ? moment(record[dataIndex]) : record[dataIndex],
|
|
693
|
-
// })
|
|
694
|
-
// }
|
|
695
|
-
|
|
596
|
+
form.setFieldsValue(_defineProperty({}, dataIndex, editable === 'date' && record[dataIndex] ? moment(record[dataIndex]) : record[dataIndex]));
|
|
597
|
+
}
|
|
696
598
|
}, [record]);
|
|
599
|
+
|
|
600
|
+
var handleTdHover = function handleTdHover() {
|
|
601
|
+
setHoverStatus(true);
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
var handleTdMouseOut = function handleTdMouseOut() {
|
|
605
|
+
setHoverStatus(false);
|
|
606
|
+
};
|
|
607
|
+
|
|
697
608
|
return /*#__PURE__*/React.createElement("td", Object.assign({}, omit(clearProps, ['dataIndex']), {
|
|
698
609
|
className: cls(clearProps === null || clearProps === void 0 ? void 0 : clearProps.className, 'lm_custom_cell_td'),
|
|
610
|
+
onMouseEnter: componentProps.quickcopy ? handleTdHover : undefined,
|
|
611
|
+
onMouseLeave: componentProps.quickcopy ? handleTdMouseOut : undefined,
|
|
699
612
|
key: "r".concat(rowIndex, "_c").concat(colIndex)
|
|
700
|
-
}),
|
|
613
|
+
}), hoverStatus && props.rowIndex > 0 && /*#__PURE__*/React.createElement("span", {
|
|
614
|
+
className: 'quick_copy_warp quick_copy_up',
|
|
615
|
+
onClick: function onClick(e) {
|
|
616
|
+
return copyKey(e, 'up');
|
|
617
|
+
}
|
|
618
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
619
|
+
type: 'lmweb-icon_up'
|
|
620
|
+
})), getMemoChildNode, hoverStatus && props.rowIndex < props.getLength - 1 && /*#__PURE__*/React.createElement("span", {
|
|
621
|
+
className: 'quick_copy_warp quick_copy_down',
|
|
622
|
+
onClick: function onClick(e) {
|
|
623
|
+
return copyKey(e, 'down');
|
|
624
|
+
}
|
|
625
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
626
|
+
type: 'lmweb-icon_down'
|
|
627
|
+
})));
|
|
701
628
|
};
|
|
629
|
+
/** true 不刷新, false 刷新 */
|
|
702
630
|
|
|
631
|
+
|
|
632
|
+
var MemoEditableCell = /*#__PURE__*/memo(EditableCell, function (prev, next) {
|
|
633
|
+
var pickProps = ['record', 'colIndex'];
|
|
634
|
+
var p = pick(prev, pickProps);
|
|
635
|
+
var n = pick(next, pickProps);
|
|
636
|
+
|
|
637
|
+
if (next === null || next === void 0 ? void 0 : next.shouldUpdate) {
|
|
638
|
+
return false;
|
|
639
|
+
} // console.log(!checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n), '22', prev.record, next.record)
|
|
640
|
+
// console.log('333', checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n))
|
|
641
|
+
|
|
642
|
+
/** TODO: 在record中带有children,子列表数据修改之后,会导致父级的record对比不一样 */
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
if (!checkMemoShouldUploadSpecialFun(prev, next)) {
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
return isEqual(p, n);
|
|
650
|
+
});
|
|
703
651
|
var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
704
652
|
var _a, _b;
|
|
705
653
|
|
|
@@ -719,16 +667,24 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
719
667
|
_props$quickOpetateCl = props.quickOpetateClearAll,
|
|
720
668
|
quickOpetateClearAll = _props$quickOpetateCl === void 0 ? true : _props$quickOpetateCl,
|
|
721
669
|
rowSelection = props.rowSelection,
|
|
670
|
+
rowDisabled = props.rowDisabled,
|
|
671
|
+
virtual = props.virtual,
|
|
722
672
|
sortOpen = props.sortOpen,
|
|
673
|
+
disabled = props.disabled,
|
|
723
674
|
colSortOpen = props.colSortOpen,
|
|
675
|
+
_props$indexCol = props.indexCol,
|
|
676
|
+
indexCol = _props$indexCol === void 0 ? false : _props$indexCol,
|
|
724
677
|
filterChange = props.filterChange,
|
|
725
678
|
_props$size = props.size,
|
|
726
679
|
size = _props$size === void 0 ? 'small' : _props$size,
|
|
727
680
|
recordCreatorProps = props.recordCreatorProps,
|
|
728
681
|
_props$shouldUpdate = props.shouldUpdate,
|
|
729
682
|
shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
|
|
730
|
-
|
|
731
|
-
|
|
683
|
+
_props$loading = props.loading,
|
|
684
|
+
loading = _props$loading === void 0 ? false : _props$loading,
|
|
685
|
+
_props$autoSizer = props.autoSizer,
|
|
686
|
+
autoSizer = _props$autoSizer === void 0 ? false : _props$autoSizer,
|
|
687
|
+
resetProps = __rest(props, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "rowDisabled", "virtual", "sortOpen", "disabled", "colSortOpen", "indexCol", "filterChange", "size", "recordCreatorProps", "shouldUpdate", "loading", "autoSizer"]);
|
|
732
688
|
|
|
733
689
|
var _useControllableValue = useControllableValue({
|
|
734
690
|
value: checkRowKeyByDataSource(props.value, _rowKey),
|
|
@@ -736,14 +692,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
736
692
|
}),
|
|
737
693
|
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
|
738
694
|
dataSource = _useControllableValue2[0],
|
|
739
|
-
setDataSource = _useControllableValue2[1];
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
var _useState5 = useState({}),
|
|
743
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
744
|
-
_valid = _useState6[0],
|
|
745
|
-
setValid = _useState6[1]; // const [localRowSelectList, setLocalRowSelectList] = useState([])
|
|
746
|
-
|
|
695
|
+
setDataSource = _useControllableValue2[1];
|
|
747
696
|
|
|
748
697
|
var transformRowSelect = function transformRowSelect(selectedRowKeys, selectedRows, info) {
|
|
749
698
|
var _a;
|
|
@@ -761,42 +710,44 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
761
710
|
localRowSelectList = _useControllableValue4[0],
|
|
762
711
|
setLocalRowSelectList = _useControllableValue4[1];
|
|
763
712
|
|
|
764
|
-
var
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
773
|
-
expandedRowKeys = _useState10[0],
|
|
774
|
-
setExpandedRowKeys = _useState10[1];
|
|
775
|
-
|
|
776
|
-
var dataSourceRef = useRef([]);
|
|
777
|
-
var sortDataSorceRef = useRef([]);
|
|
778
|
-
var deepDataSourceRef = useRef([]);
|
|
713
|
+
var _useControllableValue5 = useControllableValue({
|
|
714
|
+
value: {
|
|
715
|
+
disabledRows: (rowDisabled === null || rowDisabled === void 0 ? void 0 : rowDisabled.disabledRows) || []
|
|
716
|
+
}
|
|
717
|
+
}),
|
|
718
|
+
_useControllableValue6 = _slicedToArray(_useControllableValue5, 1),
|
|
719
|
+
localDisabledRows = _useControllableValue6[0];
|
|
720
|
+
/** TODO: 当前展开的列 */
|
|
779
721
|
|
|
780
|
-
var onSortEnd = function onSortEnd(active, over) {
|
|
781
|
-
var cloneArr = _toConsumableArray(dataSourceRef.current);
|
|
782
722
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
723
|
+
var _useState7 = useState([]),
|
|
724
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
725
|
+
expandedRowKeys = _useState8[0],
|
|
726
|
+
setExpandedRowKeys = _useState8[1];
|
|
727
|
+
|
|
728
|
+
var dataSourceRef = useRef(dataSource);
|
|
729
|
+
var deepDataSourceRef = useRef(deepDataSourcePreKeys(dataSource, _rowKey));
|
|
730
|
+
dataSourceRef.current = dataSource;
|
|
731
|
+
deepDataSourceRef.current = deepDataSourcePreKeys(dataSource, _rowKey);
|
|
732
|
+
var disabledDataSourceRowKeys = useRef(checkTableRowIsDisable(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey));
|
|
733
|
+
disabledDataSourceRowKeys.current = checkTableRowIsDisable(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey);
|
|
734
|
+
var tableWarpRef = useRef(null);
|
|
735
|
+
var autoSizerRef = useRef(null);
|
|
736
|
+
var allFormListRef = useRef({});
|
|
737
|
+
var scrollToIndexRef = useRef(null);
|
|
738
|
+
|
|
739
|
+
var _Form$useForm5 = Form.useForm(),
|
|
740
|
+
_Form$useForm6 = _slicedToArray(_Form$useForm5, 1),
|
|
741
|
+
checkForm = _Form$useForm6[0];
|
|
791
742
|
|
|
792
743
|
var onColSortEnd = function onColSortEnd(active, over) {
|
|
793
744
|
var _a;
|
|
794
745
|
|
|
795
746
|
var oldIndex = columns.findIndex(function (item) {
|
|
796
|
-
return item
|
|
747
|
+
return item.dataIndex === active;
|
|
797
748
|
});
|
|
798
749
|
var newIndex = columns.findIndex(function (item) {
|
|
799
|
-
return item
|
|
750
|
+
return item.dataIndex === over;
|
|
800
751
|
});
|
|
801
752
|
filterChange === null || filterChange === void 0 ? void 0 : filterChange((_a = arrayMove(columns, oldIndex, newIndex)) === null || _a === void 0 ? void 0 : _a.map(function (item, index) {
|
|
802
753
|
return Object.assign(Object.assign({}, item), {
|
|
@@ -809,55 +760,21 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
809
760
|
var handleDelete = function handleDelete(key) {
|
|
810
761
|
var nValue = dataSource.filter(function (item) {
|
|
811
762
|
return item[_rowKey] !== key;
|
|
812
|
-
});
|
|
813
|
-
|
|
763
|
+
});
|
|
814
764
|
setDataSource(nValue);
|
|
815
765
|
};
|
|
816
|
-
/**
|
|
766
|
+
/** 点击底部添加按钮添加 */
|
|
817
767
|
|
|
818
768
|
|
|
819
|
-
var handleAdd = function
|
|
769
|
+
var handleAdd = debounce(function (row) {
|
|
820
770
|
var _a;
|
|
821
771
|
|
|
822
772
|
var addDataInfo = isFunction(recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.initData) ? (_a = recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.initData) === null || _a === void 0 ? void 0 : _a.call(recordCreatorProps) : recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.initData;
|
|
823
773
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
824
774
|
draft.push(Object.assign(_defineProperty({}, _rowKey, "".concat(Date.now())), addDataInfo || {}));
|
|
825
775
|
});
|
|
826
|
-
setDataSource(res);
|
|
827
|
-
};
|
|
828
|
-
|
|
829
|
-
useEffect(function () {
|
|
830
|
-
var _a;
|
|
831
|
-
|
|
832
|
-
dataSourceRef.current = dataSource;
|
|
833
|
-
deepDataSourceRef.current = deepDataSourcePreKeys(dataSource, _rowKey);
|
|
834
|
-
|
|
835
|
-
if (sortOpen) {
|
|
836
|
-
var dataSourceKeys = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
|
|
837
|
-
return item[_rowKey];
|
|
838
|
-
}).join(',');
|
|
839
|
-
var setCallBackFalgKeys = ((_a = sortDataSorceRef.current) === null || _a === void 0 ? void 0 : _a.map(function (item) {
|
|
840
|
-
return item[_rowKey];
|
|
841
|
-
}).join(',')) || '';
|
|
842
|
-
|
|
843
|
-
if (dataSourceKeys !== setCallBackFalgKeys) {
|
|
844
|
-
setCallBackFalg(dataSource);
|
|
845
|
-
sortDataSorceRef.current = dataSource;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
}, [dataSource]); // /** 本地缓存一个选择数据 */
|
|
849
|
-
// useEffect(() => {
|
|
850
|
-
// if (rowSelection) {
|
|
851
|
-
// const { selectedRowKeys } = rowSelection
|
|
852
|
-
// if (selectedRowKeys) {
|
|
853
|
-
// setLocalRowSelectList(localRowSelectList || [])
|
|
854
|
-
// }
|
|
855
|
-
// }
|
|
856
|
-
// }, [rowSelection])
|
|
857
|
-
// const editTableRowChange = (selectRows) => {
|
|
858
|
-
// setLocalRowSelectList(selectRows);
|
|
859
|
-
// // (rowSelection?.onChange as any)?.(selectRows)
|
|
860
|
-
// }
|
|
776
|
+
setDataSource(res);
|
|
777
|
+
}, 40);
|
|
861
778
|
|
|
862
779
|
var handleSave = function handleSave(row, options) {
|
|
863
780
|
var _a, _b;
|
|
@@ -865,9 +782,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
865
782
|
var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[row[_rowKey]]) === null || _b === void 0 ? void 0 : _b.preKeys;
|
|
866
783
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
867
784
|
if (options === null || options === void 0 ? void 0 : options.only) {
|
|
868
|
-
var
|
|
869
|
-
key =
|
|
870
|
-
value =
|
|
785
|
+
var _ref = options === null || options === void 0 ? void 0 : options.only,
|
|
786
|
+
key = _ref.key,
|
|
787
|
+
value = _ref.value;
|
|
871
788
|
|
|
872
789
|
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
873
790
|
var deeps = function deeps(children) {
|
|
@@ -930,25 +847,26 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
930
847
|
}
|
|
931
848
|
});
|
|
932
849
|
setDataSource(res);
|
|
933
|
-
};
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
850
|
+
}; // const reWriteOriginSource = (rowKey: string, rowValue, dataIndex: number, nextValue) => {
|
|
851
|
+
// setDataSource((prevDataSource) => {
|
|
852
|
+
// return prevDataSource?.map((item) => {
|
|
853
|
+
// if (get(item, rowKey) === rowValue) {
|
|
854
|
+
// set(item, dataIndex, nextValue)
|
|
855
|
+
// }
|
|
856
|
+
// return item
|
|
857
|
+
// })
|
|
858
|
+
// })
|
|
859
|
+
// }
|
|
860
|
+
// @ts-ignore
|
|
941
861
|
|
|
942
|
-
|
|
943
|
-
});
|
|
944
|
-
});
|
|
945
|
-
}; // @ts-ignore
|
|
862
|
+
/** 删除当前行 */
|
|
946
863
|
|
|
947
864
|
|
|
948
|
-
var handleTableRowDelete = function
|
|
865
|
+
var handleTableRowDelete = debounce(function (key) {
|
|
949
866
|
var _a, _b, _c;
|
|
950
867
|
|
|
951
|
-
var
|
|
868
|
+
var rkey = isObject(key) ? key[_rowKey] : key;
|
|
869
|
+
var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[rkey]) === null || _b === void 0 ? void 0 : _b.preKeys;
|
|
952
870
|
|
|
953
871
|
if (preKeys.length > 1) {
|
|
954
872
|
/** 说明删除的是children中的数据 */
|
|
@@ -969,7 +887,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
969
887
|
return newData;
|
|
970
888
|
};
|
|
971
889
|
|
|
972
|
-
var res = filter(
|
|
890
|
+
var res = filter(dataSourceRef.current, key);
|
|
973
891
|
setDataSource(res);
|
|
974
892
|
} else {
|
|
975
893
|
if (((_c = dataSourceRef.current) === null || _c === void 0 ? void 0 : _c.length) === 1 && !quickOpetateClearAll) {
|
|
@@ -988,34 +906,76 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
988
906
|
|
|
989
907
|
setDataSource(_res);
|
|
990
908
|
}
|
|
991
|
-
};
|
|
992
|
-
/** 快捷添加 */
|
|
993
909
|
|
|
910
|
+
return null;
|
|
911
|
+
}, 40);
|
|
912
|
+
/** 替换当前行 */
|
|
913
|
+
|
|
914
|
+
var handleTableRowReplace = debounce(function (record, defaultRecord) {
|
|
915
|
+
var _a, _b;
|
|
916
|
+
|
|
917
|
+
var rkey = isObject(record) ? record[_rowKey] : record;
|
|
918
|
+
var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[rkey]) === null || _b === void 0 ? void 0 : _b.preKeys; // const res = cloneDeep(dataSourceRef.current)
|
|
919
|
+
|
|
920
|
+
var deep = function deep(children) {
|
|
921
|
+
return children.map(function (item) {
|
|
922
|
+
if (item[_rowKey] === rkey) {
|
|
923
|
+
return defaultRecord;
|
|
924
|
+
} else if (preKeys.includes(item[_rowKey]) && item.children) {
|
|
925
|
+
var child = deep(item.children);
|
|
926
|
+
return Object.assign(Object.assign({}, item), {
|
|
927
|
+
children: child
|
|
928
|
+
});
|
|
929
|
+
} else {
|
|
930
|
+
return item;
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
};
|
|
994
934
|
|
|
995
|
-
|
|
935
|
+
var res = deep(dataSourceRef.current);
|
|
936
|
+
setDataSource(res);
|
|
937
|
+
}, 40);
|
|
938
|
+
/** 快捷添加 */
|
|
939
|
+
|
|
940
|
+
var handleTableRowAdd = debounce(function (record, isAppendInChindren, defaultRecord) {
|
|
996
941
|
var _a, _b;
|
|
997
942
|
|
|
998
|
-
var
|
|
943
|
+
var rkey = isObject(record) ? record[_rowKey] : record;
|
|
944
|
+
var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[rkey]) === null || _b === void 0 ? void 0 : _b.preKeys;
|
|
999
945
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
1000
|
-
var _a, _b, _c, _d;
|
|
946
|
+
var _a, _b, _c, _d, _e;
|
|
1001
947
|
|
|
1002
|
-
if (preKeys.length > 1) {
|
|
948
|
+
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
1003
949
|
var deeps = function deeps(children) {
|
|
1004
950
|
children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
|
|
1005
|
-
var _a;
|
|
951
|
+
var _a, _b;
|
|
1006
952
|
|
|
1007
953
|
if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
|
|
1008
|
-
if (item[_rowKey] ===
|
|
954
|
+
if (item[_rowKey] === rkey) {
|
|
1009
955
|
if (isAppendInChindren) {
|
|
1010
956
|
if (item === null || item === void 0 ? void 0 : item.children) {
|
|
1011
|
-
|
|
957
|
+
if (Array.isArray(defaultRecord)) {
|
|
958
|
+
var _a2;
|
|
959
|
+
|
|
960
|
+
(_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : (_a2 = _a).push.apply(_a2, _toConsumableArray(defaultRecord));
|
|
961
|
+
} else {
|
|
962
|
+
(_b = item === null || item === void 0 ? void 0 : item.children) === null || _b === void 0 ? void 0 : _b.push(defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
963
|
+
}
|
|
1012
964
|
} else {
|
|
1013
|
-
|
|
965
|
+
if (Array.isArray(defaultRecord)) {
|
|
966
|
+
item.children = _toConsumableArray(defaultRecord);
|
|
967
|
+
} else {
|
|
968
|
+
item.children = [defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
969
|
+
}
|
|
1014
970
|
}
|
|
1015
971
|
|
|
1016
972
|
!expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray(expandedRowKeys), [item[_rowKey]]));
|
|
1017
973
|
} else {
|
|
1018
|
-
|
|
974
|
+
if (Array.isArray(defaultRecord)) {
|
|
975
|
+
children.splice.apply(children, [index + 1, 0].concat(_toConsumableArray(defaultRecord)));
|
|
976
|
+
} else {
|
|
977
|
+
children.splice(index + 1, 0, defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
978
|
+
}
|
|
1019
979
|
}
|
|
1020
980
|
} else if (item.children) {
|
|
1021
981
|
deeps(item.children);
|
|
@@ -1027,31 +987,44 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1027
987
|
deeps(draft);
|
|
1028
988
|
} else {
|
|
1029
989
|
var index = draft.findIndex(function (item) {
|
|
1030
|
-
return
|
|
990
|
+
return rkey === item[_rowKey];
|
|
1031
991
|
});
|
|
1032
992
|
|
|
1033
993
|
if (index !== -1) {
|
|
1034
994
|
if (isAppendInChindren) {
|
|
1035
995
|
if ((_a = draft[index].children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1036
|
-
|
|
996
|
+
if (Array.isArray(defaultRecord)) {
|
|
997
|
+
var _b2;
|
|
998
|
+
|
|
999
|
+
(_b = draft[index].children) === null || _b === void 0 ? void 0 : (_b2 = _b).push.apply(_b2, _toConsumableArray(defaultRecord));
|
|
1000
|
+
} else {
|
|
1001
|
+
(_c = draft[index].children) === null || _c === void 0 ? void 0 : _c.push(defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
1002
|
+
}
|
|
1037
1003
|
} else {
|
|
1038
|
-
draft[index].children = [_defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
1004
|
+
draft[index].children = Array.isArray(defaultRecord) ? _toConsumableArray(defaultRecord) : [defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
1039
1005
|
}
|
|
1040
1006
|
|
|
1041
|
-
!expandedRowKeys.includes((
|
|
1007
|
+
!expandedRowKeys.includes((_d = draft[index]) === null || _d === void 0 ? void 0 : _d[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray(expandedRowKeys), [(_e = draft[index]) === null || _e === void 0 ? void 0 : _e[_rowKey]]));
|
|
1042
1008
|
} else {
|
|
1043
|
-
|
|
1009
|
+
if (Array.isArray(defaultRecord)) {
|
|
1010
|
+
draft.splice.apply(draft, [index + 1, 0].concat(_toConsumableArray(defaultRecord)));
|
|
1011
|
+
} else {
|
|
1012
|
+
draft.splice(index + 1, 0, defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
1013
|
+
}
|
|
1044
1014
|
}
|
|
1045
1015
|
}
|
|
1046
1016
|
}
|
|
1047
1017
|
});
|
|
1048
1018
|
setDataSource(res);
|
|
1049
|
-
};
|
|
1019
|
+
}, 50);
|
|
1020
|
+
/** 快捷刷子功能 */
|
|
1050
1021
|
|
|
1051
|
-
var handleCopy = function handleCopy(key, value) {
|
|
1022
|
+
var handleCopy = function handleCopy(key, value, type, rowIndex) {
|
|
1052
1023
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
1053
|
-
draft === null || draft === void 0 ? void 0 : draft.forEach(function (item) {
|
|
1054
|
-
|
|
1024
|
+
draft === null || draft === void 0 ? void 0 : draft.forEach(function (item, index) {
|
|
1025
|
+
if (type === 'up' && index < rowIndex || type === 'down' && index > rowIndex) {
|
|
1026
|
+
item[key] = value;
|
|
1027
|
+
}
|
|
1055
1028
|
});
|
|
1056
1029
|
});
|
|
1057
1030
|
setDataSource(res);
|
|
@@ -1060,17 +1033,16 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1060
1033
|
|
|
1061
1034
|
|
|
1062
1035
|
var hasDisableOptions = useMemo(function () {
|
|
1063
|
-
// const hasOnlyOptionsDatas = columns.filter(item => item?.['componentProps']?.optionOnly)
|
|
1064
1036
|
var hasOnlyOptionsDatas = columns.filter(function (item) {
|
|
1065
1037
|
var _a;
|
|
1066
1038
|
|
|
1067
1039
|
var resultComponentProps = isFunction(item === null || item === void 0 ? void 0 : item.componentProps) ? (_a = item === null || item === void 0 ? void 0 : item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item === null || item === void 0 ? void 0 : item.componentProps;
|
|
1068
1040
|
return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
|
|
1069
|
-
});
|
|
1041
|
+
}); // const hasOnlyOptionsDatas = columns.filter((item) => item?.componentProps?.optionOnly)
|
|
1070
1042
|
|
|
1071
1043
|
if (hasOnlyOptionsDatas.length) {
|
|
1072
1044
|
return hasOnlyOptionsDatas === null || hasOnlyOptionsDatas === void 0 ? void 0 : hasOnlyOptionsDatas.map(function (item) {
|
|
1073
|
-
return item
|
|
1045
|
+
return item.dataIndex;
|
|
1074
1046
|
});
|
|
1075
1047
|
}
|
|
1076
1048
|
|
|
@@ -1082,12 +1054,11 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1082
1054
|
var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
1083
1055
|
var _a;
|
|
1084
1056
|
|
|
1085
|
-
var resultComponentProps = isFunction(item.componentProps) ? (_a = item
|
|
1086
|
-
|
|
1087
|
-
var _ref5 = resultComponentProps || {},
|
|
1088
|
-
optionOnly = _ref5.optionOnly,
|
|
1089
|
-
options = _ref5.options; // const { optionOnly, options } = item['componentProps'] || {}
|
|
1057
|
+
var resultComponentProps = isFunction(item.componentProps) ? (_a = item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item.componentProps;
|
|
1090
1058
|
|
|
1059
|
+
var _ref8 = resultComponentProps || {},
|
|
1060
|
+
optionOnly = _ref8.optionOnly,
|
|
1061
|
+
options = _ref8.options;
|
|
1091
1062
|
|
|
1092
1063
|
if (optionOnly && options) {
|
|
1093
1064
|
var dataIndex = item.dataIndex;
|
|
@@ -1107,7 +1078,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1107
1078
|
}
|
|
1108
1079
|
|
|
1109
1080
|
return Object.assign(Object.assign({}, item), {
|
|
1110
|
-
componentProps: Object.assign(Object.assign({}, item
|
|
1081
|
+
componentProps: Object.assign(Object.assign({}, item.componentProps), {
|
|
1111
1082
|
options: newOptions
|
|
1112
1083
|
})
|
|
1113
1084
|
});
|
|
@@ -1126,16 +1097,46 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1126
1097
|
var rColumns = hasDisableOptions ? DisableOptions : columns;
|
|
1127
1098
|
var localColumns = [sortOpen ? {
|
|
1128
1099
|
title: '排序',
|
|
1129
|
-
dataIndex: '
|
|
1100
|
+
dataIndex: '_sort',
|
|
1130
1101
|
width: 48,
|
|
1131
1102
|
maxWidth: 48,
|
|
1132
1103
|
className: 'drag-visible',
|
|
1104
|
+
fixed: 'left',
|
|
1133
1105
|
render: function render(_, record) {
|
|
1134
1106
|
return /*#__PURE__*/React.createElement(DragHandle, {
|
|
1135
|
-
id: record[_rowKey] || record.id
|
|
1107
|
+
id: (record === null || record === void 0 ? void 0 : record[_rowKey]) || (record === null || record === void 0 ? void 0 : record.id)
|
|
1136
1108
|
});
|
|
1137
1109
|
}
|
|
1138
|
-
} : null
|
|
1110
|
+
} : null, indexCol ? isBoolean(indexCol) ? {
|
|
1111
|
+
title: '',
|
|
1112
|
+
dataIndex: '_index',
|
|
1113
|
+
width: 48,
|
|
1114
|
+
maxWidth: 48,
|
|
1115
|
+
ellipsis: true,
|
|
1116
|
+
fixed: 'left',
|
|
1117
|
+
render: function render(_, record, index) {
|
|
1118
|
+
var _a, _b, _c;
|
|
1119
|
+
|
|
1120
|
+
return ((_c = (_b = (_a = deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[record[_rowKey]]) === null || _b === void 0 ? void 0 : _b['_deepIds']) === null || _c === void 0 ? void 0 : _c.join('-')) || "".concat(index + 1);
|
|
1121
|
+
}
|
|
1122
|
+
} : Object.assign(Object.assign({
|
|
1123
|
+
title: '',
|
|
1124
|
+
dataIndex: '_index',
|
|
1125
|
+
width: 48,
|
|
1126
|
+
ellipsis: true,
|
|
1127
|
+
maxWidth: 48,
|
|
1128
|
+
fixed: 'left'
|
|
1129
|
+
}, indexCol || {}), {
|
|
1130
|
+
render: function render(_, record, index) {
|
|
1131
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1132
|
+
|
|
1133
|
+
if (isFunction(indexCol === null || indexCol === void 0 ? void 0 : indexCol.render)) {
|
|
1134
|
+
return (_a = indexCol === null || indexCol === void 0 ? void 0 : indexCol.render) === null || _a === void 0 ? void 0 : _a.call(indexCol, record, (_c = (_b = deepDataSourceRef.current) === null || _b === void 0 ? void 0 : _b[record[_rowKey]]) === null || _c === void 0 ? void 0 : _c['_deepIds']);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
return ((_f = (_e = (_d = deepDataSourceRef.current) === null || _d === void 0 ? void 0 : _d[record[_rowKey]]) === null || _e === void 0 ? void 0 : _e['_deepIds']) === null || _f === void 0 ? void 0 : _f.join('-')) || "".concat(index + 1);
|
|
1138
|
+
}
|
|
1139
|
+
}) : null].concat(_toConsumableArray(rColumns), [useQuickOpetate ? {
|
|
1139
1140
|
title: '操作',
|
|
1140
1141
|
dataIndex: 'lm_edit_opetate',
|
|
1141
1142
|
width: 68,
|
|
@@ -1146,11 +1147,11 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1146
1147
|
options: Array.isArray(useQuickOpetate) ? useQuickOpetate : ['add', 'delete']
|
|
1147
1148
|
}
|
|
1148
1149
|
} : null]).filter(function (item) {
|
|
1149
|
-
return item && item.show !== false;
|
|
1150
|
+
return item && (item === null || item === void 0 ? void 0 : item.show) !== false;
|
|
1150
1151
|
});
|
|
1151
|
-
localColumns = localColumns.map(function (item, index) {
|
|
1152
|
+
localColumns = localColumns === null || localColumns === void 0 ? void 0 : localColumns.map(function (item, index) {
|
|
1152
1153
|
return Object.assign(Object.assign({}, item), {
|
|
1153
|
-
order: [null, undefined].includes(item
|
|
1154
|
+
order: [null, undefined].includes(item.order) ? index : item.order
|
|
1154
1155
|
});
|
|
1155
1156
|
}).sort(function (a, b) {
|
|
1156
1157
|
return a.order - b.order;
|
|
@@ -1173,29 +1174,22 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1173
1174
|
var mapColumns = function mapColumns(col, index) {
|
|
1174
1175
|
var _a, _b;
|
|
1175
1176
|
|
|
1176
|
-
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
shouldCellUpdate: function shouldCellUpdate(record, prevRecord) {
|
|
1182
|
-
var _a;
|
|
1183
|
-
|
|
1184
|
-
var dataIndex = col.dataIndex,
|
|
1185
|
-
editable = col.editable,
|
|
1186
|
-
relevanceCols = col.relevanceCols,
|
|
1187
|
-
componentProps = col.componentProps;
|
|
1177
|
+
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length) && (col === null || col === void 0 ? void 0 : col.dataIndex) === '_sort') {
|
|
1178
|
+
var fn = col === null || col === void 0 ? void 0 : col.render;
|
|
1179
|
+
return Object.assign(Object.assign({}, col), {
|
|
1180
|
+
render: function render(text, record, i) {
|
|
1181
|
+
var _a;
|
|
1188
1182
|
|
|
1189
|
-
|
|
1190
|
-
return true;
|
|
1183
|
+
return fn === null || fn === void 0 ? void 0 : fn((_a = dataSource[i]) === null || _a === void 0 ? void 0 : _a[col.dataIndex], dataSource[i], i);
|
|
1191
1184
|
}
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1192
1187
|
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1188
|
+
if (isEdit && (col === null || col === void 0 ? void 0 : col.render) && (col === null || col === void 0 ? void 0 : col.editable) === 'render') {
|
|
1189
|
+
delete col.render;
|
|
1190
|
+
}
|
|
1196
1191
|
|
|
1197
|
-
|
|
1198
|
-
},
|
|
1192
|
+
var newCol = Object.assign({
|
|
1199
1193
|
onCell: function onCell(record, rowIndex) {
|
|
1200
1194
|
return {
|
|
1201
1195
|
getLength: dataSource.length,
|
|
@@ -1210,7 +1204,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1210
1204
|
editable: col.editable,
|
|
1211
1205
|
dataIndex: col.dataIndex,
|
|
1212
1206
|
itemProps: col.itemProps,
|
|
1213
|
-
|
|
1207
|
+
shouldUpdate: shouldUpdate,
|
|
1214
1208
|
isEdit: isEdit,
|
|
1215
1209
|
isHoverEdit: isHoverEdit,
|
|
1216
1210
|
handleAdd: handleAdd,
|
|
@@ -1218,11 +1212,10 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1218
1212
|
handleCopy: handleCopy,
|
|
1219
1213
|
editEnum: typeof col.editEnum === 'function' ? col.editEnum(record) : col.editEnum,
|
|
1220
1214
|
valueType: typeof col.valueType === 'function' ? col.valueType(record) : col.valueType,
|
|
1221
|
-
handleSave: handleSave
|
|
1222
|
-
reWriteOriginSource: reWriteOriginSource
|
|
1215
|
+
handleSave: handleSave
|
|
1223
1216
|
};
|
|
1224
1217
|
}
|
|
1225
|
-
});
|
|
1218
|
+
}, col);
|
|
1226
1219
|
|
|
1227
1220
|
if (col === null || col === void 0 ? void 0 : col.children) {
|
|
1228
1221
|
newCol.children = (_b = col.children) === null || _b === void 0 ? void 0 : _b.map(mapColumns);
|
|
@@ -1231,24 +1224,24 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1231
1224
|
return newCol;
|
|
1232
1225
|
};
|
|
1233
1226
|
|
|
1234
|
-
var res = localColumns.map(function (col, index) {
|
|
1227
|
+
var res = localColumns === null || localColumns === void 0 ? void 0 : localColumns.map(function (col, index) {
|
|
1235
1228
|
return mapColumns(col, index);
|
|
1236
1229
|
});
|
|
1237
1230
|
return res;
|
|
1238
|
-
}, [columns, isAdd, sortOpen, useQuickOpetate,
|
|
1239
|
-
var DraggableContainer = useCallback(function (_a) {
|
|
1240
|
-
var _b;
|
|
1231
|
+
}, [columns, isAdd, sortOpen, useQuickOpetate, dataSource, _toConsumableArray(memoOptions)]);
|
|
1241
1232
|
|
|
1242
|
-
|
|
1233
|
+
var onSortEnd = function onSortEnd(active, over) {
|
|
1234
|
+
var cloneArr = _toConsumableArray(dataSourceRef.current);
|
|
1235
|
+
|
|
1236
|
+
var oldIndex = cloneArr.findIndex(function (v) {
|
|
1237
|
+
return v[_rowKey] === active;
|
|
1238
|
+
});
|
|
1239
|
+
var newIndex = cloneArr.findIndex(function (v) {
|
|
1240
|
+
return v[_rowKey] === over;
|
|
1241
|
+
});
|
|
1242
|
+
setDataSource(arrayMove(cloneArr, oldIndex, newIndex));
|
|
1243
|
+
};
|
|
1243
1244
|
|
|
1244
|
-
return /*#__PURE__*/React.createElement(DndContainer, {
|
|
1245
|
-
move: onSortEnd
|
|
1246
|
-
}, /*#__PURE__*/React.createElement(SortableBox, {
|
|
1247
|
-
items: (_b = dataSourceRef.current) === null || _b === void 0 ? void 0 : _b.map(function (item) {
|
|
1248
|
-
return item[_rowKey];
|
|
1249
|
-
})
|
|
1250
|
-
}, /*#__PURE__*/React.createElement("tbody", Object.assign({}, props))));
|
|
1251
|
-
}, [sortEditTable]);
|
|
1252
1245
|
var colDraggableContainer = useCallback(function (_a) {
|
|
1253
1246
|
var _b;
|
|
1254
1247
|
|
|
@@ -1266,40 +1259,18 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1266
1259
|
}, child);
|
|
1267
1260
|
}));
|
|
1268
1261
|
}, [columns]);
|
|
1269
|
-
var config = useMemo(function () {
|
|
1270
|
-
var component = {
|
|
1271
|
-
body: Object.assign({
|
|
1272
|
-
row: sortOpen ? EditableSortRow : EditableRow,
|
|
1273
|
-
cell: EditableCell
|
|
1274
|
-
}, sortOpen ? {
|
|
1275
|
-
wrapper: DraggableContainer
|
|
1276
|
-
} : {})
|
|
1277
|
-
};
|
|
1278
|
-
|
|
1279
|
-
if (colSortOpen) {
|
|
1280
|
-
component['header'] = {
|
|
1281
|
-
row: colDraggableContainer
|
|
1282
|
-
};
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
return Object.assign({
|
|
1286
|
-
pagination: false,
|
|
1287
|
-
tableLayout: 'fixed',
|
|
1288
|
-
scroll: {
|
|
1289
|
-
x: '100%'
|
|
1290
|
-
},
|
|
1291
|
-
rowKey: function rowKey(record) {
|
|
1292
|
-
return record[_rowKey] || record.index || Math.random();
|
|
1293
|
-
},
|
|
1294
|
-
components: component
|
|
1295
|
-
}, resetProps);
|
|
1296
|
-
}, [resultColumns, dataSource, sortOpen, colSortOpen, size]);
|
|
1297
1262
|
useImperativeHandle(ref, function () {
|
|
1298
1263
|
return {
|
|
1299
1264
|
setRow: handleSave,
|
|
1300
1265
|
getCheckboxRecords: function getCheckboxRecords() {
|
|
1301
1266
|
return localRowSelectList.selectedRows;
|
|
1302
1267
|
},
|
|
1268
|
+
deleteRowData: function deleteRowData(data) {
|
|
1269
|
+
return handleTableRowDelete(data);
|
|
1270
|
+
},
|
|
1271
|
+
addRowData: function addRowData(data, defaultValue, addInChild) {
|
|
1272
|
+
return addInChild === 'replace' ? handleTableRowReplace(data, defaultValue) : handleTableRowAdd(data, addInChild, defaultValue);
|
|
1273
|
+
},
|
|
1303
1274
|
clearSelect: function clearSelect() {
|
|
1304
1275
|
setLocalRowSelectList({
|
|
1305
1276
|
selectedRows: []
|
|
@@ -1310,8 +1281,241 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1310
1281
|
selectedRows: value
|
|
1311
1282
|
});
|
|
1312
1283
|
},
|
|
1313
|
-
|
|
1314
|
-
return
|
|
1284
|
+
columns: columns.map(function (item) {
|
|
1285
|
+
return omit(item, ['render', 'sorter', 'onFilter', 'filters', 'componentProps', 'formProps', 'editable']);
|
|
1286
|
+
}),
|
|
1287
|
+
// verify: async () => {
|
|
1288
|
+
// let allRule = {}
|
|
1289
|
+
// let time
|
|
1290
|
+
// let fullNum = 0
|
|
1291
|
+
// columns.forEach((col: any) => {
|
|
1292
|
+
// if (col?.formProps?.rules) {
|
|
1293
|
+
// allRule[col.dataIndex] = col?.formProps?.rules || []
|
|
1294
|
+
// }
|
|
1295
|
+
// })
|
|
1296
|
+
// const validator = new AsyncValidator(allRule);
|
|
1297
|
+
// let flag = true
|
|
1298
|
+
// let messageIndex = null
|
|
1299
|
+
// let errorRowKey = null
|
|
1300
|
+
// let errorInfo = null
|
|
1301
|
+
// const deepValidator = async (data, index) => {
|
|
1302
|
+
// for (let i = 0; i < data.length; i++) {
|
|
1303
|
+
// if (flag) {
|
|
1304
|
+
// try {
|
|
1305
|
+
// await validator.validate(data[i], (errors, fields) => {
|
|
1306
|
+
// if (errors) {
|
|
1307
|
+
// errorInfo = { errors, fields, value: data[i] };
|
|
1308
|
+
// flag = false
|
|
1309
|
+
// messageIndex = index === null ? i : index
|
|
1310
|
+
// errorRowKey = data?.[i]?.[rowKey]
|
|
1311
|
+
// } else if (data[i].children) {
|
|
1312
|
+
// deepValidator(data[i].children, i)
|
|
1313
|
+
// }
|
|
1314
|
+
// })
|
|
1315
|
+
// } catch (error) {
|
|
1316
|
+
// break;
|
|
1317
|
+
// }
|
|
1318
|
+
// }
|
|
1319
|
+
// }
|
|
1320
|
+
// }
|
|
1321
|
+
// await deepValidator(dataSource, null)
|
|
1322
|
+
// console.log(flag, 'fff')
|
|
1323
|
+
// if (flag) {
|
|
1324
|
+
// return Promise.resolve(dataSource)
|
|
1325
|
+
// } else {
|
|
1326
|
+
// setTimeout(() => {
|
|
1327
|
+
// if (messageIndex !== null) {
|
|
1328
|
+
// scrollToIndexRef.current?.(messageIndex, { align: 'center' })
|
|
1329
|
+
// time = setInterval(async () => {
|
|
1330
|
+
// fullNum++
|
|
1331
|
+
// if (fullNum > 5) {
|
|
1332
|
+
// clearInterval(time)
|
|
1333
|
+
// } else {
|
|
1334
|
+
// const form = (Object.values(allFormListRef.current || []).find((item: any) => item.key === errorRowKey) as any)?.form
|
|
1335
|
+
// if (form) {
|
|
1336
|
+
// try {
|
|
1337
|
+
// await form.validateFields()
|
|
1338
|
+
// console.log('验证成功')
|
|
1339
|
+
// } catch (error) {
|
|
1340
|
+
// console.log('验证失败', error)
|
|
1341
|
+
// return error
|
|
1342
|
+
// } finally {
|
|
1343
|
+
// clearInterval(time)
|
|
1344
|
+
// }
|
|
1345
|
+
// }
|
|
1346
|
+
// }
|
|
1347
|
+
// }, 500)
|
|
1348
|
+
// }
|
|
1349
|
+
// }, 100)
|
|
1350
|
+
// return Promise.reject(errorInfo)
|
|
1351
|
+
// }
|
|
1352
|
+
// },
|
|
1353
|
+
verify: function verify() {
|
|
1354
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
1355
|
+
var time, fullNum, flag, messageIndex, errorRowKey, errorInfo, deepValidator;
|
|
1356
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1357
|
+
while (1) {
|
|
1358
|
+
switch (_context4.prev = _context4.next) {
|
|
1359
|
+
case 0:
|
|
1360
|
+
fullNum = 0;
|
|
1361
|
+
flag = true;
|
|
1362
|
+
messageIndex = null;
|
|
1363
|
+
errorRowKey = null;
|
|
1364
|
+
errorInfo = null;
|
|
1365
|
+
|
|
1366
|
+
deepValidator = function deepValidator(data, index) {
|
|
1367
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1368
|
+
var _c, i;
|
|
1369
|
+
|
|
1370
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1371
|
+
while (1) {
|
|
1372
|
+
switch (_context2.prev = _context2.next) {
|
|
1373
|
+
case 0:
|
|
1374
|
+
i = 0;
|
|
1375
|
+
|
|
1376
|
+
case 1:
|
|
1377
|
+
if (!(i < data.length)) {
|
|
1378
|
+
_context2.next = 23;
|
|
1379
|
+
break;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
if (!flag) {
|
|
1383
|
+
_context2.next = 20;
|
|
1384
|
+
break;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
_context2.prev = 3;
|
|
1388
|
+
checkForm.resetFields();
|
|
1389
|
+
checkForm.setFieldsValue(data[i]);
|
|
1390
|
+
_context2.next = 8;
|
|
1391
|
+
return checkForm.validateFields();
|
|
1392
|
+
|
|
1393
|
+
case 8:
|
|
1394
|
+
if (!data[i].children) {
|
|
1395
|
+
_context2.next = 11;
|
|
1396
|
+
break;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
_context2.next = 11;
|
|
1400
|
+
return deepValidator(data[i].children, i);
|
|
1401
|
+
|
|
1402
|
+
case 11:
|
|
1403
|
+
_context2.next = 20;
|
|
1404
|
+
break;
|
|
1405
|
+
|
|
1406
|
+
case 13:
|
|
1407
|
+
_context2.prev = 13;
|
|
1408
|
+
_context2.t0 = _context2["catch"](3);
|
|
1409
|
+
errorInfo = {
|
|
1410
|
+
error: _context2.t0,
|
|
1411
|
+
value: data[i]
|
|
1412
|
+
};
|
|
1413
|
+
flag = false;
|
|
1414
|
+
messageIndex = index === null ? i : index;
|
|
1415
|
+
errorRowKey = (_c = data === null || data === void 0 ? void 0 : data[i]) === null || _c === void 0 ? void 0 : _c[_rowKey];
|
|
1416
|
+
return _context2.abrupt("break", 23);
|
|
1417
|
+
|
|
1418
|
+
case 20:
|
|
1419
|
+
i++;
|
|
1420
|
+
_context2.next = 1;
|
|
1421
|
+
break;
|
|
1422
|
+
|
|
1423
|
+
case 23:
|
|
1424
|
+
case "end":
|
|
1425
|
+
return _context2.stop();
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
}, _callee2, null, [[3, 13]]);
|
|
1429
|
+
}));
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
_context4.next = 8;
|
|
1433
|
+
return deepValidator(dataSource, null);
|
|
1434
|
+
|
|
1435
|
+
case 8:
|
|
1436
|
+
if (!flag) {
|
|
1437
|
+
_context4.next = 12;
|
|
1438
|
+
break;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
return _context4.abrupt("return", Promise.resolve(dataSource));
|
|
1442
|
+
|
|
1443
|
+
case 12:
|
|
1444
|
+
setTimeout(function () {
|
|
1445
|
+
var _a;
|
|
1446
|
+
|
|
1447
|
+
if (messageIndex !== null) {
|
|
1448
|
+
(_a = scrollToIndexRef.current) === null || _a === void 0 ? void 0 : _a.call(scrollToIndexRef, messageIndex, {
|
|
1449
|
+
align: 'center'
|
|
1450
|
+
});
|
|
1451
|
+
time = setInterval(function () {
|
|
1452
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
1453
|
+
var _b, form;
|
|
1454
|
+
|
|
1455
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1456
|
+
while (1) {
|
|
1457
|
+
switch (_context3.prev = _context3.next) {
|
|
1458
|
+
case 0:
|
|
1459
|
+
fullNum++;
|
|
1460
|
+
|
|
1461
|
+
if (!(fullNum > 5)) {
|
|
1462
|
+
_context3.next = 5;
|
|
1463
|
+
break;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
clearInterval(time);
|
|
1467
|
+
_context3.next = 20;
|
|
1468
|
+
break;
|
|
1469
|
+
|
|
1470
|
+
case 5:
|
|
1471
|
+
form = (_b = Object.values(allFormListRef.current || []).find(function (item) {
|
|
1472
|
+
return item.key === errorRowKey;
|
|
1473
|
+
})) === null || _b === void 0 ? void 0 : _b.form;
|
|
1474
|
+
|
|
1475
|
+
if (!form) {
|
|
1476
|
+
_context3.next = 20;
|
|
1477
|
+
break;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
_context3.prev = 7;
|
|
1481
|
+
_context3.next = 10;
|
|
1482
|
+
return form.validateFields();
|
|
1483
|
+
|
|
1484
|
+
case 10:
|
|
1485
|
+
console.log('验证成功');
|
|
1486
|
+
_context3.next = 17;
|
|
1487
|
+
break;
|
|
1488
|
+
|
|
1489
|
+
case 13:
|
|
1490
|
+
_context3.prev = 13;
|
|
1491
|
+
_context3.t0 = _context3["catch"](7);
|
|
1492
|
+
console.log('验证失败', _context3.t0);
|
|
1493
|
+
return _context3.abrupt("return", _context3.t0);
|
|
1494
|
+
|
|
1495
|
+
case 17:
|
|
1496
|
+
_context3.prev = 17;
|
|
1497
|
+
clearInterval(time);
|
|
1498
|
+
return _context3.finish(17);
|
|
1499
|
+
|
|
1500
|
+
case 20:
|
|
1501
|
+
case "end":
|
|
1502
|
+
return _context3.stop();
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
}, _callee3, null, [[7, 13, 17, 20]]);
|
|
1506
|
+
}));
|
|
1507
|
+
}, 300);
|
|
1508
|
+
}
|
|
1509
|
+
}, 100);
|
|
1510
|
+
return _context4.abrupt("return", Promise.reject(errorInfo));
|
|
1511
|
+
|
|
1512
|
+
case 14:
|
|
1513
|
+
case "end":
|
|
1514
|
+
return _context4.stop();
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
}, _callee4);
|
|
1518
|
+
}));
|
|
1315
1519
|
}
|
|
1316
1520
|
};
|
|
1317
1521
|
});
|
|
@@ -1319,22 +1523,121 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1319
1523
|
return isEdit && isAdd || isHoverEdit && isAdd;
|
|
1320
1524
|
}, [isEdit, isAdd, isHoverEdit]);
|
|
1321
1525
|
|
|
1526
|
+
var pushAllForm = function pushAllForm(form, key, index) {
|
|
1527
|
+
allFormListRef.current[key] = {
|
|
1528
|
+
form: form,
|
|
1529
|
+
key: key,
|
|
1530
|
+
index: index
|
|
1531
|
+
};
|
|
1532
|
+
};
|
|
1533
|
+
|
|
1534
|
+
var config = useRef(Object.assign({
|
|
1535
|
+
pagination: false,
|
|
1536
|
+
tableLayout: 'fixed',
|
|
1537
|
+
scroll: {
|
|
1538
|
+
x: '100%'
|
|
1539
|
+
},
|
|
1540
|
+
rowKey: function rowKey(record) {
|
|
1541
|
+
return record[_rowKey] || record.index || Math.random();
|
|
1542
|
+
},
|
|
1543
|
+
components: {
|
|
1544
|
+
table: virtual ? function (props) {
|
|
1545
|
+
return /*#__PURE__*/React.createElement(VirtualTable, Object.assign({}, props, {
|
|
1546
|
+
fn: scrollToIndexRef
|
|
1547
|
+
}));
|
|
1548
|
+
} : null,
|
|
1549
|
+
body: Object.assign({
|
|
1550
|
+
row: function row(rowProps) {
|
|
1551
|
+
return sortOpen ? EditableSortRow(Object.assign(Object.assign({}, rowProps), {
|
|
1552
|
+
virtual: virtual
|
|
1553
|
+
})) : EditableRow(Object.assign(Object.assign({}, rowProps), {
|
|
1554
|
+
virtual: virtual
|
|
1555
|
+
}));
|
|
1556
|
+
},
|
|
1557
|
+
cell: props.shouldUpdate ? EditableCell : MemoEditableCell
|
|
1558
|
+
}, sortOpen ? {
|
|
1559
|
+
wrapper: function wrapper(wrapperProps) {
|
|
1560
|
+
var _a, _b, _c;
|
|
1561
|
+
|
|
1562
|
+
return DraggableContainer(Object.assign(Object.assign({}, wrapperProps), {
|
|
1563
|
+
virtual: virtual,
|
|
1564
|
+
keys: (_a = dataSourceRef.current) === null || _a === void 0 ? void 0 : _a.map(function (item) {
|
|
1565
|
+
return item[_rowKey];
|
|
1566
|
+
}),
|
|
1567
|
+
options: dataSourceRef.current,
|
|
1568
|
+
rowKey: _rowKey,
|
|
1569
|
+
onSortEnd: onSortEnd,
|
|
1570
|
+
tableWidth: (_c = (_b = tableWarpRef === null || tableWarpRef === void 0 ? void 0 : tableWarpRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect()) === null || _c === void 0 ? void 0 : _c.width
|
|
1571
|
+
}));
|
|
1572
|
+
}
|
|
1573
|
+
} : virtual ? {
|
|
1574
|
+
wrapper: VirtualWrapper
|
|
1575
|
+
} : {}),
|
|
1576
|
+
header: {
|
|
1577
|
+
row: colSortOpen ? colDraggableContainer : null
|
|
1578
|
+
}
|
|
1579
|
+
},
|
|
1580
|
+
onRow: function onRow(record, index) {
|
|
1581
|
+
var _a;
|
|
1582
|
+
|
|
1583
|
+
return {
|
|
1584
|
+
disabled: disabled || !!((_a = disabledDataSourceRowKeys.current) === null || _a === void 0 ? void 0 : _a.includes(record[_rowKey])),
|
|
1585
|
+
dataKey: record[_rowKey],
|
|
1586
|
+
index: index,
|
|
1587
|
+
pushAllForm: pushAllForm
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
}, resetProps));
|
|
1591
|
+
useEffect(function () {
|
|
1592
|
+
var _a;
|
|
1593
|
+
|
|
1594
|
+
if (autoSizer) {
|
|
1595
|
+
var tableClient = (_a = tableWarpRef === null || tableWarpRef === void 0 ? void 0 : tableWarpRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
1596
|
+
var height = (tableClient === null || tableClient === void 0 ? void 0 : tableClient.height) || '100%';
|
|
1597
|
+
var TailorHeight = size === 'middle' ? 48 : 40;
|
|
1598
|
+
|
|
1599
|
+
if (isAdd) {
|
|
1600
|
+
TailorHeight += 48;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
if (props.summary) {
|
|
1604
|
+
TailorHeight += 48;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
if (props.pagination) {
|
|
1608
|
+
TailorHeight += 48;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
autoSizerRef.current = {
|
|
1612
|
+
width: tableClient === null || tableClient === void 0 ? void 0 : tableClient.width,
|
|
1613
|
+
height: typeof height === 'string' ? "calc(".concat(height, " - ").concat(TailorHeight, "px)") : height - TailorHeight
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1616
|
+
}, []);
|
|
1617
|
+
|
|
1322
1618
|
if (colSortOpen) {
|
|
1323
1619
|
return /*#__PURE__*/React.createElement("div", {
|
|
1324
|
-
className: "lm_editTable_warpper"
|
|
1620
|
+
className: "lm_editTable_warpper",
|
|
1621
|
+
ref: tableWarpRef
|
|
1622
|
+
}, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
1623
|
+
renderEmpty: loading ? function () {
|
|
1624
|
+
return null;
|
|
1625
|
+
} : CustomizeRenderEmpty
|
|
1325
1626
|
}, /*#__PURE__*/React.createElement(DndContainer, {
|
|
1627
|
+
rowKey: _rowKey,
|
|
1628
|
+
options: resultColumns,
|
|
1326
1629
|
move: onColSortEnd
|
|
1327
1630
|
}, /*#__PURE__*/React.createElement(SortableBoxCol, {
|
|
1328
1631
|
items: columns.reduce(function (acc, item) {
|
|
1329
1632
|
return [].concat(_toConsumableArray(acc), [item.dataIndex]);
|
|
1330
1633
|
}, [])
|
|
1331
|
-
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, config, {
|
|
1634
|
+
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current, autoSizerRef.current), {
|
|
1635
|
+
loading: loading,
|
|
1332
1636
|
size: size || 'small',
|
|
1333
1637
|
columns: resultColumns,
|
|
1334
1638
|
rowClassName: "editable-row",
|
|
1335
1639
|
bordered: true,
|
|
1336
1640
|
pagination: false,
|
|
1337
|
-
// components={tableComponents}
|
|
1338
1641
|
rowSelection: !rowSelection ? undefined : Object.assign(Object.assign({
|
|
1339
1642
|
fixed: true,
|
|
1340
1643
|
type: 'checkbox',
|
|
@@ -1344,36 +1647,59 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1344
1647
|
return isObject(v) ? v[_rowKey] : v;
|
|
1345
1648
|
}),
|
|
1346
1649
|
onChange: function onChange(selectedRowKeys, selectedRows, info) {
|
|
1347
|
-
// editTableRowChange(selectedRowKeys, selectedRows, info)
|
|
1348
1650
|
setLocalRowSelectList(selectedRowKeys, selectedRows, info);
|
|
1349
1651
|
}
|
|
1350
1652
|
}),
|
|
1351
1653
|
dataSource: dataSource
|
|
1352
|
-
})))),
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1654
|
+
}))))), /*#__PURE__*/React.createElement(BottomOpetateComponent, {
|
|
1655
|
+
disabled: disabled,
|
|
1656
|
+
isShowAddAction: isShowAddAction,
|
|
1657
|
+
recordCreatorProps: recordCreatorProps,
|
|
1658
|
+
handleAdd: handleAdd
|
|
1659
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
1356
1660
|
style: {
|
|
1357
|
-
|
|
1661
|
+
display: 'none'
|
|
1358
1662
|
}
|
|
1359
|
-
}, /*#__PURE__*/React.createElement(
|
|
1360
|
-
|
|
1361
|
-
|
|
1663
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
1664
|
+
form: checkForm,
|
|
1665
|
+
component: false
|
|
1666
|
+
}, columns.map(function (item) {
|
|
1667
|
+
return /*#__PURE__*/React.createElement(Form.Item, Object.assign({
|
|
1668
|
+
noStyle: true,
|
|
1669
|
+
key: item.dataIndex,
|
|
1670
|
+
name: item.dataIndex
|
|
1671
|
+
}, (item === null || item === void 0 ? void 0 : item['formProps']) || {}), item.dataIndex || 'text');
|
|
1672
|
+
}))));
|
|
1362
1673
|
} // @ts-ignore
|
|
1363
1674
|
|
|
1364
1675
|
|
|
1365
1676
|
return /*#__PURE__*/React.createElement("div", {
|
|
1366
|
-
className:
|
|
1367
|
-
|
|
1677
|
+
className: cls('lm_editTable_warpper', autoSizer && 'lm_editable_autosize'),
|
|
1678
|
+
ref: tableWarpRef
|
|
1679
|
+
}, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
1680
|
+
renderEmpty: loading ? function () {
|
|
1681
|
+
return null;
|
|
1682
|
+
} : CustomizeRenderEmpty
|
|
1683
|
+
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current, autoSizerRef.current), {
|
|
1368
1684
|
size: size || 'small',
|
|
1369
1685
|
columns: resultColumns,
|
|
1370
1686
|
rowClassName: "editable-row",
|
|
1371
1687
|
bordered: true,
|
|
1688
|
+
loading: loading,
|
|
1689
|
+
style: autoSizer ? {
|
|
1690
|
+
height: isAdd ? "calc(100% - ".concat(48, "px)") : '100%'
|
|
1691
|
+
} : undefined,
|
|
1372
1692
|
pagination: false,
|
|
1373
1693
|
// components={tableComponents}
|
|
1374
1694
|
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
1375
1695
|
expandedRowKeys: expandedRowKeys,
|
|
1376
1696
|
fixed: true,
|
|
1697
|
+
// indentSize: 0,
|
|
1698
|
+
expandIconColumnIndex: checkExpandIconColumnIndex({
|
|
1699
|
+
rowSelection: rowSelection,
|
|
1700
|
+
sortOpen: sortOpen,
|
|
1701
|
+
indexCol: indexCol
|
|
1702
|
+
}) || 0,
|
|
1377
1703
|
onExpandedRowsChange: function onExpandedRowsChange(expandedRows) {
|
|
1378
1704
|
return setExpandedRowKeys(expandedRows);
|
|
1379
1705
|
}
|
|
@@ -1391,15 +1717,24 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1391
1717
|
}
|
|
1392
1718
|
}),
|
|
1393
1719
|
dataSource: dataSource
|
|
1394
|
-
})),
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
}
|
|
1720
|
+
}))), /*#__PURE__*/React.createElement(BottomOpetateComponent, {
|
|
1721
|
+
disabled: disabled,
|
|
1722
|
+
isShowAddAction: isShowAddAction,
|
|
1723
|
+
recordCreatorProps: recordCreatorProps,
|
|
1724
|
+
handleAdd: handleAdd
|
|
1725
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
1726
|
+
style: {
|
|
1727
|
+
display: 'none'
|
|
1728
|
+
}
|
|
1729
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
1730
|
+
form: checkForm,
|
|
1731
|
+
component: false
|
|
1732
|
+
}, columns.map(function (item) {
|
|
1733
|
+
return /*#__PURE__*/React.createElement(Form.Item, Object.assign({
|
|
1734
|
+
noStyle: true,
|
|
1735
|
+
key: item.dataIndex,
|
|
1736
|
+
name: item.dataIndex
|
|
1737
|
+
}, (item === null || item === void 0 ? void 0 : item['formProps']) || {}), item.dataIndex || 'text');
|
|
1738
|
+
}))));
|
|
1404
1739
|
});
|
|
1405
1740
|
export default /*#__PURE__*/memo(EditTable);
|