@zat-design/sisyphus-react 3.4.1 → 3.4.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +7 -87
- package/es/ProConfigProvider/index.js +8 -1
- package/es/ProEditTable/utils/index.js +6 -4
- package/es/ProEnum/style/index.less +4 -3
- package/es/ProForm/components/base/InputNumber/index.js +3 -0
- package/es/ProForm/components/combination/Group/index.js +19 -2
- package/es/ProForm/components/combination/Group/propsType.d.ts +4 -0
- package/es/ProForm/components/combination/Group/style/index.less +3 -0
- package/es/ProForm/components/index.d.ts +0 -1
- package/es/ProForm/components/index.js +1 -1
- package/es/ProForm/components/render/ConfirmWrapper.js +15 -23
- package/es/ProForm/components/render/Render.js +24 -16
- package/es/ProForm/components/render/RenderFields.d.ts +1 -0
- package/es/ProForm/components/render/RenderFields.js +4 -2
- package/es/ProForm/components/render/propsType.d.ts +1 -4
- package/es/ProForm/index.js +6 -4
- package/es/ProForm/propsType.d.ts +2 -0
- package/es/ProForm/utils/index.d.ts +2 -0
- package/es/ProForm/utils/index.js +14 -13
- package/es/ProIcon/config/index.d.ts +4 -0
- package/es/ProIcon/config/index.js +199 -0
- package/es/ProIcon/index.js +77 -31
- package/es/ProIcon/propsTypes.d.ts +23 -1
- package/es/ProIcon/symbolIcon.js +1 -1
- package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.js +2 -2
- package/{lib → es/ProTree/components}/ProTreeSelect/propsType.d.ts +1 -1
- package/es/ProTree/index.js +1 -1
- package/es/ProTreeModal/style/index.less +8 -0
- package/es/style/components.less +1 -1
- package/lib/ProConfigProvider/index.js +8 -1
- package/lib/ProEditTable/utils/index.js +6 -4
- package/lib/ProEnum/style/index.less +4 -3
- package/lib/ProForm/components/base/InputNumber/index.js +3 -0
- package/lib/ProForm/components/combination/Group/index.js +18 -1
- package/lib/ProForm/components/combination/Group/propsType.d.ts +4 -0
- package/lib/ProForm/components/combination/Group/style/index.less +3 -0
- package/lib/ProForm/components/index.d.ts +0 -1
- package/lib/ProForm/components/index.js +0 -7
- package/lib/ProForm/components/render/ConfirmWrapper.js +15 -23
- package/lib/ProForm/components/render/Render.js +23 -15
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
- package/lib/ProForm/components/render/RenderFields.js +4 -2
- package/lib/ProForm/components/render/propsType.d.ts +1 -4
- package/lib/ProForm/index.js +5 -3
- package/lib/ProForm/propsType.d.ts +2 -0
- package/lib/ProForm/utils/index.d.ts +2 -0
- package/lib/ProForm/utils/index.js +14 -13
- package/lib/ProIcon/config/index.d.ts +4 -0
- package/lib/ProIcon/config/index.js +205 -0
- package/lib/ProIcon/index.js +77 -31
- package/lib/ProIcon/propsTypes.d.ts +23 -1
- package/lib/ProIcon/symbolIcon.js +1 -1
- package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.js +2 -2
- package/{es → lib/ProTree/components}/ProTreeSelect/propsType.d.ts +1 -1
- package/lib/ProTree/index.js +1 -1
- package/lib/ProTreeModal/style/index.less +8 -0
- package/lib/style/components.less +1 -1
- package/package.json +1 -1
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.d.ts +0 -0
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.js +0 -0
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/style/index.less +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.d.ts +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.js +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/style/index.less +0 -0
package/dist/index.esm.css
CHANGED
|
@@ -2297,6 +2297,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2297
2297
|
margin-inline-start: -1px;
|
|
2298
2298
|
border-start-start-radius: 0;
|
|
2299
2299
|
border-end-start-radius: 0;
|
|
2300
|
+
padding: 0 12px;
|
|
2301
|
+
background-color: #fff;
|
|
2302
|
+
cursor: default;
|
|
2300
2303
|
}
|
|
2301
2304
|
.pro-group .ant-space-compact .pro-modal-select {
|
|
2302
2305
|
margin-left: -1px;
|
|
@@ -3084,93 +3087,6 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3084
3087
|
.proupload-modal-preview .ant-modal {
|
|
3085
3088
|
width: 600px;
|
|
3086
3089
|
}
|
|
3087
|
-
.pro-tree-select .ant-select-selector .check-mark-icon {
|
|
3088
|
-
display: none;
|
|
3089
|
-
}
|
|
3090
|
-
.pro-tree-select .ant-select.ant-select-single.ant-select-show-arrow:not(.ant-select-show-search).ant-select-open .ant-select-arrow {
|
|
3091
|
-
-webkit-transition: -webkit-transform 300ms ease-in-out;
|
|
3092
|
-
transition: -webkit-transform 300ms ease-in-out;
|
|
3093
|
-
transition: transform 300ms ease-in-out;
|
|
3094
|
-
transition: transform 300ms ease-in-out, -webkit-transform 300ms ease-in-out;
|
|
3095
|
-
-webkit-transform: rotate(180deg);
|
|
3096
|
-
transform: rotate(180deg);
|
|
3097
|
-
}
|
|
3098
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown .highlight-search-text {
|
|
3099
|
-
color: var(--zaui-brand, #006aff);
|
|
3100
|
-
}
|
|
3101
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown .ant-select-tree-list-holder-inner {
|
|
3102
|
-
position: relative!important;
|
|
3103
|
-
}
|
|
3104
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.ant-tree-select-dropdown {
|
|
3105
|
-
width: auto!important;
|
|
3106
|
-
padding: 0px;
|
|
3107
|
-
}
|
|
3108
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.singal-tree .ant-select-tree .ant-select-tree-treenode,
|
|
3109
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.checkable-tree .ant-select-tree .ant-select-tree-treenode {
|
|
3110
|
-
padding-top: var(--zaui-space-size-xs);
|
|
3111
|
-
padding-bottom: var(--zaui-space-size-xs);
|
|
3112
|
-
}
|
|
3113
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.singal-tree .highlight,
|
|
3114
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.checkable-tree .highlight {
|
|
3115
|
-
color: red;
|
|
3116
|
-
}
|
|
3117
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.signal-tree .ant-select-tree .ant-select-tree-treenode {
|
|
3118
|
-
position: relative;
|
|
3119
|
-
padding-right: 50px;
|
|
3120
|
-
padding-left: 7px;
|
|
3121
|
-
z-index: 0;
|
|
3122
|
-
}
|
|
3123
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.signal-tree .ant-select-tree .ant-select-tree-treenode:after {
|
|
3124
|
-
content: '';
|
|
3125
|
-
display: none;
|
|
3126
|
-
position: absolute;
|
|
3127
|
-
z-index: 0;
|
|
3128
|
-
left: 0;
|
|
3129
|
-
width: 100%;
|
|
3130
|
-
height: 100%;
|
|
3131
|
-
background-color: var(--zaui-brand, #006aff);
|
|
3132
|
-
opacity: 0.1;
|
|
3133
|
-
}
|
|
3134
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.signal-tree .ant-select-tree .ant-select-tree-treenode.ant-select-tree-treenode-selected:after {
|
|
3135
|
-
display: block;
|
|
3136
|
-
}
|
|
3137
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.signal-tree .ant-select-tree .ant-select-tree-node-content-wrapper {
|
|
3138
|
-
background-color: transparent;
|
|
3139
|
-
}
|
|
3140
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.signal-tree .ant-select-tree .ant-select-tree-node-content-wrapper.ant-select-tree-node-selected .check-mark-icon {
|
|
3141
|
-
display: block;
|
|
3142
|
-
}
|
|
3143
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.signal-tree .ant-select-tree .ant-select-tree-treenode:hover {
|
|
3144
|
-
background-color: #f5f5f5;
|
|
3145
|
-
}
|
|
3146
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.signal-tree .ant-select-tree .check-option-text .check-mark-icon {
|
|
3147
|
-
position: absolute;
|
|
3148
|
-
right: -34px;
|
|
3149
|
-
top: 2px;
|
|
3150
|
-
display: none;
|
|
3151
|
-
color: var(--zaui-list-item-selected-bg);
|
|
3152
|
-
}
|
|
3153
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.checkable-tree .ant-select-tree .ant-select-tree-treenode {
|
|
3154
|
-
padding-left: 7px;
|
|
3155
|
-
}
|
|
3156
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.checkable-tree .ant-select-tree .ant-select-tree-treenode:hover {
|
|
3157
|
-
background-color: #f5f5f5;
|
|
3158
|
-
}
|
|
3159
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.checkable-tree .ant-select-tree .ant-select-tree-node-content-wrapper {
|
|
3160
|
-
padding-right: var(--zaui-space-size-md);
|
|
3161
|
-
}
|
|
3162
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.checkable-tree .ant-select-tree .ant-select-tree-node-content-wrapper:hover {
|
|
3163
|
-
background-color: transparent;
|
|
3164
|
-
}
|
|
3165
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.checkable-tree .ant-select-tree .ant-select-tree-checkbox {
|
|
3166
|
-
margin-top: var(--zaui-space-size-xs);
|
|
3167
|
-
-webkit-align-self: stretch;
|
|
3168
|
-
-ms-flex-item-align: stretch;
|
|
3169
|
-
align-self: stretch;
|
|
3170
|
-
}
|
|
3171
|
-
.pro-tree-select-drop-down-container.ant-select-dropdown.ten-count-tree-node .ant-select-tree-switcher-noop {
|
|
3172
|
-
width: var(--zaui-space-size-xs);
|
|
3173
|
-
}
|
|
3174
3090
|
.pro-tree-modal-container .ant-modal-content .ant-modal-body {
|
|
3175
3091
|
max-height: 498px;
|
|
3176
3092
|
}
|
|
@@ -3447,6 +3363,10 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3447
3363
|
.pro-transfer-right .checked-item {
|
|
3448
3364
|
margin: var(--zaui-space-size-sm, 8px) 0;
|
|
3449
3365
|
}
|
|
3366
|
+
.pro-transfer-right .checked-item.dragable .ant-tag > span:first-child {
|
|
3367
|
+
padding: 8px 0;
|
|
3368
|
+
cursor: move;
|
|
3369
|
+
}
|
|
3450
3370
|
.pro-transfer-right .checked-item:first-child {
|
|
3451
3371
|
margin-top: 0;
|
|
3452
3372
|
}
|
|
@@ -13,7 +13,14 @@ var initialState = {
|
|
|
13
13
|
ProEnum: {
|
|
14
14
|
dics: {}
|
|
15
15
|
},
|
|
16
|
-
forms: {}
|
|
16
|
+
forms: {},
|
|
17
|
+
ProIcon: {
|
|
18
|
+
mode: 'icon',
|
|
19
|
+
mapList: [{
|
|
20
|
+
type: 'view',
|
|
21
|
+
text: '查看'
|
|
22
|
+
}]
|
|
23
|
+
}
|
|
17
24
|
};
|
|
18
25
|
export var ProConfigContext = /*#__PURE__*/React.createContext({
|
|
19
26
|
state: initialState,
|
|
@@ -202,7 +202,9 @@ export var transformColumns = function transformColumns() {
|
|
|
202
202
|
ellipsis = item.ellipsis,
|
|
203
203
|
key = item.key,
|
|
204
204
|
tooltip = item.tooltip,
|
|
205
|
-
suffix = item.suffix
|
|
205
|
+
suffix = item.suffix,
|
|
206
|
+
before = item.before,
|
|
207
|
+
after = item.after;
|
|
206
208
|
// column设置label时,权重最高
|
|
207
209
|
var columnTitle = label || title;
|
|
208
210
|
if (typeof columnTitle === 'string') {
|
|
@@ -214,7 +216,7 @@ export var transformColumns = function transformColumns() {
|
|
|
214
216
|
resetProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
215
217
|
item.title = _jsxs("span", {
|
|
216
218
|
className: "pro-edit-table-title pro-edit-table-tooltip",
|
|
217
|
-
children: [columnTitle, _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
219
|
+
children: [before, columnTitle, _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
218
220
|
title: tooltipTitle !== null && tooltipTitle !== void 0 ? tooltipTitle : tooltip
|
|
219
221
|
}, resetProps), {}, {
|
|
220
222
|
children: icon ? ( /*#__PURE__*/React.cloneElement(icon, {
|
|
@@ -223,12 +225,12 @@ export var transformColumns = function transformColumns() {
|
|
|
223
225
|
className: "icon-tip",
|
|
224
226
|
src: tipSvg
|
|
225
227
|
})
|
|
226
|
-
})), suffix]
|
|
228
|
+
})), suffix || after]
|
|
227
229
|
});
|
|
228
230
|
} else {
|
|
229
231
|
item.title = _jsxs("span", {
|
|
230
232
|
className: "pro-edit-table-title",
|
|
231
|
-
children: [columnTitle, suffix]
|
|
233
|
+
children: [before, columnTitle, suffix || after]
|
|
232
234
|
});
|
|
233
235
|
}
|
|
234
236
|
}
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
padding: var(--zaui-space-size-sm) var(--zaui-space-border);
|
|
43
43
|
line-height: 18px;
|
|
44
44
|
background-color: #f1f3f6ff;
|
|
45
|
+
border: 1px solid transparent;
|
|
45
46
|
cursor: pointer;
|
|
46
47
|
|
|
47
48
|
&::after {
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
border-top-right-radius: var(--zaui-space-size-xs);
|
|
65
66
|
border-bottom-right-radius: var(--zaui-space-size-xs);
|
|
66
67
|
&::after {
|
|
67
|
-
|
|
68
|
+
background: transparent;
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
}
|
|
@@ -73,12 +74,12 @@
|
|
|
73
74
|
color: var(--zaui-brand);
|
|
74
75
|
border: 1px solid var(--zaui-brand);
|
|
75
76
|
&::after {
|
|
76
|
-
|
|
77
|
+
background: transparent;
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
.pro-enum-group-item-disabled-after::after {
|
|
81
|
-
|
|
82
|
+
background: transparent;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
.pro-enum-group-item-disabled {
|
|
@@ -73,6 +73,9 @@ var InputNumber = function InputNumber(props) {
|
|
|
73
73
|
},
|
|
74
74
|
parser: function parser(value) {
|
|
75
75
|
var num = Number(value.replace(/[\s,]+/g, ''));
|
|
76
|
+
if (value === '') {
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
76
79
|
return Number.isNaN(num) ? value : num.toFixed((props === null || props === void 0 ? void 0 : props.precision) || 2);
|
|
77
80
|
}
|
|
78
81
|
};
|
|
@@ -4,9 +4,11 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
4
4
|
import "antd/es/button/style";
|
|
5
5
|
import _Button from "antd/es/button";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { useMemo } from 'react';
|
|
9
|
-
import { omit } from 'lodash';
|
|
10
|
+
import { omit, isFunction } from 'lodash';
|
|
11
|
+
import { useDeepCompareEffect, useCounter } from 'ahooks';
|
|
10
12
|
import classnames from 'classnames';
|
|
11
13
|
import RenderFields from '../../render/RenderFields';
|
|
12
14
|
import { insertSeparator } from './utils';
|
|
@@ -19,7 +21,13 @@ var Group = function Group(props) {
|
|
|
19
21
|
space = _props$space === void 0 ? {
|
|
20
22
|
size: 12
|
|
21
23
|
} : _props$space,
|
|
22
|
-
id = props.id
|
|
24
|
+
id = props.id,
|
|
25
|
+
value = props.value,
|
|
26
|
+
onFieldChange = props.onFieldChange;
|
|
27
|
+
var _useCounter = useCounter(0),
|
|
28
|
+
_useCounter2 = _slicedToArray(_useCounter, 2),
|
|
29
|
+
num = _useCounter2[0],
|
|
30
|
+
inc = _useCounter2[1].inc;
|
|
23
31
|
var _ref = ProForm.useFieldProps() || {},
|
|
24
32
|
names = _ref.names,
|
|
25
33
|
name = _ref.name,
|
|
@@ -56,6 +64,15 @@ var Group = function Group(props) {
|
|
|
56
64
|
return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
|
|
57
65
|
})
|
|
58
66
|
}, "".concat(className), className));
|
|
67
|
+
useDeepCompareEffect(function () {
|
|
68
|
+
// 模拟change,初始化不执行onFieldChange
|
|
69
|
+
if (isFunction(onFieldChange) && num >= 1) {
|
|
70
|
+
onFieldChange(value, form.getFieldsValue(), {
|
|
71
|
+
form: form
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
inc();
|
|
75
|
+
}, [value]);
|
|
59
76
|
return _jsx("div", {
|
|
60
77
|
className: _className,
|
|
61
78
|
children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RowProps, SpaceProps } from 'antd';
|
|
3
|
+
import { FormInstance } from 'antd/es/form/Form';
|
|
3
4
|
import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
|
|
4
5
|
export interface SpaceType extends SpaceProps {
|
|
5
6
|
/**
|
|
@@ -22,4 +23,7 @@ export interface GroupProps {
|
|
|
22
23
|
value?: any;
|
|
23
24
|
id?: string;
|
|
24
25
|
disabled?: boolean | (() => void);
|
|
26
|
+
onFieldChange?: (value: any[] | null, record: any, { form, }: {
|
|
27
|
+
form: FormInstance;
|
|
28
|
+
}) => any;
|
|
25
29
|
}
|
|
@@ -24,7 +24,6 @@ export { default as Container } from './combination/Container';
|
|
|
24
24
|
export { default as ProEnum } from '../../ProEnum';
|
|
25
25
|
export { default as ProSelect } from '../../ProSelect';
|
|
26
26
|
export { default as ProUpload } from '../../ProUpload';
|
|
27
|
-
export { default as ProTreeSelect } from '../../ProTreeSelect';
|
|
28
27
|
export { default as ProTreeModal } from '../../ProTreeModal';
|
|
29
28
|
export { default as ProTree } from '../../ProTree';
|
|
30
29
|
export { default as FormFooter } from './FormFooter';
|
|
@@ -26,7 +26,7 @@ export { default as Container } from './combination/Container';
|
|
|
26
26
|
export { default as ProEnum } from '../../ProEnum';
|
|
27
27
|
export { default as ProSelect } from '../../ProSelect';
|
|
28
28
|
export { default as ProUpload } from '../../ProUpload';
|
|
29
|
-
export { default as ProTreeSelect } from '../../ProTreeSelect';
|
|
29
|
+
// export { default as ProTreeSelect } from '../../ProTreeSelect';
|
|
30
30
|
export { default as ProTreeModal } from '../../ProTreeModal';
|
|
31
31
|
export { default as ProTree } from '../../ProTree';
|
|
32
32
|
// footer组件
|
|
@@ -8,7 +8,8 @@ import { isFunction, isObject } from 'lodash';
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import ProForm from '../../index';
|
|
10
10
|
var defaultConfirmProps = {
|
|
11
|
-
title: '
|
|
11
|
+
title: '操作提示',
|
|
12
|
+
content: '确定要修改该字段吗?'
|
|
12
13
|
};
|
|
13
14
|
var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
14
15
|
var onChange = props.onChange,
|
|
@@ -22,7 +23,8 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
|
22
23
|
other[_key - 1] = arguments[_key];
|
|
23
24
|
}
|
|
24
25
|
var _value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
|
|
25
|
-
|
|
26
|
+
var confirmProps = isFunction(confirm) ? confirm(form.getFieldsValue()) : confirm;
|
|
27
|
+
if (confirmProps === true) {
|
|
26
28
|
_Modal.confirm(_objectSpread(_objectSpread({}, defaultConfirmProps), {}, {
|
|
27
29
|
onOk: function onOk() {
|
|
28
30
|
return onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
@@ -30,28 +32,18 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
|
30
32
|
}));
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
}));
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (isObject(confirmProps)) {
|
|
44
|
-
_Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, defaultConfirmProps), confirmProps), {}, {
|
|
45
|
-
onOk: function onOk() {
|
|
46
|
-
for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
47
|
-
arg[_key2] = arguments[_key2];
|
|
48
|
-
}
|
|
49
|
-
confirmProps === null || confirmProps === void 0 ? void 0 : confirmProps.onOk.apply(confirmProps, arg);
|
|
50
|
-
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
35
|
+
if (isObject(confirmProps)) {
|
|
36
|
+
_Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, defaultConfirmProps), confirmProps), {}, {
|
|
37
|
+
onOk: function onOk() {
|
|
38
|
+
var _confirmProps$onOk;
|
|
39
|
+
for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
40
|
+
arg[_key2] = arguments[_key2];
|
|
51
41
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
(_confirmProps$onOk = confirmProps.onOk) === null || _confirmProps$onOk === void 0 ? void 0 : _confirmProps$onOk.call.apply(_confirmProps$onOk, [confirmProps].concat(arg));
|
|
43
|
+
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
return;
|
|
55
47
|
}
|
|
56
48
|
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
57
49
|
};
|
|
@@ -24,7 +24,7 @@ import classNames from 'classnames';
|
|
|
24
24
|
import { ReactSVG } from 'react-svg';
|
|
25
25
|
import { isFunction, isString, omit } from 'lodash';
|
|
26
26
|
import useShouldUpdate from '../../utils/useShouldUpdate';
|
|
27
|
-
import { isTrim, isUpperCase, findOptionByValue } from '../../utils/index';
|
|
27
|
+
import { isTrim, isUpperCase, findOptionByValue, parseNamePath } from '../../utils/index';
|
|
28
28
|
import { useProConfig } from '../../../ProConfigProvider';
|
|
29
29
|
import transformNames from '../../utils/transformNames';
|
|
30
30
|
import valueTypeMap from '../../utils/valueType';
|
|
@@ -34,7 +34,7 @@ import useRules from '../../utils/useRules';
|
|
|
34
34
|
import ConfirmWrapper from './ConfirmWrapper';
|
|
35
35
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
36
36
|
var Render = function Render(props) {
|
|
37
|
-
var _ref2, _otherProps$names2;
|
|
37
|
+
var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
|
|
38
38
|
var component = props.component,
|
|
39
39
|
originComponent = props.originComponent,
|
|
40
40
|
_props$formItemProps = props.formItemProps,
|
|
@@ -53,7 +53,8 @@ var Render = function Render(props) {
|
|
|
53
53
|
equalWith = props.equalWith,
|
|
54
54
|
requiredOnView = props.requiredOnView,
|
|
55
55
|
originalTip = props.originalTip,
|
|
56
|
-
confirm = props.confirm
|
|
56
|
+
confirm = props.confirm,
|
|
57
|
+
globalControl = props.globalControl;
|
|
57
58
|
var colProps = props.colProps;
|
|
58
59
|
// 剔除一些不是FormItem的属性, 防止控制台报warning
|
|
59
60
|
var labelWidth = formItemProps.labelWidth,
|
|
@@ -169,8 +170,12 @@ var Render = function Render(props) {
|
|
|
169
170
|
}
|
|
170
171
|
/** 移除多余参数,防止透传给formItem报错 */
|
|
171
172
|
var _otherFormItemProps = omit(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'switchValue', 'precision', 'clearNotShow']);
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
/**
|
|
174
|
+
* globalControl 全局控制优先
|
|
175
|
+
* globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
|
|
176
|
+
* globalControl false时,优先级 组件上【fieldProps.disabled】 > formitem上【column.disabled】 > 全局【formDisabled】
|
|
177
|
+
*/
|
|
178
|
+
var lastDisabled = globalControl ? (_ref2 = (_ref3 = formDisabled !== null && formDisabled !== void 0 ? formDisabled : _disabled) !== null && _ref3 !== void 0 ? _ref3 : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled : (_ref4 = (_ref5 = _disabled !== null && _disabled !== void 0 ? _disabled : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref5 !== void 0 ? _ref5 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled) !== null && _ref4 !== void 0 ? _ref4 : formDisabled;
|
|
174
179
|
/**
|
|
175
180
|
* 最新fieldProps: 更新后的组件Props
|
|
176
181
|
*/
|
|
@@ -198,8 +203,8 @@ var Render = function Render(props) {
|
|
|
198
203
|
var functionArgs = function functionArgs(args) {
|
|
199
204
|
var _otherFormItemProps$n;
|
|
200
205
|
var _args = _toConsumableArray(args);
|
|
201
|
-
var
|
|
202
|
-
valueType =
|
|
206
|
+
var _ref6 = otherProps || {},
|
|
207
|
+
valueType = _ref6.valueType;
|
|
203
208
|
_args[1] = form.getFieldsValue();
|
|
204
209
|
_args[2] = {
|
|
205
210
|
form: form
|
|
@@ -260,12 +265,13 @@ var Render = function Render(props) {
|
|
|
260
265
|
// Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
|
|
261
266
|
if (formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames) {
|
|
262
267
|
setTimeout(function () {
|
|
263
|
-
|
|
264
|
-
form.
|
|
268
|
+
var namePath = parseNamePath(formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames);
|
|
269
|
+
form.setFieldValue(formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames, form.getFieldValue(namePath));
|
|
270
|
+
form.validateFields(namePath);
|
|
265
271
|
}, 60);
|
|
266
272
|
}
|
|
267
273
|
// ProTreeSelect返回option
|
|
268
|
-
if (['
|
|
274
|
+
if (['ProTree'].includes(type)) {
|
|
269
275
|
var _args2, _args2$;
|
|
270
276
|
_args[2].option = findOptionByValue(lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.dataSource, (_args2 = _args) === null || _args2 === void 0 ? void 0 : (_args2$ = _args2[0]) === null || _args2$ === void 0 ? void 0 : _args2$[0]);
|
|
271
277
|
}
|
|
@@ -275,7 +281,7 @@ var Render = function Render(props) {
|
|
|
275
281
|
* onBlur参数重置 (value, record, { form, index, namePath, option }) => void
|
|
276
282
|
*/
|
|
277
283
|
var handleBlur = /*#__PURE__*/function () {
|
|
278
|
-
var
|
|
284
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
279
285
|
var _len2,
|
|
280
286
|
args,
|
|
281
287
|
_key2,
|
|
@@ -302,12 +308,14 @@ var Render = function Render(props) {
|
|
|
302
308
|
}, _callee);
|
|
303
309
|
}));
|
|
304
310
|
return function handleBlur() {
|
|
305
|
-
return
|
|
311
|
+
return _ref7.apply(this, arguments);
|
|
306
312
|
};
|
|
307
313
|
}();
|
|
308
314
|
var renderItem = function renderItem() {
|
|
315
|
+
// 移除多余字段,group保留onFieldChange
|
|
316
|
+
var lastComponentPropsFilter = type === 'Group' ? ['disabledStrictly'] : ['onFieldChange', 'disabledStrictly'];
|
|
309
317
|
// 表单渲染 start
|
|
310
|
-
var childProps = _objectSpread(_objectSpread(_objectSpread({}, AutoComponent === null || AutoComponent === void 0 ? void 0 : AutoComponent.props), omit(lastComponentProps,
|
|
318
|
+
var childProps = _objectSpread(_objectSpread(_objectSpread({}, AutoComponent === null || AutoComponent === void 0 ? void 0 : AutoComponent.props), omit(lastComponentProps, lastComponentPropsFilter)), {}, {
|
|
311
319
|
// @ts-ignore
|
|
312
320
|
otherProps: otherProps,
|
|
313
321
|
onChange: handleChange,
|
|
@@ -350,7 +358,7 @@ var Render = function Render(props) {
|
|
|
350
358
|
if (originComponent) {
|
|
351
359
|
delete childProps.otherProps;
|
|
352
360
|
}
|
|
353
|
-
var child = /*#__PURE__*/React.isValidElement(AutoComponent) ? ( /*#__PURE__*/React.cloneElement(AutoComponent, childProps)) : _jsx(AutoComponent, _objectSpread(_objectSpread({}, omit(lastComponentProps,
|
|
361
|
+
var child = /*#__PURE__*/React.isValidElement(AutoComponent) ? ( /*#__PURE__*/React.cloneElement(AutoComponent, childProps)) : _jsx(AutoComponent, _objectSpread(_objectSpread({}, omit(lastComponentProps, lastComponentPropsFilter)), {}, {
|
|
354
362
|
otherProps: _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
355
363
|
show: show,
|
|
356
364
|
disabled: lastDisabled,
|
|
@@ -377,7 +385,7 @@ var Render = function Render(props) {
|
|
|
377
385
|
};
|
|
378
386
|
}
|
|
379
387
|
// 需要过滤掉的form_item的key
|
|
380
|
-
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after'];
|
|
388
|
+
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl'];
|
|
381
389
|
if (type === 'FormList') {
|
|
382
390
|
lastComponentProps.disabled = lastDisabled;
|
|
383
391
|
var lessMode = lastComponentProps.mode === 'less';
|
|
@@ -385,7 +393,7 @@ var Render = function Render(props) {
|
|
|
385
393
|
name: _otherFormItemProps.name
|
|
386
394
|
}, omit(_otherFormItemProps, ['rules'])), {}, {
|
|
387
395
|
children: function children(fields, operation, meta) {
|
|
388
|
-
return _jsx(AutoComponent, _objectSpread(_objectSpread({}, omit(lastComponentProps,
|
|
396
|
+
return _jsx(AutoComponent, _objectSpread(_objectSpread({}, omit(lastComponentProps, lastComponentPropsFilter)), {}, {
|
|
389
397
|
otherProps: otherProps,
|
|
390
398
|
fields: fields,
|
|
391
399
|
operation: operation,
|
|
@@ -25,7 +25,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
25
25
|
outerClearNotShow = props.clearNotShow,
|
|
26
26
|
requiredOnView = props.requiredOnView,
|
|
27
27
|
required = props.required,
|
|
28
|
-
originalTip = props.originalTip
|
|
28
|
+
originalTip = props.originalTip,
|
|
29
|
+
globalControl = props.globalControl;
|
|
29
30
|
// 是否包含隐藏字段
|
|
30
31
|
var hiddenData = columns.filter(function (item) {
|
|
31
32
|
return Array.isArray(item.hiddenNames);
|
|
@@ -204,7 +205,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
204
205
|
originalValues: originalValues,
|
|
205
206
|
equalWith: equalWith,
|
|
206
207
|
requiredOnView: requiredOnView,
|
|
207
|
-
originalTip: originalTip
|
|
208
|
+
originalTip: originalTip,
|
|
209
|
+
globalControl: globalControl
|
|
208
210
|
})
|
|
209
211
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
|
210
212
|
});
|
|
@@ -26,7 +26,6 @@ import { Props as ProRangeLimitProps } from '../combination/ProRangeLimit';
|
|
|
26
26
|
import { CheckboxPropsMap, ProEnum, PropProSelectsMap, PropRadioPropsMap } from '../../../ProEnum/propsType';
|
|
27
27
|
import { PropSelectProps as ProSelectProps } from '../../../ProSelect/propsType';
|
|
28
28
|
import { ProEditTableProps } from '../../../ProEditTable/propsType';
|
|
29
|
-
import { PropTreeSelectProps } from '../../../ProTreeSelect/propsType';
|
|
30
29
|
import { ProTreeModalProps } from '../../../ProTreeModal/propsType';
|
|
31
30
|
import { ProUploadProps } from '../../../ProUpload/propsType';
|
|
32
31
|
import { ProTreeProps } from '../../../ProTree/propsType';
|
|
@@ -150,9 +149,6 @@ export type ColumnPropsMap<Values = any, T = 'ProForm'> = {
|
|
|
150
149
|
} | {
|
|
151
150
|
type?: 'ProEditTable';
|
|
152
151
|
fieldProps?: FieldProps<ProEditTableProps, Values, T>;
|
|
153
|
-
} | {
|
|
154
|
-
type?: 'ProTreeSelect';
|
|
155
|
-
fieldProps?: FieldProps<PropTreeSelectProps, Values, T>;
|
|
156
152
|
} | {
|
|
157
153
|
type?: 'ProTreeModal';
|
|
158
154
|
fieldProps?: FieldProps<ProTreeModalProps, Values, T>;
|
|
@@ -270,6 +266,7 @@ export interface RenderProps<Values = any> {
|
|
|
270
266
|
originalValues?: Values;
|
|
271
267
|
requiredOnView?: boolean;
|
|
272
268
|
confirm?: ProFormColumnProps['confirm'];
|
|
269
|
+
globalControl?: boolean;
|
|
273
270
|
[name: string]: any;
|
|
274
271
|
}
|
|
275
272
|
export {};
|
package/es/ProForm/index.js
CHANGED
|
@@ -12,13 +12,13 @@ import _Space from "antd/es/space";
|
|
|
12
12
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
13
13
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
14
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
15
|
-
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalTip", "formKey"];
|
|
15
|
+
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalTip", "formKey", "globalControl"];
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
|
18
18
|
import classnames from 'classnames';
|
|
19
19
|
import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
20
20
|
import { isObject, isString, merge } from 'lodash';
|
|
21
|
-
import { FormFooter, InputRange, ProAddress, ProAddressBar, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload,
|
|
21
|
+
import { FormFooter, InputRange, ProAddress, ProAddressBar, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
|
|
22
22
|
import RenderFields from './components/render/RenderFields';
|
|
23
23
|
import { useProConfig, useContextForms } from '../ProConfigProvider';
|
|
24
24
|
import { getLayout, splitNameStr, useControlled, initialValuesToNames } from './utils/index';
|
|
@@ -66,6 +66,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
66
66
|
_props$originalTip = props.originalTip,
|
|
67
67
|
originalTip = _props$originalTip === void 0 ? true : _props$originalTip,
|
|
68
68
|
formKey = props.formKey,
|
|
69
|
+
globalControl = props.globalControl,
|
|
69
70
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
70
71
|
var _useProConfig = useProConfig(),
|
|
71
72
|
state = _useProConfig.state,
|
|
@@ -253,7 +254,8 @@ var ProForm = function ProForm(props, ref) {
|
|
|
253
254
|
clearNotShow: clearNotShow,
|
|
254
255
|
requiredOnView: requiredOnView,
|
|
255
256
|
required: required,
|
|
256
|
-
originalTip: originalTip
|
|
257
|
+
originalTip: originalTip,
|
|
258
|
+
globalControl: globalControl
|
|
257
259
|
}), children, footerRender()]
|
|
258
260
|
}))
|
|
259
261
|
}));
|
|
@@ -318,7 +320,7 @@ ProFormForward.ProNumberRange = ProNumberRange;
|
|
|
318
320
|
ProFormForward.ProModalSelect = ProModalSelect;
|
|
319
321
|
ProFormForward.ProTimeLimit = ProTimeLimit;
|
|
320
322
|
ProFormForward.ProUpload = ProUpload;
|
|
321
|
-
ProFormForward.ProTreeSelect = ProTreeSelect;
|
|
323
|
+
// ProFormForward.ProTreeSelect = ProTreeSelect;
|
|
322
324
|
ProFormForward.ProTreeModal = ProTreeModal;
|
|
323
325
|
ProFormForward.ProTree = ProTree;
|
|
324
326
|
// 待废弃
|
|
@@ -88,4 +88,6 @@ export declare const findOptionByValue: (treeData: any[], value: string | number
|
|
|
88
88
|
* 对比依赖列表中的 值是否变更
|
|
89
89
|
*/
|
|
90
90
|
export declare const equalDependencies: (dependencies: any, prevValues: any, currentValues: any) => any;
|
|
91
|
+
/** 解析namePath */
|
|
92
|
+
export declare const parseNamePath: (input: string) => any;
|
|
91
93
|
export {};
|
|
@@ -4,19 +4,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
6
|
import { useState } from 'react';
|
|
7
|
-
import _, { isObject, isFunction, cloneDeep, get, set, omit } from 'lodash';
|
|
8
|
-
var colProps = {
|
|
9
|
-
search: {
|
|
10
|
-
span: 8
|
|
11
|
-
},
|
|
12
|
-
drawer: {
|
|
13
|
-
span: 12
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var footer = {
|
|
17
|
-
search: false,
|
|
18
|
-
drawer: false
|
|
19
|
-
};
|
|
7
|
+
import _, { isObject, isFunction, cloneDeep, get, set, omit, isNaN } from 'lodash';
|
|
20
8
|
export var getLayout = function getLayout(params) {
|
|
21
9
|
var _params$span = params.span,
|
|
22
10
|
span = _params$span === void 0 ? 8 : _params$span,
|
|
@@ -420,4 +408,17 @@ export var equalDependencies = function equalDependencies(dependencies, prevValu
|
|
|
420
408
|
});
|
|
421
409
|
}
|
|
422
410
|
return false;
|
|
411
|
+
};
|
|
412
|
+
/** 解析namePath */
|
|
413
|
+
export var parseNamePath = function parseNamePath(input) {
|
|
414
|
+
var parts = input.split('_');
|
|
415
|
+
if (parts.every(function (item) {
|
|
416
|
+
return isNaN(Number(item));
|
|
417
|
+
})) {
|
|
418
|
+
return [input];
|
|
419
|
+
}
|
|
420
|
+
var result = parts.map(function (item) {
|
|
421
|
+
return isNaN(Number(item)) ? item : Number(item);
|
|
422
|
+
});
|
|
423
|
+
return [result];
|
|
423
424
|
};
|