aldehyde 0.2.479 → 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/card.js +2 -2
- package/lib/controls/2dEditor/components/card.js.map +1 -1
- 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/entity-select.js +3 -3
- package/lib/controls/entity-select/entity-select.js.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/asset-bar/index.d.ts +1 -0
- package/lib/draw-canvas-edit/components/asset-bar/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/asset-bar/index.js +8 -6
- package/lib/draw-canvas-edit/components/asset-bar/index.js.map +1 -1
- package/lib/draw-canvas-edit/components/main-header/index.less +3 -0
- 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/draws/bg-draw.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/draws/bg-draw.js +14 -1
- package/lib/draw-canvas-edit/components/render/draws/bg-draw.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/draws/contextmenu-draw.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/draws/contextmenu-draw.js +30 -6
- package/lib/draw-canvas-edit/components/render/draws/contextmenu-draw.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/graphs/bezier.js +3 -3
- package/lib/draw-canvas-edit/components/render/graphs/bezier.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/graphs/circle.js +2 -2
- package/lib/draw-canvas-edit/components/render/graphs/circle.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/graphs/curve.js +3 -3
- package/lib/draw-canvas-edit/components/render/graphs/curve.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/graphs/line.js +3 -3
- package/lib/draw-canvas-edit/components/render/graphs/line.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/graphs/rect.js +2 -2
- package/lib/draw-canvas-edit/components/render/graphs/rect.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/handlers/drag-outside-handlers.d.ts +1 -1
- package/lib/draw-canvas-edit/components/render/handlers/drag-outside-handlers.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/handlers/drag-outside-handlers.js +58 -122
- package/lib/draw-canvas-edit/components/render/handlers/drag-outside-handlers.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/handlers/graph-handlers.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/handlers/graph-handlers.js +2 -1
- package/lib/draw-canvas-edit/components/render/handlers/graph-handlers.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/handlers/selection-handlers.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/handlers/selection-handlers.js +11 -4
- package/lib/draw-canvas-edit/components/render/handlers/selection-handlers.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/index.d.ts +3 -1
- package/lib/draw-canvas-edit/components/render/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/index.js +37 -26
- package/lib/draw-canvas-edit/components/render/index.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/attract-tool.d.ts +2 -1
- package/lib/draw-canvas-edit/components/render/tools/attract-tool.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/attract-tool.js +33 -8
- package/lib/draw-canvas-edit/components/render/tools/attract-tool.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/component-factory.d.ts +64 -0
- package/lib/draw-canvas-edit/components/render/tools/component-factory.d.ts.map +1 -0
- package/lib/draw-canvas-edit/components/render/tools/component-factory.js +257 -0
- package/lib/draw-canvas-edit/components/render/tools/component-factory.js.map +1 -0
- package/lib/draw-canvas-edit/components/render/tools/copy-tool.d.ts +0 -2
- package/lib/draw-canvas-edit/components/render/tools/copy-tool.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/copy-tool.js +23 -45
- package/lib/draw-canvas-edit/components/render/tools/copy-tool.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/import-export-tool.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/import-export-tool.js +20 -41
- package/lib/draw-canvas-edit/components/render/tools/import-export-tool.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/index.d.ts +1 -0
- package/lib/draw-canvas-edit/components/render/tools/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/index.js +1 -0
- package/lib/draw-canvas-edit/components/render/tools/index.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/selection-tool.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/selection-tool.js +32 -19
- package/lib/draw-canvas-edit/components/render/tools/selection-tool.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/types.d.ts +11 -6
- 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/components/setting-form/imag-upload.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/setting-form/imag-upload.js +2 -2
- package/lib/draw-canvas-edit/components/setting-form/imag-upload.js.map +1 -1
- package/lib/draw-canvas-edit/components/setting-form/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/setting-form/index.js +3 -5
- package/lib/draw-canvas-edit/components/setting-form/index.js.map +1 -1
- package/lib/draw-canvas-edit/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/index.js +4 -1
- package/lib/draw-canvas-edit/index.js.map +1 -1
- package/lib/draw-canvas-edit/index.less +48 -48
- package/lib/draw-canvas-view/index.d.ts.map +1 -1
- package/lib/draw-canvas-view/index.js +4 -2
- package/lib/draw-canvas-view/index.js.map +1 -1
- package/lib/draw-canvas-view/index.less +59 -59
- package/lib/draw-canvas-view/view.d.ts +2 -0
- package/lib/draw-canvas-view/view.d.ts.map +1 -1
- package/lib/draw-canvas-view/view.js +60 -36
- 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/criteria-form.js +17 -17
- package/lib/form/criteria-form.js.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 +9 -0
- 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/form-Item-group.js +2 -2
- package/lib/form/form-Item-group.js.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-card.js +4 -4
- package/lib/module/dtmpl-edit-card.js.map +1 -1
- package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-page.js +7 -4
- package/lib/module/dtmpl-edit-page.js.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/act-table.js +8 -8
- package/lib/table/act-table.js.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 +2 -2
- package/lib/table/modal-select-table.d.ts.map +1 -1
- package/lib/table/modal-select-table.js +10 -10
- package/lib/table/modal-select-table.js.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 +2 -2
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +1 -1
- package/lib/table/relation-table.js.map +1 -1
- package/lib/table/select-table.d.ts.map +1 -1
- package/lib/table/select-table.js +16 -4
- 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/tmpl/hc-data-source.js +2 -2
- package/lib/tmpl/hc-data-source.js.map +1 -1
- package/lib/tmpl/interface.d.ts +7 -7
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.js +23 -23
- package/lib/tmpl/tmpl-config-analysis.js.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/units/index.js +3 -3
- package/lib/units/index.js.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/asset-bar/index.tsx +8 -6
- package/src/aldehyde/draw-canvas-edit/components/main-header/index.less +3 -0
- 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 -160
- package/src/aldehyde/draw-canvas-edit/components/render/draws/contextmenu-draw.ts +329 -305
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/bezier.ts +542 -542
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/circle.ts +2 -2
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/curve.ts +3 -3
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/line.ts +3 -3
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/rect.ts +2 -2
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/drag-outside-handlers.ts +72 -157
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/graph-handlers.ts +7 -1
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/selection-handlers.ts +396 -390
- package/src/aldehyde/draw-canvas-edit/components/render/index.ts +808 -799
- package/src/aldehyde/draw-canvas-edit/components/render/tools/attract-tool.ts +457 -437
- package/src/aldehyde/draw-canvas-edit/components/render/tools/component-factory.ts +270 -0
- package/src/aldehyde/draw-canvas-edit/components/render/tools/copy-tool.ts +244 -266
- package/src/aldehyde/draw-canvas-edit/components/render/tools/import-export-tool.ts +576 -600
- package/src/aldehyde/draw-canvas-edit/components/render/tools/index.ts +10 -9
- 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 -129
- package/src/aldehyde/draw-canvas-edit/components/render/types.ts +294 -291
- package/src/aldehyde/draw-canvas-edit/components/setting-form/imag-upload.tsx +2 -1
- package/src/aldehyde/draw-canvas-edit/components/setting-form/index.tsx +291 -293
- 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 -198
- package/src/aldehyde/draw-canvas-view/index.less +59 -59
- package/src/aldehyde/draw-canvas-view/index.tsx +49 -47
- package/src/aldehyde/draw-canvas-view/view.tsx +240 -212
- 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 -543
- 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 -555
- 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 -586
- 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,800 +1,809 @@
|
|
|
1
|
-
import * as _ from 'lodash';
|
|
2
|
-
import Konva from 'konva';
|
|
3
|
-
import { GraphDraw, LinkDraw, RulerDraw, PreviewDraw, RefLineDraw, BgDraw, ContextmenuDraw } from './draws';
|
|
4
|
-
import { LinkDrawPoint, GraphType, AssetType, RenderConfig, Draw, Handler, RenderEvents, LinkDrawPair, PageSettings, AssetSettings, ImageType, LinkSettings } from './types';
|
|
5
|
-
import { DragHandlers, ZoomHandlers, DragOutsideHandlers, SelectionHandlers, KeyMoveHandlers, ShutcutHandlers, LinkHandlers, GraphHandlers, TextHandlers } from './handlers';
|
|
6
|
-
import { AssetTool, SelectionTool, CopyTool, PositionTool, ZIndexTool, ImportExportTool, AlignTool, LinkTool, AttractTool } from './tools';
|
|
7
|
-
|
|
8
|
-
// 简单的事件系统替代 mitt
|
|
9
|
-
class SimpleEventEmitter {
|
|
10
|
-
private listeners: Map<string, Set<Function>> = new Map();
|
|
11
|
-
|
|
12
|
-
on(event: string, handler: Function) {
|
|
13
|
-
if (!this.listeners.has(event)) {
|
|
14
|
-
this.listeners.set(event, new Set());
|
|
15
|
-
}
|
|
16
|
-
this.listeners.get(event)!.add(handler);
|
|
17
|
-
return () => this.off(event, handler);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
off(event: string, handler: Function) {
|
|
21
|
-
this.listeners.get(event)?.delete(handler);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
emit(event: string, ...args: any[]) {
|
|
25
|
-
this.listeners.get(event)?.forEach(handler => handler(...args));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// 渲染器
|
|
30
|
-
export class Render {
|
|
31
|
-
stage: Konva.Stage;
|
|
32
|
-
layer: Konva.Layer = new Konva.Layer({ id: 'main' }); // 主要层
|
|
33
|
-
layerFloor: Konva.Layer = new Konva.Layer(); // 辅助层 - 背景
|
|
34
|
-
layerCover: Konva.Layer = new Konva.Layer({ id: 'cover' }); // 辅助层 - 连接线、对齐线
|
|
35
|
-
config: RenderConfig; // 配置
|
|
36
|
-
draws: { [index: string]: (Draw & Handler) | undefined } = {}; // 附加工具
|
|
37
|
-
assetTool: AssetTool; // 素材工具
|
|
38
|
-
selectionTool: SelectionTool; // 选择工具
|
|
39
|
-
copyTool: CopyTool; // 复制工具
|
|
40
|
-
positionTool: PositionTool; // 定位工具
|
|
41
|
-
zIndexTool: ZIndexTool; // 层级工具
|
|
42
|
-
importExportTool: ImportExportTool; // 导入导出
|
|
43
|
-
alignTool: AlignTool; // 对齐工具
|
|
44
|
-
linkTool: LinkTool; // 连线工具
|
|
45
|
-
attractTool: AttractTool; // 磁贴工具
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.
|
|
90
|
-
this.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.groupTransformer.add(this.
|
|
104
|
-
this.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
this.
|
|
140
|
-
this.
|
|
141
|
-
this.
|
|
142
|
-
this.
|
|
143
|
-
this.
|
|
144
|
-
this.
|
|
145
|
-
this.
|
|
146
|
-
this.
|
|
147
|
-
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this.handlers[
|
|
156
|
-
this.handlers[
|
|
157
|
-
this.handlers[
|
|
158
|
-
this.handlers[
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
this.stage.add(this.
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
178
|
-
this.draws[
|
|
179
|
-
this.draws[
|
|
180
|
-
this.draws[
|
|
181
|
-
|
|
182
|
-
this.
|
|
183
|
-
//
|
|
184
|
-
this.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
this.
|
|
242
|
-
//
|
|
243
|
-
this.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
this.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
this.
|
|
279
|
-
|
|
280
|
-
this.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
'
|
|
292
|
-
'
|
|
293
|
-
'
|
|
294
|
-
'
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
container.
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
'
|
|
314
|
-
'
|
|
315
|
-
'
|
|
316
|
-
'
|
|
317
|
-
'
|
|
318
|
-
'
|
|
319
|
-
'
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
'
|
|
340
|
-
'
|
|
341
|
-
'
|
|
342
|
-
'
|
|
343
|
-
'
|
|
344
|
-
'
|
|
345
|
-
'
|
|
346
|
-
'
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
//
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
this.
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
//
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
linkStroke: 'rgb(0,0,0)',
|
|
490
|
-
linkStrokeWidth: 1,
|
|
491
|
-
fontSize: 24,
|
|
492
|
-
textFill: 'rgb(0,0,0)'
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
// 获取页面设置
|
|
496
|
-
getPageSettings(): PageSettings {
|
|
497
|
-
return this.stage.attrs.pageSettings ?? { ...Render.PageSettingsDefault };
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// 更新页面设置
|
|
501
|
-
setPageSettings(settings: PageSettings, update = false) {
|
|
502
|
-
this.stage.setAttr('pageSettings', settings);
|
|
503
|
-
this.emit('page-settings-change', settings);
|
|
504
|
-
// 更新背景
|
|
505
|
-
this.updateBackground();
|
|
506
|
-
if (update) {
|
|
507
|
-
// 更新历史
|
|
508
|
-
this.updateHistory();
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
// 获取背景
|
|
513
|
-
getBackground() {
|
|
514
|
-
return this.draws[BgDraw.name]?.layer.findOne(`.${BgDraw.name}__background`) as Konva.Rect;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
// 更新背景
|
|
518
|
-
updateBackground() {
|
|
519
|
-
this.draws[BgDraw.name]?.draw();
|
|
520
|
-
this.draws[GraphDraw.name]?.draw();
|
|
521
|
-
this.draws[LinkDraw.name]?.draw();
|
|
522
|
-
this.draws[PreviewDraw.name]?.draw();
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
// 素材设置 默认值
|
|
526
|
-
static AssetSettingsDefault: AssetSettings = {
|
|
527
|
-
stroke: '',
|
|
528
|
-
strokeWidth: 0,
|
|
529
|
-
fill: '',
|
|
530
|
-
arrowStart: false,
|
|
531
|
-
arrowEnd: false,
|
|
532
|
-
fontSize: 0,
|
|
533
|
-
textFill: '',
|
|
534
|
-
text: 'Text',
|
|
535
|
-
x: 0,
|
|
536
|
-
y: 0,
|
|
537
|
-
rotation: 0,
|
|
538
|
-
tension: 0
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
// 获取素材设置
|
|
542
|
-
getAssetSettings(asset?: Konva.Node): AssetSettings {
|
|
543
|
-
const base = asset?.attrs.assetSettings ?? { ...Render.AssetSettingsDefault };
|
|
544
|
-
return {
|
|
545
|
-
// 特定
|
|
546
|
-
...base,
|
|
547
|
-
// 继承全局
|
|
548
|
-
stroke: base.stroke
|
|
549
|
-
strokeWidth: base.strokeWidth
|
|
550
|
-
fontSize: base.fontSize || this.getPageSettings().fontSize,
|
|
551
|
-
textFill: base.textFill || this.getPageSettings().textFill,
|
|
552
|
-
// 绘制图形,默认不填充
|
|
553
|
-
fill:
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
const shapes
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
const
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
this.
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
this.
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
// 连接线设置
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
1
|
+
import * as _ from 'lodash';
|
|
2
|
+
import Konva from 'konva';
|
|
3
|
+
import { GraphDraw, LinkDraw, RulerDraw, PreviewDraw, RefLineDraw, BgDraw, ContextmenuDraw } from './draws';
|
|
4
|
+
import { LinkDrawPoint, GraphType, AssetType, RenderConfig, Draw, Handler, RenderEvents, LinkDrawPair, PageSettings, AssetSettings, ImageType, LinkSettings } from './types';
|
|
5
|
+
import { DragHandlers, ZoomHandlers, DragOutsideHandlers, SelectionHandlers, KeyMoveHandlers, ShutcutHandlers, LinkHandlers, GraphHandlers, TextHandlers } from './handlers';
|
|
6
|
+
import { AssetTool, SelectionTool, CopyTool, PositionTool, ZIndexTool, ImportExportTool, AlignTool, LinkTool, AttractTool, ComponentFactory } from './tools';
|
|
7
|
+
|
|
8
|
+
// 简单的事件系统替代 mitt
|
|
9
|
+
class SimpleEventEmitter {
|
|
10
|
+
private listeners: Map<string, Set<Function>> = new Map();
|
|
11
|
+
|
|
12
|
+
on(event: string, handler: Function) {
|
|
13
|
+
if (!this.listeners.has(event)) {
|
|
14
|
+
this.listeners.set(event, new Set());
|
|
15
|
+
}
|
|
16
|
+
this.listeners.get(event)!.add(handler);
|
|
17
|
+
return () => this.off(event, handler);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
off(event: string, handler: Function) {
|
|
21
|
+
this.listeners.get(event)?.delete(handler);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
emit(event: string, ...args: any[]) {
|
|
25
|
+
this.listeners.get(event)?.forEach(handler => handler(...args));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 渲染器
|
|
30
|
+
export class Render {
|
|
31
|
+
stage: Konva.Stage;
|
|
32
|
+
layer: Konva.Layer = new Konva.Layer({ id: 'main' }); // 主要层
|
|
33
|
+
layerFloor: Konva.Layer = new Konva.Layer(); // 辅助层 - 背景
|
|
34
|
+
layerCover: Konva.Layer = new Konva.Layer({ id: 'cover' }); // 辅助层 - 连接线、对齐线
|
|
35
|
+
config: RenderConfig; // 配置
|
|
36
|
+
draws: { [index: string]: (Draw & Handler) | undefined } = {}; // 附加工具
|
|
37
|
+
assetTool: AssetTool; // 素材工具
|
|
38
|
+
selectionTool: SelectionTool; // 选择工具
|
|
39
|
+
copyTool: CopyTool; // 复制工具
|
|
40
|
+
positionTool: PositionTool; // 定位工具
|
|
41
|
+
zIndexTool: ZIndexTool; // 层级工具
|
|
42
|
+
importExportTool: ImportExportTool; // 导入导出
|
|
43
|
+
alignTool: AlignTool; // 对齐工具
|
|
44
|
+
linkTool: LinkTool; // 连线工具
|
|
45
|
+
attractTool: AttractTool; // 磁贴工具
|
|
46
|
+
componentFactory: ComponentFactory; // 统一组件渲染
|
|
47
|
+
groupTransformer: Konva.Group = new Konva.Group(); // 多选器层
|
|
48
|
+
|
|
49
|
+
// 多选器
|
|
50
|
+
transformer: Konva.Transformer = new Konva.Transformer({
|
|
51
|
+
shouldOverdrawWholeArea: true,
|
|
52
|
+
borderDash: [4, 4],
|
|
53
|
+
padding: 1,
|
|
54
|
+
rotationSnaps: [0, 45, 90, 135, 180, 225, 270, 315, 360],
|
|
55
|
+
flipEnabled: false
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// 选择框
|
|
59
|
+
selectRect: Konva.Rect = new Konva.Rect({
|
|
60
|
+
id: 'selectRect',
|
|
61
|
+
fill: 'rgba(0,0,255,0.1)',
|
|
62
|
+
visible: false
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// 事件处理
|
|
66
|
+
handlers: { [index: string]: Handler } = {};
|
|
67
|
+
|
|
68
|
+
// 参数
|
|
69
|
+
bgSize = 20;
|
|
70
|
+
rulerSize = 0;
|
|
71
|
+
previewSize = 0.2; // 预览框大小(比例)
|
|
72
|
+
pointSize = 6;
|
|
73
|
+
history: string[] = [];
|
|
74
|
+
historyIndex = -1;
|
|
75
|
+
graphType: GraphType | undefined = undefined; // 画图类型
|
|
76
|
+
texting = false; // 添加文字中
|
|
77
|
+
showGrid = false; // 显示网格
|
|
78
|
+
showAttract = true; // 显示磁吸
|
|
79
|
+
|
|
80
|
+
// 事件发射器(替代 mitt)
|
|
81
|
+
private emitter = new SimpleEventEmitter();
|
|
82
|
+
on: <K extends keyof RenderEvents>(event: K, handler: (payload: RenderEvents[K]) => void) => (() => void);
|
|
83
|
+
off: <K extends keyof RenderEvents>(event: K, handler: (payload: RenderEvents[K]) => void) => void;
|
|
84
|
+
emit: <K extends keyof RenderEvents>(event: K, payload: RenderEvents[K]) => void;
|
|
85
|
+
|
|
86
|
+
constructor(stageEle: HTMLDivElement, config: RenderConfig) {
|
|
87
|
+
this.config = config;
|
|
88
|
+
// 绑定事件方法
|
|
89
|
+
this.on = this.emitter.on.bind(this.emitter) as any;
|
|
90
|
+
this.off = this.emitter.off.bind(this.emitter) as any;
|
|
91
|
+
this.emit = this.emitter.emit.bind(this.emitter) as any;
|
|
92
|
+
if (this.config.showRuler) {
|
|
93
|
+
this.rulerSize = 40;
|
|
94
|
+
}
|
|
95
|
+
this.stage = new Konva.Stage({
|
|
96
|
+
container: stageEle,
|
|
97
|
+
x: this.rulerSize,
|
|
98
|
+
y: this.rulerSize,
|
|
99
|
+
width: config.width,
|
|
100
|
+
height: config.height
|
|
101
|
+
});
|
|
102
|
+
// 辅助层 - 顶层
|
|
103
|
+
this.groupTransformer.add(this.transformer);
|
|
104
|
+
this.groupTransformer.add(this.selectRect);
|
|
105
|
+
this.layerCover.add(this.groupTransformer);
|
|
106
|
+
|
|
107
|
+
if (this.config.showBg) { // 背景
|
|
108
|
+
this.draws[BgDraw.name] = new BgDraw(this, this.layerFloor, { size: this.bgSize, showGrid: this.showGrid, readonly: this.config.readonly });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
this.draws[LinkDraw.name] = new LinkDraw(this, this.layerCover, {
|
|
112
|
+
size: this.pointSize
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (!this.config.readonly && this.config.showRuler) {
|
|
116
|
+
this.draws[RulerDraw.name] = new RulerDraw(this, this.layerCover, {
|
|
117
|
+
size: this.rulerSize
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (!this.config.readonly && this.config.showRefLine) {
|
|
122
|
+
this.draws[RefLineDraw.name] = new RefLineDraw(this, this.layerCover, {
|
|
123
|
+
padding: this.rulerSize
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (this.config.showContextmenu) {
|
|
128
|
+
this.draws[ContextmenuDraw.name] = new ContextmenuDraw(this, this.layerCover, {});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (!this.config.readonly && this.config.showPreview) {
|
|
132
|
+
this.draws[PreviewDraw.name] = new PreviewDraw(this, this.layerCover, {
|
|
133
|
+
size: this.previewSize
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
this.draws[GraphDraw.name] = new GraphDraw(this, this.layerCover, {});
|
|
138
|
+
|
|
139
|
+
this.assetTool = new AssetTool(this); // 素材工具
|
|
140
|
+
this.selectionTool = new SelectionTool(this); // 选择工具
|
|
141
|
+
this.copyTool = new CopyTool(this); // 复制工具
|
|
142
|
+
this.positionTool = new PositionTool(this); // 定位工具
|
|
143
|
+
this.zIndexTool = new ZIndexTool(this); // 定位工具
|
|
144
|
+
this.importExportTool = new ImportExportTool(this); // 导入导出
|
|
145
|
+
this.alignTool = new AlignTool(this); // 对齐工具
|
|
146
|
+
this.linkTool = new LinkTool(this); // 对齐工具
|
|
147
|
+
this.attractTool = new AttractTool(this); // 磁贴工具
|
|
148
|
+
this.componentFactory = new ComponentFactory(this); // 统一组件渲染
|
|
149
|
+
|
|
150
|
+
// 事件处理
|
|
151
|
+
this.handlers[DragHandlers.name] = new DragHandlers(this);
|
|
152
|
+
this.handlers[ZoomHandlers.name] = new ZoomHandlers(this);
|
|
153
|
+
|
|
154
|
+
if (!this.config.readonly) {
|
|
155
|
+
this.handlers[DragOutsideHandlers.name] = new DragOutsideHandlers(this);
|
|
156
|
+
this.handlers[SelectionHandlers.name] = new SelectionHandlers(this);
|
|
157
|
+
this.handlers[KeyMoveHandlers.name] = new KeyMoveHandlers(this);
|
|
158
|
+
this.handlers[LinkHandlers.name] = new LinkHandlers(this);
|
|
159
|
+
this.handlers[GraphHandlers.name] = new GraphHandlers(this);
|
|
160
|
+
this.handlers[TextHandlers.name] = new TextHandlers(this);
|
|
161
|
+
}
|
|
162
|
+
if (!this.config.readonly && this.config.showRefLine) {
|
|
163
|
+
if (this.draws[RefLineDraw.name] !== void 0) {
|
|
164
|
+
this.handlers[RefLineDraw.name] = this.draws[RefLineDraw.name]!;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
this.handlers[ShutcutHandlers.name] = new ShutcutHandlers(this);
|
|
168
|
+
// 初始化
|
|
169
|
+
this.init();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// 初始化
|
|
173
|
+
init() {
|
|
174
|
+
this.stage.add(this.layerFloor);
|
|
175
|
+
this.draws[BgDraw.name]?.init();
|
|
176
|
+
this.stage.add(this.layer);
|
|
177
|
+
this.stage.add(this.layerCover);
|
|
178
|
+
this.draws[LinkDraw.name]?.init();
|
|
179
|
+
this.draws[RulerDraw.name]?.init();
|
|
180
|
+
this.draws[RefLineDraw.name]?.init();
|
|
181
|
+
this.draws[ContextmenuDraw.name]?.init();
|
|
182
|
+
this.draws[PreviewDraw.name]?.init();
|
|
183
|
+
// 事件绑定
|
|
184
|
+
this.eventBind();
|
|
185
|
+
// 更新历史
|
|
186
|
+
this.updateHistory();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// 更新 stage 尺寸
|
|
190
|
+
resize(width: number, height: number) {
|
|
191
|
+
this.stage.setAttrs({
|
|
192
|
+
width: width,
|
|
193
|
+
height: height
|
|
194
|
+
});
|
|
195
|
+
// 重绘
|
|
196
|
+
this.redraw();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// 移除元素
|
|
200
|
+
remove(nodes: Konva.Node[]) {
|
|
201
|
+
for (const node of nodes) {
|
|
202
|
+
if (node instanceof Konva.Transformer) {
|
|
203
|
+
// 移除已选择的节点
|
|
204
|
+
this.remove(this.selectionTool.selectingNodes);
|
|
205
|
+
} else {
|
|
206
|
+
// 移除相关联系线信息
|
|
207
|
+
const groupId = node.id();
|
|
208
|
+
for (const rn of this.layer.getChildren()) {
|
|
209
|
+
if (rn.id() !== groupId && Array.isArray(rn.attrs.points)) {
|
|
210
|
+
for (const point of rn.attrs.points) {
|
|
211
|
+
if (Array.isArray(point.pairs)) {
|
|
212
|
+
// 移除拐点记录
|
|
213
|
+
if (rn.attrs.manualPointsMap) {
|
|
214
|
+
point.pairs
|
|
215
|
+
.filter(
|
|
216
|
+
(pair: LinkDrawPair) =>
|
|
217
|
+
pair.from.groupId === groupId || pair.to.groupId === groupId
|
|
218
|
+
)
|
|
219
|
+
.forEach((pair: LinkDrawPair) => {
|
|
220
|
+
rn.attrs.manualPointsMap[pair.id] = undefined;
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
// 连接线信息
|
|
224
|
+
point.pairs = point.pairs.filter(
|
|
225
|
+
(pair: LinkDrawPair) =>
|
|
226
|
+
pair.from.groupId !== groupId && pair.to.groupId !== groupId
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
rn.setAttrs({ points: rn.attrs.points });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// 移除未选择的节点
|
|
234
|
+
node.destroy();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (nodes.length > 0) {
|
|
239
|
+
// 清除选择
|
|
240
|
+
this.selectionTool.selectingClear();
|
|
241
|
+
this.linkTool.selectingClear();
|
|
242
|
+
// 更新历史
|
|
243
|
+
this.updateHistory();
|
|
244
|
+
// 重绘
|
|
245
|
+
this.redraw();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// 撤销
|
|
250
|
+
prevHistory() {
|
|
251
|
+
const record = this.history[this.historyIndex - 1];
|
|
252
|
+
if (record) {
|
|
253
|
+
this.importExportTool.restore(record, true);
|
|
254
|
+
this.historyIndex--;
|
|
255
|
+
// 历史变化事件
|
|
256
|
+
this.emit('history-change', {
|
|
257
|
+
records: _.clone(this.history),
|
|
258
|
+
index: this.historyIndex
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// 恢复
|
|
264
|
+
nextHistory() {
|
|
265
|
+
const record = this.history[this.historyIndex + 1];
|
|
266
|
+
if (record) {
|
|
267
|
+
this.importExportTool.restore(record, true);
|
|
268
|
+
this.historyIndex++;
|
|
269
|
+
// 历史变化事件
|
|
270
|
+
this.emit('history-change', {
|
|
271
|
+
records: _.clone(this.history),
|
|
272
|
+
index: this.historyIndex
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
updateHistory() {
|
|
278
|
+
this.history.splice(this.historyIndex + 1);
|
|
279
|
+
this.history.push(this.importExportTool.save());
|
|
280
|
+
this.historyIndex = this.history.length - 1;
|
|
281
|
+
// 历史变化事件
|
|
282
|
+
this.emit('history-change', {
|
|
283
|
+
records: _.clone(this.history),
|
|
284
|
+
index: this.historyIndex
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// 事件绑定
|
|
289
|
+
eventBind() {
|
|
290
|
+
for (const event of [
|
|
291
|
+
'mousedown',
|
|
292
|
+
'mouseup',
|
|
293
|
+
'mousemove',
|
|
294
|
+
'wheel',
|
|
295
|
+
'contextmenu',
|
|
296
|
+
'pointerclick'
|
|
297
|
+
]) {
|
|
298
|
+
this.stage.on(event, (e) => {
|
|
299
|
+
e?.evt?.preventDefault();
|
|
300
|
+
for (const k in this.draws) {
|
|
301
|
+
this.draws[k]?.handlers?.stage?.[event]?.(e);
|
|
302
|
+
}
|
|
303
|
+
for (const k in this.handlers) {
|
|
304
|
+
this.handlers[k]?.handlers?.stage?.[event]?.(e);
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const container = this.stage.container();
|
|
310
|
+
container.tabIndex = 1;
|
|
311
|
+
container.focus();
|
|
312
|
+
for (const event of [
|
|
313
|
+
'mouseenter',
|
|
314
|
+
'dragenter',
|
|
315
|
+
'mousemove',
|
|
316
|
+
'mouseout',
|
|
317
|
+
'dragenter',
|
|
318
|
+
'dragover',
|
|
319
|
+
'drop',
|
|
320
|
+
'keydown',
|
|
321
|
+
'keyup'
|
|
322
|
+
]) {
|
|
323
|
+
container.addEventListener(event, (e) => {
|
|
324
|
+
e?.preventDefault();
|
|
325
|
+
if (['mouseenter', 'dragenter'].includes(event)) {
|
|
326
|
+
// 激活 dom 事件
|
|
327
|
+
this.stage.container().focus();
|
|
328
|
+
}
|
|
329
|
+
for (const k in this.draws) {
|
|
330
|
+
this.draws[k]?.handlers?.dom?.[event]?.(e);
|
|
331
|
+
}
|
|
332
|
+
for (const k in this.handlers) {
|
|
333
|
+
this.handlers[k]?.handlers?.dom?.[event]?.(e);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
for (const event of [
|
|
339
|
+
'mousedown',
|
|
340
|
+
'transformstart',
|
|
341
|
+
'transform',
|
|
342
|
+
'transformend',
|
|
343
|
+
'dragstart',
|
|
344
|
+
'dragmove',
|
|
345
|
+
'dragend',
|
|
346
|
+
'mousemove',
|
|
347
|
+
'mouseleave',
|
|
348
|
+
'dblclick'
|
|
349
|
+
]) {
|
|
350
|
+
this.transformer.on(event, (e) => {
|
|
351
|
+
e?.evt?.preventDefault();
|
|
352
|
+
for (const k in this.draws) {
|
|
353
|
+
this.draws[k]?.handlers?.transformer?.[event]?.(e);
|
|
354
|
+
}
|
|
355
|
+
for (const k in this.handlers) {
|
|
356
|
+
this.handlers[k]?.handlers?.transformer?.[event]?.(e);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
this.handlers[SelectionHandlers.name]?.transformerConfig?.anchorDragBoundFunc &&
|
|
362
|
+
this.transformer.anchorDragBoundFunc(
|
|
363
|
+
this.handlers[SelectionHandlers.name].transformerConfig!.anchorDragBoundFunc!
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// 获取 stage 状态
|
|
368
|
+
getStageState() {
|
|
369
|
+
return {
|
|
370
|
+
width: this.stage.width() - this.rulerSize,
|
|
371
|
+
height: this.stage.height() - this.rulerSize,
|
|
372
|
+
scale: this.stage.scaleX(),
|
|
373
|
+
x: this.stage.x(),
|
|
374
|
+
y: this.stage.y()
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// 相对大小(基于 stage,且无视 scale)
|
|
379
|
+
toStageValue(boardPos: number) {
|
|
380
|
+
return boardPos / this.stage.scaleX();
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// 绝对大小(基于可视区域像素)
|
|
384
|
+
toBoardValue(stagePos: number) {
|
|
385
|
+
return stagePos * this.stage.scaleX();
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// 忽略非素材
|
|
389
|
+
ignore(node: Konva.Node) {
|
|
390
|
+
// 素材有各自根 group
|
|
391
|
+
const isGroup = node instanceof Konva.Group;
|
|
392
|
+
return !isGroup || this.ignoreSelect(node) || this.ignoreDraw(node) || this.ignoreLink(node);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// 忽略 选择时 辅助元素
|
|
396
|
+
ignoreSelect(node: Konva.Node) {
|
|
397
|
+
return node.id() === 'selectRect' || node.id() === 'hoverRect';
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// 忽略各 draw 的根 group
|
|
401
|
+
ignoreDraw(node: Konva.Node) {
|
|
402
|
+
return [BgDraw.name, RulerDraw.name, RefLineDraw.name, ContextmenuDraw.name, PreviewDraw.name, LinkDraw.name, GraphDraw.name].includes(node.name());
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// 忽略各 draw 的根 group
|
|
406
|
+
ignoreLink(node: Konva.Node) {
|
|
407
|
+
return ["link-anchor", "linking-line", "link-point", "link-line", "link-manual-point"].includes(node.name());
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// 重绘(可选择)
|
|
411
|
+
redraw(drawNames?: string[]) {
|
|
412
|
+
const all = [
|
|
413
|
+
// layerFloor
|
|
414
|
+
BgDraw.name, // 更新背景
|
|
415
|
+
// layerCover(按先后顺序)
|
|
416
|
+
GraphDraw.name, // 更新图形调整点
|
|
417
|
+
LinkDraw.name, // 更新连线
|
|
418
|
+
RulerDraw.name, // 更新比例尺
|
|
419
|
+
RefLineDraw.name, // 更新参考线
|
|
420
|
+
PreviewDraw.name, // 更新预览
|
|
421
|
+
ContextmenuDraw.name // 更新右键菜单
|
|
422
|
+
];
|
|
423
|
+
|
|
424
|
+
// 可以以此发现缺失的 draw
|
|
425
|
+
// console.log('redraw', drawNames)
|
|
426
|
+
|
|
427
|
+
if (Array.isArray(drawNames)) {
|
|
428
|
+
// 选择性 draw 也要保持顺序
|
|
429
|
+
for (const name of all) {
|
|
430
|
+
if (drawNames.includes(name)) {
|
|
431
|
+
this.draws[name]?.draw();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
} else {
|
|
435
|
+
for (const name of all) {
|
|
436
|
+
this.draws[name]?.draw();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
changeDraggable(disabled: boolean) {
|
|
442
|
+
this.layer.children.forEach((asset) => {
|
|
443
|
+
// 锁定节点始终保持不可拖拽
|
|
444
|
+
asset.draggable(disabled && !asset.attrs.locked);
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// 改变画图类型
|
|
449
|
+
changeGraphType(type?: GraphType) {
|
|
450
|
+
if (type) {
|
|
451
|
+
this.texting = false;
|
|
452
|
+
this.emit('texting-change', this.texting);
|
|
453
|
+
}
|
|
454
|
+
this.graphType = type;
|
|
455
|
+
this.emit('graph-type-change', this.graphType);
|
|
456
|
+
// 绘制 Graph 的时候,不允许直接拖动其他素材
|
|
457
|
+
this.changeDraggable(!this.config.readonly && this.graphType === void 0);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// 添加文字状态
|
|
461
|
+
changeTexting(texting: boolean) {
|
|
462
|
+
if (texting) {
|
|
463
|
+
this.graphType = undefined;
|
|
464
|
+
this.emit('graph-type-change', this.graphType);
|
|
465
|
+
}
|
|
466
|
+
this.texting = texting;
|
|
467
|
+
this.emit('texting-change', this.texting);
|
|
468
|
+
document.body.style.cursor = this.texting ? 'text' : 'default';
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// 更改网格显示
|
|
472
|
+
changeShowGrid(show: boolean) {
|
|
473
|
+
this.showGrid = show;
|
|
474
|
+
(this.draws[BgDraw.name] as BgDraw)?.updateOption({ showGrid: show });
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// 更改磁吸显示
|
|
478
|
+
changeShowAttract(show: boolean) {
|
|
479
|
+
this.showAttract = show;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// 页面设置 默认值
|
|
483
|
+
static PageSettingsDefault: PageSettings = {
|
|
484
|
+
// 画布默认尺寸
|
|
485
|
+
pageWidth: 1280,
|
|
486
|
+
pageHeight: 720,
|
|
487
|
+
// 样式默认值
|
|
488
|
+
background: undefined,
|
|
489
|
+
linkStroke: 'rgb(0,0,0)',
|
|
490
|
+
linkStrokeWidth: 1,
|
|
491
|
+
fontSize: 24,
|
|
492
|
+
textFill: 'rgb(0,0,0)'
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
// 获取页面设置
|
|
496
|
+
getPageSettings(): PageSettings {
|
|
497
|
+
return this.stage.attrs.pageSettings ?? { ...Render.PageSettingsDefault };
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// 更新页面设置
|
|
501
|
+
setPageSettings(settings: PageSettings, update = false) {
|
|
502
|
+
this.stage.setAttr('pageSettings', settings);
|
|
503
|
+
this.emit('page-settings-change', settings);
|
|
504
|
+
// 更新背景
|
|
505
|
+
this.updateBackground();
|
|
506
|
+
if (update) {
|
|
507
|
+
// 更新历史
|
|
508
|
+
this.updateHistory();
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// 获取背景
|
|
513
|
+
getBackground() {
|
|
514
|
+
return this.draws[BgDraw.name]?.layer.findOne(`.${BgDraw.name}__background`) as Konva.Rect;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// 更新背景
|
|
518
|
+
updateBackground() {
|
|
519
|
+
this.draws[BgDraw.name]?.draw();
|
|
520
|
+
this.draws[GraphDraw.name]?.draw();
|
|
521
|
+
this.draws[LinkDraw.name]?.draw();
|
|
522
|
+
this.draws[PreviewDraw.name]?.draw();
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// 素材设置 默认值
|
|
526
|
+
static AssetSettingsDefault: AssetSettings = {
|
|
527
|
+
// stroke: '',
|
|
528
|
+
// strokeWidth: 0,
|
|
529
|
+
// fill: '',
|
|
530
|
+
arrowStart: false,
|
|
531
|
+
arrowEnd: false,
|
|
532
|
+
fontSize: 0,
|
|
533
|
+
textFill: '',
|
|
534
|
+
text: 'Text',
|
|
535
|
+
x: 0,
|
|
536
|
+
y: 0,
|
|
537
|
+
rotation: 0,
|
|
538
|
+
tension: 0
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
// 获取素材设置
|
|
542
|
+
getAssetSettings(asset?: Konva.Node): AssetSettings {
|
|
543
|
+
const base = asset?.attrs.assetSettings ?? { ...Render.AssetSettingsDefault };
|
|
544
|
+
return {
|
|
545
|
+
// 特定
|
|
546
|
+
...base,
|
|
547
|
+
// 继承全局
|
|
548
|
+
stroke: base.stroke,
|
|
549
|
+
strokeWidth: base.strokeWidth,
|
|
550
|
+
fontSize: base.fontSize || this.getPageSettings().fontSize,
|
|
551
|
+
textFill: base.textFill || this.getPageSettings().textFill,
|
|
552
|
+
// 绘制图形,默认不填充
|
|
553
|
+
fill: base.fill || "transparent",
|
|
554
|
+
x: parseFloat((asset?.position().x ?? 0).toFixed(1)),
|
|
555
|
+
y: parseFloat((asset?.position().y ?? 0).toFixed(1)),
|
|
556
|
+
rotation: parseFloat((asset?.rotation() ?? 0).toFixed(1)),
|
|
557
|
+
tension:
|
|
558
|
+
asset?.attrs.assetType === AssetType.Graph &&
|
|
559
|
+
asset?.attrs.graphType === "Curve"
|
|
560
|
+
? base.tension
|
|
561
|
+
: undefined
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// 设置 svgXML 样式(部分)
|
|
566
|
+
setSvgXMLSettings(xml: string, settings: AssetSettings) {
|
|
567
|
+
const reg = /<(circle|ellipse|line|path|polygon|rect|text|textPath|tref|tspan)[^>/]*\/?>/g;
|
|
568
|
+
const shapes = xml.match(reg);
|
|
569
|
+
const regStroke = / stroke="([^"]*)"/;
|
|
570
|
+
const regFill = / fill="([^"]*)"/;
|
|
571
|
+
|
|
572
|
+
for (const shape of shapes ?? []) {
|
|
573
|
+
let result = shape;
|
|
574
|
+
if (settings.stroke) {
|
|
575
|
+
if (regStroke.test(shape)) {
|
|
576
|
+
result = result.replace(regStroke, ` stroke="${settings.stroke}"`);
|
|
577
|
+
} else {
|
|
578
|
+
result = result.replace(/(<[^>/]*)(\/?>)/, `$1 stroke="${settings.stroke}" $2`);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
if (settings.fill) {
|
|
583
|
+
if (regFill.test(shape)) {
|
|
584
|
+
result = result.replace(regFill, ` fill="${settings.fill}"`);
|
|
585
|
+
} else {
|
|
586
|
+
result = result.replace(/(<[^>/]*)(\/?>)/, `$1 fill="${settings.fill}" $2`);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
xml = xml.replace(shape, result);
|
|
591
|
+
}
|
|
592
|
+
return xml;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
rotatePoint({ x, y }: { x: number; y: number }, rad: number) {
|
|
596
|
+
const rCos = Math.cos(rad);
|
|
597
|
+
const rSin = Math.sin(rad);
|
|
598
|
+
return { x: x * rCos - y * rSin, y: y * rCos + x * rSin };
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
rotateAroundCenter(node: Konva.Node, rotation: number) {
|
|
602
|
+
const topLeft = { x: -node.width() / 2, y: -node.height() / 2 };
|
|
603
|
+
const current = this.rotatePoint(topLeft, Konva.getAngle(node.rotation()));
|
|
604
|
+
const rotated = this.rotatePoint(topLeft, Konva.getAngle(rotation));
|
|
605
|
+
const dx = rotated.x - current.x;
|
|
606
|
+
const dy = rotated.y - current.y;
|
|
607
|
+
|
|
608
|
+
node.rotation(rotation);
|
|
609
|
+
node.x(node.x() + dx);
|
|
610
|
+
node.y(node.y() + dy);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// 更新素材设置
|
|
614
|
+
async setAssetSettings(asset: Konva.Node, settings: AssetSettings, update = false) {
|
|
615
|
+
if (asset instanceof Konva.Group) {
|
|
616
|
+
this.componentFactory.updateComponentSetting({ node: asset, settings }); // 更新组件配置
|
|
617
|
+
if (asset.attrs.imageType === ImageType.svg) {
|
|
618
|
+
const node = asset.children[0] as Konva.Shape;
|
|
619
|
+
if (node instanceof Konva.Image) {
|
|
620
|
+
if (node.attrs.svgXML) {
|
|
621
|
+
// 仅在 stroke/fill 变化时才重建 SVG 节点
|
|
622
|
+
const currentSettings = asset.attrs.assetSettings;
|
|
623
|
+
const strokeChanged = settings.stroke !== currentSettings?.stroke;
|
|
624
|
+
const fillChanged = settings.fill !== currentSettings?.fill;
|
|
625
|
+
if (strokeChanged || fillChanged) {
|
|
626
|
+
const n = await this.assetTool.loadSvgXML(
|
|
627
|
+
this.setSvgXMLSettings(node.attrs.svgXML, settings)
|
|
628
|
+
);
|
|
629
|
+
// 保留旧节点的变换状态
|
|
630
|
+
n.x(node.x());
|
|
631
|
+
n.y(node.y());
|
|
632
|
+
n.scaleX(node.scaleX());
|
|
633
|
+
n.scaleY(node.scaleY());
|
|
634
|
+
n.rotation(node.rotation());
|
|
635
|
+
node.parent?.add(n);
|
|
636
|
+
node.remove();
|
|
637
|
+
node.destroy();
|
|
638
|
+
n.zIndex(0);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
} else if (asset.attrs.assetType === AssetType.Graph) {
|
|
643
|
+
const node = asset.findOne('.graph');
|
|
644
|
+
if (node instanceof Konva.Shape) {
|
|
645
|
+
node.strokeWidth(settings.strokeWidth);
|
|
646
|
+
node.stroke(settings.stroke);
|
|
647
|
+
if (node instanceof Konva.Arrow) {
|
|
648
|
+
// 箭头跟随 stroke
|
|
649
|
+
node.fill(settings.stroke);
|
|
650
|
+
} else {
|
|
651
|
+
node.fill(settings.fill);
|
|
652
|
+
}
|
|
653
|
+
if (node instanceof Konva.Arrow) {
|
|
654
|
+
node.pointerAtBeginning(settings.arrowStart);
|
|
655
|
+
node.pointerAtEnding(settings.arrowEnd);
|
|
656
|
+
}
|
|
657
|
+
if (node instanceof Konva.Arrow && asset.attrs.graphType === "Curve") {
|
|
658
|
+
node.tension(settings.tension);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
} else if (asset.attrs.assetType === AssetType.Text) {
|
|
662
|
+
const node = asset.findOne('Text');
|
|
663
|
+
const rect = asset.findOne('Rect');
|
|
664
|
+
if (node instanceof Konva.Text && rect instanceof Konva.Rect) {
|
|
665
|
+
let sizeChanged = false;
|
|
666
|
+
if (node.fontSize() !== settings.fontSize || node.text() !== settings.text) {
|
|
667
|
+
sizeChanged = true;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
node.fill(settings.textFill);
|
|
671
|
+
node.fontSize(settings.fontSize);
|
|
672
|
+
node.text(settings.text);
|
|
673
|
+
|
|
674
|
+
// 内容为空时,给一个半透明背景色
|
|
675
|
+
rect.fill(node.text().trim() ? '' : 'rgba(0,0,0,0.1)');
|
|
676
|
+
rect.width(Math.max(node.width(), settings.fontSize));
|
|
677
|
+
rect.height(Math.max(node.height(), settings.fontSize));
|
|
678
|
+
|
|
679
|
+
// 刷新 transformer 大小
|
|
680
|
+
if (sizeChanged) {
|
|
681
|
+
this.selectionTool.select([asset]);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// rotate 会影响 position,不能同时改变
|
|
687
|
+
if (Math.abs(settings.rotation - asset.rotation()) >= 0.1) {
|
|
688
|
+
this.rotateAroundCenter(asset, settings.rotation);
|
|
689
|
+
// tooltip 始终箭头朝下,不受 group 旋转影响
|
|
690
|
+
asset.findOne('.tooltip')?.rotation(-asset.rotation());
|
|
691
|
+
// 同步 position 的变化
|
|
692
|
+
this.emit('asset-position-change', [asset]);
|
|
693
|
+
} else {
|
|
694
|
+
const prevSettings = this.getAssetSettings(asset);
|
|
695
|
+
asset.position({
|
|
696
|
+
x: parseFloat(settings.x.toFixed(1)),
|
|
697
|
+
y: parseFloat(settings.y.toFixed(1))
|
|
698
|
+
});
|
|
699
|
+
// 外部调用变化同步
|
|
700
|
+
if (settings.x !== prevSettings.x || settings.y !== prevSettings.y) {
|
|
701
|
+
this.emit('asset-position-change', [asset]);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
asset.setAttr('assetSettings', settings);
|
|
706
|
+
if (update) {
|
|
707
|
+
// 更新历史
|
|
708
|
+
this.updateHistory();
|
|
709
|
+
}
|
|
710
|
+
this.draws[BgDraw.name]?.draw();
|
|
711
|
+
this.draws[GraphDraw.name]?.draw();
|
|
712
|
+
this.draws[LinkDraw.name]?.draw();
|
|
713
|
+
this.draws[PreviewDraw.name]?.draw();
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// 获取画布上所有素材节点及其配置
|
|
717
|
+
getAllAssets(): Array<{ id: string; assetType: AssetType; settings: AssetSettings, componentType?: string }> {
|
|
718
|
+
const nodes = this.layer.getChildren((node) => !this.ignore(node));
|
|
719
|
+
return nodes.map((node) => ({
|
|
720
|
+
id: node.id(),
|
|
721
|
+
assetType: node.attrs.assetType as AssetType,
|
|
722
|
+
componentType: node.attrs.componentType,
|
|
723
|
+
settings: this.getAssetSettings(node)
|
|
724
|
+
}));
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// 根据节点 id 动态更新组件属性
|
|
728
|
+
updateAssetById(id: string, settings: Partial<AssetSettings>) {
|
|
729
|
+
const node: Konva.Group = this.layer.findOne(`#${id}`);
|
|
730
|
+
if (!node) {
|
|
731
|
+
console.warn(`[Render.updateAssetById] 未找到节点 id=${id}`);
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
// 合并现有设置与新设置
|
|
735
|
+
const currentSettings = this.getAssetSettings(node);
|
|
736
|
+
const mergedSettings: AssetSettings = { ...currentSettings, ...settings };
|
|
737
|
+
// 调用现有方法应用
|
|
738
|
+
this.setAssetSettings(node, mergedSettings, false);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// 连接线设置 默认值
|
|
742
|
+
static LinkSettingsDefault: LinkSettings = {
|
|
743
|
+
stroke: '',
|
|
744
|
+
strokeWidth: 0,
|
|
745
|
+
arrowStart: false,
|
|
746
|
+
arrowEnd: false,
|
|
747
|
+
tension: 0
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
// 连接线设置
|
|
751
|
+
async setLinkSettings(link: Konva.Line, settings: LinkSettings, update = false) {
|
|
752
|
+
const group = this.layer.findOne(`#${link.attrs.groupId}`);
|
|
753
|
+
if (Array.isArray(group?.attrs.points)) {
|
|
754
|
+
const point = (group?.attrs.points as LinkDrawPoint[]).find(
|
|
755
|
+
(o: LinkDrawPoint) => o.id === link.attrs.pointId
|
|
756
|
+
);
|
|
757
|
+
if (point) {
|
|
758
|
+
const pair = point.pairs.find((o) => o.id === link.attrs.pairId);
|
|
759
|
+
if (pair) {
|
|
760
|
+
pair.style = {
|
|
761
|
+
...pair.style,
|
|
762
|
+
...settings,
|
|
763
|
+
strokeWidth: Number(settings.strokeWidth ?? pair.style.strokeWidth),
|
|
764
|
+
};
|
|
765
|
+
group.setAttr('points', group?.attrs.points);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
if (update) {
|
|
771
|
+
// 更新历史
|
|
772
|
+
this.updateHistory();
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
this.draws[BgDraw.name]?.draw();
|
|
776
|
+
this.draws[GraphDraw.name]?.draw();
|
|
777
|
+
this.draws[LinkDraw.name]?.draw();
|
|
778
|
+
this.draws[PreviewDraw.name]?.draw();
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// 获取连接线设置
|
|
782
|
+
getLinkSettings(link?: Konva.Line): LinkSettings {
|
|
783
|
+
let settings: (Konva.LineConfig & LinkSettings) | undefined = undefined;
|
|
784
|
+
if (link) {
|
|
785
|
+
const group = this.layer.findOne(`#${link.attrs.groupId}`);
|
|
786
|
+
if (Array.isArray(group?.attrs.points)) {
|
|
787
|
+
const point = (group?.attrs.points as LinkDrawPoint[]).find(
|
|
788
|
+
(o: LinkDrawPoint) => o.id === link.attrs.pointId
|
|
789
|
+
);
|
|
790
|
+
if (point) {
|
|
791
|
+
const pair = point.pairs.find((o) => o.id === link.attrs.pairId);
|
|
792
|
+
if (pair) {
|
|
793
|
+
settings = pair.style;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
const base = settings ?? { ...Render.LinkSettingsDefault };
|
|
800
|
+
|
|
801
|
+
return {
|
|
802
|
+
// 特定
|
|
803
|
+
...base,
|
|
804
|
+
// 继承全局
|
|
805
|
+
stroke: (base.stroke as string) || this.getPageSettings().linkStroke,
|
|
806
|
+
strokeWidth: base.strokeWidth || this.getPageSettings().linkStrokeWidth
|
|
807
|
+
};
|
|
808
|
+
}
|
|
800
809
|
}
|