@lingxiteam/ebe-utils 0.3.20 → 0.3.21
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/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,1050 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloudUploadOutlined,
|
|
3
|
+
PlusOutlined,
|
|
4
|
+
UploadOutlined,
|
|
5
|
+
} from '@ant-design/icons';
|
|
6
|
+
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
7
|
+
import { Button, message, Modal, Radio, Upload } from 'antd';
|
|
8
|
+
import { UploadType } from 'antd/lib/upload/interface';
|
|
9
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
10
|
+
import CommIcon from '../Icon';
|
|
11
|
+
import type { IconCfg } from '../Icon/PropsType';
|
|
12
|
+
import {
|
|
13
|
+
FormFields,
|
|
14
|
+
getFieldsProps,
|
|
15
|
+
useCommonImperativeHandle,
|
|
16
|
+
useForm,
|
|
17
|
+
useListenProps,
|
|
18
|
+
} from '../utils';
|
|
19
|
+
import {
|
|
20
|
+
convertToBytes,
|
|
21
|
+
createRandomStr,
|
|
22
|
+
getAfterString,
|
|
23
|
+
} from '../utils/common';
|
|
24
|
+
import { useLocale } from '../utils/hooks/useLocale';
|
|
25
|
+
import renderReadOnly from '../utils/renderReadOnly';
|
|
26
|
+
import DownloadProgress from './DownloadProgress';
|
|
27
|
+
import UploadItem from './UploadItem';
|
|
28
|
+
|
|
29
|
+
const { Dragger } = Upload;
|
|
30
|
+
export interface MyFormUploadProps {
|
|
31
|
+
onChange?: (list?: any[]) => void;
|
|
32
|
+
onFinishUpload?: (
|
|
33
|
+
file: File,
|
|
34
|
+
fileList: any[],
|
|
35
|
+
fileResponseList: any[],
|
|
36
|
+
) => void;
|
|
37
|
+
onFileListChange?: (fileList: any[], fileResponseList: any[]) => void;
|
|
38
|
+
onFileRemove?: (file: File, fileList: any[]) => void;
|
|
39
|
+
// draggable?: boolean;
|
|
40
|
+
value?: any;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
readOnly?: boolean;
|
|
43
|
+
precheckService?: any;
|
|
44
|
+
numberLimit?: number;
|
|
45
|
+
singleFileMaxSize?: string;
|
|
46
|
+
singleFileMinSize?: string;
|
|
47
|
+
// downloadable?: boolean;
|
|
48
|
+
fileNameEncode?: boolean;
|
|
49
|
+
isWatermark?: boolean;
|
|
50
|
+
optionalFile?: boolean;
|
|
51
|
+
onListenUploading?: (
|
|
52
|
+
file: File,
|
|
53
|
+
fileList: any[],
|
|
54
|
+
fileResponseList: any[],
|
|
55
|
+
) => void;
|
|
56
|
+
onListenDownloading?: (file: any) => void;
|
|
57
|
+
onFileNameClick?: (file: File) => void;
|
|
58
|
+
accept?: any;
|
|
59
|
+
// acceptType?: any;
|
|
60
|
+
// acceptExtension?: any;
|
|
61
|
+
// showUploadList?: boolean;
|
|
62
|
+
action?: string;
|
|
63
|
+
listType?: UploadType;
|
|
64
|
+
uploadText?: string;
|
|
65
|
+
defaultFileList?: any[];
|
|
66
|
+
uploadStyle?: string;
|
|
67
|
+
icon?: IconCfg;
|
|
68
|
+
deleteIcon?: any;
|
|
69
|
+
downloadIcon?: any;
|
|
70
|
+
previewIcon?: any;
|
|
71
|
+
appId: string;
|
|
72
|
+
pageId: string;
|
|
73
|
+
iconFile?: any;
|
|
74
|
+
uploadTimeout?: number;
|
|
75
|
+
onCheckUpload?: () => any;
|
|
76
|
+
headers?: any;
|
|
77
|
+
columns?: any;
|
|
78
|
+
uploadAccepType?: any;
|
|
79
|
+
viewMode: 'newTab' | 'popUp' | 'window';
|
|
80
|
+
modalWidth?: number;
|
|
81
|
+
modalHeight?: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const FormUpload = LingxiForwardRef<any, MyFormUploadProps>((props, ref) => {
|
|
85
|
+
const {
|
|
86
|
+
onChange,
|
|
87
|
+
onFinishUpload,
|
|
88
|
+
onFileListChange,
|
|
89
|
+
onFileRemove,
|
|
90
|
+
children,
|
|
91
|
+
// draggable,
|
|
92
|
+
// acceptType,
|
|
93
|
+
// acceptExtension,
|
|
94
|
+
value,
|
|
95
|
+
disabled = false,
|
|
96
|
+
readOnly = false,
|
|
97
|
+
precheckService,
|
|
98
|
+
numberLimit = 5,
|
|
99
|
+
singleFileMaxSize,
|
|
100
|
+
singleFileMinSize,
|
|
101
|
+
// downloadable = true,
|
|
102
|
+
fileNameEncode = false,
|
|
103
|
+
isWatermark = false,
|
|
104
|
+
optionalFile = false,
|
|
105
|
+
onListenUploading,
|
|
106
|
+
onListenDownloading,
|
|
107
|
+
onFileNameClick,
|
|
108
|
+
// showUploadList,
|
|
109
|
+
uploadText,
|
|
110
|
+
listType,
|
|
111
|
+
uploadStyle,
|
|
112
|
+
deleteIcon,
|
|
113
|
+
downloadIcon,
|
|
114
|
+
previewIcon,
|
|
115
|
+
appId,
|
|
116
|
+
pageId,
|
|
117
|
+
uploadTimeout = 30000,
|
|
118
|
+
onCheckUpload,
|
|
119
|
+
headers,
|
|
120
|
+
icon = {},
|
|
121
|
+
columns,
|
|
122
|
+
uploadAccepType,
|
|
123
|
+
viewMode,
|
|
124
|
+
modalWidth,
|
|
125
|
+
modalHeight,
|
|
126
|
+
getEngineApis,
|
|
127
|
+
className,
|
|
128
|
+
...restProps
|
|
129
|
+
} = props;
|
|
130
|
+
|
|
131
|
+
const engineApis = getEngineApis?.() || {};
|
|
132
|
+
|
|
133
|
+
const { getLocale } = useLocale(engineApis);
|
|
134
|
+
|
|
135
|
+
const { api = '' } = columns || {};
|
|
136
|
+
const [action, setAction] = useState<any>(api);
|
|
137
|
+
const [optionalVisible, setOptionalVisible] = useState<boolean>(false);
|
|
138
|
+
const [okLoading, setOkLoading] = useState<boolean>(false);
|
|
139
|
+
const [downloadWay, setdDownloadWay] = useState<string>('1');
|
|
140
|
+
const [curFile, setCurFile] = useState<any>();
|
|
141
|
+
const [downloadProVisible, setDownloadProVisible] = useState<any>({});
|
|
142
|
+
const progressRef = useRef<any>({});
|
|
143
|
+
const uploadDivRef = useRef<any>(null);
|
|
144
|
+
const handleRemoveCallback = useRef<any>();
|
|
145
|
+
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
if (api) {
|
|
148
|
+
setAction(engineApis?.resolveApiPath?.(api));
|
|
149
|
+
} else {
|
|
150
|
+
// @ts-ignore
|
|
151
|
+
setAction(engineApis?.service?.uploadSingleFile());
|
|
152
|
+
}
|
|
153
|
+
}, [api]);
|
|
154
|
+
|
|
155
|
+
const uploadList = {
|
|
156
|
+
showPreviewIcon: previewIcon?.showPreviewIcon,
|
|
157
|
+
previewIcon: previewIcon?.previewIconType ? (
|
|
158
|
+
<CommIcon
|
|
159
|
+
icon={{
|
|
160
|
+
type: previewIcon?.previewIconType,
|
|
161
|
+
theme: previewIcon?.previewIconTheme,
|
|
162
|
+
isIconFont: previewIcon?.previewIconIsIconFont,
|
|
163
|
+
fontAddress: previewIcon?.downloadIconFontAddress,
|
|
164
|
+
iconFile: previewIcon?.iconFile,
|
|
165
|
+
iconFileInfo: previewIcon?.previewIconIconFileInfo,
|
|
166
|
+
}}
|
|
167
|
+
$$componentItem={props.$$componentItem}
|
|
168
|
+
getEngineApis={getEngineApis}
|
|
169
|
+
className=""
|
|
170
|
+
/>
|
|
171
|
+
) : (
|
|
172
|
+
<CommIcon
|
|
173
|
+
icon={{
|
|
174
|
+
type: 'eye',
|
|
175
|
+
theme: 'outlined',
|
|
176
|
+
isIconFont: false,
|
|
177
|
+
}}
|
|
178
|
+
$$componentItem={props.$$componentItem}
|
|
179
|
+
getEngineApis={getEngineApis}
|
|
180
|
+
className=""
|
|
181
|
+
/>
|
|
182
|
+
),
|
|
183
|
+
showDownloadIcon: downloadIcon?.showDownloadIcon,
|
|
184
|
+
downloadIcon: (file: any) => {
|
|
185
|
+
if (downloadProVisible[file.fileId]) {
|
|
186
|
+
return (
|
|
187
|
+
<DownloadProgress
|
|
188
|
+
ref={(r: any) => {
|
|
189
|
+
progressRef.current[file.fileId] = r;
|
|
190
|
+
}}
|
|
191
|
+
/>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
return downloadIcon?.downloadIconType ? (
|
|
195
|
+
<CommIcon
|
|
196
|
+
icon={{
|
|
197
|
+
type: downloadIcon?.downloadIconType,
|
|
198
|
+
theme: downloadIcon?.downloadIconTheme,
|
|
199
|
+
isIconFont: downloadIcon?.downloadIconIsIconFont,
|
|
200
|
+
fontAddress: previewIcon?.downloadIconFontAddress,
|
|
201
|
+
iconFile: downloadIcon?.iconFile,
|
|
202
|
+
iconFileInfo: downloadIcon?.downloadIconIconFileInfo,
|
|
203
|
+
}}
|
|
204
|
+
$$componentItem={props.$$componentItem}
|
|
205
|
+
getEngineApis={getEngineApis}
|
|
206
|
+
className=""
|
|
207
|
+
/>
|
|
208
|
+
) : (
|
|
209
|
+
<CommIcon
|
|
210
|
+
icon={{
|
|
211
|
+
type: 'download',
|
|
212
|
+
theme: 'outlined',
|
|
213
|
+
isIconFont: false,
|
|
214
|
+
}}
|
|
215
|
+
getEngineApis={getEngineApis}
|
|
216
|
+
$$componentItem={props.$$componentItem}
|
|
217
|
+
className=""
|
|
218
|
+
/>
|
|
219
|
+
);
|
|
220
|
+
},
|
|
221
|
+
showRemoveIcon: !(disabled || readOnly) && deleteIcon?.showRemoveIcon,
|
|
222
|
+
removeIcon: deleteIcon?.deleteIconType ? (
|
|
223
|
+
<CommIcon
|
|
224
|
+
icon={{
|
|
225
|
+
type: deleteIcon?.deleteIconType,
|
|
226
|
+
theme: deleteIcon?.deleteIconTheme,
|
|
227
|
+
isIconFont: deleteIcon?.deleteIconIsIconFont,
|
|
228
|
+
fontAddress: deleteIcon?.deleteIconFontAddress,
|
|
229
|
+
iconFile: deleteIcon?.iconFile,
|
|
230
|
+
iconFileInfo: deleteIcon?.deleteIconIconFileInfo,
|
|
231
|
+
}}
|
|
232
|
+
$$componentItem={props.$$componentItem}
|
|
233
|
+
getEngineApis={getEngineApis}
|
|
234
|
+
className=""
|
|
235
|
+
/>
|
|
236
|
+
) : (
|
|
237
|
+
<CommIcon
|
|
238
|
+
icon={{
|
|
239
|
+
type: 'delete',
|
|
240
|
+
theme: 'outlined',
|
|
241
|
+
isIconFont: false,
|
|
242
|
+
}}
|
|
243
|
+
$$componentItem={props.$$componentItem}
|
|
244
|
+
className=""
|
|
245
|
+
getEngineApis={getEngineApis}
|
|
246
|
+
/>
|
|
247
|
+
),
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const [fileList, setFileList] = useState<any[]>();
|
|
251
|
+
|
|
252
|
+
// 文件名为全路径时,拆分出实际文件名
|
|
253
|
+
const handleFileName = (_fileName: string) =>
|
|
254
|
+
_fileName ? _fileName.split('//').pop() : _fileName;
|
|
255
|
+
|
|
256
|
+
const updateDefaultFileList = (srcList: any) => {
|
|
257
|
+
if (srcList && Array.isArray(srcList)) {
|
|
258
|
+
const defaultList = JSON.parse(JSON.stringify(srcList));
|
|
259
|
+
setFileList(
|
|
260
|
+
defaultList.map((file: any) => {
|
|
261
|
+
const { fileUrl, url, filePathInServer, fileId } = file;
|
|
262
|
+
let effectDownUrl = fileUrl || url;
|
|
263
|
+
if (
|
|
264
|
+
!effectDownUrl &&
|
|
265
|
+
filePathInServer?.match(/^(http:|https:|\/\/)/)
|
|
266
|
+
) {
|
|
267
|
+
effectDownUrl = filePathInServer;
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
...file,
|
|
271
|
+
url:
|
|
272
|
+
effectDownUrl || engineApis?.service?.getAppFileUrlById(fileId),
|
|
273
|
+
name: file.fileName,
|
|
274
|
+
uid: `-${file.fileId || file.id || effectDownUrl || file.uid}`, // 添加uid
|
|
275
|
+
status: file?.status || 'done', // 后台已存在文件状态为已完成
|
|
276
|
+
};
|
|
277
|
+
}),
|
|
278
|
+
);
|
|
279
|
+
} else {
|
|
280
|
+
setFileList([]);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// 监听value值变化
|
|
285
|
+
useEffect(() => {
|
|
286
|
+
updateDefaultFileList(value);
|
|
287
|
+
}, [value]);
|
|
288
|
+
|
|
289
|
+
let beforeUploadCounter = 0; // 当前一次选择的待上传文件个数
|
|
290
|
+
let allFilesLength = 0; // 待上传文件个数 + 当前文件列表个数
|
|
291
|
+
let continueUpload = true; // 是否继续上传
|
|
292
|
+
|
|
293
|
+
const handleOnChange = (e: any) => {
|
|
294
|
+
beforeUploadCounter = 0;
|
|
295
|
+
if (!continueUpload) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
try {
|
|
299
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
300
|
+
const { file, fileList } = e;
|
|
301
|
+
const { percent, status } = file;
|
|
302
|
+
if (onListenUploading) {
|
|
303
|
+
onListenUploading(
|
|
304
|
+
file,
|
|
305
|
+
fileList,
|
|
306
|
+
fileList?.map((file: any) =>
|
|
307
|
+
file?.fileId ? file : file?.response?.resultObject,
|
|
308
|
+
),
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
if (fileList && onFileListChange) {
|
|
312
|
+
onFileListChange(
|
|
313
|
+
fileList,
|
|
314
|
+
fileList?.map((file: any) =>
|
|
315
|
+
file?.fileId ? file : file?.response?.resultObject,
|
|
316
|
+
),
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
// 上传完成的标识
|
|
320
|
+
let flag = true;
|
|
321
|
+
let files = fileList.map((f: any) => {
|
|
322
|
+
// 存在上传中的文件时,视为未完成
|
|
323
|
+
if (
|
|
324
|
+
f.status === 'uploading' ||
|
|
325
|
+
(!(f.response && typeof f.response === 'object') &&
|
|
326
|
+
f.status !== 'done')
|
|
327
|
+
) {
|
|
328
|
+
flag = false;
|
|
329
|
+
}
|
|
330
|
+
if (f.response && typeof f.response === 'object') {
|
|
331
|
+
const { resultObject, resultCode } = f.response;
|
|
332
|
+
if (resultObject) {
|
|
333
|
+
const {
|
|
334
|
+
fileId,
|
|
335
|
+
filePathInServer = undefined,
|
|
336
|
+
fileUrl = undefined,
|
|
337
|
+
url = undefined,
|
|
338
|
+
} = resultObject;
|
|
339
|
+
const { status } = f;
|
|
340
|
+
let effectDownUrl = fileUrl || url;
|
|
341
|
+
if (
|
|
342
|
+
!effectDownUrl &&
|
|
343
|
+
filePathInServer?.match(/^(http:|https:|\/\/)/)
|
|
344
|
+
) {
|
|
345
|
+
effectDownUrl = filePathInServer;
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
...f,
|
|
349
|
+
...resultObject,
|
|
350
|
+
name: handleFileName(f.name),
|
|
351
|
+
status: +resultCode !== 0 ? 'error' : status,
|
|
352
|
+
url:
|
|
353
|
+
effectDownUrl || engineApis?.service?.getAppFileUrlById(fileId),
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return f;
|
|
358
|
+
});
|
|
359
|
+
// 所有文件上传完成后才触发值回调
|
|
360
|
+
if (flag) {
|
|
361
|
+
// 只设置成功的列表
|
|
362
|
+
files = files.filter((file: any) => {
|
|
363
|
+
const { resultCode, resultMsg } = file?.response || {};
|
|
364
|
+
if (+resultCode !== 0 && resultMsg) {
|
|
365
|
+
message.error(resultMsg);
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
return true;
|
|
369
|
+
});
|
|
370
|
+
// 结束后才执行值回调
|
|
371
|
+
let fileResponseList = files;
|
|
372
|
+
if (typeof onChange === 'function') {
|
|
373
|
+
fileResponseList = files
|
|
374
|
+
?.map((file: any) => {
|
|
375
|
+
if (file?.error) {
|
|
376
|
+
message.error(file.error?.message);
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
if (file?.fileId) {
|
|
380
|
+
const {
|
|
381
|
+
fileId,
|
|
382
|
+
fileName = undefined,
|
|
383
|
+
url = undefined,
|
|
384
|
+
filePathInServer,
|
|
385
|
+
fileUrl,
|
|
386
|
+
name,
|
|
387
|
+
} = file;
|
|
388
|
+
return {
|
|
389
|
+
filePathInServer,
|
|
390
|
+
fileUrl,
|
|
391
|
+
fileId,
|
|
392
|
+
fileName: fileName || name,
|
|
393
|
+
url,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
return file;
|
|
397
|
+
})
|
|
398
|
+
.filter((file: any) => file); // 提交文件列表时,过滤掉异常(未上传成功)的文件);
|
|
399
|
+
onChange(fileResponseList);
|
|
400
|
+
}
|
|
401
|
+
if (onFinishUpload && percent === 100 && status === 'done') {
|
|
402
|
+
onFinishUpload(file, fileList, fileResponseList);
|
|
403
|
+
}
|
|
404
|
+
setFileList(files);
|
|
405
|
+
} else {
|
|
406
|
+
setFileList(files);
|
|
407
|
+
}
|
|
408
|
+
} catch (error) {
|
|
409
|
+
console.error(error);
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
const handleRemove = async (file: any) => {
|
|
414
|
+
beforeUploadCounter = 0;
|
|
415
|
+
continueUpload = true;
|
|
416
|
+
const { fileId } = file;
|
|
417
|
+
const list = (fileList || []).filter((_file) => _file.fileId !== fileId);
|
|
418
|
+
if (onChange) {
|
|
419
|
+
setFileList(list);
|
|
420
|
+
onChange(list);
|
|
421
|
+
}
|
|
422
|
+
if (onFileRemove) {
|
|
423
|
+
onFileRemove(file, list);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
handleRemoveCallback.current = handleRemove;
|
|
428
|
+
|
|
429
|
+
const getDownloadName = (suffix: any, file: any) => {
|
|
430
|
+
const suf = suffix || getAfterString(file.name, '.') || '';
|
|
431
|
+
return fileNameEncode
|
|
432
|
+
? `${createRandomStr(20).toUpperCase()}.${suf}`
|
|
433
|
+
: file.name.replace(/\.\w+$/, `.${suf}`);
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
const createDownLink = (data: Blob, downloadName: string) => {
|
|
437
|
+
if (typeof (window?.navigator as any)?.msSaveOrOpenBlob === 'function') {
|
|
438
|
+
// 兼容ie11下载
|
|
439
|
+
(window.navigator as any).msSaveOrOpenBlob(data, downloadName);
|
|
440
|
+
} else {
|
|
441
|
+
const url = window.URL.createObjectURL(data);
|
|
442
|
+
const a = document.createElement('a');
|
|
443
|
+
document.body.appendChild(a);
|
|
444
|
+
a.href = url; // 获取blob地址
|
|
445
|
+
a.download = downloadName;
|
|
446
|
+
a.click();
|
|
447
|
+
document.body.removeChild(a);
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
// 支持图片、pdf直接下载
|
|
452
|
+
const downloadFile = async (file: any) => {
|
|
453
|
+
let downUrl = file.url;
|
|
454
|
+
|
|
455
|
+
try {
|
|
456
|
+
// 如果有field 优先通过field拼接
|
|
457
|
+
if (file.fileId) {
|
|
458
|
+
const addWaterMark =
|
|
459
|
+
isWatermark && (!optionalFile || downloadWay === '2');
|
|
460
|
+
|
|
461
|
+
downUrl = engineApis?.service?.getAppFileUrlById({
|
|
462
|
+
addWaterMark,
|
|
463
|
+
fileId: file.fileId,
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
} catch (error) {
|
|
467
|
+
console.error(error);
|
|
468
|
+
}
|
|
469
|
+
if (onListenDownloading) {
|
|
470
|
+
const res = await onListenDownloading(file);
|
|
471
|
+
if (String(res) === 'false') {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
if (typeof res === 'string' && res !== 'true') {
|
|
475
|
+
// 退出事件中返回值为非空和非true的字符串时,都是视为下载地址
|
|
476
|
+
downUrl = res;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
// 是否直接url下载
|
|
480
|
+
if (window.XMLHttpRequest) {
|
|
481
|
+
setDownloadProVisible({ ...downloadProVisible, [file.fileId]: true });
|
|
482
|
+
const xhr = new XMLHttpRequest(); // ActiveXObject只存在于IE7及以下,无需兼容
|
|
483
|
+
xhr.open('GET', downUrl, true);
|
|
484
|
+
xhr.timeout = uploadTimeout; // 设置超时时间(秒)
|
|
485
|
+
xhr.responseType = 'blob'; // 设置接受类型
|
|
486
|
+
xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头参数
|
|
487
|
+
// xhr.setRequestHeader('X-B-TARGET-ID', pageId);
|
|
488
|
+
// xhr.setRequestHeader('X-B-AUTH', '1');
|
|
489
|
+
// xhr.setRequestHeader('APP-ID', appId);
|
|
490
|
+
xhr.withCredentials = true;
|
|
491
|
+
if (headers) {
|
|
492
|
+
Object.keys(headers || {}).forEach((headerKey: string) => {
|
|
493
|
+
xhr.setRequestHeader(headerKey, headers[headerKey]);
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
xhr.onload = () => {
|
|
497
|
+
// @ts-ignore
|
|
498
|
+
const suffix = getAfterString(
|
|
499
|
+
xhr.getResponseHeader('Content-Disposition'),
|
|
500
|
+
'.',
|
|
501
|
+
);
|
|
502
|
+
const data = xhr.response; // 获取响应体数据
|
|
503
|
+
createDownLink(data, getDownloadName(suffix, file));
|
|
504
|
+
setDownloadProVisible({ ...downloadProVisible, [file.fileId]: false });
|
|
505
|
+
};
|
|
506
|
+
xhr.ontimeout = () => {
|
|
507
|
+
setDownloadProVisible({ ...downloadProVisible, [file.fileId]: false });
|
|
508
|
+
xhr.abort(); // 取消请求
|
|
509
|
+
};
|
|
510
|
+
// 下载进度条
|
|
511
|
+
xhr.onprogress = (event: any) => {
|
|
512
|
+
if (event.lengthComputable) {
|
|
513
|
+
progressRef.current?.[file.fileId]?.setPercent(
|
|
514
|
+
Math.round((event.loaded * 100) / event.total),
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
xhr.send();
|
|
519
|
+
xhr.onerror = () => {
|
|
520
|
+
setDownloadProVisible({ ...downloadProVisible, [file.fileId]: false });
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
const handleDownload = async (file: any) => {
|
|
526
|
+
if (downloadProVisible[file.fileId]) {
|
|
527
|
+
message.warn(getLocale?.('Upload.download'));
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
if (isWatermark && optionalFile) {
|
|
531
|
+
// 支持选择源文件下载or加水印下载
|
|
532
|
+
setCurFile(file);
|
|
533
|
+
setOptionalVisible(true);
|
|
534
|
+
} else {
|
|
535
|
+
downloadFile(file);
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
const previewFile = async (fileId: any, data: any) => {
|
|
540
|
+
const lxDefaultPreviewUrl = (id?: string) => {
|
|
541
|
+
let url = '#/_preview';
|
|
542
|
+
// 适配0代码文件预览
|
|
543
|
+
if (window.location.pathname.indexOf('ncap-web') > -1) {
|
|
544
|
+
url = `../#/_preview?appId=${appId}&pageId=${pageId}&fileId=${id}`;
|
|
545
|
+
} else if (id) {
|
|
546
|
+
url += `?fileId=${id}`;
|
|
547
|
+
}
|
|
548
|
+
return url;
|
|
549
|
+
};
|
|
550
|
+
if (typeof engineApis?.BannerModal?.open === 'function') {
|
|
551
|
+
let fileIndex: number = 0;
|
|
552
|
+
const fileData = fileList?.map((f, i) => {
|
|
553
|
+
// 第三方系统上传接口可能没有fileId字段,保留一个previewUrl字段作为可预览
|
|
554
|
+
if (
|
|
555
|
+
f.fileId === fileId ||
|
|
556
|
+
(f.fileId === undefined && data.previewUrl === f.previewUrl)
|
|
557
|
+
) {
|
|
558
|
+
fileIndex = i;
|
|
559
|
+
}
|
|
560
|
+
return {
|
|
561
|
+
fileId: f.fileId,
|
|
562
|
+
appId: appId || window.appId,
|
|
563
|
+
pageId,
|
|
564
|
+
downloadClick: handleDownload,
|
|
565
|
+
showDownLoad: !!downloadIcon?.showDownloadIcon,
|
|
566
|
+
showDelete: !commonConfig?.disabled && !!deleteIcon?.deleteIconType,
|
|
567
|
+
deleteClick: (f: any) => {
|
|
568
|
+
if (typeof handleRemoveCallback?.current === 'function') {
|
|
569
|
+
handleRemoveCallback?.current(f);
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
file: f,
|
|
573
|
+
};
|
|
574
|
+
});
|
|
575
|
+
engineApis.BannerModal.open({
|
|
576
|
+
fileIndex,
|
|
577
|
+
fileList: fileData,
|
|
578
|
+
viewMode,
|
|
579
|
+
modalWidth,
|
|
580
|
+
modalHeight,
|
|
581
|
+
appId,
|
|
582
|
+
localPreviewUrl: lxDefaultPreviewUrl(),
|
|
583
|
+
pageId,
|
|
584
|
+
});
|
|
585
|
+
} else {
|
|
586
|
+
const link = document.createElement('a');
|
|
587
|
+
link.href = lxDefaultPreviewUrl(fileId);
|
|
588
|
+
link.setAttribute('target', '_blank');
|
|
589
|
+
document.body.appendChild(link);
|
|
590
|
+
link.click();
|
|
591
|
+
if (document.body.contains(link)) {
|
|
592
|
+
document.body.removeChild(link);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
const handlePreview = async (file: any) => {
|
|
598
|
+
const { fileId = '-1' } = file;
|
|
599
|
+
if (previewIcon?.showPreviewIcon) {
|
|
600
|
+
previewFile(fileId, file);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
const onDownloadWayCancel = () => {
|
|
605
|
+
setdDownloadWay('1');
|
|
606
|
+
setOptionalVisible(false);
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
const onDownloadWayOk = () => {
|
|
610
|
+
setOkLoading(true);
|
|
611
|
+
try {
|
|
612
|
+
downloadFile(curFile);
|
|
613
|
+
} finally {
|
|
614
|
+
onDownloadWayCancel();
|
|
615
|
+
setOkLoading(false);
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
const getFileType = (fileName: string) => {
|
|
620
|
+
const startIndex = fileName.lastIndexOf('.');
|
|
621
|
+
if (startIndex !== -1)
|
|
622
|
+
return fileName.substring(startIndex + 1, fileName.length).toLowerCase();
|
|
623
|
+
return '';
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
const acceptData = () => {
|
|
627
|
+
const { accept, acceptExtension } = uploadAccepType || {};
|
|
628
|
+
let targetacceptExtension = '';
|
|
629
|
+
if (acceptExtension) {
|
|
630
|
+
const extensionList = acceptExtension.split(',');
|
|
631
|
+
if (extensionList && extensionList.length > 0) {
|
|
632
|
+
targetacceptExtension = extensionList
|
|
633
|
+
.map((item: string) => {
|
|
634
|
+
if (item.startsWith('.')) {
|
|
635
|
+
return item;
|
|
636
|
+
}
|
|
637
|
+
return `.${item}`;
|
|
638
|
+
})
|
|
639
|
+
.join(',');
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
let combinedAcceptType;
|
|
643
|
+
if (accept && targetacceptExtension) {
|
|
644
|
+
combinedAcceptType = `${accept},${targetacceptExtension}`;
|
|
645
|
+
} else if (accept) {
|
|
646
|
+
combinedAcceptType = accept;
|
|
647
|
+
} else if (targetacceptExtension) {
|
|
648
|
+
combinedAcceptType = targetacceptExtension;
|
|
649
|
+
}
|
|
650
|
+
return combinedAcceptType;
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
const handleBeforeUpload = (file: any) => {
|
|
654
|
+
continueUpload = true;
|
|
655
|
+
if (readOnly) {
|
|
656
|
+
message.warn(getLocale?.('Upload.readonly'));
|
|
657
|
+
return Upload.LIST_IGNORE;
|
|
658
|
+
}
|
|
659
|
+
if (singleFileMinSize && convertToBytes(singleFileMinSize) > file.size) {
|
|
660
|
+
message.error(getLocale?.('Upload.minSize', { singleFileMinSize }));
|
|
661
|
+
return Upload.LIST_IGNORE;
|
|
662
|
+
}
|
|
663
|
+
if (singleFileMaxSize && convertToBytes(singleFileMaxSize) < file.size) {
|
|
664
|
+
message.error(getLocale?.('Upload.maxSize', { singleFileMaxSize }));
|
|
665
|
+
return Upload.LIST_IGNORE;
|
|
666
|
+
}
|
|
667
|
+
const fileType = getFileType(file.name);
|
|
668
|
+
const combinedAcceptType = acceptData();
|
|
669
|
+
// 后缀名不区分大小写
|
|
670
|
+
if (
|
|
671
|
+
combinedAcceptType &&
|
|
672
|
+
fileType &&
|
|
673
|
+
!combinedAcceptType?.toLowerCase()?.split(',')?.includes(`.${fileType}`)
|
|
674
|
+
) {
|
|
675
|
+
message.error(
|
|
676
|
+
getLocale?.('Upload.format', { acceptType: combinedAcceptType }),
|
|
677
|
+
);
|
|
678
|
+
return Upload.LIST_IGNORE;
|
|
679
|
+
}
|
|
680
|
+
beforeUploadCounter += 1;
|
|
681
|
+
allFilesLength = beforeUploadCounter + (fileList || []).length;
|
|
682
|
+
continueUpload = allFilesLength <= numberLimit;
|
|
683
|
+
if ((fileList || []).length >= numberLimit) {
|
|
684
|
+
message.warn(getLocale?.('Upload.maxNum', { numberLimit }));
|
|
685
|
+
return Upload.LIST_IGNORE;
|
|
686
|
+
}
|
|
687
|
+
if (allFilesLength > numberLimit) {
|
|
688
|
+
message.warn(getLocale?.('Upload.limit', { numberLimit }));
|
|
689
|
+
return Upload.LIST_IGNORE;
|
|
690
|
+
}
|
|
691
|
+
return true;
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
const commonConfig: any = {
|
|
695
|
+
multiple: numberLimit > 1,
|
|
696
|
+
listType: uploadStyle === 'picture-card' ? 'picture-card' : listType,
|
|
697
|
+
disabled,
|
|
698
|
+
action,
|
|
699
|
+
accept: acceptData(),
|
|
700
|
+
beforeUpload: (file: any) => handleBeforeUpload(file),
|
|
701
|
+
fileList,
|
|
702
|
+
onRemove: (file: any) => handleRemove(file),
|
|
703
|
+
onChange: (e: any) => handleOnChange(e),
|
|
704
|
+
showUploadList: uploadList,
|
|
705
|
+
onPreview: (file: any) => handlePreview(file),
|
|
706
|
+
onDownload: (file: any) => handleDownload(file),
|
|
707
|
+
headers: {
|
|
708
|
+
'X-B-TARGET-ID': pageId,
|
|
709
|
+
'X-B-AUTH': 1,
|
|
710
|
+
'APP-ID': appId,
|
|
711
|
+
...(headers || {}),
|
|
712
|
+
},
|
|
713
|
+
withCredentials: true,
|
|
714
|
+
itemRender: (
|
|
715
|
+
originNode: React.ReactElement,
|
|
716
|
+
file: any,
|
|
717
|
+
fileList: any[],
|
|
718
|
+
actions: any,
|
|
719
|
+
) => (
|
|
720
|
+
<UploadItem
|
|
721
|
+
originNode={originNode}
|
|
722
|
+
file={file}
|
|
723
|
+
fileList={fileList}
|
|
724
|
+
actions={actions}
|
|
725
|
+
showUploadList={uploadList}
|
|
726
|
+
onFileNameClick={onFileNameClick}
|
|
727
|
+
listType={
|
|
728
|
+
(uploadStyle === 'picture-card' ? 'picture-card' : listType) as any
|
|
729
|
+
}
|
|
730
|
+
/>
|
|
731
|
+
),
|
|
732
|
+
};
|
|
733
|
+
|
|
734
|
+
if (readOnly && fileList && fileList?.length <= 0) {
|
|
735
|
+
return renderReadOnly('--');
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
const renderUploadIcon = () => {
|
|
739
|
+
if (uploadStyle === 'picture-card') {
|
|
740
|
+
const hidden = fileList?.length === numberLimit;
|
|
741
|
+
return hidden ? null : (
|
|
742
|
+
<>
|
|
743
|
+
<CommIcon
|
|
744
|
+
icon={icon}
|
|
745
|
+
placeholder={<PlusOutlined rev="" />}
|
|
746
|
+
className=""
|
|
747
|
+
getEngineApis={getEngineApis}
|
|
748
|
+
$$componentItem={props.$$componentItem}
|
|
749
|
+
/>
|
|
750
|
+
<div>{uploadText || '点击上传'}</div>
|
|
751
|
+
</>
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
return (
|
|
756
|
+
<Button>
|
|
757
|
+
<CommIcon
|
|
758
|
+
icon={icon}
|
|
759
|
+
placeholder={<UploadOutlined rev="" />}
|
|
760
|
+
className=""
|
|
761
|
+
getEngineApis={getEngineApis}
|
|
762
|
+
$$componentItem={props.$$componentItem}
|
|
763
|
+
/>
|
|
764
|
+
{uploadText || '点击上传'}
|
|
765
|
+
</Button>
|
|
766
|
+
);
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
// 覆写上传控件外层容器,添加点击拦截
|
|
770
|
+
const coverLayout = (props: any) => {
|
|
771
|
+
const events = props.disabled
|
|
772
|
+
? {}
|
|
773
|
+
: {
|
|
774
|
+
onClick:
|
|
775
|
+
props.openFileDialogOnClick !== false
|
|
776
|
+
? async (
|
|
777
|
+
e:
|
|
778
|
+
| React.MouseEvent<HTMLDivElement>
|
|
779
|
+
| React.KeyboardEvent<HTMLDivElement>,
|
|
780
|
+
) => {
|
|
781
|
+
let checkResult: any;
|
|
782
|
+
|
|
783
|
+
const runNext = () => {
|
|
784
|
+
if (checkResult !== 0) {
|
|
785
|
+
props.onClick(e);
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
if (onCheckUpload) {
|
|
790
|
+
// 某些浏览器(Safari)可能出于安全限制,在跳出事件循环后,不再触发dom事件,此处通过添加setTimeout宏任务让当前事件循环保持
|
|
791
|
+
const loopWait = () => {
|
|
792
|
+
setTimeout(() => {
|
|
793
|
+
if (typeof checkResult === 'undefined') {
|
|
794
|
+
loopWait();
|
|
795
|
+
} else {
|
|
796
|
+
runNext();
|
|
797
|
+
}
|
|
798
|
+
}, 10);
|
|
799
|
+
};
|
|
800
|
+
loopWait();
|
|
801
|
+
checkResult = (await onCheckUpload()) ?? 1; // 避免onCheckUpload返回结果是undefined 导致loopWait的死循环,checkResult必须有一个非undefined的值
|
|
802
|
+
} else {
|
|
803
|
+
runNext();
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
: () => {},
|
|
807
|
+
};
|
|
808
|
+
return <div {...props} {...events} />;
|
|
809
|
+
};
|
|
810
|
+
|
|
811
|
+
// @ts-ignore
|
|
812
|
+
return (
|
|
813
|
+
<>
|
|
814
|
+
{uploadStyle === 'draggable' ? (
|
|
815
|
+
// @ts-ignore
|
|
816
|
+
<div className={className}>
|
|
817
|
+
<Dragger {...restProps} {...commonConfig} component={coverLayout}>
|
|
818
|
+
<p className="ant-upload-drag-icon" ref={uploadDivRef}>
|
|
819
|
+
{/* TODO: 占位图标?? */}
|
|
820
|
+
<CommIcon
|
|
821
|
+
icon={icon}
|
|
822
|
+
placeholder={
|
|
823
|
+
<CloudUploadOutlined style={{ fontSize: 45 }} rev="" />
|
|
824
|
+
}
|
|
825
|
+
getEngineApis={getEngineApis}
|
|
826
|
+
$$componentItem={props.$$componentItem}
|
|
827
|
+
className=""
|
|
828
|
+
/>
|
|
829
|
+
</p>
|
|
830
|
+
<p className="ant-upload-text">
|
|
831
|
+
{uploadText || getLocale('Upload.text')}
|
|
832
|
+
</p>
|
|
833
|
+
</Dragger>
|
|
834
|
+
</div>
|
|
835
|
+
) : (
|
|
836
|
+
<div className={className}>
|
|
837
|
+
{/* @ts-ignore */}
|
|
838
|
+
<Upload // TODO: disable情况下需要添加禁用鼠标指针,待添加
|
|
839
|
+
{...restProps}
|
|
840
|
+
{...commonConfig}
|
|
841
|
+
component={coverLayout}
|
|
842
|
+
>
|
|
843
|
+
{readOnly ? null : renderUploadIcon()}
|
|
844
|
+
</Upload>
|
|
845
|
+
</div>
|
|
846
|
+
)}
|
|
847
|
+
<Modal
|
|
848
|
+
title={getLocale?.('Upload.downloadType')}
|
|
849
|
+
visible={optionalVisible}
|
|
850
|
+
width={420}
|
|
851
|
+
onCancel={onDownloadWayCancel}
|
|
852
|
+
footer={
|
|
853
|
+
<Button type="primary" onClick={onDownloadWayOk} loading={okLoading}>
|
|
854
|
+
{getLocale?.('Upload.downloadText')}
|
|
855
|
+
</Button>
|
|
856
|
+
}
|
|
857
|
+
>
|
|
858
|
+
<Radio.Group
|
|
859
|
+
onChange={(e) => setdDownloadWay(e.target.value)}
|
|
860
|
+
value={downloadWay}
|
|
861
|
+
>
|
|
862
|
+
<Radio value="1">{getLocale?.('Upload.origin')}</Radio>
|
|
863
|
+
<Radio value="2">{getLocale?.('Upload.waterMark')}</Radio>
|
|
864
|
+
</Radio.Group>
|
|
865
|
+
</Modal>
|
|
866
|
+
</>
|
|
867
|
+
);
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
export interface MyStdUploadProps {
|
|
871
|
+
value?: any;
|
|
872
|
+
visible?: boolean;
|
|
873
|
+
onChange?: (e: any) => void;
|
|
874
|
+
onValueRelease?: (value: any) => void;
|
|
875
|
+
getCompPropMapState?: (id: string, type: string) => any;
|
|
876
|
+
compId?: string;
|
|
877
|
+
name?: string;
|
|
878
|
+
fieldName: string;
|
|
879
|
+
required?: any;
|
|
880
|
+
hidden?: boolean;
|
|
881
|
+
regexp?: any;
|
|
882
|
+
message?: any;
|
|
883
|
+
label?: any;
|
|
884
|
+
labelCol?: any;
|
|
885
|
+
wrapperCol?: any;
|
|
886
|
+
selfSpan?: number;
|
|
887
|
+
colSpan?: number;
|
|
888
|
+
style?: React.CSSProperties;
|
|
889
|
+
fileName?: string;
|
|
890
|
+
action?: string;
|
|
891
|
+
uploadProps?: any;
|
|
892
|
+
multiple?: boolean;
|
|
893
|
+
singleFileMode?: any;
|
|
894
|
+
showWrapperContainer: boolean;
|
|
895
|
+
wrapperContainer: any;
|
|
896
|
+
titleTip?: any;
|
|
897
|
+
tipIcon?: any;
|
|
898
|
+
tipLocation?: any;
|
|
899
|
+
tipContent?: any;
|
|
900
|
+
tipPlacement?: any;
|
|
901
|
+
colon?: boolean;
|
|
902
|
+
headers?: any;
|
|
903
|
+
isFormChild?: boolean | undefined;
|
|
904
|
+
rules?: any[];
|
|
905
|
+
tipSize?: string; // 文字提示
|
|
906
|
+
tipWidth?: string; // 提示自定义的宽度
|
|
907
|
+
tipHeight?: string; // 提示自定义的高度
|
|
908
|
+
columns?: any; // 选择服务
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
const STDUPLOAD_WRAPPER_CLASSNAME = 'ued-stdupload-wrap';
|
|
912
|
+
|
|
913
|
+
const StdUpload = LingxiForwardRef<any, MyStdUploadProps>((props, ref) => {
|
|
914
|
+
const {
|
|
915
|
+
value: originValue,
|
|
916
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
917
|
+
visible = true,
|
|
918
|
+
onChange,
|
|
919
|
+
onValueRelease,
|
|
920
|
+
getCompPropMapState,
|
|
921
|
+
compId,
|
|
922
|
+
name,
|
|
923
|
+
fieldName: rawFieldName,
|
|
924
|
+
regexp,
|
|
925
|
+
label,
|
|
926
|
+
labelCol,
|
|
927
|
+
wrapperCol,
|
|
928
|
+
hidden,
|
|
929
|
+
selfSpan,
|
|
930
|
+
colSpan,
|
|
931
|
+
fileName,
|
|
932
|
+
action,
|
|
933
|
+
multiple,
|
|
934
|
+
showWrapperContainer,
|
|
935
|
+
wrapperContainer: WrapperContainer,
|
|
936
|
+
titleTip,
|
|
937
|
+
tipIcon,
|
|
938
|
+
tipLocation,
|
|
939
|
+
tipContent,
|
|
940
|
+
tipPlacement,
|
|
941
|
+
isFormChild,
|
|
942
|
+
tipSize,
|
|
943
|
+
tipWidth,
|
|
944
|
+
tipHeight,
|
|
945
|
+
...restProps
|
|
946
|
+
} = props;
|
|
947
|
+
|
|
948
|
+
const [uploadProps, setUploadProps] = useListenProps(props.uploadProps);
|
|
949
|
+
|
|
950
|
+
const { formFieldsRef, required, readOnly, disabled, finalRules } =
|
|
951
|
+
useCommonImperativeHandle(ref, props, {
|
|
952
|
+
clearValue: null,
|
|
953
|
+
setUploadProps: (_props: any) => {
|
|
954
|
+
setUploadProps(_props);
|
|
955
|
+
},
|
|
956
|
+
});
|
|
957
|
+
|
|
958
|
+
const formContext = useForm();
|
|
959
|
+
|
|
960
|
+
const transValue = (val: any) => {
|
|
961
|
+
let newValue = null;
|
|
962
|
+
if (typeof val === 'string') {
|
|
963
|
+
try {
|
|
964
|
+
newValue = JSON.parse(val);
|
|
965
|
+
} catch (error) {
|
|
966
|
+
console.log(error);
|
|
967
|
+
}
|
|
968
|
+
return newValue;
|
|
969
|
+
}
|
|
970
|
+
if (typeof val === 'object') {
|
|
971
|
+
newValue = val;
|
|
972
|
+
}
|
|
973
|
+
return val;
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
// FIX: 兼容旧逻辑 通过表单设置值时表单项的值需要预处理,否则会导致值和预想的值不一致
|
|
977
|
+
if (formContext.inForm) {
|
|
978
|
+
formContext.preproccessSetFormValues(props.fieldName, (v) => transValue(v));
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
const extraParamsData = useMemo(() => {
|
|
982
|
+
const data = {
|
|
983
|
+
...(uploadProps?.data || {}),
|
|
984
|
+
};
|
|
985
|
+
if (restProps?.columns) {
|
|
986
|
+
const { _source, _serviceId } = restProps?.columns || {};
|
|
987
|
+
switch (_source) {
|
|
988
|
+
case 'std': {
|
|
989
|
+
data['ORCHESTRATION.appId'] = props.$$componentItem.appId;
|
|
990
|
+
data['ORCHESTRATION.serviceVersionId'] = _serviceId;
|
|
991
|
+
break;
|
|
992
|
+
}
|
|
993
|
+
default:
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
return data;
|
|
998
|
+
}, [uploadProps?.data, restProps?.columns, props?.$$componentItem?.appId]);
|
|
999
|
+
|
|
1000
|
+
const extraProps = useMemo(() => {
|
|
1001
|
+
const { method } = uploadProps || {};
|
|
1002
|
+
const extra: any = {
|
|
1003
|
+
name: fileName,
|
|
1004
|
+
method,
|
|
1005
|
+
data: extraParamsData,
|
|
1006
|
+
// defaultFileList,
|
|
1007
|
+
};
|
|
1008
|
+
if (action) {
|
|
1009
|
+
extra.action = action;
|
|
1010
|
+
}
|
|
1011
|
+
return extra;
|
|
1012
|
+
}, [fileName, uploadProps, action, extraParamsData]);
|
|
1013
|
+
|
|
1014
|
+
const value = useMemo(() => {
|
|
1015
|
+
return transValue(originValue);
|
|
1016
|
+
}, [originValue]);
|
|
1017
|
+
|
|
1018
|
+
return (
|
|
1019
|
+
<FormFields
|
|
1020
|
+
{...getFieldsProps(props)}
|
|
1021
|
+
disabled={disabled}
|
|
1022
|
+
readOnly={readOnly}
|
|
1023
|
+
required={required}
|
|
1024
|
+
ref={formFieldsRef}
|
|
1025
|
+
wrapperClassName={`${STDUPLOAD_WRAPPER_CLASSNAME} ${
|
|
1026
|
+
readOnly ? `${STDUPLOAD_WRAPPER_CLASSNAME}-readOnly` : ''
|
|
1027
|
+
}`}
|
|
1028
|
+
rules={finalRules}
|
|
1029
|
+
value={value}
|
|
1030
|
+
ignoreReadOnlyFlag
|
|
1031
|
+
>
|
|
1032
|
+
<FormUpload
|
|
1033
|
+
value={value}
|
|
1034
|
+
{...restProps}
|
|
1035
|
+
{...extraProps}
|
|
1036
|
+
readOnly={readOnly}
|
|
1037
|
+
disabled={disabled}
|
|
1038
|
+
appId={props.$$componentItem.appId}
|
|
1039
|
+
pageId={props.$$componentItem.pageId}
|
|
1040
|
+
onChange={(e) => {
|
|
1041
|
+
if (onChange) {
|
|
1042
|
+
onChange(e);
|
|
1043
|
+
}
|
|
1044
|
+
}}
|
|
1045
|
+
/>
|
|
1046
|
+
</FormFields>
|
|
1047
|
+
);
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
export default StdUpload;
|