linkmore-design 1.1.27 → 1.1.28-alpha.5

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.
Files changed (141) hide show
  1. package/dist/LmEditTable/DndContainer.d.ts +6 -3
  2. package/dist/LmEditTable/EditTable.d.ts +15 -5
  3. package/dist/LmEditTable/components/DraggableContainer.d.ts +10 -0
  4. package/dist/LmEditTable/components/QuickOpetate.d.ts +12 -0
  5. package/dist/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
  6. package/dist/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  7. package/dist/LmEditTable/components/index.d.ts +17 -0
  8. package/dist/LmEditTable/hooks/useForkRef.d.ts +2 -0
  9. package/dist/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
  10. package/dist/LmEditTable/sortableItem.d.ts +3 -2
  11. package/dist/LmEditTable/util.d.ts +10 -0
  12. package/dist/LmEditTable/virtual/VirtualRow.d.ts +7 -0
  13. package/dist/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
  14. package/dist/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  15. package/dist/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  16. package/dist/LmEditTable/virtual/context.d.ts +13 -0
  17. package/dist/LmEditTable/virtual/index.d.ts +4 -0
  18. package/dist/LmTable/virTual/VirtualRow.d.ts +1 -1
  19. package/dist/index.d.ts +1 -2
  20. package/dist/index.umd.js +1907 -677
  21. package/dist/index.umd.min.js +21 -21
  22. package/dist/variables.css +115 -2
  23. package/es/CardTable/style/index.css +3 -2
  24. package/es/CardTable/style/variables.css +3 -2
  25. package/es/CustomTableOption/columnsSort.js +41 -18
  26. package/es/CustomTableOption/filterSort.js +14 -6
  27. package/es/CustomTableOption/style/index.css +3 -0
  28. package/es/CustomTableOption/style/variables.css +3 -0
  29. package/es/Form/FormItem/index.js +5 -1
  30. package/es/InputNumber/index.js +7 -9
  31. package/es/LmEditTable/DndContainer.d.ts +6 -3
  32. package/es/LmEditTable/DndContainer.js +70 -10
  33. package/es/LmEditTable/DragHandle.js +1 -1
  34. package/es/LmEditTable/EditTable.d.ts +15 -5
  35. package/es/LmEditTable/EditTable.js +696 -361
  36. package/es/LmEditTable/components/DraggableContainer.d.ts +10 -0
  37. package/es/LmEditTable/components/DraggableContainer.js +39 -0
  38. package/es/LmEditTable/components/QuickOpetate.d.ts +12 -0
  39. package/es/LmEditTable/components/QuickOpetate.js +82 -0
  40. package/es/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
  41. package/es/LmEditTable/components/bottomOpetateComponent.js +23 -0
  42. package/es/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  43. package/es/LmEditTable/components/customRenderEmpty.js +20 -0
  44. package/es/LmEditTable/components/index.d.ts +17 -0
  45. package/es/LmEditTable/components/index.js +8 -0
  46. package/es/LmEditTable/hooks/useForkRef.d.ts +2 -0
  47. package/es/LmEditTable/hooks/useForkRef.js +22 -0
  48. package/es/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
  49. package/es/LmEditTable/rowSort/DndContainerRow.js +83 -0
  50. package/es/LmEditTable/sortableItem.d.ts +3 -2
  51. package/es/LmEditTable/sortableItem.js +16 -4
  52. package/es/LmEditTable/sortableItemCol.js +40 -10
  53. package/es/LmEditTable/style/index.css +109 -0
  54. package/es/LmEditTable/style/variables.css +109 -0
  55. package/es/LmEditTable/util.d.ts +10 -0
  56. package/es/LmEditTable/util.js +156 -7
  57. package/es/LmEditTable/virtual/VirtualRow.d.ts +7 -0
  58. package/es/LmEditTable/virtual/VirtualRow.js +148 -0
  59. package/es/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
  60. package/es/LmEditTable/virtual/VirtualRow2.js +62 -0
  61. package/es/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  62. package/es/LmEditTable/virtual/VirtualTable.js +64 -0
  63. package/es/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  64. package/es/LmEditTable/virtual/VirtualWrapper.js +60 -0
  65. package/es/LmEditTable/virtual/context.d.ts +13 -0
  66. package/es/LmEditTable/virtual/context.js +66 -0
  67. package/es/LmEditTable/virtual/index.d.ts +4 -0
  68. package/es/LmEditTable/virtual/index.js +4 -0
  69. package/es/LmFilter/baseFilter/index.js +3 -2
  70. package/es/LmFilter/filterFns/index.js +4 -2
  71. package/es/LmTable/virTual/VirtualRow.d.ts +1 -1
  72. package/es/LmTable/virTual/VirtualRow.js +82 -48
  73. package/es/LmTable/virTual/VirtualTable.js +17 -9
  74. package/es/LmTable/virTual/context.js +14 -2
  75. package/es/LmUpload/body/UploadCore.js +1 -1
  76. package/es/LmUpload/fns/index.js +1 -1
  77. package/es/Radio/index.js +9 -1
  78. package/es/Switch/index.js +7 -2
  79. package/es/hooks/useEvent/index.js +1 -1
  80. package/es/index.d.ts +1 -2
  81. package/es/styles/variables.css +115 -2
  82. package/lib/CardTable/style/index.css +3 -2
  83. package/lib/CardTable/style/variables.css +3 -2
  84. package/lib/CustomTableOption/columnsSort.js +48 -22
  85. package/lib/CustomTableOption/filterSort.js +19 -10
  86. package/lib/CustomTableOption/style/index.css +3 -0
  87. package/lib/CustomTableOption/style/variables.css +3 -0
  88. package/lib/Form/FormItem/index.js +5 -1
  89. package/lib/InputNumber/index.js +9 -9
  90. package/lib/LmEditTable/DndContainer.d.ts +6 -3
  91. package/lib/LmEditTable/DndContainer.js +74 -9
  92. package/lib/LmEditTable/DragHandle.js +1 -1
  93. package/lib/LmEditTable/EditTable.d.ts +15 -5
  94. package/lib/LmEditTable/EditTable.js +694 -358
  95. package/lib/LmEditTable/components/DraggableContainer.d.ts +10 -0
  96. package/lib/LmEditTable/components/DraggableContainer.js +52 -0
  97. package/lib/LmEditTable/components/QuickOpetate.d.ts +12 -0
  98. package/lib/LmEditTable/components/QuickOpetate.js +96 -0
  99. package/lib/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
  100. package/lib/LmEditTable/components/bottomOpetateComponent.js +34 -0
  101. package/lib/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  102. package/lib/LmEditTable/components/customRenderEmpty.js +32 -0
  103. package/lib/LmEditTable/components/index.d.ts +17 -0
  104. package/lib/LmEditTable/components/index.js +45 -0
  105. package/lib/LmEditTable/hooks/useForkRef.d.ts +2 -0
  106. package/lib/LmEditTable/hooks/useForkRef.js +29 -0
  107. package/lib/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
  108. package/lib/LmEditTable/rowSort/DndContainerRow.js +100 -0
  109. package/lib/LmEditTable/sortableItem.d.ts +3 -2
  110. package/lib/LmEditTable/sortableItem.js +19 -5
  111. package/lib/LmEditTable/sortableItemCol.js +37 -8
  112. package/lib/LmEditTable/style/index.css +109 -0
  113. package/lib/LmEditTable/style/variables.css +109 -0
  114. package/lib/LmEditTable/util.d.ts +10 -0
  115. package/lib/LmEditTable/util.js +165 -6
  116. package/lib/LmEditTable/virtual/VirtualRow.d.ts +7 -0
  117. package/lib/LmEditTable/virtual/VirtualRow.js +164 -0
  118. package/lib/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
  119. package/lib/LmEditTable/virtual/VirtualRow2.js +78 -0
  120. package/lib/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  121. package/lib/LmEditTable/virtual/VirtualTable.js +81 -0
  122. package/lib/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  123. package/lib/LmEditTable/virtual/VirtualWrapper.js +73 -0
  124. package/lib/LmEditTable/virtual/context.d.ts +13 -0
  125. package/lib/LmEditTable/virtual/context.js +76 -0
  126. package/lib/LmEditTable/virtual/index.d.ts +4 -0
  127. package/lib/LmEditTable/virtual/index.js +31 -0
  128. package/lib/LmFilter/baseFilter/index.js +3 -2
  129. package/lib/LmFilter/filterFns/index.js +4 -2
  130. package/lib/LmTable/virTual/VirtualRow.d.ts +1 -1
  131. package/lib/LmTable/virTual/VirtualRow.js +81 -48
  132. package/lib/LmTable/virTual/VirtualTable.js +16 -8
  133. package/lib/LmTable/virTual/context.js +14 -2
  134. package/lib/LmUpload/body/UploadCore.js +1 -1
  135. package/lib/LmUpload/fns/index.js +1 -1
  136. package/lib/Radio/index.js +9 -1
  137. package/lib/Switch/index.js +9 -2
  138. package/lib/hooks/useEvent/index.js +1 -1
  139. package/lib/index.d.ts +1 -2
  140. package/lib/styles/variables.css +115 -2
  141. package/package.json +7 -9
@@ -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");
@@ -35,8 +33,6 @@ var _immer = require("immer");
35
33
 
36
34
  var _DndContainer = _interopRequireDefault(require("./DndContainer"));
37
35
 
38
- var _sortableBox = _interopRequireDefault(require("./sortableBox"));
39
-
40
36
  var _sortableBoxCol = _interopRequireDefault(require("./sortableBoxCol"));
41
37
 
