@luck-design-biz/luckda 0.0.25-1 → 0.0.25-11
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/ComplexItem/index.js +92 -0
- package/es/{lowcode/painter/services/toolbar.js → components/ComplexItem/service.js} +7 -11
- package/es/components/LDActions/index.js +8 -10
- package/es/components/LDActions/index.less +7 -4
- package/es/components/LdAutoForm/index.js +34 -11
- package/es/components/LdFormList/index.js +39 -23
- package/es/components/LdGrid/index.js +21 -7
- package/es/components/LdGridForm/index.js +32 -11
- package/es/components/LdTree/index.js +33 -15
- package/es/helper/FromItems.js +177 -94
- package/es/helper/form.js +55 -14
- package/es/helper/props_config.js +17 -0
- package/es/locales/zh-CN.js +26 -11
- package/es/lowcode/constants/api-url.js +354 -104
- package/es/lowcode/constants/event-topics.js +2 -0
- package/es/lowcode/constants/index.js +4 -2
- package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +5 -2
- package/es/lowcode/engine/factory/panel-item-factory/StringStrategy.js +1 -1
- package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +5 -2
- package/es/lowcode/engine/meta/box.props.default.json +1 -1
- package/es/lowcode/engine/meta/box.props.json +4 -4
- package/es/lowcode/engine/meta/button.props.json +4 -4
- package/es/lowcode/engine/meta/cardlist.props.json +14 -4
- package/es/lowcode/engine/meta/components-list.json +109 -1
- package/es/lowcode/engine/meta/dialog.props.default.json +11 -5
- package/es/lowcode/engine/meta/dialog.props.json +80 -43
- package/es/lowcode/engine/meta/drawer.props.json +9 -21
- package/es/lowcode/engine/meta/fieldcolor.props.default.json +14 -0
- package/es/lowcode/engine/meta/fieldcolor.props.json +63 -0
- package/es/lowcode/engine/meta/fieldcomplex.props.default.json +13 -0
- package/es/lowcode/engine/meta/fieldcomplex.props.json +39 -0
- package/es/lowcode/engine/meta/fielddate.props.default.json +12 -0
- package/es/lowcode/engine/meta/fielddate.props.json +47 -0
- package/es/lowcode/engine/meta/fielddict.props.default.json +14 -0
- package/es/lowcode/engine/meta/fielddict.props.json +44 -0
- package/es/lowcode/engine/meta/fieldeditor.props.default.json +13 -0
- package/es/lowcode/engine/meta/fieldeditor.props.json +44 -0
- package/es/lowcode/engine/meta/fieldgroup.props.default.json +15 -0
- package/es/lowcode/engine/meta/fieldgroup.props.json +73 -0
- package/es/lowcode/engine/meta/fieldnumber.props.default.json +14 -0
- package/es/lowcode/engine/meta/fieldnumber.props.json +48 -0
- package/es/lowcode/engine/meta/fieldradio.props.default.json +12 -0
- package/es/lowcode/engine/meta/fieldradio.props.json +20 -0
- package/es/lowcode/engine/meta/fieldregion.props.default.json +12 -0
- package/es/lowcode/engine/meta/fieldregion.props.json +26 -0
- package/es/lowcode/engine/meta/fieldselect.props.default.json +14 -0
- package/es/lowcode/engine/meta/fieldselect.props.json +58 -0
- package/es/lowcode/engine/meta/fieldstring.props.default.json +16 -0
- package/es/lowcode/engine/meta/fieldstring.props.json +62 -0
- package/es/lowcode/engine/meta/fieldswitch.props.default.json +12 -0
- package/es/lowcode/engine/meta/fieldswitch.props.json +31 -0
- package/es/lowcode/engine/meta/fieldtextarea.props.default.json +13 -0
- package/es/lowcode/engine/meta/fieldtextarea.props.json +49 -0
- package/es/lowcode/engine/meta/fieldupload.props.default.json +15 -0
- package/es/lowcode/engine/meta/fieldupload.props.json +71 -0
- package/es/lowcode/engine/meta/fielduser.props.default.json +16 -0
- package/es/lowcode/engine/meta/fielduser.props.json +82 -0
- package/es/lowcode/engine/meta/fieldyear.props.default.json +12 -0
- package/es/lowcode/engine/meta/fieldyear.props.json +37 -0
- package/es/lowcode/engine/meta/form.props.default.json +4 -5
- package/es/lowcode/engine/meta/form.props.json +44 -35
- package/es/lowcode/engine/meta/image.props.json +2 -2
- package/es/lowcode/engine/meta/imex.props.default.json +8 -1
- package/es/lowcode/engine/meta/imex.props.json +54 -22
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
- package/es/lowcode/engine/meta/layout.props.json +2 -2
- package/es/lowcode/engine/meta/link.props.json +1 -1
- package/es/lowcode/engine/meta/page.props.json +2 -2
- package/es/lowcode/engine/meta/pagelayout.props.default.json +14 -0
- package/es/lowcode/engine/meta/pagelayout.props.json +47 -0
- package/es/lowcode/engine/meta/section.props.default.json +4 -6
- package/es/lowcode/engine/meta/section.props.json +52 -49
- package/es/lowcode/engine/meta/split.props.default.json +1 -1
- package/es/lowcode/engine/meta/split.props.json +4 -4
- package/es/lowcode/engine/meta/table.props.json +19 -13
- package/es/lowcode/engine/meta/tabs.props.json +3 -3
- package/es/lowcode/engine/meta/text.props.json +2 -2
- package/es/lowcode/engine/meta/tree.props.default.json +2 -0
- package/es/lowcode/engine/meta/tree.props.json +71 -8
- package/es/lowcode/engine/provider/ContextProvider/index.js +21 -35
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +89 -37
- package/es/lowcode/engine/tools/dataProcess.js +4 -0
- package/es/lowcode/engine/tools/diff.js +60 -0
- package/es/lowcode/engine/tools/helper.js +47 -26
- package/es/lowcode/engine/tools/useCanvasRender.js +8 -9
- package/es/lowcode/engine/tools/usePageDataStore.js +331 -0
- package/es/lowcode/engine/tools/usePromiseState.js +8 -10
- package/es/lowcode/engine/tools/useTodo.js +20 -10
- package/es/lowcode/painter/Design.js +41 -6
- package/es/lowcode/painter/DesignOperator.js +112 -88
- package/es/lowcode/painter/DesignToolbar.js +280 -36
- package/es/lowcode/painter/Outline.js +12 -10
- package/es/lowcode/painter/Panel.js +84 -46
- package/es/lowcode/painter/components/ActionBindModal.js +38 -27
- package/es/lowcode/painter/components/AdvancePanel.js +37 -21
- package/es/lowcode/painter/components/AttrsPanel.js +45 -34
- package/es/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
- package/es/lowcode/painter/components/DragDrop/DragDropWrapper.js +5 -2
- package/es/lowcode/painter/components/FieldSelector.js +26 -13
- package/es/lowcode/painter/components/ListEditor.js +8 -2
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
- package/es/lowcode/painter/components/code-editor/JSEditor.js +5 -9
- package/es/lowcode/painter/components/field-setting/BatchSetting.js +13 -3
- package/es/lowcode/painter/components/field-setting/CheckFrontRules.js +108 -0
- package/es/lowcode/painter/components/field-setting/CheckRules.js +1 -26
- package/es/lowcode/painter/components/field-setting/FieldRulesModal.js +33 -13
- package/es/lowcode/painter/components/field-setting/SettingUI.js +182 -31
- package/es/lowcode/painter/components/field-setting/index.js +40 -61
- package/es/lowcode/painter/components/field-setting/meta/frontRules.js +53 -0
- package/es/lowcode/painter/index.js +1 -28
- package/es/lowcode/painter/panel-section/ActionsColumnWidth.js +25 -0
- package/es/lowcode/painter/panel-section/BlockEditor/index.js +7 -4
- package/es/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +4 -3
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +55 -28
- package/es/lowcode/painter/panel-section/ButtonType.js +4 -2
- package/es/lowcode/painter/panel-section/DataSetSelector.js +30 -7
- package/es/lowcode/painter/panel-section/FieldsSetting.js +124 -55
- package/es/lowcode/painter/panel-section/I18nInput.js +20 -0
- package/es/lowcode/painter/panel-section/ImpExp.js +99 -14
- package/es/lowcode/painter/panel-section/ImpExpAlone.js +108 -0
- package/es/lowcode/painter/panel-section/PageLayoutDisplay.js +95 -0
- package/es/lowcode/painter/panel-section/SerialsSelector.js +4 -2
- package/es/lowcode/painter/panel-section/SplitDisplay.js +25 -110
- package/es/lowcode/painter/panel-section/StylePanel/StyleContext.js +1 -1
- package/es/lowcode/painter/panel-section/StylePanel/index.js +10 -4
- package/es/lowcode/painter/panel-section/TableTopFilter.js +23 -13
- package/es/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
- package/es/lowcode/painter/style/action-bind-modal.less +3 -3
- package/es/lowcode/painter/style/design.less +11 -4
- package/es/lowcode/painter/style/list-editor.less +36 -0
- package/es/lowcode/painter/style/page-layout-display.less +28 -0
- package/es/lowcode/painter/style/panel-item.less +1 -1
- package/es/lowcode/painter/style/split-display.less +0 -9
- package/es/lowcode/preview/index.js +20 -5
- package/es/lowcode/view/Canvas.js +6 -7
- package/es/lowcode/view/Page.js +5 -6
- package/es/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
- package/es/lowcode/view/lc-components/Box/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Box/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Box/meta.json +4 -4
- package/es/lowcode/view/lc-components/Button/index.js +2 -6
- package/es/lowcode/view/lc-components/Button/meta.json +4 -4
- package/es/lowcode/view/lc-components/CardList/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/CardList/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/CardList/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/CardList/meta.json +14 -4
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +3 -12
- package/es/lowcode/view/lc-components/Dialog/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Dialog/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Dialog/index.js +119 -19
- package/es/lowcode/view/lc-components/Dialog/meta.json +73 -43
- package/es/lowcode/view/lc-components/Drawer/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Drawer/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Drawer/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Drawer/meta.json +9 -21
- package/es/lowcode/view/lc-components/FieldColor/meta.json +63 -0
- package/es/lowcode/view/lc-components/FieldComplex/meta.json +39 -0
- package/es/lowcode/view/lc-components/FieldDate/meta.json +45 -0
- package/es/lowcode/view/lc-components/FieldDict/meta.json +44 -0
- package/es/lowcode/view/lc-components/FieldEditor/meta.json +44 -0
- package/es/lowcode/view/lc-components/FieldGroup/meta.json +73 -0
- package/es/lowcode/view/lc-components/FieldNumber/meta.json +48 -0
- package/es/lowcode/view/lc-components/FieldRadio/meta.json +20 -0
- package/es/lowcode/view/lc-components/FieldRegion/meta.json +26 -0
- package/es/lowcode/view/lc-components/FieldSelect/meta.json +58 -0
- package/es/lowcode/view/lc-components/FieldString/meta.json +62 -0
- package/es/lowcode/view/lc-components/FieldSwitch/meta.json +31 -0
- package/es/lowcode/view/lc-components/FieldTextarea/meta.json +49 -0
- package/es/lowcode/view/lc-components/FieldUpload/meta.json +71 -0
- package/es/lowcode/view/lc-components/FieldUser/meta.json +82 -0
- package/es/lowcode/view/lc-components/FieldYear/meta.json +35 -0
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +61 -9
- package/es/lowcode/view/lc-components/Form/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Form/FunctionPreview.js +9 -1
- package/es/lowcode/view/lc-components/Form/index.js +401 -66
- package/es/lowcode/view/lc-components/Form/meta.json +44 -35
- package/es/lowcode/view/lc-components/Iframe/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +9 -3
- package/es/lowcode/view/lc-components/ImEx/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/index.js +470 -11
- package/es/lowcode/view/lc-components/ImEx/index.less +7 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +55 -23
- package/es/lowcode/view/lc-components/Image/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Image/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Image/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Image/meta.json +2 -2
- package/es/lowcode/view/lc-components/JSX/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/JSX/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/JSX/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +13 -21
- package/es/lowcode/view/lc-components/Layout/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Layout/meta.json +2 -2
- package/es/lowcode/view/lc-components/Link/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Link/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Link/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Link/meta.json +1 -1
- package/es/lowcode/view/lc-components/Page/meta.json +2 -2
- package/es/lowcode/view/lc-components/PageContent/index.js +8 -9
- package/es/lowcode/view/lc-components/PageFooter/index.js +2 -5
- package/es/lowcode/view/lc-components/PageHeader/index.js +5 -6
- package/es/lowcode/view/lc-components/PageLayout/FunctionDesign.js +63 -0
- package/es/lowcode/view/lc-components/PageLayout/FunctionLive.js +10 -0
- package/es/lowcode/view/lc-components/PageLayout/FunctionPreview.js +10 -0
- package/es/lowcode/view/lc-components/PageLayout/index.js +32 -0
- package/es/lowcode/view/lc-components/PageLayout/meta.json +47 -0
- package/es/lowcode/view/lc-components/PageModal/index.js +12 -15
- package/es/lowcode/view/lc-components/Section/FunctionDesign.js +25 -2
- package/es/lowcode/view/lc-components/Section/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Section/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Section/index.js +114 -24
- package/es/lowcode/view/lc-components/Section/index.less +7 -0
- package/es/lowcode/view/lc-components/Section/meta.json +48 -49
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +19 -22
- package/es/lowcode/view/lc-components/Split/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Split/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Split/index.js +7 -11
- package/es/lowcode/view/lc-components/Split/meta.json +4 -4
- package/es/lowcode/view/lc-components/Table/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Table/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Table/components/TopFilter.js +78 -57
- package/es/lowcode/view/lc-components/Table/components/TopImex.js +420 -0
- package/es/lowcode/view/lc-components/Table/index.js +294 -47
- package/es/lowcode/view/lc-components/Table/meta.json +19 -13
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +11 -20
- package/es/lowcode/view/lc-components/Tabs/index.js +27 -12
- package/es/lowcode/view/lc-components/Tabs/meta.json +3 -3
- package/es/lowcode/view/lc-components/Text/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Text/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Text/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Text/meta.json +2 -2
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -3
- package/es/lowcode/view/lc-components/Tree/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Tree/index.js +103 -29
- package/es/lowcode/view/lc-components/Tree/meta.json +71 -9
- package/es/lowcode/view/lc-components/Wrapper.js +10 -12
- package/es/services.js +0 -24
- package/es/upload/FilesWall/file.png +0 -0
- package/es/upload/FilesWall/index.js +422 -0
- package/es/upload/FilesWall/index.less +74 -0
- package/es/upload/Form/gridForm.js +10 -5
- package/es/upload/Form/index.js +2 -1
- package/es/upload/FormItem/index.js +8 -9
- package/es/upload/index.js +2 -1
- package/es/utils/action.js +2 -2
- package/es/utils/form.js +16 -3
- package/es/utils/grid.js +8 -5
- package/lib/components/ComplexItem/index.js +100 -0
- package/lib/{lowcode/painter/services/toolbar.js → components/ComplexItem/service.js} +8 -12
- package/lib/components/LDActions/index.js +7 -9
- package/lib/components/LDActions/index.less +7 -4
- package/lib/components/LdAutoForm/index.js +33 -10
- package/lib/components/LdFormList/index.js +38 -22
- package/lib/components/LdGrid/index.js +21 -7
- package/lib/components/LdGridForm/index.js +30 -9
- package/lib/components/LdTree/index.js +33 -15
- package/lib/helper/FromItems.js +175 -92
- package/lib/helper/form.js +53 -13
- package/lib/helper/props_config.js +23 -0
- package/lib/locales/zh-CN.js +26 -11
- package/lib/lowcode/constants/api-url.js +355 -104
- package/lib/lowcode/constants/event-topics.js +3 -1
- package/lib/lowcode/constants/index.js +5 -3
- package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +7 -4
- package/lib/lowcode/engine/factory/panel-item-factory/StringStrategy.js +3 -2
- package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +6 -3
- package/lib/lowcode/engine/meta/box.props.default.json +1 -1
- package/lib/lowcode/engine/meta/box.props.json +4 -4
- package/lib/lowcode/engine/meta/button.props.json +4 -4
- package/lib/lowcode/engine/meta/cardlist.props.json +14 -4
- package/lib/lowcode/engine/meta/components-list.json +109 -1
- package/lib/lowcode/engine/meta/dialog.props.default.json +11 -5
- package/lib/lowcode/engine/meta/dialog.props.json +80 -43
- package/lib/lowcode/engine/meta/drawer.props.json +9 -21
- package/lib/lowcode/engine/meta/fieldcolor.props.default.json +14 -0
- package/lib/lowcode/engine/meta/fieldcolor.props.json +63 -0
- package/lib/lowcode/engine/meta/fieldcomplex.props.default.json +13 -0
- package/lib/lowcode/engine/meta/fieldcomplex.props.json +39 -0
- package/lib/lowcode/engine/meta/fielddate.props.default.json +12 -0
- package/lib/lowcode/engine/meta/fielddate.props.json +47 -0
- package/lib/lowcode/engine/meta/fielddict.props.default.json +14 -0
- package/lib/lowcode/engine/meta/fielddict.props.json +44 -0
- package/lib/lowcode/engine/meta/fieldeditor.props.default.json +13 -0
- package/lib/lowcode/engine/meta/fieldeditor.props.json +44 -0
- package/lib/lowcode/engine/meta/fieldgroup.props.default.json +15 -0
- package/lib/lowcode/engine/meta/fieldgroup.props.json +73 -0
- package/lib/lowcode/engine/meta/fieldnumber.props.default.json +14 -0
- package/lib/lowcode/engine/meta/fieldnumber.props.json +48 -0
- package/lib/lowcode/engine/meta/fieldradio.props.default.json +12 -0
- package/lib/lowcode/engine/meta/fieldradio.props.json +20 -0
- package/lib/lowcode/engine/meta/fieldregion.props.default.json +12 -0
- package/lib/lowcode/engine/meta/fieldregion.props.json +26 -0
- package/lib/lowcode/engine/meta/fieldselect.props.default.json +14 -0
- package/lib/lowcode/engine/meta/fieldselect.props.json +58 -0
- package/lib/lowcode/engine/meta/fieldstring.props.default.json +16 -0
- package/lib/lowcode/engine/meta/fieldstring.props.json +62 -0
- package/lib/lowcode/engine/meta/fieldswitch.props.default.json +12 -0
- package/lib/lowcode/engine/meta/fieldswitch.props.json +31 -0
- package/lib/lowcode/engine/meta/fieldtextarea.props.default.json +13 -0
- package/lib/lowcode/engine/meta/fieldtextarea.props.json +49 -0
- package/lib/lowcode/engine/meta/fieldupload.props.default.json +15 -0
- package/lib/lowcode/engine/meta/fieldupload.props.json +71 -0
- package/lib/lowcode/engine/meta/fielduser.props.default.json +16 -0
- package/lib/lowcode/engine/meta/fielduser.props.json +82 -0
- package/lib/lowcode/engine/meta/fieldyear.props.default.json +12 -0
- package/lib/lowcode/engine/meta/fieldyear.props.json +37 -0
- package/lib/lowcode/engine/meta/form.props.default.json +4 -5
- package/lib/lowcode/engine/meta/form.props.json +44 -35
- package/lib/lowcode/engine/meta/image.props.json +2 -2
- package/lib/lowcode/engine/meta/imex.props.default.json +8 -1
- package/lib/lowcode/engine/meta/imex.props.json +54 -22
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
- package/lib/lowcode/engine/meta/layout.props.json +2 -2
- package/lib/lowcode/engine/meta/link.props.json +1 -1
- package/lib/lowcode/engine/meta/page.props.json +2 -2
- package/lib/lowcode/engine/meta/pagelayout.props.default.json +14 -0
- package/lib/lowcode/engine/meta/pagelayout.props.json +47 -0
- package/lib/lowcode/engine/meta/section.props.default.json +4 -6
- package/lib/lowcode/engine/meta/section.props.json +52 -49
- package/lib/lowcode/engine/meta/split.props.default.json +1 -1
- package/lib/lowcode/engine/meta/split.props.json +4 -4
- package/lib/lowcode/engine/meta/table.props.json +19 -13
- package/lib/lowcode/engine/meta/tabs.props.json +3 -3
- package/lib/lowcode/engine/meta/text.props.json +2 -2
- package/lib/lowcode/engine/meta/tree.props.default.json +2 -0
- package/lib/lowcode/engine/meta/tree.props.json +71 -8
- package/lib/lowcode/engine/provider/ContextProvider/index.js +37 -35
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +86 -34
- package/lib/lowcode/engine/tools/dataProcess.js +4 -0
- package/lib/lowcode/engine/tools/diff.js +67 -0
- package/lib/lowcode/engine/tools/helper.js +48 -25
- package/lib/lowcode/engine/tools/useCanvasRender.js +6 -7
- package/lib/lowcode/engine/tools/usePageDataStore.js +338 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +6 -8
- package/lib/lowcode/engine/tools/useTodo.js +19 -9
- package/lib/lowcode/painter/Design.js +39 -4
- package/lib/lowcode/painter/DesignOperator.js +109 -85
- package/lib/lowcode/painter/DesignToolbar.js +277 -33
- package/lib/lowcode/painter/Outline.js +10 -8
- package/lib/lowcode/painter/Panel.js +82 -44
- package/lib/lowcode/painter/components/ActionBindModal.js +36 -25
- package/lib/lowcode/painter/components/AdvancePanel.js +36 -20
- package/lib/lowcode/painter/components/AttrsPanel.js +44 -33
- package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
- package/lib/lowcode/painter/components/DragDrop/DragDropWrapper.js +5 -2
- package/lib/lowcode/painter/components/FieldSelector.js +26 -13
- package/lib/lowcode/painter/components/ListEditor.js +8 -2
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +5 -9
- package/lib/lowcode/painter/components/field-setting/BatchSetting.js +13 -3
- package/lib/lowcode/painter/components/field-setting/CheckFrontRules.js +116 -0
- package/lib/lowcode/painter/components/field-setting/CheckRules.js +1 -26
- package/lib/lowcode/painter/components/field-setting/FieldRulesModal.js +34 -13
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +179 -28
- package/lib/lowcode/painter/components/field-setting/index.js +40 -61
- package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +59 -0
- package/lib/lowcode/painter/index.js +1 -30
- package/lib/lowcode/painter/panel-section/ActionsColumnWidth.js +32 -0
- package/lib/lowcode/painter/panel-section/BlockEditor/index.js +7 -4
- package/lib/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +4 -3
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +53 -25
- package/lib/lowcode/painter/panel-section/ButtonType.js +4 -2
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +30 -7
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +121 -52
- package/lib/lowcode/painter/panel-section/I18nInput.js +27 -0
- package/lib/lowcode/painter/panel-section/ImpExp.js +99 -13
- package/lib/lowcode/painter/panel-section/ImpExpAlone.js +114 -0
- package/lib/lowcode/painter/panel-section/PageLayoutDisplay.js +103 -0
- package/lib/lowcode/painter/panel-section/SerialsSelector.js +4 -2
- package/lib/lowcode/painter/panel-section/SplitDisplay.js +24 -109
- package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +5 -4
- package/lib/lowcode/painter/panel-section/StylePanel/index.js +10 -4
- package/lib/lowcode/painter/panel-section/TableTopFilter.js +22 -12
- package/lib/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
- package/lib/lowcode/painter/style/action-bind-modal.less +3 -3
- package/lib/lowcode/painter/style/design.less +11 -4
- package/lib/lowcode/painter/style/list-editor.less +36 -0
- package/lib/lowcode/painter/style/page-layout-display.less +28 -0
- package/lib/lowcode/painter/style/panel-item.less +1 -1
- package/lib/lowcode/painter/style/split-display.less +0 -9
- package/lib/lowcode/preview/index.js +21 -5
- package/lib/lowcode/view/Canvas.js +5 -6
- package/lib/lowcode/view/Page.js +5 -6
- package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
- package/lib/lowcode/view/lc-components/Box/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Box/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Box/meta.json +4 -4
- package/lib/lowcode/view/lc-components/Button/index.js +2 -6
- package/lib/lowcode/view/lc-components/Button/meta.json +4 -4
- package/lib/lowcode/view/lc-components/CardList/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/CardList/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/CardList/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/CardList/meta.json +14 -4
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -11
- package/lib/lowcode/view/lc-components/Dialog/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Dialog/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Dialog/index.js +119 -19
- package/lib/lowcode/view/lc-components/Dialog/meta.json +73 -43
- package/lib/lowcode/view/lc-components/Drawer/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Drawer/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Drawer/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Drawer/meta.json +9 -21
- package/lib/lowcode/view/lc-components/FieldColor/meta.json +63 -0
- package/lib/lowcode/view/lc-components/FieldComplex/meta.json +39 -0
- package/lib/lowcode/view/lc-components/FieldDate/meta.json +45 -0
- package/lib/lowcode/view/lc-components/FieldDict/meta.json +44 -0
- package/lib/lowcode/view/lc-components/FieldEditor/meta.json +44 -0
- package/lib/lowcode/view/lc-components/FieldGroup/meta.json +73 -0
- package/lib/lowcode/view/lc-components/FieldNumber/meta.json +48 -0
- package/lib/lowcode/view/lc-components/FieldRadio/meta.json +20 -0
- package/lib/lowcode/view/lc-components/FieldRegion/meta.json +26 -0
- package/lib/lowcode/view/lc-components/FieldSelect/meta.json +58 -0
- package/lib/lowcode/view/lc-components/FieldString/meta.json +62 -0
- package/lib/lowcode/view/lc-components/FieldSwitch/meta.json +31 -0
- package/lib/lowcode/view/lc-components/FieldTextarea/meta.json +49 -0
- package/lib/lowcode/view/lc-components/FieldUpload/meta.json +71 -0
- package/lib/lowcode/view/lc-components/FieldUser/meta.json +82 -0
- package/lib/lowcode/view/lc-components/FieldYear/meta.json +35 -0
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +58 -7
- package/lib/lowcode/view/lc-components/Form/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +9 -1
- package/lib/lowcode/view/lc-components/Form/index.js +396 -61
- package/lib/lowcode/view/lc-components/Form/meta.json +44 -35
- package/lib/lowcode/view/lc-components/Iframe/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Iframe/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Iframe/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +9 -3
- package/lib/lowcode/view/lc-components/ImEx/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/index.js +468 -9
- package/lib/lowcode/view/lc-components/ImEx/index.less +7 -0
- package/lib/lowcode/view/lc-components/ImEx/meta.json +55 -23
- package/lib/lowcode/view/lc-components/Image/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Image/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Image/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Image/meta.json +2 -2
- package/lib/lowcode/view/lc-components/JSX/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/JSX/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/JSX/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +11 -19
- package/lib/lowcode/view/lc-components/Layout/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Layout/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Link/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Link/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Link/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Link/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Page/meta.json +2 -2
- package/lib/lowcode/view/lc-components/PageContent/index.js +7 -8
- package/lib/lowcode/view/lc-components/PageFooter/index.js +2 -5
- package/lib/lowcode/view/lc-components/PageHeader/index.js +4 -5
- package/lib/lowcode/view/lc-components/PageLayout/FunctionDesign.js +71 -0
- package/lib/lowcode/view/lc-components/PageLayout/FunctionLive.js +17 -0
- package/lib/lowcode/view/lc-components/PageLayout/FunctionPreview.js +17 -0
- package/lib/lowcode/view/lc-components/PageLayout/index.js +40 -0
- package/lib/lowcode/view/lc-components/PageLayout/meta.json +47 -0
- package/lib/lowcode/view/lc-components/PageModal/index.js +11 -14
- package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +25 -2
- package/lib/lowcode/view/lc-components/Section/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Section/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Section/index.js +113 -23
- package/lib/lowcode/view/lc-components/Section/index.less +7 -0
- package/lib/lowcode/view/lc-components/Section/meta.json +48 -49
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +18 -21
- package/lib/lowcode/view/lc-components/Split/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Split/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Split/index.js +4 -8
- package/lib/lowcode/view/lc-components/Split/meta.json +4 -4
- package/lib/lowcode/view/lc-components/Table/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Table/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Table/components/TopFilter.js +75 -55
- package/lib/lowcode/view/lc-components/Table/components/TopImex.js +428 -0
- package/lib/lowcode/view/lc-components/Table/index.js +292 -45
- package/lib/lowcode/view/lc-components/Table/meta.json +19 -13
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +9 -18
- package/lib/lowcode/view/lc-components/Tabs/index.js +26 -11
- package/lib/lowcode/view/lc-components/Tabs/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Text/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Text/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Text/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Text/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -3
- package/lib/lowcode/view/lc-components/Tree/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Tree/index.js +100 -26
- package/lib/lowcode/view/lc-components/Tree/meta.json +71 -9
- package/lib/lowcode/view/lc-components/Wrapper.js +11 -12
- package/lib/services.js +0 -25
- package/lib/upload/FilesWall/file.png +0 -0
- package/lib/upload/FilesWall/index.js +429 -0
- package/lib/upload/FilesWall/index.less +74 -0
- package/lib/upload/Form/gridForm.js +10 -5
- package/lib/upload/Form/index.js +2 -1
- package/lib/upload/FormItem/index.js +8 -9
- package/lib/upload/index.js +8 -1
- package/lib/utils/action.js +2 -2
- package/lib/utils/form.js +16 -3
- package/lib/utils/grid.js +8 -5
- package/package.json +175 -171
- package/es/lowcode/engine/meta/local/local.zh-cn.js +0 -97
- package/lib/lowcode/engine/meta/local/local.zh-cn.js +0 -103
|
@@ -7,17 +7,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.executeCode = executeCode;
|
|
8
8
|
exports.getCtx = getCtx;
|
|
9
9
|
exports.getFuncBody = getFuncBody;
|
|
10
|
+
exports.getLDMetaAttr = getLDMetaAttr;
|
|
10
11
|
exports.isColor = isColor;
|
|
11
12
|
exports.isPromise = isPromise;
|
|
12
13
|
exports.listReducer = listReducer;
|
|
13
14
|
exports.omitBadProps = omitBadProps;
|
|
14
15
|
exports.parseCSS = parseCSS;
|
|
16
|
+
exports.setLDMetaAttrs = setLDMetaAttrs;
|
|
15
17
|
var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
|
|
16
18
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
17
19
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
18
20
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
19
21
|
var _lodash = require("lodash");
|
|
20
22
|
var _postcss = _interopRequireDefault(require("postcss"));
|
|
23
|
+
var _constants = require("../../constants");
|
|
21
24
|
function isPromise(value) {
|
|
22
25
|
return !!value && (0, _typeof2.default)(value) === 'object' && typeof value.then === 'function';
|
|
23
26
|
}
|
|
@@ -27,41 +30,43 @@ function omitBadProps(props) {
|
|
|
27
30
|
}
|
|
28
31
|
function listReducer(state, action) {
|
|
29
32
|
switch (action.type) {
|
|
30
|
-
case '
|
|
33
|
+
case 'insert':
|
|
31
34
|
{
|
|
32
35
|
var _action$callback;
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
var newState = (0, _toConsumableArray2.default)(state);
|
|
37
|
+
newState.splice(action.payload.index + 1, 0, action.payload.data);
|
|
38
|
+
(_action$callback = action.callback) === null || _action$callback === void 0 || _action$callback.call(action, newState);
|
|
39
|
+
return newState;
|
|
35
40
|
}
|
|
36
41
|
case 'add':
|
|
37
42
|
{
|
|
38
43
|
var _action$callback2;
|
|
39
|
-
var
|
|
40
|
-
(_action$callback2 = action.callback) === null || _action$callback2 === void 0 || _action$callback2.call(action,
|
|
41
|
-
return
|
|
44
|
+
var _newState = [].concat((0, _toConsumableArray2.default)(state), [action.payload]);
|
|
45
|
+
(_action$callback2 = action.callback) === null || _action$callback2 === void 0 || _action$callback2.call(action, _newState);
|
|
46
|
+
return _newState;
|
|
42
47
|
}
|
|
43
48
|
case 'delete':
|
|
44
49
|
{
|
|
45
50
|
var _action$callback3;
|
|
46
|
-
var
|
|
51
|
+
var _newState2 = state.filter(function (item) {
|
|
47
52
|
return item.id !== action.payload;
|
|
48
53
|
});
|
|
49
|
-
(_action$callback3 = action.callback) === null || _action$callback3 === void 0 || _action$callback3.call(action,
|
|
50
|
-
return
|
|
54
|
+
(_action$callback3 = action.callback) === null || _action$callback3 === void 0 || _action$callback3.call(action, _newState2);
|
|
55
|
+
return _newState2;
|
|
51
56
|
}
|
|
52
57
|
case 'edit':
|
|
53
58
|
{
|
|
54
59
|
var _action$callback4;
|
|
55
|
-
var
|
|
60
|
+
var _newState3 = state.map(function (item) {
|
|
56
61
|
return item.id === action.payload.id ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), action.payload.data) : item;
|
|
57
62
|
});
|
|
58
|
-
(_action$callback4 = action.callback) === null || _action$callback4 === void 0 || _action$callback4.call(action,
|
|
59
|
-
return
|
|
63
|
+
(_action$callback4 = action.callback) === null || _action$callback4 === void 0 || _action$callback4.call(action, _newState3);
|
|
64
|
+
return _newState3;
|
|
60
65
|
}
|
|
61
66
|
case 'batchEdit':
|
|
62
67
|
{
|
|
63
68
|
var _action$callback5;
|
|
64
|
-
var
|
|
69
|
+
var _newState4 = state.map(function (item) {
|
|
65
70
|
var newItem = action.payload.items.find(function (_id) {
|
|
66
71
|
return _id === item.id;
|
|
67
72
|
});
|
|
@@ -70,25 +75,25 @@ function listReducer(state, action) {
|
|
|
70
75
|
}
|
|
71
76
|
return item;
|
|
72
77
|
});
|
|
73
|
-
(_action$callback5 = action.callback) === null || _action$callback5 === void 0 || _action$callback5.call(action,
|
|
74
|
-
return
|
|
78
|
+
(_action$callback5 = action.callback) === null || _action$callback5 === void 0 || _action$callback5.call(action, _newState4);
|
|
79
|
+
return _newState4;
|
|
75
80
|
}
|
|
76
81
|
case 'active':
|
|
77
82
|
{
|
|
78
83
|
var _action$callback6;
|
|
79
|
-
var
|
|
84
|
+
var _newState5 = state.map(function (item) {
|
|
80
85
|
item.active = false;
|
|
81
86
|
return item.id === action.payload.id ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), action.payload.data) : item;
|
|
82
87
|
});
|
|
83
|
-
(_action$callback6 = action.callback) === null || _action$callback6 === void 0 || _action$callback6.call(action,
|
|
84
|
-
return
|
|
88
|
+
(_action$callback6 = action.callback) === null || _action$callback6 === void 0 || _action$callback6.call(action, _newState5);
|
|
89
|
+
return _newState5;
|
|
85
90
|
}
|
|
91
|
+
case 'init':
|
|
86
92
|
case 'new':
|
|
87
93
|
{
|
|
88
94
|
var _action$callback7;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return _newState5;
|
|
95
|
+
(_action$callback7 = action.callback) === null || _action$callback7 === void 0 || _action$callback7.call(action, action.payload);
|
|
96
|
+
return action.payload;
|
|
92
97
|
}
|
|
93
98
|
case 'sort':
|
|
94
99
|
{
|
|
@@ -108,9 +113,8 @@ function listReducer(state, action) {
|
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
115
|
function getCtx(context) {
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
});
|
|
116
|
+
return context;
|
|
117
|
+
// return omitBy(context, (_, key) => startsWith(key, '_'));
|
|
114
118
|
}
|
|
115
119
|
function getFuncBody(funcCode) {
|
|
116
120
|
var regex = /{([\s\S]*?)}(?![\s\S]*})/;
|
|
@@ -155,9 +159,28 @@ function parseCSS(cssString) {
|
|
|
155
159
|
// 返回包含所有样式的对象
|
|
156
160
|
return parsedStyles;
|
|
157
161
|
}
|
|
158
|
-
;
|
|
159
162
|
function isColor(str) {
|
|
160
163
|
var hexRegex = /^#(?:[A-Fa-f0-9]{3,4}){1,2}$/;
|
|
161
164
|
var rgbaRegex = /^rgba?\(\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(,\s*(0|1|0?\.\d+))?\s*\)$/;
|
|
162
165
|
return hexRegex.test(str) || rgbaRegex.test(str);
|
|
166
|
+
}
|
|
167
|
+
function setLDMetaAttrs(data) {
|
|
168
|
+
var meta = document.querySelector("meta[name=\"".concat(_constants.META_TAG_NAME, "\"]"));
|
|
169
|
+
if (!meta) {
|
|
170
|
+
meta = document.createElement('meta');
|
|
171
|
+
}
|
|
172
|
+
meta.name = _constants.META_TAG_NAME;
|
|
173
|
+
meta.content = new URLSearchParams(data).toString().replaceAll('&', ',');
|
|
174
|
+
document.head.appendChild(meta);
|
|
175
|
+
}
|
|
176
|
+
function getLDMetaAttr(name) {
|
|
177
|
+
if ((0, _lodash.isNil)(name)) return void 0;
|
|
178
|
+
var meta = document.querySelector("meta[name=\"".concat(_constants.META_TAG_NAME, "\"]"));
|
|
179
|
+
var params = new URLSearchParams(meta.content.replaceAll(',', '&'));
|
|
180
|
+
if ((0, _lodash.isArray)(name)) {
|
|
181
|
+
return name.map(function (n) {
|
|
182
|
+
return params.get(n);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
return params.get(name);
|
|
163
186
|
}
|
|
@@ -11,21 +11,20 @@ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helper
|
|
|
11
11
|
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
13
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
14
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
14
|
var _react = _interopRequireWildcard3(require("react"));
|
|
16
15
|
var _umi = require("umi");
|
|
17
16
|
var _ahooks = require("ahooks");
|
|
18
17
|
var _lodash = require("lodash");
|
|
18
|
+
var _ContextProvider = require("../provider/ContextProvider");
|
|
19
19
|
var _constants = require("../../constants");
|
|
20
20
|
var _excluded = ["props", "children"],
|
|
21
21
|
_excluded2 = ["id", "component", "name", "desc", "icon", "group", "groupName", "order"];
|
|
22
22
|
function useCanvasRender(data, deps) {
|
|
23
23
|
var dynamicCompMap = (0, _react.useRef)({});
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var props = _ref.props,
|
|
24
|
+
var ctx = (0, _ContextProvider.useContext)();
|
|
25
|
+
var render = (0, _ahooks.useMemoizedFn)(function () {
|
|
26
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
27
|
+
props = _ref.props,
|
|
29
28
|
children = _ref.children,
|
|
30
29
|
childrenMap = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
31
30
|
if (props && !_constants.LC_BUILDIN_UNIT_KEY_LIST.includes(props.id)) {
|
|
@@ -46,7 +45,7 @@ function useCanvasRender(data, deps) {
|
|
|
46
45
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
47
46
|
while (1) switch (_context.prev = _context.next) {
|
|
48
47
|
case 0:
|
|
49
|
-
_runtime = (0, _lodash.upperFirst)(runtime);
|
|
48
|
+
_runtime = (0, _lodash.upperFirst)(ctx.runtime);
|
|
50
49
|
_context.next = 3;
|
|
51
50
|
return function (specifier) {
|
|
52
51
|
return new Promise(function (r) {
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useTemporalStore = exports.useTask = exports.useGet = exports.resetPageData = exports.modifyNode = exports.getSelfAndParent = exports.getLevelNodes = exports.getCanUndoAndRedo = exports.deleteNode = exports.default = exports.addNode = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _zustand = require("zustand");
|
|
12
|
+
var _immer = require("zustand/middleware/immer");
|
|
13
|
+
var _middleware = require("zustand/middleware");
|
|
14
|
+
var _shallow = require("zustand/react/shallow");
|
|
15
|
+
var _lodash = require("lodash");
|
|
16
|
+
var _fastDeepEqual = _interopRequireDefault(require("fast-deep-equal"));
|
|
17
|
+
var _dataProcess = require("./dataProcess");
|
|
18
|
+
var _constants = require("../../constants");
|
|
19
|
+
var temporalStateCreator = function temporalStateCreator(userSet, userGet, options) {
|
|
20
|
+
var stateCreator = function stateCreator(set, get) {
|
|
21
|
+
return {
|
|
22
|
+
pastStates: (options === null || options === void 0 ? void 0 : options.pastStates) || [],
|
|
23
|
+
futureStates: (options === null || options === void 0 ? void 0 : options.futureStates) || [],
|
|
24
|
+
undo: function undo() {
|
|
25
|
+
var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
26
|
+
if (get().pastStates.length) {
|
|
27
|
+
var _options$partialize, _options$diff;
|
|
28
|
+
var currentState = (options === null || options === void 0 || (_options$partialize = options.partialize) === null || _options$partialize === void 0 ? void 0 : _options$partialize.call(options, userGet())) || userGet();
|
|
29
|
+
var statesToApply = get().pastStates.splice(-steps, steps);
|
|
30
|
+
var nextState = statesToApply.shift();
|
|
31
|
+
userSet(nextState);
|
|
32
|
+
set({
|
|
33
|
+
pastStates: get().pastStates,
|
|
34
|
+
futureStates: get().futureStates.concat((options === null || options === void 0 || (_options$diff = options.diff) === null || _options$diff === void 0 ? void 0 : _options$diff.call(options, currentState, nextState)) || currentState, statesToApply.reverse())
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
redo: function redo() {
|
|
39
|
+
var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
40
|
+
if (get().futureStates.length) {
|
|
41
|
+
var _options$partialize2, _options$diff2;
|
|
42
|
+
var currentState = (options === null || options === void 0 || (_options$partialize2 = options.partialize) === null || _options$partialize2 === void 0 ? void 0 : _options$partialize2.call(options, userGet())) || userGet();
|
|
43
|
+
var statesToApply = get().futureStates.splice(-steps, steps);
|
|
44
|
+
var nextState = statesToApply.shift();
|
|
45
|
+
userSet(nextState);
|
|
46
|
+
set({
|
|
47
|
+
pastStates: get().pastStates.concat((options === null || options === void 0 || (_options$diff2 = options.diff) === null || _options$diff2 === void 0 ? void 0 : _options$diff2.call(options, currentState, nextState)) || currentState, statesToApply.reverse()),
|
|
48
|
+
futureStates: get().futureStates
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
clear: function clear() {
|
|
53
|
+
return set({
|
|
54
|
+
pastStates: [],
|
|
55
|
+
futureStates: []
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
isTracking: true,
|
|
59
|
+
pause: function pause() {
|
|
60
|
+
return set({
|
|
61
|
+
isTracking: false
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
resume: function resume() {
|
|
65
|
+
return set({
|
|
66
|
+
isTracking: true
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
setOnSave: function setOnSave(_onSave) {
|
|
70
|
+
return set({
|
|
71
|
+
_onSave: _onSave
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
// Internal properties
|
|
75
|
+
_onSave: options === null || options === void 0 ? void 0 : options.onSave,
|
|
76
|
+
_handleSet: function _handleSet(pastState, replace, currentState, deltaState) {
|
|
77
|
+
var _get$_onSave, _get;
|
|
78
|
+
if (options !== null && options !== void 0 && options.limit && get().pastStates.length >= (options === null || options === void 0 ? void 0 : options.limit)) {
|
|
79
|
+
get().pastStates.shift();
|
|
80
|
+
}
|
|
81
|
+
(_get$_onSave = (_get = get())._onSave) === null || _get$_onSave === void 0 || _get$_onSave.call(_get, pastState, currentState);
|
|
82
|
+
set({
|
|
83
|
+
pastStates: get().pastStates.concat(deltaState || pastState),
|
|
84
|
+
futureStates: []
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
return stateCreator;
|
|
90
|
+
};
|
|
91
|
+
var temporal = function temporal(config, options) {
|
|
92
|
+
var configWithTemporal = function configWithTemporal(set, get, store) {
|
|
93
|
+
var _options$wrapTemporal, _options$handleSet;
|
|
94
|
+
store.temporal = (0, _zustand.createStore)((options === null || options === void 0 || (_options$wrapTemporal = options.wrapTemporal) === null || _options$wrapTemporal === void 0 ? void 0 : _options$wrapTemporal.call(options, temporalStateCreator(set, get, options))) || temporalStateCreator(set, get, options));
|
|
95
|
+
var curriedHandleSet = (options === null || options === void 0 || (_options$handleSet = options.handleSet) === null || _options$handleSet === void 0 ? void 0 : _options$handleSet.call(options, store.temporal.getState()._handleSet)) || store.temporal.getState()._handleSet;
|
|
96
|
+
var temporalHandleSet = function temporalHandleSet(pastState) {
|
|
97
|
+
var _options$partialize3, _options$diff3, _options$equality;
|
|
98
|
+
if (!store.temporal.getState().isTracking) return;
|
|
99
|
+
var currentState = (options === null || options === void 0 || (_options$partialize3 = options.partialize) === null || _options$partialize3 === void 0 ? void 0 : _options$partialize3.call(options, get())) || get();
|
|
100
|
+
var deltaState = options === null || options === void 0 || (_options$diff3 = options.diff) === null || _options$diff3 === void 0 ? void 0 : _options$diff3.call(options, pastState, currentState);
|
|
101
|
+
if (
|
|
102
|
+
// Don't call handleSet if state hasn't changed, as determined by diff fn or equality fn
|
|
103
|
+
!(
|
|
104
|
+
// If the user has provided a diff function but nothing has been changed, deltaState will be null
|
|
105
|
+
|
|
106
|
+
deltaState === null || // If the user has provided an equality function, use it
|
|
107
|
+
options !== null && options !== void 0 && (_options$equality = options.equality) !== null && _options$equality !== void 0 && _options$equality.call(options, pastState, currentState))) {
|
|
108
|
+
curriedHandleSet(pastState, void 0, currentState, deltaState);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var setState = store.setState;
|
|
112
|
+
store.setState = function () {
|
|
113
|
+
var _options$partialize4;
|
|
114
|
+
var pastState = (options === null || options === void 0 || (_options$partialize4 = options.partialize) === null || _options$partialize4 === void 0 ? void 0 : _options$partialize4.call(options, get())) || get();
|
|
115
|
+
setState.apply(void 0, arguments);
|
|
116
|
+
temporalHandleSet(pastState);
|
|
117
|
+
};
|
|
118
|
+
return config(
|
|
119
|
+
// Modify the set function to call the userlandSet function
|
|
120
|
+
function () {
|
|
121
|
+
var _options$partialize5;
|
|
122
|
+
var pastState = (options === null || options === void 0 || (_options$partialize5 = options.partialize) === null || _options$partialize5 === void 0 ? void 0 : _options$partialize5.call(options, get())) || get();
|
|
123
|
+
set.apply(void 0, arguments);
|
|
124
|
+
temporalHandleSet(pastState);
|
|
125
|
+
}, get, store);
|
|
126
|
+
};
|
|
127
|
+
return configWithTemporal;
|
|
128
|
+
};
|
|
129
|
+
var findNode = function findNode(obj, id) {
|
|
130
|
+
for (var key in obj) {
|
|
131
|
+
if (!['props', 'children'].includes(key)) {
|
|
132
|
+
if (key === id) {
|
|
133
|
+
return {
|
|
134
|
+
target: obj[key],
|
|
135
|
+
parent: obj
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if ((0, _typeof2.default)(obj[key]) === 'object' && !Array.isArray(obj[key])) {
|
|
139
|
+
var result = findNode(obj[key], id);
|
|
140
|
+
if (result) {
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
};
|
|
148
|
+
var usePageDataStore = (0, _zustand.create)()((0, _immer.immer)((0, _middleware.subscribeWithSelector)(temporal(function (set) {
|
|
149
|
+
return {
|
|
150
|
+
pageData: null,
|
|
151
|
+
moduleData: null,
|
|
152
|
+
initialize: function initialize(data) {
|
|
153
|
+
return set(function (state) {
|
|
154
|
+
state.pageData = data;
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
initializeModule: function initializeModule(data) {
|
|
158
|
+
return set(function (state) {
|
|
159
|
+
state.moduleData = data;
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
reset: function reset(data) {
|
|
163
|
+
return set(function (state) {
|
|
164
|
+
state.pageData = data || null;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}, {
|
|
169
|
+
partialize: function partialize(state) {
|
|
170
|
+
return {
|
|
171
|
+
pageData: state.pageData
|
|
172
|
+
};
|
|
173
|
+
},
|
|
174
|
+
equality: function equality(pastState, newState) {
|
|
175
|
+
return !pastState.pageData || (0, _fastDeepEqual.default)(pastState, newState);
|
|
176
|
+
},
|
|
177
|
+
handleSet: function handleSet(_handleSet2) {
|
|
178
|
+
return (0, _lodash.debounce)(function (state) {
|
|
179
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {
|
|
180
|
+
args[_key2 - 1] = arguments[_key2];
|
|
181
|
+
}
|
|
182
|
+
return _handleSet2.apply(void 0, [state].concat(args));
|
|
183
|
+
}, 400, {
|
|
184
|
+
leading: true,
|
|
185
|
+
trailing: false
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}))));
|
|
189
|
+
var _default = exports.default = usePageDataStore;
|
|
190
|
+
var resetPageData = exports.resetPageData = function resetPageData(data) {
|
|
191
|
+
usePageDataStore.setState(function (state) {
|
|
192
|
+
state.pageData = data || null;
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
var addNode = exports.addNode = function addNode(parentId, id, data) {
|
|
196
|
+
usePageDataStore.setState(function (state) {
|
|
197
|
+
if (parentId === _constants.LC_BUILDIN_UNIT_KEY.PAGE_ROOT) {
|
|
198
|
+
state.pageData.children.push(id);
|
|
199
|
+
state.pageData[id] = {
|
|
200
|
+
props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
|
|
201
|
+
id: id,
|
|
202
|
+
parentId: parentId
|
|
203
|
+
})
|
|
204
|
+
};
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
var _ref = findNode(state.pageData, parentId) || {},
|
|
208
|
+
target = _ref.target;
|
|
209
|
+
if (!target) return;
|
|
210
|
+
if (!target.hasOwnProperty('children')) {
|
|
211
|
+
target.children = [];
|
|
212
|
+
}
|
|
213
|
+
if (!target.children.includes(id)) {
|
|
214
|
+
target.children.push(id);
|
|
215
|
+
target[id] = {
|
|
216
|
+
props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
|
|
217
|
+
id: id,
|
|
218
|
+
parentId: parentId
|
|
219
|
+
})
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
var deleteNode = exports.deleteNode = function deleteNode(id) {
|
|
225
|
+
usePageDataStore.setState(function (state) {
|
|
226
|
+
var _parent$children;
|
|
227
|
+
var _ref2 = findNode(state.pageData, id) || {},
|
|
228
|
+
parent = _ref2.parent;
|
|
229
|
+
if (!parent || !((_parent$children = parent.children) !== null && _parent$children !== void 0 && _parent$children.length)) return;
|
|
230
|
+
parent.children.splice(parent.children.indexOf(id), 1);
|
|
231
|
+
if (parent.children.length === 0) {
|
|
232
|
+
delete parent['children'];
|
|
233
|
+
}
|
|
234
|
+
delete parent[id];
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
var modifyNode = exports.modifyNode = function modifyNode(id, data) {
|
|
238
|
+
usePageDataStore.setState(function (state) {
|
|
239
|
+
if (id === _constants.LC_BUILDIN_UNIT_KEY.PAGE_ROOT) {
|
|
240
|
+
(0, _lodash.assign)(state.pageData.props, (0, _lodash.omit)(data, ['id', 'parentId', 'component', 'buildIn']));
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
var _ref3 = findNode(state.pageData, id) || {},
|
|
244
|
+
target = _ref3.target;
|
|
245
|
+
if (!target) return;
|
|
246
|
+
(0, _lodash.forOwn)((0, _lodash.omit)(data, ['id', 'parentId', 'component', 'buildIn']), function (_val, _key) {
|
|
247
|
+
(0, _lodash.set)(target.props, _key, _val);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
var useTask = exports.useTask = function useTask(type) {
|
|
252
|
+
var promiseRef = (0, _react.useRef)(null);
|
|
253
|
+
var task = (0, _react.useCallback)(function () {
|
|
254
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
|
|
255
|
+
args[_key3] = arguments[_key3];
|
|
256
|
+
}
|
|
257
|
+
return new Promise(function (resolve) {
|
|
258
|
+
promiseRef.current = resolve;
|
|
259
|
+
switch (type) {
|
|
260
|
+
case 'add':
|
|
261
|
+
addNode.apply(void 0, args);
|
|
262
|
+
break;
|
|
263
|
+
case 'update':
|
|
264
|
+
case 'modify':
|
|
265
|
+
modifyNode.apply(void 0, args);
|
|
266
|
+
break;
|
|
267
|
+
case 'delete':
|
|
268
|
+
deleteNode.apply(void 0, args);
|
|
269
|
+
break;
|
|
270
|
+
default:
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}, []);
|
|
275
|
+
(0, _react.useEffect)(function () {
|
|
276
|
+
var unsub = usePageDataStore.subscribe(function (state, prevState) {
|
|
277
|
+
if (!promiseRef.current) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
promiseRef.current(state.pageData, prevState.pageData);
|
|
281
|
+
promiseRef.current = null;
|
|
282
|
+
});
|
|
283
|
+
return unsub;
|
|
284
|
+
}, []);
|
|
285
|
+
return task;
|
|
286
|
+
};
|
|
287
|
+
var useGet = exports.useGet = function useGet(_) {
|
|
288
|
+
var result = usePageDataStore((0, _shallow.useShallow)(function (state) {
|
|
289
|
+
if ((0, _lodash.isNil)(_)) {
|
|
290
|
+
return state.pageData;
|
|
291
|
+
} else if ((0, _lodash.isFunction)(_)) {
|
|
292
|
+
return _(state.pageData);
|
|
293
|
+
} else if ((0, _lodash.isArray)(_)) {
|
|
294
|
+
return _.map(function (k) {
|
|
295
|
+
var _findNode;
|
|
296
|
+
return k.includes('.') ? (0, _lodash.get)(state.pageData, k) : (_findNode = findNode(state.pageData, k)) === null || _findNode === void 0 ? void 0 : _findNode.target;
|
|
297
|
+
});
|
|
298
|
+
} else if ((0, _lodash.isObject)(_) && _.id) {
|
|
299
|
+
var _findNode2;
|
|
300
|
+
var path = _.path;
|
|
301
|
+
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;
|
|
302
|
+
return (0, _lodash.isNil)(path) ? _target : (0, _lodash.get)(_target, path);
|
|
303
|
+
} else if ((0, _lodash.isString)(_)) {
|
|
304
|
+
return (0, _lodash.get)(state.pageData, _);
|
|
305
|
+
}
|
|
306
|
+
}));
|
|
307
|
+
return result;
|
|
308
|
+
};
|
|
309
|
+
var getCanUndoAndRedo = exports.getCanUndoAndRedo = function getCanUndoAndRedo() {
|
|
310
|
+
var _usePageDataStore$tem = usePageDataStore.temporal.getState(),
|
|
311
|
+
pastStates = _usePageDataStore$tem.pastStates,
|
|
312
|
+
futureStates = _usePageDataStore$tem.futureStates;
|
|
313
|
+
var canUndo = !!pastStates.length;
|
|
314
|
+
var canRedo = !!futureStates.length;
|
|
315
|
+
return {
|
|
316
|
+
canUndo: canUndo,
|
|
317
|
+
canRedo: canRedo
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
var useTemporalStore = exports.useTemporalStore = function useTemporalStore(selector) {
|
|
321
|
+
var temp = (0, _zustand.useStore)(usePageDataStore.temporal, selector);
|
|
322
|
+
if (!temp) return {
|
|
323
|
+
canUndo: false,
|
|
324
|
+
canRedo: false
|
|
325
|
+
};
|
|
326
|
+
var canUndo = !!temp.pastStates.length;
|
|
327
|
+
var canRedo = !!temp.futureStates.length;
|
|
328
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, temp), {}, {
|
|
329
|
+
canUndo: canUndo,
|
|
330
|
+
canRedo: canRedo
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
var getLevelNodes = exports.getLevelNodes = function getLevelNodes(id) {
|
|
334
|
+
return (0, _dataProcess.getPathNodesById)(usePageDataStore.getState().pageData, id);
|
|
335
|
+
};
|
|
336
|
+
var getSelfAndParent = exports.getSelfAndParent = function getSelfAndParent(id) {
|
|
337
|
+
return (0, _dataProcess.findNodeAndParent)(id, usePageDataStore.getState().pageData);
|
|
338
|
+
};
|
|
@@ -9,25 +9,23 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _ahooks = require("ahooks");
|
|
11
11
|
var usePromiseState = function usePromiseState(initialState) {
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
state =
|
|
15
|
-
setState =
|
|
16
|
-
resetState = _useResetState2[2];
|
|
12
|
+
var _useState = (0, _react.useState)(initialState),
|
|
13
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
14
|
+
state = _useState2[0],
|
|
15
|
+
setState = _useState2[1];
|
|
17
16
|
var promiseRef = (0, _react.useRef)(null);
|
|
18
17
|
var setStatePromise = (0, _react.useCallback)(function (_state) {
|
|
19
18
|
return new Promise(function (resolve) {
|
|
20
19
|
promiseRef.current = resolve;
|
|
21
|
-
console.log('_state', _state);
|
|
22
20
|
setState(_state);
|
|
23
21
|
});
|
|
24
22
|
}, []);
|
|
25
|
-
(0, _ahooks.
|
|
23
|
+
(0, _ahooks.useUpdateLayoutEffect)(function () {
|
|
26
24
|
if (promiseRef.current) {
|
|
27
25
|
promiseRef.current(state);
|
|
28
26
|
promiseRef.current = null;
|
|
29
27
|
}
|
|
30
28
|
}, [state]);
|
|
31
|
-
return [state, setStatePromise
|
|
29
|
+
return [state, setStatePromise];
|
|
32
30
|
};
|
|
33
31
|
var _default = exports.default = usePromiseState;
|
|
@@ -12,6 +12,7 @@ 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 = _interopRequireDefault(require("./usePageDataStore"));
|
|
15
16
|
var _helper = require("./helper");
|
|
16
17
|
var _apiUrl = require("../../constants/api-url");
|
|
17
18
|
var _excluded = ["datasetCode"];
|
|
@@ -32,10 +33,13 @@ var useTodo = function useTodo() {
|
|
|
32
33
|
behaviorKey: behaviorKey
|
|
33
34
|
}, params), data);
|
|
34
35
|
});
|
|
36
|
+
var moduleData = (0, _usePageDataStore.default)(function (state) {
|
|
37
|
+
return state.moduleData;
|
|
38
|
+
});
|
|
35
39
|
var todo = (0, _ahooks.useMemoizedFn)(function (ctx, actionPool) {
|
|
36
40
|
var argsMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
37
41
|
if ((0, _lodash.isNil)(actionPool)) {
|
|
38
|
-
return;
|
|
42
|
+
return Promise.resolve();
|
|
39
43
|
}
|
|
40
44
|
var dsCode = argsMap.datasetCode,
|
|
41
45
|
args = (0, _objectWithoutProperties2.default)(argsMap, _excluded);
|
|
@@ -54,21 +58,27 @@ var useTodo = function useTodo() {
|
|
|
54
58
|
return Promise.resolve(_helper.executeCode.apply(void 0, [ctx, info.code, argsName].concat((0, _toConsumableArray2.default)(_args))));
|
|
55
59
|
case 'page-action':
|
|
56
60
|
{
|
|
57
|
-
var
|
|
58
|
-
moduleCode =
|
|
59
|
-
datasetCode =
|
|
60
|
-
params =
|
|
61
|
-
data =
|
|
61
|
+
var _ref4 = _helper.executeCode.apply(void 0, [ctx, info.code, argsName].concat((0, _toConsumableArray2.default)(_args))) || {},
|
|
62
|
+
moduleCode = _ref4.moduleCode,
|
|
63
|
+
datasetCode = _ref4.datasetCode,
|
|
64
|
+
params = _ref4.params,
|
|
65
|
+
data = _ref4.data,
|
|
66
|
+
after = _ref4.after;
|
|
67
|
+
var _moduleCode = moduleCode || moduleData.moduleCode;
|
|
62
68
|
var _dscode = datasetCode || dsCode;
|
|
63
|
-
if (!
|
|
69
|
+
if (!_moduleCode || !_dscode) {
|
|
64
70
|
_antd.message.warning('接口重要参数(模块编码或数据集编码)丢失');
|
|
65
71
|
return;
|
|
66
72
|
}
|
|
67
73
|
return callBehavior({
|
|
68
74
|
datasetCode: _dscode,
|
|
69
|
-
moduleCode:
|
|
75
|
+
moduleCode: _moduleCode,
|
|
70
76
|
behaviorKey: actionKey
|
|
71
|
-
}, params, data)
|
|
77
|
+
}, params, data).then(function (res) {
|
|
78
|
+
if ((0, _lodash.isFunction)(after)) {
|
|
79
|
+
after(ctx, res);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
72
82
|
}
|
|
73
83
|
case 'trigger':
|
|
74
84
|
return Promise.resolve();
|