@zat-design/sisyphus-react 3.4.3 → 3.4.4

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 (97) hide show
  1. package/dist/index.esm.css +35 -31
  2. package/dist/less.esm.css +20 -4
  3. package/es/ProConfigProvider/index.d.ts +1 -1
  4. package/es/ProConfigProvider/index.js +22 -1
  5. package/es/ProEditLabel/style/index.less +0 -1
  6. package/es/ProEditTable/components/DndWrapper/index.js +1 -1
  7. package/es/ProEditTable/components/RenderField/index.js +20 -14
  8. package/es/ProEditTable/index.js +17 -10
  9. package/es/ProEnum/components/Group.js +2 -19
  10. package/es/ProForm/components/base/DatePicker/index.js +3 -1
  11. package/es/ProForm/components/base/TextArea/index.js +4 -4
  12. package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  13. package/es/ProForm/components/combination/FormList/components/ActionButton.js +12 -10
  14. package/es/ProForm/components/combination/FormList/components/BlockFields.js +6 -1
  15. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -5
  16. package/es/ProForm/components/combination/Group/index.js +3 -2
  17. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -1
  18. package/es/ProForm/components/combination/ProModalSelect/index.js +116 -63
  19. package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +2 -2
  20. package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -1
  21. package/es/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
  22. package/es/ProForm/components/render/ConfirmWrapper.js +8 -2
  23. package/es/ProForm/components/render/Render.js +12 -9
  24. package/es/ProForm/components/render/RenderFields.d.ts +1 -1
  25. package/es/ProForm/components/render/propsType.d.ts +4 -4
  26. package/es/ProForm/index.js +4 -5
  27. package/es/ProForm/propsType.d.ts +2 -2
  28. package/es/ProForm/style/index.less +23 -5
  29. package/es/ProForm/utils/diffOriginal.js +17 -32
  30. package/es/ProForm/utils/index.d.ts +1 -1
  31. package/es/ProForm/utils/index.js +14 -4
  32. package/es/ProForm/utils/rulesCreator.d.ts +7 -1
  33. package/es/ProForm/utils/rulesCreator.js +45 -3
  34. package/es/ProForm/utils/useRules.js +36 -11
  35. package/es/ProForm/utils/useShouldUpdate.js +4 -4
  36. package/es/ProLayout/components/ProCollapse/index.js +23 -1
  37. package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
  38. package/es/ProThemeTools/component/PrdTools/index.js +12 -50
  39. package/es/ProThemeTools/index.js +0 -1
  40. package/es/ProTree/components/ProTreeSelect/style/index.less +1 -1
  41. package/es/ProTree/style/index.less +5 -0
  42. package/es/ProUpload/style/index.less +1 -1
  43. package/es/assets/view.svg +20 -1
  44. package/es/locale/en_US.d.ts +4 -2
  45. package/es/locale/en_US.js +4 -2
  46. package/es/locale/zh_CN.d.ts +4 -2
  47. package/es/locale/zh_CN.js +4 -2
  48. package/es/style/components.less +0 -3
  49. package/es/style/theme/antd.less +14 -28
  50. package/lib/ProConfigProvider/index.d.ts +1 -1
  51. package/lib/ProConfigProvider/index.js +21 -0
  52. package/lib/ProEditLabel/style/index.less +0 -1
  53. package/lib/ProEditTable/components/DndWrapper/index.js +1 -1
  54. package/lib/ProEditTable/components/RenderField/index.js +18 -12
  55. package/lib/ProEditTable/index.js +17 -10
  56. package/lib/ProEnum/components/Group.js +2 -19
  57. package/lib/ProForm/components/base/DatePicker/index.js +3 -1
  58. package/lib/ProForm/components/base/TextArea/index.js +5 -5
  59. package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  60. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +12 -10
  61. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +6 -1
  62. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -5
  63. package/lib/ProForm/components/combination/Group/index.js +3 -2
  64. package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -1
  65. package/lib/ProForm/components/combination/ProModalSelect/index.js +123 -74
  66. package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +2 -2
  67. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -1
  68. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
  69. package/lib/ProForm/components/render/ConfirmWrapper.js +8 -2
  70. package/lib/ProForm/components/render/Render.js +12 -9
  71. package/lib/ProForm/components/render/RenderFields.d.ts +1 -1
  72. package/lib/ProForm/components/render/propsType.d.ts +4 -4
  73. package/lib/ProForm/index.js +4 -5
  74. package/lib/ProForm/propsType.d.ts +2 -2
  75. package/lib/ProForm/style/index.less +23 -5
  76. package/lib/ProForm/utils/diffOriginal.js +16 -31
  77. package/lib/ProForm/utils/index.d.ts +1 -1
  78. package/lib/ProForm/utils/index.js +14 -4
  79. package/lib/ProForm/utils/rulesCreator.d.ts +7 -1
  80. package/lib/ProForm/utils/rulesCreator.js +45 -2
  81. package/lib/ProForm/utils/useRules.js +36 -11
  82. package/lib/ProForm/utils/useShouldUpdate.js +4 -4
  83. package/lib/ProLayout/components/ProCollapse/index.js +23 -1
  84. package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
  85. package/lib/ProThemeTools/component/PrdTools/index.js +12 -50
  86. package/lib/ProThemeTools/index.js +0 -1
  87. package/lib/ProTree/components/ProTreeSelect/style/index.less +1 -1
  88. package/lib/ProTree/style/index.less +5 -0
  89. package/lib/ProUpload/style/index.less +1 -1
  90. package/lib/assets/view.svg +20 -1
  91. package/lib/locale/en_US.d.ts +4 -2
  92. package/lib/locale/en_US.js +4 -2
  93. package/lib/locale/zh_CN.d.ts +4 -2
  94. package/lib/locale/zh_CN.js +4 -2
  95. package/lib/style/components.less +0 -3
  96. package/lib/style/theme/antd.less +14 -28
  97. package/package.json +2 -2
