@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
|
@@ -1,24 +1,35 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
1
|
import { useRef, useCallback } from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import { useHistoryTravel, useUpdateLayoutEffect } from 'ahooks';
|
|
3
|
+
import { isEqual } from 'lodash';
|
|
4
4
|
var usePromiseState = function usePromiseState(initialState) {
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
var _useHistoryTravel = useHistoryTravel(initialState),
|
|
6
|
+
value = _useHistoryTravel.value,
|
|
7
|
+
setValue = _useHistoryTravel.setValue,
|
|
8
|
+
backLength = _useHistoryTravel.backLength,
|
|
9
|
+
forwardLength = _useHistoryTravel.forwardLength,
|
|
10
|
+
back = _useHistoryTravel.back,
|
|
11
|
+
forward = _useHistoryTravel.forward;
|
|
9
12
|
var promiseRef = useRef(null);
|
|
10
|
-
var setStatePromise = useCallback(function (
|
|
13
|
+
var setStatePromise = useCallback(function (_value) {
|
|
11
14
|
return new Promise(function (resolve) {
|
|
12
15
|
promiseRef.current = resolve;
|
|
13
|
-
|
|
16
|
+
var _valStr = JSON.stringify(_value);
|
|
17
|
+
if (!isEqual(value, _valStr)) {
|
|
18
|
+
setValue(_valStr);
|
|
19
|
+
}
|
|
14
20
|
});
|
|
15
21
|
}, []);
|
|
16
|
-
|
|
22
|
+
useUpdateLayoutEffect(function () {
|
|
17
23
|
if (promiseRef.current) {
|
|
18
|
-
promiseRef.current(
|
|
24
|
+
promiseRef.current(JSON.parse(value));
|
|
19
25
|
promiseRef.current = null;
|
|
20
26
|
}
|
|
21
|
-
}, [
|
|
22
|
-
return [
|
|
27
|
+
}, [value]);
|
|
28
|
+
return [JSON.parse(value), setStatePromise, {
|
|
29
|
+
backLength: backLength - 1,
|
|
30
|
+
forwardLength: forwardLength,
|
|
31
|
+
back: back,
|
|
32
|
+
forward: forward
|
|
33
|
+
}];
|
|
23
34
|
};
|
|
24
35
|
export default usePromiseState;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
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 = ["datasetCode"];
|
|
6
|
+
import { useBoolean, useMemoizedFn } from 'ahooks';
|
|
7
|
+
import { message } from 'luck-design/antd';
|
|
8
|
+
import { keys, isNil } from 'lodash';
|
|
9
|
+
import { executeCode } from "./helper";
|
|
10
|
+
import { fetchCallBehavior } from "../../constants/api-url";
|
|
11
|
+
var useTodo = function useTodo() {
|
|
12
|
+
var _useBoolean = useBoolean(),
|
|
13
|
+
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
14
|
+
loading = _useBoolean2[0],
|
|
15
|
+
_useBoolean2$ = _useBoolean2[1],
|
|
16
|
+
setTrue = _useBoolean2$.setTrue,
|
|
17
|
+
setFalse = _useBoolean2$.setFalse;
|
|
18
|
+
var callBehavior = useMemoizedFn(function (_ref, params, data) {
|
|
19
|
+
var moduleCode = _ref.moduleCode,
|
|
20
|
+
datasetCode = _ref.datasetCode,
|
|
21
|
+
behaviorKey = _ref.behaviorKey;
|
|
22
|
+
return fetchCallBehavior(_objectSpread({
|
|
23
|
+
moduleCode: moduleCode,
|
|
24
|
+
datasetCode: datasetCode,
|
|
25
|
+
behaviorKey: behaviorKey
|
|
26
|
+
}, params), data);
|
|
27
|
+
});
|
|
28
|
+
var todo = useMemoizedFn(function (ctx, actionPool) {
|
|
29
|
+
var argsMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
30
|
+
if (isNil(actionPool)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
var dsCode = argsMap.datasetCode,
|
|
34
|
+
args = _objectWithoutProperties(argsMap, _excluded);
|
|
35
|
+
var argsName = keys(args);
|
|
36
|
+
var _args = argsName.map(function (n) {
|
|
37
|
+
return args[n];
|
|
38
|
+
});
|
|
39
|
+
if (actionPool.length > 0) {
|
|
40
|
+
setTrue();
|
|
41
|
+
var tasks = actionPool.map(function (_ref2) {
|
|
42
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
43
|
+
actionKey = _ref3[0],
|
|
44
|
+
info = _ref3[1];
|
|
45
|
+
switch (info.category) {
|
|
46
|
+
case 'custom':
|
|
47
|
+
return Promise.resolve(executeCode.apply(void 0, [ctx, info.code, argsName].concat(_toConsumableArray(_args))));
|
|
48
|
+
case 'page-action':
|
|
49
|
+
{
|
|
50
|
+
var _JSON$parse = JSON.parse(info.code || '{}'),
|
|
51
|
+
moduleCode = _JSON$parse.moduleCode,
|
|
52
|
+
datasetCode = _JSON$parse.datasetCode,
|
|
53
|
+
params = _JSON$parse.params,
|
|
54
|
+
data = _JSON$parse.data;
|
|
55
|
+
var _dscode = datasetCode || dsCode;
|
|
56
|
+
if (!moduleCode || !_dscode) {
|
|
57
|
+
message.warning('接口重要参数(模块编码或数据集编码)丢失');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
return callBehavior({
|
|
61
|
+
datasetCode: _dscode,
|
|
62
|
+
moduleCode: moduleCode,
|
|
63
|
+
behaviorKey: actionKey
|
|
64
|
+
}, params, data);
|
|
65
|
+
}
|
|
66
|
+
case 'trigger':
|
|
67
|
+
return Promise.resolve();
|
|
68
|
+
default:
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return Promise.all(tasks).finally(setFalse);
|
|
73
|
+
}
|
|
74
|
+
return Promise.resolve();
|
|
75
|
+
});
|
|
76
|
+
return [todo, callBehavior, loading];
|
|
77
|
+
};
|
|
78
|
+
export default useTodo;
|
package/es/lowcode/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
4
|
import React, { useState } from 'react';
|
|
4
5
|
import { Icon, Input, Tabs } from 'luck-design/antd';
|
|
5
6
|
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
6
7
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
7
|
-
import {
|
|
8
|
+
import { useContext } from "../engine/provider/ContextProvider";
|
|
9
|
+
import { useDraggable } from '@dnd-kit/core';
|
|
8
10
|
import styles from "./style/components.less";
|
|
9
11
|
import data from "../engine/meta/components-list.json";
|
|
12
|
+
import { Action } from "./components/DragDrop/DragDropContext";
|
|
10
13
|
var TabPane = Tabs.TabPane;
|
|
11
14
|
var Search = Input.Search;
|
|
12
15
|
var BaseCom = function BaseCom(_ref) {
|
|
@@ -28,7 +31,7 @@ var BaseCom = function BaseCom(_ref) {
|
|
|
28
31
|
}).filter(function (group) {
|
|
29
32
|
return group.components.length > 0;
|
|
30
33
|
});
|
|
31
|
-
}, [
|
|
34
|
+
}, [searchTerm]);
|
|
32
35
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
33
36
|
className: styles['components-search']
|
|
34
37
|
}, /*#__PURE__*/React.createElement(Search, {
|
|
@@ -44,30 +47,53 @@ var BaseCom = function BaseCom(_ref) {
|
|
|
44
47
|
key: group.group,
|
|
45
48
|
className: styles['components-wrapper']
|
|
46
49
|
}, /*#__PURE__*/React.createElement("h3", null, group.groupName), group.components.map(function (item) {
|
|
47
|
-
return /*#__PURE__*/React.createElement(
|
|
50
|
+
return /*#__PURE__*/React.createElement(CompItem, {
|
|
48
51
|
key: item.component,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: styles['icon-wrapper']
|
|
55
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
56
|
-
type: item.icon || 'home'
|
|
57
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
58
|
-
className: styles['text-content']
|
|
59
|
-
}, /*#__PURE__*/React.createElement("span", null, item.name)));
|
|
52
|
+
item: item,
|
|
53
|
+
onComponentClick: onComponentClick
|
|
54
|
+
});
|
|
60
55
|
}));
|
|
61
56
|
})));
|
|
62
57
|
};
|
|
58
|
+
var CompItem = function CompItem(_ref2) {
|
|
59
|
+
var item = _ref2.item,
|
|
60
|
+
onComponentClick = _ref2.onComponentClick;
|
|
61
|
+
// console.log('CompItem', item.component);
|
|
62
|
+
var _useDraggable = useDraggable({
|
|
63
|
+
id: 'comlist-' + item.component,
|
|
64
|
+
data: {
|
|
65
|
+
component: item,
|
|
66
|
+
action: Action.ADD
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
attributes = _useDraggable.attributes,
|
|
70
|
+
listeners = _useDraggable.listeners,
|
|
71
|
+
transform = _useDraggable.transform,
|
|
72
|
+
setNodeRef = _useDraggable.setNodeRef;
|
|
73
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
74
|
+
ref: setNodeRef
|
|
75
|
+
}, listeners, attributes, {
|
|
76
|
+
key: item.component,
|
|
77
|
+
className: styles['components-item'],
|
|
78
|
+
onClick: function onClick() {
|
|
79
|
+
return onComponentClick(item);
|
|
80
|
+
}
|
|
81
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: styles['icon-wrapper']
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
84
|
+
type: item.icon || 'home'
|
|
85
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: styles['text-content']
|
|
87
|
+
}, /*#__PURE__*/React.createElement("span", null, item.name)));
|
|
88
|
+
};
|
|
63
89
|
|
|
64
90
|
/**
|
|
65
91
|
* 组件清单
|
|
66
92
|
*/
|
|
67
|
-
var Components = function Components(
|
|
68
|
-
var
|
|
69
|
-
dataset =
|
|
70
|
-
var context =
|
|
93
|
+
var Components = function Components(_ref3) {
|
|
94
|
+
var _ref3$dataset = _ref3.dataset,
|
|
95
|
+
dataset = _ref3$dataset === void 0 ? 'test' : _ref3$dataset;
|
|
96
|
+
var context = useContext();
|
|
71
97
|
var onComponentClick = useMemoizedFn(function (data) {
|
|
72
98
|
context.$publisher(context.topics.COMPONENT_SETTING_CLICK, {
|
|
73
99
|
data: data
|
|
@@ -95,10 +121,10 @@ var Components = function Components(_ref2) {
|
|
|
95
121
|
onComponentClick: onComponentClick
|
|
96
122
|
})), /*#__PURE__*/React.createElement(TabPane, {
|
|
97
123
|
tab: formatMessage({
|
|
98
|
-
id: 'ccm.dev.page.set.components.
|
|
99
|
-
label: '
|
|
124
|
+
id: 'ccm.dev.page.set.components.custom',
|
|
125
|
+
label: '自定义组件'
|
|
100
126
|
}),
|
|
101
127
|
key: "dataset"
|
|
102
|
-
})));
|
|
128
|
+
}, "\u656C\u8BF7\u671F\u5F85")));
|
|
103
129
|
};
|
|
104
130
|
export default Components;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import React, { useRef, useState } from 'react';
|
|
3
|
-
import { RawIntlProvider, getLocale, getIntl, localeInfo } from 'umi';
|
|
2
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
3
|
+
import { RawIntlProvider, getLocale, getIntl, localeInfo, history } from 'umi';
|
|
4
4
|
import { useMemoizedFn } from 'ahooks';
|
|
5
5
|
import moment from 'moment';
|
|
6
6
|
import { ConfigProvider } from 'luck-design/antd';
|
|
7
|
+
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
8
|
+
import { useRemoteSource } from "../engine/provider/ContextProvider";
|
|
7
9
|
import DesignToolbar from "./DesignToolbar";
|
|
8
10
|
import DesignOperator from "./DesignOperator";
|
|
9
11
|
import Page from "../view/Page";
|
|
@@ -11,6 +13,7 @@ import styles from "./style/design.less";
|
|
|
11
13
|
var Design = function Design() {
|
|
12
14
|
var _localeInfo$locale;
|
|
13
15
|
var simulatorRef = useRef(null);
|
|
16
|
+
var remoteSource = useRemoteSource();
|
|
14
17
|
var _useState = useState(function () {
|
|
15
18
|
return getLocale();
|
|
16
19
|
}),
|
|
@@ -23,6 +26,35 @@ var Design = function Design() {
|
|
|
23
26
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
27
|
intl = _useState4[0],
|
|
25
28
|
setIntl = _useState4[1];
|
|
29
|
+
var unblock = useMemoizedFn(function () {
|
|
30
|
+
if (remoteSource.backLength > 0) return confirm("".concat(formatMessage({
|
|
31
|
+
id: 'app.base.operate.comfire.leave',
|
|
32
|
+
label: '离开当前页面?'
|
|
33
|
+
}), "\n").concat(formatMessage({
|
|
34
|
+
id: 'app.base.operate.comfire.message.leave',
|
|
35
|
+
label: '系统可能不会保存您所做的更改。'
|
|
36
|
+
})));
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
var handleBeforeUnload = useMemoizedFn(function (event) {
|
|
40
|
+
if (remoteSource.backLength > 0) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
event.returnValue = null;
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
useEffect(function () {
|
|
47
|
+
window.addEventListener('beforeunload', handleBeforeUnload);
|
|
48
|
+
history.block(function () {
|
|
49
|
+
return unblock();
|
|
50
|
+
});
|
|
51
|
+
return function () {
|
|
52
|
+
window.removeEventListener('beforeunload', handleBeforeUnload);
|
|
53
|
+
history.block(function () {
|
|
54
|
+
return true;
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
26
58
|
var handleLangChange = useMemoizedFn(function (_locale) {
|
|
27
59
|
if (moment !== null && moment !== void 0 && moment.locale) {
|
|
28
60
|
var _localeInfo$_locale;
|
|
@@ -3,14 +3,15 @@ import React, { useRef, useEffect, useState } from 'react';
|
|
|
3
3
|
import { last, initial } from 'lodash';
|
|
4
4
|
import { useEventListener, useSetState, useMemoizedFn, useCreation, useSize, useLatest } from 'ahooks';
|
|
5
5
|
import { Icon, Dropdown, message } from 'luck-design/antd';
|
|
6
|
-
import {
|
|
6
|
+
import { reverse } from 'lodash';
|
|
7
7
|
import { suid } from '@luck-design-biz/base/utils';
|
|
8
|
-
import {
|
|
8
|
+
import { useContext, usePageData } from "../engine/provider/ContextProvider";
|
|
9
9
|
import { add, deleteById } from "../engine/tools/dataProcess";
|
|
10
|
-
import {
|
|
10
|
+
import { LC_BUILDIN_UNIT_KEY, LC_COMPONENT_UNIT_KEY, LC_COMPONENT_UNIT, CONTAINER_UNITS } from "../constants";
|
|
11
11
|
import styles from "./style/design.less";
|
|
12
12
|
var _MODAL_COMPONENT_ = ['Dialog', 'Drawer'];
|
|
13
13
|
var getOperatorStyle = function getOperatorStyle(page, cellNode) {
|
|
14
|
+
if (!cellNode) return {};
|
|
14
15
|
var _page$getBoundingClie = page.getBoundingClientRect(),
|
|
15
16
|
pageLeft = _page$getBoundingClie.left,
|
|
16
17
|
pageTop = _page$getBoundingClie.top;
|
|
@@ -27,7 +28,11 @@ var getOperatorStyle = function getOperatorStyle(page, cellNode) {
|
|
|
27
28
|
var DesignOperator = function DesignOperator(_ref) {
|
|
28
29
|
var _getDomById, _getDomById2;
|
|
29
30
|
var target = _ref.target;
|
|
30
|
-
var context =
|
|
31
|
+
var context = useContext();
|
|
32
|
+
var _usePageData = usePageData(),
|
|
33
|
+
_usePageData2 = _slicedToArray(_usePageData, 2),
|
|
34
|
+
pageData = _usePageData2[0],
|
|
35
|
+
setPageData = _usePageData2[1].setPageData;
|
|
31
36
|
var size = useSize(target);
|
|
32
37
|
var _useState = useState(suid()),
|
|
33
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -43,7 +48,8 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
43
48
|
var lastSelectorId = useLatest(operatorId.selector);
|
|
44
49
|
var currentModal = useRef(null);
|
|
45
50
|
var getDomById = useMemoizedFn(function (id) {
|
|
46
|
-
|
|
51
|
+
var _context$componentMap;
|
|
52
|
+
return (_context$componentMap = context.componentMap.get(id)) === null || _context$componentMap === void 0 ? void 0 : _context$componentMap.api.getSelfDom();
|
|
47
53
|
});
|
|
48
54
|
var handleSelect = useMemoizedFn(function (_key) {
|
|
49
55
|
context.$publisher(context.topics.COMPONENT_ACTIVE, _key ? {
|
|
@@ -56,34 +62,29 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
56
62
|
} : null);
|
|
57
63
|
});
|
|
58
64
|
var handleDelete = useMemoizedFn(function (_ref2) {
|
|
59
|
-
var id = _ref2.id
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
deleteById(cloneData, id);
|
|
64
|
-
context._setPageData(cloneData).then(function (newData) {
|
|
65
|
-
context.$publisher(context.topics.COMPONENT_DELETE, {
|
|
66
|
-
id: id,
|
|
67
|
-
parentId: parentId,
|
|
68
|
-
pageData: newData
|
|
69
|
-
});
|
|
65
|
+
var id = _ref2.id;
|
|
66
|
+
context.$publisher(context.topics.COMPONENT_DELETE, {
|
|
67
|
+
id: id,
|
|
68
|
+
pageData: pageData
|
|
70
69
|
});
|
|
71
70
|
});
|
|
72
71
|
var addComponent = useMemoizedFn(function (data, targetId) {
|
|
73
72
|
var json = require("../engine/meta/".concat(data.component.toLowerCase(), ".props.default.json"));
|
|
74
73
|
var _id = "".concat(data.component.toLowerCase(), "_").concat(suid());
|
|
75
|
-
|
|
76
|
-
add(cloneData, targetId, _id, json);
|
|
74
|
+
add(pageData, targetId, _id, json);
|
|
77
75
|
context.$subscriber(context.topics.COMPONENT_MOUNT).once(function (_ref3) {
|
|
78
76
|
var mountCompId = _ref3.id;
|
|
79
77
|
if (mountCompId === _id) {
|
|
80
78
|
context.$publisher(context.topics.COMPONENT_APPEND, {
|
|
81
79
|
id: _id,
|
|
82
|
-
pageData:
|
|
80
|
+
pageData: pageData
|
|
81
|
+
});
|
|
82
|
+
context.$publisher(context.topics.COMPONENT_ACTIVE, {
|
|
83
|
+
id: _id
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
86
|
}).watch();
|
|
86
|
-
|
|
87
|
+
setPageData(pageData);
|
|
87
88
|
});
|
|
88
89
|
var acticeProps = useCreation(function () {
|
|
89
90
|
if (!operatorId.selector) return null;
|
|
@@ -114,7 +115,7 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
114
115
|
}, [operatorId.detector]);
|
|
115
116
|
useEventListener('mousemove', function (event) {
|
|
116
117
|
var elem = event.target;
|
|
117
|
-
var targetCell = elem.closest(".".concat(
|
|
118
|
+
var targetCell = elem.closest("[".concat(LC_COMPONENT_UNIT_KEY, "=\"").concat(LC_COMPONENT_UNIT, "\"]"));
|
|
118
119
|
var targetCellId = targetCell === null || targetCell === void 0 ? void 0 : targetCell.id;
|
|
119
120
|
if (targetCellId && targetCellId !== operatorId.detector && targetCellId !== operatorId.selector) {
|
|
120
121
|
setOperatorId({
|
|
@@ -144,7 +145,7 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
144
145
|
});
|
|
145
146
|
useEventListener('click', function (event) {
|
|
146
147
|
var elem = event.target;
|
|
147
|
-
var targetCell = elem.closest(".".concat(
|
|
148
|
+
var targetCell = elem.closest("[".concat(LC_COMPONENT_UNIT_KEY, "=\"").concat(LC_COMPONENT_UNIT, "\"]"));
|
|
148
149
|
var targetCellId = targetCell === null || targetCell === void 0 ? void 0 : targetCell.id;
|
|
149
150
|
if (!targetCellId || targetCellId === operatorId.selector) return;
|
|
150
151
|
context.$publisher(context.topics.COMPONENT_HOVER, null);
|
|
@@ -168,14 +169,14 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
168
169
|
id: compId
|
|
169
170
|
});
|
|
170
171
|
}).watch();
|
|
171
|
-
addComponent(data,
|
|
172
|
+
addComponent(data, LC_BUILDIN_UNIT_KEY.PAGE_ROOT);
|
|
172
173
|
return;
|
|
173
174
|
}
|
|
174
175
|
if (!lastSelectorId.current) {
|
|
175
176
|
message.info('请在右侧画布选择节点');
|
|
176
177
|
return;
|
|
177
178
|
}
|
|
178
|
-
if (context.componentMap.get(lastSelectorId.current).
|
|
179
|
+
if (!CONTAINER_UNITS.includes(context.componentMap.get(lastSelectorId.current).meta.component)) {
|
|
179
180
|
message.info('该节点不支持添加子节点');
|
|
180
181
|
return;
|
|
181
182
|
}
|
|
@@ -190,8 +191,11 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
190
191
|
}).watch();
|
|
191
192
|
var acid = context.$subscriber(context.topics.COMPONENT_ACTIVE).on(function (payload) {
|
|
192
193
|
if (payload.id) {
|
|
194
|
+
var _context$componentMap2 = context.componentMap.get(payload.id).api.getSelfAndParentLCData(),
|
|
195
|
+
node = _context$componentMap2.node;
|
|
193
196
|
setOperatorId({
|
|
194
197
|
selector: payload.id,
|
|
198
|
+
deletable: node.props.buildIn !== true,
|
|
195
199
|
detector: null
|
|
196
200
|
});
|
|
197
201
|
} else {
|
|
@@ -212,16 +216,29 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
212
216
|
currentModal.current = id;
|
|
213
217
|
} else {
|
|
214
218
|
target.current.style.removeProperty('overflow');
|
|
215
|
-
var
|
|
216
|
-
|
|
217
|
-
|
|
219
|
+
var _id = id || currentModal.current;
|
|
220
|
+
if (_id) {
|
|
221
|
+
var _modal2 = context.componentMap.get(_id);
|
|
222
|
+
_modal2.api.doClose();
|
|
223
|
+
currentModal.current = void 0;
|
|
224
|
+
}
|
|
218
225
|
}
|
|
219
226
|
}).watch();
|
|
227
|
+
var cdid = context.$subscriber(context.topics.COMPONENT_DELETE).on(function (_ref7) {
|
|
228
|
+
var id = _ref7.id,
|
|
229
|
+
pageData = _ref7.pageData;
|
|
230
|
+
if (lastSelectorId.current === id) {
|
|
231
|
+
context.$publisher(context.topics.COMPONENT_ACTIVE, null);
|
|
232
|
+
}
|
|
233
|
+
deleteById(pageData, id);
|
|
234
|
+
setPageData(pageData);
|
|
235
|
+
});
|
|
220
236
|
return function () {
|
|
221
237
|
context.$unsubscriber(context.topics.COMPONENT_SETTING_CLICK, csid);
|
|
222
238
|
context.$unsubscriber(context.topics.COMPONENT_HOVER, hcid);
|
|
223
239
|
context.$unsubscriber(context.topics.COMPONENT_ACTIVE, acid);
|
|
224
240
|
context.$unsubscriber(context.topics.MODAL_OPEN, cmtid);
|
|
241
|
+
context.$unsubscriber(context.topics.COMPONENT_DELETE, cdid);
|
|
225
242
|
};
|
|
226
243
|
}, []);
|
|
227
244
|
useEffect(function () {
|
|
@@ -235,7 +252,7 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
235
252
|
return /*#__PURE__*/React.createElement(React.Fragment, null, operatorId.detector && /*#__PURE__*/React.createElement("div", {
|
|
236
253
|
id: "lc-detector",
|
|
237
254
|
className: styles['lc-painter-design-detector'],
|
|
238
|
-
style: getOperatorStyle(target.current, getDomById(operatorId.detector))
|
|
255
|
+
style: getOperatorStyle(target.current, getDomById(operatorId.detector), 'detector', operatorId.detector)
|
|
239
256
|
}, /*#__PURE__*/React.createElement("span", {
|
|
240
257
|
className: styles['lc-painter-design-detector-name'],
|
|
241
258
|
style: {
|
|
@@ -245,10 +262,10 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
245
262
|
id: "lc-selector",
|
|
246
263
|
key: "".concat((size === null || size === void 0 ? void 0 : size.width) || 0, "-").concat((size === null || size === void 0 ? void 0 : size.height) || 0, "-").concat(positionKey),
|
|
247
264
|
className: styles['lc-painter-design-selector'],
|
|
248
|
-
style: getOperatorStyle(target.current, getDomById(operatorId.selector))
|
|
265
|
+
style: getOperatorStyle(target.current, getDomById(operatorId.selector), 'selector', operatorId.selector)
|
|
249
266
|
}, acticeProps && /*#__PURE__*/React.createElement("div", {
|
|
250
267
|
className: styles['lc-borders-actions'],
|
|
251
|
-
style: acticeProps.props.id ===
|
|
268
|
+
style: acticeProps.props.id === LC_BUILDIN_UNIT_KEY.PAGE_ROOT ? {
|
|
252
269
|
top: 0
|
|
253
270
|
} : ((_getDomById2 = getDomById(operatorId.selector)) === null || _getDomById2 === void 0 ? void 0 : _getDomById2.offsetTop) < 23 ? {
|
|
254
271
|
bottom: '-23px'
|
|
@@ -260,7 +277,7 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
260
277
|
placement: "bottomLeft"
|
|
261
278
|
}, /*#__PURE__*/React.createElement("div", {
|
|
262
279
|
className: "instance-node-selector"
|
|
263
|
-
}, acticeProps.props.name)), /*#__PURE__*/React.createElement("div", {
|
|
280
|
+
}, acticeProps.props.name)), operatorId.deletable && /*#__PURE__*/React.createElement("div", {
|
|
264
281
|
onClick: function onClick() {
|
|
265
282
|
return handleDelete(acticeProps.props);
|
|
266
283
|
}
|