@zat-design/sisyphus-react 3.4.2-beta.9 → 3.4.3

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 (98) hide show
  1. package/dist/index.esm.css +55 -36
  2. package/dist/less.esm.css +5022 -0
  3. package/dist/less.esm.js +3 -0
  4. package/es/ProConfigProvider/index.js +2 -1
  5. package/es/ProEditTable/components/RenderField/index.js +20 -10
  6. package/es/ProEditTable/utils/config.js +5 -5
  7. package/es/ProEditTable/utils/index.js +32 -9
  8. package/es/ProEnum/components/Group.d.ts +2 -0
  9. package/es/ProEnum/components/Group.js +26 -8
  10. package/es/ProEnum/index.js +4 -3
  11. package/es/ProEnum/style/index.less +11 -2
  12. package/es/ProForm/components/combination/FormList/index.js +6 -3
  13. package/es/ProForm/components/combination/FormList/utils.d.ts +2 -1
  14. package/es/ProForm/components/combination/FormList/utils.js +5 -3
  15. package/es/ProForm/components/combination/Group/index.js +23 -7
  16. package/es/ProForm/components/combination/Group/propsType.d.ts +6 -0
  17. package/es/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
  18. package/es/ProForm/components/render/ConfirmWrapper.js +1 -1
  19. package/es/ProForm/components/render/Render.js +4 -1
  20. package/es/ProForm/components/render/RenderFields.js +3 -1
  21. package/es/ProForm/propsType.d.ts +2 -0
  22. package/es/ProForm/style/index.less +17 -13
  23. package/es/ProForm/utils/transformNames.d.ts +1 -1
  24. package/es/ProForm/utils/transformNames.js +11 -4
  25. package/es/ProForm/utils/useListChanged.js +1 -0
  26. package/es/ProForm/utils/valueType.d.ts +10 -5
  27. package/es/ProForm/utils/valueType.js +20 -10
  28. package/es/ProIcon/config/index.d.ts +2 -1
  29. package/es/ProIcon/config/index.js +191 -133
  30. package/es/ProIcon/index.d.ts +0 -1
  31. package/es/ProIcon/index.js +17 -36
  32. package/es/ProIcon/propsTypes.d.ts +2 -1
  33. package/es/ProLayout/components/Layout/Header/style/index.less +1 -1
  34. package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -0
  35. package/es/ProLayout/components/ProCollapse/index.js +22 -3
  36. package/es/ProLayout/components/ProCollapse/style/index.less +19 -4
  37. package/es/ProLayout/components/ProHeader/style/index.less +2 -2
  38. package/es/ProLayout/style/index.less +5 -3
  39. package/es/ProStep/components/Item/index.js +2 -1
  40. package/es/ProStep/style/index.less +71 -70
  41. package/es/ProTree/components/ProTreeSelect/index.js +5 -9
  42. package/es/assets/catalog.svg +30 -1
  43. package/es/assets/fold.svg +27 -0
  44. package/es/locale/en_US.d.ts +3 -0
  45. package/es/locale/en_US.js +3 -0
  46. package/es/locale/zh_CN.d.ts +3 -0
  47. package/es/locale/zh_CN.js +3 -0
  48. package/es/style/less.less +2 -0
  49. package/es/style/theme/antd.less +1 -1
  50. package/lib/ProConfigProvider/index.js +2 -1
  51. package/lib/ProEditTable/components/RenderField/index.js +19 -9
  52. package/lib/ProEditTable/utils/config.js +5 -5
  53. package/lib/ProEditTable/utils/index.js +32 -9
  54. package/lib/ProEnum/components/Group.d.ts +2 -0
  55. package/lib/ProEnum/components/Group.js +26 -8
  56. package/lib/ProEnum/index.js +4 -3
  57. package/lib/ProEnum/style/index.less +11 -2
  58. package/lib/ProForm/components/combination/FormList/index.js +6 -3
  59. package/lib/ProForm/components/combination/FormList/utils.d.ts +2 -1
  60. package/lib/ProForm/components/combination/FormList/utils.js +5 -3
  61. package/lib/ProForm/components/combination/Group/index.js +22 -6
  62. package/lib/ProForm/components/combination/Group/propsType.d.ts +6 -0
  63. package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
  64. package/lib/ProForm/components/render/ConfirmWrapper.js +1 -1
  65. package/lib/ProForm/components/render/Render.js +4 -1
  66. package/lib/ProForm/components/render/RenderFields.js +3 -1
  67. package/lib/ProForm/propsType.d.ts +2 -0
  68. package/lib/ProForm/style/index.less +17 -13
  69. package/lib/ProForm/utils/transformNames.d.ts +1 -1
  70. package/lib/ProForm/utils/transformNames.js +10 -3
  71. package/lib/ProForm/utils/useListChanged.js +1 -0
  72. package/lib/ProForm/utils/valueType.d.ts +10 -5
  73. package/lib/ProForm/utils/valueType.js +20 -10
  74. package/lib/ProIcon/config/index.d.ts +2 -1
  75. package/lib/ProIcon/config/index.js +191 -133
  76. package/lib/ProIcon/index.d.ts +0 -1
  77. package/lib/ProIcon/index.js +17 -37
  78. package/lib/ProIcon/propsTypes.d.ts +2 -1
  79. package/lib/ProLayout/components/Layout/Header/style/index.less +1 -1
  80. package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -0
  81. package/lib/ProLayout/components/ProCollapse/index.js +20 -3
  82. package/lib/ProLayout/components/ProCollapse/style/index.less +19 -4
  83. package/lib/ProLayout/components/ProHeader/style/index.less +2 -2
  84. package/lib/ProLayout/style/index.less +5 -3
  85. package/lib/ProStep/components/Item/index.js +2 -1
  86. package/lib/ProStep/style/index.less +71 -70
  87. package/lib/ProTree/components/ProTreeSelect/index.js +5 -9
  88. package/lib/assets/catalog.svg +30 -1
  89. package/lib/assets/fold.svg +27 -0
  90. package/lib/locale/en_US.d.ts +3 -0
  91. package/lib/locale/en_US.js +3 -0
  92. package/lib/locale/zh_CN.d.ts +3 -0
  93. package/lib/locale/zh_CN.js +3 -0
  94. package/lib/style/less.less +2 -0
  95. package/lib/style/theme/antd.less +1 -1
  96. package/package.json +1 -1
  97. package/es/ProIcon/symbolIcon.js +0 -43
  98. package/lib/ProIcon/symbolIcon.js +0 -45
