@luck-design-biz/luckda 0.0.24-1 → 0.0.25
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 +0 -0
- package/README.md +0 -0
- package/es/components/Builder/index.js +6 -4
- package/es/components/LDActions/index.js +130 -0
- package/es/components/LDActions/index.less +48 -0
- package/es/components/LdAutoForm/index.js +0 -0
- package/es/components/LdCard/index.js +0 -0
- package/es/components/LdCard/model.js +0 -0
- package/es/components/LdCom/index.js +0 -0
- package/es/components/LdFormList/index.js +1 -1
- package/es/components/LdFormList/model.js +0 -0
- package/es/components/LdGrid/index.js +21 -6
- package/es/components/LdGrid/model.js +0 -0
- package/es/components/LdGridForm/index.js +0 -0
- package/es/components/LdGridForm/index.less +0 -0
- package/es/components/LdInfoPanel/index.js +0 -0
- package/es/components/LdPop/index.js +0 -0
- package/es/components/LdRuntimeCom/index.js +0 -0
- package/es/components/LdTree/index.js +32 -5
- package/es/components/LdTree/index.less +6 -1
- package/es/helper/FromItems.js +0 -0
- package/es/helper/action.js +0 -0
- package/es/helper/form.js +0 -0
- package/es/helper/index.less +0 -0
- package/es/helper/ldBuilder.js +0 -0
- package/es/helper/ldComBuild.js +0 -0
- package/es/index.js +1 -0
- package/es/locales/zh-CN.js +151 -0
- package/es/lowcode/constants/api-url.js +350 -1
- package/es/lowcode/constants/event-topics.js +4 -4
- package/es/lowcode/constants/index.js +3 -1
- package/es/lowcode/engine/factory/DataFactory.js +0 -0
- package/es/lowcode/engine/factory/panel-item-factory/CheckboxStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/DynamicStrategy.js +0 -0
- package/es/lowcode/engine/factory/panel-item-factory/GroupStrategy.js +0 -0
- package/es/lowcode/engine/factory/panel-item-factory/NumberStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/SegmentedStrategy.js +0 -0
- package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +4 -1
- package/es/lowcode/engine/factory/panel-item-factory/Strategy.js +0 -0
- package/es/lowcode/engine/factory/panel-item-factory/StringStrategy.js +12 -11
- package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +11 -1
- package/es/lowcode/engine/factory/panel-item-factory/index.js +4 -0
- package/es/lowcode/engine/meta/box.props.default.json +1 -3
- package/es/lowcode/engine/meta/box.props.json +1 -3
- package/es/lowcode/engine/meta/button.props.default.json +1 -1
- package/es/lowcode/engine/meta/button.props.json +8 -3
- package/es/lowcode/engine/meta/cardlist.props.default.json +0 -1
- package/es/lowcode/engine/meta/cardlist.props.json +1 -2
- package/es/lowcode/engine/meta/components-list.json +6 -6
- package/es/lowcode/engine/meta/dialog.props.default.json +0 -1
- package/es/lowcode/engine/meta/dialog.props.json +0 -1
- package/es/lowcode/engine/meta/drawer.props.default.json +0 -1
- package/es/lowcode/engine/meta/drawer.props.json +0 -1
- package/es/lowcode/engine/meta/form.props.default.json +0 -1
- package/es/lowcode/engine/meta/form.props.json +1 -2
- 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 +1 -1
- package/es/lowcode/engine/meta/image.props.json +1 -1
- package/es/lowcode/engine/meta/imex.props.default.json +1 -1
- package/es/lowcode/engine/meta/imex.props.json +1 -1
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +135 -29
- package/es/lowcode/engine/meta/jsx.props.default.json +1 -1
- package/es/lowcode/engine/meta/jsx.props.json +1 -1
- package/es/lowcode/engine/meta/layout.props.default.json +1 -1
- package/es/lowcode/engine/meta/layout.props.json +1 -1
- package/es/lowcode/engine/meta/link.props.default.json +1 -1
- package/es/lowcode/engine/meta/link.props.json +1 -1
- package/es/lowcode/engine/meta/local/local.zh-cn.js +97 -0
- package/es/lowcode/engine/meta/section.props.default.json +1 -1
- package/es/lowcode/engine/meta/section.props.json +1 -1
- package/es/lowcode/engine/meta/split.props.default.json +1 -1
- package/es/lowcode/engine/meta/split.props.json +1 -1
- package/es/lowcode/engine/meta/table.props.default.json +36 -2
- package/es/lowcode/engine/meta/table.props.json +295 -58
- package/es/lowcode/engine/meta/tabs.props.default.json +0 -1
- package/es/lowcode/engine/meta/tabs.props.json +0 -1
- package/es/lowcode/engine/meta/text.props.default.json +1 -1
- package/es/lowcode/engine/meta/text.props.json +1 -1
- package/es/lowcode/engine/meta/tree.props.default.json +9 -4
- package/es/lowcode/engine/meta/tree.props.json +101 -55
- package/es/lowcode/engine/provider/ContextProvider/index.js +199 -0
- package/es/lowcode/engine/provider/EventBusProvider.js +0 -0
- package/es/lowcode/engine/tools/dataProcess.js +5 -3
- package/es/lowcode/engine/tools/helper.js +96 -0
- package/es/lowcode/engine/tools/usePromiseState.js +7 -6
- package/es/lowcode/index.js +3 -1
- package/es/lowcode/painter/Components.js +0 -0
- package/es/lowcode/painter/Design.js +27 -304
- package/es/lowcode/painter/DesignOperator.js +271 -0
- package/es/lowcode/painter/DesignToolbar.js +91 -0
- package/es/lowcode/painter/I18n.js +0 -0
- package/es/lowcode/painter/Outline.js +31 -27
- package/es/lowcode/painter/Panel.js +52 -97
- package/es/lowcode/painter/Ribbon.js +1 -1
- package/es/lowcode/painter/components/ActionBindModal.js +180 -0
- package/es/lowcode/painter/components/AdvancePanel.js +68 -0
- package/es/lowcode/painter/components/AttrsPanel.js +134 -0
- package/es/lowcode/painter/components/Collapse.js +74 -10
- package/es/lowcode/painter/components/ColorInput.js +125 -0
- package/es/lowcode/painter/components/FieldSelector.js +44 -0
- package/es/lowcode/painter/components/{TabEditor.js → ListEditor.js} +20 -17
- package/es/lowcode/painter/components/NumberInput.js +72 -17
- package/es/lowcode/painter/components/PanelItem.js +40 -11
- package/es/lowcode/painter/components/PopConfirm.js +14 -4
- package/es/lowcode/painter/components/PopForm.js +0 -0
- package/es/lowcode/painter/components/RuleInput.js +5 -3
- package/es/lowcode/painter/components/SortBox.js +0 -0
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +56 -66
- package/es/lowcode/painter/components/code-editor/CssEditor.js +27 -0
- package/es/lowcode/painter/components/code-editor/FullScreenEditor.js +37 -14
- package/es/lowcode/painter/components/code-editor/JSEditor.js +44 -11
- package/es/lowcode/painter/components/code-editor/JsonEditor.js +41 -0
- package/es/lowcode/painter/components/code-editor/index.js +0 -0
- package/es/lowcode/painter/index.js +6 -2
- package/es/lowcode/painter/panel-section/ActionsEditor/ActionEditor.js +154 -0
- package/es/lowcode/painter/panel-section/ActionsEditor/index.js +198 -0
- package/es/lowcode/painter/panel-section/ButtonType.js +0 -0
- package/es/lowcode/painter/panel-section/DataSetSelector.js +61 -0
- package/es/lowcode/painter/panel-section/Icon.js +0 -0
- package/es/lowcode/painter/panel-section/IconSelector.js +0 -0
- package/es/lowcode/painter/panel-section/ImpExp.js +91 -0
- package/es/lowcode/painter/panel-section/JSEditor.js +48 -0
- package/es/lowcode/painter/panel-section/LayoutRatio.js +2 -1
- package/es/lowcode/painter/panel-section/StylePanel/BackGround.js +61 -0
- package/es/lowcode/painter/panel-section/StylePanel/Border.js +150 -0
- package/es/lowcode/painter/panel-section/StylePanel/BorderRadius.js +87 -0
- package/es/lowcode/painter/panel-section/StylePanel/BorderRadiusSelector.js +66 -0
- package/es/lowcode/painter/panel-section/StylePanel/BorderSelector.js +66 -0
- package/es/lowcode/painter/panel-section/StylePanel/Display.js +15 -11
- package/es/lowcode/painter/panel-section/StylePanel/DisplaySvg.js +0 -0
- package/es/lowcode/painter/panel-section/StylePanel/Font.js +162 -0
- package/es/lowcode/painter/panel-section/StylePanel/FontEditor.js +386 -0
- package/es/lowcode/painter/panel-section/StylePanel/GapSelector.js +78 -0
- package/es/lowcode/painter/panel-section/StylePanel/HighLightPanel.js +23 -0
- package/es/lowcode/painter/panel-section/StylePanel/HighLigthtSpan.js +20 -0
- package/es/lowcode/painter/panel-section/StylePanel/HightLightSvg.js +23 -0
- package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +44 -12
- package/es/lowcode/painter/panel-section/StylePanel/Margin.js +60 -0
- package/es/lowcode/painter/panel-section/StylePanel/Opacity.js +50 -0
- package/es/lowcode/painter/panel-section/StylePanel/Padding.js +61 -0
- package/es/lowcode/painter/panel-section/StylePanel/Pointer.js +41 -0
- package/es/lowcode/painter/panel-section/StylePanel/Shadow.js +216 -0
- package/es/lowcode/painter/panel-section/StylePanel/Size.js +53 -0
- package/es/lowcode/painter/panel-section/StylePanel/StyleContext.js +56 -9
- package/es/lowcode/painter/panel-section/StylePanel/StyleRow.js +16 -0
- package/es/lowcode/painter/panel-section/StylePanel/{Height.js → WidthHeight.js} +23 -20
- package/es/lowcode/painter/panel-section/StylePanel/index.js +17 -0
- package/es/lowcode/painter/panel-section/TabItems.js +7 -37
- package/es/lowcode/painter/panel-section/TableTopFilter.js +306 -0
- package/es/lowcode/painter/panel-section/TableZebra.js +14 -0
- package/es/lowcode/painter/panel-section/WidthHeight.js +39 -0
- package/es/lowcode/painter/services/I18n.js +0 -0
- package/es/lowcode/painter/style/action-bind-modal.less +99 -0
- package/es/lowcode/painter/style/actions-editor.less +16 -0
- package/es/lowcode/painter/style/border-editor.less +36 -0
- package/es/lowcode/painter/style/border-radius-selector.less +43 -0
- package/es/lowcode/painter/style/border-selector.less +40 -0
- package/es/lowcode/painter/style/button-type.less +0 -0
- package/es/lowcode/painter/style/collapse.less +2 -1
- package/es/lowcode/painter/style/color-input.less +19 -0
- package/es/lowcode/painter/style/components.less +0 -0
- package/es/lowcode/painter/style/design.less +8 -1
- package/es/lowcode/painter/style/display.less +0 -0
- package/es/lowcode/painter/style/font-editor.less +9 -0
- package/es/lowcode/painter/style/fullscreen-editor.less +0 -0
- package/es/lowcode/painter/style/icon-selector.less +0 -0
- package/es/lowcode/painter/style/icon.less +0 -0
- package/es/lowcode/painter/style/impexp.less +7 -0
- package/es/lowcode/painter/style/index.less +0 -0
- package/es/lowcode/painter/style/layout-ratio.less +0 -0
- package/es/lowcode/painter/style/{tabeditor.less → list-editor.less} +9 -40
- package/es/lowcode/painter/style/number-input.less +0 -0
- package/es/lowcode/painter/style/outline.less +0 -0
- package/es/lowcode/painter/style/panel-attrs.less +43 -0
- package/es/lowcode/painter/style/panel-item.less +11 -1
- package/es/lowcode/painter/style/panel.less +5 -49
- package/es/lowcode/painter/style/pop-confirm.less +9 -2
- package/es/lowcode/painter/style/pop-form.less +0 -0
- package/es/lowcode/painter/style/radio.less +0 -0
- package/es/lowcode/painter/style/ribbon.less +0 -0
- package/es/lowcode/painter/style/rule-input.less +0 -0
- package/es/lowcode/painter/style/style-panel.less +32 -0
- package/es/lowcode/painter/style/tabitems.less +0 -0
- package/es/lowcode/view/Canvas.js +16 -15
- package/es/lowcode/view/Loading.js +0 -0
- package/es/lowcode/view/Page.js +10 -225
- package/es/lowcode/view/index.js +5 -6
- package/es/lowcode/view/lc-components/Box/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Box/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Box/index.js +22 -6
- package/es/lowcode/view/lc-components/Box/index.less +0 -1
- package/es/lowcode/view/lc-components/Box/meta.json +1 -3
- package/es/lowcode/view/lc-components/Button/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Button/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Button/index.js +10 -7
- package/es/lowcode/view/lc-components/Button/meta.json +8 -3
- package/es/lowcode/view/lc-components/Button/style.less +3 -0
- package/es/lowcode/view/lc-components/CardList/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/CardList/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/CardList/index.js +0 -0
- package/es/lowcode/view/lc-components/CardList/meta.json +1 -2
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +48 -3
- package/es/lowcode/view/lc-components/Dialog/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Dialog/index.js +21 -23
- package/es/lowcode/view/lc-components/Dialog/index.less +1 -1
- package/es/lowcode/view/lc-components/Dialog/meta.json +0 -1
- package/es/lowcode/view/lc-components/Drawer/FunctionDesign.js +13 -2
- package/es/lowcode/view/lc-components/Drawer/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Drawer/index.js +35 -22
- package/es/lowcode/view/lc-components/Drawer/{style.less → index.less} +1 -1
- package/es/lowcode/view/lc-components/Drawer/meta.json +0 -1
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Form/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Form/index.js +0 -0
- package/es/lowcode/view/lc-components/Form/meta.json +1 -2
- package/es/lowcode/view/lc-components/Iframe/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Iframe/index.js +0 -0
- package/es/lowcode/view/lc-components/Iframe/meta.json +1 -1
- package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/ImEx/index.js +0 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +1 -1
- package/es/lowcode/view/lc-components/Image/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Image/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Image/index.js +0 -0
- package/es/lowcode/view/lc-components/Image/meta.json +1 -1
- package/es/lowcode/view/lc-components/JSX/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/JSX/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/JSX/index.js +0 -0
- package/es/lowcode/view/lc-components/JSX/meta.json +1 -1
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +6 -9
- package/es/lowcode/view/lc-components/Layout/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Layout/index.js +0 -0
- package/es/lowcode/view/lc-components/Layout/index.less +0 -0
- package/es/lowcode/view/lc-components/Layout/meta.json +1 -1
- package/es/lowcode/view/lc-components/Link/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Link/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Link/index.js +0 -0
- package/es/lowcode/view/lc-components/Link/meta.json +1 -1
- package/es/lowcode/view/lc-components/Section/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Section/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Section/index.js +0 -0
- package/es/lowcode/view/lc-components/Section/meta.json +1 -1
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Split/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Split/index.js +0 -0
- package/es/lowcode/view/lc-components/Split/meta.json +1 -1
- package/es/lowcode/view/lc-components/Table/FunctionDesign.js +37 -2
- package/es/lowcode/view/lc-components/Table/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Table/components/TopFilter.js +96 -0
- package/es/lowcode/view/lc-components/Table/index.js +418 -108
- package/es/lowcode/view/lc-components/Table/meta.json +256 -58
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Tabs/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Tabs/index.js +0 -0
- package/es/lowcode/view/lc-components/Tabs/meta.json +0 -1
- package/es/lowcode/view/lc-components/Text/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Text/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Text/index.js +0 -0
- package/es/lowcode/view/lc-components/Text/meta.json +1 -1
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +48 -3
- package/es/lowcode/view/lc-components/Tree/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Tree/index.js +77 -6
- package/es/lowcode/view/lc-components/Tree/index.less +2 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +97 -55
- package/es/lowcode/view/lc-components/Wrapper.js +2 -2
- package/es/lowcode/view/style/canvas.less +0 -0
- package/es/lowcode/view/style/loading.less +0 -0
- package/es/lowcode/view/style/page.less +0 -0
- package/es/services.js +0 -0
- package/es/upload/Form/gridForm.js +0 -0
- package/es/upload/Form/index.js +0 -0
- package/es/upload/Form/index.less +0 -0
- package/es/upload/FormItem/index.js +0 -0
- package/es/upload/GridCell/index.js +0 -0
- package/es/upload/index.js +0 -0
- package/es/utils/action.js +0 -0
- package/es/utils/form.js +0 -0
- package/es/utils/grid.js +0 -0
- package/es/utils/index.js +0 -0
- package/lib/components/Builder/index.js +5 -3
- package/lib/components/LDActions/index.js +138 -0
- package/lib/components/LDActions/index.less +48 -0
- package/lib/components/LdAutoForm/index.js +0 -0
- package/lib/components/LdCard/index.js +0 -0
- package/lib/components/LdCard/model.js +0 -0
- package/lib/components/LdCom/index.js +0 -0
- package/lib/components/LdFormList/index.js +1 -1
- package/lib/components/LdFormList/model.js +0 -0
- package/lib/components/LdGrid/index.js +20 -5
- package/lib/components/LdGrid/model.js +0 -0
- package/lib/components/LdGridForm/index.js +0 -0
- package/lib/components/LdGridForm/index.less +0 -0
- package/lib/components/LdInfoPanel/index.js +0 -0
- package/lib/components/LdPop/index.js +0 -0
- package/lib/components/LdRuntimeCom/index.js +0 -0
- package/lib/components/LdTree/index.js +31 -4
- package/lib/components/LdTree/index.less +6 -1
- package/lib/helper/FromItems.js +0 -0
- package/lib/helper/action.js +0 -0
- package/lib/helper/form.js +0 -0
- package/lib/helper/index.less +0 -0
- package/lib/helper/ldBuilder.js +0 -0
- package/lib/helper/ldComBuild.js +0 -0
- package/lib/index.js +8 -0
- package/lib/locales/zh-CN.js +157 -0
- package/lib/lowcode/constants/api-url.js +352 -2
- package/lib/lowcode/constants/event-topics.js +5 -5
- package/lib/lowcode/constants/index.js +4 -2
- package/lib/lowcode/engine/factory/DataFactory.js +0 -0
- package/lib/lowcode/engine/factory/panel-item-factory/CheckboxStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/DynamicStrategy.js +0 -0
- package/lib/lowcode/engine/factory/panel-item-factory/GroupStrategy.js +0 -0
- package/lib/lowcode/engine/factory/panel-item-factory/NumberStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SegmentedStrategy.js +0 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +4 -1
- package/lib/lowcode/engine/factory/panel-item-factory/Strategy.js +0 -0
- package/lib/lowcode/engine/factory/panel-item-factory/StringStrategy.js +11 -10
- package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +11 -1
- package/lib/lowcode/engine/factory/panel-item-factory/index.js +4 -0
- package/lib/lowcode/engine/meta/box.props.default.json +1 -3
- package/lib/lowcode/engine/meta/box.props.json +1 -3
- package/lib/lowcode/engine/meta/button.props.default.json +1 -1
- package/lib/lowcode/engine/meta/button.props.json +8 -3
- package/lib/lowcode/engine/meta/cardlist.props.default.json +0 -1
- package/lib/lowcode/engine/meta/cardlist.props.json +1 -2
- package/lib/lowcode/engine/meta/components-list.json +6 -6
- package/lib/lowcode/engine/meta/dialog.props.default.json +0 -1
- package/lib/lowcode/engine/meta/dialog.props.json +0 -1
- package/lib/lowcode/engine/meta/drawer.props.default.json +0 -1
- package/lib/lowcode/engine/meta/drawer.props.json +0 -1
- package/lib/lowcode/engine/meta/form.props.default.json +0 -1
- package/lib/lowcode/engine/meta/form.props.json +1 -2
- 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 +1 -1
- package/lib/lowcode/engine/meta/image.props.json +1 -1
- package/lib/lowcode/engine/meta/imex.props.default.json +1 -1
- package/lib/lowcode/engine/meta/imex.props.json +1 -1
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +135 -29
- package/lib/lowcode/engine/meta/jsx.props.default.json +1 -1
- package/lib/lowcode/engine/meta/jsx.props.json +1 -1
- package/lib/lowcode/engine/meta/layout.props.default.json +1 -1
- package/lib/lowcode/engine/meta/layout.props.json +1 -1
- package/lib/lowcode/engine/meta/link.props.default.json +1 -1
- package/lib/lowcode/engine/meta/link.props.json +1 -1
- package/lib/lowcode/engine/meta/local/local.zh-cn.js +103 -0
- package/lib/lowcode/engine/meta/section.props.default.json +1 -1
- package/lib/lowcode/engine/meta/section.props.json +1 -1
- package/lib/lowcode/engine/meta/split.props.default.json +1 -1
- package/lib/lowcode/engine/meta/split.props.json +1 -1
- package/lib/lowcode/engine/meta/table.props.default.json +36 -2
- package/lib/lowcode/engine/meta/table.props.json +295 -58
- package/lib/lowcode/engine/meta/tabs.props.default.json +0 -1
- package/lib/lowcode/engine/meta/tabs.props.json +0 -1
- package/lib/lowcode/engine/meta/text.props.default.json +1 -1
- package/lib/lowcode/engine/meta/text.props.json +1 -1
- package/lib/lowcode/engine/meta/tree.props.default.json +9 -4
- package/lib/lowcode/engine/meta/tree.props.json +101 -55
- package/lib/lowcode/engine/provider/ContextProvider/index.js +207 -0
- package/lib/lowcode/engine/provider/EventBusProvider.js +0 -0
- package/lib/lowcode/engine/tools/dataProcess.js +5 -3
- package/lib/lowcode/engine/tools/helper.js +101 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +6 -5
- package/lib/lowcode/index.js +5 -1
- package/lib/lowcode/painter/Components.js +0 -0
- package/lib/lowcode/painter/Design.js +24 -300
- package/lib/lowcode/painter/DesignOperator.js +278 -0
- package/lib/lowcode/painter/DesignToolbar.js +99 -0
- package/lib/lowcode/painter/I18n.js +0 -0
- package/lib/lowcode/painter/Outline.js +31 -27
- package/lib/lowcode/painter/Panel.js +49 -94
- package/lib/lowcode/painter/Ribbon.js +1 -1
- package/lib/lowcode/painter/components/ActionBindModal.js +188 -0
- package/lib/lowcode/painter/components/AdvancePanel.js +76 -0
- package/lib/lowcode/painter/components/AttrsPanel.js +142 -0
- package/lib/lowcode/painter/components/Collapse.js +72 -9
- package/lib/lowcode/painter/components/ColorInput.js +132 -0
- package/lib/lowcode/painter/components/FieldSelector.js +52 -0
- package/lib/lowcode/painter/components/{TabEditor.js → ListEditor.js} +22 -19
- package/lib/lowcode/painter/components/NumberInput.js +70 -16
- package/lib/lowcode/painter/components/PanelItem.js +40 -11
- package/lib/lowcode/painter/components/PopConfirm.js +14 -4
- package/lib/lowcode/painter/components/PopForm.js +0 -0
- package/lib/lowcode/painter/components/RuleInput.js +5 -3
- package/lib/lowcode/painter/components/SortBox.js +0 -0
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +54 -65
- package/lib/lowcode/painter/components/code-editor/CssEditor.js +26 -0
- package/lib/lowcode/painter/components/code-editor/FullScreenEditor.js +35 -13
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +44 -11
- package/lib/lowcode/painter/components/code-editor/JsonEditor.js +48 -0
- package/lib/lowcode/painter/components/code-editor/index.js +0 -0
- package/lib/lowcode/painter/index.js +6 -2
- package/lib/lowcode/painter/panel-section/ActionsEditor/ActionEditor.js +162 -0
- package/lib/lowcode/painter/panel-section/ActionsEditor/index.js +206 -0
- package/lib/lowcode/painter/panel-section/ButtonType.js +0 -0
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +69 -0
- package/lib/lowcode/painter/panel-section/Icon.js +0 -0
- package/lib/lowcode/painter/panel-section/IconSelector.js +0 -0
- package/lib/lowcode/painter/panel-section/ImpExp.js +98 -0
- package/lib/lowcode/painter/panel-section/JSEditor.js +56 -0
- package/lib/lowcode/painter/panel-section/LayoutRatio.js +2 -1
- package/lib/lowcode/painter/panel-section/StylePanel/BackGround.js +68 -0
- package/lib/lowcode/painter/panel-section/StylePanel/Border.js +158 -0
- package/lib/lowcode/painter/panel-section/StylePanel/BorderRadius.js +95 -0
- package/lib/lowcode/painter/panel-section/StylePanel/BorderRadiusSelector.js +73 -0
- package/lib/lowcode/painter/panel-section/StylePanel/BorderSelector.js +73 -0
- package/lib/lowcode/painter/panel-section/StylePanel/Display.js +15 -11
- package/lib/lowcode/painter/panel-section/StylePanel/DisplaySvg.js +0 -0
- package/lib/lowcode/painter/panel-section/StylePanel/Font.js +170 -0
- package/lib/lowcode/painter/panel-section/StylePanel/FontEditor.js +392 -0
- package/lib/lowcode/painter/panel-section/StylePanel/GapSelector.js +85 -0
- package/lib/lowcode/painter/panel-section/StylePanel/HighLightPanel.js +29 -0
- package/lib/lowcode/painter/panel-section/StylePanel/HighLigthtSpan.js +26 -0
- package/lib/lowcode/painter/panel-section/StylePanel/HightLightSvg.js +29 -0
- package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +42 -11
- package/lib/lowcode/painter/panel-section/StylePanel/Margin.js +67 -0
- package/lib/lowcode/painter/panel-section/StylePanel/Opacity.js +57 -0
- package/lib/lowcode/painter/panel-section/StylePanel/Padding.js +68 -0
- package/lib/lowcode/painter/panel-section/StylePanel/Pointer.js +48 -0
- package/lib/lowcode/painter/panel-section/StylePanel/Shadow.js +224 -0
- package/lib/lowcode/painter/panel-section/StylePanel/{Width.js → Size.js} +39 -35
- package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +56 -9
- package/lib/lowcode/painter/panel-section/StylePanel/StyleRow.js +22 -0
- package/lib/lowcode/painter/panel-section/StylePanel/{Height.js → WidthHeight.js} +22 -19
- package/lib/lowcode/painter/panel-section/StylePanel/index.js +16 -0
- package/lib/lowcode/painter/panel-section/TabItems.js +7 -37
- package/lib/lowcode/painter/panel-section/TableTopFilter.js +314 -0
- package/lib/lowcode/painter/panel-section/TableZebra.js +21 -0
- package/lib/lowcode/painter/panel-section/WidthHeight.js +46 -0
- package/lib/lowcode/painter/services/I18n.js +0 -0
- package/lib/lowcode/painter/style/action-bind-modal.less +99 -0
- package/lib/lowcode/painter/style/actions-editor.less +16 -0
- package/lib/lowcode/painter/style/border-editor.less +36 -0
- package/lib/lowcode/painter/style/border-radius-selector.less +43 -0
- package/lib/lowcode/painter/style/border-selector.less +40 -0
- package/lib/lowcode/painter/style/button-type.less +0 -0
- package/lib/lowcode/painter/style/collapse.less +2 -1
- package/lib/lowcode/painter/style/color-input.less +19 -0
- package/lib/lowcode/painter/style/components.less +0 -0
- package/lib/lowcode/painter/style/design.less +8 -1
- package/lib/lowcode/painter/style/display.less +0 -0
- package/lib/lowcode/painter/style/font-editor.less +9 -0
- package/lib/lowcode/painter/style/fullscreen-editor.less +0 -0
- package/lib/lowcode/painter/style/icon-selector.less +0 -0
- package/lib/lowcode/painter/style/icon.less +0 -0
- package/lib/lowcode/painter/style/impexp.less +7 -0
- package/lib/lowcode/painter/style/index.less +0 -0
- package/lib/lowcode/painter/style/layout-ratio.less +0 -0
- package/lib/lowcode/painter/style/{tabeditor.less → list-editor.less} +9 -40
- package/lib/lowcode/painter/style/number-input.less +0 -0
- package/lib/lowcode/painter/style/outline.less +0 -0
- package/lib/lowcode/painter/style/panel-attrs.less +43 -0
- package/lib/lowcode/painter/style/panel-item.less +11 -1
- package/lib/lowcode/painter/style/panel.less +5 -49
- package/lib/lowcode/painter/style/pop-confirm.less +9 -2
- package/lib/lowcode/painter/style/pop-form.less +0 -0
- package/lib/lowcode/painter/style/radio.less +0 -0
- package/lib/lowcode/painter/style/ribbon.less +0 -0
- package/lib/lowcode/painter/style/rule-input.less +0 -0
- package/lib/lowcode/painter/style/style-panel.less +32 -0
- package/lib/lowcode/painter/style/tabitems.less +0 -0
- package/lib/lowcode/view/Canvas.js +16 -15
- package/lib/lowcode/view/Loading.js +0 -0
- package/lib/lowcode/view/Page.js +9 -224
- package/lib/lowcode/view/index.js +5 -6
- package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Box/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Box/index.js +19 -4
- package/lib/lowcode/view/lc-components/Box/index.less +0 -1
- package/lib/lowcode/view/lc-components/Box/meta.json +1 -3
- package/lib/lowcode/view/lc-components/Button/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Button/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Button/index.js +10 -7
- package/lib/lowcode/view/lc-components/Button/meta.json +8 -3
- package/lib/lowcode/view/lc-components/Button/style.less +3 -0
- package/lib/lowcode/view/lc-components/CardList/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/CardList/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/CardList/index.js +0 -0
- package/lib/lowcode/view/lc-components/CardList/meta.json +1 -2
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +49 -3
- package/lib/lowcode/view/lc-components/Dialog/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Dialog/index.js +20 -22
- package/lib/lowcode/view/lc-components/Dialog/index.less +1 -1
- package/lib/lowcode/view/lc-components/Dialog/meta.json +0 -1
- package/lib/lowcode/view/lc-components/Drawer/FunctionDesign.js +13 -2
- package/lib/lowcode/view/lc-components/Drawer/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Drawer/index.js +34 -21
- package/lib/lowcode/view/lc-components/Drawer/{style.less → index.less} +1 -1
- package/lib/lowcode/view/lc-components/Drawer/meta.json +0 -1
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Form/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Form/index.js +0 -0
- package/lib/lowcode/view/lc-components/Form/meta.json +1 -2
- package/lib/lowcode/view/lc-components/Iframe/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Iframe/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Iframe/index.js +0 -0
- package/lib/lowcode/view/lc-components/Iframe/meta.json +1 -1
- package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/ImEx/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/ImEx/index.js +0 -0
- package/lib/lowcode/view/lc-components/ImEx/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Image/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Image/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Image/index.js +0 -0
- package/lib/lowcode/view/lc-components/Image/meta.json +1 -1
- package/lib/lowcode/view/lc-components/JSX/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/JSX/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/JSX/index.js +0 -0
- package/lib/lowcode/view/lc-components/JSX/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +6 -9
- package/lib/lowcode/view/lc-components/Layout/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Layout/index.js +0 -0
- package/lib/lowcode/view/lc-components/Layout/index.less +0 -0
- package/lib/lowcode/view/lc-components/Layout/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Link/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Link/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Link/index.js +0 -0
- package/lib/lowcode/view/lc-components/Link/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Section/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Section/index.js +0 -0
- package/lib/lowcode/view/lc-components/Section/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Split/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Split/index.js +0 -0
- package/lib/lowcode/view/lc-components/Split/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Table/FunctionDesign.js +39 -3
- package/lib/lowcode/view/lc-components/Table/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Table/components/TopFilter.js +104 -0
- package/lib/lowcode/view/lc-components/Table/index.js +418 -108
- package/lib/lowcode/view/lc-components/Table/meta.json +256 -58
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Tabs/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Tabs/index.js +0 -0
- package/lib/lowcode/view/lc-components/Tabs/meta.json +0 -1
- package/lib/lowcode/view/lc-components/Text/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Text/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Text/index.js +0 -0
- package/lib/lowcode/view/lc-components/Text/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +49 -3
- package/lib/lowcode/view/lc-components/Tree/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Tree/index.js +77 -6
- package/lib/lowcode/view/lc-components/Tree/index.less +2 -0
- package/lib/lowcode/view/lc-components/Tree/meta.json +97 -55
- package/lib/lowcode/view/lc-components/Wrapper.js +2 -2
- package/lib/lowcode/view/style/canvas.less +0 -0
- package/lib/lowcode/view/style/loading.less +0 -0
- package/lib/lowcode/view/style/page.less +0 -0
- package/lib/services.js +0 -0
- package/lib/upload/Form/gridForm.js +0 -0
- package/lib/upload/Form/index.js +0 -0
- package/lib/upload/Form/index.less +0 -0
- package/lib/upload/FormItem/index.js +0 -0
- package/lib/upload/GridCell/index.js +0 -0
- package/lib/upload/index.js +0 -0
- package/lib/utils/action.js +0 -0
- package/lib/utils/form.js +0 -0
- package/lib/utils/grid.js +0 -0
- package/lib/utils/index.js +0 -0
- package/lowcode.js +0 -0
- package/package.json +14 -7
- package/upload.js +0 -0
- package/utils.js +0 -0
- package/es/lowcode/engine/provider/ContextProvider.js +0 -157
- package/es/lowcode/painter/panel-section/StylePanel/Width.js +0 -48
- package/lib/lowcode/engine/provider/ContextProvider.js +0 -165
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
3
|
import React, { useState, useEffect } from 'react';
|
|
4
|
+
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
5
|
+
import { Tooltip, Icon } from 'luck-design/antd';
|
|
3
6
|
import { startsWith } from 'lodash';
|
|
7
|
+
import classNames from 'classnames';
|
|
4
8
|
import styles from "../style/panel-item.less";
|
|
5
|
-
import { Icon } from 'luck-design/antd';
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* `PanelItem` 组件用于展示属性面板中的单个属性项。
|
|
@@ -30,34 +33,60 @@ import { Icon } from 'luck-design/antd';
|
|
|
30
33
|
* @returns {React.Element} 渲染属性名称、对应的组件以及可选的额外内容。
|
|
31
34
|
*/
|
|
32
35
|
export default function (_ref) {
|
|
33
|
-
var
|
|
36
|
+
var field = _ref.field,
|
|
37
|
+
label = _ref.label,
|
|
38
|
+
desc = _ref.desc,
|
|
34
39
|
_ref$collapsed = _ref.collapsed,
|
|
35
40
|
collapsed = _ref$collapsed === void 0 ? true : _ref$collapsed,
|
|
36
41
|
addon = _ref.addon,
|
|
42
|
+
suppressPadding = _ref.suppressPadding,
|
|
37
43
|
children = _ref.children;
|
|
38
44
|
var _useState = useState(collapsed),
|
|
39
45
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
46
|
curClps = _useState2[0],
|
|
41
47
|
setCurClps = _useState2[1];
|
|
42
|
-
var HandleClick = function
|
|
48
|
+
var HandleClick = useMemoizedFn(function () {
|
|
49
|
+
if (!addon) return;
|
|
43
50
|
setCurClps(!curClps);
|
|
44
|
-
};
|
|
51
|
+
});
|
|
52
|
+
var tip = useCreation(function () {
|
|
53
|
+
var str = void 0;
|
|
54
|
+
if (field) {
|
|
55
|
+
str = "\u5C5E\u6027\uFF1A".concat(field);
|
|
56
|
+
}
|
|
57
|
+
if (desc) {
|
|
58
|
+
str += "".concat(str ? ' | ' : '', "\u8BF4\u660E\uFF1A").concat(desc);
|
|
59
|
+
}
|
|
60
|
+
return str;
|
|
61
|
+
}, [field, desc]);
|
|
45
62
|
useEffect(function () {
|
|
46
63
|
setCurClps(collapsed);
|
|
47
64
|
}, [collapsed]);
|
|
48
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
-
className: styles['lc-painter-components-panelitem']
|
|
66
|
+
className: classNames(styles['lc-painter-components-panelitem'], _defineProperty({}, styles['no-padding'], !!suppressPadding))
|
|
50
67
|
}, /*#__PURE__*/React.createElement("div", {
|
|
51
68
|
className: styles['panelrow']
|
|
52
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
className: styles['item-label']
|
|
69
|
+
}, label && !startsWith(label, '#') && /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: "".concat(styles['item-label']).concat(addon ? ' panel-pointer' : ''),
|
|
71
|
+
onClick: HandleClick
|
|
54
72
|
}, addon && /*#__PURE__*/React.createElement(Icon, {
|
|
55
73
|
className: styles['item-icon'],
|
|
56
|
-
type: !curClps ? 'down' : 'right'
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
type: !curClps ? 'down' : 'right'
|
|
75
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
76
|
+
overlayStyle: {
|
|
77
|
+
fontSize: '12px'
|
|
78
|
+
},
|
|
79
|
+
title: tip,
|
|
80
|
+
getPopupContainer: function getPopupContainer() {
|
|
81
|
+
return document.getElementById('lc-design-workspace');
|
|
82
|
+
}
|
|
83
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
84
|
+
style: desc ? {
|
|
85
|
+
cursor: 'help'
|
|
86
|
+
} : null
|
|
87
|
+
}, label))), /*#__PURE__*/React.createElement("span", {
|
|
59
88
|
className: styles['item-component']
|
|
60
|
-
}, children)), !curClps && /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
}, children)), !curClps && addon && /*#__PURE__*/React.createElement("div", {
|
|
61
90
|
className: styles['addon']
|
|
62
91
|
}, addon));
|
|
63
92
|
}
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["showBtn"];
|
|
2
5
|
import React from 'react';
|
|
3
6
|
import { Popconfirm } from 'luck-design/antd';
|
|
7
|
+
import classNames from 'classnames';
|
|
4
8
|
import styles from "../style/pop-confirm.less";
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* 这个组件是对 luck-design/antd 的 Popconfirm 组件的封装。
|
|
8
12
|
* 它提供了一个带有自定义样式的弹出确认框,用于在用户尝试执行重要操作前提示确认信息。
|
|
9
13
|
* 通过传入的 props 可以自定义 Popconfirm 组件的行为和外观。
|
|
10
|
-
*
|
|
14
|
+
*
|
|
11
15
|
* @param {Object} props - 传递给 Popconfirm 组件的属性。这包括所有标准的 Popconfirm 属性,
|
|
12
16
|
* 以及任何额外的属性,如事件处理器或自定义内容。
|
|
13
17
|
* @returns {ReactNode} 返回一个配置了自定义样式和指定属性的 Popconfirm 组件实例。
|
|
14
18
|
*/
|
|
15
|
-
export default function (
|
|
19
|
+
export default function (_ref) {
|
|
20
|
+
var _ref$showBtn = _ref.showBtn,
|
|
21
|
+
showBtn = _ref$showBtn === void 0 ? false : _ref$showBtn,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
23
|
return /*#__PURE__*/React.createElement(Popconfirm, _extends({
|
|
17
|
-
overlayClassName: styles['lc-painter-panel-section-components-popconfirm'],
|
|
18
|
-
icon: null
|
|
24
|
+
overlayClassName: classNames(styles['lc-painter-panel-section-components-popconfirm'], _defineProperty({}, styles['show-btn'], showBtn)),
|
|
25
|
+
icon: null,
|
|
26
|
+
getPopupContainer: function getPopupContainer() {
|
|
27
|
+
return document.getElementById('lc-design-workspace');
|
|
28
|
+
}
|
|
19
29
|
}, props));
|
|
20
30
|
}
|
|
File without changes
|
|
@@ -3,8 +3,9 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
3
3
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["onValueChange", "rules", "value"];
|
|
6
|
+
var _excluded = ["onValueChange", "rules", "value", "defaultValue"];
|
|
7
7
|
import React, { forwardRef, useState, useEffect } from 'react';
|
|
8
|
+
import { useUpdateEffect } from 'ahooks';
|
|
8
9
|
import { Input, Tooltip } from 'luck-design/antd';
|
|
9
10
|
import classNames from 'classnames';
|
|
10
11
|
import styles from "../style/rule-input.less";
|
|
@@ -44,8 +45,9 @@ export default /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
44
45
|
var onValueChange = _ref.onValueChange,
|
|
45
46
|
rules = _ref.rules,
|
|
46
47
|
value = _ref.value,
|
|
48
|
+
defaultValue = _ref.defaultValue,
|
|
47
49
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
-
var _useState = useState(value),
|
|
50
|
+
var _useState = useState(value || defaultValue),
|
|
49
51
|
_useState2 = _slicedToArray(_useState, 2),
|
|
50
52
|
inputValue = _useState2[0],
|
|
51
53
|
setInputValue = _useState2[1]; // 托管输入值的状态
|
|
@@ -55,7 +57,7 @@ export default /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
55
57
|
setErr = _useState4[1];
|
|
56
58
|
|
|
57
59
|
// 使用useEffect钩子监听value的变化
|
|
58
|
-
|
|
60
|
+
useUpdateEffect(function () {
|
|
59
61
|
setInputValue(value);
|
|
60
62
|
setErr(null);
|
|
61
63
|
}, [value]);
|
|
File without changes
|
|
@@ -1,80 +1,78 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["onChange"],
|
|
6
|
-
_excluded2 = ["children", "language", "options"
|
|
7
|
-
import React, {
|
|
4
|
+
var _excluded = ["onChange", "isFullscreen"],
|
|
5
|
+
_excluded2 = ["children", "language", "options"];
|
|
6
|
+
import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
8
7
|
import * as monaco from 'monaco-editor';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* BaseEditor 组件是一个封装了 monaco 编辑器的 React 组件,支持前向 ref 引用。
|
|
11
|
+
* 该组件允许用户编辑代码,并在代码发生变更时触发回调函数。
|
|
12
|
+
* 它还支持通过 props 控制编辑器的语言、选项以及是否全屏显示。
|
|
13
|
+
*
|
|
14
|
+
* @component
|
|
15
|
+
* @example
|
|
16
|
+
* const handleEditorChange = (newValue, event) => {
|
|
17
|
+
* console.log('Editor content changed: ', newValue);
|
|
18
|
+
* };
|
|
19
|
+
* <BaseEditor
|
|
20
|
+
* language="javascript"
|
|
21
|
+
* onChange={handleEditorChange}
|
|
22
|
+
* isFullscreen={false}
|
|
23
|
+
* width="600px"
|
|
24
|
+
* height="400px"
|
|
25
|
+
* >
|
|
26
|
+
* {`function sayHello() {\n console.log('Hello, World!');\n}`}
|
|
27
|
+
* </BaseEditor>
|
|
28
|
+
*
|
|
29
|
+
* @param {Object} props - 组件的属性。
|
|
30
|
+
* @param {Function} props.onChange - 当编辑器内容变更时调用的函数。接收最新的编辑器内容和事件对象作为参数。
|
|
31
|
+
* @param {boolean} props.isFullscreen - 控制编辑器是否全屏显示。
|
|
32
|
+
* @param {string} [props.language='javascript'] - 设置编辑器的编程语言,默认为 'javascript'。
|
|
33
|
+
* @param {Object} [props.options={}] - 用于自定义编辑器的选项。
|
|
34
|
+
* @param {React.ReactNode} children - 子组件,通常是编辑器的初始代码。
|
|
35
|
+
* @param {string} [props.width] - 编辑器的宽度,默认为 '100%'。
|
|
36
|
+
* @param {string} [props.height] - 编辑器的高度,默认为 '100%'。
|
|
37
|
+
* @param {Object} rest - 传递给 div 容器的其它属性。
|
|
38
|
+
* @param {React.Ref} ref - React ref 引用,用于外部组件调用编辑器实例的方法。
|
|
39
|
+
*
|
|
40
|
+
* @returns {ReactElement} 返回一个 React 元素,其中包含了一个配置好的 monaco 编辑器实例。
|
|
41
|
+
*/
|
|
9
42
|
var BaseEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
43
|
var onChange = _ref.onChange,
|
|
44
|
+
isFullscreen = _ref.isFullscreen,
|
|
11
45
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
46
|
var children = props.children,
|
|
13
47
|
_props$language = props.language,
|
|
14
48
|
language = _props$language === void 0 ? 'javascript' : _props$language,
|
|
15
49
|
_props$options = props.options,
|
|
16
50
|
options = _props$options === void 0 ? {} : _props$options,
|
|
17
|
-
onFullscreenChange = props.onFullscreenChange,
|
|
18
51
|
rest = _objectWithoutProperties(props, _excluded2);
|
|
19
|
-
var _useState = useState(false),
|
|
20
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
-
isFullScreen = _useState2[0],
|
|
22
|
-
setIsFullScreen = _useState2[1];
|
|
23
52
|
var editorRef = useRef(null);
|
|
24
53
|
var editorInstance = useRef(null);
|
|
25
54
|
|
|
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
55
|
// 初始化编辑器实例
|
|
71
56
|
useEffect(function () {
|
|
72
57
|
if (editorRef.current) {
|
|
73
58
|
var code = React.Children.toArray(children).join('').trim();
|
|
74
59
|
editorInstance.current = monaco.editor.create(editorRef.current, _objectSpread({
|
|
75
60
|
value: code,
|
|
76
|
-
language: language
|
|
77
|
-
|
|
61
|
+
language: language,
|
|
62
|
+
automaticLayout: true
|
|
63
|
+
}, options), {
|
|
64
|
+
storageService: {
|
|
65
|
+
get: function get() {},
|
|
66
|
+
getBoolean: function getBoolean(key) {
|
|
67
|
+
if (key === 'expandSuggestionDocs') return true;
|
|
68
|
+
return false;
|
|
69
|
+
},
|
|
70
|
+
remove: function remove() {},
|
|
71
|
+
store: function store() {},
|
|
72
|
+
onWillSaveState: function onWillSaveState() {},
|
|
73
|
+
onDidChangeStorage: function onDidChangeStorage() {}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
78
76
|
editorInstance.current.onDidChangeModelContent(function (event) {
|
|
79
77
|
if (onChange) onChange(editorInstance.current.getValue(), event);
|
|
80
78
|
});
|
|
@@ -90,20 +88,12 @@ var BaseEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
90
88
|
return {
|
|
91
89
|
get editor() {
|
|
92
90
|
return editorInstance.current;
|
|
93
|
-
}
|
|
94
|
-
toggleFullScreen: toggleFullScreen
|
|
91
|
+
}
|
|
95
92
|
};
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// 更新编辑器布局当全屏状态改变
|
|
99
|
-
useEffect(function () {
|
|
100
|
-
if (editorInstance.current) {
|
|
101
|
-
editorInstance.current.layout();
|
|
102
|
-
}
|
|
103
|
-
}, [isFullScreen]);
|
|
93
|
+
}, []);
|
|
104
94
|
|
|
105
95
|
// 根据是否全屏来设置编辑器的样式
|
|
106
|
-
var editorStyle =
|
|
96
|
+
var editorStyle = isFullscreen ? {
|
|
107
97
|
width: '100vw',
|
|
108
98
|
height: '100vh'
|
|
109
99
|
} : {
|
|
@@ -3,6 +3,33 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["children"];
|
|
4
4
|
import React, { forwardRef } from 'react';
|
|
5
5
|
import BaseEditor from "./BaseEditor";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* CssEditor 组件是一个专门用于编辑 CSS 代码的 React 组件,它基于 BaseEditor 组件构建。
|
|
9
|
+
* 该组件通过将 language 属性固定设置为 "css",确保编辑器环境专门用于 CSS 代码编辑。
|
|
10
|
+
* 用户可以传入 CSS 代码作为 children,并通过其他 props 控制 BaseEditor 提供的额外功能。
|
|
11
|
+
*
|
|
12
|
+
* @component
|
|
13
|
+
* @example
|
|
14
|
+
* const handleCssChange = (newCss, event) => {
|
|
15
|
+
* console.log('CSS changed: ', newCss);
|
|
16
|
+
* };
|
|
17
|
+
* <CssEditor
|
|
18
|
+
* onChange={handleCssChange}
|
|
19
|
+
* isFullscreen={false}
|
|
20
|
+
* width="600px"
|
|
21
|
+
* height="400px"
|
|
22
|
+
* >
|
|
23
|
+
* {`body { margin: 0; font-family: Arial, sans-serif; }`}
|
|
24
|
+
* </CssEditor>
|
|
25
|
+
*
|
|
26
|
+
* @param {Object} props - 组件的属性。
|
|
27
|
+
* @param {React.ReactNode} children - 子组件,通常是编辑器的初始 CSS 代码。
|
|
28
|
+
* @param {Object} rest - 传递给 BaseEditor 组件的其他属性。
|
|
29
|
+
* @param {React.Ref} ref - React ref 引用,用于外部组件调用编辑器实例的方法。
|
|
30
|
+
*
|
|
31
|
+
* @returns {ReactElement} 返回一个 React 元素,该元素内部是一个专门用于 CSS 编辑的 BaseEditor 组件实例。
|
|
32
|
+
*/
|
|
6
33
|
var CssEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
7
34
|
var children = _ref.children,
|
|
8
35
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -2,26 +2,48 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["EditorComponent", "onLoad", "children"];
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { useEffect, forwardRef, useRef } from 'react';
|
|
6
6
|
import { Tooltip, Icon } from 'luck-design/antd';
|
|
7
7
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
8
8
|
import styles from "../../style/fullscreen-editor.less";
|
|
9
|
+
import { useFullscreen } from 'ahooks';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* FullScreenEditor 组件是一个支持全屏编辑模式的 React 组件,它利用提供的 EditorComponent 来实现代码编辑功能。
|
|
13
|
+
* 该组件使用 ahooks 的 useFullscreen 钩子来实现全屏切换,并在全屏模式下调整编辑器布局。
|
|
14
|
+
* 全屏/非全屏模式下编辑器的某些选项可能会有所不同,以适应不同的布局需求。
|
|
15
|
+
*
|
|
16
|
+
* @component
|
|
17
|
+
* @example
|
|
18
|
+
* const MyEditor = React.forwardRef((props, ref) => <BaseEditor {...props} ref={ref} />);
|
|
19
|
+
* <FullScreenEditor
|
|
20
|
+
* EditorComponent={MyEditor}
|
|
21
|
+
* onLoad={() => console.log('Editor loaded')}
|
|
22
|
+
* >
|
|
23
|
+
* {`function sayHello() {\n console.log('Hello, World!');\n}`}
|
|
24
|
+
* </FullScreenEditor>
|
|
25
|
+
*
|
|
26
|
+
* @param {Object} props - 组件的属性。
|
|
27
|
+
* @param {Function} props.EditorComponent - 用于编辑的组件,该组件需要支持 ref 引用以调用编辑器的方法。
|
|
28
|
+
* @param {Function} [props.onLoad] - 编辑器加载完成时的回调函数。
|
|
29
|
+
* @param {React.ReactNode} children - 传递给 EditorComponent 的 children,通常是初始代码或内容。
|
|
30
|
+
* @param {Object} rest - 传递给 EditorComponent 的其他属性。
|
|
31
|
+
* @param {React.Ref} ref - React ref 引用,用于在外部组件中访问 EditorComponent 实例的方法。
|
|
32
|
+
*
|
|
33
|
+
* @returns {ReactElement} 返回一个 React 元素,其中包含了一个具有全屏切换功能的编辑器界面。
|
|
34
|
+
*/
|
|
9
35
|
var FullScreenEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
36
|
var EditorComponent = _ref.EditorComponent,
|
|
11
37
|
onLoad = _ref.onLoad,
|
|
12
38
|
children = _ref.children,
|
|
13
39
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
40
|
+
var fullscreenRef = useRef(null);
|
|
41
|
+
var _useFullscreen = useFullscreen(fullscreenRef),
|
|
42
|
+
_useFullscreen2 = _slicedToArray(_useFullscreen, 2),
|
|
43
|
+
isFullscreen = _useFullscreen2[0],
|
|
44
|
+
toggleFullscreen = _useFullscreen2[1].toggleFullscreen;
|
|
18
45
|
var handleFullscreen = function handleFullscreen() {
|
|
19
|
-
|
|
20
|
-
ref.current.toggleFullScreen();
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
var HandleFullscreenChange = function HandleFullscreenChange(fullscrean) {
|
|
24
|
-
setIsFullScreen(fullscrean);
|
|
46
|
+
toggleFullscreen();
|
|
25
47
|
};
|
|
26
48
|
useEffect(function () {
|
|
27
49
|
if (onLoad) onLoad();
|
|
@@ -39,11 +61,12 @@ var FullScreenEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
39
61
|
type: "fullscreen",
|
|
40
62
|
onClick: handleFullscreen
|
|
41
63
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
className:
|
|
64
|
+
className: isFullscreen ? styles['fullscreen'] : '',
|
|
65
|
+
ref: fullscreenRef
|
|
43
66
|
}, /*#__PURE__*/React.createElement(EditorComponent, _extends({
|
|
44
67
|
ref: ref,
|
|
45
|
-
|
|
46
|
-
options:
|
|
68
|
+
isFullscreen: isFullscreen,
|
|
69
|
+
options: isFullscreen ? {} : {
|
|
47
70
|
lineNumbers: 'off',
|
|
48
71
|
glyphMargin: false,
|
|
49
72
|
folding: false,
|
|
@@ -3,18 +3,32 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
5
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
6
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
7
|
var _excluded = ["children"];
|
|
7
8
|
import React, { useEffect, forwardRef } from 'react';
|
|
8
9
|
import BaseEditor from "./BaseEditor";
|
|
9
10
|
import * as monaco from 'monaco-editor';
|
|
11
|
+
import { isNil } from 'lodash';
|
|
12
|
+
function capitalizeFirstLetter(string) {
|
|
13
|
+
if (isNil(string)) return null;
|
|
14
|
+
if (string.length === 0) {
|
|
15
|
+
return ''; // 如果字符串为空,返回空字符串
|
|
16
|
+
}
|
|
17
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
18
|
+
}
|
|
10
19
|
var _provideCompletionItems = function provideCompletionItems(monaco, model, position, module) {
|
|
11
20
|
var textUntilPosition = model.getValueInRange({
|
|
12
|
-
startLineNumber:
|
|
21
|
+
startLineNumber: 1,
|
|
13
22
|
startColumn: 1,
|
|
14
23
|
endLineNumber: position.lineNumber,
|
|
15
24
|
endColumn: position.column
|
|
16
25
|
});
|
|
17
|
-
|
|
26
|
+
|
|
27
|
+
// 正则表达式匹配以 triggerWord 开头的任何单词
|
|
28
|
+
var pattern = new RegExp('\\b' + module.triggerWord + '[\\w.]*', 'i');
|
|
29
|
+
var match = textUntilPosition.match(pattern);
|
|
30
|
+
// console.log('match',match)
|
|
31
|
+
if (match) {
|
|
18
32
|
var word = model.getWordUntilPosition(position);
|
|
19
33
|
var range = {
|
|
20
34
|
startLineNumber: position.lineNumber,
|
|
@@ -22,14 +36,10 @@ var _provideCompletionItems = function provideCompletionItems(monaco, model, pos
|
|
|
22
36
|
startColumn: word.startColumn,
|
|
23
37
|
endColumn: word.endColumn
|
|
24
38
|
};
|
|
25
|
-
|
|
26
|
-
// 从模块中调用 completions 函数获取补全项数组
|
|
27
|
-
// 并动态转换 kind 字段
|
|
28
39
|
return module.completions.map(function (completion) {
|
|
29
|
-
return
|
|
40
|
+
return _objectSpread(_objectSpread({}, completion), {}, {
|
|
30
41
|
range: range,
|
|
31
|
-
|
|
32
|
-
kind: monaco.languages.CompletionItemKind[completion.kind]
|
|
42
|
+
kind: monaco.languages.CompletionItemKind[capitalizeFirstLetter(completion.kind)]
|
|
33
43
|
});
|
|
34
44
|
});
|
|
35
45
|
}
|
|
@@ -45,7 +55,8 @@ var setupAutocomplete = /*#__PURE__*/function () {
|
|
|
45
55
|
return import("../../../engine/meta/js-editor/auto-complete.json");
|
|
46
56
|
case 2:
|
|
47
57
|
autoCompleteModules = _context.sent;
|
|
48
|
-
console.log('autoCompleteModules', autoCompleteModules);
|
|
58
|
+
// console.log('autoCompleteModules', autoCompleteModules);
|
|
59
|
+
|
|
49
60
|
monaco.languages.registerCompletionItemProvider('javascript', _defineProperty({
|
|
50
61
|
triggerCharacters: ['.'],
|
|
51
62
|
provideCompletionItems: function provideCompletionItems(model, position) {
|
|
@@ -61,7 +72,7 @@ var setupAutocomplete = /*#__PURE__*/function () {
|
|
|
61
72
|
};
|
|
62
73
|
}
|
|
63
74
|
}, "triggerCharacters", ['.']));
|
|
64
|
-
case
|
|
75
|
+
case 4:
|
|
65
76
|
case "end":
|
|
66
77
|
return _context.stop();
|
|
67
78
|
}
|
|
@@ -71,6 +82,28 @@ var setupAutocomplete = /*#__PURE__*/function () {
|
|
|
71
82
|
return _ref.apply(this, arguments);
|
|
72
83
|
};
|
|
73
84
|
}();
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* JSEditor 组件是一个专为 JavaScript 编辑设计的 React 组件,它基于 BaseEditor 组件构建,并集成了自动完成功能。
|
|
88
|
+
* 该组件利用 monaco-editor 提供的 API,通过 setupAutocomplete 函数设置自动完成项,从而增强代码编辑体验。
|
|
89
|
+
* 自动完成逻辑包括从预定义的自动完成模块中加载补全项,以及在编辑器中键入特定字符(如".")时触发补全建议。
|
|
90
|
+
*
|
|
91
|
+
* @component
|
|
92
|
+
* @example
|
|
93
|
+
* <JSEditor
|
|
94
|
+
* language="javascript"
|
|
95
|
+
* options={{ fontSize: 14 }}
|
|
96
|
+
* >
|
|
97
|
+
* {`function sayHello() {\n console.log('Hello, World!');\n}`}
|
|
98
|
+
* </JSEditor>
|
|
99
|
+
*
|
|
100
|
+
* @param {Object} props - 组件的属性。
|
|
101
|
+
* @param {React.ReactNode} children - 传递给 BaseEditor 的 children,通常是初始代码或内容。
|
|
102
|
+
* @param {Object} rest - 传递给 BaseEditor 组件的其他属性。
|
|
103
|
+
* @param {React.Ref} ref - React ref 引用,用于在外部组件中访问 BaseEditor 实例的方法。
|
|
104
|
+
*
|
|
105
|
+
* @returns {ReactElement} 返回一个 React 元素,其中包含了一个具有自动完成功能的 JavaScript 编辑器实例。
|
|
106
|
+
*/
|
|
74
107
|
var JSEditor = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
75
108
|
var children = _ref2.children,
|
|
76
109
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
@@ -79,6 +112,6 @@ var JSEditor = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
79
112
|
}, []);
|
|
80
113
|
return /*#__PURE__*/React.createElement(BaseEditor, _extends({
|
|
81
114
|
ref: ref
|
|
82
|
-
}, rest));
|
|
115
|
+
}, rest), children);
|
|
83
116
|
});
|
|
84
117
|
export default /*#__PURE__*/React.memo(JSEditor);
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
|
|
7
|
+
/**
|
|
8
|
+
* JsonEditor 组件是一个专门用于编辑 CSS 代码的 React 组件,它基于 BaseEditor 组件构建。
|
|
9
|
+
* 该组件通过将 language 属性固定设置为 "css",确保编辑器环境专门用于 CSS 代码编辑。
|
|
10
|
+
* 用户可以传入 CSS 代码作为 children,并通过其他 props 控制 BaseEditor 提供的额外功能。
|
|
11
|
+
*
|
|
12
|
+
* @component
|
|
13
|
+
* @example
|
|
14
|
+
* const handleCssChange = (newCss, event) => {
|
|
15
|
+
* console.log('CSS changed: ', newCss);
|
|
16
|
+
* };
|
|
17
|
+
* <JsonEditor
|
|
18
|
+
* onChange={handleCssChange}
|
|
19
|
+
* isFullscreen={false}
|
|
20
|
+
* width="600px"
|
|
21
|
+
* height="400px"
|
|
22
|
+
* >
|
|
23
|
+
* {`body { margin: 0; font-family: Arial, sans-serif; }`}
|
|
24
|
+
* </JsonEditor>
|
|
25
|
+
*
|
|
26
|
+
* @param {Object} props - 组件的属性。
|
|
27
|
+
* @param {React.ReactNode} children - 子组件,通常是编辑器的初始 CSS 代码。
|
|
28
|
+
* @param {Object} rest - 传递给 BaseEditor 组件的其他属性。
|
|
29
|
+
* @param {React.Ref} ref - React ref 引用,用于外部组件调用编辑器实例的方法。
|
|
30
|
+
*
|
|
31
|
+
* @returns {ReactElement} 返回一个 React 元素,该元素内部是一个专门用于 CSS 编辑的 BaseEditor 组件实例。
|
|
32
|
+
*/
|
|
33
|
+
var JsonEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
34
|
+
var children = _ref.children,
|
|
35
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
+
return /*#__PURE__*/React.createElement(BaseEditor, _extends({
|
|
37
|
+
ref: ref,
|
|
38
|
+
language: "json"
|
|
39
|
+
}, rest), children);
|
|
40
|
+
});
|
|
41
|
+
export default /*#__PURE__*/React.memo(JsonEditor);
|
|
File without changes
|
|
@@ -11,7 +11,8 @@ import Panel from "./Panel";
|
|
|
11
11
|
import { RUNTIME } from "../constants/index";
|
|
12
12
|
import styles from "./style/index.less";
|
|
13
13
|
var Painter = function Painter(_ref) {
|
|
14
|
-
var className = _ref.className
|
|
14
|
+
var className = _ref.className,
|
|
15
|
+
code = _ref.code;
|
|
15
16
|
// 修改后刷新提示功能,暂时关掉,等待提供数据对比进行判断
|
|
16
17
|
// useEffect(() => {
|
|
17
18
|
// const handleBeforeUnload = (event) => {
|
|
@@ -38,7 +39,10 @@ var Painter = function Painter(_ref) {
|
|
|
38
39
|
|
|
39
40
|
return /*#__PURE__*/React.createElement(EventBusProvider, {
|
|
40
41
|
runtime: RUNTIME.DESIGN
|
|
41
|
-
}, /*#__PURE__*/React.createElement(ContextProvider,
|
|
42
|
+
}, /*#__PURE__*/React.createElement(ContextProvider, {
|
|
43
|
+
code: code
|
|
44
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
id: "lc-design-workspace",
|
|
42
46
|
className: classNames(styles['lc-painter'], _defineProperty({}, className, !!className))
|
|
43
47
|
}, /*#__PURE__*/React.createElement(Ribbon, null), /*#__PURE__*/React.createElement(Design, null), /*#__PURE__*/React.createElement(Panel, null))));
|
|
44
48
|
};
|