@zat-design/sisyphus-react 3.4.6 → 3.4.8

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 (109) hide show
  1. package/dist/index.esm.css +17 -1
  2. package/dist/less.esm.css +17 -1
  3. package/es/ProEditTable/components/RenderField/index.js +5 -8
  4. package/es/ProEditTable/style/index.less +5 -2
  5. package/es/ProForm/components/base/TextArea/index.d.ts +1 -0
  6. package/es/ProForm/components/base/TextArea/index.js +4 -2
  7. package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +1 -1
  8. package/es/ProForm/components/combination/FormList/index.js +2 -1
  9. package/es/ProForm/components/combination/FormList/propsType.d.ts +1 -1
  10. package/es/ProForm/components/combination/FormList/utils.js +2 -3
  11. package/es/ProForm/components/combination/{GroupCopy → Group}/component/ComRender.js +2 -2
  12. package/es/ProForm/components/combination/Group/index.d.ts +8 -2
  13. package/es/ProForm/components/combination/Group/index.js +58 -76
  14. package/es/ProForm/components/combination/Group/propsType.d.ts +27 -14
  15. package/es/ProForm/components/combination/Group/utils.d.ts +60 -7
  16. package/es/ProForm/components/combination/Group/utils.js +209 -19
  17. package/es/ProForm/components/combination/ProModalSelect/index.js +35 -29
  18. package/es/ProForm/components/combination/_Group/index.d.ts +4 -0
  19. package/es/ProForm/components/combination/_Group/index.js +109 -0
  20. package/es/ProForm/components/combination/_Group/propsType.d.ts +35 -0
  21. package/es/ProForm/components/combination/_Group/utils.d.ts +10 -0
  22. package/es/ProForm/components/combination/_Group/utils.js +46 -0
  23. package/es/ProForm/components/render/Render.js +8 -6
  24. package/es/ProForm/components/render/RenderFields.js +1 -0
  25. package/es/ProForm/components/render/propsType.d.ts +4 -3
  26. package/es/ProForm/propsType.d.ts +1 -0
  27. package/es/ProForm/style/index.less +7 -0
  28. package/es/ProForm/utils/diffOriginal.js +2 -1
  29. package/es/ProForm/utils/index.d.ts +6 -1
  30. package/es/ProForm/utils/index.js +5 -5
  31. package/es/ProForm/utils/transformNames.js +3 -10
  32. package/es/ProForm/utils/useDeepCompareMemo.d.ts +2 -0
  33. package/es/ProForm/utils/useDeepCompareMemo.js +14 -0
  34. package/es/ProForm/utils/useForm.js +2 -1
  35. package/es/ProForm/utils/useListChanged.js +2 -2
  36. package/es/ProForm/utils/useRules.js +2 -20
  37. package/es/ProSelect/index.js +14 -2
  38. package/es/ProSelect/propsType.d.ts +2 -0
  39. package/es/ProSelect/utils/index.d.ts +9 -0
  40. package/es/ProSelect/utils/index.js +60 -0
  41. package/es/ProTree/components/ProTreeSelect/index.js +3 -3
  42. package/es/ProTree/components/ProTreeSelect/style/index.less +6 -8
  43. package/es/ProTree/style/index.less +15 -0
  44. package/es/ProUpload/index.js +5 -6
  45. package/es/ProUpload/propsType.d.ts +1 -1
  46. package/es/global.less +40 -25
  47. package/es/locale/zh_CN.js +1 -1
  48. package/lib/ProEditTable/components/RenderField/index.js +5 -8
  49. package/lib/ProEditTable/style/index.less +5 -2
  50. package/lib/ProForm/components/base/TextArea/index.d.ts +1 -0
  51. package/lib/ProForm/components/base/TextArea/index.js +4 -2
  52. package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +1 -1
  53. package/lib/ProForm/components/combination/FormList/index.js +2 -1
  54. package/lib/ProForm/components/combination/FormList/propsType.d.ts +1 -1
  55. package/lib/ProForm/components/combination/FormList/utils.js +2 -3
  56. package/lib/ProForm/components/combination/{GroupCopy → Group}/component/ComRender.js +2 -2
  57. package/lib/ProForm/components/combination/Group/index.d.ts +8 -2
  58. package/lib/ProForm/components/combination/Group/index.js +57 -72
  59. package/lib/ProForm/components/combination/Group/propsType.d.ts +27 -14
  60. package/lib/ProForm/components/combination/Group/utils.d.ts +60 -7
  61. package/lib/ProForm/components/combination/Group/utils.js +210 -20
  62. package/lib/ProForm/components/combination/ProModalSelect/index.js +35 -29
  63. package/lib/ProForm/components/combination/_Group/index.d.ts +4 -0
  64. package/lib/ProForm/components/combination/_Group/index.js +113 -0
  65. package/lib/ProForm/components/combination/_Group/propsType.d.ts +35 -0
  66. package/lib/ProForm/components/combination/_Group/utils.d.ts +10 -0
  67. package/lib/ProForm/components/combination/_Group/utils.js +53 -0
  68. package/lib/ProForm/components/render/Render.js +7 -5
  69. package/lib/ProForm/components/render/RenderFields.js +1 -0
  70. package/lib/ProForm/components/render/propsType.d.ts +4 -3
  71. package/lib/ProForm/propsType.d.ts +1 -0
  72. package/lib/ProForm/style/index.less +7 -0
  73. package/lib/ProForm/utils/diffOriginal.js +2 -1
  74. package/lib/ProForm/utils/index.d.ts +6 -1
  75. package/lib/ProForm/utils/index.js +5 -5
  76. package/lib/ProForm/utils/transformNames.js +2 -9
  77. package/lib/ProForm/utils/useDeepCompareMemo.d.ts +2 -0
  78. package/lib/ProForm/utils/useDeepCompareMemo.js +20 -0
  79. package/lib/ProForm/utils/useForm.js +2 -1
  80. package/lib/ProForm/utils/useListChanged.js +1 -1
  81. package/lib/ProForm/utils/useRules.js +2 -20
  82. package/lib/ProSelect/index.js +14 -2
  83. package/lib/ProSelect/propsType.d.ts +2 -0
  84. package/lib/ProSelect/utils/index.d.ts +9 -0
  85. package/lib/ProSelect/utils/index.js +68 -0
  86. package/lib/ProTree/components/ProTreeSelect/index.js +3 -3
  87. package/lib/ProTree/components/ProTreeSelect/style/index.less +6 -8
  88. package/lib/ProTree/style/index.less +15 -0
  89. package/lib/ProUpload/index.js +5 -6
  90. package/lib/ProUpload/propsType.d.ts +1 -1
  91. package/lib/global.less +40 -25
  92. package/lib/locale/zh_CN.js +1 -1
  93. package/package.json +1 -1
  94. package/es/ProForm/components/combination/GroupCopy/index.d.ts +0 -10
  95. package/es/ProForm/components/combination/GroupCopy/index.js +0 -84
  96. package/es/ProForm/components/combination/GroupCopy/propsType.d.ts +0 -47
  97. package/es/ProForm/components/combination/GroupCopy/utils.d.ts +0 -53
  98. package/es/ProForm/components/combination/GroupCopy/utils.js +0 -180
  99. package/lib/ProForm/components/combination/GroupCopy/index.d.ts +0 -10
  100. package/lib/ProForm/components/combination/GroupCopy/index.js +0 -91
  101. package/lib/ProForm/components/combination/GroupCopy/propsType.d.ts +0 -47
  102. package/lib/ProForm/components/combination/GroupCopy/utils.d.ts +0 -53
  103. package/lib/ProForm/components/combination/GroupCopy/utils.js +0 -187
  104. /package/es/ProForm/components/combination/{GroupCopy → Group}/component/ComRender.d.ts +0 -0
  105. /package/es/ProForm/components/combination/{GroupCopy → _Group}/propsType.js +0 -0
  106. /package/es/ProForm/components/combination/{GroupCopy → _Group}/style/index.less +0 -0
  107. /package/lib/ProForm/components/combination/{GroupCopy → Group}/component/ComRender.d.ts +0 -0
  108. /package/lib/ProForm/components/combination/{GroupCopy → _Group}/propsType.js +0 -0
  109. /package/lib/ProForm/components/combination/{GroupCopy → _Group}/style/index.less +0 -0