42
38
  var _sortableItem = _interopRequireDefault(require("./sortableItem"));
@@ -49,8 +45,14 @@ var _UploadOss = _interopRequireDefault(require("../UploadOss"));
49
45
 
50
46
  var _util = require("./util");
51
47
 
48
+ var _components = require("./components");
49
+
52
50
  var _classnames = _interopRequireDefault(require("classnames"));
53
51
 
52
+ var _ConfigProvider = _interopRequireDefault(require("../ConfigProvider"));
53
+
54
+ var _virtual = require("./virtual");
55
+
54
56
  var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
55
57
  function adopt(value) {
56
58
  return value instanceof P ? value : new P(function (resolve) {
@@ -95,8 +97,6 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
95
97
  }
96
98
  return t;
97
99
  };
98
- /* eslint-disable no-unused-vars */
99
-
100
100
 
101
101
  var UploadBtn = _UploadOss.default.UploadBtn;
102
102
 
@@ -105,18 +105,23 @@ var EditableContext = /*#__PURE__*/_react.default.createContext(null); // 表格
105
105
 
106
106
  var EditableRow = function EditableRow(_a) {
107
107
  var index = _a.index,
108
- props = __rest(_a, ["index"]);
108
+ virtual = _a.virtual,
109
+ props = __rest(_a, ["index", "virtual"]);
109
110
 
110
111
  var _Form$useForm = _linkmoreDesign.Form.useForm(),
111
112
  _Form$useForm2 = (0, _slicedToArray2.default)(_Form$useForm, 1),
112
113
  form = _Form$useForm2[0];
113
114
 
115
+ var dataKey = props.dataKey,
116
+ pushAllForm = props.pushAllForm;
117
+ pushAllForm === null || pushAllForm === void 0 ? void 0 : pushAllForm(form, dataKey, index);
114
118
  return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form, {
115
119
  form: form,
120
+ disabled: props.disabled || false,
116
121
  component: false
117
122
  }, /*#__PURE__*/_react.default.createElement(EditableContext.Provider, {
118
123
  value: form
119
- }, /*#__PURE__*/_react.default.createElement("tr", Object.assign({}, props))));
124
+ }, virtual ? /*#__PURE__*/_react.default.createElement(_virtual.VirtualRow, Object.assign({}, props)) : /*#__PURE__*/_react.default.createElement("tr", Object.assign({}, props))));
120
125
  };
121
126
 
122
127
  var EditableSortRow = function EditableSortRow(_a) {
@@ -127,8 +132,12 @@ var EditableSortRow = function EditableSortRow(_a) {
127
132
  _Form$useForm4 = (0, _slicedToArray2.default)(_Form$useForm3, 1),
128
133
  form = _Form$useForm4[0];
129
134
 
135
+ var dataKey = props.dataKey,
136
+ pushAllForm = props.pushAllForm;
137
+ pushAllForm === null || pushAllForm === void 0 ? void 0 : pushAllForm(form, dataKey, index);
130
138
  return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form, {
131
139
  form: form,
140
+ disabled: props.disabled || false,
132
141
  component: false
133
142
  }, /*#__PURE__*/_react.default.createElement(EditableContext.Provider, {
134
143
  value: form
@@ -259,88 +268,7 @@ var InputRange = function InputRange(_a) {
259
268
  return handleInput(e, 'next');
260
269
  }
261
270
  }, editEnum))));
262
- }; // 操作列
263
-
264
-
265
- var Opetate = function Opetate(_ref) {
266
- var record = _ref.record,
267
- rowKey = _ref.rowKey,
268
- handleAdd = _ref.handleAdd,
269
- handleDelete = _ref.handleDelete,
270
- _ref$options = _ref.options,
271
- options = _ref$options === void 0 ? ['add', 'delete'] : _ref$options,
272
- getLength = _ref.getLength,
273
- quickOpetateClearAll = _ref.quickOpetateClearAll;
274
-
275
- var appendChildren = function appendChildren() {
276
- handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record, true);
277
- };
278
-
279
- var appendAdd = function appendAdd() {
280
- handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record);
281
- };
282
-
283
- return /*#__PURE__*/_react.default.createElement("div", {
284
- style: {
285
- display: 'flex',
286
- alignItems: 'center',
287
- justifyContent: 'flex-start',
288
- marginLeft: '-4px'
289
- }
290
- }, options.includes('delete') && /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
291
- type: "link",
292
- size: "small",
293
- disabled: !quickOpetateClearAll && getLength < 2,
294
- icon: /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
295
- type: "lmweb-minus-circle",
296
- style: {
297
- fontSize: 16
298
- }
299
- }),
300
- onClick: function onClick() {
301
- return handleDelete(record[rowKey]);
302
- }
303
- }), (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, {
304
- placement: "bottom",
305
- overlayClassName: 'lm_table_append_add_popover',
306
- open: open,
307
- title: null,
308
- content: /*#__PURE__*/_react.default.createElement("ul", null, /*#__PURE__*/_react.default.createElement("li", {
309
- onClick: appendAdd
310
- }, "\u6DFB\u52A0\u5E73\u7EA7"), /*#__PURE__*/_react.default.createElement("li", {
311
- onClick: appendChildren
312
- }, "\u6DFB\u52A0\u5B50\u7EA7")),
313
- trigger: "hover"
314
- }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
315
- type: "link",
316
- size: "small",
317
- icon: /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
318
- type: "lmweb-plus-circle-fill",
319
- style: {
320
- fontSize: 16
321
- }
322
- })
323
- })) : (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.Button, {
324
- type: "link",
325
- size: "small",
326
- icon: /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
327
- type: "lmweb-plus-circle-fill",
328
- style: {
329
- fontSize: 16
330
- }
331
- }),
332
- onClick: function onClick() {
333
- return handleAdd(record, (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? true : false);
334
- }
335
- }) : null);
336
- }; // const isValidValue = (verifyValue) => {
337
- // const toStringValue = JSON.stringify(verifyValue);
338
- // if (verifyValue === undefined || verifyValue === null || verifyValue === '' || toStringValue === '[]' || toStringValue === '{}') {
339
- // return false;
340
- // }
341
- // return true;
342
- // }
343
-
271
+ };
344
272
  /*
345
273
  表格单元格
346
274
  editEnum: 下拉框时的数据数组(非数组时是配置设置)
@@ -370,9 +298,7 @@ var EditableCell = function EditableCell(props) {
370
298
  handleDelete = props.handleDelete,
371
299
  handleCopy = props.handleCopy,
372
300
  itemProps = props.itemProps,
373
- setValid = props.setValid,
374
- reWriteOriginSource = props.reWriteOriginSource,
375
- restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "rowIndex", "colIndex", "handleTableRowDelete", "handleTableRowAdd", "quickOpetateClearAll", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "handleCopy", "itemProps", "setValid", "reWriteOriginSource"]);
301
+ restProps = __rest(props, ["record", "rowKey", "isEdit", "col", "rowIndex", "colIndex", "handleTableRowDelete", "handleTableRowAdd", "quickOpetateClearAll", "getLength", "isHoverEdit", "editEnum", "valueType", "children", "handleSave", "handleAdd", "handleDelete", "handleCopy", "itemProps"]);
376
302
  /** 去除移入移出功能,保留最纯粹的功能,优化性能 */
377
303
 
378
304
 
