@zat-design/sisyphus-react 4.5.1 → 4.5.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/es/ProEditTable/components/Summary/index.js +3 -2
- package/es/ProEditTable/utils/tools.js +1 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +7 -6
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +4 -3
- package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/es/ProForm/components/render/RenderFields.js +3 -1
- package/es/ProForm/hooks/useWatch.js +8 -10
- package/es/ProLayout/components/ProHeader/index.js +28 -15
- package/es/ProSelect/index.js +74 -187
- package/es/ProSelect/utils/index.js +174 -0
- package/es/ProTree/components/ProTreeSelect/index.js +17 -3
- package/es/ProUpload/components/DragRender.js +2 -1
- package/es/ProUpload/index.js +1 -1
- package/package.json +1 -1
- package/es/FormsProvider/index.d.ts +0 -18
- package/es/ProAction/components/CheckModalContent/index.d.ts +0 -8
- package/es/ProAction/index.d.ts +0 -7
- package/es/ProAction/propsType.d.ts +0 -45
- package/es/ProConfigProvider/index.d.ts +0 -9
- package/es/ProConfigProvider/propsType.d.ts +0 -78
- package/es/ProDownload/index.d.ts +0 -6
- package/es/ProDownload/propsType.d.ts +0 -71
- package/es/ProDownload/utils.d.ts +0 -60
- package/es/ProDrawerForm/components/ProDrawer/index.d.ts +0 -7
- package/es/ProDrawerForm/components/ProModal/index.d.ts +0 -7
- package/es/ProDrawerForm/components/index.d.ts +0 -2
- package/es/ProDrawerForm/hooks/useConfirmClose.d.ts +0 -25
- package/es/ProDrawerForm/index.d.ts +0 -6
- package/es/ProDrawerForm/propsType.d.ts +0 -111
- package/es/ProDrawerForm/utils/index.d.ts +0 -25
- package/es/ProEditLabel/components/RenderProForm.d.ts +0 -4
- package/es/ProEditLabel/index.d.ts +0 -4
- package/es/ProEditLabel/propsType.d.ts +0 -163
- package/es/ProEditLabel/utils/index.d.ts +0 -7
- package/es/ProEditTable/components/ActionButton/index.d.ts +0 -2
- package/es/ProEditTable/components/RcTable/BaseTable.d.ts +0 -6
- package/es/ProEditTable/components/RcTable/DraggableTable.d.ts +0 -7
- package/es/ProEditTable/components/RcTable/index.d.ts +0 -4
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +0 -4
- package/es/ProEditTable/components/RenderField/index.d.ts +0 -3
- package/es/ProEditTable/components/RenderField/propsType.d.ts +0 -30
- package/es/ProEditTable/components/RenderField/tools.d.ts +0 -22
- package/es/ProEditTable/components/RenderToolbar/index.d.ts +0 -2
- package/es/ProEditTable/components/Summary/index.d.ts +0 -12
- package/es/ProEditTable/components/Validator/index.d.ts +0 -19
- package/es/ProEditTable/components/index.d.ts +0 -5
- package/es/ProEditTable/index.d.ts +0 -4
- package/es/ProEditTable/propsType.d.ts +0 -437
- package/es/ProEditTable/utils/config.d.ts +0 -25
- package/es/ProEditTable/utils/diffOriginal.d.ts +0 -22
- package/es/ProEditTable/utils/getDefaultProps.d.ts +0 -1
- package/es/ProEditTable/utils/index.d.ts +0 -23
- package/es/ProEditTable/utils/tools.d.ts +0 -128
- package/es/ProEditTable/utils/transform.d.ts +0 -13
- package/es/ProEditTable/utils/useEditTableError.d.ts +0 -7
- package/es/ProEditTable/utils/useShouldUpdateForTable.d.ts +0 -16
- package/es/ProEditTable/utils/validateAll.d.ts +0 -89
- package/es/ProEnum/components/Group.d.ts +0 -10
- package/es/ProEnum/components/Tag.d.ts +0 -7
- package/es/ProEnum/hooks/useEnum.d.ts +0 -29
- package/es/ProEnum/hooks/useEnumRequest.d.ts +0 -4
- package/es/ProEnum/hooks/useFrequentEnumRequest.d.ts +0 -14
- package/es/ProEnum/index.d.ts +0 -10
- package/es/ProEnum/propsType.d.ts +0 -310
- package/es/ProEnum/utils/eventCenter.d.ts +0 -1
- package/es/ProEnum/utils/frequentEnum.d.ts +0 -39
- package/es/ProEnum/utils/getEnum.d.ts +0 -47
- package/es/ProEnum/utils/getEnumLabel.d.ts +0 -2
- package/es/ProEnum/utils/index.d.ts +0 -84
- package/es/ProForm/components/Container.d.ts +0 -9
- package/es/ProForm/components/FormFooter/index.d.ts +0 -5
- package/es/ProForm/components/FormFooter/propsType.d.ts +0 -22
- package/es/ProForm/components/base/Checkbox/index.d.ts +0 -14
- package/es/ProForm/components/base/DatePicker/index.d.ts +0 -11
- package/es/ProForm/components/base/Input/index.d.ts +0 -3
- package/es/ProForm/components/base/Input/propsType.d.ts +0 -21
- package/es/ProForm/components/base/InputNumber/index.d.ts +0 -11
- package/es/ProForm/components/base/Radio/index.d.ts +0 -15
- package/es/ProForm/components/base/RangePicker/index.d.ts +0 -19
- package/es/ProForm/components/base/RangePicker/useDateRange.d.ts +0 -15
- package/es/ProForm/components/base/Select/index.d.ts +0 -11
- package/es/ProForm/components/base/Switch/index.d.ts +0 -10
- package/es/ProForm/components/base/SwitchCheckbox/index.d.ts +0 -10
- package/es/ProForm/components/base/TextArea/index.d.ts +0 -11
- package/es/ProForm/components/base/TimePicker/index.d.ts +0 -13
- package/es/ProForm/components/combination/Container/index.d.ts +0 -4
- package/es/ProForm/components/combination/Container/propsType.d.ts +0 -13
- package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +0 -24
- package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +0 -23
- package/es/ProForm/components/combination/FormList/components/Empty.d.ts +0 -13
- package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +0 -20
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.d.ts +0 -12
- package/es/ProForm/components/combination/FormList/index.d.ts +0 -4
- package/es/ProForm/components/combination/FormList/propsType.d.ts +0 -69
- package/es/ProForm/components/combination/FormList/utils.d.ts +0 -18
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.d.ts +0 -9
- package/es/ProForm/components/combination/Group/component/ComRender.d.ts +0 -28
- package/es/ProForm/components/combination/Group/component/FlexibleGroup.d.ts +0 -10
- package/es/ProForm/components/combination/Group/hooks/index.d.ts +0 -34
- package/es/ProForm/components/combination/Group/index.d.ts +0 -9
- package/es/ProForm/components/combination/Group/propsType.d.ts +0 -99
- package/es/ProForm/components/combination/Group/utils/index.d.ts +0 -154
- package/es/ProForm/components/combination/ProCascader/index.d.ts +0 -4
- package/es/ProForm/components/combination/ProCascader/propsType.d.ts +0 -48
- package/es/ProForm/components/combination/ProCascader/utils/index.d.ts +0 -14
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.d.ts +0 -33
- package/es/ProForm/components/combination/ProModalSelect/index.d.ts +0 -4
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +0 -106
- package/es/ProForm/components/combination/ProModalSelect/utils/index.d.ts +0 -1
- package/es/ProForm/components/combination/ProModalSelect/utils/mergeSelectedRows.d.ts +0 -14
- package/es/ProForm/components/combination/ProNumberRange/index.d.ts +0 -4
- package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +0 -85
- package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +0 -4
- package/es/ProForm/components/combination/ProRangeLimit/propsType.d.ts +0 -23
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.d.ts +0 -9
- package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +0 -33
- package/es/ProForm/components/index.d.ts +0 -29
- package/es/ProForm/components/render/ChangedWrapper.d.ts +0 -17
- package/es/ProForm/components/render/ConfirmWrapper.d.ts +0 -10
- package/es/ProForm/components/render/CustomComponentViewWrapper.d.ts +0 -30
- package/es/ProForm/components/render/Render.d.ts +0 -4
- package/es/ProForm/components/render/RenderFields.d.ts +0 -26
- package/es/ProForm/components/render/propsType.d.ts +0 -279
- package/es/ProForm/hooks/useControlled.d.ts +0 -1
- package/es/ProForm/hooks/useDeepCompareMemo.d.ts +0 -2
- package/es/ProForm/hooks/useFieldProps.d.ts +0 -4
- package/es/ProForm/hooks/useForm.d.ts +0 -8
- package/es/ProForm/hooks/useRules.d.ts +0 -16
- package/es/ProForm/hooks/useShouldUpdate.d.ts +0 -31
- package/es/ProForm/hooks/useWatch.d.ts +0 -22
- package/es/ProForm/index.d.ts +0 -6
- package/es/ProForm/propsType.d.ts +0 -143
- package/es/ProForm/utils/buildFormItemProps.d.ts +0 -25
- package/es/ProForm/utils/diffOriginal.d.ts +0 -10
- package/es/ProForm/utils/getDefaultProps.d.ts +0 -1
- package/es/ProForm/utils/index.d.ts +0 -109
- package/es/ProForm/utils/processDependencies.d.ts +0 -29
- package/es/ProForm/utils/reactiveValues.d.ts +0 -34
- package/es/ProForm/utils/rulesCreator.d.ts +0 -7
- package/es/ProForm/utils/transformNames.d.ts +0 -10
- package/es/ProForm/utils/transformValue.d.ts +0 -6
- package/es/ProForm/utils/valueType.d.ts +0 -70
- package/es/ProIcon/config/index.d.ts +0 -19
- package/es/ProIcon/index.d.ts +0 -4
- package/es/ProIcon/propsTypes.d.ts +0 -175
- package/es/ProIcon/utils/index.d.ts +0 -6
- package/es/ProLayout/components/Layout/Header/index.d.ts +0 -4
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.d.ts +0 -3
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +0 -3
- package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.d.ts +0 -15
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.d.ts +0 -3
- package/es/ProLayout/components/Layout/Menu/index.d.ts +0 -4
- package/es/ProLayout/components/Layout/Notice/index.d.ts +0 -4
- package/es/ProLayout/components/Layout/index.d.ts +0 -3
- package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +0 -98
- package/es/ProLayout/components/ProCollapse/index.d.ts +0 -3
- package/es/ProLayout/components/ProFooter/PropTypes.d.ts +0 -27
- package/es/ProLayout/components/ProFooter/index.d.ts +0 -4
- package/es/ProLayout/components/ProHeader/PropTypes.d.ts +0 -206
- package/es/ProLayout/components/ProHeader/components/Copy/index.d.ts +0 -4
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.d.ts +0 -9
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.d.ts +0 -4
- package/es/ProLayout/components/ProHeader/components/index.d.ts +0 -2
- package/es/ProLayout/components/ProHeader/index.d.ts +0 -4
- package/es/ProLayout/components/ProHeader/utils/index.d.ts +0 -5
- package/es/ProLayout/components/TabsManager/components/TabContextMenu.d.ts +0 -7
- package/es/ProLayout/components/TabsManager/components/TabItem.d.ts +0 -26
- package/es/ProLayout/components/TabsManager/components/TabsContext.d.ts +0 -6
- package/es/ProLayout/components/TabsManager/components/TabsHeader.d.ts +0 -10
- package/es/ProLayout/components/TabsManager/hooks/useActiveTab.d.ts +0 -6
- package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.d.ts +0 -25
- package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.d.ts +0 -18
- package/es/ProLayout/components/TabsManager/hooks/useTabsCache.d.ts +0 -31
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.d.ts +0 -5
- package/es/ProLayout/components/TabsManager/index.d.ts +0 -7
- package/es/ProLayout/components/TabsManager/propTypes.d.ts +0 -89
- package/es/ProLayout/components/TabsManager/utils/index.d.ts +0 -47
- package/es/ProLayout/components/index.d.ts +0 -3
- package/es/ProLayout/index.d.ts +0 -20
- package/es/ProLayout/propTypes.d.ts +0 -533
- package/es/ProLayout/utils/index.d.ts +0 -43
- package/es/ProSelect/components/AdaptiveTooltip.d.ts +0 -4
- package/es/ProSelect/index.d.ts +0 -5
- package/es/ProSelect/propsType.d.ts +0 -162
- package/es/ProSelect/utils/index.d.ts +0 -4
- package/es/ProStep/components/Anchor/index.d.ts +0 -4
- package/es/ProStep/components/Item/index.d.ts +0 -3
- package/es/ProStep/components/LazyLoad/index.d.ts +0 -19
- package/es/ProStep/components/Listener/index.d.ts +0 -4
- package/es/ProStep/components/Step/index.d.ts +0 -5
- package/es/ProStep/index.d.ts +0 -11
- package/es/ProStep/propsType.d.ts +0 -224
- package/es/ProStep/utils/index.d.ts +0 -22
- package/es/ProStepTab/index.d.ts +0 -22
- package/es/ProStepTab/propsType.d.ts +0 -114
- package/es/ProTable/components/EditableCell/EditIcon.d.ts +0 -6
- package/es/ProTable/components/EditableCell/index.d.ts +0 -4
- package/es/ProTable/components/EditableCell/propsType.d.ts +0 -24
- package/es/ProTable/components/FormatColumn/index.d.ts +0 -22
- package/es/ProTable/components/FormatColumn/propsType.d.ts +0 -29
- package/es/ProTable/components/RcTable/components/BaseTable/index.d.ts +0 -3
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +0 -18
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.d.ts +0 -8
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.d.ts +0 -61
- package/es/ProTable/components/RcTable/components/DraggableTable/index.d.ts +0 -3
- package/es/ProTable/components/RcTable/index.d.ts +0 -4
- package/es/ProTable/components/RenderColumn/index.d.ts +0 -22
- package/es/ProTable/components/RenderEmptyText/index.d.ts +0 -3
- package/es/ProTable/components/RenderFooter/index.d.ts +0 -2
- package/es/ProTable/components/RenderSummary/index.d.ts +0 -3
- package/es/ProTable/components/RenderTableHeader/index.d.ts +0 -2
- package/es/ProTable/components/RenderTabs/index.d.ts +0 -4
- package/es/ProTable/components/TableResizable/index.d.ts +0 -13
- package/es/ProTable/components/TooltipTitle/index.d.ts +0 -11
- package/es/ProTable/components/index.d.ts +0 -31
- package/es/ProTable/hooks/useAntdTable.d.ts +0 -7
- package/es/ProTable/index.d.ts +0 -17
- package/es/ProTable/propsType.d.ts +0 -792
- package/es/ProTable/utils/columnStorage.d.ts +0 -35
- package/es/ProTable/utils/index.d.ts +0 -52
- package/es/ProTabs/components/Card/index.d.ts +0 -3
- package/es/ProTabs/components/index.d.ts +0 -1
- package/es/ProTabs/index.d.ts +0 -4
- package/es/ProTabs/propType.d.ts +0 -94
- package/es/ProThemeTools/component/ProTools/index.d.ts +0 -3
- package/es/ProThemeTools/component/index.d.ts +0 -1
- package/es/ProThemeTools/context/ThemeContext.d.ts +0 -43
- package/es/ProThemeTools/index.d.ts +0 -9
- package/es/ProThemeTools/propsType.d.ts +0 -170
- package/es/ProThemeTools/utils/index.d.ts +0 -51
- package/es/ProTooltip/index.d.ts +0 -3
- package/es/ProTooltip/propsType.d.ts +0 -57
- package/es/ProTree/components/AdaptiveTooltip.d.ts +0 -4
- package/es/ProTree/components/CloseIcon.d.ts +0 -2
- package/es/ProTree/components/List.d.ts +0 -17
- package/es/ProTree/components/ProTree.d.ts +0 -3
- package/es/ProTree/components/ProTreeSelect/index.d.ts +0 -5
- package/es/ProTree/components/ProTreeSelect/propsType.d.ts +0 -445
- package/es/ProTree/components/SearchTitle.d.ts +0 -11
- package/es/ProTree/components/Tree.d.ts +0 -27
- package/es/ProTree/components/index.d.ts +0 -4
- package/es/ProTree/index.d.ts +0 -3
- package/es/ProTree/propsType.d.ts +0 -818
- package/es/ProTree/utils.d.ts +0 -62
- package/es/ProTreeModal/components/Cascader.d.ts +0 -14
- package/es/ProTreeModal/components/CloseIcon.d.ts +0 -2
- package/es/ProTreeModal/components/List.d.ts +0 -21
- package/es/ProTreeModal/components/SearchTitle.d.ts +0 -7
- package/es/ProTreeModal/components/SortableItem.d.ts +0 -12
- package/es/ProTreeModal/components/Tree.d.ts +0 -25
- package/es/ProTreeModal/components/Trigger.d.ts +0 -21
- package/es/ProTreeModal/components/index.d.ts +0 -6
- package/es/ProTreeModal/index.d.ts +0 -4
- package/es/ProTreeModal/propsType.d.ts +0 -298
- package/es/ProTreeModal/utils.d.ts +0 -39
- package/es/ProUpload/components/ButtonRender.d.ts +0 -20
- package/es/ProUpload/components/DragRender.d.ts +0 -21
- package/es/ProUpload/components/DraggableUploadListItem.d.ts +0 -2
- package/es/ProUpload/components/Example.d.ts +0 -10
- package/es/ProUpload/components/FileItem.d.ts +0 -33
- package/es/ProUpload/components/ImageRender.d.ts +0 -19
- package/es/ProUpload/index.d.ts +0 -4
- package/es/ProUpload/propsType.d.ts +0 -264
- package/es/ProUpload/uitls.d.ts +0 -3
- package/es/ProUtils/utils/index.d.ts +0 -6
- package/es/ProViewer/index.d.ts +0 -4
- package/es/ProViewer/propsType.d.ts +0 -37
- package/es/ProWaterMark/index.d.ts +0 -4
- package/es/ProWaterMark/propsType.d.ts +0 -6
- package/es/hooks/useDraggableRow.d.ts +0 -34
- package/es/index.d.ts +0 -58
- package/es/locale/en_US.d.ts +0 -176
- package/es/locale/index.d.ts +0 -15
- package/es/locale/zh_CN.d.ts +0 -176
- package/es/tokens.d.ts +0 -83
- package/es/utils/index.d.ts +0 -20
|
@@ -70,7 +70,8 @@ const Summary = ({
|
|
|
70
70
|
const {
|
|
71
71
|
index,
|
|
72
72
|
colSpan,
|
|
73
|
-
prefix
|
|
73
|
+
prefix,
|
|
74
|
+
key: columnKey
|
|
74
75
|
} = item;
|
|
75
76
|
return /*#__PURE__*/_jsx(Table.Summary.Cell, {
|
|
76
77
|
index: index,
|
|
@@ -80,7 +81,7 @@ const Summary = ({
|
|
|
80
81
|
children: renderCell(item)
|
|
81
82
|
})]
|
|
82
83
|
})
|
|
83
|
-
}, index);
|
|
84
|
+
}, columnKey ?? `summary-col-${index}`);
|
|
84
85
|
})
|
|
85
86
|
})
|
|
86
87
|
});
|
|
@@ -182,13 +182,14 @@ const ActionButton = props => {
|
|
|
182
182
|
align: "start",
|
|
183
183
|
className: "pro-form-list-action",
|
|
184
184
|
children: actionProps?.map(item => {
|
|
185
|
-
|
|
185
|
+
const actionKey = `${field.key}-${item?.type ?? item?.label ?? 'action'}`;
|
|
186
|
+
if (item.show === false) return /*#__PURE__*/_jsx("span", {}, actionKey);
|
|
186
187
|
if (_isFunction(item.show) && !item.show(form.getFieldValue(namePath), {
|
|
187
188
|
namePath,
|
|
188
189
|
index,
|
|
189
190
|
form
|
|
190
191
|
})) {
|
|
191
|
-
return /*#__PURE__*/_jsx("span", {},
|
|
192
|
+
return /*#__PURE__*/_jsx("span", {}, actionKey);
|
|
192
193
|
}
|
|
193
194
|
const {
|
|
194
195
|
label,
|
|
@@ -295,7 +296,7 @@ const ActionButton = props => {
|
|
|
295
296
|
onClick: e => e.stopPropagation(),
|
|
296
297
|
children: label || defaultLabel
|
|
297
298
|
})
|
|
298
|
-
},
|
|
299
|
+
}, actionKey) : /*#__PURE__*/_jsx(Button, {
|
|
299
300
|
className: classNames({
|
|
300
301
|
'pro-form-list-tool-btn': mode === 'line',
|
|
301
302
|
'pro-form-list-tool-btn-block': mode === 'block',
|
|
@@ -313,7 +314,7 @@ const ActionButton = props => {
|
|
|
313
314
|
}
|
|
314
315
|
},
|
|
315
316
|
children: label || defaultLabel
|
|
316
|
-
},
|
|
317
|
+
}, actionKey);
|
|
317
318
|
}
|
|
318
319
|
return needConfirm ? /*#__PURE__*/_jsx(Popconfirm, {
|
|
319
320
|
title: title ?? `${locale.ProForm.formListConfirmMessage}`,
|
|
@@ -326,9 +327,9 @@ const ActionButton = props => {
|
|
|
326
327
|
onClick: e => e.stopPropagation(),
|
|
327
328
|
children: label
|
|
328
329
|
})
|
|
329
|
-
},
|
|
330
|
+
}, actionKey) : /*#__PURE__*/_createElement(Button, {
|
|
330
331
|
..._omit(rest, filterKeys),
|
|
331
|
-
key:
|
|
332
|
+
key: actionKey,
|
|
332
333
|
type: "text",
|
|
333
334
|
onClick: e => {
|
|
334
335
|
e.stopPropagation();
|
|
@@ -108,7 +108,7 @@ const ToolbarButton = props => {
|
|
|
108
108
|
return /*#__PURE__*/_jsx(Space, {
|
|
109
109
|
align: "start",
|
|
110
110
|
className: "pro-form-list-toolbar",
|
|
111
|
-
children: toolbarProps?.map(
|
|
111
|
+
children: toolbarProps?.map(item => {
|
|
112
112
|
if (item.show === false) return /*#__PURE__*/_jsx(_Fragment, {});
|
|
113
113
|
if (_isFunction(item.show) && !item.show(form.getFieldValue(namePath), {
|
|
114
114
|
namePath,
|
|
@@ -123,6 +123,7 @@ const ToolbarButton = props => {
|
|
|
123
123
|
type,
|
|
124
124
|
...rest
|
|
125
125
|
} = item;
|
|
126
|
+
const toolbarKey = `${namePath.join('.')}-${type ?? 'custom'}-${label ?? ''}`;
|
|
126
127
|
const _onClick = onClick || onHandle;
|
|
127
128
|
if (type === 'add') {
|
|
128
129
|
if (disabled || isView) return /*#__PURE__*/_jsx(_Fragment, {});
|
|
@@ -141,14 +142,14 @@ const ToolbarButton = props => {
|
|
|
141
142
|
type: "link",
|
|
142
143
|
onClick: () => handleClick(internalOnClick, _onClick, item),
|
|
143
144
|
children: label || defaultLabel
|
|
144
|
-
},
|
|
145
|
+
}, toolbarKey);
|
|
145
146
|
}
|
|
146
147
|
return /*#__PURE__*/_jsx(Button, {
|
|
147
148
|
..._omit(rest, filterKeys),
|
|
148
149
|
type: "link",
|
|
149
150
|
onClick: () => customClick(onClick, item),
|
|
150
151
|
children: label
|
|
151
|
-
},
|
|
152
|
+
}, toolbarKey);
|
|
152
153
|
})
|
|
153
154
|
});
|
|
154
155
|
};
|
|
@@ -81,7 +81,7 @@ const ProModalSelect = (props, ref) => {
|
|
|
81
81
|
const isMultiple = type === 'checkbox';
|
|
82
82
|
|
|
83
83
|
// 生成一个唯一id,用于满足tooltip功能
|
|
84
|
-
const uuid =
|
|
84
|
+
const uuid = crypto.randomUUID().slice(0, 8);
|
|
85
85
|
|
|
86
86
|
// 全局配置fieldNames指定 value与label的key
|
|
87
87
|
const {
|
|
@@ -184,6 +184,8 @@ const RenderFields = props => {
|
|
|
184
184
|
...defaultColProps,
|
|
185
185
|
...colProps
|
|
186
186
|
};
|
|
187
|
+
const columnName = _formItemProps.name;
|
|
188
|
+
const fieldKey = (Array.isArray(columnName) ? columnName.join('.') : columnName) ?? _formItemProps.label ?? _type;
|
|
187
189
|
|
|
188
190
|
// 其余参数收进对象里传给子组件 componentProps只包含子组件参数
|
|
189
191
|
const otherProps = {
|
|
@@ -228,7 +230,7 @@ const RenderFields = props => {
|
|
|
228
230
|
viewRender: viewRender,
|
|
229
231
|
desensitization: desensitization
|
|
230
232
|
})
|
|
231
|
-
},
|
|
233
|
+
}, fieldKey != null && fieldKey !== '' ? String(fieldKey) : `column-${index}`);
|
|
232
234
|
});
|
|
233
235
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
234
236
|
children: comList
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import _cloneDeep from "lodash/cloneDeep";
|
|
2
|
+
import _isEqual from "lodash/isEqual";
|
|
1
3
|
import _debounce from "lodash/debounce";
|
|
2
4
|
import warning from 'rc-util/lib/warning';
|
|
3
5
|
import { useState, useEffect, useRef, useMemo } from 'react';
|
|
4
|
-
import isEqual from 'lodash/isEqual';
|
|
5
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
6
6
|
import { toArray } from "../utils";
|
|
7
7
|
|
|
8
8
|
// 从一个对象或Form值中获取特定路径的值
|
|
@@ -79,10 +79,8 @@ const useWatchWarning = process.env.NODE_ENV !== 'production' ? dependencies =>
|
|
|
79
79
|
function useWatch(dependencies, form, wait) {
|
|
80
80
|
const isSelector = typeof dependencies === 'function';
|
|
81
81
|
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
useWatchWarning(dependencies);
|
|
85
|
-
}
|
|
82
|
+
// 无条件调用,内部按 isSelector 决定是否真正执行警告逻辑,保证 Hook 顺序稳定
|
|
83
|
+
useWatchWarning(dependencies);
|
|
86
84
|
|
|
87
85
|
// 获取表单实例
|
|
88
86
|
const formInstance = form;
|
|
@@ -134,8 +132,8 @@ function useWatch(dependencies, form, wait) {
|
|
|
134
132
|
if (wait) {
|
|
135
133
|
return _debounce(value => {
|
|
136
134
|
// 只在值真正变化时才更新状态
|
|
137
|
-
if (!
|
|
138
|
-
prevStateRef.current =
|
|
135
|
+
if (!_isEqual(prevStateRef.current, value)) {
|
|
136
|
+
prevStateRef.current = _cloneDeep(value);
|
|
139
137
|
setState(value);
|
|
140
138
|
}
|
|
141
139
|
}, wait);
|
|
@@ -143,8 +141,8 @@ function useWatch(dependencies, form, wait) {
|
|
|
143
141
|
|
|
144
142
|
// 非防抖版本
|
|
145
143
|
return value => {
|
|
146
|
-
if (!
|
|
147
|
-
prevStateRef.current =
|
|
144
|
+
if (!_isEqual(prevStateRef.current, value)) {
|
|
145
|
+
prevStateRef.current = _cloneDeep(value);
|
|
148
146
|
setState(value);
|
|
149
147
|
}
|
|
150
148
|
};
|
|
@@ -18,6 +18,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
18
18
|
const {
|
|
19
19
|
formatAmount
|
|
20
20
|
} = tools;
|
|
21
|
+
const toKeyPart = value => {
|
|
22
|
+
if (value == null || value === '') return undefined;
|
|
23
|
+
if (typeof value === 'string' || typeof value === 'number') return String(value);
|
|
24
|
+
return undefined;
|
|
25
|
+
};
|
|
26
|
+
const getDescribeColumnKey = (item, index) => toKeyPart(item.label) ?? toKeyPart(item.value) ?? `describe-${index}`;
|
|
27
|
+
const getDescribeValueKey = (item, parentKey, index) => toKeyPart(item.link) ?? toKeyPart(item.value) ?? `${parentKey}-value-${index}`;
|
|
28
|
+
const getTagKey = (tagItem, parentKey, index) => toKeyPart(tagItem) ?? `${parentKey}-tag-${index}`;
|
|
29
|
+
const getSubDescribeKey = (item, index) => toKeyPart(item.label) ?? toKeyPart(item.code) ?? `sub-describe-${index}`;
|
|
21
30
|
const ProHeader = props => {
|
|
22
31
|
const {
|
|
23
32
|
breadcrumbColumns,
|
|
@@ -93,6 +102,7 @@ const ProHeader = props => {
|
|
|
93
102
|
items = [],
|
|
94
103
|
width
|
|
95
104
|
} = item;
|
|
105
|
+
const describeItemKey = getDescribeColumnKey(item, index);
|
|
96
106
|
// show为false直接隐藏¸
|
|
97
107
|
if (show === false || !show) {
|
|
98
108
|
return null;
|
|
@@ -102,11 +112,11 @@ const ProHeader = props => {
|
|
|
102
112
|
if (Array.isArray(params?.tag) && params?.tag.length) {
|
|
103
113
|
return /*#__PURE__*/_jsx(Space, {
|
|
104
114
|
size: 4,
|
|
105
|
-
children: params.tag.map((tagItem,
|
|
115
|
+
children: params.tag.map((tagItem, tagIndex) => {
|
|
106
116
|
return /*#__PURE__*/_jsx("div", {
|
|
107
117
|
className: "pro-header-tag",
|
|
108
118
|
children: tagItem
|
|
109
|
-
},
|
|
119
|
+
}, getTagKey(tagItem, describeItemKey, tagIndex));
|
|
110
120
|
})
|
|
111
121
|
});
|
|
112
122
|
}
|
|
@@ -145,10 +155,10 @@ const ProHeader = props => {
|
|
|
145
155
|
'pro-header-describe-items': true,
|
|
146
156
|
'pro-header-describe-items-more': items.length >= 2
|
|
147
157
|
}),
|
|
148
|
-
children: [items?.length > 3 ? `共${items?.length}个,` : null, items.map((item,
|
|
158
|
+
children: [items?.length > 3 ? `共${items?.length}个,` : null, items.map((item, itemIndex) => {
|
|
149
159
|
return /*#__PURE__*/_jsxs("span", {
|
|
150
|
-
children: [valueRender(item), items?.length !==
|
|
151
|
-
},
|
|
160
|
+
children: [valueRender(item), items?.length !== itemIndex + 1 ? ' 、' : null]
|
|
161
|
+
}, getDescribeValueKey(item, describeItemKey, itemIndex));
|
|
152
162
|
}), itemsHidden ? /*#__PURE__*/_jsx("span", {
|
|
153
163
|
className: "pro-header-describe-items-omit",
|
|
154
164
|
children: "..."
|
|
@@ -156,11 +166,11 @@ const ProHeader = props => {
|
|
|
156
166
|
});
|
|
157
167
|
if (itemsHidden) {
|
|
158
168
|
const tipResult = /*#__PURE__*/_jsx(_Fragment, {
|
|
159
|
-
children: items.map((item,
|
|
169
|
+
children: items.map((item, itemIndex) => {
|
|
160
170
|
return /*#__PURE__*/_jsx("p", {
|
|
161
171
|
className: "pro-header-describe-items-tip-value",
|
|
162
172
|
children: valueRender(item)
|
|
163
|
-
},
|
|
173
|
+
}, getDescribeValueKey(item, describeItemKey, itemIndex));
|
|
164
174
|
})
|
|
165
175
|
});
|
|
166
176
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
@@ -200,7 +210,7 @@ const ProHeader = props => {
|
|
|
200
210
|
})
|
|
201
211
|
})]
|
|
202
212
|
})
|
|
203
|
-
},
|
|
213
|
+
}, describeItemKey);
|
|
204
214
|
})
|
|
205
215
|
});
|
|
206
216
|
};
|
|
@@ -269,10 +279,11 @@ const ProHeader = props => {
|
|
|
269
279
|
orientation: "vertical"
|
|
270
280
|
}),
|
|
271
281
|
children: actionRender.map((item, index) => {
|
|
282
|
+
const actionKey = ( /*#__PURE__*/React.isValidElement(item) && item.key != null ? String(item.key) : undefined) ?? toKeyPart(item?.type) ?? `action-${index}`;
|
|
272
283
|
if (_isFunction(item?.type)) {
|
|
273
284
|
return /*#__PURE__*/_jsx("div", {
|
|
274
285
|
children: item
|
|
275
|
-
},
|
|
286
|
+
}, actionKey);
|
|
276
287
|
}
|
|
277
288
|
// 判断第一层dom节点为空
|
|
278
289
|
if (item?.type && !item?.props?.children) {
|
|
@@ -280,7 +291,7 @@ const ProHeader = props => {
|
|
|
280
291
|
}
|
|
281
292
|
return /*#__PURE__*/_jsx("div", {
|
|
282
293
|
children: item
|
|
283
|
-
},
|
|
294
|
+
}, actionKey);
|
|
284
295
|
})
|
|
285
296
|
});
|
|
286
297
|
}
|
|
@@ -303,15 +314,16 @@ const ProHeader = props => {
|
|
|
303
314
|
show = true,
|
|
304
315
|
tag
|
|
305
316
|
} = item;
|
|
317
|
+
const breadcrumbItemKey = toKeyPart(value) ?? `breadcrumb-${index}`;
|
|
306
318
|
const tagRender = () => {
|
|
307
319
|
if (Array.isArray(tag) && tag.length) {
|
|
308
320
|
return /*#__PURE__*/_jsx(Space, {
|
|
309
321
|
size: 8,
|
|
310
|
-
children: tag.map((tagItem,
|
|
322
|
+
children: tag.map((tagItem, tagIndex) => {
|
|
311
323
|
return /*#__PURE__*/_jsx("div", {
|
|
312
324
|
className: "pro-header-tag",
|
|
313
325
|
children: tagItem
|
|
314
|
-
},
|
|
326
|
+
}, getTagKey(tagItem, breadcrumbItemKey, tagIndex));
|
|
315
327
|
})
|
|
316
328
|
});
|
|
317
329
|
}
|
|
@@ -330,7 +342,7 @@ const ProHeader = props => {
|
|
|
330
342
|
return null;
|
|
331
343
|
}
|
|
332
344
|
return {
|
|
333
|
-
key:
|
|
345
|
+
key: breadcrumbItemKey,
|
|
334
346
|
title: /*#__PURE__*/_jsxs(Space, {
|
|
335
347
|
size: 4,
|
|
336
348
|
children: [value, " ", tagRender()]
|
|
@@ -362,6 +374,7 @@ const ProHeader = props => {
|
|
|
362
374
|
width,
|
|
363
375
|
tag
|
|
364
376
|
} = item;
|
|
377
|
+
const infoItemKey = (type && toKeyPart(value) ? `${type}-${toKeyPart(value)}` : undefined) ?? toKeyPart(value) ?? `info-${index}`;
|
|
365
378
|
// show或者值不存在为false直接隐藏¸
|
|
366
379
|
if (!show || !value) {
|
|
367
380
|
return '';
|
|
@@ -419,7 +432,7 @@ const ProHeader = props => {
|
|
|
419
432
|
hidden: ['version', 'tag'].includes(type) && !val
|
|
420
433
|
}),
|
|
421
434
|
children: type === 'copy' ? valueRender('copy') : valueRender()
|
|
422
|
-
},
|
|
435
|
+
}, infoItemKey);
|
|
423
436
|
})
|
|
424
437
|
});
|
|
425
438
|
};
|
|
@@ -513,7 +526,7 @@ const ProHeader = props => {
|
|
|
513
526
|
children: _subDescribeColumns.map((item, index) => {
|
|
514
527
|
return /*#__PURE__*/_jsx("li", {
|
|
515
528
|
children: subDescribeRender(item)
|
|
516
|
-
}, index);
|
|
529
|
+
}, getSubDescribeKey(item, index));
|
|
517
530
|
})
|
|
518
531
|
}), /*#__PURE__*/_jsx("div", {
|
|
519
532
|
className: "pro-header-fold",
|
package/es/ProSelect/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _isNumber from "lodash/isNumber";
|
|
2
2
|
import _omit from "lodash/omit";
|
|
3
|
-
import _isString from "lodash/isString";
|
|
4
3
|
import _isObject from "lodash/isObject";
|
|
5
4
|
import _isFunction from "lodash/isFunction";
|
|
6
5
|
import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
|
|
@@ -11,22 +10,8 @@ import Container from "../ProForm/components/Container";
|
|
|
11
10
|
import AdaptiveTooltip from "./components/AdaptiveTooltip";
|
|
12
11
|
import { ProForm } from '..';
|
|
13
12
|
import locale from "../locale";
|
|
14
|
-
import { getSelectList } from "./utils";
|
|
15
|
-
|
|
16
|
-
/** 将 selectList(扁平或分组)转为扁平选项列表,用于查找、回显、defaultOne */
|
|
13
|
+
import { getSelectList, flattenOptions, findValueObject, defaultFilterOption as defaultFilterOptionFn, getInnerRecord, buildSelectOptions, resolveChangeOption, computeChangeValue, computeTransformValue } from "./utils";
|
|
17
14
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
-
function flattenOptions(list) {
|
|
19
|
-
if (!Array.isArray(list) || !list.length) return [];
|
|
20
|
-
const out = [];
|
|
21
|
-
list.forEach(item => {
|
|
22
|
-
if (Array.isArray(item.options)) {
|
|
23
|
-
out.push(...item.options);
|
|
24
|
-
} else {
|
|
25
|
-
out.push(item);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
return out;
|
|
29
|
-
}
|
|
30
15
|
export const ProSelect = (props, ref) => {
|
|
31
16
|
const {
|
|
32
17
|
fieldNames: proSelectFieldNames = {},
|
|
@@ -125,17 +110,7 @@ export const ProSelect = (props, ref) => {
|
|
|
125
110
|
|
|
126
111
|
// 展平结果仅随 selectList 变化;滚动重挂载/无关 rerender 时复用,避免重复展平
|
|
127
112
|
const flatOptions = useMemo(() => flattenOptions(selectList), [selectList]);
|
|
128
|
-
const getValueObject = input =>
|
|
129
|
-
if (Array.isArray(input) && input.length) {
|
|
130
|
-
const resArr = [];
|
|
131
|
-
input.forEach(i => {
|
|
132
|
-
const res = flatOptions.find(item => item[code] === i);
|
|
133
|
-
if (res) resArr.push(res);
|
|
134
|
-
});
|
|
135
|
-
return resArr;
|
|
136
|
-
}
|
|
137
|
-
return flatOptions.find(item => item[code] === input);
|
|
138
|
-
};
|
|
113
|
+
const getValueObject = input => findValueObject(flatOptions, code, input);
|
|
139
114
|
useImperativeHandle(ref, () => ({
|
|
140
115
|
getValueObject,
|
|
141
116
|
useRequestRef: fetchFunction
|
|
@@ -205,53 +180,29 @@ export const ProSelect = (props, ref) => {
|
|
|
205
180
|
if (!flatOptions.length) {
|
|
206
181
|
return viewEmpty;
|
|
207
182
|
}
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
if (labelInValue) {
|
|
211
|
-
return item[code] === v[code];
|
|
212
|
-
}
|
|
213
|
-
return item[code] === v;
|
|
214
|
-
});
|
|
215
|
-
if (option) {
|
|
216
|
-
return selectProps.showCodeName ? `${option[code]}-${option[label]}` : option?.[label];
|
|
217
|
-
}
|
|
218
|
-
return '-';
|
|
219
|
-
});
|
|
220
|
-
const record = value.map(v => {
|
|
221
|
-
return flatOptions.find(item => {
|
|
222
|
-
if (labelInValue) {
|
|
223
|
-
return item[code] === v[code];
|
|
224
|
-
}
|
|
225
|
-
return item[code] === v;
|
|
226
|
-
});
|
|
227
|
-
}).filter(v => !!v);
|
|
183
|
+
const findOption = v => flatOptions.find(item => labelInValue ? item[code] === v[code] : item[code] === v);
|
|
184
|
+
const record = value.map(findOption).filter(v => !!v);
|
|
228
185
|
|
|
229
|
-
// 自定义option时,默认取optionRender的值
|
|
230
|
-
|
|
231
|
-
if (!record.length) {
|
|
232
|
-
return viewEmpty;
|
|
233
|
-
}
|
|
234
|
-
const arr = [];
|
|
235
|
-
record.forEach(item => {
|
|
236
|
-
arr.push(props.optionRender(item));
|
|
237
|
-
});
|
|
186
|
+
// 自定义 option 时,默认取 optionRender 的值
|
|
187
|
+
if (_isFunction(props.optionRender) && record.length) {
|
|
238
188
|
return /*#__PURE__*/_jsx(Space, {
|
|
239
189
|
orientation: "vertical",
|
|
240
190
|
size: 4,
|
|
241
|
-
children:
|
|
242
|
-
children: item
|
|
243
|
-
}, item))
|
|
191
|
+
children: record.map(item => /*#__PURE__*/_jsx(React.Fragment, {
|
|
192
|
+
children: props.optionRender(item)
|
|
193
|
+
}, item[code]))
|
|
244
194
|
});
|
|
245
|
-
}
|
|
246
|
-
|
|
195
|
+
}
|
|
196
|
+
const labelList = value.map(v => {
|
|
197
|
+
const option = findOption(v);
|
|
198
|
+
if (!option) return '-';
|
|
199
|
+
return selectProps.showCodeName ? `${option[code]}-${option[label]}` : option?.[label];
|
|
200
|
+
});
|
|
201
|
+
return labelList?.join('、');
|
|
247
202
|
};
|
|
248
203
|
|
|
249
204
|
// 必须在早期 return 之前声明,确保每次渲染 hooks 调用数量一致(React Rules of Hooks)
|
|
250
|
-
const defaultFilterOption = useCallback(
|
|
251
|
-
if (option?.value == null) return false;
|
|
252
|
-
const optionLabel = option?.searchText ?? option?.title ?? option?.label;
|
|
253
|
-
return String(optionLabel ?? '').toLowerCase().includes(input.toLowerCase());
|
|
254
|
-
}, []);
|
|
205
|
+
const defaultFilterOption = useCallback(defaultFilterOptionFn, []);
|
|
255
206
|
const mergedShowSearch = useMemo(() => {
|
|
256
207
|
const defaultConfig = {
|
|
257
208
|
enabled: true,
|
|
@@ -285,6 +236,29 @@ export const ProSelect = (props, ref) => {
|
|
|
285
236
|
}
|
|
286
237
|
return defaultConfig;
|
|
287
238
|
}, [_onSearch, defaultFilterOption, selectProps.showSearch]);
|
|
239
|
+
let newSelectList = selectList;
|
|
240
|
+
if (otherProps?.listName && filterInList) {
|
|
241
|
+
newSelectList = getSelectList({
|
|
242
|
+
otherProps,
|
|
243
|
+
value,
|
|
244
|
+
dataSource: selectList,
|
|
245
|
+
labelInValue,
|
|
246
|
+
fieldNames,
|
|
247
|
+
mode: selectProps.mode
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// antd Select 的 options 仅随数据源/字段映射/展示配置变化;滚动重挂载与无关 rerender 时复用,
|
|
252
|
+
// 避免每次渲染全量重建 option 对象(落在虚拟表格挂载热路径上)。
|
|
253
|
+
// 依赖用 buildSelectOptions 实际消费的原始值(code/label/showCodeName/OptionRender),
|
|
254
|
+
// 而非每次新建的函数引用,避免缓存失效。
|
|
255
|
+
// 必须在 isView 早期 return 之前声明,确保每次渲染 hooks 调用数量一致(React Rules of Hooks)。
|
|
256
|
+
const selectOptions = useMemo(() => buildSelectOptions(newSelectList, {
|
|
257
|
+
code,
|
|
258
|
+
label,
|
|
259
|
+
showCodeName: selectProps.showCodeName,
|
|
260
|
+
optionRender: OptionRender
|
|
261
|
+
}), [newSelectList, code, label, selectProps.showCodeName, OptionRender]);
|
|
288
262
|
if (isView || props.isView) {
|
|
289
263
|
if (Array.isArray(value)) {
|
|
290
264
|
// 如果设置了maxTagCount且超出数量,需要截断显示
|
|
@@ -339,32 +313,6 @@ export const ProSelect = (props, ref) => {
|
|
|
339
313
|
return props.children;
|
|
340
314
|
};
|
|
341
315
|
const isReactElement = element => /*#__PURE__*/isValidElement(element);
|
|
342
|
-
const getInnerRecord = option => {
|
|
343
|
-
if (!option) return undefined;
|
|
344
|
-
if (option.record) return option.record;
|
|
345
|
-
if (option.data?.record) return option.data.record;
|
|
346
|
-
return undefined;
|
|
347
|
-
};
|
|
348
|
-
const getOptionText = item => {
|
|
349
|
-
if (OptionRender) {
|
|
350
|
-
const rendered = OptionRender(item);
|
|
351
|
-
return _isString(rendered) ? rendered : String(item[label] ?? '');
|
|
352
|
-
}
|
|
353
|
-
const text = selectProps.showCodeName ? `${item[code]}-${item[label]}` : item[label];
|
|
354
|
-
return _isString(text) ? text : String(text ?? '');
|
|
355
|
-
};
|
|
356
|
-
const buildOptionItem = (item, index) => {
|
|
357
|
-
const text = getOptionText(item);
|
|
358
|
-
return {
|
|
359
|
-
key: item[code] != null ? `${item[code]}-${index}` : `option-${index}`,
|
|
360
|
-
label: text,
|
|
361
|
-
value: item[code] != null ? item[code] : undefined,
|
|
362
|
-
disabled: !!item.disabled,
|
|
363
|
-
title: text,
|
|
364
|
-
searchText: text,
|
|
365
|
-
record: item
|
|
366
|
-
};
|
|
367
|
-
};
|
|
368
316
|
const selectOptionRender = option => {
|
|
369
317
|
const currentRecord = option?.data?.record || option?.record;
|
|
370
318
|
const text = option?.data?.searchText ?? option?.data?.title ?? option?.label ?? '';
|
|
@@ -383,103 +331,42 @@ export const ProSelect = (props, ref) => {
|
|
|
383
331
|
})
|
|
384
332
|
});
|
|
385
333
|
};
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
if (
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
Object.assign(item, currentRecord);
|
|
398
|
-
}
|
|
399
|
-
delete item.record;
|
|
400
|
-
delete item.children;
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
if (labelInValue) {
|
|
404
|
-
onChange?.(getChangeValue ? getChangeValue(getValueObject(value)) : getValueObject(value), option);
|
|
405
|
-
} else {
|
|
406
|
-
onChange?.(getChangeValue ? getChangeValue(value) : value, option);
|
|
407
|
-
}
|
|
408
|
-
} else if (!selectProps.mode && labelInValue) {
|
|
409
|
-
onChange(getChangeValue ? getChangeValue(getValueObject(value)) : getValueObject(value), option);
|
|
410
|
-
} else {
|
|
411
|
-
onChange?.(getChangeValue ? getChangeValue(value) : value, getInnerRecord(_option));
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* 处理 labelInValue 模式下值的回填
|
|
417
|
-
* @returns
|
|
418
|
-
*/
|
|
419
|
-
const transformValue = () => {
|
|
420
|
-
if (labelInValue && !selectProps.mode) {
|
|
421
|
-
if (!_isObject(value)) {
|
|
422
|
-
return undefined;
|
|
423
|
-
}
|
|
424
|
-
return value?.[code] || value?.value;
|
|
425
|
-
}
|
|
426
|
-
if (labelInValue && selectProps.mode) {
|
|
427
|
-
// 对传入的值做一些基础判断
|
|
428
|
-
if (!Array.isArray(value)) {
|
|
429
|
-
return [];
|
|
430
|
-
}
|
|
431
|
-
return value.map(item => item?.[code]);
|
|
432
|
-
}
|
|
433
|
-
// Handling Jialuo's Extreme Demands
|
|
434
|
-
if (selectProps.mode && value === null) {
|
|
435
|
-
return undefined;
|
|
436
|
-
}
|
|
437
|
-
// 只有当 dataSource 只有一个值时才默认回填(只返回值,不进行状态更新)
|
|
438
|
-
if (defaultOne && !value && !isDefaultOne && selectList?.length === 1) {
|
|
439
|
-
const option = flatOptions[0];
|
|
440
|
-
// selectList 可能是异步回来的值
|
|
441
|
-
if (option) {
|
|
442
|
-
return option?.[code];
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
// 修复空字符placeholder不显示
|
|
446
|
-
if (value === '') {
|
|
447
|
-
return undefined;
|
|
448
|
-
}
|
|
449
|
-
return value;
|
|
450
|
-
};
|
|
451
|
-
let newSelectList = selectList;
|
|
452
|
-
if (otherProps?.listName && filterInList) {
|
|
453
|
-
newSelectList = getSelectList({
|
|
454
|
-
otherProps,
|
|
455
|
-
value,
|
|
456
|
-
dataSource: selectList,
|
|
457
|
-
labelInValue,
|
|
458
|
-
fieldNames,
|
|
459
|
-
mode: selectProps.mode
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
// antd Select 的 options 仅随数据源/字段映射/展示配置变化;滚动重挂载与无关 rerender 时复用,
|
|
464
|
-
// 避免每次渲染全量重建 option 对象(落在虚拟表格挂载热路径上)。
|
|
465
|
-
// 依赖用 buildOptionItem 实际消费的原始值(code/label/showCodeName/OptionRender),
|
|
466
|
-
// 而非每次新建的 buildOptionItem 函数引用,避免缓存失效。
|
|
467
|
-
const selectOptions = useMemo(() => {
|
|
468
|
-
if (!Array.isArray(newSelectList)) {
|
|
469
|
-
return [];
|
|
334
|
+
const mode = selectProps.mode;
|
|
335
|
+
const handleChange = (value, rawOption) => {
|
|
336
|
+
// 仅多选、或单选 labelInValue 需要加工 option;其余直接取原始节点上的 record
|
|
337
|
+
if (mode !== 'multiple' && !(labelInValue && !mode)) {
|
|
338
|
+
onChange?.(computeChangeValue(value, {
|
|
339
|
+
mode,
|
|
340
|
+
getChangeValue,
|
|
341
|
+
flatOptions,
|
|
342
|
+
code
|
|
343
|
+
}), getInnerRecord(rawOption));
|
|
344
|
+
return;
|
|
470
345
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
label: item[label],
|
|
477
|
-
options: groupOptions.map((opt, optIndex) => buildOptionItem(opt, optIndex))
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
return buildOptionItem(item, index);
|
|
346
|
+
// labelInValue 下,option/其首层子节点是 React 节点时取挂载的 record
|
|
347
|
+
const isReactNode = labelInValue && (isReactElement(rawOption) || isReactElement(rawOption?.children));
|
|
348
|
+
const option = resolveChangeOption(rawOption, {
|
|
349
|
+
mode,
|
|
350
|
+
isReactNode
|
|
481
351
|
});
|
|
482
|
-
|
|
352
|
+
onChange?.(computeChangeValue(value, {
|
|
353
|
+
labelInValue,
|
|
354
|
+
mode,
|
|
355
|
+
getChangeValue,
|
|
356
|
+
flatOptions,
|
|
357
|
+
code
|
|
358
|
+
}), option);
|
|
359
|
+
};
|
|
360
|
+
const transformValue = () => computeTransformValue({
|
|
361
|
+
value,
|
|
362
|
+
labelInValue,
|
|
363
|
+
mode,
|
|
364
|
+
defaultOne,
|
|
365
|
+
isDefaultOne,
|
|
366
|
+
selectList,
|
|
367
|
+
flatOptions,
|
|
368
|
+
code
|
|
369
|
+
});
|
|
483
370
|
return /*#__PURE__*/_jsx("div", {
|
|
484
371
|
style: props.style,
|
|
485
372
|
className: "pro-select",
|