@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
|
@@ -22,7 +22,7 @@ var _ComRender = _interopRequireDefault(require("./component/ComRender"));
|
|
|
22
22
|
*
|
|
23
23
|
* render内部能力 show, component, value, onChange, disabled, clearNotShow, fieldProps
|
|
24
24
|
*/
|
|
25
|
-
var
|
|
25
|
+
var Group = function Group(props) {
|
|
26
26
|
var children = props.children,
|
|
27
27
|
className = props.className,
|
|
28
28
|
_props$space = props.space,
|
|
@@ -72,12 +72,12 @@ var GroupCopy = function GroupCopy(props) {
|
|
|
72
72
|
return (0, _jsxRuntime.jsx)("div", {
|
|
73
73
|
className: _className,
|
|
74
74
|
children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? (0, _jsxRuntime.jsx)(_antd.Space.Compact, {
|
|
75
|
-
children: columns.map(function (column) {
|
|
75
|
+
children: columns.map(function (column, index) {
|
|
76
76
|
return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
77
77
|
contextProps: contextProps
|
|
78
78
|
}, column), {}, {
|
|
79
79
|
otherProps: otherProps
|
|
80
|
-
}));
|
|
80
|
+
}), column.name);
|
|
81
81
|
})
|
|
82
82
|
}) : (0, _jsxRuntime.jsx)(_antd.Space, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
83
83
|
align: "start"
|
|
@@ -87,9 +87,9 @@ var GroupCopy = function GroupCopy(props) {
|
|
|
87
87
|
contextProps: contextProps
|
|
88
88
|
}, column), {}, {
|
|
89
89
|
otherProps: otherProps
|
|
90
|
-
}));
|
|
90
|
+
}), column.name);
|
|
91
91
|
})
|
|
92
92
|
}))
|
|
93
93
|
});
|
|
94
94
|
};
|
|
95
|
-
var _default = exports.default =
|
|
95
|
+
var _default = exports.default = Group;
|
|
@@ -200,7 +200,7 @@ var transformColumns = exports.transformColumns = function transformColumns(para
|
|
|
200
200
|
fieldProps: fieldProps,
|
|
201
201
|
name: columnName
|
|
202
202
|
});
|
|
203
|
-
}, [value, show, fieldProps, columnName, type]);
|
|
203
|
+
}, [value, show, fieldProps, _disabled, columnName, type]);
|
|
204
204
|
if (reactiveProps.show === false) {
|
|
205
205
|
return [];
|
|
206
206
|
}
|
|
@@ -227,7 +227,8 @@ var transformColumns = exports.transformColumns = function transformColumns(para
|
|
|
227
227
|
onFieldChange === null || onFieldChange === void 0 ? void 0 : onFieldChange(newValue, form.getFieldValue(namePath), {
|
|
228
228
|
index: outerIndex,
|
|
229
229
|
namePath: namePath,
|
|
230
|
-
form: form
|
|
230
|
+
form: form,
|
|
231
|
+
option: args === null || args === void 0 ? void 0 : args[1]
|
|
231
232
|
});
|
|
232
233
|
};
|
|
233
234
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, column), {}, {
|
|
@@ -95,7 +95,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
95
95
|
var realDataSource = (0, _react.useMemo)(function () {
|
|
96
96
|
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
|
97
97
|
var result = isAddressMode && realLevel === 2 ? filterDataSource(innerDataSource, level) : innerDataSource;
|
|
98
|
-
return (0,
|
|
98
|
+
return (0, _index.transformDataName)(result, fieldNames);
|
|
99
99
|
}, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
|
100
100
|
var _useRequest = (0, _objectSpread2.default)({}, useRequest),
|
|
101
101
|
service = _useRequest.service,
|
|
@@ -12,6 +12,9 @@ var transformDataName = exports.transformDataName = function transformDataName(d
|
|
|
12
12
|
value = fieldNames.value,
|
|
13
13
|
children = fieldNames.children,
|
|
14
14
|
extraFields = (0, _objectWithoutProperties2.default)(fieldNames, _excluded);
|
|
15
|
+
if (!(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 'label' in dataSource[0] && 'value' in dataSource[0] && 'children' in dataSource[0]) {
|
|
16
|
+
return dataSource;
|
|
17
|
+
}
|
|
15
18
|
function transformNode(node) {
|
|
16
19
|
var newNode = {
|
|
17
20
|
label: node[label],
|
|
@@ -124,8 +124,12 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
124
124
|
start = _ref9[0],
|
|
125
125
|
end = _ref9[1];
|
|
126
126
|
if (e.target.checked) {
|
|
127
|
-
var _start, _end;
|
|
128
|
-
|
|
127
|
+
var _rest$allowEmpty, _start, _end;
|
|
128
|
+
if (((_rest$allowEmpty = rest.allowEmpty) === null || _rest$allowEmpty === void 0 ? void 0 : _rest$allowEmpty[0]) === true) {
|
|
129
|
+
start = null;
|
|
130
|
+
} else {
|
|
131
|
+
start = start || (0, _moment.default)().startOf('day');
|
|
132
|
+
}
|
|
129
133
|
end = foreverMoment;
|
|
130
134
|
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]);
|
|
131
135
|
} else {
|
|
@@ -117,9 +117,12 @@ var RenderFields = function RenderFields(props) {
|
|
|
117
117
|
if (typeof _type === 'string') {
|
|
118
118
|
TargetComponent = _isView && viewRender ? viewRenderHandle : componentMap[_type];
|
|
119
119
|
}
|
|
120
|
+
// 自定义组件时 防止默认值影像后续判断
|
|
121
|
+
if ('component' in column) {
|
|
122
|
+
_type = null;
|
|
123
|
+
}
|
|
120
124
|
if (component && /*#__PURE__*/_react.default.isValidElement(component)) {
|
|
121
125
|
var _newComponent$props;
|
|
122
|
-
_type = null;
|
|
123
126
|
var newComponent = component;
|
|
124
127
|
var isProEditTable = (newComponent === null || newComponent === void 0 ? void 0 : (_newComponent$props = newComponent.props) === null || _newComponent$props === void 0 ? void 0 : _newComponent$props.onlyOneLineMsg) === '请先保存数据';
|
|
125
128
|
TargetComponent = _isView ? viewRenderHandle || '' : component;
|
|
@@ -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/lib/ProSelect/index.js
CHANGED
|
@@ -24,10 +24,11 @@ require("./index.less");
|
|
|
24
24
|
var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "filterInList", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "isView"];
|
|
25
25
|
var Option = _antd.Select.Option;
|
|
26
26
|
var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
|
|
27
|
-
var _locale$ProSelect;
|
|
27
|
+
var _selectProps$showCode, _locale$ProSelect;
|
|
28
28
|
var _ref = (0, _ProConfigProvider.useProConfig)('ProSelect') || {},
|
|
29
29
|
_ref$fieldNames = _ref.fieldNames,
|
|
30
|
-
proSelectFieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames
|
|
30
|
+
proSelectFieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
|
|
31
|
+
showCodeName = _ref.showCodeName;
|
|
31
32
|
var label = 'label';
|
|
32
33
|
var code = 'value';
|
|
33
34
|
if (proSelectFieldNames && Object.keys(proSelectFieldNames).length) {
|
|
@@ -55,6 +56,7 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
|
|
|
55
56
|
transformResponse = props.transformResponse,
|
|
56
57
|
isViewPro = props.isView,
|
|
57
58
|
selectProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
59
|
+
selectProps.showCodeName = (_selectProps$showCode = selectProps.showCodeName) !== null && _selectProps$showCode !== void 0 ? _selectProps$showCode : showCodeName;
|
|
58
60
|
var value = props.value;
|
|
59
61
|
var _ref2 = _.ProForm.useFieldProps() || {},
|
|
60
62
|
isViewCon = _ref2.isView,
|
|
@@ -275,7 +277,8 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
|
|
|
275
277
|
otherProps: otherProps,
|
|
276
278
|
value: props.value,
|
|
277
279
|
dataSource: selectList,
|
|
278
|
-
labelInValue: labelInValue
|
|
280
|
+
labelInValue: labelInValue,
|
|
281
|
+
fieldNames: fieldNames
|
|
279
282
|
});
|
|
280
283
|
}
|
|
281
284
|
return (0, _jsxRuntime.jsx)(_antd.Select, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
@@ -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;
|
|
@@ -14,7 +14,8 @@ var findSelectNameValues = function findSelectNameValues(_ref) {
|
|
|
14
14
|
selectName = _ref.selectName,
|
|
15
15
|
value = _ref.value,
|
|
16
16
|
dataSource = _ref.dataSource,
|
|
17
|
-
labelInValue = _ref.labelInValue
|
|
17
|
+
labelInValue = _ref.labelInValue,
|
|
18
|
+
fieldNames = _ref.fieldNames;
|
|
18
19
|
var selectValues = [];
|
|
19
20
|
list.forEach(function (item) {
|
|
20
21
|
var result = item;
|
|
@@ -37,7 +38,7 @@ var findSelectNameValues = function findSelectNameValues(_ref) {
|
|
|
37
38
|
});
|
|
38
39
|
var diffList = _lodash.default.difference(selectValues, [value]);
|
|
39
40
|
return dataSource.filter(function (item) {
|
|
40
|
-
return !diffList.includes(labelInValue ? item : item.value);
|
|
41
|
+
return !diffList.includes(labelInValue ? item : item[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value] || (item === null || item === void 0 ? void 0 : item.value));
|
|
41
42
|
});
|
|
42
43
|
};
|
|
43
44
|
/**
|
|
@@ -47,15 +48,16 @@ var getSelectList = exports.getSelectList = function getSelectList(_ref2) {
|
|
|
47
48
|
var otherProps = _ref2.otherProps,
|
|
48
49
|
value = _ref2.value,
|
|
49
50
|
dataSource = _ref2.dataSource,
|
|
50
|
-
labelInValue = _ref2.labelInValue
|
|
51
|
+
labelInValue = _ref2.labelInValue,
|
|
52
|
+
fieldNames = _ref2.fieldNames;
|
|
51
53
|
if (!otherProps) {
|
|
52
54
|
return null;
|
|
53
55
|
}
|
|
54
56
|
var listName = otherProps.listName,
|
|
55
57
|
form = otherProps.form;
|
|
56
|
-
var firstNumberIndex = listName.
|
|
58
|
+
var firstNumberIndex = listName.lastIndexOf(listName.findLast(function (item) {
|
|
57
59
|
return typeof item === 'number';
|
|
58
|
-
});
|
|
60
|
+
}));
|
|
59
61
|
var fatherName = listName.slice(0, firstNumberIndex);
|
|
60
62
|
var selectName = listName.slice(firstNumberIndex + 1);
|
|
61
63
|
return findSelectNameValues({
|
|
@@ -63,6 +65,7 @@ var getSelectList = exports.getSelectList = function getSelectList(_ref2) {
|
|
|
63
65
|
selectName: selectName,
|
|
64
66
|
value: value,
|
|
65
67
|
dataSource: dataSource,
|
|
66
|
-
labelInValue: labelInValue
|
|
68
|
+
labelInValue: labelInValue,
|
|
69
|
+
fieldNames: fieldNames
|
|
67
70
|
});
|
|
68
71
|
};
|
|
@@ -342,11 +342,14 @@ function List(props) {
|
|
|
342
342
|
return loop(newTreeData, -1);
|
|
343
343
|
}
|
|
344
344
|
var _treeData = fn();
|
|
345
|
-
var onExpand = function onExpand(newExpandedKeys) {
|
|
345
|
+
var onExpand = function onExpand(newExpandedKeys, nextPara) {
|
|
346
346
|
setState({
|
|
347
347
|
expandedKeys: newExpandedKeys,
|
|
348
348
|
autoExpandParent: false
|
|
349
349
|
});
|
|
350
|
+
if (other.onExpand) {
|
|
351
|
+
other.onExpand(newExpandedKeys, nextPara);
|
|
352
|
+
}
|
|
350
353
|
};
|
|
351
354
|
var others = other;
|
|
352
355
|
return (0, _jsxRuntime.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
|
/** 对后台返回数据进行格式化 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@dnd-kit/sortable": "^7.0.2",
|
|
59
59
|
"@dnd-kit/utilities": "^3.2.1",
|
|
60
60
|
"@pansy/react-watermark": "^3.1.13",
|
|
61
|
-
"@zat-design/utils": "^1.1.
|
|
61
|
+
"@zat-design/utils": "^1.1.22",
|
|
62
62
|
"ahooks": "3.7.4",
|
|
63
63
|
"antd": "4.24.8",
|
|
64
64
|
"big.js": "^6.2.1",
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import "antd/es/space/style";
|
|
2
|
-
import _Space from "antd/es/space";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
import "antd/es/button/style";
|
|
5
|
-
import _Button from "antd/es/button";
|
|
6
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { useMemo } from 'react';
|
|
9
|
-
import { omit, isFunction, union, isNumber } from 'lodash';
|
|
10
|
-
import { useDeepCompareEffect } from 'ahooks';
|
|
11
|
-
import classnames from 'classnames';
|
|
12
|
-
import RenderFields from '../../render/RenderFields';
|
|
13
|
-
import { insertSeparator, transformNamesString } from './utils';
|
|
14
|
-
import ProForm from '../../../../ProForm';
|
|
15
|
-
var Group = function Group(props) {
|
|
16
|
-
var columns = props.children,
|
|
17
|
-
otherProps = props.otherProps,
|
|
18
|
-
className = props.className,
|
|
19
|
-
_props$space = props.space,
|
|
20
|
-
space = _props$space === void 0 ? {
|
|
21
|
-
size: 12
|
|
22
|
-
} : _props$space,
|
|
23
|
-
id = props.id,
|
|
24
|
-
value = props.value,
|
|
25
|
-
isView = props.isView,
|
|
26
|
-
index = props.index,
|
|
27
|
-
onFieldChange = props.onFieldChange,
|
|
28
|
-
namePath = props.namePath;
|
|
29
|
-
var _ref = ProForm.useFieldProps() || {},
|
|
30
|
-
names = _ref.names,
|
|
31
|
-
name = _ref.name,
|
|
32
|
-
form = _ref.form,
|
|
33
|
-
_namePath = _ref.namePath;
|
|
34
|
-
var newNamePath = namePath || _namePath || [];
|
|
35
|
-
if (!Array.isArray(names)) {
|
|
36
|
-
console.error('Warning: Composite form components whose type is Group must be configured with names');
|
|
37
|
-
}
|
|
38
|
-
var data = useMemo(function () {
|
|
39
|
-
var fieldList = [];
|
|
40
|
-
var result = columns.map(function (item) {
|
|
41
|
-
return _objectSpread(_objectSpread({
|
|
42
|
-
disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
|
|
43
|
-
}, item), {}, {
|
|
44
|
-
isView: isView !== null && isView !== void 0 ? isView : item.isView,
|
|
45
|
-
noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
|
|
46
|
-
parentNames: id,
|
|
47
|
-
namePath: newNamePath
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var node = _jsx(_Button, {
|
|
51
|
-
className: "group-separator",
|
|
52
|
-
children: space.separator
|
|
53
|
-
});
|
|
54
|
-
return {
|
|
55
|
-
columns: insertSeparator(result, space, node, otherProps),
|
|
56
|
-
fieldList: fieldList
|
|
57
|
-
};
|
|
58
|
-
}, [name, columns, space, props, names]);
|
|
59
|
-
var _className = classnames(_defineProperty({
|
|
60
|
-
'pro-group': true,
|
|
61
|
-
'pro-group-diy-width': columns.some(function (item) {
|
|
62
|
-
var _item$fieldProps, _item$fieldProps$styl;
|
|
63
|
-
return item === null || item === void 0 ? void 0 : (_item$fieldProps = item.fieldProps) === null || _item$fieldProps === void 0 ? void 0 : (_item$fieldProps$styl = _item$fieldProps.style) === null || _item$fieldProps$styl === void 0 ? void 0 : _item$fieldProps$styl.width;
|
|
64
|
-
}),
|
|
65
|
-
'pro-group-width-auto': columns.some(function (item) {
|
|
66
|
-
return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
|
|
67
|
-
})
|
|
68
|
-
}, "".concat(className), className));
|
|
69
|
-
// 用于formList场景下names移除掉了前缀,需要再次合并回来
|
|
70
|
-
var _names = names.map(function (item) {
|
|
71
|
-
if (isNumber(item === null || item === void 0 ? void 0 : item[0])) {
|
|
72
|
-
return union(newNamePath, item);
|
|
73
|
-
}
|
|
74
|
-
return item;
|
|
75
|
-
});
|
|
76
|
-
useDeepCompareEffect(function () {
|
|
77
|
-
var _document, _document$activeEleme;
|
|
78
|
-
// 焦点激活的表单
|
|
79
|
-
var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
|
|
80
|
-
// 模拟change,初始化不执行onFieldChange
|
|
81
|
-
if (isFunction(onFieldChange) && form.isFieldsTouched(_names) && transformNamesString(_names).includes(touchName)) {
|
|
82
|
-
onFieldChange(value, (newNamePath === null || newNamePath === void 0 ? void 0 : newNamePath.length) ? form.getFieldValue(newNamePath, true) : form.getFieldsValue(), {
|
|
83
|
-
form: form,
|
|
84
|
-
namePath: newNamePath,
|
|
85
|
-
index: index
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}, [value]);
|
|
89
|
-
var _otherProps = omit(otherProps, ['colProps', 'required']);
|
|
90
|
-
return _jsx("div", {
|
|
91
|
-
className: _className,
|
|
92
|
-
children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
|
|
93
|
-
children: _jsx(RenderFields, _objectSpread({
|
|
94
|
-
columns: data.columns,
|
|
95
|
-
form: form
|
|
96
|
-
}, _otherProps))
|
|
97
|
-
}) : _jsx(_Space, _objectSpread(_objectSpread({
|
|
98
|
-
align: "start"
|
|
99
|
-
}, omit(space, ['separator', 'compact'])), {}, {
|
|
100
|
-
children: data.columns.map(function (column, index) {
|
|
101
|
-
return _jsx(RenderFields, _objectSpread({
|
|
102
|
-
columns: [column],
|
|
103
|
-
form: form
|
|
104
|
-
}, _otherProps), (column === null || column === void 0 ? void 0 : column.name) || index);
|
|
105
|
-
})
|
|
106
|
-
}))
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
export default Group;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RowProps, SpaceProps } from 'antd';
|
|
3
|
-
import { FormInstance } from 'antd/es/form/Form';
|
|
4
|
-
import { NamePath } from 'antd/lib/form/interface';
|
|
5
|
-
import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
|
|
6
|
-
export interface SpaceType extends SpaceProps {
|
|
7
|
-
/**
|
|
8
|
-
* 是否紧凑合并
|
|
9
|
-
*/
|
|
10
|
-
compact?: Boolean;
|
|
11
|
-
/**
|
|
12
|
-
* 分隔符
|
|
13
|
-
*/
|
|
14
|
-
separator?: string | React.ReactNode;
|
|
15
|
-
/** 间隔距离 */
|
|
16
|
-
size?: number;
|
|
17
|
-
}
|
|
18
|
-
export interface GroupProps {
|
|
19
|
-
children?: ProColumnProps[];
|
|
20
|
-
space?: SpaceType;
|
|
21
|
-
otherProps?: ProFormOtherProps;
|
|
22
|
-
rowProps?: RowProps;
|
|
23
|
-
className?: string;
|
|
24
|
-
value?: any;
|
|
25
|
-
id?: string;
|
|
26
|
-
disabled?: boolean | (() => void);
|
|
27
|
-
isView?: boolean;
|
|
28
|
-
namePath?: NamePath;
|
|
29
|
-
index?: number;
|
|
30
|
-
onFieldChange?: (value: any[] | null, record: any, { form, }: {
|
|
31
|
-
form: FormInstance;
|
|
32
|
-
namePath?: NamePath;
|
|
33
|
-
index?: number;
|
|
34
|
-
}) => any;
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
@root-entry-name: 'default';
|
|
2
|
-
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
|
-
|
|
4
|
-
.border-radius(@start-end: 0, @end-end: 0, @start-start: 0, @end-start: 0) {
|
|
5
|
-
border-start-end-radius: @start-end;
|
|
6
|
-
border-end-end-radius: @end-end;
|
|
7
|
-
border-start-start-radius: @start-start;
|
|
8
|
-
border-end-start-radius: @end-start;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.start-radius() {
|
|
12
|
-
border-start-start-radius: 4px;
|
|
13
|
-
border-end-start-radius: 4px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.end-radius() {
|
|
17
|
-
border-start-end-radius: 4px;
|
|
18
|
-
border-end-end-radius: 4px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.pro-group {
|
|
22
|
-
width: unset !important;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
&.pro-group-diy-width, &.pro-group-width-auto {
|
|
26
|
-
.@{ant-prefix}-space .@{ant-prefix}-space-item {
|
|
27
|
-
width: auto;
|
|
28
|
-
|
|
29
|
-
.@{ant-prefix}-space-item {
|
|
30
|
-
width: auto;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.@{ant-prefix}-space {
|
|
36
|
-
width: 100%;
|
|
37
|
-
|
|
38
|
-
.@{ant-prefix}-space-item {
|
|
39
|
-
width: 100%;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.@{ant-prefix}-form-item {
|
|
43
|
-
margin-bottom: 0 !important;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.@{ant-prefix}-form-item-label {
|
|
48
|
-
display: none;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.@{ant-prefix}-space-compact {
|
|
52
|
-
flex: auto;
|
|
53
|
-
align-items: center;
|
|
54
|
-
width: 100%;
|
|
55
|
-
|
|
56
|
-
&>.@{ant-prefix}-input-number{
|
|
57
|
-
&:first-child{
|
|
58
|
-
border-end-end-radius: 0;
|
|
59
|
-
border-start-end-radius: 0;
|
|
60
|
-
}
|
|
61
|
-
&:last-child{
|
|
62
|
-
border-start-start-radius: 0;
|
|
63
|
-
border-end-start-radius: 0;
|
|
64
|
-
margin-left: -1px;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.@{ant-prefix}-form-item {
|
|
69
|
-
margin-bottom: 0 !important;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.group-separator {
|
|
73
|
-
margin-inline-end: -2px;
|
|
74
|
-
margin-inline-start: -1px;
|
|
75
|
-
border-start-start-radius: 0;
|
|
76
|
-
border-end-start-radius: 0;
|
|
77
|
-
padding: 0 12px;
|
|
78
|
-
background-color: #fff;
|
|
79
|
-
cursor: default;
|
|
80
|
-
}
|
|
81
|
-
.pro-modal-select {
|
|
82
|
-
margin-left: -1px;
|
|
83
|
-
.@{ant-prefix}-input{
|
|
84
|
-
border-start-start-radius: 0;
|
|
85
|
-
border-end-start-radius: 0;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// 定制内敛合并样式
|
|
90
|
-
.@{ant-prefix}-input-affix-wrapper,
|
|
91
|
-
.@{ant-prefix}-select {
|
|
92
|
-
.border-radius(0, 0, 0, 0);
|
|
93
|
-
|
|
94
|
-
&:nth-child(n + 2) {
|
|
95
|
-
margin-inline-start: -1px;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
&:first-child {
|
|
99
|
-
.start-radius();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
&:last-child {
|
|
103
|
-
.end-radius();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.@{ant-prefix}-select {
|
|
108
|
-
.@{ant-prefix}-select-selector {
|
|
109
|
-
.border-radius(0, 0, 0, 0);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
&:first-child {
|
|
113
|
-
.@{ant-prefix}-select-selector {
|
|
114
|
-
.start-radius();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
&:last-child {
|
|
119
|
-
.@{ant-prefix}-select-selector {
|
|
120
|
-
.end-radius();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// 报错样式定制
|
|
126
|
-
.@{ant-prefix}-input-affix-wrapper-status-error ~ .group-separator {
|
|
127
|
-
color: var(--ant-error-color);
|
|
128
|
-
border-color: var(--ant-error-color);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { SpaceType } from './propsType';
|
|
3
|
-
/**
|
|
4
|
-
* 插入间隔符
|
|
5
|
-
* @param columns 表单配置数组
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export declare const insertSeparator: (columns: any, space?: SpaceType, separatorNode?: ReactNode, otherProps?: any) => any;
|
|
9
|
-
/** 转换names */
|
|
10
|
-
export declare const transformNamesString: (arr: (string | string[])[]) => (string | string[])[];
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
/**
|
|
3
|
-
* 插入间隔符
|
|
4
|
-
* @param columns 表单配置数组
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
export var insertSeparator = function insertSeparator(columns, space, separatorNode, otherProps) {
|
|
8
|
-
var _columns = columns;
|
|
9
|
-
var _ref = otherProps || {},
|
|
10
|
-
names = _ref.names;
|
|
11
|
-
// 紧凑模式存在names时,自动给下级拆解name
|
|
12
|
-
if (names) {
|
|
13
|
-
_columns = _columns.map(function (column, index) {
|
|
14
|
-
return _objectSpread(_objectSpread({}, column), {}, {
|
|
15
|
-
name: names[index]
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
if (!(space === null || space === void 0 ? void 0 : space.separator)) {
|
|
20
|
-
return _columns;
|
|
21
|
-
}
|
|
22
|
-
return _columns.reduce(function (result, current, index, array) {
|
|
23
|
-
// 将当前元素添加到结果数组中
|
|
24
|
-
result.push(current);
|
|
25
|
-
// 如果当前元素不是最后一个元素,则添加间隔符
|
|
26
|
-
if (index < array.length - 1) {
|
|
27
|
-
result.push({
|
|
28
|
-
component: separatorNode,
|
|
29
|
-
fieldProps: {
|
|
30
|
-
disabled: true
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
35
|
-
}, []);
|
|
36
|
-
};
|
|
37
|
-
/** 转换names */
|
|
38
|
-
export var transformNamesString = function transformNamesString(arr) {
|
|
39
|
-
var result = arr.map(function (subArr) {
|
|
40
|
-
if (Array.isArray(subArr)) {
|
|
41
|
-
return subArr.join('_');
|
|
42
|
-
}
|
|
43
|
-
return subArr;
|
|
44
|
-
});
|
|
45
|
-
return result;
|
|
46
|
-
};
|