@@ -392,6 +318,12 @@ var EditableCell = function EditableCell(props) {
392
318
 
393
319
  var inputRef = (0, _react.useRef)(null);
394
320
  var form = (0, _react.useContext)(EditableContext);
321
+
322
+ var _useState5 = (0, _react.useState)(false),
323
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
324
+ hoverStatus = _useState6[0],
325
+ setHoverStatus = _useState6[1];
326
+
395
327
  (0, _react.useEffect)(function () {
396
328
  var _a;
397
329
 
@@ -402,13 +334,7 @@ var EditableCell = function EditableCell(props) {
402
334
 
403
335
  var toggleEdit = function toggleEdit() {
404
336
  setEditing(!editing); // form.setFieldsValue({ [dataIndex]: record[dataIndex] });
405
- }; // const checkCellRef = useRef(null)
406
- // const focusCapturedRef = useRef(false);
407
- // const curValue = useMemo(() => {
408
- // return record?.dataIndex
409
- // }, [record])
410
- // const curValueIsValid = isValidValue(curValue);
411
- // 校验保存
337
+ }; // 校验保存
412
338
 
413
339
 
414
340
  var save = function save(row) {
@@ -460,13 +386,7 @@ var EditableCell = function EditableCell(props) {
460
386
  case 13:
461
387
  if (col === null || col === void 0 ? void 0 : col.hoverEdit) {
462
388
  toggleEdit();
463
- } // // 清空异常校验
464
- // setValid((old) => {
465
- // const obj = { ...old }
466
- // delete obj[record[rowKey]]
467
- // return obj
468
- // })
469
-
389
+ }
470
390
 
471
391
  _context.next = 18;
472
392
  break;
@@ -491,15 +411,14 @@ var EditableCell = function EditableCell(props) {
491
411
  /** 快捷刷子,把当前的所有列的值,刷成当前的选中的列 */
492
412
 
493
413
 
494
- var copyKey = function copyKey(e) {
414
+ var copyKey = function copyKey(e, type) {
495
415
  e === null || e === void 0 ? void 0 : e.stopPropagation();
496
416
  var dataIndex = col.dataIndex;
497
- handleCopy === null || handleCopy === void 0 ? void 0 : handleCopy(dataIndex, record[dataIndex]);
417
+ handleCopy === null || handleCopy === void 0 ? void 0 : handleCopy(dataIndex, record[dataIndex], type, props.rowIndex);
498
418
  };
499
419
 
500
420
  var Control = function Control(con) {
501
- var _a; // const resultComponentProps = isFunction(componentProps) ? componentProps?.(record, col) : componentProps
502
-
421
+ var _a;
503
422
 
504
423
  var resultComponentProps = (0, _lodash.isFunction)(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
505
424
 
@@ -509,7 +428,7 @@ var EditableCell = function EditableCell(props) {
509
428
  });
510
429
  }
511
430
 
512
- var clearAttrComponentProps = (0, _lodash.omit)(resultComponentProps, ['optionOnly', 'isOnlyValue']);
431
+ var clearAttrComponentProps = (0, _lodash.omit)(resultComponentProps, ['optionOnly', 'isOnlyValue', 'quickcopy']);
513
432
 
514
433
  switch (con) {
515
434
  case 'input':
@@ -530,19 +449,12 @@ var EditableCell = function EditableCell(props) {
530
449
  noStyle: true
531
450
  }, /*#__PURE__*/_react.default.cloneElement(resultComponentProps.addonAfter, {
532
451
  onChange: handleFormItemChange
533
- })) : null,
534
- suffix: resultComponentProps.quickcopy ? /*#__PURE__*/_react.default.createElement("span", {
535
- className: 'lm_table_quickcopy'
536
- }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
537
- onClick: copyKey,
538
- type: 'lmweb-icon_m_brush'
539
452
  })) : null
540
453
  }));
541
454
 
542
455
  case 'inputRange':
543
456
  return /*#__PURE__*/_react.default.createElement(InputRange, Object.assign({
544
- onChange: handleFormItemChange,
545
- ref: inputRef
457
+ onChange: handleFormItemChange
546
458
  }, resultComponentProps, {
547
459
  record: record,
548
460
  rowIndex: rowIndex,
@@ -606,8 +518,7 @@ var EditableCell = function EditableCell(props) {
606
518
 
607
519
  case 'radio':
608
520
  return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Radio, Object.assign({
609
- onChange: handleFormItemChange,
610
- ref: inputRef
521
+ onChange: handleFormItemChange
611
522
  }, clearAttrComponentProps));
612
523
 
613
524
  case 'radioGroup':
@@ -618,7 +529,7 @@ var EditableCell = function EditableCell(props) {
618
529
 
619
530
  case 'switch':
620
531
  return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Switch, Object.assign({
621
- size: 'small'
532
+ size: "small"
622
533
  }, clearAttrComponentProps, {
623
534
  onChange: handleFormItemChange
624
535
  }));
@@ -632,10 +543,9 @@ var EditableCell = function EditableCell(props) {
632
543
 
633
544
  case 'operate':
634
545
  case 'lm_edit_opetate':
635
- return /*#__PURE__*/_react.default.createElement(Opetate, Object.assign({
546
+ return /*#__PURE__*/_react.default.createElement(_components.QuickOpetate, Object.assign({
636
547
  record: record,
637
548
  rowKey: rowKey,
638
- ref: inputRef,
639
549
  handleAdd: handleTableRowAdd,
640
550
  handleDelete: handleTableRowDelete,
641
551
  getLength: getLength,
@@ -649,7 +559,7 @@ var EditableCell = function EditableCell(props) {
649
559
  var fromData = form.getFieldsValue();
650
560
  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), {
651
561
  onChange: save
652
- }));
562
+ }), rowIndex);
653
563
  }
654
564
 
655
565
  default:
@@ -686,7 +596,8 @@ var EditableCell = function EditableCell(props) {
686
596
  valuePropName: editable === 'switch' ? 'checked' : 'value',
687
597
  style: {
688
598
  margin: 0
689
- }
599
+ },
600
+ noStyle: formProps ? false : true
690
601
  }, formProps, {
691
602
  name: dataIndex
692
603
  }), Control(editable)));
@@ -698,6 +609,7 @@ var EditableCell = function EditableCell(props) {
698
609
  margin: 0
699
610
  }
700
611
  }, formProps, {
612
+ noStyle: formProps ? false : true,
701
613
  name: [dataIndex, 'value']
702
614
  }), Control(editable)));
703
615
  }
@@ -708,31 +620,68 @@ var EditableCell = function EditableCell(props) {
708
620
  }
709
621
 
710
622
  return childNode;
711
- }, [col, isEdit, editing, getLength]); // const [childNode, setChildNode] = useState(getMemoChildNode);
712
- // 出现死循环找我
623
+ }, [col, isEdit, editing, getLength, record]); // 出现死循环找我
713
624
 
714
625
  (0, _react.useEffect)(function () {
715
626
  var editable = col.editable,
716
627
  dataIndex = col.dataIndex;
717
628
 
718
629
  if (isEdit && editable) {
719
- form.setFieldsValue((0, _defineProperty2.default)({}, dataIndex, editable === 'date' ? (0, _moment.default)(record[dataIndex]) : record[dataIndex]));
720
- } // if (
721
- // (isEdit && editable && record[dataIndex]) ||
722
- // (isHoverEdit && editable && record[dataIndex])
723
- // ) {
724
- // form.setFieldsValue({
725
- // [dataIndex]: editable === 'date' ? moment(record[dataIndex]) : record[dataIndex],
726
- // })
727
- // }
728
-
630
+ form.setFieldsValue((0, _defineProperty2.default)({}, dataIndex, editable === 'date' && record[dataIndex] ? (0, _moment.default)(record[dataIndex]) : record[dataIndex]));
631
+ }
729
632
  }, [record]);
633
+
634
+ var handleTdHover = function handleTdHover() {
635
+ setHoverStatus(true);
636
+ };
637
+
638
+ var handleTdMouseOut = function handleTdMouseOut() {
639
+ setHoverStatus(false);
640
+ };
641
+
730
642
  return /*#__PURE__*/_react.default.createElement("td", Object.assign({}, (0, _lodash.omit)(clearProps, ['dataIndex']), {
731
643
  className: (0, _classnames.default)(clearProps === null || clearProps === void 0 ? void 0 : clearProps.className, 'lm_custom_cell_td'),
644
+ onMouseEnter: componentProps.quickcopy ? handleTdHover : undefined,
645
+ onMouseLeave: componentProps.quickcopy ? handleTdMouseOut : undefined,
732
646
  key: "r".concat(rowIndex, "_c").concat(colIndex)
733
- }), getMemoChildNode);
647
+ }), hoverStatus && props.rowIndex > 0 && /*#__PURE__*/_react.default.createElement("span", {
648
+ className: 'quick_copy_warp quick_copy_up',
649
+ onClick: function onClick(e) {
650
+ return copyKey(e, 'up');
651
+ }
652
+ }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
653
+ type: 'lmweb-icon_up'
654
+ })), getMemoChildNode, hoverStatus && props.rowIndex < props.getLength - 1 && /*#__PURE__*/_react.default.createElement("span", {
655
+ className: 'quick_copy_warp quick_copy_down',
656
+ onClick: function onClick(e) {
657
+ return copyKey(e, 'down');
658
+ }
659
+ }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
660
+ type: 'lmweb-icon_down'
661
+ })));
734
662
  };
663
+ /** true 不刷新, false 刷新 */
664
+
665
+
666
+ var MemoEditableCell = /*#__PURE__*/(0, _react.memo)(EditableCell, function (prev, next) {
667
+ var pickProps = ['record', 'colIndex'];
668
+ var p = (0, _lodash.pick)(prev, pickProps);
669
+ var n = (0, _lodash.pick)(next, pickProps);
670
+
671
+ if (next === null || next === void 0 ? void 0 : next.shouldUpdate) {
672
+ return false;
673
+ } // console.log(!checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n), '22', prev.record, next.record)
674
+ // console.log('333', checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n))
675
+
676
+ /** TODO: 在record中带有children,子列表数据修改之后,会导致父级的record对比不一样 */
735
677
 
678
+
679
+ if (!(0, _util.checkMemoShouldUploadSpecialFun)(prev, next)) {
680
+ return false;
681
+ }
682
+
683
+ return (0, _lodash.isEqual)(p, n);
684
+ });
736
685
  var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
737
686
  var _a, _b;
738
687
 
@@ -752,16 +701,24 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
752
701
  _props$quickOpetateCl = props.quickOpetateClearAll,
753
702
  quickOpetateClearAll = _props$quickOpetateCl === void 0 ? true : _props$quickOpetateCl,
754
703
  rowSelection = props.rowSelection,
704
+ rowDisabled = props.rowDisabled,
705
+ virtual = props.virtual,
755
706
  sortOpen = props.sortOpen,
707
+ disabled = props.disabled,
756
708
  colSortOpen = props.colSortOpen,
709
+ _props$indexCol = props.indexCol,
710
+ indexCol = _props$indexCol === void 0 ? false : _props$indexCol,
757
711
  filterChange = props.filterChange,
758
712
  _props$size = props.size,
759
713
  size = _props$size === void 0 ? 'small' : _props$size,
760
714
  recordCreatorProps = props.recordCreatorProps,
761
715
  _props$shouldUpdate = props.shouldUpdate,
762
716
  shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
763
- resetProps = __rest(props, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "sortOpen", "colSortOpen", "filterChange", "size", "recordCreatorProps", "shouldUpdate"]); // const [dataSource, setDataSource] = useState([]);
764
-
717
+ _props$loading = props.loading,
718
+ loading = _props$loading === void 0 ? false : _props$loading,
719
+ _props$autoSizer = props.autoSizer,
720
+ autoSizer = _props$autoSizer === void 0 ? false : _props$autoSizer,
721
+ resetProps = __rest(props, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "rowDisabled", "virtual", "sortOpen", "disabled", "colSortOpen", "indexCol", "filterChange", "size", "recordCreatorProps", "shouldUpdate", "loading", "autoSizer"]);
765
722
 
