@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,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _ahooks = require("ahooks");
|
|
15
|
+
var _antd = require("luck-design/antd");
|
|
16
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
17
|
+
var _lodash = require("lodash");
|
|
18
|
+
var _utils = require("@luck-design-biz/base/utils");
|
|
19
|
+
var _Collapse = _interopRequireDefault(require("./Collapse"));
|
|
20
|
+
var _ActionBindModal = _interopRequireDefault(require("./ActionBindModal"));
|
|
21
|
+
var _excluded = ["events"],
|
|
22
|
+
_excluded2 = ["events"];
|
|
23
|
+
var _I18N_PREFIX_ = 'luckda.lowcode.painter.advancePanel';
|
|
24
|
+
var EventItem = _styledComponents.default.div.withConfig({
|
|
25
|
+
displayName: "EventItem",
|
|
26
|
+
componentId: "luckda-6530__sc-6426fo-0"
|
|
27
|
+
})(["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;}"]);
|
|
28
|
+
var AdvancePanel = function AdvancePanel(_ref) {
|
|
29
|
+
var meta = _ref.meta,
|
|
30
|
+
value = _ref.value,
|
|
31
|
+
onChange = _ref.onChange;
|
|
32
|
+
var _useState = (0, _react.useState)((value === null || value === void 0 ? void 0 : value.events) || {}),
|
|
33
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
34
|
+
events = _useState2[0],
|
|
35
|
+
setEvents = _useState2[1];
|
|
36
|
+
var _useState3 = (0, _react.useState)(null),
|
|
37
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
38
|
+
event = _useState4[0],
|
|
39
|
+
setEvent = _useState4[1];
|
|
40
|
+
var metaMap = (0, _ahooks.useCreation)(function () {
|
|
41
|
+
var _meta$advance;
|
|
42
|
+
return (0, _lodash.keyBy)((meta === null || meta === void 0 || (_meta$advance = meta.advance) === null || _meta$advance === void 0 ? void 0 : _meta$advance.events) || [], 'key');
|
|
43
|
+
}, [meta]);
|
|
44
|
+
var handleEventClick = (0, _ahooks.useMemoizedFn)(function (e) {
|
|
45
|
+
var payload = e.item.props.payload;
|
|
46
|
+
setEvent((0, _objectSpread3.default)((0, _objectSpread3.default)({}, payload), {}, {
|
|
47
|
+
actionPool: null
|
|
48
|
+
}));
|
|
49
|
+
});
|
|
50
|
+
var handleDeleteEvent = (0, _ahooks.useMemoizedFn)(function (ek) {
|
|
51
|
+
var _ref2 = value || {},
|
|
52
|
+
events = _ref2.events,
|
|
53
|
+
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
54
|
+
var _events = (0, _lodash.omit)(events, [ek]);
|
|
55
|
+
setEvents(_events);
|
|
56
|
+
onChange((0, _objectSpread3.default)((0, _objectSpread3.default)({}, rest), {}, {
|
|
57
|
+
events: _events
|
|
58
|
+
}));
|
|
59
|
+
});
|
|
60
|
+
var handleComfirm = (0, _ahooks.useMemoizedFn)(function (actionPool) {
|
|
61
|
+
var _ref3 = value || {},
|
|
62
|
+
events = _ref3.events,
|
|
63
|
+
rest = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
|
|
64
|
+
var _events = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, events), {}, (0, _defineProperty2.default)({}, event.key, actionPool));
|
|
65
|
+
setEvents(_events);
|
|
66
|
+
onChange((0, _objectSpread3.default)((0, _objectSpread3.default)({}, rest), {}, {
|
|
67
|
+
events: _events
|
|
68
|
+
}));
|
|
69
|
+
});
|
|
70
|
+
var eventsMenu = (0, _ahooks.useCreation)(function () {
|
|
71
|
+
var _meta$advance2;
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Menu, {
|
|
73
|
+
onClick: handleEventClick,
|
|
74
|
+
style: {
|
|
75
|
+
fontSize: 12
|
|
76
|
+
}
|
|
77
|
+
}, (_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) {
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Menu.Item, {
|
|
79
|
+
key: event.key,
|
|
80
|
+
payload: event
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
|
|
82
|
+
title: event.desc || event.name,
|
|
83
|
+
placement: "left",
|
|
84
|
+
getPopupContainer: function getPopupContainer() {
|
|
85
|
+
return document.getElementById('lc-design-workspace');
|
|
86
|
+
}
|
|
87
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
88
|
+
style: {
|
|
89
|
+
width: '100%',
|
|
90
|
+
fontSize: 12
|
|
91
|
+
}
|
|
92
|
+
}, event.name)));
|
|
93
|
+
}));
|
|
94
|
+
}, []);
|
|
95
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Collapse.default, {
|
|
96
|
+
field: "events",
|
|
97
|
+
label: (0, _utils.formatMessage)({
|
|
98
|
+
id: "".concat(_I18N_PREFIX_, ".events"),
|
|
99
|
+
label: '事件'
|
|
100
|
+
}),
|
|
101
|
+
bodyStyle: {
|
|
102
|
+
padding: '12px 16px'
|
|
103
|
+
}
|
|
104
|
+
}, (0, _lodash.keys)(events).map(function (ek) {
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement(EventItem, null, /*#__PURE__*/_react.default.createElement("span", null, metaMap[ek].name), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
|
|
106
|
+
title: (0, _utils.formatMessage)({
|
|
107
|
+
id: 'luckda.lowcode.painter.edit',
|
|
108
|
+
label: '编辑'
|
|
109
|
+
})
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
111
|
+
type: "edit",
|
|
112
|
+
onClick: function onClick() {
|
|
113
|
+
return setEvent((0, _objectSpread3.default)((0, _objectSpread3.default)({}, metaMap[ek]), {}, {
|
|
114
|
+
actionPool: events[ek]
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
})), /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
|
|
118
|
+
title: (0, _utils.formatMessage)({
|
|
119
|
+
id: 'luckda.lowcode.painter.delete',
|
|
120
|
+
label: '删除'
|
|
121
|
+
})
|
|
122
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
123
|
+
type: "delete",
|
|
124
|
+
onClick: function onClick() {
|
|
125
|
+
return handleDeleteEvent(ek);
|
|
126
|
+
}
|
|
127
|
+
}))));
|
|
128
|
+
}), /*#__PURE__*/_react.default.createElement(_antd.Dropdown, {
|
|
129
|
+
overlay: eventsMenu,
|
|
130
|
+
placement: "bottomCenter",
|
|
131
|
+
getPopupContainer: function getPopupContainer() {
|
|
132
|
+
return document.getElementById('lc-design-workspace');
|
|
133
|
+
}
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
135
|
+
size: "small",
|
|
136
|
+
block: true
|
|
137
|
+
}, (0, _utils.formatMessage)({
|
|
138
|
+
id: "".concat(_I18N_PREFIX_, ".addEventAction"),
|
|
139
|
+
label: '添加事件动作'
|
|
140
|
+
})))), /*#__PURE__*/_react.default.createElement(_ActionBindModal.default, {
|
|
141
|
+
event: event,
|
|
142
|
+
onComfirm: handleComfirm,
|
|
143
|
+
onClose: function onClose() {
|
|
144
|
+
return setEvent(null);
|
|
145
|
+
}
|
|
146
|
+
}));
|
|
147
|
+
};
|
|
148
|
+
var _default = exports.default = AdvancePanel;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _ahooks = require("ahooks");
|
|
15
|
+
var _antd = require("luck-design/antd");
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
var _lodash = require("lodash");
|
|
18
|
+
var _ContextProvider = require("../../engine/provider/ContextProvider");
|
|
19
|
+
var _panelItemFactory = _interopRequireDefault(require("../../engine/factory/panel-item-factory"));
|
|
20
|
+
var _PanelItem = _interopRequireDefault(require("./PanelItem"));
|
|
21
|
+
var _Collapse = _interopRequireDefault(require("./Collapse"));
|
|
22
|
+
var _panelAttrs = _interopRequireDefault(require("../style/panel-attrs.less"));
|
|
23
|
+
var _excluded = ["type", "key", "valueKey", "name", "desc", "default", "props", "wrapper", "wrapperProps", "next", "repositioning"];
|
|
24
|
+
var AttrsPanel = function AttrsPanel(_ref) {
|
|
25
|
+
var _nextRef$current2, _nextRef$current3;
|
|
26
|
+
var meta = _ref.meta,
|
|
27
|
+
value = _ref.value,
|
|
28
|
+
onChange = _ref.onChange;
|
|
29
|
+
var nextRef = (0, _react.useRef)(null);
|
|
30
|
+
var factory = (0, _react.useRef)(new _panelItemFactory.default());
|
|
31
|
+
var _useBoolean = (0, _ahooks.useBoolean)(false),
|
|
32
|
+
_useBoolean2 = (0, _slicedToArray2.default)(_useBoolean, 2),
|
|
33
|
+
open = _useBoolean2[0],
|
|
34
|
+
_useBoolean2$ = _useBoolean2[1],
|
|
35
|
+
setTrue = _useBoolean2$.setTrue,
|
|
36
|
+
setFalse = _useBoolean2$.setFalse;
|
|
37
|
+
var context = (0, _ContextProvider.useContext)();
|
|
38
|
+
var handleChange = (0, _ahooks.useMemoizedFn)(function (field, val, repositioning) {
|
|
39
|
+
var _nextRef$current;
|
|
40
|
+
onChange(field, val, repositioning);
|
|
41
|
+
if ((_nextRef$current = nextRef.current) !== null && _nextRef$current !== void 0 && _nextRef$current.autoClose) {
|
|
42
|
+
setFalse();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
var goNext = (0, _ahooks.useMemoizedFn)(function (_next, dynamicProps) {
|
|
46
|
+
if (!_next) return;
|
|
47
|
+
nextRef.current = {
|
|
48
|
+
name: _next.name,
|
|
49
|
+
autoClose: _next.autoClose,
|
|
50
|
+
NextComp: renderPanelItems(_next.props, dynamicProps)
|
|
51
|
+
};
|
|
52
|
+
setTrue();
|
|
53
|
+
});
|
|
54
|
+
var renderPanelItems = (0, _ahooks.useMemoizedFn)(function (items, dynamicProps) {
|
|
55
|
+
var _context$componentMap = context.componentMap.get(value.id).api.getSelfAndParentLCData(),
|
|
56
|
+
node = _context$componentMap.node;
|
|
57
|
+
return items.map(function (_ref2) {
|
|
58
|
+
var type = _ref2.type,
|
|
59
|
+
key = _ref2.key,
|
|
60
|
+
valueKey = _ref2.valueKey,
|
|
61
|
+
name = _ref2.name,
|
|
62
|
+
desc = _ref2.desc,
|
|
63
|
+
defaultValue = _ref2.default,
|
|
64
|
+
props = _ref2.props,
|
|
65
|
+
wrapper = _ref2.wrapper,
|
|
66
|
+
wrapperProps = _ref2.wrapperProps,
|
|
67
|
+
next = _ref2.next,
|
|
68
|
+
repositioning = _ref2.repositioning,
|
|
69
|
+
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
70
|
+
var Comp = factory.current.getPanelItemFor((0, _lodash.startsWith)(type, '_') ? 'dynamic' : type, type);
|
|
71
|
+
if (type === 'group') {
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(Comp, {
|
|
73
|
+
nodeId: value.id,
|
|
74
|
+
key: key,
|
|
75
|
+
field: key,
|
|
76
|
+
label: name,
|
|
77
|
+
next: next ? function (_dp) {
|
|
78
|
+
return goNext(next, _dp);
|
|
79
|
+
} : null,
|
|
80
|
+
defaultCollapsed: defaultValue,
|
|
81
|
+
desc: desc
|
|
82
|
+
}, renderPanelItems(props || [], dynamicProps));
|
|
83
|
+
}
|
|
84
|
+
var _originalVal = (0, _lodash.get)(node.props, valueKey || key);
|
|
85
|
+
var comp = Comp && /*#__PURE__*/_react.default.createElement(Comp, (0, _extends2.default)({
|
|
86
|
+
nodeId: value.id,
|
|
87
|
+
key: key,
|
|
88
|
+
defaultValue: (0, _lodash.isNil)(_originalVal) ? defaultValue : _originalVal,
|
|
89
|
+
next: next !== null && next !== void 0 && next.props ? function (_dp) {
|
|
90
|
+
return goNext(next, _dp);
|
|
91
|
+
} : null,
|
|
92
|
+
onChange: function onChange(val) {
|
|
93
|
+
return handleChange(valueKey || key, val, repositioning);
|
|
94
|
+
},
|
|
95
|
+
size: "small",
|
|
96
|
+
settings: node.props,
|
|
97
|
+
renderPanelItems: renderPanelItems
|
|
98
|
+
}, rest, dynamicProps));
|
|
99
|
+
if (wrapper === 'hidden') return comp;
|
|
100
|
+
var Wrapper = wrapper === 'collapse' ? _Collapse.default : _PanelItem.default;
|
|
101
|
+
return /*#__PURE__*/_react.default.createElement(Wrapper, (0, _extends2.default)({
|
|
102
|
+
key: key,
|
|
103
|
+
nodeId: value.id,
|
|
104
|
+
field: key,
|
|
105
|
+
label: name,
|
|
106
|
+
desc: desc
|
|
107
|
+
}, wrapperProps), comp);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
var PropsComps = (0, _ahooks.useCreation)(function () {
|
|
111
|
+
setFalse();
|
|
112
|
+
if (!meta) {
|
|
113
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
114
|
+
}
|
|
115
|
+
return renderPanelItems(meta.props);
|
|
116
|
+
}, [value]);
|
|
117
|
+
(0, _react.useEffect)(function () {
|
|
118
|
+
if (!open) {
|
|
119
|
+
nextRef.current = null;
|
|
120
|
+
}
|
|
121
|
+
}, [open]);
|
|
122
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
+
id: "lc-painter-panel-attrs-container",
|
|
124
|
+
className: (0, _classnames.default)(_panelAttrs.default['lc-painter-panel-attrs'], (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _panelAttrs.default.hidden, !value), _panelAttrs.default.showNext, open))
|
|
125
|
+
}, PropsComps, /*#__PURE__*/_react.default.createElement(_antd.Drawer, {
|
|
126
|
+
visible: open,
|
|
127
|
+
width: 320,
|
|
128
|
+
mask: false,
|
|
129
|
+
closable: false,
|
|
130
|
+
getContainer: false,
|
|
131
|
+
destroyOnClose: true,
|
|
132
|
+
style: {
|
|
133
|
+
position: 'absolute',
|
|
134
|
+
transform: 'none'
|
|
135
|
+
},
|
|
136
|
+
bodyStyle: {
|
|
137
|
+
padding: 0,
|
|
138
|
+
height: '100%'
|
|
139
|
+
}
|
|
140
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
141
|
+
className: _panelAttrs.default['lc-painter-panel-attrs-next']
|
|
142
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
143
|
+
className: _panelAttrs.default['lc-painter-panel-attrs-next-header'],
|
|
144
|
+
onClick: setFalse
|
|
145
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
146
|
+
type: "left"
|
|
147
|
+
}), (_nextRef$current2 = nextRef.current) === null || _nextRef$current2 === void 0 ? void 0 : _nextRef$current2.name, /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
148
|
+
type: "close"
|
|
149
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
150
|
+
className: _panelAttrs.default['lc-painter-panel-attrs-next-body']
|
|
151
|
+
}, (_nextRef$current3 = nextRef.current) === null || _nextRef$current3 === void 0 ? void 0 : _nextRef$current3.NextComp))));
|
|
152
|
+
};
|
|
153
|
+
var _default = exports.default = AttrsPanel;
|
|
@@ -15,7 +15,7 @@ var _antd = require("luck-design/antd");
|
|
|
15
15
|
* Collapse 组件是一个可折叠区域的实现,用于显示或隐藏内容。它支持自定义标签、描述以及默认的折叠状态。
|
|
16
16
|
* 该组件还可以通过 `next` 函数来自定义点击操作,而不是简单地切换折叠状态。
|
|
17
17
|
* 提供的工具提示可以显示额外信息,如字段名和描述,以帮助用户更好地理解折叠内容的作用。
|
|
18
|
-
*
|
|
18
|
+
*
|
|
19
19
|
* @component
|
|
20
20
|
* @example
|
|
21
21
|
* <Collapse
|
|
@@ -27,7 +27,7 @@ var _antd = require("luck-design/antd");
|
|
|
27
27
|
* >
|
|
28
28
|
* <p>这里是可折叠的内容</p>
|
|
29
29
|
* </Collapse>
|
|
30
|
-
*
|
|
30
|
+
*
|
|
31
31
|
* @param {Object} props - 组件的属性。
|
|
32
32
|
* @param {React.ReactNode} children - 折叠区域展开时显示的内容。
|
|
33
33
|
* @param {string} [props.field] - 与折叠内容相关联的字段名。
|
|
@@ -35,7 +35,7 @@ var _antd = require("luck-design/antd");
|
|
|
35
35
|
* @param {string} [props.desc] - 关于折叠内容的描述信息。
|
|
36
36
|
* @param {boolean} [props.defaultCollapsed=false] - 折叠区域的默认状态。如果为 true,则默认为折叠状态。
|
|
37
37
|
* @param {Function} [props.next] - 点击操作的自定义函数。如果提供,点击时将执行此函数,而不是切换折叠状态。
|
|
38
|
-
*
|
|
38
|
+
*
|
|
39
39
|
* @returns {ReactElement} 返回一个 React 元素,表示一个具有可折叠功能的容器。
|
|
40
40
|
*/
|
|
41
41
|
function _default(_ref) {
|
|
@@ -45,7 +45,11 @@ function _default(_ref) {
|
|
|
45
45
|
desc = _ref.desc,
|
|
46
46
|
_ref$defaultCollapsed = _ref.defaultCollapsed,
|
|
47
47
|
defaultCollapsed = _ref$defaultCollapsed === void 0 ? false : _ref$defaultCollapsed,
|
|
48
|
-
next = _ref.next
|
|
48
|
+
next = _ref.next,
|
|
49
|
+
suppressIcon = _ref.suppressIcon,
|
|
50
|
+
extraRender = _ref.extraRender,
|
|
51
|
+
style = _ref.style,
|
|
52
|
+
bodyStyle = _ref.bodyStyle;
|
|
49
53
|
var _useState = (0, _react.useState)(defaultCollapsed),
|
|
50
54
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
51
55
|
collapsed = _useState2[0],
|
|
@@ -63,12 +67,13 @@ function _default(_ref) {
|
|
|
63
67
|
str = "\u5C5E\u6027\uFF1A".concat(field);
|
|
64
68
|
}
|
|
65
69
|
if (desc) {
|
|
66
|
-
str
|
|
70
|
+
str = "".concat(str ? "".concat(str, " | ") : '', "\u8BF4\u660E\uFF1A").concat(desc);
|
|
67
71
|
}
|
|
68
72
|
return str;
|
|
69
73
|
}, [field, desc]);
|
|
70
74
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
71
|
-
className: _collapse.default['lc-painter-components-collapse']
|
|
75
|
+
className: _collapse.default['lc-painter-components-collapse'],
|
|
76
|
+
style: style
|
|
72
77
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
73
78
|
className: _collapse.default['head'],
|
|
74
79
|
onClick: handleClick
|
|
@@ -85,13 +90,19 @@ function _default(_ref) {
|
|
|
85
90
|
style: {
|
|
86
91
|
cursor: desc ? 'help' : 'default'
|
|
87
92
|
}
|
|
88
|
-
}, label)), /*#__PURE__*/_react.default.createElement("
|
|
93
|
+
}, label)), /*#__PURE__*/_react.default.createElement("div", null, extraRender && /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
+
className: _collapse.default['extra'],
|
|
95
|
+
onClick: function onClick(e) {
|
|
96
|
+
return e.stopPropagation();
|
|
97
|
+
}
|
|
98
|
+
}, extraRender()), !suppressIcon && /*#__PURE__*/_react.default.createElement("span", {
|
|
89
99
|
className: _collapse.default['action']
|
|
90
100
|
}, next ? /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
91
101
|
type: "right"
|
|
92
102
|
}) : /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
93
103
|
type: collapsed ? 'down' : 'up'
|
|
94
|
-
}))), !collapsed && /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
-
className: _collapse.default['body']
|
|
104
|
+
})))), !collapsed && /*#__PURE__*/_react.default.createElement("div", {
|
|
105
|
+
className: _collapse.default['body'],
|
|
106
|
+
style: bodyStyle
|
|
96
107
|
}, children));
|
|
97
108
|
}
|
|
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -42,7 +42,7 @@ var _excluded = ["value", "onChange", "wrapperStyle"];
|
|
|
42
42
|
*
|
|
43
43
|
* @returns {ReactElement} 返回一个 React 元素,表示一个带有颜色选择器的输入框组件。
|
|
44
44
|
*/
|
|
45
|
-
function
|
|
45
|
+
var ColorInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
46
46
|
var value = _ref.value,
|
|
47
47
|
onChange = _ref.onChange,
|
|
48
48
|
wrapperStyle = _ref.wrapperStyle,
|
|
@@ -77,6 +77,7 @@ function _default(_ref) {
|
|
|
77
77
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
78
78
|
className: _colorInput.default['color-input-wrap']
|
|
79
79
|
}, /*#__PURE__*/_react.default.createElement(_antd.Input, (0, _extends2.default)({
|
|
80
|
+
ref: ref,
|
|
80
81
|
onChange: handleInputChange,
|
|
81
82
|
className: _colorInput.default['color-input'],
|
|
82
83
|
value: rgbaColor,
|
|
@@ -88,7 +89,8 @@ function _default(_ref) {
|
|
|
88
89
|
backgroundColor: rgbaColor
|
|
89
90
|
}
|
|
90
91
|
}))));
|
|
91
|
-
}
|
|
92
|
+
});
|
|
93
|
+
var _default = exports.default = ColorInput;
|
|
92
94
|
function toRGBA(colorObj) {
|
|
93
95
|
// 首先检查 colorObj 是否为 null 或 undefined
|
|
94
96
|
if (colorObj === null || typeof colorObj === 'undefined') {
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ActionSide = exports.Action = void 0;
|
|
9
|
+
exports.default = _default;
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _core = require("@dnd-kit/core");
|
|
16
|
+
var _Overlay = _interopRequireDefault(require("./Overlay"));
|
|
17
|
+
var _constants = require("../../../constants");
|
|
18
|
+
var _ContextProvider = require("../../../engine/provider/ContextProvider");
|
|
19
|
+
var _lodash = require("lodash");
|
|
20
|
+
var SIDE_DiSTANCE = 20;
|
|
21
|
+
var SIDE_DiSTANCE_TREENODE = 10;
|
|
22
|
+
var Action = exports.Action = /*#__PURE__*/(0, _createClass2.default)(function Action() {
|
|
23
|
+
(0, _classCallCheck2.default)(this, Action);
|
|
24
|
+
});
|
|
25
|
+
(0, _defineProperty2.default)(Action, "ADD", 'add');
|
|
26
|
+
(0, _defineProperty2.default)(Action, "MOVE", 'move');
|
|
27
|
+
(0, _defineProperty2.default)(Action, "DELETE", 'delete');
|
|
28
|
+
var ActionSide = exports.ActionSide = /*#__PURE__*/(0, _createClass2.default)(function ActionSide() {
|
|
29
|
+
(0, _classCallCheck2.default)(this, ActionSide);
|
|
30
|
+
});
|
|
31
|
+
(0, _defineProperty2.default)(ActionSide, "INSIDE", 'inside');
|
|
32
|
+
(0, _defineProperty2.default)(ActionSide, "LEFT", 'left');
|
|
33
|
+
(0, _defineProperty2.default)(ActionSide, "RIGHT", 'right');
|
|
34
|
+
function _default(_ref) {
|
|
35
|
+
var _active$component;
|
|
36
|
+
var children = _ref.children;
|
|
37
|
+
var ctx = (0, _ContextProvider.useContext)();
|
|
38
|
+
var _useState = (0, _react.useState)(null),
|
|
39
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
40
|
+
active = _useState2[0],
|
|
41
|
+
setActive = _useState2[1];
|
|
42
|
+
function handleDragStart(event) {
|
|
43
|
+
setActive(event.active.data.current);
|
|
44
|
+
}
|
|
45
|
+
function handleDragEnd(event) {
|
|
46
|
+
setActive(null);
|
|
47
|
+
pubEvent(event, ctx.topics.COMPONENT_DRAG_END, ctx);
|
|
48
|
+
}
|
|
49
|
+
function handleDragMove(event) {
|
|
50
|
+
pubEvent(event, ctx.topics.COMPONENT_DRAG_OVER, ctx);
|
|
51
|
+
}
|
|
52
|
+
var mouseSensor = (0, _core.useSensor)(_core.MouseSensor, {
|
|
53
|
+
// Require the mouse to move by 10 pixels before activating
|
|
54
|
+
activationConstraint: {
|
|
55
|
+
distance: 10
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
var sensors = (0, _core.useSensors)(mouseSensor);
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.DndContext, {
|
|
60
|
+
sensors: sensors,
|
|
61
|
+
onDragStart: handleDragStart,
|
|
62
|
+
onDragEnd: handleDragEnd,
|
|
63
|
+
onDragMove: handleDragMove
|
|
64
|
+
}, children, /*#__PURE__*/_react.default.createElement(_core.DragOverlay, {
|
|
65
|
+
style: {
|
|
66
|
+
zIndex: 2001
|
|
67
|
+
},
|
|
68
|
+
dropAnimation: null
|
|
69
|
+
}, active && /*#__PURE__*/_react.default.createElement(_Overlay.default, null, active === null || active === void 0 || (_active$component = active.component) === null || _active$component === void 0 ? void 0 : _active$component.name))));
|
|
70
|
+
}
|
|
71
|
+
function pubEvent(event, eventName, ctx) {
|
|
72
|
+
if (event.active && event.over && event.active.data.current.id !== event.over.data.current.id) {
|
|
73
|
+
var parentNode = ctx.componentMap.get(event.over.data.current.id).api.getSelfAndParentLCData().parent;
|
|
74
|
+
|
|
75
|
+
// console.log('event.over.data.current.type', event.over.data.current.type)
|
|
76
|
+
var actionSide = getAction(event.over.data.current.type, event.over.data.current.component.component, event.active.rect.current.translated, event.over.rect, parentNode);
|
|
77
|
+
console.log({
|
|
78
|
+
eventName: eventName,
|
|
79
|
+
id: event.over.data.current.id,
|
|
80
|
+
fromId: event.active.data.current.id,
|
|
81
|
+
fromComp: event.active.data.current.component,
|
|
82
|
+
action: event.active.data.current.action,
|
|
83
|
+
actionSide: actionSide
|
|
84
|
+
});
|
|
85
|
+
if (actionSide) {
|
|
86
|
+
ctx.$publisher(eventName, {
|
|
87
|
+
id: event.over.data.current.id,
|
|
88
|
+
// 拖拽目标组件id
|
|
89
|
+
fromId: event.active.data.current.id,
|
|
90
|
+
// 被拖拽组件id
|
|
91
|
+
fromComp: event.active.data.current.component,
|
|
92
|
+
// 被拖拽组件信息
|
|
93
|
+
action: event.active.data.current.action,
|
|
94
|
+
// 行为 add move delete
|
|
95
|
+
actionSide: actionSide // 目标位置 left inside right
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function isContainerUnit(node) {
|
|
101
|
+
if ((0, _lodash.isNil)(node)) return false;
|
|
102
|
+
return _constants.CONTAINER_UNITS.includes(node.props.component);
|
|
103
|
+
}
|
|
104
|
+
function getAction(type, overComponentName, activeRect, overRect, parentNode) {
|
|
105
|
+
var action = null;
|
|
106
|
+
var parentIsContainer = isContainerUnit(parentNode);
|
|
107
|
+
if (type == 'comp') {
|
|
108
|
+
if (_constants.CONTAINER_UNITS.includes(overComponentName)) {
|
|
109
|
+
// 如果是最小单元容器
|
|
110
|
+
if (Math.abs(activeRect.left - overRect.left) <= SIDE_DiSTANCE) {
|
|
111
|
+
if (parentIsContainer) action = ActionSide.LEFT;
|
|
112
|
+
} else if (Math.abs(activeRect.left - overRect.right) <= SIDE_DiSTANCE) {
|
|
113
|
+
if (parentIsContainer) action = ActionSide.RIGHT;
|
|
114
|
+
} else {
|
|
115
|
+
action = ActionSide.INSIDE;
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
// 独立组件
|
|
119
|
+
if (activeRect.left >= overRect.left && activeRect.left <= overRect.left + overRect.width / 2) {
|
|
120
|
+
if (parentIsContainer) action = ActionSide.LEFT;
|
|
121
|
+
} else if (activeRect.left > overRect.left + overRect.width / 2 && activeRect.left <= overRect.right) {
|
|
122
|
+
if (parentIsContainer) action = ActionSide.RIGHT;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
// console.log('position', activeRect.top, overRect.bottom)
|
|
127
|
+
if (_constants.CONTAINER_UNITS.includes(overComponentName)) {
|
|
128
|
+
// 如果是最小单元容器
|
|
129
|
+
if (Math.abs(activeRect.top - overRect.top) <= SIDE_DiSTANCE_TREENODE) {
|
|
130
|
+
if (parentIsContainer) action = ActionSide.LEFT;
|
|
131
|
+
} else if (Math.abs(activeRect.top - overRect.bottom) <= SIDE_DiSTANCE_TREENODE) {
|
|
132
|
+
if (parentIsContainer) action = ActionSide.RIGHT;
|
|
133
|
+
} else {
|
|
134
|
+
action = ActionSide.INSIDE;
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
// 独立组件
|
|
138
|
+
if (activeRect.top >= overRect.top && activeRect.top <= overRect.top + overRect.height / 2) {
|
|
139
|
+
if (parentIsContainer) action = ActionSide.LEFT;
|
|
140
|
+
} else if (activeRect.top > overRect.top + overRect.height / 2 && activeRect.top <= overRect.bottom) {
|
|
141
|
+
if (parentIsContainer) action = ActionSide.RIGHT;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return action;
|
|
146
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = _default;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _ahooks = require("ahooks");
|
|
11
|
+
var _core = require("@dnd-kit/core");
|
|
12
|
+
var _ContextProvider = require("../../../engine/provider/ContextProvider");
|
|
13
|
+
var _DragDropContext = require("./DragDropContext");
|
|
14
|
+
var _constants = require("../../../constants");
|
|
15
|
+
function _default(_ref) {
|
|
16
|
+
var id = _ref.id,
|
|
17
|
+
children = _ref.children,
|
|
18
|
+
getTargetDom = _ref.getTargetDom;
|
|
19
|
+
var ctx = (0, _ContextProvider.useContext)();
|
|
20
|
+
var itemInfo = (0, _ahooks.useCreation)(function () {
|
|
21
|
+
return ctx.componentMap.get(id).meta;
|
|
22
|
+
}, [id]);
|
|
23
|
+
var _useDraggable = (0, _core.useDraggable)({
|
|
24
|
+
id: 'draggable-' + id,
|
|
25
|
+
data: {
|
|
26
|
+
id: id,
|
|
27
|
+
component: itemInfo,
|
|
28
|
+
action: _DragDropContext.Action.MOVE
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
attributes = _useDraggable.attributes,
|
|
32
|
+
listeners = _useDraggable.listeners,
|
|
33
|
+
setDragRef = _useDraggable.setNodeRef;
|
|
34
|
+
var _useDroppable = (0, _core.useDroppable)({
|
|
35
|
+
id: 'droppable-' + id,
|
|
36
|
+
data: {
|
|
37
|
+
id: id,
|
|
38
|
+
component: itemInfo,
|
|
39
|
+
type: 'comp'
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
setDropRef = _useDroppable.setNodeRef;
|
|
43
|
+
var _memoListeners = (0, _ahooks.useCreation)(function () {
|
|
44
|
+
return listeners;
|
|
45
|
+
}, []);
|
|
46
|
+
(0, _react.useEffect)(function () {
|
|
47
|
+
var dom = getTargetDom();
|
|
48
|
+
if (dom) {
|
|
49
|
+
if (!_constants.NO_DRAGABLE.includes(itemInfo.component)) setDragRef(dom);
|
|
50
|
+
if (!_constants.NO_DROPABLE.includes(itemInfo.component)) setDropRef(dom);
|
|
51
|
+
}
|
|
52
|
+
}, []);
|
|
53
|
+
var comp = (0, _ahooks.useCreation)(function () {
|
|
54
|
+
return /*#__PURE__*/(0, _react.cloneElement)(children, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), _memoListeners), attributes));
|
|
55
|
+
}, [id, children]);
|
|
56
|
+
return comp;
|
|
57
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = _default;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _dragdrop = _interopRequireDefault(require("../../style/dragdrop.less"));
|
|
10
|
+
function _default(_ref) {
|
|
11
|
+
var children = _ref.children;
|
|
12
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
13
|
+
className: _dragdrop.default['dragdrop-overlay']
|
|
14
|
+
}, children);
|
|
15
|
+
}
|