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.
- package/LICENSE +201 -201
- package/README.md +2 -2
- package/lib/controls/2dEditor/2dEditor/index.less +5 -5
- package/lib/controls/2dEditor/2dView/index.less +8 -8
- package/lib/controls/2dEditor/components/component.less +83 -83
- package/lib/controls/action/index.css +8 -8
- package/lib/controls/action/index.d.ts.map +1 -1
- package/lib/controls/chemstruc/graph.d.ts.map +1 -1
- package/lib/controls/chemstruc/index.css +28 -28
- package/lib/controls/collapse-card/index.css +8 -8
- package/lib/controls/collapse-card/index.d.ts.map +1 -1
- package/lib/controls/cquery/cquick-button.d.ts.map +1 -1
- package/lib/controls/entity-select/entity-select.d.ts.map +1 -1
- package/lib/controls/entity-select/index.css +7 -7
- package/lib/controls/entity-select/lab-tree-select.d.ts.map +1 -1
- package/lib/controls/entity-select/popover-entity-select.d.ts.map +1 -1
- package/lib/controls/file-view/index.less +9 -9
- package/lib/controls/html-editor/index.less +67 -67
- package/lib/controls/icon-selector/icon/aldehyde-menu-icon/iconfont.css +147 -147
- package/lib/controls/password-setter/index.css +2 -2
- package/lib/controls/password-setter/index.d.ts.map +1 -1
- package/lib/controls/qr-code/index.less +28 -28
- package/lib/controls/relation-existion/index.css +3 -3
- package/lib/controls/relation-existion/index.d.ts.map +1 -1
- package/lib/controls/rfield/index.css +4 -4
- package/lib/controls/rfield/index.d.ts.map +1 -1
- package/lib/controls/select/index.d.ts.map +1 -1
- package/lib/controls/signature/index.d.ts.map +1 -1
- package/lib/controls/text/ellipsis-text.d.ts.map +1 -1
- package/lib/controls/text/index.less +7 -7
- package/lib/controls/upload/index.d.ts.map +1 -1
- package/lib/controls/upload/mult-file-upload.d.ts.map +1 -1
- package/lib/custom-page/dtmpl-custom-edit-modal-page.d.ts.map +1 -1
- package/lib/detail/button/bottom-submit-button-bar.d.ts.map +1 -1
- package/lib/detail/button/cquery-button-bar.d.ts.map +1 -1
- package/lib/detail/button/fix-right-submit-button-bar.d.ts.map +1 -1
- package/lib/detail/button/index.css +42 -42
- package/lib/detail/dtmpl.css +67 -67
- package/lib/detail/edit/fields-edit-card.d.ts.map +1 -1
- package/lib/detail/edit/modal-row-edit.d.ts.map +1 -1
- package/lib/detail/edit/popover-edit-card.d.ts.map +1 -1
- package/lib/detail/rightbar/index.css +34 -34
- package/lib/detail/rightbar/index.d.ts.map +1 -1
- package/lib/detail/view/act-dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/field-view-group.d.ts.map +1 -1
- package/lib/detail/view/modal-dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/snapshot-timeline.d.ts.map +1 -1
- package/lib/detail/view/tab-act-dtmpl-view.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/components/index.d.ts +3 -0
- package/lib/draw-canvas-edit/components/render/components/index.d.ts.map +1 -0
- package/lib/draw-canvas-edit/components/render/components/index.js +3 -0
- package/lib/draw-canvas-edit/components/render/components/index.js.map +1 -0
- package/lib/draw-canvas-edit/components/render/components/workstation-component.d.ts +31 -0
- package/lib/draw-canvas-edit/components/render/components/workstation-component.d.ts.map +1 -0
- package/lib/draw-canvas-edit/components/render/components/workstation-component.js +105 -0
- package/lib/draw-canvas-edit/components/render/components/workstation-component.js.map +1 -0
- package/lib/draw-canvas-edit/components/render/tools/component-factory.d.ts +2 -0
- package/lib/draw-canvas-edit/components/render/tools/component-factory.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/component-factory.js +10 -42
- package/lib/draw-canvas-edit/components/render/tools/component-factory.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/types.d.ts +3 -0
- package/lib/draw-canvas-edit/components/render/types.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/types.js.map +1 -1
- package/lib/draw-canvas-edit/index.less +48 -48
- package/lib/draw-canvas-view/index.less +59 -59
- package/lib/draw-canvas-view/view.d.ts.map +1 -1
- package/lib/draw-canvas-view/view.js +19 -6
- package/lib/draw-canvas-view/view.js.map +1 -1
- package/lib/export/export-frame.css +2 -2
- package/lib/export/export-frame.d.ts.map +1 -1
- package/lib/export/select-code-export-frame.d.ts.map +1 -1
- package/lib/form/dtmpl-form.css +3 -3
- package/lib/form/dtmpl-form.d.ts.map +1 -1
- package/lib/form/dtmpl-form.js +1 -1
- package/lib/form/dtmpl-form.js.map +1 -1
- package/lib/form/field-group-form.d.ts.map +1 -1
- package/lib/form/form-Item-group.d.ts.map +1 -1
- package/lib/form/index.css +12 -12
- package/lib/import/excel-import.d.ts.map +1 -1
- package/lib/import/index.css +53 -53
- package/lib/import/template.css +50 -50
- package/lib/layout/common.css +64 -64
- package/lib/layout/coverstyle.css +51 -51
- package/lib/layout/footer/index.css +5 -5
- package/lib/layout/header/index.css +122 -122
- package/lib/layout/menu/block.css +7 -7
- package/lib/layout/menu/block.d.ts.map +1 -1
- package/lib/layout/menu/l2menu-quick-bar.d.ts.map +1 -1
- package/lib/layout/menu/menu-2layers.d.ts.map +1 -1
- package/lib/layout/menu/message-bar.less +73 -73
- package/lib/layout/menu/reset-password.d.ts.map +1 -1
- package/lib/layout/menu/user-bar.d.ts.map +1 -1
- package/lib/layout/menu/userinfo-bar.d.ts.map +1 -1
- package/lib/layout/sidebar/index.css +57 -57
- package/lib/layout2/css/header.css +41 -41
- package/lib/layout2/css/sider.less +17 -17
- package/lib/layout2/css/tabs-layout.less +18 -18
- package/lib/layout3/css/header.less +195 -195
- package/lib/layout3/css/main.less +161 -161
- package/lib/layout3/css/sider.less +32 -32
- package/lib/layout3/css/tabs-layout.less +38 -38
- package/lib/layout4/css/header.less +196 -196
- package/lib/layout4/css/main.less +154 -154
- package/lib/layout4/css/sider.less +37 -37
- package/lib/layout4/css/tabs-layout.less +42 -42
- package/lib/layout5/css/header.less +35 -35
- package/lib/layout5/css/sider.less +18 -18
- package/lib/list/calendar/index.less +20 -20
- package/lib/list/card-list/index.less +154 -154
- package/lib/list/gantt/index.less +8 -8
- package/lib/list/vertical-list/index.less +208 -208
- package/lib/login/index.css +19 -19
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/vertify/index.css +143 -143
- package/lib/login3/index.less +136 -136
- package/lib/lowcode-components/act-table/index.less +26 -26
- package/lib/lowcode-components/base-button/index.less +7 -7
- package/lib/lowcode-components/base-map/index.js +6 -6
- package/lib/lowcode-components/base-radio/index.less +23 -23
- package/lib/lowcode-components/base-tabs/index.less +14 -14
- package/lib/lowcode-components/border/border10/index.less +26 -26
- package/lib/lowcode-components/border/border11/index.js +46 -46
- package/lib/lowcode-components/border/border11/index.less +17 -17
- package/lib/lowcode-components/border/border12/index.js +13 -13
- package/lib/lowcode-components/border/border12/index.less +13 -13
- package/lib/lowcode-components/border/border13/index.js +5 -5
- package/lib/lowcode-components/border/border13/index.less +13 -13
- package/lib/lowcode-components/border/border2/index.less +17 -17
- package/lib/lowcode-components/border/border3/index.less +25 -25
- package/lib/lowcode-components/border/border4/index.js +2 -2
- package/lib/lowcode-components/border/border4/index.less +72 -72
- package/lib/lowcode-components/border/border5/index.js +2 -2
- package/lib/lowcode-components/border/border5/index.less +35 -35
- package/lib/lowcode-components/border/border6/index.less +17 -17
- package/lib/lowcode-components/border/border7/index.less +26 -26
- package/lib/lowcode-components/border/border8/index.less +13 -13
- package/lib/lowcode-components/border/border9/index.js +14 -14
- package/lib/lowcode-components/border/border9/index.less +13 -13
- package/lib/lowcode-components/decoration/decoration1/index.less +7 -7
- package/lib/lowcode-components/decoration/decoration10/index.js +3 -3
- package/lib/lowcode-components/decoration/decoration10/index.less +5 -5
- package/lib/lowcode-components/decoration/decoration11/index.less +5 -5
- package/lib/lowcode-components/decoration/decoration2/index.less +6 -6
- package/lib/lowcode-components/decoration/decoration3/index.less +7 -7
- package/lib/lowcode-components/decoration/decoration4/index.less +29 -29
- package/lib/lowcode-components/decoration/decoration5/index.less +3 -3
- package/lib/lowcode-components/decoration/decoration6/index.less +7 -7
- package/lib/lowcode-components/decoration/decoration7/index.less +4 -4
- package/lib/lowcode-components/decoration/decoration8/index.less +14 -14
- package/lib/lowcode-components/decoration/decoration9/index.less +4 -4
- package/lib/lowcode-components/effectScatter-map/index.js +6 -6
- package/lib/lowcode-components/effectScatter-map-3d/index.js +6 -6
- package/lib/lowcode-components/lowcode-view/index.less +19 -19
- package/lib/lowcode-components/search-form/index.less +25 -25
- package/lib/module/dtmpl-edit-card.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
- package/lib/module/index.less +4 -4
- package/lib/module/ltmpl-modal.d.ts.map +1 -1
- package/lib/module/ltmpl-table.d.ts.map +1 -1
- package/lib/routable/index.less +25 -25
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/column/index.less +63 -63
- package/lib/table/index.css +211 -211
- package/lib/table/modal-select-table.d.ts.map +1 -1
- package/lib/table/pagination.css +14 -14
- package/lib/table/pagination.d.ts.map +1 -1
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/select-table.d.ts.map +1 -1
- package/lib/table/select-table.js +14 -2
- package/lib/table/select-table.js.map +1 -1
- package/lib/table/selected-rows-card.d.ts.map +1 -1
- package/lib/table/stat/restat.d.ts.map +1 -1
- package/lib/tree/act-tree.d.ts.map +1 -1
- package/lib/tree/block-menu-auth-tree.d.ts.map +1 -1
- package/lib/tree/index.css +22 -22
- package/lib/tree/tmpl-tree.d.ts.map +1 -1
- package/lib/welcome/components/menu-card.less +96 -96
- package/lib/welcome/components/page-card.less +49 -49
- package/lib/welcome/components/quick-entrance.less +120 -120
- package/lib/welcome/components/user-menus.less +192 -192
- package/lib/welcome/components/workbench.less +118 -118
- package/lib/welcome/index.css +13 -13
- package/package.json +223 -223
- package/src/aldehyde/controls/2dEditor/2dEditor/index.less +5 -5
- package/src/aldehyde/controls/2dEditor/2dEditor/index.tsx +270 -270
- package/src/aldehyde/controls/2dEditor/2dView/index.less +8 -8
- package/src/aldehyde/controls/2dEditor/2dView/index.tsx +110 -110
- package/src/aldehyde/controls/2dEditor/components/card.tsx +256 -256
- package/src/aldehyde/controls/2dEditor/components/component.less +83 -83
- package/src/aldehyde/controls/2dEditor/components/data.d.ts +32 -32
- package/src/aldehyde/controls/2dEditor/components/hotspot.tsx +80 -80
- package/src/aldehyde/controls/2dEditor/components/html-box.tsx +101 -101
- package/src/aldehyde/controls/2dEditor/components/image.tsx +99 -99
- package/src/aldehyde/controls/2dEditor/components/line.tsx +73 -73
- package/src/aldehyde/controls/action/index.css +8 -8
- package/src/aldehyde/controls/action/index.tsx +406 -406
- package/src/aldehyde/controls/action/utils.tsx +306 -306
- package/src/aldehyde/controls/auto-complete/index.tsx +82 -82
- package/src/aldehyde/controls/cascader/index.tsx +112 -112
- package/src/aldehyde/controls/chemstruc/graph.tsx +185 -185
- package/src/aldehyde/controls/chemstruc/index.css +28 -28
- package/src/aldehyde/controls/code-editor/sql-code-editor.tsx +73 -73
- package/src/aldehyde/controls/collapse-card/index.css +8 -8
- package/src/aldehyde/controls/collapse-card/index.tsx +109 -109
- package/src/aldehyde/controls/color-picker/index.tsx +21 -21
- package/src/aldehyde/controls/counting-tag/index.tsx +53 -53
- package/src/aldehyde/controls/cquery/cquick-button.tsx +145 -145
- package/src/aldehyde/controls/date-picker/index.tsx +199 -199
- package/src/aldehyde/controls/direct-file-view/drawer-file-view.tsx +54 -54
- package/src/aldehyde/controls/direct-file-view/index.tsx +145 -145
- package/src/aldehyde/controls/direct-upload/index.tsx +139 -139
- package/src/aldehyde/controls/entity-select/entity-select.tsx +791 -791
- package/src/aldehyde/controls/entity-select/index.css +7 -7
- package/src/aldehyde/controls/entity-select/lab-tree-select.tsx +154 -154
- package/src/aldehyde/controls/entity-select/popover-entity-select.tsx +205 -205
- package/src/aldehyde/controls/entry-control.tsx +418 -418
- package/src/aldehyde/controls/enum-badge/index.tsx +42 -42
- package/src/aldehyde/controls/enum-tag/index.tsx +45 -45
- package/src/aldehyde/controls/field-history/index.tsx +81 -81
- package/src/aldehyde/controls/file-export/select-code-export.tsx +40 -40
- package/src/aldehyde/controls/file-view/drawer-file-view.tsx +117 -117
- package/src/aldehyde/controls/file-view/index.less +9 -9
- package/src/aldehyde/controls/file-view/index.tsx +148 -148
- package/src/aldehyde/controls/file-view/multi-file-view.tsx +39 -39
- package/src/aldehyde/controls/file-view/newin-file-view.tsx +40 -40
- package/src/aldehyde/controls/html-editor/draft.tsx +136 -136
- package/src/aldehyde/controls/html-editor/index.less +67 -67
- package/src/aldehyde/controls/icon-selector/app-icon-selector.tsx +68 -68
- package/src/aldehyde/controls/icon-selector/icon/aldehyde-menu-icon/iconfont.css +147 -147
- package/src/aldehyde/controls/icon-selector/icon/aldehyde-menu-icon/iconfont.json +240 -240
- package/src/aldehyde/controls/icon-selector/pc-icon-selector.tsx +68 -68
- package/src/aldehyde/controls/input-number/index.tsx +148 -148
- package/src/aldehyde/controls/input-range/index.tsx +59 -59
- package/src/aldehyde/controls/password-setter/index.css +2 -2
- package/src/aldehyde/controls/password-setter/index.js +88 -88
- package/src/aldehyde/controls/progress/index.tsx +74 -74
- package/src/aldehyde/controls/qr-code/index.less +28 -28
- package/src/aldehyde/controls/qr-code/index.tsx +40 -40
- package/src/aldehyde/controls/relation-existion/index.css +3 -3
- package/src/aldehyde/controls/relation-existion/index.tsx +144 -144
- package/src/aldehyde/controls/rfield/index.css +4 -4
- package/src/aldehyde/controls/rfield/index.tsx +225 -225
- package/src/aldehyde/controls/select/index.tsx +216 -216
- package/src/aldehyde/controls/signature/index.tsx +226 -226
- package/src/aldehyde/controls/single-checkbox/index.tsx +18 -18
- package/src/aldehyde/controls/steps/index.tsx +59 -59
- package/src/aldehyde/controls/text/ellipsis-text.tsx +98 -98
- package/src/aldehyde/controls/text/index.less +7 -7
- package/src/aldehyde/controls/tree-select/navigation-tree.tsx +122 -122
- package/src/aldehyde/controls/tree-select/tree-entity-select.tsx +121 -121
- package/src/aldehyde/controls/upload/index.tsx +128 -128
- package/src/aldehyde/controls/upload/mult-file-upload.tsx +240 -240
- package/src/aldehyde/controls/view-control.tsx +289 -289
- package/src/aldehyde/custom-page/custom-detail-modal-page.tsx +69 -69
- package/src/aldehyde/custom-page/custom-page-router.tsx +64 -64
- package/src/aldehyde/custom-page/def-custom-page.tsx +17 -17
- package/src/aldehyde/custom-page/dtmpl-custom-edit-modal-page.tsx +88 -88
- package/src/aldehyde/detail/button/bottom-submit-button-bar.tsx +91 -91
- package/src/aldehyde/detail/button/cquery-button-bar.tsx +144 -144
- package/src/aldehyde/detail/button/edit-button.tsx +61 -61
- package/src/aldehyde/detail/button/fix-right-submit-button-bar.tsx +186 -186
- package/src/aldehyde/detail/button/index.css +42 -42
- package/src/aldehyde/detail/button/inline-edit-button.tsx +40 -40
- package/src/aldehyde/detail/button/submit-button-bar.tsx +57 -57
- package/src/aldehyde/detail/button/view-button.tsx +64 -64
- package/src/aldehyde/detail/dtmpl.css +67 -67
- package/src/aldehyde/detail/edit/dtmpl-edit.tsx +279 -279
- package/src/aldehyde/detail/edit/fields-edit-card.tsx +145 -145
- package/src/aldehyde/detail/edit/modal-row-edit.tsx +95 -95
- package/src/aldehyde/detail/edit/popover-edit-card.tsx +167 -167
- package/src/aldehyde/detail/edit/popover-editor.tsx +70 -70
- package/src/aldehyde/detail/edit/post-result/index.tsx +86 -86
- package/src/aldehyde/detail/rightbar/index.css +34 -34
- package/src/aldehyde/detail/rightbar/index.tsx +92 -92
- package/src/aldehyde/detail/tooltipbar/index.tsx +32 -32
- package/src/aldehyde/detail/view/act-dtmpl-view.tsx +288 -288
- package/src/aldehyde/detail/view/dtmpl-view.tsx +314 -314
- package/src/aldehyde/detail/view/field-view-group.tsx +88 -88
- package/src/aldehyde/detail/view/modal-dtmpl-view.tsx +73 -73
- package/src/aldehyde/detail/view/snapshot-timeline.tsx +231 -231
- package/src/aldehyde/detail/view/tab-act-dtmpl-view.tsx +304 -304
- package/src/aldehyde/detail/view/view-compare-panel.tsx +57 -57
- package/src/aldehyde/draw-canvas-edit/components/render/components/index.ts +3 -0
- package/src/aldehyde/draw-canvas-edit/components/render/components/workstation-component.tsx +104 -0
- package/src/aldehyde/draw-canvas-edit/components/render/draws/bg-draw.ts +176 -176
- package/src/aldehyde/draw-canvas-edit/components/render/draws/contextmenu-draw.ts +329 -329
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/bezier.ts +542 -542
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/drag-outside-handlers.ts +72 -72
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/selection-handlers.ts +396 -396
- package/src/aldehyde/draw-canvas-edit/components/render/index.ts +808 -808
- package/src/aldehyde/draw-canvas-edit/components/render/tools/attract-tool.ts +457 -457
- package/src/aldehyde/draw-canvas-edit/components/render/tools/component-factory.ts +270 -302
- package/src/aldehyde/draw-canvas-edit/components/render/tools/copy-tool.ts +244 -244
- package/src/aldehyde/draw-canvas-edit/components/render/tools/import-export-tool.ts +576 -576
- package/src/aldehyde/draw-canvas-edit/components/render/tools/index.ts +10 -10
- package/src/aldehyde/draw-canvas-edit/components/render/tools/position-tool.ts +191 -191
- package/src/aldehyde/draw-canvas-edit/components/render/tools/selection-tool.ts +140 -140
- package/src/aldehyde/draw-canvas-edit/components/render/types.ts +294 -291
- package/src/aldehyde/draw-canvas-edit/components/setting-form/index.tsx +291 -291
- package/src/aldehyde/draw-canvas-edit/constant.ts +5 -5
- package/src/aldehyde/draw-canvas-edit/index.less +48 -48
- package/src/aldehyde/draw-canvas-edit/index.tsx +201 -201
- package/src/aldehyde/draw-canvas-view/index.less +59 -59
- package/src/aldehyde/draw-canvas-view/index.tsx +49 -49
- package/src/aldehyde/draw-canvas-view/view.tsx +17 -5
- package/src/aldehyde/export/export-frame.css +2 -2
- package/src/aldehyde/export/export-frame.tsx +301 -301
- package/src/aldehyde/export/select-code-export-frame.tsx +212 -212
- package/src/aldehyde/form/criteria-form.tsx +604 -604
- package/src/aldehyde/form/dtmpl-form.css +3 -3
- package/src/aldehyde/form/dtmpl-form.tsx +552 -552
- package/src/aldehyde/form/field-group-form.tsx +102 -102
- package/src/aldehyde/form/fields-form.tsx +45 -45
- package/src/aldehyde/form/form-Item-group.tsx +245 -245
- package/src/aldehyde/form/index.css +12 -12
- package/src/aldehyde/hooks/use-match-route/index.tsx +62 -62
- package/src/aldehyde/hooks/use-tabs/index.tsx +139 -139
- package/src/aldehyde/hooks/useVarCssColor.ts +6 -6
- package/src/aldehyde/icon/aliIcon.tsx +9 -9
- package/src/aldehyde/icon/index.tsx +28 -28
- package/src/aldehyde/import/excel-import.tsx +450 -450
- package/src/aldehyde/import/index.css +53 -53
- package/src/aldehyde/import/template.css +50 -50
- package/src/aldehyde/index.tsx +220 -220
- package/src/aldehyde/layout/MainPage.tsx +334 -334
- package/src/aldehyde/layout/common.css +64 -64
- package/src/aldehyde/layout/coverstyle.css +51 -51
- package/src/aldehyde/layout/footer/index.css +5 -5
- package/src/aldehyde/layout/footer/index.js +17 -17
- package/src/aldehyde/layout/header/index.css +122 -122
- package/src/aldehyde/layout/header/index.tsx +152 -152
- package/src/aldehyde/layout/menu/block.css +7 -7
- package/src/aldehyde/layout/menu/block.tsx +174 -174
- package/src/aldehyde/layout/menu/l2menu-message-bar.tsx +160 -160
- package/src/aldehyde/layout/menu/l2menu-quick-bar.tsx +175 -175
- package/src/aldehyde/layout/menu/menu-2layers.tsx +117 -117
- package/src/aldehyde/layout/menu/menu-render.tsx +168 -168
- package/src/aldehyde/layout/menu/message-bar.less +73 -73
- package/src/aldehyde/layout/menu/reset-password.tsx +255 -255
- package/src/aldehyde/layout/menu/user-bar.tsx +259 -259
- package/src/aldehyde/layout/menu/userinfo-bar.tsx +69 -69
- package/src/aldehyde/layout/sidebar/index.css +57 -57
- package/src/aldehyde/layout/sidebar/index.tsx +84 -84
- package/src/aldehyde/layout2/components/icon-font.tsx +7 -7
- package/src/aldehyde/layout2/components/screenfull-button.tsx +21 -21
- package/src/aldehyde/layout2/components/search-menu.tsx +85 -85
- package/src/aldehyde/layout2/components/system-messages.tsx +75 -75
- package/src/aldehyde/layout2/components/theme-button.tsx +65 -65
- package/src/aldehyde/layout2/components/user-button.tsx +258 -258
- package/src/aldehyde/layout2/components/user-notification.tsx +74 -74
- package/src/aldehyde/layout2/css/header.css +41 -41
- package/src/aldehyde/layout2/css/sider.less +17 -17
- package/src/aldehyde/layout2/css/tabs-layout.less +18 -18
- package/src/aldehyde/layout2/header.tsx +278 -278
- package/src/aldehyde/layout2/layout-context.tsx +95 -95
- package/src/aldehyde/layout2/main.tsx +30 -30
- package/src/aldehyde/layout2/page.tsx +315 -315
- package/src/aldehyde/layout2/sider.tsx +230 -230
- package/src/aldehyde/layout2/tabs/tabs-context.tsx +37 -37
- package/src/aldehyde/layout2/tabs/tabs-layout.tsx +146 -146
- package/src/aldehyde/layout2/type/layout-type.ts +15 -15
- package/src/aldehyde/layout2/util/menu-util.tsx +125 -125
- package/src/aldehyde/layout3/components/tabs-layout.tsx +110 -110
- package/src/aldehyde/layout3/components/time.tsx +25 -25
- package/src/aldehyde/layout3/css/header.less +195 -195
- package/src/aldehyde/layout3/css/main.less +161 -161
- package/src/aldehyde/layout3/css/sider.less +32 -32
- package/src/aldehyde/layout3/css/tabs-layout.less +38 -38
- package/src/aldehyde/layout3/header.tsx +187 -187
- package/src/aldehyde/layout3/main.tsx +29 -29
- package/src/aldehyde/layout3/page.tsx +110 -110
- package/src/aldehyde/layout3/sider.tsx +198 -198
- package/src/aldehyde/layout4/components/tabs-layout.tsx +110 -110
- package/src/aldehyde/layout4/css/header.less +196 -196
- package/src/aldehyde/layout4/css/main.less +154 -154
- package/src/aldehyde/layout4/css/sider.less +37 -37
- package/src/aldehyde/layout4/css/tabs-layout.less +42 -42
- package/src/aldehyde/layout4/header.tsx +190 -190
- package/src/aldehyde/layout4/main.tsx +29 -29
- package/src/aldehyde/layout4/page.tsx +125 -125
- package/src/aldehyde/layout4/sider.tsx +201 -201
- package/src/aldehyde/layout5/css/header.less +35 -35
- package/src/aldehyde/layout5/css/sider.less +18 -18
- package/src/aldehyde/layout5/header.tsx +204 -204
- package/src/aldehyde/layout5/page.tsx +107 -107
- package/src/aldehyde/layout5/sider.tsx +235 -235
- package/src/aldehyde/list/calendar/index.less +20 -20
- package/src/aldehyde/list/calendar/index.tsx +157 -157
- package/src/aldehyde/list/card-list/card-list-item.tsx +111 -111
- package/src/aldehyde/list/card-list/index.less +154 -154
- package/src/aldehyde/list/card-list/index.tsx +83 -83
- package/src/aldehyde/list/gantt/index.less +8 -8
- package/src/aldehyde/list/gantt/index.tsx +508 -508
- package/src/aldehyde/list/vertical-list/index.less +208 -208
- package/src/aldehyde/list/vertical-list/index.tsx +55 -55
- package/src/aldehyde/list/vertical-list/item.tsx +136 -136
- package/src/aldehyde/locale/LocaleButton.tsx +48 -48
- package/src/aldehyde/locale/LocaleProvider.tsx +265 -265
- package/src/aldehyde/locale/langMp.ts +45 -45
- package/src/aldehyde/locale/translate.ts +80 -80
- package/src/aldehyde/locale/useLocale.ts +72 -72
- package/src/aldehyde/login/context-setter.tsx +130 -130
- package/src/aldehyde/login/index.css +19 -19
- package/src/aldehyde/login/login.tsx +255 -255
- package/src/aldehyde/login/router-login.tsx +107 -107
- package/src/aldehyde/login/vertify/index.css +143 -143
- package/src/aldehyde/login/vertify/index.tsx +360 -360
- package/src/aldehyde/login/vertify/tool.ts +13 -13
- package/src/aldehyde/login2/login-page.tsx +92 -92
- package/src/aldehyde/login2/login.tsx +226 -226
- package/src/aldehyde/login3/index.less +136 -136
- package/src/aldehyde/login3/login-page.tsx +71 -71
- package/src/aldehyde/lowcode-components/act-table/index.less +26 -26
- package/src/aldehyde/lowcode-components/act-table/index.tsx +139 -139
- package/src/aldehyde/lowcode-components/assets/lowcode-constant.tsx +12 -12
- package/src/aldehyde/lowcode-components/bar-chart/index.tsx +268 -268
- package/src/aldehyde/lowcode-components/base-button/index.less +7 -7
- package/src/aldehyde/lowcode-components/base-button/index.tsx +197 -197
- package/src/aldehyde/lowcode-components/base-image/index.tsx +220 -220
- package/src/aldehyde/lowcode-components/base-map/index.tsx +292 -292
- package/src/aldehyde/lowcode-components/base-radio/index.less +23 -23
- package/src/aldehyde/lowcode-components/base-radio/index.tsx +157 -157
- package/src/aldehyde/lowcode-components/base-table/index.tsx +268 -268
- package/src/aldehyde/lowcode-components/base-tabs/index.less +14 -14
- package/src/aldehyde/lowcode-components/base-tabs/index.tsx +183 -183
- package/src/aldehyde/lowcode-components/base-text/index.tsx +58 -58
- package/src/aldehyde/lowcode-components/border/border1/index.tsx +70 -70
- package/src/aldehyde/lowcode-components/border/border10/index.less +26 -26
- package/src/aldehyde/lowcode-components/border/border10/index.tsx +45 -45
- package/src/aldehyde/lowcode-components/border/border11/index.less +17 -17
- package/src/aldehyde/lowcode-components/border/border11/index.tsx +232 -232
- package/src/aldehyde/lowcode-components/border/border12/index.less +13 -13
- package/src/aldehyde/lowcode-components/border/border12/index.tsx +115 -115
- package/src/aldehyde/lowcode-components/border/border13/index.less +13 -13
- package/src/aldehyde/lowcode-components/border/border13/index.tsx +69 -69
- package/src/aldehyde/lowcode-components/border/border2/index.less +17 -17
- package/src/aldehyde/lowcode-components/border/border2/index.tsx +51 -51
- package/src/aldehyde/lowcode-components/border/border3/index.less +25 -25
- package/src/aldehyde/lowcode-components/border/border3/index.tsx +61 -61
- package/src/aldehyde/lowcode-components/border/border4/index.less +72 -72
- package/src/aldehyde/lowcode-components/border/border4/index.tsx +79 -79
- package/src/aldehyde/lowcode-components/border/border5/index.less +35 -35
- package/src/aldehyde/lowcode-components/border/border5/index.tsx +75 -75
- package/src/aldehyde/lowcode-components/border/border6/index.less +17 -17
- package/src/aldehyde/lowcode-components/border/border6/index.tsx +60 -60
- package/src/aldehyde/lowcode-components/border/border7/index.less +26 -26
- package/src/aldehyde/lowcode-components/border/border7/index.tsx +75 -75
- package/src/aldehyde/lowcode-components/border/border8/index.less +13 -13
- package/src/aldehyde/lowcode-components/border/border8/index.tsx +84 -84
- package/src/aldehyde/lowcode-components/border/border9/index.less +13 -13
- package/src/aldehyde/lowcode-components/border/border9/index.tsx +154 -154
- package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +290 -290
- package/src/aldehyde/lowcode-components/carousel/index.tsx +218 -218
- package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +263 -263
- package/src/aldehyde/lowcode-components/column-3d-chart/index.tsx +438 -438
- package/src/aldehyde/lowcode-components/column-chart/index.tsx +293 -293
- package/src/aldehyde/lowcode-components/data-number/index.tsx +219 -219
- package/src/aldehyde/lowcode-components/data.d.ts +18 -18
- package/src/aldehyde/lowcode-components/decoration/decoration1/index.less +7 -7
- package/src/aldehyde/lowcode-components/decoration/decoration1/index.tsx +153 -153
- package/src/aldehyde/lowcode-components/decoration/decoration10/index.less +5 -5
- package/src/aldehyde/lowcode-components/decoration/decoration10/index.tsx +89 -89
- package/src/aldehyde/lowcode-components/decoration/decoration11/index.less +5 -5
- package/src/aldehyde/lowcode-components/decoration/decoration11/index.tsx +133 -133
- package/src/aldehyde/lowcode-components/decoration/decoration2/index.less +6 -6
- package/src/aldehyde/lowcode-components/decoration/decoration2/index.tsx +61 -61
- package/src/aldehyde/lowcode-components/decoration/decoration3/index.less +7 -7
- package/src/aldehyde/lowcode-components/decoration/decoration3/index.tsx +87 -87
- package/src/aldehyde/lowcode-components/decoration/decoration4/index.less +29 -29
- package/src/aldehyde/lowcode-components/decoration/decoration4/index.tsx +53 -53
- package/src/aldehyde/lowcode-components/decoration/decoration5/index.less +3 -3
- package/src/aldehyde/lowcode-components/decoration/decoration5/index.tsx +116 -116
- package/src/aldehyde/lowcode-components/decoration/decoration6/index.less +7 -7
- package/src/aldehyde/lowcode-components/decoration/decoration6/index.tsx +121 -121
- package/src/aldehyde/lowcode-components/decoration/decoration7/index.less +4 -4
- package/src/aldehyde/lowcode-components/decoration/decoration7/index.tsx +70 -70
- package/src/aldehyde/lowcode-components/decoration/decoration8/index.less +14 -14
- package/src/aldehyde/lowcode-components/decoration/decoration8/index.tsx +122 -122
- package/src/aldehyde/lowcode-components/decoration/decoration9/index.less +4 -4
- package/src/aldehyde/lowcode-components/decoration/decoration9/index.tsx +196 -196
- package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +315 -315
- package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +419 -419
- package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +254 -254
- package/src/aldehyde/lowcode-components/index.ts +130 -130
- package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +300 -300
- package/src/aldehyde/lowcode-components/line-chart/index.tsx +290 -290
- package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +250 -250
- package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +478 -478
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-controller.ts +153 -153
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-definition.ts +23 -23
- package/src/aldehyde/lowcode-components/lowcode-view/component/loading.tsx +20 -20
- package/src/aldehyde/lowcode-components/lowcode-view/component/util.ts +27 -27
- package/src/aldehyde/lowcode-components/lowcode-view/index.less +19 -19
- package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +277 -277
- package/src/aldehyde/lowcode-components/lowcode-view/interface.ts +189 -189
- package/src/aldehyde/lowcode-components/pie-chart/index.tsx +349 -349
- package/src/aldehyde/lowcode-components/progress-chart/index.tsx +295 -295
- package/src/aldehyde/lowcode-components/radar-chart/index.tsx +322 -322
- package/src/aldehyde/lowcode-components/search-form/index.less +25 -25
- package/src/aldehyde/lowcode-components/search-form/index.tsx +121 -121
- package/src/aldehyde/lowcode-components/stroke-animation/index.tsx +219 -219
- package/src/aldehyde/module/block-menu-tree-drawer.tsx +118 -118
- package/src/aldehyde/module/criteria-page.tsx1 +175 -175
- package/src/aldehyde/module/draggable-modal.tsx +66 -66
- package/src/aldehyde/module/dtmpl-edit-card.tsx +437 -437
- package/src/aldehyde/module/dtmpl-edit-drawer.tsx +23 -23
- package/src/aldehyde/module/dtmpl-edit-modal.tsx +25 -25
- package/src/aldehyde/module/dtmpl-edit-page.tsx +558 -558
- package/src/aldehyde/module/dtmpl-editor.tsx +165 -165
- package/src/aldehyde/module/dtmpl-view-card.tsx +64 -64
- package/src/aldehyde/module/dtmpl-view-drawer.tsx +71 -71
- package/src/aldehyde/module/dtmpl-view-modal.tsx +56 -56
- package/src/aldehyde/module/embed-dtmpl-edit-page.tsx +137 -137
- package/src/aldehyde/module/index.less +4 -4
- package/src/aldehyde/module/ltmpl-drawer.tsx +60 -60
- package/src/aldehyde/module/ltmpl-modal.tsx +63 -63
- package/src/aldehyde/module/ltmpl-table.tsx +378 -378
- package/src/aldehyde/module/ttmpl-tree.tsx +47 -47
- package/src/aldehyde/routable/dtmpl-route.tsx +173 -173
- package/src/aldehyde/routable/import-route.tsx +35 -35
- package/src/aldehyde/routable/index.less +25 -25
- package/src/aldehyde/routable/ltmpl-route.tsx +539 -539
- package/src/aldehyde/routable/splitview-ltmpl-route.tsx +377 -377
- package/src/aldehyde/routable/ttmpl-route.tsx +93 -93
- package/src/aldehyde/routable/withroute.tsx +36 -36
- package/src/aldehyde/sso-Login/index.tsx +73 -73
- package/src/aldehyde/sso-Login/service/index.js +16 -16
- package/src/aldehyde/sso-Login/service/login.js +75 -75
- package/src/aldehyde/table/act-table.tsx +1831 -1831
- package/src/aldehyde/table/column/column-builder.tsx +864 -864
- package/src/aldehyde/table/column/column-selector.tsx +130 -130
- package/src/aldehyde/table/column/index.less +63 -63
- package/src/aldehyde/table/column/summary-builder.tsx +712 -712
- package/src/aldehyde/table/column/theme-color-getter.tsx +25 -25
- package/src/aldehyde/table/control-table-x-axis-wrapper.tsx +80 -80
- package/src/aldehyde/table/index.css +211 -211
- package/src/aldehyde/table/l2-act-table.tsx +91 -91
- package/src/aldehyde/table/modal-select-table.tsx +308 -308
- package/src/aldehyde/table/page-config-button.tsx +203 -203
- package/src/aldehyde/table/pagination.css +14 -14
- package/src/aldehyde/table/pagination.tsx +81 -81
- package/src/aldehyde/table/query-table.tsx +658 -658
- package/src/aldehyde/table/relation-table.tsx +1093 -1093
- package/src/aldehyde/table/report-table.tsx +125 -125
- package/src/aldehyde/table/resizable-table.tsx +97 -97
- package/src/aldehyde/table/select-table.tsx +559 -548
- package/src/aldehyde/table/selected-rows-card.tsx +78 -78
- package/src/aldehyde/table/stat/restat.tsx +122 -122
- package/src/aldehyde/table/table-util.tsx +25 -25
- package/src/aldehyde/tmpl/control-type-supportor.tsx +154 -154
- package/src/aldehyde/tmpl/hc-data-source.tsx +566 -566
- package/src/aldehyde/tmpl/hcservice-v3.tsx +1590 -1590
- package/src/aldehyde/tmpl/interface.tsx +919 -919
- package/src/aldehyde/tmpl/model-struc-v3.tsx +111 -111
- package/src/aldehyde/tmpl/superagent.js +146 -146
- package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +585 -585
- package/src/aldehyde/tmpl/web-socket.ts +366 -366
- package/src/aldehyde/tree/act-tree.tsx +217 -217
- package/src/aldehyde/tree/block-menu-auth-tree.tsx +189 -189
- package/src/aldehyde/tree/index.css +22 -22
- package/src/aldehyde/tree/navigation-tree.tsx +39 -39
- package/src/aldehyde/tree/tmpl-tree.tsx +751 -751
- package/src/aldehyde/tree/tree-node.tsx +73 -73
- package/src/aldehyde/tree/tree-utils.tsx +317 -317
- package/src/aldehyde/units/EncryptUtils.js +37 -37
- package/src/aldehyde/units/image.d.ts +7 -7
- package/src/aldehyde/units/index.tsx +1367 -1367
- package/src/aldehyde/units/storage.js +2 -2
- package/src/aldehyde/utils/dsu.ts +27 -27
- package/src/aldehyde/welcome/HCWelcome.js +404 -404
- package/src/aldehyde/welcome/HCWelcome1.js +259 -259
- package/src/aldehyde/welcome/components/menu-card.less +96 -96
- package/src/aldehyde/welcome/components/menu-card.tsx +70 -70
- package/src/aldehyde/welcome/components/page-card.less +49 -49
- package/src/aldehyde/welcome/components/page-card.tsx +97 -97
- package/src/aldehyde/welcome/components/quick-entrance.less +120 -120
- package/src/aldehyde/welcome/components/quick-entrance.tsx +80 -80
- package/src/aldehyde/welcome/components/user-menus.less +192 -192
- package/src/aldehyde/welcome/components/user-menus.tsx +279 -279
- package/src/aldehyde/welcome/components/workbench.less +118 -118
- package/src/aldehyde/welcome/components/workbench.tsx +146 -146
- 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
|
}
|