@zat-design/sisyphus-react 4.0.0-beta.7 → 4.0.0-beta.9

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 (61) hide show
  1. package/dist/index.esm.css +1 -1
  2. package/dist/less.esm.css +1 -1
  3. package/es/ProEditTable/components/RcTable/DraggableTable.js +5 -3
  4. package/es/ProEditTable/components/RenderField/index.js +44 -9
  5. package/es/ProEditTable/index.js +11 -9
  6. package/es/ProEditTable/propsType.d.ts +6 -0
  7. package/es/ProEditTable/style/index.less +9 -3
  8. package/es/ProEditTable/utils/useShouldUpdateForTable.d.ts +15 -0
  9. package/es/ProEditTable/utils/useShouldUpdateForTable.js +132 -0
  10. package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  11. package/es/ProForm/components/combination/FormList/components/ActionButton.js +84 -3
  12. package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  13. package/es/ProForm/components/combination/FormList/components/BlockFields.js +63 -6
  14. package/es/ProForm/components/combination/FormList/components/Empty.js +11 -2
  15. package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
  16. package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  17. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +38 -9
  18. package/es/ProForm/components/combination/FormList/index.js +67 -57
  19. package/es/ProForm/components/combination/FormList/propsType.d.ts +7 -2
  20. package/es/ProForm/components/combination/FormList/style/index.less +41 -0
  21. package/es/ProForm/components/render/RenderFields.js +2 -1
  22. package/es/ProForm/index.js +1 -1
  23. package/es/ProForm/propsType.d.ts +1 -0
  24. package/es/ProForm/utils/useShouldUpdate.js +1 -2
  25. package/es/ProForm/utils/useWatch.js +3 -3
  26. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +19 -9
  27. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +6 -8
  28. package/es/ProLayout/components/ProHeader/index.js +19 -15
  29. package/es/ProTable/hooks/useAntdTable.js +52 -29
  30. package/es/ProTabs/style/index.less +5 -1
  31. package/es/utils/index.js +13 -1
  32. package/lib/ProEditTable/components/RcTable/DraggableTable.js +5 -3
  33. package/lib/ProEditTable/components/RenderField/index.js +44 -9
  34. package/lib/ProEditTable/index.js +11 -9
  35. package/lib/ProEditTable/propsType.d.ts +6 -0
  36. package/lib/ProEditTable/style/index.less +9 -3
  37. package/lib/ProEditTable/utils/useShouldUpdateForTable.d.ts +15 -0
  38. package/lib/ProEditTable/utils/useShouldUpdateForTable.js +139 -0
  39. package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  40. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +84 -3
  41. package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  42. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +62 -6
  43. package/lib/ProForm/components/combination/FormList/components/Empty.js +11 -2
  44. package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
  45. package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  46. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +38 -9
  47. package/lib/ProForm/components/combination/FormList/index.js +67 -57
  48. package/lib/ProForm/components/combination/FormList/propsType.d.ts +7 -2
  49. package/lib/ProForm/components/combination/FormList/style/index.less +41 -0
  50. package/lib/ProForm/components/render/RenderFields.js +2 -1
  51. package/lib/ProForm/index.js +1 -1
  52. package/lib/ProForm/propsType.d.ts +1 -0
  53. package/lib/ProForm/utils/useShouldUpdate.js +1 -2
  54. package/lib/ProForm/utils/useWatch.js +3 -3
  55. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +18 -8
  56. package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +5 -7
  57. package/lib/ProLayout/components/ProHeader/index.js +19 -15
  58. package/lib/ProTable/hooks/useAntdTable.js +52 -29
  59. package/lib/ProTabs/style/index.less +5 -1
  60. package/lib/utils/index.js +13 -1
  61. package/package.json +3 -4
