aldehyde 0.2.480 → 0.2.481

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 (582) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +2 -2
  3. package/lib/controls/2dEditor/2dEditor/index.less +5 -5
  4. package/lib/controls/2dEditor/2dView/index.less +8 -8
  5. package/lib/controls/2dEditor/components/component.less +83 -83
  6. package/lib/controls/action/index.css +8 -8
  7. package/lib/controls/action/index.d.ts.map +1 -1
  8. package/lib/controls/chemstruc/graph.d.ts.map +1 -1
  9. package/lib/controls/chemstruc/index.css +28 -28
  10. package/lib/controls/collapse-card/index.css +8 -8
  11. package/lib/controls/collapse-card/index.d.ts.map +1 -1
  12. package/lib/controls/cquery/cquick-button.d.ts.map +1 -1
  13. package/lib/controls/entity-select/entity-select.d.ts.map +1 -1
  14. package/lib/controls/entity-select/index.css +7 -7
  15. package/lib/controls/entity-select/lab-tree-select.d.ts.map +1 -1
  16. package/lib/controls/entity-select/popover-entity-select.d.ts.map +1 -1
  17. package/lib/controls/file-view/index.less +9 -9
  18. package/lib/controls/html-editor/index.less +67 -67
  19. package/lib/controls/icon-selector/icon/aldehyde-menu-icon/iconfont.css +147 -147
  20. package/lib/controls/password-setter/index.css +2 -2
  21. package/lib/controls/password-setter/index.d.ts.map +1 -1
  22. package/lib/controls/qr-code/index.less +28 -28
  23. package/lib/controls/relation-existion/index.css +3 -3
  24. package/lib/controls/relation-existion/index.d.ts.map +1 -1
  25. package/lib/controls/rfield/index.css +4 -4
  26. package/lib/controls/rfield/index.d.ts.map +1 -1
  27. package/lib/controls/select/index.d.ts.map +1 -1
  28. package/lib/controls/signature/index.d.ts.map +1 -1
  29. package/lib/controls/text/ellipsis-text.d.ts.map +1 -1
  30. package/lib/controls/text/index.less +7 -7
  31. package/lib/controls/upload/index.d.ts.map +1 -1
  32. package/lib/controls/upload/mult-file-upload.d.ts.map +1 -1
  33. package/lib/custom-page/dtmpl-custom-edit-modal-page.d.ts.map +1 -1
  34. package/lib/detail/button/bottom-submit-button-bar.d.ts.map +1 -1
  35. package/lib/detail/button/cquery-button-bar.d.ts.map +1 -1
  36. package/lib/detail/button/fix-right-submit-button-bar.d.ts.map +1 -1
  37. package/lib/detail/button/index.css +42 -42
  38. package/lib/detail/dtmpl.css +67 -67
  39. package/lib/detail/edit/fields-edit-card.d.ts.map +1 -1
  40. package/lib/detail/edit/modal-row-edit.d.ts.map +1 -1
  41. package/lib/detail/edit/popover-edit-card.d.ts.map +1 -1
  42. package/lib/detail/rightbar/index.css +34 -34
  43. package/lib/detail/rightbar/index.d.ts.map +1 -1
  44. package/lib/detail/view/act-dtmpl-view.d.ts.map +1 -1
  45. package/lib/detail/view/field-view-group.d.ts.map +1 -1
  46. package/lib/detail/view/modal-dtmpl-view.d.ts.map +1 -1
  47. package/lib/detail/view/snapshot-timeline.d.ts.map +1 -1
  48. package/lib/detail/view/tab-act-dtmpl-view.d.ts.map +1 -1
  49. package/lib/draw-canvas-edit/components/render/components/index.d.ts +3 -0
  50. package/lib/draw-canvas-edit/components/render/components/index.d.ts.map +1 -0
  51. package/lib/draw-canvas-edit/components/render/components/index.js +3 -0
  52. package/lib/draw-canvas-edit/components/render/components/index.js.map +1 -0
  53. package/lib/draw-canvas-edit/components/render/components/workstation-component.d.ts +31 -0
  54. package/lib/draw-canvas-edit/components/render/components/workstation-component.d.ts.map +1 -0
  55. package/lib/draw-canvas-edit/components/render/components/workstation-component.js +105 -0
  56. package/lib/draw-canvas-edit/components/render/components/workstation-component.js.map +1 -0
  57. package/lib/draw-canvas-edit/components/render/tools/component-factory.d.ts +2 -0
  58. package/lib/draw-canvas-edit/components/render/tools/component-factory.d.ts.map +1 -1
  59. package/lib/draw-canvas-edit/components/render/tools/component-factory.js +10 -42
  60. package/lib/draw-canvas-edit/components/render/tools/component-factory.js.map +1 -1
  61. package/lib/draw-canvas-edit/components/render/types.d.ts +3 -0
  62. package/lib/draw-canvas-edit/components/render/types.d.ts.map +1 -1
  63. package/lib/draw-canvas-edit/components/render/types.js.map +1 -1
  64. package/lib/draw-canvas-edit/index.less +48 -48
  65. package/lib/draw-canvas-view/index.less +59 -59
  66. package/lib/draw-canvas-view/view.d.ts.map +1 -1
  67. package/lib/draw-canvas-view/view.js +19 -6
  68. package/lib/draw-canvas-view/view.js.map +1 -1
  69. package/lib/export/export-frame.css +2 -2
  70. package/lib/export/export-frame.d.ts.map +1 -1
  71. package/lib/export/select-code-export-frame.d.ts.map +1 -1
  72. package/lib/form/dtmpl-form.css +3 -3
  73. package/lib/form/dtmpl-form.d.ts.map +1 -1
  74. package/lib/form/dtmpl-form.js +1 -1
  75. package/lib/form/dtmpl-form.js.map +1 -1
  76. package/lib/form/field-group-form.d.ts.map +1 -1
  77. package/lib/form/form-Item-group.d.ts.map +1 -1
  78. package/lib/form/index.css +12 -12
  79. package/lib/import/excel-import.d.ts.map +1 -1
  80. package/lib/import/index.css +53 -53
  81. package/lib/import/template.css +50 -50
  82. package/lib/layout/common.css +64 -64
  83. package/lib/layout/coverstyle.css +51 -51
  84. package/lib/layout/footer/index.css +5 -5
  85. package/lib/layout/header/index.css +122 -122
  86. package/lib/layout/menu/block.css +7 -7
  87. package/lib/layout/menu/block.d.ts.map +1 -1
  88. package/lib/layout/menu/l2menu-quick-bar.d.ts.map +1 -1
  89. package/lib/layout/menu/menu-2layers.d.ts.map +1 -1
  90. package/lib/layout/menu/message-bar.less +73 -73
  91. package/lib/layout/menu/reset-password.d.ts.map +1 -1
  92. package/lib/layout/menu/user-bar.d.ts.map +1 -1
  93. package/lib/layout/menu/userinfo-bar.d.ts.map +1 -1
  94. package/lib/layout/sidebar/index.css +57 -57
  95. package/lib/layout2/css/header.css +41 -41
  96. package/lib/layout2/css/sider.less +17 -17
  97. package/lib/layout2/css/tabs-layout.less +18 -18
  98. package/lib/layout3/css/header.less +195 -195
  99. package/lib/layout3/css/main.less +161 -161
  100. package/lib/layout3/css/sider.less +32 -32
  101. package/lib/layout3/css/tabs-layout.less +38 -38
  102. package/lib/layout4/css/header.less +196 -196
  103. package/lib/layout4/css/main.less +154 -154
  104. package/lib/layout4/css/sider.less +37 -37
  105. package/lib/layout4/css/tabs-layout.less +42 -42
  106. package/lib/layout5/css/header.less +35 -35
  107. package/lib/layout5/css/sider.less +18 -18
  108. package/lib/list/calendar/index.less +20 -20
  109. package/lib/list/card-list/index.less +154 -154
  110. package/lib/list/gantt/index.less +8 -8
  111. package/lib/list/vertical-list/index.less +208 -208
  112. package/lib/login/index.css +19 -19
  113. package/lib/login/login.d.ts.map +1 -1
  114. package/lib/login/vertify/index.css +143 -143
  115. package/lib/login3/index.less +136 -136
  116. package/lib/lowcode-components/act-table/index.less +26 -26
  117. package/lib/lowcode-components/base-button/index.less +7 -7
  118. package/lib/lowcode-components/base-map/index.js +6 -6
  119. package/lib/lowcode-components/base-radio/index.less +23 -23
  120. package/lib/lowcode-components/base-tabs/index.less +14 -14
  121. package/lib/lowcode-components/border/border10/index.less +26 -26
  122. package/lib/lowcode-components/border/border11/index.js +46 -46
  123. package/lib/lowcode-components/border/border11/index.less +17 -17
  124. package/lib/lowcode-components/border/border12/index.js +13 -13
  125. package/lib/lowcode-components/border/border12/index.less +13 -13
  126. package/lib/lowcode-components/border/border13/index.js +5 -5
  127. package/lib/lowcode-components/border/border13/index.less +13 -13
  128. package/lib/lowcode-components/border/border2/index.less +17 -17
  129. package/lib/lowcode-components/border/border3/index.less +25 -25
  130. package/lib/lowcode-components/border/border4/index.js +2 -2
  131. package/lib/lowcode-components/border/border4/index.less +72 -72
  132. package/lib/lowcode-components/border/border5/index.js +2 -2
  133. package/lib/lowcode-components/border/border5/index.less +35 -35
  134. package/lib/lowcode-components/border/border6/index.less +17 -17
  135. package/lib/lowcode-components/border/border7/index.less +26 -26
  136. package/lib/lowcode-components/border/border8/index.less +13 -13
  137. package/lib/lowcode-components/border/border9/index.js +14 -14
  138. package/lib/lowcode-components/border/border9/index.less +13 -13
  139. package/lib/lowcode-components/decoration/decoration1/index.less +7 -7
  140. package/lib/lowcode-components/decoration/decoration10/index.js +3 -3
  141. package/lib/lowcode-components/decoration/decoration10/index.less +5 -5
  142. package/lib/lowcode-components/decoration/decoration11/index.less +5 -5
  143. package/lib/lowcode-components/decoration/decoration2/index.less +6 -6
  144. package/lib/lowcode-components/decoration/decoration3/index.less +7 -7
  145. package/lib/lowcode-components/decoration/decoration4/index.less +29 -29
  146. package/lib/lowcode-components/decoration/decoration5/index.less +3 -3
  147. package/lib/lowcode-components/decoration/decoration6/index.less +7 -7
  148. package/lib/lowcode-components/decoration/decoration7/index.less +4 -4
  149. package/lib/lowcode-components/decoration/decoration8/index.less +14 -14
  150. package/lib/lowcode-components/decoration/decoration9/index.less +4 -4
  151. package/lib/lowcode-components/effectScatter-map/index.js +6 -6
  152. package/lib/lowcode-components/effectScatter-map-3d/index.js +6 -6
  153. package/lib/lowcode-components/lowcode-view/index.less +19 -19
  154. package/lib/lowcode-components/search-form/index.less +25 -25
  155. package/lib/module/dtmpl-edit-card.d.ts.map +1 -1
  156. package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
  157. package/lib/module/index.less +4 -4
  158. package/lib/module/ltmpl-modal.d.ts.map +1 -1
  159. package/lib/module/ltmpl-table.d.ts.map +1 -1
  160. package/lib/routable/index.less +25 -25
  161. package/lib/table/act-table.d.ts.map +1 -1
  162. package/lib/table/column/index.less +63 -63
  163. package/lib/table/index.css +211 -211
  164. package/lib/table/modal-select-table.d.ts.map +1 -1
  165. package/lib/table/pagination.css +14 -14
  166. package/lib/table/pagination.d.ts.map +1 -1
  167. package/lib/table/relation-table.d.ts.map +1 -1
  168. package/lib/table/select-table.d.ts.map +1 -1
  169. package/lib/table/select-table.js +14 -2
  170. package/lib/table/select-table.js.map +1 -1
  171. package/lib/table/selected-rows-card.d.ts.map +1 -1
  172. package/lib/table/stat/restat.d.ts.map +1 -1
  173. package/lib/tree/act-tree.d.ts.map +1 -1
  174. package/lib/tree/block-menu-auth-tree.d.ts.map +1 -1
  175. package/lib/tree/index.css +22 -22
  176. package/lib/tree/tmpl-tree.d.ts.map +1 -1
  177. package/lib/welcome/components/menu-card.less +96 -96
  178. package/lib/welcome/components/page-card.less +49 -49
  179. package/lib/welcome/components/quick-entrance.less +120 -120
  180. package/lib/welcome/components/user-menus.less +192 -192
  181. package/lib/welcome/components/workbench.less +118 -118
  182. package/lib/welcome/index.css +13 -13
  183. package/package.json +223 -223
  184. package/src/aldehyde/controls/2dEditor/2dEditor/index.less +5 -5
  185. package/src/aldehyde/controls/2dEditor/2dEditor/index.tsx +270 -270
  186. package/src/aldehyde/controls/2dEditor/2dView/index.less +8 -8
  187. package/src/aldehyde/controls/2dEditor/2dView/index.tsx +110 -110
  188. package/src/aldehyde/controls/2dEditor/components/card.tsx +256 -256
  189. package/src/aldehyde/controls/2dEditor/components/component.less +83 -83
  190. package/src/aldehyde/controls/2dEditor/components/data.d.ts +32 -32
  191. package/src/aldehyde/controls/2dEditor/components/hotspot.tsx +80 -80
  192. package/src/aldehyde/controls/2dEditor/components/html-box.tsx +101 -101
  193. package/src/aldehyde/controls/2dEditor/components/image.tsx +99 -99
  194. package/src/aldehyde/controls/2dEditor/components/line.tsx +73 -73
  195. package/src/aldehyde/controls/action/index.css +8 -8
  196. package/src/aldehyde/controls/action/index.tsx +406 -406
  197. package/src/aldehyde/controls/action/utils.tsx +306 -306
  198. package/src/aldehyde/controls/auto-complete/index.tsx +82 -82
  199. package/src/aldehyde/controls/cascader/index.tsx +112 -112
  200. package/src/aldehyde/controls/chemstruc/graph.tsx +185 -185
  201. package/src/aldehyde/controls/chemstruc/index.css +28 -28
  202. package/src/aldehyde/controls/code-editor/sql-code-editor.tsx +73 -73
  203. package/src/aldehyde/controls/collapse-card/index.css +8 -8
  204. package/src/aldehyde/controls/collapse-card/index.tsx +109 -109
  205. package/src/aldehyde/controls/color-picker/index.tsx +21 -21
  206. package/src/aldehyde/controls/counting-tag/index.tsx +53 -53
  207. package/src/aldehyde/controls/cquery/cquick-button.tsx +145 -145
  208. package/src/aldehyde/controls/date-picker/index.tsx +199 -199
  209. package/src/aldehyde/controls/direct-file-view/drawer-file-view.tsx +54 -54
  210. package/src/aldehyde/controls/direct-file-view/index.tsx +145 -145
  211. package/src/aldehyde/controls/direct-upload/index.tsx +139 -139
  212. package/src/aldehyde/controls/entity-select/entity-select.tsx +791 -791
  213. package/src/aldehyde/controls/entity-select/index.css +7 -7
  214. package/src/aldehyde/controls/entity-select/lab-tree-select.tsx +154 -154
  215. package/src/aldehyde/controls/entity-select/popover-entity-select.tsx +205 -205
  216. package/src/aldehyde/controls/entry-control.tsx +418 -418
  217. package/src/aldehyde/controls/enum-badge/index.tsx +42 -42
  218. package/src/aldehyde/controls/enum-tag/index.tsx +45 -45
  219. package/src/aldehyde/controls/field-history/index.tsx +81 -81
  220. package/src/aldehyde/controls/file-export/select-code-export.tsx +40 -40
  221. package/src/aldehyde/controls/file-view/drawer-file-view.tsx +117 -117
  222. package/src/aldehyde/controls/file-view/index.less +9 -9
  223. package/src/aldehyde/controls/file-view/index.tsx +148 -148
  224. package/src/aldehyde/controls/file-view/multi-file-view.tsx +39 -39
  225. package/src/aldehyde/controls/file-view/newin-file-view.tsx +40 -40
  226. package/src/aldehyde/controls/html-editor/draft.tsx +136 -136
  227. package/src/aldehyde/controls/html-editor/index.less +67 -67
  228. package/src/aldehyde/controls/icon-selector/app-icon-selector.tsx +68 -68
  229. package/src/aldehyde/controls/icon-selector/icon/aldehyde-menu-icon/iconfont.css +147 -147
  230. package/src/aldehyde/controls/icon-selector/icon/aldehyde-menu-icon/iconfont.json +240 -240
  231. package/src/aldehyde/controls/icon-selector/pc-icon-selector.tsx +68 -68
  232. package/src/aldehyde/controls/input-number/index.tsx +148 -148
  233. package/src/aldehyde/controls/input-range/index.tsx +59 -59
  234. package/src/aldehyde/controls/password-setter/index.css +2 -2
  235. package/src/aldehyde/controls/password-setter/index.js +88 -88
  236. package/src/aldehyde/controls/progress/index.tsx +74 -74
  237. package/src/aldehyde/controls/qr-code/index.less +28 -28
  238. package/src/aldehyde/controls/qr-code/index.tsx +40 -40
  239. package/src/aldehyde/controls/relation-existion/index.css +3 -3
  240. package/src/aldehyde/controls/relation-existion/index.tsx +144 -144
  241. package/src/aldehyde/controls/rfield/index.css +4 -4
  242. package/src/aldehyde/controls/rfield/index.tsx +225 -225
  243. package/src/aldehyde/controls/select/index.tsx +216 -216
  244. package/src/aldehyde/controls/signature/index.tsx +226 -226
  245. package/src/aldehyde/controls/single-checkbox/index.tsx +18 -18
  246. package/src/aldehyde/controls/steps/index.tsx +59 -59
  247. package/src/aldehyde/controls/text/ellipsis-text.tsx +98 -98
  248. package/src/aldehyde/controls/text/index.less +7 -7
  249. package/src/aldehyde/controls/tree-select/navigation-tree.tsx +122 -122
  250. package/src/aldehyde/controls/tree-select/tree-entity-select.tsx +121 -121
  251. package/src/aldehyde/controls/upload/index.tsx +128 -128
  252. package/src/aldehyde/controls/upload/mult-file-upload.tsx +240 -240
  253. package/src/aldehyde/controls/view-control.tsx +289 -289
  254. package/src/aldehyde/custom-page/custom-detail-modal-page.tsx +69 -69
  255. package/src/aldehyde/custom-page/custom-page-router.tsx +64 -64
  256. package/src/aldehyde/custom-page/def-custom-page.tsx +17 -17
  257. package/src/aldehyde/custom-page/dtmpl-custom-edit-modal-page.tsx +88 -88
  258. package/src/aldehyde/detail/button/bottom-submit-button-bar.tsx +91 -91
  259. package/src/aldehyde/detail/button/cquery-button-bar.tsx +144 -144
  260. package/src/aldehyde/detail/button/edit-button.tsx +61 -61
  261. package/src/aldehyde/detail/button/fix-right-submit-button-bar.tsx +186 -186
  262. package/src/aldehyde/detail/button/index.css +42 -42
  263. package/src/aldehyde/detail/button/inline-edit-button.tsx +40 -40
  264. package/src/aldehyde/detail/button/submit-button-bar.tsx +57 -57
  265. package/src/aldehyde/detail/button/view-button.tsx +64 -64
  266. package/src/aldehyde/detail/dtmpl.css +67 -67
  267. package/src/aldehyde/detail/edit/dtmpl-edit.tsx +279 -279
  268. package/src/aldehyde/detail/edit/fields-edit-card.tsx +145 -145
  269. package/src/aldehyde/detail/edit/modal-row-edit.tsx +95 -95
  270. package/src/aldehyde/detail/edit/popover-edit-card.tsx +167 -167
  271. package/src/aldehyde/detail/edit/popover-editor.tsx +70 -70
  272. package/src/aldehyde/detail/edit/post-result/index.tsx +86 -86
  273. package/src/aldehyde/detail/rightbar/index.css +34 -34
  274. package/src/aldehyde/detail/rightbar/index.tsx +92 -92
  275. package/src/aldehyde/detail/tooltipbar/index.tsx +32 -32
  276. package/src/aldehyde/detail/view/act-dtmpl-view.tsx +288 -288
  277. package/src/aldehyde/detail/view/dtmpl-view.tsx +314 -314
  278. package/src/aldehyde/detail/view/field-view-group.tsx +88 -88
  279. package/src/aldehyde/detail/view/modal-dtmpl-view.tsx +73 -73
  280. package/src/aldehyde/detail/view/snapshot-timeline.tsx +231 -231
  281. package/src/aldehyde/detail/view/tab-act-dtmpl-view.tsx +304 -304
  282. package/src/aldehyde/detail/view/view-compare-panel.tsx +57 -57
  283. package/src/aldehyde/draw-canvas-edit/components/render/components/index.ts +3 -0
  284. package/src/aldehyde/draw-canvas-edit/components/render/components/workstation-component.tsx +104 -0
  285. package/src/aldehyde/draw-canvas-edit/components/render/draws/bg-draw.ts +176 -176
  286. package/src/aldehyde/draw-canvas-edit/components/render/draws/contextmenu-draw.ts +329 -329
  287. package/src/aldehyde/draw-canvas-edit/components/render/graphs/bezier.ts +542 -542
  288. package/src/aldehyde/draw-canvas-edit/components/render/handlers/drag-outside-handlers.ts +72 -72
  289. package/src/aldehyde/draw-canvas-edit/components/render/handlers/selection-handlers.ts +396 -396
  290. package/src/aldehyde/draw-canvas-edit/components/render/index.ts +808 -808
  291. package/src/aldehyde/draw-canvas-edit/components/render/tools/attract-tool.ts +457 -457
  292. package/src/aldehyde/draw-canvas-edit/components/render/tools/component-factory.ts +270 -302
  293. package/src/aldehyde/draw-canvas-edit/components/render/tools/copy-tool.ts +244 -244
  294. package/src/aldehyde/draw-canvas-edit/components/render/tools/import-export-tool.ts +576 -576
  295. package/src/aldehyde/draw-canvas-edit/components/render/tools/index.ts +10 -10
  296. package/src/aldehyde/draw-canvas-edit/components/render/tools/position-tool.ts +191 -191
  297. package/src/aldehyde/draw-canvas-edit/components/render/tools/selection-tool.ts +140 -140
  298. package/src/aldehyde/draw-canvas-edit/components/render/types.ts +294 -291
  299. package/src/aldehyde/draw-canvas-edit/components/setting-form/index.tsx +291 -291
  300. package/src/aldehyde/draw-canvas-edit/constant.ts +5 -5
  301. package/src/aldehyde/draw-canvas-edit/index.less +48 -48
  302. package/src/aldehyde/draw-canvas-edit/index.tsx +201 -201
  303. package/src/aldehyde/draw-canvas-view/index.less +59 -59
  304. package/src/aldehyde/draw-canvas-view/index.tsx +49 -49
  305. package/src/aldehyde/draw-canvas-view/view.tsx +17 -5
  306. package/src/aldehyde/export/export-frame.css +2 -2
  307. package/src/aldehyde/export/export-frame.tsx +301 -301
  308. package/src/aldehyde/export/select-code-export-frame.tsx +212 -212
  309. package/src/aldehyde/form/criteria-form.tsx +604 -604
  310. package/src/aldehyde/form/dtmpl-form.css +3 -3
  311. package/src/aldehyde/form/dtmpl-form.tsx +552 -552
  312. package/src/aldehyde/form/field-group-form.tsx +102 -102
  313. package/src/aldehyde/form/fields-form.tsx +45 -45
  314. package/src/aldehyde/form/form-Item-group.tsx +245 -245
  315. package/src/aldehyde/form/index.css +12 -12
  316. package/src/aldehyde/hooks/use-match-route/index.tsx +62 -62
  317. package/src/aldehyde/hooks/use-tabs/index.tsx +139 -139
  318. package/src/aldehyde/hooks/useVarCssColor.ts +6 -6
  319. package/src/aldehyde/icon/aliIcon.tsx +9 -9
  320. package/src/aldehyde/icon/index.tsx +28 -28
  321. package/src/aldehyde/import/excel-import.tsx +450 -450
  322. package/src/aldehyde/import/index.css +53 -53
  323. package/src/aldehyde/import/template.css +50 -50
  324. package/src/aldehyde/index.tsx +220 -220
  325. package/src/aldehyde/layout/MainPage.tsx +334 -334
  326. package/src/aldehyde/layout/common.css +64 -64
  327. package/src/aldehyde/layout/coverstyle.css +51 -51
  328. package/src/aldehyde/layout/footer/index.css +5 -5
  329. package/src/aldehyde/layout/footer/index.js +17 -17
  330. package/src/aldehyde/layout/header/index.css +122 -122
  331. package/src/aldehyde/layout/header/index.tsx +152 -152
  332. package/src/aldehyde/layout/menu/block.css +7 -7
  333. package/src/aldehyde/layout/menu/block.tsx +174 -174
  334. package/src/aldehyde/layout/menu/l2menu-message-bar.tsx +160 -160
  335. package/src/aldehyde/layout/menu/l2menu-quick-bar.tsx +175 -175
  336. package/src/aldehyde/layout/menu/menu-2layers.tsx +117 -117
  337. package/src/aldehyde/layout/menu/menu-render.tsx +168 -168
  338. package/src/aldehyde/layout/menu/message-bar.less +73 -73
  339. package/src/aldehyde/layout/menu/reset-password.tsx +255 -255
  340. package/src/aldehyde/layout/menu/user-bar.tsx +259 -259
  341. package/src/aldehyde/layout/menu/userinfo-bar.tsx +69 -69
  342. package/src/aldehyde/layout/sidebar/index.css +57 -57
  343. package/src/aldehyde/layout/sidebar/index.tsx +84 -84
  344. package/src/aldehyde/layout2/components/icon-font.tsx +7 -7
  345. package/src/aldehyde/layout2/components/screenfull-button.tsx +21 -21
  346. package/src/aldehyde/layout2/components/search-menu.tsx +85 -85
  347. package/src/aldehyde/layout2/components/system-messages.tsx +75 -75
  348. package/src/aldehyde/layout2/components/theme-button.tsx +65 -65
  349. package/src/aldehyde/layout2/components/user-button.tsx +258 -258
  350. package/src/aldehyde/layout2/components/user-notification.tsx +74 -74
  351. package/src/aldehyde/layout2/css/header.css +41 -41
  352. package/src/aldehyde/layout2/css/sider.less +17 -17
  353. package/src/aldehyde/layout2/css/tabs-layout.less +18 -18
  354. package/src/aldehyde/layout2/header.tsx +278 -278
  355. package/src/aldehyde/layout2/layout-context.tsx +95 -95
  356. package/src/aldehyde/layout2/main.tsx +30 -30
  357. package/src/aldehyde/layout2/page.tsx +315 -315
  358. package/src/aldehyde/layout2/sider.tsx +230 -230
  359. package/src/aldehyde/layout2/tabs/tabs-context.tsx +37 -37
  360. package/src/aldehyde/layout2/tabs/tabs-layout.tsx +146 -146
  361. package/src/aldehyde/layout2/type/layout-type.ts +15 -15
  362. package/src/aldehyde/layout2/util/menu-util.tsx +125 -125
  363. package/src/aldehyde/layout3/components/tabs-layout.tsx +110 -110
  364. package/src/aldehyde/layout3/components/time.tsx +25 -25
  365. package/src/aldehyde/layout3/css/header.less +195 -195
  366. package/src/aldehyde/layout3/css/main.less +161 -161
  367. package/src/aldehyde/layout3/css/sider.less +32 -32
  368. package/src/aldehyde/layout3/css/tabs-layout.less +38 -38
  369. package/src/aldehyde/layout3/header.tsx +187 -187
  370. package/src/aldehyde/layout3/main.tsx +29 -29
  371. package/src/aldehyde/layout3/page.tsx +110 -110
  372. package/src/aldehyde/layout3/sider.tsx +198 -198
  373. package/src/aldehyde/layout4/components/tabs-layout.tsx +110 -110
  374. package/src/aldehyde/layout4/css/header.less +196 -196
  375. package/src/aldehyde/layout4/css/main.less +154 -154
  376. package/src/aldehyde/layout4/css/sider.less +37 -37
  377. package/src/aldehyde/layout4/css/tabs-layout.less +42 -42
  378. package/src/aldehyde/layout4/header.tsx +190 -190
  379. package/src/aldehyde/layout4/main.tsx +29 -29
  380. package/src/aldehyde/layout4/page.tsx +125 -125
  381. package/src/aldehyde/layout4/sider.tsx +201 -201
  382. package/src/aldehyde/layout5/css/header.less +35 -35
  383. package/src/aldehyde/layout5/css/sider.less +18 -18
  384. package/src/aldehyde/layout5/header.tsx +204 -204
  385. package/src/aldehyde/layout5/page.tsx +107 -107
  386. package/src/aldehyde/layout5/sider.tsx +235 -235
  387. package/src/aldehyde/list/calendar/index.less +20 -20
  388. package/src/aldehyde/list/calendar/index.tsx +157 -157
  389. package/src/aldehyde/list/card-list/card-list-item.tsx +111 -111
  390. package/src/aldehyde/list/card-list/index.less +154 -154
  391. package/src/aldehyde/list/card-list/index.tsx +83 -83
  392. package/src/aldehyde/list/gantt/index.less +8 -8
  393. package/src/aldehyde/list/gantt/index.tsx +508 -508
  394. package/src/aldehyde/list/vertical-list/index.less +208 -208
  395. package/src/aldehyde/list/vertical-list/index.tsx +55 -55
  396. package/src/aldehyde/list/vertical-list/item.tsx +136 -136
  397. package/src/aldehyde/locale/LocaleButton.tsx +48 -48
  398. package/src/aldehyde/locale/LocaleProvider.tsx +265 -265
  399. package/src/aldehyde/locale/langMp.ts +45 -45
  400. package/src/aldehyde/locale/translate.ts +80 -80
  401. package/src/aldehyde/locale/useLocale.ts +72 -72
  402. package/src/aldehyde/login/context-setter.tsx +130 -130
  403. package/src/aldehyde/login/index.css +19 -19
  404. package/src/aldehyde/login/login.tsx +255 -255
  405. package/src/aldehyde/login/router-login.tsx +107 -107
  406. package/src/aldehyde/login/vertify/index.css +143 -143
  407. package/src/aldehyde/login/vertify/index.tsx +360 -360
  408. package/src/aldehyde/login/vertify/tool.ts +13 -13
  409. package/src/aldehyde/login2/login-page.tsx +92 -92
  410. package/src/aldehyde/login2/login.tsx +226 -226
  411. package/src/aldehyde/login3/index.less +136 -136
  412. package/src/aldehyde/login3/login-page.tsx +71 -71
  413. package/src/aldehyde/lowcode-components/act-table/index.less +26 -26
  414. package/src/aldehyde/lowcode-components/act-table/index.tsx +139 -139
  415. package/src/aldehyde/lowcode-components/assets/lowcode-constant.tsx +12 -12
  416. package/src/aldehyde/lowcode-components/bar-chart/index.tsx +268 -268
  417. package/src/aldehyde/lowcode-components/base-button/index.less +7 -7
  418. package/src/aldehyde/lowcode-components/base-button/index.tsx +197 -197
  419. package/src/aldehyde/lowcode-components/base-image/index.tsx +220 -220
  420. package/src/aldehyde/lowcode-components/base-map/index.tsx +292 -292
  421. package/src/aldehyde/lowcode-components/base-radio/index.less +23 -23
  422. package/src/aldehyde/lowcode-components/base-radio/index.tsx +157 -157
  423. package/src/aldehyde/lowcode-components/base-table/index.tsx +268 -268
  424. package/src/aldehyde/lowcode-components/base-tabs/index.less +14 -14
  425. package/src/aldehyde/lowcode-components/base-tabs/index.tsx +183 -183
  426. package/src/aldehyde/lowcode-components/base-text/index.tsx +58 -58
  427. package/src/aldehyde/lowcode-components/border/border1/index.tsx +70 -70
  428. package/src/aldehyde/lowcode-components/border/border10/index.less +26 -26
  429. package/src/aldehyde/lowcode-components/border/border10/index.tsx +45 -45
  430. package/src/aldehyde/lowcode-components/border/border11/index.less +17 -17
  431. package/src/aldehyde/lowcode-components/border/border11/index.tsx +232 -232
  432. package/src/aldehyde/lowcode-components/border/border12/index.less +13 -13
  433. package/src/aldehyde/lowcode-components/border/border12/index.tsx +115 -115
  434. package/src/aldehyde/lowcode-components/border/border13/index.less +13 -13
  435. package/src/aldehyde/lowcode-components/border/border13/index.tsx +69 -69
  436. package/src/aldehyde/lowcode-components/border/border2/index.less +17 -17
  437. package/src/aldehyde/lowcode-components/border/border2/index.tsx +51 -51
  438. package/src/aldehyde/lowcode-components/border/border3/index.less +25 -25
  439. package/src/aldehyde/lowcode-components/border/border3/index.tsx +61 -61
  440. package/src/aldehyde/lowcode-components/border/border4/index.less +72 -72
  441. package/src/aldehyde/lowcode-components/border/border4/index.tsx +79 -79
  442. package/src/aldehyde/lowcode-components/border/border5/index.less +35 -35
  443. package/src/aldehyde/lowcode-components/border/border5/index.tsx +75 -75
  444. package/src/aldehyde/lowcode-components/border/border6/index.less +17 -17
  445. package/src/aldehyde/lowcode-components/border/border6/index.tsx +60 -60
  446. package/src/aldehyde/lowcode-components/border/border7/index.less +26 -26
  447. package/src/aldehyde/lowcode-components/border/border7/index.tsx +75 -75
  448. package/src/aldehyde/lowcode-components/border/border8/index.less +13 -13
  449. package/src/aldehyde/lowcode-components/border/border8/index.tsx +84 -84
  450. package/src/aldehyde/lowcode-components/border/border9/index.less +13 -13
  451. package/src/aldehyde/lowcode-components/border/border9/index.tsx +154 -154
  452. package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +290 -290
  453. package/src/aldehyde/lowcode-components/carousel/index.tsx +218 -218
  454. package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +263 -263
  455. package/src/aldehyde/lowcode-components/column-3d-chart/index.tsx +438 -438
  456. package/src/aldehyde/lowcode-components/column-chart/index.tsx +293 -293
  457. package/src/aldehyde/lowcode-components/data-number/index.tsx +219 -219
  458. package/src/aldehyde/lowcode-components/data.d.ts +18 -18
  459. package/src/aldehyde/lowcode-components/decoration/decoration1/index.less +7 -7
  460. package/src/aldehyde/lowcode-components/decoration/decoration1/index.tsx +153 -153
  461. package/src/aldehyde/lowcode-components/decoration/decoration10/index.less +5 -5
  462. package/src/aldehyde/lowcode-components/decoration/decoration10/index.tsx +89 -89
  463. package/src/aldehyde/lowcode-components/decoration/decoration11/index.less +5 -5
  464. package/src/aldehyde/lowcode-components/decoration/decoration11/index.tsx +133 -133
  465. package/src/aldehyde/lowcode-components/decoration/decoration2/index.less +6 -6
  466. package/src/aldehyde/lowcode-components/decoration/decoration2/index.tsx +61 -61
  467. package/src/aldehyde/lowcode-components/decoration/decoration3/index.less +7 -7
  468. package/src/aldehyde/lowcode-components/decoration/decoration3/index.tsx +87 -87
  469. package/src/aldehyde/lowcode-components/decoration/decoration4/index.less +29 -29
  470. package/src/aldehyde/lowcode-components/decoration/decoration4/index.tsx +53 -53
  471. package/src/aldehyde/lowcode-components/decoration/decoration5/index.less +3 -3
  472. package/src/aldehyde/lowcode-components/decoration/decoration5/index.tsx +116 -116
  473. package/src/aldehyde/lowcode-components/decoration/decoration6/index.less +7 -7
  474. package/src/aldehyde/lowcode-components/decoration/decoration6/index.tsx +121 -121
  475. package/src/aldehyde/lowcode-components/decoration/decoration7/index.less +4 -4
  476. package/src/aldehyde/lowcode-components/decoration/decoration7/index.tsx +70 -70
  477. package/src/aldehyde/lowcode-components/decoration/decoration8/index.less +14 -14
  478. package/src/aldehyde/lowcode-components/decoration/decoration8/index.tsx +122 -122
  479. package/src/aldehyde/lowcode-components/decoration/decoration9/index.less +4 -4
  480. package/src/aldehyde/lowcode-components/decoration/decoration9/index.tsx +196 -196
  481. package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +315 -315
  482. package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +419 -419
  483. package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +254 -254
  484. package/src/aldehyde/lowcode-components/index.ts +130 -130
  485. package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +300 -300
  486. package/src/aldehyde/lowcode-components/line-chart/index.tsx +290 -290
  487. package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +250 -250
  488. package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +478 -478
  489. package/src/aldehyde/lowcode-components/lowcode-view/component/component-controller.ts +153 -153
  490. package/src/aldehyde/lowcode-components/lowcode-view/component/component-definition.ts +23 -23
  491. package/src/aldehyde/lowcode-components/lowcode-view/component/loading.tsx +20 -20
  492. package/src/aldehyde/lowcode-components/lowcode-view/component/util.ts +27 -27
  493. package/src/aldehyde/lowcode-components/lowcode-view/index.less +19 -19
  494. package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +277 -277
  495. package/src/aldehyde/lowcode-components/lowcode-view/interface.ts +189 -189
  496. package/src/aldehyde/lowcode-components/pie-chart/index.tsx +349 -349
  497. package/src/aldehyde/lowcode-components/progress-chart/index.tsx +295 -295
  498. package/src/aldehyde/lowcode-components/radar-chart/index.tsx +322 -322
  499. package/src/aldehyde/lowcode-components/search-form/index.less +25 -25
  500. package/src/aldehyde/lowcode-components/search-form/index.tsx +121 -121
  501. package/src/aldehyde/lowcode-components/stroke-animation/index.tsx +219 -219
  502. package/src/aldehyde/module/block-menu-tree-drawer.tsx +118 -118
  503. package/src/aldehyde/module/criteria-page.tsx1 +175 -175
  504. package/src/aldehyde/module/draggable-modal.tsx +66 -66
  505. package/src/aldehyde/module/dtmpl-edit-card.tsx +437 -437
  506. package/src/aldehyde/module/dtmpl-edit-drawer.tsx +23 -23
  507. package/src/aldehyde/module/dtmpl-edit-modal.tsx +25 -25
  508. package/src/aldehyde/module/dtmpl-edit-page.tsx +558 -558
  509. package/src/aldehyde/module/dtmpl-editor.tsx +165 -165
  510. package/src/aldehyde/module/dtmpl-view-card.tsx +64 -64
  511. package/src/aldehyde/module/dtmpl-view-drawer.tsx +71 -71
  512. package/src/aldehyde/module/dtmpl-view-modal.tsx +56 -56
  513. package/src/aldehyde/module/embed-dtmpl-edit-page.tsx +137 -137
  514. package/src/aldehyde/module/index.less +4 -4
  515. package/src/aldehyde/module/ltmpl-drawer.tsx +60 -60
  516. package/src/aldehyde/module/ltmpl-modal.tsx +63 -63
  517. package/src/aldehyde/module/ltmpl-table.tsx +378 -378
  518. package/src/aldehyde/module/ttmpl-tree.tsx +47 -47
  519. package/src/aldehyde/routable/dtmpl-route.tsx +173 -173
  520. package/src/aldehyde/routable/import-route.tsx +35 -35
  521. package/src/aldehyde/routable/index.less +25 -25
  522. package/src/aldehyde/routable/ltmpl-route.tsx +539 -539
  523. package/src/aldehyde/routable/splitview-ltmpl-route.tsx +377 -377
  524. package/src/aldehyde/routable/ttmpl-route.tsx +93 -93
  525. package/src/aldehyde/routable/withroute.tsx +36 -36
  526. package/src/aldehyde/sso-Login/index.tsx +73 -73
  527. package/src/aldehyde/sso-Login/service/index.js +16 -16
  528. package/src/aldehyde/sso-Login/service/login.js +75 -75
  529. package/src/aldehyde/table/act-table.tsx +1831 -1831
  530. package/src/aldehyde/table/column/column-builder.tsx +864 -864
  531. package/src/aldehyde/table/column/column-selector.tsx +130 -130
  532. package/src/aldehyde/table/column/index.less +63 -63
  533. package/src/aldehyde/table/column/summary-builder.tsx +712 -712
  534. package/src/aldehyde/table/column/theme-color-getter.tsx +25 -25
  535. package/src/aldehyde/table/control-table-x-axis-wrapper.tsx +80 -80
  536. package/src/aldehyde/table/index.css +211 -211
  537. package/src/aldehyde/table/l2-act-table.tsx +91 -91
  538. package/src/aldehyde/table/modal-select-table.tsx +308 -308
  539. package/src/aldehyde/table/page-config-button.tsx +203 -203
  540. package/src/aldehyde/table/pagination.css +14 -14
  541. package/src/aldehyde/table/pagination.tsx +81 -81
  542. package/src/aldehyde/table/query-table.tsx +658 -658
  543. package/src/aldehyde/table/relation-table.tsx +1093 -1093
  544. package/src/aldehyde/table/report-table.tsx +125 -125
  545. package/src/aldehyde/table/resizable-table.tsx +97 -97
  546. package/src/aldehyde/table/select-table.tsx +559 -548
  547. package/src/aldehyde/table/selected-rows-card.tsx +78 -78
  548. package/src/aldehyde/table/stat/restat.tsx +122 -122
  549. package/src/aldehyde/table/table-util.tsx +25 -25
  550. package/src/aldehyde/tmpl/control-type-supportor.tsx +154 -154
  551. package/src/aldehyde/tmpl/hc-data-source.tsx +566 -566
  552. package/src/aldehyde/tmpl/hcservice-v3.tsx +1590 -1590
  553. package/src/aldehyde/tmpl/interface.tsx +919 -919
  554. package/src/aldehyde/tmpl/model-struc-v3.tsx +111 -111
  555. package/src/aldehyde/tmpl/superagent.js +146 -146
  556. package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +585 -585
  557. package/src/aldehyde/tmpl/web-socket.ts +366 -366
  558. package/src/aldehyde/tree/act-tree.tsx +217 -217
  559. package/src/aldehyde/tree/block-menu-auth-tree.tsx +189 -189
  560. package/src/aldehyde/tree/index.css +22 -22
  561. package/src/aldehyde/tree/navigation-tree.tsx +39 -39
  562. package/src/aldehyde/tree/tmpl-tree.tsx +751 -751
  563. package/src/aldehyde/tree/tree-node.tsx +73 -73
  564. package/src/aldehyde/tree/tree-utils.tsx +317 -317
  565. package/src/aldehyde/units/EncryptUtils.js +37 -37
  566. package/src/aldehyde/units/image.d.ts +7 -7
  567. package/src/aldehyde/units/index.tsx +1367 -1367
  568. package/src/aldehyde/units/storage.js +2 -2
  569. package/src/aldehyde/utils/dsu.ts +27 -27
  570. package/src/aldehyde/welcome/HCWelcome.js +404 -404
  571. package/src/aldehyde/welcome/HCWelcome1.js +259 -259
  572. package/src/aldehyde/welcome/components/menu-card.less +96 -96
  573. package/src/aldehyde/welcome/components/menu-card.tsx +70 -70
  574. package/src/aldehyde/welcome/components/page-card.less +49 -49
  575. package/src/aldehyde/welcome/components/page-card.tsx +97 -97
  576. package/src/aldehyde/welcome/components/quick-entrance.less +120 -120
  577. package/src/aldehyde/welcome/components/quick-entrance.tsx +80 -80
  578. package/src/aldehyde/welcome/components/user-menus.less +192 -192
  579. package/src/aldehyde/welcome/components/user-menus.tsx +279 -279
  580. package/src/aldehyde/welcome/components/workbench.less +118 -118
  581. package/src/aldehyde/welcome/components/workbench.tsx +146 -146
  582. package/src/aldehyde/welcome/index.css +13 -13
