@zat-design/sisyphus-react 3.5.4 → 3.5.5-beta.2

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.
Files changed (35) hide show
  1. package/es/ProEditTable/components/RenderField/index.js +9 -4
  2. package/es/ProEditTable/index.js +11 -6
  3. package/es/ProEditTable/propsType.d.ts +1 -0
  4. package/es/ProEditTable/utils/index.js +5 -3
  5. package/es/ProEnum/propsType.d.ts +1 -1
  6. package/es/ProForm/components/base/DatePicker/index.js +2 -14
  7. package/es/ProForm/components/base/RangePicker/index.js +6 -0
  8. package/es/ProForm/components/combination/ProModalSelect/index.js +15 -14
  9. package/es/ProForm/index.d.ts +2 -1
  10. package/es/ProForm/index.js +6 -2
  11. package/es/ProForm/propsType.d.ts +1 -0
  12. package/es/ProForm/utils/useForm.d.ts +4 -1
  13. package/es/ProForm/utils/useForm.js +7 -4
  14. package/es/ProForm/utils/useShouldUpdate.js +8 -15
  15. package/es/ProStep/components/Listener/index.js +8 -3
  16. package/es/ProStep/index.js +19 -10
  17. package/es/ProTable/utils.js +0 -1
  18. package/lib/ProEditTable/components/RenderField/index.js +9 -4
  19. package/lib/ProEditTable/index.js +11 -6
  20. package/lib/ProEditTable/propsType.d.ts +1 -0
  21. package/lib/ProEditTable/utils/index.js +5 -3
  22. package/lib/ProEnum/propsType.d.ts +1 -1
  23. package/lib/ProForm/components/base/DatePicker/index.js +1 -13
  24. package/lib/ProForm/components/base/RangePicker/index.js +6 -0
  25. package/lib/ProForm/components/combination/ProModalSelect/index.js +15 -14
  26. package/lib/ProForm/index.d.ts +2 -1
  27. package/lib/ProForm/index.js +6 -2
  28. package/lib/ProForm/propsType.d.ts +1 -0
  29. package/lib/ProForm/utils/useForm.d.ts +4 -1
  30. package/lib/ProForm/utils/useForm.js +7 -4
  31. package/lib/ProForm/utils/useShouldUpdate.js +7 -14
  32. package/lib/ProStep/components/Listener/index.js +8 -3
  33. package/lib/ProStep/index.js +19 -10
  34. package/lib/ProTable/utils.js +0 -1
  35. package/package.json +1 -1
@@ -11,7 +11,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
11
11
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
12
12
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
13
13
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
14
- var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim"];
14
+ var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim", "confirm"];
15
15
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  /* eslint-disable prefer-destructuring */
17
17
  /* eslint-disable prefer-const */
@@ -29,8 +29,9 @@ import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
29
29
  import { useListChanged } from '../../../ProForm/utils/useListChanged';
30
30
  import useRules from '../../../ProForm/utils/useRules';
31
31
  import { isSelect, isTrim } from '../../../ProForm/utils';
32
+ import ConfirmWrapper from '@/ProForm/components/render/ConfirmWrapper';
32
33
  var RenderField = function RenderField(_ref) {
33
- var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps;
34
+ var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps, _componentProps2;
34
35
  var value = _ref.text,
35
36
  record = _ref.record,
36
37
  index = _ref.index,
@@ -58,6 +59,7 @@ var RenderField = function RenderField(_ref) {
58
59
  equalWith = column.equalWith,
59
60
  className = column.className,
60
61
  trim = column.trim,
62
+ confirm = column.confirm,
61
63
  resetProps = _objectWithoutProperties(column, _excluded);
62
64
  // editRender弃用使用component同ProForm
63
65
  var _editRender = component || editRender;
@@ -498,6 +500,7 @@ var RenderField = function RenderField(_ref) {
498
500
  onChange: _onChange,
499
501
  onBlur: _onblur,
500
502
  index: index,
503
+ confirm: confirm,
501
504
  otherProps: {
502
505
  form: form,
503
506
  names: names,
@@ -540,7 +543,9 @@ var RenderField = function RenderField(_ref) {
540
543
  }, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
541
544
  className: _className,
542
545
  name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
543
- children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
546
+ children: ((_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.confirm) ? _jsx(ConfirmWrapper, _objectSpread(_objectSpread({}, componentProps), {}, {
547
+ children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
548
+ })) : /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
544
549
  })) : _jsx(Container, {
545
550
  viewEmpty: viewEmpty
546
551
  });
@@ -570,7 +575,7 @@ var RenderField = function RenderField(_ref) {
570
575
  }))]
571
576
  }) : null;
