@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
@@ -9,12 +9,13 @@ exports.default = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
11
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
+ var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
13
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
16
  var _icons = require("@ant-design/icons");
17
17
  var _ahooks = require("ahooks");
18
+ var _umi = require("umi");
18
19
  var _antd = require("antd");
19
20
  var _lodash = require("lodash");
20
21
  var _reactSvg = require("react-svg");
@@ -50,7 +51,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
50
51
  isTooltip = props.isTooltip,
51
52
  searchForm = props.searchForm,
52
53
  defaultOne = props.defaultOne,
53
- restInputProps = (0, _objectWithoutProperties2.default)(props, _excluded);
54
+ restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
54
55
  var contentForm = _antd.Form.useFormInstance();
55
56
  if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
56
57
  throw new Error('error: 请检查枚举选择弹框的配置项【configOption】');
@@ -103,6 +104,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
103
104
  onOff: false,
104
105
  visible: false,
105
106
  open: false,
107
+ options: (tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource) || [],
106
108
  selectedRows: [],
107
109
  selectedRowKeys: []
108
110
  }),
@@ -113,6 +115,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
113
115
  onOff = _useSetState2$.onOff,
114
116
  visible = _useSetState2$.visible,
115
117
  open = _useSetState2$.open,
118
+ options = _useSetState2$.options,
116
119
  _selectedRows = _useSetState2$.selectedRows,
117
120
  _selectedRowKeys = _useSetState2$.selectedRowKeys,
118
121
  setState = _useSetState2[1];
@@ -121,13 +124,23 @@ var ProModalSelect = function ProModalSelect(props, ref) {
121
124
  form = _Form$useForm2[0];
122
125
  var selectedRows = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || _selectedRows;
123
126
  var selectedRowKeys = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || _selectedRowKeys;
127
+ var _useUmiRequest = (0, _umi.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
128
+ manual: true,
129
+ onSuccess: function onSuccess(data) {
130
+ var list = withPagination ? data === null || data === void 0 ? void 0 : data.list : data;
131
+ setState({
132
+ options: list
133
+ });
134
+ }
135
+ })),
136
+ run = _useUmiRequest.run;
124
137
  var _useRequestList = (0, _useRequestList2.default)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
125
138
  withPagination: withPagination,
126
139
  transformParams: transformParams,
127
140
  transformResponse: transformResponse
