@lingxiteam/ebe-utils 0.5.5 → 0.5.7
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/lib/pcpublic/src/components/pcfactory/src/DynamicTabs/index.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/StdUpload/assets/closeIcon.png +0 -0
- package/lib/pcpublic/src/components/pcfactory/src/StdUpload/assets/fileName.png +0 -0
- package/lib/pcpublic/src/components/pcfactory/src/StdUpload/assets/img.png +0 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFormatCell.ts +279 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/customLocale.tsx +6 -0
- package/lib/public/src/components/ExpBusiObjModal/index.less +28 -0
- package/lib/public/src/components/ExpBusiObjModal/index.tsx +315 -0
- package/lib/public/src/components/PreviewFile/index.less +200 -0
- package/lib/public/src/components/PreviewFile/index.tsx +787 -0
- package/lib/public/src/components/PreviewFile/utils.ts +90 -0
- package/lib/public/src/components/common/PreviewFile/index.less +200 -0
- package/lib/public/src/components/common/PreviewFile/index.tsx +787 -0
- package/lib/public/src/components/common/PreviewFile/utils.ts +90 -0
- package/lib/public/src/components/pcfactory/src/Alert/index.tsx +22 -0
- package/lib/public/src/components/pcfactory/src/Animation/index.tsx +186 -0
- package/lib/public/src/components/pcfactory/src/Animation/useAnimation.ts +270 -0
- package/lib/public/src/components/pcfactory/src/Animation/useBackgroundStyle.ts +74 -0
- package/lib/public/src/components/pcfactory/src/Audio/index.tsx +240 -0
- package/lib/public/src/components/pcfactory/src/BarChart/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Button/index.tsx +151 -0
- package/lib/public/src/components/pcfactory/src/Card/index.tsx +201 -0
- package/lib/public/src/components/pcfactory/src/Card/useExtendBtn.tsx +195 -0
- package/lib/public/src/components/pcfactory/src/Cascader/index.tsx +398 -0
- package/lib/public/src/components/pcfactory/src/ChartBar/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/ChartBar/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/ChartLine.tsx +48 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/PropsType.ts +88 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Checkbox/index.tsx +144 -0
- package/lib/public/src/components/pcfactory/src/CheckboxGroup/index.tsx +319 -0
- package/lib/public/src/components/pcfactory/src/Collapse/index.tsx +195 -0
- package/lib/public/src/components/pcfactory/src/CollapsePanel/index.tsx +186 -0
- package/lib/public/src/components/pcfactory/src/Condition/index.tsx +22 -0
- package/lib/public/src/components/pcfactory/src/DatePicker/index.tsx +756 -0
- package/lib/public/src/components/pcfactory/src/Description/index.tsx +447 -0
- package/lib/public/src/components/pcfactory/src/Description/utils/getLabelSizeMode.ts +40 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/CenterLineDivider/index.tsx +190 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/CenterTabDivider/index.tsx +77 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftCardDivider/index.tsx +87 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftLineDivider/index.tsx +106 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftTabDivider/index.tsx +60 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftTopDivider/index.tsx +55 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxDashed/index.module.less +10 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxDashed/index.tsx +143 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxSolid/index.module.less +10 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxSolid/index.tsx +126 -0
- package/lib/public/src/components/pcfactory/src/Divider/index.tsx +210 -0
- package/lib/public/src/components/pcfactory/src/Dropdown/index.tsx +385 -0
- package/lib/public/src/components/pcfactory/src/DynamicTabs/PropsType.ts +31 -0
- package/lib/public/src/components/pcfactory/src/DynamicTabs/TabPage.tsx +63 -0
- package/lib/public/src/components/pcfactory/src/DynamicTabs/index.tsx +214 -0
- package/lib/public/src/components/pcfactory/src/Form/Form.tsx +600 -0
- package/lib/public/src/components/pcfactory/src/Form/WrapperForm.ts +14 -0
- package/lib/public/src/components/pcfactory/src/Form/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/Form/useFormStatus.ts +47 -0
- package/lib/public/src/components/pcfactory/src/Form/useMonitor.ts +40 -0
- package/lib/public/src/components/pcfactory/src/FormGroup/TitleComp.tsx +107 -0
- package/lib/public/src/components/pcfactory/src/FormGroup/index.tsx +181 -0
- package/lib/public/src/components/pcfactory/src/FreeLayout/index.tsx +151 -0
- package/lib/public/src/components/pcfactory/src/Gantt/Gantt.tsx +460 -0
- package/lib/public/src/components/pcfactory/src/Gantt/const.ts +122 -0
- package/lib/public/src/components/pcfactory/src/Gantt/index.tsx +16 -0
- package/lib/public/src/components/pcfactory/src/Gantt/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/GridView/GridView.tsx +435 -0
- package/lib/public/src/components/pcfactory/src/GridView/index.tsx +24 -0
- package/lib/public/src/components/pcfactory/src/GridView/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/HorizontalView/index.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/Icon/IconED/index.tsx +42 -0
- package/lib/public/src/components/pcfactory/src/Icon/PropsType.ts +57 -0
- package/lib/public/src/components/pcfactory/src/Icon/hooks/index.tsx +300 -0
- package/lib/public/src/components/pcfactory/src/Icon/index.tsx +69 -0
- package/lib/public/src/components/pcfactory/src/IconFont/index.tsx +24 -0
- package/lib/public/src/components/pcfactory/src/Img/BasicImage/index.tsx +90 -0
- package/lib/public/src/components/pcfactory/src/Img/assets/placeholder.png +0 -0
- package/lib/public/src/components/pcfactory/src/Img/index.tsx +91 -0
- package/lib/public/src/components/pcfactory/src/Input/index.tsx +425 -0
- package/lib/public/src/components/pcfactory/src/InputNumber/index.tsx +263 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +23 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/PropsType.ts +11 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/index.less +6 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +25 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/PropsType.ts +9 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/index.less +7 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/index.tsx +17 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Layout/index.tsx +130 -0
- package/lib/public/src/components/pcfactory/src/Layout/utils.ts +48 -0
- package/lib/public/src/components/pcfactory/src/LineChart/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Link/index.tsx +117 -0
- package/lib/public/src/components/pcfactory/src/LoopList/index.tsx +551 -0
- package/lib/public/src/components/pcfactory/src/Menu/index.tsx +422 -0
- package/lib/public/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +95 -0
- package/lib/public/src/components/pcfactory/src/ModalSelect/index.tsx +453 -0
- package/lib/public/src/components/pcfactory/src/MultipleSelect/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Pagination/index.tsx +104 -0
- package/lib/public/src/components/pcfactory/src/Password/index.tsx +88 -0
- package/lib/public/src/components/pcfactory/src/PictureVerifyCode/assets/placeholder.png +0 -0
- package/lib/public/src/components/pcfactory/src/PictureVerifyCode/index.tsx +76 -0
- package/lib/public/src/components/pcfactory/src/PieChart/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Progress/index.tsx +155 -0
- package/lib/public/src/components/pcfactory/src/QRCode/const.ts +5 -0
- package/lib/public/src/components/pcfactory/src/QRCode/index.tsx +146 -0
- package/lib/public/src/components/pcfactory/src/QuillEditor/QuillEditor.tsx +197 -0
- package/lib/public/src/components/pcfactory/src/QuillEditor/index.tsx +37 -0
- package/lib/public/src/components/pcfactory/src/QuillEditor/loader.ts +12 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/RadarChartHook.ts +449 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/RadarChartType.ts +39 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/RadarECharts.tsx +86 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/index.tsx +16 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/radarDefaultConfig.js +55 -0
- package/lib/public/src/components/pcfactory/src/Radio/index.tsx +260 -0
- package/lib/public/src/components/pcfactory/src/RangePicker/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Rate/index.tsx +187 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/PropsType.ts +37 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/ReactECharts.tsx +672 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/index.tsx +26 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/components/FishRender.tsx +31 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/components/ReactRender.tsx +55 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/components/VueRender.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/constant.ts +9 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/index.tsx +82 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/remote-component.config.ts +12 -0
- package/lib/public/src/components/pcfactory/src/Result/index.tsx +27 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +105 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +234 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +41 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/index.tsx +33 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/loader.ts +12 -0
- package/lib/public/src/components/pcfactory/src/Row/Row.tsx +66 -0
- package/lib/public/src/components/pcfactory/src/Row/index.tsx +9 -0
- package/lib/public/src/components/pcfactory/src/Row/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Select/index.tsx +628 -0
- package/lib/public/src/components/pcfactory/src/Select/selectUtils.ts +257 -0
- package/lib/public/src/components/pcfactory/src/Slider/index.tsx +351 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/DownloadProgress/DownloadProgress.tsx +27 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/DownloadProgress/index.ts +3 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/UploadItem.tsx +257 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/default.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/js.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/pdf.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/ppt.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/txt.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/word.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/xls.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/zip.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/index.tsx +1050 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/uploadItem.less +64 -0
- package/lib/public/src/components/pcfactory/src/Steps/constant/checkcircle.tsx +29 -0
- package/lib/public/src/components/pcfactory/src/Steps/constant/index.ts +2 -0
- package/lib/public/src/components/pcfactory/src/Steps/constant/vector.tsx +13 -0
- package/lib/public/src/components/pcfactory/src/Steps/index.tsx +343 -0
- package/lib/public/src/components/pcfactory/src/SuperSelect/ComSelect.tsx +538 -0
- package/lib/public/src/components/pcfactory/src/SuperSelect/index.tsx +127 -0
- package/lib/public/src/components/pcfactory/src/SuperSelect/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Swiper/index.tsx +184 -0
- package/lib/public/src/components/pcfactory/src/Switch/index.tsx +219 -0
- package/lib/public/src/components/pcfactory/src/TabPane/index.tsx +145 -0
- package/lib/public/src/components/pcfactory/src/Table/BodyCell/index.tsx +278 -0
- package/lib/public/src/components/pcfactory/src/Table/EditComponent/index.tsx +554 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +34 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +26 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +41 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +34 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/index.tsx +227 -0
- package/lib/public/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +63 -0
- package/lib/public/src/components/pcfactory/src/Table/HeaderCell/index.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/Table/TableHead/index.tsx +501 -0
- package/lib/public/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +46 -0
- package/lib/public/src/components/pcfactory/src/Table/constant.ts +73 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/index.ts +32 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +325 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +176 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useColumns.tsx +1851 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useCommon.ts +39 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useDataSource.ts +201 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +324 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useFilter.tsx +274 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useFormatCell.ts +309 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/usePagination.ts +104 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +302 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +93 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useScroll.ts +120 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useSelection.ts +467 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useSort.ts +39 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +191 -0
- package/lib/public/src/components/pcfactory/src/Table/index.tsx +525 -0
- package/lib/public/src/components/pcfactory/src/Table/utils/SequenceId.ts +104 -0
- package/lib/public/src/components/pcfactory/src/Table/utils/index.ts +442 -0
- package/lib/public/src/components/pcfactory/src/Tabs/index.tsx +209 -0
- package/lib/public/src/components/pcfactory/src/Tag/index.tsx +39 -0
- package/lib/public/src/components/pcfactory/src/Text/index.tsx +191 -0
- package/lib/public/src/components/pcfactory/src/TextArea/ForIETextArea.tsx +96 -0
- package/lib/public/src/components/pcfactory/src/TextArea/index.tsx +255 -0
- package/lib/public/src/components/pcfactory/src/TimePicker/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/TlrView/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/PropsType.ts +22 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/TooltipViewED/index.tsx +10 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/hooks/index.tsx +90 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/index.tsx +13 -0
- package/lib/public/src/components/pcfactory/src/Transfer/index.tsx +753 -0
- package/lib/public/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +102 -0
- package/lib/public/src/components/pcfactory/src/Tree/index.tsx +1303 -0
- package/lib/public/src/components/pcfactory/src/TreeSelect/index.tsx +639 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +82 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +61 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/index.tsx +273 -0
- package/lib/public/src/components/pcfactory/src/Upload/Upload.tsx +740 -0
- package/lib/public/src/components/pcfactory/src/Upload/index.tsx +29 -0
- package/lib/public/src/components/pcfactory/src/Upload/loader.tsx +13 -0
- package/lib/public/src/components/pcfactory/src/VerificationCode/assets/placeholder.png +0 -0
- package/lib/public/src/components/pcfactory/src/VerificationCode/index.tsx +297 -0
- package/lib/public/src/components/pcfactory/src/VerticalView/index.tsx +25 -0
- package/lib/public/src/components/pcfactory/src/VideoPlayer/index.tsx +159 -0
- package/lib/public/src/components/pcfactory/src/View/index.tsx +150 -0
- package/lib/public/src/components/pcfactory/src/View/useBackgroundStyle.ts +75 -0
- package/lib/public/src/components/pcfactory/src/VirtualGroup/index.tsx +16 -0
- package/lib/public/src/components/pcfactory/src/Webview/index.tsx +104 -0
- package/lib/public/src/components/pcfactory/src/index.component.ts +253 -0
- package/lib/public/src/components/pcfactory/src/styles/common.less +107 -0
- package/lib/public/src/components/pcfactory/src/styles/compatible.less +976 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Alert.less +25 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Audio.less +198 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Button.less +32 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Card.less +155 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Cascader.less +54 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Checkbox.less +7 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Collapse.less +214 -0
- package/lib/public/src/components/pcfactory/src/styles/components/DatePicker.less +22 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Description.less +64 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Divider.less +530 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Drawer.less +54 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Dropdown.less +11 -0
- package/lib/public/src/components/pcfactory/src/styles/components/DynamicDataContainer.less +16 -0
- package/lib/public/src/components/pcfactory/src/styles/components/DynamicTabs.less +254 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Form.less +265 -0
- package/lib/public/src/components/pcfactory/src/styles/components/FormGroup.less +111 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Gantt.less +139 -0
- package/lib/public/src/components/pcfactory/src/styles/components/GridView.less +62 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Icon.less +20 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Input.less +164 -0
- package/lib/public/src/components/pcfactory/src/styles/components/InputNumber.less +124 -0
- package/lib/public/src/components/pcfactory/src/styles/components/InputPassword.less +3 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Link.less +4 -0
- package/lib/public/src/components/pcfactory/src/styles/components/LoopList.less +67 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Menu.less +54 -0
- package/lib/public/src/components/pcfactory/src/styles/components/ModalSelect.less +42 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Popconfirm.less +7 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Progress.less +57 -0
- package/lib/public/src/components/pcfactory/src/styles/components/QuillEditor.less +15 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Radio.less +7 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Rate.less +16 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Result.less +26 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Select.less +146 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Slider.less +78 -0
- package/lib/public/src/components/pcfactory/src/styles/components/StdUpload.less +225 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Step.less +91 -0
- package/lib/public/src/components/pcfactory/src/styles/components/SuperSelect.less +83 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Swiper.less +106 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Switch.less +49 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Table.less +1229 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Tabs.less +291 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Tag.less +107 -0
- package/lib/public/src/components/pcfactory/src/styles/components/TextArea.less +12 -0
- package/lib/public/src/components/pcfactory/src/styles/components/TooltipView.less +43 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Transfer.less +155 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Tree.less +329 -0
- package/lib/public/src/components/pcfactory/src/styles/components/TreeSelect.less +65 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Upload.less +26 -0
- package/lib/public/src/components/pcfactory/src/styles/components/VerificationCode.less +162 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Webview.less +31 -0
- package/lib/public/src/components/pcfactory/src/styles/index.less +10 -0
- package/lib/public/src/components/pcfactory/src/styles/index.ued.less +65 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/antdVariables.less +84 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/common.less +9 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/customVariables.less +35 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/index.less +2 -0
- package/lib/public/src/components/pcfactory/src/utils/ChannelContainer.tsx +150 -0
- package/lib/public/src/components/pcfactory/src/utils/ChildRender.ts +103 -0
- package/lib/public/src/components/pcfactory/src/utils/CustomModule.tsx +134 -0
- package/lib/public/src/components/pcfactory/src/utils/DummyFormContext.ts +136 -0
- package/lib/public/src/components/pcfactory/src/utils/Empty/customLocale.tsx +6 -0
- package/lib/public/src/components/pcfactory/src/utils/Empty/empty.tsx +37 -0
- package/lib/public/src/components/pcfactory/src/utils/LoaderHelper.tsx +29 -0
- package/lib/public/src/components/pcfactory/src/utils/PropsType.ts +21 -0
- package/lib/public/src/components/pcfactory/src/utils/WithSyncValue.ts +218 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/index.ts +22 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useCreation.ts +23 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useDeepCompareEffect.ts +27 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useMap.ts +46 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +27 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/usePrevious.ts +19 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useSetState.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useUnmountedRef.ts +14 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useUpdate.ts +9 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useUpdateEffect.ts +16 -0
- package/lib/public/src/components/pcfactory/src/utils/basicStatusTransfer.ts +32 -0
- package/lib/public/src/components/pcfactory/src/utils/common.ts +367 -0
- package/lib/public/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +106 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +131 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +646 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +123 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +411 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/common.ts +28 -0
- package/lib/public/src/components/pcfactory/src/utils/getExportDefaultObj.ts +11 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +140 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useDataMask.ts +83 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +63 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +86 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +41 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +43 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +90 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useListenState.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useLocale.ts +129 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +80 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useRules.ts +89 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +33 -0
- package/lib/public/src/components/pcfactory/src/utils/index.ts +19 -0
- package/lib/public/src/components/pcfactory/src/utils/polyfill.js +305 -0
- package/lib/public/src/components/pcfactory/src/utils/renderReadOnly.tsx +105 -0
- package/lib/public/src/components/pcfactory/src/variables.ts +2 -0
- package/lib/public/src/components/pcfactory/typings.d.ts +27 -0
- package/lib/public/src/hooks/useGenerateContext.ts +73 -0
- package/lib/public/src/styles/common.less +41 -0
- package/lib/public/src/styles/index.less +4 -0
- package/lib/public/src/styles/index.ts +1 -0
- package/lib/public/src/styles/theme/variables.less +130 -0
- package/lib/public/src/utils/LcdpSpin/index.less +13 -0
- package/lib/public/src/utils/LcdpSpin/index.tsx +12 -0
- package/lib/public/src/utils/ModalManager/Drawer/index.less +30 -0
- package/lib/public/src/utils/ModalManager/Drawer/index.tsx +109 -0
- package/lib/public/src/utils/ModalManager/Modal/index.less +7 -0
- package/lib/public/src/utils/ModalManager/Modal/index.tsx +96 -0
- package/lib/public/src/utils/ModalManager/index.tsx +278 -0
- package/lib/public/src/utils/Security/encipher/des.ts +52 -0
- package/lib/public/src/utils/customFuncMapping.ts +107 -0
- package/lib/public/src/utils/formUtils.ts +458 -0
- package/lib/public/src/utils/i18n/i18n.ts +15 -0
- package/lib/public/src/utils/i18n/index.ts +7 -0
- package/lib/public/src/utils/i18n/locale/app/en_US.ts +77 -0
- package/lib/public/src/utils/i18n/locale/app/index.ts +9 -0
- package/lib/public/src/utils/i18n/locale/app/otherLocale.ts +2 -0
- package/lib/public/src/utils/i18n/locale/app/zh_CN.ts +65 -0
- package/lib/public/src/utils/i18n/locale/app/zh_HK.ts +66 -0
- package/lib/public/src/utils/i18n/locale/base/en_US.ts +449 -0
- package/lib/public/src/utils/i18n/locale/base/index.ts +5 -0
- package/lib/public/src/utils/i18n/locale/base/zh_CN.ts +413 -0
- package/lib/public/src/utils/i18n/locale/base/zh_HK.ts +411 -0
- package/lib/public/src/utils/i18n/locale/pc/en_US.ts +131 -0
- package/lib/public/src/utils/i18n/locale/pc/index.ts +9 -0
- package/lib/public/src/utils/i18n/locale/pc/otherLocale.ts +2 -0
- package/lib/public/src/utils/i18n/locale/pc/zh_CN.ts +105 -0
- package/lib/public/src/utils/i18n/locale/pc/zh_HK.ts +105 -0
- package/lib/public/src/utils/i18n/localeMonitor.ts +71 -0
- package/lib/public/src/utils/i18n/locales.ts +30 -0
- package/lib/public/src/utils/i18n/replaceMessage.ts +29 -0
- package/lib/public/src/utils/i18n/types.ts +2 -0
- package/lib/public/src/utils/i18n/useLocale.ts +129 -0
- package/lib/public/src/utils/messageApi.ts +93 -0
- package/lib/public/src/utils/service/commonFetch.ts +1 -1
- package/lib/public/src/utils/useTool.ts +428 -0
- package/package.json +2 -2
- /package/lib/public/src/utils/functors/{dateAdd.ts → DATEADD.ts} +0 -0
|
@@ -0,0 +1,1303 @@
|
|
|
1
|
+
/* eslint-disable no-underscore-dangle */
|
|
2
|
+
/* eslint-disable eqeqeq */
|
|
3
|
+
/* eslint-disable no-param-reassign */
|
|
4
|
+
import { EllipsisOutlined } from '@ant-design/icons';
|
|
5
|
+
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
6
|
+
import { Dropdown, Input, Menu, Popconfirm, Tooltip, Tree } from 'antd';
|
|
7
|
+
import classnames from 'classnames';
|
|
8
|
+
import { uniq } from 'lodash';
|
|
9
|
+
import React, {
|
|
10
|
+
useEffect,
|
|
11
|
+
useImperativeHandle,
|
|
12
|
+
useMemo,
|
|
13
|
+
useRef,
|
|
14
|
+
useState,
|
|
15
|
+
} from 'react';
|
|
16
|
+
import Icon from '../Icon';
|
|
17
|
+
import { useListenProps } from '../utils';
|
|
18
|
+
import CustomModule from '../utils/CustomModule';
|
|
19
|
+
import { useFuncExpExecute } from '../utils/hooks/useFuncExpExecute';
|
|
20
|
+
import { useLocale } from '../utils/hooks/useLocale';
|
|
21
|
+
import TreeNodeMenu from './TreeNodeMenu';
|
|
22
|
+
|
|
23
|
+
const SERVICE_SOURCE = {
|
|
24
|
+
// 服务来源
|
|
25
|
+
APP: 'app', // 应用内部 & 模型生成
|
|
26
|
+
QUERY: 'query', // 解析服务
|
|
27
|
+
STD: 'std', // 编排服务
|
|
28
|
+
INNER: 'inner', // 高代码服务
|
|
29
|
+
PLATFORM: 'platform', // 平台服务
|
|
30
|
+
ATOM: 'atom', // 外部服务(低代码运营平台的原子服务)
|
|
31
|
+
RHIN: 'rhin', // 业务运营服务
|
|
32
|
+
SCENE: 'scene', // 业务运营场景服务
|
|
33
|
+
OBJECT: 'object', // 业务对象生成服务
|
|
34
|
+
};
|
|
35
|
+
const { TreeNode } = Tree;
|
|
36
|
+
const iconMapFn = (getLocale?: Function) => ({
|
|
37
|
+
add: {
|
|
38
|
+
icon: 'lcdp-icon-tianjia-da',
|
|
39
|
+
name: getLocale?.('add'),
|
|
40
|
+
},
|
|
41
|
+
edit: {
|
|
42
|
+
icon: 'lcdp-icon-zidingyi',
|
|
43
|
+
name: getLocale?.('edit'),
|
|
44
|
+
},
|
|
45
|
+
delete: {
|
|
46
|
+
icon: 'lcdp-icon-shanchu',
|
|
47
|
+
name: getLocale?.('delete'),
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export interface MyTreeProps {
|
|
52
|
+
visible?: boolean;
|
|
53
|
+
isAsync?: boolean;
|
|
54
|
+
treeData: any[];
|
|
55
|
+
defaultExpandAll?: boolean;
|
|
56
|
+
asyncService?: any;
|
|
57
|
+
treeService?: any;
|
|
58
|
+
dataSource?: any;
|
|
59
|
+
onSelect?: (
|
|
60
|
+
key: any,
|
|
61
|
+
data: any,
|
|
62
|
+
parentNodeKey: any,
|
|
63
|
+
parentNodeData: any,
|
|
64
|
+
) => void;
|
|
65
|
+
onCheck?: (checked: any) => void;
|
|
66
|
+
onDataSourceRelease?: (e: any) => void;
|
|
67
|
+
onSelectedKeysRelease?: (e: any) => void;
|
|
68
|
+
nodeIcons?: any[];
|
|
69
|
+
onNodeAdd?: (
|
|
70
|
+
key: any,
|
|
71
|
+
data: any,
|
|
72
|
+
parentNodeKey: any,
|
|
73
|
+
parentNodeData: any,
|
|
74
|
+
) => void;
|
|
75
|
+
onNodeEdit?: (
|
|
76
|
+
key: any,
|
|
77
|
+
data: any,
|
|
78
|
+
parentNodeKey: any,
|
|
79
|
+
parentNodeData: any,
|
|
80
|
+
) => void;
|
|
81
|
+
onNodeDelete?: (
|
|
82
|
+
key: any,
|
|
83
|
+
data: any,
|
|
84
|
+
parentNodeKey: any,
|
|
85
|
+
parentNodeData: any,
|
|
86
|
+
) => void;
|
|
87
|
+
onEditingKeyRelease?: (e: any) => void;
|
|
88
|
+
onSelectedDataRelease?: (e: any) => void;
|
|
89
|
+
onCheckedKeysRelease?: (e: any) => void;
|
|
90
|
+
onSelectAllRelease?: () => void;
|
|
91
|
+
className?: any;
|
|
92
|
+
showLineIcon?: boolean;
|
|
93
|
+
selectedKeys?: string;
|
|
94
|
+
checkedKeys?: string;
|
|
95
|
+
disabled?: boolean;
|
|
96
|
+
onExpand?: any;
|
|
97
|
+
treeNodeIcon?: any;
|
|
98
|
+
appId?: string;
|
|
99
|
+
showSearch?: boolean;
|
|
100
|
+
isSelectAll?: boolean;
|
|
101
|
+
checkable?: boolean;
|
|
102
|
+
rightMenuInfo?: any;
|
|
103
|
+
onRightClickNode?: (
|
|
104
|
+
key: any,
|
|
105
|
+
data: any,
|
|
106
|
+
isLoaded: boolean,
|
|
107
|
+
parentNodeKey: any,
|
|
108
|
+
parentNodeData: any,
|
|
109
|
+
) => void;
|
|
110
|
+
onClickMenuItem?: (key: string, menuData: any, path: any[]) => void;
|
|
111
|
+
customRenderCode?: any;
|
|
112
|
+
expandedKey?: any;
|
|
113
|
+
closeExpandedKey?: any;
|
|
114
|
+
showLine?: any;
|
|
115
|
+
getEngineApis: any;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// const prefixCls = 'tree';
|
|
119
|
+
|
|
120
|
+
const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
121
|
+
const {
|
|
122
|
+
visible = true,
|
|
123
|
+
treeData,
|
|
124
|
+
isAsync,
|
|
125
|
+
asyncService,
|
|
126
|
+
defaultExpandAll,
|
|
127
|
+
onSelect,
|
|
128
|
+
onCheck,
|
|
129
|
+
nodeIcons,
|
|
130
|
+
onNodeAdd,
|
|
131
|
+
onNodeEdit,
|
|
132
|
+
onNodeDelete,
|
|
133
|
+
onRightClickNode,
|
|
134
|
+
className,
|
|
135
|
+
showLineIcon,
|
|
136
|
+
onExpand,
|
|
137
|
+
appId,
|
|
138
|
+
treeNodeIcon,
|
|
139
|
+
showSearch,
|
|
140
|
+
rightMenuInfo,
|
|
141
|
+
onClickMenuItem,
|
|
142
|
+
customRenderCode,
|
|
143
|
+
getEngineApis,
|
|
144
|
+
...resetProps
|
|
145
|
+
} = props;
|
|
146
|
+
|
|
147
|
+
const [closeExpandedKey, setCloseExpandedKey] = useListenProps(
|
|
148
|
+
props.closeExpandedKey,
|
|
149
|
+
);
|
|
150
|
+
const [expandedKey, setExpandedKey] = useListenProps(props.expandedKey);
|
|
151
|
+
|
|
152
|
+
// 加载数据字段映射
|
|
153
|
+
const [treeService, setTreeService] = useListenProps(props.treeService);
|
|
154
|
+
// 加载数据
|
|
155
|
+
const [dataSource, setDataSource] = useListenProps(props.dataSource);
|
|
156
|
+
|
|
157
|
+
const engineApis = getEngineApis?.() || {};
|
|
158
|
+
|
|
159
|
+
const { sandBoxSafeRun, sandBoxLoadModule } = engineApis;
|
|
160
|
+
|
|
161
|
+
const { getLocale } = useLocale(engineApis);
|
|
162
|
+
|
|
163
|
+
const iconMap: any = iconMapFn(getLocale);
|
|
164
|
+
|
|
165
|
+
const funcExpExecute = useFuncExpExecute(sandBoxSafeRun, getLocale);
|
|
166
|
+
|
|
167
|
+
const [data, setData] = useState<any[]>(treeService ? [] : treeData);
|
|
168
|
+
const [selectedKeys, setSelectedKeys] = useState<any[]>([]);
|
|
169
|
+
|
|
170
|
+
// 当前选中数据
|
|
171
|
+
const [selectedDataList, setSelectDataList] = useState<any[]>([]);
|
|
172
|
+
|
|
173
|
+
const [checkedKeys, setCheckedKeys] = useState<any[]>([]);
|
|
174
|
+
const [loadedKeys, setLoadedKeys] = useState<any[]>([]);
|
|
175
|
+
const [isSelectAll, setIsSelectAll] = useState<boolean>(
|
|
176
|
+
props?.isSelectAll || false,
|
|
177
|
+
);
|
|
178
|
+
const [expandedKeys, setExpandedKeys] = useState<any[]>([]);
|
|
179
|
+
const [searchVal, setSearchVal] = useState('');
|
|
180
|
+
const [showRightMenu, setShowRightMenu] = useState<any>({});
|
|
181
|
+
const [rightMenuData, setRightMenuData] = useState<any>(
|
|
182
|
+
props.rightMenuInfo ?? {},
|
|
183
|
+
);
|
|
184
|
+
const [popVisible, setPopVisible] = useState<any>({});
|
|
185
|
+
const scrollIntoViewComp = useRef(false);
|
|
186
|
+
const treeWrapRef = useRef<any>();
|
|
187
|
+
|
|
188
|
+
// 当前操作字段key
|
|
189
|
+
const [editingKey, setEditingKey] = useState('');
|
|
190
|
+
|
|
191
|
+
useImperativeHandle(ref, () => ({
|
|
192
|
+
get dataSource() {
|
|
193
|
+
return data;
|
|
194
|
+
},
|
|
195
|
+
setDataSource(_data: any[]) {
|
|
196
|
+
setDataSource(_data);
|
|
197
|
+
},
|
|
198
|
+
setStateMap(stateMap: any) {
|
|
199
|
+
if (stateMap?.treeService) {
|
|
200
|
+
setTreeService(stateMap.treeService);
|
|
201
|
+
}
|
|
202
|
+
if (Array.isArray(stateMap?.dataSource)) {
|
|
203
|
+
setDataSource([...stateMap.dataSource]);
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
// 获取选中数据
|
|
207
|
+
getSelectedData() {
|
|
208
|
+
return selectedDataList;
|
|
209
|
+
},
|
|
210
|
+
// 获取当前操作的key
|
|
211
|
+
get editingKey() {
|
|
212
|
+
return editingKey;
|
|
213
|
+
},
|
|
214
|
+
get selectedKeys() {
|
|
215
|
+
return selectedKeys;
|
|
216
|
+
},
|
|
217
|
+
get checkedKeys() {
|
|
218
|
+
return checkedKeys;
|
|
219
|
+
},
|
|
220
|
+
setCheckedKeys(keys: any[]) {
|
|
221
|
+
setCheckedKeys(keys);
|
|
222
|
+
},
|
|
223
|
+
// 设置全部选中
|
|
224
|
+
setSelectAll(_flag: boolean) {
|
|
225
|
+
setIsSelectAll(_flag);
|
|
226
|
+
},
|
|
227
|
+
setSelectedKeys(keys: any[]) {
|
|
228
|
+
if (Array.isArray(keys)) {
|
|
229
|
+
setSelectedKeys(keys);
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
setRightMenuData(rightInfo: any) {
|
|
233
|
+
setRightMenuData(rightInfo);
|
|
234
|
+
},
|
|
235
|
+
setExpandedKey(_keys: any[]) {
|
|
236
|
+
setExpandedKey(_keys);
|
|
237
|
+
},
|
|
238
|
+
setCloseExpandedKey(_keys: any[]) {
|
|
239
|
+
setCloseExpandedKey(_keys);
|
|
240
|
+
},
|
|
241
|
+
}));
|
|
242
|
+
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
if (rightMenuData) {
|
|
245
|
+
const { dataSource, treeKey, titleKey, valueKey, children, selectable } =
|
|
246
|
+
rightMenuData || {};
|
|
247
|
+
|
|
248
|
+
if (
|
|
249
|
+
treeKey &&
|
|
250
|
+
!showRightMenu[treeKey] &&
|
|
251
|
+
showRightMenu?.treeKey === treeKey
|
|
252
|
+
) {
|
|
253
|
+
const recursiveSetData = (arr: any) => {
|
|
254
|
+
if (Array.isArray(arr) && arr?.length) {
|
|
255
|
+
return (arr || []).map((c: any) => {
|
|
256
|
+
const d: Record<string, any> = {
|
|
257
|
+
data: c,
|
|
258
|
+
title: c[titleKey],
|
|
259
|
+
key: c[valueKey] || c.key,
|
|
260
|
+
label: c[titleKey],
|
|
261
|
+
selectable: c[selectable],
|
|
262
|
+
};
|
|
263
|
+
if (c[children]) {
|
|
264
|
+
d.children = recursiveSetData(c[children]);
|
|
265
|
+
}
|
|
266
|
+
return d;
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
return [];
|
|
270
|
+
};
|
|
271
|
+
const d = recursiveSetData(dataSource);
|
|
272
|
+
if (d?.length) {
|
|
273
|
+
setRightMenuData((pre: any) => ({
|
|
274
|
+
...pre,
|
|
275
|
+
[treeKey]: d,
|
|
276
|
+
}));
|
|
277
|
+
setShowRightMenu((pre: any) => ({ ...pre, [treeKey]: true }));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}, [rightMenuData, showRightMenu]);
|
|
282
|
+
|
|
283
|
+
// isGetAll 是否获取所有节点keys,否则只获取父级的,展开时使用
|
|
284
|
+
const recursiveFind = (
|
|
285
|
+
arr: any[],
|
|
286
|
+
oldKey: any[],
|
|
287
|
+
keys: any[],
|
|
288
|
+
isGetAll = false,
|
|
289
|
+
) => {
|
|
290
|
+
arr?.forEach?.((k) => {
|
|
291
|
+
if (
|
|
292
|
+
(Array.isArray(k.children) &&
|
|
293
|
+
k.children.length > 0 &&
|
|
294
|
+
(!oldKey.length || oldKey.find((c) => c == k.key))) ||
|
|
295
|
+
isGetAll
|
|
296
|
+
) {
|
|
297
|
+
keys.push(oldKey.find((c) => c == k.key) || String(k.key)); // id为数字的时候, 树控件识别string来判断展开节点
|
|
298
|
+
if (Array.isArray(k.children) && k?.children?.length) {
|
|
299
|
+
recursiveFind(k.children, oldKey, keys, isGetAll);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
useEffect(() => {
|
|
306
|
+
if (props.isSelectAll !== undefined) {
|
|
307
|
+
setIsSelectAll(props.isSelectAll);
|
|
308
|
+
}
|
|
309
|
+
}, [props.isSelectAll]);
|
|
310
|
+
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
if (isSelectAll && data && props.checkable) {
|
|
313
|
+
// 全选,设置keys
|
|
314
|
+
const keys: any[] = [];
|
|
315
|
+
recursiveFind(data, [], keys, true);
|
|
316
|
+
setCheckedKeys(keys);
|
|
317
|
+
setIsSelectAll(false);
|
|
318
|
+
}
|
|
319
|
+
}, [isSelectAll, data]);
|
|
320
|
+
|
|
321
|
+
const getParams = (service: any, key: any) => {
|
|
322
|
+
const {
|
|
323
|
+
providerId,
|
|
324
|
+
appId,
|
|
325
|
+
serviceCode,
|
|
326
|
+
_source,
|
|
327
|
+
loadKey,
|
|
328
|
+
_serviceId,
|
|
329
|
+
serviceVersion,
|
|
330
|
+
sceneCode,
|
|
331
|
+
linkCode,
|
|
332
|
+
busiObjectId,
|
|
333
|
+
versionCode,
|
|
334
|
+
} = service || {};
|
|
335
|
+
let params: Record<string, any> = { [loadKey]: key };
|
|
336
|
+
// 特殊服务参数处理
|
|
337
|
+
if (_source === SERVICE_SOURCE.ATOM) {
|
|
338
|
+
// 原子服务
|
|
339
|
+
params = {
|
|
340
|
+
providerId,
|
|
341
|
+
serviceProviderRequest: params,
|
|
342
|
+
};
|
|
343
|
+
} else if (
|
|
344
|
+
_source === SERVICE_SOURCE.QUERY ||
|
|
345
|
+
_source === SERVICE_SOURCE.INNER ||
|
|
346
|
+
_source === SERVICE_SOURCE.PLATFORM
|
|
347
|
+
) {
|
|
348
|
+
// 解析类服务或请求层服务
|
|
349
|
+
params = {
|
|
350
|
+
appId: (window as any).appId || appId,
|
|
351
|
+
serviceCode,
|
|
352
|
+
params,
|
|
353
|
+
};
|
|
354
|
+
} else if (_source === SERVICE_SOURCE.STD) {
|
|
355
|
+
// 编排类服务
|
|
356
|
+
params = {
|
|
357
|
+
appId: (window as any).appId || appId,
|
|
358
|
+
serviceCode,
|
|
359
|
+
version: versionCode,
|
|
360
|
+
serviceVersionId: _serviceId,
|
|
361
|
+
parameters: params,
|
|
362
|
+
};
|
|
363
|
+
} else if (_source === SERVICE_SOURCE.RHIN) {
|
|
364
|
+
// 业务平台
|
|
365
|
+
params = {
|
|
366
|
+
appId: (window as any).appId || appId,
|
|
367
|
+
serviceCode,
|
|
368
|
+
serviceVersion: versionCode,
|
|
369
|
+
serviceRequest: params,
|
|
370
|
+
};
|
|
371
|
+
} else if (_source === SERVICE_SOURCE.SCENE) {
|
|
372
|
+
// 业务平台场景
|
|
373
|
+
params = {
|
|
374
|
+
appId: (window as any).appId || appId,
|
|
375
|
+
serviceCode,
|
|
376
|
+
serviceVersion,
|
|
377
|
+
sceneCode,
|
|
378
|
+
linkCode,
|
|
379
|
+
serviceRequest: params,
|
|
380
|
+
};
|
|
381
|
+
} else if (_source === SERVICE_SOURCE.OBJECT) {
|
|
382
|
+
params = {
|
|
383
|
+
busiObjectId,
|
|
384
|
+
busiObjectInstId: `${Math.random()}`.slice(12),
|
|
385
|
+
attrs: params,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
return params;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
const transformBoolean = (value: any) => {
|
|
392
|
+
if (value === undefined || value === null) {
|
|
393
|
+
return undefined;
|
|
394
|
+
}
|
|
395
|
+
if (value === 'false') {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
return Boolean(value);
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
const loadTreeData = (source: any[], service: Record<string, any>) => {
|
|
402
|
+
const { key, title, children, selectable = 'selectable' } = service || {};
|
|
403
|
+
const getTreeData = (arr: any[]) => {
|
|
404
|
+
if (Array.isArray(arr)) {
|
|
405
|
+
return arr.map((c) => {
|
|
406
|
+
// _isReload 标识节点数据是通过加载子节点动作设置的,此时取该动作配置好的key/title/selectable,原数据放在了data字段
|
|
407
|
+
const originData = c._isReload ? c.data : c;
|
|
408
|
+
const isSelectable =
|
|
409
|
+
transformBoolean(originData[selectable] ?? originData.selectable) ??
|
|
410
|
+
true;
|
|
411
|
+
// 如果加载子节点配置了映射,优先取加载子节点的,否则取当时加载数据的映射,若都没有则取数据上的默认字段
|
|
412
|
+
const nodeSelectable = c._isReload
|
|
413
|
+
? c.selectable ?? isSelectable
|
|
414
|
+
: isSelectable;
|
|
415
|
+
const _key = c._isReload
|
|
416
|
+
? c.key ?? originData[key]
|
|
417
|
+
: originData[key] ?? originData.key;
|
|
418
|
+
const renderTitle = () => {
|
|
419
|
+
let _title = _key;
|
|
420
|
+
// 返回的数据对象有配置的标题字段
|
|
421
|
+
if (
|
|
422
|
+
Object.prototype.hasOwnProperty.call(c, title) ||
|
|
423
|
+
Object.prototype.hasOwnProperty.call(c, 'title')
|
|
424
|
+
) {
|
|
425
|
+
_title = '';
|
|
426
|
+
}
|
|
427
|
+
if (c._isReload) {
|
|
428
|
+
return c.title ?? originData[title] ?? _title;
|
|
429
|
+
}
|
|
430
|
+
return originData[title] ?? originData.title ?? _title;
|
|
431
|
+
};
|
|
432
|
+
const node: Record<string, any> = {
|
|
433
|
+
key: _key,
|
|
434
|
+
title: renderTitle() ?? '',
|
|
435
|
+
selectable: nodeSelectable,
|
|
436
|
+
isLeaf: c.isLeaf ?? originData.isLeaf ?? false,
|
|
437
|
+
data: c.data || c,
|
|
438
|
+
disableCheckbox:
|
|
439
|
+
c.disabled ??
|
|
440
|
+
c.disableCheckbox ??
|
|
441
|
+
(nodeSelectable !== undefined ? !nodeSelectable : undefined),
|
|
442
|
+
disabled:
|
|
443
|
+
c.disabled ??
|
|
444
|
+
c.disableCheckbox ??
|
|
445
|
+
(nodeSelectable !== undefined ? !nodeSelectable : undefined),
|
|
446
|
+
};
|
|
447
|
+
// 优先取配置的children字段,若配置错误则子节点为空,若无配置默认访问数据自身chidren
|
|
448
|
+
const childrenKey = children || 'children';
|
|
449
|
+
if (Array.isArray(c[childrenKey])) {
|
|
450
|
+
node.children = getTreeData(c[childrenKey]);
|
|
451
|
+
}
|
|
452
|
+
if (originData.isLeaf === undefined) {
|
|
453
|
+
if (asyncService || isAsync) {
|
|
454
|
+
// 存量异步数据
|
|
455
|
+
// -null是非叶子 -[]是叶子 -属性不存在是非叶子
|
|
456
|
+
if (
|
|
457
|
+
Array.isArray(c[childrenKey]) &&
|
|
458
|
+
c[childrenKey]?.length === 0
|
|
459
|
+
) {
|
|
460
|
+
node.isLeaf = true;
|
|
461
|
+
}
|
|
462
|
+
} else if (children || c[childrenKey]) {
|
|
463
|
+
// 加载数据配置子节点映射,或者数据上也有children数据,则视为同步加载
|
|
464
|
+
// 目前不处理加载子节点数据动作返回来的数据里面的children
|
|
465
|
+
// -null是叶子 -[]是叶子 -属性不存在是叶子 -[有值]是非叶子
|
|
466
|
+
if (
|
|
467
|
+
c[childrenKey] === null ||
|
|
468
|
+
c[childrenKey] === undefined ||
|
|
469
|
+
!(childrenKey in c) ||
|
|
470
|
+
(Array.isArray(c[childrenKey]) && c[childrenKey]?.length === 0)
|
|
471
|
+
) {
|
|
472
|
+
node.isLeaf = true;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
// 不符合上述的,默认为异步加载,节点值为非空数组时都,视为未展开节点(非叶子)
|
|
476
|
+
}
|
|
477
|
+
return node;
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
return [];
|
|
481
|
+
};
|
|
482
|
+
return getTreeData(source);
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
useEffect(() => {
|
|
486
|
+
// treeService 目前只有配置加载数据动作时会有,存量中配置了树控件异步服务的会有
|
|
487
|
+
// 处理获取到的数据
|
|
488
|
+
if (treeService && dataSource) {
|
|
489
|
+
const res = loadTreeData(dataSource, treeService);
|
|
490
|
+
if (isAsync && asyncService) {
|
|
491
|
+
setLoadedKeys((pre: any[]) => {
|
|
492
|
+
const newKeys: any[] = [];
|
|
493
|
+
if (pre?.length > 0) {
|
|
494
|
+
recursiveFind(res, pre, newKeys);
|
|
495
|
+
}
|
|
496
|
+
setExpandedKeys(newKeys);
|
|
497
|
+
return newKeys;
|
|
498
|
+
});
|
|
499
|
+
// setLoadedKeys([]);
|
|
500
|
+
} else if (defaultExpandAll) {
|
|
501
|
+
const newKeys: any[] = [];
|
|
502
|
+
recursiveFind(res, [], newKeys);
|
|
503
|
+
setExpandedKeys(newKeys);
|
|
504
|
+
}
|
|
505
|
+
setData(res);
|
|
506
|
+
// treeServiceRef.current = treeService;
|
|
507
|
+
} else if (!treeService) {
|
|
508
|
+
// treeData应为项目设置中的常量,理应不会变化,因此优先取dataSource
|
|
509
|
+
const res = dataSource || treeData;
|
|
510
|
+
setData(res);
|
|
511
|
+
if (defaultExpandAll) {
|
|
512
|
+
const newKeys: any[] = [];
|
|
513
|
+
recursiveFind(res, [], newKeys);
|
|
514
|
+
setExpandedKeys(newKeys);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}, [
|
|
518
|
+
JSON.stringify(treeService),
|
|
519
|
+
JSON.stringify(dataSource),
|
|
520
|
+
isAsync,
|
|
521
|
+
JSON.stringify(treeData),
|
|
522
|
+
]);
|
|
523
|
+
|
|
524
|
+
const findTreeDataByKey = (treeD: any, keys: string[]) => {
|
|
525
|
+
const selectedData: any[] = [];
|
|
526
|
+
const findSelectedData = (arr: any[]) => {
|
|
527
|
+
arr.forEach((c) => {
|
|
528
|
+
if (keys?.includes(String(c.key))) {
|
|
529
|
+
selectedData.push(c.data || c);
|
|
530
|
+
}
|
|
531
|
+
if (c.children && c.children.length) {
|
|
532
|
+
findSelectedData(c.children);
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
};
|
|
536
|
+
findSelectedData(treeD);
|
|
537
|
+
return selectedData;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
useEffect(() => {
|
|
541
|
+
if (props.selectedKeys !== undefined) {
|
|
542
|
+
let newSelectKeys: string | string[] = props.selectedKeys;
|
|
543
|
+
if (typeof newSelectKeys === 'string') {
|
|
544
|
+
newSelectKeys = props.selectedKeys.split(',');
|
|
545
|
+
}
|
|
546
|
+
const sks = newSelectKeys || [];
|
|
547
|
+
setSelectedKeys([...sks]);
|
|
548
|
+
// 更新当前选中数据
|
|
549
|
+
const selectedData = findTreeDataByKey(data, newSelectKeys);
|
|
550
|
+
setSelectDataList(selectedData);
|
|
551
|
+
}
|
|
552
|
+
}, [props.selectedKeys]);
|
|
553
|
+
|
|
554
|
+
useEffect(() => {
|
|
555
|
+
if (props.checkedKeys !== undefined) {
|
|
556
|
+
let nowCheckedKeys: string | string[] = props.checkedKeys;
|
|
557
|
+
if (typeof nowCheckedKeys === 'string') {
|
|
558
|
+
nowCheckedKeys = props.checkedKeys.split(',');
|
|
559
|
+
}
|
|
560
|
+
const cks = nowCheckedKeys || [];
|
|
561
|
+
setCheckedKeys([...cks]);
|
|
562
|
+
// 重新设置选项时,重置全选状态
|
|
563
|
+
setIsSelectAll(false);
|
|
564
|
+
}
|
|
565
|
+
}, [props.checkedKeys]);
|
|
566
|
+
|
|
567
|
+
const loadNodeData = (node: any) => {
|
|
568
|
+
const { children, eventKey } = node.props;
|
|
569
|
+
return new Promise<void>((resolve) => {
|
|
570
|
+
if (children && children.length) {
|
|
571
|
+
resolve();
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
const params = getParams(asyncService, eventKey);
|
|
575
|
+
let { serviceMethod } = asyncService;
|
|
576
|
+
if (
|
|
577
|
+
[
|
|
578
|
+
SERVICE_SOURCE.ATOM,
|
|
579
|
+
SERVICE_SOURCE.QUERY,
|
|
580
|
+
SERVICE_SOURCE.INNER,
|
|
581
|
+
SERVICE_SOURCE.PLATFORM,
|
|
582
|
+
SERVICE_SOURCE.STD,
|
|
583
|
+
SERVICE_SOURCE.RHIN,
|
|
584
|
+
SERVICE_SOURCE.SCENE,
|
|
585
|
+
].includes(asyncService._source)
|
|
586
|
+
) {
|
|
587
|
+
serviceMethod = 'post';
|
|
588
|
+
}
|
|
589
|
+
engineApis?.service
|
|
590
|
+
?.commonFetch(serviceMethod, asyncService.api, params)
|
|
591
|
+
.then(
|
|
592
|
+
(res: string | any[]) => {
|
|
593
|
+
setLoadedKeys((pre) => {
|
|
594
|
+
const newKeys = new Set([...pre, eventKey]);
|
|
595
|
+
return [...newKeys];
|
|
596
|
+
});
|
|
597
|
+
if (Array.isArray(res) && res.length) {
|
|
598
|
+
const source = loadTreeData(res, asyncService);
|
|
599
|
+
node.props.dataRef.children = source.map((c) => ({
|
|
600
|
+
...c,
|
|
601
|
+
isLeaf: false,
|
|
602
|
+
}));
|
|
603
|
+
node.props.dataRef.isLeaf = false;
|
|
604
|
+
} else {
|
|
605
|
+
node.props.dataRef.children = undefined;
|
|
606
|
+
node.props.dataRef.isLeaf = true;
|
|
607
|
+
}
|
|
608
|
+
setData([...data]);
|
|
609
|
+
resolve();
|
|
610
|
+
},
|
|
611
|
+
(err: void | PromiseLike<void>) => {
|
|
612
|
+
node.props.dataRef.children = undefined;
|
|
613
|
+
node.props.dataRef.isLeaf = true;
|
|
614
|
+
setData([...data]);
|
|
615
|
+
resolve(err);
|
|
616
|
+
},
|
|
617
|
+
);
|
|
618
|
+
});
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
const onClickIcon = (
|
|
622
|
+
e: React.MouseEvent<HTMLSpanElement, MouseEvent>,
|
|
623
|
+
c: Record<string, any>,
|
|
624
|
+
icon: any,
|
|
625
|
+
) => {
|
|
626
|
+
e.stopPropagation();
|
|
627
|
+
|
|
628
|
+
// 设置当前操作key
|
|
629
|
+
setEditingKey(c.key);
|
|
630
|
+
let method: any = null;
|
|
631
|
+
if ((icon?.type || icon) === 'add') {
|
|
632
|
+
method = onNodeAdd;
|
|
633
|
+
} else if ((icon?.type || icon) === 'edit') {
|
|
634
|
+
method = onNodeEdit;
|
|
635
|
+
} else if ((icon?.type || icon) !== 'delete') {
|
|
636
|
+
// 处理默认的新增,编辑,删除,其他的所有拓展按钮走自定义事件
|
|
637
|
+
method = (resetProps as any)?.[icon?.value];
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
if (typeof method === 'function') {
|
|
641
|
+
// 事件入参:节点key 节点数据 父节点key 父节点数据
|
|
642
|
+
// 由于历史原因,图标点击事件中节点数据是原数据,而非平台包装后的数据,而选中,展开事件的节点数据为平台包装数据
|
|
643
|
+
// 父节点数据保持一致,为平台包装后的数据,访问原数据需要从.data节点获取
|
|
644
|
+
method(c.key, c.data, c?.data?.parentNode?.key, c?.data?.parentNode, c);
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
const renderIconFont = (
|
|
649
|
+
c: Record<string, any>,
|
|
650
|
+
icon: any,
|
|
651
|
+
dropdown?: boolean,
|
|
652
|
+
) => {
|
|
653
|
+
return dropdown ? (
|
|
654
|
+
<span onClick={(e) => onClickIcon(e, c, icon)}>
|
|
655
|
+
{icon?.title || iconMap[icon]?.name}
|
|
656
|
+
</span>
|
|
657
|
+
) : (
|
|
658
|
+
<span className="ued-tree-icon" onClick={(e) => onClickIcon(e, c, icon)}>
|
|
659
|
+
<Icon
|
|
660
|
+
key={icon}
|
|
661
|
+
appId={appId}
|
|
662
|
+
style={{
|
|
663
|
+
width: 14,
|
|
664
|
+
height: 14,
|
|
665
|
+
}}
|
|
666
|
+
icon={icon?.icon}
|
|
667
|
+
getEngineApis={getEngineApis}
|
|
668
|
+
className=""
|
|
669
|
+
$$componentItem={props.$$componentItem}
|
|
670
|
+
/>
|
|
671
|
+
</span>
|
|
672
|
+
);
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
const getRuleFunc = (rule: string) => {
|
|
676
|
+
if (!rule) {
|
|
677
|
+
return () => {};
|
|
678
|
+
}
|
|
679
|
+
if (typeof rule === 'function') {
|
|
680
|
+
return rule;
|
|
681
|
+
}
|
|
682
|
+
if (typeof rule === 'string') {
|
|
683
|
+
// eslint-disable-next-line no-new-func
|
|
684
|
+
return new Function(
|
|
685
|
+
'node',
|
|
686
|
+
`try { return ${rule};} catch(e) { console.warn("${rule}${getLocale?.(
|
|
687
|
+
'nodeRule',
|
|
688
|
+
)}");}`,
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
return () => {};
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
const nodeIconsInfo = useMemo(() => {
|
|
695
|
+
if (nodeIcons?.length) {
|
|
696
|
+
return nodeIcons.map((node) => {
|
|
697
|
+
if (typeof node === 'string') {
|
|
698
|
+
return {
|
|
699
|
+
icon: {
|
|
700
|
+
isIconFont: true,
|
|
701
|
+
type: iconMap[node]?.icon,
|
|
702
|
+
},
|
|
703
|
+
type: node,
|
|
704
|
+
title: iconMap[node]?.name,
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
let ruleFunc;
|
|
708
|
+
try {
|
|
709
|
+
ruleFunc = getRuleFunc(node?.rule);
|
|
710
|
+
} catch (e) {
|
|
711
|
+
console.warn(
|
|
712
|
+
`${node?.rule}节点规则不正确,请使用node.字段名进行配置`,
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
return {
|
|
716
|
+
...node,
|
|
717
|
+
rule: ruleFunc,
|
|
718
|
+
};
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
return [];
|
|
722
|
+
}, [JSON.stringify(nodeIcons || {})]);
|
|
723
|
+
|
|
724
|
+
const renderDelete = (
|
|
725
|
+
c: Record<string, any>,
|
|
726
|
+
icon: any,
|
|
727
|
+
dropdown?: boolean,
|
|
728
|
+
) => (
|
|
729
|
+
<Popconfirm
|
|
730
|
+
onVisibleChange={(v) =>
|
|
731
|
+
v && setPopVisible({ ...popVisible, [c.key]: false })
|
|
732
|
+
}
|
|
733
|
+
key={`${icon?.type || icon}_1`}
|
|
734
|
+
title={getLocale?.('deleteConfirm')}
|
|
735
|
+
placement={dropdown ? 'rightBottom' : 'top'}
|
|
736
|
+
onConfirm={(e: any) => {
|
|
737
|
+
e.stopPropagation();
|
|
738
|
+
if (typeof onNodeDelete === 'function') {
|
|
739
|
+
// 事件入参:节点key 节点数据 父节点key 父节点数据
|
|
740
|
+
// 由于历史原因,图标点击事件中节点数据是原数据,而非平台包装后的数据,而选中,展开事件的节点数据为平台包装数据
|
|
741
|
+
// 父节点数据保持一致,为平台包装后的数据,访问原数据需要从.data节点获取
|
|
742
|
+
onNodeDelete(
|
|
743
|
+
c.key,
|
|
744
|
+
c.data,
|
|
745
|
+
c?.data?.parentNode?.key,
|
|
746
|
+
c?.data?.parentNode,
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
}}
|
|
750
|
+
onCancel={(e: any) => e.stopPropagation()}
|
|
751
|
+
>
|
|
752
|
+
{renderIconFont(c, icon, dropdown)}
|
|
753
|
+
</Popconfirm>
|
|
754
|
+
);
|
|
755
|
+
|
|
756
|
+
const renderIcons = (
|
|
757
|
+
c: Record<string, any>,
|
|
758
|
+
icons: any[],
|
|
759
|
+
dropdown?: boolean,
|
|
760
|
+
) =>
|
|
761
|
+
dropdown ? (
|
|
762
|
+
<Menu>
|
|
763
|
+
{icons.map((icon) => (
|
|
764
|
+
<Menu.Item key={icon?.type || icon}>
|
|
765
|
+
{(icon?.type || icon) === 'delete'
|
|
766
|
+
? renderDelete(c, icon, dropdown)
|
|
767
|
+
: renderIconFont(c, icon, dropdown)}
|
|
768
|
+
</Menu.Item>
|
|
769
|
+
))}
|
|
770
|
+
</Menu>
|
|
771
|
+
) : (
|
|
772
|
+
icons.map((icon) =>
|
|
773
|
+
(icon?.type || icon) === 'delete' ? (
|
|
774
|
+
<Tooltip
|
|
775
|
+
title={icon?.title || iconMap[icon]?.name}
|
|
776
|
+
visible={popVisible?.[c.key]}
|
|
777
|
+
onVisibleChange={(v) =>
|
|
778
|
+
setPopVisible({ ...popVisible, [c.key]: v })
|
|
779
|
+
}
|
|
780
|
+
>
|
|
781
|
+
{renderDelete(c, icon)}
|
|
782
|
+
</Tooltip>
|
|
783
|
+
) : (
|
|
784
|
+
<Tooltip title={icon?.title || iconMap[icon]?.name}>
|
|
785
|
+
{renderIconFont(c, icon)}
|
|
786
|
+
</Tooltip>
|
|
787
|
+
),
|
|
788
|
+
)
|
|
789
|
+
);
|
|
790
|
+
|
|
791
|
+
const renderTooltip = (cItem: any, child: React.ReactNode) => (
|
|
792
|
+
<Tooltip
|
|
793
|
+
title={cItem.title}
|
|
794
|
+
overlayClassName="nodeHoverCodeTip"
|
|
795
|
+
placement="top"
|
|
796
|
+
>
|
|
797
|
+
{child}
|
|
798
|
+
</Tooltip>
|
|
799
|
+
);
|
|
800
|
+
|
|
801
|
+
const renderContent = (cItem: any, i: number) => {
|
|
802
|
+
let context: any = null;
|
|
803
|
+
let isTooltip = false;
|
|
804
|
+
|
|
805
|
+
// 自定义渲染函数-新数据格式
|
|
806
|
+
// 自定义渲染函数-旧数据格式兼容 {code: string, originCode: string}
|
|
807
|
+
let codeStr = customRenderCode?.code;
|
|
808
|
+
if (typeof customRenderCode === 'string' && !codeStr) {
|
|
809
|
+
codeStr = customRenderCode;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
if (customRenderCode && typeof customRenderCode?.jsx === 'object') {
|
|
813
|
+
if (customRenderCode.jsx.key === 'nodeHoverCode') isTooltip = true;
|
|
814
|
+
context = (
|
|
815
|
+
<div style={{ position: 'relative' }}>
|
|
816
|
+
<CustomModule
|
|
817
|
+
code={customRenderCode.targetVal}
|
|
818
|
+
compProps={{ text: cItem.title, item: cItem, index: i }}
|
|
819
|
+
sandBoxLoadModule={sandBoxLoadModule}
|
|
820
|
+
errorInfo={{
|
|
821
|
+
id: props.$$componentItem.id,
|
|
822
|
+
}}
|
|
823
|
+
/>
|
|
824
|
+
</div>
|
|
825
|
+
);
|
|
826
|
+
} else if (codeStr && funcExpExecute) {
|
|
827
|
+
if (codeStr.toString().indexOf('节点名称hover展示全称') > -1)
|
|
828
|
+
isTooltip = true;
|
|
829
|
+
context = (
|
|
830
|
+
<div
|
|
831
|
+
style={{ position: 'relative' }}
|
|
832
|
+
// eslint-disable-next-line react/no-danger
|
|
833
|
+
dangerouslySetInnerHTML={{
|
|
834
|
+
__html: funcExpExecute(codeStr, [
|
|
835
|
+
{
|
|
836
|
+
key: 'text',
|
|
837
|
+
value: cItem.title,
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
key: 'item',
|
|
841
|
+
value: cItem,
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
key: 'index',
|
|
845
|
+
value: i,
|
|
846
|
+
},
|
|
847
|
+
]),
|
|
848
|
+
}}
|
|
849
|
+
/>
|
|
850
|
+
);
|
|
851
|
+
} else {
|
|
852
|
+
context = cItem.title;
|
|
853
|
+
}
|
|
854
|
+
if (isTooltip) {
|
|
855
|
+
return renderTooltip(cItem, context);
|
|
856
|
+
}
|
|
857
|
+
return context;
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
const renderTitle = (c: Record<string, any>, i: number) => {
|
|
861
|
+
let iconsDom: any = null;
|
|
862
|
+
if (
|
|
863
|
+
!resetProps.disabled &&
|
|
864
|
+
Array.isArray(nodeIconsInfo) &&
|
|
865
|
+
nodeIconsInfo.length
|
|
866
|
+
) {
|
|
867
|
+
const finalNodeIcons = nodeIconsInfo.filter((node) => {
|
|
868
|
+
if (node.rule && typeof node.rule === 'function') {
|
|
869
|
+
try {
|
|
870
|
+
return !node.rule(c);
|
|
871
|
+
} catch (e) {
|
|
872
|
+
console.warn(getLocale?.('nodeRule'));
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
return true;
|
|
876
|
+
});
|
|
877
|
+
if (finalNodeIcons.length <= 3) {
|
|
878
|
+
iconsDom = (
|
|
879
|
+
<div key={c.key} className="ued-tree-icons ued-tree-icons-normal">
|
|
880
|
+
{renderIcons(c, finalNodeIcons)}
|
|
881
|
+
</div>
|
|
882
|
+
);
|
|
883
|
+
} else {
|
|
884
|
+
iconsDom = (
|
|
885
|
+
<div className="ued-tree-icons">
|
|
886
|
+
<Dropdown
|
|
887
|
+
trigger={['click']}
|
|
888
|
+
overlay={renderIcons(c, finalNodeIcons, true) as any}
|
|
889
|
+
getPopupContainer={(node: any) => node}
|
|
890
|
+
>
|
|
891
|
+
<EllipsisOutlined
|
|
892
|
+
rev=""
|
|
893
|
+
className="ued-tree-icon"
|
|
894
|
+
onClick={(e: { stopPropagation: () => void }) => {
|
|
895
|
+
e.stopPropagation();
|
|
896
|
+
}}
|
|
897
|
+
/>
|
|
898
|
+
</Dropdown>
|
|
899
|
+
</div>
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
return (
|
|
905
|
+
<div
|
|
906
|
+
onContextMenu={() => {
|
|
907
|
+
if (typeof onRightClickNode === 'function') {
|
|
908
|
+
onRightClickNode(
|
|
909
|
+
c.key,
|
|
910
|
+
c,
|
|
911
|
+
showRightMenu[c.key] !== undefined,
|
|
912
|
+
c?.data?.parentNode?.key,
|
|
913
|
+
c?.data?.parentNode,
|
|
914
|
+
);
|
|
915
|
+
}
|
|
916
|
+
}}
|
|
917
|
+
className="ued-tree-tit"
|
|
918
|
+
>
|
|
919
|
+
<TreeNodeMenu
|
|
920
|
+
key={c.key}
|
|
921
|
+
onClickMenuItem={onClickMenuItem}
|
|
922
|
+
visible={showRightMenu?.[c.key] || false}
|
|
923
|
+
onVisibleChange={(v: boolean) => {
|
|
924
|
+
if (!v && rightMenuData.treeKey) {
|
|
925
|
+
setRightMenuData({});
|
|
926
|
+
}
|
|
927
|
+
setShowRightMenu((pre: any) => ({
|
|
928
|
+
...pre,
|
|
929
|
+
// 收起菜单时隐藏
|
|
930
|
+
[c.key]: v ? pre?.[c.key]?.visible : v,
|
|
931
|
+
treeKey: v ? c.key : undefined,
|
|
932
|
+
}));
|
|
933
|
+
}}
|
|
934
|
+
overlayClassName="ued-tree-menu"
|
|
935
|
+
menuData={rightMenuData[c.key]}
|
|
936
|
+
>
|
|
937
|
+
<div className="tree-tit-item">{renderContent(c, i)}</div>
|
|
938
|
+
</TreeNodeMenu>
|
|
939
|
+
{iconsDom}
|
|
940
|
+
</div>
|
|
941
|
+
);
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
// 渲染节点图标
|
|
945
|
+
const renderNodeIconFont = (info: any) => {
|
|
946
|
+
if (info) {
|
|
947
|
+
return (
|
|
948
|
+
<Icon
|
|
949
|
+
{...info}
|
|
950
|
+
appId={appId}
|
|
951
|
+
isUsePrimary={treeNodeIcon?.isUsePrimary}
|
|
952
|
+
style={{
|
|
953
|
+
fill: treeNodeIcon?.isUsePrimary ? undefined : treeNodeIcon?.color,
|
|
954
|
+
}}
|
|
955
|
+
getEngineApis={getEngineApis}
|
|
956
|
+
/>
|
|
957
|
+
);
|
|
958
|
+
}
|
|
959
|
+
return undefined;
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
// 扩展规则
|
|
963
|
+
const extRules = useMemo(() => {
|
|
964
|
+
if (
|
|
965
|
+
Array.isArray(treeNodeIcon?.extendRules) &&
|
|
966
|
+
treeNodeIcon?.extendRules?.length
|
|
967
|
+
) {
|
|
968
|
+
return (treeNodeIcon?.extendRules || []).map((iconRule: any) => {
|
|
969
|
+
const { rule } = iconRule;
|
|
970
|
+
let ruleFunc;
|
|
971
|
+
if (rule) {
|
|
972
|
+
try {
|
|
973
|
+
ruleFunc = getRuleFunc(rule);
|
|
974
|
+
} catch (e) {
|
|
975
|
+
console.warn(`${rule}节点规则不正确,请使用node.字段名进行配置`);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
return {
|
|
979
|
+
...iconRule,
|
|
980
|
+
rule: ruleFunc,
|
|
981
|
+
};
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
return [];
|
|
985
|
+
}, [JSON.stringify(treeNodeIcon?.extendRules || {})]);
|
|
986
|
+
|
|
987
|
+
// 执行图标配置规则
|
|
988
|
+
const renderNodeIcon = (node: any) => {
|
|
989
|
+
const { data, expanded } = node;
|
|
990
|
+
if (!(treeNodeIcon?.iconInfo || treeNodeIcon?.extendRules?.length)) {
|
|
991
|
+
return undefined;
|
|
992
|
+
}
|
|
993
|
+
const { iconInfo, extendRules = [], iconType } = treeNodeIcon;
|
|
994
|
+
let info;
|
|
995
|
+
if (iconType === 'custom' && extendRules?.length) {
|
|
996
|
+
extRules.forEach((iconRule: any) => {
|
|
997
|
+
const { rule } = iconRule;
|
|
998
|
+
if (typeof rule === 'function') {
|
|
999
|
+
const ruleResult = rule({
|
|
1000
|
+
...node,
|
|
1001
|
+
...(data?.dataRef || data || {}),
|
|
1002
|
+
});
|
|
1003
|
+
if (ruleResult) {
|
|
1004
|
+
// 为真时表示配置该图标
|
|
1005
|
+
info = iconRule;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
if (!info && iconInfo) {
|
|
1011
|
+
// 图标规则优先执行,若无匹配中的再设置常规的展开收起
|
|
1012
|
+
if (expanded && data?.children) {
|
|
1013
|
+
info = iconInfo.expanded;
|
|
1014
|
+
} else if (data?.children) {
|
|
1015
|
+
info = iconInfo.closed;
|
|
1016
|
+
} else {
|
|
1017
|
+
info = iconInfo.leaf;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
return renderNodeIconFont(info);
|
|
1021
|
+
};
|
|
1022
|
+
|
|
1023
|
+
const createNodes = (nodes: any[], parentNode?: any) =>
|
|
1024
|
+
Array.isArray(nodes) && nodes.length > 0
|
|
1025
|
+
? nodes.map((c, i) => {
|
|
1026
|
+
const nodeWithParent = {
|
|
1027
|
+
...c,
|
|
1028
|
+
data: { ...(c.data || {}), parentNode },
|
|
1029
|
+
};
|
|
1030
|
+
const nodeProps: any = { dataRef: c };
|
|
1031
|
+
return (
|
|
1032
|
+
<TreeNode
|
|
1033
|
+
key={c.key}
|
|
1034
|
+
title={renderTitle(nodeWithParent, i)}
|
|
1035
|
+
data={nodeWithParent.data}
|
|
1036
|
+
isLeaf={c.isLeaf}
|
|
1037
|
+
selectable={c.selectable}
|
|
1038
|
+
disableCheckbox={
|
|
1039
|
+
c.disabled ??
|
|
1040
|
+
c.disableCheckbox ??
|
|
1041
|
+
(c.selectable !== undefined ? !c.selectable : undefined)
|
|
1042
|
+
}
|
|
1043
|
+
disabled={
|
|
1044
|
+
c.disabled ??
|
|
1045
|
+
c.disableCheckbox ??
|
|
1046
|
+
(c.selectable !== undefined ? !c.selectable : undefined)
|
|
1047
|
+
}
|
|
1048
|
+
className={classnames(
|
|
1049
|
+
!c.children || !c.children.length ? 'ued-tree-node-leaf' : '',
|
|
1050
|
+
'ued-tree-tree-node',
|
|
1051
|
+
)}
|
|
1052
|
+
domRef={(ref) => {
|
|
1053
|
+
if (
|
|
1054
|
+
c.matchFlag &&
|
|
1055
|
+
!scrollIntoViewComp?.current &&
|
|
1056
|
+
ref &&
|
|
1057
|
+
treeWrapRef?.current
|
|
1058
|
+
) {
|
|
1059
|
+
let currentComp: HTMLElement | null = ref.parentElement;
|
|
1060
|
+
while (currentComp !== treeWrapRef?.current && currentComp) {
|
|
1061
|
+
if (
|
|
1062
|
+
currentComp &&
|
|
1063
|
+
currentComp.scrollHeight - currentComp.clientHeight > 8
|
|
1064
|
+
) {
|
|
1065
|
+
// 容器存在滚动条
|
|
1066
|
+
break;
|
|
1067
|
+
}
|
|
1068
|
+
currentComp = currentComp
|
|
1069
|
+
? currentComp.parentElement
|
|
1070
|
+
: null;
|
|
1071
|
+
}
|
|
1072
|
+
if (currentComp && currentComp !== treeWrapRef?.current) {
|
|
1073
|
+
const { top: currentTop } =
|
|
1074
|
+
currentComp.getBoundingClientRect();
|
|
1075
|
+
const { top: refTop } = ref.getBoundingClientRect();
|
|
1076
|
+
if (refTop - currentTop > currentComp.scrollTop) {
|
|
1077
|
+
// 底部被遮挡,滚动
|
|
1078
|
+
currentComp.scrollTop = refTop - currentTop;
|
|
1079
|
+
scrollIntoViewComp.current = true;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}}
|
|
1084
|
+
{...nodeProps}
|
|
1085
|
+
>
|
|
1086
|
+
{c.children &&
|
|
1087
|
+
c.children.length > 0 &&
|
|
1088
|
+
createNodes(c.children, Object.freeze({ ...c }))}
|
|
1089
|
+
</TreeNode>
|
|
1090
|
+
);
|
|
1091
|
+
})
|
|
1092
|
+
: null;
|
|
1093
|
+
|
|
1094
|
+
// 由于为了兼容旧异步加载节点动作,搜索时过滤子节点修改了原节点数据,导致子节点数据丢失
|
|
1095
|
+
// 所以记录子节点数据
|
|
1096
|
+
const childrenData = useMemo(() => {
|
|
1097
|
+
const nodeMap = new WeakMap();
|
|
1098
|
+
const recursiveGetChildren = (d: any) => {
|
|
1099
|
+
if (Array.isArray(d) && d.length) {
|
|
1100
|
+
d.forEach((c) => {
|
|
1101
|
+
if (c.children) {
|
|
1102
|
+
nodeMap.set(c, c.children);
|
|
1103
|
+
recursiveGetChildren(c.children);
|
|
1104
|
+
}
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
recursiveGetChildren(data);
|
|
1109
|
+
return nodeMap;
|
|
1110
|
+
}, [data]);
|
|
1111
|
+
|
|
1112
|
+
// 过滤后最终的数据
|
|
1113
|
+
const filterData = useMemo(() => {
|
|
1114
|
+
let firstMatchFlag = false;
|
|
1115
|
+
scrollIntoViewComp.current = false;
|
|
1116
|
+
const recursiveFilter = (d: any) => {
|
|
1117
|
+
let newArr: any = [];
|
|
1118
|
+
if (Array.isArray(d) && d.length) {
|
|
1119
|
+
d.forEach((c, i) => {
|
|
1120
|
+
const { title } = c;
|
|
1121
|
+
const tit = title;
|
|
1122
|
+
let titText = title;
|
|
1123
|
+
const newD = c;
|
|
1124
|
+
newD.title = tit;
|
|
1125
|
+
const originChildrenData = childrenData.get(newD);
|
|
1126
|
+
if (originChildrenData) {
|
|
1127
|
+
newD.children = originChildrenData;
|
|
1128
|
+
}
|
|
1129
|
+
if (newD.children) {
|
|
1130
|
+
// 增加父级key路径
|
|
1131
|
+
let pathKeys = newD.pathKeys || [];
|
|
1132
|
+
if (newD.key) {
|
|
1133
|
+
pathKeys = [...pathKeys, newD.key];
|
|
1134
|
+
}
|
|
1135
|
+
newD.children.forEach((d: any) => {
|
|
1136
|
+
d.pathKeys = pathKeys;
|
|
1137
|
+
});
|
|
1138
|
+
newD.children = recursiveFilter(newD.children);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
// 自定义渲染函数-新数据格式
|
|
1142
|
+
// 自定义渲染函数-旧数据格式兼容 {code: string, originCode: string}
|
|
1143
|
+
let codeStr = customRenderCode?.code;
|
|
1144
|
+
if (typeof customRenderCode === 'string' && !codeStr) {
|
|
1145
|
+
codeStr = customRenderCode;
|
|
1146
|
+
}
|
|
1147
|
+
if (codeStr && funcExpExecute) {
|
|
1148
|
+
const funCodeRes = funcExpExecute(codeStr, [
|
|
1149
|
+
{
|
|
1150
|
+
key: 'text',
|
|
1151
|
+
value: tit,
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
key: 'item',
|
|
1155
|
+
value: newD,
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
key: 'index',
|
|
1159
|
+
value: i,
|
|
1160
|
+
},
|
|
1161
|
+
]);
|
|
1162
|
+
// 过滤掉funCode的html标签
|
|
1163
|
+
titText = funCodeRes
|
|
1164
|
+
.replace(/<\/?[^>]*>/g, '')
|
|
1165
|
+
.replace(/[|]*\n|\s*/g, '');
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
if (titText?.includes(searchVal || '') || newD.children?.length > 0) {
|
|
1169
|
+
if (titText.includes(searchVal || '') && !firstMatchFlag) {
|
|
1170
|
+
firstMatchFlag = true;
|
|
1171
|
+
// 匹配中的第一个节点出现在可视区域内
|
|
1172
|
+
newD.matchFlag = true;
|
|
1173
|
+
}
|
|
1174
|
+
// 匹配中或存在子节点的,保留
|
|
1175
|
+
newArr.push(newD);
|
|
1176
|
+
}
|
|
1177
|
+
});
|
|
1178
|
+
} else {
|
|
1179
|
+
newArr = d;
|
|
1180
|
+
}
|
|
1181
|
+
return newArr;
|
|
1182
|
+
};
|
|
1183
|
+
return recursiveFilter(data);
|
|
1184
|
+
}, [data, searchVal, customRenderCode]);
|
|
1185
|
+
|
|
1186
|
+
// 展开指定节点
|
|
1187
|
+
useEffect(() => {
|
|
1188
|
+
if (
|
|
1189
|
+
Array.isArray(expandedKey) &&
|
|
1190
|
+
expandedKey?.length &&
|
|
1191
|
+
filterData?.length
|
|
1192
|
+
) {
|
|
1193
|
+
let _expandKeys: any = expandedKeys || [];
|
|
1194
|
+
const getKeys = (dataAttr: any) => {
|
|
1195
|
+
dataAttr.forEach((da: any) => {
|
|
1196
|
+
if (expandedKey.includes(da.key)) {
|
|
1197
|
+
const _keys = [...(da.pathKeys || []), da.key];
|
|
1198
|
+
_expandKeys = [..._expandKeys, ..._keys];
|
|
1199
|
+
}
|
|
1200
|
+
if (da?.children?.length) {
|
|
1201
|
+
getKeys(da.children);
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
};
|
|
1205
|
+
getKeys(filterData);
|
|
1206
|
+
const extandKeyAttr = uniq(_expandKeys);
|
|
1207
|
+
setExpandedKeys(extandKeyAttr);
|
|
1208
|
+
}
|
|
1209
|
+
}, [expandedKey]);
|
|
1210
|
+
// 展开指定节点
|
|
1211
|
+
useEffect(() => {
|
|
1212
|
+
if (
|
|
1213
|
+
Array.isArray(closeExpandedKey) &&
|
|
1214
|
+
closeExpandedKey?.length &&
|
|
1215
|
+
filterData?.length
|
|
1216
|
+
) {
|
|
1217
|
+
const _expandedKeys = expandedKeys.filter(
|
|
1218
|
+
(key) => !closeExpandedKey.includes(key),
|
|
1219
|
+
);
|
|
1220
|
+
setExpandedKeys(_expandedKeys);
|
|
1221
|
+
}
|
|
1222
|
+
}, [closeExpandedKey]);
|
|
1223
|
+
|
|
1224
|
+
return visible ? (
|
|
1225
|
+
<div className="ued-tree-wrap" ref={treeWrapRef}>
|
|
1226
|
+
{showSearch && (
|
|
1227
|
+
<Input.Search
|
|
1228
|
+
className="ued-tree-search"
|
|
1229
|
+
value={searchVal}
|
|
1230
|
+
onChange={(e) => {
|
|
1231
|
+
setSearchVal(e.target.value);
|
|
1232
|
+
}}
|
|
1233
|
+
/>
|
|
1234
|
+
)}
|
|
1235
|
+
<Tree
|
|
1236
|
+
{...resetProps}
|
|
1237
|
+
className={classnames(
|
|
1238
|
+
'ued-tree',
|
|
1239
|
+
className,
|
|
1240
|
+
!showLineIcon ? 'ued-tree-no-line-icon' : '',
|
|
1241
|
+
)}
|
|
1242
|
+
selectedKeys={selectedKeys}
|
|
1243
|
+
checkedKeys={checkedKeys}
|
|
1244
|
+
showLine={
|
|
1245
|
+
resetProps?.showLine
|
|
1246
|
+
? {
|
|
1247
|
+
showLeafIcon: false,
|
|
1248
|
+
}
|
|
1249
|
+
: false
|
|
1250
|
+
}
|
|
1251
|
+
defaultExpandAll={isAsync && asyncService ? false : defaultExpandAll}
|
|
1252
|
+
loadedKeys={loadedKeys}
|
|
1253
|
+
onExpand={(keys: any[], eventData) => {
|
|
1254
|
+
const { node, expanded } = eventData;
|
|
1255
|
+
const parentNode: any = (eventData?.node as any)?.data?.parentNode;
|
|
1256
|
+
setExpandedKeys(keys);
|
|
1257
|
+
// 展开的时候触发
|
|
1258
|
+
if (expanded) {
|
|
1259
|
+
if (typeof onExpand === 'function') {
|
|
1260
|
+
onExpand(
|
|
1261
|
+
node.key,
|
|
1262
|
+
(node.children || []).map((c: any) => c.key),
|
|
1263
|
+
parentNode?.key,
|
|
1264
|
+
parentNode,
|
|
1265
|
+
);
|
|
1266
|
+
} else {
|
|
1267
|
+
node.isLeaf = !(node?.children && node?.children.length > 0);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}}
|
|
1271
|
+
expandedKeys={expandedKeys}
|
|
1272
|
+
onCheck={(checked: any) => {
|
|
1273
|
+
// 重新设置选项时,重置全选状态
|
|
1274
|
+
setCheckedKeys(checked);
|
|
1275
|
+
setIsSelectAll(false);
|
|
1276
|
+
if (onCheck) {
|
|
1277
|
+
onCheck(checked);
|
|
1278
|
+
}
|
|
1279
|
+
}}
|
|
1280
|
+
onSelect={(keys: any[], e: any) => {
|
|
1281
|
+
setSelectedKeys(keys);
|
|
1282
|
+
const selectedData = findTreeDataByKey(data, keys);
|
|
1283
|
+
setSelectDataList(selectedData);
|
|
1284
|
+
if (onSelect) {
|
|
1285
|
+
onSelect(
|
|
1286
|
+
keys,
|
|
1287
|
+
e,
|
|
1288
|
+
e?.node?.data?.parentNode?.key,
|
|
1289
|
+
e?.node?.data?.parentNode,
|
|
1290
|
+
);
|
|
1291
|
+
}
|
|
1292
|
+
}}
|
|
1293
|
+
showIcon={showLineIcon}
|
|
1294
|
+
icon={showLineIcon ? renderNodeIcon : undefined}
|
|
1295
|
+
loadData={isAsync && asyncService ? loadNodeData : undefined}
|
|
1296
|
+
>
|
|
1297
|
+
{createNodes(filterData)}
|
|
1298
|
+
</Tree>
|
|
1299
|
+
</div>
|
|
1300
|
+
) : null;
|
|
1301
|
+
});
|
|
1302
|
+
|
|
1303
|
+
export default MyTree;
|