@zat-design/sisyphus-react 3.4.9-beta.9 → 3.4.10
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/ProEditTable/components/RenderField/index.js +16 -1
- package/es/ProEditTable/propsType.d.ts +2 -2
- package/es/ProEditTable/utils/index.js +1 -0
- package/es/ProEnum/index.js +5 -2
- package/es/ProForm/components/base/InputNumber/index.js +4 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +49 -9
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +45 -7
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.d.ts +8 -0
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +18 -0
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.less +10 -0
- package/es/ProForm/components/combination/Group/component/ComRender.d.ts +2 -0
- package/es/ProForm/components/combination/Group/component/ComRender.js +29 -13
- package/es/ProForm/components/combination/Group/index.d.ts +2 -2
- package/es/ProForm/components/combination/Group/index.js +5 -5
- package/es/ProForm/components/combination/Group/utils.js +1 -1
- package/es/ProForm/components/combination/ProCascader/index.js +2 -2
- package/es/ProForm/components/combination/ProCascader/utils/index.js +3 -0
- package/es/ProLayout/style/index.less +1 -1
- package/es/ProSelect/utils/index.js +2 -2
- package/es/ProTree/components/Tree.js +4 -1
- package/es/ProTree/propsType.d.ts +5 -0
- package/lib/ProEditTable/components/RenderField/index.js +16 -1
- package/lib/ProEditTable/propsType.d.ts +2 -2
- package/lib/ProEditTable/utils/index.js +1 -0
- package/lib/ProEnum/index.js +5 -2
- package/lib/ProForm/components/base/InputNumber/index.js +4 -1
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +49 -9
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +45 -7
- package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.d.ts +8 -0
- package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.js +24 -0
- package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.less +10 -0
- package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +2 -0
- package/lib/ProForm/components/combination/Group/component/ComRender.js +31 -15
- package/lib/ProForm/components/combination/Group/index.d.ts +2 -2
- package/lib/ProForm/components/combination/Group/index.js +5 -5
- package/lib/ProForm/components/combination/Group/utils.js +1 -1
- package/lib/ProForm/components/combination/ProCascader/index.js +1 -1
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +3 -0
- package/lib/ProLayout/style/index.less +1 -1
- package/lib/ProSelect/utils/index.js +2 -2
- package/lib/ProTree/components/Tree.js +4 -1
- package/lib/ProTree/propsType.d.ts +5 -0
- package/package.json +1 -1
- package/es/ProForm/components/combination/_Group/index.d.ts +0 -4
- package/es/ProForm/components/combination/_Group/index.js +0 -109
- package/es/ProForm/components/combination/_Group/propsType.d.ts +0 -35
- package/es/ProForm/components/combination/_Group/propsType.js +0 -1
- package/es/ProForm/components/combination/_Group/style/index.less +0 -131
- package/es/ProForm/components/combination/_Group/utils.d.ts +0 -10
- package/es/ProForm/components/combination/_Group/utils.js +0 -46
- package/lib/ProForm/components/combination/_Group/index.d.ts +0 -4
- package/lib/ProForm/components/combination/_Group/index.js +0 -113
- package/lib/ProForm/components/combination/_Group/propsType.d.ts +0 -35
- package/lib/ProForm/components/combination/_Group/propsType.js +0 -5
- package/lib/ProForm/components/combination/_Group/style/index.less +0 -131
- package/lib/ProForm/components/combination/_Group/utils.d.ts +0 -10
- package/lib/ProForm/components/combination/_Group/utils.js +0 -53
package/dist/index.esm.css
CHANGED
|
@@ -1226,7 +1226,7 @@
|
|
|
1226
1226
|
.pro-layout.pro-layout-light .pro-collapse.pro-collapse-no-title .pro-header-no-describe {
|
|
1227
1227
|
padding: 0 !important;
|
|
1228
1228
|
}
|
|
1229
|
-
.pro-layout.pro-layout-light .pro-collapse .ant-collapse-item-active.pro-collapse-panel .ant-collapse-header {
|
|
1229
|
+
.pro-layout.pro-layout-light .pro-collapse .ant-collapse-item-active.pro-collapse-panel > .ant-collapse-header {
|
|
1230
1230
|
border-radius: var(--zaui-border-radius, 8px) var(--zaui-border-radius, 8px) 0 0 !important;
|
|
1231
1231
|
}
|
|
1232
1232
|
.pro-layout.pro-layout-light .pro-collapse .pro-collapse-content {
|
package/dist/less.esm.css
CHANGED
|
@@ -1226,7 +1226,7 @@
|
|
|
1226
1226
|
.pro-layout.pro-layout-light .pro-collapse.pro-collapse-no-title .pro-header-no-describe {
|
|
1227
1227
|
padding: 0 !important;
|
|
1228
1228
|
}
|
|
1229
|
-
.pro-layout.pro-layout-light .pro-collapse .ant-collapse-item-active.pro-collapse-panel .ant-collapse-header {
|
|
1229
|
+
.pro-layout.pro-layout-light .pro-collapse .ant-collapse-item-active.pro-collapse-panel > .ant-collapse-header {
|
|
1230
1230
|
border-radius: var(--zaui-border-radius, 8px) var(--zaui-border-radius, 8px) 0 0 !important;
|
|
1231
1231
|
}
|
|
1232
1232
|
.pro-layout.pro-layout-light .pro-collapse .pro-collapse-content {
|
|
@@ -526,7 +526,8 @@ var RenderField = function RenderField(_ref) {
|
|
|
526
526
|
delete _formItemProps.rules;
|
|
527
527
|
}
|
|
528
528
|
var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
|
|
529
|
-
var FormItem =
|
|
529
|
+
var FormItem = null;
|
|
530
|
+
FormItem = TargetComponent ? _jsx(_Form.Item, _objectSpread(_objectSpread({
|
|
530
531
|
validateFirst: true
|
|
531
532
|
}, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
532
533
|
className: _className,
|
|
@@ -535,6 +536,20 @@ var RenderField = function RenderField(_ref) {
|
|
|
535
536
|
})) : _jsx(Container, {
|
|
536
537
|
viewEmpty: viewEmpty
|
|
537
538
|
});
|
|
539
|
+
if (type === 'FormList') {
|
|
540
|
+
FormItem = _jsx(_Form.List, _objectSpread(_objectSpread({
|
|
541
|
+
name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName
|
|
542
|
+
}, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
543
|
+
children: function children(fields, operation, meta) {
|
|
544
|
+
return _jsx(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
545
|
+
otherProps: otherProps,
|
|
546
|
+
fields: fields,
|
|
547
|
+
operation: operation,
|
|
548
|
+
meta: meta
|
|
549
|
+
}));
|
|
550
|
+
}
|
|
551
|
+
}));
|
|
552
|
+
}
|
|
538
553
|
var originalTitle = originalDiffTip && originalValues ? _jsxs(_Space, {
|
|
539
554
|
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
540
555
|
isView: true,
|
|
@@ -66,12 +66,12 @@ export interface BaseActionProps<T = any> {
|
|
|
66
66
|
* @description 按钮前置校验事件
|
|
67
67
|
* @default -
|
|
68
68
|
*/
|
|
69
|
-
onClick?:
|
|
69
|
+
onClick?: (record?: any, index?: number) => any;
|
|
70
70
|
/**
|
|
71
71
|
* @description 按钮前置校验事件
|
|
72
72
|
* @default -
|
|
73
73
|
*/
|
|
74
|
-
onHandle?:
|
|
74
|
+
onHandle?: (record?: any, index?: number) => any;
|
|
75
75
|
/**
|
|
76
76
|
* @description 支持antd的Button属性
|
|
77
77
|
* @default -
|
|
@@ -250,6 +250,7 @@ export var transformColumns = function transformColumns() {
|
|
|
250
250
|
after = item.after;
|
|
251
251
|
// column设置label时,权重最高
|
|
252
252
|
var columnTitle = label || title;
|
|
253
|
+
item.title = columnTitle;
|
|
253
254
|
if (typeof columnTitle === 'string') {
|
|
254
255
|
item.originTitle = columnTitle;
|
|
255
256
|
if (tooltip) {
|
package/es/ProEnum/index.js
CHANGED
|
@@ -238,8 +238,11 @@ var ProEnum = function ProEnum(props) {
|
|
|
238
238
|
return item[fieldValue] === (v === null || v === void 0 ? void 0 : v[fieldValue]);
|
|
239
239
|
}
|
|
240
240
|
return item[fieldValue] === v;
|
|
241
|
-
});
|
|
242
|
-
|
|
241
|
+
}) || {};
|
|
242
|
+
if (!option) {
|
|
243
|
+
return '';
|
|
244
|
+
}
|
|
245
|
+
return enumProps.showCodeName ? "".concat(option === null || option === void 0 ? void 0 : option[fieldValue], "-").concat(option === null || option === void 0 ? void 0 : option[label]) : option === null || option === void 0 ? void 0 : option[label];
|
|
243
246
|
});
|
|
244
247
|
var record = value.map(function (v) {
|
|
245
248
|
return list.find(function (item) {
|
|
@@ -227,6 +227,10 @@ var InputNumber = function InputNumber(props) {
|
|
|
227
227
|
min: Number(_min),
|
|
228
228
|
max: Number(_max)
|
|
229
229
|
};
|
|
230
|
+
// 截取数字指定精度
|
|
231
|
+
if (props.precision !== undefined) {
|
|
232
|
+
value = Number(value.toFixed(props.precision));
|
|
233
|
+
}
|
|
230
234
|
switch (valueType || viewType) {
|
|
231
235
|
// 百分比
|
|
232
236
|
case 'percent':
|
|
@@ -241,7 +245,6 @@ var InputNumber = function InputNumber(props) {
|
|
|
241
245
|
value = limitNumber(value, limit);
|
|
242
246
|
break;
|
|
243
247
|
}
|
|
244
|
-
// 第一个类型转换值,第二个原始值
|
|
245
248
|
onBlur(value, Number(e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value));
|
|
246
249
|
};
|
|
247
250
|
return _jsx(_InputNumber, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
@@ -6,6 +6,8 @@ import _Popconfirm from "antd/es/popconfirm";
|
|
|
6
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
7
|
import "antd/es/space/style";
|
|
8
8
|
import _Space from "antd/es/space";
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
10
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
9
11
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
10
12
|
var _excluded = ["label", "onClick", "onHandle", "actionType", "needConfirm", "confirmProps", "title"],
|
|
11
13
|
_excluded2 = ["onClick", "label"];
|
|
@@ -128,17 +130,55 @@ var ActionButton = function ActionButton(props) {
|
|
|
128
130
|
}
|
|
129
131
|
return props.actionProps;
|
|
130
132
|
}, [props.actionProps]);
|
|
131
|
-
var handleClick = function
|
|
133
|
+
var handleClick = /*#__PURE__*/function () {
|
|
134
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(defaultCallback, callback, index, item) {
|
|
135
|
+
var value, data;
|
|
136
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
137
|
+
while (1) switch (_context.prev = _context.next) {
|
|
138
|
+
case 0:
|
|
139
|
+
value = form.getFieldValue(namePath);
|
|
140
|
+
_context.next = 3;
|
|
141
|
+
return callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
142
|
+
namePath: namePath,
|
|
143
|
+
index: index,
|
|
144
|
+
operation: operation,
|
|
145
|
+
form: form
|
|
146
|
+
});
|
|
147
|
+
case 3:
|
|
148
|
+
data = _context.sent;
|
|
149
|
+
if (!(!callback || data === true)) {
|
|
150
|
+
_context.next = 7;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
defaultCallback === null || defaultCallback === void 0 ? void 0 : defaultCallback(value, {
|
|
154
|
+
namePath: namePath,
|
|
155
|
+
index: index,
|
|
156
|
+
operation: operation,
|
|
157
|
+
form: form
|
|
158
|
+
});
|
|
159
|
+
return _context.abrupt("return");
|
|
160
|
+
case 7:
|
|
161
|
+
if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add') {
|
|
162
|
+
operation.add(data, index !== undefined ? index + 1 : undefined);
|
|
163
|
+
}
|
|
164
|
+
case 8:
|
|
165
|
+
case "end":
|
|
166
|
+
return _context.stop();
|
|
167
|
+
}
|
|
168
|
+
}, _callee);
|
|
169
|
+
}));
|
|
170
|
+
return function handleClick(_x, _x2, _x3, _x4) {
|
|
171
|
+
return _ref6.apply(this, arguments);
|
|
172
|
+
};
|
|
173
|
+
}();
|
|
174
|
+
var customClick = function customClick(callback, index) {
|
|
132
175
|
var value = form.getFieldValue(namePath);
|
|
133
|
-
|
|
176
|
+
callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
134
177
|
namePath: namePath,
|
|
135
178
|
index: index,
|
|
136
179
|
operation: operation,
|
|
137
180
|
form: form
|
|
138
181
|
});
|
|
139
|
-
if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add') {
|
|
140
|
-
operation.add(data, index !== undefined ? index + 1 : undefined);
|
|
141
|
-
}
|
|
142
182
|
};
|
|
143
183
|
var defaultActions = useMemo(function () {
|
|
144
184
|
return getDefaultActions(mode);
|
|
@@ -195,7 +235,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
195
235
|
return e.stopPropagation();
|
|
196
236
|
},
|
|
197
237
|
onConfirm: function onConfirm(e) {
|
|
198
|
-
handleClick(
|
|
238
|
+
handleClick(internalOnClick, _onClick, index, item);
|
|
199
239
|
}
|
|
200
240
|
}, _confirmProps), {}, {
|
|
201
241
|
children: _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, defaultRest), rest), {}, {
|
|
@@ -207,7 +247,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
207
247
|
}), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index)) : _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, defaultRest), rest), {}, {
|
|
208
248
|
onClick: function onClick(e) {
|
|
209
249
|
e.stopPropagation();
|
|
210
|
-
handleClick(
|
|
250
|
+
handleClick(internalOnClick, _onClick, index, item);
|
|
211
251
|
},
|
|
212
252
|
children: label || defaultLabel
|
|
213
253
|
}), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
|
|
@@ -218,7 +258,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
218
258
|
return e.stopPropagation();
|
|
219
259
|
},
|
|
220
260
|
onConfirm: function onConfirm() {
|
|
221
|
-
return
|
|
261
|
+
return customClick(_onClick, index);
|
|
222
262
|
}
|
|
223
263
|
}, _confirmProps), {}, {
|
|
224
264
|
children: _jsx(_Button, _objectSpread(_objectSpread({}, rest), {}, {
|
|
@@ -231,7 +271,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
231
271
|
key: "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index),
|
|
232
272
|
onClick: function onClick(e) {
|
|
233
273
|
e.stopPropagation();
|
|
234
|
-
|
|
274
|
+
customClick(_onClick, index);
|
|
235
275
|
}
|
|
236
276
|
}), label));
|
|
237
277
|
})
|
|
@@ -4,6 +4,8 @@ import _Button from "antd/es/button";
|
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
import "antd/es/space/style";
|
|
6
6
|
import _Space from "antd/es/space";
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
8
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
9
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
8
10
|
var _excluded = ["label", "onClick", "onHandle", "actionType"],
|
|
9
11
|
_excluded2 = ["onClick", "label"];
|
|
@@ -48,16 +50,52 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
48
50
|
}
|
|
49
51
|
return props.toolbarProps;
|
|
50
52
|
}, [props.toolbarProps]);
|
|
51
|
-
var handleClick = function
|
|
53
|
+
var handleClick = /*#__PURE__*/function () {
|
|
54
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(defaultCallback, callback, item) {
|
|
55
|
+
var value, data;
|
|
56
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
57
|
+
while (1) switch (_context.prev = _context.next) {
|
|
58
|
+
case 0:
|
|
59
|
+
value = form.getFieldValue(namePath);
|
|
60
|
+
_context.next = 3;
|
|
61
|
+
return callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
62
|
+
operation: operation,
|
|
63
|
+
form: form,
|
|
64
|
+
namePath: namePath
|
|
65
|
+
});
|
|
66
|
+
case 3:
|
|
67
|
+
data = _context.sent;
|
|
68
|
+
if (!(!callback || data === true)) {
|
|
69
|
+
_context.next = 7;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
defaultCallback === null || defaultCallback === void 0 ? void 0 : defaultCallback(value, {
|
|
73
|
+
operation: operation,
|
|
74
|
+
form: form,
|
|
75
|
+
namePath: namePath
|
|
76
|
+
});
|
|
77
|
+
return _context.abrupt("return");
|
|
78
|
+
case 7:
|
|
79
|
+
if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add' && data) {
|
|
80
|
+
operation.add(data);
|
|
81
|
+
}
|
|
82
|
+
case 8:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context.stop();
|
|
85
|
+
}
|
|
86
|
+
}, _callee);
|
|
87
|
+
}));
|
|
88
|
+
return function handleClick(_x, _x2, _x3) {
|
|
89
|
+
return _ref2.apply(this, arguments);
|
|
90
|
+
};
|
|
91
|
+
}();
|
|
92
|
+
var customClick = function customClick(callback, item) {
|
|
52
93
|
var value = form.getFieldValue(namePath);
|
|
53
|
-
|
|
94
|
+
callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
54
95
|
operation: operation,
|
|
55
96
|
form: form,
|
|
56
97
|
namePath: namePath
|
|
57
98
|
});
|
|
58
|
-
if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add' && data) {
|
|
59
|
-
operation.add(data);
|
|
60
|
-
}
|
|
61
99
|
};
|
|
62
100
|
return _jsx(_Space, {
|
|
63
101
|
align: "start",
|
|
@@ -88,14 +126,14 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
88
126
|
}
|
|
89
127
|
return _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, actions[actionType]), rest), {}, {
|
|
90
128
|
onClick: function onClick() {
|
|
91
|
-
return handleClick(
|
|
129
|
+
return handleClick(internalOnClick, _onClick, item);
|
|
92
130
|
},
|
|
93
131
|
children: label || defaultLabel
|
|
94
132
|
}), actionType);
|
|
95
133
|
}
|
|
96
134
|
return _jsx(_Button, _objectSpread(_objectSpread({}, rest), {}, {
|
|
97
135
|
onClick: function onClick() {
|
|
98
|
-
return
|
|
136
|
+
return customClick(_onClick2, item);
|
|
99
137
|
},
|
|
100
138
|
children: label
|
|
101
139
|
}), actionType);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './index.less';
|
|
3
|
+
var AddonWrapper = function AddonWrapper(props) {
|
|
4
|
+
var before = props.before,
|
|
5
|
+
after = props.after,
|
|
6
|
+
children = props.children;
|
|
7
|
+
return _jsxs("div", {
|
|
8
|
+
className: "addon-wrapper",
|
|
9
|
+
children: [before && _jsx("div", {
|
|
10
|
+
className: "before",
|
|
11
|
+
children: before
|
|
12
|
+
}), children, after && _jsx("div", {
|
|
13
|
+
className: "after",
|
|
14
|
+
children: after
|
|
15
|
+
})]
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export default AddonWrapper;
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after"];
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import ConfirmWrapper from '../../../../components/render/ConfirmWrapper';
|
|
7
8
|
import { FieldProvider } from '../../../../utils/useFieldProps';
|
|
8
9
|
import * as componentMap from '../../../../../index';
|
|
10
|
+
import AddonWrapper from './AddonWrapper';
|
|
11
|
+
// 这里的key与组件内参数一致, 决定使用哪个包裹组件
|
|
12
|
+
var wrapperMap = {
|
|
13
|
+
confirm: ConfirmWrapper,
|
|
14
|
+
before: AddonWrapper,
|
|
15
|
+
after: AddonWrapper
|
|
16
|
+
};
|
|
17
|
+
// 增加middleware根据配置增加多层包裹
|
|
18
|
+
var getComRender = function getComRender(component, props, componentProps) {
|
|
19
|
+
var wrappers = Object.keys(wrapperMap);
|
|
20
|
+
var Com = component;
|
|
21
|
+
wrappers.forEach(function (item) {
|
|
22
|
+
if (item in props) {
|
|
23
|
+
var Wrapper = wrapperMap[item];
|
|
24
|
+
Com = _jsx(Wrapper, _objectSpread(_objectSpread(_objectSpread({}, componentProps), _defineProperty({}, item, props[item])), {}, {
|
|
25
|
+
children: Com
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return Com;
|
|
30
|
+
};
|
|
9
31
|
/** 渲染组件 */
|
|
10
32
|
var ComRender = function ComRender(props) {
|
|
11
33
|
var type = props.type,
|
|
@@ -13,24 +35,18 @@ var ComRender = function ComRender(props) {
|
|
|
13
35
|
component = props.component,
|
|
14
36
|
fieldProps = props.fieldProps,
|
|
15
37
|
contextProps = props.contextProps,
|
|
38
|
+
before = props.before,
|
|
39
|
+
after = props.after,
|
|
16
40
|
rest = _objectWithoutProperties(props, _excluded);
|
|
17
41
|
var TypeComponent = componentMap[type];
|
|
18
42
|
var componentProps = _objectSpread(_objectSpread({}, fieldProps), rest);
|
|
19
|
-
var Component;
|
|
20
|
-
|
|
21
|
-
Component = _jsx(ConfirmWrapper, _objectSpread(_objectSpread({
|
|
22
|
-
confirm: confirm
|
|
23
|
-
}, componentProps), {}, {
|
|
24
|
-
children: component || _jsx(TypeComponent, _objectSpread({}, componentProps))
|
|
25
|
-
}));
|
|
26
|
-
} else {
|
|
27
|
-
Component = component ? ( /*#__PURE__*/React.cloneElement(component, _objectSpread({}, componentProps))) : _jsx(TypeComponent, _objectSpread({}, componentProps));
|
|
28
|
-
}
|
|
43
|
+
var Component = component ? ( /*#__PURE__*/React.cloneElement(component, _objectSpread({}, componentProps))) : _jsx(TypeComponent, _objectSpread({}, componentProps));
|
|
44
|
+
var Com = getComRender(Component, props, componentProps);
|
|
29
45
|
return _jsx(FieldProvider, {
|
|
30
46
|
value: _objectSpread(_objectSpread({}, contextProps), {}, {
|
|
31
47
|
type: type
|
|
32
48
|
}),
|
|
33
|
-
children:
|
|
49
|
+
children: Com
|
|
34
50
|
});
|
|
35
51
|
};
|
|
36
52
|
export default ComRender;
|
|
@@ -6,5 +6,5 @@ import { GroupProps } from './propsType';
|
|
|
6
6
|
*
|
|
7
7
|
* render内部能力 show, component, value, onChange, disabled, clearNotShow, fieldProps
|
|
8
8
|
*/
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
9
|
+
declare const Group: React.FC<GroupProps>;
|
|
10
|
+
export default Group;
|
|
@@ -16,7 +16,7 @@ import ComRender from './component/ComRender';
|
|
|
16
16
|
*
|
|
17
17
|
* render内部能力 show, component, value, onChange, disabled, clearNotShow, fieldProps
|
|
18
18
|
*/
|
|
19
|
-
var
|
|
19
|
+
var Group = function Group(props) {
|
|
20
20
|
var children = props.children,
|
|
21
21
|
className = props.className,
|
|
22
22
|
_props$space = props.space,
|
|
@@ -66,12 +66,12 @@ var GroupCopy = function GroupCopy(props) {
|
|
|
66
66
|
return _jsx("div", {
|
|
67
67
|
className: _className,
|
|
68
68
|
children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
|
|
69
|
-
children: columns.map(function (column) {
|
|
69
|
+
children: columns.map(function (column, index) {
|
|
70
70
|
return _jsx(ComRender, _objectSpread(_objectSpread({
|
|
71
71
|
contextProps: contextProps
|
|
72
72
|
}, column), {}, {
|
|
73
73
|
otherProps: otherProps
|
|
74
|
-
}));
|
|
74
|
+
}), column.name);
|
|
75
75
|
})
|
|
76
76
|
}) : _jsx(_Space, _objectSpread(_objectSpread({
|
|
77
77
|
align: "start"
|
|
@@ -81,9 +81,9 @@ var GroupCopy = function GroupCopy(props) {
|
|
|
81
81
|
contextProps: contextProps
|
|
82
82
|
}, column), {}, {
|
|
83
83
|
otherProps: otherProps
|
|
84
|
-
}));
|
|
84
|
+
}), column.name);
|
|
85
85
|
})
|
|
86
86
|
}))
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
|
-
export default
|
|
89
|
+
export default Group;
|
|
@@ -193,7 +193,7 @@ export var transformColumns = function transformColumns(params) {
|
|
|
193
193
|
fieldProps: fieldProps,
|
|
194
194
|
name: columnName
|
|
195
195
|
});
|
|
196
|
-
}, [value, show, fieldProps, columnName, type]);
|
|
196
|
+
}, [value, show, fieldProps, _disabled, columnName, type]);
|
|
197
197
|
if (reactiveProps.show === false) {
|
|
198
198
|
return [];
|
|
199
199
|
}
|
|
@@ -15,7 +15,7 @@ import _Typography from "antd/es/typography";
|
|
|
15
15
|
var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator"];
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { useEffect, useState, memo, useMemo } from 'react';
|
|
18
|
-
import {
|
|
18
|
+
import { omit } from 'lodash';
|
|
19
19
|
import { transformDataName } from './utils/index';
|
|
20
20
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
21
21
|
import useEnum from '../../../../ProEnum/hooks/useEnum';
|
|
@@ -95,7 +95,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
95
95
|
var realDataSource = useMemo(function () {
|
|
96
96
|
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
|
97
97
|
var result = isAddressMode && realLevel === 2 ? filterDataSource(innerDataSource, level) : innerDataSource;
|
|
98
|
-
return
|
|
98
|
+
return transformDataName(result, fieldNames);
|
|
99
99
|
}, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
|
100
100
|
var _useRequest = _objectSpread({}, useRequest),
|
|
101
101
|
service = _useRequest.service,
|
|
@@ -5,6 +5,9 @@ export var transformDataName = function transformDataName(dataSource, fieldNames
|
|
|
5
5
|
value = fieldNames.value,
|
|
6
6
|
children = fieldNames.children,
|
|
7
7
|
extraFields = _objectWithoutProperties(fieldNames, _excluded);
|
|
8
|
+
if (!(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 'label' in dataSource[0] && 'value' in dataSource[0] && 'children' in dataSource[0]) {
|
|
9
|
+
return dataSource;
|
|
10
|
+
}
|
|
8
11
|
function transformNode(node) {
|
|
9
12
|
var newNode = {
|
|
10
13
|
label: node[label],
|
|
@@ -47,9 +47,9 @@ export var getSelectList = function getSelectList(_ref2) {
|
|
|
47
47
|
}
|
|
48
48
|
var listName = otherProps.listName,
|
|
49
49
|
form = otherProps.form;
|
|
50
|
-
var firstNumberIndex = listName.
|
|
50
|
+
var firstNumberIndex = listName.lastIndexOf(listName.findLast(function (item) {
|
|
51
51
|
return typeof item === 'number';
|
|
52
|
-
});
|
|
52
|
+
}));
|
|
53
53
|
var fatherName = listName.slice(0, firstNumberIndex);
|
|
54
54
|
var selectName = listName.slice(firstNumberIndex + 1);
|
|
55
55
|
return findSelectNameValues({
|
|
@@ -337,11 +337,14 @@ function List(props) {
|
|
|
337
337
|
return loop(newTreeData, -1);
|
|
338
338
|
}
|
|
339
339
|
var _treeData = fn();
|
|
340
|
-
var onExpand = function onExpand(newExpandedKeys) {
|
|
340
|
+
var onExpand = function onExpand(newExpandedKeys, nextPara) {
|
|
341
341
|
setState({
|
|
342
342
|
expandedKeys: newExpandedKeys,
|
|
343
343
|
autoExpandParent: false
|
|
344
344
|
});
|
|
345
|
+
if (other.onExpand) {
|
|
346
|
+
other.onExpand(newExpandedKeys, nextPara);
|
|
347
|
+
}
|
|
345
348
|
};
|
|
346
349
|
var others = other;
|
|
347
350
|
return _jsx("div", {
|
|
@@ -65,6 +65,11 @@ export interface ProTreeProps extends PropTreeSelectProps {
|
|
|
65
65
|
onSelect?: (values: string[] | AllValueType, info?: any) => any;
|
|
66
66
|
/** 复选情况下点击checkbox触发,参照antd */
|
|
67
67
|
onCheck?: (values: string[] | AllValueType, info?: any) => any;
|
|
68
|
+
onExpand?: (newExpandedKeys: React.Key[], nextPara: {
|
|
69
|
+
expanded: boolean;
|
|
70
|
+
node: DataOption;
|
|
71
|
+
nativeEvent: PointerEvent;
|
|
72
|
+
}) => void;
|
|
68
73
|
/** 自定义展示 */
|
|
69
74
|
optionRender?: (item: any, searchStr: string) => string | ReactNode;
|
|
70
75
|
/** 对后台返回数据进行格式化 */
|
|
@@ -529,7 +529,8 @@ var RenderField = function RenderField(_ref) {
|
|
|
529
529
|
delete _formItemProps.rules;
|
|
530
530
|
}
|
|
531
531
|
var _className = (0, _classnames.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, className, className), 'pro-form-item-changed', changed));
|
|
532
|
-
var FormItem =
|
|
532
|
+
var FormItem = null;
|
|
533
|
+
FormItem = TargetComponent ? (0, _jsxRuntime.jsx)(_antd.Form.Item, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
533
534
|
validateFirst: true
|
|
534
535
|
}, (0, _lodash.omit)(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
535
536
|
className: _className,
|
|
@@ -538,6 +539,20 @@ var RenderField = function RenderField(_ref) {
|
|
|
538
539
|
})) : (0, _jsxRuntime.jsx)(_Container.default, {
|
|
539
540
|
viewEmpty: viewEmpty
|
|
540
541
|
});
|
|
542
|
+
if (type === 'FormList') {
|
|
543
|
+
FormItem = (0, _jsxRuntime.jsx)(_antd.Form.List, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
544
|
+
name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName
|
|
545
|
+
}, (0, _lodash.omit)(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
546
|
+
children: function children(fields, operation, meta) {
|
|
547
|
+
return (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
|
|
548
|
+
otherProps: otherProps,
|
|
549
|
+
fields: fields,
|
|
550
|
+
operation: operation,
|
|
551
|
+
meta: meta
|
|
552
|
+
}));
|
|
553
|
+
}
|
|
554
|
+
}));
|
|
555
|
+
}
|
|
541
556
|
var originalTitle = originalDiffTip && originalValues ? (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
542
557
|
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
|
|
543
558
|
isView: true,
|
|
@@ -66,12 +66,12 @@ export interface BaseActionProps<T = any> {
|
|
|
66
66
|
* @description 按钮前置校验事件
|
|
67
67
|
* @default -
|
|
68
68
|
*/
|
|
69
|
-
onClick?:
|
|
69
|
+
onClick?: (record?: any, index?: number) => any;
|
|
70
70
|
/**
|
|
71
71
|
* @description 按钮前置校验事件
|
|
72
72
|
* @default -
|
|
73
73
|
*/
|
|
74
|
-
onHandle?:
|
|
74
|
+
onHandle?: (record?: any, index?: number) => any;
|
|
75
75
|
/**
|
|
76
76
|
* @description 支持antd的Button属性
|
|
77
77
|
* @default -
|
|
@@ -254,6 +254,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
254
254
|
after = item.after;
|
|
255
255
|
// column设置label时,权重最高
|
|
256
256
|
var columnTitle = label || title;
|
|
257
|
+
item.title = columnTitle;
|
|
257
258
|
if (typeof columnTitle === 'string') {
|
|
258
259
|
item.originTitle = columnTitle;
|
|
259
260
|
if (tooltip) {
|
package/lib/ProEnum/index.js
CHANGED
|
@@ -239,8 +239,11 @@ var ProEnum = function ProEnum(props) {
|
|
|
239
239
|
return item[fieldValue] === (v === null || v === void 0 ? void 0 : v[fieldValue]);
|
|
240
240
|
}
|
|
241
241
|
return item[fieldValue] === v;
|
|
242
|
-
});
|
|
243
|
-
|
|
242
|
+
}) || {};
|
|
243
|
+
if (!option) {
|
|
244
|
+
return '';
|
|
245
|
+
}
|
|
246
|
+
return enumProps.showCodeName ? "".concat(option === null || option === void 0 ? void 0 : option[fieldValue], "-").concat(option === null || option === void 0 ? void 0 : option[label]) : option === null || option === void 0 ? void 0 : option[label];
|
|
244
247
|
});
|
|
245
248
|
var record = value.map(function (v) {
|
|
246
249
|
return list.find(function (item) {
|
|
@@ -231,6 +231,10 @@ var InputNumber = function InputNumber(props) {
|
|
|
231
231
|
min: Number(_min),
|
|
232
232
|
max: Number(_max)
|
|
233
233
|
};
|
|
234
|
+
// 截取数字指定精度
|
|
235
|
+
if (props.precision !== undefined) {
|
|
236
|
+
value = Number(value.toFixed(props.precision));
|
|
237
|
+
}
|
|
234
238
|
switch (valueType || viewType) {
|
|
235
239
|
// 百分比
|
|
236
240
|
case 'percent':
|
|
@@ -245,7 +249,6 @@ var InputNumber = function InputNumber(props) {
|
|
|
245
249
|
value = limitNumber(value, limit);
|
|
246
250
|
break;
|
|
247
251
|
}
|
|
248
|
-
// 第一个类型转换值,第二个原始值
|
|
249
252
|
onBlur(value, Number(e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value));
|
|
250
253
|
};
|
|
251
254
|
return (0, _jsxRuntime.jsx)(_antd.InputNumber, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|