linkmore-design 1.1.13-alpha.1 → 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 +2645 -1500
- 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 +275 -234
- 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 +38 -12
- 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 +271 -230
- 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 +37 -11
- 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
|
@@ -17,8 +17,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
17
17
|
|
|
18
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
19
|
|
|
20
|
-
var _icons = require("@ant-design/icons");
|
|
21
|
-
|
|
22
20
|
var _moment = _interopRequireDefault(require("moment"));
|
|
23
21
|
|
|
24
22
|
var _sortable = require("@dnd-kit/sortable");
|
|
@@ -97,8 +95,6 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
97
95
|
}
|
|
98
96
|
return t;
|
|
99
97
|
};
|
|
100
|
-
/* eslint-disable no-unused-vars */
|
|
101
|
-
|
|
102
98
|
|
|
103
99
|
var UploadBtn = _UploadOss.default.UploadBtn;
|
|
104
100
|
|
|
@@ -132,6 +128,7 @@ var EditableSortRow = function EditableSortRow(_a) {
|
|
|
132
128
|
|
|
133
129
|
return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form, {
|
|
134
130
|
form: form,
|
|
131
|
+
disabled: props.disabled || false,
|
|
135
132
|
component: false
|
|
136
133
|
}, /*#__PURE__*/_react.default.createElement(EditableContext.Provider, {
|
|
137
134
|
value: form
|
|
@@ -262,80 +259,6 @@ var InputRange = function InputRange(_a) {
|
|
|
262
259
|
return handleInput(e, 'next');
|
|
263
260
|
}
|
|
264
261
|
}, editEnum))));
|
|
265
|
-
}; // 操作列
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
var Opetate = function Opetate(_ref) {
|
|
269
|
-
var record = _ref.record,
|
|
270
|
-
rowKey = _ref.rowKey,
|
|
271
|
-
handleAdd = _ref.handleAdd,
|
|
272
|
-
handleDelete = _ref.handleDelete,
|
|
273
|
-
_ref$options = _ref.options,
|
|
274
|
-
options = _ref$options === void 0 ? ['add', 'delete'] : _ref$options,
|
|
275
|
-
getLength = _ref.getLength,
|
|
276
|
-
quickOpetateClearAll = _ref.quickOpetateClearAll;
|
|
277
|
-
|
|
278
|
-
var appendChildren = function appendChildren() {
|
|
279
|
-
handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record, true);
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
var appendAdd = function appendAdd() {
|
|
283
|
-
handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record);
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
287
|
-
style: {
|
|
288
|
-
display: 'flex',
|
|
289
|
-
alignItems: 'center',
|
|
290
|
-
justifyContent: 'flex-start',
|
|
291
|
-
marginLeft: '-4px'
|
|
292
|
-
}
|
|
293
|
-
}, options.includes('delete') && /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
|
|
294
|
-
type: "link",
|
|
295
|
-
size: "small",
|
|
296
|
-
disabled: !quickOpetateClearAll && getLength < 2,
|
|
297
|
-
icon: /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
|
|
298
|
-
type: "lmweb-minus-circle",
|
|
299
|
-
style: {
|
|
300
|
-
fontSize: 16
|
|
301
|
-
}
|
|
302
|
-
}),
|
|
303
|
-
onClick: function onClick() {
|
|
304
|
-
return handleDelete(record[rowKey]);
|
|
305
|
-
}
|
|
306
|
-
}), (options === null || options === void 0 ? void 0 : options.includes('add')) && (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Popover, {
|
|
307
|
-
placement: "bottom",
|
|
308
|
-
overlayClassName: "lm_table_append_add_popover",
|
|
309
|
-
open: open,
|
|
310
|
-
title: null,
|
|
311
|
-
content: /*#__PURE__*/_react.default.createElement("ul", null, /*#__PURE__*/_react.default.createElement("li", {
|
|
312
|
-
onClick: appendAdd
|
|
313
|
-
}, "\u6DFB\u52A0\u5E73\u7EA7"), /*#__PURE__*/_react.default.createElement("li", {
|
|
314
|
-
onClick: appendChildren
|
|
315
|
-
}, "\u6DFB\u52A0\u5B50\u7EA7")),
|
|
316
|
-
trigger: "hover"
|
|
317
|
-
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
|
|
318
|
-
type: "link",
|
|
319
|
-
size: "small",
|
|
320
|
-
icon: /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
|
|
321
|
-
type: "lmweb-plus-circle-fill",
|
|
322
|
-
style: {
|
|
323
|
-
fontSize: 16
|
|
324
|
-
}
|
|
325
|
-
})
|
|
326
|
-
})) : /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
|
|
327
|
-
type: "link",
|
|
328
|
-
size: "small",
|
|
329
|
-
icon: /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
|
|
330
|
-
type: "lmweb-plus-circle-fill",
|
|
331
|
-
style: {
|
|
332
|
-
fontSize: 16
|
|
333
|
-
}
|
|
334
|
-
}),
|
|
335
|
-
onClick: function onClick() {
|
|
336
|
-
return handleAdd(record, (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? true : false);
|
|
337
|
-
}
|
|
338
|
-
}));
|
|
339
262
|
};
|
|
340
263
|
/*
|
|
341
264
|
表格单元格
|
|
@@ -366,9 +289,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
366
289
|
handleDelete = props.handleDelete,
|
|
367
290
|
handleCopy = props.handleCopy,
|
|
368
291
|
itemProps = props.itemProps,
|
|
369
|
-
|
|
370
|
-
reWriteOriginSource = props.reWriteOriginSource,
|
|
371
|
-
restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "rowIndex", "colIndex", "handleTableRowDelete", "handleTableRowAdd", "quickOpetateClearAll", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "handleCopy", "itemProps", "setValid", "reWriteOriginSource"]);
|
|
292
|
+
restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "rowIndex", "colIndex", "handleTableRowDelete", "handleTableRowAdd", "quickOpetateClearAll", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "handleCopy", "itemProps"]);
|
|
372
293
|
/** 去除移入移出功能,保留最纯粹的功能,优化性能 */
|
|
373
294
|
|
|
374
295
|
|
|
@@ -456,13 +377,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
456
377
|
case 13:
|
|
457
378
|
if (col === null || col === void 0 ? void 0 : col.hoverEdit) {
|
|
458
379
|
toggleEdit();
|
|
459
|
-
}
|
|
460
|
-
// setValid((old) => {
|
|
461
|
-
// const obj = { ...old }
|
|
462
|
-
// delete obj[record[rowKey]]
|
|
463
|
-
// return obj
|
|
464
|
-
// })
|
|
465
|
-
|
|
380
|
+
}
|
|
466
381
|
|
|
467
382
|
_context.next = 18;
|
|
468
383
|
break;
|
|
@@ -494,7 +409,16 @@ var EditableCell = function EditableCell(props) {
|
|
|
494
409
|
};
|
|
495
410
|
|
|
496
411
|
var Control = function Control(con) {
|
|
412
|
+
var _a;
|
|
413
|
+
|
|
497
414
|
var resultComponentProps = (0, _lodash.isFunction)(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
|
|
415
|
+
|
|
416
|
+
if ((0, _lodash.isFunction)(componentProps) && ((_a = col === null || col === void 0 ? void 0 : col.newOptions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
417
|
+
resultComponentProps = Object.assign(Object.assign({}, resultComponentProps), {
|
|
418
|
+
options: col === null || col === void 0 ? void 0 : col.newOptions
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
|
|
498
422
|
var clearAttrComponentProps = (0, _lodash.omit)(resultComponentProps, ['optionOnly', 'isOnlyValue', 'quickcopy']);
|
|
499
423
|
|
|
500
424
|
switch (con) {
|
|
@@ -521,8 +445,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
521
445
|
|
|
522
446
|
case 'inputRange':
|
|
523
447
|
return /*#__PURE__*/_react.default.createElement(InputRange, Object.assign({
|
|
524
|
-
onChange: handleFormItemChange
|
|
525
|
-
ref: inputRef
|
|
448
|
+
onChange: handleFormItemChange
|
|
526
449
|
}, resultComponentProps, {
|
|
527
450
|
record: record,
|
|
528
451
|
rowIndex: rowIndex,
|
|
@@ -612,10 +535,9 @@ var EditableCell = function EditableCell(props) {
|
|
|
612
535
|
|
|
613
536
|
case 'operate':
|
|
614
537
|
case 'lm_edit_opetate':
|
|
615
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
538
|
+
return /*#__PURE__*/_react.default.createElement(_components.QuickOpetate, Object.assign({
|
|
616
539
|
record: record,
|
|
617
540
|
rowKey: rowKey,
|
|
618
|
-
ref: inputRef,
|
|
619
541
|
handleAdd: handleTableRowAdd,
|
|
620
542
|
handleDelete: handleTableRowDelete,
|
|
621
543
|
getLength: getLength,
|
|
@@ -624,11 +546,12 @@ var EditableCell = function EditableCell(props) {
|
|
|
624
546
|
|
|
625
547
|
case 'render':
|
|
626
548
|
{
|
|
627
|
-
var
|
|
549
|
+
var _resultComponentProps = resultComponentProps,
|
|
550
|
+
render = _resultComponentProps.render;
|
|
628
551
|
var fromData = form.getFieldsValue();
|
|
629
552
|
return render === null || render === void 0 ? void 0 : render(Object.assign(Object.assign({}, !(0, _util.isObjEmpty)(fromData) ? Object.assign(Object.assign({}, record), (0, _defineProperty2.default)({}, dataIndex, fromData[dataIndex])) : record), {
|
|
630
553
|
onChange: save
|
|
631
|
-
}));
|
|
554
|
+
}), rowIndex);
|
|
632
555
|
}
|
|
633
556
|
|
|
634
557
|
default:
|
|
@@ -665,7 +588,8 @@ var EditableCell = function EditableCell(props) {
|
|
|
665
588
|
valuePropName: editable === 'switch' ? 'checked' : 'value',
|
|
666
589
|
style: {
|
|
667
590
|
margin: 0
|
|
668
|
-
}
|
|
591
|
+
},
|
|
592
|
+
noStyle: formProps ? false : true
|
|
669
593
|
}, formProps, {
|
|
670
594
|
name: dataIndex
|
|
671
595
|
}), Control(editable)));
|
|
@@ -677,6 +601,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
677
601
|
margin: 0
|
|
678
602
|
}
|
|
679
603
|
}, formProps, {
|
|
604
|
+
noStyle: formProps ? false : true,
|
|
680
605
|
name: [dataIndex, 'value']
|
|
681
606
|
}), Control(editable)));
|
|
682
607
|
}
|
|
@@ -687,14 +612,14 @@ var EditableCell = function EditableCell(props) {
|
|
|
687
612
|
}
|
|
688
613
|
|
|
689
614
|
return childNode;
|
|
690
|
-
}, [col, isEdit, editing, getLength]); // 出现死循环找我
|
|
615
|
+
}, [col, isEdit, editing, getLength, record]); // 出现死循环找我
|
|
691
616
|
|
|
692
617
|
(0, _react.useEffect)(function () {
|
|
693
618
|
var editable = col.editable,
|
|
694
619
|
dataIndex = col.dataIndex;
|
|
695
620
|
|
|
696
621
|
if (isEdit && editable) {
|
|
697
|
-
form.setFieldsValue((0, _defineProperty2.default)({}, dataIndex, editable === 'date' ? (0, _moment.default)(record[dataIndex]) : record[dataIndex]));
|
|
622
|
+
form.setFieldsValue((0, _defineProperty2.default)({}, dataIndex, editable === 'date' && record[dataIndex] ? (0, _moment.default)(record[dataIndex]) : record[dataIndex]));
|
|
698
623
|
}
|
|
699
624
|
}, [record]);
|
|
700
625
|
|
|
@@ -733,10 +658,16 @@ var EditableCell = function EditableCell(props) {
|
|
|
733
658
|
var MemoEditableCell = /*#__PURE__*/(0, _react.memo)(EditableCell, function (prev, next) {
|
|
734
659
|
var pickProps = ['record', 'colIndex'];
|
|
735
660
|
var p = (0, _lodash.pick)(prev, pickProps);
|
|
736
|
-
var n = (0, _lodash.pick)(next, pickProps);
|
|
661
|
+
var n = (0, _lodash.pick)(next, pickProps);
|
|
662
|
+
|
|
663
|
+
if (next === null || next === void 0 ? void 0 : next.shouldUpdate) {
|
|
664
|
+
return false;
|
|
665
|
+
} // console.log(!checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n), '22', prev.record, next.record)
|
|
666
|
+
// console.log('333', checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n))
|
|
737
667
|
|
|
738
668
|
/** TODO: 在record中带有children,子列表数据修改之后,会导致父级的record对比不一样 */
|
|
739
669
|
|
|
670
|
+
|
|
740
671
|
if (!(0, _util.checkMemoShouldUploadSpecialFun)(prev, next)) {
|
|
741
672
|
return false;
|
|
742
673
|
}
|
|
@@ -744,6 +675,8 @@ var MemoEditableCell = /*#__PURE__*/(0, _react.memo)(EditableCell, function (pre
|
|
|
744
675
|
return (0, _lodash.isEqual)(p, n);
|
|
745
676
|
});
|
|
746
677
|
var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
678
|
+
var _a, _b;
|
|
679
|
+
|
|
747
680
|
var defaultData = props.value,
|
|
748
681
|
columns = props.columns,
|
|
749
682
|
isEdit = props.isEdit,
|
|
@@ -762,16 +695,17 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
762
695
|
rowSelection = props.rowSelection,
|
|
763
696
|
virtual = props.virtual,
|
|
764
697
|
sortOpen = props.sortOpen,
|
|
698
|
+
disabled = props.disabled,
|
|
765
699
|
colSortOpen = props.colSortOpen,
|
|
700
|
+
_props$indexCol = props.indexCol,
|
|
701
|
+
indexCol = _props$indexCol === void 0 ? false : _props$indexCol,
|
|
766
702
|
filterChange = props.filterChange,
|
|
767
703
|
_props$size = props.size,
|
|
768
704
|
size = _props$size === void 0 ? 'small' : _props$size,
|
|
769
705
|
recordCreatorProps = props.recordCreatorProps,
|
|
770
706
|
_props$shouldUpdate = props.shouldUpdate,
|
|
771
707
|
shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
|
|
772
|
-
resetProps = __rest(props
|
|
773
|
-
, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "virtual", "sortOpen", "colSortOpen", "filterChange", "size", "recordCreatorProps", "shouldUpdate"]); // const [dataSource, setDataSource] = useState([]);
|
|
774
|
-
|
|
708
|
+
resetProps = __rest(props, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "virtual", "sortOpen", "disabled", "colSortOpen", "indexCol", "filterChange", "size", "recordCreatorProps", "shouldUpdate"]);
|
|
775
709
|
|
|
776
710
|
var _useControllableValue = (0, _ahooks.useControllableValue)({
|
|
777
711
|
value: (0, _util.checkRowKeyByDataSource)(props.value, _rowKey),
|
|
@@ -779,25 +713,30 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
779
713
|
}),
|
|
780
714
|
_useControllableValue2 = (0, _slicedToArray2.default)(_useControllableValue, 2),
|
|
781
715
|
dataSource = _useControllableValue2[0],
|
|
782
|
-
setDataSource = _useControllableValue2[1];
|
|
716
|
+
setDataSource = _useControllableValue2[1];
|
|
783
717
|
|
|
718
|
+
var transformRowSelect = function transformRowSelect(selectedRowKeys, selectedRows, info) {
|
|
719
|
+
var _a;
|
|
784
720
|
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
_valid = _useState8[0],
|
|
788
|
-
setValid = _useState8[1];
|
|
721
|
+
return (_a = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.onChange) === null || _a === void 0 ? void 0 : _a.call(rowSelection, selectedRowKeys, selectedRows, info);
|
|
722
|
+
};
|
|
789
723
|
|
|
790
|
-
var
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
724
|
+
var _useControllableValue3 = (0, _ahooks.useControllableValue)({
|
|
725
|
+
value: {
|
|
726
|
+
selectedRows: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []
|
|
727
|
+
},
|
|
728
|
+
onChange: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.onChange) ? transformRowSelect : undefined
|
|
729
|
+
}),
|
|
730
|
+
_useControllableValue4 = (0, _slicedToArray2.default)(_useControllableValue3, 2),
|
|
731
|
+
localRowSelectList = _useControllableValue4[0],
|
|
732
|
+
setLocalRowSelectList = _useControllableValue4[1];
|
|
733
|
+
/** TODO: 当前展开的列 */
|
|
795
734
|
|
|
796
735
|
|
|
797
|
-
var
|
|
798
|
-
|
|
799
|
-
expandedRowKeys =
|
|
800
|
-
setExpandedRowKeys =
|
|
736
|
+
var _useState7 = (0, _react.useState)([]),
|
|
737
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
738
|
+
expandedRowKeys = _useState8[0],
|
|
739
|
+
setExpandedRowKeys = _useState8[1];
|
|
801
740
|
|
|
802
741
|
var dataSourceRef = (0, _react.useRef)(dataSource);
|
|
803
742
|
var deepDataSourceRef = (0, _react.useRef)((0, _util.deepDataSourcePreKeys)(dataSource, _rowKey));
|
|
@@ -824,41 +763,21 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
824
763
|
var handleDelete = function handleDelete(key) {
|
|
825
764
|
var nValue = dataSource.filter(function (item) {
|
|
826
765
|
return item[_rowKey] !== key;
|
|
827
|
-
});
|
|
828
|
-
|
|
766
|
+
});
|
|
829
767
|
setDataSource(nValue);
|
|
830
768
|
};
|
|
831
|
-
/**
|
|
769
|
+
/** 点击底部添加按钮添加 */
|
|
832
770
|
|
|
833
771
|
|
|
834
|
-
var handleAdd = function
|
|
772
|
+
var handleAdd = (0, _lodash.debounce)(function (row) {
|
|
835
773
|
var _a;
|
|
836
774
|
|
|
837
775
|
var addDataInfo = (0, _lodash.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;
|
|
838
776
|
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
839
777
|
draft.push(Object.assign((0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())), addDataInfo || {}));
|
|
840
778
|
});
|
|
841
|
-
setDataSource(res);
|
|
842
|
-
};
|
|
843
|
-
/** 本地缓存一个选择数据 */
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
(0, _react.useEffect)(function () {
|
|
847
|
-
if (rowSelection) {
|
|
848
|
-
var selectedRowKeys = rowSelection.selectedRowKeys;
|
|
849
|
-
|
|
850
|
-
if (selectedRowKeys) {
|
|
851
|
-
setLocalRowSelectList(localRowSelectList || []);
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
}, [rowSelection]);
|
|
855
|
-
|
|
856
|
-
var editTableRowChange = function editTableRowChange(selectRows) {
|
|
857
|
-
var _a;
|
|
858
|
-
|
|
859
|
-
setLocalRowSelectList(selectRows);
|
|
860
|
-
(_a = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.onChange) === null || _a === void 0 ? void 0 : _a.call(rowSelection, selectRows);
|
|
861
|
-
};
|
|
779
|
+
setDataSource(res);
|
|
780
|
+
}, 40);
|
|
862
781
|
|
|
863
782
|
var handleSave = function handleSave(row, options) {
|
|
864
783
|
var _a, _b;
|
|
@@ -866,9 +785,9 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
866
785
|
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;
|
|
867
786
|
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
868
787
|
if (options === null || options === void 0 ? void 0 : options.only) {
|
|
869
|
-
var
|
|
870
|
-
key =
|
|
871
|
-
value =
|
|
788
|
+
var _ref = options === null || options === void 0 ? void 0 : options.only,
|
|
789
|
+
key = _ref.key,
|
|
790
|
+
value = _ref.value;
|
|
872
791
|
|
|
873
792
|
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
874
793
|
var deeps = function deeps(children) {
|
|
@@ -931,25 +850,26 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
931
850
|
}
|
|
932
851
|
});
|
|
933
852
|
setDataSource(res);
|
|
934
|
-
};
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
var handleTableRowDelete = function
|
|
853
|
+
}; // const reWriteOriginSource = (rowKey: string, rowValue, dataIndex: number, nextValue) => {
|
|
854
|
+
// setDataSource((prevDataSource) => {
|
|
855
|
+
// return prevDataSource?.map((item) => {
|
|
856
|
+
// if (get(item, rowKey) === rowValue) {
|
|
857
|
+
// set(item, dataIndex, nextValue)
|
|
858
|
+
// }
|
|
859
|
+
// return item
|
|
860
|
+
// })
|
|
861
|
+
// })
|
|
862
|
+
// }
|
|
863
|
+
// @ts-ignore
|
|
864
|
+
|
|
865
|
+
/** 删除当前行 */
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
var handleTableRowDelete = (0, _lodash.debounce)(function (key) {
|
|
950
869
|
var _a, _b, _c;
|
|
951
870
|
|
|
952
|
-
var
|
|
871
|
+
var rkey = (0, _lodash.isObject)(key) ? key[_rowKey] : key;
|
|
872
|
+
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;
|
|
953
873
|
|
|
954
874
|
if (preKeys.length > 1) {
|
|
955
875
|
/** 说明删除的是children中的数据 */
|
|
@@ -989,34 +909,76 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
989
909
|
|
|
990
910
|
setDataSource(_res);
|
|
991
911
|
}
|
|
992
|
-
};
|
|
993
|
-
/** 快捷添加 */
|
|
994
912
|
|
|
913
|
+
return null;
|
|
914
|
+
}, 40);
|
|
915
|
+
/** 替换当前行 */
|
|
995
916
|
|
|
996
|
-
var
|
|
917
|
+
var handleTableRowReplace = (0, _lodash.debounce)(function (record, defaultRecord) {
|
|
997
918
|
var _a, _b;
|
|
998
919
|
|
|
999
|
-
var
|
|
920
|
+
var rkey = (0, _lodash.isObject)(record) ? record[_rowKey] : record;
|
|
921
|
+
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)
|
|
922
|
+
|
|
923
|
+
var deep = function deep(children) {
|
|
924
|
+
return children.map(function (item) {
|
|
925
|
+
if (item[_rowKey] === rkey) {
|
|
926
|
+
return defaultRecord;
|
|
927
|
+
} else if (preKeys.includes(item[_rowKey]) && item.children) {
|
|
928
|
+
var child = deep(item.children);
|
|
929
|
+
return Object.assign(Object.assign({}, item), {
|
|
930
|
+
children: child
|
|
931
|
+
});
|
|
932
|
+
} else {
|
|
933
|
+
return item;
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
var res = deep(dataSourceRef.current);
|
|
939
|
+
setDataSource(res);
|
|
940
|
+
}, 40);
|
|
941
|
+
/** 快捷添加 */
|
|
942
|
+
|
|
943
|
+
var handleTableRowAdd = (0, _lodash.debounce)(function (record, isAppendInChindren, defaultRecord) {
|
|
944
|
+
var _a, _b;
|
|
945
|
+
|
|
946
|
+
var rkey = (0, _lodash.isObject)(record) ? record[_rowKey] : record;
|
|
947
|
+
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;
|
|
1000
948
|
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
1001
|
-
var _a, _b, _c, _d;
|
|
949
|
+
var _a, _b, _c, _d, _e;
|
|
1002
950
|
|
|
1003
|
-
if (preKeys.length > 1) {
|
|
951
|
+
if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
|
|
1004
952
|
var deeps = function deeps(children) {
|
|
1005
953
|
children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
|
|
1006
|
-
var _a;
|
|
954
|
+
var _a, _b;
|
|
1007
955
|
|
|
1008
956
|
if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
|
|
1009
|
-
if (item[_rowKey] ===
|
|
957
|
+
if (item[_rowKey] === rkey) {
|
|
1010
958
|
if (isAppendInChindren) {
|
|
1011
959
|
if (item === null || item === void 0 ? void 0 : item.children) {
|
|
1012
|
-
|
|
960
|
+
if (Array.isArray(defaultRecord)) {
|
|
961
|
+
var _a2;
|
|
962
|
+
|
|
963
|
+
(_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : (_a2 = _a).push.apply(_a2, (0, _toConsumableArray2.default)(defaultRecord));
|
|
964
|
+
} else {
|
|
965
|
+
(_b = item === null || item === void 0 ? void 0 : item.children) === null || _b === void 0 ? void 0 : _b.push(defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
|
|
966
|
+
}
|
|
1013
967
|
} else {
|
|
1014
|
-
|
|
968
|
+
if (Array.isArray(defaultRecord)) {
|
|
969
|
+
item.children = (0, _toConsumableArray2.default)(defaultRecord);
|
|
970
|
+
} else {
|
|
971
|
+
item.children = [defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
|
|
972
|
+
}
|
|
1015
973
|
}
|
|
1016
974
|
|
|
1017
975
|
!expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat((0, _toConsumableArray2.default)(expandedRowKeys), [item[_rowKey]]));
|
|
1018
976
|
} else {
|
|
1019
|
-
|
|
977
|
+
if (Array.isArray(defaultRecord)) {
|
|
978
|
+
children.splice.apply(children, [index + 1, 0].concat((0, _toConsumableArray2.default)(defaultRecord)));
|
|
979
|
+
} else {
|
|
980
|
+
children.splice(index + 1, 0, defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
|
|
981
|
+
}
|
|
1020
982
|
}
|
|
1021
983
|
} else if (item.children) {
|
|
1022
984
|
deeps(item.children);
|
|
@@ -1028,26 +990,37 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1028
990
|
deeps(draft);
|
|
1029
991
|
} else {
|
|
1030
992
|
var index = draft.findIndex(function (item) {
|
|
1031
|
-
return
|
|
993
|
+
return rkey === item[_rowKey];
|
|
1032
994
|
});
|
|
1033
995
|
|
|
1034
996
|
if (index !== -1) {
|
|
1035
997
|
if (isAppendInChindren) {
|
|
1036
998
|
if ((_a = draft[index].children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1037
|
-
|
|
999
|
+
if (Array.isArray(defaultRecord)) {
|
|
1000
|
+
var _b2;
|
|
1001
|
+
|
|
1002
|
+
(_b = draft[index].children) === null || _b === void 0 ? void 0 : (_b2 = _b).push.apply(_b2, (0, _toConsumableArray2.default)(defaultRecord));
|
|
1003
|
+
} else {
|
|
1004
|
+
(_c = draft[index].children) === null || _c === void 0 ? void 0 : _c.push(defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
|
|
1005
|
+
}
|
|
1038
1006
|
} else {
|
|
1039
|
-
draft[index].children = [(0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
|
|
1007
|
+
draft[index].children = Array.isArray(defaultRecord) ? (0, _toConsumableArray2.default)(defaultRecord) : [defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
|
|
1040
1008
|
}
|
|
1041
1009
|
|
|
1042
|
-
!expandedRowKeys.includes((
|
|
1010
|
+
!expandedRowKeys.includes((_d = draft[index]) === null || _d === void 0 ? void 0 : _d[_rowKey]) && setExpandedRowKeys([].concat((0, _toConsumableArray2.default)(expandedRowKeys), [(_e = draft[index]) === null || _e === void 0 ? void 0 : _e[_rowKey]]));
|
|
1043
1011
|
} else {
|
|
1044
|
-
|
|
1012
|
+
if (Array.isArray(defaultRecord)) {
|
|
1013
|
+
draft.splice.apply(draft, [index + 1, 0].concat((0, _toConsumableArray2.default)(defaultRecord)));
|
|
1014
|
+
} else {
|
|
1015
|
+
draft.splice(index + 1, 0, defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
|
|
1016
|
+
}
|
|
1045
1017
|
}
|
|
1046
1018
|
}
|
|
1047
1019
|
}
|
|
1048
1020
|
});
|
|
1049
1021
|
setDataSource(res);
|
|
1050
|
-
};
|
|
1022
|
+
}, 50);
|
|
1023
|
+
/** 快捷刷子功能 */
|
|
1051
1024
|
|
|
1052
1025
|
var handleCopy = function handleCopy(key, value, type, rowIndex) {
|
|
1053
1026
|
var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
|
|
@@ -1066,8 +1039,9 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1066
1039
|
var hasOnlyOptionsDatas = columns.filter(function (item) {
|
|
1067
1040
|
var _a;
|
|
1068
1041
|
|
|
1069
|
-
|
|
1070
|
-
|
|
1042
|
+
var resultComponentProps = (0, _lodash.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;
|
|
1043
|
+
return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
|
|
1044
|
+
}); // const hasOnlyOptionsDatas = columns.filter((item) => item?.componentProps?.optionOnly)
|
|
1071
1045
|
|
|
1072
1046
|
if (hasOnlyOptionsDatas.length) {
|
|
1073
1047
|
return hasOnlyOptionsDatas === null || hasOnlyOptionsDatas === void 0 ? void 0 : hasOnlyOptionsDatas.map(function (item) {
|
|
@@ -1081,9 +1055,13 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1081
1055
|
|
|
1082
1056
|
var DisableOptions = (0, _react.useMemo)(function () {
|
|
1083
1057
|
var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
1084
|
-
var
|
|
1085
|
-
|
|
1086
|
-
|
|
1058
|
+
var _a;
|
|
1059
|
+
|
|
1060
|
+
var resultComponentProps = (0, _lodash.isFunction)(item.componentProps) ? (_a = item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item.componentProps;
|
|
1061
|
+
|
|
1062
|
+
var _ref8 = resultComponentProps || {},
|
|
1063
|
+
optionOnly = _ref8.optionOnly,
|
|
1064
|
+
options = _ref8.options;
|
|
1087
1065
|
|
|
1088
1066
|
if (optionOnly && options) {
|
|
1089
1067
|
var dataIndex = item.dataIndex;
|
|
@@ -1095,6 +1073,13 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1095
1073
|
disabled: !!dataIndexData.includes(o === null || o === void 0 ? void 0 : o.value)
|
|
1096
1074
|
});
|
|
1097
1075
|
});
|
|
1076
|
+
|
|
1077
|
+
if ((0, _lodash.isFunction)(item.componentProps)) {
|
|
1078
|
+
return Object.assign(Object.assign({}, item), {
|
|
1079
|
+
newOptions: newOptions
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1098
1083
|
return Object.assign(Object.assign({}, item), {
|
|
1099
1084
|
componentProps: Object.assign(Object.assign({}, item.componentProps), {
|
|
1100
1085
|
options: newOptions
|
|
@@ -1115,17 +1100,47 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1115
1100
|
var rColumns = hasDisableOptions ? DisableOptions : columns;
|
|
1116
1101
|
var localColumns = [sortOpen ? {
|
|
1117
1102
|
title: '排序',
|
|
1118
|
-
dataIndex: '
|
|
1103
|
+
dataIndex: '_sort',
|
|
1119
1104
|
width: 48,
|
|
1120
1105
|
maxWidth: 48,
|
|
1121
1106
|
className: 'drag-visible',
|
|
1122
1107
|
fixed: 'left',
|
|
1123
1108
|
render: function render(_, record) {
|
|
1124
1109
|
return /*#__PURE__*/_react.default.createElement(_DragHandle.default, {
|
|
1125
|
-
id: record[_rowKey] || record.id
|
|
1110
|
+
id: (record === null || record === void 0 ? void 0 : record[_rowKey]) || (record === null || record === void 0 ? void 0 : record.id)
|
|
1126
1111
|
});
|
|
1127
1112
|
}
|
|
1128
|
-
} : null
|
|
1113
|
+
} : null, indexCol ? (0, _lodash.isBoolean)(indexCol) ? {
|
|
1114
|
+
title: '',
|
|
1115
|
+
dataIndex: '_index',
|
|
1116
|
+
width: 48,
|
|
1117
|
+
maxWidth: 48,
|
|
1118
|
+
ellipsis: true,
|
|
1119
|
+
fixed: 'left',
|
|
1120
|
+
render: function render(_, record, index) {
|
|
1121
|
+
var _a, _b, _c;
|
|
1122
|
+
|
|
1123
|
+
console.log(deepDataSourceRef.current, '--deepDataSourceRef.current', _rowKey);
|
|
1124
|
+
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);
|
|
1125
|
+
}
|
|
1126
|
+
} : Object.assign(Object.assign({
|
|
1127
|
+
title: '',
|
|
1128
|
+
dataIndex: '_index',
|
|
1129
|
+
width: 48,
|
|
1130
|
+
ellipsis: true,
|
|
1131
|
+
maxWidth: 48,
|
|
1132
|
+
fixed: 'left'
|
|
1133
|
+
}, indexCol || {}), {
|
|
1134
|
+
render: function render(_, record, index) {
|
|
1135
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1136
|
+
|
|
1137
|
+
if ((0, _lodash.isFunction)(indexCol === null || indexCol === void 0 ? void 0 : indexCol.render)) {
|
|
1138
|
+
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']);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
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);
|
|
1142
|
+
}
|
|
1143
|
+
}) : null].concat((0, _toConsumableArray2.default)(rColumns), [useQuickOpetate ? {
|
|
1129
1144
|
title: '操作',
|
|
1130
1145
|
dataIndex: 'lm_edit_opetate',
|
|
1131
1146
|
width: 68,
|
|
@@ -1136,9 +1151,9 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1136
1151
|
options: Array.isArray(useQuickOpetate) ? useQuickOpetate : ['add', 'delete']
|
|
1137
1152
|
}
|
|
1138
1153
|
} : null]).filter(function (item) {
|
|
1139
|
-
return item;
|
|
1154
|
+
return item && (item === null || item === void 0 ? void 0 : item.show) !== false;
|
|
1140
1155
|
});
|
|
1141
|
-
localColumns = localColumns.map(function (item, index) {
|
|
1156
|
+
localColumns = localColumns === null || localColumns === void 0 ? void 0 : localColumns.map(function (item, index) {
|
|
1142
1157
|
return Object.assign(Object.assign({}, item), {
|
|
1143
1158
|
order: [null, undefined].includes(item.order) ? index : item.order
|
|
1144
1159
|
});
|
|
@@ -1163,8 +1178,19 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1163
1178
|
var mapColumns = function mapColumns(col, index) {
|
|
1164
1179
|
var _a, _b;
|
|
1165
1180
|
|
|
1166
|
-
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1167
|
-
|
|
1181
|
+
if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length) && (col === null || col === void 0 ? void 0 : col.dataIndex) === '_sort') {
|
|
1182
|
+
var fn = col === null || col === void 0 ? void 0 : col.render;
|
|
1183
|
+
return Object.assign(Object.assign({}, col), {
|
|
1184
|
+
render: function render(text, record, i) {
|
|
1185
|
+
var _a;
|
|
1186
|
+
|
|
1187
|
+
return fn === null || fn === void 0 ? void 0 : fn((_a = dataSource[i]) === null || _a === void 0 ? void 0 : _a[col.dataIndex], dataSource[i], i);
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
if (isEdit && (col === null || col === void 0 ? void 0 : col.render) && (col === null || col === void 0 ? void 0 : col.editable) === 'render') {
|
|
1193
|
+
delete col.render;
|
|
1168
1194
|
}
|
|
1169
1195
|
|
|
1170
1196
|
var newCol = Object.assign(Object.assign({}, col), {
|
|
@@ -1182,7 +1208,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1182
1208
|
editable: col.editable,
|
|
1183
1209
|
dataIndex: col.dataIndex,
|
|
1184
1210
|
itemProps: col.itemProps,
|
|
1185
|
-
|
|
1211
|
+
shouldUpdate: shouldUpdate,
|
|
1186
1212
|
isEdit: isEdit,
|
|
1187
1213
|
isHoverEdit: isHoverEdit,
|
|
1188
1214
|
handleAdd: handleAdd,
|
|
@@ -1190,8 +1216,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1190
1216
|
handleCopy: handleCopy,
|
|
1191
1217
|
editEnum: typeof col.editEnum === 'function' ? col.editEnum(record) : col.editEnum,
|
|
1192
1218
|
valueType: typeof col.valueType === 'function' ? col.valueType(record) : col.valueType,
|
|
1193
|
-
handleSave: handleSave
|
|
1194
|
-
reWriteOriginSource: reWriteOriginSource
|
|
1219
|
+
handleSave: handleSave
|
|
1195
1220
|
};
|
|
1196
1221
|
}
|
|
1197
1222
|
});
|
|
@@ -1203,7 +1228,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1203
1228
|
return newCol;
|
|
1204
1229
|
};
|
|
1205
1230
|
|
|
1206
|
-
var res = localColumns.map(function (col, index) {
|
|
1231
|
+
var res = localColumns === null || localColumns === void 0 ? void 0 : localColumns.map(function (col, index) {
|
|
1207
1232
|
return mapColumns(col, index);
|
|
1208
1233
|
});
|
|
1209
1234
|
return res;
|
|
@@ -1240,8 +1265,24 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1240
1265
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
1241
1266
|
return {
|
|
1242
1267
|
setRow: handleSave,
|
|
1243
|
-
|
|
1244
|
-
return
|
|
1268
|
+
getCheckboxRecords: function getCheckboxRecords() {
|
|
1269
|
+
return localRowSelectList.selectedRows;
|
|
1270
|
+
},
|
|
1271
|
+
deleteRowData: function deleteRowData(data) {
|
|
1272
|
+
return handleTableRowDelete(data);
|
|
1273
|
+
},
|
|
1274
|
+
addRowData: function addRowData(data, defaultValue, addInChild) {
|
|
1275
|
+
return addInChild === 'replace' ? handleTableRowReplace(data, defaultValue) : handleTableRowAdd(data, addInChild, defaultValue);
|
|
1276
|
+
},
|
|
1277
|
+
clearSelect: function clearSelect() {
|
|
1278
|
+
setLocalRowSelectList({
|
|
1279
|
+
selectedRows: []
|
|
1280
|
+
});
|
|
1281
|
+
},
|
|
1282
|
+
customSetCheckboxRecords: function customSetCheckboxRecords(value) {
|
|
1283
|
+
setLocalRowSelectList({
|
|
1284
|
+
selectedRows: value
|
|
1285
|
+
});
|
|
1245
1286
|
}
|
|
1246
1287
|
};
|
|
1247
1288
|
});
|
|
@@ -1286,6 +1327,11 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1286
1327
|
header: {
|
|
1287
1328
|
row: colSortOpen ? colDraggableContainer : null
|
|
1288
1329
|
}
|
|
1330
|
+
},
|
|
1331
|
+
onRow: function onRow(record, index) {
|
|
1332
|
+
return {
|
|
1333
|
+
disabled: disabled
|
|
1334
|
+
};
|
|
1289
1335
|
}
|
|
1290
1336
|
}, resetProps));
|
|
1291
1337
|
|
|
@@ -1304,29 +1350,25 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1304
1350
|
rowClassName: "editable-row",
|
|
1305
1351
|
bordered: true,
|
|
1306
1352
|
pagination: false,
|
|
1307
|
-
|
|
1308
|
-
rowSelection: !rowSelection ? undefined : {
|
|
1353
|
+
rowSelection: !rowSelection ? undefined : Object.assign(Object.assign({
|
|
1309
1354
|
fixed: true,
|
|
1310
1355
|
type: 'checkbox',
|
|
1311
|
-
columnWidth: 36
|
|
1312
|
-
|
|
1313
|
-
|
|
1356
|
+
columnWidth: 36
|
|
1357
|
+
}, rowSelection), {
|
|
1358
|
+
selectedRowKeys: (_a = localRowSelectList === null || localRowSelectList === void 0 ? void 0 : localRowSelectList.selectedRows) === null || _a === void 0 ? void 0 : _a.map(function (v) {
|
|
1359
|
+
return (0, _lodash.isObject)(v) ? v[_rowKey] : v;
|
|
1314
1360
|
}),
|
|
1315
|
-
onChange: function onChange(selectedRowKeys, selectedRows) {
|
|
1316
|
-
|
|
1361
|
+
onChange: function onChange(selectedRowKeys, selectedRows, info) {
|
|
1362
|
+
setLocalRowSelectList(selectedRowKeys, selectedRows, info);
|
|
1317
1363
|
}
|
|
1318
|
-
},
|
|
1364
|
+
}),
|
|
1319
1365
|
dataSource: dataSource
|
|
1320
|
-
})))),
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
}
|
|
1327
|
-
}, /*#__PURE__*/_react.default.createElement(_icons.PlusCircleOutlined, {
|
|
1328
|
-
className: "lmweb-plus"
|
|
1329
|
-
}), "\u65B0\u589E"));
|
|
1366
|
+
})))), /*#__PURE__*/_react.default.createElement(_components.BottomOpetateComponent, {
|
|
1367
|
+
disabled: disabled,
|
|
1368
|
+
isShowAddAction: isShowAddAction,
|
|
1369
|
+
recordCreatorProps: recordCreatorProps,
|
|
1370
|
+
handleAdd: handleAdd
|
|
1371
|
+
}));
|
|
1330
1372
|
} // @ts-ignore
|
|
1331
1373
|
|
|
1332
1374
|
|
|
@@ -1342,32 +1384,31 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1342
1384
|
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
1343
1385
|
expandedRowKeys: expandedRowKeys,
|
|
1344
1386
|
fixed: true,
|
|
1387
|
+
// indentSize: 0,
|
|
1388
|
+
expandIconColumnIndex: rowSelection && sortOpen ? 3 : rowSelection || sortOpen ? 2 : 0,
|
|
1345
1389
|
onExpandedRowsChange: function onExpandedRowsChange(expandedRows) {
|
|
1346
1390
|
return setExpandedRowKeys(expandedRows);
|
|
1347
1391
|
}
|
|
1348
1392
|
},
|
|
1349
|
-
rowSelection: !rowSelection ? undefined : {
|
|
1393
|
+
rowSelection: !rowSelection ? undefined : Object.assign(Object.assign({
|
|
1350
1394
|
fixed: true,
|
|
1351
1395
|
type: 'checkbox',
|
|
1352
|
-
columnWidth: 36
|
|
1353
|
-
|
|
1354
|
-
|
|
1396
|
+
columnWidth: 36
|
|
1397
|
+
}, rowSelection), {
|
|
1398
|
+
selectedRowKeys: (_b = localRowSelectList === null || localRowSelectList === void 0 ? void 0 : localRowSelectList.selectedRows) === null || _b === void 0 ? void 0 : _b.map(function (v) {
|
|
1399
|
+
return (0, _lodash.isObject)(v) ? v[_rowKey] : v;
|
|
1355
1400
|
}),
|
|
1356
|
-
onChange: function onChange(selectedRowKeys, selectedRows) {
|
|
1357
|
-
|
|
1401
|
+
onChange: function onChange(selectedRowKeys, selectedRows, info) {
|
|
1402
|
+
setLocalRowSelectList(selectedRowKeys, selectedRows, info);
|
|
1358
1403
|
}
|
|
1359
|
-
},
|
|
1404
|
+
}),
|
|
1360
1405
|
dataSource: dataSource
|
|
1361
|
-
})),
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
}, (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.style) || {})
|
|
1368
|
-
}, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
|
|
1369
|
-
type: "lmweb-plus"
|
|
1370
|
-
}), (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.creatorButtonText) || '新增'));
|
|
1406
|
+
})), /*#__PURE__*/_react.default.createElement(_components.BottomOpetateComponent, {
|
|
1407
|
+
disabled: disabled,
|
|
1408
|
+
isShowAddAction: isShowAddAction,
|
|
1409
|
+
recordCreatorProps: recordCreatorProps,
|
|
1410
|
+
handleAdd: handleAdd
|
|
1411
|
+
}));
|
|
1371
1412
|
});
|
|
1372
1413
|
|
|
1373
1414
|
var _default = /*#__PURE__*/(0, _react.memo)(EditTable);
|