@lingxiteam/ebe-utils 0.0.1

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.
Files changed (562) hide show
  1. package/README.md +217 -0
  2. package/bin/ebe.js +7 -0
  3. package/es/constants.d.ts +2 -0
  4. package/es/constants.js +183 -0
  5. package/es/index.d.ts +64 -0
  6. package/es/index.js +539 -0
  7. package/es/node/babel/getAllImportFiles.d.ts +1 -0
  8. package/es/node/babel/getAllImportFiles.js +79 -0
  9. package/es/node/babel/getRealPath.d.ts +5 -0
  10. package/es/node/babel/getRealPath.js +40 -0
  11. package/es/node/babel/parse.d.ts +6 -0
  12. package/es/node/babel/parse.js +20 -0
  13. package/es/node/cli.d.ts +1 -0
  14. package/es/node/cli.js +87 -0
  15. package/es/node/constants.d.ts +1 -0
  16. package/es/node/constants.js +3 -0
  17. package/es/node/copyStatic.d.ts +6 -0
  18. package/es/node/copyStatic.js +25 -0
  19. package/es/node/move.d.ts +5 -0
  20. package/es/node/move.js +64 -0
  21. package/es/node/setup.d.ts +4 -0
  22. package/es/node/setup.js +40 -0
  23. package/es/shims.d.ts +4 -0
  24. package/es/types.d.ts +14 -0
  25. package/es/types.js +1 -0
  26. package/lib/node/babel/getAllImportFiles.d.ts +1 -0
  27. package/lib/node/babel/getAllImportFiles.js +106 -0
  28. package/lib/node/babel/getRealPath.d.ts +5 -0
  29. package/lib/node/babel/getRealPath.js +59 -0
  30. package/lib/node/babel/parse.d.ts +6 -0
  31. package/lib/node/babel/parse.js +64 -0
  32. package/lib/node/cli.d.ts +1 -0
  33. package/lib/node/cli.js +37 -0
  34. package/lib/node/constants.d.ts +1 -0
  35. package/lib/node/constants.js +30 -0
  36. package/lib/node/copyStatic.d.ts +6 -0
  37. package/lib/node/copyStatic.js +57 -0
  38. package/lib/node/move.d.ts +5 -0
  39. package/lib/node/move.js +66 -0
  40. package/lib/node/setup.d.ts +4 -0
  41. package/lib/node/setup.js +43 -0
  42. package/lib/public/.editorconfig +17 -0
  43. package/lib/public/.prettierignore +15 -0
  44. package/lib/public/.stylelintrc.js +3 -0
  45. package/lib/public/deploy.sh +48 -0
  46. package/lib/public/docker/Dockerfile +11 -0
  47. package/lib/public/docker/default.conf +24 -0
  48. package/lib/public/src/assets/pageicon/closeIcon.png +0 -0
  49. package/lib/public/src/assets/pageicon/deleteIcon.png +0 -0
  50. package/lib/public/src/assets/pageicon/downloadIcon.png +0 -0
  51. package/lib/public/src/assets/pageicon/excel.png +0 -0
  52. package/lib/public/src/assets/pageicon/ico-container-drawer.png +0 -0
  53. package/lib/public/src/assets/pageicon/ico-container-modal.png +0 -0
  54. package/lib/public/src/assets/pageicon/ico-container-page.png +0 -0
  55. package/lib/public/src/assets/pageicon/index.ts +25 -0
  56. package/lib/public/src/assets/pageicon/leftIcon.png +0 -0
  57. package/lib/public/src/assets/pageicon/rightIcon.png +0 -0
  58. package/lib/public/src/assets/pageicon/zoomInIcon.png +0 -0
  59. package/lib/public/src/assets/pageicon/zoomOutIcon.png +0 -0
  60. package/lib/public/src/components/ExpBusiObjModal/index.less +28 -0
  61. package/lib/public/src/components/ExpBusiObjModal/index.tsx +315 -0
  62. package/lib/public/src/components/ExpSQLServiceModal/index.less +28 -0
  63. package/lib/public/src/components/ExpSQLServiceModal/index.tsx +295 -0
  64. package/lib/public/src/components/IconFont/IconFont.tsx +26 -0
  65. package/lib/public/src/components/IconFont/index.ts +1 -0
  66. package/lib/public/src/components/ImportBusiObjModal/index.less +262 -0
  67. package/lib/public/src/components/ImportBusiObjModal/index.tsx +1243 -0
  68. package/lib/public/src/components/LoaderHelper/index.tsx +29 -0
  69. package/lib/public/src/components/PreviewFile/index.less +200 -0
  70. package/lib/public/src/components/PreviewFile/index.tsx +787 -0
  71. package/lib/public/src/components/PreviewFile/utils.ts +90 -0
  72. package/lib/public/src/components/ProgressComp/ProgressComp.less +64 -0
  73. package/lib/public/src/components/ProgressComp/ProgressComp.tsx +34 -0
  74. package/lib/public/src/components/ProgressComp/index.tsx +153 -0
  75. package/lib/public/src/components/common/ExpBusiObjModal/index.less +28 -0
  76. package/lib/public/src/components/common/ExpBusiObjModal/index.tsx +315 -0
  77. package/lib/public/src/components/common/PreviewFile/index.less +200 -0
  78. package/lib/public/src/components/common/PreviewFile/index.tsx +787 -0
  79. package/lib/public/src/components/common/PreviewFile/utils.ts +90 -0
  80. package/lib/public/src/components/pcfactory/src/Alert/index.tsx +22 -0
  81. package/lib/public/src/components/pcfactory/src/Animation/index.tsx +186 -0
  82. package/lib/public/src/components/pcfactory/src/Animation/useAnimation.ts +270 -0
  83. package/lib/public/src/components/pcfactory/src/Animation/useBackgroundStyle.ts +74 -0
  84. package/lib/public/src/components/pcfactory/src/Audio/index.tsx +240 -0
  85. package/lib/public/src/components/pcfactory/src/BarChart/index.tsx +3 -0
  86. package/lib/public/src/components/pcfactory/src/Button/index.tsx +151 -0
  87. package/lib/public/src/components/pcfactory/src/Card/index.tsx +201 -0
  88. package/lib/public/src/components/pcfactory/src/Card/useExtendBtn.tsx +195 -0
  89. package/lib/public/src/components/pcfactory/src/Cascader/index.tsx +398 -0
  90. package/lib/public/src/components/pcfactory/src/ChartBar/index.tsx +15 -0
  91. package/lib/public/src/components/pcfactory/src/ChartBar/loader.tsx +12 -0
  92. package/lib/public/src/components/pcfactory/src/ChartLine/ChartLine.tsx +48 -0
  93. package/lib/public/src/components/pcfactory/src/ChartLine/PropsType.ts +88 -0
  94. package/lib/public/src/components/pcfactory/src/ChartLine/index.tsx +15 -0
  95. package/lib/public/src/components/pcfactory/src/ChartLine/loader.tsx +12 -0
  96. package/lib/public/src/components/pcfactory/src/Checkbox/index.tsx +144 -0
  97. package/lib/public/src/components/pcfactory/src/CheckboxGroup/index.tsx +319 -0
  98. package/lib/public/src/components/pcfactory/src/Collapse/index.tsx +195 -0
  99. package/lib/public/src/components/pcfactory/src/CollapsePanel/index.tsx +186 -0
  100. package/lib/public/src/components/pcfactory/src/Condition/index.tsx +22 -0
  101. package/lib/public/src/components/pcfactory/src/DatePicker/index.tsx +756 -0
  102. package/lib/public/src/components/pcfactory/src/Description/index.tsx +447 -0
  103. package/lib/public/src/components/pcfactory/src/Description/utils/getLabelSizeMode.ts +40 -0
  104. package/lib/public/src/components/pcfactory/src/Divider/components/CenterLineDivider/index.tsx +190 -0
  105. package/lib/public/src/components/pcfactory/src/Divider/components/CenterTabDivider/index.tsx +77 -0
  106. package/lib/public/src/components/pcfactory/src/Divider/components/LeftCardDivider/index.tsx +87 -0
  107. package/lib/public/src/components/pcfactory/src/Divider/components/LeftLineDivider/index.tsx +106 -0
  108. package/lib/public/src/components/pcfactory/src/Divider/components/LeftTabDivider/index.tsx +60 -0
  109. package/lib/public/src/components/pcfactory/src/Divider/components/LeftTopDivider/index.tsx +55 -0
  110. package/lib/public/src/components/pcfactory/src/Divider/components/LxDashed/index.module.less +10 -0
  111. package/lib/public/src/components/pcfactory/src/Divider/components/LxDashed/index.tsx +143 -0
  112. package/lib/public/src/components/pcfactory/src/Divider/components/LxSolid/index.module.less +10 -0
  113. package/lib/public/src/components/pcfactory/src/Divider/components/LxSolid/index.tsx +126 -0
  114. package/lib/public/src/components/pcfactory/src/Divider/index.tsx +210 -0
  115. package/lib/public/src/components/pcfactory/src/Dropdown/index.tsx +385 -0
  116. package/lib/public/src/components/pcfactory/src/DynamicTabs/PropsType.ts +31 -0
  117. package/lib/public/src/components/pcfactory/src/DynamicTabs/TabPage.tsx +63 -0
  118. package/lib/public/src/components/pcfactory/src/DynamicTabs/index.tsx +214 -0
  119. package/lib/public/src/components/pcfactory/src/Form/Form.tsx +600 -0
  120. package/lib/public/src/components/pcfactory/src/Form/WrapperForm.ts +14 -0
  121. package/lib/public/src/components/pcfactory/src/Form/index.tsx +15 -0
  122. package/lib/public/src/components/pcfactory/src/Form/useFormStatus.ts +47 -0
  123. package/lib/public/src/components/pcfactory/src/Form/useMonitor.ts +40 -0
  124. package/lib/public/src/components/pcfactory/src/FormGroup/TitleComp.tsx +107 -0
  125. package/lib/public/src/components/pcfactory/src/FormGroup/index.tsx +181 -0
  126. package/lib/public/src/components/pcfactory/src/FreeLayout/index.tsx +151 -0
  127. package/lib/public/src/components/pcfactory/src/Gantt/Gantt.tsx +460 -0
  128. package/lib/public/src/components/pcfactory/src/Gantt/const.ts +122 -0
  129. package/lib/public/src/components/pcfactory/src/Gantt/index.tsx +16 -0
  130. package/lib/public/src/components/pcfactory/src/Gantt/loader.tsx +12 -0
  131. package/lib/public/src/components/pcfactory/src/GridView/GridView.tsx +435 -0
  132. package/lib/public/src/components/pcfactory/src/GridView/index.tsx +24 -0
  133. package/lib/public/src/components/pcfactory/src/GridView/loader.tsx +12 -0
  134. package/lib/public/src/components/pcfactory/src/HorizontalView/index.tsx +32 -0
  135. package/lib/public/src/components/pcfactory/src/Icon/IconED/index.tsx +42 -0
  136. package/lib/public/src/components/pcfactory/src/Icon/PropsType.ts +57 -0
  137. package/lib/public/src/components/pcfactory/src/Icon/hooks/index.tsx +300 -0
  138. package/lib/public/src/components/pcfactory/src/Icon/index.tsx +69 -0
  139. package/lib/public/src/components/pcfactory/src/IconFont/index.tsx +24 -0
  140. package/lib/public/src/components/pcfactory/src/Img/BasicImage/index.tsx +90 -0
  141. package/lib/public/src/components/pcfactory/src/Img/assets/placeholder.png +0 -0
  142. package/lib/public/src/components/pcfactory/src/Img/index.tsx +91 -0
  143. package/lib/public/src/components/pcfactory/src/Input/index.tsx +425 -0
  144. package/lib/public/src/components/pcfactory/src/InputNumber/index.tsx +263 -0
  145. package/lib/public/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +23 -0
  146. package/lib/public/src/components/pcfactory/src/LXPieChart/PropsType.ts +11 -0
  147. package/lib/public/src/components/pcfactory/src/LXPieChart/index.less +6 -0
  148. package/lib/public/src/components/pcfactory/src/LXPieChart/index.tsx +15 -0
  149. package/lib/public/src/components/pcfactory/src/LXPieChart/loader.tsx +12 -0
  150. package/lib/public/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +25 -0
  151. package/lib/public/src/components/pcfactory/src/LXRadarChart/PropsType.ts +9 -0
  152. package/lib/public/src/components/pcfactory/src/LXRadarChart/index.less +7 -0
  153. package/lib/public/src/components/pcfactory/src/LXRadarChart/index.tsx +17 -0
  154. package/lib/public/src/components/pcfactory/src/LXRadarChart/loader.tsx +12 -0
  155. package/lib/public/src/components/pcfactory/src/Layout/index.tsx +130 -0
  156. package/lib/public/src/components/pcfactory/src/Layout/utils.ts +48 -0
  157. package/lib/public/src/components/pcfactory/src/LineChart/index.tsx +3 -0
  158. package/lib/public/src/components/pcfactory/src/Link/index.tsx +117 -0
  159. package/lib/public/src/components/pcfactory/src/LoopList/index.tsx +551 -0
  160. package/lib/public/src/components/pcfactory/src/Menu/index.tsx +422 -0
  161. package/lib/public/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +95 -0
  162. package/lib/public/src/components/pcfactory/src/ModalSelect/index.tsx +453 -0
  163. package/lib/public/src/components/pcfactory/src/MultipleSelect/index.tsx +3 -0
  164. package/lib/public/src/components/pcfactory/src/Pagination/index.tsx +104 -0
  165. package/lib/public/src/components/pcfactory/src/Password/index.tsx +88 -0
  166. package/lib/public/src/components/pcfactory/src/PictureVerifyCode/assets/placeholder.png +0 -0
  167. package/lib/public/src/components/pcfactory/src/PictureVerifyCode/index.tsx +76 -0
  168. package/lib/public/src/components/pcfactory/src/PieChart/index.tsx +3 -0
  169. package/lib/public/src/components/pcfactory/src/Progress/index.tsx +155 -0
  170. package/lib/public/src/components/pcfactory/src/QRCode/const.ts +5 -0
  171. package/lib/public/src/components/pcfactory/src/QRCode/index.tsx +146 -0
  172. package/lib/public/src/components/pcfactory/src/QuillEditor/QuillEditor.tsx +197 -0
  173. package/lib/public/src/components/pcfactory/src/QuillEditor/index.tsx +37 -0
  174. package/lib/public/src/components/pcfactory/src/QuillEditor/loader.ts +12 -0
  175. package/lib/public/src/components/pcfactory/src/RadarChart/RadarChartHook.ts +449 -0
  176. package/lib/public/src/components/pcfactory/src/RadarChart/RadarChartType.ts +39 -0
  177. package/lib/public/src/components/pcfactory/src/RadarChart/RadarECharts.tsx +86 -0
  178. package/lib/public/src/components/pcfactory/src/RadarChart/index.tsx +16 -0
  179. package/lib/public/src/components/pcfactory/src/RadarChart/loader.tsx +12 -0
  180. package/lib/public/src/components/pcfactory/src/RadarChart/radarDefaultConfig.js +55 -0
  181. package/lib/public/src/components/pcfactory/src/Radio/index.tsx +260 -0
  182. package/lib/public/src/components/pcfactory/src/RangePicker/index.tsx +3 -0
  183. package/lib/public/src/components/pcfactory/src/Rate/index.tsx +187 -0
  184. package/lib/public/src/components/pcfactory/src/ReactECharts/PropsType.ts +37 -0
  185. package/lib/public/src/components/pcfactory/src/ReactECharts/ReactECharts.tsx +672 -0
  186. package/lib/public/src/components/pcfactory/src/ReactECharts/index.tsx +26 -0
  187. package/lib/public/src/components/pcfactory/src/ReactECharts/loader.tsx +12 -0
  188. package/lib/public/src/components/pcfactory/src/RemoteComponent/components/FishRender.tsx +31 -0
  189. package/lib/public/src/components/pcfactory/src/RemoteComponent/components/ReactRender.tsx +55 -0
  190. package/lib/public/src/components/pcfactory/src/RemoteComponent/components/VueRender.tsx +32 -0
  191. package/lib/public/src/components/pcfactory/src/RemoteComponent/constant.ts +9 -0
  192. package/lib/public/src/components/pcfactory/src/RemoteComponent/index.tsx +82 -0
  193. package/lib/public/src/components/pcfactory/src/RemoteComponent/remote-component.config.ts +12 -0
  194. package/lib/public/src/components/pcfactory/src/Result/index.tsx +27 -0
  195. package/lib/public/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +105 -0
  196. package/lib/public/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +234 -0
  197. package/lib/public/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +41 -0
  198. package/lib/public/src/components/pcfactory/src/RichTextEditor/index.tsx +33 -0
  199. package/lib/public/src/components/pcfactory/src/RichTextEditor/loader.ts +12 -0
  200. package/lib/public/src/components/pcfactory/src/Row/Row.tsx +66 -0
  201. package/lib/public/src/components/pcfactory/src/Row/index.tsx +9 -0
  202. package/lib/public/src/components/pcfactory/src/Row/loader.tsx +12 -0
  203. package/lib/public/src/components/pcfactory/src/Select/index.tsx +628 -0
  204. package/lib/public/src/components/pcfactory/src/Select/selectUtils.ts +257 -0
  205. package/lib/public/src/components/pcfactory/src/Slider/index.tsx +351 -0
  206. package/lib/public/src/components/pcfactory/src/StdUpload/DownloadProgress/DownloadProgress.tsx +27 -0
  207. package/lib/public/src/components/pcfactory/src/StdUpload/DownloadProgress/index.ts +3 -0
  208. package/lib/public/src/components/pcfactory/src/StdUpload/UploadItem.tsx +257 -0
  209. package/lib/public/src/components/pcfactory/src/StdUpload/assets/default.png +0 -0
  210. package/lib/public/src/components/pcfactory/src/StdUpload/assets/js.png +0 -0
  211. package/lib/public/src/components/pcfactory/src/StdUpload/assets/pdf.png +0 -0
  212. package/lib/public/src/components/pcfactory/src/StdUpload/assets/ppt.png +0 -0
  213. package/lib/public/src/components/pcfactory/src/StdUpload/assets/txt.png +0 -0
  214. package/lib/public/src/components/pcfactory/src/StdUpload/assets/word.png +0 -0
  215. package/lib/public/src/components/pcfactory/src/StdUpload/assets/xls.png +0 -0
  216. package/lib/public/src/components/pcfactory/src/StdUpload/assets/zip.png +0 -0
  217. package/lib/public/src/components/pcfactory/src/StdUpload/index.tsx +1050 -0
  218. package/lib/public/src/components/pcfactory/src/StdUpload/uploadItem.less +64 -0
  219. package/lib/public/src/components/pcfactory/src/Steps/constant/checkcircle.tsx +29 -0
  220. package/lib/public/src/components/pcfactory/src/Steps/constant/index.ts +2 -0
  221. package/lib/public/src/components/pcfactory/src/Steps/constant/vector.tsx +13 -0
  222. package/lib/public/src/components/pcfactory/src/Steps/index.tsx +343 -0
  223. package/lib/public/src/components/pcfactory/src/SuperSelect/ComSelect.tsx +538 -0
  224. package/lib/public/src/components/pcfactory/src/SuperSelect/index.tsx +127 -0
  225. package/lib/public/src/components/pcfactory/src/SuperSelect/loader.tsx +12 -0
  226. package/lib/public/src/components/pcfactory/src/Swiper/index.tsx +184 -0
  227. package/lib/public/src/components/pcfactory/src/Switch/index.tsx +219 -0
  228. package/lib/public/src/components/pcfactory/src/TabPane/index.tsx +145 -0
  229. package/lib/public/src/components/pcfactory/src/Table/BodyCell/index.tsx +278 -0
  230. package/lib/public/src/components/pcfactory/src/Table/EditComponent/index.tsx +554 -0
  231. package/lib/public/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +34 -0
  232. package/lib/public/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +26 -0
  233. package/lib/public/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +41 -0
  234. package/lib/public/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +32 -0
  235. package/lib/public/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +34 -0
  236. package/lib/public/src/components/pcfactory/src/Table/FormatCell/index.tsx +227 -0
  237. package/lib/public/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +63 -0
  238. package/lib/public/src/components/pcfactory/src/Table/HeaderCell/index.tsx +32 -0
  239. package/lib/public/src/components/pcfactory/src/Table/TableHead/index.tsx +501 -0
  240. package/lib/public/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +46 -0
  241. package/lib/public/src/components/pcfactory/src/Table/constant.ts +73 -0
  242. package/lib/public/src/components/pcfactory/src/Table/hooks/index.ts +32 -0
  243. package/lib/public/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +325 -0
  244. package/lib/public/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +176 -0
  245. package/lib/public/src/components/pcfactory/src/Table/hooks/useColumns.tsx +1851 -0
  246. package/lib/public/src/components/pcfactory/src/Table/hooks/useCommon.ts +39 -0
  247. package/lib/public/src/components/pcfactory/src/Table/hooks/useDataSource.ts +201 -0
  248. package/lib/public/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +324 -0
  249. package/lib/public/src/components/pcfactory/src/Table/hooks/useFilter.tsx +274 -0
  250. package/lib/public/src/components/pcfactory/src/Table/hooks/useFormatCell.ts +309 -0
  251. package/lib/public/src/components/pcfactory/src/Table/hooks/usePagination.ts +104 -0
  252. package/lib/public/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +302 -0
  253. package/lib/public/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +93 -0
  254. package/lib/public/src/components/pcfactory/src/Table/hooks/useScroll.ts +120 -0
  255. package/lib/public/src/components/pcfactory/src/Table/hooks/useSelection.ts +467 -0
  256. package/lib/public/src/components/pcfactory/src/Table/hooks/useSort.ts +39 -0
  257. package/lib/public/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +191 -0
  258. package/lib/public/src/components/pcfactory/src/Table/index.tsx +525 -0
  259. package/lib/public/src/components/pcfactory/src/Table/utils/SequenceId.ts +104 -0
  260. package/lib/public/src/components/pcfactory/src/Table/utils/index.ts +442 -0
  261. package/lib/public/src/components/pcfactory/src/Tabs/index.tsx +209 -0
  262. package/lib/public/src/components/pcfactory/src/Tag/index.tsx +39 -0
  263. package/lib/public/src/components/pcfactory/src/Text/index.tsx +191 -0
  264. package/lib/public/src/components/pcfactory/src/TextArea/ForIETextArea.tsx +96 -0
  265. package/lib/public/src/components/pcfactory/src/TextArea/index.tsx +255 -0
  266. package/lib/public/src/components/pcfactory/src/TimePicker/index.tsx +3 -0
  267. package/lib/public/src/components/pcfactory/src/TlrView/index.tsx +3 -0
  268. package/lib/public/src/components/pcfactory/src/TooltipView/PropsType.ts +22 -0
  269. package/lib/public/src/components/pcfactory/src/TooltipView/TooltipViewED/index.tsx +10 -0
  270. package/lib/public/src/components/pcfactory/src/TooltipView/hooks/index.tsx +90 -0
  271. package/lib/public/src/components/pcfactory/src/TooltipView/index.tsx +13 -0
  272. package/lib/public/src/components/pcfactory/src/Transfer/index.tsx +753 -0
  273. package/lib/public/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +102 -0
  274. package/lib/public/src/components/pcfactory/src/Tree/index.tsx +1303 -0
  275. package/lib/public/src/components/pcfactory/src/TreeSelect/index.tsx +639 -0
  276. package/lib/public/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -0
  277. package/lib/public/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +82 -0
  278. package/lib/public/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +61 -0
  279. package/lib/public/src/components/pcfactory/src/TreeTable/index.tsx +273 -0
  280. package/lib/public/src/components/pcfactory/src/Upload/Upload.tsx +740 -0
  281. package/lib/public/src/components/pcfactory/src/Upload/index.tsx +29 -0
  282. package/lib/public/src/components/pcfactory/src/Upload/loader.tsx +13 -0
  283. package/lib/public/src/components/pcfactory/src/VerificationCode/assets/placeholder.png +0 -0
  284. package/lib/public/src/components/pcfactory/src/VerificationCode/index.tsx +297 -0
  285. package/lib/public/src/components/pcfactory/src/VerticalView/index.tsx +25 -0
  286. package/lib/public/src/components/pcfactory/src/VideoPlayer/index.tsx +159 -0
  287. package/lib/public/src/components/pcfactory/src/View/index.tsx +150 -0
  288. package/lib/public/src/components/pcfactory/src/View/useBackgroundStyle.ts +75 -0
  289. package/lib/public/src/components/pcfactory/src/VirtualGroup/index.tsx +16 -0
  290. package/lib/public/src/components/pcfactory/src/Webview/index.tsx +104 -0
  291. package/lib/public/src/components/pcfactory/src/index.component.ts +253 -0
  292. package/lib/public/src/components/pcfactory/src/styles/common.less +107 -0
  293. package/lib/public/src/components/pcfactory/src/styles/compatible.less +976 -0
  294. package/lib/public/src/components/pcfactory/src/styles/components/Alert.less +25 -0
  295. package/lib/public/src/components/pcfactory/src/styles/components/Audio.less +198 -0
  296. package/lib/public/src/components/pcfactory/src/styles/components/Button.less +32 -0
  297. package/lib/public/src/components/pcfactory/src/styles/components/Card.less +155 -0
  298. package/lib/public/src/components/pcfactory/src/styles/components/Cascader.less +54 -0
  299. package/lib/public/src/components/pcfactory/src/styles/components/Checkbox.less +7 -0
  300. package/lib/public/src/components/pcfactory/src/styles/components/Collapse.less +214 -0
  301. package/lib/public/src/components/pcfactory/src/styles/components/DatePicker.less +22 -0
  302. package/lib/public/src/components/pcfactory/src/styles/components/Description.less +64 -0
  303. package/lib/public/src/components/pcfactory/src/styles/components/Divider.less +530 -0
  304. package/lib/public/src/components/pcfactory/src/styles/components/Drawer.less +54 -0
  305. package/lib/public/src/components/pcfactory/src/styles/components/Dropdown.less +11 -0
  306. package/lib/public/src/components/pcfactory/src/styles/components/DynamicDataContainer.less +16 -0
  307. package/lib/public/src/components/pcfactory/src/styles/components/DynamicTabs.less +254 -0
  308. package/lib/public/src/components/pcfactory/src/styles/components/Form.less +265 -0
  309. package/lib/public/src/components/pcfactory/src/styles/components/FormGroup.less +111 -0
  310. package/lib/public/src/components/pcfactory/src/styles/components/Gantt.less +139 -0
  311. package/lib/public/src/components/pcfactory/src/styles/components/GridView.less +62 -0
  312. package/lib/public/src/components/pcfactory/src/styles/components/Icon.less +20 -0
  313. package/lib/public/src/components/pcfactory/src/styles/components/Input.less +164 -0
  314. package/lib/public/src/components/pcfactory/src/styles/components/InputNumber.less +124 -0
  315. package/lib/public/src/components/pcfactory/src/styles/components/InputPassword.less +3 -0
  316. package/lib/public/src/components/pcfactory/src/styles/components/Link.less +4 -0
  317. package/lib/public/src/components/pcfactory/src/styles/components/LoopList.less +67 -0
  318. package/lib/public/src/components/pcfactory/src/styles/components/Menu.less +54 -0
  319. package/lib/public/src/components/pcfactory/src/styles/components/ModalSelect.less +42 -0
  320. package/lib/public/src/components/pcfactory/src/styles/components/Popconfirm.less +7 -0
  321. package/lib/public/src/components/pcfactory/src/styles/components/Progress.less +57 -0
  322. package/lib/public/src/components/pcfactory/src/styles/components/QuillEditor.less +15 -0
  323. package/lib/public/src/components/pcfactory/src/styles/components/Radio.less +7 -0
  324. package/lib/public/src/components/pcfactory/src/styles/components/Rate.less +16 -0
  325. package/lib/public/src/components/pcfactory/src/styles/components/Result.less +26 -0
  326. package/lib/public/src/components/pcfactory/src/styles/components/Select.less +146 -0
  327. package/lib/public/src/components/pcfactory/src/styles/components/Slider.less +78 -0
  328. package/lib/public/src/components/pcfactory/src/styles/components/StdUpload.less +225 -0
  329. package/lib/public/src/components/pcfactory/src/styles/components/Step.less +91 -0
  330. package/lib/public/src/components/pcfactory/src/styles/components/SuperSelect.less +83 -0
  331. package/lib/public/src/components/pcfactory/src/styles/components/Swiper.less +106 -0
  332. package/lib/public/src/components/pcfactory/src/styles/components/Switch.less +49 -0
  333. package/lib/public/src/components/pcfactory/src/styles/components/Table.less +1229 -0
  334. package/lib/public/src/components/pcfactory/src/styles/components/Tabs.less +291 -0
  335. package/lib/public/src/components/pcfactory/src/styles/components/Tag.less +107 -0
  336. package/lib/public/src/components/pcfactory/src/styles/components/TextArea.less +12 -0
  337. package/lib/public/src/components/pcfactory/src/styles/components/TooltipView.less +43 -0
  338. package/lib/public/src/components/pcfactory/src/styles/components/Transfer.less +155 -0
  339. package/lib/public/src/components/pcfactory/src/styles/components/Tree.less +329 -0
  340. package/lib/public/src/components/pcfactory/src/styles/components/TreeSelect.less +65 -0
  341. package/lib/public/src/components/pcfactory/src/styles/components/Upload.less +26 -0
  342. package/lib/public/src/components/pcfactory/src/styles/components/VerificationCode.less +162 -0
  343. package/lib/public/src/components/pcfactory/src/styles/components/Webview.less +31 -0
  344. package/lib/public/src/components/pcfactory/src/styles/index.less +10 -0
  345. package/lib/public/src/components/pcfactory/src/styles/index.ued.less +65 -0
  346. package/lib/public/src/components/pcfactory/src/styles/theme/variables/antdVariables.less +84 -0
  347. package/lib/public/src/components/pcfactory/src/styles/theme/variables/common.less +9 -0
  348. package/lib/public/src/components/pcfactory/src/styles/theme/variables/customVariables.less +35 -0
  349. package/lib/public/src/components/pcfactory/src/styles/theme/variables/index.less +2 -0
  350. package/lib/public/src/components/pcfactory/src/utils/ChannelContainer.tsx +150 -0
  351. package/lib/public/src/components/pcfactory/src/utils/ChildRender.ts +103 -0
  352. package/lib/public/src/components/pcfactory/src/utils/CustomModule.tsx +134 -0
  353. package/lib/public/src/components/pcfactory/src/utils/DummyFormContext.ts +136 -0
  354. package/lib/public/src/components/pcfactory/src/utils/Empty/customLocale.tsx +6 -0
  355. package/lib/public/src/components/pcfactory/src/utils/Empty/empty.tsx +37 -0
  356. package/lib/public/src/components/pcfactory/src/utils/LoaderHelper.tsx +29 -0
  357. package/lib/public/src/components/pcfactory/src/utils/PropsType.ts +21 -0
  358. package/lib/public/src/components/pcfactory/src/utils/WithSyncValue.ts +218 -0
  359. package/lib/public/src/components/pcfactory/src/utils/ahooks/index.ts +22 -0
  360. package/lib/public/src/components/pcfactory/src/utils/ahooks/useCreation.ts +23 -0
  361. package/lib/public/src/components/pcfactory/src/utils/ahooks/useDeepCompareEffect.ts +27 -0
  362. package/lib/public/src/components/pcfactory/src/utils/ahooks/useMap.ts +46 -0
  363. package/lib/public/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +27 -0
  364. package/lib/public/src/components/pcfactory/src/utils/ahooks/usePrevious.ts +19 -0
  365. package/lib/public/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +26 -0
  366. package/lib/public/src/components/pcfactory/src/utils/ahooks/useSetState.ts +26 -0
  367. package/lib/public/src/components/pcfactory/src/utils/ahooks/useUnmountedRef.ts +14 -0
  368. package/lib/public/src/components/pcfactory/src/utils/ahooks/useUpdate.ts +9 -0
  369. package/lib/public/src/components/pcfactory/src/utils/ahooks/useUpdateEffect.ts +16 -0
  370. package/lib/public/src/components/pcfactory/src/utils/basicStatusTransfer.ts +32 -0
  371. package/lib/public/src/components/pcfactory/src/utils/common.ts +367 -0
  372. package/lib/public/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +106 -0
  373. package/lib/public/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +131 -0
  374. package/lib/public/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +646 -0
  375. package/lib/public/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +123 -0
  376. package/lib/public/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +411 -0
  377. package/lib/public/src/components/pcfactory/src/utils/formUtils/common.ts +28 -0
  378. package/lib/public/src/components/pcfactory/src/utils/getExportDefaultObj.ts +11 -0
  379. package/lib/public/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +140 -0
  380. package/lib/public/src/components/pcfactory/src/utils/hooks/useDataMask.ts +83 -0
  381. package/lib/public/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +63 -0
  382. package/lib/public/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +86 -0
  383. package/lib/public/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +41 -0
  384. package/lib/public/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +43 -0
  385. package/lib/public/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +90 -0
  386. package/lib/public/src/components/pcfactory/src/utils/hooks/useListenState.ts +26 -0
  387. package/lib/public/src/components/pcfactory/src/utils/hooks/useLocale.ts +129 -0
  388. package/lib/public/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +80 -0
  389. package/lib/public/src/components/pcfactory/src/utils/hooks/useRules.ts +89 -0
  390. package/lib/public/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +26 -0
  391. package/lib/public/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +33 -0
  392. package/lib/public/src/components/pcfactory/src/utils/index.ts +19 -0
  393. package/lib/public/src/components/pcfactory/src/utils/polyfill.js +305 -0
  394. package/lib/public/src/components/pcfactory/src/utils/renderReadOnly.tsx +105 -0
  395. package/lib/public/src/components/pcfactory/src/variables.ts +2 -0
  396. package/lib/public/src/components/pcfactory/typings.d.ts +27 -0
  397. package/lib/public/src/hooks/useExportCustomDataFile.ts +566 -0
  398. package/lib/public/src/hooks/useLifeCycle.ts +110 -0
  399. package/lib/public/src/hooks/useListenProps.ts +14 -0
  400. package/lib/public/src/hooks/useSafeState.ts +26 -0
  401. package/lib/public/src/hooks/useSetState.ts +41 -0
  402. package/lib/public/src/hooks/useSyncState.ts +27 -0
  403. package/lib/public/src/hooks/useTransSuperObjectParams.ts +82 -0
  404. package/lib/public/src/hooks/useUnmountedRef.ts +14 -0
  405. package/lib/public/src/hooks/useUpdateEffect.ts +16 -0
  406. package/lib/public/src/pages/_preview/index.tsx +23 -0
  407. package/lib/public/src/services/README.md +32 -0
  408. package/lib/public/src/services/api/batchInsert.ts +21 -0
  409. package/lib/public/src/services/api/engine.ts +59 -0
  410. package/lib/public/src/services/api/file.ts +50 -0
  411. package/lib/public/src/services/api/findAppConfig.ts +14 -0
  412. package/lib/public/src/services/api/getAppFileUrlByFileCode.ts +14 -0
  413. package/lib/public/src/services/api/index.ts +38 -0
  414. package/lib/public/src/services/type.ts +51 -0
  415. package/lib/public/src/styles/common.less +41 -0
  416. package/lib/public/src/styles/index.less +4 -0
  417. package/lib/public/src/styles/index.ts +1 -0
  418. package/lib/public/src/styles/theme/variables.less +130 -0
  419. package/lib/public/src/types/index.ts +246 -0
  420. package/lib/public/src/utils/AwaitHandleData.ts +46 -0
  421. package/lib/public/src/utils/Context/Container.tsx +65 -0
  422. package/lib/public/src/utils/Context/context.tsx +95 -0
  423. package/lib/public/src/utils/LcdpSpin/index.less +13 -0
  424. package/lib/public/src/utils/LcdpSpin/index.tsx +12 -0
  425. package/lib/public/src/utils/ModalManager/Drawer/index.less +30 -0
  426. package/lib/public/src/utils/ModalManager/Drawer/index.tsx +109 -0
  427. package/lib/public/src/utils/ModalManager/Modal/index.less +7 -0
  428. package/lib/public/src/utils/ModalManager/Modal/index.tsx +96 -0
  429. package/lib/public/src/utils/ModalManager/index.tsx +278 -0
  430. package/lib/public/src/utils/Security/clientCapabilities.ts +19 -0
  431. package/lib/public/src/utils/Security/config.ts +89 -0
  432. package/lib/public/src/utils/Security/const.ts +129 -0
  433. package/lib/public/src/utils/Security/encipher/aes.ts +52 -0
  434. package/lib/public/src/utils/Security/encipher/des.ts +52 -0
  435. package/lib/public/src/utils/Security/encipher/rsa.ts +42 -0
  436. package/lib/public/src/utils/Security/encipher/sign.ts +212 -0
  437. package/lib/public/src/utils/Security/encipher/token.ts +52 -0
  438. package/lib/public/src/utils/Security/httpEncryption.ts +75 -0
  439. package/lib/public/src/utils/Security/index.ts +28 -0
  440. package/lib/public/src/utils/Security/requester/fetch.ts +119 -0
  441. package/lib/public/src/utils/Security/requester/wx.ts +132 -0
  442. package/lib/public/src/utils/Security/requester/xhr.ts +121 -0
  443. package/lib/public/src/utils/Security/types.ts +181 -0
  444. package/lib/public/src/utils/Security/utils/check.ts +62 -0
  445. package/lib/public/src/utils/Security/utils/cookie.ts +70 -0
  446. package/lib/public/src/utils/Security/utils/encrypted.ts +122 -0
  447. package/lib/public/src/utils/Security/utils/message.ts +17 -0
  448. package/lib/public/src/utils/Security/utils/url.ts +78 -0
  449. package/lib/public/src/utils/StateListener.ts +69 -0
  450. package/lib/public/src/utils/User.ts +16 -0
  451. package/lib/public/src/utils/array.ts +151 -0
  452. package/lib/public/src/utils/basicStatusTransfer.ts +32 -0
  453. package/lib/public/src/utils/cmd.ts +27 -0
  454. package/lib/public/src/utils/customFuncMapping.ts +107 -0
  455. package/lib/public/src/utils/dataSource/fetchQuery.ts +154 -0
  456. package/lib/public/src/utils/dataSource/index.ts +1 -0
  457. package/lib/public/src/utils/engine-utils/exportCustomUtils.ts +215 -0
  458. package/lib/public/src/utils/engine-utils/hooks/index.ts +3 -0
  459. package/lib/public/src/utils/engine-utils/hooks/useCreation.ts +23 -0
  460. package/lib/public/src/utils/engine-utils/index.ts +2 -0
  461. package/lib/public/src/utils/engine-utils/previewUtil.ts +18 -0
  462. package/lib/public/src/utils/formUtils.ts +458 -0
  463. package/lib/public/src/utils/functors/ABS.ts +23 -0
  464. package/lib/public/src/utils/functors/AESDECRYPT.ts +26 -0
  465. package/lib/public/src/utils/functors/AESENCRYPT.ts +26 -0
  466. package/lib/public/src/utils/functors/ARRAYINDEX.ts +23 -0
  467. package/lib/public/src/utils/functors/ARRAYTOSTR.ts +23 -0
  468. package/lib/public/src/utils/functors/AVERAGE.ts +23 -0
  469. package/lib/public/src/utils/functors/CONCAT.ts +20 -0
  470. package/lib/public/src/utils/functors/COUNTA.ts +22 -0
  471. package/lib/public/src/utils/functors/COUNTARRAY.ts +20 -0
  472. package/lib/public/src/utils/functors/COUNTBLANK.ts +22 -0
  473. package/lib/public/src/utils/functors/COUNTCHAR.ts +26 -0
  474. package/lib/public/src/utils/functors/DATAMASK.ts +150 -0
  475. package/lib/public/src/utils/functors/DATEADD.ts +37 -0
  476. package/lib/public/src/utils/functors/DATENOW.ts +27 -0
  477. package/lib/public/src/utils/functors/DATETIME.ts +20 -0
  478. package/lib/public/src/utils/functors/IF.ts +20 -0
  479. package/lib/public/src/utils/functors/INT.ts +23 -0
  480. package/lib/public/src/utils/functors/LOG.ts +24 -0
  481. package/lib/public/src/utils/functors/MAX.ts +24 -0
  482. package/lib/public/src/utils/functors/MIN.ts +24 -0
  483. package/lib/public/src/utils/functors/MOD.ts +24 -0
  484. package/lib/public/src/utils/functors/NUMBER.ts +26 -0
  485. package/lib/public/src/utils/functors/OBJECTVALUE.ts +20 -0
  486. package/lib/public/src/utils/functors/POWER.ts +24 -0
  487. package/lib/public/src/utils/functors/PRODUCT.ts +20 -0
  488. package/lib/public/src/utils/functors/RANDBETWEEN.ts +22 -0
  489. package/lib/public/src/utils/functors/RANDOMNUM.ts +30 -0
  490. package/lib/public/src/utils/functors/ROUND.ts +24 -0
  491. package/lib/public/src/utils/functors/ROUNDDOWN.ts +24 -0
  492. package/lib/public/src/utils/functors/ROUNDUP.ts +25 -0
  493. package/lib/public/src/utils/functors/STRTOARRAY.ts +23 -0
  494. package/lib/public/src/utils/functors/SUM.ts +20 -0
  495. package/lib/public/src/utils/functors/index.ts +32 -0
  496. package/lib/public/src/utils/functors/types.ts +32 -0
  497. package/lib/public/src/utils/functors/utils/tools.ts +15 -0
  498. package/lib/public/src/utils/historytool.ts +154 -0
  499. package/lib/public/src/utils/hooks/index.ts +22 -0
  500. package/lib/public/src/utils/hooks/useCreation.ts +23 -0
  501. package/lib/public/src/utils/hooks/useHiddenStyle.ts +19 -0
  502. package/lib/public/src/utils/hooks/useMovable.ts +227 -0
  503. package/lib/public/src/utils/hooks/usePersistFn.ts +17 -0
  504. package/lib/public/src/utils/hooks/useReactive.ts +73 -0
  505. package/lib/public/src/utils/hooks/useRefState.ts +25 -0
  506. package/lib/public/src/utils/hooks/useSetState.ts +25 -0
  507. package/lib/public/src/utils/hooks/useStyle.ts +139 -0
  508. package/lib/public/src/utils/hooks/useTrackedEffect.ts +39 -0
  509. package/lib/public/src/utils/hooks/useUpdate.ts +9 -0
  510. package/lib/public/src/utils/hooks/useUpdateDeepEffect.ts +22 -0
  511. package/lib/public/src/utils/hooks/useUpdateEffect.ts +18 -0
  512. package/lib/public/src/utils/hooks/useWhyDidYouUpdate.ts +32 -0
  513. package/lib/public/src/utils/i18n/i18n.ts +15 -0
  514. package/lib/public/src/utils/i18n/index.ts +7 -0
  515. package/lib/public/src/utils/i18n/locale/app/en_US.ts +77 -0
  516. package/lib/public/src/utils/i18n/locale/app/index.ts +9 -0
  517. package/lib/public/src/utils/i18n/locale/app/otherLocale.ts +2 -0
  518. package/lib/public/src/utils/i18n/locale/app/zh_CN.ts +65 -0
  519. package/lib/public/src/utils/i18n/locale/app/zh_HK.ts +66 -0
  520. package/lib/public/src/utils/i18n/locale/base/en_US.ts +449 -0
  521. package/lib/public/src/utils/i18n/locale/base/index.ts +5 -0
  522. package/lib/public/src/utils/i18n/locale/base/zh_CN.ts +413 -0
  523. package/lib/public/src/utils/i18n/locale/base/zh_HK.ts +411 -0
  524. package/lib/public/src/utils/i18n/locale/pc/en_US.ts +131 -0
  525. package/lib/public/src/utils/i18n/locale/pc/index.ts +9 -0
  526. package/lib/public/src/utils/i18n/locale/pc/otherLocale.ts +2 -0
  527. package/lib/public/src/utils/i18n/locale/pc/zh_CN.ts +105 -0
  528. package/lib/public/src/utils/i18n/locale/pc/zh_HK.ts +105 -0
  529. package/lib/public/src/utils/i18n/localeMonitor.ts +71 -0
  530. package/lib/public/src/utils/i18n/locales.ts +30 -0
  531. package/lib/public/src/utils/i18n/replaceMessage.ts +29 -0
  532. package/lib/public/src/utils/i18n/types.ts +2 -0
  533. package/lib/public/src/utils/i18n/useLocale.ts +129 -0
  534. package/lib/public/src/utils/lcdpApi.ts +215 -0
  535. package/lib/public/src/utils/lcdpBaseApi.ts +293 -0
  536. package/lib/public/src/utils/messageApi.ts +93 -0
  537. package/lib/public/src/utils/platform/index.ts +1 -0
  538. package/lib/public/src/utils/platform/type.ts +7 -0
  539. package/lib/public/src/utils/platform/utils/fileUtils.ts +536 -0
  540. package/lib/public/src/utils/preprocess.ts +88 -0
  541. package/lib/public/src/utils/sandBoxLoadModule.ts +216 -0
  542. package/lib/public/src/utils/sandbox/browserCompatible.ts +54 -0
  543. package/lib/public/src/utils/sandbox/compileCode.ts +81 -0
  544. package/lib/public/src/utils/sandbox/index.ts +5 -0
  545. package/lib/public/src/utils/sandbox/sandbox.ts +324 -0
  546. package/lib/public/src/utils/sandbox/sandboxrules.ts +206 -0
  547. package/lib/public/src/utils/sandbox/utils.ts +9 -0
  548. package/lib/public/src/utils/service/baseRequest.ts +111 -0
  549. package/lib/public/src/utils/service/commonFetch.ts +140 -0
  550. package/lib/public/src/utils/service/defaultResponseInterceptor.ts +84 -0
  551. package/lib/public/src/utils/service/resolveApiPath.ts +24 -0
  552. package/lib/public/src/utils/service/urlHelper.ts +56 -0
  553. package/lib/public/src/utils/styleInject.ts +17 -0
  554. package/lib/public/src/utils/svgImage/imageUtils.ts +3 -0
  555. package/lib/public/src/utils/svgImage/index.ts +10 -0
  556. package/lib/public/src/utils/uid.ts +33 -0
  557. package/lib/public/src/utils/useComponentHoc.ts +96 -0
  558. package/lib/public/src/utils/useSetState.ts +26 -0
  559. package/lib/public/src/utils/useTool.ts +428 -0
  560. package/lib/public/tsconfig.json +33 -0
  561. package/lib/public/typings.d.ts +1 -0
  562. package/package.json +31 -0