766
723
  var _useControllableValue = (0, _ahooks.useControllableValue)({
767
724
  value: (0, _util.checkRowKeyByDataSource)(props.value, _rowKey),
@@ -769,14 +726,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
769
726
  }),
770
727
  _useControllableValue2 = (0, _slicedToArray2.default)(_useControllableValue, 2),
771
728
  dataSource = _useControllableValue2[0],
772
- setDataSource = _useControllableValue2[1]; // const [count, setCount] = useState(0);
773
-
774
-
775
- var _useState5 = (0, _react.useState)({}),
776
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
777
- _valid = _useState6[0],
778
- setValid = _useState6[1]; // const [localRowSelectList, setLocalRowSelectList] = useState([])
779
-
729
+ setDataSource = _useControllableValue2[1];
780
730
 
781
731
  var transformRowSelect = function transformRowSelect(selectedRowKeys, selectedRows, info) {
782
732
  var _a;
@@ -794,41 +744,44 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
794
744
  localRowSelectList = _useControllableValue4[0],
795
745
  setLocalRowSelectList = _useControllableValue4[1];
796
746
 
797
- var _useState7 = (0, _react.useState)([]),
798
- _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
799
- sortEditTable = _useState8[0],
800
- setCallBackFalg = _useState8[1];
801
- /** 当前展开的列 */
802
-
803
-
804
- var _useState9 = (0, _react.useState)([]),
805
- _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
806
- expandedRowKeys = _useState10[0],
807
- setExpandedRowKeys = _useState10[1];
747
+ var _useControllableValue5 = (0, _ahooks.useControllableValue)({
748
+ value: {
749
+ disabledRows: (rowDisabled === null || rowDisabled === void 0 ? void 0 : rowDisabled.disabledRows) || []
750
+ }
751
+ }),
752
+ _useControllableValue6 = (0, _slicedToArray2.default)(_useControllableValue5, 1),
753
+ localDisabledRows = _useControllableValue6[0];
754
+ /** TODO: 当前展开的列 */
808
755
 
809
- var dataSourceRef = (0, _react.useRef)([]);
810
- var sortDataSorceRef = (0, _react.useRef)([]);
811
- var deepDataSourceRef = (0, _react.useRef)([]);
812
756
 
813
- var onSortEnd = function onSortEnd(active, over) {
814
- var cloneArr = (0, _toConsumableArray2.default)(dataSourceRef.current);
815
- var oldIndex = cloneArr.findIndex(function (v) {
816
- return v[_rowKey] === active;
817
- });
818
- var newIndex = cloneArr.findIndex(function (v) {
819
- return v[_rowKey] === over;
820
- });
821
- setDataSource((0, _sortable.arrayMove)(cloneArr, oldIndex, newIndex));
822
- };
757
+ var _useState7 = (0, _react.useState)([]),
758
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
759
+ expandedRowKeys = _useState8[0],
760
+ setExpandedRowKeys = _useState8[1];
761
+
762
+ var dataSourceRef = (0, _react.useRef)(dataSource);
763
+ var deepDataSourceRef = (0, _react.useRef)((0, _util.deepDataSourcePreKeys)(dataSource, _rowKey));
764
+ dataSourceRef.current = dataSource;
765
+ deepDataSourceRef.current = (0, _util.deepDataSourcePreKeys)(dataSource, _rowKey);
766
+ var disabledDataSourceRowKeys = (0, _react.useRef)((0, _util.checkTableRowIsDisable)(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey));
767
+ disabledDataSourceRowKeys.current = (0, _util.checkTableRowIsDisable)(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey);
768
+ var tableWarpRef = (0, _react.useRef)(null);
769
+ var autoSizerRef = (0, _react.useRef)(null);
770
+ var allFormListRef = (0, _react.useRef)({});
771
+ var scrollToIndexRef = (0, _react.useRef)(null);
772
+
773
+ var _Form$useForm5 = _linkmoreDesign.Form.useForm(),
774
+ _Form$useForm6 = (0, _slicedToArray2.default)(_Form$useForm5, 1),
775
+ checkForm = _Form$useForm6[0];
823
776
 
824
777
  var onColSortEnd = function onColSortEnd(active, over) {
825
778
  var _a;
826
779
 
827
780
  var oldIndex = columns.findIndex(function (item) {
828
- return item['dataIndex'] === active;
781
+ return item.dataIndex === active;
829
782
  });
830
783
  var newIndex = columns.findIndex(function (item) {
831
- return item['dataIndex'] === over;
784
+ return item.dataIndex === over;
832
785
  });
833
786
  filterChange === null || filterChange === void 0 ? void 0 : filterChange((_a = (0, _sortable.arrayMove)(columns, oldIndex, newIndex)) === null || _a === void 0 ? void 0 : _a.map(function (item, index) {
834
787
  return Object.assign(Object.assign({}, item), {
@@ -841,55 +794,21 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
841
794
  var handleDelete = function handleDelete(key) {
842
795
  var nValue = dataSource.filter(function (item) {
843
796
  return item[_rowKey] !== key;
844
- }); // onChange?.(nValue)
845
-
797
+ });
846
798
  setDataSource(nValue);
847
799
  };
848
- /** 点击添加按钮添加 */
800
+ /** 点击底部添加按钮添加 */
849
801
 
850
802
 
851
- var handleAdd = function handleAdd(row) {
803
+ var handleAdd = (0, _lodash.debounce)(function (row) {
852
804
  var _a;
853
805
 
854
806
  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;
855
807
  var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
856
808
  draft.push(Object.assign((0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())), addDataInfo || {}));
857
809
  });
858
- setDataSource(res); // onChange?.(res)
859
- };
860
-
861
- (0, _react.useEffect)(function () {
862
- var _a;
863
-
864
- dataSourceRef.current = dataSource;
865
- deepDataSourceRef.current = (0, _util.deepDataSourcePreKeys)(dataSource, _rowKey);
866
-
867
- if (sortOpen) {
868
- var dataSourceKeys = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
869
- return item[_rowKey];
870
- }).join(',');
871
- var setCallBackFalgKeys = ((_a = sortDataSorceRef.current) === null || _a === void 0 ? void 0 : _a.map(function (item) {
872
- return item[_rowKey];
873
- }).join(',')) || '';
874
-
875
- if (dataSourceKeys !== setCallBackFalgKeys) {
876
- setCallBackFalg(dataSource);
877
- sortDataSorceRef.current = dataSource;
878
- }
879
- }
880
- }, [dataSource]); // /** 本地缓存一个选择数据 */
881
- // useEffect(() => {
882
- // if (rowSelection) {
883
- // const { selectedRowKeys } = rowSelection
884
- // if (selectedRowKeys) {
885
- // setLocalRowSelectList(localRowSelectList || [])
886
- // }
887
- // }
888
- // }, [rowSelection])
889
- // const editTableRowChange = (selectRows) => {
890
- // setLocalRowSelectList(selectRows);
891
- // // (rowSelection?.onChange as any)?.(selectRows)
892
- // }
810
+ setDataSource(res);
811
+ }, 40);
893
812
 
894
813
  var handleSave = function handleSave(row, options) {
895
814
  var _a, _b;
@@ -897,9 +816,9 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
897
816
  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;
898
817
  var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
899
818
  if (options === null || options === void 0 ? void 0 : options.only) {
900
- var _ref2 = options === null || options === void 0 ? void 0 : options.only,
901
- key = _ref2.key,
902
- value = _ref2.value;
819
+ var _ref = options === null || options === void 0 ? void 0 : options.only,
820
+ key = _ref.key,
821
+ value = _ref.value;
903
822
 
904
823
  if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
905
824
  var deeps = function deeps(children) {
@@ -962,25 +881,26 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
962
881
  }
963
882
  });
964
883
  setDataSource(res);
965
- };
966
-
967
- var reWriteOriginSource = function reWriteOriginSource(rowKey, rowValue, dataIndex, nextValue) {
968
- setDataSource(function (prevDataSource) {
969
- return prevDataSource === null || prevDataSource === void 0 ? void 0 : prevDataSource.map(function (item) {
970
- if ((0, _lodash.get)(item, rowKey) === rowValue) {
971
- (0, _lodash.set)(item, dataIndex, nextValue);
972
- }
884
+ }; // const reWriteOriginSource = (rowKey: string, rowValue, dataIndex: number, nextValue) => {
885
+ // setDataSource((prevDataSource) => {
886
+ // return prevDataSource?.map((item) => {
887
+ // if (get(item, rowKey) === rowValue) {
888
+ // set(item, dataIndex, nextValue)
889
+ // }
890
+ // return item
891
+ // })
892
+ // })
893
+ // }
894
+ // @ts-ignore
973
895
 
974
- return item;
975
- });
976
- });
977
- }; // @ts-ignore
896
+ /** 删除当前行 */
978
897
 
979
898
 
