@zat-design/sisyphus-react 3.6.4-beta.13 → 3.6.4-beta.15

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, debounce } 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';
@@ -318,63 +318,57 @@ var RenderField = function RenderField(_ref) {
318
318
  return _regeneratorRuntime().wrap(function _callee$(_context) {
319
319
  while (1) switch (_context.prev = _context.next) {
320
320
  case 0:
321
- if (!(!onFieldChange && !onChange)) {
322
- _context.next = 2;
323
- break;
324
- }
325
- return _context.abrupt("return", null);
326
- case 2:
327
321
  for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
328
322
  args[_key2] = _args2[_key2];
329
323
  }
330
324
  _args = [].concat(args);
331
325
  rowPath = [].concat(_toConsumableArray(namePath), [index]);
332
- row = form.getFieldValue(rowPath, true);
326
+ row = form.getFieldValue(rowPath, true); // if (type === 'InputNumber' && column.name) row[column.name] = args[0];
333
327
  orgRow = cloneDeep(row);
334
328
  if (!onFieldChange) {
335
- _context.next = 20;
329
+ _context.next = 18;
336
330
  break;
337
331
  }
338
332
  _args = formatArgs(args);
339
333
  _args[1] = row;
340
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;
341
335
  if (!_context.t0) {
342
- _context.next = 14;
336
+ _context.next = 12;
343
337
  break;
344
338
  }
345
- _context.next = 14;
339
+ _context.next = 12;
346
340
  return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, _toConsumableArray(_args));
347
- case 14:
341
+ case 12:
348
342
  _context.t1 = onFieldChange;
349
343
  if (!_context.t1) {
350
- _context.next = 18;
344
+ _context.next = 16;
351
345
  break;
352
346
  }
353
- _context.next = 18;
347
+ _context.next = 16;
354
348
  return onFieldChange.apply(void 0, _toConsumableArray(_args));
355
- case 18:
356
- _context.next = 29;
349
+ case 16:
350
+ _context.next = 27;
357
351
  break;
358
- case 20:
352
+ case 18:
359
353
  _args = _args.concat([row, index, form]);
360
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;
361
355
  if (!_context.t2) {
362
- _context.next = 25;
356
+ _context.next = 23;
363
357
  break;
364
358
  }
365
- _context.next = 25;
359
+ _context.next = 23;
366
360
  return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, _toConsumableArray(_args));
367
- case 25:
361
+ case 23:
368
362
  _context.t3 = onChange;
369
363
  if (!_context.t3) {
370
- _context.next = 29;
364
+ _context.next = 27;
371
365
  break;
372
366
  }
373
- _context.next = 29;
367
+ _context.next = 27;
374
368
  return onChange.apply(void 0, _toConsumableArray(_args));
375
- case 29:
369
+ case 27:
376
370
  // 判断属性是否变动
377
- form.setFieldValue(rowPath, _objectSpread({}, row));
371
+ form.setFieldValue(rowPath, row);
378
372
  if (!isEqual(orgRow, row)) {
379
373
  diff = difference(row, orgRow) || {};
380
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) {
@@ -391,7 +385,7 @@ var RenderField = function RenderField(_ref) {
391
385
  d: Date.now()
392
386
  }
393
387
  });
394
- case 32:
388
+ case 30:
395
389
  case "end":
396
390
  return _context.stop();
397
391
  }
