linkmore-design 1.1.27-alpha.2 → 1.1.27-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -312897,6 +312897,7 @@
312897
312897
  var VirtualTable$1 = /*#__PURE__*/React__default['default'].memo(function (tableProps) {
312898
312898
  var _bodyRef$current, _tableProps$children$3, _tableProps$children$4, _bodyRef$current2;
312899
312899
 
312900
+ var fn = tableProps.fn;
312900
312901
  var bodyRef = React.useRef(null);
312901
312902
 
312902
312903
  var _useRealive = useRealive$1(),
@@ -312915,7 +312916,8 @@
312915
312916
  return state.rowHeight;
312916
312917
  }, [state.rowHeight]),
312917
312918
  overscan: 5
312918
- }); // 列动态宽度
312919
+ });
312920
+ fn.current = rowVirtual.scrollToIndex; // 列动态宽度
312919
312921
 
312920
312922
  var columnEstimateSize = React.useCallback(function (i) {
312921
312923
  var _tableProps$children$, _tableProps$children$2;
@@ -313022,6 +313024,8 @@
313022
313024
  var _excluded$2Q = ["children", "pref"];
313023
313025
 
313024
313026
  var useOptions$3 = function useOptions(_ref) {
313027
+ var _sliceColumns$centerC4;
313028
+
313025
313029
  var children = _ref.children,
313026
313030
  ref = _ref.ref,
313027
313031
  trRef = _ref.trRef;
@@ -313035,7 +313039,9 @@
313035
313039
  var rowHeight = state.rowHeight,
313036
313040
  totalLen = state.totalLen;
313037
313041
  var sliceColumns = React.useMemo(function () {
313038
- return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
313042
+ var _children$reduce;
313043
+
313044
+ return children === null || children === void 0 ? void 0 : (_children$reduce = children.reduce) === null || _children$reduce === void 0 ? void 0 : _children$reduce.call(children, function (pre, cur) {
313039
313045
  var _cur$props, _cur$props2;
313040
313046
 
313041
313047
  if (typeof ((_cur$props = cur.props) === null || _cur$props === void 0 ? void 0 : _cur$props.fixLeft) === 'number') {
@@ -313064,9 +313070,9 @@
313064
313070
  }, [sliceColumns]); // 非固定列长度
313065
313071
 
313066
313072
  var centerColumnsLen = React.useMemo(function () {
313067
- var _sliceColumns$centerC;
313073
+ var _sliceColumns$centerC, _sliceColumns$centerC2;
313068
313074
 
313069
- return (_sliceColumns$centerC = sliceColumns.centerColumns.length) !== null && _sliceColumns$centerC !== void 0 ? _sliceColumns$centerC : 0;
313075
+ return (_sliceColumns$centerC = sliceColumns === null || sliceColumns === void 0 ? void 0 : (_sliceColumns$centerC2 = sliceColumns.centerColumns) === null || _sliceColumns$centerC2 === void 0 ? void 0 : _sliceColumns$centerC2.length) !== null && _sliceColumns$centerC !== void 0 ? _sliceColumns$centerC : 0;
313070
313076
  }, [sliceColumns]);
313071
313077
  React.useEffect(function () {
313072
313078
  if (state.columnsLen !== centerColumnsLen) {
@@ -313102,8 +313108,10 @@
313102
313108
  }, [virtualItems]); // 右侧隐藏数量
313103
313109
 
313104
313110
  var rightColSpan = React.useMemo(function () {
313105
- return sliceColumns.centerColumns.length - virtualItems.length - leftColSpan || 0;
313106
- }, [sliceColumns.centerColumns.length, virtualItems.length, leftColSpan]);
313111
+ var _sliceColumns$centerC3;
313112
+
313113
+ return (sliceColumns === null || sliceColumns === void 0 ? void 0 : (_sliceColumns$centerC3 = sliceColumns.centerColumns) === null || _sliceColumns$centerC3 === void 0 ? void 0 : _sliceColumns$centerC3.length) - (virtualItems === null || virtualItems === void 0 ? void 0 : virtualItems.length) - leftColSpan || 0;
313114
+ }, [sliceColumns === null || sliceColumns === void 0 ? void 0 : (_sliceColumns$centerC4 = sliceColumns.centerColumns) === null || _sliceColumns$centerC4 === void 0 ? void 0 : _sliceColumns$centerC4.length, virtualItems.length, leftColSpan]);
313107
313115
  return _objectSpread(_objectSpread({
313108
313116
  virtualItems: virtualItems
313109
313117
  }, sliceColumns), {}, {
@@ -313333,7 +313341,7 @@
313333
313341
  return isExpandRow(children) ? children === null || children === void 0 ? void 0 : (_children$2 = children[0]) === null || _children$2 === void 0 ? void 0 : (_children$2$props = _children$2.props) === null || _children$2$props === void 0 ? void 0 : (_children$2$props$chi = _children$2$props.children) === null || _children$2$props$chi === void 0 ? void 0 : (_children$2$props$chi2 = _children$2$props$chi[1]) === null || _children$2$props$chi2 === void 0 ? void 0 : (_children$2$props$chi3 = _children$2$props$chi2.props) === null || _children$2$props$chi3 === void 0 ? void 0 : _children$2$props$chi3['aria-label'] : '';
313334
313342
  }
313335
313343
  function checkMemoShouldUploadSpecialFun(prev, next) {
313336
- var _prevCol$componentPro, _nextCol$componentPro, _prevCol$componentPro2, _nextCol$componentPro2, _prevCol$componentPro3, _nextCol$componentPro3, _prevCol$componentPro4, _nextCol$componentPro4, _prevCol$componentPro5, _nextCol$componentPro5, _prevCol$componentPro6, _nextCol$componentPro6;
313344
+ var _prevCol$componentPro, _nextCol$componentPro, _prevCol$componentPro2, _nextCol$componentPro2, _prevCol$componentPro3, _nextCol$componentPro3, _prevCol$componentPro4, _nextCol$componentPro4, _prevCol$componentPro5, _nextCol$componentPro5, _next$className, _prevCol$componentPro6, _nextCol$componentPro6;
313337
313345
 
313338
313346
  var checkExpandStatus = getExpandStatus(prev.children) === getExpandStatus(next.children);
313339
313347
 
@@ -313387,6 +313395,10 @@
313387
313395
  return lodash.isEqual(prev.style, next.style);
313388
313396
  }
313389
313397
 
313398
+ if (((_next$className = next.className) === null || _next$className === void 0 ? void 0 : _next$className.indexOf('ant-table-row-expand-icon-cell')) > -1) {
313399
+ return false;
313400
+ }
313401
+
313390
313402
  if (next.className.indexOf('ant-table-selection-column') > -1) {
313391
313403
  var _prev$children, _prev$children$, _next$children, _next$children$;
313392
313404
 
@@ -313524,7 +313536,6 @@
313524
313536
  move(active.id, over.id);
313525
313537
  }
313526
313538
  }; // @ts-ignore
313527
-
313528
313539
  return /*#__PURE__*/React__default['default'].createElement(DndContext, {
313529
313540
  sensors: sensors,
313530
313541
  onDragStart: handleDragStart,
@@ -313756,6 +313767,9 @@
313756
313767
  _Form$useForm2 = _slicedToArray$1(_Form$useForm, 1),
313757
313768
  form = _Form$useForm2[0];
313758
313769
 
313770
+ var dataKey = props.dataKey,
313771
+ pushAllForm = props.pushAllForm;
313772
+ pushAllForm === null || pushAllForm === void 0 ? void 0 : pushAllForm(form, dataKey, index);
313759
313773
  return /*#__PURE__*/React__default['default'].createElement(Form$4, {
313760
313774
  form: form,
313761
313775
  disabled: props.disabled || false,
@@ -313773,6 +313787,9 @@
313773
313787
  _Form$useForm4 = _slicedToArray$1(_Form$useForm3, 1),
313774
313788
  form = _Form$useForm4[0];
313775
313789
 
313790
+ var dataKey = props.dataKey,
313791
+ pushAllForm = props.pushAllForm;
313792
+ pushAllForm === null || pushAllForm === void 0 ? void 0 : pushAllForm(form, dataKey, index);
313776
313793
  return /*#__PURE__*/React__default['default'].createElement(Form$4, {
313777
313794
  form: form,
313778
313795
  disabled: props.disabled || false,
@@ -314409,6 +314426,12 @@
314409
314426
  disabledDataSourceRowKeys.current = checkTableRowIsDisable(deepDataSourceRef.current, localDisabledRows.disabledRows, _rowKey);
314410
314427
  var tableWarpRef = React.useRef(null);
314411
314428
  var autoSizerRef = React.useRef(null);
314429
+ var allFormListRef = React.useRef({});
314430
+ var scrollToIndexRef = React.useRef(null);
314431
+
314432
+ var _Form$useForm5 = Form$4.useForm(),
314433
+ _Form$useForm6 = _slicedToArray$1(_Form$useForm5, 1),
314434
+ checkForm = _Form$useForm6[0];
314412
314435
 
314413
314436
  var onColSortEnd = function onColSortEnd(active, over) {
314414
314437
  var _arrayMove;
@@ -314963,12 +314986,257 @@
314963
314986
  },
314964
314987
  columns: columns.map(function (item) {
314965
314988
  return lodash.omit(item, ['render', 'sorter', 'onFilter', 'filters', 'componentProps', 'formProps', 'editable']);
314966
- })
314989
+ }),
314990
+ // verify: async () => {
314991
+ // let allRule = {}
314992
+ // let time
314993
+ // let fullNum = 0
314994
+ // columns.forEach((col: any) => {
314995
+ // if (col?.formProps?.rules) {
314996
+ // allRule[col.dataIndex] = col?.formProps?.rules || []
314997
+ // }
314998
+ // })
314999
+ // const validator = new AsyncValidator(allRule);
315000
+ // let flag = true
315001
+ // let messageIndex = null
315002
+ // let errorRowKey = null
315003
+ // let errorInfo = null
315004
+ // const deepValidator = async (data, index) => {
315005
+ // for (let i = 0; i < data.length; i++) {
315006
+ // if (flag) {
315007
+ // try {
315008
+ // await validator.validate(data[i], (errors, fields) => {
315009
+ // if (errors) {
315010
+ // errorInfo = { errors, fields, value: data[i] };
315011
+ // flag = false
315012
+ // messageIndex = index === null ? i : index
315013
+ // errorRowKey = data?.[i]?.[rowKey]
315014
+ // } else if (data[i].children) {
315015
+ // deepValidator(data[i].children, i)
315016
+ // }
315017
+ // })
315018
+ // } catch (error) {
315019
+ // break;
315020
+ // }
315021
+ // }
315022
+ // }
315023
+ // }
315024
+ // await deepValidator(dataSource, null)
315025
+ // console.log(flag, 'fff')
315026
+ // if (flag) {
315027
+ // return Promise.resolve(dataSource)
315028
+ // } else {
315029
+ // setTimeout(() => {
315030
+ // if (messageIndex !== null) {
315031
+ // scrollToIndexRef.current?.(messageIndex, { align: 'center' })
315032
+ // time = setInterval(async () => {
315033
+ // fullNum++
315034
+ // if (fullNum > 5) {
315035
+ // clearInterval(time)
315036
+ // } else {
315037
+ // const form = (Object.values(allFormListRef.current || []).find((item: any) => item.key === errorRowKey) as any)?.form
315038
+ // if (form) {
315039
+ // try {
315040
+ // await form.validateFields()
315041
+ // console.log('验证成功')
315042
+ // } catch (error) {
315043
+ // console.log('验证失败', error)
315044
+ // return error
315045
+ // } finally {
315046
+ // clearInterval(time)
315047
+ // }
315048
+ // }
315049
+ // }
315050
+ // }, 500)
315051
+ // }
315052
+ // }, 100)
315053
+ // return Promise.reject(errorInfo)
315054
+ // }
315055
+ // },
315056
+ verify: function () {
315057
+ var _verify = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4() {
315058
+ var time, fullNum, flag, messageIndex, errorRowKey, errorInfo, deepValidator;
315059
+ return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
315060
+ while (1) {
315061
+ switch (_context4.prev = _context4.next) {
315062
+ case 0:
315063
+ fullNum = 0;
315064
+ flag = true;
315065
+ messageIndex = null;
315066
+ errorRowKey = null;
315067
+ errorInfo = null;
315068
+
315069
+ deepValidator = /*#__PURE__*/function () {
315070
+ var _ref13 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2(data, index) {
315071
+ var i, _data$i;
315072
+
315073
+ return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
315074
+ while (1) {
315075
+ switch (_context2.prev = _context2.next) {
315076
+ case 0:
315077
+ i = 0;
315078
+
315079
+ case 1:
315080
+ if (!(i < data.length)) {
315081
+ _context2.next = 21;
315082
+ break;
315083
+ }
315084
+
315085
+ if (!flag) {
315086
+ _context2.next = 18;
315087
+ break;
315088
+ }
315089
+
315090
+ _context2.prev = 3;
315091
+ checkForm.resetFields();
315092
+ checkForm.setFieldsValue(data[i]);
315093
+ _context2.next = 8;
315094
+ return checkForm.validateFields();
315095
+
315096
+ case 8:
315097
+ if (data[i].children) {
315098
+ deepValidator(data[i].children, i);
315099
+ }
315100
+
315101
+ _context2.next = 18;
315102
+ break;
315103
+
315104
+ case 11:
315105
+ _context2.prev = 11;
315106
+ _context2.t0 = _context2["catch"](3);
315107
+ errorInfo = {
315108
+ error: _context2.t0,
315109
+ value: data[i]
315110
+ };
315111
+ flag = false;
315112
+ messageIndex = index === null ? i : index;
315113
+ errorRowKey = data === null || data === void 0 ? void 0 : (_data$i = data[i]) === null || _data$i === void 0 ? void 0 : _data$i[_rowKey];
315114
+ return _context2.abrupt("break", 21);
315115
+
315116
+ case 18:
315117
+ i++;
315118
+ _context2.next = 1;
315119
+ break;
315120
+
315121
+ case 21:
315122
+ case "end":
315123
+ return _context2.stop();
315124
+ }
315125
+ }
315126
+ }, _callee2, null, [[3, 11]]);
315127
+ }));
315128
+
315129
+ return function deepValidator(_x2, _x3) {
315130
+ return _ref13.apply(this, arguments);
315131
+ };
315132
+ }();
315133
+
315134
+ _context4.next = 8;
315135
+ return deepValidator(dataSource, null);
315136
+
315137
+ case 8:
315138
+ if (!flag) {
315139
+ _context4.next = 12;
315140
+ break;
315141
+ }
315142
+
315143
+ return _context4.abrupt("return", Promise.resolve(dataSource));
315144
+
315145
+ case 12:
315146
+ setTimeout(function () {
315147
+ if (messageIndex !== null) {
315148
+ var _scrollToIndexRef$cur;
315149
+
315150
+ (_scrollToIndexRef$cur = scrollToIndexRef.current) === null || _scrollToIndexRef$cur === void 0 ? void 0 : _scrollToIndexRef$cur.call(scrollToIndexRef, messageIndex, {
315151
+ align: 'center'
315152
+ });
315153
+ time = setInterval( /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3() {
315154
+ var _Object$values$find, form;
315155
+
315156
+ return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
315157
+ while (1) {
315158
+ switch (_context3.prev = _context3.next) {
315159
+ case 0:
315160
+ fullNum++;
315161
+
315162
+ if (!(fullNum > 5)) {
315163
+ _context3.next = 5;
315164
+ break;
315165
+ }
315166
+
315167
+ clearInterval(time);
315168
+ _context3.next = 20;
315169
+ break;
315170
+
315171
+ case 5:
315172
+ form = (_Object$values$find = Object.values(allFormListRef.current || []).find(function (item) {
315173
+ return item.key === errorRowKey;
315174
+ })) === null || _Object$values$find === void 0 ? void 0 : _Object$values$find.form;
315175
+
315176
+ if (!form) {
315177
+ _context3.next = 20;
315178
+ break;
315179
+ }
315180
+
315181
+ _context3.prev = 7;
315182
+ _context3.next = 10;
315183
+ return form.validateFields();
315184
+
315185
+ case 10:
315186
+ console.log('验证成功');
315187
+ _context3.next = 17;
315188
+ break;
315189
+
315190
+ case 13:
315191
+ _context3.prev = 13;
315192
+ _context3.t0 = _context3["catch"](7);
315193
+ console.log('验证失败', _context3.t0);
315194
+ return _context3.abrupt("return", _context3.t0);
315195
+
315196
+ case 17:
315197
+ _context3.prev = 17;
315198
+ clearInterval(time);
315199
+ return _context3.finish(17);
315200
+
315201
+ case 20:
315202
+ case "end":
315203
+ return _context3.stop();
315204
+ }
315205
+ }
315206
+ }, _callee3, null, [[7, 13, 17, 20]]);
315207
+ })), 500);
315208
+ }
315209
+ }, 100);
315210
+ return _context4.abrupt("return", Promise.reject(errorInfo));
315211
+
315212
+ case 14:
315213
+ case "end":
315214
+ return _context4.stop();
315215
+ }
315216
+ }
315217
+ }, _callee4);
315218
+ }));
315219
+
315220
+ function verify() {
315221
+ return _verify.apply(this, arguments);
315222
+ }
315223
+
315224
+ return verify;
315225
+ }()
314967
315226
  };
