@lingxiteam/ebe-utils 0.5.0 → 0.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/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/ImportBusiObjModal/index.tsx +5 -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/useTool.ts +428 -0
- package/package.json +2 -2
- /package/lib/public/src/utils/functors/{dateAdd.ts → DATEADD.ts} +0 -0
|
@@ -0,0 +1,1851 @@
|
|
|
1
|
+
/* eslint-disable no-nested-ternary */
|
|
2
|
+
import { CloseOutlined, SaveOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Icon as LegacyIcon } from '@lingxiteam/icons';
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
Divider,
|
|
7
|
+
Popconfirm,
|
|
8
|
+
Popover,
|
|
9
|
+
Skeleton,
|
|
10
|
+
Table,
|
|
11
|
+
Tooltip,
|
|
12
|
+
} from 'antd';
|
|
13
|
+
import type { ColumnProps } from 'antd/lib/table';
|
|
14
|
+
import { FilterDropdownProps } from 'antd/lib/table/interface';
|
|
15
|
+
import classnames from 'classnames';
|
|
16
|
+
import { cloneDeep } from 'lodash';
|
|
17
|
+
import React, {
|
|
18
|
+
Fragment,
|
|
19
|
+
useCallback,
|
|
20
|
+
useEffect,
|
|
21
|
+
useMemo,
|
|
22
|
+
useRef,
|
|
23
|
+
useState,
|
|
24
|
+
} from 'react';
|
|
25
|
+
import CommIcon from '../../Icon';
|
|
26
|
+
import CustomModule from '../../utils/CustomModule';
|
|
27
|
+
import EditComponent from '../EditComponent';
|
|
28
|
+
import HeaderCellTitle from '../HeaderCell/HeaderCellTitle';
|
|
29
|
+
import {
|
|
30
|
+
compareFn,
|
|
31
|
+
handleExpandColumn,
|
|
32
|
+
handleMultiLevelHeader,
|
|
33
|
+
handleRecursiveParseColumns,
|
|
34
|
+
treeRootName,
|
|
35
|
+
} from '../utils';
|
|
36
|
+
|
|
37
|
+
const ACTION_COL_KEY = '_actions';
|
|
38
|
+
|
|
39
|
+
const actionsMapFn = (getLocale: any) => ({
|
|
40
|
+
edit: [getLocale('edit'), 'edit'],
|
|
41
|
+
delete: [getLocale('delete'), 'delete'],
|
|
42
|
+
detail: [getLocale('detail'), 'file-search'],
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const useColumns = (props: any) => {
|
|
46
|
+
const {
|
|
47
|
+
form,
|
|
48
|
+
appId,
|
|
49
|
+
pageId,
|
|
50
|
+
compId,
|
|
51
|
+
size,
|
|
52
|
+
innerDataSource,
|
|
53
|
+
columns,
|
|
54
|
+
editMode,
|
|
55
|
+
extend,
|
|
56
|
+
currentRowKey,
|
|
57
|
+
extendNum, // 操作栏按钮最大展示数
|
|
58
|
+
rowActions,
|
|
59
|
+
fixedAction,
|
|
60
|
+
hiddenAction,
|
|
61
|
+
nowInlineEditKey,
|
|
62
|
+
nowEditingData,
|
|
63
|
+
actionWidth,
|
|
64
|
+
colServiceData,
|
|
65
|
+
colServiceDataForEdit,
|
|
66
|
+
hasSortEvent,
|
|
67
|
+
page,
|
|
68
|
+
pagination,
|
|
69
|
+
colorFormatInfo,
|
|
70
|
+
rowSpanMap,
|
|
71
|
+
rowClassMap,
|
|
72
|
+
rowSpanColMap,
|
|
73
|
+
expandIconPositionRef,
|
|
74
|
+
expandIconPosition,
|
|
75
|
+
expandComponents,
|
|
76
|
+
getEditVisible,
|
|
77
|
+
getDetailVisible,
|
|
78
|
+
getDeleteVisible,
|
|
79
|
+
isFlexColumn,
|
|
80
|
+
onRowDetailClick,
|
|
81
|
+
onRowDeleteClick,
|
|
82
|
+
onRowEditClick,
|
|
83
|
+
onRowSaveClick,
|
|
84
|
+
onRowCancelClick,
|
|
85
|
+
onRowAttrValsChange,
|
|
86
|
+
sandBoxSafeRun,
|
|
87
|
+
funcExpExecute,
|
|
88
|
+
engineApis,
|
|
89
|
+
loading,
|
|
90
|
+
handleIsRowEditableCanUse,
|
|
91
|
+
filters,
|
|
92
|
+
filterDropdownOpen,
|
|
93
|
+
onFilterDropdownVisibleChange,
|
|
94
|
+
renderFilterDropDown,
|
|
95
|
+
rowSelection,
|
|
96
|
+
tableGroupColorInfo,
|
|
97
|
+
getLocale,
|
|
98
|
+
onTableCellClick,
|
|
99
|
+
getRealIndexById,
|
|
100
|
+
} = props;
|
|
101
|
+
|
|
102
|
+
const actionsMap: any = actionsMapFn(getLocale);
|
|
103
|
+
|
|
104
|
+
// const api = getApis();
|
|
105
|
+
|
|
106
|
+
const tableRef = useRef<any>();
|
|
107
|
+
const [pageData, setPageData] = useState<any>({});
|
|
108
|
+
const [colCustomOrder, setColCustomOrder] = useState<any>([]); // 自定义列顺序记录
|
|
109
|
+
const [customSelectedCols, setCustomSelectedCols] = useState<any>(); // 自定义列显隐记录
|
|
110
|
+
const [popVisible, setPopVisible] = useState({});
|
|
111
|
+
const [columnWidth, setColumnWidth] = useState<any[]>([]);
|
|
112
|
+
// 初始加载列宽
|
|
113
|
+
const [initLoadColWidth, setInitLoadColWidth] = useState(false);
|
|
114
|
+
|
|
115
|
+
const getInnerRowAction = (
|
|
116
|
+
rowAction: any,
|
|
117
|
+
row: any,
|
|
118
|
+
index: number | null,
|
|
119
|
+
rowId: any,
|
|
120
|
+
) => {
|
|
121
|
+
let visible = false;
|
|
122
|
+
let clickText = rowAction.value;
|
|
123
|
+
rowAction.btnType = 'builtIn';
|
|
124
|
+
try {
|
|
125
|
+
let ruleFunc = rowAction.rule;
|
|
126
|
+
if (typeof rowAction.rule === 'string') {
|
|
127
|
+
const stringrule = rowAction.rule;
|
|
128
|
+
ruleFunc = (row: any, index: number | null, rowId: string | number) =>
|
|
129
|
+
sandBoxSafeRun(stringrule, {
|
|
130
|
+
...row,
|
|
131
|
+
row,
|
|
132
|
+
index,
|
|
133
|
+
rowId,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (rowAction.type) {
|
|
138
|
+
visible =
|
|
139
|
+
typeof ruleFunc === 'function' ? !ruleFunc(row, index, rowId) : true;
|
|
140
|
+
}
|
|
141
|
+
} catch (e) {
|
|
142
|
+
console.log(e);
|
|
143
|
+
}
|
|
144
|
+
const propsVisibleFn: any = {
|
|
145
|
+
edit: getEditVisible,
|
|
146
|
+
delete: getDeleteVisible,
|
|
147
|
+
detail: getDetailVisible,
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const propsClickFn: any = {
|
|
151
|
+
edit: 'onRowEditClick',
|
|
152
|
+
delete: 'onRowDeleteClick',
|
|
153
|
+
detail: 'onRowDetailClick',
|
|
154
|
+
};
|
|
155
|
+
clickText = propsClickFn[rowAction.type] || clickText;
|
|
156
|
+
return [
|
|
157
|
+
typeof propsVisibleFn[rowAction.type] === 'function'
|
|
158
|
+
? getEditVisible(row)
|
|
159
|
+
: visible,
|
|
160
|
+
clickText,
|
|
161
|
+
];
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const getRealRowActions = useCallback(
|
|
165
|
+
(row: any, index: number | null) => {
|
|
166
|
+
const rowId = row[currentRowKey];
|
|
167
|
+
if (Array.isArray(rowActions) && rowActions.length) {
|
|
168
|
+
let editVisible = false;
|
|
169
|
+
let detailVisible = false;
|
|
170
|
+
let deleteVisible = false;
|
|
171
|
+
rowActions.forEach((rowAction) => {
|
|
172
|
+
const [visible] = getInnerRowAction(rowAction, row, index, rowId);
|
|
173
|
+
switch (rowAction.type) {
|
|
174
|
+
case 'edit': {
|
|
175
|
+
editVisible = visible;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
case 'detail': {
|
|
179
|
+
detailVisible = visible;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
case 'delete': {
|
|
183
|
+
deleteVisible = visible;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
default:
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
editVisible =
|
|
191
|
+
typeof getEditVisible === 'function'
|
|
192
|
+
? getEditVisible(row)
|
|
193
|
+
: editVisible;
|
|
194
|
+
detailVisible =
|
|
195
|
+
typeof getDetailVisible === 'function'
|
|
196
|
+
? getDetailVisible(row)
|
|
197
|
+
: detailVisible;
|
|
198
|
+
deleteVisible =
|
|
199
|
+
typeof getDeleteVisible === 'function'
|
|
200
|
+
? getDeleteVisible(row)
|
|
201
|
+
: deleteVisible;
|
|
202
|
+
|
|
203
|
+
// 过滤掉隐藏的按钮,得到真正的按钮数据
|
|
204
|
+
const actualRowActions = (rowActions || [])
|
|
205
|
+
.filter((btn) => {
|
|
206
|
+
if (
|
|
207
|
+
typeof btn === 'string' ? btn === 'delete' : btn.type === 'delete'
|
|
208
|
+
) {
|
|
209
|
+
return deleteVisible && btn.checked;
|
|
210
|
+
}
|
|
211
|
+
if (
|
|
212
|
+
typeof btn === 'string' ? btn === 'detail' : btn.type === 'detail'
|
|
213
|
+
) {
|
|
214
|
+
return detailVisible && btn.checked;
|
|
215
|
+
}
|
|
216
|
+
return editVisible && btn.checked;
|
|
217
|
+
})
|
|
218
|
+
.map((item) => {
|
|
219
|
+
if (item.disabled) {
|
|
220
|
+
const disabledFunc = (
|
|
221
|
+
row: any,
|
|
222
|
+
index: number | null,
|
|
223
|
+
rowId: string | number,
|
|
224
|
+
) =>
|
|
225
|
+
sandBoxSafeRun(item.disabled, {
|
|
226
|
+
...row,
|
|
227
|
+
row,
|
|
228
|
+
index,
|
|
229
|
+
rowId,
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
...item,
|
|
234
|
+
disabled: disabledFunc(row, index, rowId),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
return item;
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
return actualRowActions;
|
|
241
|
+
}
|
|
242
|
+
return [];
|
|
243
|
+
},
|
|
244
|
+
[
|
|
245
|
+
rowActions,
|
|
246
|
+
sandBoxSafeRun,
|
|
247
|
+
getEditVisible,
|
|
248
|
+
getDetailVisible,
|
|
249
|
+
getDeleteVisible,
|
|
250
|
+
],
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
const getRealExtendRowActions = useCallback(
|
|
254
|
+
(row: any, index: number | null) => {
|
|
255
|
+
const rowId = row[currentRowKey];
|
|
256
|
+
if (Array.isArray(extend) && extend.length) {
|
|
257
|
+
const btnVisible: any = [];
|
|
258
|
+
let eventIndex = 0;
|
|
259
|
+
extend.forEach((item, i) => {
|
|
260
|
+
// 扩展的按钮事件改成动态生成,而不是固定的5个
|
|
261
|
+
if (!item.type) {
|
|
262
|
+
eventIndex += 1;
|
|
263
|
+
}
|
|
264
|
+
const visibleText = `getBtn${eventIndex}Visible`;
|
|
265
|
+
let clickText = item?.value || `onClickBtn${eventIndex}`; // 兼容旧数据
|
|
266
|
+
let visible;
|
|
267
|
+
if (props[visibleText] && typeof props[visibleText] === 'function') {
|
|
268
|
+
visible = props[visibleText](row);
|
|
269
|
+
} else if (item.type) {
|
|
270
|
+
// 内置按钮合并到extend中,当存在type时,表示为内置按钮
|
|
271
|
+
[visible, clickText] = getInnerRowAction(item, row, index, rowId);
|
|
272
|
+
}
|
|
273
|
+
btnVisible.push(visible);
|
|
274
|
+
|
|
275
|
+
if (props[clickText]) {
|
|
276
|
+
item.onClick = props[clickText];
|
|
277
|
+
}
|
|
278
|
+
item.btnType = 'extend';
|
|
279
|
+
});
|
|
280
|
+
// 过滤掉隐藏的扩展按钮,得到真正的扩展按钮数据
|
|
281
|
+
const actualExtendData = extend
|
|
282
|
+
.filter((extd, i) => {
|
|
283
|
+
if (typeof extd.rule === 'string') {
|
|
284
|
+
const stringrule = extd.rule;
|
|
285
|
+
extd.rule = (row: any, index: number) =>
|
|
286
|
+
sandBoxSafeRun(stringrule, {
|
|
287
|
+
...row,
|
|
288
|
+
row,
|
|
289
|
+
index,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const ruleVis =
|
|
294
|
+
typeof extd.rule === 'function'
|
|
295
|
+
? !extd.rule(row, index)
|
|
296
|
+
: !extd.rule;
|
|
297
|
+
|
|
298
|
+
return btnVisible[i] === undefined ? ruleVis : btnVisible[i];
|
|
299
|
+
})
|
|
300
|
+
.map((item) => {
|
|
301
|
+
if (item.disabled) {
|
|
302
|
+
const disabledFunc = (
|
|
303
|
+
row: any,
|
|
304
|
+
index: number | null,
|
|
305
|
+
rowId: string | number,
|
|
306
|
+
) =>
|
|
307
|
+
sandBoxSafeRun(item.disabled, {
|
|
308
|
+
...row,
|
|
309
|
+
row,
|
|
310
|
+
index,
|
|
311
|
+
rowId,
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
return {
|
|
315
|
+
...item,
|
|
316
|
+
disabled: disabledFunc(row, index, rowId),
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
return item;
|
|
320
|
+
});
|
|
321
|
+
return actualExtendData;
|
|
322
|
+
}
|
|
323
|
+
return [];
|
|
324
|
+
},
|
|
325
|
+
[extend, sandBoxSafeRun],
|
|
326
|
+
);
|
|
327
|
+
|
|
328
|
+
const calcRowActionWidth = useCallback(
|
|
329
|
+
(actions = []) => {
|
|
330
|
+
let width = 0;
|
|
331
|
+
const titleArr: any = [];
|
|
332
|
+
let actList = actions;
|
|
333
|
+
|
|
334
|
+
if (actList?.length > extendNum) {
|
|
335
|
+
// 只保留 extendNum 数量的按钮,其他在更多中
|
|
336
|
+
actList = actList.filter(
|
|
337
|
+
(_: any, index: number) => index + 2 <= extendNum,
|
|
338
|
+
);
|
|
339
|
+
actList = [...actList, { title: getLocale('more'), icon: true }];
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
let iconNum = 0;
|
|
343
|
+
actList.forEach((child: any) => {
|
|
344
|
+
if (child.title) {
|
|
345
|
+
titleArr.push(child.title);
|
|
346
|
+
}
|
|
347
|
+
if (child.icon) {
|
|
348
|
+
iconNum += 1;
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
const fontWidth = 14;
|
|
352
|
+
const smFontWidth = 12;
|
|
353
|
+
const defaultIconWidth = 14; // 默认图标宽度
|
|
354
|
+
const space = 4; // 图标与文字间隔
|
|
355
|
+
const defaultPadding = 20; // 默认左右 padding
|
|
356
|
+
const mdsmPadding = 16; // 中小尺寸左右 padding
|
|
357
|
+
const dividerWidth = 17; // 分割线占位宽度(含margin)
|
|
358
|
+
const realPadding = ['small', 'middle'].includes(size || '')
|
|
359
|
+
? mdsmPadding
|
|
360
|
+
: defaultPadding;
|
|
361
|
+
const realFontWidth = size === 'small' ? smFontWidth : fontWidth;
|
|
362
|
+
const realDividerWidth = dividerWidth * (titleArr.length - 1);
|
|
363
|
+
width =
|
|
364
|
+
realDividerWidth +
|
|
365
|
+
(defaultIconWidth + space) * iconNum +
|
|
366
|
+
realFontWidth * titleArr.join('').length +
|
|
367
|
+
realPadding;
|
|
368
|
+
return width;
|
|
369
|
+
},
|
|
370
|
+
[size],
|
|
371
|
+
);
|
|
372
|
+
|
|
373
|
+
const handleResize =
|
|
374
|
+
(index: number) =>
|
|
375
|
+
(_: React.SyntheticEvent<Element>, { size }: any) => {
|
|
376
|
+
const newColumns = [...columnWidth];
|
|
377
|
+
newColumns[index] = Number.isNaN(size.width) ? 200 : size.width;
|
|
378
|
+
setColumnWidth(newColumns);
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// 操作栏扩展按钮
|
|
382
|
+
const renderExtendBtns = (
|
|
383
|
+
btnList: any,
|
|
384
|
+
isPopover = false,
|
|
385
|
+
row: any,
|
|
386
|
+
index: number,
|
|
387
|
+
) => {
|
|
388
|
+
return btnList.map((c: any, i: number) => {
|
|
389
|
+
if (c.type) {
|
|
390
|
+
return renderBuiltInSingleBtn(
|
|
391
|
+
c,
|
|
392
|
+
row,
|
|
393
|
+
index,
|
|
394
|
+
i,
|
|
395
|
+
btnList,
|
|
396
|
+
undefined,
|
|
397
|
+
btnList?.slice(i),
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
const {
|
|
401
|
+
icon,
|
|
402
|
+
iconPos,
|
|
403
|
+
id,
|
|
404
|
+
isIcon,
|
|
405
|
+
onClick,
|
|
406
|
+
visible: buttonVisible = true,
|
|
407
|
+
} = c;
|
|
408
|
+
const iconClassName = iconPos
|
|
409
|
+
? iconPos === 'left'
|
|
410
|
+
? 'actIcon-left'
|
|
411
|
+
: 'actIcon-right'
|
|
412
|
+
: '';
|
|
413
|
+
const BtnIcon = icon ? (
|
|
414
|
+
<CommIcon
|
|
415
|
+
getEngineApis={props?.getEngineApis}
|
|
416
|
+
$$componentItem={props?.$$componentItem}
|
|
417
|
+
className={iconClassName}
|
|
418
|
+
icon={icon}
|
|
419
|
+
engineApis={engineApis}
|
|
420
|
+
/>
|
|
421
|
+
) : undefined;
|
|
422
|
+
return buttonVisible ? (
|
|
423
|
+
isPopover ? (
|
|
424
|
+
<div>
|
|
425
|
+
<Tooltip title={c.title} visible={!!isIcon && undefined}>
|
|
426
|
+
<Button
|
|
427
|
+
type="link"
|
|
428
|
+
className="ued-table-actions-antBtn"
|
|
429
|
+
disabled={c.disabled}
|
|
430
|
+
key={id}
|
|
431
|
+
onClick={(e) => {
|
|
432
|
+
e.stopPropagation();
|
|
433
|
+
if (typeof onClick === 'function') {
|
|
434
|
+
onClick(
|
|
435
|
+
currentRowKey ? row[currentRowKey] : row,
|
|
436
|
+
row,
|
|
437
|
+
index,
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
}}
|
|
441
|
+
>
|
|
442
|
+
<div className="ued-table-actions-extendBtn">
|
|
443
|
+
{iconPos && iconPos === 'left' && BtnIcon}
|
|
444
|
+
{!isIcon && c.title}
|
|
445
|
+
{iconPos && iconPos === 'right' && BtnIcon}
|
|
446
|
+
</div>
|
|
447
|
+
</Button>
|
|
448
|
+
</Tooltip>
|
|
449
|
+
</div>
|
|
450
|
+
) : (
|
|
451
|
+
<Fragment key={id}>
|
|
452
|
+
<Tooltip title={c.title} visible={!!isIcon && undefined}>
|
|
453
|
+
<Button
|
|
454
|
+
type="link"
|
|
455
|
+
className="ued-table-actions-antBtn"
|
|
456
|
+
disabled={c.disabled}
|
|
457
|
+
key={id}
|
|
458
|
+
onClick={(e) => {
|
|
459
|
+
e.stopPropagation();
|
|
460
|
+
if (typeof onClick === 'function') {
|
|
461
|
+
onClick(
|
|
462
|
+
currentRowKey ? row[currentRowKey] : row,
|
|
463
|
+
row,
|
|
464
|
+
index,
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
}}
|
|
468
|
+
>
|
|
469
|
+
<div className="ued-table-actions-extendBtn">
|
|
470
|
+
{iconPos && iconPos === 'left' && BtnIcon}
|
|
471
|
+
{!isIcon && c.title}
|
|
472
|
+
{iconPos && iconPos === 'right' && BtnIcon}
|
|
473
|
+
</div>
|
|
474
|
+
</Button>
|
|
475
|
+
</Tooltip>
|
|
476
|
+
{i !== btnList.length - 1 && <Divider type="vertical" />}
|
|
477
|
+
</Fragment>
|
|
478
|
+
)
|
|
479
|
+
) : null;
|
|
480
|
+
});
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
// 操作栏更多按钮
|
|
484
|
+
const renderExtendMoreBtns = (
|
|
485
|
+
showBuiltInBtns: any[],
|
|
486
|
+
showExtendBtns: any[],
|
|
487
|
+
moreBuiltInBtns: any[],
|
|
488
|
+
moreExtendBtns: any[],
|
|
489
|
+
row: any,
|
|
490
|
+
index: any,
|
|
491
|
+
) => {
|
|
492
|
+
return (
|
|
493
|
+
<>
|
|
494
|
+
{
|
|
495
|
+
// 扩展
|
|
496
|
+
showExtendBtns?.length > 0 ? (
|
|
497
|
+
<>
|
|
498
|
+
{!!showBuiltInBtns?.length && <Divider type="vertical" />}
|
|
499
|
+
{renderExtendBtns(showExtendBtns, false, row, index)}
|
|
500
|
+
</>
|
|
501
|
+
) : null
|
|
502
|
+
}
|
|
503
|
+
{
|
|
504
|
+
// 更多
|
|
505
|
+
moreBuiltInBtns?.length + moreExtendBtns?.length > 0 && (
|
|
506
|
+
<>
|
|
507
|
+
{/* TODO: 是什么? showBuiltInBtns[showBuiltInBtns.length - 1]?.visible !== false */}
|
|
508
|
+
{(!!showBuiltInBtns?.length || !!showExtendBtns?.length) && (
|
|
509
|
+
<Divider type="vertical" />
|
|
510
|
+
)}
|
|
511
|
+
<Popover
|
|
512
|
+
overlayClassName="ued-table-more-pop"
|
|
513
|
+
content={
|
|
514
|
+
<div
|
|
515
|
+
style={{
|
|
516
|
+
maxHeight: '300px',
|
|
517
|
+
overflow: 'auto',
|
|
518
|
+
padding: '12px 16px',
|
|
519
|
+
}}
|
|
520
|
+
onClick={(e) => e.stopPropagation()}
|
|
521
|
+
>
|
|
522
|
+
{moreBuiltInBtns?.length
|
|
523
|
+
? moreBuiltInBtns.map((child: any, idx: number) => {
|
|
524
|
+
return renderBuiltInSingleBtn(
|
|
525
|
+
child,
|
|
526
|
+
row,
|
|
527
|
+
index,
|
|
528
|
+
idx,
|
|
529
|
+
showBuiltInBtns,
|
|
530
|
+
true,
|
|
531
|
+
);
|
|
532
|
+
})
|
|
533
|
+
: null}
|
|
534
|
+
{renderExtendBtns(moreExtendBtns, true, row, index)}
|
|
535
|
+
</div>
|
|
536
|
+
}
|
|
537
|
+
trigger="click"
|
|
538
|
+
placement="topRight"
|
|
539
|
+
>
|
|
540
|
+
<Button
|
|
541
|
+
type="link"
|
|
542
|
+
className="ued-table-actions-antBtn"
|
|
543
|
+
key="more"
|
|
544
|
+
onClick={(e) => e.stopPropagation()}
|
|
545
|
+
>
|
|
546
|
+
<div className="ued-table-actions-extendBtn">
|
|
547
|
+
{getLocale?.('more')}
|
|
548
|
+
<LegacyIcon className="actIcon-left" type="down" />
|
|
549
|
+
</div>
|
|
550
|
+
</Button>
|
|
551
|
+
</Popover>
|
|
552
|
+
</>
|
|
553
|
+
)
|
|
554
|
+
}
|
|
555
|
+
</>
|
|
556
|
+
);
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
// 操作栏单个内置按钮
|
|
560
|
+
const renderBuiltInSingleBtn = (
|
|
561
|
+
c: any,
|
|
562
|
+
row: any,
|
|
563
|
+
rowIndex: number | null,
|
|
564
|
+
idx: number,
|
|
565
|
+
defaultBtnList: any,
|
|
566
|
+
isPopover = false,
|
|
567
|
+
showExtendBtns?: any[],
|
|
568
|
+
moreBuiltInBtns?: any[],
|
|
569
|
+
moreExtendBtns?: any[],
|
|
570
|
+
) => {
|
|
571
|
+
// eslint-disable-next-line no-nested-ternary
|
|
572
|
+
const iconClassName = c?.iconPos
|
|
573
|
+
? c.iconPos === 'left'
|
|
574
|
+
? 'actIcon-left'
|
|
575
|
+
: 'actIcon-right'
|
|
576
|
+
: '';
|
|
577
|
+
const { visible: buttonVisible = true } = c;
|
|
578
|
+
const BtnIcon = c.icon ? (
|
|
579
|
+
<CommIcon
|
|
580
|
+
className={iconClassName}
|
|
581
|
+
icon={c.icon}
|
|
582
|
+
getEngineApis={props?.getEngineApis}
|
|
583
|
+
$$componentItem={props?.$$componentItem}
|
|
584
|
+
/>
|
|
585
|
+
) : undefined;
|
|
586
|
+
|
|
587
|
+
const type = typeof c === 'string' ? c : c?.type;
|
|
588
|
+
|
|
589
|
+
let buildInBtn = (
|
|
590
|
+
<Button
|
|
591
|
+
type="link"
|
|
592
|
+
disabled={c.disabled}
|
|
593
|
+
className={classnames(
|
|
594
|
+
'ued-table-actions-antBtn',
|
|
595
|
+
type ? `ued-table-actions-${type}` : undefined,
|
|
596
|
+
)}
|
|
597
|
+
key={typeof c === 'string' ? c : c.type}
|
|
598
|
+
onClick={(e) => {
|
|
599
|
+
e.stopPropagation();
|
|
600
|
+
if (
|
|
601
|
+
(typeof c === 'string' ? c === 'detail' : c.type === 'detail') &&
|
|
602
|
+
typeof onRowDetailClick === 'function'
|
|
603
|
+
) {
|
|
604
|
+
onRowDetailClick(row, rowIndex);
|
|
605
|
+
} else if (
|
|
606
|
+
(typeof c === 'string' ? c === 'edit' : c.type === 'edit') &&
|
|
607
|
+
typeof onRowEditClick === 'function'
|
|
608
|
+
) {
|
|
609
|
+
onRowEditClick(row, rowIndex);
|
|
610
|
+
}
|
|
611
|
+
setPopVisible({ ...popVisible, [popKey]: false });
|
|
612
|
+
}}
|
|
613
|
+
onDoubleClick={(e) => {
|
|
614
|
+
e.stopPropagation();
|
|
615
|
+
}}
|
|
616
|
+
>
|
|
617
|
+
{typeof c === 'string' ? (
|
|
618
|
+
<div className="ued-table-actions-extendBtn">
|
|
619
|
+
<LegacyIcon className="actIcon-left" type={actionsMap[c][1]} />
|
|
620
|
+
{actionsMap[c][0]}
|
|
621
|
+
</div>
|
|
622
|
+
) : (
|
|
623
|
+
<div className="ued-table-actions-extendBtn">
|
|
624
|
+
{c.iconPos && c.iconPos === 'left' && BtnIcon}
|
|
625
|
+
{!c.isIcon && c.title}
|
|
626
|
+
{c.iconPos && c.iconPos === 'right' && BtnIcon}
|
|
627
|
+
</div>
|
|
628
|
+
)}
|
|
629
|
+
</Button>
|
|
630
|
+
);
|
|
631
|
+
const popKey = `${rowIndex}-${idx}`;
|
|
632
|
+
buildInBtn = c.isIcon ? (
|
|
633
|
+
<Tooltip
|
|
634
|
+
title={c.title}
|
|
635
|
+
// @ts-ignore
|
|
636
|
+
visible={popVisible?.[popKey]}
|
|
637
|
+
onVisibleChange={(v) => setPopVisible({ ...popVisible, [popKey]: v })}
|
|
638
|
+
>
|
|
639
|
+
{buildInBtn}
|
|
640
|
+
</Tooltip>
|
|
641
|
+
) : (
|
|
642
|
+
buildInBtn
|
|
643
|
+
);
|
|
644
|
+
|
|
645
|
+
const btn = buttonVisible ? (
|
|
646
|
+
<Fragment key={idx}>
|
|
647
|
+
{(typeof c === 'string' ? c === 'delete' : c.type === 'delete') &&
|
|
648
|
+
!c.disabled ? (
|
|
649
|
+
<span
|
|
650
|
+
style={{ lineHeight: '0px' }}
|
|
651
|
+
onClick={(e) => {
|
|
652
|
+
e.stopPropagation();
|
|
653
|
+
}}
|
|
654
|
+
onDoubleClick={(e) => {
|
|
655
|
+
e.stopPropagation();
|
|
656
|
+
}}
|
|
657
|
+
>
|
|
658
|
+
<Popconfirm
|
|
659
|
+
onVisibleChange={(v) =>
|
|
660
|
+
v && setPopVisible({ ...popVisible, [popKey]: false })
|
|
661
|
+
}
|
|
662
|
+
placement={
|
|
663
|
+
moreBuiltInBtns?.length ||
|
|
664
|
+
moreExtendBtns?.length ||
|
|
665
|
+
showExtendBtns?.length
|
|
666
|
+
? 'top'
|
|
667
|
+
: 'topRight'
|
|
668
|
+
}
|
|
669
|
+
title={getLocale('deleteConfirm')}
|
|
670
|
+
onConfirm={(e: any) => {
|
|
671
|
+
e.stopPropagation();
|
|
672
|
+
if (typeof onRowDeleteClick === 'function') {
|
|
673
|
+
onRowDeleteClick(row, rowIndex);
|
|
674
|
+
}
|
|
675
|
+
}}
|
|
676
|
+
>
|
|
677
|
+
{buildInBtn}
|
|
678
|
+
</Popconfirm>
|
|
679
|
+
</span>
|
|
680
|
+
) : (
|
|
681
|
+
buildInBtn
|
|
682
|
+
)}
|
|
683
|
+
{!isPopover && idx !== defaultBtnList.length - 1 && (
|
|
684
|
+
<Divider type="vertical" />
|
|
685
|
+
)}
|
|
686
|
+
</Fragment>
|
|
687
|
+
) : null;
|
|
688
|
+
return isPopover ? <div>{btn}</div> : btn;
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
// 递归解析列信息
|
|
692
|
+
const recursiveColumns = (columns: any) => {
|
|
693
|
+
const resolveColumns = columns
|
|
694
|
+
.map((col: any, index: number) => {
|
|
695
|
+
if (col === Table.EXPAND_COLUMN) {
|
|
696
|
+
return col;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// 解析动态列配置,根据动态列数据源,得到真正的列配置数组数据
|
|
700
|
+
if (col.type === 'dynamicCol') {
|
|
701
|
+
if (col?.dataSource?.length) {
|
|
702
|
+
return col.dataSource.map((c: any, index: number) => {
|
|
703
|
+
const dataIndex = c[col.dataIndex];
|
|
704
|
+
const realCol = {
|
|
705
|
+
...col, // 动态列所有配置行为(排序、固定等)相同
|
|
706
|
+
dataIndex,
|
|
707
|
+
title: () => (
|
|
708
|
+
<HeaderCellTitle
|
|
709
|
+
size={size}
|
|
710
|
+
column={{ ...col, title: c[col.title] }}
|
|
711
|
+
mode="engine"
|
|
712
|
+
funcExpExecute={funcExpExecute}
|
|
713
|
+
engineApis={engineApis}
|
|
714
|
+
/>
|
|
715
|
+
),
|
|
716
|
+
onHeaderCell: () => ({
|
|
717
|
+
style: col?.style,
|
|
718
|
+
}),
|
|
719
|
+
};
|
|
720
|
+
// 是否开启筛选
|
|
721
|
+
if (realCol.filter) {
|
|
722
|
+
realCol.onCell = (_: any, rowIndex: number) => ({
|
|
723
|
+
'td-dataIndex': dataIndex,
|
|
724
|
+
rowIndex,
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
realCol.filteredValue = filters[dataIndex];
|
|
728
|
+
realCol.filterDropdown = (filtersParams: FilterDropdownProps) =>
|
|
729
|
+
renderFilterDropDown(
|
|
730
|
+
filtersParams,
|
|
731
|
+
dataIndex,
|
|
732
|
+
resolveColumns,
|
|
733
|
+
);
|
|
734
|
+
realCol.filterDropdownVisible = !!filterDropdownOpen[dataIndex];
|
|
735
|
+
realCol.onFilterDropdownVisibleChange = (open: boolean) => {
|
|
736
|
+
onFilterDropdownVisibleChange(dataIndex, open);
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// key增强,拼接index,防止重复
|
|
741
|
+
realCol.key = `${realCol.key}_${index}`;
|
|
742
|
+
|
|
743
|
+
// 移除动态列标识字段,和动态列数据源字段
|
|
744
|
+
delete realCol.type;
|
|
745
|
+
delete realCol.dataSource;
|
|
746
|
+
return realCol;
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
return [];
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
if (col?.children?.length) {
|
|
753
|
+
col.children = recursiveColumns(col?.children);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
return {
|
|
757
|
+
...col,
|
|
758
|
+
onCell: (record: any, rowIndex: number) => {
|
|
759
|
+
const __rowSpan = rowSpanMap?.get(record) || {};
|
|
760
|
+
const __rowClass = rowClassMap?.get(record) || {};
|
|
761
|
+
const rowSpan =
|
|
762
|
+
__rowSpan && __rowSpan[col.dataIndex] === undefined
|
|
763
|
+
? 1
|
|
764
|
+
: __rowSpan[col.dataIndex];
|
|
765
|
+
const rowClass = __rowClass && __rowClass[col.dataIndex];
|
|
766
|
+
|
|
767
|
+
const cellProps: any = {
|
|
768
|
+
engineApis,
|
|
769
|
+
funcExpExecute,
|
|
770
|
+
appId,
|
|
771
|
+
pageId,
|
|
772
|
+
row: record,
|
|
773
|
+
rowId: record[currentRowKey],
|
|
774
|
+
rowIndex,
|
|
775
|
+
editable:
|
|
776
|
+
!!col.editoption &&
|
|
777
|
+
currentRowKey &&
|
|
778
|
+
nowInlineEditKey &&
|
|
779
|
+
record[currentRowKey] === nowInlineEditKey,
|
|
780
|
+
isExtend: col.isExtend,
|
|
781
|
+
dataIndex: col.dataIndex,
|
|
782
|
+
colorFormatInfo: [
|
|
783
|
+
...(colorFormatInfo || []),
|
|
784
|
+
...(col.colorFormatInfo || []),
|
|
785
|
+
],
|
|
786
|
+
isCustomRendering: !!col.customRendering,
|
|
787
|
+
rowSpan,
|
|
788
|
+
className: rowClass,
|
|
789
|
+
onTableCellClick,
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
if (col.filter) {
|
|
793
|
+
// 开启过滤时,在td元素上记录对应的字段编码
|
|
794
|
+
cellProps['td-dataIndex'] = col.dataIndex;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
const { translateContent } = parseTranslateContent(col, {
|
|
798
|
+
text: record[col.dataIndex],
|
|
799
|
+
row: record,
|
|
800
|
+
index,
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
// 单元格提示 -> 默认提示
|
|
804
|
+
if (
|
|
805
|
+
col?.editContent?.edittype === 'title' &&
|
|
806
|
+
col?.editContent?.title &&
|
|
807
|
+
col.key !== ACTION_COL_KEY // 操作列不需要默认提示
|
|
808
|
+
) {
|
|
809
|
+
if (
|
|
810
|
+
col?.editContent?.title?.code &&
|
|
811
|
+
col?.editContent?.title?.jsx
|
|
812
|
+
) {
|
|
813
|
+
cellProps.title = undefined;
|
|
814
|
+
} else if (
|
|
815
|
+
col?.editContent?.title?.code &&
|
|
816
|
+
funcExpExecute &&
|
|
817
|
+
!col?.editContent?.title?.jsx
|
|
818
|
+
) {
|
|
819
|
+
// 如果是这个函数表示默认名称(因为垃圾DSL中,如果是这个code表示提示标题)
|
|
820
|
+
if (
|
|
821
|
+
col.editContent.title.code ===
|
|
822
|
+
'function main(text, row, index) { return text;}'
|
|
823
|
+
) {
|
|
824
|
+
cellProps.title = translateContent;
|
|
825
|
+
} else {
|
|
826
|
+
// 以下这个方法执行'function main(text, row, index) { return text;}'会报错, 先不兼容处理,先使用新版的jsx进行
|
|
827
|
+
cellProps.title = funcExpExecute(col.editContent.title.code, [
|
|
828
|
+
{
|
|
829
|
+
key: 'rowId',
|
|
830
|
+
value: translateContent,
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
key: 'row',
|
|
834
|
+
value: record,
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
key: 'index',
|
|
838
|
+
value: rowIndex,
|
|
839
|
+
},
|
|
840
|
+
]);
|
|
841
|
+
}
|
|
842
|
+
} else {
|
|
843
|
+
cellProps.title = col?.editContent?.title;
|
|
844
|
+
}
|
|
845
|
+
// 当editContent是false表示不提示,否则默认提示标题
|
|
846
|
+
} else if (col.editContent !== false) {
|
|
847
|
+
// 默认进行标题的提示
|
|
848
|
+
cellProps.title = translateContent;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
return cellProps;
|
|
852
|
+
},
|
|
853
|
+
onHeaderCell: (record: any) => ({
|
|
854
|
+
width: record.width,
|
|
855
|
+
isFlexColumn,
|
|
856
|
+
onResize: handleResize(index),
|
|
857
|
+
style: record?.style,
|
|
858
|
+
}),
|
|
859
|
+
};
|
|
860
|
+
})
|
|
861
|
+
.reduce((prev: any, curr: any) => {
|
|
862
|
+
// 将动态列的列配置数组数据打平
|
|
863
|
+
if (Array.isArray(curr)) {
|
|
864
|
+
return [...prev, ...curr];
|
|
865
|
+
}
|
|
866
|
+
return [...prev, curr];
|
|
867
|
+
}, []);
|
|
868
|
+
return resolveColumns;
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
const actionsColWidth = useMemo(() => {
|
|
872
|
+
if (!actionWidth && innerDataSource && innerDataSource.length) {
|
|
873
|
+
let width = 0;
|
|
874
|
+
innerDataSource.forEach((row: any, index: number) => {
|
|
875
|
+
// 过滤掉隐藏的按钮,得到真正的内置的默认按钮数据(详情、编辑、删除)
|
|
876
|
+
const actualRowActions = getRealRowActions(row, index);
|
|
877
|
+
// 过滤掉隐藏的扩展按钮,得到真正的扩展按钮数据
|
|
878
|
+
const actualExtendRowActions = getRealExtendRowActions(row, index);
|
|
879
|
+
|
|
880
|
+
const currRowActionWidth = calcRowActionWidth([
|
|
881
|
+
...actualRowActions,
|
|
882
|
+
...actualExtendRowActions,
|
|
883
|
+
]);
|
|
884
|
+
width = currRowActionWidth > width ? currRowActionWidth : width;
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
return width || undefined;
|
|
888
|
+
}
|
|
889
|
+
return actionWidth;
|
|
890
|
+
}, [
|
|
891
|
+
innerDataSource,
|
|
892
|
+
actionWidth,
|
|
893
|
+
getRealRowActions,
|
|
894
|
+
getRealExtendRowActions,
|
|
895
|
+
calcRowActionWidth,
|
|
896
|
+
]);
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* 符合非隐藏规则列
|
|
900
|
+
* customCols:左右固定列 + 已选的、自定义顺序的列
|
|
901
|
+
* customizableCols:可自定义(显隐、顺序)的列
|
|
902
|
+
*/
|
|
903
|
+
const [customCols, customizableCols] = useMemo(() => {
|
|
904
|
+
const fixedLeft: any[] = [];
|
|
905
|
+
const fixedRight: any[] = [];
|
|
906
|
+
let newColumns = [...columns];
|
|
907
|
+
let hiddenCount = 0;
|
|
908
|
+
// 当前用户设置过的自定义列顺序
|
|
909
|
+
const orderMap: any = {};
|
|
910
|
+
// @ts-ignore
|
|
911
|
+
colCustomOrder.forEach((o, i) => {
|
|
912
|
+
orderMap[o] = i;
|
|
913
|
+
});
|
|
914
|
+
// 记录表格列内容
|
|
915
|
+
const colMap: any = {};
|
|
916
|
+
// 记录重新调整列内容后之前没有的列
|
|
917
|
+
const extendCols: any[] = [];
|
|
918
|
+
columns.forEach((c: any, i: number) => {
|
|
919
|
+
try {
|
|
920
|
+
let isHidden;
|
|
921
|
+
const colHiddenRule = c?.hiddenRule;
|
|
922
|
+
if (colHiddenRule) {
|
|
923
|
+
isHidden = sandBoxSafeRun(colHiddenRule);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
const newCol = {
|
|
927
|
+
...c,
|
|
928
|
+
originTitle: c.title,
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
if (isHidden) {
|
|
932
|
+
newColumns.splice(i - hiddenCount, 1);
|
|
933
|
+
hiddenCount += 1;
|
|
934
|
+
} else if (c.fixed) {
|
|
935
|
+
if (c.fixed === 'left') {
|
|
936
|
+
fixedLeft.push(newCol);
|
|
937
|
+
} else {
|
|
938
|
+
fixedRight.push(newCol);
|
|
939
|
+
}
|
|
940
|
+
} else {
|
|
941
|
+
colMap[c.dataIndex] = newCol;
|
|
942
|
+
if (orderMap[c.dataIndex] === undefined) {
|
|
943
|
+
extendCols.push(newCol);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
} catch (e) {
|
|
947
|
+
console.log(e);
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
newColumns = [];
|
|
951
|
+
colCustomOrder.forEach((c: any) => {
|
|
952
|
+
if (colMap[c]) {
|
|
953
|
+
newColumns.push(colMap[c]);
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
const customizableCols = newColumns.concat(extendCols);
|
|
957
|
+
// 只展示选中列
|
|
958
|
+
let customCols = customizableCols.filter(
|
|
959
|
+
(c) =>
|
|
960
|
+
customSelectedCols === undefined ||
|
|
961
|
+
customSelectedCols?.includes(c.dataIndex),
|
|
962
|
+
);
|
|
963
|
+
// 固定列与自定义列拼接在一起组成最终展示列
|
|
964
|
+
customCols = fixedLeft.concat(customCols).concat(fixedRight);
|
|
965
|
+
return [customCols, customizableCols];
|
|
966
|
+
}, [columns, colCustomOrder, customSelectedCols]);
|
|
967
|
+
|
|
968
|
+
const actionRowFlag = useRef<boolean>(false);
|
|
969
|
+
|
|
970
|
+
const parseTranslateContent = (
|
|
971
|
+
c: any,
|
|
972
|
+
rowInfo: {
|
|
973
|
+
text: any;
|
|
974
|
+
row: any;
|
|
975
|
+
index: number;
|
|
976
|
+
},
|
|
977
|
+
) => {
|
|
978
|
+
const { text, row, index } = rowInfo;
|
|
979
|
+
const { staticDataSource, staticService, editoption, dataIndex } = c;
|
|
980
|
+
const isOrderCol = !!(c.type && c.type === 'orderCol'); // 判断是否为内置序号列
|
|
981
|
+
|
|
982
|
+
// 行编辑规则当列所有行共用,现改为某行当列专用,实现数据联动
|
|
983
|
+
const rowEditoption = JSON.parse(JSON.stringify(editoption || '{}'));
|
|
984
|
+
// 此时为下拉框绑定表达式场景,需要通过沙箱编译
|
|
985
|
+
const baseValName = rowEditoption?.selectoption?.valName;
|
|
986
|
+
const childKeys = rowEditoption?.selectoption?.attr?.childKeys; // 绑定静态数据时,可能选择了某几个项
|
|
987
|
+
|
|
988
|
+
if (typeof baseValName === 'string') {
|
|
989
|
+
editoption.selectoption.renderValName = (row: any, index: number) =>
|
|
990
|
+
sandBoxSafeRun(baseValName, {
|
|
991
|
+
...row,
|
|
992
|
+
row,
|
|
993
|
+
index,
|
|
994
|
+
});
|
|
995
|
+
|
|
996
|
+
let _valName;
|
|
997
|
+
const _row =
|
|
998
|
+
// eslint-disable-next-line eqeqeq
|
|
999
|
+
editMode == 'multiple' && row[currentRowKey] === nowInlineEditKey
|
|
1000
|
+
? nowEditingData
|
|
1001
|
+
: innerDataSource.find(
|
|
1002
|
+
(r: any) => r[currentRowKey] === row[currentRowKey],
|
|
1003
|
+
);
|
|
1004
|
+
try {
|
|
1005
|
+
_valName = editoption.selectoption.renderValName(_row, index);
|
|
1006
|
+
} catch (e) {
|
|
1007
|
+
console.error(e);
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
rowEditoption.selectoption = {
|
|
1011
|
+
...rowEditoption.selectoption,
|
|
1012
|
+
valName: Array.isArray(_valName) ? _valName : [],
|
|
1013
|
+
};
|
|
1014
|
+
} else if (Array.isArray(childKeys) && childKeys.length) {
|
|
1015
|
+
// 如果选项设置中设置了静态编码,并且指勾选了其中几项属性,则需要过滤
|
|
1016
|
+
rowEditoption.selectoption.options =
|
|
1017
|
+
rowEditoption.selectoption.options.filter((d: any) =>
|
|
1018
|
+
childKeys.includes(d.value),
|
|
1019
|
+
);
|
|
1020
|
+
} else if (
|
|
1021
|
+
rowEditoption?.selectoption?.staticService &&
|
|
1022
|
+
colServiceDataForEdit
|
|
1023
|
+
) {
|
|
1024
|
+
// 绑定了服务
|
|
1025
|
+
const { labelKey, valueKey } = rowEditoption.selectoption.staticService;
|
|
1026
|
+
const optionskey = Object.keys(colServiceDataForEdit).find((k) => {
|
|
1027
|
+
if (k === c.dataIndex && Array.isArray(colServiceDataForEdit[k])) {
|
|
1028
|
+
return true;
|
|
1029
|
+
}
|
|
1030
|
+
return false;
|
|
1031
|
+
});
|
|
1032
|
+
if (optionskey) {
|
|
1033
|
+
rowEditoption.selectoption.colServiceData = colServiceDataForEdit[
|
|
1034
|
+
optionskey
|
|
1035
|
+
].map((o: any) => ({
|
|
1036
|
+
value: o[valueKey],
|
|
1037
|
+
label: o[labelKey],
|
|
1038
|
+
key: o[valueKey],
|
|
1039
|
+
}));
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
let translateContent = text;
|
|
1044
|
+
|
|
1045
|
+
// 内容不为空进行数据翻译
|
|
1046
|
+
if (translateContent !== undefined && translateContent !== null) {
|
|
1047
|
+
// 静态数据翻译
|
|
1048
|
+
if (Array.isArray(staticDataSource)) {
|
|
1049
|
+
// 支持数组或逗号分支字符翻译
|
|
1050
|
+
translateContent = (
|
|
1051
|
+
Array.isArray(text) ? text : String(text).split(',')
|
|
1052
|
+
)
|
|
1053
|
+
.map((n) => {
|
|
1054
|
+
// 弱等保证 Number 与 String 可比较
|
|
1055
|
+
const obj = staticDataSource.find((o) => o.value == n); // eslint-disable-line
|
|
1056
|
+
return obj ? obj.label : n;
|
|
1057
|
+
})
|
|
1058
|
+
.join(',');
|
|
1059
|
+
} else if (
|
|
1060
|
+
editoption &&
|
|
1061
|
+
editoption?.__staticService__ &&
|
|
1062
|
+
editoption.edittype === 'SuperSelect'
|
|
1063
|
+
) {
|
|
1064
|
+
// 高级选择框选用后端翻译好的字段值
|
|
1065
|
+
const _introduce = row[`${dataIndex}_introduce`];
|
|
1066
|
+
translateContent = _introduce
|
|
1067
|
+
? (Array.isArray(_introduce) ? _introduce : [_introduce]).join(',')
|
|
1068
|
+
: text;
|
|
1069
|
+
}
|
|
1070
|
+
// 服务数据翻译
|
|
1071
|
+
if (staticService && colServiceData) {
|
|
1072
|
+
const { labelKey, valueKey } = staticService;
|
|
1073
|
+
const needtranskey = Object.keys(colServiceData).find(
|
|
1074
|
+
(k) => k === c.dataIndex && Array.isArray(colServiceData[k]),
|
|
1075
|
+
);
|
|
1076
|
+
if (needtranskey) {
|
|
1077
|
+
// 支持数组或逗号分支字符翻译
|
|
1078
|
+
translateContent = (
|
|
1079
|
+
Array.isArray(text) ? text : String(text).split(',')
|
|
1080
|
+
)
|
|
1081
|
+
.map((n) => {
|
|
1082
|
+
// 弱等保证 Number 与 String 可比较
|
|
1083
|
+
const obj = colServiceData[needtranskey].find(
|
|
1084
|
+
(o: any) => o[valueKey] == n,
|
|
1085
|
+
); // eslint-disable-line
|
|
1086
|
+
return obj ? obj[labelKey] : n;
|
|
1087
|
+
})
|
|
1088
|
+
.join(',');
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
if (editoption?.edittype === 'ModalSelect') {
|
|
1092
|
+
const _introduce = row[`${dataIndex}_introduce`];
|
|
1093
|
+
translateContent = _introduce
|
|
1094
|
+
? (Array.isArray(_introduce) ? _introduce : [_introduce]).join(',')
|
|
1095
|
+
: text;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
// 内置序号列,数据内容自增规则为 1 2 3 4
|
|
1100
|
+
if (isOrderCol) {
|
|
1101
|
+
const beforeNums = page
|
|
1102
|
+
? (pagination.current - 1) * pagination.pageSize
|
|
1103
|
+
: 0;
|
|
1104
|
+
translateContent = beforeNums + index + 1; // 暂不支持翻译(咨询欢姐),所以放在翻译后面,进行覆盖
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
return {
|
|
1108
|
+
translateContent,
|
|
1109
|
+
rowEditoption,
|
|
1110
|
+
};
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
const finalcolumns: any[] = useMemo(() => {
|
|
1114
|
+
const newColumns = [...customCols];
|
|
1115
|
+
const finalCols: ColumnProps<any>[] = [];
|
|
1116
|
+
|
|
1117
|
+
// 用于表格头分组的数据结构:左树根节点,为第0层
|
|
1118
|
+
const leftTree: any = {
|
|
1119
|
+
title: treeRootName,
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1122
|
+
newColumns.forEach((c, i) => {
|
|
1123
|
+
const { editoption, dataIndex, editContent } = c;
|
|
1124
|
+
|
|
1125
|
+
// 按照条件,初始化生成实际的列定义
|
|
1126
|
+
newColumns[i].render = (text: any, row: any, index: any) => {
|
|
1127
|
+
const rowId = row[currentRowKey];
|
|
1128
|
+
const { translateContent, rowEditoption } = parseTranslateContent(c, {
|
|
1129
|
+
text,
|
|
1130
|
+
row,
|
|
1131
|
+
index,
|
|
1132
|
+
});
|
|
1133
|
+
|
|
1134
|
+
// 编辑内容
|
|
1135
|
+
if (editoption && editoption.edittype) {
|
|
1136
|
+
// 行编辑规则
|
|
1137
|
+
const isRowEditableCanUse =
|
|
1138
|
+
!!handleIsRowEditableCanUse &&
|
|
1139
|
+
handleIsRowEditableCanUse(row, index);
|
|
1140
|
+
|
|
1141
|
+
// 列可编辑规则
|
|
1142
|
+
let isColEditable = true;
|
|
1143
|
+
if (typeof editoption.editable === 'string') {
|
|
1144
|
+
const editoptionEditableRule = editoption.editable;
|
|
1145
|
+
editoption.editable = (
|
|
1146
|
+
row: any,
|
|
1147
|
+
rowId: string | number,
|
|
1148
|
+
index: number,
|
|
1149
|
+
) =>
|
|
1150
|
+
sandBoxSafeRun(editoptionEditableRule, {
|
|
1151
|
+
row,
|
|
1152
|
+
rowId,
|
|
1153
|
+
index,
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
if (typeof editoption.editable === 'function') {
|
|
1158
|
+
isColEditable = editoption.editable(row, rowId, index);
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// 弹窗选择控件,组件状态入参处理
|
|
1162
|
+
const responseObj = editoption?.modalInfo?.responseObj;
|
|
1163
|
+
if (
|
|
1164
|
+
Array.isArray(responseObj) &&
|
|
1165
|
+
editoption?.edittype === 'ModalSelect' &&
|
|
1166
|
+
responseObj?.length
|
|
1167
|
+
) {
|
|
1168
|
+
editoption.modalInfo.responseObj = (
|
|
1169
|
+
row: any,
|
|
1170
|
+
rowId: string | number,
|
|
1171
|
+
index: number,
|
|
1172
|
+
) =>
|
|
1173
|
+
responseObj?.map((d: any) => {
|
|
1174
|
+
if (typeof d?.value === 'string') {
|
|
1175
|
+
const rule = d.value;
|
|
1176
|
+
d.value = sandBoxSafeRun(rule, {
|
|
1177
|
+
row,
|
|
1178
|
+
rowId,
|
|
1179
|
+
index,
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
return d;
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
let modalSelectParams = [];
|
|
1187
|
+
if (typeof editoption?.modalInfo?.responseObj === 'function') {
|
|
1188
|
+
modalSelectParams = editoption?.modalInfo?.responseObj(
|
|
1189
|
+
row,
|
|
1190
|
+
rowId,
|
|
1191
|
+
index,
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
const editDisabled = !isColEditable || !isRowEditableCanUse;
|
|
1196
|
+
const isWholeTableEdit = editMode === 'multiple'; // 整表:多行编辑模式
|
|
1197
|
+
const isSingleRowEdit =
|
|
1198
|
+
currentRowKey &&
|
|
1199
|
+
nowInlineEditKey &&
|
|
1200
|
+
row[currentRowKey] === nowInlineEditKey; // 单行编辑模式
|
|
1201
|
+
|
|
1202
|
+
if (isWholeTableEdit || isSingleRowEdit) {
|
|
1203
|
+
const inlineVChange = (value: any, otherProps = {}) => {
|
|
1204
|
+
if (typeof onRowAttrValsChange === 'function') {
|
|
1205
|
+
onRowAttrValsChange(row, dataIndex, value, otherProps);
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
return (
|
|
1210
|
+
<EditComponent
|
|
1211
|
+
c={c}
|
|
1212
|
+
disabled={editDisabled}
|
|
1213
|
+
editoption={rowEditoption}
|
|
1214
|
+
form={form}
|
|
1215
|
+
appId={appId}
|
|
1216
|
+
compId={compId}
|
|
1217
|
+
currentRowKey={currentRowKey}
|
|
1218
|
+
rowId={rowId}
|
|
1219
|
+
rowData={isWholeTableEdit ? row : nowEditingData}
|
|
1220
|
+
inlineVChange={inlineVChange}
|
|
1221
|
+
modalSelectParams={modalSelectParams}
|
|
1222
|
+
sandBoxSafeRun={sandBoxSafeRun}
|
|
1223
|
+
engineApis={engineApis}
|
|
1224
|
+
/>
|
|
1225
|
+
);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
let content = translateContent;
|
|
1230
|
+
|
|
1231
|
+
// 表格单元格内-行数控制控制
|
|
1232
|
+
let controllLineStyle = {};
|
|
1233
|
+
const isLineNumSet =
|
|
1234
|
+
c.lineNum && typeof c.lineNum === 'number' && c.lineNum > 0;
|
|
1235
|
+
if (isLineNumSet) {
|
|
1236
|
+
const lineHeight = size === 'small' ? 16 : 20;
|
|
1237
|
+
controllLineStyle = {
|
|
1238
|
+
lineHeight: `${lineHeight}px`,
|
|
1239
|
+
maxHeight: `${lineHeight * c.lineNum}px`,
|
|
1240
|
+
WebkitLineClamp: c.lineNum,
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
let shouldRenderEdittypeTitle = false;
|
|
1245
|
+
|
|
1246
|
+
if (
|
|
1247
|
+
c?.editContent?.edittype === 'title' &&
|
|
1248
|
+
c?.editContent?.title &&
|
|
1249
|
+
c.key !== ACTION_COL_KEY // 操作列不需要默认提示
|
|
1250
|
+
) {
|
|
1251
|
+
if (c?.editContent?.title?.code && c?.editContent?.title?.jsx) {
|
|
1252
|
+
shouldRenderEdittypeTitle = true;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
if (isLineNumSet && !c.customRendering) {
|
|
1256
|
+
if (shouldRenderEdittypeTitle) {
|
|
1257
|
+
content = (
|
|
1258
|
+
<span
|
|
1259
|
+
className="ued-control-line-number"
|
|
1260
|
+
style={controllLineStyle}
|
|
1261
|
+
>
|
|
1262
|
+
<Tooltip
|
|
1263
|
+
title={
|
|
1264
|
+
<CustomModule
|
|
1265
|
+
code={c?.editContent?.title?.code}
|
|
1266
|
+
sandBoxLoadModule={engineApis.sandBoxLoadModule}
|
|
1267
|
+
errorInfo={{
|
|
1268
|
+
id: props.$$componentItem.id,
|
|
1269
|
+
}}
|
|
1270
|
+
compProps={{
|
|
1271
|
+
text: translateContent,
|
|
1272
|
+
item: row,
|
|
1273
|
+
index,
|
|
1274
|
+
}}
|
|
1275
|
+
/>
|
|
1276
|
+
}
|
|
1277
|
+
>
|
|
1278
|
+
<span>{translateContent}</span>
|
|
1279
|
+
</Tooltip>
|
|
1280
|
+
</span>
|
|
1281
|
+
);
|
|
1282
|
+
} else {
|
|
1283
|
+
content = (
|
|
1284
|
+
<span
|
|
1285
|
+
className="ued-control-line-number"
|
|
1286
|
+
style={controllLineStyle}
|
|
1287
|
+
>
|
|
1288
|
+
{translateContent}
|
|
1289
|
+
</span>
|
|
1290
|
+
);
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
// 自定义渲染函数
|
|
1295
|
+
if (c.jsx) {
|
|
1296
|
+
content = (
|
|
1297
|
+
<CustomModule
|
|
1298
|
+
code={c.customRendering}
|
|
1299
|
+
sandBoxLoadModule={engineApis.sandBoxLoadModule}
|
|
1300
|
+
errorInfo={{
|
|
1301
|
+
id: props.$$componentItem.id,
|
|
1302
|
+
}}
|
|
1303
|
+
compProps={{
|
|
1304
|
+
text: translateContent,
|
|
1305
|
+
item: row,
|
|
1306
|
+
index,
|
|
1307
|
+
}}
|
|
1308
|
+
/>
|
|
1309
|
+
);
|
|
1310
|
+
} else if (c.customRendering && funcExpExecute) {
|
|
1311
|
+
content = (
|
|
1312
|
+
<span
|
|
1313
|
+
// eslint-disable-next-line react/no-danger
|
|
1314
|
+
dangerouslySetInnerHTML={{
|
|
1315
|
+
__html: funcExpExecute(c.customRendering, [
|
|
1316
|
+
{
|
|
1317
|
+
key: 'text',
|
|
1318
|
+
value: translateContent,
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
key: 'row',
|
|
1322
|
+
value: row,
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
key: 'index',
|
|
1326
|
+
value: index,
|
|
1327
|
+
},
|
|
1328
|
+
]),
|
|
1329
|
+
}}
|
|
1330
|
+
className={classnames({
|
|
1331
|
+
'ued-control-line-number': isLineNumSet,
|
|
1332
|
+
})}
|
|
1333
|
+
style={controllLineStyle}
|
|
1334
|
+
/>
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
// 单元格提示 -> 气泡卡片
|
|
1339
|
+
if (editContent?.edittype === 'Popover' && editContent?.selectoption) {
|
|
1340
|
+
const { page, options } = editContent.selectoption;
|
|
1341
|
+
// 页面
|
|
1342
|
+
if (page && page.pageId && engineApis?.renderPopover) {
|
|
1343
|
+
if (!Object.keys(pageData).length || !pageData[page.pageId]) {
|
|
1344
|
+
return {
|
|
1345
|
+
children: content,
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
try {
|
|
1350
|
+
const pageRule = page.rule;
|
|
1351
|
+
if (pageRule) {
|
|
1352
|
+
if (typeof pageRule === 'string') {
|
|
1353
|
+
page.rule = (row: any, rowId: string, index: number) =>
|
|
1354
|
+
sandBoxSafeRun(pageRule, {
|
|
1355
|
+
row,
|
|
1356
|
+
rowId,
|
|
1357
|
+
index,
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
if (
|
|
1362
|
+
typeof page?.rule === 'function' &&
|
|
1363
|
+
page.rule(row, rowId, index)
|
|
1364
|
+
) {
|
|
1365
|
+
return {
|
|
1366
|
+
children: content,
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
} catch (e) {
|
|
1371
|
+
console.error(e);
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
const params: any = {};
|
|
1375
|
+
|
|
1376
|
+
if (page.options) {
|
|
1377
|
+
page.options.forEach((_c: any) => {
|
|
1378
|
+
try {
|
|
1379
|
+
const stateParamRule = _c?.paramFunc ?? _c?.stateParam;
|
|
1380
|
+
if (stateParamRule) {
|
|
1381
|
+
if (typeof stateParamRule === 'string') {
|
|
1382
|
+
_c.paramFunc = (row: any, rowId: string, index: number) =>
|
|
1383
|
+
sandBoxSafeRun(stateParamRule, {
|
|
1384
|
+
row,
|
|
1385
|
+
rowId,
|
|
1386
|
+
index,
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
if (typeof _c.paramFunc === 'function') {
|
|
1391
|
+
params[_c.code] = _c.paramFunc(row, rowId, index);
|
|
1392
|
+
_c.stateParam = params[_c.code];
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
} catch (e) {
|
|
1396
|
+
console.error(e);
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
content = engineApis.renderPopover({
|
|
1401
|
+
childElement: content,
|
|
1402
|
+
props,
|
|
1403
|
+
popoverSetting: {
|
|
1404
|
+
page,
|
|
1405
|
+
options: page.options,
|
|
1406
|
+
state: params,
|
|
1407
|
+
},
|
|
1408
|
+
uid: compId,
|
|
1409
|
+
});
|
|
1410
|
+
} else if (options.content) {
|
|
1411
|
+
// 自定义
|
|
1412
|
+
const {
|
|
1413
|
+
maxWidth,
|
|
1414
|
+
content: popContent,
|
|
1415
|
+
rule: popRule,
|
|
1416
|
+
...resOptions
|
|
1417
|
+
} = options;
|
|
1418
|
+
|
|
1419
|
+
// 隐藏规则
|
|
1420
|
+
try {
|
|
1421
|
+
if (popRule) {
|
|
1422
|
+
if (typeof popRule === 'string') {
|
|
1423
|
+
options.rule = (row: any, rowId: string, index: number) =>
|
|
1424
|
+
sandBoxSafeRun(popRule, {
|
|
1425
|
+
row,
|
|
1426
|
+
rowId,
|
|
1427
|
+
index,
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
if (
|
|
1432
|
+
typeof options?.rule === 'function' &&
|
|
1433
|
+
options.rule(row, rowId, index)
|
|
1434
|
+
) {
|
|
1435
|
+
return {
|
|
1436
|
+
children: content,
|
|
1437
|
+
};
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
} catch (e) {
|
|
1441
|
+
console.error(e);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
let newPopContent = popContent;
|
|
1445
|
+
try {
|
|
1446
|
+
if (popContent) {
|
|
1447
|
+
if (typeof popContent === 'string') {
|
|
1448
|
+
options.content = (row: any, rowId: string, index: number) =>
|
|
1449
|
+
sandBoxSafeRun(popContent, {
|
|
1450
|
+
row,
|
|
1451
|
+
rowId,
|
|
1452
|
+
index,
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
if (typeof options?.content === 'function') {
|
|
1457
|
+
newPopContent = options.content(row, rowId, index);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
} catch (e) {
|
|
1461
|
+
console.error(e);
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
content = (
|
|
1465
|
+
<Popover
|
|
1466
|
+
overlayStyle={{
|
|
1467
|
+
maxWidth: maxWidth || 'none',
|
|
1468
|
+
wordBreak: 'break-word',
|
|
1469
|
+
}}
|
|
1470
|
+
content={newPopContent}
|
|
1471
|
+
{...resOptions}
|
|
1472
|
+
arrowPointAtCenter
|
|
1473
|
+
>
|
|
1474
|
+
{content}
|
|
1475
|
+
</Popover>
|
|
1476
|
+
);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
return {
|
|
1481
|
+
children: content,
|
|
1482
|
+
};
|
|
1483
|
+
};
|
|
1484
|
+
|
|
1485
|
+
// 是否开启排序(判断标准:1、配置态配置 sorter: true 2、存量数据存在 defaultSortOrder)
|
|
1486
|
+
if (c.sorter || c.defaultSortOrder) {
|
|
1487
|
+
// 判断是根据前端默认排序函数排序,还是受控排序
|
|
1488
|
+
if (hasSortEvent || Object.keys(rowSpanColMap).length > 0) {
|
|
1489
|
+
newColumns[i].sorter = true;
|
|
1490
|
+
} else {
|
|
1491
|
+
newColumns[i].sorter = (a: any, b: any) => {
|
|
1492
|
+
return compareFn(a[c.dataIndex || c.key], b[c.dataIndex || c.key]);
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
// 是否开启筛选
|
|
1498
|
+
if (c.filter) {
|
|
1499
|
+
newColumns[i].filteredValue = filters[dataIndex];
|
|
1500
|
+
newColumns[i].filterDropdown = (filtersParams: FilterDropdownProps) =>
|
|
1501
|
+
renderFilterDropDown(filtersParams, dataIndex, newColumns);
|
|
1502
|
+
newColumns[i].filterDropdownVisible = !!filterDropdownOpen[dataIndex];
|
|
1503
|
+
newColumns[i].onFilterDropdownVisibleChange = (open: boolean) =>
|
|
1504
|
+
onFilterDropdownVisibleChange(dataIndex, open);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
// 处理表头标题(动态列单独处理)
|
|
1508
|
+
if (c.type !== 'dynamicCol') {
|
|
1509
|
+
newColumns[i].title = () => (
|
|
1510
|
+
<HeaderCellTitle
|
|
1511
|
+
size={size}
|
|
1512
|
+
column={{ ...c, title: c.originTitle }}
|
|
1513
|
+
mode="engine"
|
|
1514
|
+
funcExpExecute={funcExpExecute}
|
|
1515
|
+
engineApis={engineApis}
|
|
1516
|
+
/>
|
|
1517
|
+
);
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
// 处理分组逻辑
|
|
1521
|
+
handleMultiLevelHeader(leftTree, newColumns[i]);
|
|
1522
|
+
});
|
|
1523
|
+
|
|
1524
|
+
// 存在表格头分组后的数据
|
|
1525
|
+
if (leftTree?.children?.length) {
|
|
1526
|
+
finalCols.push(...leftTree?.children);
|
|
1527
|
+
} else {
|
|
1528
|
+
finalCols.push(...newColumns);
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
if (
|
|
1532
|
+
!hiddenAction &&
|
|
1533
|
+
((rowActions && rowActions.length) || (extend && extend.length))
|
|
1534
|
+
) {
|
|
1535
|
+
actionRowFlag.current = true;
|
|
1536
|
+
const actionColumn: any = {
|
|
1537
|
+
title: getLocale('ctrl'),
|
|
1538
|
+
key: ACTION_COL_KEY,
|
|
1539
|
+
width: actionsColWidth,
|
|
1540
|
+
// className: preColIsGroup ? '' : 'divider',
|
|
1541
|
+
editable: false,
|
|
1542
|
+
isExtend: true,
|
|
1543
|
+
id: ACTION_COL_KEY,
|
|
1544
|
+
render: (text: any, row: any, index: number | null) => {
|
|
1545
|
+
const isNowEditRow =
|
|
1546
|
+
currentRowKey &&
|
|
1547
|
+
nowInlineEditKey &&
|
|
1548
|
+
row[currentRowKey] === nowInlineEditKey;
|
|
1549
|
+
|
|
1550
|
+
// 过滤掉隐藏的按钮,得到真正的内置的默认按钮数据(详情、编辑、删除)
|
|
1551
|
+
const builtInBtns = getRealRowActions(
|
|
1552
|
+
row,
|
|
1553
|
+
getRealIndexById(row[currentRowKey]),
|
|
1554
|
+
);
|
|
1555
|
+
// 过滤掉隐藏的扩展按钮,得到真正的扩展按钮数据
|
|
1556
|
+
const extendBtns = getRealExtendRowActions(
|
|
1557
|
+
row,
|
|
1558
|
+
getRealIndexById(row[currentRowKey]),
|
|
1559
|
+
);
|
|
1560
|
+
|
|
1561
|
+
const allBtns = [...builtInBtns, ...extendBtns]?.filter(
|
|
1562
|
+
(btn) => btn?.checked !== false,
|
|
1563
|
+
); // 只展示选中的按钮;
|
|
1564
|
+
|
|
1565
|
+
let showBtns: any[] = [];
|
|
1566
|
+
let moreBtns: any[] = [];
|
|
1567
|
+
|
|
1568
|
+
// 当按钮数量超过 设置最大展示的数量两个时,超过的两个及以上部分放到更多中
|
|
1569
|
+
const allBtnsLen = allBtns?.length;
|
|
1570
|
+
if (allBtnsLen > extendNum) {
|
|
1571
|
+
showBtns = allBtns.slice(0, extendNum - 1);
|
|
1572
|
+
moreBtns = allBtns.slice(extendNum - 1, allBtnsLen);
|
|
1573
|
+
} else {
|
|
1574
|
+
showBtns = allBtns;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
const showBuiltInBtns = showBtns.filter(
|
|
1578
|
+
(b) => b.btnType === 'builtIn',
|
|
1579
|
+
);
|
|
1580
|
+
const showExtendBtns = showBtns.filter((b) => b.btnType === 'extend');
|
|
1581
|
+
const moreBuiltInBtns = moreBtns.filter(
|
|
1582
|
+
(b) => b.btnType === 'builtIn',
|
|
1583
|
+
);
|
|
1584
|
+
const moreExtendBtns = moreBtns.filter((b) => b.btnType === 'extend');
|
|
1585
|
+
|
|
1586
|
+
return (
|
|
1587
|
+
<div className="ued-table-actions">
|
|
1588
|
+
{
|
|
1589
|
+
// 行内编辑部分
|
|
1590
|
+
isNowEditRow ? (
|
|
1591
|
+
<>
|
|
1592
|
+
<div
|
|
1593
|
+
className="ued-table-actions-extendBtn"
|
|
1594
|
+
onClick={(e) => {
|
|
1595
|
+
e.stopPropagation();
|
|
1596
|
+
if (typeof onRowSaveClick === 'function') {
|
|
1597
|
+
onRowSaveClick(
|
|
1598
|
+
row,
|
|
1599
|
+
getRealIndexById(row[currentRowKey]),
|
|
1600
|
+
false,
|
|
1601
|
+
);
|
|
1602
|
+
}
|
|
1603
|
+
}}
|
|
1604
|
+
>
|
|
1605
|
+
<SaveOutlined rev="" className="actIcon-left" />
|
|
1606
|
+
{getLocale('save')}
|
|
1607
|
+
</div>
|
|
1608
|
+
<Divider type="vertical" />
|
|
1609
|
+
<Popconfirm
|
|
1610
|
+
title={getLocale('cancelConfirm')}
|
|
1611
|
+
placement="topRight"
|
|
1612
|
+
overlayClassName="ued-table-actions-overlay"
|
|
1613
|
+
onConfirm={(e: any) => {
|
|
1614
|
+
e.stopPropagation();
|
|
1615
|
+
if (typeof onRowCancelClick === 'function') {
|
|
1616
|
+
onRowCancelClick(row);
|
|
1617
|
+
}
|
|
1618
|
+
}}
|
|
1619
|
+
>
|
|
1620
|
+
<div
|
|
1621
|
+
className="ued-table-actions-extendBtn"
|
|
1622
|
+
onClick={(e) => {
|
|
1623
|
+
e.stopPropagation();
|
|
1624
|
+
}}
|
|
1625
|
+
>
|
|
1626
|
+
<CloseOutlined rev="" className="actIcon-left" />
|
|
1627
|
+
{getLocale('cancel')}
|
|
1628
|
+
</div>
|
|
1629
|
+
</Popconfirm>
|
|
1630
|
+
</>
|
|
1631
|
+
) : (
|
|
1632
|
+
<>
|
|
1633
|
+
{showBuiltInBtns.map((c: any, idx: number) => {
|
|
1634
|
+
return renderBuiltInSingleBtn(
|
|
1635
|
+
c,
|
|
1636
|
+
row,
|
|
1637
|
+
getRealIndexById(row[currentRowKey]),
|
|
1638
|
+
idx,
|
|
1639
|
+
showBuiltInBtns,
|
|
1640
|
+
false,
|
|
1641
|
+
showExtendBtns,
|
|
1642
|
+
moreBuiltInBtns,
|
|
1643
|
+
moreExtendBtns,
|
|
1644
|
+
);
|
|
1645
|
+
})}
|
|
1646
|
+
{renderExtendMoreBtns(
|
|
1647
|
+
showBuiltInBtns,
|
|
1648
|
+
showExtendBtns,
|
|
1649
|
+
moreBuiltInBtns,
|
|
1650
|
+
moreExtendBtns,
|
|
1651
|
+
row,
|
|
1652
|
+
getRealIndexById(row[currentRowKey]),
|
|
1653
|
+
)}
|
|
1654
|
+
</>
|
|
1655
|
+
)
|
|
1656
|
+
}
|
|
1657
|
+
</div>
|
|
1658
|
+
);
|
|
1659
|
+
},
|
|
1660
|
+
};
|
|
1661
|
+
if (fixedAction) {
|
|
1662
|
+
actionColumn.fixed = 'right';
|
|
1663
|
+
}
|
|
1664
|
+
finalCols.push(actionColumn);
|
|
1665
|
+
} else {
|
|
1666
|
+
actionRowFlag.current = false;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
handleExpandColumn({
|
|
1670
|
+
expandComponents,
|
|
1671
|
+
expandIconPosition,
|
|
1672
|
+
expandIconPositionRef,
|
|
1673
|
+
columns: finalCols,
|
|
1674
|
+
});
|
|
1675
|
+
|
|
1676
|
+
// 处理表头背景色
|
|
1677
|
+
if (tableGroupColorInfo) {
|
|
1678
|
+
const { colIdMap }: any =
|
|
1679
|
+
tableGroupColorInfo?.colorType === 'single'
|
|
1680
|
+
? {}
|
|
1681
|
+
: handleRecursiveParseColumns(
|
|
1682
|
+
tableGroupColorInfo?.customColorColumns,
|
|
1683
|
+
);
|
|
1684
|
+
handleRecursiveParseColumns(finalCols, 1, {
|
|
1685
|
+
colorType: tableGroupColorInfo?.colorType,
|
|
1686
|
+
customColorSetting: colIdMap,
|
|
1687
|
+
singleColorSetting: tableGroupColorInfo?.singleColorSetting,
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
const resolvedColumns = recursiveColumns(finalCols);
|
|
1692
|
+
// loading的时候改成鱼骨屏
|
|
1693
|
+
if (loading) {
|
|
1694
|
+
const myColumns: any[] = [];
|
|
1695
|
+
resolvedColumns.forEach((item: any) => {
|
|
1696
|
+
const column: any = cloneDeep(item);
|
|
1697
|
+
column.render = () => <Skeleton.Input active size="small" />;
|
|
1698
|
+
myColumns.push(column);
|
|
1699
|
+
});
|
|
1700
|
+
return myColumns;
|
|
1701
|
+
}
|
|
1702
|
+
return resolvedColumns;
|
|
1703
|
+
}, [
|
|
1704
|
+
// TODO: 简单补充并修正一下依赖项,有问题再看怎么改
|
|
1705
|
+
form,
|
|
1706
|
+
actionsColWidth,
|
|
1707
|
+
innerDataSource,
|
|
1708
|
+
getRealExtendRowActions,
|
|
1709
|
+
getRealRowActions,
|
|
1710
|
+
handleResize,
|
|
1711
|
+
hasSortEvent,
|
|
1712
|
+
page,
|
|
1713
|
+
pagination?.current,
|
|
1714
|
+
pagination?.pageSize,
|
|
1715
|
+
size,
|
|
1716
|
+
compId,
|
|
1717
|
+
rowClassMap,
|
|
1718
|
+
rowSpanMap,
|
|
1719
|
+
// DynamicPopover,
|
|
1720
|
+
colServiceData,
|
|
1721
|
+
colServiceDataForEdit,
|
|
1722
|
+
colorFormatInfo,
|
|
1723
|
+
customCols,
|
|
1724
|
+
currentRowKey,
|
|
1725
|
+
rowSpanColMap,
|
|
1726
|
+
editMode,
|
|
1727
|
+
extend,
|
|
1728
|
+
fixedAction,
|
|
1729
|
+
hiddenAction,
|
|
1730
|
+
nowEditingData,
|
|
1731
|
+
nowInlineEditKey,
|
|
1732
|
+
pageData,
|
|
1733
|
+
renderExtendMoreBtns,
|
|
1734
|
+
rowActions,
|
|
1735
|
+
onRowDetailClick,
|
|
1736
|
+
onRowDeleteClick,
|
|
1737
|
+
onRowEditClick,
|
|
1738
|
+
onRowSaveClick,
|
|
1739
|
+
onRowCancelClick,
|
|
1740
|
+
onRowAttrValsChange,
|
|
1741
|
+
expandComponents,
|
|
1742
|
+
expandIconPosition,
|
|
1743
|
+
expandIconPositionRef,
|
|
1744
|
+
filters,
|
|
1745
|
+
filterDropdownOpen,
|
|
1746
|
+
loading,
|
|
1747
|
+
]);
|
|
1748
|
+
|
|
1749
|
+
const printColumns: any[] = useMemo(() => {
|
|
1750
|
+
if (actionRowFlag.current) {
|
|
1751
|
+
return finalcolumns.slice(0, finalcolumns.length - 2);
|
|
1752
|
+
}
|
|
1753
|
+
return finalcolumns;
|
|
1754
|
+
}, [finalcolumns]);
|
|
1755
|
+
|
|
1756
|
+
useEffect(() => {
|
|
1757
|
+
if (tableRef.current && isFlexColumn) {
|
|
1758
|
+
// 当前执行时,antd表格列虽展示,但列宽按指定宽度渲染,需等下一次render,目前解决办法先延迟执行
|
|
1759
|
+
setTimeout(() => {
|
|
1760
|
+
const thList =
|
|
1761
|
+
tableRef?.current?.querySelectorAll('colgroup')?.[1]?.children || [];
|
|
1762
|
+
|
|
1763
|
+
for (let i = 0; i < thList.length; i += 1) {
|
|
1764
|
+
const rowWidth = thList[i].offsetWidth;
|
|
1765
|
+
columnWidth[i] = rowWidth;
|
|
1766
|
+
}
|
|
1767
|
+
// TODO: 这里是啥意思??
|
|
1768
|
+
if (rowSelection) {
|
|
1769
|
+
columnWidth.shift();
|
|
1770
|
+
}
|
|
1771
|
+
setColumnWidth([...columnWidth]);
|
|
1772
|
+
setInitLoadColWidth(true);
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
}, [tableRef.current, isFlexColumn]);
|
|
1776
|
+
|
|
1777
|
+
// 将自定义列地相关操作记录到sessionStorage中,刷新时保留
|
|
1778
|
+
useEffect(() => {
|
|
1779
|
+
if (
|
|
1780
|
+
compId &&
|
|
1781
|
+
(colCustomOrder?.length > 0 || customSelectedCols !== undefined)
|
|
1782
|
+
) {
|
|
1783
|
+
const tableStr: string =
|
|
1784
|
+
window.sessionStorage.getItem('TABLE_CUSTOM') || '{}';
|
|
1785
|
+
try {
|
|
1786
|
+
const tableInfo = JSON.parse(tableStr);
|
|
1787
|
+
if (!tableInfo[compId]) {
|
|
1788
|
+
tableInfo[compId] = {};
|
|
1789
|
+
}
|
|
1790
|
+
const target = tableInfo[compId];
|
|
1791
|
+
target.ORDER = colCustomOrder;
|
|
1792
|
+
target.SELECTED = customSelectedCols;
|
|
1793
|
+
const newRes = JSON.stringify(tableInfo);
|
|
1794
|
+
if (tableStr !== newRes) {
|
|
1795
|
+
window.sessionStorage.setItem('TABLE_CUSTOM', newRes);
|
|
1796
|
+
}
|
|
1797
|
+
} catch (e) {
|
|
1798
|
+
//
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
}, [colCustomOrder, customSelectedCols, compId]);
|
|
1802
|
+
|
|
1803
|
+
useEffect(() => {
|
|
1804
|
+
if (compId) {
|
|
1805
|
+
const tableStr: string =
|
|
1806
|
+
window.sessionStorage.getItem('TABLE_CUSTOM') || '{}';
|
|
1807
|
+
const tableInfo = JSON.parse(tableStr);
|
|
1808
|
+
const { ORDER = [], SELECTED } = tableInfo[compId] || {};
|
|
1809
|
+
setColCustomOrder(ORDER);
|
|
1810
|
+
setCustomSelectedCols(SELECTED);
|
|
1811
|
+
}
|
|
1812
|
+
}, [compId]);
|
|
1813
|
+
|
|
1814
|
+
useEffect(() => {
|
|
1815
|
+
const newColumns = [...columns];
|
|
1816
|
+
// const pages = {};
|
|
1817
|
+
const popoverPageIds: any[] = [];
|
|
1818
|
+
newColumns.forEach((c, i) => {
|
|
1819
|
+
const { editContent } = c;
|
|
1820
|
+
if (editContent) {
|
|
1821
|
+
if (editContent.edittype === 'Popover' && editContent?.selectoption) {
|
|
1822
|
+
const { page } = editContent.selectoption;
|
|
1823
|
+
if (page?.pageId && !popoverPageIds.includes(page.pageId)) {
|
|
1824
|
+
popoverPageIds.push(page.pageId);
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
});
|
|
1829
|
+
|
|
1830
|
+
popoverPageIds.forEach(async (c) => {
|
|
1831
|
+
const res = await engineApis?.service?.getPageVersionById({ pageId: c });
|
|
1832
|
+
setPageData((pre: any) => ({ ...pre, [c]: res }));
|
|
1833
|
+
});
|
|
1834
|
+
}, [columns.length]);
|
|
1835
|
+
|
|
1836
|
+
return {
|
|
1837
|
+
tableRef,
|
|
1838
|
+
finalcolumns,
|
|
1839
|
+
customizableCols,
|
|
1840
|
+
customSelectedCols,
|
|
1841
|
+
setCustomSelectedCols,
|
|
1842
|
+
setColCustomOrder,
|
|
1843
|
+
columnWidth,
|
|
1844
|
+
setColumnWidth,
|
|
1845
|
+
initLoadColWidth,
|
|
1846
|
+
printColumns,
|
|
1847
|
+
fixedAction,
|
|
1848
|
+
};
|
|
1849
|
+
};
|
|
1850
|
+
|
|
1851
|
+
export default useColumns;
|