@zat-design/sisyphus-react 4.0.0-beta.8 → 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 (39) 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/style/index.less +9 -3
  5. package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  6. package/es/ProForm/components/combination/FormList/components/ActionButton.js +84 -3
  7. package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  8. package/es/ProForm/components/combination/FormList/components/BlockFields.js +63 -6
  9. package/es/ProForm/components/combination/FormList/components/Empty.js +11 -2
  10. package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
  11. package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  12. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +38 -9
  13. package/es/ProForm/components/combination/FormList/index.js +67 -57
  14. package/es/ProForm/components/combination/FormList/propsType.d.ts +7 -2
  15. package/es/ProForm/components/combination/FormList/style/index.less +41 -0
  16. package/es/ProForm/utils/useWatch.js +3 -3
  17. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +19 -9
  18. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +6 -8
  19. package/es/ProLayout/components/ProHeader/index.js +19 -15
  20. package/es/ProTable/hooks/useAntdTable.js +52 -29
  21. package/lib/ProEditTable/components/RcTable/DraggableTable.js +5 -3
  22. package/lib/ProEditTable/style/index.less +9 -3
  23. package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  24. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +84 -3
  25. package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  26. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +62 -6
  27. package/lib/ProForm/components/combination/FormList/components/Empty.js +11 -2
  28. package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
  29. package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  30. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +38 -9
  31. package/lib/ProForm/components/combination/FormList/index.js +67 -57
  32. package/lib/ProForm/components/combination/FormList/propsType.d.ts +7 -2
  33. package/lib/ProForm/components/combination/FormList/style/index.less +41 -0
  34. package/lib/ProForm/utils/useWatch.js +3 -3
  35. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +18 -8
  36. package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +5 -7
  37. package/lib/ProLayout/components/ProHeader/index.js +19 -15
  38. package/lib/ProTable/hooks/useAntdTable.js +52 -29
  39. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
2
  import { debounce } from 'lodash';
4
3
  import warning from 'rc-util/lib/warning';
5
4
  import { useState, useEffect, useRef, useMemo } from 'react';
6
5
  import isEqual from 'lodash/isEqual';
6
+ import cloneDeep from 'lodash/cloneDeep';
7
7
  export function toArray(value) {
8
8
  if (value === undefined || value === null) {
9
9
  return [];
@@ -115,7 +115,7 @@ function useWatch(dependencies, form, wait) {
115
115
  return debounce(value => {
116
116
  // 只在值真正变化时才更新状态
117
117
  if (!isEqual(prevStateRef.current, value)) {
118
- prevStateRef.current = _objectSpread({}, value);
118
+ prevStateRef.current = cloneDeep(value);
119
119
  setState(value);
120
120
  }
121
121
  }, wait);
@@ -124,7 +124,7 @@ function useWatch(dependencies, form, wait) {
124
124
  // 非防抖版本
125
125
  return value => {
126
126
  if (!isEqual(prevStateRef.current, value)) {
127
- prevStateRef.current = _objectSpread({}, value);
127
+ prevStateRef.current = cloneDeep(value);
128
128
  setState(value);
129
129
  }
130
130
  };
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import { useContext } from 'react';
3
3
  import { Popover, Tooltip } from 'antd';
4
4
  import classnames from 'classnames';
5
- import { Link } from 'react-router-dom';
5
+ import { useHistory } from 'react-router-dom';
6
6
  import { Icon } from "../../index";
7
7
  import SideMenu from "../SideMenu";
8
8
  import { LayoutContext } from "../../../../index";
@@ -19,6 +19,7 @@ var FoldMenu = props => {
19
19
  collapsed = dataSource.collapsed,
20
20
  headerHeight = dataSource.headerHeight;
21
21
  var pathNamePrefix = `/${window.location.pathname.split('/')[1]}`;
22
+ var history = useHistory();
22
23
  var noticeCls = classnames({
23
24
  'pro-layout-menu-tooltip': true,
24
25
  'pro-layout-menu-tooltip-has-notice': notice,
@@ -113,6 +114,11 @@ var FoldMenu = props => {
113
114
  keyPath: menuKeyPath
114
115
  });
115
116
  }
117
+
118
+ // 导航到目标路径
119
+ if (toPath) {
120
+ history.push(toPath);
121
+ }
116
122
  },
117
123
  children: LiNode
118
124
  })
@@ -133,14 +139,16 @@ var FoldMenu = props => {
133
139
  keyPath: menuKeyPath
134
140
  });
135
141
  }
