@zat-design/sisyphus-react 3.4.8 → 3.4.9-beta.10

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 (59) hide show
  1. package/dist/index.esm.css +14 -1
  2. package/dist/less.esm.css +5 -1
  3. package/es/ProEditTable/components/RenderField/index.js +5 -1
  4. package/es/ProEnum/components/Group.d.ts +1 -0
  5. package/es/ProEnum/index.js +8 -5
  6. package/es/ProEnum/style/index.less +2 -2
  7. package/es/ProForm/components/combination/Group/index.js +13 -15
  8. package/es/ProForm/components/combination/Group/utils.js +2 -1
  9. package/es/ProForm/components/combination/ProModalSelect/index.js +4 -4
  10. package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +1 -0
  11. package/es/ProForm/components/combination/ProNumberRange/style/index.less +6 -1
  12. package/es/ProForm/components/combination/ProRangeLimit/index.js +6 -2
  13. package/es/ProForm/components/render/ConfirmWrapper.js +68 -33
  14. package/es/ProForm/components/render/RenderFields.js +4 -1
  15. package/es/ProForm/index.d.ts +3 -1
  16. package/es/ProForm/index.js +13 -12
  17. package/es/ProForm/utils/index.d.ts +3 -1
  18. package/es/ProForm/utils/index.js +22 -1
  19. package/es/ProForm/utils/rulesCreator.js +1 -1
  20. package/es/ProForm/utils/useForm.js +34 -17
  21. package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -0
  22. package/es/ProLayout/components/ProCollapse/index.js +11 -2
  23. package/es/ProLayout/components/ProCollapse/style/index.less +5 -2
  24. package/es/ProSelect/index.js +6 -3
  25. package/es/ProSelect/utils/index.d.ts +2 -1
  26. package/es/ProSelect/utils/index.js +7 -4
  27. package/es/ProStep/components/Listener/index.d.ts +1 -1
  28. package/es/ProStep/components/Listener/index.js +3 -2
  29. package/es/ProStep/index.d.ts +1 -1
  30. package/es/style/theme/antd.less +16 -1
  31. package/lib/ProEditTable/components/RenderField/index.js +5 -1
  32. package/lib/ProEnum/components/Group.d.ts +1 -0
  33. package/lib/ProEnum/index.js +8 -5
  34. package/lib/ProEnum/style/index.less +2 -2
  35. package/lib/ProForm/components/combination/Group/index.js +13 -16
  36. package/lib/ProForm/components/combination/Group/utils.js +2 -1
  37. package/lib/ProForm/components/combination/ProModalSelect/index.js +4 -4
  38. package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +1 -0
  39. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +6 -1
  40. package/lib/ProForm/components/combination/ProRangeLimit/index.js +6 -2
  41. package/lib/ProForm/components/render/ConfirmWrapper.js +68 -33
  42. package/lib/ProForm/components/render/RenderFields.js +4 -1
  43. package/lib/ProForm/index.d.ts +3 -1
  44. package/lib/ProForm/index.js +14 -13
  45. package/lib/ProForm/utils/index.d.ts +3 -1
  46. package/lib/ProForm/utils/index.js +25 -2
  47. package/lib/ProForm/utils/rulesCreator.js +1 -1
  48. package/lib/ProForm/utils/useForm.js +34 -17
  49. package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -0
  50. package/lib/ProLayout/components/ProCollapse/index.js +11 -2
  51. package/lib/ProLayout/components/ProCollapse/style/index.less +5 -2
  52. package/lib/ProSelect/index.js +6 -3
  53. package/lib/ProSelect/utils/index.d.ts +2 -1
  54. package/lib/ProSelect/utils/index.js +7 -4
  55. package/lib/ProStep/components/Listener/index.d.ts +1 -1
  56. package/lib/ProStep/components/Listener/index.js +3 -2
  57. package/lib/ProStep/index.d.ts +1 -1
  58. package/lib/style/theme/antd.less +16 -1
  59. package/package.json +2 -2
@@ -682,7 +682,7 @@
682
682
  .pro-collapse .pro-collapse-icon img {
683
683
  vertical-align: sub;
684
684
  }
