linkmore-design 1.1.27-alpha.0 → 1.1.27
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 +3 -6
- package/dist/LmEditTable/EditTable.d.ts +5 -10
- package/dist/LmEditTable/sortableItem.d.ts +2 -3
- package/dist/LmEditTable/util.d.ts +0 -7
- package/dist/index.d.ts +2 -1
- package/dist/index.umd.js +527 -1133
- package/dist/index.umd.min.js +8 -8
- package/dist/variables.css +0 -65
- package/es/InputNumber/index.js +9 -7
- package/es/LmEditTable/DndContainer.d.ts +3 -6
- package/es/LmEditTable/DndContainer.js +10 -70
- package/es/LmEditTable/DragHandle.js +1 -1
- package/es/LmEditTable/EditTable.d.ts +5 -10
- package/es/LmEditTable/EditTable.js +360 -352
- package/es/LmEditTable/sortableItem.d.ts +2 -3
- package/es/LmEditTable/sortableItem.js +4 -16
- package/es/LmEditTable/sortableItemCol.js +10 -40
- package/es/LmEditTable/style/index.css +0 -65
- package/es/LmEditTable/style/variables.css +0 -65
- package/es/LmEditTable/util.d.ts +0 -7
- package/es/LmEditTable/util.js +7 -92
- package/es/LmTable/virTual/VirtualRow.js +14 -12
- package/es/hooks/useEvent/index.js +1 -1
- package/es/index.d.ts +2 -1
- package/es/styles/variables.css +0 -65
- package/lib/InputNumber/index.js +9 -9
- package/lib/LmEditTable/DndContainer.d.ts +3 -6
- package/lib/LmEditTable/DndContainer.js +9 -74
- package/lib/LmEditTable/DragHandle.js +1 -1
- package/lib/LmEditTable/EditTable.d.ts +5 -10
- package/lib/LmEditTable/EditTable.js +357 -349
- package/lib/LmEditTable/sortableItem.d.ts +2 -3
- package/lib/LmEditTable/sortableItem.js +5 -19
- package/lib/LmEditTable/sortableItemCol.js +8 -37
- package/lib/LmEditTable/style/index.css +0 -65
- package/lib/LmEditTable/style/variables.css +0 -65
- package/lib/LmEditTable/util.d.ts +0 -7
- package/lib/LmEditTable/util.js +6 -97
- package/lib/LmTable/virTual/VirtualRow.js +14 -12
- package/lib/hooks/useEvent/index.js +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/styles/variables.css +0 -65
- package/package.json +9 -7
- package/dist/LmEditTable/components/DraggableContainer.d.ts +0 -10
- package/dist/LmEditTable/components/QuickOpetate.d.ts +0 -12
- package/dist/LmEditTable/components/bottomOpetateComponent.d.ts +0 -13
- package/dist/LmEditTable/components/index.d.ts +0 -16
- package/dist/LmEditTable/hooks/useForkRef.d.ts +0 -2
- package/dist/LmEditTable/rowSort/DndContainerRow.d.ts +0 -10
- package/dist/LmEditTable/virtual/VirtualRow.d.ts +0 -7
- package/dist/LmEditTable/virtual/VirtualRowBack.d.ts +0 -6
- package/dist/LmEditTable/virtual/VirtualTable.d.ts +0 -3
- package/dist/LmEditTable/virtual/VirtualWrapper.d.ts +0 -3
- package/dist/LmEditTable/virtual/context.d.ts +0 -13
- package/dist/LmEditTable/virtual/index.d.ts +0 -4
- package/es/LmEditTable/components/DraggableContainer.d.ts +0 -10
- package/es/LmEditTable/components/DraggableContainer.js +0 -39
- package/es/LmEditTable/components/QuickOpetate.d.ts +0 -12
- package/es/LmEditTable/components/QuickOpetate.js +0 -82
- package/es/LmEditTable/components/bottomOpetateComponent.d.ts +0 -13
- package/es/LmEditTable/components/bottomOpetateComponent.js +0 -23
- package/es/LmEditTable/components/index.d.ts +0 -16
- package/es/LmEditTable/components/index.js +0 -7
- package/es/LmEditTable/hooks/useForkRef.d.ts +0 -2
- package/es/LmEditTable/hooks/useForkRef.js +0 -22
- package/es/LmEditTable/rowSort/DndContainerRow.d.ts +0 -10
- package/es/LmEditTable/rowSort/DndContainerRow.js +0 -81
- package/es/LmEditTable/virtual/VirtualRow.d.ts +0 -7
- package/es/LmEditTable/virtual/VirtualRow.js +0 -62
- package/es/LmEditTable/virtual/VirtualRowBack.d.ts +0 -6
- package/es/LmEditTable/virtual/VirtualRowBack.js +0 -100
- package/es/LmEditTable/virtual/VirtualTable.d.ts +0 -3
- package/es/LmEditTable/virtual/VirtualTable.js +0 -54
- package/es/LmEditTable/virtual/VirtualWrapper.d.ts +0 -3
- package/es/LmEditTable/virtual/VirtualWrapper.js +0 -60
- package/es/LmEditTable/virtual/context.d.ts +0 -13
- package/es/LmEditTable/virtual/context.js +0 -54
- package/es/LmEditTable/virtual/index.d.ts +0 -4
- package/es/LmEditTable/virtual/index.js +0 -4
- package/lib/LmEditTable/components/DraggableContainer.d.ts +0 -10
- package/lib/LmEditTable/components/DraggableContainer.js +0 -52
- package/lib/LmEditTable/components/QuickOpetate.d.ts +0 -12
- package/lib/LmEditTable/components/QuickOpetate.js +0 -96
- package/lib/LmEditTable/components/bottomOpetateComponent.d.ts +0 -13
- package/lib/LmEditTable/components/bottomOpetateComponent.js +0 -34
- package/lib/LmEditTable/components/index.d.ts +0 -16
- package/lib/LmEditTable/components/index.js +0 -37
- package/lib/LmEditTable/hooks/useForkRef.d.ts +0 -2
- package/lib/LmEditTable/hooks/useForkRef.js +0 -29
- package/lib/LmEditTable/rowSort/DndContainerRow.d.ts +0 -10
- package/lib/LmEditTable/rowSort/DndContainerRow.js +0 -99
- package/lib/LmEditTable/virtual/VirtualRow.d.ts +0 -7
- package/lib/LmEditTable/virtual/VirtualRow.js +0 -78
- package/lib/LmEditTable/virtual/VirtualRowBack.d.ts +0 -6
- package/lib/LmEditTable/virtual/VirtualRowBack.js +0 -113
- package/lib/LmEditTable/virtual/VirtualTable.d.ts +0 -3
- package/lib/LmEditTable/virtual/VirtualTable.js +0 -71
- package/lib/LmEditTable/virtual/VirtualWrapper.d.ts +0 -3
- package/lib/LmEditTable/virtual/VirtualWrapper.js +0 -73
- package/lib/LmEditTable/virtual/context.d.ts +0 -13
- package/lib/LmEditTable/virtual/context.js +0 -64
- package/lib/LmEditTable/virtual/index.d.ts +0 -4
- package/lib/LmEditTable/virtual/index.js +0 -31
|
@@ -47,31 +47,32 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
47
47
|
}
|
|
48
48
|
return t;
|
|
49
49
|
};
|
|
50
|
+
/* eslint-disable no-unused-vars */
|
|
50
51
|
|
|
52
|
+
|
|
53
|
+
import { PlusCircleOutlined } from '@ant-design/icons';
|
|
51
54
|
import moment from 'moment';
|
|
52
55
|
import { arrayMove } from '@dnd-kit/sortable';
|
|
53
|
-
import { Checkbox, IconFont, Input, InputNumber, Radio, Select, Table, Switch, DatePicker, Form } from 'linkmore-design';
|
|
54
|
-
import {
|
|
56
|
+
import { Button, Checkbox, IconFont, Input, InputNumber, Radio, Select, Table, Switch, DatePicker, Form, Popover } from 'linkmore-design';
|
|
57
|
+
import { get, set, isFunction, omit, isObject } from 'lodash';
|
|
55
58
|
import React, { forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, memo, useCallback } from 'react';
|
|
56
59
|
import { useControllableValue } from 'ahooks';
|
|
57
60
|
import { produce } from 'immer';
|
|
58
61
|
import DndContainer from './DndContainer';
|
|
62
|
+
import SortableBox from './sortableBox';
|
|
59
63
|
import SortableBoxCol from './sortableBoxCol';
|
|
60
64
|
import SortableItem from './sortableItem';
|
|
61
65
|
import ColSortableItem from './sortableItemCol';
|
|
62
66
|
import DragHandle from './DragHandle';
|
|
63
67
|
import UploadOss from '../UploadOss';
|
|
64
|
-
import { isObjEmpty, deepDataSourcePreKeys, isExpandRow, checkRowKeyByDataSource
|
|
65
|
-
import
|
|
66
|
-
import cls from 'classnames';
|
|
67
|
-
import { VirtualTable, VirtualWrapper, VirtualRow } from './virtual';
|
|
68
|
+
import { isObjEmpty, deepDataSourcePreKeys, isExpandRow, checkRowKeyByDataSource } from './util';
|
|
69
|
+
import cls from "classnames";
|
|
68
70
|
var UploadBtn = UploadOss.UploadBtn;
|
|
69
71
|
var EditableContext = /*#__PURE__*/React.createContext(null); // 表格行
|
|
70
72
|
|
|
71
73
|
var EditableRow = function EditableRow(_a) {
|
|
72
74
|
var index = _a.index,
|
|
73
|
-
|
|
74
|
-
props = __rest(_a, ["index", "virtual"]);
|
|
75
|
+
props = __rest(_a, ["index"]);
|
|
75
76
|
|
|
76
77
|
var _Form$useForm = Form.useForm(),
|
|
77
78
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
@@ -82,7 +83,7 @@ var EditableRow = function EditableRow(_a) {
|
|
|
82
83
|
component: false
|
|
83
84
|
}, /*#__PURE__*/React.createElement(EditableContext.Provider, {
|
|
84
85
|
value: form
|
|
85
|
-
},
|
|
86
|
+
}, /*#__PURE__*/React.createElement("tr", Object.assign({}, props))));
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
var EditableSortRow = function EditableSortRow(_a) {
|
|
@@ -95,7 +96,6 @@ var EditableSortRow = function EditableSortRow(_a) {
|
|
|
95
96
|
|
|
96
97
|
return /*#__PURE__*/React.createElement(Form, {
|
|
97
98
|
form: form,
|
|
98
|
-
disabled: props.disabled || false,
|
|
99
99
|
component: false
|
|
100
100
|
}, /*#__PURE__*/React.createElement(EditableContext.Provider, {
|
|
101
101
|
value: form
|
|
@@ -226,7 +226,88 @@ var InputRange = function InputRange(_a) {
|
|
|
226
226
|
return handleInput(e, 'next');
|
|
227
227
|
}
|
|
228
228
|
}, editEnum))));
|
|
229
|
-
};
|
|
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
|
editEnum: 下拉框时的数据数组(非数组时是配置设置)
|
|
@@ -256,7 +337,9 @@ var EditableCell = function EditableCell(props) {
|
|
|
256
337
|
handleDelete = props.handleDelete,
|
|
257
338
|
handleCopy = props.handleCopy,
|
|
258
339
|
itemProps = props.itemProps,
|
|
259
|
-
|
|
340
|
+
setValid = props.setValid,
|
|
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
343
|
/** 去除移入移出功能,保留最纯粹的功能,优化性能 */
|
|
261
344
|
|
|
262
345
|
|
|
@@ -276,12 +359,6 @@ var EditableCell = function EditableCell(props) {
|
|
|
276
359
|
|
|
277
360
|
var inputRef = useRef(null);
|
|
278
361
|
var form = useContext(EditableContext);
|
|
279
|
-
|
|
280
|
-
var _useState5 = useState(false),
|
|
281
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
282
|
-
hoverStatus = _useState6[0],
|
|
283
|
-
setHoverStatus = _useState6[1];
|
|
284
|
-
|
|
285
362
|
useEffect(function () {
|
|
286
363
|
var _a;
|
|
287
364
|
|
|
@@ -292,7 +369,13 @@ var EditableCell = function EditableCell(props) {
|
|
|
292
369
|
|
|
293
370
|
var toggleEdit = function toggleEdit() {
|
|
294
371
|
setEditing(!editing); // form.setFieldsValue({ [dataIndex]: record[dataIndex] });
|
|
295
|
-
}; //
|
|
372
|
+
}; // const checkCellRef = useRef(null)
|
|
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
|
var save = function save(row) {
|
|
@@ -344,7 +427,13 @@ var EditableCell = function EditableCell(props) {
|
|
|
344
427
|
case 13:
|
|
345
428
|
if (col === null || col === void 0 ? void 0 : col.hoverEdit) {
|
|
346
429
|
toggleEdit();
|
|
347
|
-
}
|
|
430
|
+
} // // 清空异常校验
|
|
431
|
+
// setValid((old) => {
|
|
432
|
+
// const obj = { ...old }
|
|
433
|
+
// delete obj[record[rowKey]]
|
|
434
|
+
// return obj
|
|
435
|
+
// })
|
|
436
|
+
|
|
348
437
|
|
|
349
438
|
_context.next = 18;
|
|
350
439
|
break;
|
|
@@ -369,14 +458,15 @@ var EditableCell = function EditableCell(props) {
|
|
|
369
458
|
/** 快捷刷子,把当前的所有列的值,刷成当前的选中的列 */
|
|
370
459
|
|
|
371
460
|
|
|
372
|
-
var copyKey = function copyKey(e
|
|
461
|
+
var copyKey = function copyKey(e) {
|
|
373
462
|
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
374
463
|
var dataIndex = col.dataIndex;
|
|
375
|
-
handleCopy === null || handleCopy === void 0 ? void 0 : handleCopy(dataIndex, record[dataIndex]
|
|
464
|
+
handleCopy === null || handleCopy === void 0 ? void 0 : handleCopy(dataIndex, record[dataIndex]);
|
|
376
465
|
};
|
|
377
466
|
|
|
378
467
|
var Control = function Control(con) {
|
|
379
|
-
var _a;
|
|
468
|
+
var _a; // const resultComponentProps = isFunction(componentProps) ? componentProps?.(record, col) : componentProps
|
|
469
|
+
|
|
380
470
|
|
|
381
471
|
var resultComponentProps = isFunction(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
|
|
382
472
|
|
|
@@ -386,7 +476,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
386
476
|
});
|
|
387
477
|
}
|
|
388
478
|
|
|
389
|
-
var clearAttrComponentProps = omit(resultComponentProps, ['optionOnly', 'isOnlyValue'
|
|
479
|
+
var clearAttrComponentProps = omit(resultComponentProps, ['optionOnly', 'isOnlyValue']);
|
|
390
480
|
|
|
391
481
|
switch (con) {
|
|
392
482
|
case 'input':
|
|
@@ -407,12 +497,19 @@ var EditableCell = function EditableCell(props) {
|
|
|
407
497
|
noStyle: true
|
|
408
498
|
}, /*#__PURE__*/React.cloneElement(resultComponentProps.addonAfter, {
|
|
409
499
|
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'
|
|
410
506
|
})) : null
|
|
411
507
|
}));
|
|
412
508
|
|
|
413
509
|
case 'inputRange':
|
|
414
510
|
return /*#__PURE__*/React.createElement(InputRange, Object.assign({
|
|
415
|
-
onChange: handleFormItemChange
|
|
511
|
+
onChange: handleFormItemChange,
|
|
512
|
+
ref: inputRef
|
|
416
513
|
}, resultComponentProps, {
|
|
417
514
|
record: record,
|
|
418
515
|
rowIndex: rowIndex,
|
|
@@ -488,7 +585,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
488
585
|
|
|
489
586
|
case 'switch':
|
|
490
587
|
return /*#__PURE__*/React.createElement(Switch, Object.assign({
|
|
491
|
-
size:
|
|
588
|
+
size: 'small'
|
|
492
589
|
}, clearAttrComponentProps, {
|
|
493
590
|
onChange: handleFormItemChange
|
|
494
591
|
}));
|
|
@@ -502,9 +599,10 @@ var EditableCell = function EditableCell(props) {
|
|
|
502
599
|
|
|
503
600
|
case 'operate':
|
|
504
601
|
case 'lm_edit_opetate':
|
|
505
|
-
return /*#__PURE__*/React.createElement(
|
|
602
|
+
return /*#__PURE__*/React.createElement(Opetate, Object.assign({
|
|
506
603
|
record: record,
|
|
507
604
|
rowKey: rowKey,
|
|
605
|
+
ref: inputRef,
|
|
508
606
|
handleAdd: handleTableRowAdd,
|
|
509
607
|
handleDelete: handleTableRowDelete,
|
|
510
608
|
getLength: getLength,
|
|
@@ -518,7 +616,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
518
616
|
var fromData = form.getFieldsValue();
|
|
519
617
|
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), {
|
|
520
618
|
onChange: save
|
|
521
|
-
})
|
|
619
|
+
}));
|
|
522
620
|
}
|
|
523
621
|
|
|
524
622
|
default:
|
|
@@ -555,8 +653,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
555
653
|
valuePropName: editable === 'switch' ? 'checked' : 'value',
|
|
556
654
|
style: {
|
|
557
655
|
margin: 0
|
|
558
|
-
}
|
|
559
|
-
noStyle: formProps ? false : true
|
|
656
|
+
}
|
|
560
657
|
}, formProps, {
|
|
561
658
|
name: dataIndex
|
|
562
659
|
}), Control(editable)));
|
|
@@ -568,7 +665,6 @@ var EditableCell = function EditableCell(props) {
|
|
|
568
665
|
margin: 0
|
|
569
666
|
}
|
|
570
667
|
}, formProps, {
|
|
571
|
-
noStyle: formProps ? false : true,
|
|
572
668
|
name: [dataIndex, 'value']
|
|
573
669
|
}), Control(editable)));
|
|
574
670
|
}
|
|
@@ -579,68 +675,31 @@ var EditableCell = function EditableCell(props) {
|
|
|
579
675
|
}
|
|
580
676
|
|
|
581
677
|
return childNode;
|
|
582
|
-
}, [col, isEdit, editing, getLength
|
|
678
|
+
}, [col, isEdit, editing, getLength]); // const [childNode, setChildNode] = useState(getMemoChildNode);
|
|
679
|
+
// 出现死循环找我
|
|
583
680
|
|
|
584
681
|
useEffect(function () {
|
|
585
682
|
var editable = col.editable,
|
|
586
683
|
dataIndex = col.dataIndex;
|
|
587
684
|
|
|
588
685
|
if (isEdit && editable) {
|
|
589
|
-
form.setFieldsValue(_defineProperty({}, dataIndex, editable === 'date'
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
setHoverStatus(false);
|
|
599
|
-
};
|
|
686
|
+
form.setFieldsValue(_defineProperty({}, dataIndex, editable === 'date' ? moment(record[dataIndex]) : record[dataIndex]));
|
|
687
|
+
} // if (
|
|
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
|
+
// }
|
|
600
695
|
|
|
696
|
+
}, [record]);
|
|
601
697
|
return /*#__PURE__*/React.createElement("td", Object.assign({}, omit(clearProps, ['dataIndex']), {
|
|
602
698
|
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,
|
|
605
699
|
key: "r".concat(rowIndex, "_c").concat(colIndex)
|
|
606
|
-
}),
|
|
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
|
-
})));
|
|
700
|
+
}), getMemoChildNode);
|
|
621
701
|
};
|
|
622
|
-
/** true 不刷新, false 刷新 */
|
|
623
702
|
|
|
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
|
-
});
|
|
644
703
|
var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
645
704
|
var _a, _b;
|
|
646
705
|
|
|
@@ -660,21 +719,16 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
660
719
|
_props$quickOpetateCl = props.quickOpetateClearAll,
|
|
661
720
|
quickOpetateClearAll = _props$quickOpetateCl === void 0 ? true : _props$quickOpetateCl,
|
|
662
721
|
rowSelection = props.rowSelection,
|
|
663
|
-
virtual = props.virtual,
|
|
664
722
|
sortOpen = props.sortOpen,
|
|
665
|
-
disabled = props.disabled,
|
|
666
723
|
colSortOpen = props.colSortOpen,
|
|
667
|
-
_props$indexCol = props.indexCol,
|
|
668
|
-
indexCol = _props$indexCol === void 0 ? false : _props$indexCol,
|
|
669
724
|
filterChange = props.filterChange,
|
|
670
725
|
_props$size = props.size,
|
|
671
726
|
size = _props$size === void 0 ? 'small' : _props$size,
|
|
672
727
|
recordCreatorProps = props.recordCreatorProps,
|
|
673
728
|
_props$shouldUpdate = props.shouldUpdate,
|
|
674
729
|
shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
|
|
675
|
-
|
|
676
|
-
|
|
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"]);
|
|
730
|
+
resetProps = __rest(props, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "sortOpen", "colSortOpen", "filterChange", "size", "recordCreatorProps", "shouldUpdate"]); // const [dataSource, setDataSource] = useState([]);
|
|
731
|
+
|
|
678
732
|
|
|
679
733
|
var _useControllableValue = useControllableValue({
|
|
680
734
|
value: checkRowKeyByDataSource(props.value, _rowKey),
|
|
@@ -682,7 +736,14 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
682
736
|
}),
|
|
683
737
|
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
|
684
738
|
dataSource = _useControllableValue2[0],
|
|
685
|
-
setDataSource = _useControllableValue2[1];
|
|
739
|
+
setDataSource = _useControllableValue2[1]; // const [count, setCount] = useState(0);
|
|
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
747
|
|
|
687
748
|
var transformRowSelect = function transformRowSelect(selectedRowKeys, selectedRows, info) {
|
|
688
749
|
var _a;
|
|
@@ -699,28 +760,43 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
699
760
|
_useControllableValue4 = _slicedToArray(_useControllableValue3, 2),
|
|
700
761
|
localRowSelectList = _useControllableValue4[0],
|
|
701
762
|
setLocalRowSelectList = _useControllableValue4[1];
|
|
702
|
-
/** TODO: 当前展开的列 */
|
|
703
|
-
|
|
704
763
|
|
|
705
764
|
var _useState7 = useState([]),
|
|
706
765
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
707
|
-
|
|
708
|
-
|
|
766
|
+
sortEditTable = _useState8[0],
|
|
767
|
+
setCallBackFalg = _useState8[1];
|
|
768
|
+
/** 当前展开的列 */
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
var _useState9 = useState([]),
|
|
772
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
773
|
+
expandedRowKeys = _useState10[0],
|
|
774
|
+
setExpandedRowKeys = _useState10[1];
|
|
709
775
|
|
|
710
|
-
var dataSourceRef = useRef(
|
|
711
|
-
var
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
var
|
|
776
|
+
var dataSourceRef = useRef([]);
|
|
777
|
+
var sortDataSorceRef = useRef([]);
|
|
778
|
+
var deepDataSourceRef = useRef([]);
|
|
779
|
+
|
|
780
|
+
var onSortEnd = function onSortEnd(active, over) {
|
|
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
|
+
};
|
|
715
791
|
|
|
716
792
|
var onColSortEnd = function onColSortEnd(active, over) {
|
|
717
793
|
var _a;
|
|
718
794
|
|
|
719
795
|
var oldIndex = columns.findIndex(function (item) {
|
|
720
|
-
return item
|
|
796
|
+
return item['dataIndex'] === active;
|
|
721
797
|
});
|
|
722
798
|
var newIndex = columns.findIndex(function (item) {
|
|
723
|
-
return item
|
|
799
|
+
return item['dataIndex'] === over;
|
|
724
800
|
});
|
|
725
801
|
filterChange === null || filterChange === void 0 ? void 0 : filterChange((_a = arrayMove(columns, oldIndex, newIndex)) === null || _a === void 0 ? void 0 : _a.map(function (item, index) {
|
|
726
802
|
return Object.assign(Object.assign({}, item), {
|
|
@@ -733,21 +809,55 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
733
809
|
var handleDelete = function handleDelete(key) {
|
|
734
810
|
var nValue = dataSource.filter(function (item) {
|
|
735
811
|
return item[_rowKey] !== key;
|
|
736
|
-
});
|
|
812
|
+
}); // onChange?.(nValue)
|
|
813
|
+
|
|
737
814
|
setDataSource(nValue);
|
|
738
815
|
};
|
|
739
|
-
/**
|
|
816
|
+
/** 点击添加按钮添加 */
|
|
740
817
|
|
|
741
818
|
|
|
742
|
-
var handleAdd =
|
|
819
|
+
var handleAdd = function handleAdd(row) {
|
|
743
820
|
var _a;
|
|
744
821
|
|
|
745
822
|
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;
|
|
746
823
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
747
824
|
draft.push(Object.assign(_defineProperty({}, _rowKey, "".concat(Date.now())), addDataInfo || {}));
|
|
748
825
|
});
|
|
749
|
-
setDataSource(res);
|
|
750
|
-
}
|
|
826
|
+
setDataSource(res); // onChange?.(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
|
+
// }
|
|
751
861
|
|
|
752
862
|
var handleSave = function handleSave(row, options) {
|
|
753
863
|
var _a, _b;
|
|
@@ -755,9 +865,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
755
865
|
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;
|
|
756
866
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
757
867
|
if (options === null || options === void 0 ? void 0 : options.only) {
|
|
758
|
-
var
|
|
759
|
-
key =
|
|
760
|
-
value =
|
|
868
|
+
var _ref2 = options === null || options === void 0 ? void 0 : options.only,
|
|
869
|
+
key = _ref2.key,
|
|
870
|
+
value = _ref2.value;
|
|
761
871
|
|
|
762
872
|
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
763
873
|
var deeps = function deeps(children) {
|
|
@@ -820,26 +930,25 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
820
930
|
}
|
|
821
931
|
});
|
|
822
932
|
setDataSource(res);
|
|
823
|
-
};
|
|
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
|
|
933
|
+
};
|
|
834
934
|
|
|
835
|
-
|
|
935
|
+
var reWriteOriginSource = function reWriteOriginSource(rowKey, rowValue, dataIndex, nextValue) {
|
|
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
|
|
836
946
|
|
|
837
947
|
|
|
838
|
-
var handleTableRowDelete =
|
|
948
|
+
var handleTableRowDelete = function handleTableRowDelete(key) {
|
|
839
949
|
var _a, _b, _c;
|
|
840
950
|
|
|
841
|
-
var
|
|
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;
|
|
951
|
+
var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.preKeys;
|
|
843
952
|
|
|
844
953
|
if (preKeys.length > 1) {
|
|
845
954
|
/** 说明删除的是children中的数据 */
|
|
@@ -860,7 +969,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
860
969
|
return newData;
|
|
861
970
|
};
|
|
862
971
|
|
|
863
|
-
var res = filter(
|
|
972
|
+
var res = filter(dataSource, key);
|
|
864
973
|
setDataSource(res);
|
|
865
974
|
} else {
|
|
866
975
|
if (((_c = dataSourceRef.current) === null || _c === void 0 ? void 0 : _c.length) === 1 && !quickOpetateClearAll) {
|
|
@@ -879,76 +988,34 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
879
988
|
|
|
880
989
|
setDataSource(_res);
|
|
881
990
|
}
|
|
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);
|
|
991
|
+
};
|
|
911
992
|
/** 快捷添加 */
|
|
912
993
|
|
|
913
|
-
|
|
994
|
+
|
|
995
|
+
var handleTableRowAdd = function handleTableRowAdd(record, isAppendInChindren) {
|
|
914
996
|
var _a, _b;
|
|
915
997
|
|
|
916
|
-
var
|
|
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;
|
|
998
|
+
var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[record[_rowKey]]) === null || _b === void 0 ? void 0 : _b.preKeys;
|
|
918
999
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
919
|
-
var _a, _b, _c, _d
|
|
1000
|
+
var _a, _b, _c, _d;
|
|
920
1001
|
|
|
921
|
-
if (
|
|
1002
|
+
if (preKeys.length > 1) {
|
|
922
1003
|
var deeps = function deeps(children) {
|
|
923
1004
|
children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
|
|
924
|
-
var _a
|
|
1005
|
+
var _a;
|
|
925
1006
|
|
|
926
1007
|
if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
|
|
927
|
-
if (item[_rowKey] ===
|
|
1008
|
+
if (item[_rowKey] === record[_rowKey]) {
|
|
928
1009
|
if (isAppendInChindren) {
|
|
929
1010
|
if (item === null || item === void 0 ? void 0 : item.children) {
|
|
930
|
-
|
|
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
|
-
}
|
|
1011
|
+
(_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.push(_defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
937
1012
|
} else {
|
|
938
|
-
|
|
939
|
-
item.children = _toConsumableArray(defaultRecord);
|
|
940
|
-
} else {
|
|
941
|
-
item.children = [defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
942
|
-
}
|
|
1013
|
+
item.children = [_defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
943
1014
|
}
|
|
944
1015
|
|
|
945
1016
|
!expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray(expandedRowKeys), [item[_rowKey]]));
|
|
946
1017
|
} else {
|
|
947
|
-
|
|
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
|
-
}
|
|
1018
|
+
children.splice(index + 1, 0, _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
952
1019
|
}
|
|
953
1020
|
} else if (item.children) {
|
|
954
1021
|
deeps(item.children);
|
|
@@ -960,44 +1027,31 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
960
1027
|
deeps(draft);
|
|
961
1028
|
} else {
|
|
962
1029
|
var index = draft.findIndex(function (item) {
|
|
963
|
-
return
|
|
1030
|
+
return record[_rowKey] === item[_rowKey];
|
|
964
1031
|
});
|
|
965
1032
|
|
|
966
1033
|
if (index !== -1) {
|
|
967
1034
|
if (isAppendInChindren) {
|
|
968
1035
|
if ((_a = draft[index].children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
969
|
-
|
|
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
|
-
}
|
|
1036
|
+
(_b = draft[index].children) === null || _b === void 0 ? void 0 : _b.push(_defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
976
1037
|
} else {
|
|
977
|
-
draft[index].children =
|
|
1038
|
+
draft[index].children = [_defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
978
1039
|
}
|
|
979
1040
|
|
|
980
|
-
!expandedRowKeys.includes((
|
|
1041
|
+
!expandedRowKeys.includes((_c = draft[index]) === null || _c === void 0 ? void 0 : _c[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray(expandedRowKeys), [(_d = draft[index]) === null || _d === void 0 ? void 0 : _d[_rowKey]]));
|
|
981
1042
|
} else {
|
|
982
|
-
|
|
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
|
-
}
|
|
1043
|
+
draft.splice(index + 1, 0, _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
987
1044
|
}
|
|
988
1045
|
}
|
|
989
1046
|
}
|
|
990
1047
|
});
|
|
991
1048
|
setDataSource(res);
|
|
992
|
-
}
|
|
993
|
-
/** 快捷刷子功能 */
|
|
1049
|
+
};
|
|
994
1050
|
|
|
995
|
-
var handleCopy = function handleCopy(key, value
|
|
1051
|
+
var handleCopy = function handleCopy(key, value) {
|
|
996
1052
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
997
|
-
draft === null || draft === void 0 ? void 0 : draft.forEach(function (item
|
|
998
|
-
|
|
999
|
-
item[key] = value;
|
|
1000
|
-
}
|
|
1053
|
+
draft === null || draft === void 0 ? void 0 : draft.forEach(function (item) {
|
|
1054
|
+
return item[key] = value;
|
|
1001
1055
|
});
|
|
1002
1056
|
});
|
|
1003
1057
|
setDataSource(res);
|
|
@@ -1006,16 +1060,17 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1006
1060
|
|
|
1007
1061
|
|
|
1008
1062
|
var hasDisableOptions = useMemo(function () {
|
|
1063
|
+
// const hasOnlyOptionsDatas = columns.filter(item => item?.['componentProps']?.optionOnly)
|
|
1009
1064
|
var hasOnlyOptionsDatas = columns.filter(function (item) {
|
|
1010
1065
|
var _a;
|
|
1011
1066
|
|
|
1012
1067
|
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;
|
|
1013
1068
|
return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
|
|
1014
|
-
});
|
|
1069
|
+
});
|
|
1015
1070
|
|
|
1016
1071
|
if (hasOnlyOptionsDatas.length) {
|
|
1017
1072
|
return hasOnlyOptionsDatas === null || hasOnlyOptionsDatas === void 0 ? void 0 : hasOnlyOptionsDatas.map(function (item) {
|
|
1018
|
-
return item
|
|
1073
|
+
return item['dataIndex'];
|
|
1019
1074
|
});
|
|
1020
1075
|
}
|
|
1021
1076
|
|
|
@@ -1027,11 +1082,12 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1027
1082
|
var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
1028
1083
|
var _a;
|
|
1029
1084
|
|
|
1030
|
-
var resultComponentProps = isFunction(item.componentProps) ? (_a = item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item.componentProps;
|
|
1085
|
+
var resultComponentProps = isFunction(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;
|
|
1086
|
+
|
|
1087
|
+
var _ref5 = resultComponentProps || {},
|
|
1088
|
+
optionOnly = _ref5.optionOnly,
|
|
1089
|
+
options = _ref5.options; // const { optionOnly, options } = item['componentProps'] || {}
|
|
1031
1090
|
|
|
1032
|
-
var _ref8 = resultComponentProps || {},
|
|
1033
|
-
optionOnly = _ref8.optionOnly,
|
|
1034
|
-
options = _ref8.options;
|
|
1035
1091
|
|
|
1036
1092
|
if (optionOnly && options) {
|
|
1037
1093
|
var dataIndex = item.dataIndex;
|
|
@@ -1051,7 +1107,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1051
1107
|
}
|
|
1052
1108
|
|
|
1053
1109
|
return Object.assign(Object.assign({}, item), {
|
|
1054
|
-
componentProps: Object.assign(Object.assign({}, item
|
|
1110
|
+
componentProps: Object.assign(Object.assign({}, item['componentProps']), {
|
|
1055
1111
|
options: newOptions
|
|
1056
1112
|
})
|
|
1057
1113
|
});
|
|
@@ -1070,47 +1126,16 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1070
1126
|
var rColumns = hasDisableOptions ? DisableOptions : columns;
|
|
1071
1127
|
var localColumns = [sortOpen ? {
|
|
1072
1128
|
title: '排序',
|
|
1073
|
-
dataIndex: '
|
|
1129
|
+
dataIndex: 'sort',
|
|
1074
1130
|
width: 48,
|
|
1075
1131
|
maxWidth: 48,
|
|
1076
1132
|
className: 'drag-visible',
|
|
1077
|
-
fixed: 'left',
|
|
1078
1133
|
render: function render(_, record) {
|
|
1079
1134
|
return /*#__PURE__*/React.createElement(DragHandle, {
|
|
1080
|
-
id:
|
|
1135
|
+
id: record[_rowKey] || record.id
|
|
1081
1136
|
});
|
|
1082
1137
|
}
|
|
1083
|
-
} : null,
|
|
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 ? {
|
|
1138
|
+
} : null].concat(_toConsumableArray(rColumns), [useQuickOpetate ? {
|
|
1114
1139
|
title: '操作',
|
|
1115
1140
|
dataIndex: 'lm_edit_opetate',
|
|
1116
1141
|
width: 68,
|
|
@@ -1121,11 +1146,11 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1121
1146
|
options: Array.isArray(useQuickOpetate) ? useQuickOpetate : ['add', 'delete']
|
|
1122
1147
|
}
|
|
1123
1148
|
} : null]).filter(function (item) {
|
|
1124
|
-
return item &&
|
|
1149
|
+
return item && item.show !== false;
|
|
1125
1150
|
});
|
|
1126
|
-
localColumns = localColumns
|
|
1151
|
+
localColumns = localColumns.map(function (item, index) {
|
|
1127
1152
|
return Object.assign(Object.assign({}, item), {
|
|
1128
|
-
order: [null, undefined].includes(item
|
|
1153
|
+
order: [null, undefined].includes(item['order']) ? index : item['order']
|
|
1129
1154
|
});
|
|
1130
1155
|
}).sort(function (a, b) {
|
|
1131
1156
|
return a.order - b.order;
|
|
@@ -1148,22 +1173,29 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1148
1173
|
var mapColumns = function mapColumns(col, index) {
|
|
1149
1174
|
var _a, _b;
|
|
1150
1175
|
|
|
1151
|
-
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length)
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1176
|
+
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1177
|
+
return col;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
var newCol = Object.assign(Object.assign({}, col), {
|
|
1181
|
+
shouldCellUpdate: function shouldCellUpdate(record, prevRecord) {
|
|
1182
|
+
var _a;
|
|
1156
1183
|
|
|
1157
|
-
|
|
1184
|
+
var dataIndex = col.dataIndex,
|
|
1185
|
+
editable = col.editable,
|
|
1186
|
+
relevanceCols = col.relevanceCols,
|
|
1187
|
+
componentProps = col.componentProps;
|
|
1188
|
+
|
|
1189
|
+
if (componentProps && isFunction(componentProps)) {
|
|
1190
|
+
return true;
|
|
1158
1191
|
}
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
1192
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1193
|
+
if ((col === null || col === void 0 ? void 0 : col.fixed) || hasDisableOptions && hasDisableOptions.includes(dataIndex) || ((_a = col.componentProps) === null || _a === void 0 ? void 0 : _a.options) || editable === 'render' || !!relevanceCols || !!shouldUpdate || !!record.children) {
|
|
1194
|
+
return true;
|
|
1195
|
+
}
|
|
1165
1196
|
|
|
1166
|
-
|
|
1197
|
+
return record[dataIndex] !== prevRecord[dataIndex];
|
|
1198
|
+
},
|
|
1167
1199
|
onCell: function onCell(record, rowIndex) {
|
|
1168
1200
|
return {
|
|
1169
1201
|
getLength: dataSource.length,
|
|
@@ -1178,7 +1210,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1178
1210
|
editable: col.editable,
|
|
1179
1211
|
dataIndex: col.dataIndex,
|
|
1180
1212
|
itemProps: col.itemProps,
|
|
1181
|
-
|
|
1213
|
+
setValid: setValid,
|
|
1182
1214
|
isEdit: isEdit,
|
|
1183
1215
|
isHoverEdit: isHoverEdit,
|
|
1184
1216
|
handleAdd: handleAdd,
|
|
@@ -1186,7 +1218,8 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1186
1218
|
handleCopy: handleCopy,
|
|
1187
1219
|
editEnum: typeof col.editEnum === 'function' ? col.editEnum(record) : col.editEnum,
|
|
1188
1220
|
valueType: typeof col.valueType === 'function' ? col.valueType(record) : col.valueType,
|
|
1189
|
-
handleSave: handleSave
|
|
1221
|
+
handleSave: handleSave,
|
|
1222
|
+
reWriteOriginSource: reWriteOriginSource
|
|
1190
1223
|
};
|
|
1191
1224
|
}
|
|
1192
1225
|
});
|
|
@@ -1198,24 +1231,24 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1198
1231
|
return newCol;
|
|
1199
1232
|
};
|
|
1200
1233
|
|
|
1201
|
-
var res = localColumns
|
|
1234
|
+
var res = localColumns.map(function (col, index) {
|
|
1202
1235
|
return mapColumns(col, index);
|
|
1203
1236
|
});
|
|
1204
1237
|
return res;
|
|
1205
|
-
}, [columns, isAdd, sortOpen, useQuickOpetate, dataSource, _toConsumableArray(memoOptions)]);
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
var cloneArr = _toConsumableArray(dataSourceRef.current);
|
|
1238
|
+
}, [columns, isAdd, sortOpen, useQuickOpetate, sortEditTable, dataSource, _toConsumableArray(memoOptions)]);
|
|
1239
|
+
var DraggableContainer = useCallback(function (_a) {
|
|
1240
|
+
var _b;
|
|
1209
1241
|
|
|
1210
|
-
var
|
|
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
|
-
};
|
|
1242
|
+
var props = __rest(_a, []);
|
|
1218
1243
|
|
|
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]);
|
|
1219
1252
|
var colDraggableContainer = useCallback(function (_a) {
|
|
1220
1253
|
var _b;
|
|
1221
1254
|
|
|
@@ -1233,18 +1266,40 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1233
1266
|
}, child);
|
|
1234
1267
|
}));
|
|
1235
1268
|
}, [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]);
|
|
1236
1297
|
useImperativeHandle(ref, function () {
|
|
1237
1298
|
return {
|
|
1238
1299
|
setRow: handleSave,
|
|
1239
1300
|
getCheckboxRecords: function getCheckboxRecords() {
|
|
1240
1301
|
return localRowSelectList.selectedRows;
|
|
1241
1302
|
},
|
|
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
|
-
},
|
|
1248
1303
|
clearSelect: function clearSelect() {
|
|
1249
1304
|
setLocalRowSelectList({
|
|
1250
1305
|
selectedRows: []
|
|
@@ -1254,80 +1309,32 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1254
1309
|
setLocalRowSelectList({
|
|
1255
1310
|
selectedRows: value
|
|
1256
1311
|
});
|
|
1312
|
+
},
|
|
1313
|
+
valid: function valid() {
|
|
1314
|
+
return _valid;
|
|
1257
1315
|
}
|
|
1258
1316
|
};
|
|
1259
1317
|
});
|
|
1260
1318
|
var isShowAddAction = useMemo(function () {
|
|
1261
1319
|
return isEdit && isAdd || isHoverEdit && isAdd;
|
|
1262
1320
|
}, [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));
|
|
1311
1321
|
|
|
1312
1322
|
if (colSortOpen) {
|
|
1313
1323
|
return /*#__PURE__*/React.createElement("div", {
|
|
1314
|
-
className: "lm_editTable_warpper"
|
|
1315
|
-
ref: tableWarpRef
|
|
1324
|
+
className: "lm_editTable_warpper"
|
|
1316
1325
|
}, /*#__PURE__*/React.createElement(DndContainer, {
|
|
1317
|
-
rowKey: _rowKey,
|
|
1318
|
-
options: resultColumns,
|
|
1319
1326
|
move: onColSortEnd
|
|
1320
1327
|
}, /*#__PURE__*/React.createElement(SortableBoxCol, {
|
|
1321
1328
|
items: columns.reduce(function (acc, item) {
|
|
1322
1329
|
return [].concat(_toConsumableArray(acc), [item.dataIndex]);
|
|
1323
1330
|
}, [])
|
|
1324
|
-
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, config
|
|
1325
|
-
loading: loading,
|
|
1331
|
+
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, config, {
|
|
1326
1332
|
size: size || 'small',
|
|
1327
1333
|
columns: resultColumns,
|
|
1328
1334
|
rowClassName: "editable-row",
|
|
1329
1335
|
bordered: true,
|
|
1330
1336
|
pagination: false,
|
|
1337
|
+
// components={tableComponents}
|
|
1331
1338
|
rowSelection: !rowSelection ? undefined : Object.assign(Object.assign({
|
|
1332
1339
|
fixed: true,
|
|
1333
1340
|
type: 'checkbox',
|
|
@@ -1337,39 +1344,36 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1337
1344
|
return isObject(v) ? v[_rowKey] : v;
|
|
1338
1345
|
}),
|
|
1339
1346
|
onChange: function onChange(selectedRowKeys, selectedRows, info) {
|
|
1347
|
+
// editTableRowChange(selectedRowKeys, selectedRows, info)
|
|
1340
1348
|
setLocalRowSelectList(selectedRowKeys, selectedRows, info);
|
|
1341
1349
|
}
|
|
1342
1350
|
}),
|
|
1343
1351
|
dataSource: dataSource
|
|
1344
|
-
})))), /*#__PURE__*/React.createElement(
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1352
|
+
})))), isShowAddAction && /*#__PURE__*/React.createElement(Button, {
|
|
1353
|
+
className: "lm_editTable_add_bar",
|
|
1354
|
+
type: "dashed",
|
|
1355
|
+
onClick: handleAdd,
|
|
1356
|
+
style: {
|
|
1357
|
+
marginTop: 8
|
|
1358
|
+
}
|
|
1359
|
+
}, /*#__PURE__*/React.createElement(PlusCircleOutlined, {
|
|
1360
|
+
className: "lmweb-plus"
|
|
1361
|
+
}), "\u65B0\u589E"));
|
|
1350
1362
|
} // @ts-ignore
|
|
1351
1363
|
|
|
1352
1364
|
|
|
1353
1365
|
return /*#__PURE__*/React.createElement("div", {
|
|
1354
|
-
className: "lm_editTable_warpper"
|
|
1355
|
-
|
|
1356
|
-
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, config.current, {
|
|
1366
|
+
className: "lm_editTable_warpper"
|
|
1367
|
+
}, /*#__PURE__*/React.createElement(Table, Object.assign({}, config, {
|
|
1357
1368
|
size: size || 'small',
|
|
1358
1369
|
columns: resultColumns,
|
|
1359
1370
|
rowClassName: "editable-row",
|
|
1360
1371
|
bordered: true,
|
|
1361
|
-
loading: loading,
|
|
1362
1372
|
pagination: false,
|
|
1363
1373
|
// components={tableComponents}
|
|
1364
1374
|
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
1365
1375
|
expandedRowKeys: expandedRowKeys,
|
|
1366
1376
|
fixed: true,
|
|
1367
|
-
// indentSize: 0,
|
|
1368
|
-
expandIconColumnIndex: checkExpandIconColumnIndex({
|
|
1369
|
-
rowSelection: rowSelection,
|
|
1370
|
-
sortOpen: sortOpen,
|
|
1371
|
-
indexCol: indexCol
|
|
1372
|
-
}) || 0,
|
|
1373
1377
|
onExpandedRowsChange: function onExpandedRowsChange(expandedRows) {
|
|
1374
1378
|
return setExpandedRowKeys(expandedRows);
|
|
1375
1379
|
}
|
|
@@ -1387,11 +1391,15 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1387
1391
|
}
|
|
1388
1392
|
}),
|
|
1389
1393
|
dataSource: dataSource
|
|
1390
|
-
})), /*#__PURE__*/React.createElement(
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
recordCreatorProps: recordCreatorProps,
|
|
1394
|
-
|
|
1395
|
-
|
|
1394
|
+
})), isShowAddAction && /*#__PURE__*/React.createElement(Button, {
|
|
1395
|
+
className: "lm_editTable_add_bar",
|
|
1396
|
+
type: "dashed",
|
|
1397
|
+
onClick: (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.customAddClick) || handleAdd,
|
|
1398
|
+
style: Object.assign({
|
|
1399
|
+
marginTop: 8
|
|
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) || '新增'));
|
|
1396
1404
|
});
|
|
1397
1405
|
export default /*#__PURE__*/memo(EditTable);
|