142
+
143
+ // 导航到目标路径
144
+ if (toPath) {
145
+ history.push(toPath);
146
+ }
136
147
  onSelected({
137
148
  selectedPath: toPath
138
149
  });
139
150
  },
140
- children: /*#__PURE__*/_jsx(Link, {
141
- to: toPath,
142
- children: LiNode
143
- }, toPath)
151
+ children: LiNode
144
152
  })
145
153
  }, toPath) : /*#__PURE__*/_jsx("span", {
146
154
  onClick: () => {
@@ -156,11 +164,13 @@ var FoldMenu = props => {
156
164
  keyPath: menuKeyPath
157
165
  });
158
166
  }
167
+
168
+ // 导航到目标路径
169
+ if (toPath) {
170
+ history.push(toPath);
171
+ }
159
172
  },
160
- children: /*#__PURE__*/_jsx(Link, {
161
- to: toPath,
162
- children: LiNode
163
- }, toPath)
173
+ children: LiNode
164
174
  });
165
175
  })
166
176
  })
@@ -4,7 +4,7 @@ import { Menu } from 'antd';
4
4
  import { useDeepCompareEffect, useSetState } from 'ahooks';
5
5
  import { CaretDownOutlined } from '@ant-design/icons';
6
6
  import classnames from 'classnames';
7
- import { Link } from 'react-router-dom';
7
+ import { useHistory } from 'react-router-dom';
8
8
  import { cloneDeep } from 'lodash';
9
9
  import { LayoutContext } from "../../../../index";
10
10
  import { getIdsByPathName, findMenuItemByKey } from "../../../../utils";
@@ -24,6 +24,7 @@ var OpenMenu = props => {
24
24
  menus = _ref.menus,
25
25
  sideMenu = _ref.sideMenu;
26
26
  var linkRef = useRef(null);
27
+ var history = useHistory();
27
28
  // 通过URL匹配对应的ID用于回显
28
29
  var _useSetState = useSetState({
29
30
  selectedKeys: [],
@@ -120,10 +121,10 @@ var OpenMenu = props => {
120
121
  });
121
122
  }
122
123
  }, [sideMenu]);
