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,751 +1,751 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
Button,
|
|
4
|
-
Card,
|
|
5
|
-
Col,
|
|
6
|
-
Input,
|
|
7
|
-
Popconfirm,
|
|
8
|
-
Popover,
|
|
9
|
-
Row,
|
|
10
|
-
Space,
|
|
11
|
-
Tag,
|
|
12
|
-
Tooltip,
|
|
13
|
-
Tree,
|
|
14
|
-
} from "antd";
|
|
15
|
-
import {
|
|
16
|
-
AlignLeftOutlined,
|
|
17
|
-
DeleteOutlined,
|
|
18
|
-
EditOutlined,
|
|
19
|
-
PlusOutlined,
|
|
20
|
-
PlusSquareOutlined,
|
|
21
|
-
ReloadOutlined, SyncOutlined,
|
|
22
|
-
} from "@ant-design/icons";
|
|
23
|
-
|
|
24
|
-
import Scrollbars from "react-custom-scrollbars";
|
|
25
|
-
import { HydrocarbonService } from "../index";
|
|
26
|
-
import TreeUtils, { TtmplNodeConfig } from "./tree-utils";
|
|
27
|
-
import { TreeDataNode } from "./tree-utils";
|
|
28
|
-
import { LocaleContext } from "../locale/LocaleProvider";
|
|
29
|
-
|
|
30
|
-
// 查找第一个叶子节点,用于默认选中使用;存在code,则查找等于code的节点
|
|
31
|
-
const findFirstLeaf = (tree, code?: string) => {
|
|
32
|
-
if (!Array.isArray(tree)) return null;
|
|
33
|
-
const dfs = (nodes) => {
|
|
34
|
-
for (const node of nodes) {
|
|
35
|
-
if (code ? node?.code === code : node?.isLeaf === true) {
|
|
36
|
-
return node;
|
|
37
|
-
}
|
|
38
|
-
if (Array.isArray(node?.children)) {
|
|
39
|
-
const found = dfs(node.children);
|
|
40
|
-
if (found) return found;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
return dfs(tree);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface TmplTreeProps {
|
|
49
|
-
showFilterInput?: boolean;
|
|
50
|
-
ttmplNodeConfig: TtmplNodeConfig;
|
|
51
|
-
checkable: boolean,
|
|
52
|
-
onChangeCheck?: (checkCodes: string[]) => any,
|
|
53
|
-
currentId?: string,
|
|
54
|
-
checkedCodes?: string[],
|
|
55
|
-
doEditSub?: (
|
|
56
|
-
title: string,
|
|
57
|
-
ratmplId: string,
|
|
58
|
-
mainCode: string,
|
|
59
|
-
code?: string
|
|
60
|
-
) => void;
|
|
61
|
-
doViewSub?: (
|
|
62
|
-
title: string,
|
|
63
|
-
ratmplId: string,
|
|
64
|
-
mainCode: string,
|
|
65
|
-
code?: string
|
|
66
|
-
) => void;
|
|
67
|
-
doEditRoot?: (title: string, code?: string) => void;
|
|
68
|
-
doViewRoot?: (title: string, code?: string) => void;
|
|
69
|
-
doDelete?: (ratmplId: string, code?: string) => void;
|
|
70
|
-
doAddSub?: (
|
|
71
|
-
title: string,
|
|
72
|
-
ratmplId: string,
|
|
73
|
-
mainCode: string,
|
|
74
|
-
addTmplId: string
|
|
75
|
-
) => void;
|
|
76
|
-
onClickNode?: (dataNode: TreeDataNode) => void;
|
|
77
|
-
defExpandedRoot?: boolean; // 默认展开根节点
|
|
78
|
-
defSelect?: boolean; // 默认选中节点
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
interface TmplTreeState {
|
|
82
|
-
data?: TreeDataNode[];
|
|
83
|
-
expandedKeys?: string[];
|
|
84
|
-
loadedKeys?: string[];
|
|
85
|
-
loading?: boolean;
|
|
86
|
-
drawMainCode?: string;
|
|
87
|
-
// currentEditKey?: string;
|
|
88
|
-
parentNodeData?: TreeDataNode;
|
|
89
|
-
currentNodeData?: TreeDataNode;
|
|
90
|
-
rootAddable?: boolean;
|
|
91
|
-
searchValue?: string;
|
|
92
|
-
checkedKeys?: string[];
|
|
93
|
-
nodeClickLoading?: boolean;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
97
|
-
state = {
|
|
98
|
-
data: [],
|
|
99
|
-
expandedKeys: [],
|
|
100
|
-
loadedKeys: [],
|
|
101
|
-
loading: false,
|
|
102
|
-
parentNodeData: undefined,
|
|
103
|
-
currentNodeData: undefined,
|
|
104
|
-
rootAddable: false,
|
|
105
|
-
searchValue: undefined,
|
|
106
|
-
checkedKeys: undefined,
|
|
107
|
-
nodeClickLoading: false,
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
static defaultProps = {
|
|
112
|
-
draggable: false,
|
|
113
|
-
readOnly: false,
|
|
114
|
-
checkable: true,
|
|
115
|
-
showFilterInput: true,
|
|
116
|
-
defExpandedRoot: false,
|
|
117
|
-
defSelect: false,
|
|
118
|
-
};
|
|
119
|
-
static contextType = LocaleContext;
|
|
120
|
-
context: React.ContextType<typeof LocaleContext>;
|
|
121
|
-
|
|
122
|
-
reloadData = async (mainCode, currentCode?: string) => {
|
|
123
|
-
let { ttmplNodeConfig } = this.props;
|
|
124
|
-
const { data, expandedKeys } = this.state;
|
|
125
|
-
let v = await TreeUtils.reloadData(mainCode, ttmplNodeConfig, data, expandedKeys);
|
|
126
|
-
this.setState({ ...v });
|
|
127
|
-
if (currentCode) {
|
|
128
|
-
const current = TreeUtils.getNodesOfArrayNode(v.data, [currentCode])?.[0];
|
|
129
|
-
this.onClickNode(current || v.data[0]);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
doDelete = async (node: TreeDataNode) => {
|
|
135
|
-
let { ttmplNodeConfig } = this.props;
|
|
136
|
-
const { data, expandedKeys } = this.state;
|
|
137
|
-
let sourceId;
|
|
138
|
-
if (node.isLeaf) {
|
|
139
|
-
sourceId = ttmplNodeConfig.leafRatmplId;
|
|
140
|
-
} else {
|
|
141
|
-
sourceId = ttmplNodeConfig.branchRatmplId ? ttmplNodeConfig.branchRatmplId : ttmplNodeConfig.rootLTmplConfig;
|
|
142
|
-
}
|
|
143
|
-
let res = await HydrocarbonService.deleteByCode(null, sourceId, [
|
|
144
|
-
node.code,
|
|
145
|
-
]);
|
|
146
|
-
if (node.parent) {
|
|
147
|
-
let v = await TreeUtils.reloadData(node.parent.code, ttmplNodeConfig, data, expandedKeys);
|
|
148
|
-
this.setState({ ...v });
|
|
149
|
-
this.onClickNode(node.parent);
|
|
150
|
-
} else {
|
|
151
|
-
let v = await TreeUtils.reloadData(null, ttmplNodeConfig, data, expandedKeys);
|
|
152
|
-
this.setState({ ...v });
|
|
153
|
-
this.onClickNode(v.data[0]);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
async componentDidMount() {
|
|
158
|
-
await this.refresh();
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
async componentDidUpdate(prevProps) {
|
|
162
|
-
let { ttmplNodeConfig: preTtmplNodeConfig } = prevProps;
|
|
163
|
-
let { ttmplNodeConfig, currentId } = this.props;
|
|
164
|
-
|
|
165
|
-
if (
|
|
166
|
-
!ttmplNodeConfig ||
|
|
167
|
-
(preTtmplNodeConfig && ttmplNodeConfig.id == preTtmplNodeConfig.id)
|
|
168
|
-
) {
|
|
169
|
-
if (currentId && (prevProps?.currentId !== currentId)) {
|
|
170
|
-
const curNode = findFirstLeaf(this.state.data, currentId);
|
|
171
|
-
if (curNode) this.onClickNode(curNode);
|
|
172
|
-
}
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
await this.refresh();
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
async refresh() {
|
|
179
|
-
const { ttmplNodeConfig, defExpandedRoot, defSelect, currentId } = this.props;
|
|
180
|
-
if (!ttmplNodeConfig) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
this.setState({
|
|
184
|
-
loading: true,
|
|
185
|
-
});
|
|
186
|
-
//let loadedKeys = [];
|
|
187
|
-
let data = await TreeUtils.loadRootNodeData(ttmplNodeConfig);
|
|
188
|
-
this.setState({
|
|
189
|
-
searchValue: null,
|
|
190
|
-
data,
|
|
191
|
-
rootAddable:
|
|
192
|
-
ttmplNodeConfig.rootLTmplConfig?.buttons?.indexOf("dtmplAdd") > 0,
|
|
193
|
-
loading: false,
|
|
194
|
-
expandedKeys: []
|
|
195
|
-
}, async () => { // 页面闪烁异常处理,更新后立即使用state
|
|
196
|
-
if (defExpandedRoot) { // 默认展开所有根节点
|
|
197
|
-
const temData = this.state.data;
|
|
198
|
-
const temExpandedKeys = temData.map(r => r.key);
|
|
199
|
-
for (let index = 0; index < temData.length; index++) {
|
|
200
|
-
const r = temData[index];
|
|
201
|
-
await this.onExpand(temExpandedKeys, { expanded: true, node: r });
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
if (defSelect && !this.state.currentNodeData && !currentId) { // 是否默认选中
|
|
205
|
-
const leafNode = findFirstLeaf(this.state.data);
|
|
206
|
-
if (leafNode) this.onClickNode(leafNode, false);
|
|
207
|
-
}
|
|
208
|
-
if (currentId) { // 指定默认选中项
|
|
209
|
-
const curNode = findFirstLeaf(this.state.data, currentId);
|
|
210
|
-
if (curNode) this.onClickNode(curNode, false);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// loadRootNodeData = async () => {
|
|
216
|
-
// const { ttmplNodeConfig } = this.props;
|
|
217
|
-
// let data = await TreeUtils.loadRootNodeData(ttmplNodeConfig);
|
|
218
|
-
// return data;
|
|
219
|
-
// };
|
|
220
|
-
|
|
221
|
-
async componentWillUnmount() { }
|
|
222
|
-
|
|
223
|
-
onExpand = async (
|
|
224
|
-
expandedKeys,
|
|
225
|
-
current: { expanded: boolean; node: TreeDataNode }
|
|
226
|
-
) => {
|
|
227
|
-
const { ttmplNodeConfig } = this.props;
|
|
228
|
-
const { data } = this.state;
|
|
229
|
-
if (current.expanded) {
|
|
230
|
-
await TreeUtils.pushSameCodeNodeData([current.node], ttmplNodeConfig);
|
|
231
|
-
}
|
|
232
|
-
this.setState({
|
|
233
|
-
data: [...data],
|
|
234
|
-
expandedKeys,
|
|
235
|
-
});
|
|
236
|
-
};
|
|
237
|
-
serial_number = new Date().getTime();
|
|
238
|
-
|
|
239
|
-
// throttle是否节流
|
|
240
|
-
onClickNode = (dataNode: TreeDataNode, throttle = true) => {
|
|
241
|
-
const {
|
|
242
|
-
doEditRoot,
|
|
243
|
-
doViewRoot,
|
|
244
|
-
doViewSub,
|
|
245
|
-
doEditSub,
|
|
246
|
-
ttmplNodeConfig, onClickNode,
|
|
247
|
-
} = this.props;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
let new_serial_number = new Date().getTime();
|
|
251
|
-
if (!throttle || (new_serial_number - this.serial_number > 1500)) {
|
|
252
|
-
this.serial_number = new_serial_number;
|
|
253
|
-
} else {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
this.setState({ currentNodeData: dataNode, nodeClickLoading: true })
|
|
258
|
-
setTimeout(() => {
|
|
259
|
-
this.setState({ nodeClickLoading: false })
|
|
260
|
-
}, 1500)
|
|
261
|
-
if (onClickNode) {
|
|
262
|
-
onClickNode(dataNode);
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
if (dataNode.parent) {
|
|
266
|
-
//说明是sub
|
|
267
|
-
if (dataNode.isLeaf) {
|
|
268
|
-
if (ttmplNodeConfig.leafLTmplConfig.buttons.indexOf("dtmplEdit") > 0 && doEditSub) {
|
|
269
|
-
doEditSub(
|
|
270
|
-
ttmplNodeConfig.leafTitle,
|
|
271
|
-
ttmplNodeConfig.leafRatmplId,
|
|
272
|
-
dataNode.parent.code,
|
|
273
|
-
dataNode.code
|
|
274
|
-
);
|
|
275
|
-
} else if (
|
|
276
|
-
ttmplNodeConfig.leafLTmplConfig.buttons.indexOf("detail") > 0 && doViewSub
|
|
277
|
-
) {
|
|
278
|
-
doViewSub(
|
|
279
|
-
ttmplNodeConfig.leafTitle,
|
|
280
|
-
ttmplNodeConfig.leafRatmplId,
|
|
281
|
-
dataNode.parent.code,
|
|
282
|
-
dataNode.code
|
|
283
|
-
);
|
|
284
|
-
}
|
|
285
|
-
} else {
|
|
286
|
-
if (
|
|
287
|
-
ttmplNodeConfig.branchLTmplConfig.buttons.indexOf("dtmplEdit") > 0 && doEditSub
|
|
288
|
-
) {
|
|
289
|
-
doEditSub(
|
|
290
|
-
ttmplNodeConfig.branchTitle,
|
|
291
|
-
ttmplNodeConfig.branchRatmplId,
|
|
292
|
-
dataNode.parent.code,
|
|
293
|
-
dataNode.code
|
|
294
|
-
);
|
|
295
|
-
} else if (
|
|
296
|
-
ttmplNodeConfig.branchLTmplConfig.buttons.indexOf("detail") > 0 && doViewSub
|
|
297
|
-
) {
|
|
298
|
-
doViewSub(
|
|
299
|
-
ttmplNodeConfig.branchTitle,
|
|
300
|
-
ttmplNodeConfig.branchRatmplId,
|
|
301
|
-
dataNode.parent.code,
|
|
302
|
-
dataNode.code
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
} else {
|
|
307
|
-
//说明是root
|
|
308
|
-
//判断是否允许编辑
|
|
309
|
-
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("dtmplEdit") > 0 && doEditSub) {
|
|
310
|
-
doEditRoot(ttmplNodeConfig.branchTitle, dataNode.code);
|
|
311
|
-
} else if (
|
|
312
|
-
ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("detail") > 0 && doViewRoot
|
|
313
|
-
) {
|
|
314
|
-
doViewRoot(ttmplNodeConfig.branchTitle, dataNode.code);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
stopPropagation = (e) => {
|
|
321
|
-
if (e.stopPropagation) {
|
|
322
|
-
//如果提供了事件对象,则这是一个非IE浏览器
|
|
323
|
-
e.stopPropagation();
|
|
324
|
-
} else {
|
|
325
|
-
//兼容IE的方式来取消事件冒泡
|
|
326
|
-
window.event.cancelBubble = true;
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
getDeleteButton = (sourceId, node: TreeDataNode) => {
|
|
331
|
-
const { doDelete, ttmplNodeConfig } = this.props;
|
|
332
|
-
const { translate } = this.context;
|
|
333
|
-
|
|
334
|
-
return (
|
|
335
|
-
<div
|
|
336
|
-
onClick={(e) => {
|
|
337
|
-
this.stopPropagation(e);
|
|
338
|
-
}}
|
|
339
|
-
>
|
|
340
|
-
<Popconfirm
|
|
341
|
-
placement="topLeft"
|
|
342
|
-
title={translate("${确定要删除吗}?")}
|
|
343
|
-
onConfirm={async () => {
|
|
344
|
-
const { data, expandedKeys } = this.state;
|
|
345
|
-
await doDelete(sourceId, node.code);
|
|
346
|
-
if (node.parent) {
|
|
347
|
-
let v = await TreeUtils.reloadData(node.parent.code, ttmplNodeConfig, data, expandedKeys);
|
|
348
|
-
this.setState({ ...v });
|
|
349
|
-
this.onClickNode(node.parent);
|
|
350
|
-
} else {
|
|
351
|
-
const { data, expandedKeys } = this.state;
|
|
352
|
-
let v = await TreeUtils.reloadData(null, ttmplNodeConfig, data, expandedKeys);
|
|
353
|
-
this.setState({ ...v });
|
|
354
|
-
this.onClickNode(v.data[0]);
|
|
355
|
-
}
|
|
356
|
-
}}
|
|
357
|
-
okText={translate("${确定}")}
|
|
358
|
-
cancelText={translate("${取消}")}
|
|
359
|
-
>
|
|
360
|
-
<Tooltip>
|
|
361
|
-
<Button size={"small"} danger={true}>
|
|
362
|
-
<DeleteOutlined />
|
|
363
|
-
</Button>
|
|
364
|
-
</Tooltip>
|
|
365
|
-
</Popconfirm>
|
|
366
|
-
</div>
|
|
367
|
-
);
|
|
368
|
-
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
getAddButton = (
|
|
372
|
-
title: string,
|
|
373
|
-
icon: any,
|
|
374
|
-
ratmplId: string,
|
|
375
|
-
mainCode: any
|
|
376
|
-
) => {
|
|
377
|
-
const { translate } = this.context;
|
|
378
|
-
const { doAddSub } = this.props;
|
|
379
|
-
return (
|
|
380
|
-
<Button
|
|
381
|
-
onClick={(e) => {
|
|
382
|
-
this.stopPropagation(e);
|
|
383
|
-
doAddSub(title, ratmplId, mainCode, null);
|
|
384
|
-
}}
|
|
385
|
-
size={"small"}
|
|
386
|
-
>
|
|
387
|
-
{icon}
|
|
388
|
-
{translate("${" + title + "}")}
|
|
389
|
-
</Button>
|
|
390
|
-
);
|
|
391
|
-
};
|
|
392
|
-
onCheck = (checkedKeys, e) => {
|
|
393
|
-
console.log(checkedKeys);
|
|
394
|
-
console.log(e);
|
|
395
|
-
if (this.props.onChangeCheck) {
|
|
396
|
-
let checks: string[] = [];
|
|
397
|
-
if (e.checkedNodes) {
|
|
398
|
-
e.checkedNodes.forEach((c) => {
|
|
399
|
-
checks.push(c.code + "@R@" + c.title);
|
|
400
|
-
})
|
|
401
|
-
}
|
|
402
|
-
this.props.onChangeCheck(checks);
|
|
403
|
-
|
|
404
|
-
}
|
|
405
|
-
this.setState({
|
|
406
|
-
checkedKeys
|
|
407
|
-
})
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
packageTitle = (dataNode) => {
|
|
411
|
-
const {
|
|
412
|
-
doEditRoot,
|
|
413
|
-
doViewRoot,
|
|
414
|
-
doViewSub,
|
|
415
|
-
doEditSub, doDelete, doAddSub,
|
|
416
|
-
ttmplNodeConfig, currentId,
|
|
417
|
-
} = this.props;
|
|
418
|
-
const { translate } = this.context;
|
|
419
|
-
const { currentNodeData, nodeClickLoading } = this.state;
|
|
420
|
-
let buttons = [];
|
|
421
|
-
if (dataNode.parent) {
|
|
422
|
-
//说明是sub
|
|
423
|
-
if (dataNode.isLeaf) {
|
|
424
|
-
if (ttmplNodeConfig.leafLTmplConfig?.buttons.indexOf("dtmplEdit") > 0 && doEditSub) {
|
|
425
|
-
buttons.push(
|
|
426
|
-
<Button
|
|
427
|
-
onClick={(e) => {
|
|
428
|
-
this.stopPropagation(e);
|
|
429
|
-
doEditSub(
|
|
430
|
-
ttmplNodeConfig.leafTitle,
|
|
431
|
-
ttmplNodeConfig.leafRatmplId,
|
|
432
|
-
dataNode.parent.code,
|
|
433
|
-
dataNode.code
|
|
434
|
-
);
|
|
435
|
-
}}
|
|
436
|
-
size={"small"}
|
|
437
|
-
>
|
|
438
|
-
<EditOutlined />
|
|
439
|
-
{translate("${编辑}")}
|
|
440
|
-
</Button>
|
|
441
|
-
);
|
|
442
|
-
}
|
|
443
|
-
if (ttmplNodeConfig.leafLTmplConfig?.buttons.indexOf("detail") > 0 && doViewSub) {
|
|
444
|
-
buttons.push(
|
|
445
|
-
<Button
|
|
446
|
-
onClick={(e) => {
|
|
447
|
-
this.stopPropagation(e);
|
|
448
|
-
doViewSub(
|
|
449
|
-
ttmplNodeConfig.leafTitle,
|
|
450
|
-
ttmplNodeConfig.leafRatmplId,
|
|
451
|
-
dataNode.parent.code,
|
|
452
|
-
dataNode.code
|
|
453
|
-
);
|
|
454
|
-
}}
|
|
455
|
-
size={"small"}
|
|
456
|
-
>
|
|
457
|
-
<AlignLeftOutlined />
|
|
458
|
-
{translate("${查看}")}
|
|
459
|
-
</Button>
|
|
460
|
-
);
|
|
461
|
-
}
|
|
462
|
-
if (ttmplNodeConfig.leafLTmplConfig?.buttons.indexOf("singleDelete") > 0 && doDelete) {
|
|
463
|
-
buttons.push(
|
|
464
|
-
this.getDeleteButton(ttmplNodeConfig.leafRatmplId, dataNode)
|
|
465
|
-
);
|
|
466
|
-
}
|
|
467
|
-
//节点上加操作
|
|
468
|
-
// if(ttmplNodeConfig.leafLTmplConfig?.rowActions.length > 0){
|
|
469
|
-
// ttmplNodeConfig.leafLTmplConfig.rowActions.map((action) => {
|
|
470
|
-
// buttons.push(
|
|
471
|
-
// <Action
|
|
472
|
-
// serverKey={null}
|
|
473
|
-
// iconType={"icon"}
|
|
474
|
-
// key={action.id}
|
|
475
|
-
// data={[dataNode.data]}
|
|
476
|
-
// actionConfig={action}
|
|
477
|
-
// doAction={this.doRowAction}
|
|
478
|
-
// buttonSize={"small"}
|
|
479
|
-
// serial={1}
|
|
480
|
-
// ></Action>
|
|
481
|
-
// );
|
|
482
|
-
// })
|
|
483
|
-
// }
|
|
484
|
-
} else if (ttmplNodeConfig.branchLTmplConfig) {
|
|
485
|
-
if (
|
|
486
|
-
ttmplNodeConfig.branchLTmplConfig.buttons.indexOf("dtmplEdit") > 0 && doEditSub
|
|
487
|
-
) {
|
|
488
|
-
buttons.push(
|
|
489
|
-
<Button
|
|
490
|
-
onClick={(e) => {
|
|
491
|
-
this.stopPropagation(e);
|
|
492
|
-
doEditSub(
|
|
493
|
-
ttmplNodeConfig.branchTitle,
|
|
494
|
-
ttmplNodeConfig.branchRatmplId,
|
|
495
|
-
dataNode.parent.code,
|
|
496
|
-
dataNode.code
|
|
497
|
-
);
|
|
498
|
-
}}
|
|
499
|
-
size={"small"}
|
|
500
|
-
>
|
|
501
|
-
<EditOutlined />
|
|
502
|
-
{translate("${编辑}")}
|
|
503
|
-
</Button>
|
|
504
|
-
);
|
|
505
|
-
}
|
|
506
|
-
if (ttmplNodeConfig.branchLTmplConfig?.buttons.indexOf("detail") > 0 && doViewSub) {
|
|
507
|
-
buttons.push(
|
|
508
|
-
<Button
|
|
509
|
-
onClick={(e) => {
|
|
510
|
-
this.stopPropagation(e);
|
|
511
|
-
doViewSub(
|
|
512
|
-
ttmplNodeConfig.branchTitle,
|
|
513
|
-
ttmplNodeConfig.branchRatmplId,
|
|
514
|
-
dataNode.parent.code,
|
|
515
|
-
dataNode.code
|
|
516
|
-
);
|
|
517
|
-
}}
|
|
518
|
-
size={"small"}
|
|
519
|
-
>
|
|
520
|
-
<AlignLeftOutlined />
|
|
521
|
-
{translate("${查看}")}
|
|
522
|
-
</Button>
|
|
523
|
-
);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
if (
|
|
527
|
-
ttmplNodeConfig.branchLTmplConfig?.buttons.indexOf("dtmplAdd") > 0 && doAddSub
|
|
528
|
-
) {
|
|
529
|
-
buttons.push(
|
|
530
|
-
this.getAddButton(
|
|
531
|
-
ttmplNodeConfig.branchTitle,
|
|
532
|
-
<PlusSquareOutlined />,
|
|
533
|
-
ttmplNodeConfig.branchRatmplId,
|
|
534
|
-
dataNode.code
|
|
535
|
-
)
|
|
536
|
-
);
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
if (ttmplNodeConfig.leafLTmplConfig?.buttons.indexOf("dtmplAdd") > 0 && doAddSub) {
|
|
540
|
-
buttons.push(
|
|
541
|
-
this.getAddButton(
|
|
542
|
-
ttmplNodeConfig.leafTitle,
|
|
543
|
-
<PlusOutlined />,
|
|
544
|
-
ttmplNodeConfig.leafRatmplId,
|
|
545
|
-
dataNode.code
|
|
546
|
-
)
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
if (
|
|
550
|
-
ttmplNodeConfig.branchLTmplConfig?.buttons.indexOf("singleDelete") > 0 && doDelete
|
|
551
|
-
) {
|
|
552
|
-
buttons.push(
|
|
553
|
-
this.getDeleteButton(ttmplNodeConfig.branchRatmplId, dataNode)
|
|
554
|
-
);
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
} else {
|
|
558
|
-
//说明是root
|
|
559
|
-
//判断是否允许编辑
|
|
560
|
-
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("dtmplEdit") > 0 && doEditRoot) {
|
|
561
|
-
buttons.push(
|
|
562
|
-
<Button
|
|
563
|
-
onClick={(e) => {
|
|
564
|
-
this.stopPropagation(e);
|
|
565
|
-
doEditRoot(ttmplNodeConfig.branchTitle, dataNode.code);
|
|
566
|
-
}}
|
|
567
|
-
size={"small"}
|
|
568
|
-
>
|
|
569
|
-
<EditOutlined style={{ color: "var(--ant-color-primary)" }} />
|
|
570
|
-
{translate("${编辑}")}
|
|
571
|
-
</Button>
|
|
572
|
-
);
|
|
573
|
-
}
|
|
574
|
-
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("detail") > 0 && doViewRoot) {
|
|
575
|
-
buttons.push(
|
|
576
|
-
<Button
|
|
577
|
-
onClick={(e) => {
|
|
578
|
-
this.stopPropagation(e);
|
|
579
|
-
doViewRoot(ttmplNodeConfig.branchTitle, dataNode.code);
|
|
580
|
-
}}
|
|
581
|
-
size={"small"}
|
|
582
|
-
>
|
|
583
|
-
<AlignLeftOutlined />
|
|
584
|
-
{translate("${查看}")}
|
|
585
|
-
</Button>
|
|
586
|
-
);
|
|
587
|
-
}
|
|
588
|
-
//debugger
|
|
589
|
-
if (ttmplNodeConfig.branchLTmplConfig) {
|
|
590
|
-
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("dtmplAdd") > 0 && doAddSub) {
|
|
591
|
-
buttons.push(
|
|
592
|
-
this.getAddButton(
|
|
593
|
-
ttmplNodeConfig.branchTitle,
|
|
594
|
-
<PlusSquareOutlined />,
|
|
595
|
-
ttmplNodeConfig.branchRatmplId,
|
|
596
|
-
dataNode.code
|
|
597
|
-
)
|
|
598
|
-
);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
if (ttmplNodeConfig.leafLTmplConfig?.buttons.indexOf("dtmplAdd") > 0 && doAddSub) {
|
|
602
|
-
buttons.push(
|
|
603
|
-
this.getAddButton(
|
|
604
|
-
ttmplNodeConfig.leafTitle,
|
|
605
|
-
<PlusOutlined />,
|
|
606
|
-
ttmplNodeConfig.leafRatmplId,
|
|
607
|
-
dataNode.code
|
|
608
|
-
)
|
|
609
|
-
);
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("singleDelete") > 0 && doDelete) {
|
|
613
|
-
buttons.push(
|
|
614
|
-
this.getDeleteButton(ttmplNodeConfig.branchRatmplId ? ttmplNodeConfig.branchRatmplId : ttmplNodeConfig.rootGtmplId, dataNode)
|
|
615
|
-
);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
let titleNode =
|
|
620
|
-
<Tag icon={nodeClickLoading && dataNode.key == currentNodeData?.key ? <SyncOutlined spin /> : null} style={{ fontSize: '14px' }} bordered={false} color={dataNode.key == currentNodeData?.key ? "processing" : undefined} >{dataNode.title}</Tag>
|
|
621
|
-
|
|
622
|
-
if (buttons.length == 0) {
|
|
623
|
-
return titleNode;
|
|
624
|
-
} else {
|
|
625
|
-
return (
|
|
626
|
-
<Popover
|
|
627
|
-
zIndex={100}
|
|
628
|
-
content={
|
|
629
|
-
<>
|
|
630
|
-
<Space>{buttons}</Space>
|
|
631
|
-
</>
|
|
632
|
-
}
|
|
633
|
-
arrow={false}
|
|
634
|
-
>
|
|
635
|
-
{titleNode}
|
|
636
|
-
{/*<span style={{background:dataNode.key==currentNodeData?.key?"red":undefined}}>{dataNode.title }</span>*/}
|
|
637
|
-
{/*<Card styles={{body:{"padding":"0px"}}} variant={'borderless'} style={{padding:"0px",margin:'0px'}} > {dataNode.title }</Card>*/}
|
|
638
|
-
{/*{dataNode.key==currentNodeData?.key?currentNodeData.key:"2"}*/}
|
|
639
|
-
</Popover>
|
|
640
|
-
);
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
render() {
|
|
645
|
-
const { doEditRoot, ttmplNodeConfig, showFilterInput } = this.props;
|
|
646
|
-
const {
|
|
647
|
-
data,
|
|
648
|
-
loading,
|
|
649
|
-
expandedKeys,
|
|
650
|
-
rootAddable,
|
|
651
|
-
searchValue,
|
|
652
|
-
} = this.state;
|
|
653
|
-
let treeData = data;
|
|
654
|
-
const { translate } = this.context;
|
|
655
|
-
if (searchValue) {
|
|
656
|
-
treeData = TreeUtils.filterTree(data, searchValue);
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
const isAddRoot = rootAddable && doEditRoot;
|
|
660
|
-
|
|
661
|
-
return (
|
|
662
|
-
<>
|
|
663
|
-
<Row >
|
|
664
|
-
<Col span={24}>
|
|
665
|
-
<Card
|
|
666
|
-
style={{ marginBottom: 0, width: "100%" }}
|
|
667
|
-
variant={"borderless"}
|
|
668
|
-
styles={{ body: { padding: "0px 4px" } }}
|
|
669
|
-
>
|
|
670
|
-
<Row align="middle">
|
|
671
|
-
{isAddRoot ?
|
|
672
|
-
<Col span={8}>
|
|
673
|
-
<Button
|
|
674
|
-
type={"link"}
|
|
675
|
-
onClick={() => doEditRoot(ttmplNodeConfig.branchTitle)}
|
|
676
|
-
>
|
|
677
|
-
{translate("${添加}")}
|
|
678
|
-
</Button>
|
|
679
|
-
</Col> : null}
|
|
680
|
-
{showFilterInput ?
|
|
681
|
-
<Col span={isAddRoot ? 16 : 24}>
|
|
682
|
-
<Input.Search
|
|
683
|
-
value={searchValue}
|
|
684
|
-
allowClear
|
|
685
|
-
placeholder={translate("${输入查找内容}")}
|
|
686
|
-
onChange={(e) => {
|
|
687
|
-
this.setState({
|
|
688
|
-
searchValue: e.target.value,
|
|
689
|
-
});
|
|
690
|
-
}}
|
|
691
|
-
onSearch={(value) => {
|
|
692
|
-
this.refresh();
|
|
693
|
-
}}
|
|
694
|
-
enterButton={<ReloadOutlined />}
|
|
695
|
-
/>
|
|
696
|
-
</Col> : null}
|
|
697
|
-
</Row>
|
|
698
|
-
</Card>
|
|
699
|
-
</Col>
|
|
700
|
-
</Row>
|
|
701
|
-
<Row>
|
|
702
|
-
<Col span={24}>
|
|
703
|
-
<Card
|
|
704
|
-
styles={{
|
|
705
|
-
body: {
|
|
706
|
-
padding: "4px 0px 4px 0px",
|
|
707
|
-
height: "80vh",
|
|
708
|
-
minWidth: "194px",
|
|
709
|
-
}
|
|
710
|
-
}}
|
|
711
|
-
loading={loading}
|
|
712
|
-
>
|
|
713
|
-
{treeData.length == 0 ? (
|
|
714
|
-
translate("${没有找到数据}")
|
|
715
|
-
) : (
|
|
716
|
-
<Scrollbars
|
|
717
|
-
style={{ height: "80vh" }}
|
|
718
|
-
autoHide
|
|
719
|
-
autoHideTimeout={1000}
|
|
720
|
-
>
|
|
721
|
-
<Tree onSelect={(selectedKeys, info) => {
|
|
722
|
-
console.log('selected', selectedKeys, info);
|
|
723
|
-
}}
|
|
724
|
-
checkStrictly
|
|
725
|
-
blockNode
|
|
726
|
-
showLine={ttmplNodeConfig.showLine}
|
|
727
|
-
// checkable={checkable}
|
|
728
|
-
// onCheck={this.onCheck}
|
|
729
|
-
// checkedKeys={checkKeys}
|
|
730
|
-
expandedKeys={expandedKeys}
|
|
731
|
-
onExpand={this.onExpand}
|
|
732
|
-
titleRender={(nodeData) => {
|
|
733
|
-
return (
|
|
734
|
-
<div onClick={() => this.onClickNode(nodeData)}>
|
|
735
|
-
{this.packageTitle(nodeData)}
|
|
736
|
-
</div>
|
|
737
|
-
);
|
|
738
|
-
}}
|
|
739
|
-
treeData={treeData}
|
|
740
|
-
/>
|
|
741
|
-
</Scrollbars>
|
|
742
|
-
)}
|
|
743
|
-
</Card>
|
|
744
|
-
</Col>
|
|
745
|
-
</Row>
|
|
746
|
-
</>
|
|
747
|
-
);
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
export default TmplTree;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Card,
|
|
5
|
+
Col,
|
|
6
|
+
Input,
|
|
7
|
+
Popconfirm,
|
|
8
|
+
Popover,
|
|
9
|
+
Row,
|
|
10
|
+
Space,
|
|
11
|
+
Tag,
|
|
12
|
+
Tooltip,
|
|
13
|
+
Tree,
|
|
14
|
+
} from "antd";
|
|
15
|
+
import {
|
|
16
|
+
AlignLeftOutlined,
|
|
17
|
+
DeleteOutlined,
|
|
18
|
+
EditOutlined,
|
|
19
|
+
PlusOutlined,
|
|
20
|
+
PlusSquareOutlined,
|
|
21
|
+
ReloadOutlined, SyncOutlined,
|
|
22
|
+
} from "@ant-design/icons";
|
|
23
|
+
|
|
24
|
+
import Scrollbars from "react-custom-scrollbars";
|
|
25
|
+
import { HydrocarbonService } from "../index";
|
|
26
|
+
import TreeUtils, { TtmplNodeConfig } from "./tree-utils";
|
|
27
|
+
import { TreeDataNode } from "./tree-utils";
|
|
28
|
+
import { LocaleContext } from "../locale/LocaleProvider";
|
|
29
|
+
|
|
30
|
+
// 查找第一个叶子节点,用于默认选中使用;存在code,则查找等于code的节点
|
|
31
|
+
const findFirstLeaf = (tree, code?: string) => {
|
|
32
|
+
if (!Array.isArray(tree)) return null;
|
|
33
|
+
const dfs = (nodes) => {
|
|
34
|
+
for (const node of nodes) {
|
|
35
|
+
if (code ? node?.code === code : node?.isLeaf === true) {
|
|
36
|
+
return node;
|
|
37
|
+
}
|
|
38
|
+
if (Array.isArray(node?.children)) {
|
|
39
|
+
const found = dfs(node.children);
|
|
40
|
+
if (found) return found;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return dfs(tree);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface TmplTreeProps {
|
|
49
|
+
showFilterInput?: boolean;
|
|
50
|
+
ttmplNodeConfig: TtmplNodeConfig;
|
|
51
|
+
checkable: boolean,
|
|
52
|
+
onChangeCheck?: (checkCodes: string[]) => any,
|
|
53
|
+
currentId?: string,
|
|
54
|
+
checkedCodes?: string[],
|
|
55
|
+
doEditSub?: (
|
|
56
|
+
title: string,
|
|
57
|
+
ratmplId: string,
|
|
58
|
+
mainCode: string,
|
|
59
|
+
code?: string
|
|
60
|
+
) => void;
|
|
61
|
+
doViewSub?: (
|
|
62
|
+
title: string,
|
|
63
|
+
ratmplId: string,
|
|
64
|
+
mainCode: string,
|
|
65
|
+
code?: string
|
|
66
|
+
) => void;
|
|
67
|
+
doEditRoot?: (title: string, code?: string) => void;
|
|
68
|
+
doViewRoot?: (title: string, code?: string) => void;
|
|
69
|
+
doDelete?: (ratmplId: string, code?: string) => void;
|
|
70
|
+
doAddSub?: (
|
|
71
|
+
title: string,
|
|
72
|
+
ratmplId: string,
|
|
73
|
+
mainCode: string,
|
|
74
|
+
addTmplId: string
|
|
75
|
+
) => void;
|
|
76
|
+
onClickNode?: (dataNode: TreeDataNode) => void;
|
|
77
|
+
defExpandedRoot?: boolean; // 默认展开根节点
|
|
78
|
+
defSelect?: boolean; // 默认选中节点
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface TmplTreeState {
|
|
82
|
+
data?: TreeDataNode[];
|
|
83
|
+
expandedKeys?: string[];
|
|
84
|
+
loadedKeys?: string[];
|
|
85
|
+
loading?: boolean;
|
|
86
|
+
drawMainCode?: string;
|
|
87
|
+
// currentEditKey?: string;
|
|
88
|
+
parentNodeData?: TreeDataNode;
|
|
89
|
+
currentNodeData?: TreeDataNode;
|
|
90
|
+
rootAddable?: boolean;
|
|
91
|
+
searchValue?: string;
|
|
92
|
+
checkedKeys?: string[];
|
|
93
|
+
nodeClickLoading?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
97
|
+
state = {
|
|
98
|
+
data: [],
|
|
99
|
+
expandedKeys: [],
|
|
100
|
+
loadedKeys: [],
|
|
101
|
+
loading: false,
|
|
102
|
+
parentNodeData: undefined,
|
|
103
|
+
currentNodeData: undefined,
|
|
104
|
+
rootAddable: false,
|
|
105
|
+
searchValue: undefined,
|
|
106
|
+
checkedKeys: undefined,
|
|
107
|
+
nodeClickLoading: false,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
static defaultProps = {
|
|
112
|
+
draggable: false,
|
|
113
|
+
readOnly: false,
|
|
114
|
+
checkable: true,
|
|
115
|
+
showFilterInput: true,
|
|
116
|
+
defExpandedRoot: false,
|
|
117
|
+
defSelect: false,
|
|
118
|
+
};
|
|
119
|
+
static contextType = LocaleContext;
|
|
120
|
+
context: React.ContextType<typeof LocaleContext>;
|
|
121
|
+
|
|
122
|
+
reloadData = async (mainCode, currentCode?: string) => {
|
|
123
|
+
let { ttmplNodeConfig } = this.props;
|
|
124
|
+
const { data, expandedKeys } = this.state;
|
|
125
|
+
let v = await TreeUtils.reloadData(mainCode, ttmplNodeConfig, data, expandedKeys);
|
|
126
|
+
this.setState({ ...v });
|
|
127
|
+
if (currentCode) {
|
|
128
|
+
const current = TreeUtils.getNodesOfArrayNode(v.data, [currentCode])?.[0];
|
|
129
|
+
this.onClickNode(current || v.data[0]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
doDelete = async (node: TreeDataNode) => {
|
|
135
|
+
let { ttmplNodeConfig } = this.props;
|
|
136
|
+
const { data, expandedKeys } = this.state;
|
|
137
|
+
let sourceId;
|
|
138
|
+
if (node.isLeaf) {
|
|
139
|
+
sourceId = ttmplNodeConfig.leafRatmplId;
|
|
140
|
+
} else {
|
|
141
|
+
sourceId = ttmplNodeConfig.branchRatmplId ? ttmplNodeConfig.branchRatmplId : ttmplNodeConfig.rootLTmplConfig;
|
|
142
|
+
}
|
|
143
|
+
let res = await HydrocarbonService.deleteByCode(null, sourceId, [
|
|
144
|
+
node.code,
|
|
145
|
+
]);
|
|
146
|
+
if (node.parent) {
|
|
147
|
+
let v = await TreeUtils.reloadData(node.parent.code, ttmplNodeConfig, data, expandedKeys);
|
|
148
|
+
this.setState({ ...v });
|
|
149
|
+
this.onClickNode(node.parent);
|
|
150
|
+
} else {
|
|
151
|
+
let v = await TreeUtils.reloadData(null, ttmplNodeConfig, data, expandedKeys);
|
|
152
|
+
this.setState({ ...v });
|
|
153
|
+
this.onClickNode(v.data[0]);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
async componentDidMount() {
|
|
158
|
+
await this.refresh();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async componentDidUpdate(prevProps) {
|
|
162
|
+
let { ttmplNodeConfig: preTtmplNodeConfig } = prevProps;
|
|
163
|
+
let { ttmplNodeConfig, currentId } = this.props;
|
|
164
|
+
|
|
165
|
+
if (
|
|
166
|
+
!ttmplNodeConfig ||
|
|
167
|
+
(preTtmplNodeConfig && ttmplNodeConfig.id == preTtmplNodeConfig.id)
|
|
168
|
+
) {
|
|
169
|
+
if (currentId && (prevProps?.currentId !== currentId)) {
|
|
170
|
+
const curNode = findFirstLeaf(this.state.data, currentId);
|
|
171
|
+
if (curNode) this.onClickNode(curNode);
|
|
172
|
+
}
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
await this.refresh();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
async refresh() {
|
|
179
|
+
const { ttmplNodeConfig, defExpandedRoot, defSelect, currentId } = this.props;
|
|
180
|
+
if (!ttmplNodeConfig) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
this.setState({
|
|
184
|
+
loading: true,
|
|
185
|
+
});
|
|
186
|
+
//let loadedKeys = [];
|
|
187
|
+
let data = await TreeUtils.loadRootNodeData(ttmplNodeConfig);
|
|
188
|
+
this.setState({
|
|
189
|
+
searchValue: null,
|
|
190
|
+
data,
|
|
191
|
+
rootAddable:
|
|
192
|
+
ttmplNodeConfig.rootLTmplConfig?.buttons?.indexOf("dtmplAdd") > 0,
|
|
193
|
+
loading: false,
|
|
194
|
+
expandedKeys: []
|
|
195
|
+
}, async () => { // 页面闪烁异常处理,更新后立即使用state
|
|
196
|
+
if (defExpandedRoot) { // 默认展开所有根节点
|
|
197
|
+
const temData = this.state.data;
|
|
198
|
+
const temExpandedKeys = temData.map(r => r.key);
|
|
199
|
+
for (let index = 0; index < temData.length; index++) {
|
|
200
|
+
const r = temData[index];
|
|
201
|
+
await this.onExpand(temExpandedKeys, { expanded: true, node: r });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (defSelect && !this.state.currentNodeData && !currentId) { // 是否默认选中
|
|
205
|
+
const leafNode = findFirstLeaf(this.state.data);
|
|
206
|
+
if (leafNode) this.onClickNode(leafNode, false);
|
|
207
|
+
}
|
|
208
|
+
if (currentId) { // 指定默认选中项
|
|
209
|
+
const curNode = findFirstLeaf(this.state.data, currentId);
|
|
210
|
+
if (curNode) this.onClickNode(curNode, false);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// loadRootNodeData = async () => {
|
|
216
|
+
// const { ttmplNodeConfig } = this.props;
|
|
217
|
+
// let data = await TreeUtils.loadRootNodeData(ttmplNodeConfig);
|
|
218
|
+
// return data;
|
|
219
|
+
// };
|
|
220
|
+
|
|
221
|
+
async componentWillUnmount() { }
|
|
222
|
+
|
|
223
|
+
onExpand = async (
|
|
224
|
+
expandedKeys,
|
|
225
|
+
current: { expanded: boolean; node: TreeDataNode }
|
|
226
|
+
) => {
|
|
227
|
+
const { ttmplNodeConfig } = this.props;
|
|
228
|
+
const { data } = this.state;
|
|
229
|
+
if (current.expanded) {
|
|
230
|
+
await TreeUtils.pushSameCodeNodeData([current.node], ttmplNodeConfig);
|
|
231
|
+
}
|
|
232
|
+
this.setState({
|
|
233
|
+
data: [...data],
|
|
234
|
+
expandedKeys,
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
serial_number = new Date().getTime();
|
|
238
|
+
|
|
239
|
+
// throttle是否节流
|
|
240
|
+
onClickNode = (dataNode: TreeDataNode, throttle = true) => {
|
|
241
|
+
const {
|
|
242
|
+
doEditRoot,
|
|
243
|
+
doViewRoot,
|
|
244
|
+
doViewSub,
|
|
245
|
+
doEditSub,
|
|
246
|
+
ttmplNodeConfig, onClickNode,
|
|
247
|
+
} = this.props;
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
let new_serial_number = new Date().getTime();
|
|
251
|
+
if (!throttle || (new_serial_number - this.serial_number > 1500)) {
|
|
252
|
+
this.serial_number = new_serial_number;
|
|
253
|
+
} else {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
this.setState({ currentNodeData: dataNode, nodeClickLoading: true })
|
|
258
|
+
setTimeout(() => {
|
|
259
|
+
this.setState({ nodeClickLoading: false })
|
|
260
|
+
}, 1500)
|
|
261
|
+
if (onClickNode) {
|
|
262
|
+
onClickNode(dataNode);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (dataNode.parent) {
|
|
266
|
+
//说明是sub
|
|
267
|
+
if (dataNode.isLeaf) {
|
|
268
|
+
if (ttmplNodeConfig.leafLTmplConfig.buttons.indexOf("dtmplEdit") > 0 && doEditSub) {
|
|
269
|
+
doEditSub(
|
|
270
|
+
ttmplNodeConfig.leafTitle,
|
|
271
|
+
ttmplNodeConfig.leafRatmplId,
|
|
272
|
+
dataNode.parent.code,
|
|
273
|
+
dataNode.code
|
|
274
|
+
);
|
|
275
|
+
} else if (
|
|
276
|
+
ttmplNodeConfig.leafLTmplConfig.buttons.indexOf("detail") > 0 && doViewSub
|
|
277
|
+
) {
|
|
278
|
+
doViewSub(
|
|
279
|
+
ttmplNodeConfig.leafTitle,
|
|
280
|
+
ttmplNodeConfig.leafRatmplId,
|
|
281
|
+
dataNode.parent.code,
|
|
282
|
+
dataNode.code
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
} else {
|
|
286
|
+
if (
|
|
287
|
+
ttmplNodeConfig.branchLTmplConfig.buttons.indexOf("dtmplEdit") > 0 && doEditSub
|
|
288
|
+
) {
|
|
289
|
+
doEditSub(
|
|
290
|
+
ttmplNodeConfig.branchTitle,
|
|
291
|
+
ttmplNodeConfig.branchRatmplId,
|
|
292
|
+
dataNode.parent.code,
|
|
293
|
+
dataNode.code
|
|
294
|
+
);
|
|
295
|
+
} else if (
|
|
296
|
+
ttmplNodeConfig.branchLTmplConfig.buttons.indexOf("detail") > 0 && doViewSub
|
|
297
|
+
) {
|
|
298
|
+
doViewSub(
|
|
299
|
+
ttmplNodeConfig.branchTitle,
|
|
300
|
+
ttmplNodeConfig.branchRatmplId,
|
|
301
|
+
dataNode.parent.code,
|
|
302
|
+
dataNode.code
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
} else {
|
|
307
|
+
//说明是root
|
|
308
|
+
//判断是否允许编辑
|
|
309
|
+
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("dtmplEdit") > 0 && doEditSub) {
|
|
310
|
+
doEditRoot(ttmplNodeConfig.branchTitle, dataNode.code);
|
|
311
|
+
} else if (
|
|
312
|
+
ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("detail") > 0 && doViewRoot
|
|
313
|
+
) {
|
|
314
|
+
doViewRoot(ttmplNodeConfig.branchTitle, dataNode.code);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
stopPropagation = (e) => {
|
|
321
|
+
if (e.stopPropagation) {
|
|
322
|
+
//如果提供了事件对象,则这是一个非IE浏览器
|
|
323
|
+
e.stopPropagation();
|
|
324
|
+
} else {
|
|
325
|
+
//兼容IE的方式来取消事件冒泡
|
|
326
|
+
window.event.cancelBubble = true;
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
getDeleteButton = (sourceId, node: TreeDataNode) => {
|
|
331
|
+
const { doDelete, ttmplNodeConfig } = this.props;
|
|
332
|
+
const { translate } = this.context;
|
|
333
|
+
|
|
334
|
+
return (
|
|
335
|
+
<div
|
|
336
|
+
onClick={(e) => {
|
|
337
|
+
this.stopPropagation(e);
|
|
338
|
+
}}
|
|
339
|
+
>
|
|
340
|
+
<Popconfirm
|
|
341
|
+
placement="topLeft"
|
|
342
|
+
title={translate("${确定要删除吗}?")}
|
|
343
|
+
onConfirm={async () => {
|
|
344
|
+
const { data, expandedKeys } = this.state;
|
|
345
|
+
await doDelete(sourceId, node.code);
|
|
346
|
+
if (node.parent) {
|
|
347
|
+
let v = await TreeUtils.reloadData(node.parent.code, ttmplNodeConfig, data, expandedKeys);
|
|
348
|
+
this.setState({ ...v });
|
|
349
|
+
this.onClickNode(node.parent);
|
|
350
|
+
} else {
|
|
351
|
+
const { data, expandedKeys } = this.state;
|
|
352
|
+
let v = await TreeUtils.reloadData(null, ttmplNodeConfig, data, expandedKeys);
|
|
353
|
+
this.setState({ ...v });
|
|
354
|
+
this.onClickNode(v.data[0]);
|
|
355
|
+
}
|
|
356
|
+
}}
|
|
357
|
+
okText={translate("${确定}")}
|
|
358
|
+
cancelText={translate("${取消}")}
|
|
359
|
+
>
|
|
360
|
+
<Tooltip>
|
|
361
|
+
<Button size={"small"} danger={true}>
|
|
362
|
+
<DeleteOutlined />
|
|
363
|
+
</Button>
|
|
364
|
+
</Tooltip>
|
|
365
|
+
</Popconfirm>
|
|
366
|
+
</div>
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
getAddButton = (
|
|
372
|
+
title: string,
|
|
373
|
+
icon: any,
|
|
374
|
+
ratmplId: string,
|
|
375
|
+
mainCode: any
|
|
376
|
+
) => {
|
|
377
|
+
const { translate } = this.context;
|
|
378
|
+
const { doAddSub } = this.props;
|
|
379
|
+
return (
|
|
380
|
+
<Button
|
|
381
|
+
onClick={(e) => {
|
|
382
|
+
this.stopPropagation(e);
|
|
383
|
+
doAddSub(title, ratmplId, mainCode, null);
|
|
384
|
+
}}
|
|
385
|
+
size={"small"}
|
|
386
|
+
>
|
|
387
|
+
{icon}
|
|
388
|
+
{translate("${" + title + "}")}
|
|
389
|
+
</Button>
|
|
390
|
+
);
|
|
391
|
+
};
|
|
392
|
+
onCheck = (checkedKeys, e) => {
|
|
393
|
+
console.log(checkedKeys);
|
|
394
|
+
console.log(e);
|
|
395
|
+
if (this.props.onChangeCheck) {
|
|
396
|
+
let checks: string[] = [];
|
|
397
|
+
if (e.checkedNodes) {
|
|
398
|
+
e.checkedNodes.forEach((c) => {
|
|
399
|
+
checks.push(c.code + "@R@" + c.title);
|
|
400
|
+
})
|
|
401
|
+
}
|
|
402
|
+
this.props.onChangeCheck(checks);
|
|
403
|
+
|
|
404
|
+
}
|
|
405
|
+
this.setState({
|
|
406
|
+
checkedKeys
|
|
407
|
+
})
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
packageTitle = (dataNode) => {
|
|
411
|
+
const {
|
|
412
|
+
doEditRoot,
|
|
413
|
+
doViewRoot,
|
|
414
|
+
doViewSub,
|
|
415
|
+
doEditSub, doDelete, doAddSub,
|
|
416
|
+
ttmplNodeConfig, currentId,
|
|
417
|
+
} = this.props;
|
|
418
|
+
const { translate } = this.context;
|
|
419
|
+
const { currentNodeData, nodeClickLoading } = this.state;
|
|
420
|
+
let buttons = [];
|
|
421
|
+
if (dataNode.parent) {
|
|
422
|
+
//说明是sub
|
|
423
|
+
if (dataNode.isLeaf) {
|
|
424
|
+
if (ttmplNodeConfig.leafLTmplConfig?.buttons.indexOf("dtmplEdit") > 0 && doEditSub) {
|
|
425
|
+
buttons.push(
|
|
426
|
+
<Button
|
|
427
|
+
onClick={(e) => {
|
|
428
|
+
this.stopPropagation(e);
|
|
429
|
+
doEditSub(
|
|
430
|
+
ttmplNodeConfig.leafTitle,
|
|
431
|
+
ttmplNodeConfig.leafRatmplId,
|
|
432
|
+
dataNode.parent.code,
|
|
433
|
+
dataNode.code
|
|
434
|
+
);
|
|
435
|
+
}}
|
|
436
|
+
size={"small"}
|
|
437
|
+
>
|
|
438
|
+
<EditOutlined />
|
|
439
|
+
{translate("${编辑}")}
|
|
440
|
+
</Button>
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
if (ttmplNodeConfig.leafLTmplConfig?.buttons.indexOf("detail") > 0 && doViewSub) {
|
|
444
|
+
buttons.push(
|
|
445
|
+
<Button
|
|
446
|
+
onClick={(e) => {
|
|
447
|
+
this.stopPropagation(e);
|
|
448
|
+
doViewSub(
|
|
449
|
+
ttmplNodeConfig.leafTitle,
|
|
450
|
+
ttmplNodeConfig.leafRatmplId,
|
|
451
|
+
dataNode.parent.code,
|
|
452
|
+
dataNode.code
|
|
453
|
+
);
|
|
454
|
+
}}
|
|
455
|
+
size={"small"}
|
|
456
|
+
>
|
|
457
|
+
<AlignLeftOutlined />
|
|
458
|
+
{translate("${查看}")}
|
|
459
|
+
</Button>
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
if (ttmplNodeConfig.leafLTmplConfig?.buttons.indexOf("singleDelete") > 0 && doDelete) {
|
|
463
|
+
buttons.push(
|
|
464
|
+
this.getDeleteButton(ttmplNodeConfig.leafRatmplId, dataNode)
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
//节点上加操作
|
|
468
|
+
// if(ttmplNodeConfig.leafLTmplConfig?.rowActions.length > 0){
|
|
469
|
+
// ttmplNodeConfig.leafLTmplConfig.rowActions.map((action) => {
|
|
470
|
+
// buttons.push(
|
|
471
|
+
// <Action
|
|
472
|
+
// serverKey={null}
|
|
473
|
+
// iconType={"icon"}
|
|
474
|
+
// key={action.id}
|
|
475
|
+
// data={[dataNode.data]}
|
|
476
|
+
// actionConfig={action}
|
|
477
|
+
// doAction={this.doRowAction}
|
|
478
|
+
// buttonSize={"small"}
|
|
479
|
+
// serial={1}
|
|
480
|
+
// ></Action>
|
|
481
|
+
// );
|
|
482
|
+
// })
|
|
483
|
+
// }
|
|
484
|
+
} else if (ttmplNodeConfig.branchLTmplConfig) {
|
|
485
|
+
if (
|
|
486
|
+
ttmplNodeConfig.branchLTmplConfig.buttons.indexOf("dtmplEdit") > 0 && doEditSub
|
|
487
|
+
) {
|
|
488
|
+
buttons.push(
|
|
489
|
+
<Button
|
|
490
|
+
onClick={(e) => {
|
|
491
|
+
this.stopPropagation(e);
|
|
492
|
+
doEditSub(
|
|
493
|
+
ttmplNodeConfig.branchTitle,
|
|
494
|
+
ttmplNodeConfig.branchRatmplId,
|
|
495
|
+
dataNode.parent.code,
|
|
496
|
+
dataNode.code
|
|
497
|
+
);
|
|
498
|
+
}}
|
|
499
|
+
size={"small"}
|
|
500
|
+
>
|
|
501
|
+
<EditOutlined />
|
|
502
|
+
{translate("${编辑}")}
|
|
503
|
+
</Button>
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
if (ttmplNodeConfig.branchLTmplConfig?.buttons.indexOf("detail") > 0 && doViewSub) {
|
|
507
|
+
buttons.push(
|
|
508
|
+
<Button
|
|
509
|
+
onClick={(e) => {
|
|
510
|
+
this.stopPropagation(e);
|
|
511
|
+
doViewSub(
|
|
512
|
+
ttmplNodeConfig.branchTitle,
|
|
513
|
+
ttmplNodeConfig.branchRatmplId,
|
|
514
|
+
dataNode.parent.code,
|
|
515
|
+
dataNode.code
|
|
516
|
+
);
|
|
517
|
+
}}
|
|
518
|
+
size={"small"}
|
|
519
|
+
>
|
|
520
|
+
<AlignLeftOutlined />
|
|
521
|
+
{translate("${查看}")}
|
|
522
|
+
</Button>
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
if (
|
|
527
|
+
ttmplNodeConfig.branchLTmplConfig?.buttons.indexOf("dtmplAdd") > 0 && doAddSub
|
|
528
|
+
) {
|
|
529
|
+
buttons.push(
|
|
530
|
+
this.getAddButton(
|
|
531
|
+
ttmplNodeConfig.branchTitle,
|
|
532
|
+
<PlusSquareOutlined />,
|
|
533
|
+
ttmplNodeConfig.branchRatmplId,
|
|
534
|
+
dataNode.code
|
|
535
|
+
)
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (ttmplNodeConfig.leafLTmplConfig?.buttons.indexOf("dtmplAdd") > 0 && doAddSub) {
|
|
540
|
+
buttons.push(
|
|
541
|
+
this.getAddButton(
|
|
542
|
+
ttmplNodeConfig.leafTitle,
|
|
543
|
+
<PlusOutlined />,
|
|
544
|
+
ttmplNodeConfig.leafRatmplId,
|
|
545
|
+
dataNode.code
|
|
546
|
+
)
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
if (
|
|
550
|
+
ttmplNodeConfig.branchLTmplConfig?.buttons.indexOf("singleDelete") > 0 && doDelete
|
|
551
|
+
) {
|
|
552
|
+
buttons.push(
|
|
553
|
+
this.getDeleteButton(ttmplNodeConfig.branchRatmplId, dataNode)
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
} else {
|
|
558
|
+
//说明是root
|
|
559
|
+
//判断是否允许编辑
|
|
560
|
+
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("dtmplEdit") > 0 && doEditRoot) {
|
|
561
|
+
buttons.push(
|
|
562
|
+
<Button
|
|
563
|
+
onClick={(e) => {
|
|
564
|
+
this.stopPropagation(e);
|
|
565
|
+
doEditRoot(ttmplNodeConfig.branchTitle, dataNode.code);
|
|
566
|
+
}}
|
|
567
|
+
size={"small"}
|
|
568
|
+
>
|
|
569
|
+
<EditOutlined style={{ color: "var(--ant-color-primary)" }} />
|
|
570
|
+
{translate("${编辑}")}
|
|
571
|
+
</Button>
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("detail") > 0 && doViewRoot) {
|
|
575
|
+
buttons.push(
|
|
576
|
+
<Button
|
|
577
|
+
onClick={(e) => {
|
|
578
|
+
this.stopPropagation(e);
|
|
579
|
+
doViewRoot(ttmplNodeConfig.branchTitle, dataNode.code);
|
|
580
|
+
}}
|
|
581
|
+
size={"small"}
|
|
582
|
+
>
|
|
583
|
+
<AlignLeftOutlined />
|
|
584
|
+
{translate("${查看}")}
|
|
585
|
+
</Button>
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
//debugger
|
|
589
|
+
if (ttmplNodeConfig.branchLTmplConfig) {
|
|
590
|
+
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("dtmplAdd") > 0 && doAddSub) {
|
|
591
|
+
buttons.push(
|
|
592
|
+
this.getAddButton(
|
|
593
|
+
ttmplNodeConfig.branchTitle,
|
|
594
|
+
<PlusSquareOutlined />,
|
|
595
|
+
ttmplNodeConfig.branchRatmplId,
|
|
596
|
+
dataNode.code
|
|
597
|
+
)
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
if (ttmplNodeConfig.leafLTmplConfig?.buttons.indexOf("dtmplAdd") > 0 && doAddSub) {
|
|
602
|
+
buttons.push(
|
|
603
|
+
this.getAddButton(
|
|
604
|
+
ttmplNodeConfig.leafTitle,
|
|
605
|
+
<PlusOutlined />,
|
|
606
|
+
ttmplNodeConfig.leafRatmplId,
|
|
607
|
+
dataNode.code
|
|
608
|
+
)
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("singleDelete") > 0 && doDelete) {
|
|
613
|
+
buttons.push(
|
|
614
|
+
this.getDeleteButton(ttmplNodeConfig.branchRatmplId ? ttmplNodeConfig.branchRatmplId : ttmplNodeConfig.rootGtmplId, dataNode)
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
let titleNode =
|
|
620
|
+
<Tag icon={nodeClickLoading && dataNode.key == currentNodeData?.key ? <SyncOutlined spin /> : null} style={{ fontSize: '14px' }} bordered={false} color={dataNode.key == currentNodeData?.key ? "processing" : undefined} >{dataNode.title}</Tag>
|
|
621
|
+
|
|
622
|
+
if (buttons.length == 0) {
|
|
623
|
+
return titleNode;
|
|
624
|
+
} else {
|
|
625
|
+
return (
|
|
626
|
+
<Popover
|
|
627
|
+
zIndex={100}
|
|
628
|
+
content={
|
|
629
|
+
<>
|
|
630
|
+
<Space>{buttons}</Space>
|
|
631
|
+
</>
|
|
632
|
+
}
|
|
633
|
+
arrow={false}
|
|
634
|
+
>
|
|
635
|
+
{titleNode}
|
|
636
|
+
{/*<span style={{background:dataNode.key==currentNodeData?.key?"red":undefined}}>{dataNode.title }</span>*/}
|
|
637
|
+
{/*<Card styles={{body:{"padding":"0px"}}} variant={'borderless'} style={{padding:"0px",margin:'0px'}} > {dataNode.title }</Card>*/}
|
|
638
|
+
{/*{dataNode.key==currentNodeData?.key?currentNodeData.key:"2"}*/}
|
|
639
|
+
</Popover>
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
render() {
|
|
645
|
+
const { doEditRoot, ttmplNodeConfig, showFilterInput } = this.props;
|
|
646
|
+
const {
|
|
647
|
+
data,
|
|
648
|
+
loading,
|
|
649
|
+
expandedKeys,
|
|
650
|
+
rootAddable,
|
|
651
|
+
searchValue,
|
|
652
|
+
} = this.state;
|
|
653
|
+
let treeData = data;
|
|
654
|
+
const { translate } = this.context;
|
|
655
|
+
if (searchValue) {
|
|
656
|
+
treeData = TreeUtils.filterTree(data, searchValue);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
const isAddRoot = rootAddable && doEditRoot;
|
|
660
|
+
|
|
661
|
+
return (
|
|
662
|
+
<>
|
|
663
|
+
<Row >
|
|
664
|
+
<Col span={24}>
|
|
665
|
+
<Card
|
|
666
|
+
style={{ marginBottom: 0, width: "100%" }}
|
|
667
|
+
variant={"borderless"}
|
|
668
|
+
styles={{ body: { padding: "0px 4px" } }}
|
|
669
|
+
>
|
|
670
|
+
<Row align="middle">
|
|
671
|
+
{isAddRoot ?
|
|
672
|
+
<Col span={8}>
|
|
673
|
+
<Button
|
|
674
|
+
type={"link"}
|
|
675
|
+
onClick={() => doEditRoot(ttmplNodeConfig.branchTitle)}
|
|
676
|
+
>
|
|
677
|
+
{translate("${添加}")}
|
|
678
|
+
</Button>
|
|
679
|
+
</Col> : null}
|
|
680
|
+
{showFilterInput ?
|
|
681
|
+
<Col span={isAddRoot ? 16 : 24}>
|
|
682
|
+
<Input.Search
|
|
683
|
+
value={searchValue}
|
|
684
|
+
allowClear
|
|
685
|
+
placeholder={translate("${输入查找内容}")}
|
|
686
|
+
onChange={(e) => {
|
|
687
|
+
this.setState({
|
|
688
|
+
searchValue: e.target.value,
|
|
689
|
+
});
|
|
690
|
+
}}
|
|
691
|
+
onSearch={(value) => {
|
|
692
|
+
this.refresh();
|
|
693
|
+
}}
|
|
694
|
+
enterButton={<ReloadOutlined />}
|
|
695
|
+
/>
|
|
696
|
+
</Col> : null}
|
|
697
|
+
</Row>
|
|
698
|
+
</Card>
|
|
699
|
+
</Col>
|
|
700
|
+
</Row>
|
|
701
|
+
<Row>
|
|
702
|
+
<Col span={24}>
|
|
703
|
+
<Card
|
|
704
|
+
styles={{
|
|
705
|
+
body: {
|
|
706
|
+
padding: "4px 0px 4px 0px",
|
|
707
|
+
height: "80vh",
|
|
708
|
+
minWidth: "194px",
|
|
709
|
+
}
|
|
710
|
+
}}
|
|
711
|
+
loading={loading}
|
|
712
|
+
>
|
|
713
|
+
{treeData.length == 0 ? (
|
|
714
|
+
translate("${没有找到数据}")
|
|
715
|
+
) : (
|
|
716
|
+
<Scrollbars
|
|
717
|
+
style={{ height: "80vh" }}
|
|
718
|
+
autoHide
|
|
719
|
+
autoHideTimeout={1000}
|
|
720
|
+
>
|
|
721
|
+
<Tree onSelect={(selectedKeys, info) => {
|
|
722
|
+
console.log('selected', selectedKeys, info);
|
|
723
|
+
}}
|
|
724
|
+
checkStrictly
|
|
725
|
+
blockNode
|
|
726
|
+
showLine={ttmplNodeConfig.showLine}
|
|
727
|
+
// checkable={checkable}
|
|
728
|
+
// onCheck={this.onCheck}
|
|
729
|
+
// checkedKeys={checkKeys}
|
|
730
|
+
expandedKeys={expandedKeys}
|
|
731
|
+
onExpand={this.onExpand}
|
|
732
|
+
titleRender={(nodeData) => {
|
|
733
|
+
return (
|
|
734
|
+
<div onClick={() => this.onClickNode(nodeData)}>
|
|
735
|
+
{this.packageTitle(nodeData)}
|
|
736
|
+
</div>
|
|
737
|
+
);
|
|
738
|
+
}}
|
|
739
|
+
treeData={treeData}
|
|
740
|
+
/>
|
|
741
|
+
</Scrollbars>
|
|
742
|
+
)}
|
|
743
|
+
</Card>
|
|
744
|
+
</Col>
|
|
745
|
+
</Row>
|
|
746
|
+
</>
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
export default TmplTree;
|