@zat-design/sisyphus-react 3.4.3-beta.9 → 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 (47) hide show
  1. package/dist/index.esm.css +14 -1
  2. package/dist/less.esm.css +14 -1
  3. package/es/ProEditTable/components/RenderField/index.js +2 -1
  4. package/es/ProEditTable/index.js +1 -0
  5. package/es/ProForm/components/base/TextArea/index.js +4 -4
  6. package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  7. package/es/ProForm/components/combination/FormList/components/ActionButton.js +12 -10
  8. package/es/ProForm/components/combination/FormList/components/BlockFields.js +6 -1
  9. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -5
  10. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -1
  11. package/es/ProForm/components/combination/ProModalSelect/index.js +116 -63
  12. package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +2 -2
  13. package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -1
  14. package/es/ProForm/components/render/ConfirmWrapper.js +8 -2
  15. package/es/ProForm/components/render/Render.js +3 -1
  16. package/es/ProForm/components/render/propsType.d.ts +3 -3
  17. package/es/ProForm/style/index.less +17 -0
  18. package/es/ProForm/utils/index.js +5 -1
  19. package/es/assets/view.svg +20 -1
  20. package/es/locale/en_US.d.ts +2 -2
  21. package/es/locale/en_US.js +2 -2
  22. package/es/locale/zh_CN.d.ts +2 -2
  23. package/es/locale/zh_CN.js +2 -2
  24. package/es/style/components.less +0 -3
  25. package/lib/ProEditTable/components/RenderField/index.js +2 -1
  26. package/lib/ProEditTable/index.js +1 -0
  27. package/lib/ProForm/components/base/TextArea/index.js +5 -5
  28. package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  29. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +12 -10
  30. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +6 -1
  31. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -5
  32. package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -1
  33. package/lib/ProForm/components/combination/ProModalSelect/index.js +123 -74
  34. package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +2 -2
  35. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -1
  36. package/lib/ProForm/components/render/ConfirmWrapper.js +8 -2
  37. package/lib/ProForm/components/render/Render.js +3 -1
  38. package/lib/ProForm/components/render/propsType.d.ts +3 -3
  39. package/lib/ProForm/style/index.less +17 -0
  40. package/lib/ProForm/utils/index.js +5 -1
  41. package/lib/assets/view.svg +20 -1
  42. package/lib/locale/en_US.d.ts +2 -2
  43. package/lib/locale/en_US.js +2 -2
  44. package/lib/locale/zh_CN.d.ts +2 -2
  45. package/lib/locale/zh_CN.js +2 -2
  46. package/lib/style/components.less +0 -3
  47. package/package.json +1 -1
@@ -2322,7 +2322,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2322
2322
  }
2323
2323
  .pro-modal-select .viewSvg,
2324
2324
  .pro-tree-modal .viewSvg {
2325
- height: 24px;
2325
+ height: 20px;
2326
2326
  cursor: pointer;
2327
2327
  fill: #c5c7cd;
2328
2328
  }
@@ -2851,6 +2851,19 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2851
2851
  .pro-form .delete-icon {
2852
2852
  width: 18px;
2853
2853
  }