685
- .pro-collapse.pro-collapse-no-title .ant-collapse-header {
685
+ .pro-collapse.pro-collapse-no-title > .pro-collapse-panel > .ant-collapse-header {
686
686
  display: none !important;
687
687
  }
688
688
  .pro-collapse.pro-collapse-no-title .pro-collapse-level2 .ant-collapse-header {
@@ -2255,7 +2255,11 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2255
2255
  .pro-number-range .range-split.ant-input[disabled] {
2256
2256
  background: #fff !important;
2257
2257
  }
2258
+ .pro-number-range .ant-input-number-status-error:not(.ant-input-number-disabled):not( .ant-input-number-borderless).ant-input-number {
2259
+ border-color: var(--zaui-danger, #ff5050) !important;
2260
+ }
2258
2261
  .pro-number-range .ant-input-status-error.range-split {
2262
+ color: var(--zaui-danger, #ff5050) !important;
2259
2263
  border-color: var(--zaui-danger, #ff5050);
2260
2264
  }
2261
2265
  .pro-number-range .ant-input-rtl.range-right {
@@ -5163,6 +5167,15 @@ input[type='button'] {
5163
5167
  .ant-modal .ant-input-textarea-show-count.ant-input-textarea-in-form-item::after {
5164
5168
  background: transparent;
5165
5169
  }
5170
+ .ant-form .ant-drawer-body .ant-form-item .ant-form-item-label.ant-form-item-label-left > .ant-form-item-required::before,
5171
+ .ant-drawer .ant-drawer-body .ant-form-item .ant-form-item-label.ant-form-item-label-left > .ant-form-item-required::before,
5172
+ .ant-modal .ant-drawer-body .ant-form-item .ant-form-item-label.ant-form-item-label-left > .ant-form-item-required::before {
5173
+ position: absolute;
5174
+ top: calc(50% - 7px);
5175
+ left: -8px;
5176
+ margin: 0;
5177
+ right: inherit;
5178
+ }
5166
5179
  .ant-form .ant-form-item.ant-form-item-with-help,
5167
5180
  .ant-drawer .ant-form-item.ant-form-item-with-help,
5168
5181
  .ant-modal .ant-form-item.ant-form-item-with-help {
package/dist/less.esm.css CHANGED
@@ -682,7 +682,7 @@
682
682
  .pro-collapse .pro-collapse-icon img {
683
683
  vertical-align: sub;
684
684
  }
685
- .pro-collapse.pro-collapse-no-title .ant-collapse-header {
685
+ .pro-collapse.pro-collapse-no-title > .pro-collapse-panel > .ant-collapse-header {
686
686
  display: none !important;
687
687
  }
688
688
  .pro-collapse.pro-collapse-no-title .pro-collapse-level2 .ant-collapse-header {
@@ -2255,7 +2255,11 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2255
2255
  .pro-number-range .range-split.ant-input[disabled] {
2256
2256
  background: #fff !important;
2257
2257
  }
2258
+ .pro-number-range .ant-input-number-status-error:not(.ant-input-number-disabled):not( .ant-input-number-borderless).ant-input-number {
2259
+ border-color: var(--zaui-danger, #ff5050) !important;
2260
+ }
2258
2261
  .pro-number-range .ant-input-status-error.range-split {
2262
+ color: var(--zaui-danger, #ff5050) !important;
2259
2263
  border-color: var(--zaui-danger, #ff5050);
2260
2264
  }
2261
2265
  .pro-number-range .ant-input-rtl.range-right {
@@ -89,6 +89,10 @@ var RenderField = function RenderField(_ref) {
89
89
  }
90
90
  // type类型 首字母转大写
91
91
  type = ((_type = type) === null || _type === void 0 ? void 0 : (_type$replace = _type.replace) === null || _type$replace === void 0 ? void 0 : _type$replace.call(_type, type[0], type[0].toUpperCase())) || 'Input';
92
+ // 自定义组件时 防止默认值影像后续判断
93
+ if ('component' in column) {
94
+ type = null;
95
+ }
92
96
  // 单行正在编辑时,临时生成一套formItem用来存储中间值,点击取消时候重置回上一次状态
93
97
  var namePath = getNamePath(name, virtualKey);
94
98
  var rowData = form.getFieldValue([].concat(_toConsumableArray(namePath), [index])) || record || {};
@@ -406,7 +410,7 @@ var RenderField = function RenderField(_ref) {
406
410
  }
407
411
  _args = formatArgs([].concat(args));
408
412
  rowPath = [].concat(_toConsumableArray(namePath), [index]);
409
- row = type === form.getFieldValue(rowPath, true);
413
+ row = form.getFieldValue(rowPath, true);
410
414
  orgRow = cloneDeep(row);
411
415
  _args[1] = row;
412
416
  _context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
@@ -4,6 +4,7 @@ interface Props extends Pick<ProEnum, 'value' | 'onChange' | 'dataSource'> {
4
4
  fieldLabel: string;
5
5
  disabled?: boolean;
6
6
  allowClear?: boolean;
7
+ button?: boolean;
7
8
  }
8
9
  declare const Group: (props: Props) => JSX.Element;
9
10
  export default Group;
@@ -12,7 +12,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
12
12
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
13
13
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
14
14
  var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps"],
15
- _excluded2 = ["fieldNames", "clear", "cacheKey"];
15
+ _excluded2 = ["fieldNames", "clear", "cacheKey", "showCodeName"];
16
16
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
17
17
  import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
18
18
  import React, { useState, useEffect, useMemo } from 'react';
@@ -28,6 +28,7 @@ import useEnum from './hooks/useEnum';
28
28
  import locale from '../locale';
29
29
  import './style/index.less';
30
30
  var ProEnum = function ProEnum(props) {
31
+ var _enumProps$showCodeNa;
31
32
  var code = props.code,
32
33
  _props$type = props.type,
33
34
  type = _props$type === void 0 ? 'ProSelect' : _props$type,
@@ -41,15 +42,16 @@ var ProEnum = function ProEnum(props) {
41
42
  enumProps = _objectWithoutProperties(props, _excluded);
42
43
  var _ref = otherProps || {},
43
44
  isView = _ref.isView,
44
- viewEmpty = _ref.viewEmpty,
45
- disabled = _ref.disabled;
45
+ viewEmpty = _ref.viewEmpty;
46
46
  var _ref2 = useProConfig('ProEnum') || {},
47
47
  fieldNames = _ref2.fieldNames,
48
48
  _ref2$clear = _ref2.clear,
49
49
  clear = _ref2$clear === void 0 ? true : _ref2$clear,
50
50
  _ref2$cacheKey = _ref2.cacheKey,
51
51
  cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
52
+ showCodeName = _ref2.showCodeName,
52
53
  resProps = _objectWithoutProperties(_ref2, _excluded2);
54
+ enumProps.showCodeName = (_enumProps$showCodeNa = enumProps.showCodeName) !== null && _enumProps$showCodeNa !== void 0 ? _enumProps$showCodeNa : showCodeName;
53
55
  var label = '';
54
56
  var fieldValue = '';
55
57
  var _useState = useState(dataSource || []),
@@ -165,6 +167,7 @@ var ProEnum = function ProEnum(props) {
165
167
  switch (type) {
166
168
  case 'ProSelect':
167
169
  return _jsx(ProSelect, _objectSpread(_objectSpread({}, enumProps), {}, {
170
+ otherProps: otherProps,
168
171
  dataSource: list,
169
172
  fieldNames: {
170
173
  label: label,
@@ -235,8 +238,8 @@ var ProEnum = function ProEnum(props) {
235
238
  return item[fieldValue] === (v === null || v === void 0 ? void 0 : v[fieldValue]);
236
239
  }
237
240
  return item[fieldValue] === v;
238
- });
239
- return enumProps.showCodeName ? "".concat(option[fieldValue], "-").concat(option[label]) : option === null || option === void 0 ? void 0 : option[label];
241
+ }) || {};
242
+ return enumProps.showCodeName ? "".concat(option === null || option === void 0 ? void 0 : option[fieldValue], "-").concat(option === null || option === void 0 ? void 0 : option[label]) : option === null || option === void 0 ? void 0 : option[label];
240
243
  });
241
244
  var record = value.map(function (v) {
242
245
  return list.find(function (item) {
@@ -76,8 +76,8 @@
76
76
  }
77
77
 
78
78
  .pro-enum-group-item-selected {
79
- color: var(--zaui-brand);
80
- background: #fff;
79
+ background: var(--zaui-brand);
80
+ color: #fff;
81
81
  border: 1px solid var(--zaui-brand);
82
82
  &::after {
83
83
  background: transparent;
@@ -4,7 +4,7 @@ import _Space from "antd/es/space";
4
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
5
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
- import React, { useMemo } from 'react';
7
+ import React from 'react';
8
8
  import { omit } from 'lodash';
9
9
  import classnames from 'classnames';
10
10
  import { insertSeparator, transformColumns } from './utils';
@@ -41,20 +41,18 @@ var GroupCopy = function GroupCopy(props) {
41
41
  _option.current[index] = option;
42
42
  onChange(_value, _option.current);
43
43
  };
44
- var columns = useMemo(function () {
45
- var columnsProps = transformColumns({
46
- columns: children,
47
- name: name,
48
- names: names,
49
- onChange: handleChange,
50
- namePath: namePath,
51
- form: form,
52
- index: index,
53
- value: value,
54
- groupProps: props
55
- });
56
- return insertSeparator(columnsProps, space);
57
- }, [name, value, children, space, names, namePath, index]);
44
+ var columnsProps = transformColumns({
45
+ columns: children,
46
+ name: name,
47
+ names: names,
48
+ onChange: handleChange,
49
+ namePath: namePath,
50
+ form: form,
51
+ index: index,
52
+ value: value,
53
+ groupProps: props
54
+ });
55
+ var columns = insertSeparator(columnsProps, space);
58
56
  var _className = classnames(_defineProperty({
59
57
  'pro-group': true,
60
58
  'pro-group-diy-width': columns.some(function (item) {
@@ -220,7 +220,8 @@ export var transformColumns = function transformColumns(params) {
220
220
  onFieldChange === null || onFieldChange === void 0 ? void 0 : onFieldChange(newValue, form.getFieldValue(namePath), {
221
221
  index: outerIndex,
222
222
  namePath: namePath,
223
- form: form
223
+ form: form,
224
+ option: args === null || args === void 0 ? void 0 : args[1]
224
225
  });
225
226
  };
226
227
  return _objectSpread(_objectSpread(_objectSpread({}, column), {}, {
@@ -16,7 +16,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
16
16
  import "antd/es/form/style";
17
17
  import _Form from "antd/es/form";
18
18
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
19
- var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "isTooltip", "searchForm", "defaultOne"],
19
+ var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "isTooltip", "searchForm", "searchKey", "defaultOne"],
20
20
  _excluded2 = ["onOk"],
21
21
  _excluded3 = ["rowKey", "columns", "rowSelection"];
22
22
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
@@ -52,6 +52,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
52
52
  beforeOpen = props.beforeOpen,
53
53
  isTooltip = props.isTooltip,
54
54
  searchForm = props.searchForm,
55
+ searchKey = props.searchKey,
55
56
  defaultOne = props.defaultOne,
56
57
  restProps = _objectWithoutProperties(props, _excluded);
57
58
  var contentForm = _Form.useFormInstance();
@@ -603,7 +604,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
603
604
  nextState.selectedRows = value;
604
605
  }
605
606
  } else if (value) {
606
- console.log('value', value);
607
607
  nextState.selectedRowKeys = [value];
608
608
  }
609
609
  setState(nextState);
@@ -696,14 +696,14 @@ var ProModalSelect = function ProModalSelect(props, ref) {
696
696
  },
697
697
  onSearch: debounce(function (val) {
698
698
  var _useRequest$options10;
699
- var queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams), {}, _defineProperty({}, labelKey, val));
699
+ var queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams), {}, _defineProperty({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
700
700
  var params = withPagination ? {
701
701
  pageNum: 1,
702
702
  pageSize: 50,
703
703
  queryBean: queryBean
704
704
  } : queryBean;
705
705
  run(params);
706
- }, 800),
706
+ }, 2000),
707
707
  style: {
708
708
  width: isView || disabled ? '100%' : 'calc(100% - 30px)'
709
709
  }
@@ -42,6 +42,7 @@ interface ProModalPropsType {
42
42
  isTooltip?: any;
43
43
  showCodeName?: boolean;
44
44
  searchForm?: FormInstance;
45
+ searchKey?: string;
45
46
  }
46
47
  export declare type ProModalSelectPropsType = SelectProps & InputProps & ProModalPropsType;
47
48
  export {};
@@ -13,9 +13,14 @@
13
13
  background: #fff !important;
14
14
  }
15
15
  }
16
-
16
+ .@{ant-prefix}-input-number-status-error:not(.@{ant-prefix}-input-number-disabled):not(
17
+ .@{ant-prefix}-input-number-borderless
18
+ ).@{ant-prefix}-input-number {
19
+ border-color: @zaui-danger !important;
20
+ }
17
21
  .@{ant-prefix}-input-status-error {
18
22
  &.range-split {
23
+ color: @zaui-danger !important;
19
24
  border-color: @zaui-danger;
20
25
  }
21
26
  }
@@ -122,8 +122,12 @@ var ProRangeLimit = function ProRangeLimit(props) {
122
122
  start = _ref9[0],
123
123
  end = _ref9[1];
124
124
  if (e.target.checked) {
125
- var _start, _end;
126
- start = start || moment().startOf('day');
125
+ var _rest$allowEmpty, _start, _end;
126
+ if (((_rest$allowEmpty = rest.allowEmpty) === null || _rest$allowEmpty === void 0 ? void 0 : _rest$allowEmpty[0]) === true) {
127
+ start = null;
128
+ } else {
129
+ start = start || moment().startOf('day');
130
+ }
127
131
  end = foreverMoment;
128
132
  onChange([start, end, e.target.checked], [(_start = start) === null || _start === void 0 ? void 0 : _start.format(format), (_end = end) === null || _end === void 0 ? void 0 : _end.format(format), foreverStr]);
129
133
  } else {
@@ -1,6 +1,8 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
1
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
3
  import "antd/es/modal/style";
3
4
  import _Modal from "antd/es/modal";
5
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
6
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
7
  var _excluded = ["onChange", "children", "confirm", "otherProps"];
6
8
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
@@ -19,40 +21,73 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
19
21
  rest = _objectWithoutProperties(props, _excluded);
20
22
  var _ProForm$useFieldProp = ProForm.useFieldProps(),
21
23
  form = _ProForm$useFieldProp.form;
22
- var handleChange = function handleChange(value) {
23
- for (var _len = arguments.length, other = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
24
- other[_key - 1] = arguments[_key];
25
- }
26
- var _value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
27
- var confirmProps = isFunction(confirm) ? confirm(value, form.getFieldsValue(), {
28
- option: other[0],
29
- form: form,
30
- namePath: otherProps.namePath,
31
- index: otherProps.index
32
- }) : confirm;
33
- if (confirmProps === true) {
34
- _Modal.confirm(_objectSpread(_objectSpread({}, defaultConfirmProps), {}, {
35
- onOk: function onOk() {
36
- return onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
24
+ var handleChange = /*#__PURE__*/function () {
25
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {
26
+ var _len,
27
+ other,
28
+ _key,
29
+ _value,
30
+ confirmProps,
31
+ _args = arguments;
32
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
33
+ while (1) switch (_context.prev = _context.next) {
34
+ case 0:
35
+ for (_len = _args.length, other = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
36
+ other[_key - 1] = _args[_key];
37
+ }
38
+ _value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
39
+ if (!isFunction(confirm)) {
40
+ _context.next = 8;
41
+ break;
42
+ }
43
+ _context.next = 5;
44
+ return confirm(value, form.getFieldsValue(), {
45
+ option: other[0],
46
+ form: form,
47
+ namePath: otherProps.namePath,
48
+ index: otherProps.index
49
+ });
50
+ case 5:
51
+ _context.t0 = _context.sent;
52
+ _context.next = 9;
53
+ break;
54
+ case 8:
55
+ _context.t0 = confirm;
56
+ case 9:
57
+ confirmProps = _context.t0;
58
+ // 只处理 false, true 和 对象的情况
59
+ if (confirmProps === false) {
60
+ onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
61
+ }
62
+ if (confirmProps === true) {
63
+ _Modal.confirm(_objectSpread(_objectSpread({}, defaultConfirmProps), {}, {
64
+ onOk: function onOk() {
65
+ return onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
66
+ }
67
+ }));
68
+ }
69
+ if (isObject(confirmProps)) {
70
+ _Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, 'title' in confirmProps || 'content' in confirmProps ? {} : defaultConfirmProps), confirmProps), {}, {
71
+ onOk: function onOk() {
72
+ var _confirmProps$onOk;
73
+ for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
74
+ arg[_key2] = arguments[_key2];
75
+ }
76
+ (_confirmProps$onOk = confirmProps.onOk) === null || _confirmProps$onOk === void 0 ? void 0 : _confirmProps$onOk.call.apply(_confirmProps$onOk, [confirmProps].concat(arg));
77
+ onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
78
+ }
79
+ }));
80
+ }
81
+ case 13:
82
+ case "end":
83
+ return _context.stop();
37
84
  }
38
- }));
39
- return;
40
- }
41
- if (isObject(confirmProps)) {
42
- _Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, 'title' in confirmProps || 'content' in confirmProps ? {} : defaultConfirmProps), confirmProps), {}, {
43
- onOk: function onOk() {
44
- var _confirmProps$onOk;
45
- for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
46
- arg[_key2] = arguments[_key2];
47
- }
48
- (_confirmProps$onOk = confirmProps.onOk) === null || _confirmProps$onOk === void 0 ? void 0 : _confirmProps$onOk.call.apply(_confirmProps$onOk, [confirmProps].concat(arg));
49
- onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
50
- }
51
- }));
52
- return;
53
- }
54
- onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
55
- };
85
+ }, _callee);
86
+ }));
87
+ return function handleChange(_x) {
88
+ return _ref.apply(this, arguments);
89
+ };
90
+ }();
56
91
  return _jsx(_Fragment, {
57
92
  children: /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, rest), {}, {
58
93
  // @ts-ignore
@@ -109,9 +109,12 @@ var RenderFields = function RenderFields(props) {
109
109
  if (typeof _type === 'string') {
110
110
  TargetComponent = _isView && viewRender ? viewRenderHandle : componentMap[_type];
111
111
  }
112
+ // 自定义组件时 防止默认值影像后续判断
113
+ if ('component' in column) {
114
+ _type = null;
115
+ }
112
116
  if (component && /*#__PURE__*/React.isValidElement(component)) {
113
117
  var _newComponent$props;
114
- _type = null;
115
118
  var newComponent = component;
116
119
  var isProEditTable = (newComponent === null || newComponent === void 0 ? void 0 : (_newComponent$props = newComponent.props) === null || _newComponent$props === void 0 ? void 0 : _newComponent$props.onlyOneLineMsg) === '请先保存数据';
117
120
  TargetComponent = _isView ? viewRenderHandle || '' : component;
@@ -1,5 +1,6 @@
1
1
  import { Form, FormInstance } from 'antd';
2
- import { ForwardRefRenderFunction } from 'react';
2
+ import React, { ForwardRefRenderFunction } from 'react';
3
+ import { FormProviderProps } from 'antd/es/form/context';
3
4
  import { ProFormProps } from './propsType';
4
5
  interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, ProFormProps<T>> {
5
6
  useForm: typeof Form.useForm;
@@ -7,4 +8,5 @@ interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, Pr
7
8
  [key: string]: any;
8
9
  }
9
10
  declare const ProFormForward: IProForm;
11
+ export declare const ProFormProvider: React.FC<FormProviderProps>;
10
12
  export default ProFormForward;
@@ -1,4 +1,3 @@
1
- import _toArray from "@babel/runtime/helpers/esm/toArray";
2
1
  import "antd/es/row/style";
3
2
  import _Row from "antd/es/row";
4
3
  import "antd/es/form/style";
@@ -282,30 +281,32 @@ ProFormForward.useWatch = function (watchValue, form) {
282
281
  }
283
282
  return _Form.useWatch([], form);
284
283
  };
285
- var ProFormProvider = function ProFormProvider(props) {
284
+ export var ProFormProvider = function ProFormProvider(props) {
286
285
  var onFormChange = props.onFormChange,
287
286
  onFormFinish = props.onFormFinish,
288
287
  children = props.children;
289
- var handleFormChange = function handleFormChange(name, info) {
288
+ var handleFormChange = function handleFormChange(formName, info) {
290
289
  var changedFields = info.changedFields;
291
290
  var _changedFields = changedFields.flatMap(function (item) {
292
- var name = item.name,
293
- _item$value = item.value,
291
+ var _item$value = item.value,
294
292
  value = _item$value === void 0 ? [] : _item$value;
295
- var _name = _toArray(name),
296
- firstName = _name[0],
297
- names = _name.slice(1);
298
- var _namePath = [].concat(_toConsumableArray(splitNameStr(String(firstName))), _toConsumableArray(names));
299
- return _namePath.map(function (name, index) {
293
+ var name = item.name;
294
+ var namesStr = name[name.length - 1];
295
+ // name中的最后一位如果包含 '-' 则是names组件
296
+ var isNames = String(namesStr).includes('-');
297
+ if (!isNames) return item; // 不是names组件直接返回
298
+ var namesList = splitNameStr(String(namesStr)); // 拆解出name列表
299
+ var prefix = name.slice(0, name.length - 1);
300
+ return namesList.map(function (nameItem, index) {
300
301
  return _objectSpread(_objectSpread({}, item), {}, {
301
- name: name,
302
+ name: [].concat(_toConsumableArray(prefix), _toConsumableArray(nameItem)),
302
303
  value: value[index]
303
304
  });
304
305
  });
305
306
  });
306
307
  info.changedFields = _changedFields;
307
308
  // @ts-ignore
308
- onFormChange(name, info);
309
+ onFormChange(formName, info);
309
310
  };
310
311
  return _jsx(_Form.Provider, {
311
312
  onFormChange: onFormChange ? handleFormChange : undefined,
@@ -27,7 +27,7 @@ export declare const isTrim: (type: string, trim: boolean, configData: any) => a
27
27
  export declare const isUpperCase: (type: string, upperCase: boolean) => any;
28
28
  export declare const weedOutProps: (data: Record<string, any>, keys: string[]) => {}[];
29
29
  export declare const diffField: (prevValues: any, curValues: any, names: NamePath[]) => boolean;
30
- export declare const splitNameStr: (name: string) => NamePath[];
30
+ export declare const splitNameStr: (name: string) => string[][];
31
31
  export declare const filterInternalFields: (values: any) => any;
32
32
  export declare const getAllNamePath: (object: Record<string, any>, currentPath?: InternalNamePath) => InternalNamePath[];
33
33
  export declare const isNullValue: (value: any) => boolean;
@@ -95,4 +95,6 @@ export declare const findOptionByValue: (treeData: any[], value: string | number
95
95
  export declare const equalDependencies: (dependencies: any, prevValues: any, currentValues: any) => any;
96
96
  /** 解析namePath */
97
97
  export declare const parseNamePath: (input: string) => any;
98
+ /** 解析namePath */
99
+ export declare function findNamesKeyInArray(arr: string[], key: string): string | null;
98
100
  export {};
@@ -434,4 +434,25 @@ export var parseNamePath = function parseNamePath(input) {
434
434
  return isNaN(Number(item)) ? item : Number(item);
435
435
  });
436
436
  return [result];
437
- };
437
+ };
438
+ /** 解析namePath */
439
+ export function findNamesKeyInArray(arr, key) {
440
+ var _iterator2 = _createForOfIteratorHelper(arr),
441
+ _step2;
442
+ try {
443
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
444
+ var item = _step2.value;
445
+ if (!item.includes('_')) {
446
+ return null;
447
+ }
448
+ if (item.split('_')[0].includes(key)) {
449
+ return item;
450
+ }
451
+ }
452
+ } catch (err) {
453
+ _iterator2.e(err);
454
+ } finally {
455
+ _iterator2.f();
456
+ }
457
+ return null;
458
+ }
@@ -6,7 +6,7 @@ import locale, { formatMessage } from '../../locale';
6
6
  var getNonEmptyValuesByIndex = function getNonEmptyValuesByIndex(required, valueArray) {
7
7
  var result = [];
8
8
  required.forEach(function (item, index) {
9
- if (item && !valueArray[index] && !isNumber(valueArray[index])) {
9
+ if (item && !(valueArray === null || valueArray === void 0 ? void 0 : valueArray[index]) && !isNumber(valueArray === null || valueArray === void 0 ? void 0 : valueArray[index])) {
10
10
  result.push(index + 1);
11
11
  }
12
12
  });
@@ -21,11 +21,15 @@ export var useForm = function useForm(originForm) {
21
21
  };
22
22
  var _validateFields = /*#__PURE__*/function () {
23
23
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(nameList) {
24
- var _len,
24
+ var _rest$,
25
+ _len,
25
26
  rest,
26
27
  _key,
27
- values,
28
- _values,
28
+ isRecursive,
29
+ validateNames,
30
+ _form$getInternalHook,
31
+ getFields,
32
+ fieldsList,
29
33
  _error$errorFields,
30
34
  _error$errorFields$,
31
35
  _args = arguments;
@@ -36,20 +40,33 @@ export var useForm = function useForm(originForm) {
36
40
  for (_len = _args.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
37
41
  rest[_key - 1] = _args[_key];
38
42
  }
39
- _context.next = 4;
40
- return validateFields.apply(void 0, [nameList].concat(rest));
41
- case 4:
42
- values = _context.sent;
43
- if (!nameList) {
44
- _context.next = 7;
43
+ // @ts-ignore
44
+ isRecursive = rest === null || rest === void 0 ? void 0 : (_rest$ = rest[0]) === null || _rest$ === void 0 ? void 0 : _rest$.recursive;
45
+ validateNames = []; // 前缀校验模式
46
+ if (!isRecursive) {
47
+ _context.next = 10;
45
48
  break;
46
49
  }
47
- return _context.abrupt("return", values);
48
- case 7:
49
- _values = _getFieldsValue();
50
- return _context.abrupt("return", _values);
51
- case 11:
52
- _context.prev = 11;
50
+ // @ts-ignore
51
+ _form$getInternalHook = form.getInternalHooks('RC_FORM_INTERNAL_HOOKS'), getFields = _form$getInternalHook.getFields;
52
+ fieldsList = getFields();
53
+ fieldsList.forEach(function (item) {
54
+ var _item$name, _item$name2, _item$name2$;
55
+ if (nameList[0] === ((_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name[0]) || ((_item$name2 = item.name) === null || _item$name2 === void 0 ? void 0 : (_item$name2$ = _item$name2[0]) === null || _item$name2$ === void 0 ? void 0 : _item$name2$.startsWith("".concat(nameList[0], "_")))) {
56
+ validateNames.push(item.name);
57
+ }
58
+ });
59
+ // @ts-ignore
60
+ delete rest[0].recursive;
61
+ return _context.abrupt("return", validateFields.apply(void 0, [validateNames].concat(rest)).then(function (values) {
62
+ return filterInternalFields(values);
63
+ }));
64
+ case 10:
65
+ return _context.abrupt("return", validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
66
+ return nameList ? values : _getFieldsValue();
67
+ }));
68
+ case 13:
69
+ _context.prev = 13;
53
70
  _context.t0 = _context["catch"](0);
54
71
  if (_context.t0 && (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.errorFields)) {
55
72
  form === null || form === void 0 ? void 0 : form.scrollToField(_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : (_error$errorFields$ = _error$errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
@@ -58,11 +75,11 @@ export var useForm = function useForm(originForm) {
58
75
  });
59
76
  }
60
77
  throw _context.t0;
61
- case 15:
78
+ case 17:
62
79
  case "end":
63
80
  return _context.stop();
64
81
  }
65
- }, _callee, null, [[0, 11]]);
82
+ }, _callee, null, [[0, 13]]);
66
83
  }));
67
84
  return function _validateFields(_x) {
68
85
  return _ref.apply(this, arguments);
@@ -20,6 +20,11 @@ export interface ProCollapseProps {
20
20
  */
21
21
  title?: string | React.ReactNode;
22
22
  /**
23
+ * @description 自动适应窗口大小
24
+ * @default -
25
+ */
26
+ autoHeight?: Boolean;
27
+ /**
23
28
  * @description 标题前图标
24
29
  * @default -
25
30
  */