@@ -415,12 +409,6 @@ var RenderField = function RenderField(_ref) {
415
409
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
416
410
  while (1) switch (_context2.prev = _context2.next) {
417
411
  case 0:
418
- if (onBlur) {
419
- _context2.next = 2;
420
- break;
421
- }
422
- return _context2.abrupt("return", null);
423
- case 2:
424
412
  for (_len3 = _args3.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
425
413
  args[_key3] = _args3[_key3];
426
414
  }
@@ -431,22 +419,22 @@ var RenderField = function RenderField(_ref) {
431
419
  _args[1] = row;
432
420
  _context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
433
421
  if (!_context2.t0) {
434
- _context2.next = 12;
422
+ _context2.next = 10;
435
423
  break;
436
424
  }
437
- _context2.next = 12;
425
+ _context2.next = 10;
438
426
  return (_TargetComponent$prop4 = TargetComponent.props).onBlur.apply(_TargetComponent$prop4, _toConsumableArray(_args));
439
- case 12:
427
+ case 10:
440
428
  _context2.t1 = onBlur;
441
429
  if (!_context2.t1) {
442
- _context2.next = 16;
430
+ _context2.next = 14;
443
431
  break;
444
432
  }
445
- _context2.next = 16;
433
+ _context2.next = 14;
446
434
  return onBlur.apply(void 0, _toConsumableArray(_args));
447
- case 16:
435
+ case 14:
448
436
  // 判断属性是否变动
449
- form.setFieldValue(rowPath, _objectSpread({}, row));
437
+ form.setFieldValue(rowPath, row);
450
438
  if (!isEqual(orgRow, row)) {
451
439
  diff = difference(row, orgRow) || {};
452
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) {
@@ -457,23 +445,23 @@ var RenderField = function RenderField(_ref) {
457
445
  }
458
446
  }
459
447
  if (!isCell) {
460
- _context2.next = 22;
448
+ _context2.next = 20;
461
449
  break;
462
450
  }
463
- _context2.next = 21;
451
+ _context2.next = 19;
464
452
  return form.validateFields([cellName]);
465
- case 21:
453
+ case 19:
466
454
  setState({
467
455
  cellNamePath: []
468
456
  });
469
- case 22:
457
+ case 20:
470
458
  // 单行编辑时需要 强制更新视图
471
459
  setState({
472
460
  forceUpdate: {
473
461
  d: Date.now()
474
462
  }
475
463
  });
476
- case 23:
464
+ case 21:
477
465
  case "end":
478
466
  return _context2.stop();
479
467
  }
@@ -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() {
@@ -105,7 +105,7 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
105
105
  if (['percentage', 'permillage'].includes(valueType)) {
106
106
  column.render = function (value, record, index) {
107
107
  var multiple = valueType === 'percentage' ? 100 : 1000;
108
- var realValue = tools.calc(Number(value), '*', multiple);
108
+ var realValue = tools.calc(Number(value !== null && value !== void 0 ? value : 0), '*', multiple);
109
109
  var renderValue = getDecimalDigits(value) > valueTypePrecision ? realValue : realValue.toFixed(valueTypePrecision);
110
110
  var originalValue = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
111
111
  var originalRealValue = tools.calc(Number(originalValue || null), '*', multiple);
@@ -321,63 +321,57 @@ var RenderField = function RenderField(_ref) {
321
321
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
322
322
  while (1) switch (_context.prev = _context.next) {
323
323
  case 0:
324
- if (!(!onFieldChange && !onChange)) {
325
- _context.next = 2;
326
- break;
327
- }
328
- return _context.abrupt("return", null);
329
- case 2:
330
324
  for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
331
325
  args[_key2] = _args2[_key2];
332
326
  }
333
327
  _args = [].concat(args);
334
328
  rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
335
- row = form.getFieldValue(rowPath, true);
329
+ row = form.getFieldValue(rowPath, true); // if (type === 'InputNumber' && column.name) row[column.name] = args[0];
336
330
  orgRow = (0, _lodash.cloneDeep)(row);
337
331
  if (!onFieldChange) {
338
- _context.next = 20;
332
+ _context.next = 18;
339
333
  break;
340
334
  }
341
335
  _args = formatArgs(args);
342
336
  _args[1] = row;
343
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;
344
338
  if (!_context.t0) {
345
- _context.next = 14;
339
+ _context.next = 12;
346
340
  break;
347
341
  }
348
- _context.next = 14;
342
+ _context.next = 12;
349
343
  return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, (0, _toConsumableArray2.default)(_args));
350
- case 14:
344
+ case 12:
351
345
  _context.t1 = onFieldChange;
352
346
  if (!_context.t1) {
353
- _context.next = 18;
347
+ _context.next = 16;
354
348
  break;
355
349
  }
356
- _context.next = 18;
350
+ _context.next = 16;
357
351
  return onFieldChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
358
- case 18:
359
- _context.next = 29;
352
+ case 16:
353
+ _context.next = 27;
360
354
  break;
361
- case 20:
355
+ case 18:
362
356
  _args = _args.concat([row, index, form]);
363
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;
364
358
  if (!_context.t2) {
365
- _context.next = 25;
359
+ _context.next = 23;
366
360
  break;
367
361
  }
368
- _context.next = 25;
362
+ _context.next = 23;
369
363
  return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, (0, _toConsumableArray2.default)(_args));
370
- case 25:
364
+ case 23:
371
365
  _context.t3 = onChange;
372
366
  if (!_context.t3) {
373
- _context.next = 29;
367
+ _context.next = 27;
374
368
  break;
375
369
  }
376
- _context.next = 29;
370
+ _context.next = 27;
377
371
  return onChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
378
- case 29:
372
+ case 27:
379
373
  // 判断属性是否变动
380
- form.setFieldValue(rowPath, (0, _objectSpread2.default)({}, row));
374
+ form.setFieldValue(rowPath, row);
381
375
  if (!(0, _lodash.isEqual)(orgRow, row)) {
382
376
  diff = (0, _tools.difference)(row, orgRow) || {};
383
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) {
@@ -394,7 +388,7 @@ var RenderField = function RenderField(_ref) {
394
388
  d: Date.now()
395
389
  }
396
390
  });
397
- case 32:
391
+ case 30:
398
392
  case "end":
399
393
  return _context.stop();
400
394
  }
@@ -418,12 +412,6 @@ var RenderField = function RenderField(_ref) {
418
412
  return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
419
413
  while (1) switch (_context2.prev = _context2.next) {
420
414
  case 0:
421
- if (onBlur) {
422
- _context2.next = 2;
423
- break;
424
- }
425
- return _context2.abrupt("return", null);
426
- case 2:
427
415
  for (_len3 = _args3.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
428
416
  args[_key3] = _args3[_key3];
429
417
  }
@@ -434,22 +422,22 @@ var RenderField = function RenderField(_ref) {
434
422
  _args[1] = row;
435
423
  _context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
436
424
  if (!_context2.t0) {
437
- _context2.next = 12;
425
+ _context2.next = 10;
438
426
  break;
439
427
  }
440
- _context2.next = 12;
428
+ _context2.next = 10;
441
429
  return (_TargetComponent$prop4 = TargetComponent.props).onBlur.apply(_TargetComponent$prop4, (0, _toConsumableArray2.default)(_args));
442
- case 12:
430
+ case 10:
443
431
  _context2.t1 = onBlur;
444
432
  if (!_context2.t1) {
445
- _context2.next = 16;
433
+ _context2.next = 14;
446
434
  break;
447
435
  }
448
- _context2.next = 16;
436
+ _context2.next = 14;
449
437
  return onBlur.apply(void 0, (0, _toConsumableArray2.default)(_args));
450
- case 16:
438
+ case 14:
451
439
  // 判断属性是否变动
452
- form.setFieldValue(rowPath, (0, _objectSpread2.default)({}, row));
440
+ form.setFieldValue(rowPath, row);
453
441
  if (!(0, _lodash.isEqual)(orgRow, row)) {
454
442
  diff = (0, _tools.difference)(row, orgRow) || {};
455
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) {
@@ -460,23 +448,23 @@ var RenderField = function RenderField(_ref) {
460
448
  }
461
449
  }
462
450
  if (!isCell) {
463
- _context2.next = 22;
451
+ _context2.next = 20;
464
452
  break;
465
453
  }
466
- _context2.next = 21;
454
+ _context2.next = 19;
467
455
  return form.validateFields([cellName]);
468
- case 21:
456
+ case 19:
469
457
  setState({
470
458
  cellNamePath: []
471
459
  });
472
- case 22:
460
+ case 20:
473
461
  // 单行编辑时需要 强制更新视图
474
462
  setState({
475
463
  forceUpdate: {
476
464
  d: Date.now()
477
465
  }
478
466
  });
479
- case 23:
467
+ case 21:
480
468
  case "end":
481
469
  return _context2.stop();
482
470
  }
@@ -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() {
@@ -112,7 +112,7 @@ var formatColumn = exports.formatColumn = function formatColumn(column, original
112
112
  if (['percentage', 'permillage'].includes(valueType)) {
113
113
  column.render = function (value, record, index) {
114
114
  var multiple = valueType === 'percentage' ? 100 : 1000;
115
- var realValue = _utils.tools.calc(Number(value), '*', multiple);
115
+ var realValue = _utils.tools.calc(Number(value !== null && value !== void 0 ? value : 0), '*', multiple);
116
116
  var renderValue = getDecimalDigits(value) > valueTypePrecision ? realValue : realValue.toFixed(valueTypePrecision);
117
117
  var originalValue = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
118
118
  var originalRealValue = _utils.tools.calc(Number(originalValue || null), '*', multiple);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.6.4-beta.13",
3
+ "version": "3.6.4-beta.15",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",