linkmore-design 1.0.88 → 1.0.89

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.
@@ -18,6 +18,7 @@ interface ILmEditTable extends TableProps<any> {
18
18
  creatorButtonText?: string;
19
19
  style?: Record<string, any>;
20
20
  initData?: Record<string, any> | (() => Record<string, any>);
21
+ customAddClick?: () => void;
21
22
  };
22
23
  /** 是否为强制更新 */
23
24
  shouldUpdate?: boolean;
@@ -139,14 +139,17 @@ var InputRange = function InputRange(_a) {
139
139
  var _a$value = _a.value,
140
140
  value = _a$value === void 0 ? ['', ''] : _a$value,
141
141
  onChange = _a.onChange,
142
- editEnum = __rest(_a, ["value", "onChange"]); // 输入值改变
142
+ record = _a.record,
143
+ rowIndex = _a.rowIndex,
144
+ colIndex = _a.colIndex,
145
+ editEnum = __rest(_a, ["value", "onChange", "record", "rowIndex", "colIndex"]); // 输入值改变
143
146
 
144
147
 
145
- var nValue = _toConsumableArray(value);
146
-
147
148
  var handleInput = function handleInput(e, type) {
148
149
  var v = e.target.value;
149
150
 
151
+ var nValue = _toConsumableArray(value);
152
+
150
153
  if (type === 'prev') {
151
154
  nValue[0] = v;
152
155
  }
@@ -154,10 +157,14 @@ var InputRange = function InputRange(_a) {
154
157
  if (type === 'next') {
155
158
  nValue[1] = v;
156
159
  }
157
- };
158
160
 
159
- var handleBlur = function handleBlur() {
160
- onChange(nValue);
161
+ if (isFunction(editEnum.validator)) {
162
+ if (editEnum.validator(record, nValue, rowIndex, colIndex)) {
163
+ onChange(nValue);
164
+ }
165
+ } else {
166
+ onChange(nValue);
167
+ }
161
168
  };
162
169
 
163
170
  return /*#__PURE__*/React.createElement("div", {
@@ -167,14 +174,12 @@ var InputRange = function InputRange(_a) {
167
174
  }, /*#__PURE__*/React.createElement(Input, Object.assign({
168
175
  value: value === null || value === void 0 ? void 0 : value[0],
169
176
  placeholder: "\u8BF7\u8F93\u5165",
170
- onBlur: handleBlur,
171
177
  onChange: function onChange(e) {
172
178
  return handleInput(e, 'prev');
173
179
  }
174
180
  }, editEnum)), "~", /*#__PURE__*/React.createElement(Input, Object.assign({
175
181
  value: value === null || value === void 0 ? void 0 : value[1],
176
182
  placeholder: "\u8BF7\u8F93\u5165",
177
- onBlur: handleBlur,
178
183
  onChange: function onChange(e) {
179
184
  return handleInput(e, 'next');
180
185
  }
@@ -422,7 +427,11 @@ var EditableCell = function EditableCell(props) {
422
427
  return /*#__PURE__*/React.createElement(InputRange, Object.assign({
423
428
  onChange: handleFormItemChange,
424
429
  ref: inputRef
425
- }, resultComponentProps));
430
+ }, resultComponentProps, {
431
+ record: record,
432
+ rowIndex: rowIndex,
433
+ colIndex: colIndex
434
+ }));
426
435
 
427
436
  case 'number':
428
437
  return /*#__PURE__*/React.createElement(InputNumber, Object.assign({
@@ -1145,7 +1154,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1145
1154
  })), isShowAddAction && /*#__PURE__*/React.createElement(Button, {
1146
1155
  className: "lm_editTable_add_bar",
1147
1156
  type: "dashed",
1148
- onClick: handleAdd,
1157
+ onClick: (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.customAddClick) || handleAdd,
1149
1158
  style: Object.assign({
1150
1159
  marginTop: 8
1151
1160
  }, (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.style) || {})
@@ -18,6 +18,7 @@ interface ILmEditTable extends TableProps<any> {
18
18
  creatorButtonText?: string;
19
19
  style?: Record<string, any>;
20
20
  initData?: Record<string, any> | (() => Record<string, any>);
21
+ customAddClick?: () => void;
21
22
  };
22
23
  /** 是否为强制更新 */
23
24
  shouldUpdate?: boolean;
@@ -171,13 +171,15 @@ var InputRange = function InputRange(_a) {
171
171
  var _a$value = _a.value,
172
172
  value = _a$value === void 0 ? ['', ''] : _a$value,
173
173
  onChange = _a.onChange,
174
- editEnum = __rest(_a, ["value", "onChange"]); // 输入值改变
174
+ record = _a.record,
175
+ rowIndex = _a.rowIndex,
176
+ colIndex = _a.colIndex,
177
+ editEnum = __rest(_a, ["value", "onChange", "record", "rowIndex", "colIndex"]); // 输入值改变
175
178
 
176
179
 
177
- var nValue = (0, _toConsumableArray2.default)(value);
178
-
179
180
  var handleInput = function handleInput(e, type) {
180
181
  var v = e.target.value;
182
+ var nValue = (0, _toConsumableArray2.default)(value);
181
183
 
182
184
  if (type === 'prev') {
183
185
  nValue[0] = v;
@@ -186,10 +188,14 @@ var InputRange = function InputRange(_a) {
186
188
  if (type === 'next') {
187
189
  nValue[1] = v;
188
190
  }
189
- };
190
191
 
191
- var handleBlur = function handleBlur() {
192
- onChange(nValue);
192
+ if ((0, _lodash.isFunction)(editEnum.validator)) {
193
+ if (editEnum.validator(record, nValue, rowIndex, colIndex)) {
194
+ onChange(nValue);
195
+ }
196
+ } else {
197
+ onChange(nValue);
198
+ }
193
199
  };
194
200
 
195
201
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -199,14 +205,12 @@ var InputRange = function InputRange(_a) {
199
205
  }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Input, Object.assign({
200
206
  value: value === null || value === void 0 ? void 0 : value[0],
201
207
  placeholder: "\u8BF7\u8F93\u5165",
202
- onBlur: handleBlur,
203
208
  onChange: function onChange(e) {
204
209
  return handleInput(e, 'prev');
205
210
  }
206
211
  }, editEnum)), "~", /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Input, Object.assign({
207
212
  value: value === null || value === void 0 ? void 0 : value[1],
208
213
  placeholder: "\u8BF7\u8F93\u5165",
209
- onBlur: handleBlur,
210
214
  onChange: function onChange(e) {
211
215
  return handleInput(e, 'next');
212
216
  }
@@ -454,7 +458,11 @@ var EditableCell = function EditableCell(props) {
454
458
  return /*#__PURE__*/_react.default.createElement(InputRange, Object.assign({
455
459
  onChange: handleFormItemChange,
456
460
  ref: inputRef
457
- }, resultComponentProps));
461
+ }, resultComponentProps, {
462
+ record: record,
463
+ rowIndex: rowIndex,
464
+ colIndex: colIndex
465
+ }));
458
466
 
459
467
  case 'number':
460
468
  return /*#__PURE__*/_react.default.createElement(_linkmoreDesign.InputNumber, Object.assign({
@@ -1176,7 +1184,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1176
1184
  })), isShowAddAction && /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
1177
1185
  className: "lm_editTable_add_bar",
1178
1186
  type: "dashed",
1179
- onClick: handleAdd,
1187
+ onClick: (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.customAddClick) || handleAdd,
1180
1188
  style: Object.assign({
1181
1189
  marginTop: 8
1182
1190
  }, (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.style) || {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkmore-design",
3
- "version": "1.0.88",
3
+ "version": "1.0.89",
4
4
  "author": {
5
5
  "name": "nowthen",
6
6
  "email": "rnlvwyx@gmail.com"