@@ -20,7 +20,7 @@ var actions = {
20
20
  namePath = _ref.namePath;
21
21
  operation.add();
22
22
  },
23
- label: "".concat(locale.ProForm.formList_actions[5]),
23
+ label: "".concat(locale.ProForm.formListActions[5]),
24
24
  type: 'link',
25
25
  icon: _jsx(PlusOutlined, {})
26
26
  }
@@ -59,9 +59,6 @@ var ToolbarButton = function ToolbarButton(props) {
59
59
  operation.add(data);
60
60
  }
61
61
  };
62
- if (disabled || isView) {
63
- return null;
64
- }
65
62
  return _jsx(_Space, {
66
63
  align: "start",
67
64
  className: "pro-form-list-toolbar",
@@ -80,7 +77,7 @@ var ToolbarButton = function ToolbarButton(props) {
80
77
  rest = _objectWithoutProperties(item, _excluded);
81
78
  var _onClick = _onClick2 || onHandle;
82
79
  if (['add'].includes(actionType)) {
83
- if (disabled) return _jsx(_Fragment, {});
80
+ if (disabled || isView) return _jsx(_Fragment, {});
84
81
  var _actions$actionType = actions[actionType],
85
82
  internalOnClick = _actions$actionType.onClick,
86
83
  defaultLabel = _actions$actionType.label,
@@ -86,13 +86,14 @@ var Group = function Group(props) {
86
86
  });
87
87
  }
88
88
  }, [value]);
89
+ var _otherProps = omit(otherProps, ['colProps', 'required']);
89
90
  return _jsx("div", {
90
91
  className: _className,
91
92
  children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
92
93
  children: _jsx(RenderFields, _objectSpread({
93
94
  columns: data.columns,
94
95
  form: form
95
- }, omit(otherProps, ['colProps'])))
96
+ }, _otherProps))
96
97
  }) : _jsx(_Space, _objectSpread(_objectSpread({
97
98
  align: "start"
98
99
  }, omit(space, ['separator', 'compact'])), {}, {
@@ -100,7 +101,7 @@ var Group = function Group(props) {
100
101
  return _jsx(RenderFields, _objectSpread({
101
102
  columns: [column],
102
103
  form: form
103
- }, omit(otherProps, ['colProps'])), (column === null || column === void 0 ? void 0 : column.name) || index);
104
+ }, _otherProps), (column === null || column === void 0 ? void 0 : column.name) || index);
104
105
  })
105
106
  }))
106
107
  });
