@zat-design/sisyphus-react 3.6.4-beta.6 → 3.6.4-beta.7

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.
@@ -422,25 +422,24 @@ var RenderField = function RenderField(_ref) {
422
422
  _args = formatArgs([].concat(args));
423
423
  rowPath = [].concat(_toConsumableArray(namePath), [index]);
424
424
  row = form.getFieldValue(rowPath, true);
425
- if (type === 'InputNumber' && column.name) row[column.name] = args[0];
426
425
  orgRow = cloneDeep(row);
427
426
  _args[1] = row;
428
427
  _context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
429
428
  if (!_context2.t0) {
430
- _context2.next = 11;
429
+ _context2.next = 10;
431
430
  break;
432
431
  }
433
- _context2.next = 11;
432
+ _context2.next = 10;
434
433
  return (_TargetComponent$prop4 = TargetComponent.props).onBlur.apply(_TargetComponent$prop4, _toConsumableArray(_args));
435
- case 11:
434
+ case 10:
436
435
  _context2.t1 = onBlur;
437
436
  if (!_context2.t1) {
438
- _context2.next = 15;
437
+ _context2.next = 14;
439
438
  break;
440
439
  }
441
- _context2.next = 15;
440
+ _context2.next = 14;
442
441
  return onBlur.apply(void 0, _toConsumableArray(_args));
443
- case 15:
442
+ case 14:
444
443
  // 判断属性是否变动
445
444
  form.setFieldValue(rowPath, _objectSpread({}, row));
446
445
  if (!isEqual(orgRow, row)) {
@@ -453,16 +452,16 @@ var RenderField = function RenderField(_ref) {
453
452
  }
454
453
  }
455
454
  if (!isCell) {
456
- _context2.next = 21;
455
+ _context2.next = 20;
457
456
  break;
458
457
  }
459
- _context2.next = 20;
458
+ _context2.next = 19;
460
459
  return form.validateFields([cellName]);
461
- case 20:
460
+ case 19:
462
461
  setState({
463
462
  cellNamePath: []
464
463
  });
465
- case 21:
464
+ case 20:
466
465
  // 单行编辑时需要 强制更新视图
467
466
  if (virtualKey) {
468
467
  setState({
@@ -471,7 +470,7 @@ var RenderField = function RenderField(_ref) {
471
470
  }
472
471
  });
473
472
  }
474
- case 22:
473
+ case 21:
475
474
  case "end":
476
475
  return _context2.stop();
477
476
  }
@@ -76,7 +76,7 @@ var InputNumber = function InputNumber(props) {
76
76
  var _parser = function parser(value, precision) {
77
77
  var num = Number(value.replace(/[\s,]+/g, ''));
78
78
  if (value === '') return value;
79
- return Number.isNaN(num) || !precision ? value : num.toFixed(precision);
79
+ return Number.isNaN(num) || !precision && precision !== 0 ? value : num.toFixed(precision);
80
80
  };
81
81
  if (valueType) {
82
82
  switch (valueType) {
@@ -234,14 +234,21 @@ var InputNumber = function InputNumber(props) {
234
234
  var handleBlur = function handleBlur(e) {
235
235
  var _e$target, _e$target2;
236
236
  activateRef.current = false;
237
+ var changed = false;
237
238
  var value = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value;
238
239
  if (_max !== undefined && value > _max) {
239
240
  value = _max;
241
+ changed = true;
240
242
  }
241
243
  if (_min !== undefined && value < _min) {
242
244
  value = _min;
245
+ changed = true;
243
246
  }
244
247
  value = _parser(String(value), props.precision);
248
+ if (changed) {
249
+ rest === null || rest === void 0 ? void 0 : rest.onChange(value);
250
+ changed = null;
251
+ }
245
252
  var limit = {
246
253
  min: Number(_min),
247
254
  max: Number(_max)
@@ -425,25 +425,24 @@ var RenderField = function RenderField(_ref) {
425
425
  _args = formatArgs([].concat(args));
426
426
  rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
427
427
  row = form.getFieldValue(rowPath, true);
428
- if (type === 'InputNumber' && column.name) row[column.name] = args[0];
429
428
  orgRow = (0, _lodash.cloneDeep)(row);
430
429
  _args[1] = row;
431
430
  _context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
432
431
  if (!_context2.t0) {
433
- _context2.next = 11;
432
+ _context2.next = 10;
434
433
  break;
435
434
  }
436
- _context2.next = 11;
435
+ _context2.next = 10;
437
436
  return (_TargetComponent$prop4 = TargetComponent.props).onBlur.apply(_TargetComponent$prop4, (0, _toConsumableArray2.default)(_args));
438
- case 11:
437
+ case 10:
439
438
  _context2.t1 = onBlur;
440
439
  if (!_context2.t1) {
441
- _context2.next = 15;
440
+ _context2.next = 14;
442
441
  break;
443
442
  }
444
- _context2.next = 15;
443
+ _context2.next = 14;
445
444
  return onBlur.apply(void 0, (0, _toConsumableArray2.default)(_args));
446
- case 15:
445
+ case 14:
447
446
  // 判断属性是否变动
448
447
  form.setFieldValue(rowPath, (0, _objectSpread2.default)({}, row));
449
448
  if (!(0, _lodash.isEqual)(orgRow, row)) {
@@ -456,16 +455,16 @@ var RenderField = function RenderField(_ref) {
456
455
  }
457
456
  }
458
457
  if (!isCell) {
459
- _context2.next = 21;
458
+ _context2.next = 20;
460
459
  break;
461
460
  }
462
- _context2.next = 20;
461
+ _context2.next = 19;
463
462
  return form.validateFields([cellName]);
464
- case 20:
463
+ case 19:
465
464
  setState({
466
465
  cellNamePath: []
467
466
  });
468
- case 21:
467
+ case 20:
469
468
  // 单行编辑时需要 强制更新视图
470
469
  if (virtualKey) {
471
470
  setState({
@@ -474,7 +473,7 @@ var RenderField = function RenderField(_ref) {
474
473
  }
475
474
  });
476
475
  }
477
- case 22:
476
+ case 21:
478
477
  case "end":
479
478
  return _context2.stop();
480
479
  }
@@ -80,7 +80,7 @@ var InputNumber = function InputNumber(props) {
80
80
  var _parser = function parser(value, precision) {
81
81
  var num = Number(value.replace(/[\s,]+/g, ''));
82
82
  if (value === '') return value;
83
- return Number.isNaN(num) || !precision ? value : num.toFixed(precision);
83
+ return Number.isNaN(num) || !precision && precision !== 0 ? value : num.toFixed(precision);
84
84
  };
85
85
  if (valueType) {
86
86
  switch (valueType) {
@@ -238,14 +238,21 @@ var InputNumber = function InputNumber(props) {
238
238
  var handleBlur = function handleBlur(e) {
239
239
  var _e$target, _e$target2;
240
240
  activateRef.current = false;
241
+ var changed = false;
241
242
  var value = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value;
242
243
  if (_max !== undefined && value > _max) {
243
244
  value = _max;
245
+ changed = true;
244
246
  }
245
247
  if (_min !== undefined && value < _min) {
246
248
  value = _min;
249
+ changed = true;
247
250
  }
248
251
  value = _parser(String(value), props.precision);
252
+ if (changed) {
253
+ rest === null || rest === void 0 ? void 0 : rest.onChange(value);
254
+ changed = null;
255
+ }
249
256
  var limit = {
250
257
  min: Number(_min),
251
258
  max: Number(_max)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.6.4-beta.6",
3
+ "version": "3.6.4-beta.7",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",