@@ -0,0 +1,3 @@
1
+ var undefined$1 = undefined;
2
+
3
+ export default undefined$1;
@@ -18,7 +18,8 @@ var initialState = {
18
18
  mode: 'icon',
19
19
  mapList: [{
20
20
  type: 'view',
21
- text: '查看'
21
+ 'text-cn': '查看',
22
+ 'text-en': 'view'
22
23
  }]
23
24
  }
24
25
  };
@@ -17,7 +17,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
17
17
  /* eslint-disable prefer-const */
18
18
  import React, { useCallback, useEffect } from 'react';
19
19
  import classNames from 'classnames';
20
- import { cloneDeep, isEqual, debounce, omit, isFunction, get } from 'lodash';
20
+ import { cloneDeep, isEqual, debounce, omit, isFunction } from 'lodash';
21
21
  import valueTypeMap from '../../../ProForm/utils/valueType';
22
22
  import transformMap from '../../utils/transform';
23
23
  import { getNamePath, difference } from '../../utils/tools';
@@ -29,7 +29,7 @@ import { useListChanged } from '../../../ProForm/utils/useListChanged';
29
29
  import useRules from '../../../ProForm/utils/useRules';
30
30
  import { isSelect } from '../../../ProForm/utils';
31
31
  var RenderField = function RenderField(_ref) {
32
- var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4;
32
+ var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4, _componentProps;
33
33
  var value = _ref.text,
34
34
  record = _ref.record,
35
35
  index = _ref.index,
@@ -85,7 +85,7 @@ var RenderField = function RenderField(_ref) {
85
85
  type = ((_type = type) === null || _type === void 0 ? void 0 : (_type$replace = _type.replace) === null || _type$replace === void 0 ? void 0 : _type$replace.call(_type, type[0], type[0].toUpperCase())) || 'Input';
86
86
  // 单行正在编辑时,临时生成一套formItem用来存储中间值,点击取消时候重置回上一次状态
87
87
  var namePath = getNamePath(name, virtualKey);
88
- var rowData = get(form.getFieldsValue(), [].concat(_toConsumableArray(namePath), [index])) || record || {};
88
+ var rowData = form.getFieldValue([].concat(_toConsumableArray(namePath), [index])) || record || {};
89
89
  var currentValue = dataIndex ? rowData === null || rowData === void 0 ? void 0 : rowData[dataIndex] : null;
90
90
  // 第三个参数
91
91
  var options = {
@@ -210,7 +210,7 @@ var RenderField = function RenderField(_ref) {
210
210
  if (valueType) {
211
211
  transform = valueTypeTransform();
212
212
  }
213
- return transformNames(_objectSpread(_objectSpread({}, _formItemProps), transform), form, names, namesStr);
213
+ return transformNames(_objectSpread(_objectSpread({}, _formItemProps), transform), form, names, namesStr, type);
214
214
  };
215
215
  if (!_editRender && typeof type === 'string') {
216
216
  var _componentMap$type;
@@ -300,7 +300,7 @@ var RenderField = function RenderField(_ref) {
300
300
  }
301
301
  _args = [].concat(args);
302
302
  rowPath = [].concat(_toConsumableArray(namePath), [index]);
303
- row = form.getFieldValue(rowPath, true);
303
+ row = type === 'Group' ? _args[1] : form.getFieldValue(rowPath, true);
304
304
  orgRow = cloneDeep(row);
305
305
  if (!onFieldChange) {
306
306
  _context.next = 18;
@@ -345,7 +345,7 @@ var RenderField = function RenderField(_ref) {
345
345
  return onChange.apply(void 0, _toConsumableArray(_args));
346
346
  case 27:
347
347
  // 判断属性是否变动
348
- form.setFieldValue(rowPath, row);
348
+ type !== 'Group' && form.setFieldValue(rowPath, row);
349
349
  if (!isEqual(orgRow, row)) {
350
350
  diff = difference(row, orgRow) || {};
351
351
  validateFieldKeys = (_Object$keys = Object.keys(diff)) === null || _Object$keys === void 0 ? void 0 : (_Object$keys$map = _Object$keys.map) === null || _Object$keys$map === void 0 ? void 0 : _Object$keys$map.call(_Object$keys, function (key) {
@@ -469,9 +469,11 @@ var RenderField = function RenderField(_ref) {
469
469
  form: form,
470
470
  name: cellName
471
471
  }, _fieldProps), (_TargetComponent4 = TargetComponent) === null || _TargetComponent4 === void 0 ? void 0 : _TargetComponent4.props), {}, {
472
+ namePath: [].concat(_toConsumableArray(namePath), [index]),
472
473
  disabled: _disabled,
473
474
  onChange: _onchange,
474
475
  onBlur: _onblur,
476
+ index: index,
475
477
  otherProps: {
476
478
  form: form,
477
479
  names: names,
@@ -481,6 +483,11 @@ var RenderField = function RenderField(_ref) {
481
483
  isView: isView
482
484
  }
483
485
  });
486
+ if (type === 'Group') {
487
+ componentProps.onFieldChange = _onchange;
488
+ } else {
489
+ componentProps = omit(componentProps, ['onFieldChange', 'namePath', 'index']);
490
+ }
484
491
  // 单元格编辑时,设置各个单元格disabled属性
485
492
  if (isCell) {
486
493
  record["".concat(dataIndex, "-Disabled")] = _disabled;
@@ -506,11 +513,11 @@ var RenderField = function RenderField(_ref) {
506
513
  }
507
514
  var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
508
515
  var originalTitle = originalDiffTip ? _jsxs(_Space, {
509
- children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, omit(componentProps, ['onFieldChange'])), {}, {
516
+ children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
510
517
  isView: true,
511
518
  value: originalValue,
512
519
  checked: type === 'Switch' ? originalValue : undefined
513
- }))) : _jsx(TargetComponent, _objectSpread(_objectSpread({}, omit(componentProps, ['onFieldChange'])), {}, {
520
+ }))) : _jsx(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
514
521
  isView: true,
515
522
  value: originalValue,
516
523
  checked: type === 'Switch' ? originalValue : undefined
@@ -521,15 +528,18 @@ var RenderField = function RenderField(_ref) {
521
528
  }, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
522
529
  className: _className,
523
530
  name: cellName,
524
- children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread({}, omit(componentProps, ['onFieldChange'])))) : _jsx(TargetComponent, _objectSpread({}, omit(componentProps, ['onFieldChange'])))
531
+ children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
525
532
  })) : _jsx(Container, {
526
533
  viewEmpty: viewEmpty
527
534
  });
528
535
  return _jsx(FieldProvider, {
529
- value: componentProps === null || componentProps === void 0 ? void 0 : componentProps.otherProps,
536
+ value: (_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.otherProps,
530
537
  children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
531
538
  title: originalTitle,
532
539
  open: changed ? undefined : false,
540
+ getPopupContainer: function getPopupContainer(target) {
541
+ return target.parentElement;
542
+ },
533
543
  children: FormItem
534
544
  })
535
545
  });
