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