@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
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
+
var _excluded = ["type", "key", "name", "desc", "default", "props", "wrapper", "wrapperProps", "next", "repositioning"];
|
|
6
|
+
import React, { useRef, useEffect } from 'react';
|
|
7
|
+
import { useBoolean, useCreation, useMemoizedFn } from 'ahooks';
|
|
8
|
+
import { Drawer, Icon } from 'luck-design/antd';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import { startsWith, isNil } from 'lodash';
|
|
11
|
+
import { useLDContext } from "../../engine/provider/ContextProvider";
|
|
12
|
+
import PanelItemFactory from "../../engine/factory/panel-item-factory";
|
|
13
|
+
import PanelItem from "./PanelItem";
|
|
14
|
+
import Collapse from "./Collapse";
|
|
15
|
+
import styles from "../style/panel-attrs.less";
|
|
16
|
+
var AttrsPanel = function AttrsPanel(_ref) {
|
|
17
|
+
var _nextRef$current2, _nextRef$current3;
|
|
18
|
+
var meta = _ref.meta,
|
|
19
|
+
value = _ref.value,
|
|
20
|
+
onChange = _ref.onChange;
|
|
21
|
+
var nextRef = useRef(null);
|
|
22
|
+
var factory = useRef(new PanelItemFactory());
|
|
23
|
+
var _useBoolean = useBoolean(false),
|
|
24
|
+
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
25
|
+
open = _useBoolean2[0],
|
|
26
|
+
_useBoolean2$ = _useBoolean2[1],
|
|
27
|
+
setTrue = _useBoolean2$.setTrue,
|
|
28
|
+
setFalse = _useBoolean2$.setFalse;
|
|
29
|
+
var context = useLDContext();
|
|
30
|
+
var handleChange = useMemoizedFn(function (field, val, repositioning) {
|
|
31
|
+
var _nextRef$current;
|
|
32
|
+
onChange(field, val, repositioning);
|
|
33
|
+
if ((_nextRef$current = nextRef.current) !== null && _nextRef$current !== void 0 && _nextRef$current.autoClose) {
|
|
34
|
+
setFalse();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var goNext = useMemoizedFn(function (_next) {
|
|
38
|
+
if (!_next) return;
|
|
39
|
+
nextRef.current = {
|
|
40
|
+
name: _next.name,
|
|
41
|
+
autoClose: _next.autoClose,
|
|
42
|
+
NextComp: renderPanelItems(_next.props)
|
|
43
|
+
};
|
|
44
|
+
setTrue();
|
|
45
|
+
});
|
|
46
|
+
var renderPanelItems = useMemoizedFn(function (items) {
|
|
47
|
+
return items.map(function (_ref2) {
|
|
48
|
+
var type = _ref2.type,
|
|
49
|
+
key = _ref2.key,
|
|
50
|
+
name = _ref2.name,
|
|
51
|
+
desc = _ref2.desc,
|
|
52
|
+
defaultValue = _ref2.default,
|
|
53
|
+
props = _ref2.props,
|
|
54
|
+
wrapper = _ref2.wrapper,
|
|
55
|
+
wrapperProps = _ref2.wrapperProps,
|
|
56
|
+
_next2 = _ref2.next,
|
|
57
|
+
repositioning = _ref2.repositioning,
|
|
58
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
59
|
+
var Comp = factory.current.getPanelItemFor(startsWith(type, '_') ? 'dynamic' : type, type);
|
|
60
|
+
if (type === 'group') {
|
|
61
|
+
return /*#__PURE__*/React.createElement(Comp, {
|
|
62
|
+
key: key,
|
|
63
|
+
field: key,
|
|
64
|
+
label: name,
|
|
65
|
+
next: _next2 ? function () {
|
|
66
|
+
return goNext(_next2);
|
|
67
|
+
} : null,
|
|
68
|
+
defaultCollapsed: defaultValue,
|
|
69
|
+
desc: desc
|
|
70
|
+
}, renderPanelItems(props || []));
|
|
71
|
+
}
|
|
72
|
+
var _context$componentMap = context.componentMap.get(value.id).api.getSelfAndParentLCData(),
|
|
73
|
+
node = _context$componentMap.node;
|
|
74
|
+
var Wrapper = wrapper === 'collapse' ? Collapse : PanelItem;
|
|
75
|
+
return /*#__PURE__*/React.createElement(Wrapper, _extends({
|
|
76
|
+
key: key,
|
|
77
|
+
field: key,
|
|
78
|
+
label: name,
|
|
79
|
+
desc: desc
|
|
80
|
+
}, wrapperProps), Comp && /*#__PURE__*/React.createElement(Comp, _extends({
|
|
81
|
+
defaultValue: isNil(node.props[key]) ? defaultValue : node.props[key],
|
|
82
|
+
next: function next() {
|
|
83
|
+
return goNext(_next2);
|
|
84
|
+
},
|
|
85
|
+
onChange: function onChange(val) {
|
|
86
|
+
return handleChange(key, val, repositioning);
|
|
87
|
+
},
|
|
88
|
+
size: "small",
|
|
89
|
+
settings: node.props
|
|
90
|
+
}, rest)));
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
var PropsComps = useCreation(function () {
|
|
94
|
+
setFalse();
|
|
95
|
+
if (!meta) {
|
|
96
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
97
|
+
}
|
|
98
|
+
return renderPanelItems(meta.props);
|
|
99
|
+
}, [value]);
|
|
100
|
+
useEffect(function () {
|
|
101
|
+
if (!open) {
|
|
102
|
+
nextRef.current = null;
|
|
103
|
+
}
|
|
104
|
+
}, [open]);
|
|
105
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: classNames(styles['lc-painter-panel-attrs'], _defineProperty(_defineProperty({}, styles.hidden, !value), styles.showNext, open))
|
|
107
|
+
}, PropsComps, /*#__PURE__*/React.createElement(Drawer, {
|
|
108
|
+
visible: open,
|
|
109
|
+
width: 320,
|
|
110
|
+
mask: false,
|
|
111
|
+
closable: false,
|
|
112
|
+
getContainer: false,
|
|
113
|
+
destroyOnClose: true,
|
|
114
|
+
style: {
|
|
115
|
+
position: 'absolute'
|
|
116
|
+
},
|
|
117
|
+
bodyStyle: {
|
|
118
|
+
padding: 0,
|
|
119
|
+
height: '100%'
|
|
120
|
+
}
|
|
121
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
122
|
+
className: styles['lc-painter-panel-attrs-next']
|
|
123
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
124
|
+
className: styles['lc-painter-panel-attrs-next-header'],
|
|
125
|
+
onClick: setFalse
|
|
126
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
127
|
+
type: "left"
|
|
128
|
+
}), (_nextRef$current2 = nextRef.current) === null || _nextRef$current2 === void 0 ? void 0 : _nextRef$current2.name, /*#__PURE__*/React.createElement(Icon, {
|
|
129
|
+
type: "close"
|
|
130
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: styles['lc-painter-panel-attrs-next-body']
|
|
132
|
+
}, (_nextRef$current3 = nextRef.current) === null || _nextRef$current3 === void 0 ? void 0 : _nextRef$current3.NextComp))));
|
|
133
|
+
};
|
|
134
|
+
export default AttrsPanel;
|
|
@@ -1,31 +1,95 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
+
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
3
4
|
import styles from "../style/collapse.less";
|
|
4
|
-
import { Icon } from 'luck-design/antd';
|
|
5
|
+
import { Icon, Tooltip } from 'luck-design/antd';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Collapse 组件是一个可折叠区域的实现,用于显示或隐藏内容。它支持自定义标签、描述以及默认的折叠状态。
|
|
9
|
+
* 该组件还可以通过 `next` 函数来自定义点击操作,而不是简单地切换折叠状态。
|
|
10
|
+
* 提供的工具提示可以显示额外信息,如字段名和描述,以帮助用户更好地理解折叠内容的作用。
|
|
11
|
+
*
|
|
12
|
+
* @component
|
|
13
|
+
* @example
|
|
14
|
+
* <Collapse
|
|
15
|
+
* field="exampleField"
|
|
16
|
+
* label="示例标签"
|
|
17
|
+
* desc="这是一个用于演示的折叠组件"
|
|
18
|
+
* defaultCollapsed={true}
|
|
19
|
+
* next={() => console.log('Custom next function executed')}
|
|
20
|
+
* >
|
|
21
|
+
* <p>这里是可折叠的内容</p>
|
|
22
|
+
* </Collapse>
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} props - 组件的属性。
|
|
25
|
+
* @param {React.ReactNode} children - 折叠区域展开时显示的内容。
|
|
26
|
+
* @param {string} [props.field] - 与折叠内容相关联的字段名。
|
|
27
|
+
* @param {string} props.label - 折叠区域的标签名称。
|
|
28
|
+
* @param {string} [props.desc] - 关于折叠内容的描述信息。
|
|
29
|
+
* @param {boolean} [props.defaultCollapsed=false] - 折叠区域的默认状态。如果为 true,则默认为折叠状态。
|
|
30
|
+
* @param {Function} [props.next] - 点击操作的自定义函数。如果提供,点击时将执行此函数,而不是切换折叠状态。
|
|
31
|
+
*
|
|
32
|
+
* @returns {ReactElement} 返回一个 React 元素,表示一个具有可折叠功能的容器。
|
|
33
|
+
*/
|
|
5
34
|
export default function (_ref) {
|
|
6
35
|
var children = _ref.children,
|
|
36
|
+
field = _ref.field,
|
|
7
37
|
label = _ref.label,
|
|
38
|
+
desc = _ref.desc,
|
|
8
39
|
_ref$defaultCollapsed = _ref.defaultCollapsed,
|
|
9
|
-
defaultCollapsed = _ref$defaultCollapsed === void 0 ? false : _ref$defaultCollapsed
|
|
40
|
+
defaultCollapsed = _ref$defaultCollapsed === void 0 ? false : _ref$defaultCollapsed,
|
|
41
|
+
next = _ref.next,
|
|
42
|
+
suppressIcon = _ref.suppressIcon,
|
|
43
|
+
style = _ref.style,
|
|
44
|
+
bodyStyle = _ref.bodyStyle;
|
|
10
45
|
var _useState = useState(defaultCollapsed),
|
|
11
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12
47
|
collapsed = _useState2[0],
|
|
13
48
|
setCollapsed = _useState2[1];
|
|
14
|
-
var handleClick = function
|
|
15
|
-
|
|
16
|
-
|
|
49
|
+
var handleClick = useMemoizedFn(function () {
|
|
50
|
+
if (next) {
|
|
51
|
+
next();
|
|
52
|
+
} else {
|
|
53
|
+
setCollapsed(!collapsed);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var tip = useCreation(function () {
|
|
57
|
+
var str = void 0;
|
|
58
|
+
if (field) {
|
|
59
|
+
str = "\u5C5E\u6027\uFF1A".concat(field);
|
|
60
|
+
}
|
|
61
|
+
if (desc) {
|
|
62
|
+
str += "".concat(str ? ' | ' : '', "\u8BF4\u660E\uFF1A").concat(desc);
|
|
63
|
+
}
|
|
64
|
+
return str;
|
|
65
|
+
}, [field, desc]);
|
|
17
66
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
-
className: styles['lc-painter-components-collapse']
|
|
67
|
+
className: styles['lc-painter-components-collapse'],
|
|
68
|
+
style: style
|
|
19
69
|
}, /*#__PURE__*/React.createElement("div", {
|
|
20
70
|
className: styles['head'],
|
|
21
71
|
onClick: handleClick
|
|
72
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
73
|
+
overlayStyle: {
|
|
74
|
+
fontSize: '12px'
|
|
75
|
+
},
|
|
76
|
+
title: tip,
|
|
77
|
+
getPopupContainer: function getPopupContainer() {
|
|
78
|
+
return document.getElementById('lc-design-workspace');
|
|
79
|
+
}
|
|
22
80
|
}, /*#__PURE__*/React.createElement("span", {
|
|
23
|
-
className: styles['label']
|
|
24
|
-
|
|
81
|
+
className: styles['label'],
|
|
82
|
+
style: {
|
|
83
|
+
cursor: desc ? 'help' : 'default'
|
|
84
|
+
}
|
|
85
|
+
}, label)), !suppressIcon && /*#__PURE__*/React.createElement("span", {
|
|
25
86
|
className: styles['action']
|
|
26
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
87
|
+
}, next ? /*#__PURE__*/React.createElement(Icon, {
|
|
88
|
+
type: "right"
|
|
89
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
27
90
|
type: collapsed ? 'down' : 'up'
|
|
28
91
|
}))), !collapsed && /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
className: styles['body']
|
|
92
|
+
className: styles['body'],
|
|
93
|
+
style: bodyStyle
|
|
30
94
|
}, children));
|
|
31
95
|
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["value", "onChange", "wrapperStyle"];
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import { useUpdateEffect } from 'ahooks';
|
|
8
|
+
import PopConfirm from "./PopConfirm";
|
|
9
|
+
import { Input } from 'luck-design/antd';
|
|
10
|
+
import styles from "../style/color-input.less";
|
|
11
|
+
import { SketchPicker } from 'react-color';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* ColorInput 组件是一个集成颜色选择器的输入框组件,允许用户以 RGBA 或十六进制格式输入颜色值。
|
|
15
|
+
* 组件内部通过 PopConfirm 弹出一个 SketchPicker 颜色选择器,以提供一个直观的颜色选择界面。
|
|
16
|
+
* 用户输入的颜色值在内部转换为适当的格式,并通过 onChange 回调暴露给外部使用。
|
|
17
|
+
* 此组件还支持通过传入的 value 属性初始化颜色值,并响应其后续更改。
|
|
18
|
+
*
|
|
19
|
+
* @component
|
|
20
|
+
* @example
|
|
21
|
+
* const handleColorChange = (newColor) => {
|
|
22
|
+
* console.log('Selected color:', newColor);
|
|
23
|
+
* };
|
|
24
|
+
* <ColorInput
|
|
25
|
+
* value="rgba(255, 0, 0, 0.5)"
|
|
26
|
+
* onChange={handleColorChange}
|
|
27
|
+
* wrapperStyle={{ margin: '20px' }}
|
|
28
|
+
* />
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} props - 组件的属性。
|
|
31
|
+
* @param {string} props.value - 初始化颜色值,支持 RGBA 字符串或十六进制格式。
|
|
32
|
+
* @param {Function} props.onChange - 当颜色值变更时触发的回调函数。传递新的颜色值作为参数。
|
|
33
|
+
* @param {Object} [props.wrapperStyle] - 自定义包装器 div 的样式对象。
|
|
34
|
+
* @param {Object} rest - 传递给 Input 组件的其他属性。
|
|
35
|
+
*
|
|
36
|
+
* @returns {ReactElement} 返回一个 React 元素,表示一个带有颜色选择器的输入框组件。
|
|
37
|
+
*/
|
|
38
|
+
export default function (_ref) {
|
|
39
|
+
var value = _ref.value,
|
|
40
|
+
onChange = _ref.onChange,
|
|
41
|
+
wrapperStyle = _ref.wrapperStyle,
|
|
42
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
+
var _useState = useState(fromRGBA(value)),
|
|
44
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
+
color = _useState2[0],
|
|
46
|
+
setColor = _useState2[1];
|
|
47
|
+
var handleChange = function handleChange(color) {
|
|
48
|
+
changeColor(color.rgb);
|
|
49
|
+
};
|
|
50
|
+
var handleInputChange = function handleInputChange(e) {
|
|
51
|
+
changeColor(e.target.value);
|
|
52
|
+
};
|
|
53
|
+
var changeColor = function changeColor(value) {
|
|
54
|
+
if (onChange) onChange(toRGBA(value));
|
|
55
|
+
setColor(value);
|
|
56
|
+
};
|
|
57
|
+
useUpdateEffect(function () {
|
|
58
|
+
setColor(fromRGBA(value));
|
|
59
|
+
}, [value]);
|
|
60
|
+
var rgbaColor = toRGBA(color);
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: styles['lc-painter-components-color-input'],
|
|
63
|
+
style: wrapperStyle
|
|
64
|
+
}, /*#__PURE__*/React.createElement(PopConfirm, {
|
|
65
|
+
placement: "top",
|
|
66
|
+
title: /*#__PURE__*/React.createElement(SketchPicker, {
|
|
67
|
+
color: color !== null && color !== void 0 ? color : '#ffffff',
|
|
68
|
+
onChange: handleChange
|
|
69
|
+
})
|
|
70
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: styles['color-input-wrap']
|
|
72
|
+
}, /*#__PURE__*/React.createElement(Input, _extends({
|
|
73
|
+
onChange: handleInputChange,
|
|
74
|
+
className: styles['color-input'],
|
|
75
|
+
value: rgbaColor,
|
|
76
|
+
size: "small",
|
|
77
|
+
placeholder: "rgba(0,0,0,0)"
|
|
78
|
+
}, rest)), /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: "color-display",
|
|
80
|
+
style: {
|
|
81
|
+
backgroundColor: rgbaColor
|
|
82
|
+
}
|
|
83
|
+
}))));
|
|
84
|
+
}
|
|
85
|
+
function toRGBA(colorObj) {
|
|
86
|
+
// 首先检查 colorObj 是否为 null 或 undefined
|
|
87
|
+
if (colorObj === null || typeof colorObj === 'undefined') {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 检查是否为对象且包含 r, g, b, a 属性
|
|
92
|
+
if (_typeof(colorObj) === 'object' && 'r' in colorObj && 'g' in colorObj && 'b' in colorObj && 'a' in colorObj) {
|
|
93
|
+
return "rgba(".concat(colorObj.r, ", ").concat(colorObj.g, ", ").concat(colorObj.b, ", ").concat(colorObj.a, ")");
|
|
94
|
+
} else if (typeof colorObj === 'string' && colorObj.startsWith('#')) {
|
|
95
|
+
// 如果是以#号开头的字符串,则直接返回该字符串
|
|
96
|
+
return colorObj;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 如果不符合上述任何一种情况,返回一个空字符串
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
function fromRGBA(rgbaString) {
|
|
103
|
+
if (rgbaString === null || typeof rgbaString === 'undefined') {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 检查输入是否是有效的 rgba 字符串
|
|
108
|
+
var rgbaPattern = /rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)\)/;
|
|
109
|
+
var match = rgbaString.match(rgbaPattern);
|
|
110
|
+
if (match) {
|
|
111
|
+
// 如果匹配成功,则提取 rgba 值
|
|
112
|
+
return {
|
|
113
|
+
r: parseInt(match[1], 10),
|
|
114
|
+
g: parseInt(match[2], 10),
|
|
115
|
+
b: parseInt(match[3], 10),
|
|
116
|
+
a: parseFloat(match[4])
|
|
117
|
+
};
|
|
118
|
+
} else if (typeof rgbaString === 'string' && rgbaString.startsWith('#')) {
|
|
119
|
+
// 对于十六进制颜色字符串,直接返回原始字符串
|
|
120
|
+
return rgbaString;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// 如果不符合上述任何一种情况,返回 null
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["dsid", "defaultValue", "onChange"];
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
import { Select } from 'luck-design/antd';
|
|
7
|
+
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
8
|
+
var FieldSelector = function FieldSelector(_ref) {
|
|
9
|
+
var dsid = _ref.dsid,
|
|
10
|
+
defaultValue = _ref.defaultValue,
|
|
11
|
+
onChange = _ref.onChange,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
var _useState = useState([{
|
|
14
|
+
value: 'state',
|
|
15
|
+
label: '状态'
|
|
16
|
+
}, {
|
|
17
|
+
value: 'type',
|
|
18
|
+
label: '类型'
|
|
19
|
+
}, {
|
|
20
|
+
value: 'year',
|
|
21
|
+
label: '年份'
|
|
22
|
+
}, {
|
|
23
|
+
value: 'count',
|
|
24
|
+
label: '次数'
|
|
25
|
+
}]),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
options = _useState2[0],
|
|
28
|
+
setOptions = _useState2[1];
|
|
29
|
+
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
30
|
+
defaultValue: defaultValue,
|
|
31
|
+
onChange: onChange,
|
|
32
|
+
size: "small",
|
|
33
|
+
placeholder: formatMessage({
|
|
34
|
+
id: "luckda.lowcode.painter.panel-section.field-selector.placeholder",
|
|
35
|
+
label: '请选择字段'
|
|
36
|
+
})
|
|
37
|
+
}, props), options.map(function (opt) {
|
|
38
|
+
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
39
|
+
key: opt.value,
|
|
40
|
+
value: opt.value
|
|
41
|
+
}, opt.label);
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
export default FieldSelector;
|
|
@@ -2,39 +2,42 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Icon } from 'luck-design/antd';
|
|
4
4
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
5
|
-
import styles from "../style/
|
|
5
|
+
import styles from "../style/list-editor.less";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* 它提供了一个添加新标签项的操作按钮,并通过 children 属性接收一组
|
|
8
|
+
* ListEditor 是一个用于管理和展示一组可编辑标签项的容器组件。
|
|
9
|
+
* 它提供了一个添加新标签项的操作按钮,并通过 children 属性接收一组 ListEditorItem 组件。
|
|
10
10
|
*
|
|
11
11
|
* @param {Object} props - 组件接收的属性。
|
|
12
|
-
* @param {ReactNode} props.children -
|
|
12
|
+
* @param {ReactNode} props.children - ListEditorItem 组件的实例,表示可编辑的标签项。
|
|
13
13
|
* @param {Function} props.handleAdd - 一个回调函数,当用户点击添加按钮时被触发,用于添加新的标签项。
|
|
14
14
|
* @returns {ReactNode} 渲染一个带有操作按钮和标签项的容器。
|
|
15
15
|
*/
|
|
16
|
-
export var
|
|
16
|
+
export var ListEditor = function ListEditor(_ref) {
|
|
17
17
|
var children = _ref.children,
|
|
18
|
-
|
|
18
|
+
addText = _ref.addText,
|
|
19
|
+
handleAdd = _ref.handleAdd,
|
|
20
|
+
style = _ref.style;
|
|
19
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
className: styles['lc-painter-panel-section-components-
|
|
22
|
+
className: styles['lc-painter-panel-section-components-listeditor'],
|
|
23
|
+
style: style
|
|
21
24
|
}, /*#__PURE__*/React.createElement("div", {
|
|
22
|
-
className: styles['
|
|
25
|
+
className: styles['list-box']
|
|
23
26
|
}, children), /*#__PURE__*/React.createElement("div", {
|
|
24
|
-
className: styles['
|
|
27
|
+
className: styles['list-actions']
|
|
25
28
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26
|
-
className: styles['
|
|
29
|
+
className: styles['list-action'],
|
|
27
30
|
onClick: handleAdd
|
|
28
31
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
29
32
|
type: "plus-circle"
|
|
30
|
-
}), ' ', formatMessage({
|
|
31
|
-
id: 'luckda.lowcode.painter.panel-section.components.
|
|
33
|
+
}), ' ', addText || formatMessage({
|
|
34
|
+
id: 'luckda.lowcode.painter.panel-section.components.listeditor.add',
|
|
32
35
|
label: '添加一项'
|
|
33
36
|
}))));
|
|
34
37
|
};
|
|
35
38
|
|
|
36
39
|
/**
|
|
37
|
-
*
|
|
40
|
+
* ListEditorItem 是一个可编辑的标签项组件,用于在 ListEditor 容器内展示。
|
|
38
41
|
* 它支持拖拽排序,并可以通过左侧和右侧的插槽来自定义内容。
|
|
39
42
|
*
|
|
40
43
|
* @param {Object} props - 组件接收的属性。
|
|
@@ -50,7 +53,7 @@ export var TabEditor = function TabEditor(_ref) {
|
|
|
50
53
|
* @param {string} props.transition - 定义拖拽动画的CSS过渡属性。
|
|
51
54
|
* @returns {ReactNode} 渲染一个可编辑的标签项,支持拖拽排序。
|
|
52
55
|
*/
|
|
53
|
-
export var
|
|
56
|
+
export var ListEditorItem = function ListEditorItem(_ref2) {
|
|
54
57
|
var item = _ref2.item,
|
|
55
58
|
left = _ref2.left,
|
|
56
59
|
right = _ref2.right,
|
|
@@ -64,9 +67,9 @@ export var TabEditorItem = function TabEditorItem(_ref2) {
|
|
|
64
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
65
68
|
ref: setNodeRef,
|
|
66
69
|
style: style,
|
|
67
|
-
className: styles['
|
|
70
|
+
className: styles['list-item']
|
|
68
71
|
}, /*#__PURE__*/React.createElement("div", {
|
|
69
|
-
className: styles['
|
|
72
|
+
className: styles['list-item-left']
|
|
70
73
|
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
71
74
|
ref: setActivatorNodeRef
|
|
72
75
|
}, attributes, listeners, {
|
|
@@ -83,6 +86,6 @@ export var TabEditorItem = function TabEditorItem(_ref2) {
|
|
|
83
86
|
}, /*#__PURE__*/React.createElement("path", {
|
|
84
87
|
d: "M0.499972716,6 L1.50002728,6 C1.77615459,6 2,6.22384541 2,6.49997272 C2,6.77610002 1.77615459,6.99994543 1.50002728,6.99994543 L0.499972716,6.99994543 C0.22384541,6.99994543 3.38158422e-17,6.77610002 0,6.49997272 C-3.38158422e-17,6.22384541 0.22384541,6 0.499972716,6 Z M0.499972716,3 L1.50002728,3 C1.77615459,3 2,3.22384541 2,3.49997272 C2,3.77610002 1.77615459,3.99994543 1.50002728,3.99994543 L0.499972716,3.99994543 C0.22384541,3.99994543 3.38158422e-17,3.77610002 0,3.49997272 C-3.38158422e-17,3.22384541 0.22384541,3 0.499972716,3 Z M0.499972716,7.28787148e-18 L1.50002728,5.55666624e-14 C1.77615459,7.07214574e-14 2,0.22384541 2,0.499972716 C2,0.776100022 1.77615459,0.999945432 1.50002728,0.999945432 L0.499972716,0.999945432 C0.22384541,0.999945432 3.38158422e-17,0.776100022 0,0.499972716 C-3.38158422e-17,0.22384541 0.22384541,5.0723721e-17 0.499972716,0 Z M0.5,9.00002729 L1.5,9.00002729 C1.77614237,9.00002729 2,9.22388491 2,9.50002729 C2,9.77616966 1.77614237,10.0000273 1.5,10.0000273 L0.5,10.0000273 C0.223857625,10.0000273 3.38176876e-17,9.77616966 0,9.50002729 C-3.38176876e-17,9.22388491 0.223857625,9.00002729 0.5,9.00002729 Z M0.5,12.0000273 L1.5,12.0000273 C1.77614237,12.0000273 2,12.2238849 2,12.5000273 C2,12.7761697 1.77614237,13.0000273 1.5,13.0000273 L0.5,13.0000273 C0.223857625,13.0000273 3.38176876e-17,12.7761697 0,12.5000273 C-3.38176876e-17,12.2238849 0.223857625,12.0000273 0.5,12.0000273 Z M0.5,15.0000273 L1.5,15.0000273 C1.77614237,15.0000273 2,15.2238849 2,15.5000273 C2,15.7761697 1.77614237,16.0000273 1.5,16.0000273 L0.5,16.0000273 C0.223857625,16.0000273 3.38176876e-17,15.7761697 0,15.5000273 C-3.38176876e-17,15.2238849 0.223857625,15.0000273 0.5,15.0000273 Z M3.49997272,6 L4.50002728,6 C4.77615459,6 5,6.22384541 5,6.49997272 C5,6.77610002 4.77615459,6.99994543 4.50002728,6.99994543 L3.49997272,6.99994543 C3.22384541,6.99994543 3,6.77610002 3,6.49997272 C3,6.22384541 3.22384541,6 3.49997272,6 Z M3.49997272,3 L4.50002728,3 C4.77615459,3 5,3.22384541 5,3.49997272 C5,3.77610002 4.77615459,3.99994543 4.50002728,3.99994543 L3.49997272,3.99994543 C3.22384541,3.99994543 3,3.77610002 3,3.49997272 C3,3.22384541 3.22384541,3 3.49997272,3 Z M3.49997272,7.28787148e-18 L4.50002728,5.55666624e-14 C4.77615459,7.07214574e-14 5,0.22384541 5,0.499972716 C5,0.776100022 4.77615459,0.999945432 4.50002728,0.999945432 L3.49997272,0.999945432 C3.22384541,0.999945432 3,0.776100022 3,0.499972716 C3,0.22384541 3.22384541,5.0723721e-17 3.49997272,0 Z M3.5,9.00002729 L4.5,9.00002729 C4.77614237,9.00002729 5,9.22388491 5,9.50002729 C5,9.77616966 4.77614237,10.0000273 4.5,10.0000273 L3.5,10.0000273 C3.22385763,10.0000273 3,9.77616966 3,9.50002729 C3,9.22388491 3.22385763,9.00002729 3.5,9.00002729 Z M3.5,12.0000273 L4.5,12.0000273 C4.77614237,12.0000273 5,12.2238849 5,12.5000273 C5,12.7761697 4.77614237,13.0000273 4.5,13.0000273 L3.5,13.0000273 C3.22385763,13.0000273 3,12.7761697 3,12.5000273 C3,12.2238849 3.22385763,12.0000273 3.5,12.0000273 Z M3.5,15.0000273 L4.5,15.0000273 C4.77614237,15.0000273 5,15.2238849 5,15.5000273 C5,15.7761697 4.77614237,16.0000273 4.5,16.0000273 L3.5,16.0000273 C3.22385763,16.0000273 3,15.7761697 3,15.5000273 C3,15.2238849 3.22385763,15.0000273 3.5,15.0000273 Z"
|
|
85
88
|
}))), left), /*#__PURE__*/React.createElement("div", {
|
|
86
|
-
className: styles['
|
|
89
|
+
className: styles['list-item-right']
|
|
87
90
|
}, right));
|
|
88
91
|
};
|
|
@@ -1,44 +1,95 @@
|
|
|
1
1
|
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
|
-
var _excluded = ["value", "options", "onChange", "defaultValue"];
|
|
5
|
-
import React, { useState
|
|
4
|
+
var _excluded = ["value", "options", "onChange", "defaultValue", "allowNull", "convertInt"];
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
import { useUpdateEffect } from 'ahooks';
|
|
6
7
|
import styles from "../style/number-input.less";
|
|
7
8
|
import { InputNumber, Dropdown, Menu } from 'luck-design/antd';
|
|
9
|
+
import { isNil } from 'lodash';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* NumberInput 组件是一个带单位选择的数字输入框组件,允许用户输入一个数值并从预定义的选项中选择一个单位。
|
|
13
|
+
* 它支持默认值、空值、自动类型转换以及自定义更改处理逻辑。
|
|
14
|
+
* 组件内部通过 Dropdown 组件提供一个单位的下拉选择菜单,并通过 InputNumber 接收数值输入。
|
|
15
|
+
* 该组件也支持将输入值转换为整数或保持为原始格式,并允许通过 options 定制可选单位。
|
|
16
|
+
*
|
|
17
|
+
* @component
|
|
18
|
+
* @example
|
|
19
|
+
* const options = [{ value: 'px', label: '像素' }, { value: '%', label: '百分比' }];
|
|
20
|
+
* <NumberInput
|
|
21
|
+
* value={100}
|
|
22
|
+
* options={options}
|
|
23
|
+
* onChange={(newValue) => console.log('New value:', newValue)}
|
|
24
|
+
* defaultValue={0}
|
|
25
|
+
* allowNull={true}
|
|
26
|
+
* convertInt={false}
|
|
27
|
+
* />
|
|
28
|
+
*
|
|
29
|
+
* @param {Object} props - 组件的属性。
|
|
30
|
+
* @param {number|string} props.value - 初始化输入框的值。
|
|
31
|
+
* @param {Object[]} props.options - 可选单位的数组,每个对象包含 value(单位的值)和 label(显示在下拉菜单中的标签)。
|
|
32
|
+
* @param {Function} props.onChange - 当输入值或单位改变时触发的回调函数。传递新的值作为参数。
|
|
33
|
+
* @param {number|string} [props.defaultValue] - 未指定 value 时的默认值。
|
|
34
|
+
* @param {boolean} [props.allowNull=true] - 是否允许空值。
|
|
35
|
+
* @param {boolean} [props.convertInt=false] - 是否将输入值转换为整数。
|
|
36
|
+
* @param {Object} rest - 传递给 InputNumber 组件的其他属性。
|
|
37
|
+
*
|
|
38
|
+
* @returns {ReactElement} 返回一个 React 元素,表示一个带单位选择的数字输入框组件。
|
|
39
|
+
*/
|
|
8
40
|
export default function (_ref) {
|
|
9
41
|
var value = _ref.value,
|
|
10
42
|
options = _ref.options,
|
|
11
43
|
onChange = _ref.onChange,
|
|
12
|
-
|
|
13
|
-
|
|
44
|
+
defaultValue = _ref.defaultValue,
|
|
45
|
+
_ref$allowNull = _ref.allowNull,
|
|
46
|
+
allowNull = _ref$allowNull === void 0 ? true : _ref$allowNull,
|
|
47
|
+
_ref$convertInt = _ref.convertInt,
|
|
48
|
+
convertInt = _ref$convertInt === void 0 ? false : _ref$convertInt,
|
|
14
49
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
-
var _useState = useState(value),
|
|
50
|
+
var _useState = useState(value !== null && value !== void 0 ? value : defaultValue),
|
|
16
51
|
_useState2 = _slicedToArray(_useState, 2),
|
|
17
52
|
val = _useState2[0],
|
|
18
53
|
setVal = _useState2[1];
|
|
19
|
-
|
|
20
|
-
useEffect(function () {
|
|
54
|
+
useUpdateEffect(function () {
|
|
21
55
|
setVal(value);
|
|
22
56
|
}, [value]);
|
|
23
|
-
var _parseValue = parseValue(val),
|
|
57
|
+
var _parseValue = parseValue(val, options),
|
|
24
58
|
number = _parseValue.number,
|
|
25
59
|
unit = _parseValue.unit;
|
|
26
60
|
var handleSelect = function handleSelect(item) {
|
|
27
61
|
var newValue;
|
|
28
62
|
if (item.key == 'auto') newValue = item.key;else if (isNaN(number)) {
|
|
29
|
-
|
|
63
|
+
var defaultNumber = defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0;
|
|
64
|
+
if (isNaN(defaultNumber)) {
|
|
65
|
+
var match = defaultNumber.match(/[\d\.]+/);
|
|
66
|
+
defaultNumber = match ? parseFloat(match[0]) : 0;
|
|
67
|
+
}
|
|
68
|
+
newValue = defaultNumber + item.key;
|
|
30
69
|
} else {
|
|
31
70
|
newValue = number + item.key;
|
|
32
71
|
}
|
|
33
72
|
changeValue(newValue);
|
|
34
73
|
};
|
|
35
74
|
var handleChange = function handleChange(value) {
|
|
36
|
-
changeValue(value + (unit !== null && unit !== void 0 ? unit : options[0].value));
|
|
75
|
+
if (!isNil(value)) changeValue(value + (unit !== null && unit !== void 0 ? unit : options[0].value));else changeValue(null);
|
|
37
76
|
};
|
|
38
77
|
var changeValue = function changeValue(value) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
78
|
+
// 分离需要数字前缀的值和不需要数字前缀的值(如auto)
|
|
79
|
+
var numericValues = options.filter(function (option) {
|
|
80
|
+
return option.value !== 'auto';
|
|
81
|
+
}).map(function (option) {
|
|
82
|
+
return option.value.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
83
|
+
}).join('|');
|
|
84
|
+
|
|
85
|
+
// 构建正则表达式
|
|
86
|
+
var regex = new RegExp("^(\\d*(?:".concat(numericValues, ")|auto)$"));
|
|
87
|
+
var isValid = regex.test(value);
|
|
88
|
+
if (isValid || allowNull && (value === '' || value == null)) {
|
|
89
|
+
// 如果value符合要求,执行以下代码
|
|
90
|
+
if (onChange) onChange(convertInt ? parseInt(value) : value);
|
|
91
|
+
setVal(value);
|
|
92
|
+
}
|
|
42
93
|
};
|
|
43
94
|
var optionName = options[0].label;
|
|
44
95
|
var menu = /*#__PURE__*/React.createElement(Menu, {
|
|
@@ -63,13 +114,17 @@ export default function (_ref) {
|
|
|
63
114
|
className: styles['num-option']
|
|
64
115
|
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
65
116
|
overlay: menu,
|
|
66
|
-
value: unit
|
|
117
|
+
value: unit,
|
|
118
|
+
disabled: options.length === 1,
|
|
119
|
+
getPopupContainer: function getPopupContainer() {
|
|
120
|
+
return document.getElementById('lc-design-workspace');
|
|
121
|
+
}
|
|
67
122
|
}, /*#__PURE__*/React.createElement("span", null, optionName)))));
|
|
68
123
|
}
|
|
69
124
|
|
|
70
125
|
// 解析value,分离数字和单位
|
|
71
|
-
var parseValue = function parseValue(value) {
|
|
72
|
-
if (
|
|
126
|
+
var parseValue = function parseValue(value, options) {
|
|
127
|
+
if (value === null || typeof value === 'undefined' || value === '') {
|
|
73
128
|
return {
|
|
74
129
|
number: null,
|
|
75
130
|
unit: null
|
|
@@ -82,7 +137,7 @@ var parseValue = function parseValue(value) {
|
|
|
82
137
|
if (result) {
|
|
83
138
|
return {
|
|
84
139
|
number: result[1],
|
|
85
|
-
unit: result[2] ? result[2] :
|
|
140
|
+
unit: result[2] ? result[2] : options[0].value // 如果有非数字字符,则返回该字符,否则返回默认单位的第一项
|
|
86
141
|
};
|
|
87
142
|
} else {
|
|
88
143
|
return {
|