@zat-design/sisyphus-react 3.4.3 → 3.4.4-beta.2
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/babel.config.js +3 -0
- package/dist/index.esm.css +35 -31
- package/dist/less.esm.css +20 -4
- package/es/ProConfigProvider/index.d.ts +1 -1
- package/es/ProConfigProvider/index.js +22 -1
- package/es/ProEditLabel/style/index.less +0 -1
- package/es/ProEditTable/components/DndWrapper/index.js +1 -1
- package/es/ProEditTable/components/RenderField/index.js +20 -14
- package/es/ProEditTable/index.js +27 -10
- package/es/ProEditTable/propsType.d.ts +1 -0
- package/es/ProEnum/components/Group.js +8 -19
- package/es/ProEnum/style/index.less +3 -2
- package/es/ProForm/components/base/DatePicker/index.js +3 -1
- package/es/ProForm/components/base/TextArea/index.js +4 -4
- package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +12 -10
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +6 -1
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -5
- package/es/ProForm/components/combination/Group/index.js +3 -2
- package/es/ProForm/components/combination/GroupCopy/component/ComRender.d.ts +14 -0
- package/es/ProForm/components/combination/GroupCopy/component/ComRender.js +36 -0
- package/es/ProForm/components/combination/GroupCopy/index.d.ts +10 -0
- package/es/ProForm/components/combination/GroupCopy/index.js +84 -0
- package/es/ProForm/components/combination/GroupCopy/propsType.d.ts +47 -0
- package/es/ProForm/components/combination/GroupCopy/propsType.js +1 -0
- package/es/ProForm/components/combination/GroupCopy/style/index.less +131 -0
- package/es/ProForm/components/combination/GroupCopy/utils.d.ts +53 -0
- package/es/ProForm/components/combination/GroupCopy/utils.js +180 -0
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +131 -74
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +2 -2
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -1
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/es/ProForm/components/index.js +1 -0
- package/es/ProForm/components/render/ConfirmWrapper.js +8 -2
- package/es/ProForm/components/render/Render.js +12 -9
- package/es/ProForm/components/render/RenderFields.d.ts +1 -1
- package/es/ProForm/components/render/propsType.d.ts +4 -4
- package/es/ProForm/index.js +4 -5
- package/es/ProForm/propsType.d.ts +2 -2
- package/es/ProForm/style/index.less +23 -5
- package/es/ProForm/utils/diffOriginal.js +17 -32
- package/es/ProForm/utils/index.d.ts +1 -1
- package/es/ProForm/utils/index.js +14 -4
- package/es/ProForm/utils/rulesCreator.d.ts +7 -1
- package/es/ProForm/utils/rulesCreator.js +45 -3
- package/es/ProForm/utils/useRules.js +36 -11
- package/es/ProForm/utils/useShouldUpdate.js +4 -4
- package/es/ProIcon/index.js +0 -3
- package/es/ProLayout/components/ProCollapse/index.js +23 -1
- package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +12 -50
- package/es/ProThemeTools/index.js +0 -1
- package/es/ProTree/components/ProTreeSelect/style/index.less +1 -1
- package/es/ProTree/style/index.less +5 -0
- package/es/ProUpload/style/index.less +1 -1
- package/es/ProWaterMark/__snapshots__/index.test.tsx.snap +7 -0
- package/es/assets/view.svg +20 -1
- package/es/locale/en_US.d.ts +4 -2
- package/es/locale/en_US.js +4 -2
- package/es/locale/zh_CN.d.ts +4 -2
- package/es/locale/zh_CN.js +4 -2
- package/es/style/components.less +0 -3
- package/es/style/theme/antd.less +14 -28
- package/jest.config.js +8 -0
- package/lib/ProConfigProvider/index.d.ts +1 -1
- package/lib/ProConfigProvider/index.js +21 -0
- package/lib/ProEditLabel/style/index.less +0 -1
- package/lib/ProEditTable/components/DndWrapper/index.js +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +18 -12
- package/lib/ProEditTable/index.js +27 -10
- package/lib/ProEditTable/propsType.d.ts +1 -0
- package/lib/ProEnum/components/Group.js +7 -18
- package/lib/ProEnum/style/index.less +3 -2
- package/lib/ProForm/components/base/DatePicker/index.js +3 -1
- package/lib/ProForm/components/base/TextArea/index.js +5 -5
- package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +12 -10
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +6 -1
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -5
- package/lib/ProForm/components/combination/Group/index.js +3 -2
- package/lib/ProForm/components/combination/GroupCopy/component/ComRender.d.ts +14 -0
- package/lib/ProForm/components/combination/GroupCopy/component/ComRender.js +44 -0
- package/lib/ProForm/components/combination/GroupCopy/index.d.ts +10 -0
- package/lib/ProForm/components/combination/GroupCopy/index.js +91 -0
- package/lib/ProForm/components/combination/GroupCopy/propsType.d.ts +47 -0
- package/lib/ProForm/components/combination/GroupCopy/propsType.js +5 -0
- package/lib/ProForm/components/combination/GroupCopy/style/index.less +131 -0
- package/lib/ProForm/components/combination/GroupCopy/utils.d.ts +53 -0
- package/lib/ProForm/components/combination/GroupCopy/utils.js +187 -0
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +140 -87
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +2 -2
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -1
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/lib/ProForm/components/render/ConfirmWrapper.js +8 -2
- package/lib/ProForm/components/render/Render.js +12 -9
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -1
- package/lib/ProForm/components/render/propsType.d.ts +4 -4
- package/lib/ProForm/index.js +4 -5
- package/lib/ProForm/propsType.d.ts +2 -2
- package/lib/ProForm/style/index.less +23 -5
- package/lib/ProForm/utils/diffOriginal.js +16 -31
- package/lib/ProForm/utils/index.d.ts +1 -1
- package/lib/ProForm/utils/index.js +14 -4
- package/lib/ProForm/utils/rulesCreator.d.ts +7 -1
- package/lib/ProForm/utils/rulesCreator.js +45 -2
- package/lib/ProForm/utils/useRules.js +36 -11
- package/lib/ProForm/utils/useShouldUpdate.js +4 -4
- package/lib/ProIcon/index.js +0 -3
- package/lib/ProLayout/components/ProCollapse/index.js +23 -1
- package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +12 -50
- package/lib/ProThemeTools/index.js +0 -1
- package/lib/ProTree/components/ProTreeSelect/style/index.less +1 -1
- package/lib/ProTree/style/index.less +5 -0
- package/lib/ProUpload/style/index.less +1 -1
- package/lib/ProWaterMark/__snapshots__/index.test.tsx.snap +7 -0
- package/lib/assets/view.svg +20 -1
- package/lib/locale/en_US.d.ts +4 -2
- package/lib/locale/en_US.js +4 -2
- package/lib/locale/zh_CN.d.ts +4 -2
- package/lib/locale/zh_CN.js +4 -2
- package/lib/style/components.less +0 -3
- package/lib/style/theme/antd.less +14 -28
- package/package.json +5 -1
- package/test/__mocks__/fileMock.js +0 -0
- package/test/__mocks__/styleMock.js +0 -0
|
@@ -28,7 +28,7 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
|
28
28
|
add(undefined, index + 1);
|
|
29
29
|
},
|
|
30
30
|
type: 'text',
|
|
31
|
-
label: "".concat(_locale.default.ProForm.
|
|
31
|
+
label: "".concat(_locale.default.ProForm.formListActions[0]),
|
|
32
32
|
icon: (0, _jsxRuntime.jsx)(_icons.PlusSquareOutlined, {})
|
|
33
33
|
},
|
|
34
34
|
delete: {
|
|
@@ -40,7 +40,7 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
|
40
40
|
remove(index);
|
|
41
41
|
},
|
|
42
42
|
type: 'text',
|
|
43
|
-
label: "".concat(_locale.default.ProForm.
|
|
43
|
+
label: "".concat(_locale.default.ProForm.formListActions[1]),
|
|
44
44
|
icon: mode === 'less' ? (0, _jsxRuntime.jsx)(_ProIcon.default, {
|
|
45
45
|
type: "solid-close",
|
|
46
46
|
className: "single-delete"
|
|
@@ -57,7 +57,7 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
|
57
57
|
add(record, index + 1);
|
|
58
58
|
},
|
|
59
59
|
type: 'text',
|
|
60
|
-
label: "".concat(_locale.default.ProForm.
|
|
60
|
+
label: "".concat(_locale.default.ProForm.formListActions[2]),
|
|
61
61
|
icon: (0, _jsxRuntime.jsx)(_icons.CopyOutlined, {})
|
|
62
62
|
},
|
|
63
63
|
moveUp: {
|
|
@@ -69,7 +69,7 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
|
69
69
|
move(index, index - 1);
|
|
70
70
|
},
|
|
71
71
|
type: 'text',
|
|
72
|
-
label: "".concat(_locale.default.ProForm.
|
|
72
|
+
label: "".concat(_locale.default.ProForm.formListActions[3]),
|
|
73
73
|
icon: (0, _jsxRuntime.jsx)(_icons.UpSquareOutlined, {})
|
|
74
74
|
},
|
|
75
75
|
moveDown: {
|
|
@@ -81,13 +81,14 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
|
81
81
|
move(index, index + 1);
|
|
82
82
|
},
|
|
83
83
|
type: 'text',
|
|
84
|
-
label: "".concat(_locale.default.ProForm.
|
|
84
|
+
label: "".concat(_locale.default.ProForm.formListActions[4]),
|
|
85
85
|
icon: (0, _jsxRuntime.jsx)(_icons.DownSquareOutlined, {})
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
if (mode === 'block') {
|
|
89
89
|
Object.keys(originActions).forEach(function (key) {
|
|
90
|
-
originActions[key].type = '
|
|
90
|
+
originActions[key].type = 'text';
|
|
91
|
+
originActions[key].className = 'pro-form-list-tool-btn';
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
94
|
if (mode === 'line') {
|
|
@@ -116,7 +117,8 @@ var ActionButton = function ActionButton(props) {
|
|
|
116
117
|
fields = props.fields,
|
|
117
118
|
min = props.min,
|
|
118
119
|
max = props.max,
|
|
119
|
-
mode = props.mode
|
|
120
|
+
mode = props.mode,
|
|
121
|
+
isView = props.isView;
|
|
120
122
|
// 默认显示一个delete
|
|
121
123
|
var actionProps = (0, _react.useMemo)(function () {
|
|
122
124
|
var _props$actionProps;
|
|
@@ -167,7 +169,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
167
169
|
var _onClick = onClick || onHandle;
|
|
168
170
|
if (['add', 'delete', 'copy', 'moveUp', 'moveDown'].includes(actionType)) {
|
|
169
171
|
// 禁用状态默认隐藏内置操作按钮
|
|
170
|
-
if (disabled) return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
172
|
+
if (disabled || isView) return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
171
173
|
var _defaultActions$actio = defaultActions[actionType],
|
|
172
174
|
internalOnClick = _defaultActions$actio.onClick,
|
|
173
175
|
defaultLabel = _defaultActions$actio.label,
|
|
@@ -189,7 +191,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
189
191
|
return false;
|
|
190
192
|
}
|
|
191
193
|
return _needConfirm ? (0, _jsxRuntime.jsx)(_antd.Popconfirm, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
192
|
-
title: title !== null && title !== void 0 ? title : "".concat(_locale.default.ProForm.
|
|
194
|
+
title: title !== null && title !== void 0 ? title : "".concat(_locale.default.ProForm.formListConfirmMessage),
|
|
193
195
|
onCancel: function onCancel(e) {
|
|
194
196
|
return e.stopPropagation();
|
|
195
197
|
},
|
|
@@ -212,7 +214,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
212
214
|
}), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
|
|
213
215
|
}
|
|
214
216
|
return needConfirm ? (0, _jsxRuntime.jsx)(_antd.Popconfirm, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
215
|
-
title: title !== null && title !== void 0 ? title : "".concat(_locale.default.ProForm.
|
|
217
|
+
title: title !== null && title !== void 0 ? title : "".concat(_locale.default.ProForm.formListConfirmMessage),
|
|
216
218
|
onCancel: function onCancel(e) {
|
|
217
219
|
return e.stopPropagation();
|
|
218
220
|
},
|
|
@@ -5,10 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
10
|
var _antd = require("antd");
|
|
10
11
|
var _react = require("react");
|
|
11
12
|
var _lodash = require("lodash");
|
|
13
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
14
|
var _ActionButton = _interopRequireDefault(require("./ActionButton"));
|
|
13
15
|
var _RenderFields = _interopRequireDefault(require("../../../render/RenderFields"));
|
|
14
16
|
var _ProCollapse = _interopRequireDefault(require("../../../../../ProLayout/components/ProCollapse"));
|
|
@@ -38,8 +40,10 @@ var BlockFields = function BlockFields(props) {
|
|
|
38
40
|
}
|
|
39
41
|
return title;
|
|
40
42
|
}, [title, index]);
|
|
43
|
+
var cls = (0, _classnames.default)((0, _defineProperty2.default)({}, "pro-form-list-mode-".concat(mode), mode === 'block' || mode === 'line' || mode === 'less'));
|
|
41
44
|
return (0, _jsxRuntime.jsx)(_antd.Space, {
|
|
42
45
|
direction: "vertical",
|
|
46
|
+
className: cls,
|
|
43
47
|
children: (0, _jsxRuntime.jsx)(_ProCollapse.default, {
|
|
44
48
|
title: _title,
|
|
45
49
|
index: index,
|
|
@@ -59,7 +63,8 @@ var BlockFields = function BlockFields(props) {
|
|
|
59
63
|
fields: fields,
|
|
60
64
|
actionProps: actionProps,
|
|
61
65
|
mode: mode,
|
|
62
|
-
disabled: disabled
|
|
66
|
+
disabled: disabled,
|
|
67
|
+
isView: isView
|
|
63
68
|
}),
|
|
64
69
|
children: (0, _jsxRuntime.jsx)(_antd.Row, {
|
|
65
70
|
gutter: 24,
|
|
@@ -24,7 +24,7 @@ var actions = {
|
|
|
24
24
|
namePath = _ref.namePath;
|
|
25
25
|
operation.add();
|
|
26
26
|
},
|
|
27
|
-
label: "".concat(_locale.default.ProForm.
|
|
27
|
+
label: "".concat(_locale.default.ProForm.formListActions[5]),
|
|
28
28
|
type: 'link',
|
|
29
29
|
icon: (0, _jsxRuntime.jsx)(_icons.PlusOutlined, {})
|
|
30
30
|
}
|
|
@@ -63,9 +63,6 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
63
63
|
operation.add(data);
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
-
if (disabled || isView) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
66
|
return (0, _jsxRuntime.jsx)(_antd.Space, {
|
|
70
67
|
align: "start",
|
|
71
68
|
className: "pro-form-list-toolbar",
|
|
@@ -84,7 +81,7 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
84
81
|
rest = (0, _objectWithoutProperties2.default)(item, _excluded);
|
|
85
82
|
var _onClick = _onClick2 || onHandle;
|
|
86
83
|
if (['add'].includes(actionType)) {
|
|
87
|
-
if (disabled) return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
84
|
+
if (disabled || isView) return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
88
85
|
var _actions$actionType = actions[actionType],
|
|
89
86
|
internalOnClick = _actions$actionType.onClick,
|
|
90
87
|
defaultLabel = _actions$actionType.label,
|
|
@@ -90,13 +90,14 @@ var Group = function Group(props) {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
}, [value]);
|
|
93
|
+
var _otherProps = (0, _lodash.omit)(otherProps, ['colProps', 'required']);
|
|
93
94
|
return (0, _jsxRuntime.jsx)("div", {
|
|
94
95
|
className: _className,
|
|
95
96
|
children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? (0, _jsxRuntime.jsx)(_antd.Space.Compact, {
|
|
96
97
|
children: (0, _jsxRuntime.jsx)(_RenderFields.default, (0, _objectSpread2.default)({
|
|
97
98
|
columns: data.columns,
|
|
98
99
|
form: form
|
|
99
|
-
},
|
|
100
|
+
}, _otherProps))
|
|
100
101
|
}) : (0, _jsxRuntime.jsx)(_antd.Space, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
101
102
|
align: "start"
|
|
102
103
|
}, (0, _lodash.omit)(space, ['separator', 'compact'])), {}, {
|
|
@@ -104,7 +105,7 @@ var Group = function Group(props) {
|
|
|
104
105
|
return (0, _jsxRuntime.jsx)(_RenderFields.default, (0, _objectSpread2.default)({
|
|
105
106
|
columns: [column],
|
|
106
107
|
form: form
|
|
107
|
-
},
|
|
108
|
+
}, _otherProps), (column === null || column === void 0 ? void 0 : column.name) || index);
|
|
108
109
|
})
|
|
109
110
|
}))
|
|
110
111
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
type: string;
|
|
4
|
+
component: React.ReactElement;
|
|
5
|
+
value: any;
|
|
6
|
+
onChange: any;
|
|
7
|
+
disabled: any;
|
|
8
|
+
confirm: any;
|
|
9
|
+
fieldProps: any;
|
|
10
|
+
contextProps: any;
|
|
11
|
+
}
|
|
12
|
+
/** 渲染组件 */
|
|
13
|
+
declare const ComRender: React.FC<Props>;
|
|
14
|
+
export default ComRender;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
var _ConfirmWrapper = _interopRequireDefault(require("@/ProForm/components/render/ConfirmWrapper"));
|
|
14
|
+
var _useFieldProps = require("@/ProForm/utils/useFieldProps");
|
|
15
|
+
var componentMap = _interopRequireWildcard(require("../../../../../index"));
|
|
16
|
+
var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps"];
|
|
17
|
+
/** 渲染组件 */
|
|
18
|
+
var ComRender = function ComRender(props) {
|
|
19
|
+
var type = props.type,
|
|
20
|
+
confirm = props.confirm,
|
|
21
|
+
component = props.component,
|
|
22
|
+
fieldProps = props.fieldProps,
|
|
23
|
+
contextProps = props.contextProps,
|
|
24
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
25
|
+
var TypeComponent = componentMap[type];
|
|
26
|
+
var componentProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, fieldProps), rest);
|
|
27
|
+
var Component;
|
|
28
|
+
if (confirm) {
|
|
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
|
+
}
|
|
37
|
+
return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
|
|
38
|
+
value: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, contextProps), {}, {
|
|
39
|
+
type: type
|
|
40
|
+
}),
|
|
41
|
+
children: Component
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var _default = exports.default = ComRender;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GroupProps } from './propsType';
|
|
3
|
+
/**
|
|
4
|
+
* 1. 外层过滤FormItem相关属性, 但是子元素上的 required [disabled] [show] rules [fieldProps] [component] 需要取到并
|
|
5
|
+
* 2.
|
|
6
|
+
*
|
|
7
|
+
* render内部能力 show, component, value, onChange, disabled, clearNotShow, fieldProps
|
|
8
|
+
*/
|
|
9
|
+
declare const GroupCopy: React.FC<GroupProps>;
|
|
10
|
+
export default GroupCopy;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
var _antd = require("antd");
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _lodash = require("lodash");
|
|
16
|
+
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
17
|
+
var _utils = require("./utils");
|
|
18
|
+
var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
|
|
19
|
+
var _ComRender = _interopRequireDefault(require("./component/ComRender"));
|
|
20
|
+
/**
|
|
21
|
+
* 1. 外层过滤FormItem相关属性, 但是子元素上的 required [disabled] [show] rules [fieldProps] [component] 需要取到并
|
|
22
|
+
* 2.
|
|
23
|
+
*
|
|
24
|
+
* render内部能力 show, component, value, onChange, disabled, clearNotShow, fieldProps
|
|
25
|
+
*/
|
|
26
|
+
var GroupCopy = function GroupCopy(props) {
|
|
27
|
+
var children = props.children,
|
|
28
|
+
className = props.className,
|
|
29
|
+
_props$space = props.space,
|
|
30
|
+
space = _props$space === void 0 ? {
|
|
31
|
+
size: 12
|
|
32
|
+
} : _props$space,
|
|
33
|
+
value = props.value,
|
|
34
|
+
onChange = props.onChange;
|
|
35
|
+
var contextProps = _ProForm.default.useFieldProps() || {};
|
|
36
|
+
var names = contextProps.names,
|
|
37
|
+
name = contextProps.name,
|
|
38
|
+
form = contextProps.form,
|
|
39
|
+
namePath = contextProps.namePath,
|
|
40
|
+
index = contextProps.index;
|
|
41
|
+
var _value = value && (0, _toConsumableArray2.default)(value) || [];
|
|
42
|
+
var _option = _react.default.useRef([]);
|
|
43
|
+
// 组合onChange
|
|
44
|
+
var handleChange = function handleChange(value, option, index) {
|
|
45
|
+
_value[index] = value;
|
|
46
|
+
_option.current[index] = option;
|
|
47
|
+
onChange(_value, _option.current);
|
|
48
|
+
};
|
|
49
|
+
var columns = (0, _react.useMemo)(function () {
|
|
50
|
+
var columnsProps = (0, _utils.transformColumns)({
|
|
51
|
+
columns: children,
|
|
52
|
+
name: name,
|
|
53
|
+
names: names,
|
|
54
|
+
onChange: handleChange,
|
|
55
|
+
namePath: namePath,
|
|
56
|
+
form: form,
|
|
57
|
+
index: index,
|
|
58
|
+
value: _value
|
|
59
|
+
});
|
|
60
|
+
return (0, _utils.insertSeparator)(columnsProps, space);
|
|
61
|
+
}, [name, value, children, space, names, namePath, index]);
|
|
62
|
+
var _className = (0, _classnames2.default)((0, _defineProperty2.default)({
|
|
63
|
+
'pro-group': true,
|
|
64
|
+
'pro-group-diy-width': columns.some(function (item) {
|
|
65
|
+
var _item$fieldProps, _item$fieldProps$styl;
|
|
66
|
+
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;
|
|
67
|
+
}),
|
|
68
|
+
'pro-group-width-auto': columns.some(function (item) {
|
|
69
|
+
return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
|
|
70
|
+
})
|
|
71
|
+
}, "".concat(className), className));
|
|
72
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
73
|
+
className: _className,
|
|
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) {
|
|
76
|
+
return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)({
|
|
77
|
+
contextProps: contextProps
|
|
78
|
+
}, column));
|
|
79
|
+
})
|
|
80
|
+
}) : (0, _jsxRuntime.jsx)(_antd.Space, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
81
|
+
align: "start"
|
|
82
|
+
}, (0, _lodash.omit)(space, ['separator', 'compact'])), {}, {
|
|
83
|
+
children: columns.map(function (column, index) {
|
|
84
|
+
return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)({
|
|
85
|
+
contextProps: contextProps
|
|
86
|
+
}, column));
|
|
87
|
+
})
|
|
88
|
+
}))
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
var _default = exports.default = GroupCopy;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormItemProps, ModalFuncProps, SpaceProps } from 'antd';
|
|
3
|
+
import { FormInstance } from 'antd/es/form/Form';
|
|
4
|
+
import { NamePath } from 'antd/lib/form/interface';
|
|
5
|
+
import { ColumnPropsMap, FunctionArgs, ProFormValueType, ReactiveFunction, ViewType } 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?: GroupColumnProps[];
|
|
20
|
+
space?: SpaceType;
|
|
21
|
+
className?: string;
|
|
22
|
+
id?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
isView?: boolean;
|
|
25
|
+
value?: any[];
|
|
26
|
+
onChange?: (value: any[] | null, options?: any[]) => void;
|
|
27
|
+
}
|
|
28
|
+
export type GroupColumnProps<Values = any> = {
|
|
29
|
+
component?: React.ReactNode | ReactiveFunction<Values, React.ReactNode>;
|
|
30
|
+
names?: NamePath[];
|
|
31
|
+
show?: boolean | ReactiveFunction<Values, boolean>;
|
|
32
|
+
valueType?: ProFormValueType;
|
|
33
|
+
switchValue?: [any, any];
|
|
34
|
+
isView?: boolean;
|
|
35
|
+
viewRender?: (value: any, record: Values, { form, index, namePath, }: {
|
|
36
|
+
form: FormInstance<Values>;
|
|
37
|
+
index?: number | undefined;
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}) => React.ReactElement<any, any> | string | undefined | null;
|
|
40
|
+
viewType?: ViewType;
|
|
41
|
+
disabled?: boolean | ReactiveFunction<Values, boolean>;
|
|
42
|
+
trim?: boolean;
|
|
43
|
+
upperCase?: boolean;
|
|
44
|
+
toISOString?: boolean;
|
|
45
|
+
clearNotShow?: boolean;
|
|
46
|
+
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps>;
|
|
47
|
+
} & ColumnPropsMap & FormItemProps;
|
|
@@ -0,0 +1,131 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InternalNamePath, NamePath } from 'antd/lib/form/interface';
|
|
3
|
+
import { FormInstance } from 'antd';
|
|
4
|
+
import { GroupColumnProps, SpaceType } from './propsType';
|
|
5
|
+
import { ProFormColumnProps, ReactiveFunction } from '../../render/propsType';
|
|
6
|
+
export type EventArgs = any[];
|
|
7
|
+
/**
|
|
8
|
+
* 插入间隔符
|
|
9
|
+
* @param columns 表单配置数组
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare const insertSeparator: (columns: GroupColumnProps[], space?: SpaceType) => any[];
|
|
13
|
+
/** 带出event的组件默认取值方法 */
|
|
14
|
+
export declare function defaultGetValueFromEvent(valuePropName: string, ...args: EventArgs): any;
|
|
15
|
+
/** 转换names */
|
|
16
|
+
export declare const transformNamesString: (arr: (string | string[])[]) => (string | string[])[];
|
|
17
|
+
interface Params {
|
|
18
|
+
form?: FormInstance;
|
|
19
|
+
index?: number;
|
|
20
|
+
type?: string;
|
|
21
|
+
namePath?: InternalNamePath;
|
|
22
|
+
disabled?: boolean | ReactiveFunction<any, boolean>;
|
|
23
|
+
show?: boolean | ReactiveFunction<any, boolean>;
|
|
24
|
+
component?: React.ReactNode | ReactiveFunction<any, React.ReactNode>;
|
|
25
|
+
fieldProps?: boolean | ReactiveFunction<any, boolean>;
|
|
26
|
+
name?: NamePath;
|
|
27
|
+
}
|
|
28
|
+
/** 计算响应式参数的值 */
|
|
29
|
+
export declare const getReactiveProps: (params: Params) => {
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
show: boolean;
|
|
32
|
+
component: any;
|
|
33
|
+
fieldProps: boolean;
|
|
34
|
+
};
|
|
35
|
+
type ValueTypeGetterParams = Pick<ProFormColumnProps, 'valueType' | 'switchValue' | 'toISOString'> & {
|
|
36
|
+
type?: any;
|
|
37
|
+
mode?: string;
|
|
38
|
+
};
|
|
39
|
+
/** 获取当前字段的转换函数 */
|
|
40
|
+
export declare const getValueTypeTrans: (params: ValueTypeGetterParams) => any;
|
|
41
|
+
interface ColumnsTransformerParams {
|
|
42
|
+
columns: GroupColumnProps[];
|
|
43
|
+
name?: NamePath;
|
|
44
|
+
names?: NamePath[];
|
|
45
|
+
value?: any[];
|
|
46
|
+
onChange: any;
|
|
47
|
+
namePath?: InternalNamePath;
|
|
48
|
+
form: FormInstance;
|
|
49
|
+
index?: number;
|
|
50
|
+
}
|
|
51
|
+
/** 转换columns */
|
|
52
|
+
export declare const transformColumns: (params: ColumnsTransformerParams) => any[];
|
|
53
|
+
export {};
|