@@ -2792,6 +2792,11 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2792
2792
  background: var(--zaui-contract-bg, #fffaa1);
2793
2793
  border-radius: 4px;
2794
2794
  }
2795
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > span {
2796
+ border-radius: 4px;
2797
+ padding: 5px 8px;
2798
+ background: var(--zaui-contract-bg, #fffaa1);
2799
+ }
2795
2800
  .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
2796
2801
  .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
2797
2802
  .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
@@ -3983,6 +3988,14 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3983
3988
  .pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-checkbox * {
3984
3989
  height: 16px !important;
3985
3990
  }
3991
+ .pro-tree-select .ant-select-selector .check-mark-icon,
3992
+ .pro-tree-select-drop-down-container .ant-select-selector .check-mark-icon {
3993
+ display: none;
3994
+ }
3995
+ .pro-tree-select.ant-select-dropdown .ant-select-tree-node-content-wrapper .check-mark-icon,
3996
+ .pro-tree-select-drop-down-container.ant-select-dropdown .ant-select-tree-node-content-wrapper .check-mark-icon {
3997
+ display: none;
3998
+ }
3986
3999
  .pro-drawer .pro-drawer-close {
3987
4000
  position: absolute;
3988
4001
  top: 6px;
@@ -4138,6 +4151,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
4138
4151
  -webkit-box-shadow: 3px 2px 12px 0px var(--zaui-shadow, rgba(56, 56, 56, 0.15));
4139
4152
  box-shadow: 3px 2px 12px 0px var(--zaui-shadow, rgba(56, 56, 56, 0.15));
4140
4153
  }
4154
+ .pro-edit-table td[rowspan] {
4155
+ vertical-align: middle !important;
4156
+ }
4141
4157
  .pro-edit-table .pro-edit-table-tooltip {
4142
4158
  display: -webkit-inline-box;
4143
4159
  display: -webkit-inline-flex;
@@ -4204,7 +4220,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
4204
4220
  display: -ms-flexbox;
4205
4221
  display: flex;
4206
4222
  }
4207
- .pro-edit-table .drag-wrapper .drag-icon {
4223
+ .pro-edit-table .drag-wrapper .anticon {
4208
4224
  margin-right: var(--zaui-space-size-md, 16px);
4209
4225
  margin-left: var(--zaui-space-size-xs, 4px);
4210
4226
  cursor: pointer;
package/dist/less.esm.css CHANGED
@@ -2792,6 +2792,11 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2792
2792
  background: var(--zaui-contract-bg, #fffaa1);
2793
2793
  border-radius: 4px;
2794
2794
  }
2795
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > span {
2796
+ border-radius: 4px;
2797
+ padding: 5px 8px;
2798
+ background: var(--zaui-contract-bg, #fffaa1);
2799
+ }
2795
2800
  .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
2796
2801
  .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
2797
2802
  .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
@@ -3983,6 +3988,14 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3983
3988
  .pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-checkbox * {
3984
3989
  height: 16px !important;
3985
3990
  }
3991
+ .pro-tree-select .ant-select-selector .check-mark-icon,
3992
+ .pro-tree-select-drop-down-container .ant-select-selector .check-mark-icon {
3993
+ display: none;
3994
+ }
3995
+ .pro-tree-select.ant-select-dropdown .ant-select-tree-node-content-wrapper .check-mark-icon,
3996
+ .pro-tree-select-drop-down-container.ant-select-dropdown .ant-select-tree-node-content-wrapper .check-mark-icon {
3997
+ display: none;
3998
+ }
3986
3999
  .pro-drawer .pro-drawer-close {
3987
4000
  position: absolute;
3988
4001
  top: 6px;
@@ -4138,6 +4151,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
4138
4151
  -webkit-box-shadow: 3px 2px 12px 0px var(--zaui-shadow, rgba(56, 56, 56, 0.15));
4139
4152
  box-shadow: 3px 2px 12px 0px var(--zaui-shadow, rgba(56, 56, 56, 0.15));
4140
4153
  }
4154
+ .pro-edit-table td[rowspan] {
4155
+ vertical-align: middle !important;
4156
+ }
4141
4157
  .pro-edit-table .pro-edit-table-tooltip {
4142
4158
  display: -webkit-inline-box;
4143
4159
  display: -webkit-inline-flex;
@@ -4204,7 +4220,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
4204
4220
  display: -ms-flexbox;
4205
4221
  display: flex;
4206
4222
  }
4207
- .pro-edit-table .drag-wrapper .drag-icon {
4223
+ .pro-edit-table .drag-wrapper .anticon {
4208
4224
  margin-right: var(--zaui-space-size-md, 16px);
4209
4225
  margin-left: var(--zaui-space-size-xs, 4px);
4210
4226
  cursor: pointer;
@@ -315,7 +315,7 @@ var RenderField = function RenderField(_ref) {
315
315
  }
316
316
  _args = [].concat(args);
317
317
  rowPath = [].concat(_toConsumableArray(namePath), [index]);
318
- row = type === 'Group' ? _args[1] : form.getFieldValue(rowPath, true);
318
+ row = form.getFieldValue(rowPath, true);
319
319
  orgRow = cloneDeep(row);
320
320
  if (!onFieldChange) {
321
321
  _context.next = 18;
@@ -360,7 +360,7 @@ var RenderField = function RenderField(_ref) {
360
360
  return onChange.apply(void 0, _toConsumableArray(_args));
361
361
  case 27:
362
362
  // 判断属性是否变动
363
- type !== 'Group' && form.setFieldValue(rowPath, row);
363
+ form.setFieldValue(rowPath, row);
364
364
  if (!isEqual(orgRow, row)) {
365
365
  diff = difference(row, orgRow) || {};
366
366
  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) {
@@ -406,7 +406,7 @@ var RenderField = function RenderField(_ref) {
406
406
  }
407
407
  _args = formatArgs([].concat(args));
408
408
  rowPath = [].concat(_toConsumableArray(namePath), [index]);
409
- row = type === 'Group' ? _args[1] : form.getFieldValue(rowPath, true);
409
+ row = type === form.getFieldValue(rowPath, true);
410
410
  orgRow = cloneDeep(row);
411
411
  _args[1] = row;
412
412
  _context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
@@ -491,16 +491,13 @@ var RenderField = function RenderField(_ref) {
491
491
  form: form,
492
492
  names: names,
493
493
  name: cellName,
494
+ listName: cellName,
494
495
  viewEmpty: viewEmpty,
495
496
  valueType: valueType,
496
497
  isView: isView
497
498
  }
498
499
  });
499
- if (type === 'Group') {
500
- componentProps.onFieldChange = _onchange;
501
- } else {
502
- componentProps = omit(componentProps, ['onFieldChange', 'namePath', 'index']);
503
- }
500
+ componentProps = omit(componentProps, ['onFieldChange', 'namePath', 'index']);
504
501
  // 单元格编辑时,设置各个单元格disabled属性
505
502
  if (isCell) {
506
503
  record["".concat(dataIndex, "-Disabled")] = _disabled;
@@ -2,6 +2,9 @@
2
2
  @import (reference) '~antd/es/style/themes/index.less';
3
3
 
4
4
  .pro-edit-table {
5
+ td[rowspan]{
6
+ vertical-align: middle !important;
7
+ }
5
8
  .pro-edit-table-tooltip {
6
9
  display : inline-flex;
7
10
  align-items: center;
@@ -62,7 +65,7 @@
62
65
 
63
66
  .drag-wrapper {
64
67
  display: flex;
65
- .drag-icon {
68
+ .anticon {
66
69
  margin-right: var(--zaui-space-size-md, 16px);
67
70
  margin-left: var(--zaui-space-size-xs, 4px);
68
71
  cursor: pointer;
@@ -137,7 +140,7 @@
137
140
  .@{ant-prefix}-table-cell-fix-left,
138
141
  .@{ant-prefix}-table-cell-fix-right {
139
142
  background-color: var(--zaui-table-header-bg, #f2f3f5);
140
-
143
+
141
144
  }
142
145
  }
143
146
 
@@ -5,6 +5,7 @@ import './index.less';
5
5
  export interface Props extends TextAreaProps {
6
6
  otherProps?: ProFormOtherProps;
7
7
  isView?: boolean;
8
+ tooltip?: boolean;
8
9
  }
9
10
  declare const TextAreaDef: React.FC<Props>;
10
11
  export default TextAreaDef;
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
4
  import "antd/es/input/style";
5
5
  import _Input from "antd/es/input";
6
- var _excluded = ["placeholder", "otherProps", "className"];
6
+ var _excluded = ["placeholder", "otherProps", "className", "tooltip"];
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { omit } from 'lodash';
9
9
  import classnames from 'classnames';
@@ -17,6 +17,8 @@ var TextAreaDef = function TextAreaDef(props) {
17
17
  var placeholder = props.placeholder,
18
18
  otherProps = props.otherProps,
19
19
  className = props.className,
20
+ _props$tooltip = props.tooltip,
21
+ tooltip = _props$tooltip === void 0 ? true : _props$tooltip,
20
22
  rest = _objectWithoutProperties(props, _excluded);
21
23
  var _ref = ProForm.useFieldProps() || {},
22
24
  label = _ref.label,
@@ -27,7 +29,7 @@ var TextAreaDef = function TextAreaDef(props) {
27
29
  if (isView) {
28
30
  return _jsx(Container, {
29
31
  nowrap: false,
30
- tooltip: true,
32
+ tooltip: tooltip,
31
33
  viewEmpty: viewEmpty,
32
34
  children: rest.value
33
35
  });
@@ -1,7 +1,7 @@
1
1
  import { ColProps, FormListFieldData } from 'antd';
2
2
  import React from 'react';
3
3
  import { InternalNamePath } from 'antd/es/form/interface';
4
- import type { levelType } from '@/ProLayout/components/ProCollapse/PropTypes';
4
+ import type { levelType } from '../../../../../ProLayout/components/ProCollapse/PropTypes';
5
5
  import type { FormListProps } from '../propsType';
6
6
  interface Props extends Omit<FormListProps, 'toolbarProps'> {
7
7
  index: number;
@@ -48,10 +48,11 @@ var FormList = function FormList(props, ref) {
48
48
  name: _name,
49
49
  names: (item === null || item === void 0 ? void 0 : item.names) ? item.names.map(function (nameItem) {
50
50
  // 传给Group的names会被渲染成真实FormItem 不能传完整name
51
- return item.type === 'Group' ? [fieldName].concat(_toConsumableArray(toArray(nameItem))) : [].concat(_toConsumableArray(namePath), _toConsumableArray(toArray(nameItem)));
51
+ return [].concat(_toConsumableArray(namePath), _toConsumableArray(toArray(nameItem)));
52
52
  }) : item.names,
53
53
  index: fieldName,
54
54
  namePath: namePath,
55
+ listName: [].concat(_toConsumableArray(namePath), [item.name]),
55
56
  label: mode === 'less' ? undefined : item.label
56
57
  });
57
58
  return column;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { FormInstance } from 'antd/es/form/Form';
3
3
  import type { ButtonProps, FormListFieldData, FormListOperation, PopconfirmProps } from 'antd';
4
4
  import type { InternalNamePath } from 'antd/es/form/interface';
5
- import type { levelType } from '@/ProLayout/components/ProCollapse/PropTypes';
5
+ import type { levelType } from '../../../../ProLayout/components/ProCollapse/PropTypes';
6
6
  import type { ProColumnProps, ProFormOtherProps } from '../../../propsType';
7
7
  export type TitleRender = (record: Record<string, any>, index: number, form: FormInstance) => any;
8
8
  export type TitleType = string | React.ReactNode | TitleRender;
@@ -8,12 +8,11 @@ export var namesPathTransform = function namesPathTransform(_ref) {
8
8
  var names = _ref.names,
9
9
  prefixNamePath = _ref.prefixNamePath,
10
10
  type = _ref.type;
11
- if (!Array.isArray(names) || type !== 'Group' && !Array.isArray(prefixNamePath)) {
11
+ if (!Array.isArray(names) || !Array.isArray(prefixNamePath)) {
12
12
  return '';
13
13
  }
14
- var _prefixNamePath = type === 'Group' ? '' : prefixNamePath;
15
14
  var newNamePath = names.map(function (val) {
16
- return _prefixNamePath.concat(val);
15
+ return prefixNamePath.concat(val);
17
16
  });
18
17
  return newNamePath === null || newNamePath === void 0 ? void 0 : newNamePath.map(function (name) {
19
18
  return Array.isArray(name) ? name.join('_') : name;
@@ -3,8 +3,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps"];
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import React from 'react';
6
- import ConfirmWrapper from '@/ProForm/components/render/ConfirmWrapper';
7
- import { FieldProvider } from '@/ProForm/utils/useFieldProps';
6
+ import ConfirmWrapper from '../../../../components/render/ConfirmWrapper';
7
+ import { FieldProvider } from '../../../../utils/useFieldProps';
8
8
  import * as componentMap from '../../../../../index';
9
9
  /** 渲染组件 */
10
10
  var ComRender = function ComRender(props) {
@@ -1,4 +1,10 @@
1
1
  import React from 'react';
2
2
  import { GroupProps } from './propsType';
3
- declare const Group: React.FC<GroupProps>;
4
- export default Group;
3
+ /**
4
+ * 1. 外层过滤FormItem相关属性, 但是子元素上的 required [disabled] [show] rules [fieldProps] [component] 需要取到并
5
+ * 2.
6
+ *
7
+ * render内部能力 show, component, value, onChange, disabled, clearNotShow, fieldProps
8
+ */
9
+ declare const GroupCopy: React.FC<GroupProps>;
10
+ export default GroupCopy;
@@ -1,61 +1,60 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import "antd/es/space/style";
2
3
  import _Space from "antd/es/space";
3
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
- import "antd/es/button/style";
5
- import _Button from "antd/es/button";
6
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
8
- import { useMemo } from 'react';
9
- import { omit, isFunction, union, isNumber } from 'lodash';
10
- import { useDeepCompareEffect } from 'ahooks';
7
+ import React, { useMemo } from 'react';
8
+ import { omit } from 'lodash';
11
9
  import classnames from 'classnames';
12
- import RenderFields from '../../render/RenderFields';
13
- import { insertSeparator, transformNamesString } from './utils';
10
+ import { insertSeparator, transformColumns } from './utils';
14
11
  import ProForm from '../../../../ProForm';
15
- var Group = function Group(props) {
16
- var columns = props.children,
17
- otherProps = props.otherProps,
12
+ import ComRender from './component/ComRender';
13
+ /**
14
+ * 1. 外层过滤FormItem相关属性, 但是子元素上的 required [disabled] [show] rules [fieldProps] [component] 需要取到并
15
+ * 2.
16
+ *
17
+ * render内部能力 show, component, value, onChange, disabled, clearNotShow, fieldProps
18
+ */
19
+ var GroupCopy = function GroupCopy(props) {
20
+ var children = props.children,
18
21
  className = props.className,
19
22
  _props$space = props.space,
20
23
  space = _props$space === void 0 ? {
21
24
  size: 12
22
25
  } : _props$space,
23
- id = props.id,
24
26
  value = props.value,
25
- isView = props.isView,
26
- index = props.index,
27
- onFieldChange = props.onFieldChange,
28
- namePath = props.namePath;
29
- var _ref = ProForm.useFieldProps() || {},
30
- names = _ref.names,
31
- name = _ref.name,
32
- form = _ref.form,
33
- _namePath = _ref.namePath;
34
- var newNamePath = namePath || _namePath || [];
35
- if (!Array.isArray(names)) {
36
- console.error('Warning: Composite form components whose type is Group must be configured with names');
37
- }
38
- var data = useMemo(function () {
39
- var fieldList = [];
40
- var result = columns.map(function (item) {
41
- return _objectSpread(_objectSpread({
42
- disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
43
- }, item), {}, {
44
- isView: isView !== null && isView !== void 0 ? isView : item.isView,
45
- noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
46
- parentNames: id,
47
- namePath: newNamePath
48
- });
49
- });
50
- var node = _jsx(_Button, {
51
- className: "group-separator",
52
- children: space.separator
27
+ onChange = props.onChange,
28
+ otherProps = props.otherProps,
29
+ disabled = props.disabled;
30
+ var contextProps = ProForm.useFieldProps() || {};
31
+ var names = contextProps.names,
32
+ name = contextProps.name,
33
+ form = contextProps.form,
34
+ namePath = contextProps.namePath,
35
+ index = contextProps.index;
36
+ var _option = React.useRef([]);
37
+ // 组合onChange
38
+ var handleChange = function handleChange(value, option, index) {
39
+ var _value = props.value ? _toConsumableArray(props.value) : [];
40
+ _value[index] = value;
41
+ _option.current[index] = option;
42
+ onChange(_value, _option.current);
43
+ };
44
+ var columns = useMemo(function () {
45
+ var columnsProps = transformColumns({
46
+ columns: children,
47
+ name: name,
48
+ names: names,
49
+ onChange: handleChange,
50
+ namePath: namePath,
51
+ form: form,
52
+ index: index,
53
+ value: value,
54
+ groupProps: props
53
55
  });
54
- return {
55
- columns: insertSeparator(result, space, node, otherProps),
56
- fieldList: fieldList
57
- };
58
- }, [name, columns, space, props, names]);
56
+ return insertSeparator(columnsProps, space);
57
+ }, [name, value, children, space, names, namePath, index]);
59
58
  var _className = classnames(_defineProperty({
60
59
  'pro-group': true,
61
60
  'pro-group-diy-width': columns.some(function (item) {
@@ -66,44 +65,27 @@ var Group = function Group(props) {
66
65
  return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
67
66
  })
68
67
  }, "".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
- });
76
- useDeepCompareEffect(function () {
77
- var _document, _document$activeEleme;
78
- // 焦点激活的表单
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) || '';
80
- // 模拟change,初始化不执行onFieldChange
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
86
- });
87
- }
88
- }, [value]);
89
- var _otherProps = omit(otherProps, ['colProps', 'required']);
90
68
  return _jsx("div", {
91
69
  className: _className,
92
70
  children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
93
- children: _jsx(RenderFields, _objectSpread({
94
- columns: data.columns,
95
- form: form
96
- }, _otherProps))
71
+ children: columns.map(function (column) {
72
+ return _jsx(ComRender, _objectSpread(_objectSpread({
73
+ contextProps: contextProps
74
+ }, column), {}, {
75
+ otherProps: otherProps
76
+ }));
77
+ })
97
78
  }) : _jsx(_Space, _objectSpread(_objectSpread({
98
79
  align: "start"
99
80
  }, omit(space, ['separator', 'compact'])), {}, {
100
- children: data.columns.map(function (column, index) {
101
- return _jsx(RenderFields, _objectSpread({
102
- columns: [column],
103
- form: form
104
- }, _otherProps), (column === null || column === void 0 ? void 0 : column.name) || index);
81
+ children: columns.map(function (column, index) {
82
+ return _jsx(ComRender, _objectSpread(_objectSpread({
83
+ contextProps: contextProps
84
+ }, column), {}, {
85
+ otherProps: otherProps
86
+ }));
105
87
  })
106
88
  }))
107
89
  });
108
90
  };
109
- export default Group;
91
+ export default GroupCopy;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { RowProps, SpaceProps } from 'antd';
2
+ import { FormItemProps, ModalFuncProps, SpaceProps } from 'antd';
3
3
  import { FormInstance } from 'antd/es/form/Form';
4
4
  import { NamePath } from 'antd/lib/form/interface';
5
- import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
5
+ import { ColumnPropsMap, FunctionArgs, ProFormValueType, ReactiveFunction, ViewType } from '../../../propsType';
6
6
  export interface SpaceType extends SpaceProps {
7
7
  /**
8
8
  * 是否紧凑合并
@@ -16,20 +16,33 @@ export interface SpaceType extends SpaceProps {
16
16
  size?: number;
17
17
  }
18
18
  export interface GroupProps {
19
- children?: ProColumnProps[];
19
+ children?: GroupColumnProps[];
20
20
  space?: SpaceType;
21
- otherProps?: ProFormOtherProps;
22
- rowProps?: RowProps;
23
21
  className?: string;
24
- value?: any;
25
22
  id?: string;
26
- disabled?: boolean | (() => void);
23
+ disabled?: boolean;
27
24
  isView?: boolean;
28
- namePath?: NamePath;
29
- index?: number;
30
- onFieldChange?: (value: any[] | null, record: any, { form, }: {
31
- form: FormInstance;
32
- namePath?: NamePath;
33
- index?: number;
34
- }) => any;
25
+ value?: any[];
26
+ onChange?: (value: any[] | null, options?: any[]) => void;
27
+ otherProps?: any;
35
28
  }
29
+ export type GroupColumnProps<Values = any> = {
30
+ component?: React.ReactNode | ReactiveFunction<Values, React.ReactNode>;
31
+ names?: NamePath[];
32
+ show?: boolean | ReactiveFunction<Values, boolean>;
33
+ valueType?: ProFormValueType;
34
+ switchValue?: [any, any];
35
+ isView?: boolean;
36
+ viewRender?: (value: any, record: Values, { form, index, namePath, }: {
37
+ form: FormInstance<Values>;
38
+ index?: number | undefined;
39
+ [key: string]: any;
40
+ }) => React.ReactElement<any, any> | string | undefined | null;
41
+ viewType?: ViewType;
42
+ disabled?: boolean | ReactiveFunction<Values, boolean>;
43
+ trim?: boolean;
44
+ upperCase?: boolean;
45
+ toISOString?: boolean;
46
+ clearNotShow?: boolean;
47
+ confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps>;
48
+ } & ColumnPropsMap & FormItemProps;
@@ -1,10 +1,63 @@
1
- import { ReactNode } from 'react';
2
- import { SpaceType } from './propsType';
1
+ /// <reference types="react" />
2
+ import { InternalNamePath, NamePath } from 'antd/lib/form/interface';
3
+ import { FormInstance } from 'antd';
4
+ import { GroupColumnProps, GroupProps, SpaceType } from './propsType';
5
+ import { ProFormColumnProps, ReactiveFunction } from '../../render/propsType';
6
+ export type EventArgs = any[];
3
7
  /**
4
- * 插入间隔符
5
- * @param columns 表单配置数组
6
- * @returns
7
- */
8
- export declare const insertSeparator: (columns: any, space?: SpaceType, separatorNode?: ReactNode, otherProps?: any) => any;
8
+ * 插入间隔符
9
+ * @param columns 表单配置数组
10
+ * @returns
11
+ */
12
+ export declare const insertSeparator: (columns: GroupColumnProps[], space?: SpaceType) => any[];
13
+ /** 带出event的组件默认取值方法 */
14
+ export declare function defaultGetValueFromEvent(valuePropName: string, ...args: EventArgs): any;
9
15
  /** 转换names */
10
16
  export declare const transformNamesString: (arr: (string | string[])[]) => (string | string[])[];
17
+ /**
18
+ * Input TextArea 小写自动转大写
19
+ * @param type 组件类型
20
+ * @param upperCase 是否小写转大写
21
+ * @returns {}
22
+ */
23
+ export declare const isUpperCase: (type: string, upperCase: boolean) => any;
24
+ interface Params {
25
+ form?: FormInstance;
26
+ index?: number;
27
+ type?: string;
28
+ namePath?: InternalNamePath;
29
+ disabled?: boolean | ReactiveFunction<any, boolean>;
30
+ show?: boolean | ReactiveFunction<any, boolean>;
31
+ component?: React.ReactNode | ReactiveFunction<any, React.ReactNode>;
32
+ fieldProps?: boolean | ReactiveFunction<any, boolean>;
33
+ name?: NamePath;
34
+ }
35
+ /** 计算响应式参数的值 */
36
+ export declare const getReactiveProps: (params: Params) => {
37
+ disabled: boolean;
38
+ show: boolean;
39
+ component: any;
40
+ fieldProps: boolean;
41
+ };
42
+ type ValueTypeGetterParams = Pick<ProFormColumnProps, 'valueType' | 'switchValue' | 'toISOString'> & {
43
+ type?: any;
44
+ mode?: string;
45
+ };
46
+ /** 获取当前字段的转换函数 */
47
+ export declare const getValueTypeTrans: (params: ValueTypeGetterParams) => any;
48
+ /** 执行所有中间件 返回处理后的值 */
49
+ export declare const getValueMiddleware: (value: any, callbacks?: any[]) => any;
50
+ interface ColumnsTransformerParams {
51
+ columns: GroupColumnProps[];
52
+ name?: NamePath;
53
+ names?: NamePath[];
54
+ value?: any[];
55
+ onChange: any;
56
+ namePath?: InternalNamePath;
57
+ form: FormInstance;
58
+ index?: number;
59
+ groupProps: GroupProps;
60
+ }
61
+ /** 转换columns */
62
+ export declare const transformColumns: (params: ColumnsTransformerParams) => any[];
63
+ export {};