@@ -119,7 +119,8 @@ var ActionButton = props => {
119
119
  min = props.min,
120
120
  max = props.max,
121
121
  mode = props.mode,
122
- isView = props.isView;
122
+ isView = props.isView,
123
+ hideStartEndActionProps = props.hideStartEndActionProps;
123
124
 
124
125
  // 默认显示一个delete
125
126
  var actionProps = (0, _react.useMemo)(() => {
@@ -187,6 +188,10 @@ var ActionButton = props => {
187
188
  });
188
189
  };
189
190
  var defaultActions = (0, _react.useMemo)(() => getDefaultActions(mode), [mode]);
191
+
192
+ // 整体隐藏首尾 ActionButton
193
+ if (hideStartEndActionProps !== null && hideStartEndActionProps !== void 0 && hideStartEndActionProps[0] && index === 0) return null;
194
+ if (hideStartEndActionProps !== null && hideStartEndActionProps !== void 0 && hideStartEndActionProps[1] && index === fields.length - 1) return null;
190
195
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Space, {
191
196
  align: "start",
192
197
  className: "pro-form-list-action",
@@ -235,11 +240,83 @@ var ActionButton = props => {
235
240
  if (index + 1 === fields.length && type === 'moveDown') {
236
241
  return false;
237
242
  }
243
+
244
+ // 移动限制:防止将项移动到隐藏的首尾位置
245
+ if (hideStartEndActionProps !== null && hideStartEndActionProps !== void 0 && hideStartEndActionProps[0] && index === 1 && ['moveUp'].includes(type)) {
246
+ return false;
247
+ }
248
+ if (hideStartEndActionProps !== null && hideStartEndActionProps !== void 0 && hideStartEndActionProps[1] && index === fields.length - 2 && type === 'moveDown') {
249
+ return false;
250
+ }
251
+
252
+ // 处理 add 操作的插入位置
253
+ var handleAddClick = /*#__PURE__*/function () {
254
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
255
+ var value, data, insertIndex, _insertIndex;
256
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
257
+ while (1) switch (_context2.prev = _context2.next) {
258
+ case 0:
259
+ value = form.getFieldValue(namePath);
260
+ _context2.next = 3;
261
+ return _onClick === null || _onClick === void 0 ? void 0 : _onClick(value, {
262
+ namePath,
263
+ index,
264
+ operation,
265
+ form
266
+ });
267
+ case 3:
268
+ data = _context2.sent;
269
+ if (!(!_onClick || data === true)) {
270
+ _context2.next = 7;
271
+ break;
272
+ }
273
+ // 如果有 addIndex 配置,使用它计算插入位置
274
+ if (item.addIndex) {
275
+ insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
276
+ index,
277
+ namePath,
278
+ form,
279
+ operation
280
+ }) : item.addIndex;
281
+ operation.add(data, insertIndex);
282
+ } else {
283
+ operation.add(data, index + 1); // 默认插入到下一位置
284
+ }
285
+ return _context2.abrupt("return");
286
+ case 7:
287
+ if ((item === null || item === void 0 ? void 0 : item.type) === 'add') {
288
+ // 如果有 addIndex 配置,使用它计算插入位置
289
+ if (item.addIndex) {
290
+ _insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
291
+ index,
292
+ namePath,
293
+ form,
294
+ operation
295
+ }) : item.addIndex;
296
+ operation.add(data, _insertIndex);
297
+ } else {
298
+ operation.add(data, index + 1); // 默认插入到下一位置
299
+ }
300
+ }
301
+ case 8:
302
+ case "end":
303
+ return _context2.stop();
304
+ }
305
+ }, _callee2);
306
+ }));
307
+ return function handleAddClick() {
308
+ return _ref7.apply(this, arguments);
309
+ };
310
+ }();
238
311
  return _needConfirm ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Popconfirm, (0, _objectSpread2.default)((0, _objectSpread2.default)({
239
312
  title: title !== null && title !== void 0 ? title : `${_locale.default.ProForm.formListConfirmMessage}`,
240
313
  onCancel: e => e.stopPropagation(),
241
314
  onConfirm: e => {
242
- handleClick(internalOnClick, _onClick, index, item);
315
+ if (type === 'add') {
316
+ handleAddClick();
317
+ } else {
318
+ handleClick(internalOnClick, _onClick, index, item);
319
+ }
243
320
  }
244
321
  }, _confirmProps), {}, {
245
322
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultRest), (0, _lodash.omit)(rest, filterKeys)), {}, {
@@ -257,7 +334,11 @@ var ActionButton = props => {
257
334
  type: "text",
258
335
  onClick: e => {
259
336
  e.stopPropagation();
260
- handleClick(internalOnClick, _onClick, index, item);
337
+ if (type === 'add') {
338
+ handleAddClick();
339
+ } else {
340
+ handleClick(internalOnClick, _onClick, index, item);
341
+ }
261
342
  },
262
343
  children: label || defaultLabel
263
344
  }), `${item === null || item === void 0 ? void 0 : item.type}${index}`);
