@zat-design/sisyphus-react 3.4.4 → 3.4.5
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/es/ProEditTable/components/RenderField/index.js +3 -2
- package/es/ProEditTable/index.js +13 -2
- package/es/ProEditTable/propsType.d.ts +1 -0
- package/es/ProEditTable/utils/index.js +7 -1
- package/es/ProEnum/components/Group.js +7 -1
- package/es/ProEnum/style/index.less +3 -2
- package/es/ProForm/components/combination/FormList/index.js +5 -5
- 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/index.js +22 -18
- package/es/ProForm/components/index.js +1 -0
- package/es/ProForm/components/render/Render.js +2 -2
- package/es/ProForm/components/render/propsType.d.ts +1 -1
- package/es/ProIcon/config/index.d.ts +12 -0
- package/es/ProIcon/config/index.js +15 -1
- package/es/ProIcon/index.js +97 -19
- package/es/ProIcon/propsTypes.d.ts +19 -0
- package/es/ProIcon/utils/index.d.ts +1 -0
- package/es/ProIcon/utils/index.js +23 -0
- package/es/ProThemeTools/component/PrdTools/index.js +16 -0
- package/es/ProTreeModal/index.js +11 -15
- package/es/ProWaterMark/__snapshots__/index.test.tsx.snap +7 -0
- package/es/global.less +38 -2
- package/jest.config.js +8 -0
- package/lib/ProEditTable/components/RenderField/index.js +3 -2
- package/lib/ProEditTable/index.js +13 -2
- package/lib/ProEditTable/propsType.d.ts +1 -0
- package/lib/ProEditTable/utils/index.js +7 -1
- package/lib/ProEnum/components/Group.js +6 -0
- package/lib/ProEnum/style/index.less +3 -2
- package/lib/ProForm/components/combination/FormList/index.js +5 -5
- 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/index.js +23 -19
- package/lib/ProForm/components/render/Render.js +2 -2
- package/lib/ProForm/components/render/propsType.d.ts +1 -1
- package/lib/ProIcon/config/index.d.ts +12 -0
- package/lib/ProIcon/config/index.js +16 -2
- package/lib/ProIcon/index.js +94 -18
- package/lib/ProIcon/propsTypes.d.ts +19 -0
- package/lib/ProIcon/utils/index.d.ts +1 -0
- package/lib/ProIcon/utils/index.js +29 -0
- package/lib/ProThemeTools/component/PrdTools/index.js +16 -0
- package/lib/ProTreeModal/index.js +11 -15
- package/lib/ProWaterMark/__snapshots__/index.test.tsx.snap +7 -0
- package/lib/global.less +38 -2
- package/package.json +6 -2
- package/test/__mocks__/fileMock.js +0 -0
- package/test/__mocks__/styleMock.js +0 -0
package/es/global.less
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import './style/index.less';
|
|
2
2
|
|
|
3
|
-
pre
|
|
3
|
+
pre {
|
|
4
4
|
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
5
5
|
}
|
|
6
|
+
|
|
7
|
+
* {
|
|
8
|
+
// 火狐浏览器
|
|
9
|
+
scrollbar-width: thin;
|
|
10
|
+
scrollbar-color: #8b8b8b transparent;
|
|
11
|
+
// ie浏览器
|
|
12
|
+
scrollbar-face-color: #8b8b8b;
|
|
13
|
+
scrollbar-highlight-color: #606060;
|
|
14
|
+
scrollbar-3dlight-color: #606060;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
::-webkit-scrollbar {
|
|
18
|
+
width: 16px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// // 滑块
|
|
22
|
+
::-webkit-scrollbar-thumb {
|
|
23
|
+
background-color: #8b8b8b;
|
|
24
|
+
background-clip: padding-box;
|
|
25
|
+
border-color: transparent;
|
|
26
|
+
border-style: dashed;
|
|
27
|
+
border-width: 4px;
|
|
28
|
+
border-radius: 10px;
|
|
29
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 轨道
|
|
33
|
+
::-webkit-scrollbar-track {
|
|
34
|
+
background-color: transparent;
|
|
35
|
+
border-radius: 10px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 悬浮轨道
|
|
39
|
+
::-webkit-scrollbar-thumb:hover {
|
|
40
|
+
background-color: #606060;
|
|
41
|
+
}
|
package/jest.config.js
ADDED
|
@@ -77,7 +77,8 @@ var RenderField = function RenderField(_ref) {
|
|
|
77
77
|
originalValues = config.originalValues,
|
|
78
78
|
formNamePath = config.namePath,
|
|
79
79
|
_config$originalDiffT = config.originalDiffTip,
|
|
80
|
-
originalDiffTip = _config$originalDiffT === void 0 ? true : _config$originalDiffT
|
|
80
|
+
originalDiffTip = _config$originalDiffT === void 0 ? true : _config$originalDiffT,
|
|
81
|
+
rowDisabled = config.rowDisabled;
|
|
81
82
|
var _fieldProps = fieldProps || formItemProps || {};
|
|
82
83
|
var _rules = rules || [];
|
|
83
84
|
var _required = required;
|
|
@@ -102,7 +103,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
102
103
|
isEditable = isEditable(currentValue, rowData, options);
|
|
103
104
|
}
|
|
104
105
|
// 是否只读文本
|
|
105
|
-
var isView = !isEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !isEditing;
|
|
106
|
+
var isView = !isEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !isEditing || (rowDisabled === null || rowDisabled === void 0 ? void 0 : rowDisabled(record));
|
|
106
107
|
// 只读文本时,采用当前formItem的name,单行编辑时,使用生成的虚拟的name
|
|
107
108
|
var baseName = isView ? name : namePath;
|
|
108
109
|
var TargetComponent;
|
|
@@ -25,7 +25,7 @@ var _components = require("./components");
|
|
|
25
25
|
var _ProForm = _interopRequireDefault(require("../ProForm"));
|
|
26
26
|
var _empty = _interopRequireDefault(require("../assets/empty.png"));
|
|
27
27
|
var _locale = _interopRequireWildcard(require("../locale"));
|
|
28
|
-
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey"];
|
|
28
|
+
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled"];
|
|
29
29
|
var ProEditTable = function ProEditTable(_ref, ref) {
|
|
30
30
|
var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value$2;
|
|
31
31
|
var value = _ref.value,
|
|
@@ -54,6 +54,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
54
54
|
originalValues = _ref.originalValues,
|
|
55
55
|
originalDiffTip = _ref.originalDiffTip,
|
|
56
56
|
rowKey = _ref.rowKey,
|
|
57
|
+
rowDisabled = _ref.rowDisabled,
|
|
57
58
|
resetProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
58
59
|
// 上下文form
|
|
59
60
|
var contentForm = _antd.Form.useFormInstance();
|
|
@@ -162,7 +163,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
162
163
|
page: page,
|
|
163
164
|
originalValues: originalValues,
|
|
164
165
|
originalDiffTip: originalDiffTip,
|
|
165
|
-
prefixCls: prefixCls
|
|
166
|
+
prefixCls: prefixCls,
|
|
167
|
+
rowDisabled: rowDisabled
|
|
166
168
|
};
|
|
167
169
|
// 编辑行设置下样式
|
|
168
170
|
var _rowClassName = function _rowClassName(record) {
|
|
@@ -183,6 +185,15 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
183
185
|
selectedRowKeys: selectedRowKeys,
|
|
184
186
|
selectedRows: selectedRows
|
|
185
187
|
});
|
|
188
|
+
},
|
|
189
|
+
getCheckboxProps: function getCheckboxProps(record) {
|
|
190
|
+
if (rowDisabled) {
|
|
191
|
+
var _disabled = rowDisabled(record);
|
|
192
|
+
return {
|
|
193
|
+
disabled: _disabled
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return {};
|
|
186
197
|
}
|
|
187
198
|
}, rowSelection);
|
|
188
199
|
// 判断是否禁止添加、批量删除
|
|
@@ -36,7 +36,8 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
36
36
|
validateKeys = config.validateKeys,
|
|
37
37
|
actionWidth = config.actionWidth,
|
|
38
38
|
actionProps = config.actionProps,
|
|
39
|
-
page = config.page
|
|
39
|
+
page = config.page,
|
|
40
|
+
rowDisabled = config.rowDisabled;
|
|
40
41
|
var pageNum = _utils.tools.calc(page.pageNum, '-', 1);
|
|
41
42
|
var firstIndex = _utils.tools.calc(pageNum, '*', page.pageSize);
|
|
42
43
|
// actionProps配置为false 默认不插入
|
|
@@ -188,6 +189,11 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
188
189
|
fixed: 'right',
|
|
189
190
|
width: actionWidth || (virtualKey ? '120px' : '60px'),
|
|
190
191
|
render: function render(text, record, index) {
|
|
192
|
+
var _rowDisabled;
|
|
193
|
+
var _disabled = (_rowDisabled = rowDisabled === null || rowDisabled === void 0 ? void 0 : rowDisabled(record)) !== null && _rowDisabled !== void 0 ? _rowDisabled : false;
|
|
194
|
+
if (_disabled) {
|
|
195
|
+
return '';
|
|
196
|
+
}
|
|
191
197
|
return (0, _jsxRuntime.jsx)(_antd.Space, {
|
|
192
198
|
size: "middle",
|
|
193
199
|
children: actionBtns.map(function (btnConfig) {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
8
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
11
|
var _react = require("react");
|
|
@@ -17,12 +18,17 @@ var Group = function Group(props) {
|
|
|
17
18
|
disabled = props.disabled,
|
|
18
19
|
_props$allowClear = props.allowClear,
|
|
19
20
|
allowClear = _props$allowClear === void 0 ? true : _props$allowClear;
|
|
21
|
+
var _useState = (0, _react.useState)(false),
|
|
22
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
23
|
+
refresh = _useState2[0],
|
|
24
|
+
setRefresh = _useState2[1];
|
|
20
25
|
var idx = (0, _react.useRef)(-1);
|
|
21
26
|
(0, _react.useEffect)(function () {
|
|
22
27
|
var index = dataSource.findIndex(function (item) {
|
|
23
28
|
return item[fieldValue] === value;
|
|
24
29
|
});
|
|
25
30
|
idx.current = index;
|
|
31
|
+
setRefresh(!refresh);
|
|
26
32
|
}, [value]);
|
|
27
33
|
var handleClick = function handleClick(val, index) {
|
|
28
34
|
if (value === val) {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
&-group-root-disabled {
|
|
11
11
|
color: rgba(0, 0, 0, 0.25);
|
|
12
|
-
.pro-enum-group-item{
|
|
12
|
+
.pro-enum-group-item {
|
|
13
13
|
cursor: not-allowed !important;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -52,8 +52,9 @@
|
|
|
52
52
|
&::after {
|
|
53
53
|
position: absolute;
|
|
54
54
|
top: var(--zaui-space-size-sm);
|
|
55
|
-
right:
|
|
55
|
+
right: -2px;
|
|
56
56
|
bottom: var(--zaui-space-size-sm);
|
|
57
|
+
z-index: 1;
|
|
57
58
|
width: 1px;
|
|
58
59
|
background: var(--zaui-brand);
|
|
59
60
|
opacity: 0.7;
|
|
@@ -29,7 +29,8 @@ var FormList = function FormList(props, ref) {
|
|
|
29
29
|
mode = _props$mode === void 0 ? 'line' : _props$mode,
|
|
30
30
|
meta = props.meta,
|
|
31
31
|
_props$span = props.span,
|
|
32
|
-
span = _props$span === void 0 ? 8 : _props$span
|
|
32
|
+
span = _props$span === void 0 ? 8 : _props$span,
|
|
33
|
+
disabled = props.disabled;
|
|
33
34
|
var _fields = fields.map(function (item) {
|
|
34
35
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
35
36
|
key: String(item.key)
|
|
@@ -38,8 +39,7 @@ var FormList = function FormList(props, ref) {
|
|
|
38
39
|
var _ref = _ProForm.default.useFieldProps() || {},
|
|
39
40
|
form = _ref.form,
|
|
40
41
|
name = _ref.name,
|
|
41
|
-
isView = _ref.isView
|
|
42
|
-
disabled = _ref.disabled;
|
|
42
|
+
isView = _ref.isView;
|
|
43
43
|
var errors = meta.errors;
|
|
44
44
|
var _namePath = (0, _utils.toArray)(name);
|
|
45
45
|
var processColumns = (0, _react.useCallback)(function (fieldName, namePath) {
|
|
@@ -95,7 +95,7 @@ var FormList = function FormList(props, ref) {
|
|
|
95
95
|
var _columns = processColumns(index, namePath);
|
|
96
96
|
return mode === 'block' ? (0, _jsxRuntime.jsx)(_BlockFields.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
97
97
|
columns: _columns,
|
|
98
|
-
disabled: disabled
|
|
98
|
+
disabled: disabled,
|
|
99
99
|
isView: isView,
|
|
100
100
|
namePath: namePath,
|
|
101
101
|
index: index,
|
|
@@ -109,7 +109,7 @@ var FormList = function FormList(props, ref) {
|
|
|
109
109
|
}, props), {}, {
|
|
110
110
|
mode: mode,
|
|
111
111
|
columns: _columns,
|
|
112
|
-
disabled: disabled
|
|
112
|
+
disabled: disabled,
|
|
113
113
|
isView: isView,
|
|
114
114
|
namePath: namePath,
|
|
115
115
|
index: index,
|
|
@@ -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 {};
|