@@ -47,7 +47,8 @@ export function useRequestList(service, options, useRequestOptions) {
47
47
  onPageChange = _useDefaultOptions.onPageChange,
48
48
  transformParams = _useDefaultOptions.transformParams,
49
49
  transformResponse = _useDefaultOptions.transformResponse;
50
- var defaultParams = useRequestOptions.defaultParams;
50
+ var _ref2 = useRequestOptions || {},
51
+ defaultParams = _ref2.defaultParams;
51
52
  // 搜索表单里的值
52
53
  var _useState3 = useState(),
53
54
  _useState4 = _slicedToArray(_useState3, 2),
@@ -1,7 +1,11 @@
1
1
  import "antd/es/tooltip/style";
2
2
  import _Tooltip from "antd/es/tooltip";
3
+ import "antd/es/button/style";
4
+ import _Button from "antd/es/button";
3
5
  import "antd/es/input/style";
4
6
  import _Input from "antd/es/input";
7
+ import "antd/es/space/style";
8
+ import _Space from "antd/es/space";
5
9
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
10
  import "antd/es/message/style";
7
11
  import _message from "antd/es/message";
@@ -16,12 +20,13 @@ var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames",
16
20
  _excluded2 = ["onOk"],
17
21
  _excluded3 = ["rowKey", "columns", "rowSelection"];
18
22
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
- import { CloseOutlined, SearchOutlined } from '@ant-design/icons';
23
+ import { SearchOutlined } from '@ant-design/icons';
20
24
  import { useMount, useSetState } from 'ahooks';
21
- import { cloneDeep, isArray, isEqual, isFunction, omit } from 'lodash';
25
+ import { useRequest as useUmiRequest } from 'umi';
26
+ import { cloneDeep, debounce, isArray, isEqual, isFunction, omit } from 'lodash';
22
27
  import { ReactSVG } from 'react-svg';
23
28
  import React, { forwardRef, useEffect, useImperativeHandle, useMemo } from 'react';
24
- import { ProForm, ProDrawerForm, ProTable, useProConfig } from '../../../../index';
29
+ import { ProForm, ProDrawerForm, ProTable, useProConfig, ProSelect } from '../../../../index';
25
30
  import Container from '../../Container';
26
31
  import viewSvg from '../../../../assets/view.svg';
27
32
  import useRequestList from './hooks/useRequestList';
@@ -49,7 +54,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
49
54
  isTooltip = props.isTooltip,
50
55
  searchForm = props.searchForm,
51
56
  defaultOne = props.defaultOne,
52
- restInputProps = _objectWithoutProperties(props, _excluded);
57
+ restProps = _objectWithoutProperties(props, _excluded);
53
58
  var contentForm = _Form.useFormInstance();
54
59
  if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
55
60
  throw new Error('error: 请检查枚举选择弹框的配置项【configOption】');
@@ -102,6 +107,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
102
107
  onOff: false,
103
108
  visible: false,
104
109
  open: false,
110
+ options: (tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource) || [],
105
111
  selectedRows: [],
106
112
  selectedRowKeys: []
107
113
  }),
@@ -112,6 +118,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
112
118
  onOff = _useSetState2$.onOff,
113
119
  visible = _useSetState2$.visible,
114
120
  open = _useSetState2$.open,
121
+ options = _useSetState2$.options,
115
122
  _selectedRows = _useSetState2$.selectedRows,
116
123
  _selectedRowKeys = _useSetState2$.selectedRowKeys,
117
124
  setState = _useSetState2[1];
@@ -120,13 +127,23 @@ var ProModalSelect = function ProModalSelect(props, ref) {
120
127
  form = _Form$useForm2[0];
121
128
  var selectedRows = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || _selectedRows;
122
129
  var selectedRowKeys = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || _selectedRowKeys;
130
+ var _useUmiRequest = useUmiRequest(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
131
+ manual: true,
132
+ onSuccess: function onSuccess(data) {
133
+ var list = withPagination ? data === null || data === void 0 ? void 0 : data.list : data;
134
+ setState({
135
+ options: list
136
+ });
137
+ }
138
+ })),
139
+ run = _useUmiRequest.run;
123
140
  var _useRequestList = useRequestList(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
124
141
  withPagination: withPagination,
125
142
  transformParams: transformParams,
126
143
  transformResponse: transformResponse
127
144
  }, _objectSpread({
128
145
  manual: true,
129
- ready: (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || visible || defaultOne
146
+ ready: ((useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || defaultOne) && !readOnly || visible
130
147
  }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options)),
131
148
  data = _useRequestList.data,
132
149
  loading = _useRequestList.loading,
@@ -207,14 +224,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
207
224
  });
208
225
  }
209
226
  };