@@ -16,6 +16,8 @@ interface Props extends Omit<FormListType, 'toolbarProps'> {
16
16
  level?: levelType;
17
17
  towCollapse?: boolean;
18
18
  diffConfig?: DiffConfigType;
19
+ hideStartEndActionProps?: [boolean, boolean];
20
+ titlePosition?: 'top' | 'left';
19
21
  }
20
22
  declare const BlockFields: React.FC<Props>;
21
23
  export default BlockFields;
@@ -36,7 +36,9 @@ var BlockFields = props => {
36
36
  level = _props$level === void 0 ? '2' : _props$level,
37
37
  towCollapse = props.towCollapse,
38
38
  id = props.id,
39
- diffConfig = props.diffConfig;
39
+ diffConfig = props.diffConfig,
40
+ hideStartEndActionProps = props.hideStartEndActionProps,
41
+ titlePosition = props.titlePosition;
40
42
  var _title = (0, _react.useMemo)(() => {
41
43
  if ((0, _lodash.isFunction)(title)) {
42
44
  var record = form.getFieldValue(namePath);
@@ -45,8 +47,63 @@ var BlockFields = props => {
45
47
  return title;
46
48
  }, [title, index]);
47
49
  var cls = (0, _classnames.default)({
48
- [`pro-form-list-mode-${mode}`]: mode === 'block' || mode === 'line' || mode === 'less'
50
+ [`pro-form-list-mode-${mode}`]: mode === 'block' || mode === 'line' || mode === 'less',
51
+ 'pro-form-list-title-left': titlePosition === 'left'
49
52
  });
53
+
54
+ // 左侧标题布局
55
+ if (titlePosition === 'left') {
56
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Space, {
57
+ direction: "vertical",
58
+ className: cls,
59
+ id: id,
60
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
61
+ className: "pro-form-list-left-title-wrapper",
62
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
63
+ className: "pro-form-list-left-title",
64
+ children: _title
65
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
66
+ className: "pro-form-list-left-content",
67
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProCollapse.default, {
68
+ title: _title,
69
+ index: index,
70
+ form: form,
71
+ level: level,
72
+ towCollapse: towCollapse,
73
+ extra: actionProps !== false && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
74
+ min: min,
75
+ max: max,
76
+ index: index,
77
+ length: fields.length,
78
+ operation: operation,
79
+ namePath: namePath,
80
+ form: form,
81
+ field: field,
82
+ fields: fields,
83
+ actionProps: actionProps,
84
+ mode: mode,
85
+ disabled: disabled,
86
+ isView: isView,
87
+ hideStartEndActionProps: hideStartEndActionProps
88
+ }),
89
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Row, {
90
+ gutter: 24,
91
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(MemoRenderFields, {
92
+ columns: columns,
93
+ form: form,
94
+ colProps: colProps,
95
+ disabled: disabled,
96
+ isView: isView,
97
+ diffConfig: diffConfig
98
+ })
99
+ }, field.key)
100
+ })
101
+ })]
102
+ })
103
+ });
104
+ }
105
+
106
+ // 默认顶部标题布局
50
107
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Space, {
51
108
  direction: "vertical",
52
109
  className: cls,
@@ -54,9 +111,7 @@ var BlockFields = props => {
54
111
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProCollapse.default, {
55
112
  title: _title,
56
113
  index: index,
57
- form: form
58
- // namePath={namePath}
59
- ,
114
+ form: form,
60
115
  level: level,
61
116
  towCollapse: towCollapse,
62
117
  extra: actionProps !== false && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
@@ -72,7 +127,8 @@ var BlockFields = props => {
72
127
  actionProps: actionProps,
73
128
  mode: mode,
74
129
  disabled: disabled,
75
- isView: isView
130
+ isView: isView,
131
+ hideStartEndActionProps: hideStartEndActionProps
76
132
  }),
77
133
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Row, {
78
134
  gutter: 24,
@@ -8,6 +8,7 @@ exports.default = void 0;
8
8
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _antd = require("antd");
11
+ var _lodash = require("lodash");
11
12
  var _empty = _interopRequireDefault(require("../../../../../assets/empty.png"));
12
13
  var _locale = _interopRequireDefault(require("../../../../../locale"));
13
14
  var _jsxRuntime = require("react/jsx-runtime");
@@ -39,7 +40,8 @@ var Empty = _ref => {
39
40
  return addConfig === null || addConfig === void 0 || (_addConfig$onClick = addConfig.onClick) === null || _addConfig$onClick === void 0 ? void 0 : _addConfig$onClick.call(addConfig, value, {
40
41
  operation,
41
42
  form,
42
- namePath
43
+ namePath,
44
+ index: 0
43
45
  });
44
46
  case 5:
45
47
  data = _context.sent;
@@ -68,6 +70,13 @@ var Empty = _ref => {
68
70
  var getBtnText = () => {
69
71
  return emptyBtnText || (addConfig === null || addConfig === void 0 ? void 0 : addConfig.label) || _locale.default.ProForm.formListActions[6];
70
72
  };
73
+ var show = true;
74
+ if ((addConfig === null || addConfig === void 0 ? void 0 : addConfig.show) !== undefined) {
75
+ show = (0, _lodash.isFunction)(addConfig.show) ? addConfig.show(form.getFieldValue(namePath), {
76
+ namePath,
77
+ form
78
+ }) : !!addConfig.show;
79
+ }
71
80
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
72
81
  className: "pro-form-list-empty",
73
82
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
@@ -76,7 +85,7 @@ var Empty = _ref => {
76
85
  alt: "Empty"
77
86
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
78
87
  className: "pro-form-list-empty-content",
79
- children: disabled ? _locale.default.ProForm.noData : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
88
+ children: disabled || !show ? _locale.default.ProForm.noData : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
80
89
  children: [_locale.default.ProForm.noData, !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
81
90
  children: ["\uFF0C", /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
82
91
  type: "link",
@@ -14,6 +14,7 @@ interface Props extends Omit<FormListType, 'toolbarProps'> {
14
14
  key: string;
15
15
  };
16
16
  diffConfig?: DiffConfigType;
17
+ hideStartEndActionProps?: [boolean, boolean];
17
18
  }
18
19
  declare const LineFields: React.FC<Props>;
19
20
  export default LineFields;
@@ -35,7 +35,8 @@ var LineFields = props => {
35
35
  draggable = props.draggable,
36
36
  className = props.className,
37
37
  id = props.id,
38
- diffConfig = props.diffConfig;
38
+ diffConfig = props.diffConfig,
39
+ hideStartEndActionProps = props.hideStartEndActionProps;
39
40
  var isLess = mode === 'less';
40
41
  var _useSortable = (0, _sortable.useSortable)({
41
42
  id: field.key,
@@ -93,7 +94,8 @@ var LineFields = props => {
93
94
  fields: fields,
94
95
  actionProps: actionProps,
95
96
  mode: mode,
96
- disabled: disabled
97
+ disabled: disabled,
98
+ hideStartEndActionProps: hideStartEndActionProps
97
99
  })]
98
100
  });
99
101
  };
@@ -62,7 +62,7 @@ var ToolbarButton = props => {
62
62
  }, [props.toolbarProps]);
63
63
  var handleClick = /*#__PURE__*/function () {
64
64
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, item) {
65
- var value, data;
65
+ var value, data, insertIndex, _insertIndex;
66
66
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
67
67
  while (1) switch (_context.prev = _context.next) {
68
68
  case 0:
@@ -71,7 +71,8 @@ var ToolbarButton = props => {
71
71
  return callback === null || callback === void 0 ? void 0 : callback(value, {
72
72
  operation,
73
73
  form,
74
- namePath
74
+ namePath,
75
+ index: (value === null || value === void 0 ? void 0 : value.length) || 0
75
76
  });
76
77
  case 3:
77
78
  data = _context.sent;
@@ -79,15 +80,42 @@ var ToolbarButton = props => {
79
80
  _context.next = 7;
80
81
  break;
81
82
  }
82
- defaultCallback === null || defaultCallback === void 0 || defaultCallback(value, {
83
- operation,
84
- form,
85
- namePath
86
- });
83
+ if ((item === null || item === void 0 ? void 0 : item.type) === 'add') {
84
+ // 如果有 addIndex 配置,使用它计算插入位置
85
+ if (item.addIndex) {
86
+ insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
87
+ namePath,
88
+ form,
89
+ operation,
90
+ index: (value === null || value === void 0 ? void 0 : value.length) || 0
91
+ }) : item.addIndex;
92
+ operation.add(data, insertIndex);
93
+ } else {
94
+ operation.add(data); // 默认插入到末尾
95
+ }
96
+ } else {
97
+ defaultCallback === null || defaultCallback === void 0 || defaultCallback(value, {
98
+ operation,
99
+ form,
100
+ namePath,
101
+ index: (value === null || value === void 0 ? void 0 : value.length) || 0
102
+ });
103
+ }
87
104
  return _context.abrupt("return");
88
105
  case 7:
89
106
  if ((item === null || item === void 0 ? void 0 : item.type) === 'add' && data) {
90
- operation.add(data);
107
+ // 如果有 addIndex 配置,使用它计算插入位置
108
+ if (item.addIndex) {
109
+ _insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
110
+ namePath,
111
+ form,
112
+ operation,
113
+ index: (value === null || value === void 0 ? void 0 : value.length) || 0
114
+ }) : item.addIndex;
115
+ operation.add(data, _insertIndex);
116
+ } else {
117
+ operation.add(data); // 默认插入到末尾
118
+ }
91
119
  }
92
120
  case 8:
93
121
  case "end":
@@ -104,7 +132,8 @@ var ToolbarButton = props => {
104
132
  callback === null || callback === void 0 || callback(value, {
105
133
  operation,
106
134
  form,
107
- namePath
135
+ namePath,
136
+ index: 0
108
137
  });
109
138
  };
110
139
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Space, {
@@ -34,7 +34,10 @@ var FormList = (props, ref) => {
34
34
  _props$span = props.span,
35
35
  span = _props$span === void 0 ? 8 : _props$span,
36
36
  disabled = props.disabled,
37
- emptyBtnText = props.emptyBtnText;
37
+ emptyBtnText = props.emptyBtnText,
38
+ hideStartEndActionProps = props.hideStartEndActionProps,
39
+ titlePosition = props.titlePosition,
40
+ className = props.className;
38
41
  var _fields = fields.map(item => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
39
42
  key: String(item.key)
40
43
  }));
@@ -42,11 +45,12 @@ var FormList = (props, ref) => {
42
45
  form = _ref.form,
43
46
  name = _ref.name,
44
47
  isView = _ref.isView,
45
- diffConfig = _ref.diffConfig;
48
+ diffConfig = _ref.diffConfig,
49
+ namePath = _ref.namePath;
46
50
  var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
47
51
  isDiffAll = _useProConfig.isDiffAll;
48
52
  var errors = meta.errors;
49
- var _namePath = (0, _utils.toArray)(name);
53
+ var _namePath = namePath ? [...namePath.slice(0, -1), ...(0, _utils.toArray)(name)] : (0, _utils.toArray)(name);
50
54
  var orgValues = (0, _lodash.get)(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
51
55
  var _diffConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, diffConfig), {}, {
52
56
  originalValues: diffConfig !== null && diffConfig !== void 0 && diffConfig.originalValues && isDiffAll ? orgValues || [] : orgValues
@@ -87,65 +91,71 @@ var FormList = (props, ref) => {
87
91
  props.operation.move(activeIndex, overIndex);
88
92
  }
89
93
  };
90
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_core.DndContext, {
91
- onDragEnd: handleDragEnd,
92
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sortable.SortableContext, {
93
- items: _fields.map(item => ({
94
- id: item.key
95
- })),
96
- strategy: _sortable.verticalListSortingStrategy,
97
- children: [_fields.map((field, index) => {
98
- var namePath = [..._namePath, field.name];
99
- var _columns = processColumns(index, namePath);
100
- return mode === 'block' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_BlockFields.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
101
- columns: _columns,
94
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
95
+ className: className,
96
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_core.DndContext, {
97
+ onDragEnd: handleDragEnd,
98
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sortable.SortableContext, {
99
+ items: _fields.map(item => ({
100
+ id: item.key
101
+ })),
102
+ strategy: _sortable.verticalListSortingStrategy,
103
+ children: [_fields.map((field, index) => {
104
+ var namePath = [..._namePath, field.name];
105
+ var _columns = processColumns(index, namePath);
106
+ return mode === 'block' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_BlockFields.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
107
+ columns: _columns,
108
+ disabled: disabled,
109
+ isView: isView,
110
+ namePath: namePath,
111
+ index: index,
112
+ field: field,
113
+ colProps: {
114
+ span
115
+ },
116
+ form: form,
117
+ diffConfig: _diffConfig,
118
+ hideStartEndActionProps: hideStartEndActionProps,
119
+ titlePosition: titlePosition
120
+ }), field.key) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineFields.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
121
+ className: _fields.length === index + 1 ? 'pro-form-list-last' : ''
122
+ }, props), {}, {
123
+ mode: mode,
124
+ columns: _columns,
125
+ disabled: disabled,
126
+ isView: isView,
127
+ namePath: namePath,
128
+ index: index,
129
+ field: field,
130
+ colProps: {
131
+ span: mode === 'less' ? 24 : span
132
+ },
133
+ form: form,
134
+ diffConfig: _diffConfig,
135
+ hideStartEndActionProps: hideStartEndActionProps
136
+ }), field.key);
137
+ }), _fields.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Empty.default, {
102
138
  disabled: disabled,
103
- isView: isView,
104
- namePath: namePath,
105
- index: index,
106
- field: field,
107
- colProps: {
108
- span
109
- },
139
+ toolbarProps: toolbarProps,
140
+ operation: operation,
110
141
  form: form,
111
- diffConfig: _diffConfig
112
- }), field.key) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineFields.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
113
- className: _fields.length === index + 1 ? 'pro-form-list-last' : ''
114
- }, props), {}, {
115
- mode: mode,
116
- columns: _columns,
142
+ namePath: _namePath,
143
+ emptyBtnText: emptyBtnText
144
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.ErrorList, {
145
+ errors: errors
146
+ }), toolbarProps !== false && _fields.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarButton.default, {
117
147
  disabled: disabled,
118
148
  isView: isView,
119
- namePath: namePath,
120
- index: index,
121
- field: field,
122
- colProps: {
123
- span: mode === 'less' ? 24 : span
124
- },
149
+ min: min,
150
+ max: max,
151
+ length: fields.length,
152
+ operation: operation,
153
+ namePath: _namePath,
125
154
  form: form,
126
- diffConfig: _diffConfig
127
- }), field.key);
128
- }), _fields.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Empty.default, {
129
- disabled: disabled,
130
- toolbarProps: toolbarProps,
131
- operation: operation,
132
- form: form,
133
- namePath: _namePath,
134
- emptyBtnText: emptyBtnText
135
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.ErrorList, {
136
- errors: errors
137
- }), toolbarProps !== false && _fields.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarButton.default, {
138
- disabled: disabled,
139
- isView: isView,
140
- min: min,
141
- max: max,
142
- length: fields.length,
143
- operation: operation,
144
- namePath: _namePath,
145
- form: form,
146
- fields: fields,
147
- toolbarProps: toolbarProps
148
- })]
155
+ fields: fields,
156
+ toolbarProps: toolbarProps
157
+ })]
158
+ })
149
159
  })
