@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
|
@@ -11,9 +11,12 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
&.pro-collapse-no-title {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
&>.pro-collapse-panel{
|
|
15
|
+
&>.@{ant-prefix}-collapse-header {
|
|
16
|
+
display: none !important;
|
|
17
|
+
}
|
|
16
18
|
}
|
|
19
|
+
|
|
17
20
|
.pro-collapse-level2{
|
|
18
21
|
.@{ant-prefix}-collapse-header {
|
|
19
22
|
display: flex !important;
|
package/es/ProSelect/index.js
CHANGED
|
@@ -23,10 +23,11 @@ import { getSelectList } from './utils';
|
|
|
23
23
|
import './index.less';
|
|
24
24
|
var Option = _Select.Option;
|
|
25
25
|
export var ProSelect = function ProSelect(props, ref) {
|
|
26
|
-
var _locale$ProSelect;
|
|
26
|
+
var _selectProps$showCode, _locale$ProSelect;
|
|
27
27
|
var _ref = useProConfig('ProSelect') || {},
|
|
28
28
|
_ref$fieldNames = _ref.fieldNames,
|
|
29
|
-
proSelectFieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames
|
|
29
|
+
proSelectFieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
|
|
30
|
+
showCodeName = _ref.showCodeName;
|
|
30
31
|
var label = 'label';
|
|
31
32
|
var code = 'value';
|
|
32
33
|
if (proSelectFieldNames && Object.keys(proSelectFieldNames).length) {
|
|
@@ -54,6 +55,7 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
|
54
55
|
transformResponse = props.transformResponse,
|
|
55
56
|
isViewPro = props.isView,
|
|
56
57
|
selectProps = _objectWithoutProperties(props, _excluded);
|
|
58
|
+
selectProps.showCodeName = (_selectProps$showCode = selectProps.showCodeName) !== null && _selectProps$showCode !== void 0 ? _selectProps$showCode : showCodeName;
|
|
57
59
|
var value = props.value;
|
|
58
60
|
var _ref2 = ProForm.useFieldProps() || {},
|
|
59
61
|
isViewCon = _ref2.isView,
|
|
@@ -274,7 +276,8 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
|
274
276
|
otherProps: otherProps,
|
|
275
277
|
value: props.value,
|
|
276
278
|
dataSource: selectList,
|
|
277
|
-
labelInValue: labelInValue
|
|
279
|
+
labelInValue: labelInValue,
|
|
280
|
+
fieldNames: fieldNames
|
|
278
281
|
});
|
|
279
282
|
}
|
|
280
283
|
return _jsx(_Select, _objectSpread(_objectSpread({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 返回当前组件可以显示的数据源
|
|
3
3
|
*/
|
|
4
|
-
export declare const getSelectList: ({ otherProps, value, dataSource, labelInValue, }: {
|
|
4
|
+
export declare const getSelectList: ({ otherProps, value, dataSource, labelInValue, fieldNames, }: {
|
|
5
5
|
otherProps: any;
|
|
6
6
|
value: any;
|
|
7
7
|
dataSource: any;
|
|
8
8
|
labelInValue: any;
|
|
9
|
+
fieldNames: any;
|
|
9
10
|
}) => any;
|
|
@@ -6,7 +6,8 @@ var findSelectNameValues = function findSelectNameValues(_ref) {
|
|
|
6
6
|
selectName = _ref.selectName,
|
|
7
7
|
value = _ref.value,
|
|
8
8
|
dataSource = _ref.dataSource,
|
|
9
|
-
labelInValue = _ref.labelInValue
|
|
9
|
+
labelInValue = _ref.labelInValue,
|
|
10
|
+
fieldNames = _ref.fieldNames;
|
|
10
11
|
var selectValues = [];
|
|
11
12
|
list.forEach(function (item) {
|
|
12
13
|
var result = item;
|
|
@@ -29,7 +30,7 @@ var findSelectNameValues = function findSelectNameValues(_ref) {
|
|
|
29
30
|
});
|
|
30
31
|
var diffList = _.difference(selectValues, [value]);
|
|
31
32
|
return dataSource.filter(function (item) {
|
|
32
|
-
return !diffList.includes(labelInValue ? item : item.value);
|
|
33
|
+
return !diffList.includes(labelInValue ? item : item[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value] || (item === null || item === void 0 ? void 0 : item.value));
|
|
33
34
|
});
|
|
34
35
|
};
|
|
35
36
|
/**
|
|
@@ -39,15 +40,16 @@ export var getSelectList = function getSelectList(_ref2) {
|
|
|
39
40
|
var otherProps = _ref2.otherProps,
|
|
40
41
|
value = _ref2.value,
|
|
41
42
|
dataSource = _ref2.dataSource,
|
|
42
|
-
labelInValue = _ref2.labelInValue
|
|
43
|
+
labelInValue = _ref2.labelInValue,
|
|
44
|
+
fieldNames = _ref2.fieldNames;
|
|
43
45
|
if (!otherProps) {
|
|
44
46
|
return null;
|
|
45
47
|
}
|
|
46
48
|
var listName = otherProps.listName,
|
|
47
49
|
form = otherProps.form;
|
|
48
|
-
var firstNumberIndex = listName.
|
|
50
|
+
var firstNumberIndex = listName.lastIndexOf(listName.findLast(function (item) {
|
|
49
51
|
return typeof item === 'number';
|
|
50
|
-
});
|
|
52
|
+
}));
|
|
51
53
|
var fatherName = listName.slice(0, firstNumberIndex);
|
|
52
54
|
var selectName = listName.slice(firstNumberIndex + 1);
|
|
53
55
|
return findSelectNameValues({
|
|
@@ -55,6 +57,7 @@ export var getSelectList = function getSelectList(_ref2) {
|
|
|
55
57
|
selectName: selectName,
|
|
56
58
|
value: value,
|
|
57
59
|
dataSource: dataSource,
|
|
58
|
-
labelInValue: labelInValue
|
|
60
|
+
labelInValue: labelInValue,
|
|
61
|
+
fieldNames: fieldNames
|
|
59
62
|
});
|
|
60
63
|
};
|
|
@@ -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
|
/** 对后台返回数据进行格式化 */
|
|
@@ -92,6 +92,10 @@ var RenderField = function RenderField(_ref) {
|
|
|
92
92
|
}
|
|
93
93
|
// type类型 首字母转大写
|
|
94
94
|
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';
|
|
95
|
+
// 自定义组件时 防止默认值影像后续判断
|
|
96
|
+
if ('component' in column) {
|
|
97
|
+
type = null;
|
|
98
|
+
}
|
|
95
99
|
// 单行正在编辑时,临时生成一套formItem用来存储中间值,点击取消时候重置回上一次状态
|
|
96
100
|
var namePath = (0, _tools.getNamePath)(name, virtualKey);
|
|
97
101
|
var rowData = form.getFieldValue([].concat((0, _toConsumableArray2.default)(namePath), [index])) || record || {};
|
|
@@ -525,7 +529,8 @@ var RenderField = function RenderField(_ref) {
|
|
|
525
529
|
delete _formItemProps.rules;
|
|
526
530
|
}
|
|
527
531
|
var _className = (0, _classnames.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, className, className), 'pro-form-item-changed', changed));
|
|
528
|
-
var FormItem =
|
|
532
|
+
var FormItem = null;
|
|
533
|
+
FormItem = TargetComponent ? (0, _jsxRuntime.jsx)(_antd.Form.Item, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
529
534
|
validateFirst: true
|
|
530
535
|
}, (0, _lodash.omit)(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
531
536
|
className: _className,
|
|
@@ -534,6 +539,20 @@ var RenderField = function RenderField(_ref) {
|
|
|
534
539
|
})) : (0, _jsxRuntime.jsx)(_Container.default, {
|
|
535
540
|
viewEmpty: viewEmpty
|
|
536
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
|
+
}
|
|
537
556
|
var originalTitle = originalDiffTip && originalValues ? (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
538
557
|
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
|
|
539
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
|
@@ -27,8 +27,9 @@ var _useEnum = _interopRequireDefault(require("./hooks/useEnum"));
|
|
|
27
27
|
var _locale = _interopRequireDefault(require("../locale"));
|
|
28
28
|
require("./style/index.less");
|
|
29
29
|
var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps"],
|
|
30
|
-
_excluded2 = ["fieldNames", "clear", "cacheKey"];
|
|
30
|
+
_excluded2 = ["fieldNames", "clear", "cacheKey", "showCodeName"];
|
|
31
31
|
var ProEnum = function ProEnum(props) {
|
|
32
|
+
var _enumProps$showCodeNa;
|
|
32
33
|
var code = props.code,
|
|
33
34
|
_props$type = props.type,
|
|
34
35
|
type = _props$type === void 0 ? 'ProSelect' : _props$type,
|
|
@@ -42,15 +43,16 @@ var ProEnum = function ProEnum(props) {
|
|
|
42
43
|
enumProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
43
44
|
var _ref = otherProps || {},
|
|
44
45
|
isView = _ref.isView,
|
|
45
|
-
viewEmpty = _ref.viewEmpty
|
|
46
|
-
disabled = _ref.disabled;
|
|
46
|
+
viewEmpty = _ref.viewEmpty;
|
|
47
47
|
var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEnum') || {},
|
|
48
48
|
fieldNames = _ref2.fieldNames,
|
|
49
49
|
_ref2$clear = _ref2.clear,
|
|
50
50
|
clear = _ref2$clear === void 0 ? true : _ref2$clear,
|
|
51
51
|
_ref2$cacheKey = _ref2.cacheKey,
|
|
52
52
|
cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
|
|
53
|
+
showCodeName = _ref2.showCodeName,
|
|
53
54
|
resProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
55
|
+
enumProps.showCodeName = (_enumProps$showCodeNa = enumProps.showCodeName) !== null && _enumProps$showCodeNa !== void 0 ? _enumProps$showCodeNa : showCodeName;
|
|
54
56
|
var label = '';
|
|
55
57
|
var fieldValue = '';
|
|
56
58
|
var _useState = (0, _react.useState)(dataSource || []),
|
|
@@ -166,6 +168,7 @@ var ProEnum = function ProEnum(props) {
|
|
|
166
168
|
switch (type) {
|
|
167
169
|
case 'ProSelect':
|
|
168
170
|
return (0, _jsxRuntime.jsx)(_ProSelect.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, enumProps), {}, {
|
|
171
|
+
otherProps: otherProps,
|
|
169
172
|
dataSource: list,
|
|
170
173
|
fieldNames: {
|
|
171
174
|
label: label,
|
|
@@ -236,8 +239,11 @@ var ProEnum = function ProEnum(props) {
|
|
|
236
239
|
return item[fieldValue] === (v === null || v === void 0 ? void 0 : v[fieldValue]);
|
|
237
240
|
}
|
|
238
241
|
return item[fieldValue] === v;
|
|
239
|
-
});
|
|
240
|
-
|
|
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];
|
|
241
247
|
});
|
|
242
248
|
var record = value.map(function (v) {
|
|
243
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)({
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
13
|
var _react = require("react");
|
|
12
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -129,17 +131,55 @@ var ActionButton = function ActionButton(props) {
|
|
|
129
131
|
}
|
|
130
132
|
return props.actionProps;
|
|
131
133
|
}, [props.actionProps]);
|
|
132
|
-
var handleClick = function
|
|
134
|
+
var handleClick = /*#__PURE__*/function () {
|
|
135
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, index, item) {
|
|
136
|
+
var value, data;
|
|
137
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
138
|
+
while (1) switch (_context.prev = _context.next) {
|
|
139
|
+
case 0:
|
|
140
|
+
value = form.getFieldValue(namePath);
|
|
141
|
+
_context.next = 3;
|
|
142
|
+
return callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
143
|
+
namePath: namePath,
|
|
144
|
+
index: index,
|
|
145
|
+
operation: operation,
|
|
146
|
+
form: form
|
|
147
|
+
});
|
|
148
|
+
case 3:
|
|
149
|
+
data = _context.sent;
|
|
150
|
+
if (!(!callback || data === true)) {
|
|
151
|
+
_context.next = 7;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
defaultCallback === null || defaultCallback === void 0 ? void 0 : defaultCallback(value, {
|
|
155
|
+
namePath: namePath,
|
|
156
|
+
index: index,
|
|
157
|
+
operation: operation,
|
|
158
|
+
form: form
|
|
159
|
+
});
|
|
160
|
+
return _context.abrupt("return");
|
|
161
|
+
case 7:
|
|
162
|
+
if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add') {
|
|
163
|
+
operation.add(data, index !== undefined ? index + 1 : undefined);
|
|
164
|
+
}
|
|
165
|
+
case 8:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context.stop();
|
|
168
|
+
}
|
|
169
|
+
}, _callee);
|
|
170
|
+
}));
|
|
171
|
+
return function handleClick(_x, _x2, _x3, _x4) {
|
|
172
|
+
return _ref6.apply(this, arguments);
|
|
173
|
+
};
|
|
174
|
+
}();
|
|
175
|
+
var customClick = function customClick(callback, index) {
|
|
133
176
|
var value = form.getFieldValue(namePath);
|
|
134
|
-
|
|
177
|
+
callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
135
178
|
namePath: namePath,
|
|
136
179
|
index: index,
|
|
137
180
|
operation: operation,
|
|
138
181
|
form: form
|
|
139
182
|
});
|
|
140
|
-
if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add') {
|
|
141
|
-
operation.add(data, index !== undefined ? index + 1 : undefined);
|
|
142
|
-
}
|
|
143
183
|
};
|
|
144
184
|
var defaultActions = (0, _react.useMemo)(function () {
|
|
145
185
|
return getDefaultActions(mode);
|
|
@@ -196,7 +236,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
196
236
|
return e.stopPropagation();
|
|
197
237
|
},
|
|
198
238
|
onConfirm: function onConfirm(e) {
|
|
199
|
-
handleClick(
|
|
239
|
+
handleClick(internalOnClick, _onClick, index, item);
|
|
200
240
|
}
|
|
201
241
|
}, _confirmProps), {}, {
|
|
202
242
|
children: (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultRest), rest), {}, {
|
|
@@ -208,7 +248,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
208
248
|
}), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index)) : (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultRest), rest), {}, {
|
|
209
249
|
onClick: function onClick(e) {
|
|
210
250
|
e.stopPropagation();
|
|
211
|
-
handleClick(
|
|
251
|
+
handleClick(internalOnClick, _onClick, index, item);
|
|
212
252
|
},
|
|
213
253
|
children: label || defaultLabel
|
|
214
254
|
}), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
|
|
@@ -219,7 +259,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
219
259
|
return e.stopPropagation();
|
|
220
260
|
},
|
|
221
261
|
onConfirm: function onConfirm() {
|
|
222
|
-
return
|
|
262
|
+
return customClick(_onClick, index);
|
|
223
263
|
}
|
|
224
264
|
}, _confirmProps), {}, {
|
|
225
265
|
children: (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rest), {}, {
|
|
@@ -232,7 +272,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
232
272
|
key: "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index),
|
|
233
273
|
onClick: function onClick(e) {
|
|
234
274
|
e.stopPropagation();
|
|
235
|
-
|
|
275
|
+
customClick(_onClick, index);
|
|
236
276
|
}
|
|
237
277
|
}), label));
|
|
238
278
|
})
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
14
|
var _antd = require("antd");
|
|
@@ -52,16 +54,52 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
52
54
|
}
|
|
53
55
|
return props.toolbarProps;
|
|
54
56
|
}, [props.toolbarProps]);
|
|
55
|
-
var handleClick = function
|
|
57
|
+
var handleClick = /*#__PURE__*/function () {
|
|
58
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, item) {
|
|
59
|
+
var value, data;
|
|
60
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
61
|
+
while (1) switch (_context.prev = _context.next) {
|
|
62
|
+
case 0:
|
|
63
|
+
value = form.getFieldValue(namePath);
|
|
64
|
+
_context.next = 3;
|
|
65
|
+
return callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
66
|
+
operation: operation,
|
|
67
|
+
form: form,
|
|
68
|
+
namePath: namePath
|
|
69
|
+
});
|
|
70
|
+
case 3:
|
|
71
|
+
data = _context.sent;
|
|
72
|
+
if (!(!callback || data === true)) {
|
|
73
|
+
_context.next = 7;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
defaultCallback === null || defaultCallback === void 0 ? void 0 : defaultCallback(value, {
|
|
77
|
+
operation: operation,
|
|
78
|
+
form: form,
|
|
79
|
+
namePath: namePath
|
|
80
|
+
});
|
|
81
|
+
return _context.abrupt("return");
|
|
82
|
+
case 7:
|
|
83
|
+
if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add' && data) {
|
|
84
|
+
operation.add(data);
|
|
85
|
+
}
|
|
86
|
+
case 8:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context.stop();
|
|
89
|
+
}
|
|
90
|
+
}, _callee);
|
|
91
|
+
}));
|
|
92
|
+
return function handleClick(_x, _x2, _x3) {
|
|
93
|
+
return _ref2.apply(this, arguments);
|
|
94
|
+
};
|
|
95
|
+
}();
|
|
96
|
+
var customClick = function customClick(callback, item) {
|
|
56
97
|
var value = form.getFieldValue(namePath);
|
|
57
|
-
|
|
98
|
+
callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
58
99
|
operation: operation,
|
|
59
100
|
form: form,
|
|
60
101
|
namePath: namePath
|
|
61
102
|
});
|
|
62
|
-
if ((item === null || item === void 0 ? void 0 : item.actionType) === 'add' && data) {
|
|
63
|
-
operation.add(data);
|
|
64
|
-
}
|
|
65
103
|
};
|
|
66
104
|
return (0, _jsxRuntime.jsx)(_antd.Space, {
|
|
67
105
|
align: "start",
|
|
@@ -92,14 +130,14 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
92
130
|
}
|
|
93
131
|
return (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, actions[actionType]), rest), {}, {
|
|
94
132
|
onClick: function onClick() {
|
|
95
|
-
return handleClick(
|
|
133
|
+
return handleClick(internalOnClick, _onClick, item);
|
|
96
134
|
},
|
|
97
135
|
children: label || defaultLabel
|
|
98
136
|
}), actionType);
|
|
99
137
|
}
|
|
100
138
|
return (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rest), {}, {
|
|
101
139
|
onClick: function onClick() {
|
|
102
|
-
return
|
|
140
|
+
return customClick(_onClick2, item);
|
|
103
141
|
},
|
|
104
142
|
children: label
|
|
105
143
|
}), actionType);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
require("./index.less");
|
|
9
|
+
var AddonWrapper = function AddonWrapper(props) {
|
|
10
|
+
var before = props.before,
|
|
11
|
+
after = props.after,
|
|
12
|
+
children = props.children;
|
|
13
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
14
|
+
className: "addon-wrapper",
|
|
15
|
+
children: [before && (0, _jsxRuntime.jsx)("div", {
|
|
16
|
+
className: "before",
|
|
17
|
+
children: before
|
|
18
|
+
}), children, after && (0, _jsxRuntime.jsx)("div", {
|
|
19
|
+
className: "after",
|
|
20
|
+
children: after
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var _default = exports.default = AddonWrapper;
|
|
@@ -6,14 +6,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
var _react = _interopRequireDefault(require("react"));
|
|
13
14
|
var _ConfirmWrapper = _interopRequireDefault(require("../../../../components/render/ConfirmWrapper"));
|
|
14
15
|
var _useFieldProps = require("../../../../utils/useFieldProps");
|
|
15
16
|
var componentMap = _interopRequireWildcard(require("../../../../../index"));
|
|
16
|
-
var
|
|
17
|
+
var _AddonWrapper = _interopRequireDefault(require("./AddonWrapper"));
|
|
18
|
+
var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after"];
|
|
19
|
+
// 这里的key与组件内参数一致, 决定使用哪个包裹组件
|
|
20
|
+
var wrapperMap = {
|
|
21
|
+
confirm: _ConfirmWrapper.default,
|
|
22
|
+
before: _AddonWrapper.default,
|
|
23
|
+
after: _AddonWrapper.default
|
|
24
|
+
};
|
|
25
|
+
// 增加middleware根据配置增加多层包裹
|
|
26
|
+
var getComRender = function getComRender(component, props, componentProps) {
|
|
27
|
+
var wrappers = Object.keys(wrapperMap);
|
|
28
|
+
var Com = component;
|
|
29
|
+
wrappers.forEach(function (item) {
|
|
30
|
+
if (item in props) {
|
|
31
|
+
var Wrapper = wrapperMap[item];
|
|
32
|
+
Com = (0, _jsxRuntime.jsx)(Wrapper, (0, _objectSpread3.default)((0, _objectSpread3.default)((0, _objectSpread3.default)({}, componentProps), (0, _defineProperty2.default)({}, item, props[item])), {}, {
|
|
33
|
+
children: Com
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return Com;
|
|
38
|
+
};
|
|
17
39
|
/** 渲染组件 */
|
|
18
40
|
var ComRender = function ComRender(props) {
|
|
19
41
|
var type = props.type,
|
|
@@ -21,24 +43,18 @@ var ComRender = function ComRender(props) {
|
|
|
21
43
|
component = props.component,
|
|
22
44
|
fieldProps = props.fieldProps,
|
|
23
45
|
contextProps = props.contextProps,
|
|
46
|
+
before = props.before,
|
|
47
|
+
after = props.after,
|
|
24
48
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
25
49
|
var TypeComponent = componentMap[type];
|
|
26
|
-
var componentProps = (0,
|
|
27
|
-
var Component;
|
|
28
|
-
|
|
29
|
-
Component = (0, _jsxRuntime.jsx)(_ConfirmWrapper.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
30
|
-
confirm: confirm
|
|
31
|
-
}, componentProps), {}, {
|
|
32
|
-
children: component || (0, _jsxRuntime.jsx)(TypeComponent, (0, _objectSpread2.default)({}, componentProps))
|
|
33
|
-
}));
|
|
34
|
-
} else {
|
|
35
|
-
Component = component ? ( /*#__PURE__*/_react.default.cloneElement(component, (0, _objectSpread2.default)({}, componentProps))) : (0, _jsxRuntime.jsx)(TypeComponent, (0, _objectSpread2.default)({}, componentProps));
|
|
36
|
-
}
|
|
50
|
+
var componentProps = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, fieldProps), rest);
|
|
51
|
+
var Component = component ? ( /*#__PURE__*/_react.default.cloneElement(component, (0, _objectSpread3.default)({}, componentProps))) : (0, _jsxRuntime.jsx)(TypeComponent, (0, _objectSpread3.default)({}, componentProps));
|
|
52
|
+
var Com = getComRender(Component, props, componentProps);
|
|
37
53
|
return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
|
|
38
|
-
value: (0,
|
|
54
|
+
value: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, contextProps), {}, {
|
|
39
55
|
type: type
|
|
40
56
|
}),
|
|
41
|
-
children:
|
|
57
|
+
children: Com
|
|
42
58
|
});
|
|
43
59
|
};
|
|
44
60
|
var _default = exports.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;
|