@@ -190,11 +190,6 @@ export var actions = {
190
190
  addData.isEditing = true;
191
191
  }
192
192
  insertType === 'before' ? nextData.unshift(addData) : nextData.push(addData);
193
- form.setFieldValue(name, nextData);
194
- (_tableRef$current$que = tableRef.current.querySelector(".".concat(prefixCls, "-table-body"))) === null || _tableRef$current$que === void 0 ? void 0 : (_tableRef$current$que2 = _tableRef$current$que.scrollTo) === null || _tableRef$current$que2 === void 0 ? void 0 : _tableRef$current$que2.call(_tableRef$current$que, {
195
- top: 10000,
196
- behavior: 'smooth'
197
- });
198
193
  // 当单选情况下,存储正在编辑值
199
194
  if (virtualKey) {
200
195
  nextEditingKeys = _toConsumableArray(editingKeys); // 开启编辑状态
@@ -204,6 +199,11 @@ export var actions = {
204
199
  editingKeys: nextEditingKeys
205
200
  });
206
201
  }
202
+ form.setFieldValue(name, nextData);
203
+ (_tableRef$current$que = tableRef.current.querySelector(".".concat(prefixCls, "-table-body"))) === null || _tableRef$current$que === void 0 ? void 0 : (_tableRef$current$que2 = _tableRef$current$que.scrollTo) === null || _tableRef$current$que2 === void 0 ? void 0 : _tableRef$current$que2.call(_tableRef$current$que, {
204
+ top: insertType === 'before' ? -10000 : 10000,
205
+ behavior: 'smooth'
206
+ });
207
207
  _context2.next = 14;