150
160
  });
151
161
  };
@@ -7,9 +7,9 @@ import type { ProFormColumnType, ProFormOtherType } 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;
9
9
  type Callback = (record: any, option: Pick<Option, 'namePath' | 'index' | 'operation' | 'form'>) => any | void;
10
- export type ToolbarCallback = (record: any, option: Pick<Option, 'namePath' | 'form' | 'operation'>) => any | void;
10
+ export type ToolbarCallback = (record: any, option: Pick<Option, 'index' | 'namePath' | 'form' | 'operation'>) => any | void;
11
11
  export interface Option {
12
- index: number;
12
+ index: number | undefined;
13
13
  namePath: InternalNamePath;
14
14
  form: FormInstance;
15
15
  operation: FormListOperation;
@@ -23,12 +23,14 @@ export interface ActionType extends Omit<ButtonProps, 'onClick' | 'type'> {
23
23
  confirmProps?: boolean | PopconfirmProps;
24
24
  title?: string;
25
25
  show?: boolean | ((record: any, option: Pick<Option, 'index' | 'form' | 'namePath'>) => boolean);
26
+ addIndex?: number | ((record: any, option: Pick<Option, 'index' | 'form' | 'namePath' | 'operation'>) => number);
26
27
  }
27
28
  export interface ToolbarActionType extends Omit<ActionType, 'actionType' | 'onHandle' | 'onClick' | 'show' | 'type'> {
28
29
  type?: 'add';
29
30
  onHandle?: ToolbarCallback;
30
31
  onClick?: ToolbarCallback;
31
32
  show?: boolean | ((record: any, option: Pick<Option, 'form' | 'namePath'>) => boolean);
33
+ addIndex?: number | ((record: any, option: Pick<Option, 'index' | 'form' | 'namePath' | 'operation'>) => number);
32
34
  }
33
35
  export type FormListMode = 'block' | 'line' | 'less';
34
36
  export interface FormListType {
@@ -56,6 +58,9 @@ export interface FormListType {
56
58
  draggable?: boolean;
57
59
  id?: string;
58
60
  emptyBtnText?: string;
61
+ hideStartEndActionProps?: [boolean, boolean];
62
+ titlePosition?: 'top' | 'left';
63
+ className?: string;
59
64
  }
60
65
  export type TypeWithRef = FormListType & React.RefAttributes<FormListRefType>;
61
66
  export interface FormListRefType {
@@ -127,3 +127,44 @@
127
127
  }
128
128
  }
129
129
  }