980
- var handleTableRowDelete = function handleTableRowDelete(key) {
899
+ var handleTableRowDelete = (0, _lodash.debounce)(function (key) {
981
900
  var _a, _b, _c;
982
901
 
983
- var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.preKeys;
902
+ var rkey = (0, _lodash.isObject)(key) ? key[_rowKey] : key;
903
+ 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;
984
904
 
985
905
  if (preKeys.length > 1) {
986
906
  /** 说明删除的是children中的数据 */
@@ -1001,7 +921,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1001
921
  return newData;
1002
922
  };
1003
923
 
1004
- var res = filter(dataSource, key);
924
+ var res = filter(dataSourceRef.current, key);
1005
925
  setDataSource(res);
1006
926
  } else {
1007
927
  if (((_c = dataSourceRef.current) === null || _c === void 0 ? void 0 : _c.length) === 1 && !quickOpetateClearAll) {
@@ -1020,34 +940,76 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1020
940
 
1021
941
  setDataSource(_res);
1022
942
  }
1023
- };
1024
- /** 快捷添加 */
1025
943
 
944
+ return null;
945
+ }, 40);
946
+ /** 替换当前行 */
1026
947
 
1027
- var handleTableRowAdd = function handleTableRowAdd(record, isAppendInChindren) {
948
+ var handleTableRowReplace = (0, _lodash.debounce)(function (record, defaultRecord) {
1028
949
  var _a, _b;
1029
950
 
1030
- var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[record[_rowKey]]) === null || _b === void 0 ? void 0 : _b.preKeys;
951
+ var rkey = (0, _lodash.isObject)(record) ? record[_rowKey] : record;
952
+ 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)
953
+
954
+ var deep = function deep(children) {
955
+ return children.map(function (item) {
956
+ if (item[_rowKey] === rkey) {
957
+ return defaultRecord;
958
+ } else if (preKeys.includes(item[_rowKey]) && item.children) {
959
+ var child = deep(item.children);
960
+ return Object.assign(Object.assign({}, item), {
961
+ children: child
962
+ });
963
+ } else {
964
+ return item;
965
+ }
966
+ });
967
+ };
968
+
969
+ var res = deep(dataSourceRef.current);
970
+ setDataSource(res);
971
+ }, 40);
972
+ /** 快捷添加 */
973
+
974
+ var handleTableRowAdd = (0, _lodash.debounce)(function (record, isAppendInChindren, defaultRecord) {
975
+ var _a, _b;
976
+
977
+ var rkey = (0, _lodash.isObject)(record) ? record[_rowKey] : record;
978
+ 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;
1031
979
  var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
1032
- var _a, _b, _c, _d;
980
+ var _a, _b, _c, _d, _e;
1033
981
 
1034
- if (preKeys.length > 1) {
982
+ if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
1035
983
  var deeps = function deeps(children) {
1036
984
  children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
1037
- var _a;
985
+ var _a, _b;
1038
986
 
1039
987
  if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
1040
- if (item[_rowKey] === record[_rowKey]) {
988
+ if (item[_rowKey] === rkey) {
1041
989
  if (isAppendInChindren) {
1042
990
  if (item === null || item === void 0 ? void 0 : item.children) {
1043
- (_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.push((0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
991
+ if (Array.isArray(defaultRecord)) {
992
+ var _a2;
993
+
994
+ (_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));
995
+ } else {
996
+ (_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())));
997
+ }
1044
998
  } else {
1045
- item.children = [(0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
999
+ if (Array.isArray(defaultRecord)) {
1000
+ item.children = (0, _toConsumableArray2.default)(defaultRecord);
1001
+ } else {
1002
+ item.children = [defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
1003
+ }
1046
1004
  }
1047
1005
 
1048
1006
  !expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat((0, _toConsumableArray2.default)(expandedRowKeys), [item[_rowKey]]));
1049
1007
  } else {
1050
- children.splice(index + 1, 0, (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1008
+ if (Array.isArray(defaultRecord)) {
1009
+ children.splice.apply(children, [index + 1, 0].concat((0, _toConsumableArray2.default)(defaultRecord)));
1010
+ } else {
1011
+ children.splice(index + 1, 0, defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1012
+ }
1051
1013
  }
1052
1014
  } else if (item.children) {
1053
1015
  deeps(item.children);
@@ -1059,31 +1021,44 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1059
1021
  deeps(draft);
1060
1022
  } else {
1061
1023
  var index = draft.findIndex(function (item) {
1062
- return record[_rowKey] === item[_rowKey];
1024
+ return rkey === item[_rowKey];
1063
1025
  });
1064
1026
 
1065
1027
  if (index !== -1) {
1066
1028
  if (isAppendInChindren) {
1067
1029
  if ((_a = draft[index].children) === null || _a === void 0 ? void 0 : _a.length) {
1068
- (_b = draft[index].children) === null || _b === void 0 ? void 0 : _b.push((0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1030
+ if (Array.isArray(defaultRecord)) {
1031
+ var _b2;
1032
+
1033
+ (_b = draft[index].children) === null || _b === void 0 ? void 0 : (_b2 = _b).push.apply(_b2, (0, _toConsumableArray2.default)(defaultRecord));
1034
+ } else {
1035
+ (_c = draft[index].children) === null || _c === void 0 ? void 0 : _c.push(defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1036
+ }
1069
1037
  } else {
1070
- draft[index].children = [(0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
1038
+ draft[index].children = Array.isArray(defaultRecord) ? (0, _toConsumableArray2.default)(defaultRecord) : [defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
1071
1039
  }
1072
1040
 
1073
- !expandedRowKeys.includes((_c = draft[index]) === null || _c === void 0 ? void 0 : _c[_rowKey]) && setExpandedRowKeys([].concat((0, _toConsumableArray2.default)(expandedRowKeys), [(_d = draft[index]) === null || _d === void 0 ? void 0 : _d[_rowKey]]));
1041
+ !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]]));
1074
1042
  } else {
1075
- draft.splice(index + 1, 0, (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1043
+ if (Array.isArray(defaultRecord)) {
1044
+ draft.splice.apply(draft, [index + 1, 0].concat((0, _toConsumableArray2.default)(defaultRecord)));
1045
+ } else {
1046
+ draft.splice(index + 1, 0, defaultRecord || (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1047
+ }
1076
1048
  }
1077
1049
  }
1078
1050
  }
1079
1051
  });
1080
1052
  setDataSource(res);
1081
- };
1053
+ }, 50);
1054
+ /** 快捷刷子功能 */
1082
1055
 
1083
- var handleCopy = function handleCopy(key, value) {
1056
+ var handleCopy = function handleCopy(key, value, type, rowIndex) {
1084
1057
  var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
1085
- draft === null || draft === void 0 ? void 0 : draft.forEach(function (item) {
1086
- return item[key] = value;
1058
+ draft === null || draft === void 0 ? void 0 : draft.forEach(function (item, index) {
1059
+ if (type === 'up' && index < rowIndex || type === 'down' && index > rowIndex) {
1060
+ item[key] = value;
1061
+ }
1087
1062
  });
1088
1063
  });
1089
1064
  setDataSource(res);
@@ -1092,17 +1067,16 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1092
1067
 
1093
1068
 
1094
1069
  var hasDisableOptions = (0, _react.useMemo)(function () {
1095
- // const hasOnlyOptionsDatas = columns.filter(item => item?.['componentProps']?.optionOnly)
1096
1070
  var hasOnlyOptionsDatas = columns.filter(function (item) {
1097
1071
  var _a;
1098
1072
 
1099
1073
  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;
1100
1074
  return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
1101
- });
1075
+ }); // const hasOnlyOptionsDatas = columns.filter((item) => item?.componentProps?.optionOnly)
1102
1076
 
1103
1077
  if (hasOnlyOptionsDatas.length) {
1104
1078
  return hasOnlyOptionsDatas === null || hasOnlyOptionsDatas === void 0 ? void 0 : hasOnlyOptionsDatas.map(function (item) {
1105
- return item['dataIndex'];
1079
+ return item.dataIndex;
1106
1080
  });
1107
1081
  }
1108
1082
 
@@ -1114,12 +1088,11 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1114
1088
  var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
1115
1089
  var _a;
1116
1090
 
1117
- var resultComponentProps = (0, _lodash.isFunction)(item.componentProps) ? (_a = item === null || item === void 0 ? void 0 : item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item === null || item === void 0 ? void 0 : item.componentProps;
1118
-
1119
- var _ref5 = resultComponentProps || {},
1120
- optionOnly = _ref5.optionOnly,
1121
- options = _ref5.options; // const { optionOnly, options } = item['componentProps'] || {}
1091
+ var resultComponentProps = (0, _lodash.isFunction)(item.componentProps) ? (_a = item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item.componentProps;
1122
1092
 
1093
+ var _ref8 = resultComponentProps || {},
1094
+ optionOnly = _ref8.optionOnly,
1095
+ options = _ref8.options;
1123
1096
 
1124
1097
  if (optionOnly && options) {
1125
1098
  var dataIndex = item.dataIndex;
@@ -1139,7 +1112,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1139
1112
  }
1140
1113
 
1141
1114
  return Object.assign(Object.assign({}, item), {
1142
- componentProps: Object.assign(Object.assign({}, item['componentProps']), {
1115
+ componentProps: Object.assign(Object.assign({}, item.componentProps), {
1143
1116
  options: newOptions
1144
1117
  })
1145
1118
  });
@@ -1158,16 +1131,46 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1158
1131
  var rColumns = hasDisableOptions ? DisableOptions : columns;
1159
1132
  var localColumns = [sortOpen ? {
1160
1133
  title: '排序',
1161
- dataIndex: 'sort',
1134
+ dataIndex: '_sort',
1162
1135
  width: 48,
1163
1136
  maxWidth: 48,
1164
1137
  className: 'drag-visible',
1138
+ fixed: 'left',
1165
1139
  render: function render(_, record) {
1166
1140
  return /*#__PURE__*/_react.default.createElement(_DragHandle.default, {
1167
- id: record[_rowKey] || record.id
1141
+ id: (record === null || record === void 0 ? void 0 : record[_rowKey]) || (record === null || record === void 0 ? void 0 : record.id)
1168
1142
  });
1169
1143
  }
1170
- } : null].concat((0, _toConsumableArray2.default)(rColumns), [useQuickOpetate ? {
1144
+ } : null, indexCol ? (0, _lodash.isBoolean)(indexCol) ? {
1145
+ title: '',
1146
+ dataIndex: '_index',
1147
+ width: 48,
1148
+ maxWidth: 48,
1149
+ ellipsis: true,
1150
+ fixed: 'left',
1151
+ render: function render(_, record, index) {
1152
+ var _a, _b, _c;
1153
+
1154
+ 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);
1155
+ }
1156
+ } : Object.assign(Object.assign({
1157
+ title: '',
1158
+ dataIndex: '_index',
1159
+ width: 48,
1160
+ ellipsis: true,
1161
+ maxWidth: 48,
1162
+ fixed: 'left'
1163
+ }, indexCol || {}), {
1164
+ render: function render(_, record, index) {
1165
+ var _a, _b, _c, _d, _e, _f;
1166
+
1167
+ if ((0, _lodash.isFunction)(indexCol === null || indexCol === void 0 ? void 0 : indexCol.render)) {
1168
+ 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']);
1169
+ }
1170
+
1171
+ 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);
1172
+ }
1173
+ }) : null].concat((0, _toConsumableArray2.default)(rColumns), [useQuickOpetate ? {
1171
1174
  title: '操作',
1172
1175
  dataIndex: 'lm_edit_opetate',
1173
1176
  width: 68,
@@ -1178,11 +1181,11 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1178
1181
  options: Array.isArray(useQuickOpetate) ? useQuickOpetate : ['add', 'delete']
1179
1182
  }
1180
1183
  } : null]).filter(function (item) {
1181
- return item && item.show !== false;
1184
+ return item && (item === null || item === void 0 ? void 0 : item.show) !== false;
1182
1185
  });
1183
- localColumns = localColumns.map(function (item, index) {
1186
+ localColumns = localColumns === null || localColumns === void 0 ? void 0 : localColumns.map(function (item, index) {
1184
1187
  return Object.assign(Object.assign({}, item), {
1185
- order: [null, undefined].includes(item['order']) ? index : item['order']
1188
+ order: [null, undefined].includes(item.order) ? index : item.order
1186
1189
  });
1187
1190
  }).sort(function (a, b) {
1188
1191
  return a.order - b.order;
@@ -1205,29 +1208,22 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1205
1208
  var mapColumns = function mapColumns(col, index) {
1206
1209
  var _a, _b;
1207
1210
 
1208
- if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length)) {
1209
- return col;
1210
- }
1211
-
1212
- var newCol = Object.assign(Object.assign({}, col), {
1213
- shouldCellUpdate: function shouldCellUpdate(record, prevRecord) {
1214
- var _a;
1215
-
1216
- var dataIndex = col.dataIndex,
1217
- editable = col.editable,
1218
- relevanceCols = col.relevanceCols,
1219
- componentProps = col.componentProps;
1211
+ if (!col.editable && !((_a = col.children) === null || _a === void 0 ? void 0 : _a.length) && (col === null || col === void 0 ? void 0 : col.dataIndex) === '_sort') {
1212
+ var fn = col === null || col === void 0 ? void 0 : col.render;
1213
+ return Object.assign(Object.assign({}, col), {
1214
+ render: function render(text, record, i) {
1215
+ var _a;
1220
1216
 
1221
- if (componentProps && (0, _lodash.isFunction)(componentProps)) {
1222
- return true;
1217
+ return fn === null || fn === void 0 ? void 0 : fn((_a = dataSource[i]) === null || _a === void 0 ? void 0 : _a[col.dataIndex], dataSource[i], i);
1223
1218
  }
1219
+ });
1220
+ }
1224
1221
 
1225
- if ((col === null || col === void 0 ? void 0 : col.fixed) || hasDisableOptions && hasDisableOptions.includes(dataIndex) || ((_a = col.componentProps) === null || _a === void 0 ? void 0 : _a.options) || editable === 'render' || !!relevanceCols || !!shouldUpdate || !!record.children) {
1226
- return true;
1227
- }
1222
+ if (isEdit && (col === null || col === void 0 ? void 0 : col.render) && (col === null || col === void 0 ? void 0 : col.editable) === 'render') {
1223
+ delete col.render;
1224
+ }
1228
1225
 
1229
- return record[dataIndex] !== prevRecord[dataIndex];
1230
- },
1226
+ var newCol = Object.assign({
1231
1227
  onCell: function onCell(record, rowIndex) {
1232
1228
  return {
1233
1229
  getLength: dataSource.length,
@@ -1242,7 +1238,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1242
1238
  editable: col.editable,
1243
1239
  dataIndex: col.dataIndex,
1244
1240
  itemProps: col.itemProps,
1245
- setValid: setValid,
1241
+ shouldUpdate: shouldUpdate,
1246
1242
  isEdit: isEdit,
1247
1243
  isHoverEdit: isHoverEdit,
1248
1244
  handleAdd: handleAdd,
@@ -1250,11 +1246,10 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1250
1246
  handleCopy: handleCopy,
1251
1247
  editEnum: typeof col.editEnum === 'function' ? col.editEnum(record) : col.editEnum,
1252
1248
  valueType: typeof col.valueType === 'function' ? col.valueType(record) : col.valueType,
1253
- handleSave: handleSave,
1254
- reWriteOriginSource: reWriteOriginSource
1249
+ handleSave: handleSave
1255
1250
  };
1256
1251
  }
1257
- });
1252
+ }, col);
1258
1253
 
1259
1254
  if (col === null || col === void 0 ? void 0 : col.children) {
1260
1255
  newCol.children = (_b = col.children) === null || _b === void 0 ? void 0 : _b.map(mapColumns);
@@ -1263,24 +1258,23 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1263
1258
  return newCol;
1264
1259
  };
1265
1260
 
1266
- var res = localColumns.map(function (col, index) {
1261
+ var res = localColumns === null || localColumns === void 0 ? void 0 : localColumns.map(function (col, index) {
1267
1262
  return mapColumns(col, index);
1268
1263
  });
1269
1264
  return res;
1270
- }, [columns, isAdd, sortOpen, useQuickOpetate, sortEditTable, dataSource, (0, _toConsumableArray2.default)(memoOptions)]);
1271
- var DraggableContainer = (0, _react.useCallback)(function (_a) {
1272
- var _b;
1265
+ }, [columns, isAdd, sortOpen, useQuickOpetate, dataSource, (0, _toConsumableArray2.default)(memoOptions)]);
1273
1266
 
1274
- var props = __rest(_a, []);
1267
+ var onSortEnd = function onSortEnd(active, over) {
1268
+ var cloneArr = (0, _toConsumableArray2.default)(dataSourceRef.current);
1269
+ var oldIndex = cloneArr.findIndex(function (v) {
1270
+ return v[_rowKey] === active;
1271
+ });
1272
+ var newIndex = cloneArr.findIndex(function (v) {
1273
+ return v[_rowKey] === over;
1274
+ });
1275
+ setDataSource((0, _sortable.arrayMove)(cloneArr, oldIndex, newIndex));
1276
+ };
1275
1277
 
1276
- return /*#__PURE__*/_react.default.createElement(_DndContainer.default, {
1277
- move: onSortEnd
1278
- }, /*#__PURE__*/_react.default.createElement(_sortableBox.default, {
1279
- items: (_b = dataSourceRef.current) === null || _b === void 0 ? void 0 : _b.map(function (item) {
1280
- return item[_rowKey];
1281
- })
1282
- }, /*#__PURE__*/_react.default.createElement("tbody", Object.assign({}, props))));
1283
- }, [sortEditTable]);
1284
1278
  var colDraggableContainer = (0, _react.useCallback)(function (_a) {
1285
1279
  var _b;
1286
1280
 
@@ -1298,40 +1292,18 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1298
1292
  }, child);
1299
1293
  }));
1300
1294
  }, [columns]);
1301
- var config = (0, _react.useMemo)(function () {
1302
- var component = {
1303
- body: Object.assign({
1304
- row: sortOpen ? EditableSortRow : EditableRow,
1305
- cell: EditableCell
1306
- }, sortOpen ? {
1307
- wrapper: DraggableContainer
1308
- } : {})
1309
- };
1310
-
1311
- if (colSortOpen) {
1312
- component['header'] = {
1313
- row: colDraggableContainer
1314
- };
1315
- }
1316
-
1317
- return Object.assign({
1318
- pagination: false,
1319
- tableLayout: 'fixed',
1320
- scroll: {
1321
- x: '100%'
1322
- },
1323
- rowKey: function rowKey(record) {
1324
- return record[_rowKey] || record.index || Math.random();
1325
- },
1326
- components: component
1327
- }, resetProps);
1328
- }, [resultColumns, dataSource, sortOpen, colSortOpen, size]);
1329
1295
  (0, _react.useImperativeHandle)(ref, function () {
1330
1296
  return {
1331
1297
  setRow: handleSave,
1332
1298
  getCheckboxRecords: function getCheckboxRecords() {
1333
1299
  return localRowSelectList.selectedRows;
1334
1300
  },
1301
+ deleteRowData: function deleteRowData(data) {
1302
+ return handleTableRowDelete(data);
1303
+ },
1304
+ addRowData: function addRowData(data, defaultValue, addInChild) {
1305
+ return addInChild === 'replace' ? handleTableRowReplace(data, defaultValue) : handleTableRowAdd(data, addInChild, defaultValue);
1306
+ },
1335
1307
  clearSelect: function clearSelect() {
1336
1308
  setLocalRowSelectList({
1337
1309
  selectedRows: []
@@ -1342,8 +1314,241 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1342
1314
  selectedRows: value
1343
1315
  });
1344
1316
  },
1345
- valid: function valid() {
1346
- return _valid;
1317
+ columns: columns.map(function (item) {
1318
+ return (0, _lodash.omit)(item, ['render', 'sorter', 'onFilter', 'filters', 'componentProps', 'formProps', 'editable']);
1319
+ }),
1320
+ // verify: async () => {
1321
+ // let allRule = {}
1322
+ // let time
1323
+ // let fullNum = 0
1324
+ // columns.forEach((col: any) => {
1325
+ // if (col?.formProps?.rules) {
1326
+ // allRule[col.dataIndex] = col?.formProps?.rules || []
1327
+ // }
1328
+ // })
1329
+ // const validator = new AsyncValidator(allRule);
1330
+ // let flag = true
1331
+ // let messageIndex = null
1332
+ // let errorRowKey = null
1333
+ // let errorInfo = null
1334
+ // const deepValidator = async (data, index) => {
1335
+ // for (let i = 0; i < data.length; i++) {
1336
+ // if (flag) {
1337
+ // try {
1338
+ // await validator.validate(data[i], (errors, fields) => {
1339
+ // if (errors) {
1340
+ // errorInfo = { errors, fields, value: data[i] };
1341
+ // flag = false
1342
+ // messageIndex = index === null ? i : index
1343
+ // errorRowKey = data?.[i]?.[rowKey]
1344
+ // } else if (data[i].children) {
1345
+ // deepValidator(data[i].children, i)
1346
+ // }
1347
+ // })
1348
+ // } catch (error) {
1349
+ // break;
1350
+ // }
1351
+ // }
1352
+ // }
1353
+ // }
1354
+ // await deepValidator(dataSource, null)
1355
+ // console.log(flag, 'fff')
1356
+ // if (flag) {
1357
+ // return Promise.resolve(dataSource)
1358
+ // } else {
1359
+ // setTimeout(() => {
1360
+ // if (messageIndex !== null) {
1361
+ // scrollToIndexRef.current?.(messageIndex, { align: 'center' })
1362
+ // time = setInterval(async () => {
1363
+ // fullNum++
1364
+ // if (fullNum > 5) {
1365
+ // clearInterval(time)
1366
+ // } else {
1367
+ // const form = (Object.values(allFormListRef.current || []).find((item: any) => item.key === errorRowKey) as any)?.form
1368
+ // if (form) {
1369
+ // try {
1370
+ // await form.validateFields()
1371
+ // console.log('验证成功')
1372
+ // } catch (error) {
1373
+ // console.log('验证失败', error)
1374
+ // return error
1375
+ // } finally {
1376
+ // clearInterval(time)
1377
+ // }
1378
+ // }
1379
+ // }
1380
+ // }, 500)
1381
+ // }
1382
+ // }, 100)
1383
+ // return Promise.reject(errorInfo)
1384
+ // }
1385
+ // },
1386
+ verify: function verify() {
1387
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
1388
+ var time, fullNum, flag, messageIndex, errorRowKey, errorInfo, deepValidator;
1389
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
1390
+ while (1) {
1391
+ switch (_context4.prev = _context4.next) {
1392
+ case 0:
1393
+ fullNum = 0;
1394
+ flag = true;
1395
+ messageIndex = null;
1396
+ errorRowKey = null;
1397
+ errorInfo = null;
1398
+
1399
+ deepValidator = function deepValidator(data, index) {
1400
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
1401
+ var _c, i;
1402
+
1403
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
1404
+ while (1) {
1405
+ switch (_context2.prev = _context2.next) {
1406
+ case 0:
1407
+ i = 0;
1408
+
1409
+ case 1:
1410
+ if (!(i < data.length)) {
1411
+ _context2.next = 23;
1412
+ break;
1413
+ }
1414
+
1415
+ if (!flag) {
1416
+ _context2.next = 20;
1417
+ break;
1418
+ }
1419
+
1420
+ _context2.prev = 3;
1421
+ checkForm.resetFields();
1422
+ checkForm.setFieldsValue(data[i]);
1423
+ _context2.next = 8;
1424
+ return checkForm.validateFields();
1425
+
1426
+ case 8:
1427
+ if (!data[i].children) {
1428
+ _context2.next = 11;
1429
+ break;
1430
+ }
1431
+
1432
+ _context2.next = 11;
1433
+ return deepValidator(data[i].children, i);
1434
+
1435
+ case 11:
1436
+ _context2.next = 20;
1437
+ break;
1438
+
1439
+ case 13:
1440
+ _context2.prev = 13;
1441
+ _context2.t0 = _context2["catch"](3);
1442
+ errorInfo = {
1443
+ error: _context2.t0,
1444
+ value: data[i]
1445
+ };
1446
+ flag = false;
1447
+ messageIndex = index === null ? i : index;
1448
+ errorRowKey = (_c = data === null || data === void 0 ? void 0 : data[i]) === null || _c === void 0 ? void 0 : _c[_rowKey];
1449
+ return _context2.abrupt("break", 23);
1450
+
1451
+ case 20:
1452
+ i++;
1453
+ _context2.next = 1;
1454
+ break;
1455
+
1456
+ case 23:
1457
+ case "end":
1458
+ return _context2.stop();
1459
+ }
1460
+ }
1461
+ }, _callee2, null, [[3, 13]]);
1462
+ }));
1463
+ };
1464
+
1465
+ _context4.next = 8;
1466
+ return deepValidator(dataSource, null);
1467
+
1468
+ case 8:
1469
+ if (!flag) {
1470
+ _context4.next = 12;
1471
+ break;
1472
+ }
1473
+
1474
+ return _context4.abrupt("return", Promise.resolve(dataSource));
1475
+
1476
+ case 12:
1477
+ setTimeout(function () {
1478
+ var _a;
1479
+
1480
+ if (messageIndex !== null) {
1481
+ (_a = scrollToIndexRef.current) === null || _a === void 0 ? void 0 : _a.call(scrollToIndexRef, messageIndex, {
1482
+ align: 'center'
1483
+ });
1484
+ time = setInterval(function () {
1485
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {
1486
+ var _b, form;
1487
+
1488
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
1489
+ while (1) {
1490
+ switch (_context3.prev = _context3.next) {
1491
+ case 0:
1492
+ fullNum++;
1493
+
1494
+ if (!(fullNum > 5)) {
1495
+ _context3.next = 5;
1496
+ break;
1497
+ }
1498
+
1499
+ clearInterval(time);
1500
+ _context3.next = 20;
1501
+ break;
1502
+
1503
+ case 5:
1504
+ form = (_b = Object.values(allFormListRef.current || []).find(function (item) {
1505
+ return item.key === errorRowKey;
1506
+ })) === null || _b === void 0 ? void 0 : _b.form;
1507
+
1508
+ if (!form) {
1509
+ _context3.next = 20;
1510
+ break;
1511
+ }
1512
+
1513
+ _context3.prev = 7;
1514
+ _context3.next = 10;
1515
+ return form.validateFields();
1516
+
1517
+ case 10:
1518
+ console.log('验证成功');
1519
+ _context3.next = 17;
1520
+ break;
1521
+
1522
+ case 13:
1523
+ _context3.prev = 13;
1524
+ _context3.t0 = _context3["catch"](7);
1525
+ console.log('验证失败', _context3.t0);
1526
+ return _context3.abrupt("return", _context3.t0);
1527
+
1528
+ case 17:
1529
+ _context3.prev = 17;
1530
+ clearInterval(time);
1531
+ return _context3.finish(17);
1532
+
1533
+ case 20:
1534
+ case "end":
1535
+ return _context3.stop();
1536
+ }
1537
+ }
1538
+ }, _callee3, null, [[7, 13, 17, 20]]);
1539
+ }));
1540
+ }, 300);
1541
+ }
1542
+ }, 100);
1543
+ return _context4.abrupt("return", Promise.reject(errorInfo));
1544
+
1545
+ case 14:
1546
+ case "end":
1547
+ return _context4.stop();
1548
+ }
1549
+ }
1550
+ }, _callee4);
1551
+ }));
1347
1552
  }
1348
1553
  };
1349
1554
  });
