@lingxiteam/ebe-utils 0.5.5 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/lib/pcpublic/src/components/pcfactory/src/DynamicTabs/index.tsx +2 -2
  2. package/lib/pcpublic/src/components/pcfactory/src/StdUpload/assets/closeIcon.png +0 -0
  3. package/lib/pcpublic/src/components/pcfactory/src/StdUpload/assets/fileName.png +0 -0
  4. package/lib/pcpublic/src/components/pcfactory/src/StdUpload/assets/img.png +0 -0
  5. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFormatCell.ts +279 -0
  6. package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/customLocale.tsx +6 -0
  7. package/lib/public/src/components/ExpBusiObjModal/index.less +28 -0
  8. package/lib/public/src/components/ExpBusiObjModal/index.tsx +315 -0
  9. package/lib/public/src/components/PreviewFile/index.less +200 -0
  10. package/lib/public/src/components/PreviewFile/index.tsx +787 -0
  11. package/lib/public/src/components/PreviewFile/utils.ts +90 -0
  12. package/lib/public/src/components/common/PreviewFile/index.less +200 -0
  13. package/lib/public/src/components/common/PreviewFile/index.tsx +787 -0
  14. package/lib/public/src/components/common/PreviewFile/utils.ts +90 -0
  15. package/lib/public/src/components/pcfactory/src/Alert/index.tsx +22 -0
  16. package/lib/public/src/components/pcfactory/src/Animation/index.tsx +186 -0
  17. package/lib/public/src/components/pcfactory/src/Animation/useAnimation.ts +270 -0
  18. package/lib/public/src/components/pcfactory/src/Animation/useBackgroundStyle.ts +74 -0
  19. package/lib/public/src/components/pcfactory/src/Audio/index.tsx +240 -0
  20. package/lib/public/src/components/pcfactory/src/BarChart/index.tsx +3 -0
  21. package/lib/public/src/components/pcfactory/src/Button/index.tsx +151 -0
  22. package/lib/public/src/components/pcfactory/src/Card/index.tsx +201 -0
  23. package/lib/public/src/components/pcfactory/src/Card/useExtendBtn.tsx +195 -0
  24. package/lib/public/src/components/pcfactory/src/Cascader/index.tsx +398 -0
  25. package/lib/public/src/components/pcfactory/src/ChartBar/index.tsx +15 -0
  26. package/lib/public/src/components/pcfactory/src/ChartBar/loader.tsx +12 -0
  27. package/lib/public/src/components/pcfactory/src/ChartLine/ChartLine.tsx +48 -0
  28. package/lib/public/src/components/pcfactory/src/ChartLine/PropsType.ts +88 -0
  29. package/lib/public/src/components/pcfactory/src/ChartLine/index.tsx +15 -0
  30. package/lib/public/src/components/pcfactory/src/ChartLine/loader.tsx +12 -0
  31. package/lib/public/src/components/pcfactory/src/Checkbox/index.tsx +144 -0
  32. package/lib/public/src/components/pcfactory/src/CheckboxGroup/index.tsx +319 -0
  33. package/lib/public/src/components/pcfactory/src/Collapse/index.tsx +195 -0
  34. package/lib/public/src/components/pcfactory/src/CollapsePanel/index.tsx +186 -0
  35. package/lib/public/src/components/pcfactory/src/Condition/index.tsx +22 -0
  36. package/lib/public/src/components/pcfactory/src/DatePicker/index.tsx +756 -0
  37. package/lib/public/src/components/pcfactory/src/Description/index.tsx +447 -0
  38. package/lib/public/src/components/pcfactory/src/Description/utils/getLabelSizeMode.ts +40 -0
  39. package/lib/public/src/components/pcfactory/src/Divider/components/CenterLineDivider/index.tsx +190 -0
  40. package/lib/public/src/components/pcfactory/src/Divider/components/CenterTabDivider/index.tsx +77 -0
  41. package/lib/public/src/components/pcfactory/src/Divider/components/LeftCardDivider/index.tsx +87 -0
  42. package/lib/public/src/components/pcfactory/src/Divider/components/LeftLineDivider/index.tsx +106 -0
  43. package/lib/public/src/components/pcfactory/src/Divider/components/LeftTabDivider/index.tsx +60 -0
  44. package/lib/public/src/components/pcfactory/src/Divider/components/LeftTopDivider/index.tsx +55 -0
  45. package/lib/public/src/components/pcfactory/src/Divider/components/LxDashed/index.module.less +10 -0
  46. package/lib/public/src/components/pcfactory/src/Divider/components/LxDashed/index.tsx +143 -0
  47. package/lib/public/src/components/pcfactory/src/Divider/components/LxSolid/index.module.less +10 -0
  48. package/lib/public/src/components/pcfactory/src/Divider/components/LxSolid/index.tsx +126 -0
  49. package/lib/public/src/components/pcfactory/src/Divider/index.tsx +210 -0
  50. package/lib/public/src/components/pcfactory/src/Dropdown/index.tsx +385 -0
  51. package/lib/public/src/components/pcfactory/src/DynamicTabs/PropsType.ts +31 -0
  52. package/lib/public/src/components/pcfactory/src/DynamicTabs/TabPage.tsx +63 -0
  53. package/lib/public/src/components/pcfactory/src/DynamicTabs/index.tsx +214 -0
  54. package/lib/public/src/components/pcfactory/src/Form/Form.tsx +600 -0
  55. package/lib/public/src/components/pcfactory/src/Form/WrapperForm.ts +14 -0
  56. package/lib/public/src/components/pcfactory/src/Form/index.tsx +15 -0
  57. package/lib/public/src/components/pcfactory/src/Form/useFormStatus.ts +47 -0
  58. package/lib/public/src/components/pcfactory/src/Form/useMonitor.ts +40 -0
  59. package/lib/public/src/components/pcfactory/src/FormGroup/TitleComp.tsx +107 -0
  60. package/lib/public/src/components/pcfactory/src/FormGroup/index.tsx +181 -0
  61. package/lib/public/src/components/pcfactory/src/FreeLayout/index.tsx +151 -0
  62. package/lib/public/src/components/pcfactory/src/Gantt/Gantt.tsx +460 -0
  63. package/lib/public/src/components/pcfactory/src/Gantt/const.ts +122 -0
  64. package/lib/public/src/components/pcfactory/src/Gantt/index.tsx +16 -0
  65. package/lib/public/src/components/pcfactory/src/Gantt/loader.tsx +12 -0
  66. package/lib/public/src/components/pcfactory/src/GridView/GridView.tsx +435 -0
  67. package/lib/public/src/components/pcfactory/src/GridView/index.tsx +24 -0
  68. package/lib/public/src/components/pcfactory/src/GridView/loader.tsx +12 -0
  69. package/lib/public/src/components/pcfactory/src/HorizontalView/index.tsx +32 -0
  70. package/lib/public/src/components/pcfactory/src/Icon/IconED/index.tsx +42 -0
  71. package/lib/public/src/components/pcfactory/src/Icon/PropsType.ts +57 -0
  72. package/lib/public/src/components/pcfactory/src/Icon/hooks/index.tsx +300 -0
  73. package/lib/public/src/components/pcfactory/src/Icon/index.tsx +69 -0
  74. package/lib/public/src/components/pcfactory/src/IconFont/index.tsx +24 -0
  75. package/lib/public/src/components/pcfactory/src/Img/BasicImage/index.tsx +90 -0
  76. package/lib/public/src/components/pcfactory/src/Img/assets/placeholder.png +0 -0
  77. package/lib/public/src/components/pcfactory/src/Img/index.tsx +91 -0
  78. package/lib/public/src/components/pcfactory/src/Input/index.tsx +425 -0
  79. package/lib/public/src/components/pcfactory/src/InputNumber/index.tsx +263 -0
  80. package/lib/public/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +23 -0
  81. package/lib/public/src/components/pcfactory/src/LXPieChart/PropsType.ts +11 -0
  82. package/lib/public/src/components/pcfactory/src/LXPieChart/index.less +6 -0
  83. package/lib/public/src/components/pcfactory/src/LXPieChart/index.tsx +15 -0
  84. package/lib/public/src/components/pcfactory/src/LXPieChart/loader.tsx +12 -0
  85. package/lib/public/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +25 -0
  86. package/lib/public/src/components/pcfactory/src/LXRadarChart/PropsType.ts +9 -0
  87. package/lib/public/src/components/pcfactory/src/LXRadarChart/index.less +7 -0
  88. package/lib/public/src/components/pcfactory/src/LXRadarChart/index.tsx +17 -0
  89. package/lib/public/src/components/pcfactory/src/LXRadarChart/loader.tsx +12 -0
  90. package/lib/public/src/components/pcfactory/src/Layout/index.tsx +130 -0
  91. package/lib/public/src/components/pcfactory/src/Layout/utils.ts +48 -0
  92. package/lib/public/src/components/pcfactory/src/LineChart/index.tsx +3 -0
  93. package/lib/public/src/components/pcfactory/src/Link/index.tsx +117 -0
  94. package/lib/public/src/components/pcfactory/src/LoopList/index.tsx +551 -0
  95. package/lib/public/src/components/pcfactory/src/Menu/index.tsx +422 -0
  96. package/lib/public/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +95 -0
  97. package/lib/public/src/components/pcfactory/src/ModalSelect/index.tsx +453 -0
  98. package/lib/public/src/components/pcfactory/src/MultipleSelect/index.tsx +3 -0
  99. package/lib/public/src/components/pcfactory/src/Pagination/index.tsx +104 -0
  100. package/lib/public/src/components/pcfactory/src/Password/index.tsx +88 -0
  101. package/lib/public/src/components/pcfactory/src/PictureVerifyCode/assets/placeholder.png +0 -0
  102. package/lib/public/src/components/pcfactory/src/PictureVerifyCode/index.tsx +76 -0
  103. package/lib/public/src/components/pcfactory/src/PieChart/index.tsx +3 -0
  104. package/lib/public/src/components/pcfactory/src/Progress/index.tsx +155 -0
  105. package/lib/public/src/components/pcfactory/src/QRCode/const.ts +5 -0
  106. package/lib/public/src/components/pcfactory/src/QRCode/index.tsx +146 -0
  107. package/lib/public/src/components/pcfactory/src/QuillEditor/QuillEditor.tsx +197 -0
  108. package/lib/public/src/components/pcfactory/src/QuillEditor/index.tsx +37 -0
  109. package/lib/public/src/components/pcfactory/src/QuillEditor/loader.ts +12 -0
  110. package/lib/public/src/components/pcfactory/src/RadarChart/RadarChartHook.ts +449 -0
  111. package/lib/public/src/components/pcfactory/src/RadarChart/RadarChartType.ts +39 -0
  112. package/lib/public/src/components/pcfactory/src/RadarChart/RadarECharts.tsx +86 -0
  113. package/lib/public/src/components/pcfactory/src/RadarChart/index.tsx +16 -0
  114. package/lib/public/src/components/pcfactory/src/RadarChart/loader.tsx +12 -0
  115. package/lib/public/src/components/pcfactory/src/RadarChart/radarDefaultConfig.js +55 -0
  116. package/lib/public/src/components/pcfactory/src/Radio/index.tsx +260 -0
  117. package/lib/public/src/components/pcfactory/src/RangePicker/index.tsx +3 -0
  118. package/lib/public/src/components/pcfactory/src/Rate/index.tsx +187 -0
  119. package/lib/public/src/components/pcfactory/src/ReactECharts/PropsType.ts +37 -0
  120. package/lib/public/src/components/pcfactory/src/ReactECharts/ReactECharts.tsx +672 -0
  121. package/lib/public/src/components/pcfactory/src/ReactECharts/index.tsx +26 -0
  122. package/lib/public/src/components/pcfactory/src/ReactECharts/loader.tsx +12 -0
  123. package/lib/public/src/components/pcfactory/src/RemoteComponent/components/FishRender.tsx +31 -0
  124. package/lib/public/src/components/pcfactory/src/RemoteComponent/components/ReactRender.tsx +55 -0
  125. package/lib/public/src/components/pcfactory/src/RemoteComponent/components/VueRender.tsx +32 -0
  126. package/lib/public/src/components/pcfactory/src/RemoteComponent/constant.ts +9 -0
  127. package/lib/public/src/components/pcfactory/src/RemoteComponent/index.tsx +82 -0
  128. package/lib/public/src/components/pcfactory/src/RemoteComponent/remote-component.config.ts +12 -0
  129. package/lib/public/src/components/pcfactory/src/Result/index.tsx +27 -0
  130. package/lib/public/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +105 -0
  131. package/lib/public/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +234 -0
  132. package/lib/public/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +41 -0
  133. package/lib/public/src/components/pcfactory/src/RichTextEditor/index.tsx +33 -0
  134. package/lib/public/src/components/pcfactory/src/RichTextEditor/loader.ts +12 -0
  135. package/lib/public/src/components/pcfactory/src/Row/Row.tsx +66 -0
  136. package/lib/public/src/components/pcfactory/src/Row/index.tsx +9 -0
  137. package/lib/public/src/components/pcfactory/src/Row/loader.tsx +12 -0
  138. package/lib/public/src/components/pcfactory/src/Select/index.tsx +628 -0
  139. package/lib/public/src/components/pcfactory/src/Select/selectUtils.ts +257 -0
  140. package/lib/public/src/components/pcfactory/src/Slider/index.tsx +351 -0
  141. package/lib/public/src/components/pcfactory/src/StdUpload/DownloadProgress/DownloadProgress.tsx +27 -0
  142. package/lib/public/src/components/pcfactory/src/StdUpload/DownloadProgress/index.ts +3 -0
  143. package/lib/public/src/components/pcfactory/src/StdUpload/UploadItem.tsx +257 -0
  144. package/lib/public/src/components/pcfactory/src/StdUpload/assets/default.png +0 -0
  145. package/lib/public/src/components/pcfactory/src/StdUpload/assets/js.png +0 -0
  146. package/lib/public/src/components/pcfactory/src/StdUpload/assets/pdf.png +0 -0
  147. package/lib/public/src/components/pcfactory/src/StdUpload/assets/ppt.png +0 -0
  148. package/lib/public/src/components/pcfactory/src/StdUpload/assets/txt.png +0 -0
  149. package/lib/public/src/components/pcfactory/src/StdUpload/assets/word.png +0 -0
  150. package/lib/public/src/components/pcfactory/src/StdUpload/assets/xls.png +0 -0
  151. package/lib/public/src/components/pcfactory/src/StdUpload/assets/zip.png +0 -0
  152. package/lib/public/src/components/pcfactory/src/StdUpload/index.tsx +1050 -0
  153. package/lib/public/src/components/pcfactory/src/StdUpload/uploadItem.less +64 -0
  154. package/lib/public/src/components/pcfactory/src/Steps/constant/checkcircle.tsx +29 -0
  155. package/lib/public/src/components/pcfactory/src/Steps/constant/index.ts +2 -0
  156. package/lib/public/src/components/pcfactory/src/Steps/constant/vector.tsx +13 -0
  157. package/lib/public/src/components/pcfactory/src/Steps/index.tsx +343 -0
  158. package/lib/public/src/components/pcfactory/src/SuperSelect/ComSelect.tsx +538 -0
  159. package/lib/public/src/components/pcfactory/src/SuperSelect/index.tsx +127 -0
  160. package/lib/public/src/components/pcfactory/src/SuperSelect/loader.tsx +12 -0
  161. package/lib/public/src/components/pcfactory/src/Swiper/index.tsx +184 -0
  162. package/lib/public/src/components/pcfactory/src/Switch/index.tsx +219 -0
  163. package/lib/public/src/components/pcfactory/src/TabPane/index.tsx +145 -0
  164. package/lib/public/src/components/pcfactory/src/Table/BodyCell/index.tsx +278 -0
  165. package/lib/public/src/components/pcfactory/src/Table/EditComponent/index.tsx +554 -0
  166. package/lib/public/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +34 -0
  167. package/lib/public/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +26 -0
  168. package/lib/public/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +41 -0
  169. package/lib/public/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +32 -0
  170. package/lib/public/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +34 -0
  171. package/lib/public/src/components/pcfactory/src/Table/FormatCell/index.tsx +227 -0
  172. package/lib/public/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +63 -0
  173. package/lib/public/src/components/pcfactory/src/Table/HeaderCell/index.tsx +32 -0
  174. package/lib/public/src/components/pcfactory/src/Table/TableHead/index.tsx +501 -0
  175. package/lib/public/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +46 -0
  176. package/lib/public/src/components/pcfactory/src/Table/constant.ts +73 -0
  177. package/lib/public/src/components/pcfactory/src/Table/hooks/index.ts +32 -0
  178. package/lib/public/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +325 -0
  179. package/lib/public/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +176 -0
  180. package/lib/public/src/components/pcfactory/src/Table/hooks/useColumns.tsx +1851 -0
  181. package/lib/public/src/components/pcfactory/src/Table/hooks/useCommon.ts +39 -0
  182. package/lib/public/src/components/pcfactory/src/Table/hooks/useDataSource.ts +201 -0
  183. package/lib/public/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +324 -0
  184. package/lib/public/src/components/pcfactory/src/Table/hooks/useFilter.tsx +274 -0
  185. package/lib/public/src/components/pcfactory/src/Table/hooks/useFormatCell.ts +309 -0
  186. package/lib/public/src/components/pcfactory/src/Table/hooks/usePagination.ts +104 -0
  187. package/lib/public/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +302 -0
  188. package/lib/public/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +93 -0
  189. package/lib/public/src/components/pcfactory/src/Table/hooks/useScroll.ts +120 -0
  190. package/lib/public/src/components/pcfactory/src/Table/hooks/useSelection.ts +467 -0
  191. package/lib/public/src/components/pcfactory/src/Table/hooks/useSort.ts +39 -0
  192. package/lib/public/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +191 -0
  193. package/lib/public/src/components/pcfactory/src/Table/index.tsx +525 -0
  194. package/lib/public/src/components/pcfactory/src/Table/utils/SequenceId.ts +104 -0
  195. package/lib/public/src/components/pcfactory/src/Table/utils/index.ts +442 -0
  196. package/lib/public/src/components/pcfactory/src/Tabs/index.tsx +209 -0
  197. package/lib/public/src/components/pcfactory/src/Tag/index.tsx +39 -0
  198. package/lib/public/src/components/pcfactory/src/Text/index.tsx +191 -0
  199. package/lib/public/src/components/pcfactory/src/TextArea/ForIETextArea.tsx +96 -0
  200. package/lib/public/src/components/pcfactory/src/TextArea/index.tsx +255 -0
  201. package/lib/public/src/components/pcfactory/src/TimePicker/index.tsx +3 -0
  202. package/lib/public/src/components/pcfactory/src/TlrView/index.tsx +3 -0
  203. package/lib/public/src/components/pcfactory/src/TooltipView/PropsType.ts +22 -0
  204. package/lib/public/src/components/pcfactory/src/TooltipView/TooltipViewED/index.tsx +10 -0
  205. package/lib/public/src/components/pcfactory/src/TooltipView/hooks/index.tsx +90 -0
  206. package/lib/public/src/components/pcfactory/src/TooltipView/index.tsx +13 -0
  207. package/lib/public/src/components/pcfactory/src/Transfer/index.tsx +753 -0
  208. package/lib/public/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +102 -0
  209. package/lib/public/src/components/pcfactory/src/Tree/index.tsx +1303 -0
  210. package/lib/public/src/components/pcfactory/src/TreeSelect/index.tsx +639 -0
  211. package/lib/public/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -0
  212. package/lib/public/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +82 -0
  213. package/lib/public/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +61 -0
  214. package/lib/public/src/components/pcfactory/src/TreeTable/index.tsx +273 -0
  215. package/lib/public/src/components/pcfactory/src/Upload/Upload.tsx +740 -0
  216. package/lib/public/src/components/pcfactory/src/Upload/index.tsx +29 -0
  217. package/lib/public/src/components/pcfactory/src/Upload/loader.tsx +13 -0
  218. package/lib/public/src/components/pcfactory/src/VerificationCode/assets/placeholder.png +0 -0
  219. package/lib/public/src/components/pcfactory/src/VerificationCode/index.tsx +297 -0
  220. package/lib/public/src/components/pcfactory/src/VerticalView/index.tsx +25 -0
  221. package/lib/public/src/components/pcfactory/src/VideoPlayer/index.tsx +159 -0
  222. package/lib/public/src/components/pcfactory/src/View/index.tsx +150 -0
  223. package/lib/public/src/components/pcfactory/src/View/useBackgroundStyle.ts +75 -0
  224. package/lib/public/src/components/pcfactory/src/VirtualGroup/index.tsx +16 -0
  225. package/lib/public/src/components/pcfactory/src/Webview/index.tsx +104 -0
  226. package/lib/public/src/components/pcfactory/src/index.component.ts +253 -0
  227. package/lib/public/src/components/pcfactory/src/styles/common.less +107 -0
  228. package/lib/public/src/components/pcfactory/src/styles/compatible.less +976 -0
  229. package/lib/public/src/components/pcfactory/src/styles/components/Alert.less +25 -0
  230. package/lib/public/src/components/pcfactory/src/styles/components/Audio.less +198 -0
  231. package/lib/public/src/components/pcfactory/src/styles/components/Button.less +32 -0
  232. package/lib/public/src/components/pcfactory/src/styles/components/Card.less +155 -0
  233. package/lib/public/src/components/pcfactory/src/styles/components/Cascader.less +54 -0
  234. package/lib/public/src/components/pcfactory/src/styles/components/Checkbox.less +7 -0
  235. package/lib/public/src/components/pcfactory/src/styles/components/Collapse.less +214 -0
  236. package/lib/public/src/components/pcfactory/src/styles/components/DatePicker.less +22 -0
  237. package/lib/public/src/components/pcfactory/src/styles/components/Description.less +64 -0
  238. package/lib/public/src/components/pcfactory/src/styles/components/Divider.less +530 -0
  239. package/lib/public/src/components/pcfactory/src/styles/components/Drawer.less +54 -0
  240. package/lib/public/src/components/pcfactory/src/styles/components/Dropdown.less +11 -0
  241. package/lib/public/src/components/pcfactory/src/styles/components/DynamicDataContainer.less +16 -0
  242. package/lib/public/src/components/pcfactory/src/styles/components/DynamicTabs.less +254 -0
  243. package/lib/public/src/components/pcfactory/src/styles/components/Form.less +265 -0
  244. package/lib/public/src/components/pcfactory/src/styles/components/FormGroup.less +111 -0
  245. package/lib/public/src/components/pcfactory/src/styles/components/Gantt.less +139 -0
  246. package/lib/public/src/components/pcfactory/src/styles/components/GridView.less +62 -0
  247. package/lib/public/src/components/pcfactory/src/styles/components/Icon.less +20 -0
  248. package/lib/public/src/components/pcfactory/src/styles/components/Input.less +164 -0
  249. package/lib/public/src/components/pcfactory/src/styles/components/InputNumber.less +124 -0
  250. package/lib/public/src/components/pcfactory/src/styles/components/InputPassword.less +3 -0
  251. package/lib/public/src/components/pcfactory/src/styles/components/Link.less +4 -0
  252. package/lib/public/src/components/pcfactory/src/styles/components/LoopList.less +67 -0
  253. package/lib/public/src/components/pcfactory/src/styles/components/Menu.less +54 -0
  254. package/lib/public/src/components/pcfactory/src/styles/components/ModalSelect.less +42 -0
  255. package/lib/public/src/components/pcfactory/src/styles/components/Popconfirm.less +7 -0
  256. package/lib/public/src/components/pcfactory/src/styles/components/Progress.less +57 -0
  257. package/lib/public/src/components/pcfactory/src/styles/components/QuillEditor.less +15 -0
  258. package/lib/public/src/components/pcfactory/src/styles/components/Radio.less +7 -0
  259. package/lib/public/src/components/pcfactory/src/styles/components/Rate.less +16 -0
  260. package/lib/public/src/components/pcfactory/src/styles/components/Result.less +26 -0
  261. package/lib/public/src/components/pcfactory/src/styles/components/Select.less +146 -0
  262. package/lib/public/src/components/pcfactory/src/styles/components/Slider.less +78 -0
  263. package/lib/public/src/components/pcfactory/src/styles/components/StdUpload.less +225 -0
  264. package/lib/public/src/components/pcfactory/src/styles/components/Step.less +91 -0
  265. package/lib/public/src/components/pcfactory/src/styles/components/SuperSelect.less +83 -0
  266. package/lib/public/src/components/pcfactory/src/styles/components/Swiper.less +106 -0
  267. package/lib/public/src/components/pcfactory/src/styles/components/Switch.less +49 -0
  268. package/lib/public/src/components/pcfactory/src/styles/components/Table.less +1229 -0
  269. package/lib/public/src/components/pcfactory/src/styles/components/Tabs.less +291 -0
  270. package/lib/public/src/components/pcfactory/src/styles/components/Tag.less +107 -0
  271. package/lib/public/src/components/pcfactory/src/styles/components/TextArea.less +12 -0
  272. package/lib/public/src/components/pcfactory/src/styles/components/TooltipView.less +43 -0
  273. package/lib/public/src/components/pcfactory/src/styles/components/Transfer.less +155 -0
  274. package/lib/public/src/components/pcfactory/src/styles/components/Tree.less +329 -0
  275. package/lib/public/src/components/pcfactory/src/styles/components/TreeSelect.less +65 -0
  276. package/lib/public/src/components/pcfactory/src/styles/components/Upload.less +26 -0
  277. package/lib/public/src/components/pcfactory/src/styles/components/VerificationCode.less +162 -0
  278. package/lib/public/src/components/pcfactory/src/styles/components/Webview.less +31 -0
  279. package/lib/public/src/components/pcfactory/src/styles/index.less +10 -0
  280. package/lib/public/src/components/pcfactory/src/styles/index.ued.less +65 -0
  281. package/lib/public/src/components/pcfactory/src/styles/theme/variables/antdVariables.less +84 -0
  282. package/lib/public/src/components/pcfactory/src/styles/theme/variables/common.less +9 -0
  283. package/lib/public/src/components/pcfactory/src/styles/theme/variables/customVariables.less +35 -0
  284. package/lib/public/src/components/pcfactory/src/styles/theme/variables/index.less +2 -0
  285. package/lib/public/src/components/pcfactory/src/utils/ChannelContainer.tsx +150 -0
  286. package/lib/public/src/components/pcfactory/src/utils/ChildRender.ts +103 -0
  287. package/lib/public/src/components/pcfactory/src/utils/CustomModule.tsx +134 -0
  288. package/lib/public/src/components/pcfactory/src/utils/DummyFormContext.ts +136 -0
  289. package/lib/public/src/components/pcfactory/src/utils/Empty/customLocale.tsx +6 -0
  290. package/lib/public/src/components/pcfactory/src/utils/Empty/empty.tsx +37 -0
  291. package/lib/public/src/components/pcfactory/src/utils/LoaderHelper.tsx +29 -0
  292. package/lib/public/src/components/pcfactory/src/utils/PropsType.ts +21 -0
  293. package/lib/public/src/components/pcfactory/src/utils/WithSyncValue.ts +218 -0
  294. package/lib/public/src/components/pcfactory/src/utils/ahooks/index.ts +22 -0
  295. package/lib/public/src/components/pcfactory/src/utils/ahooks/useCreation.ts +23 -0
  296. package/lib/public/src/components/pcfactory/src/utils/ahooks/useDeepCompareEffect.ts +27 -0
  297. package/lib/public/src/components/pcfactory/src/utils/ahooks/useMap.ts +46 -0
  298. package/lib/public/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +27 -0
  299. package/lib/public/src/components/pcfactory/src/utils/ahooks/usePrevious.ts +19 -0
  300. package/lib/public/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +26 -0
  301. package/lib/public/src/components/pcfactory/src/utils/ahooks/useSetState.ts +26 -0
  302. package/lib/public/src/components/pcfactory/src/utils/ahooks/useUnmountedRef.ts +14 -0
  303. package/lib/public/src/components/pcfactory/src/utils/ahooks/useUpdate.ts +9 -0
  304. package/lib/public/src/components/pcfactory/src/utils/ahooks/useUpdateEffect.ts +16 -0
  305. package/lib/public/src/components/pcfactory/src/utils/basicStatusTransfer.ts +32 -0
  306. package/lib/public/src/components/pcfactory/src/utils/common.ts +367 -0
  307. package/lib/public/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +106 -0
  308. package/lib/public/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +131 -0
  309. package/lib/public/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +646 -0
  310. package/lib/public/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +123 -0
  311. package/lib/public/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +411 -0
  312. package/lib/public/src/components/pcfactory/src/utils/formUtils/common.ts +28 -0
  313. package/lib/public/src/components/pcfactory/src/utils/getExportDefaultObj.ts +11 -0
  314. package/lib/public/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +140 -0
  315. package/lib/public/src/components/pcfactory/src/utils/hooks/useDataMask.ts +83 -0
  316. package/lib/public/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +63 -0
  317. package/lib/public/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +86 -0
  318. package/lib/public/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +41 -0
  319. package/lib/public/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +43 -0
  320. package/lib/public/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +90 -0
  321. package/lib/public/src/components/pcfactory/src/utils/hooks/useListenState.ts +26 -0
  322. package/lib/public/src/components/pcfactory/src/utils/hooks/useLocale.ts +129 -0
  323. package/lib/public/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +80 -0
  324. package/lib/public/src/components/pcfactory/src/utils/hooks/useRules.ts +89 -0
  325. package/lib/public/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +26 -0
  326. package/lib/public/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +33 -0
  327. package/lib/public/src/components/pcfactory/src/utils/index.ts +19 -0
  328. package/lib/public/src/components/pcfactory/src/utils/polyfill.js +305 -0
  329. package/lib/public/src/components/pcfactory/src/utils/renderReadOnly.tsx +105 -0
  330. package/lib/public/src/components/pcfactory/src/variables.ts +2 -0
  331. package/lib/public/src/components/pcfactory/typings.d.ts +27 -0
  332. package/lib/public/src/hooks/useGenerateContext.ts +73 -0
  333. package/lib/public/src/styles/common.less +41 -0
  334. package/lib/public/src/styles/index.less +4 -0
  335. package/lib/public/src/styles/index.ts +1 -0
  336. package/lib/public/src/styles/theme/variables.less +130 -0
  337. package/lib/public/src/utils/LcdpSpin/index.less +13 -0
  338. package/lib/public/src/utils/LcdpSpin/index.tsx +12 -0
  339. package/lib/public/src/utils/ModalManager/Drawer/index.less +30 -0
  340. package/lib/public/src/utils/ModalManager/Drawer/index.tsx +109 -0
  341. package/lib/public/src/utils/ModalManager/Modal/index.less +7 -0
  342. package/lib/public/src/utils/ModalManager/Modal/index.tsx +96 -0
  343. package/lib/public/src/utils/ModalManager/index.tsx +278 -0
  344. package/lib/public/src/utils/Security/encipher/des.ts +52 -0
  345. package/lib/public/src/utils/customFuncMapping.ts +107 -0
  346. package/lib/public/src/utils/formUtils.ts +458 -0
  347. package/lib/public/src/utils/i18n/i18n.ts +15 -0
  348. package/lib/public/src/utils/i18n/index.ts +7 -0
  349. package/lib/public/src/utils/i18n/locale/app/en_US.ts +77 -0
  350. package/lib/public/src/utils/i18n/locale/app/index.ts +9 -0
  351. package/lib/public/src/utils/i18n/locale/app/otherLocale.ts +2 -0
  352. package/lib/public/src/utils/i18n/locale/app/zh_CN.ts +65 -0
  353. package/lib/public/src/utils/i18n/locale/app/zh_HK.ts +66 -0
  354. package/lib/public/src/utils/i18n/locale/base/en_US.ts +449 -0
  355. package/lib/public/src/utils/i18n/locale/base/index.ts +5 -0
  356. package/lib/public/src/utils/i18n/locale/base/zh_CN.ts +413 -0
  357. package/lib/public/src/utils/i18n/locale/base/zh_HK.ts +411 -0
  358. package/lib/public/src/utils/i18n/locale/pc/en_US.ts +131 -0
  359. package/lib/public/src/utils/i18n/locale/pc/index.ts +9 -0
  360. package/lib/public/src/utils/i18n/locale/pc/otherLocale.ts +2 -0
  361. package/lib/public/src/utils/i18n/locale/pc/zh_CN.ts +105 -0
  362. package/lib/public/src/utils/i18n/locale/pc/zh_HK.ts +105 -0
  363. package/lib/public/src/utils/i18n/localeMonitor.ts +71 -0
  364. package/lib/public/src/utils/i18n/locales.ts +30 -0
  365. package/lib/public/src/utils/i18n/replaceMessage.ts +29 -0
  366. package/lib/public/src/utils/i18n/types.ts +2 -0
  367. package/lib/public/src/utils/i18n/useLocale.ts +129 -0
  368. package/lib/public/src/utils/messageApi.ts +93 -0
  369. package/lib/public/src/utils/service/commonFetch.ts +1 -1
  370. package/lib/public/src/utils/useTool.ts +428 -0
  371. package/package.json +2 -2
  372. /package/lib/public/src/utils/functors/{dateAdd.ts → DATEADD.ts} +0 -0