130
+
131
+ // 左侧标题布局样式
132
+ .pro-form-list-mode-block.pro-form-list-title-left {
133
+ .@{ant-prefix}-collapse-header-text{
134
+ display: none;
135
+ }
136
+ .pro-form-list-left-title-wrapper {
137
+ display: flex;
138
+ gap: 16px;
139
+ align-items: flex-start;
140
+
141
+ .pro-form-list-left-title {
142
+ flex: 0 0 80px;
143
+ font-weight: 600;
144
+ font-size: 14px;
145
+ line-height: 1.4;
146
+ color: @zaui-text;
147
+ padding-top: 8px;
148
+ }
149
+
150
+ .pro-form-list-left-content {
151
+ flex: 1;
152
+ min-width: 0;
153
+ }
154
+ }
155
+
156
+ // 移动端响应式
157
+ @media (max-width: 768px) {
158
+ .pro-form-list-left-title-wrapper {
159
+ flex-direction: column;
160
+ gap: 8px;
161
+
162
+ .pro-form-list-left-title {
163
+ flex: none;
164
+ width: 100%;
165
+ padding-top: 0;
166
+ margin-bottom: 8px;
167
+ }
168
+ }
169
+ }
170
+ }
@@ -216,7 +216,8 @@ var RenderFields = props => {
216
216
  listName: column.listName,
217
217
  globalControl,
218
218
  formDisabled,
219
- diffConfig
219
+ diffConfig,
220
+ shouldUpdateDebounce
220
221
  };
