@zat-design/sisyphus-react 3.6.4-beta.11 → 3.6.4-beta.13
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.
|
@@ -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, omit, isFunction } from 'lodash';
|
|
20
|
+
import { cloneDeep, isEqual, omit, isFunction, debounce } 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,107 +296,107 @@ var RenderField = function RenderField(_ref) {
|
|
|
296
296
|
}, 100);
|
|
297
297
|
};
|
|
298
298
|
// 单元格更新数据时,加个防抖,防止更新频率过快,卡顿
|
|
299
|
-
var _onChange = /*#__PURE__*/function () {
|
|
300
|
-
var
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
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
|
-
}
|
|
340
|
-
_context.next = 12;
|
|
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
|
-
}
|
|
348
|
-
_context.next = 16;
|
|
349
|
-
return onFieldChange.apply(void 0, _toConsumableArray(_args));
|
|
350
|
-
case 16:
|
|
351
|
-
_context.next = 27;
|
|
299
|
+
var _onChange = debounce( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
300
|
+
var _len2,
|
|
301
|
+
args,
|
|
302
|
+
_key2,
|
|
303
|
+
_args,
|
|
304
|
+
rowPath,
|
|
305
|
+
row,
|
|
306
|
+
orgRow,
|
|
307
|
+
_TargetComponent,
|
|
308
|
+
_TargetComponent$prop,
|
|
309
|
+
_TargetComponent$prop2,
|
|
310
|
+
_TargetComponent2,
|
|
311
|
+
_TargetComponent2$pro,
|
|
312
|
+
_TargetComponent$prop3,
|
|
313
|
+
_Object$keys,
|
|
314
|
+
_Object$keys$map,
|
|
315
|
+
diff,
|
|
316
|
+
validateFieldKeys,
|
|
317
|
+
_args2 = arguments;
|
|
318
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
319
|
+
while (1) switch (_context.prev = _context.next) {
|
|
320
|
+
case 0:
|
|
321
|
+
if (!(!onFieldChange && !onChange)) {
|
|
322
|
+
_context.next = 2;
|
|
352
323
|
break;
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
324
|
+
}
|
|
325
|
+
return _context.abrupt("return", null);
|
|
326
|
+
case 2:
|
|
327
|
+
for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
328
|
+
args[_key2] = _args2[_key2];
|
|
329
|
+
}
|
|
330
|
+
_args = [].concat(args);
|
|
331
|
+
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
332
|
+
row = form.getFieldValue(rowPath, true);
|
|
333
|
+
orgRow = cloneDeep(row);
|
|
334
|
+
if (!onFieldChange) {
|
|
335
|
+
_context.next = 20;
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
_args = formatArgs(args);
|
|
339
|
+
_args[1] = row;
|
|
340
|
+
_context.t0 = (_TargetComponent = TargetComponent) === null || _TargetComponent === void 0 ? void 0 : (_TargetComponent$prop = _TargetComponent.props) === null || _TargetComponent$prop === void 0 ? void 0 : _TargetComponent$prop.onFieldChange;
|
|
341
|
+
if (!_context.t0) {
|
|
342
|
+
_context.next = 14;
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
_context.next = 14;
|
|
346
|
+
return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, _toConsumableArray(_args));
|
|
347
|
+
case 14:
|
|
348
|
+
_context.t1 = onFieldChange;
|
|
349
|
+
if (!_context.t1) {
|
|
350
|
+
_context.next = 18;
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
_context.next = 18;
|
|
354
|
+
return onFieldChange.apply(void 0, _toConsumableArray(_args));
|
|
355
|
+
case 18:
|
|
356
|
+
_context.next = 29;
|
|
357
|
+
break;
|
|
358
|
+
case 20:
|
|
359
|
+
_args = _args.concat([row, index, form]);
|
|
360
|
+
_context.t2 = (_TargetComponent2 = TargetComponent) === null || _TargetComponent2 === void 0 ? void 0 : (_TargetComponent2$pro = _TargetComponent2.props) === null || _TargetComponent2$pro === void 0 ? void 0 : _TargetComponent2$pro.onChange;
|
|
361
|
+
if (!_context.t2) {
|
|
362
|
+
_context.next = 25;
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
_context.next = 25;
|
|
366
|
+
return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, _toConsumableArray(_args));
|
|
367
|
+
case 25:
|
|
368
|
+
_context.t3 = onChange;
|
|
369
|
+
if (!_context.t3) {
|
|
370
|
+
_context.next = 29;
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
_context.next = 29;
|
|
374
|
+
return onChange.apply(void 0, _toConsumableArray(_args));
|
|
375
|
+
case 29:
|
|
376
|
+
// 判断属性是否变动
|
|
377
|
+
form.setFieldValue(rowPath, _objectSpread({}, row));
|
|
378
|
+
if (!isEqual(orgRow, row)) {
|
|
379
|
+
diff = difference(row, orgRow) || {};
|
|
380
|
+
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) {
|
|
381
|
+
return [].concat(_toConsumableArray(rowPath), [key]);
|
|
382
|
+
});
|
|
383
|
+
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
|
384
|
+
setTimeout(function () {
|
|
385
|
+
form.validateFields(validateFieldKeys);
|
|
386
|
+
}, 100);
|
|
367
387
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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
|
-
}
|
|
388
|
+
}
|
|
389
|
+
setState({
|
|
390
|
+
forceUpdate: {
|
|
391
|
+
d: Date.now()
|
|
383
392
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
case "end":
|
|
392
|
-
return _context.stop();
|
|
393
|
-
}
|
|
394
|
-
}, _callee);
|
|
395
|
-
}));
|
|
396
|
-
return function _onChange() {
|
|
397
|
-
return _ref2.apply(this, arguments);
|
|
398
|
-
};
|
|
399
|
-
}();
|
|
393
|
+
});
|
|
394
|
+
case 32:
|
|
395
|
+
case "end":
|
|
396
|
+
return _context.stop();
|
|
397
|
+
}
|
|
398
|
+
}, _callee);
|
|
399
|
+
})), 300);
|
|
400
400
|
var _onblur = /*#__PURE__*/function () {
|
|
401
401
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
402
402
|
var _TargetComponent3, _TargetComponent3$pro, _TargetComponent$prop4;
|
|
@@ -415,6 +415,12 @@ var RenderField = function RenderField(_ref) {
|
|
|
415
415
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
416
416
|
while (1) switch (_context2.prev = _context2.next) {
|
|
417
417
|
case 0:
|
|
418
|
+
if (onBlur) {
|
|
419
|
+
_context2.next = 2;
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
return _context2.abrupt("return", null);
|
|
423
|
+
case 2:
|
|
418
424
|
for (_len3 = _args3.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
419
425
|
args[_key3] = _args3[_key3];
|
|
420
426
|
}
|
|
@@ -425,20 +431,20 @@ var RenderField = function RenderField(_ref) {
|
|
|
425
431
|
_args[1] = row;
|
|
426
432
|
_context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
|
|
427
433
|
if (!_context2.t0) {
|
|
428
|
-
_context2.next =
|
|
434
|
+
_context2.next = 12;
|
|
429
435
|
break;
|
|
430
436
|
}
|
|
431
|
-
_context2.next =
|
|
437
|
+
_context2.next = 12;
|
|
432
438
|
return (_TargetComponent$prop4 = TargetComponent.props).onBlur.apply(_TargetComponent$prop4, _toConsumableArray(_args));
|
|
433
|
-
case
|
|
439
|
+
case 12:
|
|
434
440
|
_context2.t1 = onBlur;
|
|
435
441
|
if (!_context2.t1) {
|
|
436
|
-
_context2.next =
|
|
442
|
+
_context2.next = 16;
|
|
437
443
|
break;
|
|
438
444
|
}
|
|
439
|
-
_context2.next =
|
|
445
|
+
_context2.next = 16;
|
|
440
446
|
return onBlur.apply(void 0, _toConsumableArray(_args));
|
|
441
|
-
case
|
|
447
|
+
case 16:
|
|
442
448
|
// 判断属性是否变动
|
|
443
449
|
form.setFieldValue(rowPath, _objectSpread({}, row));
|
|
444
450
|
if (!isEqual(orgRow, row)) {
|
|
@@ -451,23 +457,23 @@ var RenderField = function RenderField(_ref) {
|
|
|
451
457
|
}
|
|
452
458
|
}
|
|
453
459
|
if (!isCell) {
|
|
454
|
-
_context2.next =
|
|
460
|
+
_context2.next = 22;
|
|
455
461
|
break;
|
|
456
462
|
}
|
|
457
|
-
_context2.next =
|
|
463
|
+
_context2.next = 21;
|
|
458
464
|
return form.validateFields([cellName]);
|
|
459
|
-
case
|
|
465
|
+
case 21:
|
|
460
466
|
setState({
|
|
461
467
|
cellNamePath: []
|
|
462
468
|
});
|
|
463
|
-
case
|
|
469
|
+
case 22:
|
|
464
470
|
// 单行编辑时需要 强制更新视图
|
|
465
471
|
setState({
|
|
466
472
|
forceUpdate: {
|
|
467
473
|
d: Date.now()
|
|
468
474
|
}
|
|
469
475
|
});
|
|
470
|
-
case
|
|
476
|
+
case 23:
|
|
471
477
|
case "end":
|
|
472
478
|
return _context2.stop();
|
|
473
479
|
}
|
|
@@ -299,107 +299,107 @@ var RenderField = function RenderField(_ref) {
|
|
|
299
299
|
}, 100);
|
|
300
300
|
};
|
|
301
301
|
// 单元格更新数据时,加个防抖,防止更新频率过快,卡顿
|
|
302
|
-
var _onChange = /*#__PURE__*/function () {
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
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
|
-
}
|
|
343
|
-
_context.next = 12;
|
|
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
|
-
}
|
|
351
|
-
_context.next = 16;
|
|
352
|
-
return onFieldChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
353
|
-
case 16:
|
|
354
|
-
_context.next = 27;
|
|
302
|
+
var _onChange = (0, _lodash.debounce)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
303
|
+
var _len2,
|
|
304
|
+
args,
|
|
305
|
+
_key2,
|
|
306
|
+
_args,
|
|
307
|
+
rowPath,
|
|
308
|
+
row,
|
|
309
|
+
orgRow,
|
|
310
|
+
_TargetComponent,
|
|
311
|
+
_TargetComponent$prop,
|
|
312
|
+
_TargetComponent$prop2,
|
|
313
|
+
_TargetComponent2,
|
|
314
|
+
_TargetComponent2$pro,
|
|
315
|
+
_TargetComponent$prop3,
|
|
316
|
+
_Object$keys,
|
|
317
|
+
_Object$keys$map,
|
|
318
|
+
diff,
|
|
319
|
+
validateFieldKeys,
|
|
320
|
+
_args2 = arguments;
|
|
321
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
322
|
+
while (1) switch (_context.prev = _context.next) {
|
|
323
|
+
case 0:
|
|
324
|
+
if (!(!onFieldChange && !onChange)) {
|
|
325
|
+
_context.next = 2;
|
|
355
326
|
break;
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
327
|
+
}
|
|
328
|
+
return _context.abrupt("return", null);
|
|
329
|
+
case 2:
|
|
330
|
+
for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
331
|
+
args[_key2] = _args2[_key2];
|
|
332
|
+
}
|
|
333
|
+
_args = [].concat(args);
|
|
334
|
+
rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
|
|
335
|
+
row = form.getFieldValue(rowPath, true);
|
|
336
|
+
orgRow = (0, _lodash.cloneDeep)(row);
|
|
337
|
+
if (!onFieldChange) {
|
|
338
|
+
_context.next = 20;
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
_args = formatArgs(args);
|
|
342
|
+
_args[1] = row;
|
|
343
|
+
_context.t0 = (_TargetComponent = TargetComponent) === null || _TargetComponent === void 0 ? void 0 : (_TargetComponent$prop = _TargetComponent.props) === null || _TargetComponent$prop === void 0 ? void 0 : _TargetComponent$prop.onFieldChange;
|
|
344
|
+
if (!_context.t0) {
|
|
345
|
+
_context.next = 14;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
_context.next = 14;
|
|
349
|
+
return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, (0, _toConsumableArray2.default)(_args));
|
|
350
|
+
case 14:
|
|
351
|
+
_context.t1 = onFieldChange;
|
|
352
|
+
if (!_context.t1) {
|
|
353
|
+
_context.next = 18;
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
_context.next = 18;
|
|
357
|
+
return onFieldChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
358
|
+
case 18:
|
|
359
|
+
_context.next = 29;
|
|
360
|
+
break;
|
|
361
|
+
case 20:
|
|
362
|
+
_args = _args.concat([row, index, form]);
|
|
363
|
+
_context.t2 = (_TargetComponent2 = TargetComponent) === null || _TargetComponent2 === void 0 ? void 0 : (_TargetComponent2$pro = _TargetComponent2.props) === null || _TargetComponent2$pro === void 0 ? void 0 : _TargetComponent2$pro.onChange;
|
|
364
|
+
if (!_context.t2) {
|
|
365
|
+
_context.next = 25;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
_context.next = 25;
|
|
369
|
+
return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, (0, _toConsumableArray2.default)(_args));
|
|
370
|
+
case 25:
|
|
371
|
+
_context.t3 = onChange;
|
|
372
|
+
if (!_context.t3) {
|
|
373
|
+
_context.next = 29;
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
_context.next = 29;
|
|
377
|
+
return onChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
378
|
+
case 29:
|
|
379
|
+
// 判断属性是否变动
|
|
380
|
+
form.setFieldValue(rowPath, (0, _objectSpread2.default)({}, row));
|
|
381
|
+
if (!(0, _lodash.isEqual)(orgRow, row)) {
|
|
382
|
+
diff = (0, _tools.difference)(row, orgRow) || {};
|
|
383
|
+
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) {
|
|
384
|
+
return [].concat((0, _toConsumableArray2.default)(rowPath), [key]);
|
|
385
|
+
});
|
|
386
|
+
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
|
387
|
+
setTimeout(function () {
|
|
388
|
+
form.validateFields(validateFieldKeys);
|
|
389
|
+
}, 100);
|
|
370
390
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|
-
}
|
|
391
|
+
}
|
|
392
|
+
setState({
|
|
393
|
+
forceUpdate: {
|
|
394
|
+
d: Date.now()
|
|
386
395
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
case "end":
|
|
395
|
-
return _context.stop();
|
|
396
|
-
}
|
|
397
|
-
}, _callee);
|
|
398
|
-
}));
|
|
399
|
-
return function _onChange() {
|
|
400
|
-
return _ref2.apply(this, arguments);
|
|
401
|
-
};
|
|
402
|
-
}();
|
|
396
|
+
});
|
|
397
|
+
case 32:
|
|
398
|
+
case "end":
|
|
399
|
+
return _context.stop();
|
|
400
|
+
}
|
|
401
|
+
}, _callee);
|
|
402
|
+
})), 300);
|
|
403
403
|
var _onblur = /*#__PURE__*/function () {
|
|
404
404
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
|
405
405
|
var _TargetComponent3, _TargetComponent3$pro, _TargetComponent$prop4;
|
|
@@ -418,6 +418,12 @@ var RenderField = function RenderField(_ref) {
|
|
|
418
418
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
419
419
|
while (1) switch (_context2.prev = _context2.next) {
|
|
420
420
|
case 0:
|
|
421
|
+
if (onBlur) {
|
|
422
|
+
_context2.next = 2;
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
return _context2.abrupt("return", null);
|
|
426
|
+
case 2:
|
|
421
427
|
for (_len3 = _args3.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
422
428
|
args[_key3] = _args3[_key3];
|
|
423
429
|
}
|
|
@@ -428,20 +434,20 @@ var RenderField = function RenderField(_ref) {
|
|
|
428
434
|
_args[1] = row;
|
|
429
435
|
_context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
|
|
430
436
|
if (!_context2.t0) {
|
|
431
|
-
_context2.next =
|
|
437
|
+
_context2.next = 12;
|
|
432
438
|
break;
|
|
433
439
|
}
|
|
434
|
-
_context2.next =
|
|
440
|
+
_context2.next = 12;
|
|
435
441
|
return (_TargetComponent$prop4 = TargetComponent.props).onBlur.apply(_TargetComponent$prop4, (0, _toConsumableArray2.default)(_args));
|
|
436
|
-
case
|
|
442
|
+
case 12:
|
|
437
443
|
_context2.t1 = onBlur;
|
|
438
444
|
if (!_context2.t1) {
|
|
439
|
-
_context2.next =
|
|
445
|
+
_context2.next = 16;
|
|
440
446
|
break;
|
|
441
447
|
}
|
|
442
|
-
_context2.next =
|
|
448
|
+
_context2.next = 16;
|
|
443
449
|
return onBlur.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
444
|
-
case
|
|
450
|
+
case 16:
|
|
445
451
|
// 判断属性是否变动
|
|
446
452
|
form.setFieldValue(rowPath, (0, _objectSpread2.default)({}, row));
|
|
447
453
|
if (!(0, _lodash.isEqual)(orgRow, row)) {
|
|
@@ -454,23 +460,23 @@ var RenderField = function RenderField(_ref) {
|
|
|
454
460
|
}
|
|
455
461
|
}
|
|
456
462
|
if (!isCell) {
|
|
457
|
-
_context2.next =
|
|
463
|
+
_context2.next = 22;
|
|
458
464
|
break;
|
|
459
465
|
}
|
|
460
|
-
_context2.next =
|
|
466
|
+
_context2.next = 21;
|
|
461
467
|
return form.validateFields([cellName]);
|
|
462
|
-
case
|
|
468
|
+
case 21:
|
|
463
469
|
setState({
|
|
464
470
|
cellNamePath: []
|
|
465
471
|
});
|
|
466
|
-
case
|
|
472
|
+
case 22:
|
|
467
473
|
// 单行编辑时需要 强制更新视图
|
|
468
474
|
setState({
|
|
469
475
|
forceUpdate: {
|
|
470
476
|
d: Date.now()
|
|
471
477
|
}
|
|
472
478
|
});
|
|
473
|
-
case
|
|
479
|
+
case 23:
|
|
474
480
|
case "end":
|
|
475
481
|
return _context2.stop();
|
|
476
482
|
}
|