@zat-design/sisyphus-react 3.6.4-beta.1 → 3.6.4-beta.3
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/es/ProEditTable/components/RenderField/index.js +116 -106
- package/es/ProForm/components/base/InputNumber/index.js +1 -1
- package/es/ProForm/utils/useShouldUpdate.js +3 -1
- package/lib/ProEditTable/components/RenderField/index.js +115 -105
- package/lib/ProForm/components/base/InputNumber/index.js +1 -1
- package/lib/ProForm/utils/useShouldUpdate.js +3 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
17
17
|
/* eslint-disable prefer-const */
|
|
18
18
|
import React, { useCallback, useEffect } from 'react';
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
-
import { cloneDeep, isEqual,
|
|
20
|
+
import { cloneDeep, isEqual, omit, isFunction } from 'lodash';
|
|
21
21
|
import valueTypeMap from '../../../ProForm/utils/valueType';
|
|
22
22
|
import transformMap from '../../utils/transform';
|
|
23
23
|
import { getNamePath, difference, getDisabled } from '../../utils/tools';
|
|
@@ -296,101 +296,108 @@ var RenderField = function RenderField(_ref) {
|
|
|
296
296
|
}, 100);
|
|
297
297
|
};
|
|
298
298
|
// 单元格更新数据时,加个防抖,防止更新频率过快,卡顿
|
|
299
|
-
var _onChange =
|
|
300
|
-
var
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
args
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
299
|
+
var _onChange = /*#__PURE__*/function () {
|
|
300
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
301
|
+
var _len2,
|
|
302
|
+
args,
|
|
303
|
+
_key2,
|
|
304
|
+
_args,
|
|
305
|
+
rowPath,
|
|
306
|
+
row,
|
|
307
|
+
orgRow,
|
|
308
|
+
_TargetComponent,
|
|
309
|
+
_TargetComponent$prop,
|
|
310
|
+
_TargetComponent$prop2,
|
|
311
|
+
_TargetComponent2,
|
|
312
|
+
_TargetComponent2$pro,
|
|
313
|
+
_TargetComponent$prop3,
|
|
314
|
+
_Object$keys,
|
|
315
|
+
_Object$keys$map,
|
|
316
|
+
diff,
|
|
317
|
+
validateFieldKeys,
|
|
318
|
+
_args2 = arguments;
|
|
319
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
320
|
+
while (1) switch (_context.prev = _context.next) {
|
|
321
|
+
case 0:
|
|
322
|
+
for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
323
|
+
args[_key2] = _args2[_key2];
|
|
324
|
+
}
|
|
325
|
+
_args = [].concat(args);
|
|
326
|
+
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
327
|
+
row = form.getFieldValue(rowPath, true);
|
|
328
|
+
orgRow = cloneDeep(row);
|
|
329
|
+
if (!onFieldChange) {
|
|
330
|
+
_context.next = 18;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
_args = formatArgs(args);
|
|
334
|
+
_args[1] = row;
|
|
335
|
+
_context.t0 = (_TargetComponent = TargetComponent) === null || _TargetComponent === void 0 ? void 0 : (_TargetComponent$prop = _TargetComponent.props) === null || _TargetComponent$prop === void 0 ? void 0 : _TargetComponent$prop.onFieldChange;
|
|
336
|
+
if (!_context.t0) {
|
|
337
|
+
_context.next = 12;
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
336
340
|
_context.next = 12;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
341
|
+
return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, _toConsumableArray(_args));
|
|
342
|
+
case 12:
|
|
343
|
+
_context.t1 = onFieldChange;
|
|
344
|
+
if (!_context.t1) {
|
|
345
|
+
_context.next = 16;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
344
348
|
_context.next = 16;
|
|
349
|
+
return onFieldChange.apply(void 0, _toConsumableArray(_args));
|
|
350
|
+
case 16:
|
|
351
|
+
_context.next = 27;
|
|
345
352
|
break;
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
_args = _args.concat([row, index, form]);
|
|
354
|
-
_context.t2 = (_TargetComponent2 = TargetComponent) === null || _TargetComponent2 === void 0 ? void 0 : (_TargetComponent2$pro = _TargetComponent2.props) === null || _TargetComponent2$pro === void 0 ? void 0 : _TargetComponent2$pro.onChange;
|
|
355
|
-
if (!_context.t2) {
|
|
353
|
+
case 18:
|
|
354
|
+
_args = _args.concat([row, index, form]);
|
|
355
|
+
_context.t2 = (_TargetComponent2 = TargetComponent) === null || _TargetComponent2 === void 0 ? void 0 : (_TargetComponent2$pro = _TargetComponent2.props) === null || _TargetComponent2$pro === void 0 ? void 0 : _TargetComponent2$pro.onChange;
|
|
356
|
+
if (!_context.t2) {
|
|
357
|
+
_context.next = 23;
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
356
360
|
_context.next = 23;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, _toConsumableArray(_args));
|
|
362
|
+
case 23:
|
|
363
|
+
_context.t3 = onChange;
|
|
364
|
+
if (!_context.t3) {
|
|
365
|
+
_context.next = 27;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
364
368
|
_context.next = 27;
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
form.validateFields(validateFieldKeys);
|
|
380
|
-
}, 100);
|
|
369
|
+
return onChange.apply(void 0, _toConsumableArray(_args));
|
|
370
|
+
case 27:
|
|
371
|
+
// 判断属性是否变动
|
|
372
|
+
form.setFieldValue(rowPath, _objectSpread({}, row));
|
|
373
|
+
if (!isEqual(orgRow, row)) {
|
|
374
|
+
diff = difference(row, orgRow) || {};
|
|
375
|
+
validateFieldKeys = (_Object$keys = Object.keys(diff)) === null || _Object$keys === void 0 ? void 0 : (_Object$keys$map = _Object$keys.map) === null || _Object$keys$map === void 0 ? void 0 : _Object$keys$map.call(_Object$keys, function (key) {
|
|
376
|
+
return [].concat(_toConsumableArray(rowPath), [key]);
|
|
377
|
+
});
|
|
378
|
+
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
|
379
|
+
setTimeout(function () {
|
|
380
|
+
form.validateFields(validateFieldKeys);
|
|
381
|
+
}, 100);
|
|
382
|
+
}
|
|
381
383
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
384
|
+
if (virtualKey) {
|
|
385
|
+
setState({
|
|
386
|
+
forceUpdate: {
|
|
387
|
+
d: Date.now()
|
|
388
|
+
}
|
|
389
|
+
});
|
|
386
390
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
391
|
+
case 30:
|
|
392
|
+
case "end":
|
|
393
|
+
return _context.stop();
|
|
394
|
+
}
|
|
395
|
+
}, _callee);
|
|
396
|
+
}));
|
|
397
|
+
return function _onChange() {
|
|
398
|
+
return _ref2.apply(this, arguments);
|
|
399
|
+
};
|
|
400
|
+
}();
|
|
394
401
|
var _onblur = /*#__PURE__*/function () {
|
|
395
402
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
396
403
|
var _TargetComponent3, _TargetComponent3$pro, _TargetComponent$prop4;
|
|
@@ -415,26 +422,27 @@ var RenderField = function RenderField(_ref) {
|
|
|
415
422
|
_args = formatArgs([].concat(args));
|
|
416
423
|
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
417
424
|
row = form.getFieldValue(rowPath, true);
|
|
425
|
+
if (type === 'InputNumber' && column.name) row[column.name] = args[0];
|
|
418
426
|
orgRow = cloneDeep(row);
|
|
419
427
|
_args[1] = row;
|
|
420
428
|
_context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
|
|
421
429
|
if (!_context2.t0) {
|
|
422
|
-
_context2.next =
|
|
430
|
+
_context2.next = 11;
|
|
423
431
|
break;
|
|
424
432
|
}
|
|
425
|
-
_context2.next =
|
|
433
|
+
_context2.next = 11;
|
|
426
434
|
return (_TargetComponent$prop4 = TargetComponent.props).onBlur.apply(_TargetComponent$prop4, _toConsumableArray(_args));
|
|
427
|
-
case
|
|
435
|
+
case 11:
|
|
428
436
|
_context2.t1 = onBlur;
|
|
429
437
|
if (!_context2.t1) {
|
|
430
|
-
_context2.next =
|
|
438
|
+
_context2.next = 15;
|
|
431
439
|
break;
|
|
432
440
|
}
|
|
433
|
-
_context2.next =
|
|
441
|
+
_context2.next = 15;
|
|
434
442
|
return onBlur.apply(void 0, _toConsumableArray(_args));
|
|
435
|
-
case
|
|
443
|
+
case 15:
|
|
436
444
|
// 判断属性是否变动
|
|
437
|
-
form.setFieldValue(rowPath, row);
|
|
445
|
+
form.setFieldValue(rowPath, _objectSpread({}, row));
|
|
438
446
|
if (!isEqual(orgRow, row)) {
|
|
439
447
|
diff = difference(row, orgRow) || {};
|
|
440
448
|
validateFieldKeys = (_Object$keys2 = Object.keys(diff)) === null || _Object$keys2 === void 0 ? void 0 : (_Object$keys2$map = _Object$keys2.map) === null || _Object$keys2$map === void 0 ? void 0 : _Object$keys2$map.call(_Object$keys2, function (key) {
|
|
@@ -445,23 +453,25 @@ var RenderField = function RenderField(_ref) {
|
|
|
445
453
|
}
|
|
446
454
|
}
|
|
447
455
|
if (!isCell) {
|
|
448
|
-
_context2.next =
|
|
456
|
+
_context2.next = 21;
|
|
449
457
|
break;
|
|
450
458
|
}
|
|
451
|
-
_context2.next =
|
|
459
|
+
_context2.next = 20;
|
|
452
460
|
return form.validateFields([cellName]);
|
|
453
|
-
case 19:
|
|
454
|
-
setState({
|
|
455
|
-
cellNamePath: []
|
|
456
|
-
});
|
|
457
461
|
case 20:
|
|
458
|
-
// 单行编辑时需要 强制更新视图
|
|
459
462
|
setState({
|
|
460
|
-
|
|
461
|
-
d: Date.now()
|
|
462
|
-
}
|
|
463
|
+
cellNamePath: []
|
|
463
464
|
});
|
|
464
465
|
case 21:
|
|
466
|
+
// 单行编辑时需要 强制更新视图
|
|
467
|
+
if (virtualKey) {
|
|
468
|
+
setState({
|
|
469
|
+
forceUpdate: {
|
|
470
|
+
d: Date.now()
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
case 22:
|
|
465
475
|
case "end":
|
|
466
476
|
return _context2.stop();
|
|
467
477
|
}
|
|
@@ -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) {
|
|
@@ -172,7 +172,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
172
172
|
clearTimeout(timerRef.current);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
var equalRes = isEqualWith(rulesRef.current, _rules, customEqualForFun);
|
|
176
|
+
var proEqualRes = isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun);
|
|
177
|
+
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes ||
|
|
176
178
|
// 值变更,需要同步更新函数式的fieldProps
|
|
177
179
|
// (isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues)) ||
|
|
178
180
|
// !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
|
|
@@ -299,101 +299,108 @@ var RenderField = function RenderField(_ref) {
|
|
|
299
299
|
}, 100);
|
|
300
300
|
};
|
|
301
301
|
// 单元格更新数据时,加个防抖,防止更新频率过快,卡顿
|
|
302
|
-
var _onChange =
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
args
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
302
|
+
var _onChange = /*#__PURE__*/function () {
|
|
303
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
304
|
+
var _len2,
|
|
305
|
+
args,
|
|
306
|
+
_key2,
|
|
307
|
+
_args,
|
|
308
|
+
rowPath,
|
|
309
|
+
row,
|
|
310
|
+
orgRow,
|
|
311
|
+
_TargetComponent,
|
|
312
|
+
_TargetComponent$prop,
|
|
313
|
+
_TargetComponent$prop2,
|
|
314
|
+
_TargetComponent2,
|
|
315
|
+
_TargetComponent2$pro,
|
|
316
|
+
_TargetComponent$prop3,
|
|
317
|
+
_Object$keys,
|
|
318
|
+
_Object$keys$map,
|
|
319
|
+
diff,
|
|
320
|
+
validateFieldKeys,
|
|
321
|
+
_args2 = arguments;
|
|
322
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
323
|
+
while (1) switch (_context.prev = _context.next) {
|
|
324
|
+
case 0:
|
|
325
|
+
for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
326
|
+
args[_key2] = _args2[_key2];
|
|
327
|
+
}
|
|
328
|
+
_args = [].concat(args);
|
|
329
|
+
rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
|
|
330
|
+
row = form.getFieldValue(rowPath, true);
|
|
331
|
+
orgRow = (0, _lodash.cloneDeep)(row);
|
|
332
|
+
if (!onFieldChange) {
|
|
333
|
+
_context.next = 18;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
_args = formatArgs(args);
|
|
337
|
+
_args[1] = row;
|
|
338
|
+
_context.t0 = (_TargetComponent = TargetComponent) === null || _TargetComponent === void 0 ? void 0 : (_TargetComponent$prop = _TargetComponent.props) === null || _TargetComponent$prop === void 0 ? void 0 : _TargetComponent$prop.onFieldChange;
|
|
339
|
+
if (!_context.t0) {
|
|
340
|
+
_context.next = 12;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
339
343
|
_context.next = 12;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
344
|
+
return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, (0, _toConsumableArray2.default)(_args));
|
|
345
|
+
case 12:
|
|
346
|
+
_context.t1 = onFieldChange;
|
|
347
|
+
if (!_context.t1) {
|
|
348
|
+
_context.next = 16;
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
347
351
|
_context.next = 16;
|
|
352
|
+
return onFieldChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
353
|
+
case 16:
|
|
354
|
+
_context.next = 27;
|
|
348
355
|
break;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
_args = _args.concat([row, index, form]);
|
|
357
|
-
_context.t2 = (_TargetComponent2 = TargetComponent) === null || _TargetComponent2 === void 0 ? void 0 : (_TargetComponent2$pro = _TargetComponent2.props) === null || _TargetComponent2$pro === void 0 ? void 0 : _TargetComponent2$pro.onChange;
|
|
358
|
-
if (!_context.t2) {
|
|
356
|
+
case 18:
|
|
357
|
+
_args = _args.concat([row, index, form]);
|
|
358
|
+
_context.t2 = (_TargetComponent2 = TargetComponent) === null || _TargetComponent2 === void 0 ? void 0 : (_TargetComponent2$pro = _TargetComponent2.props) === null || _TargetComponent2$pro === void 0 ? void 0 : _TargetComponent2$pro.onChange;
|
|
359
|
+
if (!_context.t2) {
|
|
360
|
+
_context.next = 23;
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
359
363
|
_context.next = 23;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, (0, _toConsumableArray2.default)(_args));
|
|
365
|
+
case 23:
|
|
366
|
+
_context.t3 = onChange;
|
|
367
|
+
if (!_context.t3) {
|
|
368
|
+
_context.next = 27;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
367
371
|
_context.next = 27;
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
form.validateFields(validateFieldKeys);
|
|
383
|
-
}, 100);
|
|
372
|
+
return onChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
373
|
+
case 27:
|
|
374
|
+
// 判断属性是否变动
|
|
375
|
+
form.setFieldValue(rowPath, (0, _objectSpread2.default)({}, row));
|
|
376
|
+
if (!(0, _lodash.isEqual)(orgRow, row)) {
|
|
377
|
+
diff = (0, _tools.difference)(row, orgRow) || {};
|
|
378
|
+
validateFieldKeys = (_Object$keys = Object.keys(diff)) === null || _Object$keys === void 0 ? void 0 : (_Object$keys$map = _Object$keys.map) === null || _Object$keys$map === void 0 ? void 0 : _Object$keys$map.call(_Object$keys, function (key) {
|
|
379
|
+
return [].concat((0, _toConsumableArray2.default)(rowPath), [key]);
|
|
380
|
+
});
|
|
381
|
+
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
|
382
|
+
setTimeout(function () {
|
|
383
|
+
form.validateFields(validateFieldKeys);
|
|
384
|
+
}, 100);
|
|
385
|
+
}
|
|
384
386
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
if (virtualKey) {
|
|
388
|
+
setState({
|
|
389
|
+
forceUpdate: {
|
|
390
|
+
d: Date.now()
|
|
391
|
+
}
|
|
392
|
+
});
|
|
389
393
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
394
|
+
case 30:
|
|
395
|
+
case "end":
|
|
396
|
+
return _context.stop();
|
|
397
|
+
}
|
|
398
|
+
}, _callee);
|
|
399
|
+
}));
|
|
400
|
+
return function _onChange() {
|
|
401
|
+
return _ref2.apply(this, arguments);
|
|
402
|
+
};
|
|
403
|
+
}();
|
|
397
404
|
var _onblur = /*#__PURE__*/function () {
|
|
398
405
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
|
399
406
|
var _TargetComponent3, _TargetComponent3$pro, _TargetComponent$prop4;
|
|
@@ -418,26 +425,27 @@ var RenderField = function RenderField(_ref) {
|
|
|
418
425
|
_args = formatArgs([].concat(args));
|
|
419
426
|
rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
|
|
420
427
|
row = form.getFieldValue(rowPath, true);
|
|
428
|
+
if (type === 'InputNumber' && column.name) row[column.name] = args[0];
|
|
421
429
|
orgRow = (0, _lodash.cloneDeep)(row);
|
|
422
430
|
_args[1] = row;
|
|
423
431
|
_context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
|
|
424
432
|
if (!_context2.t0) {
|
|
425
|
-
_context2.next =
|
|
433
|
+
_context2.next = 11;
|
|
426
434
|
break;
|
|
427
435
|
}
|
|
428
|
-
_context2.next =
|
|
436
|
+
_context2.next = 11;
|
|
429
437
|
return (_TargetComponent$prop4 = TargetComponent.props).onBlur.apply(_TargetComponent$prop4, (0, _toConsumableArray2.default)(_args));
|
|
430
|
-
case
|
|
438
|
+
case 11:
|
|
431
439
|
_context2.t1 = onBlur;
|
|
432
440
|
if (!_context2.t1) {
|
|
433
|
-
_context2.next =
|
|
441
|
+
_context2.next = 15;
|
|
434
442
|
break;
|
|
435
443
|
}
|
|
436
|
-
_context2.next =
|
|
444
|
+
_context2.next = 15;
|
|
437
445
|
return onBlur.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
438
|
-
case
|
|
446
|
+
case 15:
|
|
439
447
|
// 判断属性是否变动
|
|
440
|
-
form.setFieldValue(rowPath, row);
|
|
448
|
+
form.setFieldValue(rowPath, (0, _objectSpread2.default)({}, row));
|
|
441
449
|
if (!(0, _lodash.isEqual)(orgRow, row)) {
|
|
442
450
|
diff = (0, _tools.difference)(row, orgRow) || {};
|
|
443
451
|
validateFieldKeys = (_Object$keys2 = Object.keys(diff)) === null || _Object$keys2 === void 0 ? void 0 : (_Object$keys2$map = _Object$keys2.map) === null || _Object$keys2$map === void 0 ? void 0 : _Object$keys2$map.call(_Object$keys2, function (key) {
|
|
@@ -448,23 +456,25 @@ var RenderField = function RenderField(_ref) {
|
|
|
448
456
|
}
|
|
449
457
|
}
|
|
450
458
|
if (!isCell) {
|
|
451
|
-
_context2.next =
|
|
459
|
+
_context2.next = 21;
|
|
452
460
|
break;
|
|
453
461
|
}
|
|
454
|
-
_context2.next =
|
|
462
|
+
_context2.next = 20;
|
|
455
463
|
return form.validateFields([cellName]);
|
|
456
|
-
case 19:
|
|
457
|
-
setState({
|
|
458
|
-
cellNamePath: []
|
|
459
|
-
});
|
|
460
464
|
case 20:
|
|
461
|
-
// 单行编辑时需要 强制更新视图
|
|
462
465
|
setState({
|
|
463
|
-
|
|
464
|
-
d: Date.now()
|
|
465
|
-
}
|
|
466
|
+
cellNamePath: []
|
|
466
467
|
});
|
|
467
468
|
case 21:
|
|
469
|
+
// 单行编辑时需要 强制更新视图
|
|
470
|
+
if (virtualKey) {
|
|
471
|
+
setState({
|
|
472
|
+
forceUpdate: {
|
|
473
|
+
d: Date.now()
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
case 22:
|
|
468
478
|
case "end":
|
|
469
479
|
return _context2.stop();
|
|
470
480
|
}
|
|
@@ -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) {
|
|
@@ -179,7 +179,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
179
179
|
clearTimeout(timerRef.current);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
var equalRes = (0, _lodash.isEqualWith)(rulesRef.current, _rules, _index.customEqualForFun);
|
|
183
|
+
var proEqualRes = (0, _lodash.isEqualWith)(fieldPropsRef.current, _fieldProps, _index.customEqualForFun);
|
|
184
|
+
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes ||
|
|
183
185
|
// 值变更,需要同步更新函数式的fieldProps
|
|
184
186
|
// (isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues)) ||
|
|
185
187
|
// !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
|