221
222
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
222
223
  value: otherProps,
@@ -73,7 +73,7 @@ var ProForm = (props, ref) => {
73
73
  _props$stopOnFirstErr = props.stopOnFirstError,
74
74
  stopOnFirstError = _props$stopOnFirstErr === void 0 ? false : _props$stopOnFirstErr,
75
75
  _props$shouldUpdateDe = props.shouldUpdateDebounce,
76
- shouldUpdateDebounce = _props$shouldUpdateDe === void 0 ? 500 : _props$shouldUpdateDe,
76
+ shouldUpdateDebounce = _props$shouldUpdateDe === void 0 ? 200 : _props$shouldUpdateDe,
77
77
  otherProps = (0, _objectWithoutProperties2.default)(props, _excluded);
78
78
  var config = (0, _ProConfigProvider.useProConfig)('ProForm');
79
79
  // source: 用于区分是哪个组件调用,用于错误提示
@@ -46,6 +46,7 @@ export interface ProFormOtherType {
46
46
  formDisabled?: boolean;
47
47
  isDiffChange?: boolean;
48
48
  diffConfig?: DiffConfigType;
49
+ shouldUpdateDebounce?: number;
49
50
  }
50
51
  export interface DiffConfigType<Values = any> {
51
52
  /** 比对原始数据源 */
@@ -31,8 +31,7 @@ var useShouldUpdate = props => {
31
31
  originComponent = props.originComponent,
32
32
  type = props.type,
33
33
  desensitization = props.desensitization,
34
- _props$shouldUpdateDe = props.shouldUpdateDebounce,
35
- shouldUpdateDebounce = _props$shouldUpdateDe === void 0 ? 500 : _props$shouldUpdateDe;
34
+ shouldUpdateDebounce = props.shouldUpdateDebounce;
36
35
  var _shouldUpdate = formItemProps.shouldUpdate,
37
36
  name = formItemProps.name,
38
37
  clearNotShow = formItemProps.clearNotShow,