314968
315227
  });
314969
315228
  var isShowAddAction = React.useMemo(function () {
314970
315229
  return isEdit && isAdd || isHoverEdit && isAdd;
314971
315230
  }, [isEdit, isAdd, isHoverEdit]);
315231
+
315232
+ var pushAllForm = function pushAllForm(form, key, index) {
315233
+ allFormListRef.current[key] = {
315234
+ form: form,
315235
+ key: key,
315236
+ index: index
315237
+ };
315238
+ };
315239
+
314972
315240
  var config = React.useRef(_objectSpread({
314973
315241
  pagination: false,
314974
315242
  tableLayout: 'fixed',
@@ -314979,7 +315247,11 @@
314979
315247
  return record[_rowKey] || record.index || Math.random();
314980
315248
  },
314981
315249
  components: {
314982
- table: virtual ? VirtualTable$1 : null,
315250
+ table: virtual ? function (props) {
315251
+ return /*#__PURE__*/React__default['default'].createElement(VirtualTable$1, _objectSpread(_objectSpread({}, props), {}, {
315252
+ fn: scrollToIndexRef
315253
+ }));
315254
+ } : null,
314983
315255
  body: Object.assign({
314984
315256
  row: function row(rowProps) {
314985
315257
  return sortOpen ? EditableSortRow(_objectSpread(_objectSpread({}, rowProps), {}, {
@@ -314988,7 +315260,7 @@
314988
315260
  virtual: virtual
314989
315261
  }));
314990
315262
  },
314991
- cell: MemoEditableCell
315263
+ cell: props.shouldUpdate ? EditableCell$1 : MemoEditableCell
314992
315264
  }, sortOpen ? {
314993
315265
  wrapper: function wrapper(wrapperProps) {
314994
315266
  var _dataSourceRef$curren2, _tableWarpRef$current, _tableWarpRef$current2;
@@ -315015,7 +315287,10 @@
315015
315287
  var _disabledDataSourceRo;
315016
315288
 
315017
315289
  return {
315018
- disabled: disabled || !!((_disabledDataSourceRo = disabledDataSourceRowKeys.current) === null || _disabledDataSourceRo === void 0 ? void 0 : _disabledDataSourceRo.includes(record[_rowKey]))
315290
+ disabled: disabled || !!((_disabledDataSourceRo = disabledDataSourceRowKeys.current) === null || _disabledDataSourceRo === void 0 ? void 0 : _disabledDataSourceRo.includes(record[_rowKey])),
315291
+ dataKey: record[_rowKey],
315292
+ index: index,
315293
+ pushAllForm: pushAllForm
315019
315294
  };
315020
315295
  }
315021
315296
  }, resetProps));
@@ -315089,7 +315364,15 @@
315089
315364
  isShowAddAction: isShowAddAction,
315090
315365
  recordCreatorProps: recordCreatorProps,
315091
315366
  handleAdd: handleAdd
315092
- }));
315367
+ }), /*#__PURE__*/React__default['default'].createElement(Form$4, {
315368
+ form: checkForm,
315369
+ component: false
315370
+ }, columns.map(function (item) {
315371
+ return /*#__PURE__*/React__default['default'].createElement(Form$4.Item, _objectSpread({
315372
+ noStyle: true,
315373
+ name: item.dataIndex
315374
+ }, (item === null || item === void 0 ? void 0 : item['formProps']) || {}));
315375
+ })));
315093
315376
  } // @ts-ignore
315094
315377
 
315095
315378
 
@@ -315142,7 +315425,15 @@
315142
315425
  isShowAddAction: isShowAddAction,
315143
315426
  recordCreatorProps: recordCreatorProps,
315144
315427
  handleAdd: handleAdd
315145
- }));
315428
+ }), /*#__PURE__*/React__default['default'].createElement(Form$4, {
315429
+ form: checkForm,
315430
+ component: false
315431
+ }, columns.map(function (item) {
315432
+ return /*#__PURE__*/React__default['default'].createElement(Form$4.Item, _objectSpread({
315433
+ noStyle: true,
315434
+ name: item.dataIndex
315435
+ }, (item === null || item === void 0 ? void 0 : item['formProps']) || {}));
315436
+ })));
315146
315437
  });
315147
315438
  var LmEditTable = /*#__PURE__*/React.memo(EditTable$1);
315148
315439