@@ -0,0 +1,1243 @@
1
+ import engineApi from '@/services/api/engine';
2
+ import { getAppFileUrlByFileCode } from '@/services/api/getAppFileUrlByFileCode';
3
+ import { ImportBusiObjModalHooks, ImportBusiObjModalProps } from '@/types';
4
+ import { handleParseGroups as parseGroupFunction } from '@/utils/engine-utils/exportCustomUtils';
5
+ import {
6
+ batchDownloadFileByIds,
7
+ saveBlobFile,
8
+ } from '@/utils/platform/utils/fileUtils';
9
+ import security from '@/utils/Security';
10
+ import resolveApiPath from '@/utils/service/resolveApiPath';
11
+ import {
12
+ Button,
13
+ Card,
14
+ Checkbox,
15
+ message,
16
+ Modal,
17
+ Progress,
18
+ Spin,
19
+ Upload,
20
+ } from 'antd';
21
+ import { UploadProps } from 'antd/es/upload/interface';
22
+ import {
23
+ forwardRef,
24
+ useEffect,
25
+ useImperativeHandle,
26
+ useMemo,
27
+ useRef,
28
+ useState,
29
+ } from 'react';
30
+ import pageIcon from '../../assets/pageicon';
31
+ import { prefix } from '../../styles';
32
+ import { IconFont } from '../IconFont';
33
+ import { closeProgressMsg, openProgressMsg } from '../ProgressComp';
34
+ import './index.less';
35
+ const importBusiObjModal = `${prefix}-import-busi-obj-modal`;
36
+
37
+ const { Dragger } = Upload;
38
+
39
+ const CheckboxGroup = Checkbox.Group;
40
+
41
+ enum Status {
42
+ done = 'done',
43
+ init = 'init',
44
+ fail = 'fail',
45
+ }
46
+
47
+ enum DownloadType {
48
+ downloadTemplate = 'downloadTemplate',
49
+ downloadFail = 'downloadFail',
50
+ }
51
+
52
+ const initInfo = {
53
+ success: [],
54
+ fail: [],
55
+ status: Status.init, // 上传状态,
56
+ msg: '',
57
+ // 异步导入的数据
58
+ fileId: undefined,
59
+ successCount: 0,
60
+ failCount: 0,
61
+ isAsyncImport: false,
62
+ };
63
+
64
+ // TODO 记得删
65
+ // const appId = '1089426139952508928';
66
+ // const pageId = '1108371301173338112';
67
+ const ImportBusiObjModal = forwardRef<
68
+ ImportBusiObjModalHooks,
69
+ ImportBusiObjModalProps
70
+ >((props, ref) => {
71
+ const {
72
+ // appId,
73
+ // pageId,
74
+ // utils,
75
+ } = props;
76
+ const getLocale = props.getLocale!;
77
+ // const api = getApis({ appId: appId, pageId: pageId });
78
+ const [visible, setVisible] = useState<boolean>(false);
79
+ const [loading, setLoading] = useState<boolean>(false);
80
+ const [curDataSource, setCurDataSource] = useState<any[]>([]);
81
+ const [selectedKeys, setSelectedKeys] = useState<any[]>([]);
82
+ const [uploading, setUploading] = useState<boolean>(false);
83
+ const [params, setParams] = useState<any>({});
84
+ const [objOptions, setObjOptions] = useState<any[]>([]);
85
+ const [isCustom, setIsCustom] = useState<boolean>(false); // 是否自定义导入业务对象数据
86
+ const [isCustomService, setIsCustomService] = useState<boolean>(false); // 是否自定义导入数据(通过自定义服务)
87
+ const [isHideCheck, setIsHideCheck] = useState<boolean>(false); // 是否展示选择内容
88
+ const [fileList, setFileList] = useState<any[]>([]);
89
+ const uploadAbortController = useRef<any>();
90
+ // 上传进度和文件解析进度
91
+ const [progress, setProgress] = useState<{ upload: number; parse: number }>({
92
+ upload: 0,
93
+ parse: 0,
94
+ });
95
+ const timeRef = useRef<any>();
96
+
97
+ // 导入的成功和失败列
98
+ const [importInfo, setImportInfo] = useState<any>(initInfo);
99
+ const importList = useRef<any>([]);
100
+
101
+ const RESULT_INFO = {
102
+ warn: {
103
+ title: getLocale(
104
+ 'ExpBusiObjModal.partImportFailTitle',
105
+ '部分数据导入失败',
106
+ ),
107
+ icon: 'lcdp-icon-Warning',
108
+ },
109
+ success: {
110
+ title: getLocale('ExpBusiObjModal.importSuccessTitle', '导入成功'),
111
+ icon: 'lcdp-icon-Success',
112
+ tips: getLocale(
113
+ 'ExpBusiObjModal.importSuccessMsg',
114
+ '数据导入成功,请选择前往列表查看',
115
+ ),
116
+ },
117
+ error: {
118
+ title: getLocale('ExpBusiObjModal.importFailTitle', '导入失败'),
119
+ icon: 'lcdp-icon-Error',
120
+ tips: getLocale(
121
+ 'ExpBusiObjModal.importFailMsg',
122
+ '数据导入失败,请核对以下信息后,再重新提交。',
123
+ ),
124
+ },
125
+ };
126
+
127
+ type RESULT_INFO_TYPE = keyof typeof RESULT_INFO;
128
+
129
+ useEffect(() => {
130
+ return () => {
131
+ if (timeRef?.current) {
132
+ clearTimeout(timeRef?.current);
133
+ }
134
+ };
135
+ }, []);
136
+
137
+ const { successLen, failLen, fileId, isAsyncImport } = useMemo(() => {
138
+ const { isAsyncImport, fail, success, failCount, successCount } =
139
+ importInfo || {};
140
+ return {
141
+ ...importInfo,
142
+ successLen: isAsyncImport ? successCount : success?.length,
143
+ failLen: isAsyncImport ? failCount : fail?.length,
144
+ };
145
+ }, [importInfo]);
146
+
147
+ // 需要展示上传进度步骤和结果页的(自定义导入业务对象和导入业务对象数据动作)
148
+ const hasUploadProcess = useMemo(
149
+ () => isCustom || (!isCustom && !isCustomService),
150
+ [isCustom, isCustomService],
151
+ );
152
+
153
+ const [selectedRows, colNameMap] = useMemo<[any[], any]>(() => {
154
+ const { busiObjectFields, customGroup } = params;
155
+ const nameMap: any = {};
156
+ if (isCustom) {
157
+ // 自定义导入业务对象数据时,busiObjectFields为对象数组格式,其他情况下,busiObjectFields为数组
158
+ const newFields: any = [];
159
+ if (busiObjectFields?.length) {
160
+ curDataSource.forEach((item) => {
161
+ const curField = busiObjectFields.find(
162
+ (field: any) =>
163
+ item.attrCode === field?.code || item.attrCode === field,
164
+ );
165
+ if (curField) {
166
+ nameMap[typeof curField === 'string' ? curField : curField?.code] =
167
+ item.attrName || item.attrCode;
168
+ newFields.push(
169
+ curField?.code ? { ...item, ...(curField || {}) } : item,
170
+ );
171
+ }
172
+ });
173
+ }
174
+ if (customGroup) {
175
+ // 存在表头分组时,需要记录下导出字段的名称和编码映射,组装分组时需要用到
176
+ curDataSource.forEach((c) => {
177
+ nameMap[c.attrCode] = c.attrName;
178
+ });
179
+ }
180
+ return [newFields, nameMap];
181
+ }
182
+ return [
183
+ selectedKeys.length
184
+ ? curDataSource.filter((item) => selectedKeys.includes(item.attrCode))
185
+ : [],
186
+ nameMap,
187
+ ];
188
+ }, [selectedKeys, curDataSource, params, isCustom]);
189
+
190
+ const uploadDisabled = useMemo(
191
+ () =>
192
+ loading ||
193
+ uploading ||
194
+ // 导入业务对象数据动作需要勾选导出字段
195
+ (selectedKeys.length === 0 && !isCustom && !isCustomService) ||
196
+ // 自定义导入业务对象数据动作需要配置导出列,否则禁止上传
197
+ (isCustom && params.busiObjectFields?.length === 0) ||
198
+ // 自定义导入动作需要配置自定义导入地址
199
+ (isCustomService && !params.custUrl),
200
+ [loading, uploading, selectedKeys, isCustom, isCustomService, params],
201
+ );
202
+
203
+ // 获取对象字段
204
+ const queryBusiObjectRowColumns = async ({ busiObjectId }: any) => {
205
+ try {
206
+ setLoading(true);
207
+ const resultList: any = await engineApi.queryBusiObjectRowColumns({
208
+ busiObjectId,
209
+ });
210
+ setCurDataSource(resultList);
211
+ setObjOptions(
212
+ resultList.map((item: any) => ({
213
+ value: item.attrCode,
214
+ label: item.attrName,
215
+ disabled: item.isRequired === 'T',
216
+ })),
217
+ );
218
+ const rows = resultList.filter((item: any) => item.isRequired === 'T');
219
+ setSelectedKeys(rows.map((item: any) => item.attrCode));
220
+ } catch (error) {
221
+ console.log(error);
222
+ message.error(getLocale('service.failMsg', '网络繁忙,请稍后再试'));
223
+ } finally {
224
+ setLoading(false);
225
+ }
226
+ };
227
+
228
+ const queryCustBusiObjectRowColumns = async ({ busiObjectId }: any) => {
229
+ try {
230
+ setLoading(true);
231
+ const resultList: any = await engineApi.queryBusiObjectRowColumns({
232
+ busiObjectId,
233
+ });
234
+ setCurDataSource(resultList);
235
+ } catch (error) {
236
+ console.log(error);
237
+ message.error(getLocale('service.failMsg', '网络繁忙,请稍后再试'));
238
+ } finally {
239
+ setLoading(false);
240
+ }
241
+ };
242
+
243
+ const getWorkBookTemplate = async (
244
+ downloadType = DownloadType.downloadTemplate,
245
+ ) => {
246
+ if (isAsyncImport && downloadType === DownloadType.downloadFail && fileId) {
247
+ // 异步导入如果存在失败原因,从文件服务器下载
248
+ batchDownloadFileByIds({
249
+ fileIds: fileId,
250
+ newFileName: getLocale(
251
+ 'ExpBusiObjModal.importFailList',
252
+ `导入失败列表-${new Date().getTime()}.xlsx`,
253
+ { name: `${new Date().getTime()}` },
254
+ ),
255
+ messageApi: {
256
+ ...message,
257
+ openProgressMsg,
258
+ closeProgressMsg,
259
+ },
260
+ // appId,
261
+ // pageId,
262
+ getLocale,
263
+ });
264
+ return;
265
+ }
266
+ try {
267
+ const { busiObjectId, fileName, customGroup } = params || {};
268
+ const obj: any = {
269
+ pickRows: selectedRows,
270
+ busiObjectId,
271
+ };
272
+ // 存在配置的表头分组,下载模版时需要传给后端组装多表头模版
273
+ if (customGroup && typeof parseGroupFunction === 'function') {
274
+ // 配置了表头分组规则的,进行头部分组组装
275
+ obj.groups = parseGroupFunction({
276
+ list: selectedRows
277
+ .sort((a, b) => +a?.sort - +b?.sort)
278
+ .map((row) => row.attrCode),
279
+ groupMap: customGroup,
280
+ nameMap: colNameMap,
281
+ });
282
+ }
283
+ let resultList;
284
+ let name: string = '';
285
+ // 下载失败模版
286
+ if (downloadType === DownloadType.downloadFail) {
287
+ if (importList?.current?.length) {
288
+ resultList = await engineApi.getFailedWorkBook({
289
+ pickRows: obj.pickRows,
290
+ groups: obj.groups,
291
+ insts: importList?.current || [],
292
+ });
293
+ name = getLocale(
294
+ 'ExpBusiObjModal.importFailList',
295
+ `导入失败列表-${new Date().getTime()}.xlsx`,
296
+ { name: `${new Date().getTime()}` },
297
+ );
298
+ }
299
+ } else {
300
+ name = fileName
301
+ ? `${fileName}.xlsx`
302
+ : `tpl-${new Date().getTime()}.xlsx`;
303
+ resultList = await engineApi.getWorkBookTemplate(obj);
304
+ }
305
+ if (resultList) {
306
+ saveBlobFile({
307
+ data: resultList,
308
+ fileName: name,
309
+ });
310
+ }
311
+ } catch (error) {
312
+ console.log(error);
313
+ message.error(getLocale('service.failMsg', '网络繁忙,请稍后再试'));
314
+ }
315
+ };
316
+
317
+ const open = (options: any) => {
318
+ setVisible(true);
319
+ setIsCustom(false);
320
+ setIsCustomService(false);
321
+ setParams(options || {});
322
+ const { busiObjectId } = options;
323
+ queryBusiObjectRowColumns({ busiObjectId });
324
+ };
325
+
326
+ const openWithCustFields = (options: any) => {
327
+ setVisible(true);
328
+ setIsCustom(true);
329
+ setIsCustomService(false);
330
+ setParams(options || {});
331
+ const { busiObjectId } = options;
332
+ queryCustBusiObjectRowColumns({ busiObjectId });
333
+ };
334
+
335
+ const openWithCustParams = (options: any) => {
336
+ setVisible(true);
337
+ setIsCustom(false);
338
+ setIsCustomService(true);
339
+ setParams(options || {});
340
+ };
341
+
342
+ const close = () => {
343
+ setVisible(false);
344
+ setFileList([]);
345
+ setImportInfo(initInfo);
346
+ // 关闭弹窗的时候如果请求还未结束则停止请求
347
+ if (
348
+ uploadAbortController.current &&
349
+ typeof uploadAbortController.current?.abort === 'function'
350
+ ) {
351
+ // 终止请求
352
+ uploadAbortController.current.abort();
353
+ }
354
+ };
355
+
356
+ const onChange = (checkedValues: any[]) => {
357
+ setSelectedKeys(checkedValues);
358
+ };
359
+
360
+ const onCheckAllChange = (e: any) => {
361
+ if (e.target.checked) {
362
+ setSelectedKeys(curDataSource.map((item) => item.attrCode));
363
+ } else {
364
+ setSelectedKeys(
365
+ curDataSource
366
+ .filter((item) => item.isRequired === 'T')
367
+ .map((item) => item.attrCode),
368
+ );
369
+ }
370
+ };
371
+
372
+ // TODO: 待确认
373
+ const uploadAction = useMemo(() => {
374
+ if (!isCustomService) {
375
+ return engineApi.importInsts;
376
+ }
377
+ const { custUrl } = params || {};
378
+ if (custUrl?.api) {
379
+ return resolveApiPath(custUrl.api);
380
+ }
381
+
382
+ // TODO: 其他情况(自定义导入数据??)
383
+ // if (typeof custUrl === 'string' && custUrl?.startsWith('http') || custUrl?.startsWith('//')) {
384
+ // return custUrl;
385
+ // }
386
+ // if (typeof custUrl === 'string' && custUrl?.startsWith('/')) {
387
+ // return prefix + custUrl;
388
+ // }
389
+ // return `${prefix}/${custUrl}`;
390
+ return '';
391
+ }, [isCustomService, params]);
392
+
393
+ // 上传时的额外参数
394
+ const uploadPropsData = useMemo<any>(() => {
395
+ const obj: any = {};
396
+ const { customGroup, exception = {} } = params || {};
397
+ if (exception) {
398
+ Object.keys(exception).forEach((exp) => {
399
+ obj[exp] = exception[exp];
400
+ });
401
+ }
402
+ // 存在配置的表头分组,下载模版时需要传给后端组装多表头模版
403
+ if (customGroup && typeof parseGroupFunction === 'function') {
404
+ // 配置了表头分组规则的,进行头部分组组装
405
+ obj.groups = parseGroupFunction({
406
+ list: selectedRows
407
+ .sort((a, b) => +a?.sort - +b?.sort)
408
+ .map((row) => row.attrCode),
409
+ groupMap: customGroup,
410
+ nameMap: colNameMap,
411
+ });
412
+ }
413
+ if (!isCustomService) {
414
+ return {
415
+ query: new Blob(
416
+ [
417
+ JSON.stringify({
418
+ pickRows: selectedRows,
419
+ showOnly: params.showOnly === 'T' ? 'T' : 'F',
420
+ busiObjectId: params.busiObjectId,
421
+ ...obj,
422
+ }),
423
+ ],
424
+ { type: 'application/json' },
425
+ ),
426
+ };
427
+ }
428
+ const { _source, _serviceId } = params.custUrl || {};
429
+ const customParams: any = {
430
+ param: new Blob(
431
+ [JSON.stringify({ ...(params.custParams || {}), ...obj })],
432
+ { type: 'application/json' },
433
+ ),
434
+ };
435
+ if (_source === 'std') {
436
+ // 自定义导出勾选了编排类服务
437
+ // customParams['ORCHESTRATION.appId'] = appId;
438
+ customParams['ORCHESTRATION.serviceVersionId'] = _serviceId;
439
+ }
440
+ return customParams;
441
+ }, [isCustomService, selectedRows, params, colNameMap]);
442
+
443
+ const baseUploadProps: UploadProps = {
444
+ name: 'impFile',
445
+ action: uploadAction,
446
+ // @ts-ignore
447
+ withCredentials: true,
448
+ // @ts-ignore
449
+ disabled: uploadDisabled,
450
+ // @ts-ignore
451
+ // showUploadList: isCustom || isCustomService ? true : false,
452
+ // @ts-ignore
453
+ accept: '.xls,.xlsx',
454
+ listType: 'picture',
455
+ // @ts-ignore
456
+ headers: {
457
+ // @ts-ignore
458
+ // 'APP-ID': appId,
459
+ // @ts-ignore
460
+ // 'X-B-TARGET-ID': pageId,
461
+ // @ts-ignore
462
+ 'X-B-AUTH': 1,
463
+ },
464
+ // @ts-ignore
465
+ maxCount: 1,
466
+ // @ts-ignore
467
+ data: uploadPropsData,
468
+ };
469
+
470
+ /**
471
+ * @param responseParams 响应失败上下文参数
472
+ */
473
+ const handleFail = (responseParams: any) => {
474
+ // 状态码非200的情况
475
+ const { message } = responseParams || {};
476
+ const { success, fail, isAsyncImport } = responseParams?.resultObject || {};
477
+ const resultMsg = responseParams?.resultMsg || message;
478
+ if (typeof params?.onFail === 'function') {
479
+ params.onFail(
480
+ isAsyncImport ? undefined : fail || responseParams?.resultObject,
481
+ resultMsg,
482
+ );
483
+ }
484
+ setImportInfo({
485
+ ...responseParams?.resultObject,
486
+ msg:
487
+ resultMsg ||
488
+ getLocale('ExpBusiObjModal.uploadFail', '文件上传失败,请重试!', {}),
489
+ status: Status.fail,
490
+ fail,
491
+ success,
492
+ });
493
+ if (isCustomService) {
494
+ // 上传失败时重置列表
495
+ setFileList([]);
496
+ }
497
+ };
498
+
499
+ /**
500
+ *
501
+ * @param responseParams 响应成功上下文参数
502
+ * @param triggerCallback 是否触发回调和关闭弹窗
503
+ */
504
+ const handleSuccess = (responseParams: any, triggerCallback = false) => {
505
+ const { success, fail, successCount, failCount, isAsyncImport } =
506
+ responseParams?.resultObject || {};
507
+ const successLen = isAsyncImport ? successCount : success?.length;
508
+ const failLen = isAsyncImport ? failCount : fail?.length;
509
+ // 全部导入失败时触发
510
+ if (!successLen && failLen) {
511
+ handleFail({
512
+ ...responseParams,
513
+ resultMsg: getLocale(
514
+ 'ExpBusiObjModal.uploadFail',
515
+ '文件上传失败,请重试!',
516
+ {},
517
+ ),
518
+ });
519
+ } else {
520
+ if (typeof params?.onSuccess === 'function') {
521
+ params.onSuccess(
522
+ isAsyncImport ? undefined : success || responseParams?.resultObject,
523
+ responseParams?.resultMsg,
524
+ );
525
+ }
526
+ // if (hasUploadProcess && !triggerCallback) {
527
+ setImportInfo({
528
+ ...responseParams?.resultObject,
529
+ status: Status.done,
530
+ msg: responseParams?.resultMsg,
531
+ success: success || responseParams?.resultObject || [],
532
+ fail,
533
+ });
534
+ // } else {
535
+ // close();
536
+ // }
537
+ }
538
+ };
539
+
540
+ // 模拟数据处理进度条
541
+ const mockParseProgress = () => {
542
+ let percent = 0;
543
+ let resolve;
544
+ const update = () => {
545
+ if (timeRef?.current) {
546
+ window.clearTimeout(timeRef?.current);
547
+ timeRef.current = null;
548
+ }
549
+ timeRef.current = setTimeout(() => {
550
+ percent = +(percent + Math.max((100 - percent) / 5, 0.01)).toFixed(2);
551
+ setProgress((pre: any) => ({ ...pre, parse: percent }));
552
+ if (percent < 100) {
553
+ update();
554
+ }
555
+ }, 200);
556
+ };
557
+ new Promise((res, rej) => {
558
+ resolve = res;
559
+ update();
560
+ }).then((p) => {
561
+ if (timeRef?.current) {
562
+ window.clearTimeout(timeRef?.current);
563
+ timeRef.current = null;
564
+ }
565
+ setProgress((pre: any) => ({ ...pre, parse: p }));
566
+ });
567
+ return resolve;
568
+ };
569
+
570
+ // 后端返回处理所有列表,前端需要进行解析区分出成功与失败的列表
571
+ const parseSuccess = (result: any, isAsyncImport = false) => {
572
+ return new Promise((resolve) => {
573
+ if (params?.exception?.partialImport !== 'T') {
574
+ // 非部分导入时,存在失败的条目则表示导入失败
575
+ let fail: any[] = [];
576
+ if (!isAsyncImport) {
577
+ fail = (result || []).find((c: any) => c.failReason);
578
+ }
579
+ resolve(
580
+ isAsyncImport
581
+ ? {
582
+ ...result,
583
+ isAsyncImport,
584
+ }
585
+ : { success: fail ? [] : result, fail: fail ? result : [] },
586
+ );
587
+ } else {
588
+ const res: any = {
589
+ success: [],
590
+ fail: [],
591
+ };
592
+ // 开启部分导入时,需要分别展示成功和失败的条目
593
+ setTimeout(() => {
594
+ const parse = (list: any[]) => {
595
+ const curList = list.slice(0, 50);
596
+ curList.forEach((l) => {
597
+ if (l.failReason) {
598
+ res.fail.push(l);
599
+ } else {
600
+ res.success.push(l);
601
+ }
602
+ });
603
+ if (list.slice(50)?.length > 0) {
604
+ const callback = () => {
605
+ parse(list.slice(50));
606
+ };
607
+ if (typeof window.requestAnimationFrame === 'function') {
608
+ window.requestAnimationFrame(callback);
609
+ } else {
610
+ setTimeout(callback, 0);
611
+ }
612
+ } else {
613
+ resolve(res);
614
+ }
615
+ };
616
+ if (isAsyncImport) {
617
+ resolve({ ...result, isAsyncImport });
618
+ } else {
619
+ parse(result);
620
+ }
621
+ }, 0);
622
+ }
623
+ });
624
+ };
625
+
626
+ // 自定义上传方法,若没传response参数,则手动发起上传请求
627
+ const handleCustomUpload = async (res?: any, list?: any) => {
628
+ const _fileList = fileList?.length > 0 ? fileList : list;
629
+ if (!_fileList?.length) {
630
+ message.warn(
631
+ getLocale('ExpBusiObjModal.noFile', '无上传文件,请先选择文件'),
632
+ );
633
+ return;
634
+ }
635
+ let response = res;
636
+ if (!response) {
637
+ try {
638
+ setUploading(true);
639
+ const xhrPromise = new Promise((resolve, reject) => {
640
+ const xhr = new XMLHttpRequest();
641
+ const formData = new FormData();
642
+ const file = _fileList[0];
643
+ formData.append(baseUploadProps.name || 'file', file);
644
+ if (Object.keys(uploadPropsData)?.length) {
645
+ Object.keys(uploadPropsData).forEach((key) => {
646
+ formData.append(key, uploadPropsData[key]);
647
+ });
648
+ }
649
+ importList.current = [];
650
+ xhr.open('post', baseUploadProps.action as string);
651
+ Object.keys(baseUploadProps.headers || {}).forEach((c) => {
652
+ xhr.setRequestHeader(c, (baseUploadProps.headers || {})[c]);
653
+ });
654
+ xhr.setRequestHeader(
655
+ 'X-SIGN',
656
+ security.httpEncryption.createHttpSignStr(
657
+ baseUploadProps.action as string,
658
+ {
659
+ method: 'post',
660
+ headers: baseUploadProps.headers,
661
+ body: formData || '',
662
+ search: '',
663
+ },
664
+ ),
665
+ );
666
+ xhr.withCredentials = true;
667
+ // 后端解析结束触发回调,终止进度
668
+ let finishFn: any;
669
+ xhr.upload.onprogress = ({ loaded }) => {
670
+ setProgress((pre) => ({
671
+ ...pre,
672
+ upload: +((loaded / file.size) * 100).toFixed(2),
673
+ }));
674
+ if (loaded >= file.size) {
675
+ finishFn = mockParseProgress();
676
+ }
677
+ };
678
+ xhr.onload = async () => {
679
+ response = JSON.parse(xhr.responseText || xhr.response);
680
+ if (xhr.status === 200) {
681
+ let result = response?.resultObject;
682
+ let isAsyncImport = false;
683
+ if (hasUploadProcess) {
684
+ if (
685
+ result &&
686
+ typeof result === 'object' &&
687
+ result?.failCount !== undefined
688
+ ) {
689
+ isAsyncImport = true;
690
+ } else if (Array.isArray(result || [])) {
691
+ // 只解析不入库的导入数据出参为数组格式,入库的数据调整成异步导入,返回对象格式
692
+ importList.current = result || [];
693
+ result = [...importList.current];
694
+ }
695
+ const res = await parseSuccess(result, isAsyncImport);
696
+ response = {
697
+ ...response,
698
+ resultObject: res,
699
+ };
700
+ }
701
+ }
702
+ if (typeof finishFn === 'function') {
703
+ finishFn(100);
704
+ }
705
+ resolve(response);
706
+ uploadAbortController.current = null;
707
+ };
708
+ xhr.ontimeout = () => {
709
+ xhr.abort();
710
+ reject();
711
+ if (typeof finishFn === 'function') {
712
+ finishFn(0);
713
+ }
714
+ uploadAbortController.current = null;
715
+ };
716
+ uploadAbortController.current = {
717
+ abort: () => {
718
+ reject();
719
+ xhr.abort();
720
+ if (typeof finishFn === 'function') {
721
+ finishFn(0);
722
+ }
723
+ if (isCustomService) {
724
+ setFileList([]);
725
+ }
726
+ },
727
+ };
728
+ xhr.send(formData);
729
+ });
730
+ await xhrPromise;
731
+ } finally {
732
+ // 重置进度条
733
+ setUploading(false);
734
+ setProgress({ upload: 0, parse: 0 });
735
+ }
736
+ }
737
+ const { resultObject, resultCode } = response || {};
738
+ if (resultCode === '0') {
739
+ handleSuccess(response);
740
+ } else if (resultCode && resultCode !== '0') {
741
+ handleFail(response);
742
+ } else if (!resultCode) {
743
+ // 兼容旧方式
744
+ if (!(resultObject && resultObject[0])) {
745
+ handleFail(response);
746
+ } else {
747
+ handleSuccess(response);
748
+ }
749
+ }
750
+ };
751
+
752
+ const renderFileItem = (file: any, remove?: any) => (
753
+ <div className="upload-list-item">
754
+ <img src={pageIcon.excelIcon} alt="" />
755
+ <div className="content">
756
+ <div className="title">{file.name}</div>
757
+ <div className="text">
758
+ {getLocale('fileSize', '文件大小')}
759
+ {((file?.size || 0) / (1024 * 1024)).toFixed(3)}MB
760
+ </div>
761
+ </div>
762
+ {remove && (
763
+ <div className="delete" onClick={remove}>
764
+ <IconFont width={16} height={16} iconClass="lcdp-icon-shanchu" />
765
+ </div>
766
+ )}
767
+ </div>
768
+ );
769
+
770
+ const uploadProps: UploadProps = {
771
+ ...baseUploadProps,
772
+ // @ts-ignore
773
+ onChange: async (info) => {
774
+ if (!info.file.status) {
775
+ return;
776
+ }
777
+ setFileList(info.fileList);
778
+ if (!['uploading', 'removed'].includes(info.file.status) && !loading) {
779
+ setLoading(true);
780
+ }
781
+ if (info.file.status === 'done') {
782
+ setLoading(false);
783
+ const { response } = info.file;
784
+ await handleCustomUpload(response);
785
+ } else if (info.file.status === 'error') {
786
+ setLoading(false);
787
+ message.error(
788
+ getLocale(
789
+ 'ExpBusiObjModal.uploadFail',
790
+ `${info.file.name} 文件上传失败,请重试!`,
791
+ { name: info.file.name },
792
+ ),
793
+ );
794
+ } else if (info.file.status === 'removed') {
795
+ setLoading(false);
796
+ }
797
+ },
798
+ beforeUpload: (file, list) => {
799
+ if (
800
+ ![
801
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
802
+ 'application/vnd.ms-excel',
803
+ ].includes(file.type)
804
+ ) {
805
+ message.warn(
806
+ getLocale('ExpBusiObjModal.validTable', '请上传合法的表格'),
807
+ );
808
+ return Promise.reject();
809
+ }
810
+ if (visible) {
811
+ // 自定义导入业务对象数据/导入业务对象数据
812
+ setFileList(list);
813
+ if (isCustomService) {
814
+ handleCustomUpload(null, list);
815
+ }
816
+ return false;
817
+ }
818
+ return undefined;
819
+ },
820
+ itemRender: (_, file: any, __, { remove }) => {
821
+ return renderFileItem(file, remove);
822
+ },
823
+ };
824
+
825
+ useImperativeHandle(ref, () => ({
826
+ open,
827
+ close,
828
+ openWithCustFields,
829
+ openWithCustParams,
830
+ }));
831
+
832
+ const renderResultIcon = (type: RESULT_INFO_TYPE, info?: any) => {
833
+ const resultInfo = {
834
+ ...(RESULT_INFO[type] || {}),
835
+ ...info,
836
+ };
837
+ return (
838
+ <div className="result">
839
+ <p className="iconbox">
840
+ <IconFont
841
+ className="icon"
842
+ width={60}
843
+ height={60}
844
+ iconClass={resultInfo.icon}
845
+ />
846
+ </p>
847
+ <p className="title">{resultInfo.title}</p>
848
+ <p className="tips">{resultInfo.tips}</p>
849
+ </div>
850
+ );
851
+ };
852
+
853
+ /** 自定义导入业务对象数据、导入业务对象数据动作
854
+ * 全部校验通过
855
+ * - 展示成功,触发成功回调
856
+ * 部分校验不通过
857
+ * - 开启部分导入
858
+ * - 存在成功
859
+ * - 展示部分失败,触发成功回调传入成功列表,允许下载失败原因
860
+ * - 非部分导入
861
+ * - 展示失败,触发失败回调,允许下载失败原因
862
+ * 全部校验不通过
863
+ * - resultcode不为0或者接口非200
864
+ * - 展示失败,触发失败回调,不下载失败原因
865
+ * - 接口200
866
+ * - 展示失败,触发失败回调,允许下载失败原因
867
+ */
868
+ const renderImportResult = () => {
869
+ if (uploading && fileList[0]) {
870
+ // 上传中,展示进度
871
+ return (
872
+ <Spin
873
+ spinning={progress.upload >= 100 || true}
874
+ tip={getLocale('ExpBusiObjModal.dataDealing', '数据处理中...')}
875
+ >
876
+ <div className="progress">
877
+ {renderFileItem(fileList[0])}
878
+ <div className="progress-item">
879
+ {getLocale('fileUpload', '文件上传')}
880
+ <Progress percent={progress.upload || 0} />
881
+ </div>
882
+ {/* <div className="progress-item">
883
+ 数据处理
884
+ <Progress percent={progress.parse || 0} />
885
+ </div> */}
886
+ </div>
887
+ </Spin>
888
+ );
889
+ }
890
+ if (importInfo?.status === Status.fail && !failLen) {
891
+ // 上传失败
892
+ return (
893
+ <>
894
+ {renderResultIcon('error')}
895
+ <div className="result-sub">
896
+ <span className="title-icon">
897
+ <IconFont
898
+ className="icon"
899
+ width={16}
900
+ height={16}
901
+ iconClass="lcdp-icon-News"
902
+ />
903
+ </span>
904
+ {importInfo?.msg}
905
+ </div>
906
+ </>
907
+ );
908
+ }
909
+ if ([Status.done, Status.fail].includes(importInfo?.status) && failLen) {
910
+ const successLength = successLen || 0;
911
+ const failLength = failLen || 0;
912
+ return (
913
+ <>
914
+ {/* 部分成功部分失败 */}
915
+ {params.exception?.partialImport === 'T' &&
916
+ successLength !== 0 &&
917
+ renderResultIcon('warn', {
918
+ tips: getLocale(
919
+ 'ImportBusiObjModal.tips',
920
+ `导入总记录数${
921
+ successLength + failLength
922
+ }条,其中${successLength}条成功,${failLength}条失败`,
923
+ {
924
+ total: successLength + failLength,
925
+ success: successLength,
926
+ fail: failLen,
927
+ },
928
+ ),
929
+ })}
930
+ {/* 全部校验失败 */}
931
+ {failLength && successLength === 0 && renderResultIcon('error')}
932
+ <div className="result-sub">
933
+ <span className="title-icon">
934
+ <IconFont
935
+ className="icon"
936
+ width={16}
937
+ height={16}
938
+ iconClass="lcdp-icon-News"
939
+ />
940
+ </span>
941
+ <div className="content">
942
+ {getLocale(
943
+ 'ExpBusiObjModal.downloadFailReason',
944
+ '下载导入失败数据,查看失败原因',
945
+ )}
946
+ </div>
947
+ <a
948
+ href="javascript:void(0);"
949
+ onClick={(e) => {
950
+ e.preventDefault();
951
+ getWorkBookTemplate(DownloadType.downloadFail);
952
+ }}
953
+ >
954
+ {getLocale('clickdownload', '点击下载')}
955
+ </a>
956
+ </div>
957
+ </>
958
+ );
959
+ }
960
+ if (importInfo?.status === Status.done) {
961
+ // 导入成功
962
+ return renderResultIcon('success');
963
+ }
964
+ return (
965
+ <>
966
+ {!isCustom && !isCustomService ? (
967
+ <Card
968
+ title={
969
+ <>
970
+ <span
971
+ className={`${importBusiObjModal}-icon`}
972
+ onClick={() => setIsHideCheck(!isHideCheck)}
973
+ >
974
+ <IconFont
975
+ className="ant-tabs-icon"
976
+ width={16}
977
+ height={16}
978
+ iconClass="lcdp-icon-sanjiaoxiala"
979
+ />
980
+ </span>
981
+ <Checkbox
982
+ indeterminate={
983
+ selectedKeys.length > 0 &&
984
+ selectedKeys.length < objOptions.length
985
+ }
986
+ onChange={onCheckAllChange}
987
+ className={`${importBusiObjModal}-checkwrap`}
988
+ checked={selectedKeys.length === objOptions.length}
989
+ >
990
+ <span>
991
+ {getLocale(
992
+ 'ExpBusiObjModal.validField',
993
+ '指定导入的有效字段',
994
+ )}
995
+ </span>
996
+ </Checkbox>
997
+ </>
998
+ }
999
+ size="small"
1000
+ style={{ width: '100%' }}
1001
+ className={`${importBusiObjModal}-downloadcard`}
1002
+ extra={
1003
+ <Button
1004
+ onClick={() => {
1005
+ if (selectedKeys.length) {
1006
+ getWorkBookTemplate();
1007
+ } else {
1008
+ message.error(
1009
+ getLocale(
1010
+ 'ExpBusiObjModal.exportFieldError',
1011
+ '请先选择要导出的字段',
1012
+ ),
1013
+ );
1014
+ }
1015
+ }}
1016
+ type="link"
1017
+ >
1018
+ {getLocale(
1019
+ 'ExpBusiObjModal.downloadMutiTpl',
1020
+ '下载批量导入模版',
1021
+ )}
1022
+ </Button>
1023
+ }
1024
+ >
1025
+ {!isHideCheck && (
1026
+ <Spin spinning={loading}>
1027
+ <CheckboxGroup
1028
+ options={objOptions}
1029
+ value={selectedKeys}
1030
+ onChange={onChange}
1031
+ className={`${importBusiObjModal}-checkbox`}
1032
+ />
1033
+ </Spin>
1034
+ )}
1035
+ </Card>
1036
+ ) : null}
1037
+ <Card
1038
+ title={
1039
+ isCustom || isCustomService
1040
+ ? ''
1041
+ : getLocale('fileUpload', '文件上传')
1042
+ }
1043
+ size="small"
1044
+ style={{
1045
+ width: '100%',
1046
+ marginTop: isCustom || (isCustomService && params.custTpl) ? 0 : 10,
1047
+ borderTopWidth: isCustomService ? 0 : 1,
1048
+ }}
1049
+ className={`${importBusiObjModal}-customCard`}
1050
+ >
1051
+ {isCustom || isCustomService ? (
1052
+ <div className="title">{getLocale('fileUpload', '文件上传')}</div>
1053
+ ) : null}
1054
+ <Dragger
1055
+ {...uploadProps}
1056
+ fileList={fileList}
1057
+ style={{ opacity: uploadDisabled ? 0.3 : 1 }}
1058
+ >
1059
+ <p className="ant-upload-drag-icon">
1060
+ <IconFont
1061
+ className="ant-tabs-icon"
1062
+ width={48}
1063
+ height={48}
1064
+ iconClass="lcdp-icon-cloud-upload"
1065
+ />
1066
+ </p>
1067
+ <p className={`${importBusiObjModal}-text`}>
1068
+ {getLocale(
1069
+ 'ExpBusiObjModal.dragView',
1070
+ '点击选择文件或拖动文件到此区域进行上传',
1071
+ )}
1072
+ </p>
1073
+ <p className={`${importBusiObjModal}-hint`}>
1074
+ {getLocale(
1075
+ 'ExpBusiObjModal.onlySingleUpload',
1076
+ '仅支持单个文件上传',
1077
+ )}
1078
+ </p>
1079
+ </Dragger>
1080
+ </Card>
1081
+ </>
1082
+ );
1083
+ };
1084
+
1085
+ const renderCardExtra = () => {
1086
+ if (isCustom) {
1087
+ return (
1088
+ <Button
1089
+ className={`${importBusiObjModal}-downloadTempBtn`}
1090
+ onClick={() => {
1091
+ if (selectedRows.length) {
1092
+ getWorkBookTemplate();
1093
+ } else {
1094
+ message.error(
1095
+ getLocale(
1096
+ 'ExpSQLServiceModal.importFieldError',
1097
+ '请先选择要导入的字段',
1098
+ ),
1099
+ );
1100
+ }
1101
+ }}
1102
+ type="link"
1103
+ >
1104
+ {getLocale('ExpBusiObjModal.downloadMutiTpl', '下载批量导入模版')}
1105
+ </Button>
1106
+ );
1107
+ }
1108
+ if (isCustomService && (params.custTpl || params.custTplUrl)) {
1109
+ return (
1110
+ <Button
1111
+ onClick={() => {
1112
+ const { fileCode } = params.custTpl || {};
1113
+ // @ts-ignore
1114
+ const downloadUrl =
1115
+ params.custTplUrl ||
1116
+ (fileCode ? getAppFileUrlByFileCode(fileCode) : null);
1117
+ if (!downloadUrl) {
1118
+ return;
1119
+ }
1120
+ // 下载导入模板自定义名称无效处理
1121
+ const xhr = new XMLHttpRequest();
1122
+ xhr.open('GET', downloadUrl, true);
1123
+ xhr.responseType = 'blob'; // 通过文件下载url拿到对应的blob对象
1124
+ xhr.onload = () => {
1125
+ if (xhr.status === 200) {
1126
+ const link = document.createElement('a');
1127
+ link.href = window.URL?.createObjectURL(xhr.response);
1128
+ if (params?.name) {
1129
+ link.download = `${params.name}.xlsx`;
1130
+ }
1131
+ if (params?.custTpl?.name) {
1132
+ link.download = params?.custTpl?.name;
1133
+ }
1134
+ link.click();
1135
+ link.remove();
1136
+ window.URL?.revokeObjectURL(link.href);
1137
+ }
1138
+ };
1139
+ xhr.send();
1140
+ }}
1141
+ type="link"
1142
+ className={`${importBusiObjModal}-downloadTempBtn`}
1143
+ >
1144
+ {getLocale('ExpBusiObjModal.downloadTpl', '下载导入模版')}
1145
+ </Button>
1146
+ );
1147
+ }
1148
+ return null;
1149
+ };
1150
+
1151
+ return (
1152
+ <Modal
1153
+ className={`${importBusiObjModal}-customModal`}
1154
+ title={
1155
+ <>
1156
+ <span className="title">
1157
+ {getLocale('ExpSQLServiceModal.importData', '导入数据')}
1158
+ </span>
1159
+ {(isCustom || isCustomService) && renderCardExtra()}
1160
+ </>
1161
+ }
1162
+ open={visible}
1163
+ destroyOnClose
1164
+ onCancel={close}
1165
+ footer={
1166
+ <>
1167
+ <Button
1168
+ type="default"
1169
+ onClick={() => {
1170
+ if (uploading) {
1171
+ if (
1172
+ uploadAbortController.current &&
1173
+ typeof uploadAbortController.current?.abort === 'function'
1174
+ ) {
1175
+ // 终止请求
1176
+ uploadAbortController.current.abort();
1177
+ }
1178
+ } else {
1179
+ close();
1180
+ }
1181
+ }}
1182
+ >
1183
+ {uploading
1184
+ ? getLocale('cancelUpload', '取消上传')
1185
+ : getLocale('close', '关闭')}
1186
+ </Button>
1187
+ {/* 自定义导入 */}
1188
+ {isCustomService &&
1189
+ !uploading &&
1190
+ importInfo?.status === Status.fail && (
1191
+ <Button
1192
+ type="primary"
1193
+ onClick={() => {
1194
+ setProgress({
1195
+ upload: 0,
1196
+ parse: 0,
1197
+ });
1198
+ setImportInfo(initInfo);
1199
+ }}
1200
+ >
1201
+ {getLocale('reupload', '重新上传')}
1202
+ </Button>
1203
+ )}
1204
+ {/* 自定义导入业务对象数据、导入业务对象数据 */}
1205
+ {hasUploadProcess &&
1206
+ !uploading &&
1207
+ !(importInfo?.status === Status.done && (failLen || 0) === 0) && (
1208
+ <Button
1209
+ type="primary"
1210
+ onClick={() => {
1211
+ setProgress({
1212
+ upload: 0,
1213
+ parse: 0,
1214
+ });
1215
+ if (
1216
+ importInfo?.status === Status.fail ||
1217
+ (failLen || 0) > 0
1218
+ ) {
1219
+ setImportInfo(initInfo);
1220
+ } else {
1221
+ handleCustomUpload();
1222
+ }
1223
+ }}
1224
+ >
1225
+ {importInfo?.status === Status.fail || (failLen || 0) > 0
1226
+ ? getLocale('reupload', '重新上传')
1227
+ : getLocale('upload', '上传')}
1228
+ </Button>
1229
+ )}
1230
+ </>
1231
+ }
1232
+ width={588}
1233
+ >
1234
+ {renderImportResult()}
1235
+ </Modal>
1236
+ );
1237
+ });
1238
+
1239
+ ImportBusiObjModal.defaultProps = {
1240
+ getLocale: (k, p) => p ?? '',
1241
+ };
1242
+
1243
+ export default ImportBusiObjModal;