linkmore-design 1.1.13-alpha.5 → 1.1.13-alpha.6

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.
@@ -33,7 +33,7 @@ export interface CountdownHandle {
33
33
  clearSelect: () => void;
34
34
  customSetCheckboxRecords: (data: any[]) => void;
35
35
  deleteRowData: (record: string | Record<string, any>) => void;
36
- addRowData: (record: string | Record<string, any>, addInChind: boolean, defaultValue?: Record<string, any>) => void;
36
+ addRowData: (record: string | Record<string, any>, defaultValue?: Record<string, any> | Record<string, any>[], addInChild?: boolean) => void;
37
37
  valid: () => void;
38
38
  }
39
39
  interface ILmColumns extends TableColumnType<any> {
package/dist/index.umd.js CHANGED
@@ -312883,21 +312883,46 @@
312883
312883
  var SortableItem$2 = /*#__PURE__*/React.memo(SortableItem$1);
312884
312884
 
312885
312885
  var _excluded$2S = ["children"];
312886
+ // children: React.ReactNode
312887
+ // }
312888
+ // interface ItemInstance {}
312889
+ // @ts-ignore
312890
+
312886
312891
  var Item$5 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
312887
312892
  var children = _ref.children,
312888
312893
  props = _objectWithoutProperties$1(_ref, _excluded$2S);
312889
312894
 
312890
- var rProps = lodash.omit(_objectSpread(_objectSpread({}, props), children.props), ['isSticky', 'colStart', 'colEnd', 'prefixCls', 'fixLeft', 'fixRight', 'lastFixLeft', 'firstFixRight', 'lastFixRight', 'firstFixLeft', 'isSticky', 'additionalProps', 'rowType']);
312891
- return /*#__PURE__*/React__default['default'].createElement("th", _objectSpread(_objectSpread({}, rProps), {}, {
312892
- ref: ref
312893
- })); // <th {...props} ref={ref as any}>
312894
- // {/* {(children as any)?.props?.children || children} */}
312895
- // { children }
312896
- // </th>
312895
+ // const rProps = omit({ ...props, ...children.props }, [
312896
+ // 'isSticky',
312897
+ // 'colStart',
312898
+ // 'colEnd',
312899
+ // 'prefixCls',
312900
+ // 'fixLeft',
312901
+ // 'fixRight',
312902
+ // 'lastFixLeft',
312903
+ // 'firstFixRight',
312904
+ // 'lastFixRight',
312905
+ // 'firstFixLeft',
312906
+ // 'isSticky',
312907
+ // 'additionalProps',
312908
+ // 'rowType',
312909
+ // ])
312910
+ return (
312911
+ /*#__PURE__*/
312912
+ // <th {...rProps} ref={ref as any} />
312913
+ React__default['default'].createElement("th", _objectSpread(_objectSpread(_objectSpread({}, props), children.props), {}, {
312914
+ ref: ref
312915
+ })) // <th {...props} ref={ref as any}>
312916
+ // {(children as any)?.props?.children || children}
312917
+ // </th>
312918
+
312919
+ );
312897
312920
  });
312898
312921
  function SortableItem$3(props) {
312922
+ var id = props.id;
312923
+
312899
312924
  var _useSortable = useSortable({
312900
- id: props.id
312925
+ id: id
312901
312926
  }),
312902
312927
  attributes = _useSortable.attributes,
312903
312928
  listeners = _useSortable.listeners,
@@ -313003,7 +313028,7 @@
313003
313028
  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'] : '';
313004
313029
  }
313005
313030
  function checkMemoShouldUploadSpecialFun(prev, next) {
313006
- var _prevCol$componentPro, _nextCol$componentPro, _prevCol$componentPro2, _nextCol$componentPro2, _prevCol$componentPro3, _nextCol$componentPro3, _prevCol$componentPro4, _nextCol$componentPro4;
313031
+ 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;
313007
313032
 
313008
313033
  var checkExpandStatus = getExpandStatus(prev.children) === getExpandStatus(next.children);
313009
313034
 
@@ -313028,7 +313053,14 @@
313028
313053
  }
313029
313054
 
