@zat-design/sisyphus-react 3.4.4 → 3.4.5-beta.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/babel.config.js +3 -0
- package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
- package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
- package/coverage/lcov-report/src/.umi/core/index.html +206 -0
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
- package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
- package/coverage/lcov-report/src/.umi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
- package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
- package/dist/index.esm.css +70 -19
- package/dist/less.esm.css +70 -19
- package/es/ProConfigProvider/index.d.ts +2 -2
- package/es/ProConfigProvider/index.js +0 -3
- package/es/ProEditTable/components/RenderField/index.js +10 -9
- package/es/ProEditTable/index.js +14 -3
- 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/Container/index.js +3 -2
- package/es/ProForm/components/combination/Container/style/index.less +5 -1
- 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/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/{ProAddressBar → ProCascader}/index.d.ts +2 -2
- package/es/ProForm/components/combination/ProCascader/index.js +255 -0
- package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +8 -6
- package/es/ProForm/components/combination/ProCascader/propsType.js +1 -0
- package/es/ProForm/components/combination/ProModalSelect/index.js +25 -22
- package/es/ProForm/components/index.d.ts +1 -2
- package/es/ProForm/components/index.js +1 -3
- package/es/ProForm/components/render/Render.js +3 -3
- package/es/ProForm/components/render/propsType.d.ts +4 -8
- package/es/ProForm/index.js +2 -2
- package/es/ProForm/style/index.less +1 -1
- package/es/ProForm/utils/index.js +1 -1
- package/es/ProIcon/config/index.d.ts +14 -0
- package/es/ProIcon/config/index.js +17 -1
- package/es/ProIcon/index.js +134 -26
- package/es/ProIcon/propsTypes.d.ts +24 -0
- package/es/ProIcon/utils/index.d.ts +6 -0
- package/es/ProIcon/utils/index.js +83 -0
- package/es/ProLayout/components/ProCollapse/index.js +6 -3
- package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/es/ProSelect/index.js +1 -1
- package/es/ProStep/components/Step/index.js +5 -4
- package/es/ProStep/style/index.less +20 -0
- package/es/ProTable/utils.js +6 -3
- package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +30 -4
- package/es/ProThemeTools/component/PrdTools/style/index.less +56 -48
- 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/ProConfigProvider/index.d.ts +2 -2
- package/lib/ProConfigProvider/index.js +0 -3
- package/lib/ProEditTable/components/RenderField/index.js +9 -8
- package/lib/ProEditTable/index.js +14 -3
- 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/Container/index.js +3 -2
- package/lib/ProForm/components/combination/Container/style/index.less +5 -1
- 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/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/{ProAddressBar → ProCascader}/index.d.ts +2 -2
- package/lib/ProForm/components/combination/ProCascader/index.js +255 -0
- package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +8 -6
- package/lib/ProForm/components/combination/ProCascader/propsType.js +5 -0
- package/lib/ProForm/components/combination/ProModalSelect/index.js +26 -23
- package/lib/ProForm/components/index.d.ts +1 -2
- package/lib/ProForm/components/index.js +1 -8
- package/lib/ProForm/components/render/Render.js +3 -3
- package/lib/ProForm/components/render/propsType.d.ts +4 -8
- package/lib/ProForm/index.js +1 -1
- package/lib/ProForm/style/index.less +1 -1
- package/lib/ProForm/utils/index.js +1 -1
- package/lib/ProIcon/config/index.d.ts +14 -0
- package/lib/ProIcon/config/index.js +18 -2
- package/lib/ProIcon/index.js +132 -26
- package/lib/ProIcon/propsTypes.d.ts +24 -0
- package/lib/ProIcon/utils/index.d.ts +6 -0
- package/lib/ProIcon/utils/index.js +90 -0
- package/lib/ProLayout/components/ProCollapse/index.js +6 -3
- package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/lib/ProSelect/index.js +1 -1
- package/lib/ProStep/components/Step/index.js +5 -4
- package/lib/ProStep/style/index.less +20 -0
- package/lib/ProTable/utils.js +6 -3
- package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +30 -4
- package/lib/ProThemeTools/component/PrdTools/style/index.less +56 -48
- 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/ProForm/components/base/ProCascader/index.d.ts +0 -14
- package/es/ProForm/components/base/ProCascader/index.js +0 -72
- package/es/ProForm/components/combination/ProAddressBar/index.js +0 -437
- package/lib/ProForm/components/base/ProCascader/index.d.ts +0 -14
- package/lib/ProForm/components/base/ProCascader/index.js +0 -78
- package/lib/ProForm/components/combination/ProAddressBar/index.js +0 -437
- /package/es/ProForm/components/combination/{ProAddressBar → GroupCopy}/propsType.js +0 -0
- /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
- /package/lib/ProForm/components/combination/{ProAddressBar → GroupCopy}/propsType.js +0 -0
- /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
|
@@ -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 {};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.defaultGetValueFromEvent = defaultGetValueFromEvent;
|
|
8
|
+
exports.transformNamesString = exports.transformColumns = exports.insertSeparator = exports.getValueTypeTrans = exports.getReactiveProps = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
var _lodash = require("lodash");
|
|
13
|
+
var _antd = require("antd");
|
|
14
|
+
var _valueType = _interopRequireDefault(require("../../../utils/valueType"));
|
|
15
|
+
/**
|
|
16
|
+
* 插入间隔符
|
|
17
|
+
* @param columns 表单配置数组
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
var insertSeparator = exports.insertSeparator = function insertSeparator(columns, space) {
|
|
21
|
+
if (!(space === null || space === void 0 ? void 0 : space.separator)) {
|
|
22
|
+
return columns;
|
|
23
|
+
}
|
|
24
|
+
return columns.reduce(function (result, current, index, array) {
|
|
25
|
+
// 将当前元素添加到结果数组中
|
|
26
|
+
result.push(current);
|
|
27
|
+
// 如果当前元素不是最后一个元素,则添加间隔符
|
|
28
|
+
if (index < array.length - 1) {
|
|
29
|
+
result.push({
|
|
30
|
+
component: (0, _jsxRuntime.jsx)(_antd.Button, {
|
|
31
|
+
className: "group-separator",
|
|
32
|
+
children: space.separator
|
|
33
|
+
}),
|
|
34
|
+
fieldProps: {
|
|
35
|
+
disabled: true
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}, []);
|
|
41
|
+
};
|
|
42
|
+
/** 带出event的组件默认取值方法 */
|
|
43
|
+
function defaultGetValueFromEvent(valuePropName) {
|
|
44
|
+
var event = arguments.length <= 1 ? undefined : arguments[1];
|
|
45
|
+
if (event && event.target && (0, _typeof2.default)(event.target) === 'object' && valuePropName in event.target) {
|
|
46
|
+
return event.target[valuePropName];
|
|
47
|
+
}
|
|
48
|
+
return event;
|
|
49
|
+
}
|
|
50
|
+
/** 转换names */
|
|
51
|
+
var transformNamesString = exports.transformNamesString = function transformNamesString(arr) {
|
|
52
|
+
var result = arr.map(function (subArr) {
|
|
53
|
+
if (Array.isArray(subArr)) {
|
|
54
|
+
return subArr.join('_');
|
|
55
|
+
}
|
|
56
|
+
return subArr;
|
|
57
|
+
});
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
/** 计算响应式参数的值 */
|
|
61
|
+
var getReactiveProps = exports.getReactiveProps = function getReactiveProps(params) {
|
|
62
|
+
var form = params.form,
|
|
63
|
+
index = params.index,
|
|
64
|
+
namePath = params.namePath,
|
|
65
|
+
disabled = params.disabled,
|
|
66
|
+
show = params.show,
|
|
67
|
+
component = params.component,
|
|
68
|
+
fieldProps = params.fieldProps,
|
|
69
|
+
name = params.name;
|
|
70
|
+
var values = form.getFieldsValue(namePath || undefined);
|
|
71
|
+
var _disabled = (0, _lodash.isFunction)(disabled) ? disabled(values, {
|
|
72
|
+
form: form,
|
|
73
|
+
index: index,
|
|
74
|
+
namePath: namePath
|
|
75
|
+
}) : disabled;
|
|
76
|
+
var _show = (0, _lodash.isFunction)(show) ? show(values, {
|
|
77
|
+
form: form,
|
|
78
|
+
index: index,
|
|
79
|
+
namePath: namePath
|
|
80
|
+
}) : show;
|
|
81
|
+
var _component = (0, _lodash.isFunction)(component) ? component(values, {
|
|
82
|
+
form: form,
|
|
83
|
+
index: index,
|
|
84
|
+
namePath: namePath
|
|
85
|
+
}) : component;
|
|
86
|
+
var _fieldProps = (0, _lodash.isFunction)(fieldProps) ? fieldProps(values, {
|
|
87
|
+
form: form,
|
|
88
|
+
index: index,
|
|
89
|
+
namePath: namePath
|
|
90
|
+
}) : fieldProps;
|
|
91
|
+
return {
|
|
92
|
+
disabled: _disabled,
|
|
93
|
+
show: _show,
|
|
94
|
+
component: _component,
|
|
95
|
+
fieldProps: _fieldProps
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
/** 获取当前字段的转换函数 */
|
|
99
|
+
var getValueTypeTrans = exports.getValueTypeTrans = function getValueTypeTrans(params) {
|
|
100
|
+
var _valueTypeMap$valueTy;
|
|
101
|
+
var valueType = params.valueType;
|
|
102
|
+
var transform = (_valueTypeMap$valueTy = _valueType.default[valueType]) === null || _valueTypeMap$valueTy === void 0 ? void 0 : _valueTypeMap$valueTy.call(_valueType.default, params);
|
|
103
|
+
return transform;
|
|
104
|
+
};
|
|
105
|
+
/** 转换columns */
|
|
106
|
+
var transformColumns = exports.transformColumns = function transformColumns(params) {
|
|
107
|
+
var form = params.form,
|
|
108
|
+
columns = params.columns,
|
|
109
|
+
name = params.name,
|
|
110
|
+
names = params.names,
|
|
111
|
+
outerIndex = params.index,
|
|
112
|
+
namePath = params.namePath,
|
|
113
|
+
value = params.value,
|
|
114
|
+
internalChange = params.onChange;
|
|
115
|
+
return columns === null || columns === void 0 ? void 0 : columns.flatMap(function (column, index) {
|
|
116
|
+
var type = column.type,
|
|
117
|
+
valueType = column.valueType,
|
|
118
|
+
switchValue = column.switchValue,
|
|
119
|
+
toISOString = column.toISOString,
|
|
120
|
+
fieldProps = column.fieldProps,
|
|
121
|
+
getValueFromEvent = column.getValueFromEvent,
|
|
122
|
+
_column$valuePropName = column.valuePropName,
|
|
123
|
+
valuePropName = _column$valuePropName === void 0 ? 'value' : _column$valuePropName,
|
|
124
|
+
normalize = column.normalize,
|
|
125
|
+
disabled = column.disabled,
|
|
126
|
+
show = column.show,
|
|
127
|
+
component = column.component;
|
|
128
|
+
var _ref = fieldProps || {},
|
|
129
|
+
mode = _ref.mode,
|
|
130
|
+
onChange = _ref.onChange,
|
|
131
|
+
onFieldChange = _ref.onFieldChange,
|
|
132
|
+
comDisabled = _ref.disabled;
|
|
133
|
+
var _disabled = disabled !== null && disabled !== void 0 ? disabled : comDisabled;
|
|
134
|
+
var columnName = names ? names[index] : [].concat(name, index);
|
|
135
|
+
// 响应式字段
|
|
136
|
+
var reactiveProps = getReactiveProps({
|
|
137
|
+
form: form,
|
|
138
|
+
index: index,
|
|
139
|
+
type: type,
|
|
140
|
+
namePath: namePath,
|
|
141
|
+
disabled: _disabled,
|
|
142
|
+
show: show,
|
|
143
|
+
component: component,
|
|
144
|
+
fieldProps: fieldProps,
|
|
145
|
+
name: columnName
|
|
146
|
+
});
|
|
147
|
+
if (reactiveProps.show === false) return [];
|
|
148
|
+
var transform = getValueTypeTrans({
|
|
149
|
+
type: type,
|
|
150
|
+
valueType: valueType,
|
|
151
|
+
switchValue: switchValue,
|
|
152
|
+
toISOString: toISOString,
|
|
153
|
+
mode: mode
|
|
154
|
+
});
|
|
155
|
+
var newValue;
|
|
156
|
+
var handleChange = function handleChange() {
|
|
157
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
158
|
+
args[_key] = arguments[_key];
|
|
159
|
+
}
|
|
160
|
+
if (getValueFromEvent) {
|
|
161
|
+
newValue = getValueFromEvent.apply(void 0, args);
|
|
162
|
+
} else {
|
|
163
|
+
newValue = defaultGetValueFromEvent.apply(void 0, [valuePropName].concat(args));
|
|
164
|
+
}
|
|
165
|
+
if ((transform === null || transform === void 0 ? void 0 : transform.normalize) || normalize) {
|
|
166
|
+
var _transform$normalize;
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
newValue = ((_transform$normalize = transform.normalize) === null || _transform$normalize === void 0 ? void 0 : _transform$normalize.call(transform, newValue)) || (normalize === null || normalize === void 0 ? void 0 : normalize(newValue));
|
|
169
|
+
}
|
|
170
|
+
internalChange === null || internalChange === void 0 ? void 0 : internalChange(newValue, args[1], index);
|
|
171
|
+
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, args);
|
|
172
|
+
onFieldChange === null || onFieldChange === void 0 ? void 0 : onFieldChange(newValue, form.getFieldValue(namePath), {
|
|
173
|
+
index: outerIndex,
|
|
174
|
+
namePath: namePath,
|
|
175
|
+
form: form
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, column), {}, {
|
|
179
|
+
name: columnName
|
|
180
|
+
}, reactiveProps), {}, {
|
|
181
|
+
fieldProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, column === null || column === void 0 ? void 0 : column.fieldProps), {}, {
|
|
182
|
+
onChange: handleChange,
|
|
183
|
+
value: value === null || value === void 0 ? void 0 : value[index]
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
declare const _default: import("react").MemoExoticComponent<(props:
|
|
2
|
+
import { ProCascaderProps } from './propsType';
|
|
3
|
+
declare const _default: import("react").MemoExoticComponent<(props: ProCascaderProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|