@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/babel.config.js
ADDED
|
@@ -74,7 +74,8 @@ var RenderField = function RenderField(_ref) {
|
|
|
74
74
|
originalValues = config.originalValues,
|
|
75
75
|
formNamePath = config.namePath,
|
|
76
76
|
_config$originalDiffT = config.originalDiffTip,
|
|
77
|
-
originalDiffTip = _config$originalDiffT === void 0 ? true : _config$originalDiffT
|
|
77
|
+
originalDiffTip = _config$originalDiffT === void 0 ? true : _config$originalDiffT,
|
|
78
|
+
rowDisabled = config.rowDisabled;
|
|
78
79
|
var _fieldProps = fieldProps || formItemProps || {};
|
|
79
80
|
var _rules = rules || [];
|
|
80
81
|
var _required = required;
|
|
@@ -99,7 +100,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
99
100
|
isEditable = isEditable(currentValue, rowData, options);
|
|
100
101
|
}
|
|
101
102
|
// 是否只读文本
|
|
102
|
-
var isView = !isEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !isEditing;
|
|
103
|
+
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));
|
|
103
104
|
// 只读文本时,采用当前formItem的name,单行编辑时,使用生成的虚拟的name
|
|
104
105
|
var baseName = isView ? name : namePath;
|
|
105
106
|
var TargetComponent;
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
11
11
|
import "antd/es/form/style";
|
|
12
12
|
import _Form from "antd/es/form";
|
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
14
|
-
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"];
|
|
14
|
+
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"];
|
|
15
15
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
17
17
|
import { get, isArray } from 'lodash';
|
|
@@ -51,6 +51,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
51
51
|
originalValues = _ref.originalValues,
|
|
52
52
|
originalDiffTip = _ref.originalDiffTip,
|
|
53
53
|
rowKey = _ref.rowKey,
|
|
54
|
+
rowDisabled = _ref.rowDisabled,
|
|
54
55
|
resetProps = _objectWithoutProperties(_ref, _excluded);
|
|
55
56
|
// 上下文form
|
|
56
57
|
var contentForm = _Form.useFormInstance();
|
|
@@ -159,7 +160,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
159
160
|
page: page,
|
|
160
161
|
originalValues: originalValues,
|
|
161
162
|
originalDiffTip: originalDiffTip,
|
|
162
|
-
prefixCls: prefixCls
|
|
163
|
+
prefixCls: prefixCls,
|
|
164
|
+
rowDisabled: rowDisabled
|
|
163
165
|
};
|
|
164
166
|
// 编辑行设置下样式
|
|
165
167
|
var _rowClassName = function _rowClassName(record) {
|
|
@@ -180,6 +182,15 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
180
182
|
selectedRowKeys: selectedRowKeys,
|
|
181
183
|
selectedRows: selectedRows
|
|
182
184
|
});
|
|
185
|
+
},
|
|
186
|
+
getCheckboxProps: function getCheckboxProps(record) {
|
|
187
|
+
if (rowDisabled) {
|
|
188
|
+
var _disabled = rowDisabled(record);
|
|
189
|
+
return {
|
|
190
|
+
disabled: _disabled
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
return {};
|
|
183
194
|
}
|
|
184
195
|
}, rowSelection);
|
|
185
196
|
// 判断是否禁止添加、批量删除
|
|
@@ -32,7 +32,8 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
32
32
|
validateKeys = config.validateKeys,
|
|
33
33
|
actionWidth = config.actionWidth,
|
|
34
34
|
actionProps = config.actionProps,
|
|
35
|
-
page = config.page
|
|
35
|
+
page = config.page,
|
|
36
|
+
rowDisabled = config.rowDisabled;
|
|
36
37
|
var pageNum = tools.calc(page.pageNum, '-', 1);
|
|
37
38
|
var firstIndex = tools.calc(pageNum, '*', page.pageSize);
|
|
38
39
|
// actionProps配置为false 默认不插入
|
|
@@ -184,6 +185,11 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
184
185
|
fixed: 'right',
|
|
185
186
|
width: actionWidth || (virtualKey ? '120px' : '60px'),
|
|
186
187
|
render: function render(text, record, index) {
|
|
188
|
+
var _rowDisabled;
|
|
189
|
+
var _disabled = (_rowDisabled = rowDisabled === null || rowDisabled === void 0 ? void 0 : rowDisabled(record)) !== null && _rowDisabled !== void 0 ? _rowDisabled : false;
|
|
190
|
+
if (_disabled) {
|
|
191
|
+
return '';
|
|
192
|
+
}
|
|
187
193
|
return _jsx(_Space, {
|
|
188
194
|
size: "middle",
|
|
189
195
|
children: actionBtns.map(function (btnConfig) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import classNames from 'classnames';
|
|
3
|
-
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
5
|
var Group = function Group(props) {
|
|
5
6
|
var value = props.value,
|
|
6
7
|
onChange = props.onChange,
|
|
@@ -10,12 +11,17 @@ var Group = function Group(props) {
|
|
|
10
11
|
disabled = props.disabled,
|
|
11
12
|
_props$allowClear = props.allowClear,
|
|
12
13
|
allowClear = _props$allowClear === void 0 ? true : _props$allowClear;
|
|
14
|
+
var _useState = useState(false),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
refresh = _useState2[0],
|
|
17
|
+
setRefresh = _useState2[1];
|
|
13
18
|
var idx = useRef(-1);
|
|
14
19
|
useEffect(function () {
|
|
15
20
|
var index = dataSource.findIndex(function (item) {
|
|
16
21
|
return item[fieldValue] === value;
|
|
17
22
|
});
|
|
18
23
|
idx.current = index;
|
|
24
|
+
setRefresh(!refresh);
|
|
19
25
|
}, [value]);
|
|
20
26
|
var handleClick = function handleClick(val, index) {
|
|
21
27
|
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;
|
|
@@ -23,7 +23,8 @@ var FormList = function FormList(props, ref) {
|
|
|
23
23
|
mode = _props$mode === void 0 ? 'line' : _props$mode,
|
|
24
24
|
meta = props.meta,
|
|
25
25
|
_props$span = props.span,
|
|
26
|
-
span = _props$span === void 0 ? 8 : _props$span
|
|
26
|
+
span = _props$span === void 0 ? 8 : _props$span,
|
|
27
|
+
disabled = props.disabled;
|
|
27
28
|
var _fields = fields.map(function (item) {
|
|
28
29
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
29
30
|
key: String(item.key)
|
|
@@ -32,8 +33,7 @@ var FormList = function FormList(props, ref) {
|
|
|
32
33
|
var _ref = ProForm.useFieldProps() || {},
|
|
33
34
|
form = _ref.form,
|
|
34
35
|
name = _ref.name,
|
|
35
|
-
isView = _ref.isView
|
|
36
|
-
disabled = _ref.disabled;
|
|
36
|
+
isView = _ref.isView;
|
|
37
37
|
var errors = meta.errors;
|
|
38
38
|
var _namePath = toArray(name);
|
|
39
39
|
var processColumns = useCallback(function (fieldName, namePath) {
|
|
@@ -89,7 +89,7 @@ var FormList = function FormList(props, ref) {
|
|
|
89
89
|
var _columns = processColumns(index, namePath);
|
|
90
90
|
return mode === 'block' ? _jsx(BlockFields, _objectSpread(_objectSpread({}, props), {}, {
|
|
91
91
|
columns: _columns,
|
|
92
|
-
disabled: disabled
|
|
92
|
+
disabled: disabled,
|
|
93
93
|
isView: isView,
|
|
94
94
|
namePath: namePath,
|
|
95
95
|
index: index,
|
|
@@ -103,7 +103,7 @@ var FormList = function FormList(props, ref) {
|
|
|
103
103
|
}, props), {}, {
|
|
104
104
|
mode: mode,
|
|
105
105
|
columns: _columns,
|
|
106
|
-
disabled: disabled
|
|
106
|
+
disabled: disabled,
|
|
107
107
|
isView: isView,
|
|
108
108
|
namePath: namePath,
|
|
109
109
|
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,36 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps"];
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ConfirmWrapper from '@/ProForm/components/render/ConfirmWrapper';
|
|
7
|
+
import { FieldProvider } from '@/ProForm/utils/useFieldProps';
|
|
8
|
+
import * as componentMap from '../../../../../index';
|
|
9
|
+
/** 渲染组件 */
|
|
10
|
+
var ComRender = function ComRender(props) {
|
|
11
|
+
var type = props.type,
|
|
12
|
+
confirm = props.confirm,
|
|
13
|
+
component = props.component,
|
|
14
|
+
fieldProps = props.fieldProps,
|
|
15
|
+
contextProps = props.contextProps,
|
|
16
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
17
|
+
var TypeComponent = componentMap[type];
|
|
18
|
+
var componentProps = _objectSpread(_objectSpread({}, fieldProps), rest);
|
|
19
|
+
var Component;
|
|
20
|
+
if (confirm) {
|
|
21
|
+
Component = _jsx(ConfirmWrapper, _objectSpread(_objectSpread({
|
|
22
|
+
confirm: confirm
|
|
23
|
+
}, componentProps), {}, {
|
|
24
|
+
children: component || _jsx(TypeComponent, _objectSpread({}, componentProps))
|
|
25
|
+
}));
|
|
26
|
+
} else {
|
|
27
|
+
Component = component ? ( /*#__PURE__*/React.cloneElement(component, _objectSpread({}, componentProps))) : _jsx(TypeComponent, _objectSpread({}, componentProps));
|
|
28
|
+
}
|
|
29
|
+
return _jsx(FieldProvider, {
|
|
30
|
+
value: _objectSpread(_objectSpread({}, contextProps), {}, {
|
|
31
|
+
type: type
|
|
32
|
+
}),
|
|
33
|
+
children: Component
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export 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,84 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import "antd/es/space/style";
|
|
3
|
+
import _Space from "antd/es/space";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
8
|
+
import { omit } from 'lodash';
|
|
9
|
+
import classnames from 'classnames';
|
|
10
|
+
import { insertSeparator, transformColumns } from './utils';
|
|
11
|
+
import ProForm from '../../../../ProForm';
|
|
12
|
+
import ComRender from './component/ComRender';
|
|
13
|
+
/**
|
|
14
|
+
* 1. 外层过滤FormItem相关属性, 但是子元素上的 required [disabled] [show] rules [fieldProps] [component] 需要取到并
|
|
15
|
+
* 2.
|
|
16
|
+
*
|
|
17
|
+
* render内部能力 show, component, value, onChange, disabled, clearNotShow, fieldProps
|
|
18
|
+
*/
|
|
19
|
+
var GroupCopy = function GroupCopy(props) {
|
|
20
|
+
var children = props.children,
|
|
21
|
+
className = props.className,
|
|
22
|
+
_props$space = props.space,
|
|
23
|
+
space = _props$space === void 0 ? {
|
|
24
|
+
size: 12
|
|
25
|
+
} : _props$space,
|
|
26
|
+
value = props.value,
|
|
27
|
+
onChange = props.onChange;
|
|
28
|
+
var contextProps = ProForm.useFieldProps() || {};
|
|
29
|
+
var names = contextProps.names,
|
|
30
|
+
name = contextProps.name,
|
|
31
|
+
form = contextProps.form,
|
|
32
|
+
namePath = contextProps.namePath,
|
|
33
|
+
index = contextProps.index;
|
|
34
|
+
var _value = value && _toConsumableArray(value) || [];
|
|
35
|
+
var _option = React.useRef([]);
|
|
36
|
+
// 组合onChange
|
|
37
|
+
var handleChange = function handleChange(value, option, index) {
|
|
38
|
+
_value[index] = value;
|
|
39
|
+
_option.current[index] = option;
|
|
40
|
+
onChange(_value, _option.current);
|
|
41
|
+
};
|
|
42
|
+
var columns = useMemo(function () {
|
|
43
|
+
var columnsProps = transformColumns({
|
|
44
|
+
columns: children,
|
|
45
|
+
name: name,
|
|
46
|
+
names: names,
|
|
47
|
+
onChange: handleChange,
|
|
48
|
+
namePath: namePath,
|
|
49
|
+
form: form,
|
|
50
|
+
index: index,
|
|
51
|
+
value: _value
|
|
52
|
+
});
|
|
53
|
+
return insertSeparator(columnsProps, space);
|
|
54
|
+
}, [name, value, children, space, names, namePath, index]);
|
|
55
|
+
var _className = classnames(_defineProperty({
|
|
56
|
+
'pro-group': true,
|
|
57
|
+
'pro-group-diy-width': columns.some(function (item) {
|
|
58
|
+
var _item$fieldProps, _item$fieldProps$styl;
|
|
59
|
+
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;
|
|
60
|
+
}),
|
|
61
|
+
'pro-group-width-auto': columns.some(function (item) {
|
|
62
|
+
return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
|
|
63
|
+
})
|
|
64
|
+
}, "".concat(className), className));
|
|
65
|
+
return _jsx("div", {
|
|
66
|
+
className: _className,
|
|
67
|
+
children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
|
|
68
|
+
children: columns.map(function (column) {
|
|
69
|
+
return _jsx(ComRender, _objectSpread({
|
|
70
|
+
contextProps: contextProps
|
|
71
|
+
}, column));
|
|
72
|
+
})
|
|
73
|
+
}) : _jsx(_Space, _objectSpread(_objectSpread({
|
|
74
|
+
align: "start"
|
|
75
|
+
}, omit(space, ['separator', 'compact'])), {}, {
|
|
76
|
+
children: columns.map(function (column, index) {
|
|
77
|
+
return _jsx(ComRender, _objectSpread({
|
|
78
|
+
contextProps: contextProps
|
|
79
|
+
}, column));
|
|
80
|
+
})
|
|
81
|
+
}))
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
export 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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 {};
|