123
- return /*#__PURE__*/_jsxs("div", {
124
+ return /*#__PURE__*/_jsx("div", {
124
125
  className: cls,
125
126
  style: style,
126
- children: [/*#__PURE__*/_jsx(Menu, {
127
+ children: /*#__PURE__*/_jsx(Menu, {
127
128
  mode: "inline"
128
129
  // @ts-ignore
129
130
  ,
@@ -175,7 +176,7 @@ var OpenMenu = props => {
175
176
  setTimeout(() => {
176
177
  // 路由变更,且不再demo文档中
177
178
  if (!window.location.href.includes('~demos/prolayout')) {
178
- linkRef.current.click();
179
+ history.push(router);
179
180
  }
180
181
  }, 100);
181
182
  }
@@ -184,10 +185,7 @@ var OpenMenu = props => {
184
185
  height: dataSource.sideMenu ? 'auto' : `calc(100vh - ${(dataSource === null || dataSource === void 0 ? void 0 : dataSource.height) || 0}px)`,
185
186
  color: 'red'
186
187
  }
187
- }), /*#__PURE__*/_jsx(Link, {
188
- to: router,
189
- ref: linkRef
190
- })]
188
+ })
191
189
  });
192
190
  };
193
191
  export default OpenMenu;
@@ -110,11 +110,11 @@ var ProHeader = props => {
110
110
  return null;
111
111
  }
112
112
  var onlyTag = tag && !label && !value;
113
- var tagRender = parmas => {
114
- if (Array.isArray(parmas === null || parmas === void 0 ? void 0 : parmas.tag) && parmas !== null && parmas !== void 0 && parmas.tag.length) {
113
+ var tagRender = params => {
114
+ if (Array.isArray(params === null || params === void 0 ? void 0 : params.tag) && params !== null && params !== void 0 && params.tag.length) {
115
115
  return /*#__PURE__*/_jsx(Space, {
116
116
  size: 4,
117
- children: parmas.tag.map((tagItem, index) => {
117
+ children: params.tag.map((tagItem, index) => {
118
118
  return /*#__PURE__*/_jsx("div", {
119
119
  className: "pro-header-tag",
120
120
  children: tagItem
@@ -122,26 +122,30 @@ var ProHeader = props => {
122
122
  })
123
123
  });
124
124
  }
125
- return parmas !== null && parmas !== void 0 && parmas.tag ? /*#__PURE__*/_jsx("div", {
125
+ return params !== null && params !== void 0 && params.tag ? /*#__PURE__*/_jsx("div", {
126
126
  className: "pro-header-tag",
127
- children: parmas === null || parmas === void 0 ? void 0 : parmas.tag
127
+ children: params === null || params === void 0 ? void 0 : params.tag
128
128
  }) : null;
129
129
  };
130
130
 
131
131
  /** 单行渲染 */
132
- var valueRender = parmas => {
132
+ var valueRender = params => {
133
133
  return /*#__PURE__*/_jsxs(Space, {
134
134
  size: 4,
135
- align: parmas !== null && parmas !== void 0 && parmas.tag ? 'baseline' : 'center',
136
- children: [parmas !== null && parmas !== void 0 && parmas.link ? /*#__PURE__*/_jsx("a", {
137
- href: parmas.link,
138
- rel: "noopener noreferrer",
139
- target: "_blank",
140
- children: parmas === null || parmas === void 0 ? void 0 : parmas.value
141
- }) : parmas === null || parmas === void 0 ? void 0 : parmas.value, parmas !== null && parmas !== void 0 && parmas.copyable && isString(parmas === null || parmas === void 0 ? void 0 : parmas.value) ? /*#__PURE__*/_jsx(Copy, {
142
- text: parmas.value
135
+ align: params !== null && params !== void 0 && params.tag ? 'baseline' : 'center',
136
+ children: [params !== null && params !== void 0 && params.link ?
137
+ /*#__PURE__*/
138
+ // eslint-disable-next-line jsx-a11y/anchor-is-valid
139
+ _jsx("a", {
140
+ onClick: () => {
141
+ var newWindow = window.open(params.link);
142
+ newWindow.opener = null;
143
+ },
144
+ children: params === null || params === void 0 ? void 0 : params.value
145
+ }) : params === null || params === void 0 ? void 0 : params.value, params !== null && params !== void 0 && params.copyable && isString(params === null || params === void 0 ? void 0 : params.value) ? /*#__PURE__*/_jsx(Copy, {
146
+ text: params.value
143
147
  }) : null, tagRender({
144
- tag: parmas === null || parmas === void 0 ? void 0 : parmas.tag
148
+ tag: params === null || params === void 0 ? void 0 : params.tag
145
149
  })]
146
150
  });
147
151
  };
@@ -149,13 +149,64 @@ function useAntdTable(service, options, useRequestOptions) {
149
149
  selectedRowKeys: []
150
150
  });
151
151
  };
152
+ var resetParams = () => {
153
+ setState({
154
+ searchValues: {},
155
+ allSelected: false,
156
+ selectedRecords: [],
157
+ selectedRowKeys: [],
158
+ extraFilter: {
159
+ filters: undefined,
160
+ sorter: undefined
161
+ }
162
+ });
163
+ };
164
+
165
+ // 重置查询条件: 页码还原、勾选清空
166
+ var onReset = refresh => {
167
+ form === null || form === void 0 || form.resetFields();
168
+ var newPage = {
169
+ pageNum: 1,
170
+ pageSize: page.pageSize
171
+ };
172
+ resetParams();
173
+ if (isResetQuery || refresh) {
174
+ onPageChange(newPage);
175
+ run(getTransformParams({
176
+ page: newPage
177
+ }));
178
+ }
179
+ };
152
180
 
153
181
  /**
154
182
  * 手动触发时,手动调用run
155
183
  */
156
184
  useEffect(() => {
157
185
  if (!(useRequestOptions !== null && useRequestOptions !== void 0 && useRequestOptions.manual)) {
158
- run(getTransformParams());
186
+ onReset(true);
187
+ }
188
+ }, [useRequestOptions === null || useRequestOptions === void 0 ? void 0 : useRequestOptions.manual, curExtraParams, curService]);
189
+
190
+ /**
191
+ * 手动触发时,手动调用run
192
+ */
193
+ useEffect(() => {
194
+ if (!(useRequestOptions !== null && useRequestOptions !== void 0 && useRequestOptions.manual)) {
195
+ // 当 extraParams 变化时,重置分页和选中状态
196
+ onPageChange(initPage);
197
+ setState({
198
+ searchValues: {},
199
+ allSelected: false,
200
+ selectedRecords: [],
201
+ selectedRowKeys: [],
202
+ extraFilter: {
203
+ filters: undefined,
204
+ sorter: undefined
205
+ }
206
+ });
207
+ run(getTransformParams({
208
+ page: initPage
209
+ }));
159
210
  }
160
211
  }, [useRequestOptions === null || useRequestOptions === void 0 ? void 0 : useRequestOptions.manual, curExtraParams, curService]);
161
212
  useDeepCompareEffect(() => {
@@ -265,34 +316,6 @@ function useAntdTable(service, options, useRequestOptions) {
265
316
  page: newPage
266
317
  }, extraFilter), _values)));
267
318
  };
268
- var resetParams = page => {
269
- setState({
270
- searchValues: {},
271
- allSelected: false,
272
- selectedRecords: [],
273
- selectedRowKeys: [],
274
- extraFilter: {
275
- filters: undefined,
276
- sorter: undefined
277
- }
278
- });
279
- };
280
-
281
- // 重置查询条件: 页码还原、勾选清空
282
- var onReset = () => {
283
- form === null || form === void 0 || form.resetFields();
284
- var newPage = {
285
- pageNum: 1,
286
- pageSize: page.pageSize
287
- };
288
- resetParams(newPage);
289
- if (isResetQuery) {
290
- onPageChange(newPage);
291
- run(getTransformParams({
292
- page: newPage
293
- }));
294
- }
295
- };
296
319
  var refreshPage = res => {
297
320
  var transformResult = transformResponse ? transformResponse(res) : res || {};
298
321
  var _ref3 = isListResult(transformResult) ? transformResult : (transformResult === null || transformResult === void 0 ? void 0 : transformResult.data) || {},
@@ -45,8 +45,9 @@ var Row = props => {
45
45
  ref: setNodeRef,
46
46
  style: style
47
47
  }, attributes), {}, {
48
- children: _react.default.Children.map(children, child => {
49
- if (child.key === 'RC_TABLE_KEY' && !disabled) {
48
+ children: _react.default.Children.map(children, (child, index) => {
49
+ // 在第一列(通常是rowSelection列)显示拖拽图标
50
+ if (index === 0 && !disabled) {
50
51
  var _restProps$dataRowD;
51
52
  var _ref = (child === null || child === void 0 ? void 0 : child.props) || {},
52
53
  render = _ref.render,
@@ -67,7 +68,8 @@ var Row = props => {
67
68
  }, listeners)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProIcon.default, {
68
69
  size: 20
69
70
  }), props['data-hide'] ? null : render === null || render === void 0 ? void 0 : render(null, record, renderIndex)]
70
- })
71
+ }),
72
+ className: 'pro-edit-table-drag-wrapper-cell'
71
73
  });
72
74
  }
73
75
  return child;
@@ -1,5 +1,12 @@
1
1
 
2
2
  .pro-edit-table {
3
+ .pro-edit-table-drag-wrapper-cell{
4
+ .@{ant-prefix}-btn{
5
+ &:hover{
6
+ background: transparent;
7
+ }
8
+ }
9
+ }
3
10
  td[rowspan]{
4
11
  vertical-align: middle !important;
5
12
  }
@@ -81,10 +88,9 @@
81
88
 
82
89
  .pro-edit-table-drag-wrapper {
83
90
  display: flex;
84
- justify-content: flex-end;
91
+ align-items: center;
85
92
  .anticon {
86
- margin-right: var(--zaui-space-size-md, 16px);
87
- margin-left: var(--zaui-space-size-xs, 4px);
93
+ margin-right: var(--zaui-space-size-xs, 4px);
88
94
  cursor: pointer;
89
95
  }
90
96
  }
@@ -18,6 +18,7 @@ export interface Props {
18
18
  mode: FormListMode;
19
19
  disabled?: boolean;
20
20
  isView?: boolean;
21
+ hideStartEndActionProps?: [boolean, boolean];
21
22
  }
22
23
  declare const ActionButton: React.FC<Props>;
23
24
  export default ActionButton;
@@ -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
  };