linkmore-design 1.1.26 → 1.1.27-alpha.1
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 +10 -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 +8 -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 +1380 -576
- package/dist/index.umd.min.js +21 -21
- package/dist/variables.css +92 -0
- 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 +10 -5
- package/es/LmEditTable/EditTable.js +364 -360
- 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 +81 -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 +92 -0
- package/es/LmEditTable/style/variables.css +92 -0
- package/es/LmEditTable/util.d.ts +8 -0
- package/es/LmEditTable/util.js +103 -7
- package/es/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/es/LmEditTable/virtual/VirtualRow.js +140 -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 +62 -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/filterFns/index.js +7 -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/hooks/useEvent/index.js +1 -1
- package/es/index.d.ts +1 -2
- package/es/styles/variables.css +92 -0
- 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 +10 -5
- package/lib/LmEditTable/EditTable.js +362 -357
- 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 +99 -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 +92 -0
- package/lib/LmEditTable/style/variables.css +92 -0
- package/lib/LmEditTable/util.d.ts +8 -0
- package/lib/LmEditTable/util.js +110 -6
- package/lib/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/lib/LmEditTable/virtual/VirtualRow.js +155 -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 +79 -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/filterFns/index.js +7 -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/hooks/useEvent/index.js +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/styles/variables.css +92 -0
- package/package.json +7 -9
|
@@ -47,32 +47,32 @@ 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 } 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),
|
|
@@ -83,7 +83,7 @@ var EditableRow = function EditableRow(_a) {
|
|
|
83
83
|
component: false
|
|
84
84
|
}, /*#__PURE__*/React.createElement(EditableContext.Provider, {
|
|
85
85
|
value: form
|
|
86
|
-
}, /*#__PURE__*/React.createElement("tr", Object.assign({}, props))));
|
|
86
|
+
}, virtual ? /*#__PURE__*/React.createElement(VirtualRow, Object.assign({}, props)) : /*#__PURE__*/React.createElement("tr", Object.assign({}, props))));
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
var EditableSortRow = function EditableSortRow(_a) {
|
|
@@ -96,6 +96,7 @@ var EditableSortRow = function EditableSortRow(_a) {
|
|
|
96
96
|
|
|
97
97
|
return /*#__PURE__*/React.createElement(Form, {
|
|
98
98
|
form: form,
|
|
99
|
+
disabled: props.disabled || false,
|
|
99
100
|
component: false
|
|
100
101
|
}, /*#__PURE__*/React.createElement(EditableContext.Provider, {
|
|
101
102
|
value: form
|
|
@@ -226,88 +227,7 @@ var InputRange = function InputRange(_a) {
|
|
|
226
227
|
return handleInput(e, 'next');
|
|
227
228
|
}
|
|
228
229
|
}, 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
|
-
|
|
230
|
+
};
|
|
311
231
|
/*
|
|
312
232
|
表格单元格
|
|
313
233
|
editEnum: 下拉框时的数据数组(非数组时是配置设置)
|
|
@@ -337,9 +257,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
337
257
|
handleDelete = props.handleDelete,
|
|
338
258
|
handleCopy = props.handleCopy,
|
|
339
259
|
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"]);
|
|
260
|
+
restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "rowIndex", "colIndex", "handleTableRowDelete", "handleTableRowAdd", "quickOpetateClearAll", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "handleCopy", "itemProps"]);
|
|
343
261
|
/** 去除移入移出功能,保留最纯粹的功能,优化性能 */
|
|
344
262
|
|
|
345
263
|
|
|
@@ -359,6 +277,12 @@ var EditableCell = function EditableCell(props) {
|
|
|
359
277
|
|
|
360
278
|
var inputRef = useRef(null);
|
|
361
279
|
var form = useContext(EditableContext);
|
|
280
|
+
|
|
281
|
+
var _useState5 = useState(false),
|
|
282
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
283
|
+
hoverStatus = _useState6[0],
|
|
284
|
+
setHoverStatus = _useState6[1];
|
|
285
|
+
|
|
362
286
|
useEffect(function () {
|
|
363
287
|
var _a;
|
|
364
288
|
|
|
@@ -369,13 +293,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
369
293
|
|
|
370
294
|
var toggleEdit = function toggleEdit() {
|
|
371
295
|
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
|
-
// 校验保存
|
|
296
|
+
}; // 校验保存
|
|
379
297
|
|
|
380
298
|
|
|
381
299
|
var save = function save(row) {
|
|
@@ -427,13 +345,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
427
345
|
case 13:
|
|
428
346
|
if (col === null || col === void 0 ? void 0 : col.hoverEdit) {
|
|
429
347
|
toggleEdit();
|
|
430
|
-
}
|
|
431
|
-
// setValid((old) => {
|
|
432
|
-
// const obj = { ...old }
|
|
433
|
-
// delete obj[record[rowKey]]
|
|
434
|
-
// return obj
|
|
435
|
-
// })
|
|
436
|
-
|
|
348
|
+
}
|
|
437
349
|
|
|
438
350
|
_context.next = 18;
|
|
439
351
|
break;
|
|
@@ -458,15 +370,14 @@ var EditableCell = function EditableCell(props) {
|
|
|
458
370
|
/** 快捷刷子,把当前的所有列的值,刷成当前的选中的列 */
|
|
459
371
|
|
|
460
372
|
|
|
461
|
-
var copyKey = function copyKey(e) {
|
|
373
|
+
var copyKey = function copyKey(e, type) {
|
|
462
374
|
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
463
375
|
var dataIndex = col.dataIndex;
|
|
464
|
-
handleCopy === null || handleCopy === void 0 ? void 0 : handleCopy(dataIndex, record[dataIndex]);
|
|
376
|
+
handleCopy === null || handleCopy === void 0 ? void 0 : handleCopy(dataIndex, record[dataIndex], type, props.rowIndex);
|
|
465
377
|
};
|
|
466
378
|
|
|
467
379
|
var Control = function Control(con) {
|
|
468
|
-
var _a;
|
|
469
|
-
|
|
380
|
+
var _a;
|
|
470
381
|
|
|
471
382
|
var resultComponentProps = isFunction(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
|
|
472
383
|
|
|
@@ -476,7 +387,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
476
387
|
});
|
|
477
388
|
}
|
|
478
389
|
|
|
479
|
-
var clearAttrComponentProps = omit(resultComponentProps, ['optionOnly', 'isOnlyValue']);
|
|
390
|
+
var clearAttrComponentProps = omit(resultComponentProps, ['optionOnly', 'isOnlyValue', 'quickcopy']);
|
|
480
391
|
|
|
481
392
|
switch (con) {
|
|
482
393
|
case 'input':
|
|
@@ -497,19 +408,12 @@ var EditableCell = function EditableCell(props) {
|
|
|
497
408
|
noStyle: true
|
|
498
409
|
}, /*#__PURE__*/React.cloneElement(resultComponentProps.addonAfter, {
|
|
499
410
|
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
411
|
})) : null
|
|
507
412
|
}));
|
|
508
413
|
|
|
509
414
|
case 'inputRange':
|
|
510
415
|
return /*#__PURE__*/React.createElement(InputRange, Object.assign({
|
|
511
|
-
onChange: handleFormItemChange
|
|
512
|
-
ref: inputRef
|
|
416
|
+
onChange: handleFormItemChange
|
|
513
417
|
}, resultComponentProps, {
|
|
514
418
|
record: record,
|
|
515
419
|
rowIndex: rowIndex,
|
|
@@ -585,7 +489,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
585
489
|
|
|
586
490
|
case 'switch':
|
|
587
491
|
return /*#__PURE__*/React.createElement(Switch, Object.assign({
|
|
588
|
-
size:
|
|
492
|
+
size: "small"
|
|
589
493
|
}, clearAttrComponentProps, {
|
|
590
494
|
onChange: handleFormItemChange
|
|
591
495
|
}));
|
|
@@ -599,10 +503,9 @@ var EditableCell = function EditableCell(props) {
|
|
|
599
503
|
|
|
600
504
|
case 'operate':
|
|
601
505
|
case 'lm_edit_opetate':
|
|
602
|
-
return /*#__PURE__*/React.createElement(
|
|
506
|
+
return /*#__PURE__*/React.createElement(QuickOpetate, Object.assign({
|
|
603
507
|
record: record,
|
|
604
508
|
rowKey: rowKey,
|
|
605
|
-
ref: inputRef,
|
|
606
509
|
handleAdd: handleTableRowAdd,
|
|
607
510
|
handleDelete: handleTableRowDelete,
|
|
608
511
|
getLength: getLength,
|
|
@@ -616,7 +519,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
616
519
|
var fromData = form.getFieldsValue();
|
|
617
520
|
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
521
|
onChange: save
|
|
619
|
-
}));
|
|
522
|
+
}), rowIndex);
|
|
620
523
|
}
|
|
621
524
|
|
|
622
525
|
default:
|
|
@@ -653,7 +556,8 @@ var EditableCell = function EditableCell(props) {
|
|
|
653
556
|
valuePropName: editable === 'switch' ? 'checked' : 'value',
|
|
654
557
|
style: {
|
|
655
558
|
margin: 0
|
|
656
|
-
}
|
|
559
|
+
},
|
|
560
|
+
noStyle: formProps ? false : true
|
|
657
561
|
}, formProps, {
|
|
658
562
|
name: dataIndex
|
|
659
563
|
}), Control(editable)));
|
|
@@ -665,6 +569,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
665
569
|
margin: 0
|
|
666
570
|
}
|
|
667
571
|
}, formProps, {
|
|
572
|
+
noStyle: formProps ? false : true,
|
|
668
573
|
name: [dataIndex, 'value']
|
|
669
574
|
}), Control(editable)));
|
|
670
575
|
}
|
|
@@ -675,31 +580,68 @@ var EditableCell = function EditableCell(props) {
|
|
|
675
580
|
}
|
|
676
581
|
|
|
677
582
|
return childNode;
|
|
678
|
-
}, [col, isEdit, editing, getLength]); //
|
|
679
|
-
// 出现死循环找我
|
|
583
|
+
}, [col, isEdit, editing, getLength, record]); // 出现死循环找我
|
|
680
584
|
|
|
681
585
|
useEffect(function () {
|
|
682
586
|
var editable = col.editable,
|
|
683
587
|
dataIndex = col.dataIndex;
|
|
684
588
|
|
|
685
589
|
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
|
-
|
|
590
|
+
form.setFieldsValue(_defineProperty({}, dataIndex, editable === 'date' && record[dataIndex] ? moment(record[dataIndex]) : record[dataIndex]));
|
|
591
|
+
}
|
|
696
592
|
}, [record]);
|
|
593
|
+
|
|
594
|
+
var handleTdHover = function handleTdHover() {
|
|
595
|
+
setHoverStatus(true);
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
var handleTdMouseOut = function handleTdMouseOut() {
|
|
599
|
+
setHoverStatus(false);
|
|
600
|
+
};
|
|
601
|
+
|
|
697
602
|
return /*#__PURE__*/React.createElement("td", Object.assign({}, omit(clearProps, ['dataIndex']), {
|
|
698
603
|
className: cls(clearProps === null || clearProps === void 0 ? void 0 : clearProps.className, 'lm_custom_cell_td'),
|
|
604
|
+
onMouseEnter: componentProps.quickcopy ? handleTdHover : undefined,
|
|
605
|
+
onMouseLeave: componentProps.quickcopy ? handleTdMouseOut : undefined,
|
|
699
606
|
key: "r".concat(rowIndex, "_c").concat(colIndex)
|
|
700
|
-
}),
|
|
607
|
+
}), hoverStatus && props.rowIndex > 0 && /*#__PURE__*/React.createElement("span", {
|
|
608
|
+
className: 'quick_copy_warp quick_copy_up',
|
|
609
|
+
onClick: function onClick(e) {
|
|
610
|
+
return copyKey(e, 'up');
|
|
611
|
+
}
|
|
612
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
613
|
+
type: 'lmweb-icon_up'
|
|
614
|
+
})), getMemoChildNode, hoverStatus && props.rowIndex < props.getLength - 1 && /*#__PURE__*/React.createElement("span", {
|
|
615
|
+
className: 'quick_copy_warp quick_copy_down',
|
|
616
|
+
onClick: function onClick(e) {
|
|
617
|
+
return copyKey(e, 'down');
|
|
618
|
+
}
|
|
619
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
620
|
+
type: 'lmweb-icon_down'
|
|
621
|
+
})));
|
|
701
622
|
};
|
|
623
|
+
/** true 不刷新, false 刷新 */
|
|
624
|
+
|
|
702
625
|
|
|
626
|
+
var MemoEditableCell = /*#__PURE__*/memo(EditableCell, function (prev, next) {
|
|
627
|
+
var pickProps = ['record', 'colIndex'];
|
|
628
|
+
var p = pick(prev, pickProps);
|
|
629
|
+
var n = pick(next, pickProps);
|
|
630
|
+
|
|
631
|
+
if (next === null || next === void 0 ? void 0 : next.shouldUpdate) {
|
|
632
|
+
return false;
|
|
633
|
+
} // console.log(!checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n), '22', prev.record, next.record)
|
|
634
|
+
// console.log('333', checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n))
|
|
635
|
+
|
|
636
|
+
/** TODO: 在record中带有children,子列表数据修改之后,会导致父级的record对比不一样 */
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
if (!checkMemoShouldUploadSpecialFun(prev, next)) {
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
return isEqual(p, n);
|
|
644
|
+
});
|
|
703
645
|
var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
704
646
|
var _a, _b;
|
|
705
647
|
|
|
@@ -719,16 +661,21 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
719
661
|
_props$quickOpetateCl = props.quickOpetateClearAll,
|
|
720
662
|
quickOpetateClearAll = _props$quickOpetateCl === void 0 ? true : _props$quickOpetateCl,
|
|
721
663
|
rowSelection = props.rowSelection,
|
|
664
|
+
virtual = props.virtual,
|
|
722
665
|
sortOpen = props.sortOpen,
|
|
666
|
+
disabled = props.disabled,
|
|
723
667
|
colSortOpen = props.colSortOpen,
|
|
668
|
+
_props$indexCol = props.indexCol,
|
|
669
|
+
indexCol = _props$indexCol === void 0 ? false : _props$indexCol,
|
|
724
670
|
filterChange = props.filterChange,
|
|
725
671
|
_props$size = props.size,
|
|
726
672
|
size = _props$size === void 0 ? 'small' : _props$size,
|
|
727
673
|
recordCreatorProps = props.recordCreatorProps,
|
|
728
674
|
_props$shouldUpdate = props.shouldUpdate,
|
|
729
675
|
shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
|
|
730
|
-
|
|
731
|
-
|
|
676
|
+
_props$loading = props.loading,
|
|
677
|
+
loading = _props$loading === void 0 ? false : _props$loading,
|
|
678
|
+
resetProps = __rest(props, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "virtual", "sortOpen", "disabled", "colSortOpen", "indexCol", "filterChange", "size", "recordCreatorProps", "shouldUpdate", "loading"]);
|
|
732
679
|
|
|
733
680
|
var _useControllableValue = useControllableValue({
|
|
734
681
|
value: checkRowKeyByDataSource(props.value, _rowKey),
|
|
@@ -736,14 +683,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
736
683
|
}),
|
|
737
684
|
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
|
738
685
|
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
|
-
|
|
686
|
+
setDataSource = _useControllableValue2[1];
|
|
747
687
|
|
|
748
688
|
var transformRowSelect = function transformRowSelect(selectedRowKeys, selectedRows, info) {
|
|
749
689
|
var _a;
|
|
@@ -760,43 +700,28 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
760
700
|
_useControllableValue4 = _slicedToArray(_useControllableValue3, 2),
|
|
761
701
|
localRowSelectList = _useControllableValue4[0],
|
|
762
702
|
setLocalRowSelectList = _useControllableValue4[1];
|
|
703
|
+
/** TODO: 当前展开的列 */
|
|
704
|
+
|
|
763
705
|
|
|
764
706
|
var _useState7 = useState([]),
|
|
765
707
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
/** 当前展开的列 */
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
var _useState9 = useState([]),
|
|
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([]);
|
|
708
|
+
expandedRowKeys = _useState8[0],
|
|
709
|
+
setExpandedRowKeys = _useState8[1];
|
|
779
710
|
|
|
780
|
-
var
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
});
|
|
786
|
-
var newIndex = cloneArr.findIndex(function (v) {
|
|
787
|
-
return v[_rowKey] === over;
|
|
788
|
-
});
|
|
789
|
-
setDataSource(arrayMove(cloneArr, oldIndex, newIndex));
|
|
790
|
-
};
|
|
711
|
+
var dataSourceRef = useRef(dataSource);
|
|
712
|
+
var deepDataSourceRef = useRef(deepDataSourcePreKeys(dataSource, _rowKey));
|
|
713
|
+
dataSourceRef.current = dataSource;
|
|
714
|
+
deepDataSourceRef.current = deepDataSourcePreKeys(dataSource, _rowKey);
|
|
715
|
+
var tableWarpRef = useRef(null);
|
|
791
716
|
|
|
792
717
|
var onColSortEnd = function onColSortEnd(active, over) {
|
|
793
718
|
var _a;
|
|
794
719
|
|
|
795
720
|
var oldIndex = columns.findIndex(function (item) {
|
|
796
|
-
return item
|
|
721
|
+
return item.dataIndex === active;
|
|
797
722
|
});
|
|
798
723
|
var newIndex = columns.findIndex(function (item) {
|
|
799
|
-
return item
|
|
724
|
+
return item.dataIndex === over;
|
|
800
725
|
});
|
|
801
726
|
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
727
|
return Object.assign(Object.assign({}, item), {
|
|
@@ -809,55 +734,21 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
809
734
|
var handleDelete = function handleDelete(key) {
|
|
810
735
|
var nValue = dataSource.filter(function (item) {
|
|
811
736
|
return item[_rowKey] !== key;
|
|
812
|
-
});
|
|
813
|
-
|
|
737
|
+
});
|
|
814
738
|
setDataSource(nValue);
|
|
815
739
|
};
|
|
816
|
-
/**
|
|
740
|
+
/** 点击底部添加按钮添加 */
|
|
817
741
|
|
|
818
742
|
|
|
819
|
-
var handleAdd = function
|
|
743
|
+
var handleAdd = debounce(function (row) {
|
|
820
744
|
var _a;
|
|
821
745
|
|
|
822
746
|
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
747
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
824
748
|
draft.push(Object.assign(_defineProperty({}, _rowKey, "".concat(Date.now())), addDataInfo || {}));
|
|
825
749
|
});
|
|
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
|
-
// }
|
|
750
|
+
setDataSource(res);
|
|
751
|
+
}, 40);
|
|
861
752
|
|
|
862
753
|
var handleSave = function handleSave(row, options) {
|
|
863
754
|
var _a, _b;
|
|
@@ -865,9 +756,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
865
756
|
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
757
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
867
758
|
if (options === null || options === void 0 ? void 0 : options.only) {
|
|
868
|
-
var
|
|
869
|
-
key =
|
|
870
|
-
value =
|
|
759
|
+
var _ref = options === null || options === void 0 ? void 0 : options.only,
|
|
760
|
+
key = _ref.key,
|
|
761
|
+
value = _ref.value;
|
|
871
762
|
|
|
872
763
|
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
873
764
|
var deeps = function deeps(children) {
|
|
@@ -930,25 +821,26 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
930
821
|
}
|
|
931
822
|
});
|
|
932
823
|
setDataSource(res);
|
|
933
|
-
};
|
|
824
|
+
}; // const reWriteOriginSource = (rowKey: string, rowValue, dataIndex: number, nextValue) => {
|
|
825
|
+
// setDataSource((prevDataSource) => {
|
|
826
|
+
// return prevDataSource?.map((item) => {
|
|
827
|
+
// if (get(item, rowKey) === rowValue) {
|
|
828
|
+
// set(item, dataIndex, nextValue)
|
|
829
|
+
// }
|
|
830
|
+
// return item
|
|
831
|
+
// })
|
|
832
|
+
// })
|
|
833
|
+
// }
|
|
834
|
+
// @ts-ignore
|
|
934
835
|
|
|
935
|
-
|
|
936
|
-
setDataSource(function (prevDataSource) {
|
|
937
|
-
return prevDataSource === null || prevDataSource === void 0 ? void 0 : prevDataSource.map(function (item) {
|
|
938
|
-
if (get(item, rowKey) === rowValue) {
|
|
939
|
-
set(item, dataIndex, nextValue);
|
|
940
|
-
}
|
|
836
|
+
/** 删除当前行 */
|
|
941
837
|
|
|
942
|
-
return item;
|
|
943
|
-
});
|
|
944
|
-
});
|
|
945
|
-
}; // @ts-ignore
|
|
946
838
|
|
|
947
|
-
|
|
948
|
-
var handleTableRowDelete = function handleTableRowDelete(key) {
|
|
839
|
+
var handleTableRowDelete = debounce(function (key) {
|
|
949
840
|
var _a, _b, _c;
|
|
950
841
|
|
|
951
|
-
var
|
|
842
|
+
var rkey = isObject(key) ? key[_rowKey] : key;
|
|
843
|
+
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
844
|
|
|
953
845
|
if (preKeys.length > 1) {
|
|
954
846
|
/** 说明删除的是children中的数据 */
|
|
@@ -969,7 +861,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
969
861
|
return newData;
|
|
970
862
|
};
|
|
971
863
|
|
|
972
|
-
var res = filter(
|
|
864
|
+
var res = filter(dataSourceRef.current, key);
|
|
973
865
|
setDataSource(res);
|
|
974
866
|
} else {
|
|
975
867
|
if (((_c = dataSourceRef.current) === null || _c === void 0 ? void 0 : _c.length) === 1 && !quickOpetateClearAll) {
|
|
@@ -988,34 +880,76 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
988
880
|
|
|
989
881
|
setDataSource(_res);
|
|
990
882
|
}
|
|
991
|
-
};
|
|
992
|
-
/** 快捷添加 */
|
|
993
883
|
|
|
884
|
+
return null;
|
|
885
|
+
}, 40);
|
|
886
|
+
/** 替换当前行 */
|
|
887
|
+
|
|
888
|
+
var handleTableRowReplace = debounce(function (record, defaultRecord) {
|
|
889
|
+
var _a, _b;
|
|
890
|
+
|
|
891
|
+
var rkey = isObject(record) ? record[_rowKey] : record;
|
|
892
|
+
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)
|
|
893
|
+
|
|
894
|
+
var deep = function deep(children) {
|
|
895
|
+
return children.map(function (item) {
|
|
896
|
+
if (item[_rowKey] === rkey) {
|
|
897
|
+
return defaultRecord;
|
|
898
|
+
} else if (preKeys.includes(item[_rowKey]) && item.children) {
|
|
899
|
+
var child = deep(item.children);
|
|
900
|
+
return Object.assign(Object.assign({}, item), {
|
|
901
|
+
children: child
|
|
902
|
+
});
|
|
903
|
+
} else {
|
|
904
|
+
return item;
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
var res = deep(dataSourceRef.current);
|
|
910
|
+
setDataSource(res);
|
|
911
|
+
}, 40);
|
|
912
|
+
/** 快捷添加 */
|
|
994
913
|
|
|
995
|
-
var handleTableRowAdd = function
|
|
914
|
+
var handleTableRowAdd = debounce(function (record, isAppendInChindren, defaultRecord) {
|
|
996
915
|
var _a, _b;
|
|
997
916
|
|
|
998
|
-
var
|
|
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;
|
|
999
919
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
1000
|
-
var _a, _b, _c, _d;
|
|
920
|
+
var _a, _b, _c, _d, _e;
|
|
1001
921
|
|
|
1002
|
-
if (preKeys.length > 1) {
|
|
922
|
+
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
1003
923
|
var deeps = function deeps(children) {
|
|
1004
924
|
children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
|
|
1005
|
-
var _a;
|
|
925
|
+
var _a, _b;
|
|
1006
926
|
|
|
1007
927
|
if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
|
|
1008
|
-
if (item[_rowKey] ===
|
|
928
|
+
if (item[_rowKey] === rkey) {
|
|
1009
929
|
if (isAppendInChindren) {
|
|
1010
930
|
if (item === null || item === void 0 ? void 0 : item.children) {
|
|
1011
|
-
|
|
931
|
+
if (Array.isArray(defaultRecord)) {
|
|
932
|
+
var _a2;
|
|
933
|
+
|
|
934
|
+
(_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : (_a2 = _a).push.apply(_a2, _toConsumableArray(defaultRecord));
|
|
935
|
+
} else {
|
|
936
|
+
(_b = item === null || item === void 0 ? void 0 : item.children) === null || _b === void 0 ? void 0 : _b.push(defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
937
|
+
}
|
|
1012
938
|
} else {
|
|
1013
|
-
|
|
939
|
+
if (Array.isArray(defaultRecord)) {
|
|
940
|
+
item.children = _toConsumableArray(defaultRecord);
|
|
941
|
+
} else {
|
|
942
|
+
item.children = [defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
943
|
+
}
|
|
1014
944
|
}
|
|
1015
945
|
|
|
1016
946
|
!expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray(expandedRowKeys), [item[_rowKey]]));
|
|
1017
947
|
} else {
|
|
1018
|
-
|
|
948
|
+
if (Array.isArray(defaultRecord)) {
|
|
949
|
+
children.splice.apply(children, [index + 1, 0].concat(_toConsumableArray(defaultRecord)));
|
|
950
|
+
} else {
|
|
951
|
+
children.splice(index + 1, 0, defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
952
|
+
}
|
|
1019
953
|
}
|
|
1020
954
|
} else if (item.children) {
|
|
1021
955
|
deeps(item.children);
|
|
@@ -1027,31 +961,44 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1027
961
|
deeps(draft);
|
|
1028
962
|
} else {
|
|
1029
963
|
var index = draft.findIndex(function (item) {
|
|
1030
|
-
return
|
|
964
|
+
return rkey === item[_rowKey];
|
|
1031
965
|
});
|
|
1032
966
|
|
|
1033
967
|
if (index !== -1) {
|
|
1034
968
|
if (isAppendInChindren) {
|
|
1035
969
|
if ((_a = draft[index].children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1036
|
-
|
|
970
|
+
if (Array.isArray(defaultRecord)) {
|
|
971
|
+
var _b2;
|
|
972
|
+
|
|
973
|
+
(_b = draft[index].children) === null || _b === void 0 ? void 0 : (_b2 = _b).push.apply(_b2, _toConsumableArray(defaultRecord));
|
|
974
|
+
} else {
|
|
975
|
+
(_c = draft[index].children) === null || _c === void 0 ? void 0 : _c.push(defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
976
|
+
}
|
|
1037
977
|
} else {
|
|
1038
|
-
draft[index].children = [_defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
978
|
+
draft[index].children = Array.isArray(defaultRecord) ? _toConsumableArray(defaultRecord) : [defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
1039
979
|
}
|
|
1040
980
|
|
|
1041
|
-
!expandedRowKeys.includes((
|
|
981
|
+
!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
982
|
} else {
|
|
1043
|
-
|
|
983
|
+
if (Array.isArray(defaultRecord)) {
|
|
984
|
+
draft.splice.apply(draft, [index + 1, 0].concat(_toConsumableArray(defaultRecord)));
|
|
985
|
+
} else {
|
|
986
|
+
draft.splice(index + 1, 0, defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
987
|
+
}
|
|
1044
988
|
}
|
|
1045
989
|
}
|
|
1046
990
|
}
|
|
1047
991
|
});
|
|
1048
992
|
setDataSource(res);
|
|
1049
|
-
};
|
|
993
|
+
}, 50);
|
|
994
|
+
/** 快捷刷子功能 */
|
|
1050
995
|
|
|
1051
|
-
var handleCopy = function handleCopy(key, value) {
|
|
996
|
+
var handleCopy = function handleCopy(key, value, type, rowIndex) {
|
|
1052
997
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
1053
|
-
draft === null || draft === void 0 ? void 0 : draft.forEach(function (item) {
|
|
1054
|
-
|
|
998
|
+
draft === null || draft === void 0 ? void 0 : draft.forEach(function (item, index) {
|
|
999
|
+
if (type === 'up' && index < rowIndex || type === 'down' && index > rowIndex) {
|
|
1000
|
+
item[key] = value;
|
|
1001
|
+
}
|
|
1055
1002
|
});
|
|
1056
1003
|
});
|
|
1057
1004
|
setDataSource(res);
|
|
@@ -1060,17 +1007,16 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1060
1007
|
|
|
1061
1008
|
|
|
1062
1009
|
var hasDisableOptions = useMemo(function () {
|
|
1063
|
-
// const hasOnlyOptionsDatas = columns.filter(item => item?.['componentProps']?.optionOnly)
|
|
1064
1010
|
var hasOnlyOptionsDatas = columns.filter(function (item) {
|
|
1065
1011
|
var _a;
|
|
1066
1012
|
|
|
1067
1013
|
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
1014
|
return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
|
|
1069
|
-
});
|
|
1015
|
+
}); // const hasOnlyOptionsDatas = columns.filter((item) => item?.componentProps?.optionOnly)
|
|
1070
1016
|
|
|
1071
1017
|
if (hasOnlyOptionsDatas.length) {
|
|
1072
1018
|
return hasOnlyOptionsDatas === null || hasOnlyOptionsDatas === void 0 ? void 0 : hasOnlyOptionsDatas.map(function (item) {
|
|
1073
|
-
return item
|
|
1019
|
+
return item.dataIndex;
|
|
1074
1020
|
});
|
|
1075
1021
|
}
|
|
1076
1022
|
|
|
@@ -1082,12 +1028,11 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1082
1028
|
var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
1083
1029
|
var _a;
|
|
1084
1030
|
|
|
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'] || {}
|
|
1031
|
+
var resultComponentProps = isFunction(item.componentProps) ? (_a = item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item.componentProps;
|
|
1090
1032
|
|
|
1033
|
+
var _ref8 = resultComponentProps || {},
|
|
1034
|
+
optionOnly = _ref8.optionOnly,
|
|
1035
|
+
options = _ref8.options;
|
|
1091
1036
|
|
|
1092
1037
|
if (optionOnly && options) {
|
|
1093
1038
|
var dataIndex = item.dataIndex;
|
|
@@ -1107,7 +1052,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1107
1052
|
}
|
|
1108
1053
|
|
|
1109
1054
|
return Object.assign(Object.assign({}, item), {
|
|
1110
|
-
componentProps: Object.assign(Object.assign({}, item
|
|
1055
|
+
componentProps: Object.assign(Object.assign({}, item.componentProps), {
|
|
1111
1056
|
options: newOptions
|
|
1112
1057
|
})
|
|
1113
1058
|
});
|
|
@@ -1126,16 +1071,47 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1126
1071
|
var rColumns = hasDisableOptions ? DisableOptions : columns;
|
|
1127
1072
|
var localColumns = [sortOpen ? {
|
|
1128
1073
|
title: '排序',
|
|
1129
|
-
dataIndex: '
|
|
1074
|
+
dataIndex: '_sort',
|
|
1130
1075
|
width: 48,
|
|
1131
1076
|
maxWidth: 48,
|
|
1132
1077
|
className: 'drag-visible',
|
|
1078
|
+
fixed: 'left',
|
|
1133
1079
|
render: function render(_, record) {
|
|
1134
1080
|
return /*#__PURE__*/React.createElement(DragHandle, {
|
|
1135
|
-
id: record[_rowKey] || record.id
|
|
1081
|
+
id: (record === null || record === void 0 ? void 0 : record[_rowKey]) || (record === null || record === void 0 ? void 0 : record.id)
|
|
1136
1082
|
});
|
|
1137
1083
|
}
|
|
1138
|
-
} : null
|
|
1084
|
+
} : null, indexCol ? isBoolean(indexCol) ? {
|
|
1085
|
+
title: '',
|
|
1086
|
+
dataIndex: '_index',
|
|
1087
|
+
width: 48,
|
|
1088
|
+
maxWidth: 48,
|
|
1089
|
+
ellipsis: true,
|
|
1090
|
+
fixed: 'left',
|
|
1091
|
+
render: function render(_, record, index) {
|
|
1092
|
+
var _a, _b, _c;
|
|
1093
|
+
|
|
1094
|
+
console.log(deepDataSourceRef.current, '--deepDataSourceRef.current', _rowKey);
|
|
1095
|
+
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);
|
|
1096
|
+
}
|
|
1097
|
+
} : Object.assign(Object.assign({
|
|
1098
|
+
title: '',
|
|
1099
|
+
dataIndex: '_index',
|
|
1100
|
+
width: 48,
|
|
1101
|
+
ellipsis: true,
|
|
1102
|
+
maxWidth: 48,
|
|
1103
|
+
fixed: 'left'
|
|
1104
|
+
}, indexCol || {}), {
|
|
1105
|
+
render: function render(_, record, index) {
|
|
1106
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1107
|
+
|
|
1108
|
+
if (isFunction(indexCol === null || indexCol === void 0 ? void 0 : indexCol.render)) {
|
|
1109
|
+
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']);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
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);
|
|
1113
|
+
}
|
|
1114
|
+
}) : null].concat(_toConsumableArray(rColumns), [useQuickOpetate ? {
|
|
1139
1115
|
title: '操作',
|
|
1140
1116
|
dataIndex: 'lm_edit_opetate',
|
|
1141
1117
|
width: 68,
|
|
@@ -1146,11 +1122,11 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1146
1122
|
options: Array.isArray(useQuickOpetate) ? useQuickOpetate : ['add', 'delete']
|
|
1147
1123
|
}
|
|
1148
1124
|
} : null]).filter(function (item) {
|
|
1149
|
-
return item && item.show !== false;
|
|
1125
|
+
return item && (item === null || item === void 0 ? void 0 : item.show) !== false;
|
|
1150
1126
|
});
|
|
1151
|
-
localColumns = localColumns.map(function (item, index) {
|
|
1127
|
+
localColumns = localColumns === null || localColumns === void 0 ? void 0 : localColumns.map(function (item, index) {
|
|
1152
1128
|
return Object.assign(Object.assign({}, item), {
|
|
1153
|
-
order: [null, undefined].includes(item
|
|
1129
|
+
order: [null, undefined].includes(item.order) ? index : item.order
|
|
1154
1130
|
});
|
|
1155
1131
|
}).sort(function (a, b) {
|
|
1156
1132
|
return a.order - b.order;
|
|
@@ -1173,29 +1149,22 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1173
1149
|
var mapColumns = function mapColumns(col, index) {
|
|
1174
1150
|
var _a, _b;
|
|
1175
1151
|
|
|
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;
|
|
1152
|
+
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length) && (col === null || col === void 0 ? void 0 : col.dataIndex) === '_sort') {
|
|
1153
|
+
var fn = col === null || col === void 0 ? void 0 : col.render;
|
|
1154
|
+
return Object.assign(Object.assign({}, col), {
|
|
1155
|
+
render: function render(text, record, i) {
|
|
1156
|
+
var _a;
|
|
1188
1157
|
|
|
1189
|
-
|
|
1190
|
-
return true;
|
|
1158
|
+
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
1159
|
}
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1192
1162
|
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1163
|
+
if (isEdit && (col === null || col === void 0 ? void 0 : col.render) && (col === null || col === void 0 ? void 0 : col.editable) === 'render') {
|
|
1164
|
+
delete col.render;
|
|
1165
|
+
}
|
|
1196
1166
|
|
|
1197
|
-
|
|
1198
|
-
},
|
|
1167
|
+
var newCol = Object.assign(Object.assign({}, col), {
|
|
1199
1168
|
onCell: function onCell(record, rowIndex) {
|
|
1200
1169
|
return {
|
|
1201
1170
|
getLength: dataSource.length,
|
|
@@ -1210,7 +1179,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1210
1179
|
editable: col.editable,
|
|
1211
1180
|
dataIndex: col.dataIndex,
|
|
1212
1181
|
itemProps: col.itemProps,
|
|
1213
|
-
|
|
1182
|
+
shouldUpdate: shouldUpdate,
|
|
1214
1183
|
isEdit: isEdit,
|
|
1215
1184
|
isHoverEdit: isHoverEdit,
|
|
1216
1185
|
handleAdd: handleAdd,
|
|
@@ -1218,8 +1187,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1218
1187
|
handleCopy: handleCopy,
|
|
1219
1188
|
editEnum: typeof col.editEnum === 'function' ? col.editEnum(record) : col.editEnum,
|
|
1220
1189
|
valueType: typeof col.valueType === 'function' ? col.valueType(record) : col.valueType,
|
|
1221
|
-
handleSave: handleSave
|
|
1222
|
-
reWriteOriginSource: reWriteOriginSource
|
|
1190
|
+
handleSave: handleSave
|
|
1223
1191
|
};
|
|
1224
1192
|
}
|
|
1225
1193
|
});
|
|
@@ -1231,24 +1199,24 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1231
1199
|
return newCol;
|
|
1232
1200
|
};
|
|
1233
1201
|
|
|
1234
|
-
var res = localColumns.map(function (col, index) {
|
|
1202
|
+
var res = localColumns === null || localColumns === void 0 ? void 0 : localColumns.map(function (col, index) {
|
|
1235
1203
|
return mapColumns(col, index);
|
|
1236
1204
|
});
|
|
1237
1205
|
return res;
|
|
1238
|
-
}, [columns, isAdd, sortOpen, useQuickOpetate,
|
|
1239
|
-
var DraggableContainer = useCallback(function (_a) {
|
|
1240
|
-
var _b;
|
|
1206
|
+
}, [columns, isAdd, sortOpen, useQuickOpetate, dataSource, _toConsumableArray(memoOptions)]);
|
|
1241
1207
|
|
|
1242
|
-
|
|
1208
|
+
var onSortEnd = function onSortEnd(active, over) {
|
|
1209
|
+
var cloneArr = _toConsumableArray(dataSourceRef.current);
|
|
1210
|
+
|
|
1211
|
+
var oldIndex = cloneArr.findIndex(function (v) {
|
|
1212
|
+
return v[_rowKey] === active;
|
|
1213
|
+
});
|
|
1214
|
+
var newIndex = cloneArr.findIndex(function (v) {
|
|
1215
|
+
return v[_rowKey] === over;
|
|
1216
|
+
});
|
|
1217
|
+
setDataSource(arrayMove(cloneArr, oldIndex, newIndex));
|
|
1218
|
+
};
|
|
1243
1219
|
|
|
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
1220
|
var colDraggableContainer = useCallback(function (_a) {
|
|
1253
1221
|
var _b;
|
|
1254
1222
|
|
|
@@ -1266,40 +1234,18 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1266
1234
|
}, child);
|
|
1267
1235
|
}));
|
|
1268
1236
|
}, [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
1237
|
useImperativeHandle(ref, function () {
|
|
1298
1238
|
return {
|
|
1299
1239
|
setRow: handleSave,
|
|
1300
1240
|
getCheckboxRecords: function getCheckboxRecords() {
|
|
1301
1241
|
return localRowSelectList.selectedRows;
|
|
1302
1242
|
},
|
|
1243
|
+
deleteRowData: function deleteRowData(data) {
|
|
1244
|
+
return handleTableRowDelete(data);
|
|
1245
|
+
},
|
|
1246
|
+
addRowData: function addRowData(data, defaultValue, addInChild) {
|
|
1247
|
+
return addInChild === 'replace' ? handleTableRowReplace(data, defaultValue) : handleTableRowAdd(data, addInChild, defaultValue);
|
|
1248
|
+
},
|
|
1303
1249
|
clearSelect: function clearSelect() {
|
|
1304
1250
|
setLocalRowSelectList({
|
|
1305
1251
|
selectedRows: []
|
|
@@ -1310,31 +1256,86 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1310
1256
|
selectedRows: value
|
|
1311
1257
|
});
|
|
1312
1258
|
},
|
|
1313
|
-
|
|
1314
|
-
return
|
|
1315
|
-
}
|
|
1259
|
+
columns: columns.map(function (item) {
|
|
1260
|
+
return omit(item, ['render', 'sorter', 'onFilter', 'filters', 'componentProps', 'formProps', 'editable']);
|
|
1261
|
+
})
|
|
1316
1262
|
};
|
|
1317
1263
|
});
|
|
1318
1264
|
var isShowAddAction = useMemo(function () {
|
|
1319
1265
|
return isEdit && isAdd || isHoverEdit && isAdd;
|
|
1320
1266
|
}, [isEdit, isAdd, isHoverEdit]);
|
|
1267
|
+
var config = useRef(Object.assign({
|
|
1268
|
+
pagination: false,
|
|
1269
|
+
tableLayout: 'fixed',
|
|
1270
|
+
scroll: {
|
|
1271
|
+
x: '100%'
|
|
1272
|
+
},
|
|
1273
|
+
rowKey: function rowKey(record) {
|
|
1274
|
+
return record[_rowKey] || record.index || Math.random();
|
|
1275
|
+
},
|
|
1276
|
+
components: {
|
|
1277
|
+
table: virtual ? VirtualTable : null,
|
|
1278
|
+
body: Object.assign({
|
|
1279
|
+
row: function row(rowProps) {
|
|
1280
|
+
return sortOpen ? EditableSortRow(Object.assign(Object.assign({}, rowProps), {
|
|
1281
|
+
virtual: virtual
|
|
1282
|
+
})) : EditableRow(Object.assign(Object.assign({}, rowProps), {
|
|
1283
|
+
virtual: virtual
|
|
1284
|
+
}));
|
|
1285
|
+
},
|
|
1286
|
+
cell: MemoEditableCell
|
|
1287
|
+
}, sortOpen ? {
|
|
1288
|
+
wrapper: function wrapper(wrapperProps) {
|
|
1289
|
+
var _a, _b, _c;
|
|
1290
|
+
|
|
1291
|
+
return DraggableContainer(Object.assign(Object.assign({}, wrapperProps), {
|
|
1292
|
+
virtual: virtual,
|
|
1293
|
+
keys: (_a = dataSourceRef.current) === null || _a === void 0 ? void 0 : _a.map(function (item) {
|
|
1294
|
+
return item[_rowKey];
|
|
1295
|
+
}),
|
|
1296
|
+
options: dataSourceRef.current,
|
|
1297
|
+
rowKey: _rowKey,
|
|
1298
|
+
onSortEnd: onSortEnd,
|
|
1299
|
+
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
|
|
1300
|
+
}));
|
|
1301
|
+
}
|
|
1302
|
+
} : virtual ? {
|
|
1303
|
+
wrapper: VirtualWrapper
|
|
1304
|
+
} : {}),
|
|
1305
|
+
header: {
|
|
1306
|
+
row: colSortOpen ? colDraggableContainer : null
|
|
1307
|
+
}
|
|
1308
|
+
},
|
|
1309
|
+
onRow: function onRow(record, index) {
|
|
1310
|
+
return {
|
|
1311
|
+
disabled: disabled
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
}, resetProps));
|
|
1321
1315
|
|
|
1322
1316
|
if (colSortOpen) {
|
|
1323
1317
|
return /*#__PURE__*/React.createElement("div", {
|
|
1324
|
-
className: "lm_editTable_warpper"
|
|
1318
|
+
className: "lm_editTable_warpper",
|
|
1319
|
+
ref: tableWarpRef
|
|
1320
|
+
}, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
1321
|
+
renderEmpty: loading ? function () {
|
|
1322
|
+
return null;
|
|
1323
|
+
} : CustomizeRenderEmpty
|
|
1325
1324
|
}, /*#__PURE__*/React.createElement(DndContainer, {
|
|
1325
|
+
rowKey: _rowKey,
|
|
1326
|
+
options: resultColumns,
|
|
1326
1327
|
move: onColSortEnd
|
|
1327
1328
|
}, /*#__PURE__*/React.createElement(SortableBoxCol, {
|
|
1328
1329
|
items: columns.reduce(function (acc, item) {
|
|
1329
1330
|
return [].concat(_toConsumableArray(acc), [item.dataIndex]);
|
|
1330
1331
|
}, [])
|
|
1331
|
-
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, config, {
|
|
1332
|
+
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current), {
|
|
1333
|
+
loading: loading,
|
|
1332
1334
|
size: size || 'small',
|
|
1333
1335
|
columns: resultColumns,
|
|
1334
1336
|
rowClassName: "editable-row",
|
|
1335
1337
|
bordered: true,
|
|
1336
1338
|
pagination: false,
|
|
1337
|
-
// components={tableComponents}
|
|
1338
1339
|
rowSelection: !rowSelection ? undefined : Object.assign(Object.assign({
|
|
1339
1340
|
fixed: true,
|
|
1340
1341
|
type: 'checkbox',
|
|
@@ -1344,36 +1345,43 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1344
1345
|
return isObject(v) ? v[_rowKey] : v;
|
|
1345
1346
|
}),
|
|
1346
1347
|
onChange: function onChange(selectedRowKeys, selectedRows, info) {
|
|
1347
|
-
// editTableRowChange(selectedRowKeys, selectedRows, info)
|
|
1348
1348
|
setLocalRowSelectList(selectedRowKeys, selectedRows, info);
|
|
1349
1349
|
}
|
|
1350
1350
|
}),
|
|
1351
1351
|
dataSource: dataSource
|
|
1352
|
-
})))),
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
}
|
|
1359
|
-
}, /*#__PURE__*/React.createElement(PlusCircleOutlined, {
|
|
1360
|
-
className: "lmweb-plus"
|
|
1361
|
-
}), "\u65B0\u589E"));
|
|
1352
|
+
}))))), /*#__PURE__*/React.createElement(BottomOpetateComponent, {
|
|
1353
|
+
disabled: disabled,
|
|
1354
|
+
isShowAddAction: isShowAddAction,
|
|
1355
|
+
recordCreatorProps: recordCreatorProps,
|
|
1356
|
+
handleAdd: handleAdd
|
|
1357
|
+
}));
|
|
1362
1358
|
} // @ts-ignore
|
|
1363
1359
|
|
|
1364
1360
|
|
|
1365
1361
|
return /*#__PURE__*/React.createElement("div", {
|
|
1366
|
-
className: "lm_editTable_warpper"
|
|
1367
|
-
|
|
1362
|
+
className: "lm_editTable_warpper",
|
|
1363
|
+
ref: tableWarpRef
|
|
1364
|
+
}, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
1365
|
+
renderEmpty: loading ? function () {
|
|
1366
|
+
return null;
|
|
1367
|
+
} : CustomizeRenderEmpty
|
|
1368
|
+
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current), {
|
|
1368
1369
|
size: size || 'small',
|
|
1369
1370
|
columns: resultColumns,
|
|
1370
1371
|
rowClassName: "editable-row",
|
|
1371
1372
|
bordered: true,
|
|
1373
|
+
loading: loading,
|
|
1372
1374
|
pagination: false,
|
|
1373
1375
|
// components={tableComponents}
|
|
1374
1376
|
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
1375
1377
|
expandedRowKeys: expandedRowKeys,
|
|
1376
1378
|
fixed: true,
|
|
1379
|
+
// indentSize: 0,
|
|
1380
|
+
expandIconColumnIndex: checkExpandIconColumnIndex({
|
|
1381
|
+
rowSelection: rowSelection,
|
|
1382
|
+
sortOpen: sortOpen,
|
|
1383
|
+
indexCol: indexCol
|
|
1384
|
+
}) || 0,
|
|
1377
1385
|
onExpandedRowsChange: function onExpandedRowsChange(expandedRows) {
|
|
1378
1386
|
return setExpandedRowKeys(expandedRows);
|
|
1379
1387
|
}
|
|
@@ -1391,15 +1399,11 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1391
1399
|
}
|
|
1392
1400
|
}),
|
|
1393
1401
|
dataSource: dataSource
|
|
1394
|
-
})),
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
}, (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.style) || {})
|
|
1401
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
1402
|
-
type: "lmweb-plus"
|
|
1403
|
-
}), (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.creatorButtonText) || '新增'));
|
|
1402
|
+
}))), /*#__PURE__*/React.createElement(BottomOpetateComponent, {
|
|
1403
|
+
disabled: disabled,
|
|
1404
|
+
isShowAddAction: isShowAddAction,
|
|
1405
|
+
recordCreatorProps: recordCreatorProps,
|
|
1406
|
+
handleAdd: handleAdd
|
|
1407
|
+
}));
|
|
1404
1408
|
});
|
|
1405
1409
|
export default /*#__PURE__*/memo(EditTable);
|