2854
+ .pro-form .pro-form-list-tool-btn {
2855
+ margin-left: 8px;
2856
+ padding: 0;
2857
+ cursor: pointer;
2858
+ }
2859
+ .pro-form .pro-form-list-tool-btn .anticon {
2860
+ color: var(--zaui-text-weak, #a0a0a0);
2861
+ font-size: 16px;
2862
+ vertical-align: middle;
2863
+ }
2864
+ .pro-form .pro-form-list-mode-block .pro-collapse-content .ant-row {
2865
+ width: auto;
2866
+ }
2854
2867
  .pro-upload .pro-upload-dragger .pro-upload-handle-box {
2855
2868
  background: #F8F9FA;
2856
2869
  border-radius: var(--zaui-border-radius, 8px);
package/dist/less.esm.css CHANGED
@@ -2322,7 +2322,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2322
2322
  }
2323
2323
  .pro-modal-select .viewSvg,
2324
2324
  .pro-tree-modal .viewSvg {
2325
- height: 24px;
2325
+ height: 20px;
2326
2326
  cursor: pointer;
2327
2327
  fill: #c5c7cd;
2328
2328
  }
@@ -2851,6 +2851,19 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2851
2851
  .pro-form .delete-icon {
2852
2852
  width: 18px;
2853
2853
  }
2854
+ .pro-form .pro-form-list-tool-btn {
2855
+ margin-left: 8px;
2856
+ padding: 0;
2857
+ cursor: pointer;
2858
+ }
2859
+ .pro-form .pro-form-list-tool-btn .anticon {
2860
+ color: var(--zaui-text-weak, #a0a0a0);
2861
+ font-size: 16px;
2862
+ vertical-align: middle;
2863
+ }
2864
+ .pro-form .pro-form-list-mode-block .pro-collapse-content .ant-row {
2865
+ width: auto;
2866
+ }
2854
2867
  .pro-upload .pro-upload-dragger .pro-upload-handle-box {
2855
2868
  background: #F8F9FA;
2856
2869
  border-radius: var(--zaui-border-radius, 8px);
@@ -72,6 +72,7 @@ var RenderField = function RenderField(_ref) {
72
72
  virtualKey = config.virtualKey,
73
73
  viewEmpty = config.viewEmpty,
74
74
  originalValues = config.originalValues,
75
+ formNamePath = config.namePath,
75
76
  _config$originalDiffT = config.originalDiffTip,
76
77
  originalDiffTip = _config$originalDiffT === void 0 ? true : _config$originalDiffT;
77
78
  var _fieldProps = fieldProps || formItemProps || {};
@@ -520,7 +521,7 @@ var RenderField = function RenderField(_ref) {
520
521
  validateFirst: true
521
522
  }, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
522
523
  className: _className,
523
- name: cellName,
524
+ name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
524
525
  children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
525
526
  })) : _jsx(Container, {
526
527
  viewEmpty: viewEmpty
@@ -152,6 +152,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
152
152
  virtualKey: virtualKey,
153
153
  requiredAlign: requiredAlign,
154
154
  name: isArray(name) ? name : [name],
155
+ namePath: namePath,
155
156
  tableRef: tableRef,
156
157
  max: max,
157
158
  tableLength: value === null || value === void 0 ? void 0 : value.length,
@@ -1,4 +1,5 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
4
  import "antd/es/input/style";
4
5
  import _Input from "antd/es/input";
@@ -31,11 +32,10 @@ var TextAreaDef = function TextAreaDef(props) {
31
32
  children: rest.value
32
33
  });
33
34
  }
34
- var _className = classnames({
35
+ var _className = classnames(_defineProperty({
35
36
  'pro-textarea': true,
36
- 'pro-textarea-view': isView,
37
- className: className
38
- });
37
+ 'pro-textarea-view': isView
38
+ }, className, true));
39
39
  return _jsx(TextArea, _objectSpread(_objectSpread(_objectSpread({
40
40
  showCount: true,
41
41
  autoComplete: "off",
@@ -17,6 +17,7 @@ export interface Props {
17
17
  fields: FormListFieldData[];
18
18
  mode: FormListMode;
19
19
  disabled?: boolean;
20
+ isView?: boolean;
20
21
  }
21
22
  declare const ActionButton: React.FC<Props>;
22
23
  export default ActionButton;
@@ -27,7 +27,7 @@ var getDefaultActions = function getDefaultActions(mode) {
27
27
  add(undefined, index + 1);
28
28
  },
29
29
  type: 'text',
30
- label: "".concat(locale.ProForm.formList_actions[0]),
30
+ label: "".concat(locale.ProForm.formListActions[0]),
31
31
  icon: _jsx(PlusSquareOutlined, {})
32
32
  },
33
33
  delete: {
@@ -39,7 +39,7 @@ var getDefaultActions = function getDefaultActions(mode) {
39
39
  remove(index);
40
40
  },
41
41
  type: 'text',
42
- label: "".concat(locale.ProForm.formList_actions[1]),
42
+ label: "".concat(locale.ProForm.formListActions[1]),
43
43
  icon: mode === 'less' ? _jsx(ProIcon, {
44
44
  type: "solid-close",
45
45
  className: "single-delete"
@@ -56,7 +56,7 @@ var getDefaultActions = function getDefaultActions(mode) {
56
56
  add(record, index + 1);
57
57
  },
58
58
  type: 'text',
59
- label: "".concat(locale.ProForm.formList_actions[2]),
59
+ label: "".concat(locale.ProForm.formListActions[2]),
60
60
  icon: _jsx(CopyOutlined, {})
61
61
  },
62
62
  moveUp: {
@@ -68,7 +68,7 @@ var getDefaultActions = function getDefaultActions(mode) {
68
68
  move(index, index - 1);
69
69
  },
70
70
  type: 'text',
71
- label: "".concat(locale.ProForm.formList_actions[3]),
71
+ label: "".concat(locale.ProForm.formListActions[3]),
72
72
  icon: _jsx(UpSquareOutlined, {})
73
73
  },
74
74
  moveDown: {
@@ -80,13 +80,14 @@ var getDefaultActions = function getDefaultActions(mode) {
80
80
  move(index, index + 1);
81
81
  },
82
82
  type: 'text',
83
- label: "".concat(locale.ProForm.formList_actions[4]),
83
+ label: "".concat(locale.ProForm.formListActions[4]),
84
84
  icon: _jsx(DownSquareOutlined, {})
85
85
  }
86
86
  };
87
87
  if (mode === 'block') {
88
88
  Object.keys(originActions).forEach(function (key) {
89
- originActions[key].type = 'default';
89
+ originActions[key].type = 'text';
90
+ originActions[key].className = 'pro-form-list-tool-btn';
90
91
  });
91
92
  }
92
93
  if (mode === 'line') {
@@ -115,7 +116,8 @@ var ActionButton = function ActionButton(props) {
115
116
  fields = props.fields,
116
117
  min = props.min,
117
118
  max = props.max,
118
- mode = props.mode;
119
+ mode = props.mode,
120
+ isView = props.isView;
119
121
  // 默认显示一个delete
120
122
  var actionProps = useMemo(function () {
121
123
  var _props$actionProps;
@@ -166,7 +168,7 @@ var ActionButton = function ActionButton(props) {
166
168
  var _onClick = onClick || onHandle;
167
169
  if (['add', 'delete', 'copy', 'moveUp', 'moveDown'].includes(actionType)) {
168
170
  // 禁用状态默认隐藏内置操作按钮
169
- if (disabled) return _jsx(_Fragment, {});
171
+ if (disabled || isView) return _jsx(_Fragment, {});
170
172
  var _defaultActions$actio = defaultActions[actionType],
171
173
  internalOnClick = _defaultActions$actio.onClick,
172
174
  defaultLabel = _defaultActions$actio.label,
@@ -188,7 +190,7 @@ var ActionButton = function ActionButton(props) {
188
190
  return false;
189
191
  }
190
192
  return _needConfirm ? _jsx(_Popconfirm, _objectSpread(_objectSpread({
191
- title: title !== null && title !== void 0 ? title : "".concat(locale.ProForm.formList_confirmMessage),
193
+ title: title !== null && title !== void 0 ? title : "".concat(locale.ProForm.formListConfirmMessage),
192
194
  onCancel: function onCancel(e) {
193
195
  return e.stopPropagation();
194
196
  },
@@ -211,7 +213,7 @@ var ActionButton = function ActionButton(props) {
211
213
  }), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
212
214
  }
213
215
  return needConfirm ? _jsx(_Popconfirm, _objectSpread(_objectSpread({
214
- title: title !== null && title !== void 0 ? title : "".concat(locale.ProForm.formList_confirmMessage),
216
+ title: title !== null && title !== void 0 ? title : "".concat(locale.ProForm.formListConfirmMessage),
215
217
  onCancel: function onCancel(e) {
216
218
  return e.stopPropagation();
217
219
  },
@@ -2,9 +2,11 @@ import "antd/es/row/style";
2
2
  import _Row from "antd/es/row";
3
3
  import "antd/es/space/style";
4
4
  import _Space from "antd/es/space";
5
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
6
7
  import { useMemo } from 'react';
7
8
  import { isFunction } from 'lodash';
9
+ import classNames from 'classnames';
8
10
  import ActionButton from './ActionButton';
9
11
  import RenderFields from '../../../render/RenderFields';
10
12
  import ProCollapse from '../../../../../ProLayout/components/ProCollapse';
@@ -34,8 +36,10 @@ var BlockFields = function BlockFields(props) {
34
36
  }
35
37
  return title;
36
38
  }, [title, index]);
39
+ var cls = classNames(_defineProperty({}, "pro-form-list-mode-".concat(mode), mode === 'block' || mode === 'line' || mode === 'less'));
37
40
  return _jsx(_Space, {
38
41
  direction: "vertical",
42
+ className: cls,
39
43
  children: _jsx(ProCollapse, {
40
44
  title: _title,
41
45
  index: index,
@@ -55,7 +59,8 @@ var BlockFields = function BlockFields(props) {
55
59
  fields: fields,
56
60
  actionProps: actionProps,
57
61
  mode: mode,
58
- disabled: disabled
62
+ disabled: disabled,
63
+ isView: isView
59
64
  }),
60
65
  children: _jsx(_Row, {
61
66
  gutter: 24,
@@ -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,
@@ -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
  }
@@ -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() {
@@ -155,7 +155,9 @@ var Render = function Render(props) {
155
155
  Object.assign(otherFormItemProps, transforms, {
156
156
  names: otherProps.names
157
157
  }, internalRule, {
158
- required: typeof labelRequired === 'boolean' ? labelRequired : _required
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
+ }))
159
161
  }, otherProps.isView && !requiredOnView ? {
160
162
  required: false
161
163
  } : null, _objectSpread({}, isTrim(type, trim, useProConfig())), // 优先取传进来的,其次取ProConfigProvider配置的
@@ -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;
@@ -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
  /**
@@ -347,4 +347,21 @@
347
347
  .delete-icon {
348
348
  width: 18px;
349
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
+ }
350
367
  }