@@ -1351,22 +1556,121 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1351
1556
  return isEdit && isAdd || isHoverEdit && isAdd;
1352
1557
  }, [isEdit, isAdd, isHoverEdit]);
1353
1558
 
1559
+ var pushAllForm = function pushAllForm(form, key, index) {
1560
+ allFormListRef.current[key] = {
1561
+ form: form,
1562
+ key: key,
1563
+ index: index
1564
+ };
1565
+ };
1566
+
1567
+ var config = (0, _react.useRef)(Object.assign({
1568
+ pagination: false,
1569
+ tableLayout: 'fixed',
1570
+ scroll: {
1571
+ x: '100%'
1572
+ },
1573
+ rowKey: function rowKey(record) {
1574
+ return record[_rowKey] || record.index || Math.random();
1575
+ },
1576
+ components: {
1577
+ table: virtual ? function (props) {
1578
+ return /*#__PURE__*/_react.default.createElement(_virtual.VirtualTable, Object.assign({}, props, {
1579
+ fn: scrollToIndexRef
1580
+ }));
1581
+ } : null,
1582
+ body: Object.assign({
1583
+ row: function row(rowProps) {
1584
+ return sortOpen ? EditableSortRow(Object.assign(Object.assign({}, rowProps), {
1585
+ virtual: virtual
1586
+ })) : EditableRow(Object.assign(Object.assign({}, rowProps), {
1587
+ virtual: virtual
1588
+ }));
1589
+ },
1590
+ cell: props.shouldUpdate ? EditableCell : MemoEditableCell
1591
+ }, sortOpen ? {
1592
+ wrapper: function wrapper(wrapperProps) {
1593
+ var _a, _b, _c;
1594
+
1595
+ return (0, _components.DraggableContainer)(Object.assign(Object.assign({}, wrapperProps), {
1596
+ virtual: virtual,
1597
+ keys: (_a = dataSourceRef.current) === null || _a === void 0 ? void 0 : _a.map(function (item) {
1598
+ return item[_rowKey];
1599
+ }),
1600
+ options: dataSourceRef.current,
1601
+ rowKey: _rowKey,
1602
+ onSortEnd: onSortEnd,
1603
+ tableWidth: (_c = (_b = tableWarpRef === null || tableWarpRef === void 0 ? void 0 : tableWarpRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect()) === null || _c === void 0 ? void 0 : _c.width
1604
+ }));
1605
+ }
1606
+ } : virtual ? {
1607
+ wrapper: _virtual.VirtualWrapper
1608
+ } : {}),
1609
+ header: {
1610
+ row: colSortOpen ? colDraggableContainer : null
1611
+ }
1612
+ },
1613
+ onRow: function onRow(record, index) {
1614
+ var _a;
1615
+
1616
+ return {
1617
+ disabled: disabled || !!((_a = disabledDataSourceRowKeys.current) === null || _a === void 0 ? void 0 : _a.includes(record[_rowKey])),
1618
+ dataKey: record[_rowKey],
1619
+ index: index,
1620
+ pushAllForm: pushAllForm
1621
+ };
1622
+ }
1623
+ }, resetProps));
1624
+ (0, _react.useEffect)(function () {
1625
+ var _a;
1626
+
1627
+ if (autoSizer) {
1628
+ var tableClient = (_a = tableWarpRef === null || tableWarpRef === void 0 ? void 0 : tableWarpRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
1629
+ var height = (tableClient === null || tableClient === void 0 ? void 0 : tableClient.height) || '100%';
1630
+ var TailorHeight = size === 'middle' ? 48 : 40;
1631
+
1632
+ if (isAdd) {
1633
+ TailorHeight += 48;
1634
+ }
1635
+
1636
+ if (props.summary) {
1637
+ TailorHeight += 48;
1638
+ }
1639
+
1640
+ if (props.pagination) {
1641
+ TailorHeight += 48;
1642
+ }
1643
+
1644
+ autoSizerRef.current = {
1645
+ width: tableClient === null || tableClient === void 0 ? void 0 : tableClient.width,
1646
+ height: typeof height === 'string' ? "calc(".concat(height, " - ").concat(TailorHeight, "px)") : height - TailorHeight
1647
+ };
1648
+ }
1649
+ }, []);
1650
+
1354
1651
  if (colSortOpen) {
1355
1652
  return /*#__PURE__*/_react.default.createElement("div", {
1356
- className: "lm_editTable_warpper"
1653
+ className: "lm_editTable_warpper",
1654
+ ref: tableWarpRef
1655
+ }, /*#__PURE__*/_react.default.createElement(_ConfigProvider.default, {
1656
+ renderEmpty: loading ? function () {
1657
+ return null;
1658
+ } : _components.CustomizeRenderEmpty
1357
1659
  }, /*#__PURE__*/_react.default.createElement(_DndContainer.default, {
1660
+ rowKey: _rowKey,
1661
+ options: resultColumns,
1358
1662
  move: onColSortEnd
1359
1663
  }, /*#__PURE__*/_react.default.createElement(_sortableBoxCol.default, {
1360
1664
  items: columns.reduce(function (acc, item) {
1361
1665
  return [].concat((0, _toConsumableArray2.default)(acc), [item.dataIndex]);
1362
1666
  }, [])
1363
- }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Table, Object.assign({}, config, {
1667
+ }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Table, Object.assign({}, (0, _util.checkDataSourceIsEmpty)(config.current, dataSourceRef.current, autoSizerRef.current), {
1668
+ loading: loading,
1364
1669
  size: size || 'small',
1365
1670
  columns: resultColumns,
1366
1671
  rowClassName: "editable-row",
1367
1672
  bordered: true,
1368
1673
  pagination: false,
1369
- // components={tableComponents}
1370
1674
  rowSelection: !rowSelection ? undefined : Object.assign(Object.assign({
1371
1675
  fixed: true,
1372
1676
  type: 'checkbox',
@@ -1376,36 +1680,59 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1376
1680
  return (0, _lodash.isObject)(v) ? v[_rowKey] : v;
1377
1681
  }),
1378
1682
  onChange: function onChange(selectedRowKeys, selectedRows, info) {
1379
- // editTableRowChange(selectedRowKeys, selectedRows, info)
1380
1683
  setLocalRowSelectList(selectedRowKeys, selectedRows, info);
1381
1684
  }
1382
1685
  }),
1383
1686
  dataSource: dataSource
1384
- })))), isShowAddAction && /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
1385
- className: "lm_editTable_add_bar",
1386
- type: "dashed",
1387
- onClick: handleAdd,
1687
+ }))))), /*#__PURE__*/_react.default.createElement(_components.BottomOpetateComponent, {
1688
+ disabled: disabled,
1689
+ isShowAddAction: isShowAddAction,
1690
+ recordCreatorProps: recordCreatorProps,
1691
+ handleAdd: handleAdd
1692
+ }), /*#__PURE__*/_react.default.createElement("div", {
1388
1693
  style: {
1389
- marginTop: 8
1694
+ display: 'none'
1390
1695
  }
1391
- }, /*#__PURE__*/_react.default.createElement(_icons.PlusCircleOutlined, {
1392
- className: "lmweb-plus"
1393
- }), "\u65B0\u589E"));
1696
+ }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form, {
1697
+ form: checkForm,
1698
+ component: false
1699
+ }, columns.map(function (item) {
1700
+ return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form.Item, Object.assign({
1701
+ noStyle: true,
1702
+ key: item.dataIndex,
1703
+ name: item.dataIndex
1704
+ }, (item === null || item === void 0 ? void 0 : item['formProps']) || {}), item.dataIndex || 'text');
1705
+ }))));
1394
1706
  } // @ts-ignore
