linkmore-design 1.1.23 → 1.1.24

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.
@@ -465,7 +465,17 @@ var EditableCell = function EditableCell(props) {
465
465
  };
466
466
 
467
467
  var Control = function Control(con) {
468
+ var _a; // const resultComponentProps = isFunction(componentProps) ? componentProps?.(record, col) : componentProps
469
+
470
+
468
471
  var resultComponentProps = isFunction(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
472
+
473
+ if (isFunction(componentProps) && ((_a = col === null || col === void 0 ? void 0 : col.newOptions) === null || _a === void 0 ? void 0 : _a.length)) {
474
+ resultComponentProps = Object.assign(Object.assign({}, resultComponentProps), {
475
+ options: col === null || col === void 0 ? void 0 : col.newOptions
476
+ });
477
+ }
478
+
469
479
  var clearAttrComponentProps = omit(resultComponentProps, ['optionOnly', 'isOnlyValue']);
470
480
 
471
481
  switch (con) {
@@ -601,7 +611,8 @@ var EditableCell = function EditableCell(props) {
601
611
 
602
612
  case 'render':
603
613
  {
604
- var render = resultComponentProps.render;
614
+ var _resultComponentProps = resultComponentProps,
615
+ render = _resultComponentProps.render;
605
616
  var fromData = form.getFieldsValue();
606
617
  return render === null || render === void 0 ? void 0 : render(Object.assign(Object.assign({}, !isObjEmpty(fromData) ? Object.assign(Object.assign({}, record), _defineProperty({}, dataIndex, fromData[dataIndex])) : record), {
607
618
  onChange: save
@@ -1049,10 +1060,12 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1049
1060
 
1050
1061
 
1051
1062
  var hasDisableOptions = useMemo(function () {
1063
+ // const hasOnlyOptionsDatas = columns.filter(item => item?.['componentProps']?.optionOnly)
1052
1064
  var hasOnlyOptionsDatas = columns.filter(function (item) {
1053
1065
  var _a;
1054
1066
 
1055
- return (_a = item === null || item === void 0 ? void 0 : item['componentProps']) === null || _a === void 0 ? void 0 : _a.optionOnly;
1067
+ var resultComponentProps = isFunction(item === null || item === void 0 ? void 0 : item.componentProps) ? (_a = item === null || item === void 0 ? void 0 : item.componentProps) === null || _a === void 0 ? void 0 : _a.call(item, {}, item) : item === null || item === void 0 ? void 0 : item.componentProps;
1068
+ return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
1056
1069
  });
1057
1070
 
1058
1071
  if (hasOnlyOptionsDatas.length) {
@@ -1067,9 +1080,14 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1067
1080
 
1068
1081
  var DisableOptions = useMemo(function () {
1069
1082
  var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
1070
- var _ref5 = item['componentProps'] || {},
1083
+ var _a;
1084
+
1085
+ var resultComponentProps = 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;
1086
+
1087
+ var _ref5 = resultComponentProps || {},
1071
1088
  optionOnly = _ref5.optionOnly,
1072
- options = _ref5.options;
1089
+ options = _ref5.options; // const { optionOnly, options } = item['componentProps'] || {}
1090
+
1073
1091
 
1074
1092
  if (optionOnly && options) {
1075
1093
  var dataIndex = item.dataIndex;
@@ -1081,6 +1099,13 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1081
1099
  disabled: !!dataIndexData.includes(o === null || o === void 0 ? void 0 : o.value)
1082
1100
  });
1083
1101
  });
1102
+
1103
+ if (isFunction(item.componentProps)) {
1104
+ return Object.assign(Object.assign({}, item), {
1105
+ newOptions: newOptions
1106
+ });
1107
+ }
1108
+
1084
1109
  return Object.assign(Object.assign({}, item), {
1085
1110
  componentProps: Object.assign(Object.assign({}, item['componentProps']), {
1086
1111
  options: newOptions
@@ -82,7 +82,8 @@ var CLMTreeSelect = /*#__PURE__*/forwardRef(function (props, ref) {
82
82
  className: 'lm_tree_select',
83
83
  value: resetValue,
84
84
  size: mergeSize,
85
- disabled: mergedDisabled
85
+ disabled: mergedDisabled,
86
+ treeData: treeData
86
87
  }, resetProps), children);
87
88
  });
88
89
  var LMTreeSelect = CLMTreeSelect;
@@ -498,7 +498,17 @@ var EditableCell = function EditableCell(props) {
498
498
  };
499
499
 
500
500
  var Control = function Control(con) {
501
+ var _a; // const resultComponentProps = isFunction(componentProps) ? componentProps?.(record, col) : componentProps
502
+
503
+
501
504
  var resultComponentProps = (0, _lodash.isFunction)(componentProps) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps(record, col) : componentProps;
505
+
506
+ if ((0, _lodash.isFunction)(componentProps) && ((_a = col === null || col === void 0 ? void 0 : col.newOptions) === null || _a === void 0 ? void 0 : _a.length)) {
507
+ resultComponentProps = Object.assign(Object.assign({}, resultComponentProps), {
508
+ options: col === null || col === void 0 ? void 0 : col.newOptions
509
+ });
510
+ }
511
+
502
512
  var clearAttrComponentProps = (0, _lodash.omit)(resultComponentProps, ['optionOnly', 'isOnlyValue']);
503
513
 
504
514
  switch (con) {
@@ -634,7 +644,8 @@ var EditableCell = function EditableCell(props) {
634
644
 
635
645
  case 'render':
636
646
  {
637
- var render = resultComponentProps.render;
647
+ var _resultComponentProps = resultComponentProps,
648
+ render = _resultComponentProps.render;
638
649
  var fromData = form.getFieldsValue();
639
650
  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), {
640
651
  onChange: save
@@ -1081,10 +1092,12 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1081
1092
 
1082
1093
 
1083
1094
  var hasDisableOptions = (0, _react.useMemo)(function () {
1095
+ // const hasOnlyOptionsDatas = columns.filter(item => item?.['componentProps']?.optionOnly)
1084
1096
  var hasOnlyOptionsDatas = columns.filter(function (item) {
1085
1097
  var _a;
1086
1098
 
1087
- return (_a = item === null || item === void 0 ? void 0 : item['componentProps']) === null || _a === void 0 ? void 0 : _a.optionOnly;
1099
+ 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
+ return resultComponentProps === null || resultComponentProps === void 0 ? void 0 : resultComponentProps.optionOnly;
1088
1101
  });
1089
1102
 
1090
1103
  if (hasOnlyOptionsDatas.length) {
@@ -1099,9 +1112,14 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1099
1112
 
1100
1113
  var DisableOptions = (0, _react.useMemo)(function () {
1101
1114
  var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
1102
- var _ref5 = item['componentProps'] || {},
1115
+ var _a;
1116
+
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 || {},
1103
1120
  optionOnly = _ref5.optionOnly,
1104
- options = _ref5.options;
1121
+ options = _ref5.options; // const { optionOnly, options } = item['componentProps'] || {}
1122
+
1105
1123
 
1106
1124
  if (optionOnly && options) {
1107
1125
  var dataIndex = item.dataIndex;
@@ -1113,6 +1131,13 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1113
1131
  disabled: !!dataIndexData.includes(o === null || o === void 0 ? void 0 : o.value)
1114
1132
  });
1115
1133
  });
1134
+
1135
+ if ((0, _lodash.isFunction)(item.componentProps)) {
1136
+ return Object.assign(Object.assign({}, item), {
1137
+ newOptions: newOptions
1138
+ });
1139
+ }
1140
+
1116
1141
  return Object.assign(Object.assign({}, item), {
1117
1142
  componentProps: Object.assign(Object.assign({}, item['componentProps']), {
1118
1143
  options: newOptions
@@ -101,7 +101,8 @@ var CLMTreeSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
101
101
  className: 'lm_tree_select',
102
102
  value: resetValue,
103
103
  size: mergeSize,
104
- disabled: mergedDisabled
104
+ disabled: mergedDisabled,
105
+ treeData: treeData
105
106
  }, resetProps), children);
106
107
  });
107
108
  var LMTreeSelect = CLMTreeSelect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkmore-design",
3
- "version": "1.1.23",
3
+ "version": "1.1.24",
4
4
  "author": {
5
5
  "name": "nowthen",
6
6
  "email": "rnlvwyx@gmail.com"