572
577
  return _jsx(FieldProvider, {
573
- value: (_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.otherProps,
578
+ value: (_componentProps2 = componentProps) === null || _componentProps2 === void 0 ? void 0 : _componentProps2.otherProps,
574
579
  children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
575
580
  title: originalTitle,
576
581
  placement: "topLeft",
@@ -9,7 +9,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
9
9
  import "antd/es/form/style";
10
10
  import _Form from "antd/es/form";
11
11
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
12
- var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll"];
12
+ var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
13
13
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
15
15
  import { get, isArray } from 'lodash';
@@ -22,7 +22,7 @@ import ProForm from '../ProForm';
22
22
  import Empty from '../assets/empty.png';
23
23
  import locale, { formatMessage } from '../locale';
24
24
  var ProEditTable = function ProEditTable(_ref, ref) {
25
- var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value$2;
25
+ var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value$;
26
26
  var value = _ref.value,
27
27
  onChange = _ref.onChange,
28
28
  onDrag = _ref.onDrag,
@@ -54,6 +54,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
54
54
  rowDraggable = _ref.rowDraggable,
55
55
  footerRender = _ref.footerRender,
56
56
  scroll = _ref.scroll,
57
+ actionDirection = _ref.actionDirection,
57
58
  resetProps = _objectWithoutProperties(_ref, _excluded);
58
59
  // 上下文form
59
60
  var contentForm = _Form.useFormInstance();
@@ -162,7 +163,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
162
163
  originalValues: originalValues,
163
164
  originalDiffTip: originalDiffTip,
164
165
  prefixCls: prefixCls,
165
- rowDisabled: rowDisabled
166
+ rowDisabled: rowDisabled,
167
+ actionDirection: actionDirection
166
168
  }, resetProps);
167
169
  // 编辑行设置下样式
168
170
  var _rowClassName = function _rowClassName(record) {
@@ -279,9 +281,11 @@ var ProEditTable = function ProEditTable(_ref, ref) {
279
281
  // },
280
282
  // );
281
283
  useEffect(function () {
282
- var _value$;
284
+ var isAllHasKey = value.every(function (item) {
285
+ return item.rowKey;
286
+ });
283
287
  // 初始化默认生成row-key
284
- if ((value === null || value === void 0 ? void 0 : value.length) && !(value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey)) {
288
+ if ((value === null || value === void 0 ? void 0 : value.length) && !isAllHasKey) {
285
289
  var _originalArr$forEach;
286
290
  var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
287
291
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -328,7 +332,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
328
332
  }) : null, _jsx(_Table, _objectSpread(_objectSpread({
329
333
  ref: tableRef,
330
334
  className: _className,
331
- dataSource: (value === null || value === void 0 ? void 0 : (_value$2 = value[0]) === null || _value$2 === void 0 ? void 0 : _value$2.rowKey) ? value : undefined,
335
+ dataSource: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value : undefined,
332
336
  columns: _columns,
333
337
  rowSelection: renderRowSelection(),
334
338
  rowClassName: _rowClassName,
@@ -388,6 +392,7 @@ ForwardProEditTable.defaultProps = {
388
392
  type: 'multiple',
389
393
  mode: 'multiple',
390
394
  insertType: 'after',
395
+ actionDirection: 'horizontal',
391
396
  value: [],
392
397
  actionProps: [],
393
398
  toolbarProps: [],
@@ -257,4 +257,5 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
257
257
  rowDraggable?: (record?: T) => string | boolean;
258
258
  onDrag?: (event: DragEndEvent, dataSource: T[]) => T[];
259
259
  ref?: any;
260
+ actionDirection?: 'vertical' | 'horizontal';
260
261
  }
@@ -33,7 +33,8 @@ var getActionColumn = function getActionColumn(config) {
33
33
  actionWidth = config.actionWidth,
34
34
  actionProps = config.actionProps,
35
35
  page = config.page,
36
- rowDisabled = config.rowDisabled;
36
+ rowDisabled = config.rowDisabled,
37
+ actionDirection = config.actionDirection;
37
38
  var pageNum = tools.calc(page.pageNum, '-', 1);
38
39
  var firstIndex = tools.calc(pageNum, '*', page.pageSize);
39
40
  // actionProps配置为false 默认不插入
@@ -155,7 +156,7 @@ var getActionColumn = function getActionColumn(config) {
155
156
  title: locale.ProEditTable.operation,
156
157
  key: 'action',
157
158
  fixed: 'right',
158
- width: actionWidth || (virtualKey ? '120px' : '60px'),
159
+ width: actionWidth || (actionDirection === 'vertical' ? '60px' : virtualKey ? '120px' : '60px'),
159
160
  render: function render(text, record, index) {
160
161
  var _rowDisabled;
161
162
  var _disabled = (_rowDisabled = rowDisabled === null || rowDisabled === void 0 ? void 0 : rowDisabled(record)) !== null && _rowDisabled !== void 0 ? _rowDisabled : false;
@@ -163,7 +164,8 @@ var getActionColumn = function getActionColumn(config) {
163
164
  return '';
164
165
  }
165
166
  return _jsx(_Space, {
166
- size: "middle",
167
+ size: "small",
168
+ direction: actionDirection,
167
169
  children: actionBtns.map(function (btnConfig) {
168
170
  return _jsx(React.Fragment, {
169
171
  children: _jsx(ActionButton, _objectSpread({}, {
@@ -49,7 +49,7 @@ export interface ProEnum {
49
49
  /** 用于自定义组件 */
50
50
  component?: ReactNode;
51
51
  /** 用于提交 code */
52
- code: string | string[];
52
+ code?: string | string[];
53
53
  /** 字段别名 */
54
54
  fieldNames?: Record<string, string>;
55
55
  /** 是否查看模式 */
@@ -15,14 +15,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
15
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
16
16
  */
17
17
 
18
- import { isFunction, isString, isObject, uniq, isBoolean } from 'lodash';
18
+ import { isFunction, isString, isObject, uniq } from 'lodash';
19
19
  import classNames from 'classnames';
20
20
  import moment from 'moment';
21
21
  import { useProConfig } from '../../../../ProConfigProvider';
22
22
  import ProForm from '../../../../ProForm';
23
23
  import Container from '../../Container';
24
24
  var DatePicker = function DatePicker(props) {
25
- var _rest$showTime;
26
25
  var className = props.className,
27
26
  _props$format = props.format,
28
27
  format = _props$format === void 0 ? 'YYYY-MM-DD' : _props$format,
@@ -68,13 +67,6 @@ var DatePicker = function DatePicker(props) {
68
67
  var _rest = _objectSpread(_objectSpread({}, rest), {}, {
69
68
  showTime: rest.showTime === undefined && valueType === 'dateTime' || rest.showTime
70
69
  });
71
- if (_rest.showTime && !isBoolean(_rest.showTime) && !Reflect.ownKeys((_rest$showTime = _rest.showTime) !== null && _rest$showTime !== void 0 ? _rest$showTime : {}).includes('format')) {
72
- var _rest$showTime2;
73
- _rest.showTime = _objectSpread(_objectSpread({}, (_rest$showTime2 = _rest.showTime) !== null && _rest$showTime2 !== void 0 ? _rest$showTime2 : {}), _defaultShowTime);
74
- }
75
- if (isBoolean(_rest.showTime)) {
76
- _rest.showTime = _objectSpread({}, _defaultShowTime);
77
- }
78
70
  // 字符串时间格式兼容
79
71
  if (isString(_rest.value)) {
80
72
  _rest.value = moment(_rest.value);
@@ -86,16 +78,12 @@ var DatePicker = function DatePicker(props) {
86
78
  _defaultShowTime: _defaultShowTime
87
79
  };
88
80
  }
89
- if (isBoolean(_rest.showTime)) {
81
+ if (_rest.showTime === true) {
90
82
  _rest.showTime = _objectSpread({}, _defaultShowTime);
91
83
  }
92
84
  if (isObject(_rest.showTime)) {
93
85
  _rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
94
86
  }
95
- // 传进来showTime权重最高
96
- if (isBoolean(rest.showTime)) {
97
- _rest.showTime = rest.showTime;
98
- }
99
87
  return _jsx(_DatePicker, _objectSpread(_objectSpread(_objectSpread({}, initialConfig), {}, {
100
88
  format: _format
101
89
  }, _rest), {}, {
@@ -56,6 +56,9 @@ var RangePicker = function RangePicker(props) {
56
56
  var _format = uniq([].concat(_toConsumableArray(tempFormat), ['YYYY-MM-DD', 'YYYYMMDD', 'YYYY/MM/DD', 'YYYY_MM_DD', 'YYYY.MM.DD'])).filter(function (formatKey) {
57
57
  return !!formatKey;
58
58
  });
59
+ var _defaultShowTime = {
60
+ format: 'YYYY-MM-DD HH:mm:ss'
61
+ };
59
62
  if (isView) {
60
63
  var _res$value = _res.value,
61
64
  value = _res$value === void 0 ? [] : _res$value;
@@ -80,6 +83,9 @@ var RangePicker = function RangePicker(props) {
80
83
  children: viewChildren
81
84
  });
82
85
  }
86
+ if (_res.showTime === true) {
87
+ _res.showTime = _objectSpread({}, _defaultShowTime);
88
+ }
83
89
  return _jsx(AntRangePicker, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, initialConfig), omit(_res, ['separator'])), rangeRegulator), {}, {
84
90
  format: _format
85
91
  }));
@@ -137,7 +137,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
137
137
  var _res$data;
138
138
  var list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list : res === null || res === void 0 ? void 0 : res.data;
139
139
  setState({
140
- options: list
140
+ options: transformResponse ? transformResponse(res === null || res === void 0 ? void 0 : res.data) : list
141
141
  });
142
142
  }
143
143
  })),
@@ -301,7 +301,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
301
301
  while (1) switch (_context2.prev = _context2.next) {
302
302
  case 0:
303
303
  _context2.prev = 0;
304
- if (selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) {
304
+ if (!(!(selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) || !(selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length))) {
305
305
  _context2.next = 4;
306
306
  break;
307
307
  }
@@ -434,7 +434,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
434
434
  // 初始化回显,当传入initParams时,前端用来回险
435
435
  var getInitValues = /*#__PURE__*/function () {
436
436
  var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
437
- var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list, _res$data2, _data, nextSelectRowKeys;
437
+ var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
438
438
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
439
439
  while (1) switch (_context4.prev = _context4.next) {
440
440
  case 0:
@@ -459,11 +459,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
459
459
  case 8:
460
460
  res = _context4.sent;
461
461
  if (res === null || res === void 0 ? void 0 : res.data) {
462
- list = [];
462
+ list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
463
463
  if (transformResponse) {
464
464
  list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
465
- } else {
466
- list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
467
465
  }
468
466
  _data = isMultiple ? list : (_list = list) === null || _list === void 0 ? void 0 : _list[0];
469
467
  if (_data) {
@@ -500,7 +498,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
500
498
  var getDefaultOneValues = /*#__PURE__*/function () {
501
499
  var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
502
500
  var _useRequest$options4, _useRequest$options5;
503
- var queryBean, page, params, res, _list2, list, _res$data3, _data2, nextSelectRowKeys;
501
+ var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
504
502
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
505
503
  while (1) switch (_context5.prev = _context5.next) {
506
504
  case 0:
@@ -518,11 +516,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
518
516
  case 6:
519
517
  res = _context5.sent;
520
518
  if (res === null || res === void 0 ? void 0 : res.data) {
521
- list = [];
519
+ list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
522
520
  if (transformResponse) {
523
521
  list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
524
- } else {
525
- list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
526
522
  }
527
523
  _data2 = isMultiple ? list : (_list2 = list) === null || _list2 === void 0 ? void 0 : _list2[0];
528
524
  nextSelectRowKeys = isMultiple ? value : [value];
@@ -604,9 +600,11 @@ var ProModalSelect = function ProModalSelect(props, ref) {
604
600
  nextState.selectedRows = value;
605
601
  }
606
602
  } else if (value) {
603
+ var _list$filter;
607
604
  var nextSelectedRowKeys = isMultiple ? value : [value];
608
605
  nextState.selectedRowKeys = nextSelectedRowKeys;
609
- nextState.selectedRows = options.filter(function (item) {
606
+ var list = options !== null && options !== void 0 ? options : data;
607
+ nextState.selectedRows = list === null || list === void 0 ? void 0 : (_list$filter = list.filter) === null || _list$filter === void 0 ? void 0 : _list$filter.call(list, function (item) {
610
608
  return nextSelectedRowKeys.includes(item[valueKey]);
611
609
  });
612
610
  }
@@ -629,7 +627,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
629
627
  pageSize: 50,
630
628
  queryBean: _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.defaultParams), initParams)
631
629
  } : _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
632
- run(params);
630
+ var nextParams = transformParams ? transformParams(params) : params;
631
+ run(nextParams);
633
632
  setState({
634
633
  isInit: false
635
634
  });
@@ -693,7 +692,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
693
692
  pageSize: 50,
694
693
  queryBean: queryBean
695
694
  } : queryBean;
696
- run(params);
695
+ var nextParams = transformParams ? transformParams(params) : params;
696
+ run(nextParams);
697
697
  setState({
698
698
  isInit: false
699
699
  });
@@ -707,7 +707,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
707
707
  pageSize: 50,
708
708
  queryBean: queryBean
709
709
  } : queryBean;
710
- run(params);
710
+ var nextParams = transformParams ? transformParams(params) : params;
711
+ run(nextParams);
711
712
  }, 2000),
712
713
  style: {
713
714
  width: isView || disabled ? '100%' : 'calc(100% - 30px)'
@@ -2,8 +2,9 @@ import { Form, FormInstance } from 'antd';
2
2
  import React, { ForwardRefRenderFunction } from 'react';
3
3
  import { FormProviderProps } from 'antd/es/form/context';
4
4
  import { ProFormProps } from './propsType';
5
+ import { useForm } from './utils/useForm';
5
6
  interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, ProFormProps<T>> {
6
- useForm: typeof Form.useForm;
7
+ useForm: typeof useForm;
7
8
  useWatch: typeof Form.useWatch;
8
9
  [key: string]: any;
9
10
  }
@@ -11,7 +11,7 @@ import _Space from "antd/es/space";
11
11
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
12
12
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
13
13
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
14
- var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl"];
14
+ var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl", "scrollToError"];
15
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  import { DoubleLeftOutlined } from '@ant-design/icons';
17
17
  import classnames from 'classnames';
@@ -65,13 +65,17 @@ var ProForm = function ProForm(props, ref) {
65
65
  originalDiffTip = _props$originalDiffTi === void 0 ? true : _props$originalDiffTi,
66
66
  formKey = props.formKey,
67
67
  globalControl = props.globalControl,
68
+ _props$scrollToError = props.scrollToError,
69
+ scrollToError = _props$scrollToError === void 0 ? true : _props$scrollToError,
68
70
  otherProps = _objectWithoutProperties(props, _excluded);
69
71
  var _useProConfig = useProConfig(),
70
72
  state = _useProConfig.state,
71
73
  dispatch = _useProConfig.dispatch;
72
74
  var config = state.ProForm,
73
75
  forms = state.forms;
74
- var _useForm = useForm((_forms$formKey = forms[formKey]) !== null && _forms$formKey !== void 0 ? _forms$formKey : originForm),
76
+ var _useForm = useForm((_forms$formKey = forms[formKey]) !== null && _forms$formKey !== void 0 ? _forms$formKey : originForm, {
77
+ scrollToError: scrollToError
78
+ }),
75
79
  _useForm2 = _slicedToArray(_useForm, 1),
76
80
  form = _useForm2[0];
77
81
  var _useControlled = useControlled({
@@ -75,6 +75,7 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
75
75
  formId?: string;
76
76
  required?: boolean | boolean[];
77
77
  originalDiffTip?: boolean;
78
+ scrollToError?: boolean;
78
79
  }
79
80
  export interface Transform<T = any> {
80
81
  normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
@@ -2,5 +2,8 @@ import { FormInstance } from 'antd';
2
2
  type ModifiedFormInstance<T> = FormInstance<T> & {
3
3
  isModified?: boolean;
4
4
  };
5
- export declare const useForm: <T>(originForm: ModifiedFormInstance<T>) => [ModifiedFormInstance<T>];
5
+ interface FormInstanceOption {
6
+ scrollToError?: boolean;
7
+ }
8
+ export declare const useForm: <T>(originForm: ModifiedFormInstance<T>, options?: FormInstanceOption) => [ModifiedFormInstance<T>];
6
9
  export {};
@@ -6,7 +6,10 @@ import _Form from "antd/es/form";
6
6
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
7
7
  import { filterInternalFields } from './index';
8
8
  import { handleScrollToError } from '../../ProEditTable/utils/tools';
9
- export var useForm = function useForm(originForm) {
9
+ export var useForm = function useForm(originForm, options) {
10
+ var _ref = options || {},
11
+ _ref$scrollToError = _ref.scrollToError,
12
+ scrollToError = _ref$scrollToError === void 0 ? true : _ref$scrollToError;
10
13
  var _Form$useForm = _Form.useForm(originForm),
11
14
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
12
15
  form = _Form$useForm2[0];
@@ -24,7 +27,7 @@ export var useForm = function useForm(originForm) {
24
27
  return getFieldsValue(nameList, filterFunc);
25
28
  };
26
29
  var _validateFields = /*#__PURE__*/function () {
27
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(nameList) {
30
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(nameList) {
28
31
  var _rest$,
29
32
  _len,
30
33
  rest,
@@ -81,7 +84,7 @@ export var useForm = function useForm(originForm) {
81
84
  case 17:
82
85
  _context.prev = 17;
83
86
  _context.t0 = _context["catch"](0);
84
- if (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : _error$errorFields.length) {
87
+ if (scrollToError && (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : _error$errorFields.length)) {
85
88
  form.scrollToField((_error$errorFields$ = _context.t0.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
86
89
  block: 'center',
87
90
  behavior: 'smooth'
@@ -96,7 +99,7 @@ export var useForm = function useForm(originForm) {
96
99
  }, _callee, null, [[0, 17]]);
97
100
  }));
98
101
  return function _validateFields(_x) {
99
- return _ref.apply(this, arguments);
102
+ return _ref2.apply(this, arguments);
100
103
  };
101
104
  }();
102
105
  form.getFieldsValue = _getFieldsValue;
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import { useRef, useState } from 'react';
3
- import { isFunction, isEqualWith } from 'lodash';
3
+ import { isFunction, isEqualWith, isEqual } from 'lodash';
4
4
  import { customEqualForFun, equalDependencies } from './index';
5
5
  // 代理shouldUpdate事件, 执行函数值的[show, disabled], 当[show, disabled]与上一次值不相同时更新状态
6
6
  var useShouldUpdate = function useShouldUpdate(props) {
@@ -148,11 +148,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
148
148
  index: index,
149
149
  namePath: namePath
150
150
  }) : rules;
151
- var _component = isFunction(originComponent) ? originComponent(_currentValues, {
152
- form: form,
153
- index: index,
154
- namePath: namePath
155
- }) : newComponent;
151
+ // const _component = isFunction(originComponent)
152
+ // ? originComponent(_currentValues, { form, index, namePath })
153
+ // : newComponent;
156
154
  var _fieldProps = isFunction(fieldProps) ? fieldProps(_currentValues, {
157
155
  form: form,
158
156
  index: index,
@@ -161,7 +159,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
161
159
  // 清值防抖 多次刷新时以最后一次为准
162
160
  if (clearNotShow !== false && (name || names)) {
163
161
  if (_show === false) {
164
- clearInterval(timerRef.current);
162
+ clearTimeout(timerRef.current);
165
163
  timerRef.current = setTimeout(function () {
166
164
  if (Array.isArray(names)) {
167
165
  form.resetFields(names);
@@ -171,17 +169,12 @@ var useShouldUpdate = function useShouldUpdate(props) {
171
169
  }
172
170
  }, 200);
173
171
  } else {
174
- clearInterval(timerRef.current);
172
+ clearTimeout(timerRef.current);
175
173
  }
176
174
  }
177
- // // 当校验规则改变的时候 重新执行校验 导致: 第一次进页面直接触发校验
178
- // if (
179
- // _required !== requiredRef.current ||
180
- // !isEqualWith(rulesRef.current, _rules, customEqualForFun)
181
- // ) {
182
- // form.validateFields([name]);
183
- // }
184
175
  if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !isEqualWith(rulesRef.current, _rules, customEqualForFun) || !isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) ||
176
+ // 值变更,需要同步更新函数式的fieldProps
177
+ isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues) ||
185
178
  // !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
186
179
  equalDependencies(dependencies, prevValues, _currentValues)) {
187
180
  showRef.current = _show;
@@ -7,12 +7,16 @@ import { throttle } from 'lodash';
7
7
  import React from 'react';
8
8
  import { useStep } from '../../index';
9
9
  export default (function (_ref) {
10
+ var _children$props;
10
11
  var children = _ref.children,
11
12
  delayTime = _ref.delayTime,
12
13
  props = _objectWithoutProperties(_ref, _excluded);
13
14
  var _useStep = useStep(),
14
- notify = _useStep.notify;
15
+ notify = _useStep.notify,
16
+ loading = _useStep.loading,
17
+ setLoading = _useStep.setLoading;
15
18
  return /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
19
+ loading: loading || (children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.loading),
16
20
  onClick: throttle( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17
21
  var values;
18
22
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -24,10 +28,11 @@ export default (function (_ref) {
24
28
  case 3:
25
29
  values = _context.sent;
26
30
  setTimeout(function () {
31
+ setLoading(false);
27
32
  var localData = localStorage.getItem('cache-pro-step');
28
33
  if (localData !== 'false') {
29
- var _children$props, _children$props$onCli;
30
- children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : (_children$props$onCli = _children$props.onClick) === null || _children$props$onCli === void 0 ? void 0 : _children$props$onCli.call(_children$props, values);
34
+ var _children$props2, _children$props2$onCl;
35
+ children === null || children === void 0 ? void 0 : (_children$props2 = children.props) === null || _children$props2 === void 0 ? void 0 : (_children$props2$onCl = _children$props2.onClick) === null || _children$props2$onCl === void 0 ? void 0 : _children$props2$onCl.call(_children$props2, values);
31
36
  }
32
37
  }, delayTime !== null && delayTime !== void 0 ? delayTime : 0);
33
38
  case 5:
@@ -31,6 +31,10 @@ var ProStep = function ProStep(_ref) {
31
31
  _useState2 = _slicedToArray(_useState, 2),
32
32
  anchorIds = _useState2[0],
33
33
  setAnchorIds = _useState2[1];
34
+ var _useState3 = useState(false),
35
+ _useState4 = _slicedToArray(_useState3, 2),
36
+ loading = _useState4[0],
37
+ setLoading = _useState4[1];
34
38
  var _useLocalStorageState = useLocalStorageState('cache-pro-step'),
35
39
  _useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 2),
36
40
  setLocalData = _useLocalStorageState2[1];
@@ -102,10 +106,11 @@ var ProStep = function ProStep(_ref) {
102
106
  case 10:
103
107
  values[id] = _context.sent;
104
108
  case 11:
105
- _context.next = 19;
109
+ setErrorCollection(_defineProperty({}, id, 0));
110
+ _context.next = 21;
106
111
  break;
107
- case 13:
108
- _context.prev = 13;
112
+ case 14:
113
+ _context.prev = 14;
109
114
  _context.t0 = _context["catch"](1);
110
115
  num = _context.t0 === null || _context.t0 === void 0 ? void 0 : (_errors$errorFields = _context.t0.errorFields) === null || _errors$errorFields === void 0 ? void 0 : _errors$errorFields.length;
111
116
  if (num) {
@@ -113,14 +118,15 @@ var ProStep = function ProStep(_ref) {
113
118
  console.error(_context.t0);
114
119
  }
115
120
  setErrorCollection(_defineProperty({}, id, num));
121
+ setLoading(false);
116
122
  return _context.abrupt("return", _context.t0);
117
- case 19:
123
+ case 21:
118
124
  return _context.abrupt("return", values[id]);
119
- case 20:
125
+ case 22:
120
126
  case "end":
121
127
  return _context.stop();
122
128
  }
123
- }, _callee, null, [[1, 13]]);
129
+ }, _callee, null, [[1, 14]]);
124
130
  }));
125
131
  return function subEvent() {
126
132
  return _ref5.apply(this, arguments);
@@ -137,11 +143,12 @@ var ProStep = function ProStep(_ref) {
137
143
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
138
144
  while (1) switch (_context2.prev = _context2.next) {
139
145
  case 0:
140
- _context2.next = 2;
146
+ setLoading(true);
147
+ _context2.next = 3;
141
148
  return emitter.emit();
142
- case 2:
143
- return _context2.abrupt("return", values);
144
149
  case 3:
150
+ return _context2.abrupt("return", values);
151
+ case 4:
145
152
  case "end":
146
153
  return _context2.stop();
147
154
  }
@@ -232,7 +239,9 @@ var ProStep = function ProStep(_ref) {
232
239
  register: register,
233
240
  notify: notify,
234
241
  triggerTo: triggerTo,
235
- handleScroll: handleScroll
242
+ handleScroll: handleScroll,
243
+ loading: loading,
244
+ setLoading: setLoading
236
245
  },
237
246
  children: _jsxs("div", {
238
247
  className: "pro-step-wrapper",
@@ -78,7 +78,6 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
78
78
  };
79
79
  // 后缀处理
80
80
  var suffixNode = function suffixNode(value, record, index) {
81
- console.log('记录看下', suffix);
82
81
  if (isString(suffix) || /*#__PURE__*/isValidElement(suffix)) {
83
82
  return suffix;
84
83
  }
@@ -29,11 +29,12 @@ var _useFieldProps = require("../../../ProForm/utils/useFieldProps");
29
29
  var _useListChanged3 = require("../../../ProForm/utils/useListChanged");
30
30
  var _useRules = _interopRequireDefault(require("../../../ProForm/utils/useRules"));
31
31
  var _utils = require("../../../ProForm/utils");
32
- var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim"];
32
+ var _ConfirmWrapper = _interopRequireDefault(require("@/ProForm/components/render/ConfirmWrapper"));
33
+ var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim", "confirm"];
33
34
  /* eslint-disable prefer-destructuring */
34
35
  /* eslint-disable prefer-const */
35
36
  var RenderField = function RenderField(_ref) {
36
- var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps;
37
+ var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps, _componentProps2;
37
38
  var value = _ref.text,
38
39
  record = _ref.record,
39
40
  index = _ref.index,
@@ -61,6 +62,7 @@ var RenderField = function RenderField(_ref) {
61
62
  equalWith = column.equalWith,
62
63
  className = column.className,
63
64
  trim = column.trim,
65
+ confirm = column.confirm,
64
66
  resetProps = (0, _objectWithoutProperties2.default)(column, _excluded);
65
67
  // editRender弃用使用component同ProForm
66
68
  var _editRender = component || editRender;
@@ -501,6 +503,7 @@ var RenderField = function RenderField(_ref) {
501
503
  onChange: _onChange,
502
504
  onBlur: _onblur,
503
505
  index: index,
506
+ confirm: confirm,
504
507
  otherProps: {
505
508
  form: form,
506
509
  names: names,
@@ -543,7 +546,9 @@ var RenderField = function RenderField(_ref) {
543
546
  }, (0, _lodash.omit)(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
544
547
  className: _className,
545
548
  name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
546
- children: /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, componentProps)) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)({}, componentProps))
549
+ children: ((_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.confirm) ? (0, _jsxRuntime.jsx)(_ConfirmWrapper.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
550
+ children: /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, componentProps)) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)({}, componentProps))
551
+ })) : /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, componentProps)) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)({}, componentProps))
547
552
  })) : (0, _jsxRuntime.jsx)(_Container.default, {
548
553
  viewEmpty: viewEmpty
549
554
  });
@@ -573,7 +578,7 @@ var RenderField = function RenderField(_ref) {
573
578
  }))]
574
579
  }) : null;
575
580
  return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
576
- value: (_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.otherProps,
581
+ value: (_componentProps2 = componentProps) === null || _componentProps2 === void 0 ? void 0 : _componentProps2.otherProps,
577
582
  children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : (0, _jsxRuntime.jsx)(_antd.Tooltip, {
578
583
  title: originalTitle,
579
584
  placement: "topLeft",
@@ -23,9 +23,9 @@ var _components = require("./components");
23
23
  var _ProForm = _interopRequireDefault(require("../ProForm"));
24
24
  var _empty = _interopRequireDefault(require("../assets/empty.png"));
25
25
  var _locale = _interopRequireWildcard(require("../locale"));
26
- var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll"];
26
+ var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
27
27
  var ProEditTable = function ProEditTable(_ref, ref) {
28
- var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value$2;
28
+ var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value$;
29
29
  var value = _ref.value,
30
30
  onChange = _ref.onChange,
31
31
  onDrag = _ref.onDrag,
@@ -57,6 +57,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
57
57
  rowDraggable = _ref.rowDraggable,
58
58
  footerRender = _ref.footerRender,
59
59
  scroll = _ref.scroll,
60
+ actionDirection = _ref.actionDirection,
60
61
  resetProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
61
62
  // 上下文form
62
63
  var contentForm = _antd.Form.useFormInstance();
@@ -165,7 +166,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
165
166
  originalValues: originalValues,
166
167
  originalDiffTip: originalDiffTip,
167
168
  prefixCls: prefixCls,
168
- rowDisabled: rowDisabled
169
+ rowDisabled: rowDisabled,
170
+ actionDirection: actionDirection
169
171
  }, resetProps);
170
172
  // 编辑行设置下样式
171
173
  var _rowClassName = function _rowClassName(record) {
@@ -282,9 +284,11 @@ var ProEditTable = function ProEditTable(_ref, ref) {
282
284
  // },
283
285
  // );
284
286
  (0, _react.useEffect)(function () {
285
- var _value$;
287
+ var isAllHasKey = value.every(function (item) {
288
+ return item.rowKey;
289
+ });
286
290
  // 初始化默认生成row-key
287
- if ((value === null || value === void 0 ? void 0 : value.length) && !(value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey)) {
291
+ if ((value === null || value === void 0 ? void 0 : value.length) && !isAllHasKey) {
288
292
  var _originalArr$forEach;
289
293
  var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
290
294
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
@@ -331,7 +335,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
331
335
  }) : null, (0, _jsxRuntime.jsx)(_antd.Table, (0, _objectSpread2.default)((0, _objectSpread2.default)({
332
336
  ref: tableRef,
333
337
  className: _className,
334
- dataSource: (value === null || value === void 0 ? void 0 : (_value$2 = value[0]) === null || _value$2 === void 0 ? void 0 : _value$2.rowKey) ? value : undefined,
338
+ dataSource: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value : undefined,
335
339
  columns: _columns,
336
340
  rowSelection: renderRowSelection(),
337
341
  rowClassName: _rowClassName,
@@ -391,6 +395,7 @@ ForwardProEditTable.defaultProps = {
391
395
  type: 'multiple',
392
396
  mode: 'multiple',
393
397
  insertType: 'after',
398
+ actionDirection: 'horizontal',
394
399
  value: [],
395
400
  actionProps: [],
396
401
  toolbarProps: [],
@@ -257,4 +257,5 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
257
257
  rowDraggable?: (record?: T) => string | boolean;
258
258
  onDrag?: (event: DragEndEvent, dataSource: T[]) => T[];
259
259
  ref?: any;
260
+ actionDirection?: 'vertical' | 'horizontal';
260
261
  }
@@ -37,7 +37,8 @@ var getActionColumn = function getActionColumn(config) {
37
37
  actionWidth = config.actionWidth,
38
38
  actionProps = config.actionProps,
39
39
  page = config.page,
40
- rowDisabled = config.rowDisabled;
40
+ rowDisabled = config.rowDisabled,
41
+ actionDirection = config.actionDirection;
41
42
  var pageNum = _utils.tools.calc(page.pageNum, '-', 1);
42
43
  var firstIndex = _utils.tools.calc(pageNum, '*', page.pageSize);
43
44
  // actionProps配置为false 默认不插入
@@ -159,7 +160,7 @@ var getActionColumn = function getActionColumn(config) {
159
160
  title: _locale.default.ProEditTable.operation,
160
161
  key: 'action',
161
162
  fixed: 'right',
162
- width: actionWidth || (virtualKey ? '120px' : '60px'),
163
+ width: actionWidth || (actionDirection === 'vertical' ? '60px' : virtualKey ? '120px' : '60px'),
163
164
  render: function render(text, record, index) {
164
165
  var _rowDisabled;
165
166
  var _disabled = (_rowDisabled = rowDisabled === null || rowDisabled === void 0 ? void 0 : rowDisabled(record)) !== null && _rowDisabled !== void 0 ? _rowDisabled : false;
@@ -167,7 +168,8 @@ var getActionColumn = function getActionColumn(config) {
167
168
  return '';
168
169
  }
169
170
  return (0, _jsxRuntime.jsx)(_antd.Space, {
170
- size: "middle",
171
+ size: "small",
172
+ direction: actionDirection,
171
173
  children: actionBtns.map(function (btnConfig) {
172
174
  return (0, _jsxRuntime.jsx)(_react.default.Fragment, {
173
175
  children: (0, _jsxRuntime.jsx)(_components.ActionButton, (0, _objectSpread2.default)({}, {
@@ -49,7 +49,7 @@ export interface ProEnum {
49
49
  /** 用于自定义组件 */
50
50
  component?: ReactNode;
51
51
  /** 用于提交 code */
52
- code: string | string[];
52
+ code?: string | string[];
53
53
  /** 字段别名 */
54
54
  fieldNames?: Record<string, string>;
55
55
  /** 是否查看模式 */
@@ -27,7 +27,6 @@ var _excluded = ["className", "format"];
27
27
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
28
28
  */
29
29
  var DatePicker = function DatePicker(props) {
30
- var _rest$showTime;
31
30
  var className = props.className,
32
31
  _props$format = props.format,
33
32
  format = _props$format === void 0 ? 'YYYY-MM-DD' : _props$format,
@@ -73,13 +72,6 @@ var DatePicker = function DatePicker(props) {
73
72
  var _rest = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rest), {}, {
74
73
  showTime: rest.showTime === undefined && valueType === 'dateTime' || rest.showTime
75
74
  });
76
- if (_rest.showTime && !(0, _lodash.isBoolean)(_rest.showTime) && !Reflect.ownKeys((_rest$showTime = _rest.showTime) !== null && _rest$showTime !== void 0 ? _rest$showTime : {}).includes('format')) {
77
- var _rest$showTime2;
78
- _rest.showTime = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (_rest$showTime2 = _rest.showTime) !== null && _rest$showTime2 !== void 0 ? _rest$showTime2 : {}), _defaultShowTime);
79
- }
80
- if ((0, _lodash.isBoolean)(_rest.showTime)) {
81
- _rest.showTime = (0, _objectSpread2.default)({}, _defaultShowTime);
82
- }
83
75
  // 字符串时间格式兼容
84
76
  if ((0, _lodash.isString)(_rest.value)) {
85
77
  _rest.value = (0, _moment.default)(_rest.value);
@@ -91,16 +83,12 @@ var DatePicker = function DatePicker(props) {
91
83
  _defaultShowTime: _defaultShowTime
92
84
  };
93
85
  }
94
- if ((0, _lodash.isBoolean)(_rest.showTime)) {
86
+ if (_rest.showTime === true) {
95
87
  _rest.showTime = (0, _objectSpread2.default)({}, _defaultShowTime);
96
88
  }
97
89
  if ((0, _lodash.isObject)(_rest.showTime)) {
98
90
  _rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
99
91
  }
100
- // 传进来showTime权重最高
101
- if ((0, _lodash.isBoolean)(rest.showTime)) {
102
- _rest.showTime = rest.showTime;
103
- }
104
92
  return (0, _jsxRuntime.jsx)(_antd.DatePicker, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, initialConfig), {}, {
105
93
  format: _format
106
94
  }, _rest), {}, {
@@ -61,6 +61,9 @@ var RangePicker = function RangePicker(props) {
61
61
  var _format = (0, _lodash.uniq)([].concat((0, _toConsumableArray2.default)(tempFormat), ['YYYY-MM-DD', 'YYYYMMDD', 'YYYY/MM/DD', 'YYYY_MM_DD', 'YYYY.MM.DD'])).filter(function (formatKey) {
62
62
  return !!formatKey;
63
63
  });
64
+ var _defaultShowTime = {
65
+ format: 'YYYY-MM-DD HH:mm:ss'
66
+ };
64
67
  if (isView) {
65
68
  var _res$value = _res.value,
66
69
  value = _res$value === void 0 ? [] : _res$value;
@@ -85,6 +88,9 @@ var RangePicker = function RangePicker(props) {
85
88
  children: viewChildren
86
89
  });
87
90
  }
91
+ if (_res.showTime === true) {
92
+ _res.showTime = (0, _objectSpread2.default)({}, _defaultShowTime);
93
+ }
88
94
  return (0, _jsxRuntime.jsx)(AntRangePicker, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, initialConfig), (0, _lodash.omit)(_res, ['separator'])), rangeRegulator), {}, {
89
95
  format: _format
90
96
  }));
@@ -134,7 +134,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
134
134
  var _res$data;
135
135
  var list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list : res === null || res === void 0 ? void 0 : res.data;
136
136
  setState({
137
- options: list
137
+ options: transformResponse ? transformResponse(res === null || res === void 0 ? void 0 : res.data) : list
138
138
  });
139
139
  }
140
140
  })),
@@ -298,7 +298,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
298
298
  while (1) switch (_context2.prev = _context2.next) {
299
299
  case 0:
300
300
  _context2.prev = 0;
301
- if (selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) {
301
+ if (!(!(selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) || !(selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length))) {
302
302
  _context2.next = 4;
303
303
  break;
304
304
  }
@@ -431,7 +431,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
431
431
  // 初始化回显,当传入initParams时,前端用来回险
432
432
  var getInitValues = /*#__PURE__*/function () {
433
433
  var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
434
- var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list, _res$data2, _data, nextSelectRowKeys;
434
+ var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
435
435
  return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
436
436
  while (1) switch (_context4.prev = _context4.next) {
437
437
  case 0:
@@ -456,11 +456,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
456
456
  case 8:
457
457
  res = _context4.sent;
458
458
  if (res === null || res === void 0 ? void 0 : res.data) {
459
- list = [];
459
+ list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
460
460
  if (transformResponse) {
461
461
  list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
462
- } else {
463
- list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
464
462
  }
465
463
  _data = isMultiple ? list : (_list = list) === null || _list === void 0 ? void 0 : _list[0];
466
464
  if (_data) {
@@ -497,7 +495,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
497
495
  var getDefaultOneValues = /*#__PURE__*/function () {
498
496
  var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee5() {
499
497
  var _useRequest$options4, _useRequest$options5;
500
- var queryBean, page, params, res, _list2, list, _res$data3, _data2, nextSelectRowKeys;
498
+ var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
501
499
  return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {
502
500
  while (1) switch (_context5.prev = _context5.next) {
503
501
  case 0:
@@ -515,11 +513,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
515
513
  case 6:
516
514
  res = _context5.sent;
517
515
  if (res === null || res === void 0 ? void 0 : res.data) {
518
- list = [];
516
+ list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
519
517
  if (transformResponse) {
520
518
  list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
521
- } else {
522
- list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
523
519
  }
524
520
  _data2 = isMultiple ? list : (_list2 = list) === null || _list2 === void 0 ? void 0 : _list2[0];
525
521
  nextSelectRowKeys = isMultiple ? value : [value];
@@ -601,9 +597,11 @@ var ProModalSelect = function ProModalSelect(props, ref) {
601
597
  nextState.selectedRows = value;
602
598
  }
603
599
  } else if (value) {
600
+ var _list$filter;
604
601
  var nextSelectedRowKeys = isMultiple ? value : [value];
605
602
  nextState.selectedRowKeys = nextSelectedRowKeys;
606
- nextState.selectedRows = options.filter(function (item) {
603
+ var list = options !== null && options !== void 0 ? options : data;
604
+ nextState.selectedRows = list === null || list === void 0 ? void 0 : (_list$filter = list.filter) === null || _list$filter === void 0 ? void 0 : _list$filter.call(list, function (item) {
607
605
  return nextSelectedRowKeys.includes(item[valueKey]);
608
606
  });
609
607
  }
@@ -626,7 +624,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
626
624
  pageSize: 50,
627
625
  queryBean: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.defaultParams), initParams)
628
626
  } : (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
629
- run(params);
627
+ var nextParams = transformParams ? transformParams(params) : params;
628
+ run(nextParams);
630
629
  setState({
631
630
  isInit: false
632
631
  });
@@ -690,7 +689,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
690
689
  pageSize: 50,
691
690
  queryBean: queryBean
692
691
  } : queryBean;
693
- run(params);
692
+ var nextParams = transformParams ? transformParams(params) : params;
693
+ run(nextParams);
694
694
  setState({
695
695
  isInit: false
696
696
  });
@@ -704,7 +704,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
704
704
  pageSize: 50,
705
705
  queryBean: queryBean
706
706
  } : queryBean;
707
- run(params);
707
+ var nextParams = transformParams ? transformParams(params) : params;
708
+ run(nextParams);
708
709
  }, 2000),
709
710
  style: {
710
711
  width: isView || disabled ? '100%' : 'calc(100% - 30px)'
@@ -2,8 +2,9 @@ import { Form, FormInstance } from 'antd';
2
2
  import React, { ForwardRefRenderFunction } from 'react';
3
3
  import { FormProviderProps } from 'antd/es/form/context';
4
4
  import { ProFormProps } from './propsType';
5
+ import { useForm } from './utils/useForm';
5
6
  interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, ProFormProps<T>> {
6
- useForm: typeof Form.useForm;
7
+ useForm: typeof useForm;
7
8
  useWatch: typeof Form.useWatch;
8
9
  [key: string]: any;
9
10
  }
@@ -24,7 +24,7 @@ var _index = require("./utils/index");
24
24
  var _useForm3 = require("./utils/useForm");
25
25
  var _useFieldProps = require("./utils/useFieldProps");
26
26
  var _locale = _interopRequireDefault(require("../locale"));
27
- var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl"];
27
+ var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl", "scrollToError"];
28
28
  var ProForm = function ProForm(props, ref) {
29
29
  var _forms$formKey, _localStorage, _ref;
30
30
  var _props$mode = props.mode,
@@ -66,13 +66,17 @@ var ProForm = function ProForm(props, ref) {
66
66
  originalDiffTip = _props$originalDiffTi === void 0 ? true : _props$originalDiffTi,
67
67
  formKey = props.formKey,
68
68
  globalControl = props.globalControl,
69
+ _props$scrollToError = props.scrollToError,
70
+ scrollToError = _props$scrollToError === void 0 ? true : _props$scrollToError,
69
71
  otherProps = (0, _objectWithoutProperties2.default)(props, _excluded);
70
72
  var _useProConfig = (0, _ProConfigProvider.useProConfig)(),
71
73
  state = _useProConfig.state,
72
74
  dispatch = _useProConfig.dispatch;
73
75
  var config = state.ProForm,
74
76
  forms = state.forms;
75
- var _useForm = (0, _useForm3.useForm)((_forms$formKey = forms[formKey]) !== null && _forms$formKey !== void 0 ? _forms$formKey : originForm),
77
+ var _useForm = (0, _useForm3.useForm)((_forms$formKey = forms[formKey]) !== null && _forms$formKey !== void 0 ? _forms$formKey : originForm, {
78
+ scrollToError: scrollToError
79
+ }),
76
80
  _useForm2 = (0, _slicedToArray2.default)(_useForm, 1),
77
81
  form = _useForm2[0];
78
82
  var _useControlled = (0, _index.useControlled)({
@@ -75,6 +75,7 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
75
75
  formId?: string;
76
76
  required?: boolean | boolean[];
77
77
  originalDiffTip?: boolean;
78
+ scrollToError?: boolean;
78
79
  }
79
80
  export interface Transform<T = any> {
80
81
  normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
@@ -2,5 +2,8 @@ import { FormInstance } from 'antd';
2
2
  type ModifiedFormInstance<T> = FormInstance<T> & {
3
3
  isModified?: boolean;
4
4
  };
5
- export declare const useForm: <T>(originForm: ModifiedFormInstance<T>) => [ModifiedFormInstance<T>];
5
+ interface FormInstanceOption {
6
+ scrollToError?: boolean;
7
+ }
8
+ export declare const useForm: <T>(originForm: ModifiedFormInstance<T>, options?: FormInstanceOption) => [ModifiedFormInstance<T>];
6
9
  export {};
@@ -12,7 +12,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
12
12
  var _antd = require("antd");
13
13
  var _index = require("./index");
14
14
  var _tools = require("../../ProEditTable/utils/tools");
15
- var useForm = exports.useForm = function useForm(originForm) {
15
+ var useForm = exports.useForm = function useForm(originForm, options) {
16
+ var _ref = options || {},
17
+ _ref$scrollToError = _ref.scrollToError,
18
+ scrollToError = _ref$scrollToError === void 0 ? true : _ref$scrollToError;
16
19
  var _Form$useForm = _antd.Form.useForm(originForm),
17
20
  _Form$useForm2 = (0, _slicedToArray2.default)(_Form$useForm, 1),
18
21
  form = _Form$useForm2[0];
@@ -30,7 +33,7 @@ var useForm = exports.useForm = function useForm(originForm) {
30
33
  return getFieldsValue(nameList, filterFunc);
31
34
  };
32
35
  var _validateFields = /*#__PURE__*/function () {
33
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(nameList) {
36
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(nameList) {
34
37
  var _rest$,
35
38
  _len,
36
39
  rest,
@@ -87,7 +90,7 @@ var useForm = exports.useForm = function useForm(originForm) {
87
90
  case 17:
88
91
  _context.prev = 17;
89
92
  _context.t0 = _context["catch"](0);
90
- if (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : _error$errorFields.length) {
93
+ if (scrollToError && (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : _error$errorFields.length)) {
91
94
  form.scrollToField((_error$errorFields$ = _context.t0.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
92
95
  block: 'center',
93
96
  behavior: 'smooth'
@@ -102,7 +105,7 @@ var useForm = exports.useForm = function useForm(originForm) {
102
105
  }, _callee, null, [[0, 17]]);
103
106
  }));
104
107
  return function _validateFields(_x) {
105
- return _ref.apply(this, arguments);
108
+ return _ref2.apply(this, arguments);
106
109
  };
107
110
  }();
108
111
  form.getFieldsValue = _getFieldsValue;
@@ -155,11 +155,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
155
155
  index: index,
156
156
  namePath: namePath
157
157
  }) : rules;
158
- var _component = (0, _lodash.isFunction)(originComponent) ? originComponent(_currentValues, {
159
- form: form,
160
- index: index,
161
- namePath: namePath
162
- }) : newComponent;
158
+ // const _component = isFunction(originComponent)
159
+ // ? originComponent(_currentValues, { form, index, namePath })
160
+ // : newComponent;
163
161
  var _fieldProps = (0, _lodash.isFunction)(fieldProps) ? fieldProps(_currentValues, {
164
162
  form: form,
165
163
  index: index,
@@ -168,7 +166,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
168
166
  // 清值防抖 多次刷新时以最后一次为准
169
167
  if (clearNotShow !== false && (name || names)) {
170
168
  if (_show === false) {
171
- clearInterval(timerRef.current);
169
+ clearTimeout(timerRef.current);
172
170
  timerRef.current = setTimeout(function () {
173
171
  if (Array.isArray(names)) {
174
172
  form.resetFields(names);
@@ -178,17 +176,12 @@ var useShouldUpdate = function useShouldUpdate(props) {
178
176
  }
179
177
  }, 200);
180
178
  } else {
181
- clearInterval(timerRef.current);
179
+ clearTimeout(timerRef.current);
182
180
  }
183
181
  }
184
- // // 当校验规则改变的时候 重新执行校验 导致: 第一次进页面直接触发校验
185
- // if (
186
- // _required !== requiredRef.current ||
187
- // !isEqualWith(rulesRef.current, _rules, customEqualForFun)
188
- // ) {
189
- // form.validateFields([name]);
190
- // }
191
182
  if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !(0, _lodash.isEqualWith)(rulesRef.current, _rules, _index.customEqualForFun) || !(0, _lodash.isEqualWith)(fieldPropsRef.current, _fieldProps, _index.customEqualForFun) ||
183
+ // 值变更,需要同步更新函数式的fieldProps
184
+ (0, _lodash.isEqualWith)(fieldPropsRef.current, _fieldProps, _index.customEqualForFun) && !(0, _lodash.isEqual)(prevValues, currentValues) ||
192
185
  // !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
193
186
  (0, _index.equalDependencies)(dependencies, prevValues, _currentValues)) {
194
187
  showRef.current = _show;
@@ -14,12 +14,16 @@ var _react = _interopRequireDefault(require("react"));
14
14
  var _index = require("../../index");
15
15
  var _excluded = ["children", "delayTime"];
16
16
  var _default = exports.default = function _default(_ref) {
17
+ var _children$props;
17
18
  var children = _ref.children,
18
19
  delayTime = _ref.delayTime,
19
20
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
20
21
  var _useStep = (0, _index.useStep)(),
21
- notify = _useStep.notify;
22
+ notify = _useStep.notify,
23
+ loading = _useStep.loading,
24
+ setLoading = _useStep.setLoading;
22
25
  return /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
26
+ loading: loading || (children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.loading),
23
27
  onClick: (0, _lodash.throttle)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
24
28
  var values;
25
29
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
@@ -31,10 +35,11 @@ var _default = exports.default = function _default(_ref) {
31
35
  case 3:
32
36
  values = _context.sent;
33
37
  setTimeout(function () {
38
+ setLoading(false);
34
39
  var localData = localStorage.getItem('cache-pro-step');
35
40
  if (localData !== 'false') {
36
- var _children$props, _children$props$onCli;
37
- children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : (_children$props$onCli = _children$props.onClick) === null || _children$props$onCli === void 0 ? void 0 : _children$props$onCli.call(_children$props, values);
41
+ var _children$props2, _children$props2$onCl;
42
+ children === null || children === void 0 ? void 0 : (_children$props2 = children.props) === null || _children$props2 === void 0 ? void 0 : (_children$props2$onCl = _children$props2.onClick) === null || _children$props2$onCl === void 0 ? void 0 : _children$props2$onCl.call(_children$props2, values);
38
43
  }
39
44
  }, delayTime !== null && delayTime !== void 0 ? delayTime : 0);
40
45
  case 5:
@@ -38,6 +38,10 @@ var ProStep = function ProStep(_ref) {
38
38
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
39
39
  anchorIds = _useState2[0],
40
40
  setAnchorIds = _useState2[1];
41
+ var _useState3 = (0, _react.useState)(false),
42
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
43
+ loading = _useState4[0],
44
+ setLoading = _useState4[1];
41
45
  var _useLocalStorageState = (0, _ahooks.useLocalStorageState)('cache-pro-step'),
42
46
  _useLocalStorageState2 = (0, _slicedToArray2.default)(_useLocalStorageState, 2),
43
47
  setLocalData = _useLocalStorageState2[1];
@@ -109,10 +113,11 @@ var ProStep = function ProStep(_ref) {
109
113
  case 10:
110
114
  values[id] = _context.sent;
111
115
  case 11:
112
- _context.next = 19;
116
+ setErrorCollection((0, _defineProperty2.default)({}, id, 0));
117
+ _context.next = 21;
113
118
  break;
114
- case 13:
115
- _context.prev = 13;
119
+ case 14:
120
+ _context.prev = 14;
116
121
  _context.t0 = _context["catch"](1);
117
122
  num = _context.t0 === null || _context.t0 === void 0 ? void 0 : (_errors$errorFields = _context.t0.errorFields) === null || _errors$errorFields === void 0 ? void 0 : _errors$errorFields.length;
118
123
  if (num) {
@@ -120,14 +125,15 @@ var ProStep = function ProStep(_ref) {
120
125
  console.error(_context.t0);
121
126
  }
122
127
  setErrorCollection((0, _defineProperty2.default)({}, id, num));
128
+ setLoading(false);
123
129
  return _context.abrupt("return", _context.t0);
124
- case 19:
130
+ case 21:
125
131
  return _context.abrupt("return", values[id]);
126
- case 20:
132
+ case 22:
127
133
  case "end":
128
134
  return _context.stop();
129
135
  }
130
- }, _callee, null, [[1, 13]]);
136
+ }, _callee, null, [[1, 14]]);
131
137
  }));
132
138
  return function subEvent() {
133
139
  return _ref5.apply(this, arguments);
@@ -144,11 +150,12 @@ var ProStep = function ProStep(_ref) {
144
150
  return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
145
151
  while (1) switch (_context2.prev = _context2.next) {
146
152
  case 0:
147
- _context2.next = 2;
153
+ setLoading(true);
154
+ _context2.next = 3;
148
155
  return emitter.emit();
149
- case 2:
150
- return _context2.abrupt("return", values);
151
156
  case 3:
157
+ return _context2.abrupt("return", values);
158
+ case 4:
152
159
  case "end":
153
160
  return _context2.stop();
154
161
  }
@@ -239,7 +246,9 @@ var ProStep = function ProStep(_ref) {
239
246
  register: register,
240
247
  notify: notify,
241
248
  triggerTo: triggerTo,
242
- handleScroll: _utils.handleScroll
249
+ handleScroll: _utils.handleScroll,
250
+ loading: loading,
251
+ setLoading: setLoading
243
252
  },
244
253
  children: (0, _jsxRuntime.jsxs)("div", {
245
254
  className: "pro-step-wrapper",
@@ -85,7 +85,6 @@ var formatColumn = exports.formatColumn = function formatColumn(column, original
85
85
  };
86
86
  // 后缀处理
87
87
  var suffixNode = function suffixNode(value, record, index) {
88
- console.log('记录看下', suffix);
89
88
  if ((0, _lodash.isString)(suffix) || /*#__PURE__*/(0, _react.isValidElement)(suffix)) {
90
89
  return suffix;
91
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.5.4",
3
+ "version": "3.5.5-beta.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",