1395
1707
 
1396
1708
 
1397
1709
  return /*#__PURE__*/_react.default.createElement("div", {
1398
- className: "lm_editTable_warpper"
1399
- }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Table, Object.assign({}, config, {
1710
+ className: (0, _classnames.default)('lm_editTable_warpper', autoSizer && 'lm_editable_autosize'),
1711
+ ref: tableWarpRef
1712
+ }, /*#__PURE__*/_react.default.createElement(_ConfigProvider.default, {
1713
+ renderEmpty: loading ? function () {
1714
+ return null;
1715
+ } : _components.CustomizeRenderEmpty
1716
+ }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Table, Object.assign({}, (0, _util.checkDataSourceIsEmpty)(config.current, dataSourceRef.current, autoSizerRef.current), {
1400
1717
  size: size || 'small',
1401
1718
  columns: resultColumns,
1402
1719
  rowClassName: "editable-row",
1403
1720
  bordered: true,
1721
+ loading: loading,
1722
+ style: autoSizer ? {
1723
+ height: isAdd ? "calc(100% - ".concat(48, "px)") : '100%'
1724
+ } : undefined,
1404
1725
  pagination: false,
1405
1726
  // components={tableComponents}
1406
1727
  expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
1407
1728
  expandedRowKeys: expandedRowKeys,
1408
1729
  fixed: true,
1730
+ // indentSize: 0,
1731
+ expandIconColumnIndex: (0, _util.checkExpandIconColumnIndex)({
1732
+ rowSelection: rowSelection,
1733
+ sortOpen: sortOpen,
1734
+ indexCol: indexCol
1735
+ }) || 0,
1409
1736
  onExpandedRowsChange: function onExpandedRowsChange(expandedRows) {
1410
1737
  return setExpandedRowKeys(expandedRows);
1411
1738
  }
@@ -1423,16 +1750,25 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1423
1750
  }
1424
1751
  }),
1425
1752
  dataSource: dataSource
1426
- })), isShowAddAction && /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
1427
- className: "lm_editTable_add_bar",
1428
- type: "dashed",
1429
- onClick: (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.customAddClick) || handleAdd,
1430
- style: Object.assign({
1431
- marginTop: 8
1432
- }, (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.style) || {})
1433
- }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
1434
- type: "lmweb-plus"
1435
- }), (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.creatorButtonText) || '新增'));
1753
+ }))), /*#__PURE__*/_react.default.createElement(_components.BottomOpetateComponent, {
1754
+ disabled: disabled,
1755
+ isShowAddAction: isShowAddAction,
1756
+ recordCreatorProps: recordCreatorProps,
1757
+ handleAdd: handleAdd
1758
+ }), /*#__PURE__*/_react.default.createElement("div", {
1759
+ style: {
1760
+ display: 'none'
1761
+ }
1762
+ }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form, {
1763
+ form: checkForm,
1764
+ component: false
1765
+ }, columns.map(function (item) {
1766
+ return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Form.Item, Object.assign({
1767
+ noStyle: true,
1768
+ key: item.dataIndex,
1769
+ name: item.dataIndex
1770
+ }, (item === null || item === void 0 ? void 0 : item['formProps']) || {}), item.dataIndex || 'text');
1771
+ }))));
1436
1772
  });
1437
1773
 
1438
1774
  var _default = /*#__PURE__*/(0, _react.memo)(EditTable);