linkmore-design 1.1.13-alpha.0 → 1.1.13-alpha.10
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/CHANGELOG.md +118 -0
- package/dist/Button/demos/ghost.d.ts +2 -0
- package/dist/ConfigProvider/context.d.ts +1 -0
- package/dist/Descriptions/Cell.d.ts +1 -0
- package/dist/Descriptions/Item.d.ts +1 -0
- package/dist/Descriptions/index.d.ts +1 -1
- package/dist/Form/FormWrapper.d.ts +3 -0
- package/dist/Form/WrapperItem.d.ts +4 -0
- package/dist/Form/demos/disabled.d.ts +2 -0
- package/dist/Form/demos/responsive.d.ts +0 -1
- package/dist/Form/index.d.ts +2 -0
- package/dist/Form/interface.d.ts +12 -0
- package/dist/IconFont/demos/ConfigProvider.d.ts +2 -0
- package/dist/IconFont/index.d.ts +1 -2
- package/dist/LmDrag/LmDrag.d.ts +4 -0
- package/dist/LmDrag/components/DndContainer.d.ts +3 -0
- package/dist/LmDrag/components/sortableBox.d.ts +5 -0
- package/dist/LmDrag/components/sortableItem.d.ts +7 -0
- package/dist/LmDrag/demos/basic.d.ts +2 -0
- package/dist/LmDrag/index.d.ts +10 -0
- package/dist/LmDrag/style/index.d.ts +1 -0
- package/dist/LmDrag/style/variables.d.ts +1 -0
- package/dist/LmDrag/wrapper/Root.d.ts +3 -0
- package/dist/LmEditTable/EditTable.d.ts +16 -3
- 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 +3 -1
- package/dist/LmFilter/LmFilter.d.ts +2 -6
- package/dist/LmTable/demos/summuy.d.ts +2 -0
- package/dist/LmTable/expression.d.ts +1 -0
- package/dist/LmTable/hooks/useGroupDataSource.d.ts +7 -0
- package/dist/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
- package/dist/LmUpload/fns/index.d.ts +1 -0
- package/dist/QuickMenu/demos/useInDraw.d.ts +2 -0
- package/dist/QuickMenu/index.d.ts +3 -1
- package/dist/Select/index.d.ts +3 -0
- package/dist/TreeSelect/demos/treedata.d.ts +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.umd.js +2660 -1507
- package/dist/index.umd.min.js +17 -17
- package/dist/variables.css +263 -120
- package/es/Button/index.js +4 -3
- package/es/Button/style/index.css +28 -25
- package/es/Button/style/variables.css +28 -25
- package/es/Cascader/index.js +31 -3
- package/es/Cascader/style/index.css +1 -0
- package/es/Cascader/style/variables.css +1 -0
- package/es/ConfigProvider/context.d.ts +1 -0
- package/es/ConfigProvider/index.js +5 -3
- package/es/Descriptions/Cell.d.ts +1 -0
- package/es/Descriptions/Cell.js +5 -2
- package/es/Descriptions/Item.d.ts +1 -0
- package/es/Descriptions/Row.js +6 -1
- package/es/Descriptions/index.d.ts +1 -1
- package/es/Descriptions/index.js +3 -3
- package/es/Descriptions/style/index.css +3 -0
- package/es/Descriptions/style/variables.css +3 -0
- package/es/Form/Form.js +13 -4
- package/es/Form/FormItem/ItemHolder.js +1 -10
- package/es/Form/FormWrapper.d.ts +3 -0
- package/es/Form/FormWrapper.js +22 -0
- package/es/Form/WrapperItem.d.ts +4 -0
- package/es/Form/WrapperItem.js +217 -0
- package/es/Form/container.js +1 -13
- package/es/Form/images/icon_collapse.svg +1 -0
- package/es/Form/index.d.ts +2 -0
- package/es/Form/index.js +2 -0
- package/es/Form/interface.d.ts +12 -0
- package/es/Form/style/index.css +34 -41
- package/es/Form/style/variables.css +34 -41
- package/es/IconFont/index.d.ts +1 -2
- package/es/IconFont/index.js +18 -4
- package/es/ImageViewer/components/Operate.js +4 -7
- package/es/Input/index.js +47 -10
- package/es/InputNumber/index.js +23 -11
- package/es/InputNumber/style/index.css +7 -0
- package/es/InputNumber/style/variables.css +7 -0
- package/es/LmDrag/LmDrag.d.ts +4 -0
- package/es/LmDrag/LmDrag.js +30 -0
- package/es/LmDrag/components/DndContainer.d.ts +3 -0
- package/es/LmDrag/components/DndContainer.js +121 -0
- package/es/LmDrag/components/sortableBox.d.ts +5 -0
- package/es/LmDrag/components/sortableBox.js +23 -0
- package/es/LmDrag/components/sortableItem.d.ts +7 -0
- package/es/LmDrag/components/sortableItem.js +41 -0
- package/es/LmDrag/index.d.ts +10 -0
- package/es/LmDrag/index.js +3 -0
- package/es/LmDrag/style/index.css +0 -0
- package/es/LmDrag/style/index.d.ts +1 -0
- package/es/LmDrag/style/index.js +1 -0
- package/es/LmDrag/style/variables.css +0 -0
- package/es/LmDrag/style/variables.d.ts +1 -0
- package/es/LmDrag/style/variables.js +1 -0
- package/es/LmDrag/wrapper/Root.d.ts +3 -0
- package/es/LmDrag/wrapper/Root.js +12 -0
- package/es/LmEditTable/EditTable.d.ts +16 -3
- package/es/LmEditTable/EditTable.js +276 -235
- 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 +3 -1
- package/es/LmEditTable/components/index.js +3 -1
- package/es/LmEditTable/sortableItemCol.js +40 -10
- package/es/LmEditTable/style/index.css +20 -0
- package/es/LmEditTable/style/variables.css +20 -0
- package/es/LmEditTable/util.js +51 -15
- package/es/LmFilter/LmFilter.js +6 -6
- package/es/LmFilter/components/CheckboxFilter.js +9 -4
- package/es/LmFilter/components/DropdownFIlter.js +186 -111
- package/es/LmFilter/components/SelectFilter.js +4 -3
- package/es/LmFilter/filterFns/index.js +4 -6
- package/es/LmFilter/index.js +0 -3
- package/es/LmFilter/style/index.css +82 -54
- package/es/LmFilter/style/variables.css +82 -54
- package/es/LmFilter/utils.js +6 -6
- package/es/LmSelect/style/index.css +1 -0
- package/es/LmSelect/style/variables.css +1 -0
- package/es/LmTable/Table.js +24 -15
- package/es/LmTable/expression.d.ts +1 -0
- package/es/LmTable/expression.js +31 -0
- package/es/LmTable/hooks/useGroupDataSource.js +50 -0
- package/es/LmTable/style/index.css +39 -0
- package/es/LmTable/style/variables.css +39 -0
- package/es/LmUpload/LmUpload.js +6 -3
- package/es/LmUpload/UploadList/ItemPicture.js +2 -1
- package/es/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
- package/es/LmUpload/UploadList/ItemPictureCard.js +15 -5
- package/es/LmUpload/UploadList/ItemText.js +7 -2
- package/es/LmUpload/UploadList/index.js +53 -2
- package/es/LmUpload/body/UploadCore.js +4 -1
- package/es/LmUpload/fns/index.d.ts +1 -0
- package/es/LmUpload/fns/index.js +27 -6
- package/es/LmUpload/style/index.css +17 -0
- package/es/LmUpload/style/variables.css +17 -0
- package/es/QuickMenu/index.d.ts +3 -1
- package/es/QuickMenu/index.js +22 -19
- package/es/Select/index.d.ts +3 -0
- package/es/Select/index.js +44 -7
- package/es/Select/style/index.css +28 -0
- package/es/Select/style/variables.css +28 -0
- package/es/TreeSelect/index.js +17 -2
- package/es/TreeSelect/style/index.css +3 -0
- package/es/TreeSelect/style/variables.css +3 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -1
- package/es/styles/variables.css +263 -120
- package/lib/Button/index.js +4 -3
- package/lib/Button/style/index.css +28 -25
- package/lib/Button/style/variables.css +28 -25
- package/lib/Cascader/index.js +35 -3
- package/lib/Cascader/style/index.css +1 -0
- package/lib/Cascader/style/variables.css +1 -0
- package/lib/ConfigProvider/context.d.ts +1 -0
- package/lib/ConfigProvider/index.js +5 -3
- package/lib/Descriptions/Cell.d.ts +1 -0
- package/lib/Descriptions/Cell.js +5 -2
- package/lib/Descriptions/Item.d.ts +1 -0
- package/lib/Descriptions/Row.js +6 -1
- package/lib/Descriptions/index.d.ts +1 -1
- package/lib/Descriptions/index.js +3 -3
- package/lib/Descriptions/style/index.css +3 -0
- package/lib/Descriptions/style/variables.css +3 -0
- package/lib/Form/Form.js +13 -4
- package/lib/Form/FormItem/ItemHolder.js +1 -10
- package/lib/Form/FormWrapper.d.ts +3 -0
- package/lib/Form/FormWrapper.js +34 -0
- package/lib/Form/WrapperItem.d.ts +4 -0
- package/lib/Form/WrapperItem.js +235 -0
- package/lib/Form/container.js +1 -13
- package/lib/Form/images/icon_collapse.svg +1 -0
- package/lib/Form/index.d.ts +2 -0
- package/lib/Form/index.js +3 -0
- package/lib/Form/interface.d.ts +12 -0
- package/lib/Form/style/index.css +34 -41
- package/lib/Form/style/variables.css +34 -41
- package/lib/IconFont/index.d.ts +1 -2
- package/lib/IconFont/index.js +25 -4
- package/lib/ImageViewer/components/Operate.js +4 -8
- package/lib/Input/index.js +52 -10
- package/lib/InputNumber/index.js +29 -11
- package/lib/InputNumber/style/index.css +7 -0
- package/lib/InputNumber/style/variables.css +7 -0
- package/lib/LmDrag/LmDrag.d.ts +4 -0
- package/lib/LmDrag/LmDrag.js +44 -0
- package/lib/LmDrag/components/DndContainer.d.ts +3 -0
- package/lib/LmDrag/components/DndContainer.js +138 -0
- package/lib/LmDrag/components/sortableBox.d.ts +5 -0
- package/lib/LmDrag/components/sortableBox.js +37 -0
- package/lib/LmDrag/components/sortableItem.d.ts +7 -0
- package/lib/LmDrag/components/sortableItem.js +54 -0
- package/lib/LmDrag/index.d.ts +10 -0
- package/lib/LmDrag/index.js +19 -0
- package/lib/LmDrag/style/index.css +0 -0
- package/lib/LmDrag/style/index.d.ts +1 -0
- package/lib/LmDrag/style/index.js +3 -0
- package/lib/LmDrag/style/variables.css +0 -0
- package/lib/LmDrag/style/variables.d.ts +1 -0
- package/lib/LmDrag/style/variables.js +3 -0
- package/lib/LmDrag/wrapper/Root.d.ts +3 -0
- package/lib/LmDrag/wrapper/Root.js +26 -0
- package/lib/LmEditTable/EditTable.d.ts +16 -3
- package/lib/LmEditTable/EditTable.js +272 -231
- 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 +3 -1
- package/lib/LmEditTable/components/index.js +16 -0
- package/lib/LmEditTable/sortableItemCol.js +37 -8
- package/lib/LmEditTable/style/index.css +20 -0
- package/lib/LmEditTable/style/variables.css +20 -0
- package/lib/LmEditTable/util.js +50 -14
- package/lib/LmFilter/LmFilter.js +6 -6
- package/lib/LmFilter/components/CheckboxFilter.js +9 -4
- package/lib/LmFilter/components/DropdownFIlter.js +186 -111
- package/lib/LmFilter/components/SelectFilter.js +4 -3
- package/lib/LmFilter/filterFns/index.js +4 -6
- package/lib/LmFilter/index.js +0 -3
- package/lib/LmFilter/style/index.css +82 -54
- package/lib/LmFilter/style/variables.css +82 -54
- package/lib/LmFilter/utils.js +6 -6
- package/lib/LmSelect/style/index.css +1 -0
- package/lib/LmSelect/style/variables.css +1 -0
- package/lib/LmTable/Table.js +24 -15
- package/lib/LmTable/expression.d.ts +1 -0
- package/lib/LmTable/expression.js +41 -0
- package/lib/LmTable/hooks/useGroupDataSource.js +50 -0
- package/lib/LmTable/style/index.css +39 -0
- package/lib/LmTable/style/variables.css +39 -0
- package/lib/LmUpload/LmUpload.js +9 -3
- package/lib/LmUpload/UploadList/ItemPicture.js +2 -1
- package/lib/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
- package/lib/LmUpload/UploadList/ItemPictureCard.js +15 -5
- package/lib/LmUpload/UploadList/ItemText.js +7 -2
- package/lib/LmUpload/UploadList/index.js +54 -2
- package/lib/LmUpload/body/UploadCore.js +5 -1
- package/lib/LmUpload/fns/index.d.ts +1 -0
- package/lib/LmUpload/fns/index.js +27 -6
- package/lib/LmUpload/style/index.css +17 -0
- package/lib/LmUpload/style/variables.css +17 -0
- package/lib/QuickMenu/index.d.ts +3 -1
- package/lib/QuickMenu/index.js +21 -18
- package/lib/Select/index.d.ts +3 -0
- package/lib/Select/index.js +47 -7
- package/lib/Select/style/index.css +28 -0
- package/lib/Select/style/variables.css +28 -0
- package/lib/TreeSelect/index.js +21 -2
- package/lib/TreeSelect/style/index.css +3 -0
- package/lib/TreeSelect/style/variables.css +3 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +15 -1
- package/lib/styles/variables.css +263 -120
- package/package.json +5 -1
|
@@ -47,26 +47,22 @@ 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
|
-
import DndContainer from './DndContainer';
|
|
62
|
-
|
|
58
|
+
import DndContainer from './DndContainer';
|
|
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
64
|
import { isObjEmpty, deepDataSourcePreKeys, isExpandRow, checkRowKeyByDataSource, checkMemoShouldUploadSpecialFun } from './util';
|
|
69
|
-
import { DraggableContainer } from './components';
|
|
65
|
+
import { DraggableContainer, BottomOpetateComponent, QuickOpetate } from './components';
|
|
70
66
|
import cls from 'classnames';
|
|
71
67
|
import { VirtualTable, VirtualWrapper, VirtualRow } from './virtual';
|
|
72
68
|
var UploadBtn = UploadOss.UploadBtn;
|
|
@@ -99,6 +95,7 @@ var EditableSortRow = function EditableSortRow(_a) {
|
|
|
99
95
|
|
|
100
96
|
return /*#__PURE__*/React.createElement(Form, {
|
|
101
97
|
form: form,
|
|
98
|
+
disabled: props.disabled || false,
|
|
102
99
|
component: false
|
|
103
100
|
}, /*#__PURE__*/React.createElement(EditableContext.Provider, {
|
|
104
101
|
value: form
|
|
@@ -229,80 +226,6 @@ var InputRange = function InputRange(_a) {
|
|
|
229
226
|
return handleInput(e, 'next');
|
|
230
227
|
}
|
|
231
228
|
}, editEnum))));
|
|
232
|
-
}; // 操作列
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
var Opetate = function Opetate(_ref) {
|
|
236
|
-
var record = _ref.record,
|
|
237
|
-
rowKey = _ref.rowKey,
|
|
238
|
-
handleAdd = _ref.handleAdd,
|
|
239
|
-
handleDelete = _ref.handleDelete,
|
|
240
|
-
_ref$options = _ref.options,
|
|
241
|
-
options = _ref$options === void 0 ? ['add', 'delete'] : _ref$options,
|
|
242
|
-
getLength = _ref.getLength,
|
|
243
|
-
quickOpetateClearAll = _ref.quickOpetateClearAll;
|
|
244
|
-
|
|
245
|
-
var appendChildren = function appendChildren() {
|
|
246
|
-
handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record, true);
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
var appendAdd = function appendAdd() {
|
|
250
|
-
handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record);
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
254
|
-
style: {
|
|
255
|
-
display: 'flex',
|
|
256
|
-
alignItems: 'center',
|
|
257
|
-
justifyContent: 'flex-start',
|
|
258
|
-
marginLeft: '-4px'
|
|
259
|
-
}
|
|
260
|
-
}, options.includes('delete') && /*#__PURE__*/React.createElement(Button, {
|
|
261
|
-
type: "link",
|
|
262
|
-
size: "small",
|
|
263
|
-
disabled: !quickOpetateClearAll && getLength < 2,
|
|
264
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
265
|
-
type: "lmweb-minus-circle",
|
|
266
|
-
style: {
|
|
267
|
-
fontSize: 16
|
|
268
|
-
}
|
|
269
|
-
}),
|
|
270
|
-
onClick: function onClick() {
|
|
271
|
-
return handleDelete(record[rowKey]);
|
|
272
|
-
}
|
|
273
|
-
}), (options === null || options === void 0 ? void 0 : options.includes('add')) && (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/React.createElement(Popover, {
|
|
274
|
-
placement: "bottom",
|
|
275
|
-
overlayClassName: "lm_table_append_add_popover",
|
|
276
|
-
open: open,
|
|
277
|
-
title: null,
|
|
278
|
-
content: /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", {
|
|
279
|
-
onClick: appendAdd
|
|
280
|
-
}, "\u6DFB\u52A0\u5E73\u7EA7"), /*#__PURE__*/React.createElement("li", {
|
|
281
|
-
onClick: appendChildren
|
|
282
|
-
}, "\u6DFB\u52A0\u5B50\u7EA7")),
|
|
283
|
-
trigger: "hover"
|
|
284
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
285
|
-
type: "link",
|
|
286
|
-
size: "small",
|
|
287
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
288
|
-
type: "lmweb-plus-circle-fill",
|
|
289
|
-
style: {
|
|
290
|
-
fontSize: 16
|
|
291
|
-
}
|
|
292
|
-
})
|
|
293
|
-
})) : /*#__PURE__*/React.createElement(Button, {
|
|
294
|
-
type: "link",
|
|
295
|
-
size: "small",
|
|
296
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
297
|
-
type: "lmweb-plus-circle-fill",
|
|
298
|
-
style: {
|
|
299
|
-
fontSize: 16
|
|
300
|
-
}
|
|
301
|
-
}),
|
|
302
|
-
onClick: function onClick() {
|
|
303
|
-
return handleAdd(record, (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? true : false);
|
|
304
|
-
}
|
|
305
|
-
}));
|
|
306
229
|
};
|
|
307
230
|
/*
|
|
308
231
|
表格单元格
|
|
@@ -333,9 +256,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
333
256
|
handleDelete = props.handleDelete,
|
|
334
257
|
handleCopy = props.handleCopy,
|
|
335
258
|
itemProps = props.itemProps,
|
|
336
|
-
|
|
337
|
-
reWriteOriginSource = props.reWriteOriginSource,
|
|
338
|
-
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"]);
|
|
339
260
|
/** 去除移入移出功能,保留最纯粹的功能,优化性能 */
|
|
340
261
|
|
|
341
262
|
|
|
@@ -423,13 +344,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
423
344
|
case 13:
|
|
424
345
|
if (col === null || col === void 0 ? void 0 : col.hoverEdit) {
|
|
425
346
|
toggleEdit();
|
|
426
|
-
}
|
|
427
|
-
// setValid((old) => {
|
|
428
|
-
// const obj = { ...old }
|
|
429
|
-
// delete obj[record[rowKey]]
|
|
430
|
-
// return obj
|
|
431
|
-
// })
|
|
432
|
-
|
|
347
|
+
}
|
|
433
348
|
|
|
434
349
|
_context.next = 18;
|
|
435
350
|
break;
|
|
@@ -461,7 +376,16 @@ var EditableCell = function EditableCell(props) {
|
|
|
461
376
|
};
|
|
462
377
|
|
|
463
378
|
var Control = function Control(con) {
|
|
379
|
+
var _a;
|
|
380
|
+
|
|
464
381
|
var resultComponentProps = isFunction(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
|
|
382
|
+
|
|
383
|
+
if (isFunction(componentProps) && ((_a = col === null || col === void 0 ? void 0 : col.newOptions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
384
|
+
resultComponentProps = Object.assign(Object.assign({}, resultComponentProps), {
|
|
385
|
+
options: col === null || col === void 0 ? void 0 : col.newOptions
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
|
|
465
389
|
var clearAttrComponentProps = omit(resultComponentProps, ['optionOnly', 'isOnlyValue', 'quickcopy']);
|
|
466
390
|
|
|
467
391
|
switch (con) {
|
|
@@ -488,8 +412,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
488
412
|
|
|
489
413
|
case 'inputRange':
|
|
490
414
|
return /*#__PURE__*/React.createElement(InputRange, Object.assign({
|
|
491
|
-
onChange: handleFormItemChange
|
|
492
|
-
ref: inputRef
|
|
415
|
+
onChange: handleFormItemChange
|
|
493
416
|
}, resultComponentProps, {
|
|
494
417
|
record: record,
|
|
495
418
|
rowIndex: rowIndex,
|
|
@@ -579,10 +502,9 @@ var EditableCell = function EditableCell(props) {
|
|
|
579
502
|
|
|
580
503
|
case 'operate':
|
|
581
504
|
case 'lm_edit_opetate':
|
|
582
|
-
return /*#__PURE__*/React.createElement(
|
|
505
|
+
return /*#__PURE__*/React.createElement(QuickOpetate, Object.assign({
|
|
583
506
|
record: record,
|
|
584
507
|
rowKey: rowKey,
|
|
585
|
-
ref: inputRef,
|
|
586
508
|
handleAdd: handleTableRowAdd,
|
|
587
509
|
handleDelete: handleTableRowDelete,
|
|
588
510
|
getLength: getLength,
|
|
@@ -591,11 +513,12 @@ var EditableCell = function EditableCell(props) {
|
|
|
591
513
|
|
|
592
514
|
case 'render':
|
|
593
515
|
{
|
|
594
|
-
var
|
|
516
|
+
var _resultComponentProps = resultComponentProps,
|
|
517
|
+
render = _resultComponentProps.render;
|
|
595
518
|
var fromData = form.getFieldsValue();
|
|
596
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), {
|
|
597
520
|
onChange: save
|
|
598
|
-
}));
|
|
521
|
+
}), rowIndex);
|
|
599
522
|
}
|
|
600
523
|
|
|
601
524
|
default:
|
|
@@ -632,7 +555,8 @@ var EditableCell = function EditableCell(props) {
|
|
|
632
555
|
valuePropName: editable === 'switch' ? 'checked' : 'value',
|
|
633
556
|
style: {
|
|
634
557
|
margin: 0
|
|
635
|
-
}
|
|
558
|
+
},
|
|
559
|
+
noStyle: formProps ? false : true
|
|
636
560
|
}, formProps, {
|
|
637
561
|
name: dataIndex
|
|
638
562
|
}), Control(editable)));
|
|
@@ -644,6 +568,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
644
568
|
margin: 0
|
|
645
569
|
}
|
|
646
570
|
}, formProps, {
|
|
571
|
+
noStyle: formProps ? false : true,
|
|
647
572
|
name: [dataIndex, 'value']
|
|
648
573
|
}), Control(editable)));
|
|
649
574
|
}
|
|
@@ -654,14 +579,14 @@ var EditableCell = function EditableCell(props) {
|
|
|
654
579
|
}
|
|
655
580
|
|
|
656
581
|
return childNode;
|
|
657
|
-
}, [col, isEdit, editing, getLength]); // 出现死循环找我
|
|
582
|
+
}, [col, isEdit, editing, getLength, record]); // 出现死循环找我
|
|
658
583
|
|
|
659
584
|
useEffect(function () {
|
|
660
585
|
var editable = col.editable,
|
|
661
586
|
dataIndex = col.dataIndex;
|
|
662
587
|
|
|
663
588
|
if (isEdit && editable) {
|
|
664
|
-
form.setFieldsValue(_defineProperty({}, dataIndex, editable === 'date' ? moment(record[dataIndex]) : record[dataIndex]));
|
|
589
|
+
form.setFieldsValue(_defineProperty({}, dataIndex, editable === 'date' && record[dataIndex] ? moment(record[dataIndex]) : record[dataIndex]));
|
|
665
590
|
}
|
|
666
591
|
}, [record]);
|
|
667
592
|
|
|
@@ -700,11 +625,16 @@ var EditableCell = function EditableCell(props) {
|
|
|
700
625
|
var MemoEditableCell = /*#__PURE__*/memo(EditableCell, function (prev, next) {
|
|
701
626
|
var pickProps = ['record', 'colIndex'];
|
|
702
627
|
var p = pick(prev, pickProps);
|
|
703
|
-
var n = pick(next, pickProps);
|
|
704
|
-
|
|
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))
|
|
705
634
|
|
|
706
635
|
/** TODO: 在record中带有children,子列表数据修改之后,会导致父级的record对比不一样 */
|
|
707
636
|
|
|
637
|
+
|
|
708
638
|
if (!checkMemoShouldUploadSpecialFun(prev, next)) {
|
|
709
639
|
return false;
|
|
710
640
|
}
|
|
@@ -712,6 +642,8 @@ var MemoEditableCell = /*#__PURE__*/memo(EditableCell, function (prev, next) {
|
|
|
712
642
|
return isEqual(p, n);
|
|
713
643
|
});
|
|
714
644
|
var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
645
|
+
var _a, _b;
|
|
646
|
+
|
|
715
647
|
var defaultData = props.value,
|
|
716
648
|
columns = props.columns,
|
|
717
649
|
isEdit = props.isEdit,
|
|
@@ -730,16 +662,17 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
730
662
|
rowSelection = props.rowSelection,
|
|
731
663
|
virtual = props.virtual,
|
|
732
664
|
sortOpen = props.sortOpen,
|
|
665
|
+
disabled = props.disabled,
|
|
733
666
|
colSortOpen = props.colSortOpen,
|
|
667
|
+
_props$indexCol = props.indexCol,
|
|
668
|
+
indexCol = _props$indexCol === void 0 ? false : _props$indexCol,
|
|
734
669
|
filterChange = props.filterChange,
|
|
735
670
|
_props$size = props.size,
|
|
736
671
|
size = _props$size === void 0 ? 'small' : _props$size,
|
|
737
672
|
recordCreatorProps = props.recordCreatorProps,
|
|
738
673
|
_props$shouldUpdate = props.shouldUpdate,
|
|
739
674
|
shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
|
|
740
|
-
resetProps = __rest(props
|
|
741
|
-
, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "virtual", "sortOpen", "colSortOpen", "filterChange", "size", "recordCreatorProps", "shouldUpdate"]); // const [dataSource, setDataSource] = useState([]);
|
|
742
|
-
|
|
675
|
+
resetProps = __rest(props, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "virtual", "sortOpen", "disabled", "colSortOpen", "indexCol", "filterChange", "size", "recordCreatorProps", "shouldUpdate"]);
|
|
743
676
|
|
|
744
677
|
var _useControllableValue = useControllableValue({
|
|
745
678
|
value: checkRowKeyByDataSource(props.value, _rowKey),
|
|
@@ -747,25 +680,30 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
747
680
|
}),
|
|
748
681
|
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
|
749
682
|
dataSource = _useControllableValue2[0],
|
|
750
|
-
setDataSource = _useControllableValue2[1];
|
|
683
|
+
setDataSource = _useControllableValue2[1];
|
|
751
684
|
|
|
685
|
+
var transformRowSelect = function transformRowSelect(selectedRowKeys, selectedRows, info) {
|
|
686
|
+
var _a;
|
|
752
687
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
_valid = _useState8[0],
|
|
756
|
-
setValid = _useState8[1];
|
|
688
|
+
return (_a = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.onChange) === null || _a === void 0 ? void 0 : _a.call(rowSelection, selectedRowKeys, selectedRows, info);
|
|
689
|
+
};
|
|
757
690
|
|
|
758
|
-
var
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
691
|
+
var _useControllableValue3 = useControllableValue({
|
|
692
|
+
value: {
|
|
693
|
+
selectedRows: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []
|
|
694
|
+
},
|
|
695
|
+
onChange: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.onChange) ? transformRowSelect : undefined
|
|
696
|
+
}),
|
|
697
|
+
_useControllableValue4 = _slicedToArray(_useControllableValue3, 2),
|
|
698
|
+
localRowSelectList = _useControllableValue4[0],
|
|
699
|
+
setLocalRowSelectList = _useControllableValue4[1];
|
|
700
|
+
/** TODO: 当前展开的列 */
|
|
763
701
|
|
|
764
702
|
|
|
765
|
-
var
|
|
766
|
-
|
|
767
|
-
expandedRowKeys =
|
|
768
|
-
setExpandedRowKeys =
|
|
703
|
+
var _useState7 = useState([]),
|
|
704
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
705
|
+
expandedRowKeys = _useState8[0],
|
|
706
|
+
setExpandedRowKeys = _useState8[1];
|
|
769
707
|
|
|
770
708
|
var dataSourceRef = useRef(dataSource);
|
|
771
709
|
var deepDataSourceRef = useRef(deepDataSourcePreKeys(dataSource, _rowKey));
|
|
@@ -792,41 +730,21 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
792
730
|
var handleDelete = function handleDelete(key) {
|
|
793
731
|
var nValue = dataSource.filter(function (item) {
|
|
794
732
|
return item[_rowKey] !== key;
|
|
795
|
-
});
|
|
796
|
-
|
|
733
|
+
});
|
|
797
734
|
setDataSource(nValue);
|
|
798
735
|
};
|
|
799
|
-
/**
|
|
736
|
+
/** 点击底部添加按钮添加 */
|
|
800
737
|
|
|
801
738
|
|
|
802
|
-
var handleAdd = function
|
|
739
|
+
var handleAdd = debounce(function (row) {
|
|
803
740
|
var _a;
|
|
804
741
|
|
|
805
742
|
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;
|
|
806
743
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
807
744
|
draft.push(Object.assign(_defineProperty({}, _rowKey, "".concat(Date.now())), addDataInfo || {}));
|
|
808
745
|
});
|
|
809
|
-
setDataSource(res);
|
|
810
|
-
};
|
|
811
|
-
/** 本地缓存一个选择数据 */
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
useEffect(function () {
|
|
815
|
-
if (rowSelection) {
|
|
816
|
-
var selectedRowKeys = rowSelection.selectedRowKeys;
|
|
817
|
-
|
|
818
|
-
if (selectedRowKeys) {
|
|
819
|
-
setLocalRowSelectList(localRowSelectList || []);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
}, [rowSelection]);
|
|
823
|
-
|
|
824
|
-
var editTableRowChange = function editTableRowChange(selectRows) {
|
|
825
|
-
var _a;
|
|
826
|
-
|
|
827
|
-
setLocalRowSelectList(selectRows);
|
|
828
|
-
(_a = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.onChange) === null || _a === void 0 ? void 0 : _a.call(rowSelection, selectRows);
|
|
829
|
-
};
|
|
746
|
+
setDataSource(res);
|
|
747
|
+
}, 40);
|
|
830
748
|
|
|
831
749
|
var handleSave = function handleSave(row, options) {
|
|
832
750
|
var _a, _b;
|
|
@@ -834,9 +752,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
834
752
|
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;
|
|
835
753
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
836
754
|
if (options === null || options === void 0 ? void 0 : options.only) {
|
|
837
|
-
var
|
|
838
|
-
key =
|
|
839
|
-
value =
|
|
755
|
+
var _ref = options === null || options === void 0 ? void 0 : options.only,
|
|
756
|
+
key = _ref.key,
|
|
757
|
+
value = _ref.value;
|
|
840
758
|
|
|
841
759
|
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
842
760
|
var deeps = function deeps(children) {
|
|
@@ -899,25 +817,26 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
899
817
|
}
|
|
900
818
|
});
|
|
901
819
|
setDataSource(res);
|
|
902
|
-
};
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
var handleTableRowDelete = function
|
|
820
|
+
}; // const reWriteOriginSource = (rowKey: string, rowValue, dataIndex: number, nextValue) => {
|
|
821
|
+
// setDataSource((prevDataSource) => {
|
|
822
|
+
// return prevDataSource?.map((item) => {
|
|
823
|
+
// if (get(item, rowKey) === rowValue) {
|
|
824
|
+
// set(item, dataIndex, nextValue)
|
|
825
|
+
// }
|
|
826
|
+
// return item
|
|
827
|
+
// })
|
|
828
|
+
// })
|
|
829
|
+
// }
|
|
830
|
+
// @ts-ignore
|
|
831
|
+
|
|
832
|
+
/** 删除当前行 */
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
var handleTableRowDelete = debounce(function (key) {
|
|
918
836
|
var _a, _b, _c;
|
|
919
837
|
|
|
920
|
-
var
|
|
838
|
+
var rkey = isObject(key) ? key[_rowKey] : key;
|
|
839
|
+
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;
|
|
921
840
|
|
|
922
841
|
if (preKeys.length > 1) {
|
|
923
842
|
/** 说明删除的是children中的数据 */
|
|
@@ -957,34 +876,76 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
957
876
|
|
|
958
877
|
setDataSource(_res);
|
|
959
878
|
}
|
|
960
|
-
};
|
|
961
|
-
/** 快捷添加 */
|
|
962
879
|
|
|
880
|
+
return null;
|
|
881
|
+
}, 40);
|
|
882
|
+
/** 替换当前行 */
|
|
963
883
|
|
|
964
|
-
var
|
|
884
|
+
var handleTableRowReplace = debounce(function (record, defaultRecord) {
|
|
965
885
|
var _a, _b;
|
|
966
886
|
|
|
967
|
-
var
|
|
887
|
+
var rkey = isObject(record) ? record[_rowKey] : record;
|
|
888
|
+
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)
|
|
889
|
+
|
|
890
|
+
var deep = function deep(children) {
|
|
891
|
+
return children.map(function (item) {
|
|
892
|
+
if (item[_rowKey] === rkey) {
|
|
893
|
+
return defaultRecord;
|
|
894
|
+
} else if (preKeys.includes(item[_rowKey]) && item.children) {
|
|
895
|
+
var child = deep(item.children);
|
|
896
|
+
return Object.assign(Object.assign({}, item), {
|
|
897
|
+
children: child
|
|
898
|
+
});
|
|
899
|
+
} else {
|
|
900
|
+
return item;
|
|
901
|
+
}
|
|
902
|
+
});
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
var res = deep(dataSourceRef.current);
|
|
906
|
+
setDataSource(res);
|
|
907
|
+
}, 40);
|
|
908
|
+
/** 快捷添加 */
|
|
909
|
+
|
|
910
|
+
var handleTableRowAdd = debounce(function (record, isAppendInChindren, defaultRecord) {
|
|
911
|
+
var _a, _b;
|
|
912
|
+
|
|
913
|
+
var rkey = isObject(record) ? record[_rowKey] : record;
|
|
914
|
+
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;
|
|
968
915
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
969
|
-
var _a, _b, _c, _d;
|
|
916
|
+
var _a, _b, _c, _d, _e;
|
|
970
917
|
|
|
971
|
-
if (preKeys.length > 1) {
|
|
918
|
+
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
972
919
|
var deeps = function deeps(children) {
|
|
973
920
|
children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
|
|
974
|
-
var _a;
|
|
921
|
+
var _a, _b;
|
|
975
922
|
|
|
976
923
|
if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
|
|
977
|
-
if (item[_rowKey] ===
|
|
924
|
+
if (item[_rowKey] === rkey) {
|
|
978
925
|
if (isAppendInChindren) {
|
|
979
926
|
if (item === null || item === void 0 ? void 0 : item.children) {
|
|
980
|
-
|
|
927
|
+
if (Array.isArray(defaultRecord)) {
|
|
928
|
+
var _a2;
|
|
929
|
+
|
|
930
|
+
(_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : (_a2 = _a).push.apply(_a2, _toConsumableArray(defaultRecord));
|
|
931
|
+
} else {
|
|
932
|
+
(_b = item === null || item === void 0 ? void 0 : item.children) === null || _b === void 0 ? void 0 : _b.push(defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
933
|
+
}
|
|
981
934
|
} else {
|
|
982
|
-
|
|
935
|
+
if (Array.isArray(defaultRecord)) {
|
|
936
|
+
item.children = _toConsumableArray(defaultRecord);
|
|
937
|
+
} else {
|
|
938
|
+
item.children = [defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
939
|
+
}
|
|
983
940
|
}
|
|
984
941
|
|
|
985
942
|
!expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray(expandedRowKeys), [item[_rowKey]]));
|
|
986
943
|
} else {
|
|
987
|
-
|
|
944
|
+
if (Array.isArray(defaultRecord)) {
|
|
945
|
+
children.splice.apply(children, [index + 1, 0].concat(_toConsumableArray(defaultRecord)));
|
|
946
|
+
} else {
|
|
947
|
+
children.splice(index + 1, 0, defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
948
|
+
}
|
|
988
949
|
}
|
|
989
950
|
} else if (item.children) {
|
|
990
951
|
deeps(item.children);
|
|
@@ -996,26 +957,37 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
996
957
|
deeps(draft);
|
|
997
958
|
} else {
|
|
998
959
|
var index = draft.findIndex(function (item) {
|
|
999
|
-
return
|
|
960
|
+
return rkey === item[_rowKey];
|
|
1000
961
|
});
|
|
1001
962
|
|
|
1002
963
|
if (index !== -1) {
|
|
1003
964
|
if (isAppendInChindren) {
|
|
1004
965
|
if ((_a = draft[index].children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1005
|
-
|
|
966
|
+
if (Array.isArray(defaultRecord)) {
|
|
967
|
+
var _b2;
|
|
968
|
+
|
|
969
|
+
(_b = draft[index].children) === null || _b === void 0 ? void 0 : (_b2 = _b).push.apply(_b2, _toConsumableArray(defaultRecord));
|
|
970
|
+
} else {
|
|
971
|
+
(_c = draft[index].children) === null || _c === void 0 ? void 0 : _c.push(defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
972
|
+
}
|
|
1006
973
|
} else {
|
|
1007
|
-
draft[index].children = [_defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
974
|
+
draft[index].children = Array.isArray(defaultRecord) ? _toConsumableArray(defaultRecord) : [defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now()))];
|
|
1008
975
|
}
|
|
1009
976
|
|
|
1010
|
-
!expandedRowKeys.includes((
|
|
977
|
+
!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]]));
|
|
1011
978
|
} else {
|
|
1012
|
-
|
|
979
|
+
if (Array.isArray(defaultRecord)) {
|
|
980
|
+
draft.splice.apply(draft, [index + 1, 0].concat(_toConsumableArray(defaultRecord)));
|
|
981
|
+
} else {
|
|
982
|
+
draft.splice(index + 1, 0, defaultRecord || _defineProperty({}, _rowKey, "".concat(Date.now())));
|
|
983
|
+
}
|
|
1013
984
|
}
|
|
1014
985
|
}
|
|
1015
986
|
}
|
|
1016
987
|
});
|
|
1017
988
|
setDataSource(res);
|
|
1018
|
-
};
|
|
989
|
+
}, 50);
|
|
990
|
+
/** 快捷刷子功能 */
|
|
1019
991
|
|
|
1020
992
|
var handleCopy = function handleCopy(key, value, type, rowIndex) {
|
|
1021
993
|
var res = produce(dataSourceRef.current, function (draft) {
|
|
@@ -1034,8 +1006,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1034
1006
|
var hasOnlyOptionsDatas = columns.filter(function (item) {
|
|
1035
1007
|
var _a;
|
|
1036
1008
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1009
|
+
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;
|
|
1010
|
+
return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
|
|
1011
|
+
}); // const hasOnlyOptionsDatas = columns.filter((item) => item?.componentProps?.optionOnly)
|
|
1039
1012
|
|
|
1040
1013
|
if (hasOnlyOptionsDatas.length) {
|
|
1041
1014
|
return hasOnlyOptionsDatas === null || hasOnlyOptionsDatas === void 0 ? void 0 : hasOnlyOptionsDatas.map(function (item) {
|
|
@@ -1049,9 +1022,13 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1049
1022
|
|
|
1050
1023
|
var DisableOptions = useMemo(function () {
|
|
1051
1024
|
var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
1052
|
-
var
|
|
1053
|
-
|
|
1054
|
-
|
|
1025
|
+
var _a;
|
|
1026
|
+
|
|
1027
|
+
var resultComponentProps = isFunction(item.componentProps) ? (_a = item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item.componentProps;
|
|
1028
|
+
|
|
1029
|
+
var _ref8 = resultComponentProps || {},
|
|
1030
|
+
optionOnly = _ref8.optionOnly,
|
|
1031
|
+
options = _ref8.options;
|
|
1055
1032
|
|
|
1056
1033
|
if (optionOnly && options) {
|
|
1057
1034
|
var dataIndex = item.dataIndex;
|
|
@@ -1063,6 +1040,13 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1063
1040
|
disabled: !!dataIndexData.includes(o === null || o === void 0 ? void 0 : o.value)
|
|
1064
1041
|
});
|
|
1065
1042
|
});
|
|
1043
|
+
|
|
1044
|
+
if (isFunction(item.componentProps)) {
|
|
1045
|
+
return Object.assign(Object.assign({}, item), {
|
|
1046
|
+
newOptions: newOptions
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1066
1050
|
return Object.assign(Object.assign({}, item), {
|
|
1067
1051
|
componentProps: Object.assign(Object.assign({}, item.componentProps), {
|
|
1068
1052
|
options: newOptions
|
|
@@ -1083,16 +1067,47 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1083
1067
|
var rColumns = hasDisableOptions ? DisableOptions : columns;
|
|
1084
1068
|
var localColumns = [sortOpen ? {
|
|
1085
1069
|
title: '排序',
|
|
1086
|
-
dataIndex: '
|
|
1070
|
+
dataIndex: '_sort',
|
|
1087
1071
|
width: 48,
|
|
1088
1072
|
maxWidth: 48,
|
|
1089
1073
|
className: 'drag-visible',
|
|
1074
|
+
fixed: 'left',
|
|
1090
1075
|
render: function render(_, record) {
|
|
1091
1076
|
return /*#__PURE__*/React.createElement(DragHandle, {
|
|
1092
|
-
id: record[_rowKey] || record.id
|
|
1077
|
+
id: (record === null || record === void 0 ? void 0 : record[_rowKey]) || (record === null || record === void 0 ? void 0 : record.id)
|
|
1093
1078
|
});
|
|
1094
1079
|
}
|
|
1095
|
-
} : null
|
|
1080
|
+
} : null, indexCol ? isBoolean(indexCol) ? {
|
|
1081
|
+
title: '',
|
|
1082
|
+
dataIndex: '_index',
|
|
1083
|
+
width: 48,
|
|
1084
|
+
maxWidth: 48,
|
|
1085
|
+
ellipsis: true,
|
|
1086
|
+
fixed: 'left',
|
|
1087
|
+
render: function render(_, record, index) {
|
|
1088
|
+
var _a, _b, _c;
|
|
1089
|
+
|
|
1090
|
+
console.log(deepDataSourceRef.current, '--deepDataSourceRef.current', _rowKey);
|
|
1091
|
+
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);
|
|
1092
|
+
}
|
|
1093
|
+
} : Object.assign(Object.assign({
|
|
1094
|
+
title: '',
|
|
1095
|
+
dataIndex: '_index',
|
|
1096
|
+
width: 48,
|
|
1097
|
+
ellipsis: true,
|
|
1098
|
+
maxWidth: 48,
|
|
1099
|
+
fixed: 'left'
|
|
1100
|
+
}, indexCol || {}), {
|
|
1101
|
+
render: function render(_, record, index) {
|
|
1102
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1103
|
+
|
|
1104
|
+
if (isFunction(indexCol === null || indexCol === void 0 ? void 0 : indexCol.render)) {
|
|
1105
|
+
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']);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
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);
|
|
1109
|
+
}
|
|
1110
|
+
}) : null].concat(_toConsumableArray(rColumns), [useQuickOpetate ? {
|
|
1096
1111
|
title: '操作',
|
|
1097
1112
|
dataIndex: 'lm_edit_opetate',
|
|
1098
1113
|
width: 68,
|
|
@@ -1103,9 +1118,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1103
1118
|
options: Array.isArray(useQuickOpetate) ? useQuickOpetate : ['add', 'delete']
|
|
1104
1119
|
}
|
|
1105
1120
|
} : null]).filter(function (item) {
|
|
1106
|
-
return item;
|
|
1121
|
+
return item && (item === null || item === void 0 ? void 0 : item.show) !== false;
|
|
1107
1122
|
});
|
|
1108
|
-
localColumns = localColumns.map(function (item, index) {
|
|
1123
|
+
localColumns = localColumns === null || localColumns === void 0 ? void 0 : localColumns.map(function (item, index) {
|
|
1109
1124
|
return Object.assign(Object.assign({}, item), {
|
|
1110
1125
|
order: [null, undefined].includes(item.order) ? index : item.order
|
|
1111
1126
|
});
|
|
@@ -1130,8 +1145,19 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1130
1145
|
var mapColumns = function mapColumns(col, index) {
|
|
1131
1146
|
var _a, _b;
|
|
1132
1147
|
|
|
1133
|
-
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1134
|
-
|
|
1148
|
+
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length) && (col === null || col === void 0 ? void 0 : col.dataIndex) === '_sort') {
|
|
1149
|
+
var fn = col === null || col === void 0 ? void 0 : col.render;
|
|
1150
|
+
return Object.assign(Object.assign({}, col), {
|
|
1151
|
+
render: function render(text, record, i) {
|
|
1152
|
+
var _a;
|
|
1153
|
+
|
|
1154
|
+
return fn === null || fn === void 0 ? void 0 : fn((_a = dataSource[i]) === null || _a === void 0 ? void 0 : _a[col.dataIndex], dataSource[i], i);
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
if (isEdit && (col === null || col === void 0 ? void 0 : col.render) && (col === null || col === void 0 ? void 0 : col.editable) === 'render') {
|
|
1160
|
+
delete col.render;
|
|
1135
1161
|
}
|
|
1136
1162
|
|
|
1137
1163
|
var newCol = Object.assign(Object.assign({}, col), {
|
|
@@ -1149,7 +1175,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1149
1175
|
editable: col.editable,
|
|
1150
1176
|
dataIndex: col.dataIndex,
|
|
1151
1177
|
itemProps: col.itemProps,
|
|
1152
|
-
|
|
1178
|
+
shouldUpdate: shouldUpdate,
|
|
1153
1179
|
isEdit: isEdit,
|
|
1154
1180
|
isHoverEdit: isHoverEdit,
|
|
1155
1181
|
handleAdd: handleAdd,
|
|
@@ -1157,8 +1183,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1157
1183
|
handleCopy: handleCopy,
|
|
1158
1184
|
editEnum: typeof col.editEnum === 'function' ? col.editEnum(record) : col.editEnum,
|
|
1159
1185
|
valueType: typeof col.valueType === 'function' ? col.valueType(record) : col.valueType,
|
|
1160
|
-
handleSave: handleSave
|
|
1161
|
-
reWriteOriginSource: reWriteOriginSource
|
|
1186
|
+
handleSave: handleSave
|
|
1162
1187
|
};
|
|
1163
1188
|
}
|
|
1164
1189
|
});
|
|
@@ -1170,7 +1195,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1170
1195
|
return newCol;
|
|
1171
1196
|
};
|
|
1172
1197
|
|
|
1173
|
-
var res = localColumns.map(function (col, index) {
|
|
1198
|
+
var res = localColumns === null || localColumns === void 0 ? void 0 : localColumns.map(function (col, index) {
|
|
1174
1199
|
return mapColumns(col, index);
|
|
1175
1200
|
});
|
|
1176
1201
|
return res;
|
|
@@ -1208,8 +1233,24 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1208
1233
|
useImperativeHandle(ref, function () {
|
|
1209
1234
|
return {
|
|
1210
1235
|
setRow: handleSave,
|
|
1211
|
-
|
|
1212
|
-
return
|
|
1236
|
+
getCheckboxRecords: function getCheckboxRecords() {
|
|
1237
|
+
return localRowSelectList.selectedRows;
|
|
1238
|
+
},
|
|
1239
|
+
deleteRowData: function deleteRowData(data) {
|
|
1240
|
+
return handleTableRowDelete(data);
|
|
1241
|
+
},
|
|
1242
|
+
addRowData: function addRowData(data, defaultValue, addInChild) {
|
|
1243
|
+
return addInChild === 'replace' ? handleTableRowReplace(data, defaultValue) : handleTableRowAdd(data, addInChild, defaultValue);
|
|
1244
|
+
},
|
|
1245
|
+
clearSelect: function clearSelect() {
|
|
1246
|
+
setLocalRowSelectList({
|
|
1247
|
+
selectedRows: []
|
|
1248
|
+
});
|
|
1249
|
+
},
|
|
1250
|
+
customSetCheckboxRecords: function customSetCheckboxRecords(value) {
|
|
1251
|
+
setLocalRowSelectList({
|
|
1252
|
+
selectedRows: value
|
|
1253
|
+
});
|
|
1213
1254
|
}
|
|
1214
1255
|
};
|
|
1215
1256
|
});
|
|
@@ -1254,6 +1295,11 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1254
1295
|
header: {
|
|
1255
1296
|
row: colSortOpen ? colDraggableContainer : null
|
|
1256
1297
|
}
|
|
1298
|
+
},
|
|
1299
|
+
onRow: function onRow(record, index) {
|
|
1300
|
+
return {
|
|
1301
|
+
disabled: disabled
|
|
1302
|
+
};
|
|
1257
1303
|
}
|
|
1258
1304
|
}, resetProps));
|
|
1259
1305
|
|
|
@@ -1272,29 +1318,25 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1272
1318
|
rowClassName: "editable-row",
|
|
1273
1319
|
bordered: true,
|
|
1274
1320
|
pagination: false,
|
|
1275
|
-
|
|
1276
|
-
rowSelection: !rowSelection ? undefined : {
|
|
1321
|
+
rowSelection: !rowSelection ? undefined : Object.assign(Object.assign({
|
|
1277
1322
|
fixed: true,
|
|
1278
1323
|
type: 'checkbox',
|
|
1279
|
-
columnWidth: 36
|
|
1280
|
-
|
|
1281
|
-
|
|
1324
|
+
columnWidth: 36
|
|
1325
|
+
}, rowSelection), {
|
|
1326
|
+
selectedRowKeys: (_a = localRowSelectList === null || localRowSelectList === void 0 ? void 0 : localRowSelectList.selectedRows) === null || _a === void 0 ? void 0 : _a.map(function (v) {
|
|
1327
|
+
return isObject(v) ? v[_rowKey] : v;
|
|
1282
1328
|
}),
|
|
1283
|
-
onChange: function onChange(selectedRowKeys, selectedRows) {
|
|
1284
|
-
|
|
1329
|
+
onChange: function onChange(selectedRowKeys, selectedRows, info) {
|
|
1330
|
+
setLocalRowSelectList(selectedRowKeys, selectedRows, info);
|
|
1285
1331
|
}
|
|
1286
|
-
},
|
|
1332
|
+
}),
|
|
1287
1333
|
dataSource: dataSource
|
|
1288
|
-
})))),
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
}
|
|
1295
|
-
}, /*#__PURE__*/React.createElement(PlusCircleOutlined, {
|
|
1296
|
-
className: "lmweb-plus"
|
|
1297
|
-
}), "\u65B0\u589E"));
|
|
1334
|
+
})))), /*#__PURE__*/React.createElement(BottomOpetateComponent, {
|
|
1335
|
+
disabled: disabled,
|
|
1336
|
+
isShowAddAction: isShowAddAction,
|
|
1337
|
+
recordCreatorProps: recordCreatorProps,
|
|
1338
|
+
handleAdd: handleAdd
|
|
1339
|
+
}));
|
|
1298
1340
|
} // @ts-ignore
|
|
1299
1341
|
|
|
1300
1342
|
|
|
@@ -1310,31 +1352,30 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1310
1352
|
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
1311
1353
|
expandedRowKeys: expandedRowKeys,
|
|
1312
1354
|
fixed: true,
|
|
1355
|
+
// indentSize: 0,
|
|
1356
|
+
expandIconColumnIndex: rowSelection && sortOpen ? 3 : rowSelection || sortOpen ? 2 : 0,
|
|
1313
1357
|
onExpandedRowsChange: function onExpandedRowsChange(expandedRows) {
|
|
1314
1358
|
return setExpandedRowKeys(expandedRows);
|
|
1315
1359
|
}
|
|
1316
1360
|
},
|
|
1317
|
-
rowSelection: !rowSelection ? undefined : {
|
|
1361
|
+
rowSelection: !rowSelection ? undefined : Object.assign(Object.assign({
|
|
1318
1362
|
fixed: true,
|
|
1319
1363
|
type: 'checkbox',
|
|
1320
|
-
columnWidth: 36
|
|
1321
|
-
|
|
1322
|
-
|
|
1364
|
+
columnWidth: 36
|
|
1365
|
+
}, rowSelection), {
|
|
1366
|
+
selectedRowKeys: (_b = localRowSelectList === null || localRowSelectList === void 0 ? void 0 : localRowSelectList.selectedRows) === null || _b === void 0 ? void 0 : _b.map(function (v) {
|
|
1367
|
+
return isObject(v) ? v[_rowKey] : v;
|
|
1323
1368
|
}),
|
|
1324
|
-
onChange: function onChange(selectedRowKeys, selectedRows) {
|
|
1325
|
-
|
|
1369
|
+
onChange: function onChange(selectedRowKeys, selectedRows, info) {
|
|
1370
|
+
setLocalRowSelectList(selectedRowKeys, selectedRows, info);
|
|
1326
1371
|
}
|
|
1327
|
-
},
|
|
1372
|
+
}),
|
|
1328
1373
|
dataSource: dataSource
|
|
1329
|
-
})),
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
}, (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.style) || {})
|
|
1336
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
1337
|
-
type: "lmweb-plus"
|
|
1338
|
-
}), (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.creatorButtonText) || '新增'));
|
|
1374
|
+
})), /*#__PURE__*/React.createElement(BottomOpetateComponent, {
|
|
1375
|
+
disabled: disabled,
|
|
1376
|
+
isShowAddAction: isShowAddAction,
|
|
1377
|
+
recordCreatorProps: recordCreatorProps,
|
|
1378
|
+
handleAdd: handleAdd
|
|
1379
|
+
}));
|
|
1339
1380
|
});
|
|
1340
1381
|
export default /*#__PURE__*/memo(EditTable);
|