128
- }, (0, _objectSpread2.default)({
141
+ }, (0, _objectSpread3.default)({
129
142
  manual: true,
130
- ready: (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || visible || defaultOne
143
+ ready: ((useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || defaultOne) && !readOnly || visible
131
144
  }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options)),
132
145
  data = _useRequestList.data,
133
146
  loading = _useRequestList.loading,
@@ -159,13 +172,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
159
172
  return data;
160
173
  }
161
174
  if (Object.prototype.toString.call(data) === '[object Object]') {
162
- return handleFormat((0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
175
+ return handleFormat((0, _objectSpread3.default)((0, _objectSpread3.default)({}, data), {}, {
163
176
  value: data[valueKey],
164
177
  label: data[labelKey]
165
178
  }));
166
179
  }
167
180
  return (0, _lodash.isArray)(data) ? data === null || data === void 0 ? void 0 : (_data$map = data.map(function (item) {
168
- return handleFormat((0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
181
+ return handleFormat((0, _objectSpread3.default)((0, _objectSpread3.default)({}, item), {}, {
169
182
  value: item[valueKey],
170
183
  label: item[labelKey]
171
184
  }));
@@ -208,14 +221,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
208
221
  });
209
222
  }
210
223
  };
211
- // 清空表单项
212
- var handleClearValue = function handleClearValue() {
213
- onChange(undefined, {});
214
- setState({
215
- _value: undefined,
216
- selectedRowKeys: [],
217
- selectedRows: []
218
- });
224
+ var handleSelectValue = function handleSelectValue(val, option) {
225
+ onChange(val, option);
219
226
  };
220
227
  var handleClick = /*#__PURE__*/function () {
221
228
  var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
@@ -318,7 +325,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
318
325
  onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ? _data : getNextValues(_data), _data);
319
326
  // 更新内部展示值
320
327
  setState({
321
- _value: _data
328
+ _value: _data,
329
+ options: (0, _lodash.isArray)(_data) ? _data : [_data]
322
330
  });
323
331
  handleClose();
324
332
  }
@@ -347,7 +355,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
347
355
  return form.validateFields();
348
356
  case 2:
349
357
  values = _context3.sent;
350
- onSearch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, values), {}, {
358
+ onSearch((0, _objectSpread3.default)((0, _objectSpread3.default)({}, values), {}, {
351
359
  d: Date.now()
352
360
  }));
353
361
  case 4:
@@ -360,7 +368,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
360
368
  return _ref8.apply(this, arguments);
361
369
  };
362
370
  }();
363
- var _rowSelection = (0, _objectSpread2.default)({
371
+ var _rowSelection = (0, _objectSpread3.default)({
364
372
  type: type,
365
373
  onChange: function onChange(rowKeys, rows) {
366
374
  setState({
@@ -423,12 +431,12 @@ var ProModalSelect = function ProModalSelect(props, ref) {
423
431
  _context4.next = 10;
424
432
  break;
425
433
  }
426
- queryBean = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.defaultParams), (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || {});
427
- page = (0, _objectSpread2.default)({
434
+ queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.defaultParams), (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || {});
435
+ page = (0, _objectSpread3.default)({
428
436
  pageNum: 1,
429
437
  pageSize: 10
430
438
  }, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options3 = useRequest.options) === null || _useRequest$options3 === void 0 ? void 0 : _useRequest$options3.page);
431
- params = withPagination ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, page), {}, {
439
+ params = withPagination ? (0, _objectSpread3.default)((0, _objectSpread3.default)({}, page), {}, {
432
440
  queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
433
441
  }) : queryBean;
434
442
  params = transformParams ? transformParams(params) : params;
@@ -482,12 +490,12 @@ var ProModalSelect = function ProModalSelect(props, ref) {
482
490
  return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {
483
491
  while (1) switch (_context5.prev = _context5.next) {
484
492
  case 0:
485
- queryBean = (0, _objectSpread2.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.defaultParams);
486
- page = (0, _objectSpread2.default)({
493
+ queryBean = (0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.defaultParams);
494
+ page = (0, _objectSpread3.default)({
487
495
  pageNum: 1,
488
496
  pageSize: 10
489
497
  }, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options5 = useRequest.options) === null || _useRequest$options5 === void 0 ? void 0 : _useRequest$options5.page);
490
- params = withPagination ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, page), {}, {
498
+ params = withPagination ? (0, _objectSpread3.default)((0, _objectSpread3.default)({}, page), {}, {
491
499
  queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
492
500
  }) : queryBean;
493
501
  params = transformParams ? transformParams(params) : params;
@@ -587,9 +595,30 @@ var ProModalSelect = function ProModalSelect(props, ref) {
587
595
  }, [onOff, visible, value]);
588
596
  (0, _react.useEffect)(function () {
589
597
  if (value && !visible && isInit) {
590
- getInitValues();
598
+ if (readOnly) {
599
+ // 加定时器 修复依赖数据同步更新未取到问题
600
+ setTimeout(function () {
601
+ var _useRequest$options7, _useRequest$options8;
602
+ var initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams;
603
+ if (typeof (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) === 'function') {
604
+ var _contentForm$getField2;
605
+ 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));
606
+ }
607
+ var params = withPagination ? {
608
+ pageNum: 1,
609
+ pageSize: 50,
610
+ queryBean: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.defaultParams), initParams)
611
+ } : (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
612
+ run(params);
613
+ setState({
614
+ isInit: false
615
+ });
616
+ }, 300);
617
+ } else {
618
+ getInitValues();
619
+ }
591
620
  }
592
- }, [value, visible, isInit]);
621
+ }, [value, visible, isInit, useRequest]);
593
622
  (0, _react.useEffect)(function () {
594
623
  if (!value) {
595
624
  if (defaultOne) {
@@ -602,59 +631,79 @@ var ProModalSelect = function ProModalSelect(props, ref) {
602
631
  });
603
632
  }
604
633
  }
605
- if (labelInValue && _value && !(0, _lodash.isEqual)(value, _value)) {
606
- setState({
607
- _value: value,
608
- selectedRowKeys: [],
609
- selectedRows: []
610
- });
611
- }
612
- if (!labelInValue && (_value === null || _value === void 0 ? void 0 : _value[valueKey]) && !(0, _lodash.isEqual)(value, _value === null || _value === void 0 ? void 0 : _value[valueKey])) {
613
- setState({
614
- _value: value,
615
- selectedRowKeys: [],
616
- selectedRows: []
617
- });
634
+ if (!readOnly) {
635
+ if (labelInValue && _value && !(0, _lodash.isEqual)(value, _value)) {
636
+ setState({
637
+ _value: value,
638
+ selectedRowKeys: [],
639
+ selectedRows: []
640
+ });
641
+ }
642
+ if (!labelInValue && (_value === null || _value === void 0 ? void 0 : _value[valueKey]) && !(0, _lodash.isEqual)(value, _value === null || _value === void 0 ? void 0 : _value[valueKey])) {
643
+ setState({
644
+ _value: value,
645
+ selectedRowKeys: [],
646
+ selectedRows: []
647
+ });
648
+ }
618
649
  }
619
650
  }, [value, _value]);
620
- var defaultAddonAfter = (0, _jsxRuntime.jsxs)("div", {
621
- className: "pro-enum-input-addonAfter",
622
- children: [value && !disabled && (0, _jsxRuntime.jsx)("span", {
623
- className: "close-icon",
624
- children: (0, _jsxRuntime.jsx)(_icons.CloseOutlined, {
625
- onClick: handleClearValue
626
- })
627
- }), (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
628
- className: "viewSvg",
629
- src: _view.default,
630
- onClick: handleClick
631
- })]
632
- });
633
- var forceAddonAfterRender = function forceAddonAfterRender() {
634
- if (isView || disabled) {
635
- return;
636
- }
637
- if (addonAfter) {
638
- return (0, _jsxRuntime.jsx)("div", {
639
- onClick: handleClick,
640
- children: addonAfter
641
- });
642
- }
643
- return defaultAddonAfter;
644
- };
645
651
  // 加个中间状态Input
646
- var initRender = (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
647
- children: [(0, _jsxRuntime.jsx)(_antd.Input, (0, _objectSpread2.default)({
652
+ var initRender = (0, _jsxRuntime.jsxs)(_antd.Space.Compact, {
653
+ style: {
654
+ width: '100%'
655
+ },
656
+ block: true,
657
+ children: [readOnly ? (0, _jsxRuntime.jsx)(_index.ProSelect, (0, _objectSpread3.default)({
658
+ value: value,
659
+ onChange: handleSelectValue,
660
+ disabled: disabled,
661
+ fieldNames: fieldNames,
662
+ showCodeName: showCodeName,
663
+ labelInValue: labelInValue,
664
+ dataSource: options,
665
+ scrollFollowParent: false,
666
+ onClick: function onClick() {
667
+ // 没有值的时候,初始化点击默认查询前五十条
668
+ if (!value && isInit || !(options === null || options === void 0 ? void 0 : options.length)) {
669
+ var _useRequest$options9;
670
+ var queryBean = useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams;
671
+ var params = withPagination ? {
672
+ pageNum: 1,
673
+ pageSize: 50,
674
+ queryBean: queryBean
675
+ } : queryBean;
676
+ run(params);
677
+ setState({
678
+ isInit: false
679
+ });
680
+ }
681
+ },
682
+ onSearch: (0, _lodash.debounce)(function (val) {
683
+ var _useRequest$options10;
684
+ var queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams), {}, (0, _defineProperty2.default)({}, labelKey, val));
685
+ var params = withPagination ? {
686
+ pageNum: 1,
687
+ pageSize: 50,
688
+ queryBean: queryBean
689
+ } : queryBean;
690
+ run(params);
691
+ }, 800),
692
+ style: {
693
+ width: isView || disabled ? '100%' : 'calc(100% - 30px)'
694
+ }
695
+ }, (0, _lodash.omit)(restProps, ['otherProps']))) : (0, _jsxRuntime.jsx)(_antd.Input, (0, _objectSpread3.default)({
648
696
  value: viewText,
649
- readOnly: readOnly,
650
- onClick: readOnly ? handleClick : undefined,
651
697
  onChange: handleChangeValue,
652
698
  disabled: disabled,
653
- addonAfter: forceAddonAfterRender(),
654
- autoComplete: "off"
655
- }, (0, _lodash.omit)(restInputProps, ['otherProps']))), (0, _jsxRuntime.jsx)(_antd.Input, {
656
- type: "hidden",
657
- value: value
699
+ autoComplete: "off",
700
+ allowClear: true
701
+ }, (0, _lodash.omit)(restProps, ['otherProps']))), isView || disabled ? null : (0, _jsxRuntime.jsx)(_antd.Button, {
702
+ icon: (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
703
+ className: "viewSvg",
704
+ src: _view.default,
705
+ onClick: handleClick
706
+ })
658
707
  })]
659
708
  });
660
709
  if (customRender && /*#__PURE__*/_react.default.isValidElement(customRender)) {
@@ -731,7 +780,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
731
780
  open: open,
732
781
  title: viewText,
733
782
  children: initRender
734
- }) : initRender, (0, _jsxRuntime.jsxs)(_index.ProDrawerForm, (0, _objectSpread2.default)((0, _objectSpread2.default)({
783
+ }) : initRender, (0, _jsxRuntime.jsxs)(_index.ProDrawerForm, (0, _objectSpread3.default)((0, _objectSpread3.default)({
735
784
  showType: "Modal",
736
785
  title: title,
737
786
  onOk: handleFinish,
@@ -745,7 +794,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
745
794
  columns: formColumns,
746
795
  onFinish: handleSearch,
747
796
  footer: (formColumns === null || formColumns === void 0 ? void 0 : formColumns.length) > 1
748
- }), (0, _jsxRuntime.jsx)(_index.ProTable, (0, _objectSpread2.default)({
797
+ }), (0, _jsxRuntime.jsx)(_index.ProTable, (0, _objectSpread3.default)({
749
798
  onRow: function onRow(record) {
750
799
  return {
751
800
  onClick: function onClick() {
@@ -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
  }
@@ -12,7 +12,7 @@ var _lodash = require("lodash");
12
12
  var _react = _interopRequireDefault(require("react"));
13
13
  var _antd = require("antd");
14
14
  var _index = _interopRequireDefault(require("../../index"));
15
- var _excluded = ["onChange", "children", "confirm"];
15
+ var _excluded = ["onChange", "children", "confirm", "otherProps"];
16
16
  var defaultConfirmProps = {
17
17
  title: '操作提示',
18
18
  content: '确定要修改该字段吗?'
@@ -21,6 +21,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
21
21
  var onChange = props.onChange,
22
22
  children = props.children,
23
23
  confirm = props.confirm,
24
+ otherProps = props.otherProps,
24
25
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
25
26
  var _ProForm$useFieldProp = _index.default.useFieldProps(),
26
27
  form = _ProForm$useFieldProp.form;
@@ -29,7 +30,12 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
29
30
  other[_key - 1] = arguments[_key];
30
31
  }
31
32
  var _value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
32
- var confirmProps = (0, _lodash.isFunction)(confirm) ? confirm(form.getFieldsValue()) : confirm;
33
+ var confirmProps = (0, _lodash.isFunction)(confirm) ? confirm(value, form.getFieldsValue(), {
34
+ option: other[0],
35
+ form: form,
36
+ namePath: otherProps.namePath,
37
+ index: otherProps.index
38
+ }) : confirm;
33
39
  if (confirmProps === true) {
34
40
  _antd.Modal.confirm((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultConfirmProps), {}, {
35
41
  onOk: function onOk() {
@@ -152,9 +152,11 @@ var Render = function Render(props) {
152
152
  // ↑↑↑↑↑↑ formItem参数整理 ↑↑↑↑↑↑
153
153
  Object.assign(otherFormItemProps, transforms, {
154
154
  names: otherProps.names
155
- }, internalRule, labelRequired || _required ? {
156
- required: labelRequired || _required
157
- } : null, otherProps.isView && !requiredOnView ? {
155
+ }, internalRule, {
156
+ required: typeof labelRequired === 'boolean' ? labelRequired : _required || (rules === null || rules === void 0 ? void 0 : rules.some(function (item) {
157
+ return item === null || item === void 0 ? void 0 : item.required;
158
+ }))
159
+ }, otherProps.isView && !requiredOnView ? {
158
160
  required: false
159
161
  } : null, (0, _objectSpread2.default)({}, (0, _index.isTrim)(type, trim, (0, _ProConfigProvider.useProConfig)())), // 优先取传进来的,其次取ProConfigProvider配置的
160
162
  (0, _objectSpread2.default)({}, (0, _index.isUpperCase)(type, upperCase)), {
@@ -220,12 +222,8 @@ var Render = function Render(props) {
220
222
  if (valueType) {
221
223
  _args[2].transformValue = form.getFieldValue(_otherFormItemProps === null || _otherFormItemProps === void 0 ? void 0 : _otherFormItemProps.name) || undefined;
222
224
  }
225
+ _args[2].option = args[1];
223
226
  switch (type) {
224
- case 'ProSelect':
225
- case 'ProModalSelect':
226
- case 'ProEnum':
227
- _args[2].option = args[1];
228
- break;
229
227
  case 'ProAddressBar':
230
228
  _args[2].selectedOptions = args[1];
231
229
  break;
@@ -242,7 +240,7 @@ var Render = function Render(props) {
242
240
  * onChange参数重置 (value, record, { form, index, namePath, option }) => void
243
241
  */
244
242
  var handleChange = function handleChange() {
245
- var _lastComponentProps$c2;
243
+ var _otherFormItemProps$n3, _lastComponentProps$c2;
246
244
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
247
245
  args[_key] = arguments[_key];
248
246
  }
@@ -260,6 +258,11 @@ var Render = function Render(props) {
260
258
  ((_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((0, _toConsumableArray2.default)(_args)))) || ((_lastComponentProps$c = lastComponentProps[changeKey]) === null || _lastComponentProps$c === void 0 ? void 0 : _lastComponentProps$c.call.apply(_lastComponentProps$c, [lastComponentProps].concat((0, _toConsumableArray2.default)(_args))));
261
259
  return false;
262
260
  }
261
+ var inList = _otherFormItemProps === null || _otherFormItemProps === void 0 ? void 0 : (_otherFormItemProps$n3 = _otherFormItemProps.namePath) === null || _otherFormItemProps$n3 === void 0 ? void 0 : _otherFormItemProps$n3.length;
262
+ // FormList 和 Group场景 对比值改变的话, 回显到表单上
263
+ if (inList) {
264
+ form.setFieldsValue(_args[1]);
265
+ }
263
266
  // Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
264
267
  if (formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames) {
265
268
  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
  /**
@@ -27,7 +27,7 @@ var _useFieldProps = require("./utils/useFieldProps");
27
27
  var _locale = _interopRequireDefault(require("../locale"));
28
28
  var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl"];
29
29
  var ProForm = function ProForm(props, ref) {
30
- var _forms$formKey, _localStorage;
30
+ var _forms$formKey, _localStorage, _ref;
31
31
  var _props$mode = props.mode,
32
32
  mode = _props$mode === void 0 ? 'search' : _props$mode,
33
33
  span = props.span,
@@ -50,8 +50,7 @@ var ProForm = function ProForm(props, ref) {
50
50
  expandOpenChange = props.expandOpenChange,
51
51
  _props$viewEmpty = props.viewEmpty,
52
52
  viewEmpty = _props$viewEmpty === void 0 ? '-' : _props$viewEmpty,
53
- _props$labelAlign = props.labelAlign,
54
- labelAlign = _props$labelAlign === void 0 ? 'left' : _props$labelAlign,
53
+ labelAlign = props.labelAlign,
55
54
  labelWidth = props.labelWidth,
56
55
  onValuesChange = props.onValuesChange,
57
56
  onFinish = props.onFinish,
@@ -232,9 +231,9 @@ var ProForm = function ProForm(props, ref) {
232
231
  }
233
232
  },
234
233
  className: cls,
235
- form: form,
236
- labelAlign: labelAlign
234
+ form: form
237
235
  }, formProps), config), otherProps), {}, {
236
+ labelAlign: (_ref = labelAlign !== null && labelAlign !== void 0 ? labelAlign : config.labelAlign) !== null && _ref !== void 0 ? _ref : 'left',
238
237
  onValuesChange: handleValuesChange,
239
238
  onFinish: handleFinish,
240
239
  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
  }
@@ -5,49 +5,34 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.diffOriginal = void 0;
8
- var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _lodash = require("lodash");
10
10
  var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
11
- var extractValue = function extractValue(obj, path) {
12
- var value = obj || {};
13
- if (!Object.keys(obj)) {
14
- return [];
15
- }
16
- var _iterator = (0, _createForOfIteratorHelper2.default)(path),
17
- _step;
18
- try {
19
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
20
- var key = _step.value;
21
- if (value && value.hasOwnProperty(key)) {
22
- value = value[key];
23
- } else {
24
- return undefined;
25
- }
26
- }
27
- } catch (err) {
28
- _iterator.e(err);
29
- } finally {
30
- _iterator.f();
31
- }
32
- return Object.values(value);
33
- };
34
11
  /** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
35
- var extractValues = function extractValues(data, pathString) {
36
- if (pathString.includes('_')) {
37
- var namePrefixes = pathString.split('-')[0].split('_').slice(0, -1);
38
- return extractValue(data, namePrefixes);
12
+ var extractValues = function extractValues(form, pathString) {
13
+ var _pathString;
14
+ var result = [];
15
+ var PrefixesName = (0, _lodash.isString)(pathString) ? [] : pathString.slice(0, -1);
16
+ if ((0, _lodash.isString)(pathString)) {
17
+ pathString.split('-').forEach(function (item) {
18
+ result.push(form.getFieldValue([].concat((0, _toConsumableArray2.default)(PrefixesName), [item])));
19
+ });
20
+ return result;
39
21
  }
40
- return pathString.split('-').map(function (item) {
41
- return data[item];
22
+ (_pathString = pathString[pathString.length - 1]) === null || _pathString === void 0 ? void 0 : _pathString.split('-').forEach(function (item) {
23
+ result.push(form.getFieldValue([].concat((0, _toConsumableArray2.default)(PrefixesName), [item])));
42
24
  });
25
+ return result;
43
26
  };
44
27
  var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
28
+ var _name$join;
45
29
  var originalValue = params.originalValue,
46
30
  _value = params.value,
47
31
  equalWith = params.equalWith,
48
32
  form = params.form,
49
33
  name = params.name;
50
- var value = !(name === null || name === void 0 ? void 0 : name.includes('-')) ? _value : extractValues(form.getFieldsValue(), name);
34
+ 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('-'));
35
+ var value = !isNames ? _value : extractValues(form, name);
51
36
  // 支持传入自定义比较事件
52
37
  if ((0, _lodash.isFunction)(equalWith)) {
53
38
  return !equalWith(originalValue, value);