313030
313055
  if (((prevCol === null || prevCol === void 0 ? void 0 : (_prevCol$componentPro2 = prevCol.componentProps) === null || _prevCol$componentPro2 === void 0 ? void 0 : _prevCol$componentPro2.optionOnly) || (nextCol === null || nextCol === void 0 ? void 0 : (_nextCol$componentPro2 = nextCol.componentProps) === null || _nextCol$componentPro2 === void 0 ? void 0 : _nextCol$componentPro2.optionOnly)) && !lodash.isEqual(prevCol === null || prevCol === void 0 ? void 0 : (_prevCol$componentPro3 = prevCol.componentProps) === null || _prevCol$componentPro3 === void 0 ? void 0 : _prevCol$componentPro3.options, nextCol === null || nextCol === void 0 ? void 0 : (_nextCol$componentPro3 = nextCol.componentProps) === null || _nextCol$componentPro3 === void 0 ? void 0 : _nextCol$componentPro3.options)) {
313031
- // return isEqual(prevCol?.componentProps?.options, nextCol?.componentProps?.options)
313056
+ return false;
313057
+ }
313058
+
313059
+ if (((prevCol === null || prevCol === void 0 ? void 0 : (_prevCol$componentPro4 = prevCol.componentProps) === null || _prevCol$componentPro4 === void 0 ? void 0 : _prevCol$componentPro4.options) || (nextCol === null || nextCol === void 0 ? void 0 : (_nextCol$componentPro4 = nextCol.componentProps) === null || _nextCol$componentPro4 === void 0 ? void 0 : _nextCol$componentPro4.options)) && !lodash.isEqual(prevCol === null || prevCol === void 0 ? void 0 : (_prevCol$componentPro5 = prevCol.componentProps) === null || _prevCol$componentPro5 === void 0 ? void 0 : _prevCol$componentPro5.options, nextCol === null || nextCol === void 0 ? void 0 : (_nextCol$componentPro5 = nextCol.componentProps) === null || _nextCol$componentPro5 === void 0 ? void 0 : _nextCol$componentPro5.options)) {
313060
+ return false;
313061
+ }
313062
+
313063
+ if ((lodash.isFunction(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) || lodash.isFunction(nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps)) && !lodash.isEqual(prevCol.newOptions, nextCol.newOptions) && !lodash.isEqual(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps, nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps)) {
313032
313064
  return false;
313033
313065
  }
313034
313066
 
@@ -313037,6 +313069,10 @@
313037
313069
  return false;
313038
313070
  }
313039
313071
 