@@ -1,713 +1,713 @@
1
- import {BigNumber} from "bignumber.js";
2
- import Table from "../control-table-x-axis-wrapper";
3
- import React from "react";
4
- import "../index.css";
5
- interface SummaryColProps {
6
- columns: any[];
7
- translate: (...strs: string[]) => string;
8
- summaryConfigs:{
9
- title?:string,
10
- id: string;
11
- aggFunc: "sum" | "avg" | "groupIsum" | "groupIavg";
12
- }[];
13
- pageData:any,
14
- rowSelection,groupIColumns
15
- }
16
-
17
- export default {
18
- summary(summaryColProps:SummaryColProps) {
19
- const {translate,summaryConfigs,pageData,columns,
20
- rowSelection,groupIColumns}=summaryColProps;
21
- if (
22
- !summaryConfigs ||
23
- summaryConfigs?.length === 0 ||
24
- pageData.length === 0
25
- )
26
- return <></>;
27
- // const isProSumarryTable = Boolean(subtotalXColumn);
28
- // const columns = isProSumarryTable
29
- // ? proSummaryTableColumns
30
- // : columns_;
31
- //const columns= columns_;
32
- const sumConfigs: {
33
- sum: { value: string; id: string; columnConfig?: any }[];
34
- avg: { value: string; id: string; columnConfig?: any }[];
35
- } = { sum: [], avg: [] };
36
-
37
- if (rowSelection) {
38
- sumConfigs["avg"].push({
39
- value: "",
40
- id: "",
41
- columnConfig: { align: "center" },
42
- });
43
- sumConfigs["sum"].push({
44
- value: "",
45
- id: "",
46
- columnConfig: { align: "center" },
47
- });
48
- }
49
-
50
- sumConfigs["sum"].push({
51
- value: translate("${合计}"),
52
- id: "title",
53
- columnConfig: { align: "center" },
54
- });
55
- sumConfigs["avg"].push({
56
- value: translate("${均值}"),
57
- id: "title",
58
- columnConfig: { align: "center" },
59
- });
60
-
61
- let sumLen = 0,
62
- avgLen = 0;
63
-
64
- for (let i = 0; i < columns.length; i++) {
65
- const idx = i,
66
- dataIndex = columns[i].dataIndex;
67
- if (idx === 0) continue;
68
- const sum = { value: "", id: "", columnConfig: columns[i] };
69
- const sumConfigIdx = summaryConfigs.findIndex(
70
- ({ id ,title}) => id === dataIndex || title===dataIndex
71
- );
72
-
73
- if (sumConfigIdx === -1) {
74
- sumConfigs["sum"].push(sum);
75
- sumConfigs["avg"].push(sum);
76
- continue;
77
- }
78
- const argFun = summaryConfigs[sumConfigIdx].aggFunc;
79
- if (argFun === "sum")
80
- sum.value = pageData
81
- .reduce(
82
- (lastNum, item) =>
83
-
84
- lastNum.plus(
85
- new BigNumber(
86
- this.getTableSummaryNumberValue(item[dataIndex])
87
- )
88
- ),
89
- new BigNumber(0)
90
- )
91
- ?.toString();
92
- if (argFun === "avg")
93
- sum.value = pageData
94
- .reduce(
95
- (lastNum, item) =>
96
- lastNum.plus(
97
- new BigNumber(
98
- this.getTableSummaryNumberValue(item[dataIndex])
99
- ).div(pageData.length)
100
- ),
101
- new BigNumber(0)
102
- )
103
- ?.toString();
104
-
105
- const hash = (...args) => args.join("-");
106
- const hashKey = (data, keys) =>
107
- hash(...keys.map((key) => data[key]));
108
-
109
- if (argFun === "groupIsum") {
110
- const allKeys = groupIColumns?.map(({ id }) => id);
111
- const set = new Set();
112
-
113
- sum.value = pageData
114
- .reduce((lastNum, item) => {
115
- if (set.has(hashKey(item, allKeys))) return lastNum;
116
- set.add(hashKey(item, allKeys));
117
- return lastNum.plus(
118
- new BigNumber(
119
- this.getTableSummaryNumberValue(item[dataIndex])
120
- )
121
- );
122
- }, new BigNumber(0))
123
- ?.toString();
124
- }
125
-
126
- if (argFun === "groupIavg") {
127
- const set = new Set();
128
- let nums = 0;
129
- const allKeys = groupIColumns?.map(({ id }) => id);
130
-
131
- pageData.forEach((item) => {
132
- if (set.has(hashKey(item, allKeys))) return;
133
- set.add(hashKey(item, allKeys));
134
-
135
- nums++;
136
- });
137
-
138
- set.clear();
139
-
140
- sum.value = pageData
141
- .reduce((lastNum, item) => {
142
- if (set.has(hashKey(item, allKeys))) return lastNum;
143
- set.add(hashKey(item, allKeys));
144
- return lastNum.plus(
145
- new BigNumber(
146
- this.getTableSummaryNumberValue(item[dataIndex])
147
- ).div(nums)
148
- );
149
- }, new BigNumber(0))
150
- ?.toString();
151
- }
152
-
153
- sum.id = dataIndex;
154
- if (argFun === "avg" || argFun === "groupIavg") {
155
- sumConfigs["avg"].push(sum);
156
- avgLen++;
157
- } else sumConfigs["avg"].push({ value: "", id: "" });
158
-
159
- if (argFun === "sum" || argFun === "groupIsum") {
160
- sumConfigs["sum"].push(sum);
161
- sumLen++;
162
- } else sumConfigs["sum"].push({ value: "", id: "" });
163
- }
164
-
165
- console.log("sumConfigs", sumConfigs, sumLen, avgLen);
166
-
167
- return (
168
- <>
169
- {sumLen === 0 ? (
170
- <></>
171
- ) : (
172
- <Table.Summary.Row>
173
- {sumConfigs["sum"].map(
174
- ({ id, value, columnConfig }, idx) => (
175
- <Table.Summary.Cell
176
- align={columnConfig?.align}
177
- index={idx}
178
- className="heji"
179
- >
180
- {value}
181
- </Table.Summary.Cell>
182
- )
183
- )}
184
- </Table.Summary.Row>
185
- )}
186
- {avgLen === 0 ? (
187
- <></>
188
- ) : (
189
- <Table.Summary.Row>
190
- {sumConfigs["avg"].map(
191
- ({ id, value, columnConfig }, idx) => (
192
- <Table.Summary.Cell
193
- align={columnConfig?.align}
194
- index={idx}
195
- className="heji"
196
- >
197
- {value}
198
- </Table.Summary.Cell>
199
- )
200
- )}
201
- </Table.Summary.Row>
202
- )}
203
- </>
204
- );
205
- },
206
-
207
- handleProSummaryTable(props: any) {
208
- const {subtotalXColumn,columns: _columns,data,translate,groupIColumns}=props
209
- const isProSumarryTable = Boolean(
210
- subtotalXColumn
211
- );
212
- if (!isProSumarryTable)
213
- return { proSummaryTableColumns: [], proSummaryTableData: [] };
214
- const columns = _columns;
215
-
216
- for (const column of columns) {
217
- delete column["sorter"];
218
- }
219
-
220
- for (const d of data) {
221
- for (const [k, v] of Object.entries(d)) {
222
- if (v == null || v == "null") {
223
- d[k] = "";
224
- } else if (typeof v === "string" && (v as string)?.includes("@R@")) {
225
- d[k] = (v as string).split("@R@")[1];
226
- }
227
- }
228
- }
229
-
230
- console.log("data", data);
231
- console.log("columns", columns);
232
-
233
- const colMp = {
234
- dimension: [],
235
- fact: [],
236
- others: [
237
- {
238
- dataIndex: "orderInGroup",
239
- title: "orderInGroup",
240
- },
241
- ],
242
- };
243
- const colIdToNameMp = {};
244
- const colNameToIdMp = {};
245
- for (const col of columns) {
246
- colIdToNameMp[col["dataIndex"]] = col["title"];
247
- colNameToIdMp[col["title"]] = col["dataIndex"];
248
- if (col.statColType !== undefined) {
249
- colMp[col.statColType].push(this.deepClone(col));
250
- } else {
251
- if (col.title !== "序号") colMp["others"].push(this.deepClone(col));
252
- }
253
- }
254
- console.log("colIdToNameMp", colIdToNameMp);
255
- console.log("colNameToIdMp", colNameToIdMp);
256
- console.log("colMp", colMp);
257
-
258
- // canReadData
259
- const canReadData = [];
260
- let order = 0;
261
- for (const d of data) {
262
- const item = {};
263
- for (const [k, v] of Object.entries(d)) {
264
- let _v = v;
265
- if (
266
- colMp.fact.findIndex(({ dataIndex }) => dataIndex === k) > -1 &&
267
- v === null
268
- )
269
- _v = 0;
270
- item[colIdToNameMp[k]] = _v;
271
- }
272
- canReadData.push({ ...item, orderInGroup: order++ });
273
- }
274
- console.log("canReadData", canReadData);
275
-
276
- let proSummaryTableColumns = [
277
- ...this.deepClone(colMp.dimension),
278
- ...this.deepClone(colMp.others),
279
- ],
280
- proSummaryTableData = [],
281
- excludeGroupSumData = [];
282
- const cal = colMp.fact[0]?.cal;
283
- const calTxt = cal === "sum" ? translate("${小计}") : translate("${均值}");
284
- const calMp = {};
285
- colMp.fact.forEach(({ title, cal }) => (calMp[title] = cal));
286
-
287
- // 计算列
288
- proSummaryTableColumns.push(...colMp.fact);
289
-
290
- // buildData
291
- this.buildColTag(proSummaryTableColumns);
292
-
293
- // 处理行
294
- const rowMp = {};
295
- const rowKey = [];
296
- for (const col of proSummaryTableColumns) {
297
- if (Array.isArray(col.keys) && col.keys.length === 1) rowKey.push(col);
298
- }
299
- console.log("rowKey", rowKey);
300
-
301
- for (const d of canReadData) {
302
- let t: any = rowMp;
303
- for (let i = 0; i < rowKey.length; i++) {
304
- const key = rowKey[i].title;
305
- if (t[d[key]] === undefined) {
306
- if (i !== rowKey.length - 1) t[d[key]] = {};
307
- else t[d[key]] = [];
308
- }
309
- t = t[d[key]];
310
- }
311
- if (Array.isArray(t)) t.push(d);
312
- }
313
-
314
- // 行数据处理完毕
315
- console.log("rowMp", rowMp);
316
-
317
- // 处理列
318
- const colKey = [];
319
- const colKeyTitle = this.flatSummaryCol(proSummaryTableColumns);
320
- for (const col of proSummaryTableColumns) {
321
- if (
322
- (col.statColType === "fact" || Array.isArray(col.children)) &&
323
- col.TYPE === undefined
324
- ) {
325
- colKey.push(col);
326
- }
327
- }
328
- const flatSummaryColTitle = this.flatSummaryCol(colKey);
329
- const flatSummaryRowTitle = this.flatSummaryCol(rowKey);
330
- const flatSummaryCalTitle = this.flatSummaryCol(
331
- proSummaryTableColumns.filter(({ TYPE }) => TYPE !== undefined)
332
- );
333
- console.log("colKey", colKey);
334
- console.log("colKeyTitle", colKeyTitle);
335
- console.log("flatSummaryColTitle", flatSummaryColTitle);
336
- console.log("flatSummaryRowTitle", flatSummaryRowTitle);
337
- console.log("flatSummaryCalTitle", flatSummaryCalTitle);
338
-
339
- proSummaryTableData = this.handleColData(
340
- rowMp,
341
- flatSummaryRowTitle,
342
- flatSummaryColTitle,
343
- flatSummaryCalTitle,
344
- cal
345
- );
346
-
347
- excludeGroupSumData = this.deepClone(proSummaryTableData);
348
- console.log("excludeGroupSumData", excludeGroupSumData);
349
-
350
- if (
351
- subtotalXColumn &&
352
- Array.isArray(subtotalXColumn) &&
353
- subtotalXColumn.length
354
- ) {
355
- const sortKeys = subtotalXColumn.map(({ id }) => colIdToNameMp[id]);
356
-
357
- const rowSumMp = this.buildRowMp(proSummaryTableData, sortKeys);
358
- console.log("rowSumMp", rowSumMp);
359
-
360
- const calRowKeys = [
361
- ...flatSummaryCalTitle,
362
- ...flatSummaryColTitle,
363
- ].map((i) => this.buildKeys(i));
364
- console.log("calRowKeys", calRowKeys);
365
-
366
- proSummaryTableData = this.handleRowData(
367
- rowSumMp,
368
- calRowKeys,
369
- calMp,
370
- calTxt,
371
- sortKeys[0],[],groupIColumns
372
- );
373
- }
374
-
375
- // 序号
376
- if (columns[0].title === "序号") {
377
- const col: any = {
378
- dataIndex: "序号",
379
- title: "序号",
380
- width: 60,
381
- order: -1,
382
- };
383
- if (columns[0].colWidth) {
384
- col.width = columns[0].colWidth;
385
- }
386
- proSummaryTableColumns.unshift(col);
387
- proSummaryTableData.forEach((_, idx) => {
388
- _["序号"] = idx + 1;
389
- });
390
- }
391
-
392
-
393
- // 给小计和总计染色
394
- this.stain(proSummaryTableColumns);
395
-
396
- // 删除默认数据在组内顺序字段
397
- proSummaryTableColumns.splice(
398
- proSummaryTableColumns.findIndex(
399
- ({ dataIndex }) => dataIndex === "orderInGroup"
400
- ),
401
- 1
402
- );
403
-
404
- proSummaryTableData.forEach((item) => delete item.orderInGroup);
405
-
406
- // 排序
407
- proSummaryTableColumns = proSummaryTableColumns.sort((a, b) => {
408
- if (a.order === undefined && b.order === undefined) return 0;
409
- if (a.order === undefined) return 1;
410
- if (b.order === undefined) return -1;
411
- return a.order < b.order ? -1 : 1;
412
- });
413
-
414
- console.log("proSummaryTableColumns", proSummaryTableColumns);
415
- console.log("proSummaryTableData", proSummaryTableData);
416
-
417
- return { proSummaryTableColumns, proSummaryTableData };
418
- },
419
- deepClone(source, hash = new WeakSet()) {
420
- try {
421
- if (
422
- typeof source !== "object" ||
423
- source === null ||
424
- React.isValidElement(source)
425
- ) {
426
- return source;
427
- }
428
- if (hash.has(source)) {
429
- return source;
430
- }
431
-
432
- hash.add(source);
433
- const target = Array.isArray(source) ? [] : {};
434
- Reflect.ownKeys(source).forEach((key) => {
435
- const val = source[key];
436
- if (typeof val === "object" && val != null) {
437
- target[key] = this.deepClone(val, hash);
438
- } else {
439
- target[key] = val;
440
- }
441
- });
442
- return target;
443
- } catch (err) {
444
- console.log("deepclone err", err, source);
445
- }
446
- },
447
- flatSummaryCol(arr, res = []) {
448
- for (const i of arr) {
449
- if (!i.children) res.push(i.keys);
450
- else this.flatSummaryCol(i.children, res);
451
- }
452
- return res;
453
- },
454
- buildColTag(cols, keys = []) {
455
- for (const col of cols) {
456
- if (!col.children) {
457
- col.dataIndex = this.buildKeys([
458
- ...keys,
459
- { dataKey: col._type ? col._type : col.title, title: col.title },
460
- ]);
461
- if (col.keys === undefined)
462
- col.keys = [
463
- ...keys,
464
- { dataKey: col._type ? col._type : col.title, title: col.title },
465
- ];
466
- } else {
467
- this.buildColTag(col.children, [
468
- ...keys,
469
- { dataKey: col._type ? col._type : col.title, title: col.title },
470
- ]);
471
- }
472
- }
473
- },
474
-
475
- getCurCalKeys(cols, keys = []) {
476
- for (const col of cols) {
477
- if (Array.isArray(col.children)) {
478
- this.getCurCalKeys(col.children, keys);
479
- } else {
480
- keys.push({
481
- factIndex: col.keys[col.keys.length - 1],
482
- dataIndex: col.dataIndex,
483
- });
484
- }
485
- }
486
-
487
- return keys;
488
- },
489
-
490
- setSumColKeys(sumCol, sumKeys) {
491
- if (sumKeys.length === 0) return;
492
- if (Array.isArray(sumCol.children)) {
493
- this.setSumColKeys(sumCol.children, sumKeys);
494
- } else {
495
- for (const col of sumCol) {
496
- const factKey = col.keys[col.keys.length - 1].dataKey;
497
- col.sumDataIndex = sumKeys.filter(
498
- ({ factIndex: { dataKey } }) => dataKey === factKey
499
- );
500
- col.keys[col.keys.length - 1].sumDataIndex = col.sumDataIndex.map(
501
- ({ dataIndex }) => dataIndex
502
- );
503
- }
504
- }
505
- },
506
- handleColData(
507
- rowMp,
508
- flatSummaryRowTitle,
509
- flatSummaryColTitle,
510
- flatSummaryCalTitle,
511
- cal,
512
- idx = 0,
513
- data = {},
514
- list = []
515
- ) {
516
- if (Array.isArray(rowMp)) {
517
- for (const col of flatSummaryColTitle) {
518
- const key = this.buildKeys(col);
519
- const colTarget = [];
520
- const preConditions = col.slice(0, col.length - 1);
521
- const targetKey = col.slice(col.length - 1)[0].title;
522
- for (const d of rowMp) {
523
- if (
524
- preConditions.every(({ dataKey, title }) => d[dataKey] === title)
525
- ) {
526
- colTarget.push(d);
527
- }
528
- }
529
-
530
- if (data[key] === undefined || data[key] == "") {
531
- data[key] = BigNumber(0);
532
- }
533
- if (cal === "sum")
534
- data[key] = colTarget.reduce(
535
- (last, d) => last.plus(BigNumber(d[targetKey])),
536
- BigNumber(0)
537
- );
538
- if (cal === "avg")
539
- data[key] = colTarget.reduce(
540
- (last, d) =>
541
- last.plus(BigNumber(d[targetKey]).div(colTarget.length)),
542
- BigNumber(0)
543
- );
544
- data[key] =
545
- data[key]?.toString() == "NaN" ? "0" : data[key]?.toString();
546
- }
547
-
548
- for (const calCol of flatSummaryCalTitle) {
549
- const key = this.buildKeys(calCol);
550
- const sumDataIndex = calCol[calCol.length - 1].sumDataIndex;
551
-
552
- if (data[key] === undefined || data[key] == "")
553
- data[key] = BigNumber(0);
554
- if (cal === "sum")
555
- data[key] = sumDataIndex.reduce(
556
- (last, dataKey) => last.plus(BigNumber(data[dataKey])),
557
- BigNumber(0)
558
- );
559
- if (cal === "avg")
560
- data[key] = sumDataIndex.reduce(
561
- (last, dataKey) =>
562
- last.plus(BigNumber(data[dataKey]).div(sumDataIndex.length)),
563
- BigNumber(0)
564
- );
565
- data[key] = data[key]?.toString();
566
- }
567
- list.push(data);
568
- } else {
569
- for (const [k, v] of Object.entries(rowMp)) {
570
- const dataKey = flatSummaryRowTitle[idx][0].dataKey;
571
- data[dataKey] = k;
572
- this.handleColData(
573
- v,
574
- flatSummaryRowTitle,
575
- flatSummaryColTitle,
576
- flatSummaryCalTitle,
577
- cal,
578
- idx + 1,
579
- this.deepClone(data),
580
- list
581
- );
582
- }
583
- }
584
-
585
- return list;
586
- },
587
-
588
- buildRowMp(data, sortKeys, idx = 0, mp = {}) {
589
- if (idx >= sortKeys.length) return data;
590
-
591
- const dataKey = sortKeys[idx];
592
-
593
- for (const d of data) {
594
- if (mp[d[dataKey]] === undefined) mp[d[dataKey]] = [];
595
- mp[d[dataKey]].push(d);
596
- }
597
-
598
- for (const [k, v] of Object.entries(mp)) {
599
- mp[k] = this.buildRowMp(v, sortKeys, idx + 1);
600
- }
601
-
602
- return mp;
603
- },
604
-
605
- handleRowData(
606
- data,
607
- calKeys,
608
- calMp: { [key: string]: string },
609
- calTxt,
610
- calTxtKey,
611
- res = [],groupIColumns
612
- ) {
613
- for (const [k, v] of Object.entries(data)) {
614
- if (Array.isArray(v)) {
615
- const sumData = {
616
- [calTxtKey]: calTxt,
617
- _type: calMp,
618
- _calRange: "small",
619
- };
620
-
621
- for (const calKey of calKeys) {
622
- if (calMp[calKey] === "sum")
623
- sumData[calKey] = v.reduce(
624
- (last, d) => last.plus(BigNumber(d[calKey])),
625
- BigNumber(0)
626
- );
627
- if (calMp[calKey] === "avg")
628
- sumData[calKey] = v.reduce(
629
- (last, d) => last.plus(BigNumber(d[calKey]).div(v.length)),
630
- BigNumber(0)
631
- );
632
-
633
- const hash = (...args) => args.join("-");
634
- const hashKey = (data, keys) => hash(...keys.map((key) => data[key]));
635
- if (calMp[calKey] === "groupIsum") {
636
- const allKeys = groupIColumns?.map(({ title }) => title);
637
- const set = new Set();
638
-
639
- sumData[calKey] = v.reduce((lastNum, item) => {
640
- if (set.has(hashKey(item, allKeys))) return lastNum;
641
- set.add(hashKey(item, allKeys));
642
- return lastNum.plus(
643
- new BigNumber(this.getTableSummaryNumberValue(item[calKey]))
644
- );
645
- }, new BigNumber(0));
646
- }
647
-
648
- if (calMp[calKey] === "groupIavg") {
649
- const set = new Set();
650
- let nums = 0;
651
- const allKeys = groupIColumns?.map(({ title }) => title);
652
-
653
- data.forEach((item) => {
654
- if (set.has(hashKey(item, allKeys))) return;
655
- set.add(hashKey(item, allKeys));
656
-
657
- nums++;
658
- });
659
-
660
- set.clear();
661
-
662
- sumData[calKey] = v.reduce((lastNum, item) => {
663
- if (set.has(hashKey(item, allKeys))) return lastNum;
664
- set.add(hashKey(item, allKeys));
665
- return lastNum.plus(
666
- new BigNumber(
667
- this.getTableSummaryNumberValue(item[calKey])
668
- ).div(nums)
669
- );
670
- }, new BigNumber(0));
671
- }
672
-
673
- sumData[calKey] = sumData[calKey]?.toString();
674
- }
675
-
676
- v.sort((a, b) =>
677
- Number(a.orderInGroup) < Number(b.orderInGroup) ? -1 : 1
678
- );
679
- res.push(...v, sumData);
680
- } else {
681
- this.handleRowData(v, calKeys, calMp, calTxt, calTxtKey, res,groupIColumns);
682
- }
683
- }
684
-
685
- return res;
686
- },
687
-
688
- stain(cols) {
689
- for (const col of cols) {
690
- if (Array.isArray(col.children)) {
691
- this.stain(col.children);
692
- } else {
693
- col.render = function(text, record, index) {
694
- let className = "";
695
- if (record._type !== undefined) {
696
- if (record._calRange === "small") className = "xiaoji";
697
- else className = "heji";
698
- }
699
- return <div className={className}>{text}</div>;
700
- };
701
- }
702
- }
703
- },
704
- getTableSummaryNumberValue(value: "" | string[]) {
705
- if (value === undefined || value === null) return 0;
706
- if (typeof value === "string") return Number(value);
707
- return Number(value[0].split("@R@")[1]);
708
- },
709
- buildKeys(keys: { title: string; dataKey: string }[]) {
710
- return keys.map((i) => i.title).join("-");
711
- }
712
-
1
+ import {BigNumber} from "bignumber.js";
2
+ import Table from "../control-table-x-axis-wrapper";
3
+ import React from "react";
4
+ import "../index.css";
5
+ interface SummaryColProps {
6
+ columns: any[];
7
+ translate: (...strs: string[]) => string;
8
+ summaryConfigs:{
9
+ title?:string,
10
+ id: string;
11
+ aggFunc: "sum" | "avg" | "groupIsum" | "groupIavg";
12
+ }[];
13
+ pageData:any,
14
+ rowSelection,groupIColumns
15
+ }
16
+
17
+ export default {
18
+ summary(summaryColProps:SummaryColProps) {
19
+ const {translate,summaryConfigs,pageData,columns,
20
+ rowSelection,groupIColumns}=summaryColProps;
21
+ if (
22
+ !summaryConfigs ||
23
+ summaryConfigs?.length === 0 ||
24
+ pageData.length === 0
25
+ )
26
+ return <></>;
27
+ // const isProSumarryTable = Boolean(subtotalXColumn);
28
+ // const columns = isProSumarryTable
29
+ // ? proSummaryTableColumns
30
+ // : columns_;
31
+ //const columns= columns_;
32
+ const sumConfigs: {
33
+ sum: { value: string; id: string; columnConfig?: any }[];
34
+ avg: { value: string; id: string; columnConfig?: any }[];
35
+ } = { sum: [], avg: [] };
36
+
37
+ if (rowSelection) {
38
+ sumConfigs["avg"].push({
39
+ value: "",
40
+ id: "",
41
+ columnConfig: { align: "center" },
42
+ });
43
+ sumConfigs["sum"].push({
44
+ value: "",
45
+ id: "",
46
+ columnConfig: { align: "center" },
47
+ });
48
+ }
49
+
50
+ sumConfigs["sum"].push({
51
+ value: translate("${合计}"),
52
+ id: "title",
53
+ columnConfig: { align: "center" },
54
+ });
55
+ sumConfigs["avg"].push({
56
+ value: translate("${均值}"),
57
+ id: "title",
58
+ columnConfig: { align: "center" },
59
+ });
60
+
61
+ let sumLen = 0,
62
+ avgLen = 0;
63
+
64
+ for (let i = 0; i < columns.length; i++) {
65
+ const idx = i,
66
+ dataIndex = columns[i].dataIndex;
67
+ if (idx === 0) continue;
68
+ const sum = { value: "", id: "", columnConfig: columns[i] };
69
+ const sumConfigIdx = summaryConfigs.findIndex(
70
+ ({ id ,title}) => id === dataIndex || title===dataIndex
71
+ );
72
+
73
+ if (sumConfigIdx === -1) {
74
+ sumConfigs["sum"].push(sum);
75
+ sumConfigs["avg"].push(sum);
76
+ continue;
77
+ }
78
+ const argFun = summaryConfigs[sumConfigIdx].aggFunc;
79
+ if (argFun === "sum")
80
+ sum.value = pageData
81
+ .reduce(
82
+ (lastNum, item) =>
83
+
84
+ lastNum.plus(
85
+ new BigNumber(
86
+ this.getTableSummaryNumberValue(item[dataIndex])
87
+ )
88
+ ),
89
+ new BigNumber(0)
90
+ )
91
+ ?.toString();
92
+ if (argFun === "avg")
93
+ sum.value = pageData
94
+ .reduce(
95
+ (lastNum, item) =>
96
+ lastNum.plus(
97
+ new BigNumber(
98
+ this.getTableSummaryNumberValue(item[dataIndex])
99
+ ).div(pageData.length)
100
+ ),
101
+ new BigNumber(0)
102
+ )
103
+ ?.toString();
104
+
105
+ const hash = (...args) => args.join("-");
106
+ const hashKey = (data, keys) =>
107
+ hash(...keys.map((key) => data[key]));
108
+
109
+ if (argFun === "groupIsum") {
110
+ const allKeys = groupIColumns?.map(({ id }) => id);
111
+ const set = new Set();
112
+
113
+ sum.value = pageData
114
+ .reduce((lastNum, item) => {
115
+ if (set.has(hashKey(item, allKeys))) return lastNum;
116
+ set.add(hashKey(item, allKeys));
117
+ return lastNum.plus(
118
+ new BigNumber(
119
+ this.getTableSummaryNumberValue(item[dataIndex])
120
+ )
121
+ );
122
+ }, new BigNumber(0))
123
+ ?.toString();
124
+ }
125
+
126
+ if (argFun === "groupIavg") {
127
+ const set = new Set();
128
+ let nums = 0;
129
+ const allKeys = groupIColumns?.map(({ id }) => id);
130
+
131
+ pageData.forEach((item) => {
132
+ if (set.has(hashKey(item, allKeys))) return;
133
+ set.add(hashKey(item, allKeys));
134
+
135
+ nums++;
136
+ });
137
+
138
+ set.clear();
139
+
140
+ sum.value = pageData
141
+ .reduce((lastNum, item) => {
142
+ if (set.has(hashKey(item, allKeys))) return lastNum;
143
+ set.add(hashKey(item, allKeys));
144
+ return lastNum.plus(
145
+ new BigNumber(
146
+ this.getTableSummaryNumberValue(item[dataIndex])
147
+ ).div(nums)
148
+ );
149
+ }, new BigNumber(0))
150
+ ?.toString();
151
+ }
152
+
153
+ sum.id = dataIndex;
154
+ if (argFun === "avg" || argFun === "groupIavg") {
155
+ sumConfigs["avg"].push(sum);
156
+ avgLen++;
157
+ } else sumConfigs["avg"].push({ value: "", id: "" });
158
+
159
+ if (argFun === "sum" || argFun === "groupIsum") {
160
+ sumConfigs["sum"].push(sum);
161
+ sumLen++;
162
+ } else sumConfigs["sum"].push({ value: "", id: "" });
163
+ }
164
+
165
+ console.log("sumConfigs", sumConfigs, sumLen, avgLen);
166
+
167
+ return (
168
+ <>
169
+ {sumLen === 0 ? (
170
+ <></>
171
+ ) : (
172
+ <Table.Summary.Row>
173
+ {sumConfigs["sum"].map(
174
+ ({ id, value, columnConfig }, idx) => (
175
+ <Table.Summary.Cell
176
+ align={columnConfig?.align}
177
+ index={idx}
178
+ className="heji"
179
+ >
180
+ {value}
181
+ </Table.Summary.Cell>
182
+ )
183
+ )}
184
+ </Table.Summary.Row>
185
+ )}
186
+ {avgLen === 0 ? (
187
+ <></>
188
+ ) : (
189
+ <Table.Summary.Row>
190
+ {sumConfigs["avg"].map(
191
+ ({ id, value, columnConfig }, idx) => (
192
+ <Table.Summary.Cell
193
+ align={columnConfig?.align}
194
+ index={idx}
195
+ className="heji"
196
+ >
197
+ {value}
198
+ </Table.Summary.Cell>
199
+ )
200
+ )}
201
+ </Table.Summary.Row>
202
+ )}
203
+ </>
204
+ );
205
+ },
206
+
207
+ handleProSummaryTable(props: any) {
208
+ const {subtotalXColumn,columns: _columns,data,translate,groupIColumns}=props
209
+ const isProSumarryTable = Boolean(
210
+ subtotalXColumn
211
+ );
212
+ if (!isProSumarryTable)
213
+ return { proSummaryTableColumns: [], proSummaryTableData: [] };
214
+ const columns = _columns;
215
+
216
+ for (const column of columns) {
217
+ delete column["sorter"];
218
+ }
219
+
220
+ for (const d of data) {
221
+ for (const [k, v] of Object.entries(d)) {
222
+ if (v == null || v == "null") {
223
+ d[k] = "";
224
+ } else if (typeof v === "string" && (v as string)?.includes("@R@")) {
225
+ d[k] = (v as string).split("@R@")[1];
226
+ }
227
+ }
228
+ }
229
+
230
+ console.log("data", data);
231
+ console.log("columns", columns);
232
+
233
+ const colMp = {
234
+ dimension: [],
235
+ fact: [],
236
+ others: [
237
+ {
238
+ dataIndex: "orderInGroup",
239
+ title: "orderInGroup",
240
+ },
241
+ ],
242
+ };
243
+ const colIdToNameMp = {};
244
+ const colNameToIdMp = {};
245
+ for (const col of columns) {
246
+ colIdToNameMp[col["dataIndex"]] = col["title"];
247
+ colNameToIdMp[col["title"]] = col["dataIndex"];
248
+ if (col.statColType !== undefined) {
249
+ colMp[col.statColType].push(this.deepClone(col));
250
+ } else {
251
+ if (col.title !== "序号") colMp["others"].push(this.deepClone(col));
252
+ }
253
+ }
254
+ console.log("colIdToNameMp", colIdToNameMp);
255
+ console.log("colNameToIdMp", colNameToIdMp);
256
+ console.log("colMp", colMp);
257
+
258
+ // canReadData
259
+ const canReadData = [];
260
+ let order = 0;
261
+ for (const d of data) {
262
+ const item = {};
263
+ for (const [k, v] of Object.entries(d)) {
264
+ let _v = v;
265
+ if (
266
+ colMp.fact.findIndex(({ dataIndex }) => dataIndex === k) > -1 &&
267
+ v === null
268
+ )
269
+ _v = 0;
270
+ item[colIdToNameMp[k]] = _v;
271
+ }
272
+ canReadData.push({ ...item, orderInGroup: order++ });
273
+ }
274
+ console.log("canReadData", canReadData);
275
+
276
+ let proSummaryTableColumns = [
277
+ ...this.deepClone(colMp.dimension),
278
+ ...this.deepClone(colMp.others),
279
+ ],
280
+ proSummaryTableData = [],
281
+ excludeGroupSumData = [];
282
+ const cal = colMp.fact[0]?.cal;
283
+ const calTxt = cal === "sum" ? translate("${小计}") : translate("${均值}");
284
+ const calMp = {};
285
+ colMp.fact.forEach(({ title, cal }) => (calMp[title] = cal));
286
+
287
+ // 计算列
288
+ proSummaryTableColumns.push(...colMp.fact);
289
+
290
+ // buildData
291
+ this.buildColTag(proSummaryTableColumns);
292
+
293
+ // 处理行
294
+ const rowMp = {};
295
+ const rowKey = [];
296
+ for (const col of proSummaryTableColumns) {
297
+ if (Array.isArray(col.keys) && col.keys.length === 1) rowKey.push(col);
298
+ }
299
+ console.log("rowKey", rowKey);
300
+
301
+ for (const d of canReadData) {
302
+ let t: any = rowMp;
303
+ for (let i = 0; i < rowKey.length; i++) {
304
+ const key = rowKey[i].title;
305
+ if (t[d[key]] === undefined) {
306
+ if (i !== rowKey.length - 1) t[d[key]] = {};
307
+ else t[d[key]] = [];
308
+ }
309
+ t = t[d[key]];
310
+ }
311
+ if (Array.isArray(t)) t.push(d);
312
+ }
313
+
314
+ // 行数据处理完毕
315
+ console.log("rowMp", rowMp);
316
+
317
+ // 处理列
318
+ const colKey = [];
319
+ const colKeyTitle = this.flatSummaryCol(proSummaryTableColumns);
320
+ for (const col of proSummaryTableColumns) {
321
+ if (
322
+ (col.statColType === "fact" || Array.isArray(col.children)) &&
323
+ col.TYPE === undefined
324
+ ) {
325
+ colKey.push(col);
326
+ }
327
+ }
328
+ const flatSummaryColTitle = this.flatSummaryCol(colKey);
329
+ const flatSummaryRowTitle = this.flatSummaryCol(rowKey);
330
+ const flatSummaryCalTitle = this.flatSummaryCol(
331
+ proSummaryTableColumns.filter(({ TYPE }) => TYPE !== undefined)
332
+ );
333
+ console.log("colKey", colKey);
334
+ console.log("colKeyTitle", colKeyTitle);
335
+ console.log("flatSummaryColTitle", flatSummaryColTitle);
336
+ console.log("flatSummaryRowTitle", flatSummaryRowTitle);
337
+ console.log("flatSummaryCalTitle", flatSummaryCalTitle);
338
+
339
+ proSummaryTableData = this.handleColData(
340
+ rowMp,
341
+ flatSummaryRowTitle,
342
+ flatSummaryColTitle,
343
+ flatSummaryCalTitle,
344
+ cal
345
+ );
346
+
347
+ excludeGroupSumData = this.deepClone(proSummaryTableData);
348
+ console.log("excludeGroupSumData", excludeGroupSumData);
349
+
350
+ if (
351
+ subtotalXColumn &&
352
+ Array.isArray(subtotalXColumn) &&
353
+ subtotalXColumn.length
354
+ ) {
355
+ const sortKeys = subtotalXColumn.map(({ id }) => colIdToNameMp[id]);
356
+
357
+ const rowSumMp = this.buildRowMp(proSummaryTableData, sortKeys);
358
+ console.log("rowSumMp", rowSumMp);
359
+
360
+ const calRowKeys = [
361
+ ...flatSummaryCalTitle,
362
+ ...flatSummaryColTitle,
363
+ ].map((i) => this.buildKeys(i));
364
+ console.log("calRowKeys", calRowKeys);
365
+
366
+ proSummaryTableData = this.handleRowData(
367
+ rowSumMp,
368
+ calRowKeys,
369
+ calMp,
370
+ calTxt,
371
+ sortKeys[0],[],groupIColumns
372
+ );
373
+ }
374
+
375
+ // 序号
376
+ if (columns[0].title === "序号") {
377
+ const col: any = {
378
+ dataIndex: "序号",
379
+ title: "序号",
380
+ width: 60,
381
+ order: -1,
382
+ };
383
+ if (columns[0].colWidth) {
384
+ col.width = columns[0].colWidth;
385
+ }
386
+ proSummaryTableColumns.unshift(col);
387
+ proSummaryTableData.forEach((_, idx) => {
388
+ _["序号"] = idx + 1;
389
+ });
390
+ }
391
+
392
+
393
+ // 给小计和总计染色
394
+ this.stain(proSummaryTableColumns);
395
+
396
+ // 删除默认数据在组内顺序字段
397
+ proSummaryTableColumns.splice(
398
+ proSummaryTableColumns.findIndex(
399
+ ({ dataIndex }) => dataIndex === "orderInGroup"
400
+ ),
401
+ 1
402
+ );
403
+
404
+ proSummaryTableData.forEach((item) => delete item.orderInGroup);
405
+
406
+ // 排序
407
+ proSummaryTableColumns = proSummaryTableColumns.sort((a, b) => {
408
+ if (a.order === undefined && b.order === undefined) return 0;
409
+ if (a.order === undefined) return 1;
410
+ if (b.order === undefined) return -1;
411
+ return a.order < b.order ? -1 : 1;
412
+ });
413
+
414
+ console.log("proSummaryTableColumns", proSummaryTableColumns);
415
+ console.log("proSummaryTableData", proSummaryTableData);
416
+
417
+ return { proSummaryTableColumns, proSummaryTableData };
418
+ },
419
+ deepClone(source, hash = new WeakSet()) {
420
+ try {
421
+ if (
422
+ typeof source !== "object" ||
423
+ source === null ||
424
+ React.isValidElement(source)
425
+ ) {
426
+ return source;
427
+ }
428
+ if (hash.has(source)) {
429
+ return source;
430
+ }
431
+
432
+ hash.add(source);
433
+ const target = Array.isArray(source) ? [] : {};
434
+ Reflect.ownKeys(source).forEach((key) => {
435
+ const val = source[key];
436
+ if (typeof val === "object" && val != null) {
437
+ target[key] = this.deepClone(val, hash);
438
+ } else {
439
+ target[key] = val;
440
+ }
441
+ });
442
+ return target;
443
+ } catch (err) {
444
+ console.log("deepclone err", err, source);
445
+ }
446
+ },
447
+ flatSummaryCol(arr, res = []) {
448
+ for (const i of arr) {
449
+ if (!i.children) res.push(i.keys);
450
+ else this.flatSummaryCol(i.children, res);
451
+ }
452
+ return res;
453
+ },
454
+ buildColTag(cols, keys = []) {
455
+ for (const col of cols) {
456
+ if (!col.children) {
457
+ col.dataIndex = this.buildKeys([
458
+ ...keys,
459
+ { dataKey: col._type ? col._type : col.title, title: col.title },
460
+ ]);
461
+ if (col.keys === undefined)
462
+ col.keys = [
463
+ ...keys,
464
+ { dataKey: col._type ? col._type : col.title, title: col.title },
465
+ ];
466
+ } else {
467
+ this.buildColTag(col.children, [
468
+ ...keys,
469
+ { dataKey: col._type ? col._type : col.title, title: col.title },
470
+ ]);
471
+ }
472
+ }
473
+ },
474
+
475
+ getCurCalKeys(cols, keys = []) {
476
+ for (const col of cols) {
477
+ if (Array.isArray(col.children)) {
478
+ this.getCurCalKeys(col.children, keys);
479
+ } else {
480
+ keys.push({
481
+ factIndex: col.keys[col.keys.length - 1],
482
+ dataIndex: col.dataIndex,
483
+ });
484
+ }
485
+ }
486
+
487
+ return keys;
488
+ },
489
+
490
+ setSumColKeys(sumCol, sumKeys) {
491
+ if (sumKeys.length === 0) return;
492
+ if (Array.isArray(sumCol.children)) {
493
+ this.setSumColKeys(sumCol.children, sumKeys);
494
+ } else {
495
+ for (const col of sumCol) {
496
+ const factKey = col.keys[col.keys.length - 1].dataKey;
497
+ col.sumDataIndex = sumKeys.filter(
498
+ ({ factIndex: { dataKey } }) => dataKey === factKey
499
+ );
500
+ col.keys[col.keys.length - 1].sumDataIndex = col.sumDataIndex.map(
501
+ ({ dataIndex }) => dataIndex
502
+ );
503
+ }
504
+ }
505
+ },
506
+ handleColData(
507
+ rowMp,
508
+ flatSummaryRowTitle,
509
+ flatSummaryColTitle,
510
+ flatSummaryCalTitle,
511
+ cal,
512
+ idx = 0,
513
+ data = {},
514
+ list = []
515
+ ) {
516
+ if (Array.isArray(rowMp)) {
517
+ for (const col of flatSummaryColTitle) {
518
+ const key = this.buildKeys(col);
519
+ const colTarget = [];
520
+ const preConditions = col.slice(0, col.length - 1);
521
+ const targetKey = col.slice(col.length - 1)[0].title;
522
+ for (const d of rowMp) {
523
+ if (
524
+ preConditions.every(({ dataKey, title }) => d[dataKey] === title)
525
+ ) {
526
+ colTarget.push(d);
527
+ }
528
+ }
529
+
530
+ if (data[key] === undefined || data[key] == "") {
531
+ data[key] = BigNumber(0);
532
+ }
533
+ if (cal === "sum")
534
+ data[key] = colTarget.reduce(
535
+ (last, d) => last.plus(BigNumber(d[targetKey])),
536
+ BigNumber(0)
537
+ );
538
+ if (cal === "avg")
539
+ data[key] = colTarget.reduce(
540
+ (last, d) =>
541
+ last.plus(BigNumber(d[targetKey]).div(colTarget.length)),
542
+ BigNumber(0)
543
+ );
544
+ data[key] =
545
+ data[key]?.toString() == "NaN" ? "0" : data[key]?.toString();
546
+ }
547
+
548
+ for (const calCol of flatSummaryCalTitle) {
549
+ const key = this.buildKeys(calCol);
550
+ const sumDataIndex = calCol[calCol.length - 1].sumDataIndex;
551
+
552
+ if (data[key] === undefined || data[key] == "")
553
+ data[key] = BigNumber(0);
554
+ if (cal === "sum")
555
+ data[key] = sumDataIndex.reduce(
556
+ (last, dataKey) => last.plus(BigNumber(data[dataKey])),
557
+ BigNumber(0)
558
+ );
559
+ if (cal === "avg")
560
+ data[key] = sumDataIndex.reduce(
561
+ (last, dataKey) =>
562
+ last.plus(BigNumber(data[dataKey]).div(sumDataIndex.length)),
563
+ BigNumber(0)
564
+ );
565
+ data[key] = data[key]?.toString();
566
+ }
567
+ list.push(data);
568
+ } else {
569
+ for (const [k, v] of Object.entries(rowMp)) {
570
+ const dataKey = flatSummaryRowTitle[idx][0].dataKey;
571
+ data[dataKey] = k;
572
+ this.handleColData(
573
+ v,
574
+ flatSummaryRowTitle,
575
+ flatSummaryColTitle,
576
+ flatSummaryCalTitle,
577
+ cal,
578
+ idx + 1,
579
+ this.deepClone(data),
580
+ list
581
+ );
582
+ }
583
+ }
584
+
585
+ return list;
586
+ },
587
+
588
+ buildRowMp(data, sortKeys, idx = 0, mp = {}) {
589
+ if (idx >= sortKeys.length) return data;
590
+
591
+ const dataKey = sortKeys[idx];
592
+
593
+ for (const d of data) {
594
+ if (mp[d[dataKey]] === undefined) mp[d[dataKey]] = [];
595
+ mp[d[dataKey]].push(d);
596
+ }
597
+
598
+ for (const [k, v] of Object.entries(mp)) {
599
+ mp[k] = this.buildRowMp(v, sortKeys, idx + 1);
600
+ }
601
+
602
+ return mp;
603
+ },
604
+
605
+ handleRowData(
606
+ data,
607
+ calKeys,
608
+ calMp: { [key: string]: string },
609
+ calTxt,
610
+ calTxtKey,
611
+ res = [],groupIColumns
612
+ ) {
613
+ for (const [k, v] of Object.entries(data)) {
614
+ if (Array.isArray(v)) {
615
+ const sumData = {
616
+ [calTxtKey]: calTxt,
617
+ _type: calMp,
618
+ _calRange: "small",
619
+ };
620
+
621
+ for (const calKey of calKeys) {
622
+ if (calMp[calKey] === "sum")
623
+ sumData[calKey] = v.reduce(
624
+ (last, d) => last.plus(BigNumber(d[calKey])),
625
+ BigNumber(0)
626
+ );
627
+ if (calMp[calKey] === "avg")
628
+ sumData[calKey] = v.reduce(
629
+ (last, d) => last.plus(BigNumber(d[calKey]).div(v.length)),
630
+ BigNumber(0)
631
+ );
632
+
633
+ const hash = (...args) => args.join("-");
634
+ const hashKey = (data, keys) => hash(...keys.map((key) => data[key]));
635
+ if (calMp[calKey] === "groupIsum") {
636
+ const allKeys = groupIColumns?.map(({ title }) => title);
637
+ const set = new Set();
638
+
639
+ sumData[calKey] = v.reduce((lastNum, item) => {
640
+ if (set.has(hashKey(item, allKeys))) return lastNum;
641
+ set.add(hashKey(item, allKeys));
642
+ return lastNum.plus(
643
+ new BigNumber(this.getTableSummaryNumberValue(item[calKey]))
644
+ );
645
+ }, new BigNumber(0));
646
+ }
647
+
648
+ if (calMp[calKey] === "groupIavg") {
649
+ const set = new Set();
650
+ let nums = 0;
651
+ const allKeys = groupIColumns?.map(({ title }) => title);
652
+
653
+ data.forEach((item) => {
654
+ if (set.has(hashKey(item, allKeys))) return;
655
+ set.add(hashKey(item, allKeys));
656
+
657
+ nums++;
658
+ });
659
+
660
+ set.clear();
661
+
662
+ sumData[calKey] = v.reduce((lastNum, item) => {
663
+ if (set.has(hashKey(item, allKeys))) return lastNum;
664
+ set.add(hashKey(item, allKeys));
665
+ return lastNum.plus(
666
+ new BigNumber(
667
+ this.getTableSummaryNumberValue(item[calKey])
668
+ ).div(nums)
669
+ );
670
+ }, new BigNumber(0));
671
+ }
672
+
673
+ sumData[calKey] = sumData[calKey]?.toString();
674
+ }
675
+
676
+ v.sort((a, b) =>
677
+ Number(a.orderInGroup) < Number(b.orderInGroup) ? -1 : 1
678
+ );
679
+ res.push(...v, sumData);
680
+ } else {
681
+ this.handleRowData(v, calKeys, calMp, calTxt, calTxtKey, res,groupIColumns);
682
+ }
683
+ }
684
+
685
+ return res;
686
+ },
687
+
688
+ stain(cols) {
689
+ for (const col of cols) {
690
+ if (Array.isArray(col.children)) {
691
+ this.stain(col.children);
692
+ } else {
693
+ col.render = function(text, record, index) {
694
+ let className = "";
695
+ if (record._type !== undefined) {
696
+ if (record._calRange === "small") className = "xiaoji";
697
+ else className = "heji";
698
+ }
699
+ return <div className={className}>{text}</div>;
700
+ };
701
+ }
702
+ }
703
+ },
704
+ getTableSummaryNumberValue(value: "" | string[]) {
705
+ if (value === undefined || value === null) return 0;
706
+ if (typeof value === "string") return Number(value);
707
+ return Number(value[0].split("@R@")[1]);
708
+ },
709
+ buildKeys(keys: { title: string; dataKey: string }[]) {
710
+ return keys.map((i) => i.title).join("-");
711
+ }
712
+
713
713
  }