@luck-design-biz/luckda 0.0.22 → 0.0.24-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +40 -49
- package/es/components/Builder/index.js +4 -4
- package/es/components/LdAutoForm/index.js +7 -9
- package/es/components/LdCard/index.js +5 -6
- package/es/components/LdCard/model.js +1 -1
- package/es/components/LdCom/index.js +2 -2
- package/es/components/LdFormList/index.js +15 -16
- package/es/components/LdFormList/model.js +0 -0
- package/es/components/LdGrid/index.js +11 -12
- package/es/components/LdGrid/model.js +1 -1
- package/es/components/LdGridForm/index.js +10 -10
- package/es/components/LdGridForm/index.less +7 -7
- package/es/components/LdInfoPanel/index.js +2 -2
- package/es/components/LdPop/index.js +0 -0
- package/es/components/LdRuntimeCom/index.js +42 -0
- package/es/components/LdTree/index.js +3 -4
- package/es/components/LdTree/index.less +36 -36
- package/es/helper/FromItems.js +1 -1
- package/es/helper/action.js +8 -8
- package/es/helper/form.js +16 -16
- package/es/helper/index.less +7 -7
- package/es/helper/ldBuilder.js +1 -1
- package/es/helper/ldComBuild.js +4 -4
- package/es/index.js +10 -9
- package/es/lowcode/constants/api-url.js +3 -0
- package/es/lowcode/constants/event-topics.js +36 -0
- package/es/lowcode/constants/index.js +12 -0
- package/es/lowcode/engine/factory/DataFactory.js +1 -0
- package/es/lowcode/engine/factory/panel-item-factory/DynamicStrategy.js +60 -0
- package/es/lowcode/engine/factory/panel-item-factory/GroupStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/SegmentedStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +50 -0
- package/es/lowcode/engine/factory/panel-item-factory/Strategy.js +21 -0
- package/es/lowcode/engine/factory/panel-item-factory/StringStrategy.js +50 -0
- package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/index.js +42 -0
- package/es/lowcode/engine/meta/box.props.default.json +12 -0
- package/es/lowcode/engine/meta/box.props.json +42 -0
- package/es/lowcode/engine/meta/button.props.default.json +16 -0
- package/es/lowcode/engine/meta/button.props.json +122 -0
- package/es/lowcode/engine/meta/cardlist.props.default.json +18 -0
- package/es/lowcode/engine/meta/cardlist.props.json +144 -0
- package/es/lowcode/engine/meta/components-list.json +128 -0
- package/es/lowcode/engine/meta/dialog.props.default.json +19 -0
- package/es/lowcode/engine/meta/dialog.props.json +121 -0
- package/es/lowcode/engine/meta/drawer.props.default.json +18 -0
- package/es/lowcode/engine/meta/drawer.props.json +144 -0
- package/es/lowcode/engine/meta/form.props.default.json +13 -0
- package/es/lowcode/engine/meta/form.props.json +117 -0
- package/es/lowcode/engine/meta/iframe.props.default.json +11 -0
- package/es/lowcode/engine/meta/iframe.props.json +32 -0
- package/es/lowcode/engine/meta/image.props.default.json +16 -0
- package/es/lowcode/engine/meta/image.props.json +114 -0
- package/es/lowcode/engine/meta/imex.props.default.json +12 -0
- package/es/lowcode/engine/meta/imex.props.json +82 -0
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +29 -0
- package/es/lowcode/engine/meta/jsx.props.default.json +10 -0
- package/es/lowcode/engine/meta/jsx.props.json +25 -0
- package/es/lowcode/engine/meta/layout.props.default.json +13 -0
- package/es/lowcode/engine/meta/layout.props.json +108 -0
- package/es/lowcode/engine/meta/link.props.default.json +14 -0
- package/es/lowcode/engine/meta/link.props.json +112 -0
- package/es/lowcode/engine/meta/section.props.default.json +17 -0
- package/es/lowcode/engine/meta/section.props.json +108 -0
- package/es/lowcode/engine/meta/split.props.default.json +13 -0
- package/es/lowcode/engine/meta/split.props.json +72 -0
- package/es/lowcode/engine/meta/table.props.default.json +12 -0
- package/es/lowcode/engine/meta/table.props.json +174 -0
- package/es/lowcode/engine/meta/tabs.props.default.json +18 -0
- package/es/lowcode/engine/meta/tabs.props.json +141 -0
- package/es/lowcode/engine/meta/text.props.default.json +12 -0
- package/es/lowcode/engine/meta/text.props.json +66 -0
- package/es/lowcode/engine/meta/tree.props.default.json +17 -0
- package/es/lowcode/engine/meta/tree.props.json +157 -0
- package/es/lowcode/engine/provider/ContextProvider.js +157 -0
- package/es/lowcode/engine/provider/EventBusProvider.js +120 -0
- package/es/lowcode/engine/tools/dataProcess.js +263 -0
- package/es/lowcode/engine/tools/helper.js +4 -0
- package/es/lowcode/engine/tools/usePromiseState.js +24 -0
- package/es/lowcode/index.js +3 -0
- package/es/lowcode/painter/Components.js +104 -0
- package/es/lowcode/painter/Design.js +329 -0
- package/es/lowcode/painter/I18n.js +205 -0
- package/es/lowcode/painter/Outline.js +207 -0
- package/es/lowcode/painter/Panel.js +207 -0
- package/es/lowcode/painter/Ribbon.js +142 -0
- package/es/lowcode/painter/components/Collapse.js +31 -0
- package/es/lowcode/painter/components/NumberInput.js +93 -0
- package/es/lowcode/painter/components/PanelItem.js +63 -0
- package/es/lowcode/painter/components/PopConfirm.js +20 -0
- package/es/lowcode/painter/components/PopForm.js +71 -0
- package/es/lowcode/painter/components/RuleInput.js +105 -0
- package/es/lowcode/painter/components/SortBox.js +92 -0
- package/es/lowcode/painter/components/TabEditor.js +88 -0
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +118 -0
- package/es/lowcode/painter/components/code-editor/CssEditor.js +14 -0
- package/es/lowcode/painter/components/code-editor/FullScreenEditor.js +64 -0
- package/es/lowcode/painter/components/code-editor/JSEditor.js +84 -0
- package/es/lowcode/painter/components/code-editor/index.js +2 -0
- package/es/lowcode/painter/index.js +45 -0
- package/es/lowcode/painter/panel-section/ButtonType.js +39 -0
- package/es/lowcode/painter/panel-section/Icon.js +48 -0
- package/es/lowcode/painter/panel-section/IconSelector.js +134 -0
- package/es/lowcode/painter/panel-section/LayoutRatio.js +130 -0
- package/es/lowcode/painter/panel-section/StylePanel/Display.js +292 -0
- package/es/lowcode/painter/panel-section/StylePanel/DisplaySvg.js +543 -0
- package/es/lowcode/painter/panel-section/StylePanel/Height.js +48 -0
- package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +64 -0
- package/es/lowcode/painter/panel-section/StylePanel/StyleContext.js +101 -0
- package/es/lowcode/painter/panel-section/StylePanel/Width.js +48 -0
- package/es/lowcode/painter/panel-section/StylePanel/index.js +12 -0
- package/es/lowcode/painter/panel-section/TabItems.js +237 -0
- package/es/lowcode/painter/services/I18n.js +85 -0
- package/es/lowcode/painter/style/button-type.less +5 -0
- package/es/lowcode/painter/style/collapse.less +21 -0
- package/es/lowcode/painter/style/components.less +90 -0
- package/es/lowcode/painter/style/design.less +142 -0
- package/es/lowcode/painter/style/display.less +17 -0
- package/es/lowcode/painter/style/fullscreen-editor.less +17 -0
- package/es/lowcode/painter/style/icon-selector.less +22 -0
- package/es/lowcode/painter/style/icon.less +11 -0
- package/es/lowcode/painter/style/index.less +6 -0
- package/es/lowcode/painter/style/layout-ratio.less +51 -0
- package/es/lowcode/painter/style/number-input.less +17 -0
- package/es/lowcode/painter/style/outline.less +28 -0
- package/es/lowcode/painter/style/panel-item.less +44 -0
- package/es/lowcode/painter/style/panel.less +142 -0
- package/es/lowcode/painter/style/pop-confirm.less +10 -0
- package/es/lowcode/painter/style/pop-form.less +20 -0
- package/es/lowcode/painter/style/radio.less +24 -0
- package/es/lowcode/painter/style/ribbon.less +5 -0
- package/es/lowcode/painter/style/rule-input.less +13 -0
- package/es/lowcode/painter/style/style-panel.less +5 -0
- package/es/lowcode/painter/style/tabeditor.less +90 -0
- package/es/lowcode/painter/style/tabitems.less +90 -0
- package/es/lowcode/view/Canvas.js +143 -0
- package/es/lowcode/view/Loading.js +23 -0
- package/es/lowcode/view/Page.js +252 -0
- package/es/lowcode/view/index.js +18 -0
- package/es/lowcode/view/lc-components/Box/FunctionDesign.js +20 -0
- package/es/lowcode/view/lc-components/Box/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Box/index.js +38 -0
- package/es/lowcode/view/lc-components/Box/index.less +15 -0
- package/es/lowcode/view/lc-components/Box/meta.json +42 -0
- package/es/lowcode/view/lc-components/Button/FunctionDesign.js +21 -0
- package/es/lowcode/view/lc-components/Button/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Button/index.js +102 -0
- package/es/lowcode/view/lc-components/Button/meta.json +122 -0
- package/es/lowcode/view/lc-components/CardList/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/CardList/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/CardList/index.js +20 -0
- package/es/lowcode/view/lc-components/CardList/meta.json +144 -0
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Dialog/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Dialog/index.js +61 -0
- package/es/lowcode/view/lc-components/Dialog/index.less +3 -0
- package/es/lowcode/view/lc-components/Dialog/meta.json +121 -0
- package/es/lowcode/view/lc-components/Drawer/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Drawer/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Drawer/index.js +62 -0
- package/es/lowcode/view/lc-components/Drawer/meta.json +144 -0
- package/es/lowcode/view/lc-components/Drawer/style.less +7 -0
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Form/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Form/index.js +20 -0
- package/es/lowcode/view/lc-components/Form/meta.json +117 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Iframe/index.js +20 -0
- package/es/lowcode/view/lc-components/Iframe/meta.json +32 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/ImEx/index.js +20 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +82 -0
- package/es/lowcode/view/lc-components/Image/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Image/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Image/index.js +20 -0
- package/es/lowcode/view/lc-components/Image/meta.json +114 -0
- package/es/lowcode/view/lc-components/JSX/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/JSX/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/JSX/index.js +20 -0
- package/es/lowcode/view/lc-components/JSX/meta.json +25 -0
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +75 -0
- package/es/lowcode/view/lc-components/Layout/FunctionLive.js +15 -0
- package/es/lowcode/view/lc-components/Layout/index.js +57 -0
- package/es/lowcode/view/lc-components/Layout/index.less +5 -0
- package/es/lowcode/view/lc-components/Layout/meta.json +108 -0
- package/es/lowcode/view/lc-components/Link/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Link/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Link/index.js +20 -0
- package/es/lowcode/view/lc-components/Link/meta.json +112 -0
- package/es/lowcode/view/lc-components/Section/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Section/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Section/index.js +34 -0
- package/es/lowcode/view/lc-components/Section/meta.json +108 -0
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Split/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Split/index.js +21 -0
- package/es/lowcode/view/lc-components/Split/meta.json +72 -0
- package/es/lowcode/view/lc-components/Table/FunctionDesign.js +16 -0
- package/es/lowcode/view/lc-components/Table/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Table/index.js +153 -0
- package/es/lowcode/view/lc-components/Table/meta.json +174 -0
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Tabs/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Tabs/index.js +21 -0
- package/es/lowcode/view/lc-components/Tabs/meta.json +141 -0
- package/es/lowcode/view/lc-components/Text/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Text/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Text/index.js +23 -0
- package/es/lowcode/view/lc-components/Text/meta.json +66 -0
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Tree/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Tree/index.js +20 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +157 -0
- package/es/lowcode/view/lc-components/Wrapper.js +54 -0
- package/es/lowcode/view/style/canvas.less +5 -0
- package/es/lowcode/view/style/loading.less +84 -0
- package/es/lowcode/view/style/page.less +5 -0
- package/es/services.js +1 -1
- package/es/upload/Form/gridForm.js +30 -8
- package/es/upload/Form/index.js +1 -1
- package/es/upload/Form/index.less +7 -7
- package/es/upload/FormItem/index.js +30 -18
- package/es/upload/GridCell/index.js +0 -0
- package/es/upload/index.js +3 -3
- package/es/utils/action.js +1 -1
- package/es/utils/form.js +26 -26
- package/es/utils/grid.js +26 -29
- package/es/utils/index.js +3 -3
- package/lib/components/Builder/index.js +3 -5
- package/lib/components/LdAutoForm/index.js +5 -8
- package/lib/components/LdCard/index.js +5 -7
- package/lib/components/LdCard/model.js +0 -0
- package/lib/components/LdCom/index.js +6 -11
- package/lib/components/LdFormList/index.js +10 -12
- package/lib/components/LdFormList/model.js +0 -0
- package/lib/components/LdGrid/index.js +10 -12
- package/lib/components/LdGrid/model.js +0 -0
- package/lib/components/LdGridForm/index.js +6 -7
- package/lib/components/LdGridForm/index.less +7 -7
- package/lib/components/LdInfoPanel/index.js +2 -3
- package/lib/components/LdPop/index.js +2 -4
- package/lib/components/LdRuntimeCom/index.js +49 -0
- package/lib/components/LdTree/index.js +2 -4
- package/lib/components/LdTree/index.less +36 -36
- package/lib/helper/FromItems.js +15 -29
- package/lib/helper/action.js +9 -11
- package/lib/helper/form.js +18 -20
- package/lib/helper/index.less +7 -7
- package/lib/helper/ldBuilder.js +1 -2
- package/lib/helper/ldComBuild.js +7 -11
- package/lib/index.js +9 -1
- package/lib/lowcode/constants/api-url.js +9 -0
- package/lib/lowcode/constants/event-topics.js +42 -0
- package/lib/lowcode/constants/index.js +18 -0
- package/lib/lowcode/engine/factory/DataFactory.js +3 -0
- package/lib/lowcode/engine/factory/panel-item-factory/DynamicStrategy.js +73 -0
- package/lib/lowcode/engine/factory/panel-item-factory/GroupStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SegmentedStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +56 -0
- package/lib/lowcode/engine/factory/panel-item-factory/Strategy.js +27 -0
- package/lib/lowcode/engine/factory/panel-item-factory/StringStrategy.js +56 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/index.js +48 -0
- package/lib/lowcode/engine/meta/box.props.default.json +12 -0
- package/lib/lowcode/engine/meta/box.props.json +42 -0
- package/lib/lowcode/engine/meta/button.props.default.json +16 -0
- package/lib/lowcode/engine/meta/button.props.json +122 -0
- package/lib/lowcode/engine/meta/cardlist.props.default.json +18 -0
- package/lib/lowcode/engine/meta/cardlist.props.json +144 -0
- package/lib/lowcode/engine/meta/components-list.json +128 -0
- package/lib/lowcode/engine/meta/dialog.props.default.json +19 -0
- package/lib/lowcode/engine/meta/dialog.props.json +121 -0
- package/lib/lowcode/engine/meta/drawer.props.default.json +18 -0
- package/lib/lowcode/engine/meta/drawer.props.json +144 -0
- package/lib/lowcode/engine/meta/form.props.default.json +13 -0
- package/lib/lowcode/engine/meta/form.props.json +117 -0
- package/lib/lowcode/engine/meta/iframe.props.default.json +11 -0
- package/lib/lowcode/engine/meta/iframe.props.json +32 -0
- package/lib/lowcode/engine/meta/image.props.default.json +16 -0
- package/lib/lowcode/engine/meta/image.props.json +114 -0
- package/lib/lowcode/engine/meta/imex.props.default.json +12 -0
- package/lib/lowcode/engine/meta/imex.props.json +82 -0
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +29 -0
- package/lib/lowcode/engine/meta/jsx.props.default.json +10 -0
- package/lib/lowcode/engine/meta/jsx.props.json +25 -0
- package/lib/lowcode/engine/meta/layout.props.default.json +13 -0
- package/lib/lowcode/engine/meta/layout.props.json +108 -0
- package/lib/lowcode/engine/meta/link.props.default.json +14 -0
- package/lib/lowcode/engine/meta/link.props.json +112 -0
- package/lib/lowcode/engine/meta/section.props.default.json +17 -0
- package/lib/lowcode/engine/meta/section.props.json +108 -0
- package/lib/lowcode/engine/meta/split.props.default.json +13 -0
- package/lib/lowcode/engine/meta/split.props.json +72 -0
- package/lib/lowcode/engine/meta/table.props.default.json +12 -0
- package/lib/lowcode/engine/meta/table.props.json +174 -0
- package/lib/lowcode/engine/meta/tabs.props.default.json +18 -0
- package/lib/lowcode/engine/meta/tabs.props.json +141 -0
- package/lib/lowcode/engine/meta/text.props.default.json +12 -0
- package/lib/lowcode/engine/meta/text.props.json +66 -0
- package/lib/lowcode/engine/meta/tree.props.default.json +17 -0
- package/lib/lowcode/engine/meta/tree.props.json +157 -0
- package/lib/lowcode/engine/provider/ContextProvider.js +165 -0
- package/lib/lowcode/engine/provider/EventBusProvider.js +128 -0
- package/lib/lowcode/engine/tools/dataProcess.js +277 -0
- package/lib/lowcode/engine/tools/helper.js +11 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +31 -0
- package/lib/lowcode/index.js +20 -0
- package/lib/lowcode/painter/Components.js +112 -0
- package/lib/lowcode/painter/Design.js +336 -0
- package/lib/lowcode/painter/I18n.js +213 -0
- package/lib/lowcode/painter/Outline.js +215 -0
- package/lib/lowcode/painter/Panel.js +215 -0
- package/lib/lowcode/painter/Ribbon.js +150 -0
- package/lib/lowcode/painter/components/Collapse.js +39 -0
- package/lib/lowcode/painter/components/NumberInput.js +101 -0
- package/lib/lowcode/painter/components/PanelItem.js +70 -0
- package/lib/lowcode/painter/components/PopConfirm.js +26 -0
- package/lib/lowcode/painter/components/PopForm.js +77 -0
- package/lib/lowcode/painter/components/RuleInput.js +112 -0
- package/lib/lowcode/painter/components/SortBox.js +99 -0
- package/lib/lowcode/painter/components/TabEditor.js +94 -0
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +126 -0
- package/lib/lowcode/painter/components/code-editor/CssEditor.js +22 -0
- package/lib/lowcode/painter/components/code-editor/FullScreenEditor.js +72 -0
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +95 -0
- package/lib/lowcode/painter/components/code-editor/index.js +20 -0
- package/lib/lowcode/painter/index.js +54 -0
- package/lib/lowcode/painter/panel-section/ButtonType.js +46 -0
- package/lib/lowcode/painter/panel-section/Icon.js +54 -0
- package/lib/lowcode/painter/panel-section/IconSelector.js +141 -0
- package/lib/lowcode/painter/panel-section/LayoutRatio.js +138 -0
- package/lib/lowcode/painter/panel-section/StylePanel/Display.js +299 -0
- package/lib/lowcode/painter/panel-section/StylePanel/DisplaySvg.js +550 -0
- package/lib/lowcode/painter/panel-section/StylePanel/Height.js +55 -0
- package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +72 -0
- package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +112 -0
- package/lib/lowcode/painter/panel-section/StylePanel/Width.js +55 -0
- package/lib/lowcode/painter/panel-section/StylePanel/index.js +19 -0
- package/lib/lowcode/painter/panel-section/TabItems.js +245 -0
- package/lib/lowcode/painter/services/I18n.js +95 -0
- package/lib/lowcode/painter/style/button-type.less +5 -0
- package/lib/lowcode/painter/style/collapse.less +21 -0
- package/lib/lowcode/painter/style/components.less +90 -0
- package/lib/lowcode/painter/style/design.less +142 -0
- package/lib/lowcode/painter/style/display.less +17 -0
- package/lib/lowcode/painter/style/fullscreen-editor.less +17 -0
- package/lib/lowcode/painter/style/icon-selector.less +22 -0
- package/lib/lowcode/painter/style/icon.less +11 -0
- package/lib/lowcode/painter/style/index.less +6 -0
- package/lib/lowcode/painter/style/layout-ratio.less +51 -0
- package/lib/lowcode/painter/style/number-input.less +17 -0
- package/lib/lowcode/painter/style/outline.less +28 -0
- package/lib/lowcode/painter/style/panel-item.less +44 -0
- package/lib/lowcode/painter/style/panel.less +142 -0
- package/lib/lowcode/painter/style/pop-confirm.less +10 -0
- package/lib/lowcode/painter/style/pop-form.less +20 -0
- package/lib/lowcode/painter/style/radio.less +24 -0
- package/lib/lowcode/painter/style/ribbon.less +5 -0
- package/lib/lowcode/painter/style/rule-input.less +13 -0
- package/lib/lowcode/painter/style/style-panel.less +5 -0
- package/lib/lowcode/painter/style/tabeditor.less +90 -0
- package/lib/lowcode/painter/style/tabitems.less +90 -0
- package/lib/lowcode/view/Canvas.js +158 -0
- package/lib/lowcode/view/Loading.js +30 -0
- package/lib/lowcode/view/Page.js +260 -0
- package/lib/lowcode/view/index.js +25 -0
- package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +27 -0
- package/lib/lowcode/view/lc-components/Box/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Box/index.js +46 -0
- package/lib/lowcode/view/lc-components/Box/index.less +15 -0
- package/lib/lowcode/view/lc-components/Box/meta.json +42 -0
- package/lib/lowcode/view/lc-components/Button/FunctionDesign.js +28 -0
- package/lib/lowcode/view/lc-components/Button/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Button/index.js +110 -0
- package/lib/lowcode/view/lc-components/Button/meta.json +122 -0
- package/lib/lowcode/view/lc-components/CardList/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/CardList/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/CardList/index.js +28 -0
- package/lib/lowcode/view/lc-components/CardList/meta.json +144 -0
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Dialog/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Dialog/index.js +69 -0
- package/lib/lowcode/view/lc-components/Dialog/index.less +3 -0
- package/lib/lowcode/view/lc-components/Dialog/meta.json +121 -0
- package/lib/lowcode/view/lc-components/Drawer/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Drawer/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Drawer/index.js +70 -0
- package/lib/lowcode/view/lc-components/Drawer/meta.json +144 -0
- package/lib/lowcode/view/lc-components/Drawer/style.less +7 -0
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Form/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Form/index.js +28 -0
- package/lib/lowcode/view/lc-components/Form/meta.json +117 -0
- package/lib/lowcode/view/lc-components/Iframe/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Iframe/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Iframe/index.js +28 -0
- package/lib/lowcode/view/lc-components/Iframe/meta.json +32 -0
- package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/ImEx/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/ImEx/index.js +28 -0
- package/lib/lowcode/view/lc-components/ImEx/meta.json +82 -0
- package/lib/lowcode/view/lc-components/Image/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Image/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Image/index.js +28 -0
- package/lib/lowcode/view/lc-components/Image/meta.json +114 -0
- package/lib/lowcode/view/lc-components/JSX/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/JSX/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/JSX/index.js +28 -0
- package/lib/lowcode/view/lc-components/JSX/meta.json +25 -0
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +82 -0
- package/lib/lowcode/view/lc-components/Layout/FunctionLive.js +22 -0
- package/lib/lowcode/view/lc-components/Layout/index.js +65 -0
- package/lib/lowcode/view/lc-components/Layout/index.less +5 -0
- package/lib/lowcode/view/lc-components/Layout/meta.json +108 -0
- package/lib/lowcode/view/lc-components/Link/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Link/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Link/index.js +28 -0
- package/lib/lowcode/view/lc-components/Link/meta.json +112 -0
- package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Section/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Section/index.js +42 -0
- package/lib/lowcode/view/lc-components/Section/meta.json +108 -0
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Split/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Split/index.js +29 -0
- package/lib/lowcode/view/lc-components/Split/meta.json +72 -0
- package/lib/lowcode/view/lc-components/Table/FunctionDesign.js +23 -0
- package/lib/lowcode/view/lc-components/Table/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Table/index.js +161 -0
- package/lib/lowcode/view/lc-components/Table/meta.json +174 -0
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Tabs/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Tabs/index.js +29 -0
- package/lib/lowcode/view/lc-components/Tabs/meta.json +141 -0
- package/lib/lowcode/view/lc-components/Text/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Text/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Text/index.js +31 -0
- package/lib/lowcode/view/lc-components/Text/meta.json +66 -0
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Tree/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Tree/index.js +28 -0
- package/lib/lowcode/view/lc-components/Tree/meta.json +157 -0
- package/lib/lowcode/view/lc-components/Wrapper.js +61 -0
- package/lib/lowcode/view/style/canvas.less +5 -0
- package/lib/lowcode/view/style/loading.less +84 -0
- package/lib/lowcode/view/style/page.less +5 -0
- package/lib/services.js +0 -0
- package/lib/upload/Form/gridForm.js +28 -7
- package/lib/upload/Form/index.js +1 -2
- package/lib/upload/Form/index.less +7 -7
- package/lib/upload/FormItem/index.js +30 -19
- package/lib/upload/GridCell/index.js +1 -2
- package/lib/upload/index.js +0 -0
- package/lib/utils/action.js +0 -0
- package/lib/utils/form.js +26 -29
- package/lib/utils/grid.js +22 -26
- package/lib/utils/index.js +0 -0
- package/lowcode.js +1 -0
- package/package.json +164 -78
- package/upload.js +1 -1
- package/utils.js +1 -1
- package/README.zh-CN.md +0 -51
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { startsWith } from 'lodash';
|
|
4
|
+
import styles from "../style/panel-item.less";
|
|
5
|
+
import { Icon } from 'luck-design/antd';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `PanelItem` 组件用于展示属性面板中的单个属性项。
|
|
9
|
+
* 它支持展示一个标签(属性名称)及对应的组件(例如输入框、选择器等),并可通过传入的 `addon` 属性添加额外的内容。
|
|
10
|
+
* 此组件支持折叠功能,可以通过 `collapsed` 属性控制初始折叠状态。
|
|
11
|
+
*
|
|
12
|
+
* @component
|
|
13
|
+
* @example
|
|
14
|
+
* ```jsx
|
|
15
|
+
* <PanelItem
|
|
16
|
+
* label="属性名称"
|
|
17
|
+
* collapsed={false}
|
|
18
|
+
* addon={<div>额外内容</div>}
|
|
19
|
+
* >
|
|
20
|
+
* <input type="text" />
|
|
21
|
+
* </PanelItem>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} props 组件接收的参数。
|
|
25
|
+
* @param {string} props.label 显示的属性名称。如果标签以 `#` 开头,则不显示。
|
|
26
|
+
* @param {boolean} [props.collapsed=true] 初始是否折叠。默认为 `true`。
|
|
27
|
+
* @param {React.ReactNode} props.addon 当属性项展开时,可以在下方显示额外内容。
|
|
28
|
+
* @param {React.ReactNode} props.children 对应于属性名称的组件,可以是输入框、下拉菜单等 React 节点。
|
|
29
|
+
*
|
|
30
|
+
* @returns {React.Element} 渲染属性名称、对应的组件以及可选的额外内容。
|
|
31
|
+
*/
|
|
32
|
+
export default function (_ref) {
|
|
33
|
+
var label = _ref.label,
|
|
34
|
+
_ref$collapsed = _ref.collapsed,
|
|
35
|
+
collapsed = _ref$collapsed === void 0 ? true : _ref$collapsed,
|
|
36
|
+
addon = _ref.addon,
|
|
37
|
+
children = _ref.children;
|
|
38
|
+
var _useState = useState(collapsed),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
curClps = _useState2[0],
|
|
41
|
+
setCurClps = _useState2[1];
|
|
42
|
+
var HandleClick = function HandleClick() {
|
|
43
|
+
setCurClps(!curClps);
|
|
44
|
+
};
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
setCurClps(collapsed);
|
|
47
|
+
}, [collapsed]);
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: styles['lc-painter-components-panelitem']
|
|
50
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: styles['panelrow']
|
|
52
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: styles['item-label']
|
|
54
|
+
}, addon && /*#__PURE__*/React.createElement(Icon, {
|
|
55
|
+
className: styles['item-icon'],
|
|
56
|
+
type: !curClps ? 'down' : 'right',
|
|
57
|
+
onClick: HandleClick
|
|
58
|
+
}), label && !startsWith(label, '#') && /*#__PURE__*/React.createElement("span", null, label)), /*#__PURE__*/React.createElement("span", {
|
|
59
|
+
className: styles['item-component']
|
|
60
|
+
}, children)), !curClps && /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: styles['addon']
|
|
62
|
+
}, addon));
|
|
63
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Popconfirm } from 'luck-design/antd';
|
|
4
|
+
import styles from "../style/pop-confirm.less";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 这个组件是对 luck-design/antd 的 Popconfirm 组件的封装。
|
|
8
|
+
* 它提供了一个带有自定义样式的弹出确认框,用于在用户尝试执行重要操作前提示确认信息。
|
|
9
|
+
* 通过传入的 props 可以自定义 Popconfirm 组件的行为和外观。
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} props - 传递给 Popconfirm 组件的属性。这包括所有标准的 Popconfirm 属性,
|
|
12
|
+
* 以及任何额外的属性,如事件处理器或自定义内容。
|
|
13
|
+
* @returns {ReactNode} 返回一个配置了自定义样式和指定属性的 Popconfirm 组件实例。
|
|
14
|
+
*/
|
|
15
|
+
export default function (props) {
|
|
16
|
+
return /*#__PURE__*/React.createElement(Popconfirm, _extends({
|
|
17
|
+
overlayClassName: styles['lc-painter-panel-section-components-popconfirm'],
|
|
18
|
+
icon: null
|
|
19
|
+
}, props));
|
|
20
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"],
|
|
4
|
+
_excluded2 = ["children"],
|
|
5
|
+
_excluded3 = ["children"],
|
|
6
|
+
_excluded4 = ["children"];
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import styles from "../style/pop-form.less";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* PopForm 是一个为弹出式表单布局提供容器的组件,它使用特定的样式来组织表单内容。
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} props - 组件的 props。
|
|
14
|
+
* @param {ReactNode} props.children - 组件内包含的子元素。
|
|
15
|
+
* @param {Object} rest - 传递给组件的其余属性,这些属性将直接传递给根 div 元素。
|
|
16
|
+
*/
|
|
17
|
+
export var PopForm = function PopForm(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
21
|
+
className: styles['lc-painter-panel-section-components-popform']
|
|
22
|
+
}, rest), children);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* PopFormItem 是 PopForm 组件的一个子项,用于包装表单的每个独立字段。
|
|
27
|
+
* 它提供了一致的布局和样式封装,用于表单项的展示。
|
|
28
|
+
*
|
|
29
|
+
* @param {Object} props - 组件的 props。
|
|
30
|
+
* @param {ReactNode} props.children - 组件内包含的子元素。
|
|
31
|
+
* @param {Object} rest - 传递给组件的其余属性,这些属性将直接传递给根 div 元素。
|
|
32
|
+
*/
|
|
33
|
+
export var PopFormItem = function PopFormItem(_ref2) {
|
|
34
|
+
var children = _ref2.children,
|
|
35
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
37
|
+
className: styles['item']
|
|
38
|
+
}, rest), children);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* PopFormItemLeft 是 PopFormItem 的子组件,用于展示表单项的标签或标题部分。
|
|
43
|
+
* 它通常用于放置字段名或说明性文本。
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} props - 组件的 props。
|
|
46
|
+
* @param {ReactNode} props.children - 组件内包含的子元素。
|
|
47
|
+
* @param {Object} rest - 传递给组件的其余属性,这些属性将直接传递给根 div 元素。
|
|
48
|
+
*/
|
|
49
|
+
export var PopFormItemLeft = function PopFormItemLeft(_ref3) {
|
|
50
|
+
var children = _ref3.children,
|
|
51
|
+
rest = _objectWithoutProperties(_ref3, _excluded3);
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
53
|
+
className: styles['left']
|
|
54
|
+
}, rest), children);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* PopFormItemRight 是 PopFormItem 的子组件,用于包含表单项的输入字段。
|
|
59
|
+
* 它是表单项布局中用于用户输入的部分,可以容纳各种类型的输入控件。
|
|
60
|
+
*
|
|
61
|
+
* @param {Object} props - 组件的 props。
|
|
62
|
+
* @param {ReactNode} props.children - 组件内包含的子元素。
|
|
63
|
+
* @param {Object} rest - 传递给组件的其余属性,这些属性将直接传递给根 div 元素。
|
|
64
|
+
*/
|
|
65
|
+
export var PopFormItemRight = function PopFormItemRight(_ref4) {
|
|
66
|
+
var children = _ref4.children,
|
|
67
|
+
rest = _objectWithoutProperties(_ref4, _excluded4);
|
|
68
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
69
|
+
className: styles['right']
|
|
70
|
+
}, rest), children);
|
|
71
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
|
+
var _excluded = ["onValueChange", "rules", "value"];
|
|
7
|
+
import React, { forwardRef, useState, useEffect } from 'react';
|
|
8
|
+
import { Input, Tooltip } from 'luck-design/antd';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import styles from "../style/rule-input.less";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 带校验功能的输入组件。
|
|
14
|
+
*
|
|
15
|
+
* 此组件封装了antd的Input组件,并增加了输入值的校验功能。它允许开发者定义一组校验规则,
|
|
16
|
+
* 以确保用户输入符合特定要求。每条规则由一个校验函数和一个错误信息组成。如果用户的输入
|
|
17
|
+
* 不满足任何一条规则,将展示相应的错误信息提示。
|
|
18
|
+
*
|
|
19
|
+
* @component
|
|
20
|
+
* @example
|
|
21
|
+
* <RuleInput
|
|
22
|
+
* value="示例值"
|
|
23
|
+
* onValueChange={(e, newValue) => console.log('新值:', newValue)}
|
|
24
|
+
* rules={[
|
|
25
|
+
* { func: value => !!value, err: '输入不能为空' },
|
|
26
|
+
* { func: value => /^\d+$/.test(value), err: '只允许输入数字' }
|
|
27
|
+
* ]}
|
|
28
|
+
* />
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} props 组件接收的props
|
|
31
|
+
* @param {string} props.value 输入框当前的值,可以由外部控制以实现受控组件。
|
|
32
|
+
* @param {Function} props.onValueChange 当输入值改变并通过所有校验时,触发的回调函数。
|
|
33
|
+
* 该函数接收原生的事件对象和新的输入值作为参数。
|
|
34
|
+
* @param {Array<{func: (value: string) => boolean, err: string}>} props.rules
|
|
35
|
+
* 定义输入校验规则的数组。每个元素是一个对象,其中`func`属性是一个函数,用于执行校验逻辑,
|
|
36
|
+
* 接收当前输入值作为参数,返回一个布尔值表示校验是否通过;`err`属性是一个字符串,指定当
|
|
37
|
+
* 校验失败时要显示的错误信息。
|
|
38
|
+
* @param {Object} rest 传递给内部Input组件的其他props,如`placeholder`、`disabled`等。
|
|
39
|
+
* @param {React.Ref} ref React ref对象,用于将ref传递给内部的Input DOM元素。
|
|
40
|
+
*
|
|
41
|
+
* @returns React元素,渲染一个带有校验功能的输入框和校验失败时的错误信息提示。
|
|
42
|
+
*/
|
|
43
|
+
export default /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
44
|
+
var onValueChange = _ref.onValueChange,
|
|
45
|
+
rules = _ref.rules,
|
|
46
|
+
value = _ref.value,
|
|
47
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
+
var _useState = useState(value),
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
inputValue = _useState2[0],
|
|
51
|
+
setInputValue = _useState2[1]; // 托管输入值的状态
|
|
52
|
+
var _useState3 = useState(null),
|
|
53
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
54
|
+
err = _useState4[0],
|
|
55
|
+
setErr = _useState4[1];
|
|
56
|
+
|
|
57
|
+
// 使用useEffect钩子监听value的变化
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
setInputValue(value);
|
|
60
|
+
setErr(null);
|
|
61
|
+
}, [value]);
|
|
62
|
+
var handleInputChange = function handleInputChange(e) {
|
|
63
|
+
var value = e.target.value;
|
|
64
|
+
setInputValue(value); // 更新托管的输入值
|
|
65
|
+
|
|
66
|
+
if (value == '') onValueChange(e, value);
|
|
67
|
+
var error = null;
|
|
68
|
+
|
|
69
|
+
// 遍历rules,检查输入值是否满足条件
|
|
70
|
+
var _iterator = _createForOfIteratorHelper(rules),
|
|
71
|
+
_step;
|
|
72
|
+
try {
|
|
73
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
74
|
+
var rule = _step.value;
|
|
75
|
+
if (!rule.func(value)) {
|
|
76
|
+
error = rule.err;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch (err) {
|
|
81
|
+
_iterator.e(err);
|
|
82
|
+
} finally {
|
|
83
|
+
_iterator.f();
|
|
84
|
+
}
|
|
85
|
+
if (!error) {
|
|
86
|
+
setErr(null);
|
|
87
|
+
onValueChange(e, value);
|
|
88
|
+
} else {
|
|
89
|
+
setErr(error);
|
|
90
|
+
console.error(error);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
94
|
+
title: err,
|
|
95
|
+
visible: err
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Input, _extends({
|
|
97
|
+
className: classNames(styles['lc-painter-components-ruleinput'], _defineProperty({}, styles.err, !!err)),
|
|
98
|
+
size: "small",
|
|
99
|
+
value: inputValue // 绑定输入值
|
|
100
|
+
,
|
|
101
|
+
onChange: handleInputChange
|
|
102
|
+
}, rest, {
|
|
103
|
+
ref: ref
|
|
104
|
+
}))));
|
|
105
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { DndContext } from '@dnd-kit/core';
|
|
4
|
+
import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
5
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* SortBox 是一个使用 dnd-kit 实现拖拽排序的组件。
|
|
9
|
+
* 它允许子元素通过拖拽操作来重新排序,并在排序操作完成后通过 onChange 回调传递新的排序结果。
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} props 组件的 props。
|
|
12
|
+
* @param {Array} props.datas 初始排序的数据数组,通常包含用于排序的唯一标识符。
|
|
13
|
+
* @param {ReactNode} props.children 组件的子元素,通常是需要进行排序的元素集合。
|
|
14
|
+
* @param {Function} props.onChange 当排序操作完成时触发的回调函数,参数为重新排序后的数据数组。
|
|
15
|
+
* @param {Function} [props.strategy=verticalListSortingStrategy] 用于排序的策略。默认为垂直列表排序策略。
|
|
16
|
+
*
|
|
17
|
+
* @returns {ReactNode} 返回一个配置了 DndContext 和 SortableContext 的 React 组件结构。
|
|
18
|
+
*/
|
|
19
|
+
export var SortBox = function SortBox(_ref) {
|
|
20
|
+
var datas = _ref.datas,
|
|
21
|
+
children = _ref.children,
|
|
22
|
+
onChange = _ref.onChange,
|
|
23
|
+
strategy = _ref.strategy;
|
|
24
|
+
var _useState = useState(datas),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
items = _useState2[0],
|
|
27
|
+
setItems = _useState2[1];
|
|
28
|
+
var sortStrategy = strategy !== null && strategy !== void 0 ? strategy : verticalListSortingStrategy;
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
setItems(datas);
|
|
31
|
+
}, [datas]);
|
|
32
|
+
function handleDragEnd(event) {
|
|
33
|
+
var active = event.active,
|
|
34
|
+
over = event.over;
|
|
35
|
+
if (active.id !== over.id) {
|
|
36
|
+
setItems(function (items) {
|
|
37
|
+
var oldIndex = items.indexOf(active.id);
|
|
38
|
+
var newIndex = items.indexOf(over.id);
|
|
39
|
+
var newSortItem = arrayMove(items, oldIndex, newIndex);
|
|
40
|
+
if (onChange) onChange(newSortItem);
|
|
41
|
+
return newSortItem;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return /*#__PURE__*/React.createElement(DndContext, {
|
|
46
|
+
onDragEnd: handleDragEnd
|
|
47
|
+
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
48
|
+
strategy: sortStrategy,
|
|
49
|
+
items: items
|
|
50
|
+
}, children));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* SortItem 组件是一个使用 dnd-kit 实现的可排序项。它通过 useSortable 钩子来提供拖拽功能,
|
|
55
|
+
* 并将必要的属性和监听器传递给其子元素,使得子元素可拖拽。
|
|
56
|
+
*
|
|
57
|
+
* @param {Object} props - 组件的 props。
|
|
58
|
+
* @param {string} props.id - 该排序项的唯一标识符,用于识别不同的可排序元素。
|
|
59
|
+
* @param {ReactNode} props.children - 该组件的子元素。通常是你希望使之可拖拽的元素。
|
|
60
|
+
* SortItem 会将拖拽相关的 props 注入到这个子元素中。
|
|
61
|
+
*
|
|
62
|
+
* @returns {ReactNode} 返回一个增强后的 React 元素,此元素集成了拖拽功能。
|
|
63
|
+
* 它基于原 children 元素,附加了用于拖拽的属性和样式。
|
|
64
|
+
*/
|
|
65
|
+
export var SortItem = function SortItem(_ref2) {
|
|
66
|
+
var id = _ref2.id,
|
|
67
|
+
children = _ref2.children;
|
|
68
|
+
var _useSortable = useSortable({
|
|
69
|
+
id: id
|
|
70
|
+
}),
|
|
71
|
+
attributes = _useSortable.attributes,
|
|
72
|
+
listeners = _useSortable.listeners,
|
|
73
|
+
setNodeRef = _useSortable.setNodeRef,
|
|
74
|
+
transform = _useSortable.transform,
|
|
75
|
+
transition = _useSortable.transition,
|
|
76
|
+
setActivatorNodeRef = _useSortable.setActivatorNodeRef;
|
|
77
|
+
var style = {
|
|
78
|
+
transform: CSS.Transform.toString(transform),
|
|
79
|
+
transition: transition
|
|
80
|
+
};
|
|
81
|
+
var childWithProps = /*#__PURE__*/React.cloneElement(children, {
|
|
82
|
+
key: id,
|
|
83
|
+
attributes: attributes,
|
|
84
|
+
listeners: listeners,
|
|
85
|
+
setNodeRef: setNodeRef,
|
|
86
|
+
transform: transform,
|
|
87
|
+
transition: transition,
|
|
88
|
+
setActivatorNodeRef: setActivatorNodeRef,
|
|
89
|
+
style: style
|
|
90
|
+
});
|
|
91
|
+
return childWithProps;
|
|
92
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Icon } from 'luck-design/antd';
|
|
4
|
+
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
5
|
+
import styles from "../style/tabeditor.less";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* TabEditor 是一个用于管理和展示一组可编辑标签项的容器组件。
|
|
9
|
+
* 它提供了一个添加新标签项的操作按钮,并通过 children 属性接收一组 TabEditorItem 组件。
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} props - 组件接收的属性。
|
|
12
|
+
* @param {ReactNode} props.children - TabEditorItem 组件的实例,表示可编辑的标签项。
|
|
13
|
+
* @param {Function} props.handleAdd - 一个回调函数,当用户点击添加按钮时被触发,用于添加新的标签项。
|
|
14
|
+
* @returns {ReactNode} 渲染一个带有操作按钮和标签项的容器。
|
|
15
|
+
*/
|
|
16
|
+
export var TabEditor = function TabEditor(_ref) {
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
handleAdd = _ref.handleAdd;
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: styles['lc-painter-panel-section-components-tabeditor']
|
|
21
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: styles['tabs-box']
|
|
23
|
+
}, children), /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: styles['tabs-actions']
|
|
25
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: styles['tabs-action'],
|
|
27
|
+
onClick: handleAdd
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
29
|
+
type: "plus-circle"
|
|
30
|
+
}), ' ', formatMessage({
|
|
31
|
+
id: 'luckda.lowcode.painter.panel-section.components.tabeditor.add',
|
|
32
|
+
label: '添加一项'
|
|
33
|
+
}))));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* TabEditorItem 是一个可编辑的标签项组件,用于在 TabEditor 容器内展示。
|
|
38
|
+
* 它支持拖拽排序,并可以通过左侧和右侧的插槽来自定义内容。
|
|
39
|
+
*
|
|
40
|
+
* @param {Object} props - 组件接收的属性。
|
|
41
|
+
* @param {Object} props.item - 表示标签项数据的对象。
|
|
42
|
+
* @param {ReactNode} props.left - 放置在标签项左侧的内容,通常用于展示标签名称或其他信息。
|
|
43
|
+
* @param {ReactNode} props.right - 放置在标签项右侧的内容,通常用于展示操作按钮如编辑或删除。
|
|
44
|
+
* @param {Function} props.setNodeRef - 用于设置拖拽组件根节点的引用。
|
|
45
|
+
* @param {Function} props.setActivatorNodeRef - 用于设置激活拖拽操作的节点引用。
|
|
46
|
+
* @param {Object} props.style - 应用于标签项的样式对象,通常包含拖拽过程中的动态变化样式。
|
|
47
|
+
* @param {Object} props.attributes - 包含与拖拽相关的HTML属性。
|
|
48
|
+
* @param {Object} props.listeners - 包含处理拖拽事件的监听器。
|
|
49
|
+
* @param {CSSProperties} props.transform - 应用于组件的CSS变换属性,用于实现拖拽效果。
|
|
50
|
+
* @param {string} props.transition - 定义拖拽动画的CSS过渡属性。
|
|
51
|
+
* @returns {ReactNode} 渲染一个可编辑的标签项,支持拖拽排序。
|
|
52
|
+
*/
|
|
53
|
+
export var TabEditorItem = function TabEditorItem(_ref2) {
|
|
54
|
+
var item = _ref2.item,
|
|
55
|
+
left = _ref2.left,
|
|
56
|
+
right = _ref2.right,
|
|
57
|
+
setNodeRef = _ref2.setNodeRef,
|
|
58
|
+
setActivatorNodeRef = _ref2.setActivatorNodeRef,
|
|
59
|
+
style = _ref2.style,
|
|
60
|
+
attributes = _ref2.attributes,
|
|
61
|
+
listeners = _ref2.listeners,
|
|
62
|
+
transform = _ref2.transform,
|
|
63
|
+
transition = _ref2.transition;
|
|
64
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
ref: setNodeRef,
|
|
66
|
+
style: style,
|
|
67
|
+
className: styles['tabitem']
|
|
68
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: styles['tabitem-left']
|
|
70
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
71
|
+
ref: setActivatorNodeRef
|
|
72
|
+
}, attributes, listeners, {
|
|
73
|
+
className: styles['dragicon']
|
|
74
|
+
}), /*#__PURE__*/React.createElement("svg", {
|
|
75
|
+
fill: "currentColor",
|
|
76
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
77
|
+
width: "16",
|
|
78
|
+
height: "12",
|
|
79
|
+
viewBox: "0 0 5 12",
|
|
80
|
+
style: {
|
|
81
|
+
verticalAlign: 'middle'
|
|
82
|
+
}
|
|
83
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
84
|
+
d: "M0.499972716,6 L1.50002728,6 C1.77615459,6 2,6.22384541 2,6.49997272 C2,6.77610002 1.77615459,6.99994543 1.50002728,6.99994543 L0.499972716,6.99994543 C0.22384541,6.99994543 3.38158422e-17,6.77610002 0,6.49997272 C-3.38158422e-17,6.22384541 0.22384541,6 0.499972716,6 Z M0.499972716,3 L1.50002728,3 C1.77615459,3 2,3.22384541 2,3.49997272 C2,3.77610002 1.77615459,3.99994543 1.50002728,3.99994543 L0.499972716,3.99994543 C0.22384541,3.99994543 3.38158422e-17,3.77610002 0,3.49997272 C-3.38158422e-17,3.22384541 0.22384541,3 0.499972716,3 Z M0.499972716,7.28787148e-18 L1.50002728,5.55666624e-14 C1.77615459,7.07214574e-14 2,0.22384541 2,0.499972716 C2,0.776100022 1.77615459,0.999945432 1.50002728,0.999945432 L0.499972716,0.999945432 C0.22384541,0.999945432 3.38158422e-17,0.776100022 0,0.499972716 C-3.38158422e-17,0.22384541 0.22384541,5.0723721e-17 0.499972716,0 Z M0.5,9.00002729 L1.5,9.00002729 C1.77614237,9.00002729 2,9.22388491 2,9.50002729 C2,9.77616966 1.77614237,10.0000273 1.5,10.0000273 L0.5,10.0000273 C0.223857625,10.0000273 3.38176876e-17,9.77616966 0,9.50002729 C-3.38176876e-17,9.22388491 0.223857625,9.00002729 0.5,9.00002729 Z M0.5,12.0000273 L1.5,12.0000273 C1.77614237,12.0000273 2,12.2238849 2,12.5000273 C2,12.7761697 1.77614237,13.0000273 1.5,13.0000273 L0.5,13.0000273 C0.223857625,13.0000273 3.38176876e-17,12.7761697 0,12.5000273 C-3.38176876e-17,12.2238849 0.223857625,12.0000273 0.5,12.0000273 Z M0.5,15.0000273 L1.5,15.0000273 C1.77614237,15.0000273 2,15.2238849 2,15.5000273 C2,15.7761697 1.77614237,16.0000273 1.5,16.0000273 L0.5,16.0000273 C0.223857625,16.0000273 3.38176876e-17,15.7761697 0,15.5000273 C-3.38176876e-17,15.2238849 0.223857625,15.0000273 0.5,15.0000273 Z M3.49997272,6 L4.50002728,6 C4.77615459,6 5,6.22384541 5,6.49997272 C5,6.77610002 4.77615459,6.99994543 4.50002728,6.99994543 L3.49997272,6.99994543 C3.22384541,6.99994543 3,6.77610002 3,6.49997272 C3,6.22384541 3.22384541,6 3.49997272,6 Z M3.49997272,3 L4.50002728,3 C4.77615459,3 5,3.22384541 5,3.49997272 C5,3.77610002 4.77615459,3.99994543 4.50002728,3.99994543 L3.49997272,3.99994543 C3.22384541,3.99994543 3,3.77610002 3,3.49997272 C3,3.22384541 3.22384541,3 3.49997272,3 Z M3.49997272,7.28787148e-18 L4.50002728,5.55666624e-14 C4.77615459,7.07214574e-14 5,0.22384541 5,0.499972716 C5,0.776100022 4.77615459,0.999945432 4.50002728,0.999945432 L3.49997272,0.999945432 C3.22384541,0.999945432 3,0.776100022 3,0.499972716 C3,0.22384541 3.22384541,5.0723721e-17 3.49997272,0 Z M3.5,9.00002729 L4.5,9.00002729 C4.77614237,9.00002729 5,9.22388491 5,9.50002729 C5,9.77616966 4.77614237,10.0000273 4.5,10.0000273 L3.5,10.0000273 C3.22385763,10.0000273 3,9.77616966 3,9.50002729 C3,9.22388491 3.22385763,9.00002729 3.5,9.00002729 Z M3.5,12.0000273 L4.5,12.0000273 C4.77614237,12.0000273 5,12.2238849 5,12.5000273 C5,12.7761697 4.77614237,13.0000273 4.5,13.0000273 L3.5,13.0000273 C3.22385763,13.0000273 3,12.7761697 3,12.5000273 C3,12.2238849 3.22385763,12.0000273 3.5,12.0000273 Z M3.5,15.0000273 L4.5,15.0000273 C4.77614237,15.0000273 5,15.2238849 5,15.5000273 C5,15.7761697 4.77614237,16.0000273 4.5,16.0000273 L3.5,16.0000273 C3.22385763,16.0000273 3,15.7761697 3,15.5000273 C3,15.2238849 3.22385763,15.0000273 3.5,15.0000273 Z"
|
|
85
|
+
}))), left), /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: styles['tabitem-right']
|
|
87
|
+
}, right));
|
|
88
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["onChange"],
|
|
6
|
+
_excluded2 = ["children", "language", "options", "onFullscreenChange"];
|
|
7
|
+
import React, { useState, useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
8
|
+
import * as monaco from 'monaco-editor';
|
|
9
|
+
var BaseEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
|
+
var onChange = _ref.onChange,
|
|
11
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
var children = props.children,
|
|
13
|
+
_props$language = props.language,
|
|
14
|
+
language = _props$language === void 0 ? 'javascript' : _props$language,
|
|
15
|
+
_props$options = props.options,
|
|
16
|
+
options = _props$options === void 0 ? {} : _props$options,
|
|
17
|
+
onFullscreenChange = props.onFullscreenChange,
|
|
18
|
+
rest = _objectWithoutProperties(props, _excluded2);
|
|
19
|
+
var _useState = useState(false),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
isFullScreen = _useState2[0],
|
|
22
|
+
setIsFullScreen = _useState2[1];
|
|
23
|
+
var editorRef = useRef(null);
|
|
24
|
+
var editorInstance = useRef(null);
|
|
25
|
+
|
|
26
|
+
// 全屏切换方法
|
|
27
|
+
var toggleFullScreen = function toggleFullScreen() {
|
|
28
|
+
var element = editorRef.current;
|
|
29
|
+
if (!document.fullscreenElement) {
|
|
30
|
+
if (element.requestFullscreen) {
|
|
31
|
+
element.requestFullscreen();
|
|
32
|
+
} else if (element.mozRequestFullScreen) {
|
|
33
|
+
element.mozRequestFullScreen();
|
|
34
|
+
} else if (element.webkitRequestFullscreen) {
|
|
35
|
+
element.webkitRequestFullscreen();
|
|
36
|
+
} else if (element.msRequestFullscreen) {
|
|
37
|
+
element.msRequestFullscreen();
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
if (document.exitFullscreen) {
|
|
41
|
+
document.exitFullscreen();
|
|
42
|
+
} else if (document.mozCancelFullScreen) {
|
|
43
|
+
document.mozCancelFullScreen();
|
|
44
|
+
} else if (document.webkitExitFullscreen) {
|
|
45
|
+
document.webkitExitFullscreen();
|
|
46
|
+
} else if (document.msExitFullscreen) {
|
|
47
|
+
document.msExitFullscreen();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// 监听全屏状态的改变,并调用 layout
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
var handleFullScreenChange = function handleFullScreenChange() {
|
|
55
|
+
var isFullScreenNow = !!document.fullscreenElement;
|
|
56
|
+
setIsFullScreen(isFullScreenNow);
|
|
57
|
+
if (editorInstance.current) {
|
|
58
|
+
editorInstance.current.layout();
|
|
59
|
+
}
|
|
60
|
+
if (onFullscreenChange) onFullscreenChange(isFullScreenNow);
|
|
61
|
+
};
|
|
62
|
+
document.addEventListener('fullscreenchange', handleFullScreenChange);
|
|
63
|
+
|
|
64
|
+
// 组件卸载时移除事件监听器
|
|
65
|
+
return function () {
|
|
66
|
+
document.removeEventListener('fullscreenchange', handleFullScreenChange);
|
|
67
|
+
};
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
// 初始化编辑器实例
|
|
71
|
+
useEffect(function () {
|
|
72
|
+
if (editorRef.current) {
|
|
73
|
+
var code = React.Children.toArray(children).join('').trim();
|
|
74
|
+
editorInstance.current = monaco.editor.create(editorRef.current, _objectSpread({
|
|
75
|
+
value: code,
|
|
76
|
+
language: language
|
|
77
|
+
}, options));
|
|
78
|
+
editorInstance.current.onDidChangeModelContent(function (event) {
|
|
79
|
+
if (onChange) onChange(editorInstance.current.getValue(), event);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return function () {
|
|
83
|
+
var _editorInstance$curre;
|
|
84
|
+
return (_editorInstance$curre = editorInstance.current) === null || _editorInstance$curre === void 0 ? void 0 : _editorInstance$curre.dispose();
|
|
85
|
+
};
|
|
86
|
+
}, [children, language, options]);
|
|
87
|
+
|
|
88
|
+
// 使用 ref 暴露组件方法
|
|
89
|
+
useImperativeHandle(ref, function () {
|
|
90
|
+
return {
|
|
91
|
+
get editor() {
|
|
92
|
+
return editorInstance.current;
|
|
93
|
+
},
|
|
94
|
+
toggleFullScreen: toggleFullScreen
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// 更新编辑器布局当全屏状态改变
|
|
99
|
+
useEffect(function () {
|
|
100
|
+
if (editorInstance.current) {
|
|
101
|
+
editorInstance.current.layout();
|
|
102
|
+
}
|
|
103
|
+
}, [isFullScreen]);
|
|
104
|
+
|
|
105
|
+
// 根据是否全屏来设置编辑器的样式
|
|
106
|
+
var editorStyle = isFullScreen ? {
|
|
107
|
+
width: '100vw',
|
|
108
|
+
height: '100vh'
|
|
109
|
+
} : {
|
|
110
|
+
width: props.width || '100%',
|
|
111
|
+
height: props.height || '100%'
|
|
112
|
+
};
|
|
113
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
114
|
+
ref: editorRef,
|
|
115
|
+
style: editorStyle
|
|
116
|
+
}, rest));
|
|
117
|
+
});
|
|
118
|
+
export default /*#__PURE__*/React.memo(BaseEditor);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"];
|
|
4
|
+
import React, { forwardRef } from 'react';
|
|
5
|
+
import BaseEditor from "./BaseEditor";
|
|
6
|
+
var CssEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
7
|
+
var children = _ref.children,
|
|
8
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
9
|
+
return /*#__PURE__*/React.createElement(BaseEditor, _extends({
|
|
10
|
+
ref: ref,
|
|
11
|
+
language: "css"
|
|
12
|
+
}, rest), children);
|
|
13
|
+
});
|
|
14
|
+
export default /*#__PURE__*/React.memo(CssEditor);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["EditorComponent", "onLoad", "children"];
|
|
5
|
+
import React, { useState, useEffect, forwardRef } from 'react';
|
|
6
|
+
import { Tooltip, Icon } from 'luck-design/antd';
|
|
7
|
+
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
8
|
+
import styles from "../../style/fullscreen-editor.less";
|
|
9
|
+
var FullScreenEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
|
+
var EditorComponent = _ref.EditorComponent,
|
|
11
|
+
onLoad = _ref.onLoad,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
var _useState = useState(false),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
isFullScreen = _useState2[0],
|
|
17
|
+
setIsFullScreen = _useState2[1];
|
|
18
|
+
var handleFullscreen = function handleFullscreen() {
|
|
19
|
+
if (ref.current && ref.current.toggleFullScreen) {
|
|
20
|
+
ref.current.toggleFullScreen();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var HandleFullscreenChange = function HandleFullscreenChange(fullscrean) {
|
|
24
|
+
setIsFullScreen(fullscrean);
|
|
25
|
+
};
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
if (onLoad) onLoad();
|
|
28
|
+
}, []);
|
|
29
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: styles['lc-painter-components-fullscreen-editor']
|
|
31
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: styles['actions']
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
34
|
+
title: formatMessage({
|
|
35
|
+
id: 'luckda.lowcode.painter.components.fullscreen.tip',
|
|
36
|
+
label: '全屏'
|
|
37
|
+
})
|
|
38
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
39
|
+
type: "fullscreen",
|
|
40
|
+
onClick: handleFullscreen
|
|
41
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: isFullScreen ? styles['fullscreen'] : ''
|
|
43
|
+
}, /*#__PURE__*/React.createElement(EditorComponent, _extends({
|
|
44
|
+
ref: ref,
|
|
45
|
+
onFullscreenChange: HandleFullscreenChange,
|
|
46
|
+
options: isFullScreen ? {} : {
|
|
47
|
+
lineNumbers: 'off',
|
|
48
|
+
glyphMargin: false,
|
|
49
|
+
folding: false,
|
|
50
|
+
lineDecorationsWidth: 0,
|
|
51
|
+
lineNumbersMinChars: 0,
|
|
52
|
+
minimap: {
|
|
53
|
+
enabled: false
|
|
54
|
+
},
|
|
55
|
+
overviewRulerLanes: 0,
|
|
56
|
+
scrollbar: {
|
|
57
|
+
vertical: 'hidden',
|
|
58
|
+
horizontal: 'hidden',
|
|
59
|
+
handleMouseWheel: false
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, props), children)));
|
|
63
|
+
});
|
|
64
|
+
export default /*#__PURE__*/React.memo(FullScreenEditor);
|