@luck-design-biz/luckda 0.0.24-2 → 0.0.25-2
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/es/components/Builder/index.js +6 -4
- package/es/components/IconFont/index.js +5 -0
- package/es/components/LDActions/index.js +133 -0
- package/es/components/LDActions/index.less +65 -0
- package/es/components/LdAutoForm/index.js +1 -1
- package/es/components/LdCom/index.js +2 -1
- package/es/components/LdFormList/index.js +15 -10
- package/es/components/LdGrid/index.js +14 -8
- package/es/components/LdGridForm/index.js +5 -4
- package/es/components/LdRuntimeCom/index.js +20 -7
- package/es/components/LdTree/index.js +112 -31
- package/es/components/LdTree/index.less +6 -1
- package/es/helper/ldBuilder.js +28 -12
- package/es/helper/ldComBuild.js +29 -14
- package/es/index.js +1 -0
- package/es/locales/zh-CN.js +230 -0
- package/es/lowcode/constants/api-url.js +464 -262
- package/es/lowcode/constants/event-topics.js +4 -0
- package/es/lowcode/constants/index.js +31 -2
- package/es/lowcode/engine/factory/panel-item-factory/CheckboxStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/index.js +2 -0
- package/es/lowcode/engine/meta/box.props.default.json +4 -3
- package/es/lowcode/engine/meta/box.props.json +2 -4
- package/es/lowcode/engine/meta/button.props.default.json +5 -2
- package/es/lowcode/engine/meta/button.props.json +9 -9
- package/es/lowcode/engine/meta/cardlist.props.default.json +4 -2
- package/es/lowcode/engine/meta/cardlist.props.json +2 -3
- package/es/lowcode/engine/meta/components-list.json +1 -1
- package/es/lowcode/engine/meta/dialog.props.default.json +4 -2
- package/es/lowcode/engine/meta/dialog.props.json +1 -2
- package/es/lowcode/engine/meta/drawer.props.default.json +4 -2
- package/es/lowcode/engine/meta/drawer.props.json +1 -2
- package/es/lowcode/engine/meta/form.props.default.json +52 -4
- package/es/lowcode/engine/meta/form.props.json +596 -64
- package/es/lowcode/engine/meta/iframe.props.default.json +1 -1
- package/es/lowcode/engine/meta/iframe.props.json +1 -1
- package/es/lowcode/engine/meta/image.props.default.json +5 -2
- package/es/lowcode/engine/meta/image.props.json +3 -3
- package/es/lowcode/engine/meta/imex.props.default.json +5 -2
- package/es/lowcode/engine/meta/imex.props.json +2 -2
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +152 -26
- package/es/lowcode/engine/meta/jsx.props.default.json +2 -1
- package/es/lowcode/engine/meta/jsx.props.json +10 -5
- package/es/lowcode/engine/meta/layout.props.default.json +5 -2
- package/es/lowcode/engine/meta/layout.props.json +1 -2
- package/es/lowcode/engine/meta/link.props.default.json +5 -2
- package/es/lowcode/engine/meta/link.props.json +3 -3
- package/es/lowcode/engine/meta/local/local.zh-cn.js +97 -0
- package/es/lowcode/engine/meta/page.props.default.json +12 -0
- package/es/lowcode/engine/meta/page.props.json +49 -0
- package/es/lowcode/engine/meta/pagecontent.props.default.json +6 -0
- package/es/lowcode/engine/meta/pagecontent.props.json +7 -0
- package/es/lowcode/engine/meta/pagefooter.props.default.json +6 -0
- package/es/lowcode/engine/meta/pagefooter.props.json +7 -0
- package/es/lowcode/engine/meta/pageheader.props.default.json +6 -0
- package/es/lowcode/engine/meta/pageheader.props.json +7 -0
- package/es/lowcode/engine/meta/section.props.default.json +7 -6
- package/es/lowcode/engine/meta/section.props.json +52 -49
- package/es/lowcode/engine/meta/split.props.default.json +9 -4
- package/es/lowcode/engine/meta/split.props.json +14 -29
- package/es/lowcode/engine/meta/table.props.default.json +23 -3
- package/es/lowcode/engine/meta/table.props.json +257 -55
- package/es/lowcode/engine/meta/tabs.props.default.json +16 -9
- package/es/lowcode/engine/meta/tabs.props.json +57 -81
- package/es/lowcode/engine/meta/text.props.default.json +5 -2
- package/es/lowcode/engine/meta/text.props.json +3 -3
- package/es/lowcode/engine/meta/tree.props.default.json +20 -7
- package/es/lowcode/engine/meta/tree.props.json +225 -79
- package/es/lowcode/engine/provider/ContextProvider/index.js +177 -0
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +174 -0
- package/es/lowcode/engine/tools/dataProcess.js +64 -2
- package/es/lowcode/engine/tools/helper.js +97 -18
- package/es/lowcode/engine/tools/useCanvasRender.js +73 -0
- package/es/lowcode/engine/tools/usePromiseState.js +23 -12
- package/es/lowcode/engine/tools/useTodo.js +78 -0
- package/es/lowcode/index.js +1 -0
- package/es/lowcode/painter/Components.js +47 -21
- package/es/lowcode/painter/Design.js +34 -2
- package/es/lowcode/painter/DesignOperator.js +48 -31
- package/es/lowcode/painter/DesignToolbar.js +324 -16
- package/es/lowcode/painter/I18n.js +2 -2
- package/es/lowcode/painter/Outline.js +31 -26
- package/es/lowcode/painter/Panel.js +99 -142
- package/es/lowcode/painter/Ribbon.js +1 -1
- package/es/lowcode/painter/components/ActionBindModal.js +293 -0
- package/es/lowcode/painter/components/AdvancePanel.js +140 -0
- package/es/lowcode/painter/components/AttrsPanel.js +145 -0
- package/es/lowcode/painter/components/Collapse.js +20 -9
- package/es/lowcode/painter/components/ColorInput.js +5 -3
- package/es/lowcode/painter/components/DragDrop/DragDropContext.js +137 -0
- package/es/lowcode/painter/components/DragDrop/DragDropWrapper.js +50 -0
- package/es/lowcode/painter/components/DragDrop/Overlay.js +8 -0
- package/es/lowcode/painter/components/DragDrop/TreeDragDropWrapper.js +67 -0
- package/es/lowcode/painter/components/FieldSelector.js +44 -0
- package/es/lowcode/painter/components/ListEditor.js +26 -11
- package/es/lowcode/painter/components/PanelItem.js +1 -1
- package/es/lowcode/painter/components/PopConfirm.js +10 -3
- package/es/lowcode/painter/components/SortBox.js +11 -4
- package/es/lowcode/painter/components/TreeEditor.js +13 -0
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +14 -2
- package/es/lowcode/painter/components/code-editor/JSEditor.js +25 -14
- package/es/lowcode/painter/components/code-editor/JsonEditor.js +41 -0
- package/es/lowcode/painter/components/field-setting/BatchSetting.js +154 -0
- package/es/lowcode/painter/components/field-setting/CheckRules.js +126 -0
- package/es/lowcode/painter/components/field-setting/FieldAttrs.js +287 -0
- package/es/lowcode/painter/components/field-setting/FieldAttrsModal.js +290 -0
- package/es/lowcode/painter/components/field-setting/FieldDefaultValue.js +63 -0
- package/es/lowcode/painter/components/field-setting/FieldRulesModal.js +116 -0
- package/es/lowcode/painter/components/field-setting/SettingUI.js +438 -0
- package/es/lowcode/painter/components/field-setting/index.js +373 -0
- package/es/lowcode/painter/index.js +3 -28
- package/es/lowcode/painter/panel-section/ActionsColumnWidth.js +25 -0
- package/es/lowcode/painter/panel-section/ActionsEditor/ActionEditor.js +101 -0
- package/es/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/index.js +74 -13
- package/es/lowcode/painter/panel-section/BlockEditor/index.js +27 -0
- package/es/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +45 -0
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +235 -0
- package/es/lowcode/painter/panel-section/DataSetSelector.js +115 -43
- package/es/lowcode/painter/panel-section/FieldsSetting.js +329 -0
- package/es/lowcode/painter/panel-section/I18nInput.js +20 -0
- package/es/lowcode/painter/panel-section/Icon.js +14 -14
- package/es/lowcode/painter/panel-section/IconConditionSelector.js +111 -0
- package/es/lowcode/painter/panel-section/IconSelector.js +5 -2
- package/es/lowcode/painter/panel-section/ImpExp.js +91 -0
- package/es/lowcode/painter/panel-section/JSEditor.js +49 -0
- package/es/lowcode/painter/panel-section/LayoutRatio.js +6 -7
- package/es/lowcode/painter/panel-section/SerialsSelector.js +44 -0
- package/es/lowcode/painter/panel-section/SplitDisplay.js +248 -0
- package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/StyleContext.js +2 -22
- package/es/lowcode/painter/panel-section/TabItems.js +46 -30
- package/es/lowcode/painter/panel-section/TableTopFilter.js +306 -0
- package/es/lowcode/painter/panel-section/TableZebra.js +66 -6
- package/es/lowcode/painter/panel-section/TreeRootEditor.js +78 -0
- package/es/lowcode/painter/style/action-bind-modal.less +102 -0
- package/es/lowcode/painter/style/collapse.less +6 -0
- package/es/lowcode/painter/style/components.less +5 -4
- package/es/lowcode/painter/style/design.less +7 -4
- package/es/lowcode/painter/style/dragdrop.less +10 -0
- package/es/lowcode/painter/style/fields-setting.less +25 -0
- package/es/lowcode/painter/style/impexp.less +7 -0
- package/es/lowcode/painter/style/list-editor.less +36 -0
- package/es/lowcode/painter/style/panel-attrs.less +43 -0
- package/es/lowcode/painter/style/panel.less +6 -37
- package/es/lowcode/painter/style/pop-confirm.less +9 -2
- package/es/lowcode/painter/style/split-display.less +28 -0
- package/es/lowcode/painter/style/treedragdrop.less +19 -0
- package/es/lowcode/preview/index.js +27 -0
- package/es/lowcode/view/Canvas.js +34 -139
- package/es/lowcode/view/Loading.js +6 -2
- package/es/lowcode/view/Page.js +16 -14
- package/es/lowcode/view/lc-components/Box/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Box/index.js +11 -2
- package/es/lowcode/view/lc-components/Box/index.less +0 -1
- package/es/lowcode/view/lc-components/Box/meta.json +2 -4
- package/es/lowcode/view/lc-components/Button/FunctionDesign.js +8 -10
- package/es/lowcode/view/lc-components/Button/FunctionLive.js +3 -6
- package/es/lowcode/view/lc-components/Button/FunctionPreview.js +6 -0
- package/es/lowcode/view/lc-components/Button/index.js +43 -20
- package/es/lowcode/view/lc-components/Button/meta.json +9 -9
- package/es/lowcode/view/lc-components/CardList/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/CardList/index.js +1 -0
- package/es/lowcode/view/lc-components/CardList/meta.json +2 -3
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +16 -24
- package/es/lowcode/view/lc-components/Dialog/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Dialog/index.js +1 -0
- package/es/lowcode/view/lc-components/Dialog/meta.json +1 -2
- package/es/lowcode/view/lc-components/Drawer/FunctionDesign.js +4 -2
- package/es/lowcode/view/lc-components/Drawer/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Drawer/index.js +17 -0
- package/es/lowcode/view/lc-components/Drawer/index.less +3 -0
- package/es/lowcode/view/lc-components/Drawer/meta.json +1 -2
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +93 -2
- package/es/lowcode/view/lc-components/Form/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Form/index.js +290 -13
- package/es/lowcode/view/lc-components/Form/index.less +5 -0
- package/es/lowcode/view/lc-components/Form/meta.json +546 -64
- package/es/lowcode/view/lc-components/Iframe/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Iframe/index.js +1 -0
- package/es/lowcode/view/lc-components/Iframe/meta.json +1 -1
- package/es/lowcode/view/lc-components/ImEx/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/ImEx/index.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +2 -2
- package/es/lowcode/view/lc-components/Image/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Image/index.js +1 -0
- package/es/lowcode/view/lc-components/Image/meta.json +3 -3
- package/es/lowcode/view/lc-components/JSX/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/JSX/index.js +19 -6
- package/es/lowcode/view/lc-components/JSX/meta.json +8 -5
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +23 -22
- package/es/lowcode/view/lc-components/Layout/FunctionLive.js +3 -8
- package/es/lowcode/view/lc-components/Layout/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Layout/index.js +1 -0
- package/es/lowcode/view/lc-components/Layout/meta.json +1 -2
- package/es/lowcode/view/lc-components/Link/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Link/index.js +1 -0
- package/es/lowcode/view/lc-components/Link/meta.json +3 -3
- package/es/lowcode/view/lc-components/Page/meta.json +49 -0
- package/es/lowcode/view/lc-components/PageContent/index.js +53 -0
- package/es/lowcode/view/lc-components/PageContent/meta.json +9 -0
- package/es/lowcode/view/lc-components/PageFooter/index.js +38 -0
- package/es/lowcode/view/lc-components/PageFooter/meta.json +9 -0
- package/es/lowcode/view/lc-components/PageHeader/index.js +40 -0
- package/es/lowcode/view/lc-components/PageHeader/meta.json +9 -0
- package/es/lowcode/view/lc-components/PageModal/index.js +23 -0
- package/es/lowcode/view/lc-components/Section/FunctionDesign.js +31 -2
- package/es/lowcode/view/lc-components/Section/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Section/index.js +115 -24
- package/es/lowcode/view/lc-components/Section/index.less +7 -0
- package/es/lowcode/view/lc-components/Section/meta.json +48 -49
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +57 -2
- package/es/lowcode/view/lc-components/Split/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Split/index.js +46 -7
- package/es/lowcode/view/lc-components/Split/meta.json +10 -29
- package/es/lowcode/view/lc-components/Table/FunctionDesign.js +41 -4
- package/es/lowcode/view/lc-components/Table/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Table/components/TopFilter.js +96 -0
- package/es/lowcode/view/lc-components/Table/index.js +365 -48
- package/es/lowcode/view/lc-components/Table/meta.json +229 -55
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +70 -2
- package/es/lowcode/view/lc-components/Tabs/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Tabs/FunctionPreview.js +10 -0
- package/es/lowcode/view/lc-components/Tabs/index.js +113 -10
- package/es/lowcode/view/lc-components/Tabs/meta.json +53 -81
- package/es/lowcode/view/lc-components/Text/FunctionPreview.js +9 -0
- package/es/lowcode/view/lc-components/Text/index.js +1 -0
- package/es/lowcode/view/lc-components/Text/meta.json +3 -3
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +63 -3
- package/es/lowcode/view/lc-components/Tree/FunctionPreview.js +26 -0
- package/es/lowcode/view/lc-components/Tree/index.js +323 -8
- package/es/lowcode/view/lc-components/Tree/index.less +5 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +224 -80
- package/es/lowcode/view/lc-components/Wrapper.js +44 -27
- package/es/lowcode/view/style/page.less +3 -0
- package/es/services.js +5 -3
- package/es/upload/Form/gridForm.js +7 -3
- package/es/utils/grid.js +2 -2
- package/lib/components/Builder/index.js +4 -1
- package/lib/components/IconFont/index.js +11 -0
- package/lib/components/LDActions/index.js +141 -0
- package/lib/components/LDActions/index.less +65 -0
- package/lib/components/LdAutoForm/index.js +1 -1
- package/lib/components/LdCom/index.js +2 -1
- package/lib/components/LdFormList/index.js +14 -9
- package/lib/components/LdGrid/index.js +13 -7
- package/lib/components/LdGridForm/index.js +4 -3
- package/lib/components/LdRuntimeCom/index.js +21 -8
- package/lib/components/LdTree/index.js +112 -31
- package/lib/components/LdTree/index.less +6 -1
- package/lib/helper/ldBuilder.js +28 -12
- package/lib/helper/ldComBuild.js +27 -12
- package/lib/index.js +8 -0
- package/lib/locales/zh-CN.js +236 -0
- package/lib/lowcode/constants/api-url.js +465 -263
- package/lib/lowcode/constants/event-topics.js +5 -1
- package/lib/lowcode/constants/index.js +32 -3
- package/lib/lowcode/engine/factory/panel-item-factory/CheckboxStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/index.js +2 -0
- package/lib/lowcode/engine/meta/box.props.default.json +4 -3
- package/lib/lowcode/engine/meta/box.props.json +2 -4
- package/lib/lowcode/engine/meta/button.props.default.json +5 -2
- package/lib/lowcode/engine/meta/button.props.json +9 -9
- package/lib/lowcode/engine/meta/cardlist.props.default.json +4 -2
- package/lib/lowcode/engine/meta/cardlist.props.json +2 -3
- package/lib/lowcode/engine/meta/components-list.json +1 -1
- package/lib/lowcode/engine/meta/dialog.props.default.json +4 -2
- package/lib/lowcode/engine/meta/dialog.props.json +1 -2
- package/lib/lowcode/engine/meta/drawer.props.default.json +4 -2
- package/lib/lowcode/engine/meta/drawer.props.json +1 -2
- package/lib/lowcode/engine/meta/form.props.default.json +52 -4
- package/lib/lowcode/engine/meta/form.props.json +596 -64
- package/lib/lowcode/engine/meta/iframe.props.default.json +1 -1
- package/lib/lowcode/engine/meta/iframe.props.json +1 -1
- package/lib/lowcode/engine/meta/image.props.default.json +5 -2
- package/lib/lowcode/engine/meta/image.props.json +3 -3
- package/lib/lowcode/engine/meta/imex.props.default.json +5 -2
- package/lib/lowcode/engine/meta/imex.props.json +2 -2
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +152 -26
- package/lib/lowcode/engine/meta/jsx.props.default.json +2 -1
- package/lib/lowcode/engine/meta/jsx.props.json +10 -5
- package/lib/lowcode/engine/meta/layout.props.default.json +5 -2
- package/lib/lowcode/engine/meta/layout.props.json +1 -2
- package/lib/lowcode/engine/meta/link.props.default.json +5 -2
- package/lib/lowcode/engine/meta/link.props.json +3 -3
- package/lib/lowcode/engine/meta/local/local.zh-cn.js +103 -0
- package/lib/lowcode/engine/meta/page.props.default.json +12 -0
- package/lib/lowcode/engine/meta/page.props.json +49 -0
- package/lib/lowcode/engine/meta/pagecontent.props.default.json +6 -0
- package/lib/lowcode/engine/meta/pagecontent.props.json +7 -0
- package/lib/lowcode/engine/meta/pagefooter.props.default.json +6 -0
- package/lib/lowcode/engine/meta/pagefooter.props.json +7 -0
- package/lib/lowcode/engine/meta/pageheader.props.default.json +6 -0
- package/lib/lowcode/engine/meta/pageheader.props.json +7 -0
- package/lib/lowcode/engine/meta/section.props.default.json +7 -6
- package/lib/lowcode/engine/meta/section.props.json +52 -49
- package/lib/lowcode/engine/meta/split.props.default.json +9 -4
- package/lib/lowcode/engine/meta/split.props.json +14 -29
- package/lib/lowcode/engine/meta/table.props.default.json +23 -3
- package/lib/lowcode/engine/meta/table.props.json +257 -55
- package/lib/lowcode/engine/meta/tabs.props.default.json +16 -9
- package/lib/lowcode/engine/meta/tabs.props.json +57 -81
- package/lib/lowcode/engine/meta/text.props.default.json +5 -2
- package/lib/lowcode/engine/meta/text.props.json +3 -3
- package/lib/lowcode/engine/meta/tree.props.default.json +20 -7
- package/lib/lowcode/engine/meta/tree.props.json +225 -79
- package/lib/lowcode/engine/provider/ContextProvider/index.js +185 -0
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +182 -0
- package/lib/lowcode/engine/tools/dataProcess.js +64 -1
- package/lib/lowcode/engine/tools/helper.js +101 -17
- package/lib/lowcode/engine/tools/useCanvasRender.js +88 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +22 -12
- package/lib/lowcode/engine/tools/useTodo.js +85 -0
- package/lib/lowcode/index.js +7 -0
- package/lib/lowcode/painter/Components.js +46 -20
- package/lib/lowcode/painter/Design.js +32 -0
- package/lib/lowcode/painter/DesignOperator.js +45 -28
- package/lib/lowcode/painter/DesignToolbar.js +321 -13
- package/lib/lowcode/painter/I18n.js +1 -1
- package/lib/lowcode/painter/Outline.js +29 -24
- package/lib/lowcode/painter/Panel.js +96 -139
- package/lib/lowcode/painter/Ribbon.js +1 -1
- package/lib/lowcode/painter/components/ActionBindModal.js +300 -0
- package/lib/lowcode/painter/components/AdvancePanel.js +148 -0
- package/lib/lowcode/painter/components/AttrsPanel.js +153 -0
- package/lib/lowcode/painter/components/Collapse.js +20 -9
- package/lib/lowcode/painter/components/ColorInput.js +5 -3
- package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +146 -0
- package/lib/lowcode/painter/components/DragDrop/DragDropWrapper.js +57 -0
- package/lib/lowcode/painter/components/DragDrop/Overlay.js +15 -0
- package/lib/lowcode/painter/components/DragDrop/TreeDragDropWrapper.js +75 -0
- package/lib/lowcode/painter/components/FieldSelector.js +52 -0
- package/lib/lowcode/painter/components/ListEditor.js +25 -10
- package/lib/lowcode/painter/components/PanelItem.js +1 -1
- package/lib/lowcode/painter/components/PopConfirm.js +10 -3
- package/lib/lowcode/painter/components/SortBox.js +12 -5
- package/lib/lowcode/painter/components/TreeEditor.js +20 -0
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +14 -2
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +25 -14
- package/lib/lowcode/painter/components/code-editor/JsonEditor.js +48 -0
- package/lib/lowcode/painter/components/field-setting/BatchSetting.js +161 -0
- package/lib/lowcode/painter/components/field-setting/CheckRules.js +133 -0
- package/lib/lowcode/painter/components/field-setting/FieldAttrs.js +295 -0
- package/lib/lowcode/painter/components/field-setting/FieldAttrsModal.js +298 -0
- package/lib/lowcode/painter/components/field-setting/FieldDefaultValue.js +70 -0
- package/lib/lowcode/painter/components/field-setting/FieldRulesModal.js +123 -0
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +446 -0
- package/lib/lowcode/painter/components/field-setting/index.js +380 -0
- package/lib/lowcode/painter/index.js +3 -30
- package/lib/lowcode/painter/panel-section/ActionsColumnWidth.js +32 -0
- package/lib/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/ActionEditor.js +20 -66
- package/lib/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/index.js +71 -10
- package/lib/lowcode/painter/panel-section/BlockEditor/index.js +34 -0
- package/lib/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +52 -0
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +242 -0
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +112 -40
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +337 -0
- package/lib/lowcode/painter/panel-section/I18nInput.js +27 -0
- package/lib/lowcode/painter/panel-section/Icon.js +16 -14
- package/lib/lowcode/painter/panel-section/IconConditionSelector.js +119 -0
- package/lib/lowcode/painter/panel-section/IconSelector.js +5 -2
- package/lib/lowcode/painter/panel-section/ImpExp.js +98 -0
- package/lib/lowcode/painter/panel-section/JSEditor.js +57 -0
- package/lib/lowcode/painter/panel-section/LayoutRatio.js +5 -6
- package/lib/lowcode/painter/panel-section/SerialsSelector.js +51 -0
- package/lib/lowcode/painter/panel-section/SplitDisplay.js +256 -0
- package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +3 -23
- package/lib/lowcode/painter/panel-section/TabItems.js +45 -29
- package/lib/lowcode/painter/panel-section/TableTopFilter.js +314 -0
- package/lib/lowcode/painter/panel-section/TableZebra.js +67 -6
- package/lib/lowcode/painter/panel-section/TreeRootEditor.js +86 -0
- package/lib/lowcode/painter/style/action-bind-modal.less +102 -0
- package/lib/lowcode/painter/style/collapse.less +6 -0
- package/lib/lowcode/painter/style/components.less +5 -4
- package/lib/lowcode/painter/style/design.less +7 -4
- package/lib/lowcode/painter/style/dragdrop.less +10 -0
- package/lib/lowcode/painter/style/fields-setting.less +25 -0
- package/lib/lowcode/painter/style/impexp.less +7 -0
- package/lib/lowcode/painter/style/list-editor.less +36 -0
- package/lib/lowcode/painter/style/panel-attrs.less +43 -0
- package/lib/lowcode/painter/style/panel.less +6 -37
- package/lib/lowcode/painter/style/pop-confirm.less +9 -2
- package/lib/lowcode/painter/style/split-display.less +28 -0
- package/lib/lowcode/painter/style/treedragdrop.less +19 -0
- package/lib/lowcode/preview/index.js +35 -0
- package/lib/lowcode/view/Canvas.js +32 -145
- package/lib/lowcode/view/Loading.js +6 -2
- package/lib/lowcode/view/Page.js +12 -10
- package/lib/lowcode/view/lc-components/Box/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Box/index.js +11 -2
- package/lib/lowcode/view/lc-components/Box/index.less +0 -1
- package/lib/lowcode/view/lc-components/Box/meta.json +2 -4
- package/lib/lowcode/view/lc-components/Button/FunctionDesign.js +8 -10
- package/lib/lowcode/view/lc-components/Button/FunctionLive.js +3 -6
- package/lib/lowcode/view/lc-components/Button/FunctionPreview.js +13 -0
- package/lib/lowcode/view/lc-components/Button/index.js +41 -18
- package/lib/lowcode/view/lc-components/Button/meta.json +9 -9
- package/lib/lowcode/view/lc-components/CardList/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/CardList/index.js +1 -0
- package/lib/lowcode/view/lc-components/CardList/meta.json +2 -3
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +15 -24
- package/lib/lowcode/view/lc-components/Dialog/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Dialog/index.js +1 -0
- package/lib/lowcode/view/lc-components/Dialog/meta.json +1 -2
- package/lib/lowcode/view/lc-components/Drawer/FunctionDesign.js +4 -2
- package/lib/lowcode/view/lc-components/Drawer/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Drawer/index.js +17 -0
- package/lib/lowcode/view/lc-components/Drawer/index.less +3 -0
- package/lib/lowcode/view/lc-components/Drawer/meta.json +1 -2
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +94 -2
- package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Form/index.js +289 -12
- package/lib/lowcode/view/lc-components/Form/index.less +5 -0
- package/lib/lowcode/view/lc-components/Form/meta.json +546 -64
- package/lib/lowcode/view/lc-components/Iframe/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Iframe/index.js +1 -0
- package/lib/lowcode/view/lc-components/Iframe/meta.json +1 -1
- package/lib/lowcode/view/lc-components/ImEx/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/ImEx/index.js +1 -0
- package/lib/lowcode/view/lc-components/ImEx/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Image/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Image/index.js +1 -0
- package/lib/lowcode/view/lc-components/Image/meta.json +3 -3
- package/lib/lowcode/view/lc-components/JSX/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/JSX/index.js +19 -6
- package/lib/lowcode/view/lc-components/JSX/meta.json +8 -5
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +24 -22
- package/lib/lowcode/view/lc-components/Layout/FunctionLive.js +3 -8
- package/lib/lowcode/view/lc-components/Layout/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Layout/index.js +1 -0
- package/lib/lowcode/view/lc-components/Layout/meta.json +1 -2
- package/lib/lowcode/view/lc-components/Link/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Link/index.js +1 -0
- package/lib/lowcode/view/lc-components/Link/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Page/meta.json +49 -0
- package/lib/lowcode/view/lc-components/PageContent/index.js +61 -0
- package/lib/lowcode/view/lc-components/PageContent/meta.json +9 -0
- package/lib/lowcode/view/lc-components/PageFooter/index.js +46 -0
- package/lib/lowcode/view/lc-components/PageFooter/meta.json +9 -0
- package/lib/lowcode/view/lc-components/PageHeader/index.js +48 -0
- package/lib/lowcode/view/lc-components/PageHeader/meta.json +9 -0
- package/lib/lowcode/view/lc-components/PageModal/index.js +30 -0
- package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +31 -2
- package/lib/lowcode/view/lc-components/Section/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Section/index.js +114 -23
- package/lib/lowcode/view/lc-components/Section/index.less +7 -0
- package/lib/lowcode/view/lc-components/Section/meta.json +48 -49
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +58 -2
- package/lib/lowcode/view/lc-components/Split/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Split/index.js +45 -6
- package/lib/lowcode/view/lc-components/Split/meta.json +10 -29
- package/lib/lowcode/view/lc-components/Table/FunctionDesign.js +43 -5
- package/lib/lowcode/view/lc-components/Table/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Table/components/TopFilter.js +104 -0
- package/lib/lowcode/view/lc-components/Table/index.js +364 -47
- package/lib/lowcode/view/lc-components/Table/meta.json +229 -55
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +71 -2
- package/lib/lowcode/view/lc-components/Tabs/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Tabs/FunctionPreview.js +17 -0
- package/lib/lowcode/view/lc-components/Tabs/index.js +112 -9
- package/lib/lowcode/view/lc-components/Tabs/meta.json +53 -81
- package/lib/lowcode/view/lc-components/Text/FunctionPreview.js +16 -0
- package/lib/lowcode/view/lc-components/Text/index.js +1 -0
- package/lib/lowcode/view/lc-components/Text/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +64 -3
- package/lib/lowcode/view/lc-components/Tree/FunctionPreview.js +33 -0
- package/lib/lowcode/view/lc-components/Tree/index.js +321 -6
- package/lib/lowcode/view/lc-components/Tree/index.less +5 -0
- package/lib/lowcode/view/lc-components/Tree/meta.json +224 -80
- package/lib/lowcode/view/lc-components/Wrapper.js +42 -25
- package/lib/lowcode/view/style/page.less +3 -0
- package/lib/services.js +5 -3
- package/lib/upload/Form/gridForm.js +7 -3
- package/lib/utils/grid.js +2 -2
- package/package.json +12 -7
- package/es/lowcode/engine/provider/ContextProvider.js +0 -169
- package/es/lowcode/painter/components/actions-editor/ActionEditor.js +0 -147
- package/es/lowcode/painter/panel-section/TableActions.js +0 -19
- package/lib/lowcode/engine/provider/ContextProvider.js +0 -177
- package/lib/lowcode/painter/panel-section/TableActions.js +0 -26
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
+
var _excluded = ["events"],
|
|
6
|
+
_excluded2 = ["events"];
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
9
|
+
import { Menu, Dropdown, Button, Tooltip, Icon } from 'luck-design/antd';
|
|
10
|
+
import styled from 'styled-components';
|
|
11
|
+
import { keyBy, keys, omit } from 'lodash';
|
|
12
|
+
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
13
|
+
import Collapse from "./Collapse";
|
|
14
|
+
import ActionBindModal from "./ActionBindModal";
|
|
15
|
+
var _I18N_PREFIX_ = 'luckda.lowcode.painter.advancePanel';
|
|
16
|
+
var EventItem = styled.div.withConfig({
|
|
17
|
+
displayName: "EventItem",
|
|
18
|
+
componentId: "luckda-6530__sc-6426fo-0"
|
|
19
|
+
})(["display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border:1px solid #e5e6e8;border-radius:6px;margin-bottom:6px;font-size:12px;i{color:rgba(0,0,0,0.4);cursor:pointer;}i:not(:last-child){margin-right:6px;}"]);
|
|
20
|
+
var AdvancePanel = function AdvancePanel(_ref) {
|
|
21
|
+
var meta = _ref.meta,
|
|
22
|
+
value = _ref.value,
|
|
23
|
+
onChange = _ref.onChange;
|
|
24
|
+
var _useState = useState((value === null || value === void 0 ? void 0 : value.events) || {}),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
events = _useState2[0],
|
|
27
|
+
setEvents = _useState2[1];
|
|
28
|
+
var _useState3 = useState(null),
|
|
29
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
30
|
+
event = _useState4[0],
|
|
31
|
+
setEvent = _useState4[1];
|
|
32
|
+
var metaMap = useCreation(function () {
|
|
33
|
+
var _meta$advance;
|
|
34
|
+
return keyBy((meta === null || meta === void 0 || (_meta$advance = meta.advance) === null || _meta$advance === void 0 ? void 0 : _meta$advance.events) || [], 'key');
|
|
35
|
+
}, [meta]);
|
|
36
|
+
var handleEventClick = useMemoizedFn(function (e) {
|
|
37
|
+
var payload = e.item.props.payload;
|
|
38
|
+
setEvent(_objectSpread(_objectSpread({}, payload), {}, {
|
|
39
|
+
actionPool: null
|
|
40
|
+
}));
|
|
41
|
+
});
|
|
42
|
+
var handleDeleteEvent = useMemoizedFn(function (ek) {
|
|
43
|
+
var _ref2 = value || {},
|
|
44
|
+
events = _ref2.events,
|
|
45
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
46
|
+
var _events = omit(events, [ek]);
|
|
47
|
+
setEvents(_events);
|
|
48
|
+
onChange(_objectSpread(_objectSpread({}, rest), {}, {
|
|
49
|
+
events: _events
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
var handleComfirm = useMemoizedFn(function (actionPool) {
|
|
53
|
+
var _ref3 = value || {},
|
|
54
|
+
events = _ref3.events,
|
|
55
|
+
rest = _objectWithoutProperties(_ref3, _excluded2);
|
|
56
|
+
var _events = _objectSpread(_objectSpread({}, events), {}, _defineProperty({}, event.key, actionPool));
|
|
57
|
+
setEvents(_events);
|
|
58
|
+
onChange(_objectSpread(_objectSpread({}, rest), {}, {
|
|
59
|
+
events: _events
|
|
60
|
+
}));
|
|
61
|
+
});
|
|
62
|
+
var eventsMenu = useCreation(function () {
|
|
63
|
+
var _meta$advance2;
|
|
64
|
+
return /*#__PURE__*/React.createElement(Menu, {
|
|
65
|
+
onClick: handleEventClick,
|
|
66
|
+
style: {
|
|
67
|
+
fontSize: 12
|
|
68
|
+
}
|
|
69
|
+
}, (_meta$advance2 = meta.advance) === null || _meta$advance2 === void 0 || (_meta$advance2 = _meta$advance2.events) === null || _meta$advance2 === void 0 ? void 0 : _meta$advance2.map(function (event) {
|
|
70
|
+
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
71
|
+
key: event.key,
|
|
72
|
+
payload: event
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
74
|
+
title: event.desc || event.name,
|
|
75
|
+
placement: "left",
|
|
76
|
+
getPopupContainer: function getPopupContainer() {
|
|
77
|
+
return document.getElementById('lc-design-workspace');
|
|
78
|
+
}
|
|
79
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
style: {
|
|
81
|
+
width: '100%',
|
|
82
|
+
fontSize: 12
|
|
83
|
+
}
|
|
84
|
+
}, event.name)));
|
|
85
|
+
}));
|
|
86
|
+
}, []);
|
|
87
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Collapse, {
|
|
88
|
+
field: "events",
|
|
89
|
+
label: formatMessage({
|
|
90
|
+
id: "".concat(_I18N_PREFIX_, ".events"),
|
|
91
|
+
label: '事件'
|
|
92
|
+
}),
|
|
93
|
+
bodyStyle: {
|
|
94
|
+
padding: '12px 16px'
|
|
95
|
+
}
|
|
96
|
+
}, keys(events).map(function (ek) {
|
|
97
|
+
return /*#__PURE__*/React.createElement(EventItem, null, /*#__PURE__*/React.createElement("span", null, metaMap[ek].name), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
98
|
+
title: formatMessage({
|
|
99
|
+
id: 'luckda.lowcode.painter.edit',
|
|
100
|
+
label: '编辑'
|
|
101
|
+
})
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
103
|
+
type: "edit",
|
|
104
|
+
onClick: function onClick() {
|
|
105
|
+
return setEvent(_objectSpread(_objectSpread({}, metaMap[ek]), {}, {
|
|
106
|
+
actionPool: events[ek]
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
110
|
+
title: formatMessage({
|
|
111
|
+
id: 'luckda.lowcode.painter.delete',
|
|
112
|
+
label: '删除'
|
|
113
|
+
})
|
|
114
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
115
|
+
type: "delete",
|
|
116
|
+
onClick: function onClick() {
|
|
117
|
+
return handleDeleteEvent(ek);
|
|
118
|
+
}
|
|
119
|
+
}))));
|
|
120
|
+
}), /*#__PURE__*/React.createElement(Dropdown, {
|
|
121
|
+
overlay: eventsMenu,
|
|
122
|
+
placement: "bottomCenter",
|
|
123
|
+
getPopupContainer: function getPopupContainer() {
|
|
124
|
+
return document.getElementById('lc-design-workspace');
|
|
125
|
+
}
|
|
126
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
127
|
+
size: "small",
|
|
128
|
+
block: true
|
|
129
|
+
}, formatMessage({
|
|
130
|
+
id: "".concat(_I18N_PREFIX_, ".addEventAction"),
|
|
131
|
+
label: '添加事件动作'
|
|
132
|
+
})))), /*#__PURE__*/React.createElement(ActionBindModal, {
|
|
133
|
+
event: event,
|
|
134
|
+
onComfirm: handleComfirm,
|
|
135
|
+
onClose: function onClose() {
|
|
136
|
+
return setEvent(null);
|
|
137
|
+
}
|
|
138
|
+
}));
|
|
139
|
+
};
|
|
140
|
+
export default AdvancePanel;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
+
var _excluded = ["type", "key", "valueKey", "name", "desc", "default", "props", "wrapper", "wrapperProps", "next", "repositioning"];
|
|
6
|
+
import React, { useRef, useEffect } from 'react';
|
|
7
|
+
import { useBoolean, useCreation, useMemoizedFn } from 'ahooks';
|
|
8
|
+
import { Drawer, Icon } from 'luck-design/antd';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import { startsWith, isNil, get } from 'lodash';
|
|
11
|
+
import { useContext } from "../../engine/provider/ContextProvider";
|
|
12
|
+
import PanelItemFactory from "../../engine/factory/panel-item-factory";
|
|
13
|
+
import PanelItem from "./PanelItem";
|
|
14
|
+
import Collapse from "./Collapse";
|
|
15
|
+
import styles from "../style/panel-attrs.less";
|
|
16
|
+
var AttrsPanel = function AttrsPanel(_ref) {
|
|
17
|
+
var _nextRef$current2, _nextRef$current3;
|
|
18
|
+
var meta = _ref.meta,
|
|
19
|
+
value = _ref.value,
|
|
20
|
+
onChange = _ref.onChange;
|
|
21
|
+
var nextRef = useRef(null);
|
|
22
|
+
var factory = useRef(new PanelItemFactory());
|
|
23
|
+
var _useBoolean = useBoolean(false),
|
|
24
|
+
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
25
|
+
open = _useBoolean2[0],
|
|
26
|
+
_useBoolean2$ = _useBoolean2[1],
|
|
27
|
+
setTrue = _useBoolean2$.setTrue,
|
|
28
|
+
setFalse = _useBoolean2$.setFalse;
|
|
29
|
+
var context = useContext();
|
|
30
|
+
var handleChange = useMemoizedFn(function (field, val, repositioning) {
|
|
31
|
+
var _nextRef$current;
|
|
32
|
+
onChange(field, val, repositioning);
|
|
33
|
+
if ((_nextRef$current = nextRef.current) !== null && _nextRef$current !== void 0 && _nextRef$current.autoClose) {
|
|
34
|
+
setFalse();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var goNext = useMemoizedFn(function (_next, dynamicProps) {
|
|
38
|
+
if (!_next) return;
|
|
39
|
+
nextRef.current = {
|
|
40
|
+
name: _next.name,
|
|
41
|
+
autoClose: _next.autoClose,
|
|
42
|
+
NextComp: renderPanelItems(_next.props, dynamicProps)
|
|
43
|
+
};
|
|
44
|
+
setTrue();
|
|
45
|
+
});
|
|
46
|
+
var renderPanelItems = useMemoizedFn(function (items, dynamicProps) {
|
|
47
|
+
var _context$componentMap = context.componentMap.get(value.id).api.getSelfAndParentLCData(),
|
|
48
|
+
node = _context$componentMap.node;
|
|
49
|
+
return items.map(function (_ref2) {
|
|
50
|
+
var type = _ref2.type,
|
|
51
|
+
key = _ref2.key,
|
|
52
|
+
valueKey = _ref2.valueKey,
|
|
53
|
+
name = _ref2.name,
|
|
54
|
+
desc = _ref2.desc,
|
|
55
|
+
defaultValue = _ref2.default,
|
|
56
|
+
props = _ref2.props,
|
|
57
|
+
wrapper = _ref2.wrapper,
|
|
58
|
+
wrapperProps = _ref2.wrapperProps,
|
|
59
|
+
next = _ref2.next,
|
|
60
|
+
repositioning = _ref2.repositioning,
|
|
61
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
62
|
+
var Comp = factory.current.getPanelItemFor(startsWith(type, '_') ? 'dynamic' : type, type);
|
|
63
|
+
if (type === 'group') {
|
|
64
|
+
return /*#__PURE__*/React.createElement(Comp, {
|
|
65
|
+
nodeId: value.id,
|
|
66
|
+
key: key,
|
|
67
|
+
field: key,
|
|
68
|
+
label: name,
|
|
69
|
+
next: next ? function (_dp) {
|
|
70
|
+
return goNext(next, _dp);
|
|
71
|
+
} : null,
|
|
72
|
+
defaultCollapsed: defaultValue,
|
|
73
|
+
desc: desc
|
|
74
|
+
}, renderPanelItems(props || [], dynamicProps));
|
|
75
|
+
}
|
|
76
|
+
var _originalVal = get(node.props, valueKey || key);
|
|
77
|
+
var comp = Comp && /*#__PURE__*/React.createElement(Comp, _extends({
|
|
78
|
+
nodeId: value.id,
|
|
79
|
+
key: key,
|
|
80
|
+
defaultValue: isNil(_originalVal) ? defaultValue : _originalVal,
|
|
81
|
+
next: next !== null && next !== void 0 && next.props ? function (_dp) {
|
|
82
|
+
return goNext(next, _dp);
|
|
83
|
+
} : null,
|
|
84
|
+
onChange: function onChange(val) {
|
|
85
|
+
return handleChange(valueKey || key, val, repositioning);
|
|
86
|
+
},
|
|
87
|
+
size: "small",
|
|
88
|
+
settings: node.props,
|
|
89
|
+
renderPanelItems: renderPanelItems
|
|
90
|
+
}, rest, dynamicProps));
|
|
91
|
+
if (wrapper === 'hidden') return comp;
|
|
92
|
+
var Wrapper = wrapper === 'collapse' ? Collapse : PanelItem;
|
|
93
|
+
return /*#__PURE__*/React.createElement(Wrapper, _extends({
|
|
94
|
+
key: key,
|
|
95
|
+
nodeId: value.id,
|
|
96
|
+
field: key,
|
|
97
|
+
label: name,
|
|
98
|
+
desc: desc
|
|
99
|
+
}, wrapperProps), comp);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
var PropsComps = useCreation(function () {
|
|
103
|
+
setFalse();
|
|
104
|
+
if (!meta) {
|
|
105
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
106
|
+
}
|
|
107
|
+
return renderPanelItems(meta.props);
|
|
108
|
+
}, [value]);
|
|
109
|
+
useEffect(function () {
|
|
110
|
+
if (!open) {
|
|
111
|
+
nextRef.current = null;
|
|
112
|
+
}
|
|
113
|
+
}, [open]);
|
|
114
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
id: "lc-painter-panel-attrs-container",
|
|
116
|
+
className: classNames(styles['lc-painter-panel-attrs'], _defineProperty(_defineProperty({}, styles.hidden, !value), styles.showNext, open))
|
|
117
|
+
}, PropsComps, /*#__PURE__*/React.createElement(Drawer, {
|
|
118
|
+
visible: open,
|
|
119
|
+
width: 320,
|
|
120
|
+
mask: false,
|
|
121
|
+
closable: false,
|
|
122
|
+
getContainer: false,
|
|
123
|
+
destroyOnClose: true,
|
|
124
|
+
style: {
|
|
125
|
+
position: 'absolute',
|
|
126
|
+
transform: 'none'
|
|
127
|
+
},
|
|
128
|
+
bodyStyle: {
|
|
129
|
+
padding: 0,
|
|
130
|
+
height: '100%'
|
|
131
|
+
}
|
|
132
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
133
|
+
className: styles['lc-painter-panel-attrs-next']
|
|
134
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
135
|
+
className: styles['lc-painter-panel-attrs-next-header'],
|
|
136
|
+
onClick: setFalse
|
|
137
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
138
|
+
type: "left"
|
|
139
|
+
}), (_nextRef$current2 = nextRef.current) === null || _nextRef$current2 === void 0 ? void 0 : _nextRef$current2.name, /*#__PURE__*/React.createElement(Icon, {
|
|
140
|
+
type: "close"
|
|
141
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
className: styles['lc-painter-panel-attrs-next-body']
|
|
143
|
+
}, (_nextRef$current3 = nextRef.current) === null || _nextRef$current3 === void 0 ? void 0 : _nextRef$current3.NextComp))));
|
|
144
|
+
};
|
|
145
|
+
export default AttrsPanel;
|
|
@@ -8,7 +8,7 @@ import { Icon, Tooltip } from 'luck-design/antd';
|
|
|
8
8
|
* Collapse 组件是一个可折叠区域的实现,用于显示或隐藏内容。它支持自定义标签、描述以及默认的折叠状态。
|
|
9
9
|
* 该组件还可以通过 `next` 函数来自定义点击操作,而不是简单地切换折叠状态。
|
|
10
10
|
* 提供的工具提示可以显示额外信息,如字段名和描述,以帮助用户更好地理解折叠内容的作用。
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* @component
|
|
13
13
|
* @example
|
|
14
14
|
* <Collapse
|
|
@@ -20,7 +20,7 @@ import { Icon, Tooltip } from 'luck-design/antd';
|
|
|
20
20
|
* >
|
|
21
21
|
* <p>这里是可折叠的内容</p>
|
|
22
22
|
* </Collapse>
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
24
|
* @param {Object} props - 组件的属性。
|
|
25
25
|
* @param {React.ReactNode} children - 折叠区域展开时显示的内容。
|
|
26
26
|
* @param {string} [props.field] - 与折叠内容相关联的字段名。
|
|
@@ -28,7 +28,7 @@ import { Icon, Tooltip } from 'luck-design/antd';
|
|
|
28
28
|
* @param {string} [props.desc] - 关于折叠内容的描述信息。
|
|
29
29
|
* @param {boolean} [props.defaultCollapsed=false] - 折叠区域的默认状态。如果为 true,则默认为折叠状态。
|
|
30
30
|
* @param {Function} [props.next] - 点击操作的自定义函数。如果提供,点击时将执行此函数,而不是切换折叠状态。
|
|
31
|
-
*
|
|
31
|
+
*
|
|
32
32
|
* @returns {ReactElement} 返回一个 React 元素,表示一个具有可折叠功能的容器。
|
|
33
33
|
*/
|
|
34
34
|
export default function (_ref) {
|
|
@@ -38,7 +38,11 @@ export default function (_ref) {
|
|
|
38
38
|
desc = _ref.desc,
|
|
39
39
|
_ref$defaultCollapsed = _ref.defaultCollapsed,
|
|
40
40
|
defaultCollapsed = _ref$defaultCollapsed === void 0 ? false : _ref$defaultCollapsed,
|
|
41
|
-
next = _ref.next
|
|
41
|
+
next = _ref.next,
|
|
42
|
+
suppressIcon = _ref.suppressIcon,
|
|
43
|
+
extraRender = _ref.extraRender,
|
|
44
|
+
style = _ref.style,
|
|
45
|
+
bodyStyle = _ref.bodyStyle;
|
|
42
46
|
var _useState = useState(defaultCollapsed),
|
|
43
47
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
48
|
collapsed = _useState2[0],
|
|
@@ -56,12 +60,13 @@ export default function (_ref) {
|
|
|
56
60
|
str = "\u5C5E\u6027\uFF1A".concat(field);
|
|
57
61
|
}
|
|
58
62
|
if (desc) {
|
|
59
|
-
str
|
|
63
|
+
str = "".concat(str ? "".concat(str, " | ") : '', "\u8BF4\u660E\uFF1A").concat(desc);
|
|
60
64
|
}
|
|
61
65
|
return str;
|
|
62
66
|
}, [field, desc]);
|
|
63
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
64
|
-
className: styles['lc-painter-components-collapse']
|
|
68
|
+
className: styles['lc-painter-components-collapse'],
|
|
69
|
+
style: style
|
|
65
70
|
}, /*#__PURE__*/React.createElement("div", {
|
|
66
71
|
className: styles['head'],
|
|
67
72
|
onClick: handleClick
|
|
@@ -78,13 +83,19 @@ export default function (_ref) {
|
|
|
78
83
|
style: {
|
|
79
84
|
cursor: desc ? 'help' : 'default'
|
|
80
85
|
}
|
|
81
|
-
}, label)), /*#__PURE__*/React.createElement("
|
|
86
|
+
}, label)), /*#__PURE__*/React.createElement("div", null, extraRender && /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: styles['extra'],
|
|
88
|
+
onClick: function onClick(e) {
|
|
89
|
+
return e.stopPropagation();
|
|
90
|
+
}
|
|
91
|
+
}, extraRender()), !suppressIcon && /*#__PURE__*/React.createElement("span", {
|
|
82
92
|
className: styles['action']
|
|
83
93
|
}, next ? /*#__PURE__*/React.createElement(Icon, {
|
|
84
94
|
type: "right"
|
|
85
95
|
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
86
96
|
type: collapsed ? 'down' : 'up'
|
|
87
|
-
}))), !collapsed && /*#__PURE__*/React.createElement("div", {
|
|
88
|
-
className: styles['body']
|
|
97
|
+
})))), !collapsed && /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: styles['body'],
|
|
99
|
+
style: bodyStyle
|
|
89
100
|
}, children));
|
|
90
101
|
}
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["value", "onChange", "wrapperStyle"];
|
|
6
|
-
import React, { useState } from 'react';
|
|
6
|
+
import React, { forwardRef, useState } from 'react';
|
|
7
7
|
import { useUpdateEffect } from 'ahooks';
|
|
8
8
|
import PopConfirm from "./PopConfirm";
|
|
9
9
|
import { Input } from 'luck-design/antd';
|
|
@@ -35,7 +35,7 @@ import { SketchPicker } from 'react-color';
|
|
|
35
35
|
*
|
|
36
36
|
* @returns {ReactElement} 返回一个 React 元素,表示一个带有颜色选择器的输入框组件。
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
var ColorInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
39
39
|
var value = _ref.value,
|
|
40
40
|
onChange = _ref.onChange,
|
|
41
41
|
wrapperStyle = _ref.wrapperStyle,
|
|
@@ -70,6 +70,7 @@ export default function (_ref) {
|
|
|
70
70
|
}, /*#__PURE__*/React.createElement("div", {
|
|
71
71
|
className: styles['color-input-wrap']
|
|
72
72
|
}, /*#__PURE__*/React.createElement(Input, _extends({
|
|
73
|
+
ref: ref,
|
|
73
74
|
onChange: handleInputChange,
|
|
74
75
|
className: styles['color-input'],
|
|
75
76
|
value: rgbaColor,
|
|
@@ -81,7 +82,8 @@ export default function (_ref) {
|
|
|
81
82
|
backgroundColor: rgbaColor
|
|
82
83
|
}
|
|
83
84
|
}))));
|
|
84
|
-
}
|
|
85
|
+
});
|
|
86
|
+
export default ColorInput;
|
|
85
87
|
function toRGBA(colorObj) {
|
|
86
88
|
// 首先检查 colorObj 是否为 null 或 undefined
|
|
87
89
|
if (colorObj === null || typeof colorObj === 'undefined') {
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
import { DndContext, DragOverlay, useSensor, MouseSensor, useSensors } from '@dnd-kit/core';
|
|
7
|
+
import Overlay from "./Overlay";
|
|
8
|
+
import { CONTAINER_UNITS } from "../../../constants";
|
|
9
|
+
import { useContext } from "../../../engine/provider/ContextProvider";
|
|
10
|
+
import { isNil } from 'lodash';
|
|
11
|
+
var SIDE_DiSTANCE = 20;
|
|
12
|
+
var SIDE_DiSTANCE_TREENODE = 10;
|
|
13
|
+
export var Action = /*#__PURE__*/_createClass(function Action() {
|
|
14
|
+
_classCallCheck(this, Action);
|
|
15
|
+
});
|
|
16
|
+
_defineProperty(Action, "ADD", 'add');
|
|
17
|
+
_defineProperty(Action, "MOVE", 'move');
|
|
18
|
+
_defineProperty(Action, "DELETE", 'delete');
|
|
19
|
+
export var ActionSide = /*#__PURE__*/_createClass(function ActionSide() {
|
|
20
|
+
_classCallCheck(this, ActionSide);
|
|
21
|
+
});
|
|
22
|
+
_defineProperty(ActionSide, "INSIDE", 'inside');
|
|
23
|
+
_defineProperty(ActionSide, "LEFT", 'left');
|
|
24
|
+
_defineProperty(ActionSide, "RIGHT", 'right');
|
|
25
|
+
export default function (_ref) {
|
|
26
|
+
var _active$component;
|
|
27
|
+
var children = _ref.children;
|
|
28
|
+
var ctx = useContext();
|
|
29
|
+
var _useState = useState(null),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
active = _useState2[0],
|
|
32
|
+
setActive = _useState2[1];
|
|
33
|
+
function handleDragStart(event) {
|
|
34
|
+
setActive(event.active.data.current);
|
|
35
|
+
}
|
|
36
|
+
function handleDragEnd(event) {
|
|
37
|
+
setActive(null);
|
|
38
|
+
pubEvent(event, ctx.topics.COMPONENT_DRAG_END, ctx);
|
|
39
|
+
}
|
|
40
|
+
function handleDragMove(event) {
|
|
41
|
+
pubEvent(event, ctx.topics.COMPONENT_DRAG_OVER, ctx);
|
|
42
|
+
}
|
|
43
|
+
var mouseSensor = useSensor(MouseSensor, {
|
|
44
|
+
// Require the mouse to move by 10 pixels before activating
|
|
45
|
+
activationConstraint: {
|
|
46
|
+
distance: 10
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var sensors = useSensors(mouseSensor);
|
|
50
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DndContext, {
|
|
51
|
+
sensors: sensors,
|
|
52
|
+
onDragStart: handleDragStart,
|
|
53
|
+
onDragEnd: handleDragEnd,
|
|
54
|
+
onDragMove: handleDragMove
|
|
55
|
+
}, children, /*#__PURE__*/React.createElement(DragOverlay, {
|
|
56
|
+
style: {
|
|
57
|
+
zIndex: 2001
|
|
58
|
+
},
|
|
59
|
+
dropAnimation: null
|
|
60
|
+
}, active && /*#__PURE__*/React.createElement(Overlay, null, active === null || active === void 0 || (_active$component = active.component) === null || _active$component === void 0 ? void 0 : _active$component.name))));
|
|
61
|
+
}
|
|
62
|
+
function pubEvent(event, eventName, ctx) {
|
|
63
|
+
if (event.active && event.over && event.active.data.current.id !== event.over.data.current.id) {
|
|
64
|
+
var parentNode = ctx.componentMap.get(event.over.data.current.id).api.getSelfAndParentLCData().parent;
|
|
65
|
+
|
|
66
|
+
// console.log('event.over.data.current.type', event.over.data.current.type)
|
|
67
|
+
var actionSide = getAction(event.over.data.current.type, event.over.data.current.component.component, event.active.rect.current.translated, event.over.rect, parentNode);
|
|
68
|
+
console.log({
|
|
69
|
+
eventName: eventName,
|
|
70
|
+
id: event.over.data.current.id,
|
|
71
|
+
fromId: event.active.data.current.id,
|
|
72
|
+
fromComp: event.active.data.current.component,
|
|
73
|
+
action: event.active.data.current.action,
|
|
74
|
+
actionSide: actionSide
|
|
75
|
+
});
|
|
76
|
+
if (actionSide) {
|
|
77
|
+
ctx.$publisher(eventName, {
|
|
78
|
+
id: event.over.data.current.id,
|
|
79
|
+
// 拖拽目标组件id
|
|
80
|
+
fromId: event.active.data.current.id,
|
|
81
|
+
// 被拖拽组件id
|
|
82
|
+
fromComp: event.active.data.current.component,
|
|
83
|
+
// 被拖拽组件信息
|
|
84
|
+
action: event.active.data.current.action,
|
|
85
|
+
// 行为 add move delete
|
|
86
|
+
actionSide: actionSide // 目标位置 left inside right
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function isContainerUnit(node) {
|
|
92
|
+
if (isNil(node)) return false;
|
|
93
|
+
return CONTAINER_UNITS.includes(node.props.component);
|
|
94
|
+
}
|
|
95
|
+
function getAction(type, overComponentName, activeRect, overRect, parentNode) {
|
|
96
|
+
var action = null;
|
|
97
|
+
var parentIsContainer = isContainerUnit(parentNode);
|
|
98
|
+
if (type == 'comp') {
|
|
99
|
+
if (CONTAINER_UNITS.includes(overComponentName)) {
|
|
100
|
+
// 如果是最小单元容器
|
|
101
|
+
if (Math.abs(activeRect.left - overRect.left) <= SIDE_DiSTANCE) {
|
|
102
|
+
if (parentIsContainer) action = ActionSide.LEFT;
|
|
103
|
+
} else if (Math.abs(activeRect.left - overRect.right) <= SIDE_DiSTANCE) {
|
|
104
|
+
if (parentIsContainer) action = ActionSide.RIGHT;
|
|
105
|
+
} else {
|
|
106
|
+
action = ActionSide.INSIDE;
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
// 独立组件
|
|
110
|
+
if (activeRect.left >= overRect.left && activeRect.left <= overRect.left + overRect.width / 2) {
|
|
111
|
+
if (parentIsContainer) action = ActionSide.LEFT;
|
|
112
|
+
} else if (activeRect.left > overRect.left + overRect.width / 2 && activeRect.left <= overRect.right) {
|
|
113
|
+
if (parentIsContainer) action = ActionSide.RIGHT;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
// console.log('position', activeRect.top, overRect.bottom)
|
|
118
|
+
if (CONTAINER_UNITS.includes(overComponentName)) {
|
|
119
|
+
// 如果是最小单元容器
|
|
120
|
+
if (Math.abs(activeRect.top - overRect.top) <= SIDE_DiSTANCE_TREENODE) {
|
|
121
|
+
if (parentIsContainer) action = ActionSide.LEFT;
|
|
122
|
+
} else if (Math.abs(activeRect.top - overRect.bottom) <= SIDE_DiSTANCE_TREENODE) {
|
|
123
|
+
if (parentIsContainer) action = ActionSide.RIGHT;
|
|
124
|
+
} else {
|
|
125
|
+
action = ActionSide.INSIDE;
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
// 独立组件
|
|
129
|
+
if (activeRect.top >= overRect.top && activeRect.top <= overRect.top + overRect.height / 2) {
|
|
130
|
+
if (parentIsContainer) action = ActionSide.LEFT;
|
|
131
|
+
} else if (activeRect.top > overRect.top + overRect.height / 2 && activeRect.top <= overRect.bottom) {
|
|
132
|
+
if (parentIsContainer) action = ActionSide.RIGHT;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return action;
|
|
137
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { cloneElement, useEffect } from 'react';
|
|
3
|
+
import { useCreation } from 'ahooks';
|
|
4
|
+
import { useDraggable, useDroppable } from '@dnd-kit/core';
|
|
5
|
+
import { useContext } from "../../../engine/provider/ContextProvider";
|
|
6
|
+
import { Action } from "./DragDropContext";
|
|
7
|
+
import { NO_DRAGABLE, NO_DROPABLE } from "../../../constants";
|
|
8
|
+
export default function (_ref) {
|
|
9
|
+
var id = _ref.id,
|
|
10
|
+
children = _ref.children,
|
|
11
|
+
getTargetDom = _ref.getTargetDom;
|
|
12
|
+
var ctx = useContext();
|
|
13
|
+
var itemInfo = useCreation(function () {
|
|
14
|
+
return ctx.componentMap.get(id).meta;
|
|
15
|
+
}, [id]);
|
|
16
|
+
var _useDraggable = useDraggable({
|
|
17
|
+
id: 'draggable-' + id,
|
|
18
|
+
data: {
|
|
19
|
+
id: id,
|
|
20
|
+
component: itemInfo,
|
|
21
|
+
action: Action.MOVE
|
|
22
|
+
}
|
|
23
|
+
}),
|
|
24
|
+
attributes = _useDraggable.attributes,
|
|
25
|
+
listeners = _useDraggable.listeners,
|
|
26
|
+
setDragRef = _useDraggable.setNodeRef;
|
|
27
|
+
var _useDroppable = useDroppable({
|
|
28
|
+
id: 'droppable-' + id,
|
|
29
|
+
data: {
|
|
30
|
+
id: id,
|
|
31
|
+
component: itemInfo,
|
|
32
|
+
type: 'comp'
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
setDropRef = _useDroppable.setNodeRef;
|
|
36
|
+
var _memoListeners = useCreation(function () {
|
|
37
|
+
return listeners;
|
|
38
|
+
}, []);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
var dom = getTargetDom();
|
|
41
|
+
if (dom) {
|
|
42
|
+
if (!NO_DRAGABLE.includes(itemInfo.component)) setDragRef(dom);
|
|
43
|
+
if (!NO_DROPABLE.includes(itemInfo.component)) setDropRef(dom);
|
|
44
|
+
}
|
|
45
|
+
}, []);
|
|
46
|
+
var comp = useCreation(function () {
|
|
47
|
+
return /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), _memoListeners), attributes));
|
|
48
|
+
}, [id, children]);
|
|
49
|
+
return comp;
|
|
50
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import { useDraggable, useDroppable, useDndMonitor } from '@dnd-kit/core';
|
|
5
|
+
import { Action } from "./DragDropContext";
|
|
6
|
+
import { useContext } from "../../../engine/provider/ContextProvider";
|
|
7
|
+
import styles from "../../style/treedragdrop.less";
|
|
8
|
+
import { NO_DRAGABLE, NO_DROPABLE } from "../../../constants";
|
|
9
|
+
export default function (_ref) {
|
|
10
|
+
var item = _ref.item,
|
|
11
|
+
children = _ref.children;
|
|
12
|
+
var _useState = useState(null),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
side = _useState2[0],
|
|
15
|
+
setSide = _useState2[1];
|
|
16
|
+
var id = item.id;
|
|
17
|
+
var context = useContext();
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
var event_drag = context.$subscriber(context.topics.COMPONENT_DRAG_OVER).on(function (_ref2) {
|
|
20
|
+
var itemId = _ref2.id,
|
|
21
|
+
fromId = _ref2.fromId,
|
|
22
|
+
actionSide = _ref2.actionSide;
|
|
23
|
+
if (itemId === id) {
|
|
24
|
+
setSide(actionSide);
|
|
25
|
+
} else {
|
|
26
|
+
setSide(null);
|
|
27
|
+
}
|
|
28
|
+
}).watch();
|
|
29
|
+
return function () {
|
|
30
|
+
context.$unsubscriber(context.topics.COMPONENT_DRAG_OVER, event_drag);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
useDndMonitor({
|
|
34
|
+
onDragEnd: function onDragEnd() {
|
|
35
|
+
setSide(null);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
var _useDraggable = useDraggable({
|
|
39
|
+
id: 'draggable-treenode-' + id,
|
|
40
|
+
data: {
|
|
41
|
+
id: id,
|
|
42
|
+
component: item,
|
|
43
|
+
action: Action.MOVE,
|
|
44
|
+
type: 'comp'
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
47
|
+
attributes = _useDraggable.attributes,
|
|
48
|
+
listeners = _useDraggable.listeners,
|
|
49
|
+
isDragging = _useDraggable.isDragging,
|
|
50
|
+
setDragRef = _useDraggable.setNodeRef;
|
|
51
|
+
var _useDroppable = useDroppable({
|
|
52
|
+
id: 'droppable-treenode-' + id,
|
|
53
|
+
data: {
|
|
54
|
+
id: id,
|
|
55
|
+
component: item,
|
|
56
|
+
type: 'treeNode'
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
setDropRef = _useDroppable.setNodeRef;
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
61
|
+
className: "".concat(styles['lc-painter-components-treedragdrop'], " ").concat(side ? "".concat(side, "-side") : '', " ").concat(isDragging ? "ondrag" : ''),
|
|
62
|
+
ref: function ref(node) {
|
|
63
|
+
if (!NO_DRAGABLE.includes(item.component)) setDragRef(node);
|
|
64
|
+
if (!NO_DROPABLE.includes(item.component)) setDropRef(node);
|
|
65
|
+
}
|
|
66
|
+
}, listeners, attributes), children);
|
|
67
|
+
}
|