@zat-design/sisyphus-react 3.6.4-beta.9 → 3.6.5

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, debounce, 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,108 +296,101 @@ var RenderField = function RenderField(_ref) {
296
296
  }, 100);
297
297
  };
298
298
  // 单元格更新数据时,加个防抖,防止更新频率过快,卡顿
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
- }
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
+ for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
322
+ args[_key2] = _args2[_key2];
323
+ }
324
+ _args = [].concat(args);
325
+ rowPath = [].concat(_toConsumableArray(namePath), [index]);
326
+ row = form.getFieldValue(rowPath, true); // if (type === 'InputNumber' && column.name) row[column.name] = args[0];
327
+ orgRow = cloneDeep(row);
328
+ if (!onFieldChange) {
329
+ _context.next = 18;
330
+ break;
331
+ }
332
+ _args = formatArgs(args);
333
+ _args[1] = row;
334
+ _context.t0 = (_TargetComponent = TargetComponent) === null || _TargetComponent === void 0 ? void 0 : (_TargetComponent$prop = _TargetComponent.props) === null || _TargetComponent$prop === void 0 ? void 0 : _TargetComponent$prop.onFieldChange;
335
+ if (!_context.t0) {
340
336
  _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
- }
337
+ break;
338
+ }
339
+ _context.next = 12;
340
+ return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, _toConsumableArray(_args));
341
+ case 12:
342
+ _context.t1 = onFieldChange;
343
+ if (!_context.t1) {
348
344
  _context.next = 16;
349
- return onFieldChange.apply(void 0, _toConsumableArray(_args));
350
- case 16:
351
- _context.next = 27;
352
345
  break;
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
- }
346
+ }
347
+ _context.next = 16;
348
+ return onFieldChange.apply(void 0, _toConsumableArray(_args));
349
+ case 16:
350
+ _context.next = 27;
351
+ break;
352
+ case 18:
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) {
360
356
  _context.next = 23;
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
- }
357
+ break;
358
+ }
359
+ _context.next = 23;
360
+ return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, _toConsumableArray(_args));
361
+ case 23:
362
+ _context.t3 = onChange;
363
+ if (!_context.t3) {
368
364
  _context.next = 27;
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
- }
365
+ break;
366
+ }
367
+ _context.next = 27;
368
+ return onChange.apply(void 0, _toConsumableArray(_args));
369
+ case 27:
370
+ // 判断属性是否变动
371
+ form.setFieldValue(rowPath, row);
372
+ if (!isEqual(orgRow, row)) {
373
+ diff = difference(row, orgRow) || {};
374
+ 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) {
375
+ return [].concat(_toConsumableArray(rowPath), [key]);
376
+ });
377
+ if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
378
+ setTimeout(function () {
379
+ form.validateFields(validateFieldKeys);
380
+ }, 100);
383
381
  }