210
- // 清空表单项
211
- var handleClearValue = function handleClearValue() {
212
- onChange(undefined, {});
213
- setState({
214
- _value: undefined,
215
- selectedRowKeys: [],
216
- selectedRows: []
217
- });
227
+ var handleSelectValue = function handleSelectValue(val, option) {
228
+ onChange(val, option);
218
229
  };
219
230
  var handleClick = /*#__PURE__*/function () {
220
231
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -317,7 +328,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
317
328
  onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ? _data : getNextValues(_data), _data);
318
329
  // 更新内部展示值
319
330
  setState({
320
- _value: _data
331
+ _value: _data,
332
+ options: isArray(_data) ? _data : [_data]
321
333
  });
322
334
  handleClose();
323
335
  }
@@ -586,9 +598,30 @@ var ProModalSelect = function ProModalSelect(props, ref) {
586
598
  }, [onOff, visible, value]);
587
599
  useEffect(function () {
588
600
  if (value && !visible && isInit) {
589
- getInitValues();
601
+ if (readOnly) {
602
+ // 加定时器 修复依赖数据同步更新未取到问题
603
+ setTimeout(function () {
604
+ var _useRequest$options7, _useRequest$options8;
605
+ var initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams;
606
+ if (typeof (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) === 'function') {
607
+ var _contentForm$getField2;
608
+ initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField2 = contentForm.getFieldsValue) === null || _contentForm$getField2 === void 0 ? void 0 : _contentForm$getField2.call(contentForm));
609
+ }
610
+ var params = withPagination ? {
611
+ pageNum: 1,
612
+ pageSize: 50,
613
+ 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)
614
+ } : _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
615
+ run(params);
616
+ setState({
617
+ isInit: false
618
+ });
619
+ }, 300);
620
+ } else {
621
+ getInitValues();
622
+ }
590
623
  }
591
- }, [value, visible, isInit]);
624
+ }, [value, visible, isInit, useRequest]);
592
625
  useEffect(function () {
593
626
  if (!value) {
594
627
  if (defaultOne) {
@@ -601,59 +634,79 @@ var ProModalSelect = function ProModalSelect(props, ref) {
601
634
  });
602
635
  }
603
636
  }
604
- if (labelInValue && _value && !isEqual(value, _value)) {
605
- setState({
606
- _value: value,
607
- selectedRowKeys: [],
608
- selectedRows: []
609
- });
610
- }
611
- if (!labelInValue && (_value === null || _value === void 0 ? void 0 : _value[valueKey]) && !isEqual(value, _value === null || _value === void 0 ? void 0 : _value[valueKey])) {
612
- setState({
613
- _value: value,
614
- selectedRowKeys: [],
615
- selectedRows: []
616
- });
637
+ if (!readOnly) {
638
+ if (labelInValue && _value && !isEqual(value, _value)) {
639
+ setState({
640
+ _value: value,
641
+ selectedRowKeys: [],
642
+ selectedRows: []
643
+ });
644
+ }
645
+ if (!labelInValue && (_value === null || _value === void 0 ? void 0 : _value[valueKey]) && !isEqual(value, _value === null || _value === void 0 ? void 0 : _value[valueKey])) {
646
+ setState({
647
+ _value: value,
648
+ selectedRowKeys: [],
649
+ selectedRows: []
650
+ });
651
+ }
617
652
  }
618
653
  }, [value, _value]);
619
- var defaultAddonAfter = _jsxs("div", {
620
- className: "pro-enum-input-addonAfter",
621
- children: [value && !disabled && _jsx("span", {
622
- className: "close-icon",
623
- children: _jsx(CloseOutlined, {
624
- onClick: handleClearValue
625
- })
626
- }), _jsx(ReactSVG, {
627
- className: "viewSvg",
628
- src: viewSvg,
629
- onClick: handleClick
630
- })]
631
- });
632
- var forceAddonAfterRender = function forceAddonAfterRender() {
633
- if (isView || disabled) {
634
- return;
635
- }
636
- if (addonAfter) {
637
- return _jsx("div", {
638
- onClick: handleClick,
639
- children: addonAfter
640
- });
641
- }
642
- return defaultAddonAfter;
643
- };
644
654
  // 加个中间状态Input
