@zat-design/sisyphus-react 3.13.21 → 3.13.22-beta.1
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.
- package/dist/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +84 -3
- package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +63 -6
- package/es/ProForm/components/combination/FormList/components/Empty.js +2 -1
- package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
- package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +38 -9
- package/es/ProForm/components/combination/FormList/index.js +64 -55
- package/es/ProForm/components/combination/FormList/propsType.d.ts +7 -2
- package/es/ProForm/components/combination/FormList/style/index.less +41 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +84 -3
- package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +62 -6
- package/lib/ProForm/components/combination/FormList/components/Empty.js +2 -1
- package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +38 -9
- package/lib/ProForm/components/combination/FormList/index.js +64 -55
- package/lib/ProForm/components/combination/FormList/propsType.d.ts +7 -2
- package/lib/ProForm/components/combination/FormList/style/index.less +41 -0
- package/package.json +5 -2
|
@@ -123,7 +123,8 @@ var ActionButton = props => {
|
|
|
123
123
|
min = props.min,
|
|
124
124
|
max = props.max,
|
|
125
125
|
mode = props.mode,
|
|
126
|
-
isView = props.isView
|
|
126
|
+
isView = props.isView,
|
|
127
|
+
hideStartEndActionProps = props.hideStartEndActionProps;
|
|
127
128
|
|
|
128
129
|
// 默认显示一个delete
|
|
129
130
|
var actionProps = (0, _react.useMemo)(() => {
|
|
@@ -191,6 +192,10 @@ var ActionButton = props => {
|
|
|
191
192
|
});
|
|
192
193
|
};
|
|
193
194
|
var defaultActions = (0, _react.useMemo)(() => getDefaultActions(mode), [mode]);
|
|
195
|
+
|
|
196
|
+
// 整体隐藏首尾 ActionButton
|
|
197
|
+
if (hideStartEndActionProps !== null && hideStartEndActionProps !== void 0 && hideStartEndActionProps[0] && index === 0) return null;
|
|
198
|
+
if (hideStartEndActionProps !== null && hideStartEndActionProps !== void 0 && hideStartEndActionProps[1] && index === fields.length - 1) return null;
|
|
194
199
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_space.default, {
|
|
195
200
|
align: "start",
|
|
196
201
|
className: "pro-form-list-action",
|
|
@@ -239,11 +244,83 @@ var ActionButton = props => {
|
|
|
239
244
|
if (index + 1 === fields.length && type === 'moveDown') {
|
|
240
245
|
return false;
|
|
241
246
|
}
|
|
247
|
+
|
|
248
|
+
// 移动限制:防止将项移动到隐藏的首尾位置
|
|
249
|
+
if (hideStartEndActionProps !== null && hideStartEndActionProps !== void 0 && hideStartEndActionProps[0] && index === 1 && ['moveUp'].includes(type)) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
if (hideStartEndActionProps !== null && hideStartEndActionProps !== void 0 && hideStartEndActionProps[1] && index === fields.length - 2 && type === 'moveDown') {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// 处理 add 操作的插入位置
|
|
257
|
+
var handleAddClick = /*#__PURE__*/function () {
|
|
258
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
|
259
|
+
var value, data, insertIndex, _insertIndex;
|
|
260
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
261
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
262
|
+
case 0:
|
|
263
|
+
value = form.getFieldValue(namePath);
|
|
264
|
+
_context2.next = 3;
|
|
265
|
+
return _onClick === null || _onClick === void 0 ? void 0 : _onClick(value, {
|
|
266
|
+
namePath,
|
|
267
|
+
index,
|
|
268
|
+
operation,
|
|
269
|
+
form
|
|
270
|
+
});
|
|
271
|
+
case 3:
|
|
272
|
+
data = _context2.sent;
|
|
273
|
+
if (!(!_onClick || data === true)) {
|
|
274
|
+
_context2.next = 7;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
// 如果有 addIndex 配置,使用它计算插入位置
|
|
278
|
+
if (item.addIndex) {
|
|
279
|
+
insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
|
|
280
|
+
index,
|
|
281
|
+
namePath,
|
|
282
|
+
form,
|
|
283
|
+
operation
|
|
284
|
+
}) : item.addIndex;
|
|
285
|
+
operation.add(data, insertIndex);
|
|
286
|
+
} else {
|
|
287
|
+
operation.add(data, index + 1); // 默认插入到下一位置
|
|
288
|
+
}
|
|
289
|
+
return _context2.abrupt("return");
|
|
290
|
+
case 7:
|
|
291
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'add') {
|
|
292
|
+
// 如果有 addIndex 配置,使用它计算插入位置
|
|
293
|
+
if (item.addIndex) {
|
|
294
|
+
_insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
|
|
295
|
+
index,
|
|
296
|
+
namePath,
|
|
297
|
+
form,
|
|
298
|
+
operation
|
|
299
|
+
}) : item.addIndex;
|
|
300
|
+
operation.add(data, _insertIndex);
|
|
301
|
+
} else {
|
|
302
|
+
operation.add(data, index + 1); // 默认插入到下一位置
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
case 8:
|
|
306
|
+
case "end":
|
|
307
|
+
return _context2.stop();
|
|
308
|
+
}
|
|
309
|
+
}, _callee2);
|
|
310
|
+
}));
|
|
311
|
+
return function handleAddClick() {
|
|
312
|
+
return _ref7.apply(this, arguments);
|
|
313
|
+
};
|
|
314
|
+
}();
|
|
242
315
|
return _needConfirm ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_popconfirm.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
243
316
|
title: title !== null && title !== void 0 ? title : `${_locale.default.ProForm.formListConfirmMessage}`,
|
|
244
317
|
onCancel: e => e.stopPropagation(),
|
|
245
318
|
onConfirm: e => {
|
|
246
|
-
|
|
319
|
+
if (type === 'add') {
|
|
320
|
+
handleAddClick();
|
|
321
|
+
} else {
|
|
322
|
+
handleClick(internalOnClick, _onClick, index, item);
|
|
323
|
+
}
|
|
247
324
|
}
|
|
248
325
|
}, _confirmProps), {}, {
|
|
249
326
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultRest), (0, _lodash.omit)(rest, filterKeys)), {}, {
|
|
@@ -255,7 +332,11 @@ var ActionButton = props => {
|
|
|
255
332
|
type: "text",
|
|
256
333
|
onClick: e => {
|
|
257
334
|
e.stopPropagation();
|
|
258
|
-
|
|
335
|
+
if (type === 'add') {
|
|
336
|
+
handleAddClick();
|
|
337
|
+
} else {
|
|
338
|
+
handleClick(internalOnClick, _onClick, index, item);
|
|
339
|
+
}
|
|
259
340
|
},
|
|
260
341
|
children: label || defaultLabel
|
|
261
342
|
}), `${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;
|
|
@@ -39,7 +39,9 @@ var BlockFields = props => {
|
|
|
39
39
|
level = _props$level === void 0 ? '2' : _props$level,
|
|
40
40
|
towCollapse = props.towCollapse,
|
|
41
41
|
id = props.id,
|
|
42
|
-
diffConfig = props.diffConfig
|
|
42
|
+
diffConfig = props.diffConfig,
|
|
43
|
+
hideStartEndActionProps = props.hideStartEndActionProps,
|
|
44
|
+
titlePosition = props.titlePosition;
|
|
43
45
|
var _title = (0, _react.useMemo)(() => {
|
|
44
46
|
if ((0, _lodash.isFunction)(title)) {
|
|
45
47
|
var record = form.getFieldValue(namePath);
|
|
@@ -48,8 +50,63 @@ var BlockFields = props => {
|
|
|
48
50
|
return title;
|
|
49
51
|
}, [title, index]);
|
|
50
52
|
var cls = (0, _classnames.default)({
|
|
51
|
-
[`pro-form-list-mode-${mode}`]: mode === 'block' || mode === 'line' || mode === 'less'
|
|
53
|
+
[`pro-form-list-mode-${mode}`]: mode === 'block' || mode === 'line' || mode === 'less',
|
|
54
|
+
'pro-form-list-title-left': titlePosition === 'left'
|
|
52
55
|
});
|
|
56
|
+
|
|
57
|
+
// 左侧标题布局
|
|
58
|
+
if (titlePosition === 'left') {
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_space.default, {
|
|
60
|
+
direction: "vertical",
|
|
61
|
+
className: cls,
|
|
62
|
+
id: id,
|
|
63
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
64
|
+
className: "pro-form-list-left-title-wrapper",
|
|
65
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
66
|
+
className: "pro-form-list-left-title",
|
|
67
|
+
children: _title
|
|
68
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
69
|
+
className: "pro-form-list-left-content",
|
|
70
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProCollapse.default, {
|
|
71
|
+
title: _title,
|
|
72
|
+
index: index,
|
|
73
|
+
form: form,
|
|
74
|
+
level: level,
|
|
75
|
+
towCollapse: towCollapse,
|
|
76
|
+
extra: actionProps !== false && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
77
|
+
min: min,
|
|
78
|
+
max: max,
|
|
79
|
+
index: index,
|
|
80
|
+
length: fields.length,
|
|
81
|
+
operation: operation,
|
|
82
|
+
namePath: namePath,
|
|
83
|
+
form: form,
|
|
84
|
+
field: field,
|
|
85
|
+
fields: fields,
|
|
86
|
+
actionProps: actionProps,
|
|
87
|
+
mode: mode,
|
|
88
|
+
disabled: disabled,
|
|
89
|
+
isView: isView,
|
|
90
|
+
hideStartEndActionProps: hideStartEndActionProps
|
|
91
|
+
}),
|
|
92
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_row.default, {
|
|
93
|
+
gutter: 24,
|
|
94
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(MemoRenderFields, {
|
|
95
|
+
columns: columns,
|
|
96
|
+
form: form,
|
|
97
|
+
colProps: colProps,
|
|
98
|
+
disabled: disabled,
|
|
99
|
+
isView: isView,
|
|
100
|
+
diffConfig: diffConfig
|
|
101
|
+
})
|
|
102
|
+
}, field.key)
|
|
103
|
+
})
|
|
104
|
+
})]
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 默认顶部标题布局
|
|
53
110
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_space.default, {
|
|
54
111
|
direction: "vertical",
|
|
55
112
|
className: cls,
|
|
@@ -57,9 +114,7 @@ var BlockFields = props => {
|
|
|
57
114
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProCollapse.default, {
|
|
58
115
|
title: _title,
|
|
59
116
|
index: index,
|
|
60
|
-
form: form
|
|
61
|
-
// namePath={namePath}
|
|
62
|
-
,
|
|
117
|
+
form: form,
|
|
63
118
|
level: level,
|
|
64
119
|
towCollapse: towCollapse,
|
|
65
120
|
extra: actionProps !== false && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
@@ -75,7 +130,8 @@ var BlockFields = props => {
|
|
|
75
130
|
actionProps: actionProps,
|
|
76
131
|
mode: mode,
|
|
77
132
|
disabled: disabled,
|
|
78
|
-
isView: isView
|
|
133
|
+
isView: isView,
|
|
134
|
+
hideStartEndActionProps: hideStartEndActionProps
|
|
79
135
|
}),
|
|
80
136
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_row.default, {
|
|
81
137
|
gutter: 24,
|
|
@@ -40,7 +40,8 @@ var Empty = _ref => {
|
|
|
40
40
|
return addConfig === null || addConfig === void 0 || (_addConfig$onClick = addConfig.onClick) === null || _addConfig$onClick === void 0 ? void 0 : _addConfig$onClick.call(addConfig, value, {
|
|
41
41
|
operation,
|
|
42
42
|
form,
|
|
43
|
-
namePath
|
|
43
|
+
namePath,
|
|
44
|
+
index: 0
|
|
44
45
|
});
|
|
45
46
|
case 5:
|
|
46
47
|
data = _context.sent;
|
|
@@ -36,7 +36,8 @@ var LineFields = props => {
|
|
|
36
36
|
draggable = props.draggable,
|
|
37
37
|
className = props.className,
|
|
38
38
|
id = props.id,
|
|
39
|
-
diffConfig = props.diffConfig
|
|
39
|
+
diffConfig = props.diffConfig,
|
|
40
|
+
hideStartEndActionProps = props.hideStartEndActionProps;
|
|
40
41
|
var isLess = mode === 'less';
|
|
41
42
|
var _useSortable = (0, _sortable.useSortable)({
|
|
42
43
|
id: field.key,
|
|
@@ -94,7 +95,8 @@ var LineFields = props => {
|
|
|
94
95
|
fields: fields,
|
|
95
96
|
actionProps: actionProps,
|
|
96
97
|
mode: mode,
|
|
97
|
-
disabled: disabled
|
|
98
|
+
disabled: disabled,
|
|
99
|
+
hideStartEndActionProps: hideStartEndActionProps
|
|
98
100
|
})]
|
|
99
101
|
});
|
|
100
102
|
};
|
|
@@ -65,7 +65,7 @@ var ToolbarButton = props => {
|
|
|
65
65
|
}, [props.toolbarProps]);
|
|
66
66
|
var handleClick = /*#__PURE__*/function () {
|
|
67
67
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, item) {
|
|
68
|
-
var value, data;
|
|
68
|
+
var value, data, insertIndex, _insertIndex;
|
|
69
69
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
70
70
|
while (1) switch (_context.prev = _context.next) {
|
|
71
71
|
case 0:
|
|
@@ -74,7 +74,8 @@ var ToolbarButton = props => {
|
|
|
74
74
|
return callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
75
75
|
operation,
|
|
76
76
|
form,
|
|
77
|
-
namePath
|
|
77
|
+
namePath,
|
|
78
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
78
79
|
});
|
|
79
80
|
case 3:
|
|
80
81
|
data = _context.sent;
|
|
@@ -82,15 +83,42 @@ var ToolbarButton = props => {
|
|
|
82
83
|
_context.next = 7;
|
|
83
84
|
break;
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'add') {
|
|
87
|
+
// 如果有 addIndex 配置,使用它计算插入位置
|
|
88
|
+
if (item.addIndex) {
|
|
89
|
+
insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
|
|
90
|
+
namePath,
|
|
91
|
+
form,
|
|
92
|
+
operation,
|
|
93
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
94
|
+
}) : item.addIndex;
|
|
95
|
+
operation.add(data, insertIndex);
|
|
96
|
+
} else {
|
|
97
|
+
operation.add(data); // 默认插入到末尾
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
defaultCallback === null || defaultCallback === void 0 || defaultCallback(value, {
|
|
101
|
+
operation,
|
|
102
|
+
form,
|
|
103
|
+
namePath,
|
|
104
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
105
|
+
});
|
|
106
|
+
}
|
|
90
107
|
return _context.abrupt("return");
|
|
91
108
|
case 7:
|
|
92
109
|
if ((item === null || item === void 0 ? void 0 : item.type) === 'add' && data) {
|
|
93
|
-
|
|
110
|
+
// 如果有 addIndex 配置,使用它计算插入位置
|
|
111
|
+
if (item.addIndex) {
|
|
112
|
+
_insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
|
|
113
|
+
namePath,
|
|
114
|
+
form,
|
|
115
|
+
operation,
|
|
116
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
117
|
+
}) : item.addIndex;
|
|
118
|
+
operation.add(data, _insertIndex);
|
|
119
|
+
} else {
|
|
120
|
+
operation.add(data); // 默认插入到末尾
|
|
121
|
+
}
|
|
94
122
|
}
|
|
95
123
|
case 8:
|
|
96
124
|
case "end":
|
|
@@ -107,7 +135,8 @@ var ToolbarButton = props => {
|
|
|
107
135
|
callback === null || callback === void 0 || callback(value, {
|
|
108
136
|
operation,
|
|
109
137
|
form,
|
|
110
|
-
namePath
|
|
138
|
+
namePath,
|
|
139
|
+
index: 0
|
|
111
140
|
});
|
|
112
141
|
};
|
|
113
142
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_space.default, {
|
|
@@ -35,7 +35,10 @@ var FormList = (props, ref) => {
|
|
|
35
35
|
_props$span = props.span,
|
|
36
36
|
span = _props$span === void 0 ? 8 : _props$span,
|
|
37
37
|
disabled = props.disabled,
|
|
38
|
-
emptyBtnText = props.emptyBtnText
|
|
38
|
+
emptyBtnText = props.emptyBtnText,
|
|
39
|
+
hideStartEndActionProps = props.hideStartEndActionProps,
|
|
40
|
+
titlePosition = props.titlePosition,
|
|
41
|
+
className = props.className;
|
|
39
42
|
var _fields = fields.map(item => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
40
43
|
key: String(item.key)
|
|
41
44
|
}));
|
|
@@ -88,65 +91,71 @@ var FormList = (props, ref) => {
|
|
|
88
91
|
props.operation.move(activeIndex, overIndex);
|
|
89
92
|
}
|
|
90
93
|
};
|
|
91
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
92
|
-
|
|
93
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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, {
|
|
103
138
|
disabled: disabled,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
index: index,
|
|
107
|
-
field: field,
|
|
108
|
-
colProps: {
|
|
109
|
-
span
|
|
110
|
-
},
|
|
139
|
+
toolbarProps: toolbarProps,
|
|
140
|
+
operation: operation,
|
|
111
141
|
form: form,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
columns: _columns,
|
|
142
|
+
namePath: _namePath,
|
|
143
|
+
emptyBtnText: emptyBtnText
|
|
144
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_form.default.ErrorList, {
|
|
145
|
+
errors: errors
|
|
146
|
+
}), toolbarProps !== false && _fields.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarButton.default, {
|
|
118
147
|
disabled: disabled,
|
|
119
148
|
isView: isView,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
},
|
|
149
|
+
min: min,
|
|
150
|
+
max: max,
|
|
151
|
+
length: fields.length,
|
|
152
|
+
operation: operation,
|
|
153
|
+
namePath: _namePath,
|
|
126
154
|
form: form,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
toolbarProps: toolbarProps,
|
|
132
|
-
operation: operation,
|
|
133
|
-
form: form,
|
|
134
|
-
namePath: _namePath,
|
|
135
|
-
emptyBtnText: emptyBtnText
|
|
136
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_form.default.ErrorList, {
|
|
137
|
-
errors: errors
|
|
138
|
-
}), toolbarProps !== false && _fields.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarButton.default, {
|
|
139
|
-
disabled: disabled,
|
|
140
|
-
isView: isView,
|
|
141
|
-
min: min,
|
|
142
|
-
max: max,
|
|
143
|
-
length: fields.length,
|
|
144
|
-
operation: operation,
|
|
145
|
-
namePath: _namePath,
|
|
146
|
-
form: form,
|
|
147
|
-
fields: fields,
|
|
148
|
-
toolbarProps: toolbarProps
|
|
149
|
-
})]
|
|
155
|
+
fields: fields,
|
|
156
|
+
toolbarProps: toolbarProps
|
|
157
|
+
})]
|
|
158
|
+
})
|
|
150
159
|
})
|
|
151
160
|
});
|
|
152
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 {
|
|
@@ -93,3 +93,44 @@
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
// 左侧标题布局样式
|
|
98
|
+
.pro-form-list-mode-block.pro-form-list-title-left {
|
|
99
|
+
.@{ant-prefix}-collapse-header-text{
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
.pro-form-list-left-title-wrapper {
|
|
103
|
+
display: flex;
|
|
104
|
+
gap: 16px;
|
|
105
|
+
align-items: flex-start;
|
|
106
|
+
|
|
107
|
+
.pro-form-list-left-title {
|
|
108
|
+
flex: 0 0 80px;
|
|
109
|
+
font-weight: 600;
|
|
110
|
+
font-size: 14px;
|
|
111
|
+
line-height: 1.4;
|
|
112
|
+
color: @zaui-text;
|
|
113
|
+
padding-top: 8px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.pro-form-list-left-content {
|
|
117
|
+
flex: 1;
|
|
118
|
+
min-width: 0;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 移动端响应式
|
|
123
|
+
@media (max-width: 768px) {
|
|
124
|
+
.pro-form-list-left-title-wrapper {
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: 8px;
|
|
127
|
+
|
|
128
|
+
.pro-form-list-left-title {
|
|
129
|
+
flex: none;
|
|
130
|
+
width: 100%;
|
|
131
|
+
padding-top: 0;
|
|
132
|
+
margin-bottom: 8px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.22-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=18.19.0"
|
|
7
|
+
},
|
|
5
8
|
"main": "lib/index.js",
|
|
6
9
|
"module": "es/index.js",
|
|
7
10
|
"typings": "lib/index.d.ts",
|
|
@@ -12,7 +15,7 @@
|
|
|
12
15
|
"build-es": "father build --format esm",
|
|
13
16
|
"build-lib": "father build --format cjs",
|
|
14
17
|
"build-dist": "father build --format umd",
|
|
15
|
-
"docs": "dumi build",
|
|
18
|
+
"docs": "export NODE_OPTIONS=--openssl-legacy-provider && dumi build",
|
|
16
19
|
"docs:deploy": "gh-pages -d docs-dist",
|
|
17
20
|
"lint": "npm run lint:js && npm run lint:style && npm run lint:prettier",
|
|
18
21
|
"lint-staged": "lint-staged",
|