384
- if (virtualKey) {
385
- setState({
386
- forceUpdate: {
387
- d: Date.now()
388
- }
389
- });
382
+ }
383
+ setState({
384
+ forceUpdate: {
385
+ d: Date.now()
390
386
  }
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
- }();
387
+ });
388
+ case 30:
389
+ case "end":
390
+ return _context.stop();
391
+ }
392
+ }, _callee);
393
+ })), 300);
401
394
  var _onblur = /*#__PURE__*/function () {
402
395
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
403
396
  var _TargetComponent3, _TargetComponent3$pro, _TargetComponent$prop4;
@@ -441,7 +434,7 @@ var RenderField = function RenderField(_ref) {
441
434
  return onBlur.apply(void 0, _toConsumableArray(_args));
442
435
  case 14:
443
436
  // 判断属性是否变动
444
- form.setFieldValue(rowPath, _objectSpread({}, row));
437
+ form.setFieldValue(rowPath, row);
445
438
  if (!isEqual(orgRow, row)) {
446
439
  diff = difference(row, orgRow) || {};
447
440
  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) {
@@ -463,13 +456,11 @@ var RenderField = function RenderField(_ref) {
463
456
  });
464
457
  case 20:
465
458
  // 单行编辑时需要 强制更新视图
466
- if (virtualKey) {
467
- setState({
468
- forceUpdate: {
469
- d: Date.now()
470
- }
471
- });
472
- }
459
+ setState({
460
+ forceUpdate: {
461
+ d: Date.now()
462
+ }
463
+ });
473
464
  case 21:
474
465
  case "end":
475
466
  return _context2.stop();
@@ -34,7 +34,7 @@ var FormFooter = function FormFooter(props) {
34
34
  form.setFieldsValue(cache[formId]);
35
35
  }
36
36
  return cache;
37
- }, []);
37
+ }, [formId]);
38
38
  var _onOk = function _onOk() {
39
39
  if (formId) {
40
40
  var values = form.getFieldsValue();
@@ -35,7 +35,6 @@ var limitNumber = function limitNumber(num, _ref) {
35
35
  return num;
36
36
  };
37
37
  var InputNumber = function InputNumber(props) {
38
- var _props$precision4;
39
38
  var placeholder = props.placeholder,
40
39
  className = props.className,
41
40
  otherProps = props.otherProps,
@@ -56,33 +55,28 @@ var InputNumber = function InputNumber(props) {
56
55
  var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
57
56
  var valueProps = {};
58
57
  var formatter = function formatter(value) {
59
- var _props$precision;
60
58
  if (value === '') return '';
61
59
  var num = Number(value);
62
60
  if (Number.isNaN(num)) {
63
61
  return value;
64
62
  }
65
63
  var val = num.toLocaleString('en-US', {
66
- maximumFractionDigits: (_props$precision = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision !== void 0 ? _props$precision : 2
64
+ maximumFractionDigits: (props === null || props === void 0 ? void 0 : props.precision) || 2
67
65
  });
68
66
  if (!activateRef.current) {
69
- var _props$precision2;
70
67
  var _val$split = val.split('.'),
71
68
  _val$split2 = _slicedToArray(_val$split, 2),
72
69
  int = _val$split2[0],
73
70
  _val$split2$ = _val$split2[1],
74
71
  float = _val$split2$ === void 0 ? '' : _val$split2$;
75
- if ((props === null || props === void 0 ? void 0 : props.precision) === 0) {
76
- return int;
77
- }
78
- return "".concat(int, ".").concat(float.padEnd((_props$precision2 = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision2 !== void 0 ? _props$precision2 : 2, '0'));
72
+ return "".concat(int, ".").concat(float.padEnd((props === null || props === void 0 ? void 0 : props.precision) || 2, '0'));
79
73
  }
80
74
  return val;
81
75
  };
82
76
  var _parser = function parser(value, precision) {
83
- if (value === '') return value;
84
77
  var num = Number(value.replace(/[\s,]+/g, ''));
85
- return Number.isNaN(num) || !precision && precision !== 0 ? Number.isNaN(Number(value)) ? null : value : num.toFixed(precision);
78
+ if (value === '') return value;
79
+ return Number.isNaN(num) || !precision ? value : num.toFixed(precision);
86
80
  };
87
81
  if (valueType) {
88
82
  switch (valueType) {
@@ -94,10 +88,8 @@ var InputNumber = function InputNumber(props) {
94
88
  valueProps = {
95
89
  formatter: formatter,
96
90
  parser: function parser(val) {
97
- var _props$precision3;
98
- return _parser(val, (_props$precision3 = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision3 !== void 0 ? _props$precision3 : 2);
99
- },
100
- precision: (_props$precision4 = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision4 !== void 0 ? _props$precision4 : 2
91
+ return _parser(val, (props === null || props === void 0 ? void 0 : props.precision) || 2);
92
+ }
101
93
  };
102
94
  break;
103
95
  // 百分比
@@ -185,7 +177,7 @@ var InputNumber = function InputNumber(props) {
185
177
  var originValue = calc(Number(value), '/', 100);
186
178
  // 获取真实数据的小数位数
187
179
  var decimalDigits = getDecimalDigits(originValue);
188
- if (decimalDigits > (precision !== null && precision !== void 0 ? precision : 4)) {
180
+ if (decimalDigits > (precision || 4)) {
189
181
  return _jsx(Container, {
190
182
  viewEmpty: viewEmpty,
191
183
  children: value
@@ -203,7 +195,7 @@ var InputNumber = function InputNumber(props) {
203
195
  var _originValue = calc(Number(value), '/', 1000);
204
196
  // 获取真实数据的小数位数
205
197
  var _decimalDigits = getDecimalDigits(_originValue);
206
- if (_decimalDigits > (precision !== null && precision !== void 0 ? precision : 5)) {
198
+ if (_decimalDigits > (precision || 5)) {
207
199
  return _jsx(Container, {
208
200
  viewEmpty: viewEmpty,
209
201
  children: value
@@ -220,7 +212,7 @@ var InputNumber = function InputNumber(props) {
220
212
  case 'thousandth':
221
213
  return _jsx(Container, {
222
214
  viewEmpty: viewEmpty,
223
- children: tools.formatAmount(value, precision !== null && precision !== void 0 ? precision : 2)
215
+ children: tools.formatAmount(value, precision || 2)
224
216
  });
225
217
  // CNY千分位
226
218
  case 'thousandthCNY':
@@ -240,7 +232,7 @@ var InputNumber = function InputNumber(props) {
240
232
  }
241
233
  // 失去焦点时处理数字,
242
234
  var handleBlur = function handleBlur(e) {
243
- var _e$target, _props$precision5, _valueProps3, _e$target2;
235
+ var _e$target, _e$target2;
244
236
  activateRef.current = false;
245
237
  var value = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value;
246
238
  if (_max !== undefined && value > _max) {
@@ -249,8 +241,7 @@ var InputNumber = function InputNumber(props) {
249
241
  if (_min !== undefined && value < _min) {
250
242
  value = _min;
251
243
  }
252
- value = _parser(String(value), (_props$precision5 = props.precision) !== null && _props$precision5 !== void 0 ? _props$precision5 : (_valueProps3 = valueProps) === null || _valueProps3 === void 0 ? void 0 : _valueProps3.precision);
253
- rest === null || rest === void 0 ? void 0 : rest.onChange(value);
244
+ value = _parser(String(value), props.precision);
254
245
  var limit = {
255
246
  min: Number(_min),
256
247
  max: Number(_max)
@@ -5,7 +5,6 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  import { forwardRef, useCallback, useImperativeHandle } from 'react';
7
7
  import { DndContext } from '@dnd-kit/core';
8
- import { cloneDeep, isFunction } from 'lodash';
9
8
  import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
10
9
  import { toArray } from '../../../utils';
11
10
  import { namesPathTransform } from './utils';
@@ -56,10 +55,6 @@ var FormList = function FormList(props, ref) {
56
55
  listName: [].concat(_toConsumableArray(namePath), [item.name]),
57
56
  label: mode === 'less' ? undefined : item.label
58
57
  });
59
- // 可编辑表格的columns需要消除引用关系,防止串数据
60
- if (column.type === 'ProEditTable' && !isFunction(column.fieldProps)) {
61
- column.fieldProps.columns = cloneDeep(column.fieldProps.columns);
62
- }
63
58
  return column;
64
59
  });
65
60
  }, [columns]);
@@ -160,7 +160,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
160
160
  var defaultOptionRender = function defaultOptionRender(rowData) {
161
161
  return rowData === null || rowData === void 0 ? void 0 : rowData[labelKey];
162
162
  };
163
- var handleFormat = optionRender || onFormat || defaultOptionRender;
163
+ var handleFormat = onFormat || defaultOptionRender;
164
164
  if (showCodeName) {
165
165
  handleFormat = function handleFormat(_ref5) {
166
166
  var value = _ref5.value,
@@ -681,6 +681,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
681
681
  showCodeName: showCodeName,
682
682
  labelInValue: labelInValue,
683
683
  dataSource: options,
684
+ optionRender: optionRender,
684
685
  scrollFollowParent: false,
685
686
  mode: isMultiple ? 'multiple' : undefined,
686
687
  onFocus: function onFocus() {
@@ -299,108 +299,101 @@ var RenderField = function RenderField(_ref) {
299
299
  }, 100);
300
300
  };
301
301
  // 单元格更新数据时,加个防抖,防止更新频率过快,卡顿
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
- }
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
+ for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
325
+ args[_key2] = _args2[_key2];
326
+ }
327
+ _args = [].concat(args);
328
+ rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
329
+ row = form.getFieldValue(rowPath, true); // if (type === 'InputNumber' && column.name) row[column.name] = args[0];
330
+ orgRow = (0, _lodash.cloneDeep)(row);
331
+ if (!onFieldChange) {
332
+ _context.next = 18;
333
+ break;
334
+ }
335
+ _args = formatArgs(args);
336
+ _args[1] = row;
337
+ _context.t0 = (_TargetComponent = TargetComponent) === null || _TargetComponent === void 0 ? void 0 : (_TargetComponent$prop = _TargetComponent.props) === null || _TargetComponent$prop === void 0 ? void 0 : _TargetComponent$prop.onFieldChange;
338
+ if (!_context.t0) {
343
339
  _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
- }
340
+ break;
341
+ }
342
+ _context.next = 12;
343
+ return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, (0, _toConsumableArray2.default)(_args));
344
+ case 12:
345
+ _context.t1 = onFieldChange;
346
+ if (!_context.t1) {
351
347
  _context.next = 16;
352
- return onFieldChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
353
- case 16:
354
- _context.next = 27;
355
348
  break;
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
- }
349
+ }
350
+ _context.next = 16;
351
+ return onFieldChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
352
+ case 16:
353
+ _context.next = 27;
354
+ break;
355
+ case 18:
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) {
363
359
  _context.next = 23;
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
- }
360
+ break;
361
+ }
362
+ _context.next = 23;
363
+ return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, (0, _toConsumableArray2.default)(_args));
364
+ case 23:
365
+ _context.t3 = onChange;
366
+ if (!_context.t3) {
371
367
  _context.next = 27;
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
- }
368
+ break;
369
+ }
370
+ _context.next = 27;
371
+ return onChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
372
+ case 27:
373
+ // 判断属性是否变动
374
+ form.setFieldValue(rowPath, row);
375
+ if (!(0, _lodash.isEqual)(orgRow, row)) {
376
+ diff = (0, _tools.difference)(row, orgRow) || {};
377
+ 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) {
378
+ return [].concat((0, _toConsumableArray2.default)(rowPath), [key]);
379
+ });
380
+ if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
381
+ setTimeout(function () {
382
+ form.validateFields(validateFieldKeys);
383
+ }, 100);
386
384
  }
387
- if (virtualKey) {
388
- setState({
389
- forceUpdate: {
390
- d: Date.now()
391
- }
392
- });
385
+ }
386
+ setState({
387
+ forceUpdate: {
388
+ d: Date.now()
393
389
  }
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
- }();
390
+ });
391
+ case 30:
392
+ case "end":
393
+ return _context.stop();
394
+ }
395
+ }, _callee);
396
+ })), 300);
404
397
  var _onblur = /*#__PURE__*/function () {
405
398
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
406
399
  var _TargetComponent3, _TargetComponent3$pro, _TargetComponent$prop4;
@@ -444,7 +437,7 @@ var RenderField = function RenderField(_ref) {
444
437
  return onBlur.apply(void 0, (0, _toConsumableArray2.default)(_args));
445
438
  case 14:
446
439
  // 判断属性是否变动
447
- form.setFieldValue(rowPath, (0, _objectSpread2.default)({}, row));
440
+ form.setFieldValue(rowPath, row);
448
441
  if (!(0, _lodash.isEqual)(orgRow, row)) {
449
442
  diff = (0, _tools.difference)(row, orgRow) || {};
450
443
  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) {
@@ -466,13 +459,11 @@ var RenderField = function RenderField(_ref) {
466
459
  });
467
460
  case 20:
468
461
  // 单行编辑时需要 强制更新视图
469
- if (virtualKey) {
470
- setState({
471
- forceUpdate: {
472
- d: Date.now()
473
- }
474
- });
475
- }
462
+ setState({
463
+ forceUpdate: {
464
+ d: Date.now()
465
+ }
466
+ });
476
467
  case 21:
477
468
  case "end":
478
469
  return _context2.stop();
@@ -38,7 +38,7 @@ var FormFooter = function FormFooter(props) {
38
38
  form.setFieldsValue(cache[formId]);
39
39
  }
40
40
  return cache;
41
- }, []);
41
+ }, [formId]);
42
42
  var _onOk = function _onOk() {
43
43
  if (formId) {
44
44
  var values = form.getFieldsValue();
@@ -39,7 +39,6 @@ var limitNumber = function limitNumber(num, _ref) {
39
39
  return num;
40
40
  };
41
41
  var InputNumber = function InputNumber(props) {
42
- var _props$precision4;
43
42
  var placeholder = props.placeholder,
44
43
  className = props.className,
45
44
  otherProps = props.otherProps,
@@ -60,33 +59,28 @@ var InputNumber = function InputNumber(props) {
60
59
  var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
61
60
  var valueProps = {};
62
61
  var formatter = function formatter(value) {
63
- var _props$precision;
64
62
  if (value === '') return '';
65
63
  var num = Number(value);
66
64
  if (Number.isNaN(num)) {
67
65
  return value;
68
66
  }
69
67
  var val = num.toLocaleString('en-US', {
70
- maximumFractionDigits: (_props$precision = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision !== void 0 ? _props$precision : 2
68
+ maximumFractionDigits: (props === null || props === void 0 ? void 0 : props.precision) || 2
71
69
  });
72
70
  if (!activateRef.current) {
73
- var _props$precision2;
74
71
  var _val$split = val.split('.'),
75
72
  _val$split2 = (0, _slicedToArray2.default)(_val$split, 2),
76
73
  int = _val$split2[0],
77
74
  _val$split2$ = _val$split2[1],
78
75
  float = _val$split2$ === void 0 ? '' : _val$split2$;
79
- if ((props === null || props === void 0 ? void 0 : props.precision) === 0) {
80
- return int;
81
- }
82
- return "".concat(int, ".").concat(float.padEnd((_props$precision2 = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision2 !== void 0 ? _props$precision2 : 2, '0'));
76
+ return "".concat(int, ".").concat(float.padEnd((props === null || props === void 0 ? void 0 : props.precision) || 2, '0'));
83
77
  }
84
78
  return val;
85
79
  };
86
80
  var _parser = function parser(value, precision) {
87
- if (value === '') return value;
88
81
  var num = Number(value.replace(/[\s,]+/g, ''));
89
- return Number.isNaN(num) || !precision && precision !== 0 ? Number.isNaN(Number(value)) ? null : value : num.toFixed(precision);
82
+ if (value === '') return value;
83
+ return Number.isNaN(num) || !precision ? value : num.toFixed(precision);
90
84
  };
91
85
  if (valueType) {
92
86
  switch (valueType) {
@@ -98,10 +92,8 @@ var InputNumber = function InputNumber(props) {
98
92
  valueProps = {
99
93
  formatter: formatter,
100
94
  parser: function parser(val) {
101
- var _props$precision3;
102
- return _parser(val, (_props$precision3 = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision3 !== void 0 ? _props$precision3 : 2);
103
- },
104
- precision: (_props$precision4 = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision4 !== void 0 ? _props$precision4 : 2
95
+ return _parser(val, (props === null || props === void 0 ? void 0 : props.precision) || 2);
96
+ }
105
97
  };
106
98
  break;
107
99
  // 百分比
@@ -189,7 +181,7 @@ var InputNumber = function InputNumber(props) {
189
181
  var originValue = calc(Number(value), '/', 100);
190
182
  // 获取真实数据的小数位数
191
183
  var decimalDigits = (0, _index.getDecimalDigits)(originValue);
192
- if (decimalDigits > (precision !== null && precision !== void 0 ? precision : 4)) {
184
+ if (decimalDigits > (precision || 4)) {
193
185
  return (0, _jsxRuntime.jsx)(_Container.default, {
194
186
  viewEmpty: viewEmpty,
195
187
  children: value
@@ -207,7 +199,7 @@ var InputNumber = function InputNumber(props) {
207
199
  var _originValue = calc(Number(value), '/', 1000);
208
200
  // 获取真实数据的小数位数
209
201
  var _decimalDigits = (0, _index.getDecimalDigits)(_originValue);
210
- if (_decimalDigits > (precision !== null && precision !== void 0 ? precision : 5)) {
202
+ if (_decimalDigits > (precision || 5)) {
211
203
  return (0, _jsxRuntime.jsx)(_Container.default, {
212
204
  viewEmpty: viewEmpty,
213
205
  children: value
@@ -224,7 +216,7 @@ var InputNumber = function InputNumber(props) {
224
216
  case 'thousandth':
225
217
  return (0, _jsxRuntime.jsx)(_Container.default, {
226
218
  viewEmpty: viewEmpty,
227
- children: _utils.tools.formatAmount(value, precision !== null && precision !== void 0 ? precision : 2)
219
+ children: _utils.tools.formatAmount(value, precision || 2)
228
220
  });
229
221
  // CNY千分位
230
222
  case 'thousandthCNY':
@@ -244,7 +236,7 @@ var InputNumber = function InputNumber(props) {
244
236
  }
245
237
  // 失去焦点时处理数字,
246
238
  var handleBlur = function handleBlur(e) {
247
- var _e$target, _props$precision5, _valueProps3, _e$target2;
239
+ var _e$target, _e$target2;
248
240
  activateRef.current = false;
249
241
  var value = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value;
250
242
  if (_max !== undefined && value > _max) {
@@ -253,8 +245,7 @@ var InputNumber = function InputNumber(props) {
253
245
  if (_min !== undefined && value < _min) {
254
246
  value = _min;
255
247
  }
256
- value = _parser(String(value), (_props$precision5 = props.precision) !== null && _props$precision5 !== void 0 ? _props$precision5 : (_valueProps3 = valueProps) === null || _valueProps3 === void 0 ? void 0 : _valueProps3.precision);
257
- rest === null || rest === void 0 ? void 0 : rest.onChange(value);
248
+ value = _parser(String(value), props.precision);
258
249
  var limit = {
259
250
  min: Number(_min),
260
251
  max: Number(_max)
@@ -11,7 +11,6 @@ var _jsxRuntime = require("react/jsx-runtime");
11
11
  var _react = require("react");
12
12
  var _antd = require("antd");
13
13
  var _core = require("@dnd-kit/core");
14
- var _lodash = require("lodash");
15
14
  var _sortable = require("@dnd-kit/sortable");
16
15
  var _utils = require("../../../utils");
17
16
  var _utils2 = require("./utils");
@@ -62,10 +61,6 @@ var FormList = function FormList(props, ref) {
62
61
  listName: [].concat((0, _toConsumableArray2.default)(namePath), [item.name]),
63
62
  label: mode === 'less' ? undefined : item.label
64
63
  });
65
- // 可编辑表格的columns需要消除引用关系,防止串数据
66
- if (column.type === 'ProEditTable' && !(0, _lodash.isFunction)(column.fieldProps)) {
67
- column.fieldProps.columns = (0, _lodash.cloneDeep)(column.fieldProps.columns);
68
- }
69
64
  return column;
70
65
  });
71
66
  }, [columns]);
@@ -157,7 +157,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
157
157
  var defaultOptionRender = function defaultOptionRender(rowData) {
158
158
  return rowData === null || rowData === void 0 ? void 0 : rowData[labelKey];
159
159
  };
160
- var handleFormat = optionRender || onFormat || defaultOptionRender;
160
+ var handleFormat = onFormat || defaultOptionRender;
161
161
  if (showCodeName) {
162
162
  handleFormat = function handleFormat(_ref5) {
163
163
  var value = _ref5.value,
@@ -678,6 +678,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
678
678
  showCodeName: showCodeName,
679
679
  labelInValue: labelInValue,
680
680
  dataSource: options,
681
+ optionRender: optionRender,
681
682
  scrollFollowParent: false,
682
683
  mode: isMultiple ? 'multiple' : undefined,
683
684
  onFocus: function onFocus() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.6.4-beta.9",
3
+ "version": "3.6.5",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",