@luck-design-biz/luckda 1.0.2-13 → 1.0.2-14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +40 -40
- package/es/components/Builder/index.js +13 -10
- package/es/components/LDActions/index.less +70 -70
- package/es/components/LdAutoForm/index.js +5 -4
- package/es/components/LdCom/index.js +3 -2
- package/es/components/LdFormList/index.js +4 -3
- package/es/components/LdGrid/index.js +4 -4
- package/es/components/LdGridForm/index.js +5 -4
- package/es/components/LdGridForm/index.less +7 -7
- package/es/components/LdTree/index.less +42 -42
- package/es/helper/FromItems.js +64 -5
- package/es/helper/action.js +6 -6
- package/es/helper/form.js +14 -14
- package/es/helper/index.less +7 -7
- package/es/helper/ldBuilder.js +5 -4
- package/es/helper/ldComBuild.js +16 -11
- package/es/locales/zh-CN.js +41 -5
- package/es/lowcode/constants/api-url.js +309 -261
- package/es/lowcode/constants/event-topics.js +2 -0
- package/es/lowcode/constants/index.js +5 -4
- package/es/lowcode/engine/meta/components-list.json +12 -6
- package/es/lowcode/engine/meta/fielddate.props.default.json +1 -0
- package/es/lowcode/engine/meta/fielddate.props.json +48 -0
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +35 -30
- package/es/lowcode/engine/meta/proxy.props.default.json +15 -0
- package/es/lowcode/engine/meta/proxy.props.json +66 -0
- package/es/lowcode/engine/provider/ContextProvider/index.js +87 -49
- package/es/lowcode/engine/provider/ContextProvider/usePageDataStore.js +49 -43
- package/es/lowcode/engine/provider/ContextProvider/usePageVar.js +11 -5
- package/es/lowcode/engine/provider/ContextProvider/useTodo.js +2 -4
- package/es/lowcode/engine/provider/EventBusProvider.js +14 -4
- package/es/lowcode/engine/provider/PageProxyProvider.js +95 -0
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +10 -12
- package/es/lowcode/engine/tools/dataProcess.js +76 -76
- package/es/lowcode/engine/tools/helper.js +25 -1
- package/es/lowcode/engine/tools/initDS.js +4 -4
- package/es/lowcode/painter/Components.js +2 -2
- package/es/lowcode/painter/Design.js +1 -0
- package/es/lowcode/painter/DesignOperator.js +129 -27
- package/es/lowcode/painter/DesignToolbar.js +88 -173
- package/es/lowcode/painter/components/AdvancePanel.js +28 -10
- package/es/lowcode/painter/components/Collapse.js +26 -26
- package/es/lowcode/painter/components/ColorInput.js +24 -24
- package/es/lowcode/painter/components/ListEditor.js +24 -24
- package/es/lowcode/painter/components/NumberInput.js +28 -28
- package/es/lowcode/painter/components/PanelItem.js +24 -24
- package/es/lowcode/painter/components/PopConfirm.js +8 -8
- package/es/lowcode/painter/components/PopForm.js +27 -27
- package/es/lowcode/painter/components/RuleInput.js +30 -30
- package/es/lowcode/painter/components/SortBox.js +22 -22
- package/es/lowcode/painter/components/TipIcon.js +12 -4
- package/es/lowcode/painter/components/TreeEditor.js +10 -10
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +32 -32
- package/es/lowcode/painter/components/code-editor/CssEditor.js +25 -25
- package/es/lowcode/painter/components/code-editor/FullScreenEditor.js +23 -23
- package/es/lowcode/painter/components/code-editor/JSEditor.js +20 -20
- package/es/lowcode/painter/components/code-editor/JsonEditor.js +25 -25
- package/es/lowcode/painter/components/field-setting/SettingUI.js +56 -4
- package/es/lowcode/painter/components/field-setting/index.js +24 -1
- package/es/lowcode/painter/components/shortcut-modal/KeyIcon.js +11 -0
- package/es/lowcode/painter/components/shortcut-modal/index.js +208 -0
- package/es/lowcode/painter/panel-section/BlockEditor/index.js +10 -19
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +4 -1
- package/es/lowcode/painter/panel-section/ConditionCheck.js +0 -1
- package/es/lowcode/painter/panel-section/DataSetSelector.js +6 -3
- package/es/lowcode/painter/panel-section/FieldsSetting.js +1 -1
- package/es/lowcode/painter/panel-section/Icon.js +23 -23
- package/es/lowcode/painter/panel-section/IconConditionSelector.js +2 -1
- package/es/lowcode/painter/panel-section/IconSelector.js +16 -16
- package/es/lowcode/painter/panel-section/JSEditor/ToolBar.js +7 -4
- package/es/lowcode/painter/panel-section/JSEditor/index.js +15 -5
- package/es/lowcode/painter/panel-section/JSEditor/index.less +4 -0
- package/es/lowcode/painter/panel-section/LayoutRatio.js +21 -21
- package/es/lowcode/painter/panel-section/ProxyLinker.js +137 -0
- package/es/lowcode/painter/panel-section/ProxyParams.js +28 -0
- package/es/lowcode/painter/panel-section/ProxyParamsSetter.js +240 -0
- package/es/lowcode/painter/panel-section/StylePanel/BackGround.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/Border.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/BorderRadius.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/BorderRadiusSelector.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/BorderSelector.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/Display.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/Font.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/FontEditor.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/GapSelector.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/HighLightPanel.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/HighLigthtSpan.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/HightLightSvg.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/Margin.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/Opacity.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/Padding.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/Pointer.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/Shadow.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/Size.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/StyleContext.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/StyleRow.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/WidthHeight.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/index.js +15 -15
- package/es/lowcode/painter/style/action-bind-modal.less +104 -104
- package/es/lowcode/painter/style/actions-editor.less +15 -15
- package/es/lowcode/painter/style/border-editor.less +36 -36
- package/es/lowcode/painter/style/border-radius-selector.less +42 -42
- package/es/lowcode/painter/style/border-selector.less +39 -39
- package/es/lowcode/painter/style/button-type.less +5 -5
- package/es/lowcode/painter/style/collapse.less +28 -28
- package/es/lowcode/painter/style/color-input.less +19 -19
- package/es/lowcode/painter/style/components.less +91 -91
- package/es/lowcode/painter/style/design.less +178 -178
- package/es/lowcode/painter/style/display.less +17 -17
- package/es/lowcode/painter/style/dragdrop.less +56 -56
- package/es/lowcode/painter/style/fields-setting.less +25 -25
- package/es/lowcode/painter/style/font-editor.less +9 -9
- package/es/lowcode/painter/style/fullscreen-editor.less +17 -17
- package/es/lowcode/painter/style/history.less +46 -46
- package/es/lowcode/painter/style/icon-selector.less +22 -22
- package/es/lowcode/painter/style/icon.less +10 -10
- package/es/lowcode/painter/style/impexp.less +7 -7
- package/es/lowcode/painter/style/index.less +6 -6
- package/es/lowcode/painter/style/layout-ratio.less +51 -51
- package/es/lowcode/painter/style/list-editor.less +97 -97
- package/es/lowcode/painter/style/number-input.less +19 -19
- package/es/lowcode/painter/style/outline.less +30 -30
- package/es/lowcode/painter/style/page-layout-display.less +27 -27
- package/es/lowcode/painter/style/page-vars.less +25 -25
- package/es/lowcode/painter/style/panel-attrs.less +47 -47
- package/es/lowcode/painter/style/panel-item.less +55 -54
- package/es/lowcode/painter/style/panel.less +100 -100
- package/es/lowcode/painter/style/pop-confirm.less +17 -17
- package/es/lowcode/painter/style/pop-form.less +19 -19
- package/es/lowcode/painter/style/radio.less +24 -24
- package/es/lowcode/painter/style/ribbon.less +7 -7
- package/es/lowcode/painter/style/rule-input.less +12 -12
- package/es/lowcode/painter/style/split-display.less +18 -18
- package/es/lowcode/painter/style/style-panel.less +37 -37
- package/es/lowcode/painter/style/tabitems.less +90 -90
- package/es/lowcode/painter/svg/code.svg +3 -3
- package/es/lowcode/painter/svg/expect.svg +9 -9
- package/es/lowcode/preview/DebugTool.js +78 -0
- package/es/lowcode/preview/DebugToolDetail.js +103 -0
- package/es/lowcode/preview/index.js +10 -17
- package/es/lowcode/preview/useDebugSettings.js +62 -0
- package/es/lowcode/view/Canvas.js +5 -1
- package/es/lowcode/view/Page.js +8 -3
- package/es/lowcode/view/lc-components/Box/index.js +4 -4
- package/es/lowcode/view/lc-components/Box/index.less +14 -14
- package/es/lowcode/view/lc-components/Box/meta.json +40 -40
- package/es/lowcode/view/lc-components/Button/index.js +33 -33
- package/es/lowcode/view/lc-components/Button/meta.json +127 -127
- package/es/lowcode/view/lc-components/Button/style.less +2 -2
- package/es/lowcode/view/lc-components/CardList/index.js +126 -123
- package/es/lowcode/view/lc-components/CardList/meta.json +332 -332
- package/es/lowcode/view/lc-components/Dialog/index.js +14 -13
- package/es/lowcode/view/lc-components/Dialog/index.less +12 -12
- package/es/lowcode/view/lc-components/Dialog/meta.json +224 -224
- package/es/lowcode/view/lc-components/Drawer/index.js +15 -13
- package/es/lowcode/view/lc-components/Drawer/index.less +13 -13
- package/es/lowcode/view/lc-components/Drawer/meta.json +242 -242
- package/es/lowcode/view/lc-components/FieldColor/meta.json +157 -157
- package/es/lowcode/view/lc-components/FieldComplex/meta.json +140 -140
- package/es/lowcode/view/lc-components/FieldDate/meta.json +188 -140
- package/es/lowcode/view/lc-components/FieldDict/meta.json +138 -138
- package/es/lowcode/view/lc-components/FieldEditor/meta.json +137 -137
- package/es/lowcode/view/lc-components/FieldGroup/meta.json +166 -166
- package/es/lowcode/view/lc-components/FieldNumber/meta.json +143 -143
- package/es/lowcode/view/lc-components/FieldRadio/meta.json +115 -115
- package/es/lowcode/view/lc-components/FieldRegion/meta.json +121 -121
- package/es/lowcode/view/lc-components/FieldSelect/meta.json +152 -152
- package/es/lowcode/view/lc-components/FieldString/meta.json +152 -152
- package/es/lowcode/view/lc-components/FieldSwitch/meta.json +125 -125
- package/es/lowcode/view/lc-components/FieldTextarea/meta.json +143 -143
- package/es/lowcode/view/lc-components/FieldUpload/meta.json +165 -165
- package/es/lowcode/view/lc-components/FieldUser/meta.json +176 -176
- package/es/lowcode/view/lc-components/FieldYear/meta.json +128 -128
- package/es/lowcode/view/lc-components/Form/index.js +23 -20
- package/es/lowcode/view/lc-components/Form/meta.json +629 -629
- package/es/lowcode/view/lc-components/GroupTree/index.js +23 -23
- package/es/lowcode/view/lc-components/GroupTree/index.less +11 -11
- package/es/lowcode/view/lc-components/GroupTree/meta.json +82 -82
- package/es/lowcode/view/lc-components/Iframe/meta.json +31 -31
- package/es/lowcode/view/lc-components/ImEx/index.js +25 -25
- package/es/lowcode/view/lc-components/ImEx/index.less +7 -7
- package/es/lowcode/view/lc-components/ImEx/meta.json +134 -134
- package/es/lowcode/view/lc-components/Image/index.less +27 -27
- package/es/lowcode/view/lc-components/Image/meta.json +149 -149
- package/es/lowcode/view/lc-components/JSX/RuntimeComp.js +4 -4
- package/es/lowcode/view/lc-components/JSX/meta.json +29 -29
- package/es/lowcode/view/lc-components/Layout/index.js +16 -16
- package/es/lowcode/view/lc-components/Layout/index.less +5 -5
- package/es/lowcode/view/lc-components/Layout/meta.json +107 -107
- package/es/lowcode/view/lc-components/Link/index.less +15 -15
- package/es/lowcode/view/lc-components/Link/meta.json +112 -112
- package/es/lowcode/view/lc-components/Page/meta.json +61 -61
- package/es/lowcode/view/lc-components/PageContent/meta.json +9 -9
- package/es/lowcode/view/lc-components/PageFooter/meta.json +9 -9
- package/es/lowcode/view/lc-components/PageHeader/meta.json +9 -9
- package/es/lowcode/view/lc-components/PageLayout/meta.json +59 -59
- package/es/lowcode/view/lc-components/Proxy/FunctionDesign.js +17 -0
- package/es/lowcode/view/lc-components/Proxy/FunctionLive.js +23 -0
- package/es/lowcode/view/lc-components/Proxy/FunctionPreview.js +23 -0
- package/es/lowcode/view/lc-components/Proxy/index.js +42 -0
- package/es/lowcode/view/lc-components/Proxy/index.less +5 -0
- package/es/lowcode/view/lc-components/Proxy/meta.json +66 -0
- package/es/lowcode/view/lc-components/Section/index.less +7 -7
- package/es/lowcode/view/lc-components/Section/meta.json +108 -108
- package/es/lowcode/view/lc-components/Split/meta.json +53 -53
- package/es/lowcode/view/lc-components/Table/index.js +156 -149
- package/es/lowcode/view/lc-components/Table/meta.json +443 -443
- package/es/lowcode/view/lc-components/Tabs/index.js +23 -23
- package/es/lowcode/view/lc-components/Tabs/meta.json +113 -113
- package/es/lowcode/view/lc-components/Text/meta.json +56 -56
- package/es/lowcode/view/lc-components/Tree/index.js +99 -96
- package/es/lowcode/view/lc-components/Tree/index.less +4 -4
- package/es/lowcode/view/lc-components/Tree/meta.json +353 -353
- package/es/lowcode/view/lc-components/Wrapper.js +7 -1
- package/es/lowcode/view/style/canvas.less +5 -5
- package/es/lowcode/view/style/loading.less +98 -98
- package/es/lowcode/view/style/page.less +7 -7
- package/es/upload/FilesWall/index.js +13 -13
- package/es/upload/FilesWall/index.less +74 -74
- package/es/upload/Form/index.less +7 -7
- package/es/upload/FormItem/index.js +15 -15
- package/es/utils/form.js +21 -21
- package/lib/components/Builder/index.js +13 -10
- package/lib/components/LDActions/index.less +70 -70
- package/lib/components/LdAutoForm/index.js +3 -2
- package/lib/components/LdCom/index.js +3 -2
- package/lib/components/LdFormList/index.js +3 -2
- package/lib/components/LdGrid/index.js +4 -4
- package/lib/components/LdGridForm/index.js +3 -2
- package/lib/components/LdGridForm/index.less +7 -7
- package/lib/components/LdTree/index.less +42 -42
- package/lib/helper/FromItems.js +64 -5
- package/lib/helper/action.js +6 -6
- package/lib/helper/form.js +14 -14
- package/lib/helper/index.less +7 -7
- package/lib/helper/ldBuilder.js +4 -4
- package/lib/helper/ldComBuild.js +14 -9
- package/lib/locales/zh-CN.js +41 -5
- package/lib/lowcode/constants/api-url.js +309 -260
- package/lib/lowcode/constants/event-topics.js +3 -1
- package/lib/lowcode/constants/index.js +6 -5
- package/lib/lowcode/engine/meta/components-list.json +12 -6
- package/lib/lowcode/engine/meta/fielddate.props.default.json +1 -0
- package/lib/lowcode/engine/meta/fielddate.props.json +48 -0
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +35 -30
- package/lib/lowcode/engine/meta/proxy.props.default.json +15 -0
- package/lib/lowcode/engine/meta/proxy.props.json +66 -0
- package/lib/lowcode/engine/provider/ContextProvider/index.js +87 -49
- package/lib/lowcode/engine/provider/ContextProvider/usePageDataStore.js +50 -44
- package/lib/lowcode/engine/provider/ContextProvider/usePageVar.js +10 -4
- package/lib/lowcode/engine/provider/ContextProvider/useTodo.js +1 -3
- package/lib/lowcode/engine/provider/EventBusProvider.js +14 -4
- package/lib/lowcode/engine/provider/PageProxyProvider.js +103 -0
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +10 -12
- package/lib/lowcode/engine/tools/dataProcess.js +76 -76
- package/lib/lowcode/engine/tools/helper.js +25 -0
- package/lib/lowcode/engine/tools/initDS.js +4 -4
- package/lib/lowcode/painter/Components.js +2 -2
- package/lib/lowcode/painter/Design.js +1 -0
- package/lib/lowcode/painter/DesignOperator.js +126 -24
- package/lib/lowcode/painter/DesignToolbar.js +84 -169
- package/lib/lowcode/painter/components/AdvancePanel.js +27 -9
- package/lib/lowcode/painter/components/Collapse.js +26 -26
- package/lib/lowcode/painter/components/ColorInput.js +24 -24
- package/lib/lowcode/painter/components/ListEditor.js +24 -24
- package/lib/lowcode/painter/components/NumberInput.js +28 -28
- package/lib/lowcode/painter/components/PanelItem.js +24 -24
- package/lib/lowcode/painter/components/PopConfirm.js +8 -8
- package/lib/lowcode/painter/components/PopForm.js +27 -27
- package/lib/lowcode/painter/components/RuleInput.js +30 -30
- package/lib/lowcode/painter/components/SortBox.js +22 -22
- package/lib/lowcode/painter/components/TipIcon.js +12 -4
- package/lib/lowcode/painter/components/TreeEditor.js +10 -10
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +32 -32
- package/lib/lowcode/painter/components/code-editor/CssEditor.js +25 -25
- package/lib/lowcode/painter/components/code-editor/FullScreenEditor.js +23 -23
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +20 -20
- package/lib/lowcode/painter/components/code-editor/JsonEditor.js +25 -25
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +55 -3
- package/lib/lowcode/painter/components/field-setting/index.js +24 -1
- package/lib/lowcode/painter/components/shortcut-modal/KeyIcon.js +18 -0
- package/lib/lowcode/painter/components/shortcut-modal/index.js +215 -0
- package/lib/lowcode/painter/panel-section/BlockEditor/index.js +9 -18
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +4 -1
- package/lib/lowcode/painter/panel-section/ConditionCheck.js +0 -1
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +6 -3
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +1 -1
- package/lib/lowcode/painter/panel-section/Icon.js +23 -23
- package/lib/lowcode/painter/panel-section/IconConditionSelector.js +2 -1
- package/lib/lowcode/painter/panel-section/IconSelector.js +16 -16
- package/lib/lowcode/painter/panel-section/JSEditor/ToolBar.js +7 -4
- package/lib/lowcode/painter/panel-section/JSEditor/index.js +14 -4
- package/lib/lowcode/painter/panel-section/JSEditor/index.less +4 -0
- package/lib/lowcode/painter/panel-section/LayoutRatio.js +21 -21
- package/lib/lowcode/painter/panel-section/ProxyLinker.js +145 -0
- package/lib/lowcode/painter/panel-section/ProxyParams.js +35 -0
- package/lib/lowcode/painter/panel-section/ProxyParamsSetter.js +248 -0
- package/lib/lowcode/painter/panel-section/StylePanel/BackGround.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/Border.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/BorderRadius.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/BorderRadiusSelector.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/BorderSelector.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/Display.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/Font.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/FontEditor.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/GapSelector.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/HighLightPanel.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/HighLigthtSpan.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/HightLightSvg.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/Margin.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/Opacity.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/Padding.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/Pointer.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/Shadow.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/Size.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/StyleRow.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/WidthHeight.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/index.js +15 -15
- package/lib/lowcode/painter/style/action-bind-modal.less +104 -104
- package/lib/lowcode/painter/style/actions-editor.less +15 -15
- package/lib/lowcode/painter/style/border-editor.less +36 -36
- package/lib/lowcode/painter/style/border-radius-selector.less +42 -42
- package/lib/lowcode/painter/style/border-selector.less +39 -39
- package/lib/lowcode/painter/style/button-type.less +5 -5
- package/lib/lowcode/painter/style/collapse.less +28 -28
- package/lib/lowcode/painter/style/color-input.less +19 -19
- package/lib/lowcode/painter/style/components.less +91 -91
- package/lib/lowcode/painter/style/design.less +178 -178
- package/lib/lowcode/painter/style/display.less +17 -17
- package/lib/lowcode/painter/style/dragdrop.less +56 -56
- package/lib/lowcode/painter/style/fields-setting.less +25 -25
- package/lib/lowcode/painter/style/font-editor.less +9 -9
- package/lib/lowcode/painter/style/fullscreen-editor.less +17 -17
- package/lib/lowcode/painter/style/history.less +46 -46
- package/lib/lowcode/painter/style/icon-selector.less +22 -22
- package/lib/lowcode/painter/style/icon.less +10 -10
- package/lib/lowcode/painter/style/impexp.less +7 -7
- package/lib/lowcode/painter/style/index.less +6 -6
- package/lib/lowcode/painter/style/layout-ratio.less +51 -51
- package/lib/lowcode/painter/style/list-editor.less +97 -97
- package/lib/lowcode/painter/style/number-input.less +19 -19
- package/lib/lowcode/painter/style/outline.less +30 -30
- package/lib/lowcode/painter/style/page-layout-display.less +27 -27
- package/lib/lowcode/painter/style/page-vars.less +25 -25
- package/lib/lowcode/painter/style/panel-attrs.less +47 -47
- package/lib/lowcode/painter/style/panel-item.less +55 -54
- package/lib/lowcode/painter/style/panel.less +100 -100
- package/lib/lowcode/painter/style/pop-confirm.less +17 -17
- package/lib/lowcode/painter/style/pop-form.less +19 -19
- package/lib/lowcode/painter/style/radio.less +24 -24
- package/lib/lowcode/painter/style/ribbon.less +7 -7
- package/lib/lowcode/painter/style/rule-input.less +12 -12
- package/lib/lowcode/painter/style/split-display.less +18 -18
- package/lib/lowcode/painter/style/style-panel.less +37 -37
- package/lib/lowcode/painter/style/tabitems.less +90 -90
- package/lib/lowcode/painter/svg/code.svg +3 -3
- package/lib/lowcode/painter/svg/expect.svg +9 -9
- package/lib/lowcode/preview/DebugTool.js +86 -0
- package/lib/lowcode/preview/DebugToolDetail.js +111 -0
- package/lib/lowcode/preview/index.js +10 -18
- package/lib/lowcode/preview/useDebugSettings.js +69 -0
- package/lib/lowcode/view/Canvas.js +5 -1
- package/lib/lowcode/view/Page.js +8 -3
- package/lib/lowcode/view/lc-components/Box/index.js +4 -4
- package/lib/lowcode/view/lc-components/Box/index.less +14 -14
- package/lib/lowcode/view/lc-components/Box/meta.json +40 -40
- package/lib/lowcode/view/lc-components/Button/index.js +33 -33
- package/lib/lowcode/view/lc-components/Button/meta.json +127 -127
- package/lib/lowcode/view/lc-components/Button/style.less +2 -2
- package/lib/lowcode/view/lc-components/CardList/index.js +126 -123
- package/lib/lowcode/view/lc-components/CardList/meta.json +332 -332
- package/lib/lowcode/view/lc-components/Dialog/index.js +14 -13
- package/lib/lowcode/view/lc-components/Dialog/index.less +12 -12
- package/lib/lowcode/view/lc-components/Dialog/meta.json +224 -224
- package/lib/lowcode/view/lc-components/Drawer/index.js +15 -13
- package/lib/lowcode/view/lc-components/Drawer/index.less +13 -13
- package/lib/lowcode/view/lc-components/Drawer/meta.json +242 -242
- package/lib/lowcode/view/lc-components/FieldColor/meta.json +157 -157
- package/lib/lowcode/view/lc-components/FieldComplex/meta.json +140 -140
- package/lib/lowcode/view/lc-components/FieldDate/meta.json +188 -140
- package/lib/lowcode/view/lc-components/FieldDict/meta.json +138 -138
- package/lib/lowcode/view/lc-components/FieldEditor/meta.json +137 -137
- package/lib/lowcode/view/lc-components/FieldGroup/meta.json +166 -166
- package/lib/lowcode/view/lc-components/FieldNumber/meta.json +143 -143
- package/lib/lowcode/view/lc-components/FieldRadio/meta.json +115 -115
- package/lib/lowcode/view/lc-components/FieldRegion/meta.json +121 -121
- package/lib/lowcode/view/lc-components/FieldSelect/meta.json +152 -152
- package/lib/lowcode/view/lc-components/FieldString/meta.json +152 -152
- package/lib/lowcode/view/lc-components/FieldSwitch/meta.json +125 -125
- package/lib/lowcode/view/lc-components/FieldTextarea/meta.json +143 -143
- package/lib/lowcode/view/lc-components/FieldUpload/meta.json +165 -165
- package/lib/lowcode/view/lc-components/FieldUser/meta.json +176 -176
- package/lib/lowcode/view/lc-components/FieldYear/meta.json +128 -128
- package/lib/lowcode/view/lc-components/Form/index.js +23 -20
- package/lib/lowcode/view/lc-components/Form/meta.json +629 -629
- package/lib/lowcode/view/lc-components/GroupTree/index.js +23 -23
- package/lib/lowcode/view/lc-components/GroupTree/index.less +11 -11
- package/lib/lowcode/view/lc-components/GroupTree/meta.json +82 -82
- package/lib/lowcode/view/lc-components/Iframe/meta.json +31 -31
- package/lib/lowcode/view/lc-components/ImEx/index.js +25 -25
- package/lib/lowcode/view/lc-components/ImEx/index.less +7 -7
- package/lib/lowcode/view/lc-components/ImEx/meta.json +134 -134
- package/lib/lowcode/view/lc-components/Image/index.less +27 -27
- package/lib/lowcode/view/lc-components/Image/meta.json +149 -149
- package/lib/lowcode/view/lc-components/JSX/RuntimeComp.js +4 -4
- package/lib/lowcode/view/lc-components/JSX/meta.json +29 -29
- package/lib/lowcode/view/lc-components/Layout/index.js +16 -16
- package/lib/lowcode/view/lc-components/Layout/index.less +5 -5
- package/lib/lowcode/view/lc-components/Layout/meta.json +107 -107
- package/lib/lowcode/view/lc-components/Link/index.less +15 -15
- package/lib/lowcode/view/lc-components/Link/meta.json +112 -112
- package/lib/lowcode/view/lc-components/Page/meta.json +61 -61
- package/lib/lowcode/view/lc-components/PageContent/meta.json +9 -9
- package/lib/lowcode/view/lc-components/PageFooter/meta.json +9 -9
- package/lib/lowcode/view/lc-components/PageHeader/meta.json +9 -9
- package/lib/lowcode/view/lc-components/PageLayout/meta.json +59 -59
- package/lib/lowcode/view/lc-components/Proxy/FunctionDesign.js +24 -0
- package/lib/lowcode/view/lc-components/Proxy/FunctionLive.js +30 -0
- package/lib/lowcode/view/lc-components/Proxy/FunctionPreview.js +30 -0
- package/lib/lowcode/view/lc-components/Proxy/index.js +50 -0
- package/lib/lowcode/view/lc-components/Proxy/index.less +5 -0
- package/lib/lowcode/view/lc-components/Proxy/meta.json +66 -0
- package/lib/lowcode/view/lc-components/Section/index.less +7 -7
- package/lib/lowcode/view/lc-components/Section/meta.json +108 -108
- package/lib/lowcode/view/lc-components/Split/meta.json +53 -53
- package/lib/lowcode/view/lc-components/Table/index.js +156 -149
- package/lib/lowcode/view/lc-components/Table/meta.json +443 -443
- package/lib/lowcode/view/lc-components/Tabs/index.js +23 -23
- package/lib/lowcode/view/lc-components/Tabs/meta.json +113 -113
- package/lib/lowcode/view/lc-components/Text/meta.json +56 -56
- package/lib/lowcode/view/lc-components/Tree/index.js +99 -96
- package/lib/lowcode/view/lc-components/Tree/index.less +4 -4
- package/lib/lowcode/view/lc-components/Tree/meta.json +353 -353
- package/lib/lowcode/view/lc-components/Wrapper.js +6 -0
- package/lib/lowcode/view/style/canvas.less +5 -5
- package/lib/lowcode/view/style/loading.less +98 -98
- package/lib/lowcode/view/style/page.less +7 -7
- package/lib/upload/FilesWall/index.js +13 -13
- package/lib/upload/FilesWall/index.less +74 -74
- package/lib/upload/Form/index.less +7 -7
- package/lib/upload/FormItem/index.js +15 -15
- package/lib/utils/form.js +21 -21
- package/lowcode.js +1 -1
- package/package.json +175 -175
- package/upload.js +1 -1
- package/utils.js +1 -1
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useTemporalStore = exports.useTask = exports.useGet = exports.setNeedPrompt = exports.resetPageData = exports.moveNode = exports.modifyNode = exports.getSelfAndParent = exports.getNeedPrompt = exports.
|
|
7
|
+
exports.useTemporalStore = exports.useTask = exports.useGet = exports.setNeedPrompt = exports.resetPageData = exports.moveNode = exports.modifyNode = exports.getSelfAndParent = exports.getNeedPrompt = exports.getLevelNodes = exports.deleteNode = exports.default = exports.clearChildren = exports.addNode = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
10
|
var _react = require("react");
|
|
@@ -14,6 +14,7 @@ var _middleware = require("zustand/middleware");
|
|
|
14
14
|
var _shallow = require("zustand/react/shallow");
|
|
15
15
|
var _lodash = require("lodash");
|
|
16
16
|
var _fastDeepEqual = _interopRequireDefault(require("fast-deep-equal"));
|
|
17
|
+
var _PageProxyProvider = require("../PageProxyProvider");
|
|
17
18
|
var _dataProcess = require("../../tools/dataProcess");
|
|
18
19
|
var _constants = require("../../../constants");
|
|
19
20
|
var temporalStateCreator = function temporalStateCreator(userSet, userGet, options) {
|
|
@@ -148,18 +149,12 @@ var findNode = function findNode(obj, id) {
|
|
|
148
149
|
var usePageDataStore = (0, _zustand.create)()((0, _immer.immer)((0, _middleware.subscribeWithSelector)(temporal(function (set) {
|
|
149
150
|
return {
|
|
150
151
|
pageData: null,
|
|
151
|
-
moduleData: null,
|
|
152
152
|
needPrompt: false,
|
|
153
153
|
initialize: function initialize(data) {
|
|
154
154
|
return set(function (state) {
|
|
155
155
|
state.pageData = data;
|
|
156
156
|
});
|
|
157
157
|
},
|
|
158
|
-
initializeModule: function initializeModule(data) {
|
|
159
|
-
return set(function (state) {
|
|
160
|
-
state.moduleData = data;
|
|
161
|
-
});
|
|
162
|
-
},
|
|
163
158
|
reset: function reset(data) {
|
|
164
159
|
return set(function (state) {
|
|
165
160
|
state.pageData = data || null;
|
|
@@ -265,22 +260,22 @@ var modifyNode = exports.modifyNode = function modifyNode(id, data) {
|
|
|
265
260
|
});
|
|
266
261
|
};
|
|
267
262
|
|
|
268
|
-
/**
|
|
269
|
-
* 移动页面中的一个节点到另一个位置。
|
|
270
|
-
*
|
|
271
|
-
* @param {string} sid - 源节点的ID。
|
|
272
|
-
* @param {string} tid - 目标节点的ID。
|
|
273
|
-
* @param {string} action - 移动类型,可以是 'inside', 'left', 'right' 中的一个。
|
|
274
|
-
* @param {string} newid - 新节点的ID,仅在创建新节点时使用。
|
|
275
|
-
* @param {Object} json - 新节点的初始属性,仅在创建新节点时使用。
|
|
276
|
-
*
|
|
277
|
-
* @description
|
|
278
|
-
* 此函数会更新页面数据状态,根据提供的动作类型(`action`),将源节点(`sourceNode`)移动到目标节点(`targetNode`)的相应位置。
|
|
279
|
-
* - 'inside': 将源节点作为目标节点的子节点。
|
|
280
|
-
* - 'left': 将源节点放在目标节点的左边(同一父节点下)。
|
|
281
|
-
* - 'right': 将源节点放在目标节点的右边(同一父节点下)。
|
|
282
|
-
* 如果 `sid` 是空但提供了 `newid`,则函数会创建一个新的节点。
|
|
283
|
-
*
|
|
263
|
+
/**
|
|
264
|
+
* 移动页面中的一个节点到另一个位置。
|
|
265
|
+
*
|
|
266
|
+
* @param {string} sid - 源节点的ID。
|
|
267
|
+
* @param {string} tid - 目标节点的ID。
|
|
268
|
+
* @param {string} action - 移动类型,可以是 'inside', 'left', 'right' 中的一个。
|
|
269
|
+
* @param {string} newid - 新节点的ID,仅在创建新节点时使用。
|
|
270
|
+
* @param {Object} json - 新节点的初始属性,仅在创建新节点时使用。
|
|
271
|
+
*
|
|
272
|
+
* @description
|
|
273
|
+
* 此函数会更新页面数据状态,根据提供的动作类型(`action`),将源节点(`sourceNode`)移动到目标节点(`targetNode`)的相应位置。
|
|
274
|
+
* - 'inside': 将源节点作为目标节点的子节点。
|
|
275
|
+
* - 'left': 将源节点放在目标节点的左边(同一父节点下)。
|
|
276
|
+
* - 'right': 将源节点放在目标节点的右边(同一父节点下)。
|
|
277
|
+
* 如果 `sid` 是空但提供了 `newid`,则函数会创建一个新的节点。
|
|
278
|
+
*
|
|
284
279
|
*/
|
|
285
280
|
var moveNode = exports.moveNode = function moveNode(sid, tid, action, newid, json) {
|
|
286
281
|
usePageDataStore.setState(function (state) {
|
|
@@ -394,30 +389,41 @@ var useTask = exports.useTask = function useTask(type) {
|
|
|
394
389
|
}, []);
|
|
395
390
|
return task;
|
|
396
391
|
};
|
|
397
|
-
var
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
392
|
+
var getTargetData = function getTargetData(_, source) {
|
|
393
|
+
if ((0, _lodash.isNil)(_)) {
|
|
394
|
+
return source;
|
|
395
|
+
} else if ((0, _lodash.isFunction)(_)) {
|
|
396
|
+
return _(source);
|
|
397
|
+
} else if ((0, _lodash.isArray)(_)) {
|
|
398
|
+
return _.map(function (k) {
|
|
399
|
+
var _findNode;
|
|
400
|
+
return k.includes('.') ? (0, _lodash.get)(source, k) : (_findNode = findNode(source, k)) === null || _findNode === void 0 ? void 0 : _findNode.target;
|
|
401
|
+
});
|
|
402
|
+
} else if ((0, _lodash.isObject)(_) && _.id) {
|
|
403
|
+
var _findNode2;
|
|
404
|
+
var path = _.path;
|
|
405
|
+
var _target = _.id === _constants.LC_BUILDIN_UNIT_KEY.PAGE_ROOT ? source : (_findNode2 = findNode(source, _.id)) === null || _findNode2 === void 0 ? void 0 : _findNode2.target;
|
|
406
|
+
if ((0, _lodash.isNil)(path)) {
|
|
407
|
+
return _target;
|
|
408
|
+
} else if ((0, _lodash.isString)(path)) {
|
|
409
|
+
return (0, _lodash.get)(_target, path);
|
|
410
|
+
} else if ((0, _lodash.isArray)(path)) {
|
|
411
|
+
return path.map(function (k) {
|
|
412
|
+
return (0, _lodash.get)(_target, k);
|
|
407
413
|
});
|
|
408
|
-
} else if ((0, _lodash.isObject)(_) && _.id) {
|
|
409
|
-
var _findNode2;
|
|
410
|
-
var path = _.path;
|
|
411
|
-
var _target = _.id === _constants.LC_BUILDIN_UNIT_KEY.PAGE_ROOT ? state.pageData : (_findNode2 = findNode(state.pageData, _.id)) === null || _findNode2 === void 0 ? void 0 : _findNode2.target;
|
|
412
|
-
return (0, _lodash.isNil)(path) ? _target : (0, _lodash.get)(_target, path);
|
|
413
|
-
} else if ((0, _lodash.isString)(_)) {
|
|
414
|
-
return (0, _lodash.get)(state.pageData, _);
|
|
415
414
|
}
|
|
416
|
-
}))
|
|
417
|
-
|
|
415
|
+
} else if ((0, _lodash.isString)(_)) {
|
|
416
|
+
return (0, _lodash.get)(state.pageData, _);
|
|
417
|
+
}
|
|
418
418
|
};
|
|
419
|
-
var
|
|
420
|
-
|
|
419
|
+
var useGet = exports.useGet = function useGet(_) {
|
|
420
|
+
var ppCtx = (0, _PageProxyProvider.usePageProxyContext)();
|
|
421
|
+
if (ppCtx !== null && ppCtx !== void 0 && ppCtx.proxyCode) {
|
|
422
|
+
return getTargetData(_, usePageDataStore.getState()[ppCtx.proxyCode]);
|
|
423
|
+
}
|
|
424
|
+
return usePageDataStore((0, _shallow.useShallow)(function (state) {
|
|
425
|
+
return getTargetData(_, state.pageData);
|
|
426
|
+
}));
|
|
421
427
|
};
|
|
422
428
|
var setNeedPrompt = exports.setNeedPrompt = function setNeedPrompt(_need) {
|
|
423
429
|
usePageDataStore.setState(function (state) {
|
|
@@ -13,14 +13,20 @@ var _lodash = require("lodash");
|
|
|
13
13
|
var useStateStore = exports.useStateStore = (0, _zustand.create)()((0, _immer.immer)((0, _middleware.subscribeWithSelector)(function (set) {
|
|
14
14
|
return {
|
|
15
15
|
state: {},
|
|
16
|
-
initialize: function initialize(init) {
|
|
16
|
+
initialize: function initialize(init, append) {
|
|
17
17
|
return set(function (store) {
|
|
18
|
-
|
|
18
|
+
if (append) {
|
|
19
|
+
(0, _lodash.forOwn)(init, function (value, key) {
|
|
20
|
+
store.state[key] = value;
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
store.state = init;
|
|
24
|
+
}
|
|
19
25
|
});
|
|
20
26
|
},
|
|
21
|
-
clear: function clear() {
|
|
27
|
+
clear: function clear(_vars) {
|
|
22
28
|
return set(function (store) {
|
|
23
|
-
store.state =
|
|
29
|
+
store.state = (0, _lodash.omit)(store.state, _vars);
|
|
24
30
|
});
|
|
25
31
|
}
|
|
26
32
|
};
|
|
@@ -12,7 +12,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
12
12
|
var _ahooks = require("ahooks");
|
|
13
13
|
var _antd = require("luck-design/antd");
|
|
14
14
|
var _lodash = require("lodash");
|
|
15
|
-
var _usePageDataStore = require("./usePageDataStore");
|
|
16
15
|
var _helper = require("../../tools/helper");
|
|
17
16
|
var _apiUrl = require("../../../constants/api-url");
|
|
18
17
|
var _excluded = ["datasetCode"];
|
|
@@ -61,8 +60,7 @@ var useTodo = function useTodo() {
|
|
|
61
60
|
params = _ref4.params,
|
|
62
61
|
data = _ref4.data,
|
|
63
62
|
after = _ref4.after;
|
|
64
|
-
var
|
|
65
|
-
var _moduleCode = moduleCode || moduleData.moduleCode;
|
|
63
|
+
var _moduleCode = moduleCode || (0, _helper.getLDMetaAttr)('moduleCode');
|
|
66
64
|
var _dscode = datasetCode || dsCode;
|
|
67
65
|
if (!_moduleCode || !_dscode) {
|
|
68
66
|
_antd.message.warning('接口重要参数(模块编码或数据集编码)丢失');
|
|
@@ -66,7 +66,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
66
66
|
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
67
67
|
_id = _ref4[0],
|
|
68
68
|
_subscriber = _ref4[1];
|
|
69
|
-
var temp = _subscriber._before ? _subscriber._before(payload) : null;
|
|
69
|
+
var temp = _subscriber._before ? _subscriber._before(payload, _id) : null;
|
|
70
70
|
if (_subscriber._before && !(0, _helper.isPromise)(temp)) {
|
|
71
71
|
console.error('before hook must return a promise');
|
|
72
72
|
return;
|
|
@@ -76,10 +76,10 @@ var _default = exports.default = function _default(_ref) {
|
|
|
76
76
|
if (!flag) return flag;
|
|
77
77
|
var func = _subscriber._once || _subscriber._on;
|
|
78
78
|
if (!func) return;
|
|
79
|
-
return func(payload);
|
|
79
|
+
return func(payload, _id);
|
|
80
80
|
}).then(function (flag) {
|
|
81
81
|
if (flag === false || !_subscriber._after) return;
|
|
82
|
-
return _subscriber._after(payload);
|
|
82
|
+
return _subscriber._after(payload, _id);
|
|
83
83
|
}).finally(function () {
|
|
84
84
|
if (_subscriber._once) {
|
|
85
85
|
$unsubscriber(topic, _id);
|
|
@@ -93,6 +93,15 @@ var _default = exports.default = function _default(_ref) {
|
|
|
93
93
|
runtime: runtime
|
|
94
94
|
}, payload));
|
|
95
95
|
});
|
|
96
|
+
var $publisherOnce = (0, _ahooks.useMemoizedFn)(function (topic, payload) {
|
|
97
|
+
return new Promise(function (resolve) {
|
|
98
|
+
event$.emit((0, _objectSpread2.default)({
|
|
99
|
+
topic: topic,
|
|
100
|
+
runtime: runtime
|
|
101
|
+
}, payload));
|
|
102
|
+
$subscriber(topic).once(resolve).watch();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
96
105
|
var $subscriber = (0, _ahooks.useMemoizedFn)(function (topic) {
|
|
97
106
|
if (!subscriberPool.has(topic)) subscriberPool.set(topic, []);
|
|
98
107
|
var id = (0, _utils.suid)();
|
|
@@ -112,7 +121,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
112
121
|
if (!subscriberPool.get(topic).length) {
|
|
113
122
|
subscriberPool.delete(topic);
|
|
114
123
|
}
|
|
115
|
-
(_subscriber$_off = (_subscriber2 = _subscriber)._off) === null || _subscriber$_off === void 0 || _subscriber$_off.call(_subscriber2);
|
|
124
|
+
(_subscriber$_off = (_subscriber2 = _subscriber)._off) === null || _subscriber$_off === void 0 || _subscriber$_off.call(_subscriber2, _id);
|
|
116
125
|
_subscriber = null;
|
|
117
126
|
}
|
|
118
127
|
});
|
|
@@ -121,6 +130,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
121
130
|
value: {
|
|
122
131
|
runtime: runtime,
|
|
123
132
|
$publisher: $publisher,
|
|
133
|
+
$publisherOnce: $publisherOnce,
|
|
124
134
|
$subscriber: $subscriber,
|
|
125
135
|
$unsubscriber: $unsubscriber
|
|
126
136
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.usePageProxyContext = exports.default = exports.Context = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _ahooks = require("ahooks");
|
|
11
|
+
var _antd = require("luck-design/antd");
|
|
12
|
+
var _lodash = require("lodash");
|
|
13
|
+
var _utils = require("@luck-design-biz/base/utils");
|
|
14
|
+
var _ContextProvider = require("./ContextProvider");
|
|
15
|
+
var _usePageDataStore = _interopRequireDefault(require("./ContextProvider/usePageDataStore"));
|
|
16
|
+
var _dataProcess = require("../tools/dataProcess");
|
|
17
|
+
var _apiUrl = require("../../constants/api-url");
|
|
18
|
+
var Context = exports.Context = /*#__PURE__*/(0, _react.createContext)(null);
|
|
19
|
+
var usePageProxyContext = exports.usePageProxyContext = function usePageProxyContext() {
|
|
20
|
+
return (0, _react.useContext)(Context);
|
|
21
|
+
};
|
|
22
|
+
var _default = exports.default = function _default(_ref) {
|
|
23
|
+
var children = _ref.children,
|
|
24
|
+
id = _ref.id,
|
|
25
|
+
proxyCode = _ref.proxyCode,
|
|
26
|
+
destroyOnUnmount = _ref.destroyOnUnmount,
|
|
27
|
+
proxyParams = _ref.proxyParams;
|
|
28
|
+
if ((0, _lodash.isNil)(proxyCode)) return /*#__PURE__*/_react.default.createElement(_antd.Empty, {
|
|
29
|
+
description: (0, _utils.formatMessage)({
|
|
30
|
+
id: 'luckda.lowcode.view.lc-component.design.nocode',
|
|
31
|
+
label: '缺少页面代理编码配置'
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
var ctx = (0, _ContextProvider.useContext)();
|
|
35
|
+
var _useRequest = (0, _ahooks.useRequest)(_apiUrl.fetchPageData, {
|
|
36
|
+
defaultParams: [{
|
|
37
|
+
code: proxyCode
|
|
38
|
+
}],
|
|
39
|
+
ready: !_usePageDataStore.default.getState()[proxyCode],
|
|
40
|
+
onFinally: function onFinally() {
|
|
41
|
+
ctx.$publisher(ctx.topics.PAGE_LOAD_MOUNT, {
|
|
42
|
+
proxyCode: proxyCode
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
onSuccess: function onSuccess(_ref2) {
|
|
46
|
+
var code = _ref2.code,
|
|
47
|
+
data = _ref2.data,
|
|
48
|
+
list = _ref2.list,
|
|
49
|
+
detail = _ref2.detail;
|
|
50
|
+
if (code === 1) {
|
|
51
|
+
_usePageDataStore.default.setState(function (state) {
|
|
52
|
+
var source = detail[list[0]].source;
|
|
53
|
+
state[proxyCode] = (0, _dataProcess.decompress)(source);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
loading = _useRequest.loading;
|
|
59
|
+
(0, _react.useEffect)(function () {
|
|
60
|
+
if (_usePageDataStore.default.getState()[proxyCode]) {
|
|
61
|
+
ctx.$publisher(ctx.topics.PAGE_LOAD_MOUNT, {
|
|
62
|
+
proxyCode: proxyCode
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return function () {
|
|
66
|
+
if (destroyOnUnmount) {
|
|
67
|
+
_usePageDataStore.default.setState(function (state) {
|
|
68
|
+
state[proxyCode] = null;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}, []);
|
|
73
|
+
var _proxyParams = (0, _ahooks.useCreation)(function () {
|
|
74
|
+
return (0, _lodash.reduce)(proxyParams, function (ret, param) {
|
|
75
|
+
switch (param.origin) {
|
|
76
|
+
case 'state':
|
|
77
|
+
ret[param.name] = ctx.state[param.value];
|
|
78
|
+
return ret;
|
|
79
|
+
case 'golbal':
|
|
80
|
+
ret[param.name] = ctx.global[param.value];
|
|
81
|
+
return ret;
|
|
82
|
+
case 'url':
|
|
83
|
+
ret[param.name] = ctx.router.getQuery(param.value);
|
|
84
|
+
return ret;
|
|
85
|
+
case 'string':
|
|
86
|
+
case 'num':
|
|
87
|
+
case 'bool':
|
|
88
|
+
default:
|
|
89
|
+
ret[param.name] = param.value;
|
|
90
|
+
return ret;
|
|
91
|
+
}
|
|
92
|
+
}, {});
|
|
93
|
+
}, []);
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(Context.Provider, {
|
|
95
|
+
value: {
|
|
96
|
+
id: id,
|
|
97
|
+
proxyCode: proxyCode,
|
|
98
|
+
params: _proxyParams
|
|
99
|
+
}
|
|
100
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Spin, {
|
|
101
|
+
spinning: loading
|
|
102
|
+
}, children));
|
|
103
|
+
};
|
|
@@ -8,12 +8,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = exports.RemoteSourceContext = void 0;
|
|
9
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
10
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
16
|
var _ahooks = require("ahooks");
|
|
16
17
|
var _umi = require("umi");
|
|
18
|
+
var _lodash = require("lodash");
|
|
17
19
|
var _launcher = _interopRequireDefault(require("../launcher"));
|
|
18
20
|
var _Builder = require("../../../components/Builder");
|
|
19
21
|
var _action2 = require("../../../helper/action");
|
|
@@ -31,12 +33,10 @@ var _default = exports.default = function _default(_ref) {
|
|
|
31
33
|
var _usePageDataStore = (0, _usePageDataStore2.default)(function (state) {
|
|
32
34
|
return {
|
|
33
35
|
initialize: state.initialize,
|
|
34
|
-
initializeModule: state.initializeModule,
|
|
35
36
|
reset: state.reset
|
|
36
37
|
};
|
|
37
38
|
}),
|
|
38
39
|
initialize = _usePageDataStore.initialize,
|
|
39
|
-
initializeModule = _usePageDataStore.initializeModule,
|
|
40
40
|
reset = _usePageDataStore.reset;
|
|
41
41
|
var _useTemporalStore = (0, _usePageDataStore2.useTemporalStore)(function (state) {
|
|
42
42
|
return {
|
|
@@ -78,7 +78,6 @@ var _default = exports.default = function _default(_ref) {
|
|
|
78
78
|
setRemoteSource({
|
|
79
79
|
module: data
|
|
80
80
|
});
|
|
81
|
-
initializeModule(data);
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
}),
|
|
@@ -161,7 +160,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
161
160
|
}),
|
|
162
161
|
runFetchAllBehaviorExport = _useRequest6.run;
|
|
163
162
|
(0, _ahooks.useAsyncEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
164
|
-
var fetchPageDataRes, data, list, detail, source;
|
|
163
|
+
var fetchPageDataRes, data, list, detail, source, _pageData;
|
|
165
164
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
166
165
|
while (1) switch (_context.prev = _context.next) {
|
|
167
166
|
case 0:
|
|
@@ -181,16 +180,17 @@ var _default = exports.default = function _default(_ref) {
|
|
|
181
180
|
break;
|
|
182
181
|
}
|
|
183
182
|
_umi.history.replace('/404');
|
|
184
|
-
_context.next =
|
|
183
|
+
_context.next = 21;
|
|
185
184
|
break;
|
|
186
185
|
case 9:
|
|
187
|
-
source = detail[list[0]].source;
|
|
188
186
|
(0, _helper.setMetaAttrs)(_constants.META_TAG_NAME, data);
|
|
189
|
-
|
|
187
|
+
source = detail[list[0]].source;
|
|
188
|
+
_pageData = (0, _dataProcess.decompress)(source);
|
|
189
|
+
_context.next = 14;
|
|
190
190
|
return runFetchModlueData(data.dataModelKey, {
|
|
191
|
-
moduleCode: data.moduleCode
|
|
191
|
+
moduleCode: [data.moduleCode].concat((0, _toConsumableArray2.default)((0, _lodash.values)(_pageData.props.proxy))).join(',')
|
|
192
192
|
});
|
|
193
|
-
case
|
|
193
|
+
case 14:
|
|
194
194
|
runFetchAllBehaviorImport({
|
|
195
195
|
behaviorMode: 'IMPORT',
|
|
196
196
|
moduleCode: data.moduleCode
|
|
@@ -205,11 +205,9 @@ var _default = exports.default = function _default(_ref) {
|
|
|
205
205
|
runFetchAllSerials({
|
|
206
206
|
uid: data.moduleId
|
|
207
207
|
});
|
|
208
|
-
initialize(
|
|
208
|
+
initialize(_pageData);
|
|
209
209
|
resume();
|
|
210
210
|
eventBus.$publisher(_eventTopics.PAGE_LOAD_MOUNT);
|
|
211
|
-
case 20:
|
|
212
|
-
;
|
|
213
211
|
case 21:
|
|
214
212
|
case "end":
|
|
215
213
|
return _context.stop();
|
|
@@ -20,10 +20,10 @@ var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime
|
|
|
20
20
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
21
21
|
var LZString = _interopRequireWildcard(require("lz-string"));
|
|
22
22
|
var _constants = require("../../constants");
|
|
23
|
-
/**
|
|
24
|
-
* 数据压缩
|
|
25
|
-
* @param {JSON} data
|
|
26
|
-
* @returns 加密后的字符串
|
|
23
|
+
/**
|
|
24
|
+
* 数据压缩
|
|
25
|
+
* @param {JSON} data
|
|
26
|
+
* @returns 加密后的字符串
|
|
27
27
|
*/
|
|
28
28
|
function compress(data) {
|
|
29
29
|
// 将对象转换为JSON字符串
|
|
@@ -32,10 +32,10 @@ function compress(data) {
|
|
|
32
32
|
return LZString.compressToBase64(jsonString);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* 数据解压
|
|
37
|
-
* @param {string} compressedData
|
|
38
|
-
* @returns {json}
|
|
35
|
+
/**
|
|
36
|
+
* 数据解压
|
|
37
|
+
* @param {string} compressedData
|
|
38
|
+
* @returns {json}
|
|
39
39
|
*/
|
|
40
40
|
function decompress(compressedData) {
|
|
41
41
|
// 使用LZ-String解压数据
|
|
@@ -44,13 +44,13 @@ function decompress(compressedData) {
|
|
|
44
44
|
return JSON.parse(jsonString);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* 查找指定ID的节点及其父节点。
|
|
49
|
-
*
|
|
50
|
-
* @param {string} id - 要查找的节点ID。
|
|
51
|
-
* @param {Object} current - 当前遍历的JSON对象。
|
|
52
|
-
* @param {Object|null} parent - 当前节点的父节点。
|
|
53
|
-
* @returns {{node: Object|null, parent: Object|null}} 查找结果,包含节点和其父节点。
|
|
47
|
+
/**
|
|
48
|
+
* 查找指定ID的节点及其父节点。
|
|
49
|
+
*
|
|
50
|
+
* @param {string} id - 要查找的节点ID。
|
|
51
|
+
* @param {Object} current - 当前遍历的JSON对象。
|
|
52
|
+
* @param {Object|null} parent - 当前节点的父节点。
|
|
53
|
+
* @returns {{node: Object|null, parent: Object|null}} 查找结果,包含节点和其父节点。
|
|
54
54
|
*/
|
|
55
55
|
function findNodeAndParent(id, current) {
|
|
56
56
|
var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -84,13 +84,13 @@ function findNodeAndParent(id, current) {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
/**
|
|
88
|
-
* 对指定的JSON结构进行节点的添加、修改或删除操作。
|
|
89
|
-
*
|
|
90
|
-
* @param {Object} json - 要操作的JSON对象。
|
|
91
|
-
* @param {string|null} path - 要操作的节点路径,使用'/'分隔。
|
|
92
|
-
* @param {string} id - 操作节点的唯一标识符。
|
|
93
|
-
* @param {Object|null} data - 要添加或修改的数据。如果为null,表示删除操作。
|
|
87
|
+
/**
|
|
88
|
+
* 对指定的JSON结构进行节点的添加、修改或删除操作。
|
|
89
|
+
*
|
|
90
|
+
* @param {Object} json - 要操作的JSON对象。
|
|
91
|
+
* @param {string|null} path - 要操作的节点路径,使用'/'分隔。
|
|
92
|
+
* @param {string} id - 操作节点的唯一标识符。
|
|
93
|
+
* @param {Object|null} data - 要添加或修改的数据。如果为null,表示删除操作。
|
|
94
94
|
*/
|
|
95
95
|
function process(json, path, id, data) {
|
|
96
96
|
if (!json) {
|
|
@@ -156,25 +156,25 @@ function process(json, path, id, data) {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
/**
|
|
160
|
-
* 对指定的JSON结构进行节点的添加操作。
|
|
161
|
-
*
|
|
162
|
-
* @param {Object} json - 要操作的JSON对象。
|
|
163
|
-
* @param {string} parentId - 父节点的唯一标识符。
|
|
164
|
-
* @param {string} id - 操作节点的唯一标识符。
|
|
165
|
-
* @param {Object|null} data - 要添加或修改的数据。如果为null,表示删除操作。
|
|
159
|
+
/**
|
|
160
|
+
* 对指定的JSON结构进行节点的添加操作。
|
|
161
|
+
*
|
|
162
|
+
* @param {Object} json - 要操作的JSON对象。
|
|
163
|
+
* @param {string} parentId - 父节点的唯一标识符。
|
|
164
|
+
* @param {string} id - 操作节点的唯一标识符。
|
|
165
|
+
* @param {Object|null} data - 要添加或修改的数据。如果为null,表示删除操作。
|
|
166
166
|
*/
|
|
167
167
|
function add(json, parentId, id, data) {
|
|
168
168
|
process(json, getPathById(json, parentId), id, data);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
/**
|
|
172
|
-
* 移动指定的节点到另一个节点的指定位置。
|
|
173
|
-
*
|
|
174
|
-
* @param {Object} json - 要操作的JSON对象。
|
|
175
|
-
* @param {string} sid - 被移动的节点id
|
|
176
|
-
* @param {string} tid - 目标节点id
|
|
177
|
-
* @param {string} action - 'left': 往节点前面插入,'right':往节点后面插,'inside':往节点子节点插
|
|
171
|
+
/**
|
|
172
|
+
* 移动指定的节点到另一个节点的指定位置。
|
|
173
|
+
*
|
|
174
|
+
* @param {Object} json - 要操作的JSON对象。
|
|
175
|
+
* @param {string} sid - 被移动的节点id
|
|
176
|
+
* @param {string} tid - 目标节点id
|
|
177
|
+
* @param {string} action - 'left': 往节点前面插入,'right':往节点后面插,'inside':往节点子节点插
|
|
178
178
|
*/
|
|
179
179
|
function move(json, sid, tid, action) {
|
|
180
180
|
// 验证节点存在性
|
|
@@ -230,34 +230,34 @@ function move(json, sid, tid, action) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
/**
|
|
234
|
-
* 对指定的JSON结构进行节点的修改操作。
|
|
235
|
-
*
|
|
236
|
-
* @param {Object} json - 要操作的JSON对象。
|
|
237
|
-
* @param {string} id - 操作节点的唯一标识符。
|
|
238
|
-
* @param {Object|null} data - 要添加或修改的数据。如果为null,表示删除操作。
|
|
233
|
+
/**
|
|
234
|
+
* 对指定的JSON结构进行节点的修改操作。
|
|
235
|
+
*
|
|
236
|
+
* @param {Object} json - 要操作的JSON对象。
|
|
237
|
+
* @param {string} id - 操作节点的唯一标识符。
|
|
238
|
+
* @param {Object|null} data - 要添加或修改的数据。如果为null,表示删除操作。
|
|
239
239
|
*/
|
|
240
240
|
function modifyById(json, id, data) {
|
|
241
241
|
process(json, null, id, data);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
/**
|
|
245
|
-
* 删除指定id的节点。
|
|
246
|
-
*
|
|
247
|
-
* @param {Object} json - JSON对象。
|
|
248
|
-
* @param {string} id - 要删除的节点ID。
|
|
244
|
+
/**
|
|
245
|
+
* 删除指定id的节点。
|
|
246
|
+
*
|
|
247
|
+
* @param {Object} json - JSON对象。
|
|
248
|
+
* @param {string} id - 要删除的节点ID。
|
|
249
249
|
*/
|
|
250
250
|
function deleteById(json, id) {
|
|
251
251
|
process(json, null, id);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
/**
|
|
255
|
-
* 根据ID在给定的JSON结构中查找节点的路径。
|
|
256
|
-
*
|
|
257
|
-
* @param {Object} json - 要搜索的JSON对象。
|
|
258
|
-
* @param {string} id - 要查找的节点ID。
|
|
259
|
-
* @param {string} currentPath - 当前递归到的路径,用于构建返回的路径字符串。
|
|
260
|
-
* @returns {string|null} 如果找到节点,返回节点的路径;否则返回null。
|
|
254
|
+
/**
|
|
255
|
+
* 根据ID在给定的JSON结构中查找节点的路径。
|
|
256
|
+
*
|
|
257
|
+
* @param {Object} json - 要搜索的JSON对象。
|
|
258
|
+
* @param {string} id - 要查找的节点ID。
|
|
259
|
+
* @param {string} currentPath - 当前递归到的路径,用于构建返回的路径字符串。
|
|
260
|
+
* @returns {string|null} 如果找到节点,返回节点的路径;否则返回null。
|
|
261
261
|
*/
|
|
262
262
|
function getPathById(json, id) {
|
|
263
263
|
var currentPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
@@ -277,28 +277,28 @@ function getPathById(json, id) {
|
|
|
277
277
|
return null;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
/**
|
|
281
|
-
* 在给定的JSON结构中搜索具有特定id的节点,并返回包含该节点及其所有父节点的props属性的路径数组。
|
|
282
|
-
*
|
|
283
|
-
* @param {Object} data - 待搜索的JSON对象,它代表了一个复杂的树状结构,每个节点都可能有props和children属性。
|
|
284
|
-
* @param {string} targetId - 需要找到的目标节点的id。
|
|
285
|
-
* @returns {Array<Object>} 一个包含目标节点及其所有父节点的props属性的数组。如果未找到目标节点,则返回空数组。
|
|
286
|
-
*
|
|
287
|
-
* @example
|
|
288
|
-
* const data = {
|
|
289
|
-
* props: {
|
|
290
|
-
* id: 'page_root',
|
|
291
|
-
* type: 'Page',
|
|
292
|
-
* name: '页面',
|
|
293
|
-
* hasHeder: true,
|
|
294
|
-
* hasFooter: true,
|
|
295
|
-
* },
|
|
296
|
-
* // ...其他节点
|
|
297
|
-
* };
|
|
298
|
-
*
|
|
299
|
-
* const path = getPathNodesById(data, 'form_jknbjkun');
|
|
300
|
-
* console.log(path);
|
|
301
|
-
* // 输出目标节点及其所有父节点的props属性的数组
|
|
280
|
+
/**
|
|
281
|
+
* 在给定的JSON结构中搜索具有特定id的节点,并返回包含该节点及其所有父节点的props属性的路径数组。
|
|
282
|
+
*
|
|
283
|
+
* @param {Object} data - 待搜索的JSON对象,它代表了一个复杂的树状结构,每个节点都可能有props和children属性。
|
|
284
|
+
* @param {string} targetId - 需要找到的目标节点的id。
|
|
285
|
+
* @returns {Array<Object>} 一个包含目标节点及其所有父节点的props属性的数组。如果未找到目标节点,则返回空数组。
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* const data = {
|
|
289
|
+
* props: {
|
|
290
|
+
* id: 'page_root',
|
|
291
|
+
* type: 'Page',
|
|
292
|
+
* name: '页面',
|
|
293
|
+
* hasHeder: true,
|
|
294
|
+
* hasFooter: true,
|
|
295
|
+
* },
|
|
296
|
+
* // ...其他节点
|
|
297
|
+
* };
|
|
298
|
+
*
|
|
299
|
+
* const path = getPathNodesById(data, 'form_jknbjkun');
|
|
300
|
+
* console.log(path);
|
|
301
|
+
* // 输出目标节点及其所有父节点的props属性的数组
|
|
302
302
|
*/
|
|
303
303
|
function getPathNodesById(data, targetId) {
|
|
304
304
|
// 初始化结果数组
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.dataToTree = dataToTree;
|
|
7
8
|
exports.executeCode = executeCode;
|
|
8
9
|
exports.extractKeywords = extractKeywords;
|
|
9
10
|
exports.findFirstLeafNode = findFirstLeafNode;
|
|
@@ -282,4 +283,28 @@ function findFirstLeafNode(node) {
|
|
|
282
283
|
_iterator2.f();
|
|
283
284
|
}
|
|
284
285
|
return null;
|
|
286
|
+
}
|
|
287
|
+
function dataToTree(data, params) {
|
|
288
|
+
var _ref = params || {},
|
|
289
|
+
_ref$parentKey = _ref.parentKey,
|
|
290
|
+
parentKey = _ref$parentKey === void 0 ? 'parentId' : _ref$parentKey,
|
|
291
|
+
_ref$childKey = _ref.childKey,
|
|
292
|
+
childKey = _ref$childKey === void 0 ? 'children' : _ref$childKey,
|
|
293
|
+
_ref$rootId = _ref.rootId,
|
|
294
|
+
rootId = _ref$rootId === void 0 ? '0' : _ref$rootId,
|
|
295
|
+
_ref$id = _ref.id,
|
|
296
|
+
id = _ref$id === void 0 ? 'id' : _ref$id,
|
|
297
|
+
_ref$stain = _ref.stain,
|
|
298
|
+
stain = _ref$stain === void 0 ? false : _ref$stain;
|
|
299
|
+
var _data = stain ? data : (0, _lodash.cloneDeep)(data);
|
|
300
|
+
var groupedByParents = (0, _lodash.groupBy)(_data, parentKey);
|
|
301
|
+
var itemsById = (0, _lodash.keyBy)(_data, id);
|
|
302
|
+
try {
|
|
303
|
+
(0, _lodash.each)((0, _lodash.omit)(groupedByParents, rootId), function (children, parentId) {
|
|
304
|
+
itemsById[parentId][childKey] = children;
|
|
305
|
+
});
|
|
306
|
+
} catch (e) {
|
|
307
|
+
console.error('helper.dataToTree error', e);
|
|
308
|
+
}
|
|
309
|
+
return groupedByParents[rootId];
|
|
285
310
|
}
|