645
- var initRender = _jsxs(_Fragment, {
646
- children: [_jsx(_Input, _objectSpread({
655
+ var initRender = _jsxs(_Space.Compact, {
656
+ style: {
657
+ width: '100%'
658
+ },
659
+ block: true,
660
+ children: [readOnly ? _jsx(ProSelect, _objectSpread({
661
+ value: value,
662
+ onChange: handleSelectValue,
663
+ disabled: disabled,
664
+ fieldNames: fieldNames,
665
+ showCodeName: showCodeName,
666
+ labelInValue: labelInValue,
667
+ dataSource: options,
668
+ scrollFollowParent: false,
669
+ onClick: function onClick() {
670
+ // 没有值的时候,初始化点击默认查询前五十条
671
+ if (!value && isInit || !(options === null || options === void 0 ? void 0 : options.length)) {
672
+ var _useRequest$options9;
673
+ var queryBean = useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams;
674
+ var params = withPagination ? {
675
+ pageNum: 1,
676
+ pageSize: 50,
677
+ queryBean: queryBean
678
+ } : queryBean;
679
+ run(params);
680
+ setState({
681
+ isInit: false
682
+ });
683
+ }
684
+ },
685
+ onSearch: debounce(function (val) {
686
+ var _useRequest$options10;
687
+ 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));
688
+ var params = withPagination ? {
689
+ pageNum: 1,
690
+ pageSize: 50,
691
+ queryBean: queryBean
692
+ } : queryBean;
693
+ run(params);
694
+ }, 800),
695
+ style: {
696
+ width: isView || disabled ? '100%' : 'calc(100% - 30px)'
697
+ }
698
+ }, omit(restProps, ['otherProps']))) : _jsx(_Input, _objectSpread({
647
699
  value: viewText,
648
- readOnly: readOnly,
649
- onClick: readOnly ? handleClick : undefined,
650
700
  onChange: handleChangeValue,
651
701
  disabled: disabled,
652
- addonAfter: forceAddonAfterRender(),
653
- autoComplete: "off"
654
- }, omit(restInputProps, ['otherProps']))), _jsx(_Input, {
655
- type: "hidden",
656
- value: value
702
+ autoComplete: "off",
703
+ allowClear: true
704
+ }, omit(restProps, ['otherProps']))), isView || disabled ? null : _jsx(_Button, {
705
+ icon: _jsx(ReactSVG, {
706
+ className: "viewSvg",
707
+ src: viewSvg,
708
+ onClick: handleClick
709
+ })
657
710
  })]
658
711
  });
659
712
  if (customRender && /*#__PURE__*/React.isValidElement(customRender)) {
@@ -1,4 +1,4 @@
1
- import { FormInstance, InputProps, ModalProps } from 'antd';
1
+ import { FormInstance, InputProps, SelectProps, ModalProps } from 'antd';
2
2
  import { Service, Options } from 'ahooks/lib/useRequest/src/types';
3
3
  import React from 'react';
4
4
  import { ProColumnProps } from '../../render/propsType';
@@ -43,5 +43,5 @@ interface ProModalPropsType {
43
43
  showCodeName?: boolean;
44
44
  searchForm?: FormInstance;
45
45
  }
46
- export declare type ProModalSelectPropsType = InputProps & ProModalPropsType;
46
+ export declare type ProModalSelectPropsType = SelectProps & InputProps & ProModalPropsType;
47
47
  export {};
@@ -88,7 +88,7 @@
88
88
  }
89
89
 
90
90
  .viewSvg {
91
- height: 24px;
91
+ height: 20px;
92
92
  cursor: pointer;
93
93
  fill: #c5c7cd;
94
94
  }
@@ -9,7 +9,7 @@
9
9
  border-right: 0px;
10
10
  border-left: 0px;
11
11
  pointer-events: none;
12
- &.ant-input[disabled] {
12
+ &.@{ant-prefix}-input[disabled] {
13
13
  background: #fff !important;
14
14
  }
15
15
  }
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import "antd/es/modal/style";
3
3
  import _Modal from "antd/es/modal";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["onChange", "children", "confirm"];
5
+ var _excluded = ["onChange", "children", "confirm", "otherProps"];
6
6
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
7
7
  import { isFunction, isObject } from 'lodash';
8
8
  import React from 'react';
@@ -15,6 +15,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
15
15
  var onChange = props.onChange,
16
16
  children = props.children,
17
17
  confirm = props.confirm,
18
+ otherProps = props.otherProps,
18
19
  rest = _objectWithoutProperties(props, _excluded);
19
20
  var _ProForm$useFieldProp = ProForm.useFieldProps(),
20
21
  form = _ProForm$useFieldProp.form;
@@ -23,7 +24,12 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
23
24
  other[_key - 1] = arguments[_key];
24
25
  }
25
26
  var _value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
26
- var confirmProps = isFunction(confirm) ? confirm(form.getFieldsValue()) : confirm;
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;
27
33
  if (confirmProps === true) {
28
34
  _Modal.confirm(_objectSpread(_objectSpread({}, defaultConfirmProps), {}, {
29
35
  onOk: function onOk() {
@@ -154,9 +154,11 @@ var Render = function Render(props) {
154
154
  // ↑↑↑↑↑↑ formItem参数整理 ↑↑↑↑↑↑
155
155
  Object.assign(otherFormItemProps, transforms, {
156
156
  names: otherProps.names
157
- }, internalRule, labelRequired || _required ? {
158
- required: labelRequired || _required
159
- } : null, otherProps.isView && !requiredOnView ? {
157
+ }, internalRule, {
158
+ required: typeof labelRequired === 'boolean' ? labelRequired : _required || (rules === null || rules === void 0 ? void 0 : rules.some(function (item) {
159
+ return item === null || item === void 0 ? void 0 : item.required;
160
+ }))
161
+ }, otherProps.isView && !requiredOnView ? {
160
162
  required: false
161
163
  } : null, _objectSpread({}, isTrim(type, trim, useProConfig())), // 优先取传进来的,其次取ProConfigProvider配置的
162
164
  _objectSpread({}, isUpperCase(type, upperCase)), {
@@ -222,12 +224,8 @@ var Render = function Render(props) {
222
224
  if (valueType) {
223
225
  _args[2].transformValue = form.getFieldValue(_otherFormItemProps === null || _otherFormItemProps === void 0 ? void 0 : _otherFormItemProps.name) || undefined;
224
226
  }
227
+ _args[2].option = args[1];
225
228
  switch (type) {
226
- case 'ProSelect':
227
- case 'ProModalSelect':
228
- case 'ProEnum':
229
- _args[2].option = args[1];
230
- break;
231
229
  case 'ProAddressBar':
232
230
  _args[2].selectedOptions = args[1];
233
231
  break;
@@ -244,7 +242,7 @@ var Render = function Render(props) {
244
242
  * onChange参数重置 (value, record, { form, index, namePath, option }) => void
245
243
  */
246
244
  var handleChange = function handleChange() {
247
- var _lastComponentProps$c2;
245
+ var _otherFormItemProps$n3, _lastComponentProps$c2;
248
246
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
249
247
  args[_key] = arguments[_key];
250
248
  }
@@ -262,6 +260,11 @@ var Render = function Render(props) {
262
260
  ((_AutoComponent$props$ = (_AutoComponent$props = AutoComponent === null || AutoComponent === void 0 ? void 0 : AutoComponent.props)[changeKey]) === null || _AutoComponent$props$ === void 0 ? void 0 : _AutoComponent$props$.call.apply(_AutoComponent$props$, [_AutoComponent$props].concat(_toConsumableArray(_args)))) || ((_lastComponentProps$c = lastComponentProps[changeKey]) === null || _lastComponentProps$c === void 0 ? void 0 : _lastComponentProps$c.call.apply(_lastComponentProps$c, [lastComponentProps].concat(_toConsumableArray(_args))));
263
261
  return false;
264
262
  }
263
+ var inList = _otherFormItemProps === null || _otherFormItemProps === void 0 ? void 0 : (_otherFormItemProps$n3 = _otherFormItemProps.namePath) === null || _otherFormItemProps$n3 === void 0 ? void 0 : _otherFormItemProps$n3.length;
264
+ // FormList 和 Group场景 对比值改变的话, 回显到表单上
265
+ if (inList) {
266
+ form.setFieldsValue(_args[1]);
267
+ }
265
268
  // Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
266
269
  if (formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames) {
267
270
  setTimeout(function () {
@@ -16,7 +16,7 @@ interface Props<T = any> {
16
16
  originalValues?: ProFormProps<T>['originalValues'];
17
17
  clearNotShow?: boolean;
18
18
  requiredOnView?: boolean;
19
- required?: boolean | (() => boolean);
19
+ required?: boolean | boolean[] | (() => boolean | boolean[]);
20
20
  originalDiffTip?: boolean;
21
21
  globalControl?: boolean;
22
22
  }
@@ -52,12 +52,12 @@ interface ControlProps {
52
52
  /**
53
53
  * 扩展函数的参数
54
54
  */
55
- type FunctionArgs<Values> = (value: any, record: any, { form, index, namePath, option, selectedOptions, dateString, }: {
55
+ type FunctionArgs<Values, R = any> = (value: any, record: any, { form, index, namePath, option, selectedOptions, dateString, }: {
56
56
  form: FormInstance<Values>;
57
57
  index?: number;
58
58
  namePath?: NamePath;
59
59
  [key: string]: any;
60
- }) => any;
60
+ }) => R;
61
61
  type TransformToFormField<T extends ControlProps, Values> = DistributiveOmit<T, 'onChange' | 'value'> & {
62
62
  value?: T['value'];
63
63
  onChange?: (value: Parameters<T['onChange']>[0], options: Parameters<T['onChange']>[1], form: FormInstance<Values>) => void;
@@ -206,7 +206,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
206
206
  hiddenNames?: string[] | any[];
207
207
  rules?: ProRule[] | ReactiveFunction<Values, ProRule[]>;
208
208
  equalWith?: (originValue: any, currentValue: any) => boolean;
209
- required?: boolean | ReactiveFunction<Values, boolean>;
209
+ required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
210
210
  labelRequired?: boolean;
211
211
  toISOString?: boolean;
212
212
  clearNotShow?: boolean;
@@ -220,7 +220,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
220
220
  extra?: string | React.ReactNode;
221
221
  /** 是否固定字段, 不隐藏 */
222
222
  fixed?: boolean;
223
- confirm?: boolean | ModalFuncProps | ((values: Values) => boolean | ModalFuncProps);
223
+ confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps>;
224
224
  }
225
225
  export type ProColumnProps<T = any> = ProFormColumnProps<T> & ColumnPropsMap<T, 'ProForm'>;
226
226
  /**
@@ -26,7 +26,7 @@ import { useForm } from './utils/useForm';
26
26
  import { useFieldProps } from './utils/useFieldProps';
27
27
  import locale from '../locale';
28
28
  var ProForm = function ProForm(props, ref) {
29
- var _forms$formKey, _localStorage;
29
+ var _forms$formKey, _localStorage, _ref;
30
30
  var _props$mode = props.mode,
31
31
  mode = _props$mode === void 0 ? 'search' : _props$mode,
32
32
  span = props.span,
@@ -49,8 +49,7 @@ var ProForm = function ProForm(props, ref) {
49
49
  expandOpenChange = props.expandOpenChange,
50
50
  _props$viewEmpty = props.viewEmpty,
51
51
  viewEmpty = _props$viewEmpty === void 0 ? '-' : _props$viewEmpty,
52
- _props$labelAlign = props.labelAlign,
53
- labelAlign = _props$labelAlign === void 0 ? 'left' : _props$labelAlign,
52
+ labelAlign = props.labelAlign,
54
53
  labelWidth = props.labelWidth,
55
54
  onValuesChange = props.onValuesChange,
56
55
  onFinish = props.onFinish,
@@ -231,9 +230,9 @@ var ProForm = function ProForm(props, ref) {
231
230
  }
232
231
  },
233
232
  className: cls,
234
- form: form,
235
- labelAlign: labelAlign
233
+ form: form
236
234
  }, formProps), config), otherProps), {}, {
235
+ labelAlign: (_ref = labelAlign !== null && labelAlign !== void 0 ? labelAlign : config.labelAlign) !== null && _ref !== void 0 ? _ref : 'left',
237
236
  onValuesChange: handleValuesChange,
238
237
  onFinish: handleFinish,
239
238
  initialValues: _initialValues,
@@ -38,7 +38,7 @@ export interface ProFormOtherProps {
38
38
  colProps: ColProps;
39
39
  disabled: boolean;
40
40
  show?: boolean | (() => boolean);
41
- required?: boolean | (() => boolean);
41
+ required?: boolean | boolean[] | (() => boolean | boolean[]);
42
42
  mode?: string;
43
43
  namePath?: any[] | string | number;
44
44
  }
@@ -70,7 +70,7 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
70
70
  clearNotShow?: boolean;
71
71
  requiredOnView?: boolean;
72
72
  formId?: string;
73
- required?: boolean;
73
+ required?: boolean | boolean[];
74
74
  originalDiffTip?: boolean;
75
75
  }
76
76
  export interface Transform<T = any> {
@@ -132,7 +132,8 @@
132
132
  }
133
133
  }
134
134
 
135
- .ant-form-item-control:has(.ant-switch-handle, .ant-checkbox-wrapper-in-form-item) {
135
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
136
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
136
137
  background: @zaui-contract-bg;
137
138
  border-radius: 4px;
138
139
  }
@@ -140,13 +141,13 @@
140
141
  // 地址组件
141
142
  .@{ant-prefix}-form-item-control-input-content {
142
143
  & > .pro-address {
143
- .ant-select-selector,
144
- .ant-input-affix-wrapper,
145
- .ant-input-disabled {
144
+ .@{ant-prefix}-select-selector,
145
+ .@{ant-prefix}-input-affix-wrapper,
146
+ .@{ant-prefix}-input-disabled {
146
147
  background: @zaui-contract-bg;
147
148
  }
148
149
  }
149
- & > .ant-input-group {
150
+ & > .@{ant-prefix}-input-group {
150
151
  .forever-checkbox {
151
152
  background: @zaui-contract-bg;
152
153
  }
@@ -346,4 +347,21 @@
346
347
  .delete-icon {
347
348
  width: 18px;
348
349
  }
350
+ .pro-form-list-tool-btn {
351
+ margin-left: 8px;
352
+ padding: 0;
353
+ cursor: pointer;
354
+ .anticon {
355
+ color: var(--zaui-text-weak, #a0a0a0);
356
+ font-size: 16px;
357
+ vertical-align: middle;
358
+ }
359
+ }
360
+ .pro-form-list-mode-block{
361
+ .pro-collapse-content{
362
+ .@{ant-prefix}-row{
363
+ width: auto;
364
+ }
365
+ }
366
+ }
349
367
  }
@@ -1,46 +1,31 @@
1
- import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
- import { isEqual, isFunction } from 'lodash';
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import { isEqual, isFunction, isString } from 'lodash';
3
3
  var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
4
- var extractValue = function extractValue(obj, path) {
5
- var value = obj || {};
6
- if (!Object.keys(obj)) {
7
- return [];
8
- }
9
- var _iterator = _createForOfIteratorHelper(path),
10
- _step;
11
- try {
12
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
13
- var key = _step.value;
14
- if (value && value.hasOwnProperty(key)) {
15
- value = value[key];
16
- } else {
17
- return undefined;
18
- }
19
- }
20
- } catch (err) {
21
- _iterator.e(err);
22
- } finally {
23
- _iterator.f();
24
- }
25
- return Object.values(value);
26
- };
27
4
  /** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
28
- var extractValues = function extractValues(data, pathString) {
29
- if (pathString.includes('_')) {
30
- var namePrefixes = pathString.split('-')[0].split('_').slice(0, -1);
31
- return extractValue(data, namePrefixes);
5
+ var extractValues = function extractValues(form, pathString) {
6
+ var _pathString;
7
+ var result = [];
8
+ var PrefixesName = isString(pathString) ? [] : pathString.slice(0, -1);
9
+ if (isString(pathString)) {
10
+ pathString.split('-').forEach(function (item) {
11
+ result.push(form.getFieldValue([].concat(_toConsumableArray(PrefixesName), [item])));
12
+ });
13
+ return result;
32
14
  }
33
- return pathString.split('-').map(function (item) {
34
- return data[item];
15
+ (_pathString = pathString[pathString.length - 1]) === null || _pathString === void 0 ? void 0 : _pathString.split('-').forEach(function (item) {
16
+ result.push(form.getFieldValue([].concat(_toConsumableArray(PrefixesName), [item])));
35
17
  });
18
+ return result;
36
19
  };
37
20
  export var diffOriginal = function diffOriginal(params) {
21
+ var _name$join;
38
22
  var originalValue = params.originalValue,
39
23
  _value = params.value,
40
24
  equalWith = params.equalWith,
41
25
  form = params.form,
42
26
  name = params.name;
43
- var value = !(name === null || name === void 0 ? void 0 : name.includes('-')) ? _value : extractValues(form.getFieldsValue(), name);
27
+ var isNames = Array.isArray(name) && ((_name$join = name.join(',')) === null || _name$join === void 0 ? void 0 : _name$join.includes('-')) || (name === null || name === void 0 ? void 0 : name.includes('-'));
28
+ var value = !isNames ? _value : extractValues(form, name);
44
29
  // 支持传入自定义比较事件
45
30
  if (isFunction(equalWith)) {
46
31
  return !equalWith(originalValue, value);
@@ -36,7 +36,7 @@ export declare const isNullValue: (value: any) => boolean;
36
36
  * @param arr 值
37
37
  * @returns boole
38
38
  */
39
- export declare const isNotFullArray: (arr: any, length: any) => boolean;
39
+ export declare const isNotFullArray: (arr: any, length: any, required: any) => boolean;
40
40
  /**
41
41
  * 判断数组中值是否都为空 全部为空则为true
42
42
  * @param arr 值