208
208
  return form.validateFields([name]);
209
209
  case 14:
@@ -100,7 +100,30 @@ var getActionColumn = function getActionColumn(config) {
100
100
  setTimeout(function () {
101
101
  var errorDom = document.querySelector('.ant-form-item-has-error');
102
102
  if (errorDom) {
103
- errorDom.scrollIntoViewIfNeeded(true);
103
+ var tableBody = errorDom.closest('.ant-table-content') || errorDom.closest('.ant-table-body');
104
+ var tableCell = errorDom.closest('.ant-table-cell');
105
+ if (tableBody && tableCell) {
106
+ var previousSibling = tableCell.previousElementSibling;
107
+ var childOffsetLeft = 0;
108
+ var childFixedLeft = 0;
109
+ while (previousSibling) {
110
+ if (previousSibling.nodeType === 1) {
111
+ var _previousSibling, _previousSibling$clas, _previousSibling$clas2, _previousSibling$clas3;
112
+ var _ref2 = previousSibling.getBoundingClientRect() || {},
113
+ _ref2$width = _ref2.width,
114
+ width = _ref2$width === void 0 ? 0 : _ref2$width;
115
+ childOffsetLeft += width;
116
+ if ((_previousSibling = previousSibling) === null || _previousSibling === void 0 ? void 0 : (_previousSibling$clas = _previousSibling.classList) === null || _previousSibling$clas === void 0 ? void 0 : (_previousSibling$clas2 = (_previousSibling$clas3 = _previousSibling$clas).contains) === null || _previousSibling$clas2 === void 0 ? void 0 : _previousSibling$clas2.call(_previousSibling$clas3, 'ant-table-cell-fix-left')) {
117
+ childFixedLeft += width;
118
+ }
119
+ }
120
+ previousSibling = previousSibling.previousElementSibling;
121
+ }
122
+ tableBody.scrollTo({
123
+ left: childOffsetLeft - childFixedLeft,
124
+ behavior: 'smooth'
125
+ });
126
+ }
104
127
  }
105
128
  }, 0);
106
129
  return _context.abrupt("return", Promise.reject(_context.t0));
@@ -224,10 +247,10 @@ export var transformColumns = function transformColumns() {
224
247
  if (typeof columnTitle === 'string') {
225
248
  item.originTitle = columnTitle;
226
249
  if (tooltip) {
227
- var _ref2 = tooltip || {},
228
- tooltipTitle = _ref2.title,
229
- icon = _ref2.icon,
230
- resetProps = _objectWithoutProperties(_ref2, _excluded2);
250
+ var _ref3 = tooltip || {},
251
+ tooltipTitle = _ref3.title,
252
+ icon = _ref3.icon,
253
+ resetProps = _objectWithoutProperties(_ref3, _excluded2);
231
254
  item.title = _jsxs("span", {
232
255
  className: "pro-edit-table-title pro-edit-table-tooltip",
233
256
  children: [before, columnTitle, _jsx(_Tooltip, _objectSpread(_objectSpread({
@@ -379,13 +402,13 @@ export var transformColumns = function transformColumns() {
379
402
  // cacheMap 用来存储缓存值,若有值后不再请求
380
403
  if (JSON.stringify(cacheMap.current) === '{}') {
381
404
  Promise.all(Object.entries(_cacheMap).map( /*#__PURE__*/function () {
382
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
383
- var _item, key, value, _ref4, service, option;
405
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
406
+ var _item, key, value, _ref5, service, option;
384
407
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
385
408
  while (1) switch (_context2.prev = _context2.next) {
386
409
  case 0:
387
410
  _item = _slicedToArray(item, 2), key = _item[0], value = _item[1];
388
- _ref4 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref4.service, option = _ref4.option;
411
+ _ref5 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref5.service, option = _ref5.option;
389
412
  if (!service) {
390
413
  _context2.next = 8;
391
414
  break;
@@ -405,7 +428,7 @@ export var transformColumns = function transformColumns() {
405
428
  }, _callee2);
406
429
  }));
407
430
  return function (_x3) {
408
- return _ref3.apply(this, arguments);
431
+ return _ref4.apply(this, arguments);
409
432
  };
410
433
  }())).then(function (res) {
411
434
  res.forEach(function (item) {
@@ -2,6 +2,8 @@ import { ProEnum } from '../propsType';
2
2
  interface Props extends Pick<ProEnum, 'value' | 'onChange' | 'dataSource'> {
3
3
  fieldValue: string;
4
4
  fieldLabel: string;
5
+ disabled?: boolean;
6
+ allowClear?: boolean;
5
7
  }
6
8
  declare const Group: (props: Props) => JSX.Element;
7
9
  export default Group;
@@ -8,7 +8,10 @@ var Group = function Group(props) {
8
8
  onChange = props.onChange,
9
9
  dataSource = props.dataSource,
10
10
  fieldValue = props.fieldValue,
11
- fieldLabel = props.fieldLabel;
11
+ fieldLabel = props.fieldLabel,
12
+ disabled = props.disabled,
13
+ _props$allowClear = props.allowClear,
14
+ allowClear = _props$allowClear === void 0 ? true : _props$allowClear;
12
15
  var idx = useRef(-1);
13
16
  var _useSetState = useSetState({
14
17
  checked: ''
@@ -20,13 +23,28 @@ var Group = function Group(props) {
20
23
  setState({
21
24
  checked: value
22
25
  });
23
- }, [value]);
24
- var handleClick = function handleClick(val, index) {
25
- setState({
26
- checked: val
26
+ var index = dataSource.findIndex(function (item) {
27
+ return item[fieldValue] === value;
27
28
  });
28
29
  idx.current = index;
29
- onChange === null || onChange === void 0 ? void 0 : onChange(val);
30
+ }, [value]);
31
+ var handleClick = function handleClick(val, index) {
32
+ if (state.checked === val) {
33
+ if (!allowClear) {
34
+ return false;
35
+ }
36
+ setState({
37
+ checked: ''
38
+ });
39
+ onChange === null || onChange === void 0 ? void 0 : onChange('');
40
+ idx.current = -1;
41
+ } else {
42
+ setState({
43
+ checked: val
44
+ });
45
+ idx.current = index;
46
+ onChange === null || onChange === void 0 ? void 0 : onChange(val);
47
+ }
30
48
  };
31
49
  if (dataSource.length === 0) {
32
50
  return _jsx("span", {
@@ -34,11 +52,11 @@ var Group = function Group(props) {
34
52
  });
35
53
  }
36
54
  return _jsx("div", {
37
- className: "pro-enum-group-root",
55
+ className: classNames('pro-enum-group-root', disabled ? 'pro-enum-group-root-disabled' : ''),
38
56
  children: dataSource.map(function (item, index) {
39
57
  return _jsx("div", {
40
58
  onClick: function onClick() {
41
- if (!item.disabled) {
59
+ if (!item.disabled && !disabled) {
42
60
  handleClick(item[fieldValue], index);
43
61
  }
44
62
  },
@@ -41,7 +41,8 @@ var ProEnum = function ProEnum(props) {
41
41
  enumProps = _objectWithoutProperties(props, _excluded);
42
42
  var _ref = otherProps || {},
43
43
  isView = _ref.isView,
44
- viewEmpty = _ref.viewEmpty;
44
+ viewEmpty = _ref.viewEmpty,
45
+ disabled = _ref.disabled;
45
46
  var _ref2 = useProConfig('ProEnum') || {},
46
47
  fieldNames = _ref2.fieldNames,
47
48
  _ref2$clear = _ref2.clear,
@@ -207,13 +208,13 @@ var ProEnum = function ProEnum(props) {
207
208
  dataSource: list
208
209
  });
209
210
  case 'Group':
210
- return _jsx(ProEnumGroup, {
211
+ return _jsx(ProEnumGroup, _objectSpread(_objectSpread({}, enumProps), {}, {
211
212
  value: value,
212
213
  onChange: onChange,
213
214
  fieldLabel: label,
214
215
  fieldValue: fieldValue,
215
216
  dataSource: list
216
- });
217
+ }));
217
218
  default:
218
219
  return null;
219
220
  }
@@ -7,12 +7,17 @@
7
7
  flex-direction: row;
8
8
  flex-wrap: wrap;
9
9
  }
10
+ &-group-root-disabled {
11
+ color: rgba(0, 0, 0, 0.25);
12
+ .pro-enum-group-item{
13
+ cursor: not-allowed !important;
14
+ }
15
+ }
10
16
  &-tag-item {
11
17
  display: flex;
12
18
  align-items: center;
13
19
  justify-content: center;
14
20
  margin-right: var(--zaui-space-size-sm);
15
- margin-bottom: calc(var(--zaui-space-size-sm; 8px) * var(--zaui-size; 1));
16
21
  padding: var(--zaui-space-size-xs) 10px;
17
22
  background-color: #f5f5f5;
18
23
  border-radius: var(--zaui-space-size-xs);
@@ -71,8 +76,8 @@
71
76
 
72
77
  .pro-enum-group-item-selected {
73
78
  color: var(--zaui-brand);
74
- border: 1px solid var(--zaui-brand);
75
79
  background: #fff;
80
+ border: 1px solid var(--zaui-brand);
76
81
  &::after {
77
82
  background: transparent;
78
83
  }
@@ -88,4 +93,8 @@
88
93
  cursor: not-allowed;
89
94
  }
90
95
  }
96
+
97
+ &-group-root-disabled {
98
+ opacity: 0.7;
99
+ }
91
100
  }
@@ -41,17 +41,20 @@ var FormList = function FormList(props, ref) {
41
41
  // names的name处理
42
42
  var _name = Array.isArray(item === null || item === void 0 ? void 0 : item.names) ? [fieldName, namesPathTransform({
43
43
  names: item === null || item === void 0 ? void 0 : item.names,
44
- prefixNamePath: namePath
44
+ prefixNamePath: namePath,
45
+ type: item.type
45
46
  })] : [fieldName].concat(_toConsumableArray(toArray(item.name)));
46
- return _objectSpread(_objectSpread({}, item), {}, {
47
+ var column = _objectSpread(_objectSpread({}, item), {}, {
47
48
  name: _name,
48
49
  names: (item === null || item === void 0 ? void 0 : item.names) ? item.names.map(function (nameItem) {
49
- return [].concat(_toConsumableArray(namePath), _toConsumableArray(toArray(nameItem)));
50
+ // 传给Group的names会被渲染成真实FormItem 不能传完整name
51
+ return item.type === 'Group' ? [fieldName].concat(_toConsumableArray(toArray(nameItem))) : [].concat(_toConsumableArray(namePath), _toConsumableArray(toArray(nameItem)));
50
52
  }) : item.names,
51
53
  index: fieldName,
52
54
  namePath: namePath,
53
55
  label: mode === 'less' ? undefined : item.label
54
56
  });
57
+ return column;
55
58
  });
56
59
  }, [columns]);
57
60
  useImperativeHandle(ref, function () {
@@ -4,7 +4,8 @@
4
4
  * @param prefixNamePath formList的name前缀
5
5
  * @returns list_0_min-list_0_max
6
6
  */
7
- export declare const namesPathTransform: ({ names, prefixNamePath, }: {
7
+ export declare const namesPathTransform: ({ names, prefixNamePath, type, }: {
8
8
  names: any[];
9
9
  prefixNamePath: any[];
10
+ type: string;
10
11
  }) => string;
@@ -6,12 +6,14 @@
6
6
  */
7
7
  export var namesPathTransform = function namesPathTransform(_ref) {
8
8
  var names = _ref.names,
9
- prefixNamePath = _ref.prefixNamePath;
10
- if (!Array.isArray(names) || !Array.isArray(prefixNamePath)) {
9
+ prefixNamePath = _ref.prefixNamePath,
10
+ type = _ref.type;
11
+ if (!Array.isArray(names) || type !== 'Group' && !Array.isArray(prefixNamePath)) {
11
12
  return '';
12
13
  }
14
+ var _prefixNamePath = type === 'Group' ? '' : prefixNamePath;
13
15
  var newNamePath = names.map(function (val) {
14
- return prefixNamePath.concat(val);
16
+ return _prefixNamePath.concat(val);
15
17
  });
16
18
  return newNamePath === null || newNamePath === void 0 ? void 0 : newNamePath.map(function (name) {
17
19
  return Array.isArray(name) ? name.join('_') : name;
@@ -6,7 +6,7 @@ import _Button from "antd/es/button";
6
6
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { useMemo } from 'react';
9
- import { omit, isFunction } from 'lodash';
9
+ import { omit, isFunction, union, isNumber } from 'lodash';
10
10
  import { useDeepCompareEffect } from 'ahooks';
11
11
  import classnames from 'classnames';
12
12
  import RenderFields from '../../render/RenderFields';
@@ -22,11 +22,16 @@ var Group = function Group(props) {
22
22
  } : _props$space,
23
23
  id = props.id,
24
24
  value = props.value,
25
- onFieldChange = props.onFieldChange;
25
+ isView = props.isView,
26
+ index = props.index,
27
+ onFieldChange = props.onFieldChange,
28
+ namePath = props.namePath;
26
29
  var _ref = ProForm.useFieldProps() || {},
27
30
  names = _ref.names,
28
31
  name = _ref.name,
29
- form = _ref.form;
32
+ form = _ref.form,
33
+ _namePath = _ref.namePath;
34
+ var newNamePath = namePath || _namePath || [];
30
35
  if (!Array.isArray(names)) {
31
36
  console.error('Warning: Composite form components whose type is Group must be configured with names');
32
37
  }
@@ -36,8 +41,10 @@ var Group = function Group(props) {
36
41
  return _objectSpread(_objectSpread({
37
42
  disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
38
43
  }, item), {}, {
44
+ isView: isView !== null && isView !== void 0 ? isView : item.isView,
39
45
  noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
40
- parentNames: id
46
+ parentNames: id,
47
+ namePath: newNamePath
41
48
  });
42
49
  });
43
50
  var node = _jsx(_Button, {
@@ -59,14 +66,23 @@ var Group = function Group(props) {
59
66
  return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
60
67
  })
61
68
  }, "".concat(className), className));
69
+ // 用于formList场景下names移除掉了前缀,需要再次合并回来
70
+ var _names = names.map(function (item) {
71
+ if (isNumber(item === null || item === void 0 ? void 0 : item[0])) {
72
+ return union(newNamePath, item);
73
+ }
74
+ return item;
75
+ });
62
76
  useDeepCompareEffect(function () {
63
77
  var _document, _document$activeEleme;
64
78
  // 焦点激活的表单
65
79
  var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
66
80
  // 模拟change,初始化不执行onFieldChange
67
- if (isFunction(onFieldChange) && form.isFieldsTouched(names) && transformNamesString(names).includes(touchName)) {
68
- onFieldChange(value, form.getFieldsValue(), {
69
- form: form
81
+ if (isFunction(onFieldChange) && form.isFieldsTouched(_names) && transformNamesString(_names).includes(touchName)) {
82
+ onFieldChange(value, (newNamePath === null || newNamePath === void 0 ? void 0 : newNamePath.length) ? form.getFieldValue(newNamePath, true) : form.getFieldsValue(), {
83
+ form: form,
84
+ namePath: newNamePath,
85
+ index: index
70
86
  });
71
87
  }
72
88
  }, [value]);
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { RowProps, SpaceProps } from 'antd';
3
3
  import { FormInstance } from 'antd/es/form/Form';
4
+ import { NamePath } from 'antd/lib/form/interface';
4
5
  import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
5
6
  export interface SpaceType extends SpaceProps {
6
7
  /**
@@ -23,7 +24,12 @@ export interface GroupProps {
23
24
  value?: any;
24
25
  id?: string;
25
26
  disabled?: boolean | (() => void);
27
+ isView?: boolean;
28
+ namePath?: NamePath;
29
+ index?: number;
26
30
  onFieldChange?: (value: any[] | null, record: any, { form, }: {
27
31
  form: FormInstance;
32
+ namePath?: NamePath;
33
+ index?: number;
28
34
  }) => any;
29
35
  }
@@ -6,7 +6,7 @@
6
6
  ~ .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
7
7
  .@{ant-prefix}-input-borderless
8
8
  ).@{ant-prefix}-input {
9
- background: @zaui-base-bg;
9
+ // background: @zaui-base-bg;
10
10
  border-color: var(--ant-error-color);
11
11
  }
12
12
  .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
@@ -33,7 +33,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
33
33
  return;
34
34
  }
35
35
  if (isObject(confirmProps)) {
36
- _Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, defaultConfirmProps), confirmProps), {}, {
36
+ _Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, 'title' in confirmProps || 'content' in confirmProps ? {} : defaultConfirmProps), confirmProps), {}, {
37
37
  onOk: function onOk() {
38
38
  var _confirmProps$onOk;
39
39
  for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
@@ -150,7 +150,7 @@ var Render = function Render(props) {
150
150
  */
151
151
  var transforms = Array.isArray(otherProps === null || otherProps === void 0 ? void 0 : otherProps.names) ? transformNames(_objectSpread(_objectSpread({}, otherFormItemProps), valueTypeTransform()),
152
152
  // 合并valueType的transform
153
- form, otherProps.names, namesStr) : valueTypeTransform();
153
+ form, otherProps.names, namesStr, otherProps.type) : valueTypeTransform();
154
154
  // ↑↑↑↑↑↑ formItem参数整理 ↑↑↑↑↑↑
155
155
  Object.assign(otherFormItemProps, transforms, {
156
156
  names: otherProps.names
@@ -447,6 +447,9 @@ var Render = function Render(props) {
447
447
  return _jsx(_Tooltip, {
448
448
  title: title,
449
449
  visible: changed ? undefined : false,
450
+ getPopupContainer: function getPopupContainer(target) {
451
+ return target.parentElement;
452
+ },
450
453
  children: formItem
451
454
  });
452
455
  };
@@ -176,7 +176,9 @@ var RenderFields = function RenderFields(props) {
176
176
  form: form,
177
177
  type: _type,
178
178
  hiddenNames: column.hiddenNames,
179
- colProps: _colProps
179
+ colProps: _colProps,
180
+ mode: componentProps.mode,
181
+ namePath: column.namePath
180
182
  };
181
183
  if (outerClearNotShow !== false && show === false && (column === null || column === void 0 ? void 0 : column.name) && form.getFieldValue(column === null || column === void 0 ? void 0 : column.name)) {
182
184
  setTimeout(function () {
@@ -39,6 +39,8 @@ export interface ProFormOtherProps {
39
39
  disabled: boolean;
40
40
  show?: boolean | (() => boolean);
41
41
  required?: boolean | (() => boolean);
42
+ mode?: string;
43
+ namePath?: any[] | string | number;
42
44
  }
43
45
  export interface ProFormProps<Values = any> extends FormProps<Values> {
44
46
  disabled?: boolean;
@@ -31,16 +31,6 @@
31
31
  }
32
32
  }
33
33
 
34
- &.@{ant-prefix}-form {
35
- margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
36
- }
37
-
38
- .pro-collapse-level2 {
39
- .@{ant-prefix}-collapse-item {
40
- margin-bottom: 0 !important;
41
- }
42
- }
43
-
44
34
  .@{ant-prefix}-form-item-control-input {
45
35
  flex-grow: 1;
46
36
  max-width: 100%;
@@ -135,7 +125,7 @@
135
125
  background: @zaui-contract-bg !important;
136
126
 
137
127
  input {
138
- background: @zaui-contract-bg;
128
+ background: transparent;
139
129
  }
140
130
  .@{ant-prefix}-select-selection-placeholder {
141
131
  z-index: 9;
@@ -147,8 +137,22 @@
147
137
  border-radius: 4px;
148
138
  }
149
139
 
150
- // 查看模式 修改容器样式
151
- .@{ant-prefix}-form-item-control-input-content > span, // 地址组件
140
+ // 地址组件
141
+ .@{ant-prefix}-form-item-control-input-content {
142
+ & > .pro-address {
143
+ .ant-select-selector,
144
+ .ant-input-affix-wrapper,
145
+ .ant-input-disabled {
146
+ background: @zaui-contract-bg;
147
+ }
148
+ }
149
+ & > .ant-input-group {
150
+ .forever-checkbox {
151
+ background: @zaui-contract-bg;
152
+ }
153
+ }
154
+ }
155
+
152
156
  .pro-form-view-container {
153
157
  padding: 4px 8px;
154
158
  background: @zaui-contract-bg;
@@ -6,5 +6,5 @@ interface TransformProps extends FormItemProps {
6
6
  namePath: any[];
7
7
  }
8
8
  type TransformFun = 'normalize' | 'getValueProps' | 'shouldUpdate' | 'name';
9
- declare const transformNames: (formItem: TransformProps, form: FormInstance, names: NamePath[], fieldName: string) => Pick<TransformProps, TransformFun>;
9
+ declare const transformNames: (formItem: TransformProps, form: FormInstance, names: NamePath[], fieldName: string, type?: string) => Pick<TransformProps, TransformFun>;
10
10
  export default transformNames;
@@ -1,16 +1,23 @@
1
- import { union } from 'lodash';
1
+ import { union, isNumber } from 'lodash';
2
2
  import { transformValue } from './transformValue';
3
- var transformNames = function transformNames(formItem, form, names, fieldName) {
3
+ var transformNames = function transformNames(formItem, form, names, fieldName, type) {
4
+ var _names2, _names3, _names3$;
4
5
  var _ref = formItem || {},
5
6
  normalize = _ref.normalize,
6
7
  getValueProps = _ref.getValueProps,
7
8
  _shouldUpdate2 = _ref.shouldUpdate;
8
- if (!(names === null || names === void 0 ? void 0 : names.length)) {
9
+ var _names = names;
10
+ if (!((_names2 = _names) === null || _names2 === void 0 ? void 0 : _names2.length)) {
9
11
  return {};
10
12
  }
11
13
  // 当在formList场景下,给transformValue函数的setFiledProps的name, 需要全namePath
12
14
  var _fieldName = Array.isArray(formItem === null || formItem === void 0 ? void 0 : formItem.name) ? union(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, formItem === null || formItem === void 0 ? void 0 : formItem.name) : fieldName;
13
- var _transformValue = transformValue(names, form, _fieldName, normalize, getValueProps),
15
+ if (type === 'Group' && isNumber((_names3 = _names) === null || _names3 === void 0 ? void 0 : (_names3$ = _names3[0]) === null || _names3$ === void 0 ? void 0 : _names3$[0])) {
16
+ _names = _names.map(function (item) {
17
+ return union(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, item);
18
+ });
19
+ }
20
+ var _transformValue = transformValue(_names, form, _fieldName, normalize, getValueProps),
14
21
  _normalize = _transformValue.normalize,
15
22
  _getValueProps = _transformValue.getValueProps,
16
23
  _shouldUpdate = _transformValue.shouldUpdate;