@zat-design/sisyphus-react 3.4.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 +2 -2
- package/dist/less.esm.css +2 -2
- package/es/ProEditTable/components/RenderField/index.js +20 -1
- package/es/ProEditTable/propsType.d.ts +2 -2
- package/es/ProEditTable/utils/index.js +1 -0
- package/es/ProEnum/components/Group.d.ts +1 -0
- package/es/ProEnum/index.js +11 -5
- package/es/ProEnum/style/index.less +2 -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 +3 -2
- package/es/ProForm/components/combination/ProCascader/index.js +2 -2
- package/es/ProForm/components/combination/ProCascader/utils/index.js +3 -0
- package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.js +6 -2
- package/es/ProForm/components/render/RenderFields.js +4 -1
- package/es/ProLayout/components/ProCollapse/style/index.less +5 -2
- package/es/ProLayout/style/index.less +1 -1
- package/es/ProSelect/index.js +6 -3
- package/es/ProSelect/utils/index.d.ts +2 -1
- package/es/ProSelect/utils/index.js +9 -6
- package/es/ProTree/components/Tree.js +4 -1
- package/es/ProTree/propsType.d.ts +5 -0
- package/lib/ProEditTable/components/RenderField/index.js +20 -1
- package/lib/ProEditTable/propsType.d.ts +2 -2
- package/lib/ProEditTable/utils/index.js +1 -0
- package/lib/ProEnum/components/Group.d.ts +1 -0
- package/lib/ProEnum/index.js +11 -5
- package/lib/ProEnum/style/index.less +2 -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 +3 -2
- package/lib/ProForm/components/combination/ProCascader/index.js +1 -1
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +3 -0
- package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +6 -2
- package/lib/ProForm/components/render/RenderFields.js +4 -1
- package/lib/ProLayout/components/ProCollapse/style/index.less +5 -2
- package/lib/ProLayout/style/index.less +1 -1
- package/lib/ProSelect/index.js +6 -3
- package/lib/ProSelect/utils/index.d.ts +2 -1
- package/lib/ProSelect/utils/index.js +9 -6
- package/lib/ProTree/components/Tree.js +4 -1
- package/lib/ProTree/propsType.d.ts +5 -0
- package/package.json +2 -2
- 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
|
@@ -682,7 +682,7 @@
|
|
|
682
682
|
.pro-collapse .pro-collapse-icon img {
|
|
683
683
|
vertical-align: sub;
|
|
684
684
|
}
|
|
685
|
-
.pro-collapse.pro-collapse-no-title .ant-collapse-header {
|
|
685
|
+
.pro-collapse.pro-collapse-no-title > .pro-collapse-panel > .ant-collapse-header {
|
|
686
686
|
display: none !important;
|
|
687
687
|
}
|
|
688
688
|
.pro-collapse.pro-collapse-no-title .pro-collapse-level2 .ant-collapse-header {
|
|
@@ -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
|
@@ -682,7 +682,7 @@
|
|
|
682
682
|
.pro-collapse .pro-collapse-icon img {
|
|
683
683
|
vertical-align: sub;
|
|
684
684
|
}
|
|
685
|
-
.pro-collapse.pro-collapse-no-title .ant-collapse-header {
|
|
685
|
+
.pro-collapse.pro-collapse-no-title > .pro-collapse-panel > .ant-collapse-header {
|
|
686
686
|
display: none !important;
|
|
687
687
|
}
|
|
688
688
|
.pro-collapse.pro-collapse-no-title .pro-collapse-level2 .ant-collapse-header {
|
|
@@ -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 {
|
|
@@ -89,6 +89,10 @@ var RenderField = function RenderField(_ref) {
|
|
|
89
89
|
}
|
|
90
90
|
// type类型 首字母转大写
|
|
91
91
|
type = ((_type = type) === null || _type === void 0 ? void 0 : (_type$replace = _type.replace) === null || _type$replace === void 0 ? void 0 : _type$replace.call(_type, type[0], type[0].toUpperCase())) || 'Input';
|
|
92
|
+
// 自定义组件时 防止默认值影像后续判断
|
|
93
|
+
if ('component' in column) {
|
|
94
|
+
type = null;
|
|
95
|
+
}
|
|
92
96
|
// 单行正在编辑时,临时生成一套formItem用来存储中间值,点击取消时候重置回上一次状态
|
|
93
97
|
var namePath = getNamePath(name, virtualKey);
|
|
94
98
|
var rowData = form.getFieldValue([].concat(_toConsumableArray(namePath), [index])) || record || {};
|
|
@@ -522,7 +526,8 @@ var RenderField = function RenderField(_ref) {
|
|
|
522
526
|
delete _formItemProps.rules;
|
|
523
527
|
}
|
|
524
528
|
var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
|
|
525
|
-
var FormItem =
|
|
529
|
+
var FormItem = null;
|
|
530
|
+
FormItem = TargetComponent ? _jsx(_Form.Item, _objectSpread(_objectSpread({
|
|
526
531
|
validateFirst: true
|
|
527
532
|
}, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
528
533
|
className: _className,
|
|
@@ -531,6 +536,20 @@ var RenderField = function RenderField(_ref) {
|
|
|
531
536
|
})) : _jsx(Container, {
|
|
532
537
|
viewEmpty: viewEmpty
|
|
533
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
|
+
}
|
|
534
553
|
var originalTitle = originalDiffTip && originalValues ? _jsxs(_Space, {
|
|
535
554
|
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
536
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
|
@@ -12,7 +12,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
12
12
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
14
14
|
var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps"],
|
|
15
|
-
_excluded2 = ["fieldNames", "clear", "cacheKey"];
|
|
15
|
+
_excluded2 = ["fieldNames", "clear", "cacheKey", "showCodeName"];
|
|
16
16
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
17
|
import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
|
|
18
18
|
import React, { useState, useEffect, useMemo } from 'react';
|
|
@@ -28,6 +28,7 @@ import useEnum from './hooks/useEnum';
|
|
|
28
28
|
import locale from '../locale';
|
|
29
29
|
import './style/index.less';
|
|
30
30
|
var ProEnum = function ProEnum(props) {
|
|
31
|
+
var _enumProps$showCodeNa;
|
|
31
32
|
var code = props.code,
|
|
32
33
|
_props$type = props.type,
|
|
33
34
|
type = _props$type === void 0 ? 'ProSelect' : _props$type,
|
|
@@ -41,15 +42,16 @@ var ProEnum = function ProEnum(props) {
|
|
|
41
42
|
enumProps = _objectWithoutProperties(props, _excluded);
|
|
42
43
|
var _ref = otherProps || {},
|
|
43
44
|
isView = _ref.isView,
|
|
44
|
-
viewEmpty = _ref.viewEmpty
|
|
45
|
-
disabled = _ref.disabled;
|
|
45
|
+
viewEmpty = _ref.viewEmpty;
|
|
46
46
|
var _ref2 = useProConfig('ProEnum') || {},
|
|
47
47
|
fieldNames = _ref2.fieldNames,
|
|
48
48
|
_ref2$clear = _ref2.clear,
|
|
49
49
|
clear = _ref2$clear === void 0 ? true : _ref2$clear,
|
|
50
50
|
_ref2$cacheKey = _ref2.cacheKey,
|
|
51
51
|
cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
|
|
52
|
+
showCodeName = _ref2.showCodeName,
|
|
52
53
|
resProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
54
|
+
enumProps.showCodeName = (_enumProps$showCodeNa = enumProps.showCodeName) !== null && _enumProps$showCodeNa !== void 0 ? _enumProps$showCodeNa : showCodeName;
|
|
53
55
|
var label = '';
|
|
54
56
|
var fieldValue = '';
|
|
55
57
|
var _useState = useState(dataSource || []),
|
|
@@ -165,6 +167,7 @@ var ProEnum = function ProEnum(props) {
|
|
|
165
167
|
switch (type) {
|
|
166
168
|
case 'ProSelect':
|
|
167
169
|
return _jsx(ProSelect, _objectSpread(_objectSpread({}, enumProps), {}, {
|
|
170
|
+
otherProps: otherProps,
|
|
168
171
|
dataSource: list,
|
|
169
172
|
fieldNames: {
|
|
170
173
|
label: label,
|
|
@@ -235,8 +238,11 @@ var ProEnum = function ProEnum(props) {
|
|
|
235
238
|
return item[fieldValue] === (v === null || v === void 0 ? void 0 : v[fieldValue]);
|
|
236
239
|
}
|
|
237
240
|
return item[fieldValue] === v;
|
|
238
|
-
});
|
|
239
|
-
|
|
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];
|
|
240
246
|
});
|
|
241
247
|
var record = value.map(function (v) {
|
|
242
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
|
}
|
|
@@ -220,7 +220,8 @@ export var transformColumns = function transformColumns(params) {
|
|
|
220
220
|
onFieldChange === null || onFieldChange === void 0 ? void 0 : onFieldChange(newValue, form.getFieldValue(namePath), {
|
|
221
221
|
index: outerIndex,
|
|
222
222
|
namePath: namePath,
|
|
223
|
-
form: form
|
|
223
|
+
form: form,
|
|
224
|
+
option: args === null || args === void 0 ? void 0 : args[1]
|
|
224
225
|
});
|
|
225
226
|
};
|
|
226
227
|
return _objectSpread(_objectSpread(_objectSpread({}, column), {}, {
|
|
@@ -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],
|
|
@@ -122,8 +122,12 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
122
122
|
start = _ref9[0],
|
|
123
123
|
end = _ref9[1];
|
|
124
124
|
if (e.target.checked) {
|
|
125
|
-
var _start, _end;
|
|
126
|
-
|
|
125
|
+
var _rest$allowEmpty, _start, _end;
|
|
126
|
+
if (((_rest$allowEmpty = rest.allowEmpty) === null || _rest$allowEmpty === void 0 ? void 0 : _rest$allowEmpty[0]) === true) {
|
|
127
|
+
start = null;
|
|
128
|
+
} else {
|
|
129
|
+
start = start || moment().startOf('day');
|
|
130
|
+
}
|
|
127
131
|
end = foreverMoment;
|
|
128
132
|
onChange([start, end, e.target.checked], [(_start = start) === null || _start === void 0 ? void 0 : _start.format(format), (_end = end) === null || _end === void 0 ? void 0 : _end.format(format), foreverStr]);
|
|
129
133
|
} else {
|
|
@@ -109,9 +109,12 @@ var RenderFields = function RenderFields(props) {
|
|
|
109
109
|
if (typeof _type === 'string') {
|
|
110
110
|
TargetComponent = _isView && viewRender ? viewRenderHandle : componentMap[_type];
|
|
111
111
|
}
|
|
112
|
+
// 自定义组件时 防止默认值影像后续判断
|
|
113
|
+
if ('component' in column) {
|
|
114
|
+
_type = null;
|
|
115
|
+
}
|
|
112
116
|
if (component && /*#__PURE__*/React.isValidElement(component)) {
|
|
113
117
|
var _newComponent$props;
|
|
114
|
-
_type = null;
|
|
115
118
|
var newComponent = component;
|
|
116
119
|
var isProEditTable = (newComponent === null || newComponent === void 0 ? void 0 : (_newComponent$props = newComponent.props) === null || _newComponent$props === void 0 ? void 0 : _newComponent$props.onlyOneLineMsg) === '请先保存数据';
|
|
117
120
|
TargetComponent = _isView ? viewRenderHandle || '' : component;
|