@zat-design/sisyphus-react 4.5.9 → 4.5.10-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/FormsProvider/index.js +14 -21
- package/es/ProAction/components/CheckModalContent/index.js +12 -26
- package/es/ProAction/index.js +79 -83
- package/es/ProAction/propsType.js +0 -1
- package/es/ProConfigProvider/index.js +63 -110
- package/es/ProConfigProvider/propsType.js +0 -1
- package/es/ProDownload/index.d.ts +2 -1
- package/es/ProDownload/index.js +74 -69
- package/es/ProDownload/propsType.js +0 -1
- package/es/ProDownload/utils.d.ts +10 -5
- package/es/ProDownload/utils.js +63 -95
- package/es/ProDrawerForm/components/ProDrawer/index.js +83 -113
- package/es/ProDrawerForm/components/ProModal/index.js +77 -108
- package/es/ProDrawerForm/components/index.js +6 -2
- package/es/ProDrawerForm/hooks/useConfirmClose.js +20 -39
- package/es/ProDrawerForm/index.js +29 -38
- package/es/ProDrawerForm/propsType.js +0 -1
- package/es/ProDrawerForm/utils/index.js +18 -36
- package/es/ProEditLabel/components/RenderProForm.js +45 -49
- package/es/ProEditLabel/index.js +126 -163
- package/es/ProEditLabel/propsType.js +0 -1
- package/es/ProEditLabel/utils/index.js +5 -8
- package/es/ProEditTable/components/ActionButton/index.js +111 -119
- package/es/ProEditTable/components/RcTable/BaseTable.js +38 -51
- package/es/ProEditTable/components/RcTable/DraggableTable.js +97 -129
- package/es/ProEditTable/components/RcTable/index.js +6 -4
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +77 -95
- package/es/ProEditTable/components/RenderField/index.js +490 -587
- package/es/ProEditTable/components/RenderField/propsType.js +0 -1
- package/es/ProEditTable/components/RenderField/tools.js +115 -112
- package/es/ProEditTable/components/RenderToolbar/index.js +47 -73
- package/es/ProEditTable/components/Summary/index.js +38 -64
- package/es/ProEditTable/components/Validator/index.js +46 -46
- package/es/ProEditTable/components/index.js +12 -5
- package/es/ProEditTable/index.js +456 -378
- package/es/ProEditTable/propsType.js +0 -1
- package/es/ProEditTable/utils/config.js +60 -122
- package/es/ProEditTable/utils/diffOriginal.js +45 -82
- package/es/ProEditTable/utils/getDefaultProps.js +19 -24
- package/es/ProEditTable/utils/index.js +154 -235
- package/es/ProEditTable/utils/tools.js +149 -286
- package/es/ProEditTable/utils/transform.js +25 -30
- package/es/ProEditTable/utils/useEditTableError.js +30 -43
- package/es/ProEditTable/utils/useShouldUpdateForTable.js +42 -72
- package/es/ProEditTable/utils/validateAll.js +87 -154
- package/es/ProEnum/components/Group.js +38 -30
- package/es/ProEnum/components/Tag.js +22 -26
- package/es/ProEnum/hooks/useEnum.js +48 -116
- package/es/ProEnum/hooks/useEnumRequest.js +182 -212
- package/es/ProEnum/hooks/useFrequentEnumRequest.js +40 -48
- package/es/ProEnum/index.js +162 -172
- package/es/ProEnum/propsType.js +0 -1
- package/es/ProEnum/utils/eventCenter.js +10 -12
- package/es/ProEnum/utils/frequentEnum.js +35 -92
- package/es/ProEnum/utils/getEnum.js +32 -90
- package/es/ProEnum/utils/getEnumLabel.js +44 -49
- package/es/ProEnum/utils/index.js +93 -207
- package/es/ProForm/components/Container.js +13 -28
- package/es/ProForm/components/FormFooter/index.js +36 -44
- package/es/ProForm/components/FormFooter/propsType.js +0 -1
- package/es/ProForm/components/base/Checkbox/index.js +32 -59
- package/es/ProForm/components/base/DatePicker/index.js +49 -71
- package/es/ProForm/components/base/Input/index.js +63 -97
- package/es/ProForm/components/base/Input/propsType.js +0 -1
- package/es/ProForm/components/base/InputNumber/index.js +118 -172
- package/es/ProForm/components/base/Radio/index.js +39 -52
- package/es/ProForm/components/base/RangePicker/index.js +109 -127
- package/es/ProForm/components/base/RangePicker/useDateRange.js +20 -17
- package/es/ProForm/components/base/Select/index.js +63 -89
- package/es/ProForm/components/base/Switch/index.js +27 -35
- package/es/ProForm/components/base/SwitchCheckbox/index.js +36 -54
- package/es/ProForm/components/base/TextArea/index.js +30 -41
- package/es/ProForm/components/base/TimePicker/index.js +27 -37
- package/es/ProForm/components/combination/Container/index.js +37 -47
- package/es/ProForm/components/combination/Container/propsType.js +0 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +165 -237
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +98 -102
- package/es/ProForm/components/combination/FormList/components/Empty.js +28 -55
- package/es/ProForm/components/combination/FormList/components/LineFields.js +57 -54
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +61 -109
- package/es/ProForm/components/combination/FormList/index.js +151 -161
- package/es/ProForm/components/combination/FormList/propsType.js +0 -1
- package/es/ProForm/components/combination/FormList/style/index.less +6 -0
- package/es/ProForm/components/combination/FormList/utils.js +22 -38
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +12 -28
- package/es/ProForm/components/combination/Group/component/ComRender.js +50 -111
- package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +106 -213
- package/es/ProForm/components/combination/Group/hooks/index.js +69 -129
- package/es/ProForm/components/combination/Group/index.js +87 -126
- package/es/ProForm/components/combination/Group/propsType.js +0 -1
- package/es/ProForm/components/combination/Group/utils/index.js +124 -239
- package/es/ProForm/components/combination/ProCascader/index.js +156 -199
- package/es/ProForm/components/combination/ProCascader/propsType.js +0 -1
- package/es/ProForm/components/combination/ProCascader/utils/index.js +12 -21
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +72 -70
- package/es/ProForm/components/combination/ProModalSelect/index.js +309 -347
- package/es/ProForm/components/combination/ProModalSelect/propsType.js +0 -1
- package/es/ProForm/components/combination/ProModalSelect/utils/index.js +32 -39
- package/es/ProForm/components/combination/ProNumberRange/index.js +100 -156
- package/es/ProForm/components/combination/ProNumberRange/propsType.js +0 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.js +104 -115
- package/es/ProForm/components/combination/ProRangeLimit/propsType.js +0 -1
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +16 -16
- package/es/ProForm/components/combination/ProTimeLimit/index.js +75 -109
- package/es/ProForm/components/index.js +56 -34
- package/es/ProForm/components/render/ChangedWrapper.js +85 -94
- package/es/ProForm/components/render/ConfirmWrapper.js +27 -39
- package/es/ProForm/components/render/CustomComponentViewWrapper.js +65 -82
- package/es/ProForm/components/render/Render.js +223 -329
- package/es/ProForm/components/render/RenderFields.js +76 -113
- package/es/ProForm/components/render/propsType.js +0 -1
- package/es/ProForm/hooks/useControlled.js +8 -10
- package/es/ProForm/hooks/useDeepCompareMemo.js +11 -11
- package/es/ProForm/hooks/useFieldProps.js +8 -4
- package/es/ProForm/hooks/useForm.js +50 -110
- package/es/ProForm/hooks/useRules.js +17 -33
- package/es/ProForm/hooks/useShouldUpdate.js +77 -152
- package/es/ProForm/hooks/useWatch.js +62 -134
- package/es/ProForm/index.js +157 -194
- package/es/ProForm/propsType.js +15 -7
- package/es/ProForm/utils/buildFormItemProps.js +51 -58
- package/es/ProForm/utils/diffOriginal.js +43 -73
- package/es/ProForm/utils/getDefaultProps.js +18 -24
- package/es/ProForm/utils/index.js +160 -235
- package/es/ProForm/utils/processDependencies.js +21 -60
- package/es/ProForm/utils/reactiveValues.js +20 -34
- package/es/ProForm/utils/rulesCreator.js +42 -40
- package/es/ProForm/utils/transformNames.js +10 -13
- package/es/ProForm/utils/transformValue.js +16 -29
- package/es/ProForm/utils/valueType.js +96 -178
- package/es/ProIcon/config/index.js +340 -274
- package/es/ProIcon/index.js +135 -209
- package/es/ProIcon/propsTypes.js +0 -1
- package/es/ProIcon/utils/index.js +24 -39
- package/es/ProLayout/components/Layout/Header/index.js +108 -141
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +134 -190
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +113 -139
- package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +0 -1
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +23 -31
- package/es/ProLayout/components/Layout/Menu/index.js +92 -89
- package/es/ProLayout/components/Layout/Notice/index.js +13 -27
- package/es/ProLayout/components/Layout/index.js +8 -3
- package/es/ProLayout/components/ProCollapse/PropTypes.js +0 -1
- package/es/ProLayout/components/ProCollapse/index.js +89 -111
- package/es/ProLayout/components/ProFooter/PropTypes.js +0 -1
- package/es/ProLayout/components/ProFooter/index.js +27 -24
- package/es/ProLayout/components/ProHeader/PropTypes.js +0 -1
- package/es/ProLayout/components/ProHeader/components/Copy/index.js +23 -21
- package/es/ProLayout/components/ProHeader/components/Describe/index.js +67 -84
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +18 -21
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +0 -1
- package/es/ProLayout/components/ProHeader/components/index.js +6 -2
- package/es/ProLayout/components/ProHeader/index.js +216 -356
- package/es/ProLayout/components/ProHeader/utils/index.js +19 -26
- package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +92 -85
- package/es/ProLayout/components/TabsManager/components/TabItem.js +53 -63
- package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -5
- package/es/ProLayout/components/TabsManager/components/TabsHeader.js +42 -52
- package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +8 -9
- package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.js +19 -32
- package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +6 -20
- package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +25 -42
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +320 -350
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.d.ts +19 -0
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +332 -0
- package/es/ProLayout/components/TabsManager/index.js +407 -351
- package/es/ProLayout/components/TabsManager/propTypes.d.ts +4 -0
- package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
- package/es/ProLayout/components/TabsManager/style/index.less +1 -1
- package/es/ProLayout/components/TabsManager/utils/historyObserver.d.ts +7 -0
- package/es/ProLayout/components/TabsManager/utils/historyObserver.js +65 -0
- package/es/ProLayout/components/TabsManager/utils/index.d.ts +15 -2
- package/es/ProLayout/components/TabsManager/utils/index.js +156 -159
- package/es/ProLayout/components/index.js +8 -3
- package/es/ProLayout/index.js +173 -228
- package/es/ProLayout/propTypes.d.ts +28 -1
- package/es/ProLayout/propTypes.js +12 -52
- package/es/ProLayout/utils/index.js +48 -128
- package/es/ProSelect/components/AdaptiveTooltip.js +26 -25
- package/es/ProSelect/index.js +187 -223
- package/es/ProSelect/propsType.js +0 -1
- package/es/ProSelect/style/index.less +13 -0
- package/es/ProSelect/utils/index.js +100 -146
- package/es/ProStep/components/Anchor/index.js +71 -82
- package/es/ProStep/components/Item/index.js +49 -56
- package/es/ProStep/components/LazyLoad/index.js +23 -29
- package/es/ProStep/components/Listener/index.js +20 -33
- package/es/ProStep/components/Step/index.js +31 -38
- package/es/ProStep/constants.js +4 -1
- package/es/ProStep/index.js +166 -153
- package/es/ProStep/propsType.js +0 -1
- package/es/ProStep/style/index.less +1 -1
- package/es/ProStep/utils/index.js +29 -55
- package/es/ProStepTab/index.js +83 -138
- package/es/ProStepTab/propsType.js +0 -1
- package/es/ProTable/components/EditableCell/EditIcon.js +10 -14
- package/es/ProTable/components/EditableCell/index.js +37 -71
- package/es/ProTable/components/EditableCell/propsType.js +0 -1
- package/es/ProTable/components/FormatColumn/index.js +209 -340
- package/es/ProTable/components/FormatColumn/propsType.js +0 -1
- package/es/ProTable/components/RcTable/components/BaseTable/index.js +35 -39
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +80 -107
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +54 -48
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +0 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +47 -54
- package/es/ProTable/components/RcTable/index.js +6 -4
- package/es/ProTable/components/RenderColumn/index.js +158 -186
- package/es/ProTable/components/RenderEmptyText/index.js +12 -21
- package/es/ProTable/components/RenderFooter/index.js +15 -15
- package/es/ProTable/components/RenderSummary/index.js +33 -50
- package/es/ProTable/components/RenderTableHeader/index.js +44 -46
- package/es/ProTable/components/RenderTabs/index.js +47 -51
- package/es/ProTable/components/TableResizable/index.js +56 -72
- package/es/ProTable/components/TooltipTitle/index.js +13 -21
- package/es/ProTable/components/index.js +16 -36
- package/es/ProTable/hooks/useAntdTable.js +191 -224
- package/es/ProTable/index.js +232 -249
- package/es/ProTable/propsType.js +0 -1
- package/es/ProTable/utils/columnStorage.js +63 -88
- package/es/ProTable/utils/index.js +57 -90
- package/es/ProTabs/components/Card/index.js +20 -48
- package/es/ProTabs/components/index.js +4 -1
- package/es/ProTabs/index.js +41 -58
- package/es/ProTabs/propType.js +0 -1
- package/es/ProThemeTools/component/ProTools/index.js +106 -158
- package/es/ProThemeTools/component/index.js +4 -1
- package/es/ProThemeTools/context/ThemeContext.js +67 -146
- package/es/ProThemeTools/index.js +103 -156
- package/es/ProThemeTools/propsType.js +0 -1
- package/es/ProThemeTools/utils/index.js +60 -109
- package/es/ProTooltip/index.js +132 -168
- package/es/ProTooltip/propsType.js +0 -1
- package/es/ProTree/components/AdaptiveTooltip.js +15 -17
- package/es/ProTree/components/CloseIcon.js +18 -26
- package/es/ProTree/components/List.js +28 -47
- package/es/ProTree/components/ProTree.js +152 -211
- package/es/ProTree/components/ProTreeSelect/index.js +255 -459
- package/es/ProTree/components/ProTreeSelect/propsType.js +0 -1
- package/es/ProTree/components/SearchTitle.js +23 -42
- package/es/ProTree/components/Tree.js +147 -195
- package/es/ProTree/components/index.js +10 -5
- package/es/ProTree/index.js +12 -16
- package/es/ProTree/propsType.js +0 -1
- package/es/ProTree/utils.js +46 -118
- package/es/ProTreeModal/components/Cascader.js +56 -64
- package/es/ProTreeModal/components/CloseIcon.js +18 -26
- package/es/ProTreeModal/components/List.js +114 -180
- package/es/ProTreeModal/components/SearchTitle.js +15 -18
- package/es/ProTreeModal/components/SortableItem.js +29 -58
- package/es/ProTreeModal/components/Tree.js +99 -113
- package/es/ProTreeModal/components/Trigger.js +87 -121
- package/es/ProTreeModal/components/index.js +14 -6
- package/es/ProTreeModal/index.js +397 -438
- package/es/ProTreeModal/propsType.js +0 -1
- package/es/ProTreeModal/utils.js +52 -95
- package/es/ProUpload/components/ButtonRender.js +44 -54
- package/es/ProUpload/components/DragRender.js +94 -148
- package/es/ProUpload/components/DraggableUploadListItem.js +12 -25
- package/es/ProUpload/components/Example.js +27 -31
- package/es/ProUpload/components/FileItem.js +69 -163
- package/es/ProUpload/components/ImageRender.js +134 -170
- package/es/ProUpload/index.js +68 -100
- package/es/ProUpload/propsType.js +0 -1
- package/es/ProUpload/uitls.js +8 -4
- package/es/ProUtils/utils/index.js +17 -13
- package/es/ProViewer/index.js +154 -175
- package/es/ProViewer/propsType.js +0 -5
- package/es/ProWaterMark/index.js +9 -16
- package/es/ProWaterMark/propsType.js +0 -1
- package/es/hooks/useDraggableRow.js +25 -53
- package/es/index.js +57 -77
- package/es/locale/en_US.js +153 -142
- package/es/locale/index.js +23 -36
- package/es/locale/zh_CN.js +145 -142
- package/es/tokens.js +84 -83
- package/es/utils/index.js +24 -51
- package/package.json +4 -2
- package/es/ProConfigProvider/demo/locale.js +0 -58
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Col, Form, Input, Space } from "antd";
|
|
3
|
+
import React, { useMemo, useRef, useEffect } from "react";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import { QuestionCircleOutlined } from "@ant-design/icons";
|
|
6
|
+
import isString from "lodash/isString";
|
|
7
|
+
import omit from "lodash/omit";
|
|
8
|
+
import set from "lodash/set";
|
|
9
|
+
import debounce from "lodash/debounce";
|
|
9
10
|
import useShouldUpdate from "../../hooks/useShouldUpdate";
|
|
10
11
|
import { findOptionByValue, parseNamePath } from "../../utils/index";
|
|
11
12
|
import { buildFormItemProps } from "../../utils/buildFormItemProps";
|
|
@@ -14,18 +15,24 @@ import useRules from "../../hooks/useRules";
|
|
|
14
15
|
import ConfirmWrapper from "./ConfirmWrapper";
|
|
15
16
|
import ChangedWrapper from "./ChangedWrapper";
|
|
16
17
|
import CustomComponentViewWrapper from "./CustomComponentViewWrapper";
|
|
17
|
-
|
|
18
|
-
/** 隐藏 FormItem 占位用的兜底 name,保证 shouldUpdate 监听有 FormItem 承载 */
|
|
19
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
|
-
const HIDDEN_FORM_ITEM_NAME = 'proFormItemHidden';
|
|
21
|
-
/** Group 默认校验延时(ms),等待 setFieldValue 同步最新值后再校验 */
|
|
18
|
+
const HIDDEN_FORM_ITEM_NAME = "proFormItemHidden";
|
|
22
19
|
const GROUP_VALIDATE_DELAY = 60;
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
const LAST_COMPONENT_PROPS_FILTER = ["onFieldChange", "disabledStrictly"];
|
|
21
|
+
const FILTER_FORM_ITEM_KEYS = [
|
|
22
|
+
"onFieldChange",
|
|
23
|
+
"shouldUpdate",
|
|
24
|
+
"namePath",
|
|
25
|
+
"isView",
|
|
26
|
+
"parentNames",
|
|
27
|
+
"space",
|
|
28
|
+
"before",
|
|
29
|
+
"after",
|
|
30
|
+
"globalControl",
|
|
31
|
+
"listName",
|
|
32
|
+
"fixed"
|
|
33
|
+
];
|
|
34
|
+
const Render = (props) => {
|
|
35
|
+
var _a, _b;
|
|
29
36
|
const {
|
|
30
37
|
component,
|
|
31
38
|
originComponent,
|
|
@@ -42,20 +49,8 @@ const Render = props => {
|
|
|
42
49
|
viewRender,
|
|
43
50
|
desensitization
|
|
44
51
|
} = props;
|
|
45
|
-
|
|
46
|
-
// 以下字段统一从 otherProps(Context)读取,避免与独立 prop 重复传递
|
|
47
|
-
const {
|
|
48
|
-
form,
|
|
49
|
-
formDisabled,
|
|
50
|
-
type,
|
|
51
|
-
colProps,
|
|
52
|
-
globalControl,
|
|
53
|
-
diffConfig,
|
|
54
|
-
shouldUpdateDebounce
|
|
55
|
-
} = otherProps || {};
|
|
52
|
+
const { form, formDisabled, type, colProps, globalControl, diffConfig, shouldUpdateDebounce } = otherProps || {};
|
|
56
53
|
const proConfig = useProConfig();
|
|
57
|
-
|
|
58
|
-
// 剔除一些不是FormItem的属性, 防止控制台报warning
|
|
59
54
|
const {
|
|
60
55
|
labelWidth,
|
|
61
56
|
hiddenNames,
|
|
@@ -69,8 +64,6 @@ const Render = props => {
|
|
|
69
64
|
validateFirst = true,
|
|
70
65
|
...otherFormItemProps
|
|
71
66
|
} = formItemProps;
|
|
72
|
-
|
|
73
|
-
// 更新show & disabled & rules
|
|
74
67
|
const {
|
|
75
68
|
shouldUpdate,
|
|
76
69
|
show: resolvedShow,
|
|
@@ -94,24 +87,19 @@ const Render = props => {
|
|
|
94
87
|
desensitization,
|
|
95
88
|
shouldUpdateDebounce
|
|
96
89
|
});
|
|
97
|
-
|
|
98
|
-
// 以不可变方式补上 shouldUpdate,作为后续整理的基础对象
|
|
99
|
-
const baseFormItemProps = {
|
|
100
|
-
...otherFormItemProps,
|
|
101
|
-
shouldUpdate
|
|
102
|
-
};
|
|
90
|
+
const baseFormItemProps = { ...otherFormItemProps, shouldUpdate };
|
|
103
91
|
const namesStr = useMemo(() => {
|
|
104
|
-
|
|
105
|
-
|
|
92
|
+
var _a2;
|
|
93
|
+
if (!Array.isArray(otherProps == null ? void 0 : otherProps.names)) {
|
|
94
|
+
return "";
|
|
106
95
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return otherProps?.name;
|
|
96
|
+
if (Array.isArray(otherProps == null ? void 0 : otherProps.name)) {
|
|
97
|
+
return otherProps == null ? void 0 : otherProps.name;
|
|
110
98
|
}
|
|
111
|
-
return otherProps.names
|
|
112
|
-
return Array.isArray(name) ? name.join(
|
|
113
|
-
}).join(
|
|
114
|
-
}, [otherProps
|
|
99
|
+
return (_a2 = otherProps.names) == null ? void 0 : _a2.map((name) => {
|
|
100
|
+
return Array.isArray(name) ? name.join("_") : name;
|
|
101
|
+
}).join("-");
|
|
102
|
+
}, [otherProps == null ? void 0 : otherProps.names]);
|
|
115
103
|
const internalRule = useRules({
|
|
116
104
|
names: otherProps.names,
|
|
117
105
|
label: baseFormItemProps.label,
|
|
@@ -121,15 +109,7 @@ const Render = props => {
|
|
|
121
109
|
isSelect,
|
|
122
110
|
type
|
|
123
111
|
});
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* globalControl 全局控制优先
|
|
127
|
-
* globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
|
|
128
|
-
* globalControl false时,优先级 组件上【fieldProps.disabled】 > formitem上【column.disabled】 > 全局【formDisabled】
|
|
129
|
-
*/
|
|
130
|
-
const lastDisabled = globalControl ? formDisabled ?? resolvedDisabled ?? resolvedFieldProps?.disabled ?? componentProps?.disabled : resolvedDisabled ?? resolvedFieldProps?.disabled ?? componentProps?.disabled ?? formDisabled;
|
|
131
|
-
|
|
132
|
-
// formItem 参数整理(纯函数,不可变合并,避免原地 mutate)
|
|
112
|
+
const lastDisabled = globalControl ? formDisabled ?? resolvedDisabled ?? (resolvedFieldProps == null ? void 0 : resolvedFieldProps.disabled) ?? (componentProps == null ? void 0 : componentProps.disabled) : resolvedDisabled ?? (resolvedFieldProps == null ? void 0 : resolvedFieldProps.disabled) ?? (componentProps == null ? void 0 : componentProps.disabled) ?? formDisabled;
|
|
133
113
|
const lastFormItemProps = buildFormItemProps({
|
|
134
114
|
baseFormItemProps,
|
|
135
115
|
otherProps,
|
|
@@ -148,19 +128,11 @@ const Render = props => {
|
|
|
148
128
|
lastDisabled,
|
|
149
129
|
labelWidth
|
|
150
130
|
});
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
* 最新fieldProps: 更新后的组件Props
|
|
154
|
-
*/
|
|
155
|
-
// 灵活模式:当存在 flexibleGroupProps 时,从 resolvedFieldProps.style 中移除 width,避免透传到组件
|
|
156
|
-
const flexibleGroupProps = otherProps?.flexibleGroupProps;
|
|
157
|
-
const adjustedFieldProps = flexibleGroupProps && resolvedFieldProps?.style?.width ? {
|
|
131
|
+
const flexibleGroupProps = otherProps == null ? void 0 : otherProps.flexibleGroupProps;
|
|
132
|
+
const adjustedFieldProps = flexibleGroupProps && ((_a = resolvedFieldProps == null ? void 0 : resolvedFieldProps.style) == null ? void 0 : _a.width) ? {
|
|
158
133
|
...resolvedFieldProps,
|
|
159
134
|
style: (() => {
|
|
160
|
-
const {
|
|
161
|
-
width,
|
|
162
|
-
...restStyle
|
|
163
|
-
} = resolvedFieldProps.style;
|
|
135
|
+
const { width, ...restStyle } = resolvedFieldProps.style;
|
|
164
136
|
return restStyle;
|
|
165
137
|
})()
|
|
166
138
|
} : resolvedFieldProps;
|
|
@@ -170,64 +142,58 @@ const Render = props => {
|
|
|
170
142
|
disabled: lastDisabled,
|
|
171
143
|
desensitization: resolvedDesensitization
|
|
172
144
|
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
145
|
+
const debounceWait = lastComponentProps == null ? void 0 : lastComponentProps.debounceWait;
|
|
146
|
+
const handlerRef = useRef(void 0);
|
|
147
|
+
const debouncedHandleChange = useMemo(
|
|
148
|
+
() => debounce((...args) => {
|
|
149
|
+
var _a2;
|
|
150
|
+
return (_a2 = handlerRef.current) == null ? void 0 : _a2.call(handlerRef, ...args);
|
|
151
|
+
}, debounceWait),
|
|
152
|
+
[debounceWait]
|
|
153
|
+
);
|
|
178
154
|
useEffect(() => () => debouncedHandleChange.cancel(), [debouncedHandleChange]);
|
|
179
155
|
const itemClassName = classNames({
|
|
180
156
|
[className]: className,
|
|
181
|
-
|
|
157
|
+
"pro-form-item-width-auto": ["Switch"].includes(type)
|
|
182
158
|
});
|
|
183
159
|
if (formItemProps.hidden === true || resolvedShow === false) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
required: false
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
160
|
+
return /* @__PURE__ */ jsx(
|
|
161
|
+
Form.Item,
|
|
162
|
+
{
|
|
163
|
+
name: lastFormItemProps.name || HIDDEN_FORM_ITEM_NAME,
|
|
164
|
+
shouldUpdate: lastFormItemProps.shouldUpdate,
|
|
165
|
+
className: itemClassName,
|
|
166
|
+
noStyle: true,
|
|
167
|
+
hidden: true,
|
|
168
|
+
rules: [{ required: false }],
|
|
169
|
+
children: /* @__PURE__ */ jsx(Input, {})
|
|
170
|
+
}
|
|
171
|
+
);
|
|
196
172
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
* 函数新参数组装
|
|
200
|
-
*/
|
|
201
|
-
const functionArgs = args => {
|
|
173
|
+
const functionArgs = (args) => {
|
|
174
|
+
var _a2, _b2;
|
|
202
175
|
const nextArgs = [...args];
|
|
203
|
-
const {
|
|
204
|
-
valueType
|
|
205
|
-
} = otherProps || {};
|
|
176
|
+
const { valueType } = otherProps || {};
|
|
206
177
|
nextArgs[1] = form.getFieldsValue();
|
|
207
178
|
nextArgs[2] = {
|
|
208
179
|
form
|
|
209
180
|
};
|
|
210
|
-
|
|
211
|
-
if (Array.isArray(lastFormItemProps.namePath) && lastFormItemProps?.namePath?.length) {
|
|
181
|
+
if (Array.isArray(lastFormItemProps.namePath) && ((_a2 = lastFormItemProps == null ? void 0 : lastFormItemProps.namePath) == null ? void 0 : _a2.length)) {
|
|
212
182
|
nextArgs[1] = form.getFieldValue(lastFormItemProps.namePath);
|
|
213
183
|
nextArgs[2].namePath = lastFormItemProps.namePath;
|
|
214
|
-
nextArgs[2].index = lastFormItemProps.namePath[lastFormItemProps
|
|
184
|
+
nextArgs[2].index = lastFormItemProps.namePath[((_b2 = lastFormItemProps == null ? void 0 : lastFormItemProps.namePath) == null ? void 0 : _b2.length) - 1];
|
|
215
185
|
}
|
|
216
|
-
|
|
217
|
-
// 返回表单元素默认值
|
|
218
186
|
nextArgs[2].extra = args;
|
|
219
|
-
|
|
220
|
-
// 当设置valueType后返回转换后的值
|
|
221
187
|
if (valueType) {
|
|
222
|
-
nextArgs[2].transformValue = form.getFieldValue(lastFormItemProps
|
|
188
|
+
nextArgs[2].transformValue = form.getFieldValue(lastFormItemProps == null ? void 0 : lastFormItemProps.name) || void 0;
|
|
223
189
|
}
|
|
224
190
|
nextArgs[2].option = args[1];
|
|
225
191
|
switch (type) {
|
|
226
|
-
case
|
|
192
|
+
case "ProCascader":
|
|
227
193
|
nextArgs[2].selectedOptions = args[1];
|
|
228
194
|
break;
|
|
229
|
-
case
|
|
230
|
-
case
|
|
195
|
+
case "DatePicker":
|
|
196
|
+
case "RangePicker":
|
|
231
197
|
nextArgs[2].dateString = args[1];
|
|
232
198
|
break;
|
|
233
199
|
default:
|
|
@@ -235,57 +201,47 @@ const Render = props => {
|
|
|
235
201
|
}
|
|
236
202
|
return nextArgs;
|
|
237
203
|
};
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* onChange参数重置 (value, record, { form, index, namePath, option }) => void
|
|
241
|
-
*/
|
|
242
204
|
const defaultHandleChange = (...args) => {
|
|
205
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
243
206
|
let nextArgs = [...args];
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const changeKey = Object.keys(lastComponentProps).includes('onFieldChange') ? 'onFieldChange' : 'onChange';
|
|
247
|
-
if (changeKey === 'onChange') {
|
|
207
|
+
const changeKey = Object.keys(lastComponentProps).includes("onFieldChange") ? "onFieldChange" : "onChange";
|
|
208
|
+
if (changeKey === "onChange") {
|
|
248
209
|
nextArgs[2] = form;
|
|
249
210
|
}
|
|
250
|
-
if (changeKey ===
|
|
211
|
+
if (changeKey === "onFieldChange") {
|
|
251
212
|
nextArgs = functionArgs([...args]);
|
|
252
213
|
}
|
|
253
|
-
const inList = lastFormItemProps
|
|
254
|
-
if (
|
|
255
|
-
(AutoComponent
|
|
214
|
+
const inList = (_a2 = lastFormItemProps == null ? void 0 : lastFormItemProps.namePath) == null ? void 0 : _a2.length;
|
|
215
|
+
if (React.isValidElement(AutoComponent)) {
|
|
216
|
+
((_c = (_b2 = AutoComponent == null ? void 0 : AutoComponent.props)[changeKey]) == null ? void 0 : _c.call(_b2, ...nextArgs)) || ((_d = lastComponentProps[changeKey]) == null ? void 0 : _d.call(lastComponentProps, ...nextArgs));
|
|
256
217
|
return false;
|
|
257
218
|
}
|
|
258
|
-
|
|
259
|
-
// FormList 和 Group场景 对比值改变的话, 回显到表单上
|
|
260
|
-
if (inList && changeKey === 'onFieldChange') {
|
|
219
|
+
if (inList && changeKey === "onFieldChange") {
|
|
261
220
|
const values = form.getFieldsValue();
|
|
262
|
-
const newValues =
|
|
221
|
+
const newValues = set(values, lastFormItemProps.namePath, nextArgs[1]);
|
|
263
222
|
form.setFieldsValue(newValues);
|
|
264
223
|
}
|
|
265
|
-
|
|
266
|
-
// Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
|
|
267
|
-
if (formItemProps?.parentNames) {
|
|
224
|
+
if (formItemProps == null ? void 0 : formItemProps.parentNames) {
|
|
268
225
|
setTimeout(() => {
|
|
269
|
-
const namePath = parseNamePath(formItemProps
|
|
270
|
-
form.setFieldValue(formItemProps
|
|
226
|
+
const namePath = parseNamePath(formItemProps == null ? void 0 : formItemProps.parentNames);
|
|
227
|
+
form.setFieldValue(formItemProps == null ? void 0 : formItemProps.parentNames, form.getFieldValue(namePath));
|
|
271
228
|
form.validateFields(namePath);
|
|
272
229
|
}, GROUP_VALIDATE_DELAY);
|
|
273
230
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
231
|
+
if (["ProTree"].includes(type) && !nextArgs[2].option) {
|
|
232
|
+
nextArgs[2].option = findOptionByValue(
|
|
233
|
+
lastComponentProps == null ? void 0 : lastComponentProps.dataSource,
|
|
234
|
+
(_e = nextArgs == null ? void 0 : nextArgs[0]) == null ? void 0 : _e[0],
|
|
235
|
+
(lastComponentProps == null ? void 0 : lastComponentProps.fieldNames) || {}
|
|
236
|
+
);
|
|
278
237
|
}
|
|
279
|
-
lastComponentProps[changeKey]
|
|
238
|
+
(_f = lastComponentProps[changeKey]) == null ? void 0 : _f.call(lastComponentProps, ...nextArgs);
|
|
280
239
|
};
|
|
281
|
-
|
|
282
|
-
// 更新 ref 到最新 handler,使记忆化的防抖函数始终调用最新闭包
|
|
283
240
|
handlerRef.current = defaultHandleChange;
|
|
284
241
|
const handleChange = (...args) => {
|
|
285
242
|
const nextArgs = [...args];
|
|
286
|
-
if (lastComponentProps
|
|
287
|
-
|
|
288
|
-
if (['Input', 'TextArea'].includes(type)) {
|
|
243
|
+
if (lastComponentProps == null ? void 0 : lastComponentProps.debounceWait) {
|
|
244
|
+
if (["Input", "TextArea"].includes(type)) {
|
|
289
245
|
nextArgs[0] = {
|
|
290
246
|
target: {
|
|
291
247
|
value: nextArgs[0].target.value
|
|
@@ -297,237 +253,175 @@ const Render = props => {
|
|
|
297
253
|
defaultHandleChange(...nextArgs);
|
|
298
254
|
}
|
|
299
255
|
};
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* onBlur参数重置 (value, record, { form, index, namePath, option }) => void
|
|
303
|
-
*/
|
|
304
256
|
const handleBlur = async (...args) => {
|
|
305
257
|
const nextArgs = functionArgs([...args]);
|
|
306
|
-
lastComponentProps
|
|
258
|
+
(lastComponentProps == null ? void 0 : lastComponentProps.onBlur) && await (lastComponentProps == null ? void 0 : lastComponentProps.onBlur(...nextArgs));
|
|
307
259
|
};
|
|
308
|
-
|
|
309
|
-
// colProps 一次派生:FormList / 容器组件需要覆盖 span
|
|
310
260
|
const lastColProps = (() => {
|
|
311
|
-
if (type ===
|
|
312
|
-
const lessMode = lastComponentProps.mode ===
|
|
313
|
-
return {
|
|
314
|
-
...colProps,
|
|
315
|
-
span: lessMode ? colProps?.span : 24
|
|
316
|
-
}; // 默认占一行
|
|
261
|
+
if (type === "FormList") {
|
|
262
|
+
const lessMode = lastComponentProps.mode === "less";
|
|
263
|
+
return { ...colProps, span: lessMode ? colProps == null ? void 0 : colProps.span : 24 };
|
|
317
264
|
}
|
|
318
|
-
if ([
|
|
319
|
-
return {
|
|
320
|
-
...colProps,
|
|
321
|
-
span: 24
|
|
322
|
-
}; // 默认占一行
|
|
265
|
+
if (["ProCollapse", "Container"].includes(type)) {
|
|
266
|
+
return { ...colProps, span: 24 };
|
|
323
267
|
}
|
|
324
268
|
return colProps;
|
|
325
269
|
})();
|
|
326
270
|
const renderItem = () => {
|
|
327
|
-
|
|
271
|
+
var _a2, _b2, _c;
|
|
328
272
|
const childProps = {
|
|
329
|
-
...AutoComponent
|
|
330
|
-
...
|
|
273
|
+
...AutoComponent == null ? void 0 : AutoComponent.props,
|
|
274
|
+
...omit(lastComponentProps, LAST_COMPONENT_PROPS_FILTER),
|
|
331
275
|
otherProps,
|
|
332
276
|
onChange: handleChange,
|
|
333
277
|
onBlur: handleBlur
|
|
334
278
|
};
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* formItem前后值添加
|
|
338
|
-
*/
|
|
339
279
|
const internalItemRender = {
|
|
340
|
-
mark:
|
|
341
|
-
render: (inputProps, doms) =>
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
},
|
|
347
|
-
children: formItemProps.above
|
|
348
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
349
|
-
style: {
|
|
350
|
-
display: 'flex',
|
|
351
|
-
alignItems: 'center'
|
|
352
|
-
},
|
|
353
|
-
children: [formItemProps?.before ? /*#__PURE__*/_jsx("div", {
|
|
280
|
+
mark: "pro_table_render",
|
|
281
|
+
render: (inputProps, doms) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
282
|
+
/* @__PURE__ */ jsx(Space, { size: 0, style: { marginTop: 8 }, children: formItemProps.above }),
|
|
283
|
+
/* @__PURE__ */ jsxs(
|
|
284
|
+
"div",
|
|
285
|
+
{
|
|
354
286
|
style: {
|
|
355
|
-
|
|
287
|
+
display: "flex",
|
|
288
|
+
alignItems: "center"
|
|
356
289
|
},
|
|
357
|
-
children:
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
marginInlineStart: 8
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
marginTop: 8
|
|
368
|
-
},
|
|
369
|
-
children: formItemProps.extra
|
|
370
|
-
}), doms.errorList ? /*#__PURE__*/_jsx("div", {
|
|
371
|
-
className: "ant-form-item-additional",
|
|
372
|
-
style: {
|
|
373
|
-
minHeight: '16px'
|
|
374
|
-
},
|
|
375
|
-
children: doms.errorList
|
|
376
|
-
}) : null]
|
|
377
|
-
})
|
|
290
|
+
children: [
|
|
291
|
+
(formItemProps == null ? void 0 : formItemProps.before) ? /* @__PURE__ */ jsx("div", { style: { marginInlineEnd: 8 }, children: formItemProps == null ? void 0 : formItemProps.before }) : null,
|
|
292
|
+
doms.input,
|
|
293
|
+
(formItemProps == null ? void 0 : formItemProps.after) ? /* @__PURE__ */ jsx("div", { style: { marginInlineStart: 8 }, children: formItemProps == null ? void 0 : formItemProps.after }) : null
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
/* @__PURE__ */ jsx(Space, { size: 0, style: { marginTop: 8 }, children: formItemProps.extra }),
|
|
298
|
+
doms.errorList ? /* @__PURE__ */ jsx("div", { className: "ant-form-item-additional", style: { minHeight: "16px" }, children: doms.errorList }) : null
|
|
299
|
+
] })
|
|
378
300
|
};
|
|
379
|
-
// 自定义组件移除otherProps参数
|
|
380
301
|
if (originComponent) {
|
|
381
302
|
delete childProps.otherProps;
|
|
382
303
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
},
|
|
393
|
-
onChange: handleChange,
|
|
394
|
-
onBlur: handleBlur
|
|
395
|
-
});
|
|
304
|
+
let child = React.isValidElement(AutoComponent) ? React.cloneElement(AutoComponent, childProps) : /* @__PURE__ */ jsx(
|
|
305
|
+
AutoComponent,
|
|
306
|
+
{
|
|
307
|
+
...omit(lastComponentProps, [...LAST_COMPONENT_PROPS_FILTER, "debounceWait"]),
|
|
308
|
+
otherProps: { ...otherProps, show, disabled: lastDisabled, required },
|
|
309
|
+
onChange: handleChange,
|
|
310
|
+
onBlur: handleBlur
|
|
311
|
+
}
|
|
312
|
+
);
|
|
396
313
|
if (confirm) {
|
|
397
|
-
child =
|
|
398
|
-
confirm: confirm,
|
|
399
|
-
...childProps,
|
|
400
|
-
children: child
|
|
401
|
-
});
|
|
314
|
+
child = /* @__PURE__ */ jsx(ConfirmWrapper, { confirm, ...childProps, children: child });
|
|
402
315
|
}
|
|
403
|
-
|
|
404
|
-
// 表单提示
|
|
405
|
-
|
|
406
316
|
if (tooltip) {
|
|
407
|
-
lastFormItemProps.tooltip =
|
|
408
|
-
|
|
409
|
-
icon: /*#__PURE__*/_jsx(QuestionCircleOutlined, {
|
|
410
|
-
className: "pro-icon-tip"
|
|
411
|
-
})
|
|
412
|
-
} : {
|
|
413
|
-
icon: /*#__PURE__*/_jsx(QuestionCircleOutlined, {
|
|
414
|
-
className: "pro-icon-tip"
|
|
415
|
-
}),
|
|
317
|
+
lastFormItemProps.tooltip = isString(tooltip) ? { title: tooltip, icon: /* @__PURE__ */ jsx(QuestionCircleOutlined, { className: "pro-icon-tip" }) } : {
|
|
318
|
+
icon: /* @__PURE__ */ jsx(QuestionCircleOutlined, { className: "pro-icon-tip" }),
|
|
416
319
|
...tooltip
|
|
417
320
|
};
|
|
418
321
|
}
|
|
419
|
-
if (type ===
|
|
322
|
+
if (type === "FormList") {
|
|
420
323
|
lastComponentProps.disabled = lastDisabled;
|
|
421
|
-
return
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
name: lastFormItemProps.name,
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
324
|
+
return /* @__PURE__ */ jsx(
|
|
325
|
+
Form.Item,
|
|
326
|
+
{
|
|
327
|
+
...omit(lastFormItemProps, FILTER_FORM_ITEM_KEYS),
|
|
328
|
+
_internalItemRender: internalItemRender,
|
|
329
|
+
className: itemClassName,
|
|
330
|
+
children: /* @__PURE__ */ jsx(Form.List, { name: lastFormItemProps.name, ...omit(lastFormItemProps, ["rules"]), children: (fields, operation, meta) => {
|
|
331
|
+
return /* @__PURE__ */ jsx(
|
|
332
|
+
AutoComponent,
|
|
333
|
+
{
|
|
334
|
+
...omit(lastComponentProps, LAST_COMPONENT_PROPS_FILTER),
|
|
335
|
+
otherProps,
|
|
336
|
+
fields,
|
|
337
|
+
operation,
|
|
338
|
+
meta
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
} })
|
|
342
|
+
}
|
|
343
|
+
);
|
|
440
344
|
}
|
|
441
|
-
if (diffConfig
|
|
345
|
+
if (diffConfig == null ? void 0 : diffConfig.originalValues) {
|
|
442
346
|
let nextNames = otherProps.names;
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
nextNames = otherProps.names.map(name => name.slice(prefixLength));
|
|
347
|
+
if (((_a2 = otherProps == null ? void 0 : otherProps.namePath) == null ? void 0 : _a2.length) && ((_b2 = otherProps.names) == null ? void 0 : _b2.length)) {
|
|
348
|
+
const prefixLength = ((_c = otherProps == null ? void 0 : otherProps.namePath) == null ? void 0 : _c.length) - 1;
|
|
349
|
+
nextNames = otherProps.names.map((name) => name.slice(prefixLength));
|
|
447
350
|
}
|
|
448
|
-
child =
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
351
|
+
child = /* @__PURE__ */ jsx(
|
|
352
|
+
ChangedWrapper,
|
|
353
|
+
{
|
|
354
|
+
name: formItemProps.name,
|
|
355
|
+
names: nextNames,
|
|
356
|
+
namesStr,
|
|
357
|
+
diffConfig,
|
|
358
|
+
form,
|
|
359
|
+
onDiff,
|
|
360
|
+
type,
|
|
361
|
+
onChange: handleChange,
|
|
362
|
+
onBlur: handleBlur,
|
|
363
|
+
valuePropName: lastFormItemProps.valuePropName,
|
|
364
|
+
normalize: lastFormItemProps.normalize,
|
|
365
|
+
getValueProps: lastFormItemProps.getValueProps,
|
|
366
|
+
viewRender,
|
|
367
|
+
children: child
|
|
368
|
+
}
|
|
369
|
+
);
|
|
464
370
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
const
|
|
468
|
-
const finalStyle = flexibleGroupProps?.style;
|
|
469
|
-
|
|
470
|
-
// 判断是否应该使用自定义组件视图包装器
|
|
471
|
-
const shouldUseCustomViewWrapper = otherProps?.isView && (props.viewRender || viewRender) && (props.originComponent || originComponent) && (typeof component === 'function' && ! /*#__PURE__*/React.isValidElement(component) || typeof AutoComponent === 'function' && ! /*#__PURE__*/React.isValidElement(AutoComponent));
|
|
472
|
-
|
|
473
|
-
// 如果应该使用自定义组件视图包装器,直接返回
|
|
371
|
+
const finalClassName = (flexibleGroupProps == null ? void 0 : flexibleGroupProps.className) ? classNames(itemClassName, flexibleGroupProps.className) : itemClassName;
|
|
372
|
+
const finalStyle = flexibleGroupProps == null ? void 0 : flexibleGroupProps.style;
|
|
373
|
+
const shouldUseCustomViewWrapper = (otherProps == null ? void 0 : otherProps.isView) && (props.viewRender || viewRender) && (props.originComponent || originComponent) && (typeof component === "function" && !React.isValidElement(component) || typeof AutoComponent === "function" && !React.isValidElement(AutoComponent));
|
|
474
374
|
if (shouldUseCustomViewWrapper) {
|
|
475
|
-
return
|
|
476
|
-
|
|
477
|
-
|
|
375
|
+
return /* @__PURE__ */ jsx(
|
|
376
|
+
CustomComponentViewWrapper,
|
|
377
|
+
{
|
|
378
|
+
formItemProps: lastFormItemProps,
|
|
379
|
+
internalItemRender,
|
|
380
|
+
className: finalClassName,
|
|
381
|
+
style: finalStyle,
|
|
382
|
+
filterFormItemKey: FILTER_FORM_ITEM_KEYS,
|
|
383
|
+
form,
|
|
384
|
+
name: lastFormItemProps.name,
|
|
385
|
+
isView: otherProps == null ? void 0 : otherProps.isView,
|
|
386
|
+
viewRender: props.viewRender || viewRender,
|
|
387
|
+
originComponent: props.originComponent || originComponent,
|
|
388
|
+
viewEmpty: otherProps == null ? void 0 : otherProps.viewEmpty,
|
|
389
|
+
otherProps,
|
|
390
|
+
component,
|
|
391
|
+
AutoComponent,
|
|
392
|
+
children: child
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
return /* @__PURE__ */ jsx(
|
|
397
|
+
Form.Item,
|
|
398
|
+
{
|
|
399
|
+
...omit(lastFormItemProps, FILTER_FORM_ITEM_KEYS),
|
|
400
|
+
_internalItemRender: internalItemRender,
|
|
478
401
|
className: finalClassName,
|
|
479
402
|
style: finalStyle,
|
|
480
|
-
filterFormItemKey: FILTER_FORM_ITEM_KEYS,
|
|
481
|
-
form: form,
|
|
482
|
-
name: lastFormItemProps.name,
|
|
483
|
-
isView: otherProps?.isView,
|
|
484
|
-
viewRender: props.viewRender || viewRender,
|
|
485
|
-
originComponent: props.originComponent || originComponent,
|
|
486
|
-
viewEmpty: otherProps?.viewEmpty,
|
|
487
|
-
otherProps: otherProps,
|
|
488
|
-
component: component,
|
|
489
|
-
AutoComponent: AutoComponent,
|
|
490
403
|
children: child
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
// 正常情况:使用标准的 Form.Item
|
|
495
|
-
return /*#__PURE__*/_jsx(Form.Item, {
|
|
496
|
-
..._omit(lastFormItemProps, FILTER_FORM_ITEM_KEYS),
|
|
497
|
-
// @ts-ignore _internalItemRender 为 antd Form.Item 内部属性,未导出公开类型,无法去除
|
|
498
|
-
_internalItemRender: internalItemRender,
|
|
499
|
-
className: finalClassName,
|
|
500
|
-
style: finalStyle,
|
|
501
|
-
children: child
|
|
502
|
-
});
|
|
404
|
+
}
|
|
405
|
+
);
|
|
503
406
|
};
|
|
504
|
-
const FormItem =
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
hidden: true,
|
|
515
|
-
name: name,
|
|
516
|
-
children: /*#__PURE__*/_jsx(Input, {})
|
|
517
|
-
}, name);
|
|
518
|
-
}) : null]
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
// 灵活模式:当存在 flexibleGroupProps 时,不包裹 Col,直接返回 FormItem
|
|
522
|
-
if (otherProps?.flexibleGroupProps) {
|
|
407
|
+
const FormItem = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
408
|
+
lastFormItemProps.shouldUpdate ? (
|
|
409
|
+
// 空标签防止气泡不显示
|
|
410
|
+
/* @__PURE__ */ jsx(Form.Item, { shouldUpdate: lastFormItemProps.shouldUpdate, noStyle: true, children: () => renderItem() })
|
|
411
|
+
) : renderItem(),
|
|
412
|
+
((_b = otherProps == null ? void 0 : otherProps.names) == null ? void 0 : _b.length) ? otherProps.names.map((name) => {
|
|
413
|
+
return /* @__PURE__ */ jsx(Form.Item, { hidden: true, name, children: /* @__PURE__ */ jsx(Input, {}) }, name);
|
|
414
|
+
}) : null
|
|
415
|
+
] });
|
|
416
|
+
if (otherProps == null ? void 0 : otherProps.flexibleGroupProps) {
|
|
523
417
|
return FormItem;
|
|
524
418
|
}
|
|
525
|
-
if (formItemProps
|
|
419
|
+
if (formItemProps == null ? void 0 : formItemProps.parentNames) {
|
|
526
420
|
return FormItem;
|
|
527
421
|
}
|
|
528
|
-
return
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
422
|
+
return /* @__PURE__ */ jsx(Col, { ...lastColProps, children: FormItem });
|
|
423
|
+
};
|
|
424
|
+
var Render_default = Render;
|
|
425
|
+
export {
|
|
426
|
+
Render_default as default
|
|
532
427
|
};
|
|
533
|
-
export default Render;
|