@luck-design-biz/luckda 0.0.23 → 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/es/components/Builder/index.js +6 -4
- package/es/components/LdFormList/index.js +1 -4
- package/es/components/LdGrid/index.js +12 -3
- package/es/lowcode/constants/api-url.js +292 -1
- package/es/lowcode/constants/event-topics.js +14 -1
- package/es/lowcode/engine/factory/panel-item-factory/DynamicStrategy.js +60 -0
- package/es/lowcode/engine/factory/panel-item-factory/GroupStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/NumberStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/SegmentedStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +53 -0
- package/es/lowcode/engine/factory/panel-item-factory/Strategy.js +21 -0
- package/es/lowcode/engine/factory/panel-item-factory/StringStrategy.js +51 -0
- package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +42 -0
- package/es/lowcode/engine/factory/panel-item-factory/index.js +44 -0
- package/es/lowcode/engine/meta/box.props.default.json +12 -0
- package/es/lowcode/engine/meta/box.props.json +42 -0
- package/es/lowcode/engine/meta/button.props.default.json +15 -7
- package/es/lowcode/engine/meta/{components/button.json → button.props.json} +126 -103
- package/es/lowcode/engine/meta/cardlist.props.default.json +17 -9
- package/es/lowcode/engine/meta/{components/card-list.json → cardlist.props.json} +143 -142
- package/es/lowcode/engine/meta/components-list.json +127 -121
- package/es/lowcode/engine/meta/dialog.props.default.json +19 -0
- package/{lib/lowcode/engine/meta/components/modal.json → es/lowcode/engine/meta/dialog.props.json} +120 -119
- package/es/lowcode/engine/meta/drawer.props.default.json +17 -9
- package/{lib/lowcode/engine/meta/components/drawer.json → es/lowcode/engine/meta/drawer.props.json} +143 -142
- package/es/lowcode/engine/meta/form.props.default.json +12 -4
- package/{lib/lowcode/engine/meta/components/form.json → es/lowcode/engine/meta/form.props.json} +116 -115
- package/es/lowcode/engine/meta/iframe.props.default.json +10 -2
- package/es/lowcode/engine/meta/{components/iframe.json → iframe.props.json} +31 -30
- package/es/lowcode/engine/meta/image.props.default.json +15 -7
- package/es/lowcode/engine/meta/{components/image.json → image.props.json} +113 -112
- package/es/lowcode/engine/meta/imex.props.default.json +11 -3
- package/{lib/lowcode/engine/meta/components/imex.json → es/lowcode/engine/meta/imex.props.json} +81 -80
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +29 -0
- package/es/lowcode/engine/meta/jsx.props.default.json +10 -1
- package/es/lowcode/engine/meta/{components/jsx.json → jsx.props.json} +24 -23
- package/es/lowcode/engine/meta/layout.props.default.json +12 -4
- package/{lib/lowcode/engine/meta/components/layout.json → es/lowcode/engine/meta/layout.props.json} +107 -106
- package/es/lowcode/engine/meta/link.props.default.json +13 -5
- package/{lib/lowcode/engine/meta/components/link.json → es/lowcode/engine/meta/link.props.json} +111 -110
- package/es/lowcode/engine/meta/section.props.default.json +16 -8
- package/{lib/lowcode/engine/meta/components/section.json → es/lowcode/engine/meta/section.props.json} +107 -106
- package/es/lowcode/engine/meta/split.props.default.json +12 -4
- package/es/lowcode/engine/meta/{components/split.json → split.props.json} +71 -70
- package/es/lowcode/engine/meta/table.props.default.json +29 -9
- package/es/lowcode/engine/meta/table.props.json +236 -0
- package/es/lowcode/engine/meta/tabs.props.default.json +17 -9
- package/es/lowcode/engine/meta/{components/tabs.json → tabs.props.json} +140 -139
- package/es/lowcode/engine/meta/text.props.default.json +11 -3
- package/{lib/lowcode/engine/meta/components/text.json → es/lowcode/engine/meta/text.props.json} +65 -64
- package/es/lowcode/engine/meta/tree.props.default.json +16 -8
- package/es/lowcode/engine/meta/{components/tree.json → tree.props.json} +156 -155
- package/es/lowcode/engine/provider/ContextProvider.js +46 -41
- package/es/lowcode/engine/provider/EventBusProvider.js +2 -2
- package/es/lowcode/engine/tools/dataProcess.js +85 -8
- package/es/lowcode/engine/tools/helper.js +68 -0
- package/es/lowcode/engine/tools/usePromiseState.js +24 -0
- package/es/lowcode/index.js +3 -1
- package/es/lowcode/painter/Design.js +40 -85
- package/es/lowcode/painter/DesignOperator.js +271 -0
- package/es/lowcode/painter/DesignToolbar.js +91 -0
- package/es/lowcode/painter/I18n.js +202 -2
- package/es/lowcode/painter/Outline.js +63 -54
- package/es/lowcode/painter/Panel.js +239 -2
- package/es/lowcode/painter/Ribbon.js +61 -55
- package/es/lowcode/painter/components/Collapse.js +90 -0
- package/es/lowcode/painter/components/ColorInput.js +125 -0
- package/es/lowcode/painter/components/ListEditor.js +89 -0
- package/es/lowcode/painter/components/NumberInput.js +148 -0
- package/es/lowcode/painter/components/PanelItem.js +83 -11
- package/es/lowcode/painter/components/PopConfirm.js +23 -0
- package/es/lowcode/painter/components/PopForm.js +71 -0
- package/es/lowcode/painter/components/RuleInput.js +9 -7
- package/es/lowcode/painter/components/SortBox.js +92 -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 +96 -0
- package/es/lowcode/painter/components/code-editor/CssEditor.js +41 -0
- package/es/lowcode/painter/components/code-editor/FullScreenEditor.js +87 -0
- package/es/lowcode/painter/components/code-editor/JSEditor.js +106 -0
- package/es/lowcode/painter/components/code-editor/index.js +2 -0
- package/es/lowcode/painter/index.js +33 -3
- package/es/lowcode/painter/panel-section/ButtonType.js +39 -0
- package/es/lowcode/painter/panel-section/DataSetSelector.js +61 -0
- package/es/lowcode/painter/panel-section/Icon.js +48 -0
- package/es/lowcode/painter/panel-section/IconSelector.js +134 -0
- package/es/lowcode/painter/panel-section/LayoutRatio.js +57 -49
- 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 +296 -0
- package/es/lowcode/painter/panel-section/StylePanel/DisplaySvg.js +543 -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 +96 -0
- 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 +148 -0
- package/es/lowcode/painter/panel-section/StylePanel/StyleRow.js +16 -0
- package/es/lowcode/painter/panel-section/StylePanel/WidthHeight.js +51 -0
- package/es/lowcode/painter/panel-section/StylePanel/index.js +29 -0
- package/es/lowcode/painter/panel-section/TabItems.js +207 -0
- 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 +85 -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 +5 -0
- package/es/lowcode/painter/style/collapse.less +22 -0
- package/es/lowcode/painter/style/color-input.less +19 -0
- package/es/lowcode/painter/style/design.less +116 -5
- package/es/lowcode/painter/style/display.less +17 -0
- package/es/lowcode/painter/style/font-editor.less +9 -0
- package/es/lowcode/painter/style/fullscreen-editor.less +17 -0
- package/es/lowcode/painter/style/icon-selector.less +22 -0
- package/es/lowcode/painter/style/icon.less +11 -0
- package/es/lowcode/painter/style/index.less +0 -1
- package/es/lowcode/painter/style/layout-ratio.less +1 -1
- package/es/lowcode/painter/style/list-editor.less +59 -0
- package/es/lowcode/painter/style/number-input.less +17 -0
- package/es/lowcode/painter/style/outline.less +2 -0
- package/es/lowcode/painter/style/panel-item.less +45 -12
- package/es/lowcode/painter/style/panel.less +124 -0
- package/es/lowcode/painter/style/pop-confirm.less +10 -0
- package/es/lowcode/painter/style/pop-form.less +20 -0
- package/es/lowcode/painter/style/ribbon.less +1 -0
- package/es/lowcode/painter/style/style-panel.less +37 -0
- package/es/lowcode/painter/style/tabitems.less +90 -0
- package/es/lowcode/view/Canvas.js +79 -70
- package/es/lowcode/view/Page.js +10 -28
- package/es/lowcode/view/index.js +5 -6
- package/es/lowcode/view/lc-components/Box/FunctionDesign.js +20 -0
- package/es/lowcode/view/lc-components/Box/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Box/index.js +22 -5
- package/es/lowcode/view/lc-components/Box/index.less +15 -0
- package/es/lowcode/view/lc-components/Box/meta.json +42 -0
- package/es/lowcode/view/lc-components/Button/FunctionDesign.js +21 -0
- package/es/lowcode/view/lc-components/Button/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Button/index.js +75 -7
- package/es/lowcode/view/lc-components/Button/meta.json +127 -0
- package/es/lowcode/view/lc-components/Button/style.less +3 -0
- package/es/lowcode/view/lc-components/CardList/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/CardList/FunctionLive.js +9 -0
- package/{lib/lowcode/engine/meta/components/table.json → es/lowcode/view/lc-components/CardList/meta.json} +11 -28
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +54 -0
- package/es/lowcode/view/lc-components/Dialog/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Dialog/index.js +20 -11
- package/es/lowcode/view/lc-components/Dialog/index.less +1 -1
- package/es/lowcode/view/lc-components/Dialog/meta.json +121 -0
- package/es/lowcode/view/lc-components/Drawer/FunctionDesign.js +20 -0
- package/es/lowcode/view/lc-components/Drawer/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Drawer/index.js +22 -9
- package/es/lowcode/view/lc-components/Drawer/index.less +7 -0
- package/es/lowcode/view/lc-components/Drawer/meta.json +144 -0
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Form/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Form/meta.json +117 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Iframe/meta.json +32 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +82 -0
- package/es/lowcode/view/lc-components/Image/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Image/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Image/meta.json +114 -0
- package/es/lowcode/view/lc-components/JSX/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/JSX/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/JSX/meta.json +25 -0
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +75 -0
- package/es/lowcode/view/lc-components/Layout/FunctionLive.js +15 -0
- package/es/lowcode/view/lc-components/Layout/index.js +40 -7
- package/es/lowcode/view/lc-components/Layout/index.less +5 -0
- package/es/lowcode/view/lc-components/Layout/meta.json +108 -0
- package/es/lowcode/view/lc-components/Link/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Link/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Link/meta.json +112 -0
- package/es/lowcode/view/lc-components/Section/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Section/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Section/meta.json +108 -0
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Split/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Split/meta.json +72 -0
- package/es/lowcode/view/lc-components/Table/FunctionDesign.js +18 -0
- package/es/lowcode/view/lc-components/Table/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Table/index.js +229 -9
- package/es/lowcode/view/lc-components/Table/meta.json +225 -0
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Tabs/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Tabs/meta.json +141 -0
- package/es/lowcode/view/lc-components/Text/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Text/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Text/meta.json +66 -0
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +9 -0
- package/es/lowcode/view/lc-components/Tree/FunctionLive.js +9 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +157 -0
- package/es/lowcode/view/lc-components/Wrapper.js +32 -23
- package/es/lowcode/view/style/page.less +0 -1
- package/es/upload/Form/gridForm.js +1 -1
- package/es/utils/grid.js +4 -3
- package/lib/components/Builder/index.js +5 -3
- package/lib/components/LdFormList/index.js +1 -5
- package/lib/components/LdGrid/index.js +12 -3
- package/lib/lowcode/constants/api-url.js +294 -2
- package/lib/lowcode/constants/event-topics.js +15 -2
- package/lib/lowcode/engine/factory/panel-item-factory/DynamicStrategy.js +73 -0
- package/lib/lowcode/engine/factory/panel-item-factory/GroupStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/NumberStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SegmentedStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +59 -0
- package/lib/lowcode/engine/factory/panel-item-factory/Strategy.js +27 -0
- package/lib/lowcode/engine/factory/panel-item-factory/StringStrategy.js +57 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +48 -0
- package/lib/lowcode/engine/factory/panel-item-factory/index.js +50 -0
- package/lib/lowcode/engine/meta/box.props.default.json +12 -0
- package/lib/lowcode/engine/meta/box.props.json +42 -0
- package/lib/lowcode/engine/meta/button.props.default.json +15 -7
- package/lib/lowcode/engine/meta/{components/button.json → button.props.json} +126 -103
- package/lib/lowcode/engine/meta/cardlist.props.default.json +17 -9
- package/lib/lowcode/engine/meta/{components/card-list.json → cardlist.props.json} +143 -142
- package/lib/lowcode/engine/meta/components-list.json +127 -121
- package/lib/lowcode/engine/meta/dialog.props.default.json +19 -0
- package/{es/lowcode/engine/meta/components/modal.json → lib/lowcode/engine/meta/dialog.props.json} +120 -119
- package/lib/lowcode/engine/meta/drawer.props.default.json +17 -9
- package/{es/lowcode/engine/meta/components/drawer.json → lib/lowcode/engine/meta/drawer.props.json} +143 -142
- package/lib/lowcode/engine/meta/form.props.default.json +12 -4
- package/{es/lowcode/engine/meta/components/form.json → lib/lowcode/engine/meta/form.props.json} +116 -115
- package/lib/lowcode/engine/meta/iframe.props.default.json +10 -2
- package/lib/lowcode/engine/meta/{components/iframe.json → iframe.props.json} +31 -30
- package/lib/lowcode/engine/meta/image.props.default.json +15 -7
- package/lib/lowcode/engine/meta/{components/image.json → image.props.json} +113 -112
- package/lib/lowcode/engine/meta/imex.props.default.json +11 -3
- package/{es/lowcode/engine/meta/components/imex.json → lib/lowcode/engine/meta/imex.props.json} +81 -80
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +29 -0
- package/lib/lowcode/engine/meta/jsx.props.default.json +10 -1
- package/lib/lowcode/engine/meta/{components/jsx.json → jsx.props.json} +24 -23
- package/lib/lowcode/engine/meta/layout.props.default.json +12 -4
- package/{es/lowcode/engine/meta/components/layout.json → lib/lowcode/engine/meta/layout.props.json} +107 -106
- package/lib/lowcode/engine/meta/link.props.default.json +13 -5
- package/{es/lowcode/engine/meta/components/link.json → lib/lowcode/engine/meta/link.props.json} +111 -110
- package/lib/lowcode/engine/meta/section.props.default.json +16 -8
- package/{es/lowcode/engine/meta/components/section.json → lib/lowcode/engine/meta/section.props.json} +107 -106
- package/lib/lowcode/engine/meta/split.props.default.json +12 -4
- package/lib/lowcode/engine/meta/{components/split.json → split.props.json} +71 -70
- package/lib/lowcode/engine/meta/table.props.default.json +29 -9
- package/lib/lowcode/engine/meta/table.props.json +236 -0
- package/lib/lowcode/engine/meta/tabs.props.default.json +17 -9
- package/lib/lowcode/engine/meta/{components/tabs.json → tabs.props.json} +140 -139
- package/lib/lowcode/engine/meta/text.props.default.json +11 -3
- package/{es/lowcode/engine/meta/components/text.json → lib/lowcode/engine/meta/text.props.json} +65 -64
- package/lib/lowcode/engine/meta/tree.props.default.json +16 -8
- package/lib/lowcode/engine/meta/{components/tree.json → tree.props.json} +156 -155
- package/lib/lowcode/engine/provider/ContextProvider.js +46 -41
- package/lib/lowcode/engine/provider/EventBusProvider.js +2 -2
- package/lib/lowcode/engine/tools/dataProcess.js +86 -8
- package/lib/lowcode/engine/tools/helper.js +70 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +31 -0
- package/lib/lowcode/index.js +5 -1
- package/lib/lowcode/painter/Design.js +39 -84
- package/lib/lowcode/painter/DesignOperator.js +278 -0
- package/lib/lowcode/painter/DesignToolbar.js +99 -0
- package/lib/lowcode/painter/I18n.js +203 -2
- package/lib/lowcode/painter/Outline.js +62 -53
- package/lib/lowcode/painter/Panel.js +238 -1
- package/lib/lowcode/painter/Ribbon.js +63 -64
- package/lib/lowcode/painter/components/Collapse.js +97 -0
- package/lib/lowcode/painter/components/ColorInput.js +132 -0
- package/lib/lowcode/painter/components/ListEditor.js +95 -0
- package/lib/lowcode/painter/components/NumberInput.js +155 -0
- package/lib/lowcode/painter/components/PanelItem.js +84 -11
- package/lib/lowcode/painter/components/PopConfirm.js +29 -0
- package/lib/lowcode/painter/components/PopForm.js +77 -0
- package/lib/lowcode/painter/components/RuleInput.js +9 -7
- package/lib/lowcode/painter/components/SortBox.js +99 -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 +103 -0
- package/lib/lowcode/painter/components/code-editor/CssEditor.js +48 -0
- package/lib/lowcode/painter/components/code-editor/FullScreenEditor.js +94 -0
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +117 -0
- package/lib/lowcode/painter/components/code-editor/index.js +20 -0
- package/lib/lowcode/painter/index.js +35 -3
- package/lib/lowcode/painter/panel-section/ButtonType.js +46 -0
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +69 -0
- package/lib/lowcode/painter/panel-section/Icon.js +54 -0
- package/lib/lowcode/painter/panel-section/IconSelector.js +141 -0
- package/lib/lowcode/painter/panel-section/LayoutRatio.js +56 -48
- 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 +303 -0
- package/lib/lowcode/painter/panel-section/StylePanel/DisplaySvg.js +550 -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 +103 -0
- 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/Size.js +59 -0
- package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +159 -0
- package/lib/lowcode/painter/panel-section/StylePanel/StyleRow.js +22 -0
- package/lib/lowcode/painter/panel-section/StylePanel/WidthHeight.js +58 -0
- package/lib/lowcode/painter/panel-section/StylePanel/index.js +35 -0
- package/lib/lowcode/painter/panel-section/TabItems.js +215 -0
- 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 +95 -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 +5 -0
- package/lib/lowcode/painter/style/collapse.less +22 -0
- package/lib/lowcode/painter/style/color-input.less +19 -0
- package/lib/lowcode/painter/style/design.less +116 -5
- package/lib/lowcode/painter/style/display.less +17 -0
- package/lib/lowcode/painter/style/font-editor.less +9 -0
- package/lib/lowcode/painter/style/fullscreen-editor.less +17 -0
- package/lib/lowcode/painter/style/icon-selector.less +22 -0
- package/lib/lowcode/painter/style/icon.less +11 -0
- package/lib/lowcode/painter/style/index.less +0 -1
- package/lib/lowcode/painter/style/layout-ratio.less +1 -1
- package/lib/lowcode/painter/style/list-editor.less +59 -0
- package/lib/lowcode/painter/style/number-input.less +17 -0
- package/lib/lowcode/painter/style/outline.less +2 -0
- package/lib/lowcode/painter/style/panel-item.less +45 -12
- package/lib/lowcode/painter/style/panel.less +124 -0
- package/lib/lowcode/painter/style/pop-confirm.less +10 -0
- package/lib/lowcode/painter/style/pop-form.less +20 -0
- package/lib/lowcode/painter/style/ribbon.less +1 -0
- package/lib/lowcode/painter/style/style-panel.less +37 -0
- package/lib/lowcode/painter/style/tabitems.less +90 -0
- package/lib/lowcode/view/Canvas.js +84 -75
- package/lib/lowcode/view/Page.js +9 -27
- package/lib/lowcode/view/index.js +5 -6
- package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +27 -0
- package/lib/lowcode/view/lc-components/Box/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Box/index.js +23 -6
- package/lib/lowcode/view/lc-components/Box/index.less +15 -0
- package/lib/lowcode/view/lc-components/Box/meta.json +42 -0
- package/lib/lowcode/view/lc-components/Button/FunctionDesign.js +28 -0
- package/lib/lowcode/view/lc-components/Button/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Button/index.js +76 -8
- package/lib/lowcode/view/lc-components/Button/meta.json +127 -0
- package/lib/lowcode/view/lc-components/Button/style.less +3 -0
- package/lib/lowcode/view/lc-components/CardList/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/CardList/FunctionLive.js +16 -0
- package/{es/lowcode/engine/meta/components/table.json → lib/lowcode/view/lc-components/CardList/meta.json} +11 -28
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +62 -0
- package/lib/lowcode/view/lc-components/Dialog/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Dialog/index.js +20 -11
- package/lib/lowcode/view/lc-components/Dialog/index.less +1 -1
- package/lib/lowcode/view/lc-components/Dialog/meta.json +121 -0
- package/lib/lowcode/view/lc-components/Drawer/FunctionDesign.js +27 -0
- package/lib/lowcode/view/lc-components/Drawer/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Drawer/index.js +22 -9
- package/lib/lowcode/view/lc-components/Drawer/index.less +7 -0
- package/lib/lowcode/view/lc-components/Drawer/meta.json +144 -0
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Form/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Form/meta.json +117 -0
- package/lib/lowcode/view/lc-components/Iframe/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Iframe/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Iframe/meta.json +32 -0
- package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/ImEx/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/ImEx/meta.json +82 -0
- package/lib/lowcode/view/lc-components/Image/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Image/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Image/meta.json +114 -0
- package/lib/lowcode/view/lc-components/JSX/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/JSX/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/JSX/meta.json +25 -0
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +82 -0
- package/lib/lowcode/view/lc-components/Layout/FunctionLive.js +22 -0
- package/lib/lowcode/view/lc-components/Layout/index.js +41 -8
- package/lib/lowcode/view/lc-components/Layout/index.less +5 -0
- package/lib/lowcode/view/lc-components/Layout/meta.json +108 -0
- package/lib/lowcode/view/lc-components/Link/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Link/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Link/meta.json +112 -0
- package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Section/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Section/meta.json +108 -0
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Split/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Split/meta.json +72 -0
- package/lib/lowcode/view/lc-components/Table/FunctionDesign.js +25 -0
- package/lib/lowcode/view/lc-components/Table/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Table/index.js +228 -8
- package/lib/lowcode/view/lc-components/Table/meta.json +225 -0
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Tabs/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Tabs/meta.json +141 -0
- package/lib/lowcode/view/lc-components/Text/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Text/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Text/meta.json +66 -0
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +16 -0
- package/lib/lowcode/view/lc-components/Tree/FunctionLive.js +16 -0
- package/lib/lowcode/view/lc-components/Tree/meta.json +157 -0
- package/lib/lowcode/view/lc-components/Wrapper.js +30 -21
- package/lib/lowcode/view/style/page.less +0 -1
- package/lib/upload/Form/gridForm.js +1 -1
- package/lib/utils/grid.js +6 -5
- package/package.json +15 -6
- package/es/lowcode/engine/meta/modal.props.default.json +0 -11
- package/es/lowcode/engine/tools/lcid.js +0 -16
- package/es/lowcode/painter/panel-section/Radio.js +0 -58
- package/lib/lowcode/engine/meta/modal.props.default.json +0 -11
- package/lib/lowcode/engine/tools/lcid.js +0 -22
- package/lib/lowcode/painter/panel-section/Radio.js +0 -65
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Icon } from 'luck-design/antd';
|
|
4
|
+
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
5
|
+
import styles from "../style/list-editor.less";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ListEditor 是一个用于管理和展示一组可编辑标签项的容器组件。
|
|
9
|
+
* 它提供了一个添加新标签项的操作按钮,并通过 children 属性接收一组 ListEditorItem 组件。
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} props - 组件接收的属性。
|
|
12
|
+
* @param {ReactNode} props.children - ListEditorItem 组件的实例,表示可编辑的标签项。
|
|
13
|
+
* @param {Function} props.handleAdd - 一个回调函数,当用户点击添加按钮时被触发,用于添加新的标签项。
|
|
14
|
+
* @returns {ReactNode} 渲染一个带有操作按钮和标签项的容器。
|
|
15
|
+
*/
|
|
16
|
+
export var ListEditor = function ListEditor(_ref) {
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
addText = _ref.addText,
|
|
19
|
+
handleAdd = _ref.handleAdd;
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: styles['lc-painter-panel-section-components-listeditor']
|
|
22
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: styles['list-box']
|
|
24
|
+
}, children), /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: styles['list-actions']
|
|
26
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: styles['list-action'],
|
|
28
|
+
onClick: handleAdd
|
|
29
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
30
|
+
type: "plus-circle"
|
|
31
|
+
}), ' ', addText || formatMessage({
|
|
32
|
+
id: 'luckda.lowcode.painter.panel-section.components.listeditor.add',
|
|
33
|
+
label: '添加一项'
|
|
34
|
+
}))));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* ListEditorItem 是一个可编辑的标签项组件,用于在 ListEditor 容器内展示。
|
|
39
|
+
* 它支持拖拽排序,并可以通过左侧和右侧的插槽来自定义内容。
|
|
40
|
+
*
|
|
41
|
+
* @param {Object} props - 组件接收的属性。
|
|
42
|
+
* @param {Object} props.item - 表示标签项数据的对象。
|
|
43
|
+
* @param {ReactNode} props.left - 放置在标签项左侧的内容,通常用于展示标签名称或其他信息。
|
|
44
|
+
* @param {ReactNode} props.right - 放置在标签项右侧的内容,通常用于展示操作按钮如编辑或删除。
|
|
45
|
+
* @param {Function} props.setNodeRef - 用于设置拖拽组件根节点的引用。
|
|
46
|
+
* @param {Function} props.setActivatorNodeRef - 用于设置激活拖拽操作的节点引用。
|
|
47
|
+
* @param {Object} props.style - 应用于标签项的样式对象,通常包含拖拽过程中的动态变化样式。
|
|
48
|
+
* @param {Object} props.attributes - 包含与拖拽相关的HTML属性。
|
|
49
|
+
* @param {Object} props.listeners - 包含处理拖拽事件的监听器。
|
|
50
|
+
* @param {CSSProperties} props.transform - 应用于组件的CSS变换属性,用于实现拖拽效果。
|
|
51
|
+
* @param {string} props.transition - 定义拖拽动画的CSS过渡属性。
|
|
52
|
+
* @returns {ReactNode} 渲染一个可编辑的标签项,支持拖拽排序。
|
|
53
|
+
*/
|
|
54
|
+
export var ListEditorItem = function ListEditorItem(_ref2) {
|
|
55
|
+
var item = _ref2.item,
|
|
56
|
+
left = _ref2.left,
|
|
57
|
+
right = _ref2.right,
|
|
58
|
+
setNodeRef = _ref2.setNodeRef,
|
|
59
|
+
setActivatorNodeRef = _ref2.setActivatorNodeRef,
|
|
60
|
+
style = _ref2.style,
|
|
61
|
+
attributes = _ref2.attributes,
|
|
62
|
+
listeners = _ref2.listeners,
|
|
63
|
+
transform = _ref2.transform,
|
|
64
|
+
transition = _ref2.transition;
|
|
65
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
ref: setNodeRef,
|
|
67
|
+
style: style,
|
|
68
|
+
className: styles['list-item']
|
|
69
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: styles['list-item-left']
|
|
71
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
72
|
+
ref: setActivatorNodeRef
|
|
73
|
+
}, attributes, listeners, {
|
|
74
|
+
className: styles['dragicon']
|
|
75
|
+
}), /*#__PURE__*/React.createElement("svg", {
|
|
76
|
+
fill: "currentColor",
|
|
77
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
78
|
+
width: "16",
|
|
79
|
+
height: "12",
|
|
80
|
+
viewBox: "0 0 5 12",
|
|
81
|
+
style: {
|
|
82
|
+
verticalAlign: 'middle'
|
|
83
|
+
}
|
|
84
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
85
|
+
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"
|
|
86
|
+
}))), left), /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: styles['list-item-right']
|
|
88
|
+
}, right));
|
|
89
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
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 = ["value", "options", "onChange", "defaultValue", "allowNull", "convertInt"];
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
import { useUpdateEffect } from 'ahooks';
|
|
7
|
+
import styles from "../style/number-input.less";
|
|
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
|
+
*/
|
|
40
|
+
export default function (_ref) {
|
|
41
|
+
var value = _ref.value,
|
|
42
|
+
options = _ref.options,
|
|
43
|
+
onChange = _ref.onChange,
|
|
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,
|
|
49
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
var _useState = useState(value !== null && value !== void 0 ? value : defaultValue),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
val = _useState2[0],
|
|
53
|
+
setVal = _useState2[1];
|
|
54
|
+
useUpdateEffect(function () {
|
|
55
|
+
setVal(value);
|
|
56
|
+
}, [value]);
|
|
57
|
+
var _parseValue = parseValue(val, options),
|
|
58
|
+
number = _parseValue.number,
|
|
59
|
+
unit = _parseValue.unit;
|
|
60
|
+
var handleSelect = function handleSelect(item) {
|
|
61
|
+
var newValue;
|
|
62
|
+
if (item.key == 'auto') newValue = item.key;else if (isNaN(number)) {
|
|
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;
|
|
69
|
+
} else {
|
|
70
|
+
newValue = number + item.key;
|
|
71
|
+
}
|
|
72
|
+
changeValue(newValue);
|
|
73
|
+
};
|
|
74
|
+
var handleChange = function handleChange(value) {
|
|
75
|
+
if (!isNil(value)) changeValue(value + (unit !== null && unit !== void 0 ? unit : options[0].value));else changeValue(null);
|
|
76
|
+
};
|
|
77
|
+
var changeValue = function changeValue(value) {
|
|
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
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var optionName = options[0].label;
|
|
95
|
+
var menu = /*#__PURE__*/React.createElement(Menu, {
|
|
96
|
+
onClick: handleSelect
|
|
97
|
+
}, options.map(function (item) {
|
|
98
|
+
if (item.value == unit) optionName = item.label;
|
|
99
|
+
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
100
|
+
key: item.value
|
|
101
|
+
}, item.label);
|
|
102
|
+
}));
|
|
103
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
104
|
+
className: styles['lc-painter-panel-section-components-number-input']
|
|
105
|
+
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: styles['num-input-wrap']
|
|
107
|
+
}, /*#__PURE__*/React.createElement(InputNumber, _extends({
|
|
108
|
+
className: styles['num-input'],
|
|
109
|
+
size: "small"
|
|
110
|
+
}, rest, {
|
|
111
|
+
value: number,
|
|
112
|
+
onChange: handleChange
|
|
113
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: styles['num-option']
|
|
115
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
116
|
+
overlay: menu,
|
|
117
|
+
value: unit,
|
|
118
|
+
disabled: options.length === 1,
|
|
119
|
+
getPopupContainer: function getPopupContainer() {
|
|
120
|
+
return document.getElementById('lc-design-workspace');
|
|
121
|
+
}
|
|
122
|
+
}, /*#__PURE__*/React.createElement("span", null, optionName)))));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 解析value,分离数字和单位
|
|
126
|
+
var parseValue = function parseValue(value, options) {
|
|
127
|
+
if (value === null || typeof value === 'undefined' || value === '') {
|
|
128
|
+
return {
|
|
129
|
+
number: null,
|
|
130
|
+
unit: null
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
value = String(value);
|
|
134
|
+
|
|
135
|
+
// 调整正则表达式以匹配数字后跟任意非数字字符
|
|
136
|
+
var result = value.match(/^(\d+)(\D*)$/); // \D 匹配任意非数字字符
|
|
137
|
+
if (result) {
|
|
138
|
+
return {
|
|
139
|
+
number: result[1],
|
|
140
|
+
unit: result[2] ? result[2] : options[0].value // 如果有非数字字符,则返回该字符,否则返回默认单位的第一项
|
|
141
|
+
};
|
|
142
|
+
} else {
|
|
143
|
+
return {
|
|
144
|
+
number: value,
|
|
145
|
+
unit: value
|
|
146
|
+
}; // 当没有数字时,比如 "auto",这里的逻辑可能需要调整,因为你的描述有点矛盾
|
|
147
|
+
}
|
|
148
|
+
};
|
|
@@ -1,20 +1,92 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { useState, useEffect } from 'react';
|
|
4
|
+
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
5
|
+
import { Tooltip, Icon } from 'luck-design/antd';
|
|
6
|
+
import { startsWith } from 'lodash';
|
|
7
|
+
import classNames from 'classnames';
|
|
2
8
|
import styles from "../style/panel-item.less";
|
|
3
9
|
|
|
4
10
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
11
|
+
* `PanelItem` 组件用于展示属性面板中的单个属性项。
|
|
12
|
+
* 它支持展示一个标签(属性名称)及对应的组件(例如输入框、选择器等),并可通过传入的 `addon` 属性添加额外的内容。
|
|
13
|
+
* 此组件支持折叠功能,可以通过 `collapsed` 属性控制初始折叠状态。
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @example
|
|
17
|
+
* ```jsx
|
|
18
|
+
* <PanelItem
|
|
19
|
+
* label="属性名称"
|
|
20
|
+
* collapsed={false}
|
|
21
|
+
* addon={<div>额外内容</div>}
|
|
22
|
+
* >
|
|
23
|
+
* <input type="text" />
|
|
24
|
+
* </PanelItem>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param {Object} props 组件接收的参数。
|
|
28
|
+
* @param {string} props.label 显示的属性名称。如果标签以 `#` 开头,则不显示。
|
|
29
|
+
* @param {boolean} [props.collapsed=true] 初始是否折叠。默认为 `true`。
|
|
30
|
+
* @param {React.ReactNode} props.addon 当属性项展开时,可以在下方显示额外内容。
|
|
31
|
+
* @param {React.ReactNode} props.children 对应于属性名称的组件,可以是输入框、下拉菜单等 React 节点。
|
|
32
|
+
*
|
|
33
|
+
* @returns {React.Element} 渲染属性名称、对应的组件以及可选的额外内容。
|
|
9
34
|
*/
|
|
10
35
|
export default function (_ref) {
|
|
11
|
-
var
|
|
12
|
-
|
|
36
|
+
var field = _ref.field,
|
|
37
|
+
label = _ref.label,
|
|
38
|
+
desc = _ref.desc,
|
|
39
|
+
_ref$collapsed = _ref.collapsed,
|
|
40
|
+
collapsed = _ref$collapsed === void 0 ? true : _ref$collapsed,
|
|
41
|
+
addon = _ref.addon,
|
|
42
|
+
suppressPadding = _ref.suppressPadding,
|
|
43
|
+
children = _ref.children;
|
|
44
|
+
var _useState = useState(collapsed),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
curClps = _useState2[0],
|
|
47
|
+
setCurClps = _useState2[1];
|
|
48
|
+
var HandleClick = useMemoizedFn(function () {
|
|
49
|
+
if (!addon) return;
|
|
50
|
+
setCurClps(!curClps);
|
|
51
|
+
});
|
|
52
|
+
var tip = useCreation(function () {
|
|
53
|
+
var str = void 0;
|
|
54
|
+
if (field) {
|
|
55
|
+
str = "\u5C5E\u6027\uFF1A".concat(field);
|
|
56
|
+
}
|
|
57
|
+
if (desc) {
|
|
58
|
+
str += "".concat(str ? ' | ' : '', "\u8BF4\u660E\uFF1A").concat(desc);
|
|
59
|
+
}
|
|
60
|
+
return str;
|
|
61
|
+
}, [field, desc]);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
setCurClps(collapsed);
|
|
64
|
+
}, [collapsed]);
|
|
13
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
14
|
-
className: styles['lc-painter-components-panelitem']
|
|
66
|
+
className: classNames(styles['lc-painter-components-panelitem'], _defineProperty({}, styles['no-padding'], !!suppressPadding))
|
|
67
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: styles['panelrow']
|
|
69
|
+
}, label && !startsWith(label, '#') && /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: "".concat(styles['item-label']).concat(addon ? ' panel-pointer' : ''),
|
|
71
|
+
onClick: HandleClick
|
|
72
|
+
}, addon && /*#__PURE__*/React.createElement(Icon, {
|
|
73
|
+
className: styles['item-icon'],
|
|
74
|
+
type: !curClps ? 'down' : 'right'
|
|
75
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
76
|
+
overlayStyle: {
|
|
77
|
+
fontSize: '12px'
|
|
78
|
+
},
|
|
79
|
+
title: tip,
|
|
80
|
+
getPopupContainer: function getPopupContainer() {
|
|
81
|
+
return document.getElementById('lc-design-workspace');
|
|
82
|
+
}
|
|
15
83
|
}, /*#__PURE__*/React.createElement("span", {
|
|
16
|
-
|
|
17
|
-
|
|
84
|
+
style: desc ? {
|
|
85
|
+
cursor: 'help'
|
|
86
|
+
} : null
|
|
87
|
+
}, label))), /*#__PURE__*/React.createElement("span", {
|
|
18
88
|
className: styles['item-component']
|
|
19
|
-
},
|
|
89
|
+
}, children)), !curClps && addon && /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: styles['addon']
|
|
91
|
+
}, addon));
|
|
20
92
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Popconfirm } from 'luck-design/antd';
|
|
4
|
+
import styles from "../style/pop-confirm.less";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 这个组件是对 luck-design/antd 的 Popconfirm 组件的封装。
|
|
8
|
+
* 它提供了一个带有自定义样式的弹出确认框,用于在用户尝试执行重要操作前提示确认信息。
|
|
9
|
+
* 通过传入的 props 可以自定义 Popconfirm 组件的行为和外观。
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} props - 传递给 Popconfirm 组件的属性。这包括所有标准的 Popconfirm 属性,
|
|
12
|
+
* 以及任何额外的属性,如事件处理器或自定义内容。
|
|
13
|
+
* @returns {ReactNode} 返回一个配置了自定义样式和指定属性的 Popconfirm 组件实例。
|
|
14
|
+
*/
|
|
15
|
+
export default function (props) {
|
|
16
|
+
return /*#__PURE__*/React.createElement(Popconfirm, _extends({
|
|
17
|
+
overlayClassName: styles['lc-painter-panel-section-components-popconfirm'],
|
|
18
|
+
icon: null,
|
|
19
|
+
getPopupContainer: function getPopupContainer() {
|
|
20
|
+
return document.getElementById('lc-design-workspace');
|
|
21
|
+
}
|
|
22
|
+
}, props));
|
|
23
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"],
|
|
4
|
+
_excluded2 = ["children"],
|
|
5
|
+
_excluded3 = ["children"],
|
|
6
|
+
_excluded4 = ["children"];
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import styles from "../style/pop-form.less";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* PopForm 是一个为弹出式表单布局提供容器的组件,它使用特定的样式来组织表单内容。
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} props - 组件的 props。
|
|
14
|
+
* @param {ReactNode} props.children - 组件内包含的子元素。
|
|
15
|
+
* @param {Object} rest - 传递给组件的其余属性,这些属性将直接传递给根 div 元素。
|
|
16
|
+
*/
|
|
17
|
+
export var PopForm = function PopForm(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
21
|
+
className: styles['lc-painter-panel-section-components-popform']
|
|
22
|
+
}, rest), children);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* PopFormItem 是 PopForm 组件的一个子项,用于包装表单的每个独立字段。
|
|
27
|
+
* 它提供了一致的布局和样式封装,用于表单项的展示。
|
|
28
|
+
*
|
|
29
|
+
* @param {Object} props - 组件的 props。
|
|
30
|
+
* @param {ReactNode} props.children - 组件内包含的子元素。
|
|
31
|
+
* @param {Object} rest - 传递给组件的其余属性,这些属性将直接传递给根 div 元素。
|
|
32
|
+
*/
|
|
33
|
+
export var PopFormItem = function PopFormItem(_ref2) {
|
|
34
|
+
var children = _ref2.children,
|
|
35
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
37
|
+
className: styles['item']
|
|
38
|
+
}, rest), children);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* PopFormItemLeft 是 PopFormItem 的子组件,用于展示表单项的标签或标题部分。
|
|
43
|
+
* 它通常用于放置字段名或说明性文本。
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} props - 组件的 props。
|
|
46
|
+
* @param {ReactNode} props.children - 组件内包含的子元素。
|
|
47
|
+
* @param {Object} rest - 传递给组件的其余属性,这些属性将直接传递给根 div 元素。
|
|
48
|
+
*/
|
|
49
|
+
export var PopFormItemLeft = function PopFormItemLeft(_ref3) {
|
|
50
|
+
var children = _ref3.children,
|
|
51
|
+
rest = _objectWithoutProperties(_ref3, _excluded3);
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
53
|
+
className: styles['left']
|
|
54
|
+
}, rest), children);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* PopFormItemRight 是 PopFormItem 的子组件,用于包含表单项的输入字段。
|
|
59
|
+
* 它是表单项布局中用于用户输入的部分,可以容纳各种类型的输入控件。
|
|
60
|
+
*
|
|
61
|
+
* @param {Object} props - 组件的 props。
|
|
62
|
+
* @param {ReactNode} props.children - 组件内包含的子元素。
|
|
63
|
+
* @param {Object} rest - 传递给组件的其余属性,这些属性将直接传递给根 div 元素。
|
|
64
|
+
*/
|
|
65
|
+
export var PopFormItemRight = function PopFormItemRight(_ref4) {
|
|
66
|
+
var children = _ref4.children,
|
|
67
|
+
rest = _objectWithoutProperties(_ref4, _excluded4);
|
|
68
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
69
|
+
className: styles['right']
|
|
70
|
+
}, rest), children);
|
|
71
|
+
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
3
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["onValueChange", "rules", "value"];
|
|
6
|
+
var _excluded = ["onValueChange", "rules", "value", "defaultValue"];
|
|
6
7
|
import React, { forwardRef, useState, useEffect } from 'react';
|
|
8
|
+
import { useUpdateEffect } from 'ahooks';
|
|
7
9
|
import { Input, Tooltip } from 'luck-design/antd';
|
|
10
|
+
import classNames from 'classnames';
|
|
8
11
|
import styles from "../style/rule-input.less";
|
|
9
12
|
|
|
10
13
|
/**
|
|
@@ -42,8 +45,9 @@ export default /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
42
45
|
var onValueChange = _ref.onValueChange,
|
|
43
46
|
rules = _ref.rules,
|
|
44
47
|
value = _ref.value,
|
|
48
|
+
defaultValue = _ref.defaultValue,
|
|
45
49
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
-
var _useState = useState(value),
|
|
50
|
+
var _useState = useState(value || defaultValue),
|
|
47
51
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
52
|
inputValue = _useState2[0],
|
|
49
53
|
setInputValue = _useState2[1]; // 托管输入值的状态
|
|
@@ -53,7 +57,7 @@ export default /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
53
57
|
setErr = _useState4[1];
|
|
54
58
|
|
|
55
59
|
// 使用useEffect钩子监听value的变化
|
|
56
|
-
|
|
60
|
+
useUpdateEffect(function () {
|
|
57
61
|
setInputValue(value);
|
|
58
62
|
setErr(null);
|
|
59
63
|
}, [value]);
|
|
@@ -85,16 +89,14 @@ export default /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
85
89
|
onValueChange(e, value);
|
|
86
90
|
} else {
|
|
87
91
|
setErr(error);
|
|
88
|
-
console.
|
|
92
|
+
console.error(error);
|
|
89
93
|
}
|
|
90
94
|
};
|
|
91
|
-
var className = styles['lc-painter-components-ruleinput'];
|
|
92
|
-
if (err) className += ' ' + styles['err'];
|
|
93
95
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
94
96
|
title: err,
|
|
95
97
|
visible: err
|
|
96
98
|
}, /*#__PURE__*/React.createElement(Input, _extends({
|
|
97
|
-
className:
|
|
99
|
+
className: classNames(styles['lc-painter-components-ruleinput'], _defineProperty({}, styles.err, !!err)),
|
|
98
100
|
size: "small",
|
|
99
101
|
value: inputValue // 绑定输入值
|
|
100
102
|
,
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { DndContext } from '@dnd-kit/core';
|
|
4
|
+
import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
5
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* SortBox 是一个使用 dnd-kit 实现拖拽排序的组件。
|
|
9
|
+
* 它允许子元素通过拖拽操作来重新排序,并在排序操作完成后通过 onChange 回调传递新的排序结果。
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} props 组件的 props。
|
|
12
|
+
* @param {Array} props.datas 初始排序的数据数组,通常包含用于排序的唯一标识符。
|
|
13
|
+
* @param {ReactNode} props.children 组件的子元素,通常是需要进行排序的元素集合。
|
|
14
|
+
* @param {Function} props.onChange 当排序操作完成时触发的回调函数,参数为重新排序后的数据数组。
|
|
15
|
+
* @param {Function} [props.strategy=verticalListSortingStrategy] 用于排序的策略。默认为垂直列表排序策略。
|
|
16
|
+
*
|
|
17
|
+
* @returns {ReactNode} 返回一个配置了 DndContext 和 SortableContext 的 React 组件结构。
|
|
18
|
+
*/
|
|
19
|
+
export var SortBox = function SortBox(_ref) {
|
|
20
|
+
var datas = _ref.datas,
|
|
21
|
+
children = _ref.children,
|
|
22
|
+
onChange = _ref.onChange,
|
|
23
|
+
strategy = _ref.strategy;
|
|
24
|
+
var _useState = useState(datas),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
items = _useState2[0],
|
|
27
|
+
setItems = _useState2[1];
|
|
28
|
+
var sortStrategy = strategy !== null && strategy !== void 0 ? strategy : verticalListSortingStrategy;
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
setItems(datas);
|
|
31
|
+
}, [datas]);
|
|
32
|
+
function handleDragEnd(event) {
|
|
33
|
+
var active = event.active,
|
|
34
|
+
over = event.over;
|
|
35
|
+
if (active.id !== over.id) {
|
|
36
|
+
setItems(function (items) {
|
|
37
|
+
var oldIndex = items.indexOf(active.id);
|
|
38
|
+
var newIndex = items.indexOf(over.id);
|
|
39
|
+
var newSortItem = arrayMove(items, oldIndex, newIndex);
|
|
40
|
+
if (onChange) onChange(newSortItem);
|
|
41
|
+
return newSortItem;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return /*#__PURE__*/React.createElement(DndContext, {
|
|
46
|
+
onDragEnd: handleDragEnd
|
|
47
|
+
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
48
|
+
strategy: sortStrategy,
|
|
49
|
+
items: items
|
|
50
|
+
}, children));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* SortItem 组件是一个使用 dnd-kit 实现的可排序项。它通过 useSortable 钩子来提供拖拽功能,
|
|
55
|
+
* 并将必要的属性和监听器传递给其子元素,使得子元素可拖拽。
|
|
56
|
+
*
|
|
57
|
+
* @param {Object} props - 组件的 props。
|
|
58
|
+
* @param {string} props.id - 该排序项的唯一标识符,用于识别不同的可排序元素。
|
|
59
|
+
* @param {ReactNode} props.children - 该组件的子元素。通常是你希望使之可拖拽的元素。
|
|
60
|
+
* SortItem 会将拖拽相关的 props 注入到这个子元素中。
|
|
61
|
+
*
|
|
62
|
+
* @returns {ReactNode} 返回一个增强后的 React 元素,此元素集成了拖拽功能。
|
|
63
|
+
* 它基于原 children 元素,附加了用于拖拽的属性和样式。
|
|
64
|
+
*/
|
|
65
|
+
export var SortItem = function SortItem(_ref2) {
|
|
66
|
+
var id = _ref2.id,
|
|
67
|
+
children = _ref2.children;
|
|
68
|
+
var _useSortable = useSortable({
|
|
69
|
+
id: id
|
|
70
|
+
}),
|
|
71
|
+
attributes = _useSortable.attributes,
|
|
72
|
+
listeners = _useSortable.listeners,
|
|
73
|
+
setNodeRef = _useSortable.setNodeRef,
|
|
74
|
+
transform = _useSortable.transform,
|
|
75
|
+
transition = _useSortable.transition,
|
|
76
|
+
setActivatorNodeRef = _useSortable.setActivatorNodeRef;
|
|
77
|
+
var style = {
|
|
78
|
+
transform: CSS.Transform.toString(transform),
|
|
79
|
+
transition: transition
|
|
80
|
+
};
|
|
81
|
+
var childWithProps = /*#__PURE__*/React.cloneElement(children, {
|
|
82
|
+
key: id,
|
|
83
|
+
attributes: attributes,
|
|
84
|
+
listeners: listeners,
|
|
85
|
+
setNodeRef: setNodeRef,
|
|
86
|
+
transform: transform,
|
|
87
|
+
transition: transition,
|
|
88
|
+
setActivatorNodeRef: setActivatorNodeRef,
|
|
89
|
+
style: style
|
|
90
|
+
});
|
|
91
|
+
return childWithProps;
|
|
92
|
+
};
|