@@ -0,0 +1,467 @@
1
+ import { TableRowSelection } from 'antd/lib/table/interface';
2
+ import { useEffect, useMemo, useRef, useState } from 'react';
3
+ import { MyTableProps } from '../types/prop';
4
+ import { recursionDataSource } from '../utils';
5
+ import useCheckStrict from './useCheckStrict';
6
+
7
+ type selectionProps<T> = {
8
+ innerDataSource: T[];
9
+ currentRowKey: string;
10
+ currentPageDataSource: T[];
11
+ checkIfHiddenRow?: Function;
12
+ hasPageChangeEvent?: boolean;
13
+ funcExpExecute: Function;
14
+ };
15
+ const useSelection = <T extends { [key: string]: unknown }>(
16
+ props: MyTableProps & selectionProps<T>,
17
+ ) => {
18
+ const {
19
+ innerDataSource,
20
+ currentRowKey,
21
+ currentPageDataSource,
22
+ checkIfHiddenRow,
23
+ page,
24
+ hasPageChangeEvent,
25
+ rowSelection,
26
+ rowSelectionDisabled,
27
+ onSelectChange,
28
+ funcExpExecute,
29
+ checkLoosed,
30
+ expandable,
31
+ } = props;
32
+
33
+ const { childrenColumnName = 'children' } = expandable || {};
34
+
35
+ const [selectedRows, setSelectedRows] = useState<any[]>([]);
36
+ const [selectedRowKeys, setSelectedRowKeys] = useState<any[]>([]);
37
+ const [currentPageSelectedRows, setCurrentPageSelectedRows] = useState<any[]>(
38
+ [],
39
+ );
40
+ const [currentPageSelectedRowKeys, setCurrentPageSelectedRowKeys] = useState<
41
+ any[]
42
+ >([]);
43
+ const {
44
+ checkStrictly,
45
+ relatedDisabledMap,
46
+ markDisable,
47
+ triggerSingleSelection,
48
+ triggerFullSelection,
49
+ } = useCheckStrict<T>({
50
+ dataSource: innerDataSource,
51
+ currentRowKey,
52
+ rowSelectType: rowSelection?.type,
53
+ checkLoosed,
54
+ childrenKey: childrenColumnName,
55
+ });
56
+
57
+ // 记录动作+操作选中的keys,包括跨页和非法的key
58
+ const combineSelectedRowKeysRef = useRef<any[]>([]);
59
+ const hiddenKeysRef = useRef<any[]>([]);
60
+ const updateCombineKeys = (keys: string[], action = false) => {
61
+ // 通过动作设置选中数据时,是追加而非覆盖
62
+ const curKeys = action ? combineSelectedRowKeysRef.current : keys;
63
+ if (action) {
64
+ // hiddenKeysRef记录的是动作设置的,string类型的,且不在当前页面展示的选中key,等数据被加载后需要显示选中
65
+ hiddenKeysRef.current = keys;
66
+ } else {
67
+ // 当更新当前selectedKeys时,从hiddenKeys中过滤掉页面上已展示过的
68
+ // 配置时兼容key为数字or字符串的情况
69
+ const currentMap: Record<string | number, boolean> = keys.reduce(
70
+ (p, n) => {
71
+ p[n] = true;
72
+ return p;
73
+ },
74
+ {} as any,
75
+ );
76
+ hiddenKeysRef.current = hiddenKeysRef.current.filter(
77
+ (k) => !currentMap[k],
78
+ );
79
+ }
80
+ // 更新表格所有的选中key
81
+ combineSelectedRowKeysRef.current = [
82
+ ...new Set([...curKeys, ...hiddenKeysRef.current]),
83
+ ];
84
+ };
85
+
86
+ // 给动作专用
87
+ const [actionSetSelectRowsObject, updateSelectRowsObject] = useState<any>();
88
+
89
+ /**
90
+ * 判断可选表格某行是否允许界面选中
91
+ * @param row 某行数据对象
92
+ * @param index 某行所处当前页行索引
93
+ * @returns
94
+ */
95
+ const handleIsRowSelectDisabled = (row: any, index?: number) => {
96
+ // 存量:配置态生成的DSL是包含的完整代码的对象
97
+ if (rowSelectionDisabled?.code) {
98
+ return funcExpExecute(rowSelectionDisabled.code, [
99
+ {
100
+ key: 'row',
101
+ value: row,
102
+ },
103
+ {
104
+ key: 'index',
105
+ value: index,
106
+ },
107
+ ]);
108
+ }
109
+ if (rowSelectionDisabled) {
110
+ /**
111
+ * 新版:配置态生成的DSL就是一个$$包含函数的表达式
112
+ * 但会经过预处理移除 $$
113
+ */
114
+ return funcExpExecute(rowSelectionDisabled, [
115
+ {
116
+ key: 'row',
117
+ value: row,
118
+ },
119
+ {
120
+ key: 'index',
121
+ value: index,
122
+ },
123
+ ]);
124
+ }
125
+
126
+ return false;
127
+ };
128
+
129
+ /**
130
+ * 获取所有页选中行数据
131
+ * @param _selectedRows 当前选中的行数据
132
+ * @returns
133
+ */
134
+ const handleAllPageSelectedRows = (_selectedRows: any[] = []) => {
135
+ // 当 未配置页面回调事件 时,认为是前端分页,此时,_selectedRows 就代表所有页选中行数据
136
+ if (!hasPageChangeEvent) {
137
+ return _selectedRows;
138
+ }
139
+
140
+ // 当 配置页面回调事件 时,认为是后端分页,此时,_selectedRows 代表当前页选中数据,需要特殊处理
141
+ if (currentRowKey) {
142
+ // 移除当前所有页行选中中,当前页对应的选中
143
+ const otherPageSelectedRows = selectedRows.filter((selectedRow) => {
144
+ return !innerDataSource.some(
145
+ (row: any) => row[currentRowKey] === selectedRow[currentRowKey],
146
+ );
147
+ });
148
+
149
+ // 重新补回最新的当前页的选中数据,返回所有页选中行数据
150
+ return [...otherPageSelectedRows, ..._selectedRows];
151
+ }
152
+
153
+ return _selectedRows;
154
+ };
155
+
156
+ /**
157
+ * 获取当前页选中行数据
158
+ * @param selectedRows 当前最新的选中的行数据
159
+ * @returns
160
+ */
161
+ const handleCurrentPageSelectedRows = (selectedRows: any[] = []) => {
162
+ let currentPageSeletedRows = [];
163
+
164
+ if (currentRowKey) {
165
+ const currentPageKey = new Set<string>();
166
+ // 记录当前页数据(包括层级数据)的主键集合
167
+ recursionDataSource(
168
+ currentPageDataSource,
169
+ (n) => {
170
+ currentPageKey.add(n[currentRowKey] as string);
171
+ },
172
+ childrenColumnName,
173
+ );
174
+ // 在当前最新的选中的行数据中,找到属于当前页的、且可选中数据
175
+ currentPageSeletedRows = selectedRows.filter((selectedRow) => {
176
+ return currentPageKey.has(selectedRow[currentRowKey]);
177
+ });
178
+ }
179
+
180
+ return currentPageSeletedRows;
181
+ };
182
+
183
+ /**
184
+ * 处理复选框、单选按钮选中
185
+ * @param _selectedRows 当前选中的行数据(在dataSource中真正有的行数据)
186
+ * 注:selectedRowKeys 中不在 dataSource 的,rows 不包含
187
+ */
188
+ const handleSelect = (_selectedRows: any[]) => {
189
+ // 单选
190
+ if (rowSelection?.type === 'radio') {
191
+ onRowSelected(_selectedRows, true, _selectedRows);
192
+ } else {
193
+ // 多选
194
+ const allPageSelectedRows = handleAllPageSelectedRows(_selectedRows);
195
+
196
+ let currentPageSelectedRows;
197
+
198
+ /**
199
+ * 1、当 配置页面回调事件 时,认为是后端分页,此时,_selectedRows 就代表当前页选中数据
200
+ * 2、当 未配置页面回调事件(前端分页) 且 未开启分页 时,认为只有一页,此时,_selectedRows 就代表当前页选中数据
201
+ */
202
+ if (hasPageChangeEvent || !page) {
203
+ currentPageSelectedRows = _selectedRows;
204
+ }
205
+
206
+ onRowSelected(allPageSelectedRows, true, currentPageSelectedRows);
207
+ }
208
+ };
209
+
210
+ const onRowSelected = (
211
+ _sltrows: any[],
212
+ doOnSelectChange: boolean,
213
+ _currentPageSelectedRows?: any[],
214
+ ) => {
215
+ const sltrows: any = currentRowKey ? _sltrows : [];
216
+
217
+ const sltkeys: any = sltrows.map((row: any) => row[currentRowKey]);
218
+
219
+ setSelectedRows(sltrows);
220
+ updateCombineKeys(sltkeys);
221
+ setSelectedRowKeys(sltkeys);
222
+
223
+ let newCurrentPageSelectedRows: any = currentRowKey
224
+ ? _currentPageSelectedRows
225
+ : [];
226
+ let newCurrentPageSelectedRowKeys = newCurrentPageSelectedRows?.map(
227
+ (r: any) => r[currentRowKey],
228
+ );
229
+
230
+ if (!_currentPageSelectedRows) {
231
+ newCurrentPageSelectedRows = currentRowKey
232
+ ? handleCurrentPageSelectedRows(sltrows)
233
+ : [];
234
+ newCurrentPageSelectedRowKeys = newCurrentPageSelectedRows.map(
235
+ (r: any) => r[currentRowKey],
236
+ );
237
+ }
238
+
239
+ // 更新当前页选中数据
240
+ setCurrentPageSelectedRows(newCurrentPageSelectedRows);
241
+ setCurrentPageSelectedRowKeys(newCurrentPageSelectedRowKeys);
242
+
243
+ if (typeof onSelectChange === 'function' && doOnSelectChange) {
244
+ const oldSelectedKeys = selectedRowKeys.sort();
245
+ const newSelectedKeys = sltkeys.sort();
246
+
247
+ // 当选中数据变更时,才需要触发选中回调
248
+ if (JSON.stringify(oldSelectedKeys) !== JSON.stringify(newSelectedKeys)) {
249
+ onSelectChange(sltkeys, sltrows);
250
+ }
251
+ }
252
+ };
253
+
254
+ const onRowSelectClick = (record: any, index?: number) => {
255
+ // 行禁用,不允许界面选中
256
+ if (rowSelection && !handleIsRowSelectDisabled(record, index)) {
257
+ if (selectedRowKeys.includes(record[currentRowKey])) {
258
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
259
+ rowSelection.type === 'radio'
260
+ ? onRowSelected([record], true)
261
+ : onRowSelected(triggerSingleSelection(selectedRows, record), true);
262
+ } else {
263
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
264
+ rowSelection.type === 'radio'
265
+ ? onRowSelected([record], true)
266
+ : onRowSelected(triggerSingleSelection(selectedRows, record), true);
267
+ }
268
+ }
269
+ };
270
+
271
+ // 设置选中行动作设置的默认选中
272
+ const handleUpdateSelectedRows = (
273
+ selectedRowsRule: string | string[] | T[],
274
+ ) => {
275
+ let actionSetSelectedKeys: any = [];
276
+ // 记录设置选中行时配置的对象格式格数据
277
+ const rowsObject = new Map();
278
+ if (selectedRowsRule) {
279
+ if (!['string', 'object'].includes(typeof selectedRowsRule)) {
280
+ // TODO: (2022.7.27 与国永沟通),废弃旧版本在表格内部对 $$ 表达式的解析
281
+ console.warn(
282
+ '请检查配置数据,现有版本只支持(行id字符串或数组、行对象)',
283
+ );
284
+ updateSelectRowsObject(rowsObject);
285
+ return;
286
+ }
287
+
288
+ // '1' / '1,2,3' / 1,2,3 代表选中行的行id
289
+ if (typeof selectedRowsRule === 'string') {
290
+ actionSetSelectedKeys =
291
+ selectedRowsRule?.split(',').map((k) => k.trim()) || [];
292
+ }
293
+
294
+ // 处理 [{ [rowId]: '1'} ...] 或 ['1', '2'] 或 [1, 2]
295
+ if (Array.isArray(selectedRowsRule)) {
296
+ actionSetSelectedKeys = selectedRowsRule
297
+ .map((one) => {
298
+ if (['string', 'number'].includes(typeof one)) {
299
+ return one;
300
+ }
301
+
302
+ if (typeof one === 'object' && !Array.isArray(one) && one) {
303
+ const rowKey = one[currentRowKey];
304
+ if (rowKey) {
305
+ rowsObject.set(rowKey, one);
306
+ }
307
+ return rowKey;
308
+ }
309
+
310
+ return undefined;
311
+ })
312
+ .filter((one) => !!one);
313
+ }
314
+
315
+ // 代表行数据对象
316
+ if (
317
+ !Array.isArray(selectedRowsRule) &&
318
+ typeof selectedRowsRule === 'object'
319
+ ) {
320
+ const selectedRowKey = selectedRowsRule[currentRowKey];
321
+ if (selectedRowKey) {
322
+ rowsObject.set(selectedRowKey, selectedRowsRule);
323
+ }
324
+ actionSetSelectedKeys = selectedRowKey ? [selectedRowKey] : [];
325
+ }
326
+ }
327
+
328
+ updateCombineKeys(actionSetSelectedKeys, true);
329
+ updateSelectRowsObject(rowsObject);
330
+ };
331
+
332
+ // 可选表格当前页不允许选择的行数据
333
+ const currentPageDisabledRows = useMemo(() => {
334
+ return currentPageDataSource.filter((row: any, index: number) =>
335
+ handleIsRowSelectDisabled(row, index),
336
+ );
337
+ }, [currentPageDataSource]);
338
+
339
+ useEffect(() => {
340
+ if (currentRowKey) {
341
+ const keySet: Record<string | number, unknown> = {};
342
+ const map: any = {};
343
+ // 数据源变更需要更新当前选中行的数据,保证获取时能获取到当前最新的数据详情
344
+ recursionDataSource<{ [k: string]: any; children?: any[] }>(
345
+ innerDataSource as [],
346
+ (n) => {
347
+ map[n[currentRowKey]] = n;
348
+ },
349
+ childrenColumnName,
350
+ );
351
+
352
+ const rows = [];
353
+ selectedRows.forEach((selectedRow) => {
354
+ const key = selectedRow[currentRowKey];
355
+ if (!map[key]) {
356
+ map[key] = selectedRow;
357
+ }
358
+ });
359
+
360
+ const actionRows: any[] = [];
361
+ const collectSelectedRow = (key: string | number, childFlag = false) => {
362
+ if (!keySet[key]) {
363
+ const row = map[key] || actionSetSelectRowsObject.get(key);
364
+ const canSelected = childFlag
365
+ ? !relatedDisabledMap[row[currentRowKey]]
366
+ : true;
367
+ // 通过动作设置选中的禁用节点,允许选中
368
+ // 通过动作设置选中父节点时,非禁用的子级数据也需要选中
369
+ if (row && canSelected) {
370
+ keySet[key] = row;
371
+ actionRows.push(row);
372
+ if (row?.[childrenColumnName]?.length && !checkStrictly) {
373
+ recursionDataSource<{ [k: string]: any }>(
374
+ row[childrenColumnName],
375
+ (n) => {
376
+ if (n[currentRowKey]) {
377
+ collectSelectedRow(n[currentRowKey], true);
378
+ }
379
+ },
380
+ childrenColumnName,
381
+ );
382
+ }
383
+ }
384
+ }
385
+ };
386
+ const fullKeys = triggerFullSelection(
387
+ combineSelectedRowKeysRef.current || [],
388
+ );
389
+ // 遍历所有选中keys,组装当前选中行
390
+ fullKeys.forEach((key: string | number) => {
391
+ collectSelectedRow(key);
392
+ });
393
+ rows.push(...actionRows);
394
+ onRowSelected(rows, true);
395
+ }
396
+ }, [
397
+ actionSetSelectRowsObject,
398
+ currentRowKey,
399
+ innerDataSource,
400
+ childrenColumnName,
401
+ ]);
402
+
403
+ // 分页更新时,更新当前页选中数据
404
+ useEffect(() => {
405
+ const newCurrentPageSelectedRows =
406
+ handleCurrentPageSelectedRows(selectedRows);
407
+ const newCurrentPageSelectedRowKeys = newCurrentPageSelectedRows.map(
408
+ (r: any) => r[currentRowKey],
409
+ );
410
+ setCurrentPageSelectedRows(newCurrentPageSelectedRows);
411
+ setCurrentPageSelectedRowKeys(newCurrentPageSelectedRowKeys);
412
+ }, [selectedRows, currentRowKey, currentPageDataSource]);
413
+
414
+ return {
415
+ rowSelection: rowSelection
416
+ ? {
417
+ type: rowSelection.type,
418
+ selectedRowKeys,
419
+ checkStrictly,
420
+ onChange: (_: any, sltrows: any[]) => handleSelect(sltrows),
421
+ getCheckboxProps: (record: T) => {
422
+ const props: ReturnType<
423
+ Required<TableRowSelection<unknown>>['getCheckboxProps']
424
+ > = {
425
+ disabled: relatedDisabledMap[record[currentRowKey] as string],
426
+ };
427
+
428
+ /**
429
+ * 决定可选表格某行是否可选
430
+ * 由于此接口不支持索引 index 操作,所以 index 定位行逻辑放在 currentPageDisabledRows,以此兼容
431
+ */
432
+ const isRowSelectDisabled =
433
+ handleIsRowSelectDisabled(record) ||
434
+ !!currentPageDisabledRows.find(
435
+ (row) => row[currentRowKey] === record[currentRowKey],
436
+ );
437
+
438
+ if (
439
+ isRowSelectDisabled ||
440
+ checkIfHiddenRow?.(record[currentRowKey])
441
+ ) {
442
+ props.disabled = true;
443
+ }
444
+
445
+ // 开启checkLoosed模式时,父禁用子也禁用
446
+ markDisable(record, props.disabled || false);
447
+
448
+ return props;
449
+ },
450
+ }
451
+ : undefined,
452
+ selectedRows,
453
+ selectedRowKeys,
454
+ currentPageSelectedRows,
455
+ currentPageSelectedRowKeys,
456
+ setSelectedRows,
457
+ setSelectedRowKeys,
458
+ setCurrentPageSelectedRows,
459
+ setCurrentPageSelectedRowKeys,
460
+ setSelectedRowsRule: handleUpdateSelectedRows,
461
+ onRowSelected,
462
+ onRowSelectClick,
463
+ checkStrictly,
464
+ };
465
+ };
466
+
467
+ export default useSelection;
@@ -0,0 +1,39 @@
1
+ import { useMemo, useState } from 'react';
2
+ import { compareFn } from '../utils';
3
+
4
+ const useSort = (props: any) => {
5
+ const { innerDataSource, onSortChange } = props;
6
+
7
+ const hasSortEvent = typeof onSortChange === 'function'; // 是否配置表格排序事件
8
+
9
+ // 开启了行合并后由前端进行排序
10
+ const [sortOrder, setSortOrder] = useState<
11
+ | {
12
+ field: string;
13
+ order?: string;
14
+ }
15
+ | undefined
16
+ >();
17
+
18
+ // 前端排序后的数据
19
+ const sortDataSource = useMemo(() => {
20
+ if (!sortOrder?.order) {
21
+ return innerDataSource;
22
+ }
23
+ return [...innerDataSource].sort((a, b) => {
24
+ if (sortOrder?.order === 'ascend') {
25
+ return compareFn(a[sortOrder?.field], b[sortOrder?.field]);
26
+ }
27
+ return compareFn(b[sortOrder?.field], a[sortOrder?.field]);
28
+ });
29
+ }, [innerDataSource, sortOrder]);
30
+
31
+ return {
32
+ onSortChange,
33
+ sortDataSource,
34
+ setSortOrder,
35
+ hasSortEvent,
36
+ };
37
+ };
38
+
39
+ export default useSort;
@@ -0,0 +1,191 @@
1
+ import { TableColumnProps } from 'antd';
2
+ import { useMemo } from 'react';
3
+ import { SummaryConfig } from '../types/prop';
4
+
5
+ export type ColItem = {
6
+ /**
7
+ * 总结行类型 sub 合计
8
+ */
9
+ operateType: 'sub';
10
+
11
+ /**
12
+ * 总结行涉及列key集合
13
+ */
14
+ group: string[];
15
+ };
16
+
17
+ export type Column = {
18
+ key?: string;
19
+ dataIndex: string;
20
+ type?: string;
21
+ fixed?: TableColumnProps<any>['fixed'];
22
+ align?: TableColumnProps<any>['align'];
23
+ children?: Array<Column>;
24
+ };
25
+ export interface SummaryProps<T> {
26
+ summaryConfig?: SummaryConfig;
27
+ readonly dataSource?: Array<T>;
28
+ columns?: Array<Column>;
29
+ }
30
+ const useSummaryCol = <T>(props: SummaryProps<T>) => {
31
+ const { summaryConfig, dataSource, columns } = props;
32
+ const { summaryType, summaryGroup } = useMemo(() => {
33
+ if (!summaryConfig) {
34
+ return {
35
+ summaryType: 'none',
36
+ summaryGroup: [],
37
+ };
38
+ }
39
+ const { type } = summaryConfig;
40
+ return {
41
+ summaryType: type,
42
+ summaryGroup:
43
+ type === 'single' ? summaryConfig?.col : summaryConfig?.group,
44
+ };
45
+ }, [summaryConfig]);
46
+
47
+ const summaryColIndexMap = useMemo(() => {
48
+ const map = new Map<
49
+ string,
50
+ {
51
+ index: number;
52
+ operateType: ColItem['operateType'];
53
+ }
54
+ >();
55
+ if (summaryType === 'none') {
56
+ return map;
57
+ }
58
+ summaryGroup?.forEach(({ group, operateType }, index) => {
59
+ if (group?.length) {
60
+ group.forEach((g: string) => {
61
+ map.set(g, {
62
+ operateType,
63
+ index,
64
+ });
65
+ });
66
+ }
67
+ });
68
+ return map;
69
+ }, [summaryGroup, summaryType]);
70
+
71
+ /**
72
+ * 1. 勾选相邻的,按顺序渲染,多列时进行合并
73
+ * 2. 勾选不相邻时,空出来的填充空白单元格
74
+ * 3. 勾选不相邻,位置存在交叉的,交叉的作为单独计算项
75
+ */
76
+ const summaryColList = useMemo(() => {
77
+ if (summaryColIndexMap.size === 0) return [];
78
+ const col: Array<{
79
+ title: string | number;
80
+ colSpan?: number;
81
+ dataIndexList?: string[];
82
+ operateType?: ColItem['operateType'];
83
+ prev?: {
84
+ index: number;
85
+ fixed?: TableColumnProps<T>['fixed'];
86
+ };
87
+ align?: TableColumnProps<T>['align'];
88
+ }> = [];
89
+ // 标记当前已经记录的总结列
90
+ const currentSummaryColMap: Record<number, (typeof col)[number]> = {};
91
+ columns?.forEach((c, i) => {
92
+ if (i === 0 && c.type === 'orderCol' && summaryConfig?.name) {
93
+ col.push({
94
+ title: summaryConfig?.name,
95
+ align: c.align,
96
+ });
97
+ } else {
98
+ let item: (typeof col)[number] = {
99
+ title: '',
100
+ dataIndexList: [],
101
+ align: c.align,
102
+ };
103
+ const { key, dataIndex } = c;
104
+ const summaryCol = summaryColIndexMap.get(key || '');
105
+ if (summaryCol) {
106
+ const { index, operateType } = summaryCol;
107
+ if (currentSummaryColMap[index]) {
108
+ const prevItem = currentSummaryColMap[index];
109
+ if (
110
+ prevItem?.prev &&
111
+ i === prevItem?.prev?.index + 1 &&
112
+ prevItem?.prev?.fixed === c?.fixed
113
+ ) {
114
+ // 勾选列是相邻的,则允许合并
115
+ item = prevItem;
116
+ } else {
117
+ // 单独一列
118
+ col.push(item);
119
+ }
120
+ } else {
121
+ currentSummaryColMap[index] = item;
122
+ // 合并分组
123
+ col.push(item);
124
+ }
125
+ item?.dataIndexList?.push?.(dataIndex);
126
+ item.colSpan = (item.colSpan || 0) + 1;
127
+ if (item.colSpan > 1) {
128
+ item.align = 'center';
129
+ }
130
+ item.prev = {
131
+ index: i,
132
+ fixed: c?.fixed,
133
+ };
134
+ item.operateType = operateType;
135
+ return;
136
+ }
137
+ // 没有配置的单独一列作为空白单元格存在
138
+ col.push(item);
139
+ }
140
+ });
141
+ const dataMap: Record<string, any[]> = {};
142
+ dataSource?.forEach((v) => {
143
+ Object.keys(v || {}).forEach((key: string) => {
144
+ if (!dataMap[key]) {
145
+ dataMap[key] = [];
146
+ }
147
+ dataMap[key].push((v as any)[key]);
148
+ });
149
+ });
150
+ return col.map((c) => {
151
+ const { operateType, dataIndexList = [] } = c;
152
+ const item = {
153
+ ...c,
154
+ };
155
+ switch (operateType) {
156
+ case 'sub': {
157
+ // 计算合计
158
+ const sub = dataIndexList.reduce((p, dataIndex) => {
159
+ const data = dataMap[dataIndex] || [];
160
+ let val = p;
161
+ if (isNaN(val)) {
162
+ // 转换失败不合计
163
+ return NaN;
164
+ }
165
+ data.forEach((v) => {
166
+ val += Number(v);
167
+ });
168
+ return val;
169
+ }, 0);
170
+ item.title = isNaN(sub)
171
+ ? ''
172
+ : sub.toFixed(summaryConfig?.decimal || 0);
173
+ break;
174
+ }
175
+ default:
176
+ }
177
+ return item;
178
+ });
179
+ }, [
180
+ dataSource,
181
+ summaryConfig?.name,
182
+ summaryConfig?.decimal,
183
+ columns,
184
+ summaryColIndexMap,
185
+ ]);
186
+ return {
187
+ summaryColList,
188
+ };
189
+ };
190
+
191
+ export default useSummaryCol;