@luck-design-biz/luckda 0.0.24-1 → 0.0.24-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/es/components/Builder/index.js +6 -4
- 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 +0 -0
- package/es/components/LdFormList/model.js +0 -0
- package/es/components/LdGrid/index.js +12 -3
- 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 +0 -0
- package/es/components/LdTree/index.less +0 -0
- 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 +0 -0
- package/es/lowcode/constants/api-url.js +291 -1
- package/es/lowcode/constants/event-topics.js +4 -4
- package/es/lowcode/constants/index.js +0 -0
- package/es/lowcode/engine/factory/DataFactory.js +0 -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 +2 -0
- package/es/lowcode/engine/meta/box.props.default.json +0 -0
- package/es/lowcode/engine/meta/box.props.json +0 -0
- package/es/lowcode/engine/meta/button.props.default.json +0 -0
- package/es/lowcode/engine/meta/button.props.json +7 -2
- package/es/lowcode/engine/meta/cardlist.props.default.json +0 -0
- package/es/lowcode/engine/meta/cardlist.props.json +0 -0
- package/es/lowcode/engine/meta/components-list.json +6 -6
- package/es/lowcode/engine/meta/dialog.props.default.json +0 -0
- package/es/lowcode/engine/meta/dialog.props.json +0 -0
- package/es/lowcode/engine/meta/drawer.props.default.json +0 -0
- package/es/lowcode/engine/meta/drawer.props.json +0 -0
- package/es/lowcode/engine/meta/form.props.default.json +0 -0
- package/es/lowcode/engine/meta/form.props.json +0 -0
- package/es/lowcode/engine/meta/iframe.props.default.json +0 -0
- package/es/lowcode/engine/meta/iframe.props.json +0 -0
- package/es/lowcode/engine/meta/image.props.default.json +0 -0
- package/es/lowcode/engine/meta/image.props.json +0 -0
- package/es/lowcode/engine/meta/imex.props.default.json +0 -0
- package/es/lowcode/engine/meta/imex.props.json +0 -0
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +28 -28
- package/es/lowcode/engine/meta/jsx.props.default.json +0 -0
- package/es/lowcode/engine/meta/jsx.props.json +0 -0
- package/es/lowcode/engine/meta/layout.props.default.json +0 -0
- package/es/lowcode/engine/meta/layout.props.json +0 -0
- package/es/lowcode/engine/meta/link.props.default.json +0 -0
- package/es/lowcode/engine/meta/link.props.json +0 -0
- package/es/lowcode/engine/meta/section.props.default.json +0 -0
- package/es/lowcode/engine/meta/section.props.json +0 -0
- package/es/lowcode/engine/meta/split.props.default.json +0 -0
- package/es/lowcode/engine/meta/split.props.json +0 -0
- package/es/lowcode/engine/meta/table.props.default.json +20 -2
- package/es/lowcode/engine/meta/table.props.json +99 -37
- package/es/lowcode/engine/meta/tabs.props.default.json +0 -0
- package/es/lowcode/engine/meta/tabs.props.json +0 -0
- package/es/lowcode/engine/meta/text.props.default.json +0 -0
- package/es/lowcode/engine/meta/text.props.json +0 -0
- package/es/lowcode/engine/meta/tree.props.default.json +0 -0
- package/es/lowcode/engine/meta/tree.props.json +0 -0
- package/es/lowcode/engine/provider/ContextProvider.js +40 -28
- 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 +68 -0
- package/es/lowcode/engine/tools/usePromiseState.js +0 -0
- 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 +71 -33
- package/es/lowcode/painter/Ribbon.js +0 -0
- package/es/lowcode/painter/components/Collapse.js +67 -8
- package/es/lowcode/painter/components/ColorInput.js +125 -0
- package/es/lowcode/painter/components/{TabEditor.js → ListEditor.js} +17 -16
- 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 +4 -1
- 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/actions-editor/ActionEditor.js +147 -0
- package/es/lowcode/painter/components/actions-editor/index.js +170 -0
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +42 -64
- 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 +22 -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/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/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 +42 -10
- 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 +55 -8
- 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/TableActions.js +19 -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/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 +7 -0
- 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/index.less +0 -0
- package/es/lowcode/painter/style/layout-ratio.less +0 -0
- package/{lib/lowcode/painter/style/tabeditor.less → es/lowcode/painter/style/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-item.less +11 -1
- package/es/lowcode/painter/style/panel.less +3 -16
- package/es/lowcode/painter/style/pop-confirm.less +0 -0
- 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 +2 -2
- package/es/lowcode/view/lc-components/Box/index.less +0 -0
- package/es/lowcode/view/lc-components/Box/meta.json +0 -0
- 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 +7 -2
- 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 +0 -0
- 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 -0
- 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 +19 -22
- package/es/lowcode/view/lc-components/Drawer/{style.less → index.less} +1 -1
- package/es/lowcode/view/lc-components/Drawer/meta.json +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- package/es/lowcode/view/lc-components/Table/FunctionDesign.js +4 -2
- package/es/lowcode/view/lc-components/Table/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Table/index.js +222 -132
- package/es/lowcode/view/lc-components/Table/meta.json +88 -37
- 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 -0
- 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 +0 -0
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +0 -0
- package/es/lowcode/view/lc-components/Tree/FunctionLive.js +0 -0
- package/es/lowcode/view/lc-components/Tree/index.js +0 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +0 -0
- package/es/lowcode/view/lc-components/Wrapper.js +0 -0
- 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/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 +0 -0
- package/lib/components/LdFormList/model.js +0 -0
- package/lib/components/LdGrid/index.js +12 -3
- 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 +0 -0
- package/lib/components/LdTree/index.less +0 -0
- 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 +0 -0
- package/lib/lowcode/constants/api-url.js +293 -2
- package/lib/lowcode/constants/event-topics.js +5 -5
- package/lib/lowcode/constants/index.js +0 -0
- package/lib/lowcode/engine/factory/DataFactory.js +0 -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 +2 -0
- package/lib/lowcode/engine/meta/box.props.default.json +0 -0
- package/lib/lowcode/engine/meta/box.props.json +0 -0
- package/lib/lowcode/engine/meta/button.props.default.json +0 -0
- package/lib/lowcode/engine/meta/button.props.json +7 -2
- package/lib/lowcode/engine/meta/cardlist.props.default.json +0 -0
- package/lib/lowcode/engine/meta/cardlist.props.json +0 -0
- package/lib/lowcode/engine/meta/components-list.json +6 -6
- package/lib/lowcode/engine/meta/dialog.props.default.json +0 -0
- package/lib/lowcode/engine/meta/dialog.props.json +0 -0
- package/lib/lowcode/engine/meta/drawer.props.default.json +0 -0
- package/lib/lowcode/engine/meta/drawer.props.json +0 -0
- package/lib/lowcode/engine/meta/form.props.default.json +0 -0
- package/lib/lowcode/engine/meta/form.props.json +0 -0
- package/lib/lowcode/engine/meta/iframe.props.default.json +0 -0
- package/lib/lowcode/engine/meta/iframe.props.json +0 -0
- package/lib/lowcode/engine/meta/image.props.default.json +0 -0
- package/lib/lowcode/engine/meta/image.props.json +0 -0
- package/lib/lowcode/engine/meta/imex.props.default.json +0 -0
- package/lib/lowcode/engine/meta/imex.props.json +0 -0
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +28 -28
- package/lib/lowcode/engine/meta/jsx.props.default.json +0 -0
- package/lib/lowcode/engine/meta/jsx.props.json +0 -0
- package/lib/lowcode/engine/meta/layout.props.default.json +0 -0
- package/lib/lowcode/engine/meta/layout.props.json +0 -0
- package/lib/lowcode/engine/meta/link.props.default.json +0 -0
- package/lib/lowcode/engine/meta/link.props.json +0 -0
- package/lib/lowcode/engine/meta/section.props.default.json +0 -0
- package/lib/lowcode/engine/meta/section.props.json +0 -0
- package/lib/lowcode/engine/meta/split.props.default.json +0 -0
- package/lib/lowcode/engine/meta/split.props.json +0 -0
- package/lib/lowcode/engine/meta/table.props.default.json +20 -2
- package/lib/lowcode/engine/meta/table.props.json +99 -37
- package/lib/lowcode/engine/meta/tabs.props.default.json +0 -0
- package/lib/lowcode/engine/meta/tabs.props.json +0 -0
- package/lib/lowcode/engine/meta/text.props.default.json +0 -0
- package/lib/lowcode/engine/meta/text.props.json +0 -0
- package/lib/lowcode/engine/meta/tree.props.default.json +0 -0
- package/lib/lowcode/engine/meta/tree.props.json +0 -0
- package/lib/lowcode/engine/provider/ContextProvider.js +40 -28
- 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 +70 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +0 -0
- 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 +71 -33
- package/lib/lowcode/painter/Ribbon.js +0 -0
- package/lib/lowcode/painter/components/Collapse.js +65 -7
- package/lib/lowcode/painter/components/ColorInput.js +132 -0
- package/lib/lowcode/painter/components/{TabEditor.js → ListEditor.js} +19 -18
- 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 +4 -1
- 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/actions-editor/ActionEditor.js +155 -0
- package/lib/lowcode/painter/components/actions-editor/index.js +178 -0
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +40 -63
- 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 +22 -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/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/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 +40 -9
- 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 +55 -8
- 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/TableActions.js +26 -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/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 +7 -0
- 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/index.less +0 -0
- package/lib/lowcode/painter/style/layout-ratio.less +0 -0
- package/{es/lowcode/painter/style/tabeditor.less → lib/lowcode/painter/style/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-item.less +11 -1
- package/lib/lowcode/painter/style/panel.less +3 -16
- package/lib/lowcode/painter/style/pop-confirm.less +0 -0
- 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 +2 -2
- package/lib/lowcode/view/lc-components/Box/index.less +0 -0
- package/lib/lowcode/view/lc-components/Box/meta.json +0 -0
- 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 +7 -2
- 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 +0 -0
- 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 -0
- 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 +18 -21
- package/lib/lowcode/view/lc-components/Drawer/{style.less → index.less} +1 -1
- package/lib/lowcode/view/lc-components/Drawer/meta.json +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- package/lib/lowcode/view/lc-components/Table/FunctionDesign.js +4 -2
- package/lib/lowcode/view/lc-components/Table/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Table/index.js +221 -131
- package/lib/lowcode/view/lc-components/Table/meta.json +88 -37
- 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 -0
- 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 +0 -0
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +0 -0
- package/lib/lowcode/view/lc-components/Tree/FunctionLive.js +0 -0
- package/lib/lowcode/view/lc-components/Tree/index.js +0 -0
- package/lib/lowcode/view/lc-components/Tree/meta.json +0 -0
- package/lib/lowcode/view/lc-components/Wrapper.js +0 -0
- 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 +7 -5
- package/upload.js +0 -0
- package/utils.js +0 -0
- package/es/lowcode/painter/panel-section/StylePanel/Width.js +0 -48
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
12
|
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -19,6 +21,8 @@ var _PanelItem = _interopRequireDefault(require("./components/PanelItem"));
|
|
|
19
21
|
var _panelItemFactory = _interopRequireDefault(require("../engine/factory/panel-item-factory"));
|
|
20
22
|
var _dataProcess = require("../engine/tools/dataProcess");
|
|
21
23
|
var _panel = _interopRequireDefault(require("./style/panel.less"));
|
|
24
|
+
var _StylePanel = _interopRequireDefault(require("./panel-section/StylePanel"));
|
|
25
|
+
var _excluded = ["type", "key", "name", "desc", "default", "props", "panelItem", "next", "repositioning"];
|
|
22
26
|
var _TAB_LIST_ = [{
|
|
23
27
|
title: '属性',
|
|
24
28
|
key: 'attrs'
|
|
@@ -50,7 +54,7 @@ var Panel = function Panel() {
|
|
|
50
54
|
setTrue = _useBoolean2$.setTrue,
|
|
51
55
|
setFalse = _useBoolean2$.setFalse;
|
|
52
56
|
var context = (0, _ContextProvider.useLDContext)();
|
|
53
|
-
var handleChange = (0, _ahooks.useMemoizedFn)(function (field, value) {
|
|
57
|
+
var handleChange = (0, _ahooks.useMemoizedFn)(function (field, value, repositioning) {
|
|
54
58
|
var component = context.componentMap.get(activeNode.node.id);
|
|
55
59
|
var _component$api$getSel = component.api.getSelfAndParentLCData(),
|
|
56
60
|
node = _component$api$getSel.node;
|
|
@@ -61,43 +65,73 @@ var Panel = function Panel() {
|
|
|
61
65
|
id: activeNode.node.id,
|
|
62
66
|
pageData: (0, _lodash.cloneDeep)(newData)
|
|
63
67
|
});
|
|
68
|
+
if (repositioning) context.$publisher(context.topics.COMPONENT_REPOSITIONING, {
|
|
69
|
+
id: activeNode.node.id
|
|
70
|
+
});
|
|
64
71
|
});
|
|
65
|
-
|
|
72
|
+
if (nextRef.current.autoClose) {
|
|
73
|
+
setFalse();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
var handleStyleChange = (0, _ahooks.useMemoizedFn)(function (newStyle, newCss) {
|
|
77
|
+
console.log('style', newStyle, newCss);
|
|
78
|
+
// setCss(newCss);
|
|
79
|
+
});
|
|
80
|
+
var goNext = (0, _ahooks.useMemoizedFn)(function (_next) {
|
|
81
|
+
if (!_next) return;
|
|
82
|
+
nextRef.current = {
|
|
83
|
+
name: _next.name,
|
|
84
|
+
autoClose: _next.autoClose,
|
|
85
|
+
NextComp: renderPanelItems(_next.props)
|
|
86
|
+
};
|
|
87
|
+
setTrue();
|
|
66
88
|
});
|
|
67
89
|
var renderPanelItems = (0, _ahooks.useMemoizedFn)(function (items) {
|
|
68
|
-
return items.map(function (
|
|
69
|
-
var
|
|
70
|
-
|
|
90
|
+
return items.map(function (_ref) {
|
|
91
|
+
var type = _ref.type,
|
|
92
|
+
key = _ref.key,
|
|
93
|
+
name = _ref.name,
|
|
94
|
+
desc = _ref.desc,
|
|
95
|
+
defaultValue = _ref.default,
|
|
96
|
+
props = _ref.props,
|
|
97
|
+
panelItem = _ref.panelItem,
|
|
98
|
+
_next2 = _ref.next,
|
|
99
|
+
repositioning = _ref.repositioning,
|
|
100
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
101
|
+
var Comp = factory.current.getPanelItemFor((0, _lodash.startsWith)(type, '_') ? 'dynamic' : type, type);
|
|
102
|
+
if (type === 'group') {
|
|
71
103
|
return /*#__PURE__*/_react.default.createElement(Comp, {
|
|
72
|
-
key:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
104
|
+
key: key,
|
|
105
|
+
field: key,
|
|
106
|
+
label: name,
|
|
107
|
+
next: _next2 ? function () {
|
|
108
|
+
return goNext(_next2);
|
|
109
|
+
} : null,
|
|
110
|
+
defaultCollapsed: defaultValue,
|
|
111
|
+
desc: desc
|
|
112
|
+
}, renderPanelItems(props || []));
|
|
76
113
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
114
|
+
var _context$componentMap = context.componentMap.get(activeNode.node.id).api.getSelfAndParentLCData(),
|
|
115
|
+
node = _context$componentMap.node;
|
|
116
|
+
return /*#__PURE__*/_react.default.createElement(_PanelItem.default, (0, _extends2.default)({
|
|
117
|
+
key: key,
|
|
118
|
+
field: key,
|
|
119
|
+
label: name,
|
|
120
|
+
desc: desc
|
|
121
|
+
}, panelItem), Comp && /*#__PURE__*/_react.default.createElement(Comp, (0, _extends2.default)({
|
|
122
|
+
defaultValue: (0, _lodash.isNil)(node.props[key]) ? defaultValue : node.props[key],
|
|
83
123
|
next: function next() {
|
|
84
|
-
|
|
85
|
-
nextRef.current = {
|
|
86
|
-
name: item.next.name,
|
|
87
|
-
NextComp: renderPanelItems(item.next.props)
|
|
88
|
-
};
|
|
89
|
-
setTrue();
|
|
124
|
+
return goNext(_next2);
|
|
90
125
|
},
|
|
91
|
-
options: item.options,
|
|
92
|
-
disabled: item.disabled,
|
|
93
126
|
onChange: function onChange(value) {
|
|
94
|
-
return handleChange(
|
|
127
|
+
return handleChange(key, value, repositioning);
|
|
95
128
|
},
|
|
96
129
|
size: "small"
|
|
97
|
-
}));
|
|
130
|
+
}, rest)));
|
|
98
131
|
});
|
|
99
132
|
});
|
|
100
133
|
var PropsComps = (0, _ahooks.useCreation)(function () {
|
|
134
|
+
setActiveTabKey('attrs');
|
|
101
135
|
var _meta;
|
|
102
136
|
try {
|
|
103
137
|
_meta = require("../engine/meta/".concat(activeNode.node.component.toLowerCase(), ".props.json"));
|
|
@@ -113,6 +147,7 @@ var Panel = function Panel() {
|
|
|
113
147
|
}, [open]);
|
|
114
148
|
(0, _react.useEffect)(function () {
|
|
115
149
|
var _id = context.$subscriber(context.topics.COMPONENT_ACTIVE).on(function (payload) {
|
|
150
|
+
setFalse();
|
|
116
151
|
if (!payload.id) {
|
|
117
152
|
setActiveNode(null);
|
|
118
153
|
return;
|
|
@@ -129,7 +164,7 @@ var Panel = function Panel() {
|
|
|
129
164
|
return function () {
|
|
130
165
|
context.$unsubscriber(context.topics.COMPONENT_ACTIVE, _id);
|
|
131
166
|
};
|
|
132
|
-
}, [
|
|
167
|
+
}, []);
|
|
133
168
|
(0, _react.useLayoutEffect)(function () {
|
|
134
169
|
underLineRef.current.style.left = "".concat(activeTabRef.current.offsetLeft + activeTabRef.current.offsetWidth / 2 - 10, "px");
|
|
135
170
|
}, [activeTabKey, !!activeNode]);
|
|
@@ -142,9 +177,9 @@ var Panel = function Panel() {
|
|
|
142
177
|
style: {
|
|
143
178
|
fontSize: 12
|
|
144
179
|
}
|
|
145
|
-
}, activeNode === null || activeNode === void 0 ? void 0 : activeNode.level.map(function (
|
|
146
|
-
var id =
|
|
147
|
-
name =
|
|
180
|
+
}, activeNode === null || activeNode === void 0 ? void 0 : activeNode.level.map(function (_ref2) {
|
|
181
|
+
var id = _ref2.id,
|
|
182
|
+
name = _ref2.name;
|
|
148
183
|
return /*#__PURE__*/_react.default.createElement(_antd.Breadcrumb.Item, {
|
|
149
184
|
key: id,
|
|
150
185
|
className: (0, _classnames.default)((0, _defineProperty2.default)({}, _panel.default['active-node-level'], id !== activeNode.node.id)),
|
|
@@ -169,7 +204,7 @@ var Panel = function Panel() {
|
|
|
169
204
|
className: (0, _classnames.default)(_panel.default['lc-painter-panel-tabbar'], (0, _defineProperty2.default)({}, _panel.default.hidden, !activeNode))
|
|
170
205
|
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
171
206
|
className: _panel.default.headerList
|
|
172
|
-
}, _TAB_LIST_.map(function (_item) {
|
|
207
|
+
}, (activeNode !== null && activeNode !== void 0 && activeNode.node.style ? _TAB_LIST_ : [_TAB_LIST_[0], _TAB_LIST_[2]]).map(function (_item) {
|
|
173
208
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
174
209
|
key: _item.key,
|
|
175
210
|
ref: activeTabKey === _item.key ? activeTabRef : null,
|
|
@@ -182,7 +217,7 @@ var Panel = function Panel() {
|
|
|
182
217
|
ref: underLineRef,
|
|
183
218
|
className: _panel.default.underline
|
|
184
219
|
})), activeTabKey === _TAB_LIST_[0].key && /*#__PURE__*/_react.default.createElement("div", {
|
|
185
|
-
className: (0, _classnames.default)(_panel.default['lc-painter-panel-content'], (0, _defineProperty2.default)({}, _panel.default.hidden, !activeNode))
|
|
220
|
+
className: (0, _classnames.default)(_panel.default['lc-painter-panel-content'], (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _panel.default.hidden, !activeNode), _panel.default.showNext, open))
|
|
186
221
|
}, PropsComps, /*#__PURE__*/_react.default.createElement(_antd.Drawer, {
|
|
187
222
|
visible: open,
|
|
188
223
|
width: 320,
|
|
@@ -208,7 +243,10 @@ var Panel = function Panel() {
|
|
|
208
243
|
type: "close"
|
|
209
244
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
210
245
|
className: _panel.default['next-content-body']
|
|
211
|
-
}, (_nextRef$current2 = nextRef.current) === null || _nextRef$current2 === void 0 ? void 0 : _nextRef$current2.NextComp)))), activeTabKey === _TAB_LIST_[1].key && /*#__PURE__*/_react.default.createElement(
|
|
246
|
+
}, (_nextRef$current2 = nextRef.current) === null || _nextRef$current2 === void 0 ? void 0 : _nextRef$current2.NextComp)))), activeTabKey === _TAB_LIST_[1].key && /*#__PURE__*/_react.default.createElement(_StylePanel.default, {
|
|
247
|
+
onChange: handleStyleChange,
|
|
248
|
+
value: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.style
|
|
249
|
+
}), activeTabKey === _TAB_LIST_[2].key && /*#__PURE__*/_react.default.createElement("div", null, "\u9AD8\u7EA7\u9762\u677F"), /*#__PURE__*/_react.default.createElement("div", {
|
|
212
250
|
className: (0, _classnames.default)(_panel.default['lc-painter-panel-empty'], (0, _defineProperty2.default)({}, _panel.default.hidden, !!activeNode))
|
|
213
251
|
}, "\u8BF7\u5728\u5DE6\u4FA7\u753B\u5E03\u9009\u4E2D\u8282\u70B9"));
|
|
214
252
|
};
|
|
File without changes
|
|
@@ -8,30 +8,88 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = _default;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _ahooks = require("ahooks");
|
|
11
12
|
var _collapse = _interopRequireDefault(require("../style/collapse.less"));
|
|
12
13
|
var _antd = require("luck-design/antd");
|
|
14
|
+
/**
|
|
15
|
+
* Collapse 组件是一个可折叠区域的实现,用于显示或隐藏内容。它支持自定义标签、描述以及默认的折叠状态。
|
|
16
|
+
* 该组件还可以通过 `next` 函数来自定义点击操作,而不是简单地切换折叠状态。
|
|
17
|
+
* 提供的工具提示可以显示额外信息,如字段名和描述,以帮助用户更好地理解折叠内容的作用。
|
|
18
|
+
*
|
|
19
|
+
* @component
|
|
20
|
+
* @example
|
|
21
|
+
* <Collapse
|
|
22
|
+
* field="exampleField"
|
|
23
|
+
* label="示例标签"
|
|
24
|
+
* desc="这是一个用于演示的折叠组件"
|
|
25
|
+
* defaultCollapsed={true}
|
|
26
|
+
* next={() => console.log('Custom next function executed')}
|
|
27
|
+
* >
|
|
28
|
+
* <p>这里是可折叠的内容</p>
|
|
29
|
+
* </Collapse>
|
|
30
|
+
*
|
|
31
|
+
* @param {Object} props - 组件的属性。
|
|
32
|
+
* @param {React.ReactNode} children - 折叠区域展开时显示的内容。
|
|
33
|
+
* @param {string} [props.field] - 与折叠内容相关联的字段名。
|
|
34
|
+
* @param {string} props.label - 折叠区域的标签名称。
|
|
35
|
+
* @param {string} [props.desc] - 关于折叠内容的描述信息。
|
|
36
|
+
* @param {boolean} [props.defaultCollapsed=false] - 折叠区域的默认状态。如果为 true,则默认为折叠状态。
|
|
37
|
+
* @param {Function} [props.next] - 点击操作的自定义函数。如果提供,点击时将执行此函数,而不是切换折叠状态。
|
|
38
|
+
*
|
|
39
|
+
* @returns {ReactElement} 返回一个 React 元素,表示一个具有可折叠功能的容器。
|
|
40
|
+
*/
|
|
13
41
|
function _default(_ref) {
|
|
14
42
|
var children = _ref.children,
|
|
43
|
+
field = _ref.field,
|
|
15
44
|
label = _ref.label,
|
|
45
|
+
desc = _ref.desc,
|
|
16
46
|
_ref$defaultCollapsed = _ref.defaultCollapsed,
|
|
17
|
-
defaultCollapsed = _ref$defaultCollapsed === void 0 ? false : _ref$defaultCollapsed
|
|
47
|
+
defaultCollapsed = _ref$defaultCollapsed === void 0 ? false : _ref$defaultCollapsed,
|
|
48
|
+
next = _ref.next;
|
|
18
49
|
var _useState = (0, _react.useState)(defaultCollapsed),
|
|
19
50
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
20
51
|
collapsed = _useState2[0],
|
|
21
52
|
setCollapsed = _useState2[1];
|
|
22
|
-
var handleClick = function
|
|
23
|
-
|
|
24
|
-
|
|
53
|
+
var handleClick = (0, _ahooks.useMemoizedFn)(function () {
|
|
54
|
+
if (next) {
|
|
55
|
+
next();
|
|
56
|
+
} else {
|
|
57
|
+
setCollapsed(!collapsed);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var tip = (0, _ahooks.useCreation)(function () {
|
|
61
|
+
var str = void 0;
|
|
62
|
+
if (field) {
|
|
63
|
+
str = "\u5C5E\u6027\uFF1A".concat(field);
|
|
64
|
+
}
|
|
65
|
+
if (desc) {
|
|
66
|
+
str += "".concat(str ? ' | ' : '', "\u8BF4\u660E\uFF1A").concat(desc);
|
|
67
|
+
}
|
|
68
|
+
return str;
|
|
69
|
+
}, [field, desc]);
|
|
25
70
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
26
71
|
className: _collapse.default['lc-painter-components-collapse']
|
|
27
72
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
28
73
|
className: _collapse.default['head'],
|
|
29
74
|
onClick: handleClick
|
|
75
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
|
|
76
|
+
overlayStyle: {
|
|
77
|
+
fontSize: '12px'
|
|
78
|
+
},
|
|
79
|
+
title: tip,
|
|
80
|
+
getPopupContainer: function getPopupContainer() {
|
|
81
|
+
return document.getElementById('lc-design-workspace');
|
|
82
|
+
}
|
|
30
83
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
31
|
-
className: _collapse.default['label']
|
|
32
|
-
|
|
84
|
+
className: _collapse.default['label'],
|
|
85
|
+
style: {
|
|
86
|
+
cursor: desc ? 'help' : 'default'
|
|
87
|
+
}
|
|
88
|
+
}, label)), /*#__PURE__*/_react.default.createElement("span", {
|
|
33
89
|
className: _collapse.default['action']
|
|
34
|
-
}, /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
90
|
+
}, next ? /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
91
|
+
type: "right"
|
|
92
|
+
}) : /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
35
93
|
type: collapsed ? 'down' : 'up'
|
|
36
94
|
}))), !collapsed && /*#__PURE__*/_react.default.createElement("div", {
|
|
37
95
|
className: _collapse.default['body']
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = _default;
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _ahooks = require("ahooks");
|
|
15
|
+
var _PopConfirm = _interopRequireDefault(require("./PopConfirm"));
|
|
16
|
+
var _antd = require("luck-design/antd");
|
|
17
|
+
var _colorInput = _interopRequireDefault(require("../style/color-input.less"));
|
|
18
|
+
var _reactColor = require("react-color");
|
|
19
|
+
var _excluded = ["value", "onChange", "wrapperStyle"];
|
|
20
|
+
/**
|
|
21
|
+
* ColorInput 组件是一个集成颜色选择器的输入框组件,允许用户以 RGBA 或十六进制格式输入颜色值。
|
|
22
|
+
* 组件内部通过 PopConfirm 弹出一个 SketchPicker 颜色选择器,以提供一个直观的颜色选择界面。
|
|
23
|
+
* 用户输入的颜色值在内部转换为适当的格式,并通过 onChange 回调暴露给外部使用。
|
|
24
|
+
* 此组件还支持通过传入的 value 属性初始化颜色值,并响应其后续更改。
|
|
25
|
+
*
|
|
26
|
+
* @component
|
|
27
|
+
* @example
|
|
28
|
+
* const handleColorChange = (newColor) => {
|
|
29
|
+
* console.log('Selected color:', newColor);
|
|
30
|
+
* };
|
|
31
|
+
* <ColorInput
|
|
32
|
+
* value="rgba(255, 0, 0, 0.5)"
|
|
33
|
+
* onChange={handleColorChange}
|
|
34
|
+
* wrapperStyle={{ margin: '20px' }}
|
|
35
|
+
* />
|
|
36
|
+
*
|
|
37
|
+
* @param {Object} props - 组件的属性。
|
|
38
|
+
* @param {string} props.value - 初始化颜色值,支持 RGBA 字符串或十六进制格式。
|
|
39
|
+
* @param {Function} props.onChange - 当颜色值变更时触发的回调函数。传递新的颜色值作为参数。
|
|
40
|
+
* @param {Object} [props.wrapperStyle] - 自定义包装器 div 的样式对象。
|
|
41
|
+
* @param {Object} rest - 传递给 Input 组件的其他属性。
|
|
42
|
+
*
|
|
43
|
+
* @returns {ReactElement} 返回一个 React 元素,表示一个带有颜色选择器的输入框组件。
|
|
44
|
+
*/
|
|
45
|
+
function _default(_ref) {
|
|
46
|
+
var value = _ref.value,
|
|
47
|
+
onChange = _ref.onChange,
|
|
48
|
+
wrapperStyle = _ref.wrapperStyle,
|
|
49
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
50
|
+
var _useState = (0, _react.useState)(fromRGBA(value)),
|
|
51
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
52
|
+
color = _useState2[0],
|
|
53
|
+
setColor = _useState2[1];
|
|
54
|
+
var handleChange = function handleChange(color) {
|
|
55
|
+
changeColor(color.rgb);
|
|
56
|
+
};
|
|
57
|
+
var handleInputChange = function handleInputChange(e) {
|
|
58
|
+
changeColor(e.target.value);
|
|
59
|
+
};
|
|
60
|
+
var changeColor = function changeColor(value) {
|
|
61
|
+
if (onChange) onChange(toRGBA(value));
|
|
62
|
+
setColor(value);
|
|
63
|
+
};
|
|
64
|
+
(0, _ahooks.useUpdateEffect)(function () {
|
|
65
|
+
setColor(fromRGBA(value));
|
|
66
|
+
}, [value]);
|
|
67
|
+
var rgbaColor = toRGBA(color);
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
+
className: _colorInput.default['lc-painter-components-color-input'],
|
|
70
|
+
style: wrapperStyle
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement(_PopConfirm.default, {
|
|
72
|
+
placement: "top",
|
|
73
|
+
title: /*#__PURE__*/_react.default.createElement(_reactColor.SketchPicker, {
|
|
74
|
+
color: color !== null && color !== void 0 ? color : '#ffffff',
|
|
75
|
+
onChange: handleChange
|
|
76
|
+
})
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
+
className: _colorInput.default['color-input-wrap']
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Input, (0, _extends2.default)({
|
|
80
|
+
onChange: handleInputChange,
|
|
81
|
+
className: _colorInput.default['color-input'],
|
|
82
|
+
value: rgbaColor,
|
|
83
|
+
size: "small",
|
|
84
|
+
placeholder: "rgba(0,0,0,0)"
|
|
85
|
+
}, rest)), /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
className: "color-display",
|
|
87
|
+
style: {
|
|
88
|
+
backgroundColor: rgbaColor
|
|
89
|
+
}
|
|
90
|
+
}))));
|
|
91
|
+
}
|
|
92
|
+
function toRGBA(colorObj) {
|
|
93
|
+
// 首先检查 colorObj 是否为 null 或 undefined
|
|
94
|
+
if (colorObj === null || typeof colorObj === 'undefined') {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 检查是否为对象且包含 r, g, b, a 属性
|
|
99
|
+
if ((0, _typeof2.default)(colorObj) === 'object' && 'r' in colorObj && 'g' in colorObj && 'b' in colorObj && 'a' in colorObj) {
|
|
100
|
+
return "rgba(".concat(colorObj.r, ", ").concat(colorObj.g, ", ").concat(colorObj.b, ", ").concat(colorObj.a, ")");
|
|
101
|
+
} else if (typeof colorObj === 'string' && colorObj.startsWith('#')) {
|
|
102
|
+
// 如果是以#号开头的字符串,则直接返回该字符串
|
|
103
|
+
return colorObj;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 如果不符合上述任何一种情况,返回一个空字符串
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
function fromRGBA(rgbaString) {
|
|
110
|
+
if (rgbaString === null || typeof rgbaString === 'undefined') {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// 检查输入是否是有效的 rgba 字符串
|
|
115
|
+
var rgbaPattern = /rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)\)/;
|
|
116
|
+
var match = rgbaString.match(rgbaPattern);
|
|
117
|
+
if (match) {
|
|
118
|
+
// 如果匹配成功,则提取 rgba 值
|
|
119
|
+
return {
|
|
120
|
+
r: parseInt(match[1], 10),
|
|
121
|
+
g: parseInt(match[2], 10),
|
|
122
|
+
b: parseInt(match[3], 10),
|
|
123
|
+
a: parseFloat(match[4])
|
|
124
|
+
};
|
|
125
|
+
} else if (typeof rgbaString === 'string' && rgbaString.startsWith('#')) {
|
|
126
|
+
// 对于十六进制颜色字符串,直接返回原始字符串
|
|
127
|
+
return rgbaString;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// 如果不符合上述任何一种情况,返回 null
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
@@ -4,43 +4,44 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.ListEditorItem = exports.ListEditor = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _antd = require("luck-design/antd");
|
|
11
11
|
var _utils = require("@luck-design-biz/base/utils");
|
|
12
|
-
var
|
|
12
|
+
var _listEditor = _interopRequireDefault(require("../style/list-editor.less"));
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* 它提供了一个添加新标签项的操作按钮,并通过 children 属性接收一组
|
|
14
|
+
* ListEditor 是一个用于管理和展示一组可编辑标签项的容器组件。
|
|
15
|
+
* 它提供了一个添加新标签项的操作按钮,并通过 children 属性接收一组 ListEditorItem 组件。
|
|
16
16
|
*
|
|
17
17
|
* @param {Object} props - 组件接收的属性。
|
|
18
|
-
* @param {ReactNode} props.children -
|
|
18
|
+
* @param {ReactNode} props.children - ListEditorItem 组件的实例,表示可编辑的标签项。
|
|
19
19
|
* @param {Function} props.handleAdd - 一个回调函数,当用户点击添加按钮时被触发,用于添加新的标签项。
|
|
20
20
|
* @returns {ReactNode} 渲染一个带有操作按钮和标签项的容器。
|
|
21
21
|
*/
|
|
22
|
-
var
|
|
22
|
+
var ListEditor = exports.ListEditor = function ListEditor(_ref) {
|
|
23
23
|
var children = _ref.children,
|
|
24
|
+
addText = _ref.addText,
|
|
24
25
|
handleAdd = _ref.handleAdd;
|
|
25
26
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
-
className:
|
|
27
|
+
className: _listEditor.default['lc-painter-panel-section-components-listeditor']
|
|
27
28
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
28
|
-
className:
|
|
29
|
+
className: _listEditor.default['list-box']
|
|
29
30
|
}, children), /*#__PURE__*/_react.default.createElement("div", {
|
|
30
|
-
className:
|
|
31
|
+
className: _listEditor.default['list-actions']
|
|
31
32
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
-
className:
|
|
33
|
+
className: _listEditor.default['list-action'],
|
|
33
34
|
onClick: handleAdd
|
|
34
35
|
}, /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
35
36
|
type: "plus-circle"
|
|
36
|
-
}), ' ', (0, _utils.formatMessage)({
|
|
37
|
-
id: 'luckda.lowcode.painter.panel-section.components.
|
|
37
|
+
}), ' ', addText || (0, _utils.formatMessage)({
|
|
38
|
+
id: 'luckda.lowcode.painter.panel-section.components.listeditor.add',
|
|
38
39
|
label: '添加一项'
|
|
39
40
|
}))));
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
|
-
*
|
|
44
|
+
* ListEditorItem 是一个可编辑的标签项组件,用于在 ListEditor 容器内展示。
|
|
44
45
|
* 它支持拖拽排序,并可以通过左侧和右侧的插槽来自定义内容。
|
|
45
46
|
*
|
|
46
47
|
* @param {Object} props - 组件接收的属性。
|
|
@@ -56,7 +57,7 @@ var TabEditor = exports.TabEditor = function TabEditor(_ref) {
|
|
|
56
57
|
* @param {string} props.transition - 定义拖拽动画的CSS过渡属性。
|
|
57
58
|
* @returns {ReactNode} 渲染一个可编辑的标签项,支持拖拽排序。
|
|
58
59
|
*/
|
|
59
|
-
var
|
|
60
|
+
var ListEditorItem = exports.ListEditorItem = function ListEditorItem(_ref2) {
|
|
60
61
|
var item = _ref2.item,
|
|
61
62
|
left = _ref2.left,
|
|
62
63
|
right = _ref2.right,
|
|
@@ -70,13 +71,13 @@ var TabEditorItem = exports.TabEditorItem = function TabEditorItem(_ref2) {
|
|
|
70
71
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
71
72
|
ref: setNodeRef,
|
|
72
73
|
style: style,
|
|
73
|
-
className:
|
|
74
|
+
className: _listEditor.default['list-item']
|
|
74
75
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
-
className:
|
|
76
|
+
className: _listEditor.default['list-item-left']
|
|
76
77
|
}, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
77
78
|
ref: setActivatorNodeRef
|
|
78
79
|
}, attributes, listeners, {
|
|
79
|
-
className:
|
|
80
|
+
className: _listEditor.default['dragicon']
|
|
80
81
|
}), /*#__PURE__*/_react.default.createElement("svg", {
|
|
81
82
|
fill: "currentColor",
|
|
82
83
|
preserveAspectRatio: "xMidYMid meet",
|
|
@@ -89,6 +90,6 @@ var TabEditorItem = exports.TabEditorItem = function TabEditorItem(_ref2) {
|
|
|
89
90
|
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
90
91
|
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"
|
|
91
92
|
}))), left), /*#__PURE__*/_react.default.createElement("div", {
|
|
92
|
-
className:
|
|
93
|
+
className: _listEditor.default['list-item-right']
|
|
93
94
|
}, right));
|
|
94
95
|
};
|
|
@@ -10,43 +10,93 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _ahooks = require("ahooks");
|
|
13
14
|
var _numberInput = _interopRequireDefault(require("../style/number-input.less"));
|
|
14
15
|
var _antd = require("luck-design/antd");
|
|
15
|
-
var
|
|
16
|
+
var _lodash = require("lodash");
|
|
17
|
+
var _excluded = ["value", "options", "onChange", "defaultValue", "allowNull", "convertInt"];
|
|
18
|
+
/**
|
|
19
|
+
* NumberInput 组件是一个带单位选择的数字输入框组件,允许用户输入一个数值并从预定义的选项中选择一个单位。
|
|
20
|
+
* 它支持默认值、空值、自动类型转换以及自定义更改处理逻辑。
|
|
21
|
+
* 组件内部通过 Dropdown 组件提供一个单位的下拉选择菜单,并通过 InputNumber 接收数值输入。
|
|
22
|
+
* 该组件也支持将输入值转换为整数或保持为原始格式,并允许通过 options 定制可选单位。
|
|
23
|
+
*
|
|
24
|
+
* @component
|
|
25
|
+
* @example
|
|
26
|
+
* const options = [{ value: 'px', label: '像素' }, { value: '%', label: '百分比' }];
|
|
27
|
+
* <NumberInput
|
|
28
|
+
* value={100}
|
|
29
|
+
* options={options}
|
|
30
|
+
* onChange={(newValue) => console.log('New value:', newValue)}
|
|
31
|
+
* defaultValue={0}
|
|
32
|
+
* allowNull={true}
|
|
33
|
+
* convertInt={false}
|
|
34
|
+
* />
|
|
35
|
+
*
|
|
36
|
+
* @param {Object} props - 组件的属性。
|
|
37
|
+
* @param {number|string} props.value - 初始化输入框的值。
|
|
38
|
+
* @param {Object[]} props.options - 可选单位的数组,每个对象包含 value(单位的值)和 label(显示在下拉菜单中的标签)。
|
|
39
|
+
* @param {Function} props.onChange - 当输入值或单位改变时触发的回调函数。传递新的值作为参数。
|
|
40
|
+
* @param {number|string} [props.defaultValue] - 未指定 value 时的默认值。
|
|
41
|
+
* @param {boolean} [props.allowNull=true] - 是否允许空值。
|
|
42
|
+
* @param {boolean} [props.convertInt=false] - 是否将输入值转换为整数。
|
|
43
|
+
* @param {Object} rest - 传递给 InputNumber 组件的其他属性。
|
|
44
|
+
*
|
|
45
|
+
* @returns {ReactElement} 返回一个 React 元素,表示一个带单位选择的数字输入框组件。
|
|
46
|
+
*/
|
|
16
47
|
function _default(_ref) {
|
|
17
48
|
var value = _ref.value,
|
|
18
49
|
options = _ref.options,
|
|
19
50
|
onChange = _ref.onChange,
|
|
20
|
-
|
|
21
|
-
|
|
51
|
+
defaultValue = _ref.defaultValue,
|
|
52
|
+
_ref$allowNull = _ref.allowNull,
|
|
53
|
+
allowNull = _ref$allowNull === void 0 ? true : _ref$allowNull,
|
|
54
|
+
_ref$convertInt = _ref.convertInt,
|
|
55
|
+
convertInt = _ref$convertInt === void 0 ? false : _ref$convertInt,
|
|
22
56
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
23
|
-
var _useState = (0, _react.useState)(value),
|
|
57
|
+
var _useState = (0, _react.useState)(value !== null && value !== void 0 ? value : defaultValue),
|
|
24
58
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
25
59
|
val = _useState2[0],
|
|
26
60
|
setVal = _useState2[1];
|
|
27
|
-
|
|
28
|
-
(0, _react.useEffect)(function () {
|
|
61
|
+
(0, _ahooks.useUpdateEffect)(function () {
|
|
29
62
|
setVal(value);
|
|
30
63
|
}, [value]);
|
|
31
|
-
var _parseValue = parseValue(val),
|
|
64
|
+
var _parseValue = parseValue(val, options),
|
|
32
65
|
number = _parseValue.number,
|
|
33
66
|
unit = _parseValue.unit;
|
|
34
67
|
var handleSelect = function handleSelect(item) {
|
|
35
68
|
var newValue;
|
|
36
69
|
if (item.key == 'auto') newValue = item.key;else if (isNaN(number)) {
|
|
37
|
-
|
|
70
|
+
var defaultNumber = defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0;
|
|
71
|
+
if (isNaN(defaultNumber)) {
|
|
72
|
+
var match = defaultNumber.match(/[\d\.]+/);
|
|
73
|
+
defaultNumber = match ? parseFloat(match[0]) : 0;
|
|
74
|
+
}
|
|
75
|
+
newValue = defaultNumber + item.key;
|
|
38
76
|
} else {
|
|
39
77
|
newValue = number + item.key;
|
|
40
78
|
}
|
|
41
79
|
changeValue(newValue);
|
|
42
80
|
};
|
|
43
81
|
var handleChange = function handleChange(value) {
|
|
44
|
-
changeValue(value + (unit !== null && unit !== void 0 ? unit : options[0].value));
|
|
82
|
+
if (!(0, _lodash.isNil)(value)) changeValue(value + (unit !== null && unit !== void 0 ? unit : options[0].value));else changeValue(null);
|
|
45
83
|
};
|
|
46
84
|
var changeValue = function changeValue(value) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
85
|
+
// 分离需要数字前缀的值和不需要数字前缀的值(如auto)
|
|
86
|
+
var numericValues = options.filter(function (option) {
|
|
87
|
+
return option.value !== 'auto';
|
|
88
|
+
}).map(function (option) {
|
|
89
|
+
return option.value.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
90
|
+
}).join('|');
|
|
91
|
+
|
|
92
|
+
// 构建正则表达式
|
|
93
|
+
var regex = new RegExp("^(\\d*(?:".concat(numericValues, ")|auto)$"));
|
|
94
|
+
var isValid = regex.test(value);
|
|
95
|
+
if (isValid || allowNull && (value === '' || value == null)) {
|
|
96
|
+
// 如果value符合要求,执行以下代码
|
|
97
|
+
if (onChange) onChange(convertInt ? parseInt(value) : value);
|
|
98
|
+
setVal(value);
|
|
99
|
+
}
|
|
50
100
|
};
|
|
51
101
|
var optionName = options[0].label;
|
|
52
102
|
var menu = /*#__PURE__*/_react.default.createElement(_antd.Menu, {
|
|
@@ -71,13 +121,17 @@ function _default(_ref) {
|
|
|
71
121
|
className: _numberInput.default['num-option']
|
|
72
122
|
}, /*#__PURE__*/_react.default.createElement(_antd.Dropdown, {
|
|
73
123
|
overlay: menu,
|
|
74
|
-
value: unit
|
|
124
|
+
value: unit,
|
|
125
|
+
disabled: options.length === 1,
|
|
126
|
+
getPopupContainer: function getPopupContainer() {
|
|
127
|
+
return document.getElementById('lc-design-workspace');
|
|
128
|
+
}
|
|
75
129
|
}, /*#__PURE__*/_react.default.createElement("span", null, optionName)))));
|
|
76
130
|
}
|
|
77
131
|
|
|
78
132
|
// 解析value,分离数字和单位
|
|
79
|
-
var parseValue = function parseValue(value) {
|
|
80
|
-
if (
|
|
133
|
+
var parseValue = function parseValue(value, options) {
|
|
134
|
+
if (value === null || typeof value === 'undefined' || value === '') {
|
|
81
135
|
return {
|
|
82
136
|
number: null,
|
|
83
137
|
unit: null
|
|
@@ -90,7 +144,7 @@ var parseValue = function parseValue(value) {
|
|
|
90
144
|
if (result) {
|
|
91
145
|
return {
|
|
92
146
|
number: result[1],
|
|
93
|
-
unit: result[2] ? result[2] :
|
|
147
|
+
unit: result[2] ? result[2] : options[0].value // 如果有非数字字符,则返回该字符,否则返回默认单位的第一项
|
|
94
148
|
};
|
|
95
149
|
} else {
|
|
96
150
|
return {
|