313072
+ if (next.className.indexOf('drag-visible') > -1) {
313073
+ return lodash.isEqual(prev.style, next.style);
313074
+ }
313075
+
313040
313076
  if (next.className.indexOf('ant-table-selection-column') > -1) {
313041
313077
  var _prev$children, _prev$children$, _next$children, _next$children$;
313042
313078
 
@@ -313045,7 +313081,7 @@
313045
313081
  /** 如果启用了快速复制功能,需要实时判断rowIndex与getLength */
313046
313082
 
313047
313083
 
313048
- if ((prevCol === null || prevCol === void 0 ? void 0 : (_prevCol$componentPro4 = prevCol.componentProps) === null || _prevCol$componentPro4 === void 0 ? void 0 : _prevCol$componentPro4.quickcopy) || (nextCol === null || nextCol === void 0 ? void 0 : (_nextCol$componentPro4 = nextCol.componentProps) === null || _nextCol$componentPro4 === void 0 ? void 0 : _nextCol$componentPro4.quickcopy)) {
313084
+ if ((prevCol === null || prevCol === void 0 ? void 0 : (_prevCol$componentPro6 = prevCol.componentProps) === null || _prevCol$componentPro6 === void 0 ? void 0 : _prevCol$componentPro6.quickcopy) || (nextCol === null || nextCol === void 0 ? void 0 : (_nextCol$componentPro6 = nextCol.componentProps) === null || _nextCol$componentPro6 === void 0 ? void 0 : _nextCol$componentPro6.quickcopy)) {
313049
313085
  var pickProps = ['record', 'colIndex', 'rowIndex', 'getLength'];
313050
313086
  var p = lodash.pick(prev, pickProps);
313051
313087
  var n = lodash.pick(next, pickProps);
@@ -313481,7 +313517,16 @@
313481
313517
  };
313482
313518
 
313483
313519
  var Control = function Control(con) {
313520
+ var _col$newOptions;
313521
+
313484
313522
  var resultComponentProps = lodash.isFunction(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
313523
+
313524
+ if (lodash.isFunction(componentProps) && (col === null || col === void 0 ? void 0 : (_col$newOptions = col.newOptions) === null || _col$newOptions === void 0 ? void 0 : _col$newOptions.length)) {
313525
+ resultComponentProps = _objectSpread(_objectSpread({}, resultComponentProps), {}, {
313526
+ options: col === null || col === void 0 ? void 0 : col.newOptions
313527
+ });
313528
+ }
313529
+
313485
313530
  var clearAttrComponentProps = lodash.omit(resultComponentProps, ['optionOnly', 'isOnlyValue', 'quickcopy']);
313486
313531
 
313487
313532
  switch (con) {
@@ -313609,7 +313654,8 @@
313609
313654
 
313610
313655
  case 'render':
313611
313656
  {
313612
- var render = resultComponentProps.render;
313657
+ var _resultComponentProps = resultComponentProps,
313658
+ render = _resultComponentProps.render;
313613
313659
  var fromData = form.getFieldsValue();
313614
313660
  return render === null || render === void 0 ? void 0 : render(_objectSpread(_objectSpread({}, !isObjEmpty(fromData) ? _objectSpread(_objectSpread({}, record), {}, _defineProperty$1({}, dataIndex, fromData[dataIndex])) : record), {}, {
313615
313661
  onChange: save
@@ -313718,7 +313764,8 @@
313718
313764
  var MemoEditableCell = /*#__PURE__*/React.memo(EditableCell$1, function (prev, next) {
313719
313765
  var pickProps = ['record', 'colIndex'];
313720
313766
  var p = lodash.pick(prev, pickProps);
313721
- var n = lodash.pick(next, pickProps); // console.log(prev, next, '22', checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n))
313767
+ var n = lodash.pick(next, pickProps);
313768
+ console.log(prev, next, 222); // console.log(prev, next, '22', checkMemoShouldUploadSpecialFun(prev, next), isEqual(p, n))
313722
313769
 
313723
313770
  /** TODO: 在record中带有children,子列表数据修改之后,会导致父级的record对比不一样 */
313724
313771
 
@@ -313994,24 +314041,39 @@
313994
314041
 
313995
314042
  var rkey = lodash.isObject(record) ? record[_rowKey] : record;
313996
314043
  var preKeys = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : (_deepDataSourceRef$cu5 = deepDataSourceRef.current) === null || _deepDataSourceRef$cu5 === void 0 ? void 0 : (_deepDataSourceRef$cu6 = _deepDataSourceRef$cu5[rkey]) === null || _deepDataSourceRef$cu6 === void 0 ? void 0 : _deepDataSourceRef$cu6.preKeys;
314044
+ console.log(record, isAppendInChindren, defaultRecord, '333', preKeys);
313997
314045
  var res = fn(dataSourceRef.current, function (draft) {
313998
- if (preKeys.length > 1) {
314046
+ if ((preKeys === null || preKeys === void 0 ? void 0 : preKeys.length) > 1) {
313999
314047
  var deeps = function deeps(children) {
314000
314048
  children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
314001
314049
  if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
314002
314050
  if (item[_rowKey] === rkey) {
314003
314051
  if (isAppendInChindren) {
314004
314052
  if (item === null || item === void 0 ? void 0 : item.children) {
314005
- var _item$children;
314053
+ if (Array.isArray(defaultRecord)) {
314054
+ var _item$children;
314055
+
314056
+ item === null || item === void 0 ? void 0 : (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.push.apply(_item$children, _toConsumableArray$1(defaultRecord));
314057
+ } else {
314058
+ var _item$children2;
314006
314059
 
314007
- item === null || item === void 0 ? void 0 : (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.push(defaultRecord || _defineProperty$1({}, _rowKey, "".concat(Date.now())));
314060
+ item === null || item === void 0 ? void 0 : (_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.push(defaultRecord || _defineProperty$1({}, _rowKey, "".concat(Date.now())));
314061
+ }
314008
314062
  } else {
314009
- item.children = [defaultRecord || _defineProperty$1({}, _rowKey, "".concat(Date.now()))];
314063
+ if (Array.isArray(defaultRecord)) {
314064
+ item.children = _toConsumableArray$1(defaultRecord);
314065
+ } else {
314066
+ item.children = [defaultRecord || _defineProperty$1({}, _rowKey, "".concat(Date.now()))];
314067
+ }
314010
314068
  }
314011
314069
 
314012
314070
  !expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray$1(expandedRowKeys), [item[_rowKey]]));
314013
314071
  } else {
314014
- children.splice(index + 1, 0, defaultRecord || _defineProperty$1({}, _rowKey, "".concat(Date.now())));
314072
+ if (Array.isArray(defaultRecord)) {
314073
+ children.splice.apply(children, [index + 1, 0].concat(_toConsumableArray$1(defaultRecord)));
314074
+ } else {
314075
+ children.splice(index + 1, 0, defaultRecord || _defineProperty$1({}, _rowKey, "".concat(Date.now())));
314076
+ }
314015
314077
  }
314016
314078
  } else if (item.children) {
314017
314079
  deeps(item.children);
@@ -314031,21 +314093,32 @@
314031
314093
  var _draft$index$children, _draft$index, _draft$index2;
314032
314094
 
314033
314095
  if ((_draft$index$children = draft[index].children) === null || _draft$index$children === void 0 ? void 0 : _draft$index$children.length) {
314034
- var _draft$index$children2;
314096
+ if (Array.isArray(defaultRecord)) {
314097
+ var _draft$index$children2;
314098
+
314099
+ (_draft$index$children2 = draft[index].children) === null || _draft$index$children2 === void 0 ? void 0 : _draft$index$children2.push.apply(_draft$index$children2, _toConsumableArray$1(defaultRecord));
314100
+ } else {
314101
+ var _draft$index$children3;
314035
314102
 
314036
- (_draft$index$children2 = draft[index].children) === null || _draft$index$children2 === void 0 ? void 0 : _draft$index$children2.push(_defineProperty$1({}, _rowKey, "".concat(Date.now())));
314103
+ (_draft$index$children3 = draft[index].children) === null || _draft$index$children3 === void 0 ? void 0 : _draft$index$children3.push(defaultRecord || _defineProperty$1({}, _rowKey, "".concat(Date.now())));
314104
+ }
314037
314105
  } else {
314038
- draft[index].children = [_defineProperty$1({}, _rowKey, "".concat(Date.now()))];
314106
+ draft[index].children = Array.isArray(defaultRecord) ? _toConsumableArray$1(defaultRecord) : [defaultRecord || _defineProperty$1({}, _rowKey, "".concat(Date.now()))];
314039
314107
  }
314040
314108
 
314041
314109
  !expandedRowKeys.includes((_draft$index = draft[index]) === null || _draft$index === void 0 ? void 0 : _draft$index[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray$1(expandedRowKeys), [(_draft$index2 = draft[index]) === null || _draft$index2 === void 0 ? void 0 : _draft$index2[_rowKey]]));
314042
314110
  } else {
314043
- draft.splice(index + 1, 0, _defineProperty$1({}, _rowKey, "".concat(Date.now())));
314111
+ if (Array.isArray(defaultRecord)) {
314112
+ console.log(1);
314113
+ draft.splice.apply(draft, [index + 1, 0].concat(_toConsumableArray$1(defaultRecord)));
314114
+ } else {
314115
+ console.log(2);
314116
+ draft.splice(index + 1, 0, defaultRecord || _defineProperty$1({}, _rowKey, "".concat(Date.now())));
314117
+ }
314044
314118
  }
314045
314119
  }
314046
314120
  }
314047
314121
  });
314048
- console.log(preKeys, '--preKeys', res);
314049
314122
  setDataSource(res);
314050
314123
  };
314051
314124
 
@@ -314066,8 +314139,9 @@
314066
314139
  var hasOnlyOptionsDatas = columns.filter(function (item) {
314067
314140
  var _item$componentProps;
314068
314141
 
314069
- return item === null || item === void 0 ? void 0 : (_item$componentProps = item.componentProps) === null || _item$componentProps === void 0 ? void 0 : _item$componentProps.optionOnly;
314070
- });
314142
+ var resultComponentProps = lodash.isFunction(item === null || item === void 0 ? void 0 : item.componentProps) ? item === null || item === void 0 ? void 0 : (_item$componentProps = item.componentProps) === null || _item$componentProps === void 0 ? void 0 : _item$componentProps.call(item, {}, item) : item === null || item === void 0 ? void 0 : item.componentProps;
314143
+ return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
314144
+ }); // const hasOnlyOptionsDatas = columns.filter((item) => item?.componentProps?.optionOnly)
314071
314145
 
314072
314146
  if (hasOnlyOptionsDatas.length) {
314073
314147
  return hasOnlyOptionsDatas === null || hasOnlyOptionsDatas === void 0 ? void 0 : hasOnlyOptionsDatas.map(function (item) {
@@ -314081,9 +314155,13 @@
314081
314155
 
314082
314156
  var DisableOptions = React.useMemo(function () {
314083
314157
  var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
314084
- var _ref10 = item.componentProps || {},
314085
- optionOnly = _ref10.optionOnly,
314086
- options = _ref10.options;
314158
+ var _item$componentProps2;
314159
+
314160
+ var resultComponentProps = lodash.isFunction(item.componentProps) ? (_item$componentProps2 = item.componentProps) === null || _item$componentProps2 === void 0 ? void 0 : _item$componentProps2.call(item, {}, item) : item.componentProps;
314161
+
314162
+ var _ref12 = resultComponentProps || {},
314163
+ optionOnly = _ref12.optionOnly,
314164
+ options = _ref12.options;
314087
314165
 
314088
314166
  if (optionOnly && options) {
314089
314167
  var dataIndex = item.dataIndex;
@@ -314095,6 +314173,13 @@
314095
314173
  disabled: !!dataIndexData.includes(o === null || o === void 0 ? void 0 : o.value)
314096
314174
  });
314097
314175
  });
314176
+
314177
+ if (lodash.isFunction(item.componentProps)) {
314178
+ return _objectSpread(_objectSpread({}, item), {}, {
314179
+ newOptions: newOptions
314180
+ });
314181
+ }
314182
+
314098
314183
  return _objectSpread(_objectSpread({}, item), {}, {
314099
314184
  componentProps: _objectSpread(_objectSpread({}, item.componentProps), {}, {
314100
314185
  options: newOptions
@@ -314124,7 +314209,7 @@
314124
314209
  fixed: 'left',
314125
314210
  render: function render(_, record) {
314126
314211
  return /*#__PURE__*/React__default['default'].createElement(Dragger$1, {
314127
- id: record[_rowKey] || record.id
314212
+ id: record[_rowKey] || (record === null || record === void 0 ? void 0 : record.id)
314128
314213
  });
314129
314214
  }
314130
314215
  } : null, indexCol ? lodash.isBoolean(indexCol) ? {
@@ -314250,10 +314335,10 @@
314250
314335
  setDataSource(arrayMove(cloneArr, oldIndex, newIndex));
314251
314336
  };
314252
314337
 
314253
- var colDraggableContainer = React.useCallback(function (_ref11) {
314338
+ var colDraggableContainer = React.useCallback(function (_ref13) {
314254
314339
  var _React$Children;
314255
314340
 
314256
- var props = _extends$2({}, _ref11);
314341
+ var props = _extends$2({}, _ref13);
314257
314342
 
314258
314343
  return /*#__PURE__*/React__default['default'].createElement("tr", null, (_React$Children = React__default['default'].Children) === null || _React$Children === void 0 ? void 0 : _React$Children.map(props.children, function (child) {
314259
314344
  var _child$props, _child$props$column;
@@ -314276,8 +314361,8 @@
314276
314361
  deleteRowData: function deleteRowData(data) {
314277
314362
  return handleTableRowDelete(data);
314278
314363
  },
314279
- addRowData: function addRowData(data, addInChind, defaultValue) {
314280
- return handleTableRowAdd(data, addInChind, defaultValue);
314364
+ addRowData: function addRowData(data, defaultValue, addInChild) {
314365
+ return handleTableRowAdd(data, addInChild, defaultValue);
314281
314366
  },
314282
314367
  clearSelect: function clearSelect() {
314283
314368
  setLocalRowSelectList({