@luck-design-biz/luckda 1.0.2-2 → 1.0.2-20temp
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/Builder/index.js +37 -27
- package/es/components/ComplexItem/index.js +5 -3
- package/es/components/ComplexItem/service.js +6 -3
- package/es/components/LDActions/index.js +1 -0
- package/es/components/LdAutoForm/index.js +18 -8
- package/es/components/LdCard/index.js +10 -8
- package/es/components/LdCom/index.js +3 -2
- package/es/components/LdFormList/index.js +10 -7
- package/es/components/LdGrid/index.js +24 -16
- package/es/components/LdGridForm/index.js +16 -7
- package/es/helper/FromItems.js +64 -5
- package/es/helper/action.js +2 -0
- package/es/helper/form.js +7 -1
- package/es/helper/ldBuilder.js +9 -5
- package/es/helper/ldComBuild.js +16 -11
- package/es/locales/zh-CN.js +61 -6
- package/es/lowcode/constants/api-url.js +359 -190
- package/es/lowcode/constants/event-topics.js +4 -0
- package/es/lowcode/constants/index.js +5 -4
- package/es/lowcode/engine/meta/box.props.default.json +1 -1
- package/es/lowcode/engine/meta/box.props.json +1 -1
- package/es/lowcode/engine/meta/cardlist.props.json +3 -5
- package/es/lowcode/engine/meta/components-list.json +6 -0
- package/es/lowcode/engine/meta/dialog.props.default.json +4 -1
- package/es/lowcode/engine/meta/dialog.props.json +24 -4
- package/es/lowcode/engine/meta/drawer.props.json +1 -1
- package/es/lowcode/engine/meta/fielddate.props.default.json +1 -0
- package/es/lowcode/engine/meta/fielddate.props.json +48 -1
- package/es/lowcode/engine/meta/fieldeditor.props.json +0 -1
- package/es/lowcode/engine/meta/fieldgroup.props.json +0 -1
- package/es/lowcode/engine/meta/fieldyear.props.json +0 -1
- package/es/lowcode/engine/meta/form.props.json +3 -19
- package/es/lowcode/engine/meta/grouptree.props.json +0 -1
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +5 -0
- package/es/lowcode/engine/meta/jsx.props.default.json +1 -2
- package/es/lowcode/engine/meta/jsx.props.json +4 -3
- package/es/lowcode/engine/meta/layout.props.default.json +1 -1
- package/es/lowcode/engine/meta/layout.props.json +1 -1
- package/es/lowcode/engine/meta/proxy.props.default.json +15 -0
- package/es/lowcode/engine/meta/proxy.props.json +66 -0
- package/es/lowcode/engine/meta/section.props.json +2 -2
- package/es/lowcode/engine/meta/table.props.json +0 -7
- package/es/lowcode/engine/meta/tabs.props.json +1 -1
- package/es/lowcode/engine/meta/tree.props.json +1 -5
- package/es/lowcode/engine/provider/ContextProvider/index.js +45 -9
- package/es/lowcode/engine/provider/ContextProvider/router.js +21 -1
- package/es/lowcode/engine/provider/ContextProvider/usePageDataStore.js +36 -30
- 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/helper.js +25 -1
- package/es/lowcode/engine/tools/initDS.js +4 -4
- package/es/lowcode/painter/Design.js +1 -0
- package/es/lowcode/painter/DesignOperator.js +135 -27
- package/es/lowcode/painter/DesignToolbar.js +102 -188
- package/es/lowcode/painter/History.js +300 -0
- package/es/lowcode/painter/Panel.js +1 -1
- package/es/lowcode/painter/Ribbon.js +37 -1
- package/es/lowcode/painter/components/AdvancePanel.js +55 -51
- package/es/lowcode/painter/components/DragDrop/DragDropContext.js +10 -3
- package/es/lowcode/painter/components/TipIcon.js +12 -4
- package/es/lowcode/painter/components/TreeEditor.js +76 -8
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +10 -6
- package/es/lowcode/painter/components/code-editor/DiffEditor.js +41 -0
- package/es/lowcode/painter/components/field-setting/FieldAttrs.js +2 -2
- package/es/lowcode/painter/components/field-setting/SettingUI.js +56 -5
- 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 +70 -0
- package/es/lowcode/painter/panel-section/DataSetSelector.js +6 -3
- package/es/lowcode/painter/panel-section/DialogSize.js +76 -0
- package/es/lowcode/painter/panel-section/DialogWidthHeight.js +60 -0
- package/es/lowcode/painter/panel-section/FieldsSetting.js +1 -1
- package/es/lowcode/painter/panel-section/IconConditionSelector.js +2 -2
- package/es/lowcode/painter/panel-section/JSEditor/ToolBar.js +174 -0
- package/es/lowcode/painter/panel-section/JSEditor/index.js +181 -0
- package/es/lowcode/painter/panel-section/JSEditor/index.less +4 -0
- package/es/lowcode/painter/panel-section/PageLayoutDisplay.js +7 -2
- 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/MainPanel.js +37 -26
- package/es/lowcode/painter/style/action-bind-modal.less +1 -1
- package/es/lowcode/painter/style/components.less +1 -1
- package/es/lowcode/painter/style/history.less +46 -0
- package/es/lowcode/painter/style/outline.less +1 -1
- package/es/lowcode/painter/style/panel-item.less +1 -0
- 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/ErrorBoundary.js +80 -0
- package/es/lowcode/view/Page.js +11 -6
- package/es/lowcode/view/lc-components/Box/FunctionDesign.js +4 -2
- package/es/lowcode/view/lc-components/Box/index.less +2 -2
- package/es/lowcode/view/lc-components/Box/meta.json +1 -1
- package/es/lowcode/view/lc-components/CardList/index.js +3 -0
- package/es/lowcode/view/lc-components/CardList/meta.json +3 -5
- package/es/lowcode/view/lc-components/Dialog/index.js +13 -5
- package/es/lowcode/view/lc-components/Dialog/meta.json +24 -4
- package/es/lowcode/view/lc-components/Drawer/index.js +5 -3
- package/es/lowcode/view/lc-components/Drawer/meta.json +1 -1
- package/es/lowcode/view/lc-components/FieldDate/meta.json +48 -1
- package/es/lowcode/view/lc-components/FieldEditor/meta.json +0 -1
- package/es/lowcode/view/lc-components/FieldGroup/meta.json +0 -1
- package/es/lowcode/view/lc-components/FieldYear/meta.json +0 -1
- package/es/lowcode/view/lc-components/Form/index.js +15 -19
- package/es/lowcode/view/lc-components/Form/meta.json +3 -19
- package/es/lowcode/view/lc-components/GroupTree/meta.json +0 -1
- package/es/lowcode/view/lc-components/JSX/RuntimeComp.js +32 -16
- package/es/lowcode/view/lc-components/JSX/meta.json +4 -3
- package/es/lowcode/view/lc-components/Layout/meta.json +1 -1
- package/es/lowcode/view/lc-components/PageLayout/index.js +1 -1
- 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/meta.json +2 -2
- package/es/lowcode/view/lc-components/Table/components/TopImex.js +16 -13
- package/es/lowcode/view/lc-components/Table/index.js +11 -3
- package/es/lowcode/view/lc-components/Table/meta.json +0 -7
- package/es/lowcode/view/lc-components/Tabs/index.js +6 -2
- package/es/lowcode/view/lc-components/Tabs/meta.json +1 -1
- package/es/lowcode/view/lc-components/Tree/index.js +3 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +1 -5
- package/es/lowcode/view/lc-components/Wrapper.js +9 -1
- package/es/services.js +24 -7
- package/es/upload/FilesWall/index.js +16 -6
- package/es/upload/Form/gridForm.js +16 -6
- package/es/upload/FormItem/index.js +16 -4
- package/es/utils/action.js +3 -2
- package/es/utils/form.js +40 -6
- package/es/utils/grid.js +12 -3
- package/lib/components/Builder/index.js +36 -26
- package/lib/components/ComplexItem/index.js +5 -3
- package/lib/components/ComplexItem/service.js +6 -3
- package/lib/components/LDActions/index.js +1 -0
- package/lib/components/LdAutoForm/index.js +15 -5
- package/lib/components/LdCard/index.js +10 -8
- package/lib/components/LdCom/index.js +3 -2
- package/lib/components/LdFormList/index.js +9 -6
- package/lib/components/LdGrid/index.js +24 -16
- package/lib/components/LdGridForm/index.js +13 -4
- package/lib/helper/FromItems.js +64 -5
- package/lib/helper/action.js +2 -0
- package/lib/helper/form.js +7 -1
- package/lib/helper/ldBuilder.js +8 -5
- package/lib/helper/ldComBuild.js +14 -9
- package/lib/locales/zh-CN.js +61 -6
- package/lib/lowcode/constants/api-url.js +360 -190
- package/lib/lowcode/constants/event-topics.js +5 -1
- package/lib/lowcode/constants/index.js +6 -5
- package/lib/lowcode/engine/meta/box.props.default.json +1 -1
- package/lib/lowcode/engine/meta/box.props.json +1 -1
- package/lib/lowcode/engine/meta/cardlist.props.json +3 -5
- package/lib/lowcode/engine/meta/components-list.json +6 -0
- package/lib/lowcode/engine/meta/dialog.props.default.json +4 -1
- package/lib/lowcode/engine/meta/dialog.props.json +24 -4
- package/lib/lowcode/engine/meta/drawer.props.json +1 -1
- package/lib/lowcode/engine/meta/fielddate.props.default.json +1 -0
- package/lib/lowcode/engine/meta/fielddate.props.json +48 -1
- package/lib/lowcode/engine/meta/fieldeditor.props.json +0 -1
- package/lib/lowcode/engine/meta/fieldgroup.props.json +0 -1
- package/lib/lowcode/engine/meta/fieldyear.props.json +0 -1
- package/lib/lowcode/engine/meta/form.props.json +3 -19
- package/lib/lowcode/engine/meta/grouptree.props.json +0 -1
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +5 -0
- package/lib/lowcode/engine/meta/jsx.props.default.json +1 -2
- package/lib/lowcode/engine/meta/jsx.props.json +4 -3
- package/lib/lowcode/engine/meta/layout.props.default.json +1 -1
- package/lib/lowcode/engine/meta/layout.props.json +1 -1
- package/lib/lowcode/engine/meta/proxy.props.default.json +15 -0
- package/lib/lowcode/engine/meta/proxy.props.json +66 -0
- package/lib/lowcode/engine/meta/section.props.json +2 -2
- package/lib/lowcode/engine/meta/table.props.json +0 -7
- package/lib/lowcode/engine/meta/tabs.props.json +1 -1
- package/lib/lowcode/engine/meta/tree.props.json +1 -5
- package/lib/lowcode/engine/provider/ContextProvider/index.js +50 -13
- package/lib/lowcode/engine/provider/ContextProvider/router.js +22 -1
- package/lib/lowcode/engine/provider/ContextProvider/usePageDataStore.js +37 -31
- 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/helper.js +25 -0
- package/lib/lowcode/engine/tools/initDS.js +4 -4
- package/lib/lowcode/painter/Design.js +1 -0
- package/lib/lowcode/painter/DesignOperator.js +132 -24
- package/lib/lowcode/painter/DesignToolbar.js +98 -184
- package/lib/lowcode/painter/History.js +308 -0
- package/lib/lowcode/painter/Panel.js +1 -1
- package/lib/lowcode/painter/Ribbon.js +37 -1
- package/lib/lowcode/painter/components/AdvancePanel.js +53 -49
- package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +10 -3
- package/lib/lowcode/painter/components/TipIcon.js +12 -4
- package/lib/lowcode/painter/components/TreeEditor.js +76 -8
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +10 -6
- package/lib/lowcode/painter/components/code-editor/DiffEditor.js +49 -0
- package/lib/lowcode/painter/components/field-setting/FieldAttrs.js +2 -2
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +55 -4
- 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 +78 -0
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +6 -3
- package/lib/lowcode/painter/panel-section/DialogSize.js +83 -0
- package/lib/lowcode/painter/panel-section/DialogWidthHeight.js +67 -0
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +1 -1
- package/lib/lowcode/painter/panel-section/IconConditionSelector.js +2 -2
- package/lib/lowcode/painter/panel-section/JSEditor/ToolBar.js +181 -0
- package/lib/lowcode/painter/panel-section/JSEditor/index.js +189 -0
- package/lib/lowcode/painter/panel-section/JSEditor/index.less +4 -0
- package/lib/lowcode/painter/panel-section/PageLayoutDisplay.js +7 -2
- 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/MainPanel.js +37 -26
- package/lib/lowcode/painter/style/action-bind-modal.less +1 -1
- package/lib/lowcode/painter/style/components.less +1 -1
- package/lib/lowcode/painter/style/history.less +46 -0
- package/lib/lowcode/painter/style/outline.less +1 -1
- package/lib/lowcode/painter/style/panel-item.less +1 -0
- 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/ErrorBoundary.js +88 -0
- package/lib/lowcode/view/Page.js +12 -7
- package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +4 -2
- package/lib/lowcode/view/lc-components/Box/index.less +2 -2
- package/lib/lowcode/view/lc-components/Box/meta.json +1 -1
- package/lib/lowcode/view/lc-components/CardList/index.js +3 -0
- package/lib/lowcode/view/lc-components/CardList/meta.json +3 -5
- package/lib/lowcode/view/lc-components/Dialog/index.js +11 -3
- package/lib/lowcode/view/lc-components/Dialog/meta.json +24 -4
- package/lib/lowcode/view/lc-components/Drawer/index.js +3 -1
- package/lib/lowcode/view/lc-components/Drawer/meta.json +1 -1
- package/lib/lowcode/view/lc-components/FieldDate/meta.json +48 -1
- package/lib/lowcode/view/lc-components/FieldEditor/meta.json +0 -1
- package/lib/lowcode/view/lc-components/FieldGroup/meta.json +0 -1
- package/lib/lowcode/view/lc-components/FieldYear/meta.json +0 -1
- package/lib/lowcode/view/lc-components/Form/index.js +15 -19
- package/lib/lowcode/view/lc-components/Form/meta.json +3 -19
- package/lib/lowcode/view/lc-components/GroupTree/meta.json +0 -1
- package/lib/lowcode/view/lc-components/JSX/RuntimeComp.js +33 -16
- package/lib/lowcode/view/lc-components/JSX/meta.json +4 -3
- package/lib/lowcode/view/lc-components/Layout/meta.json +1 -1
- package/lib/lowcode/view/lc-components/PageLayout/index.js +1 -1
- 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/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Table/components/TopImex.js +16 -13
- package/lib/lowcode/view/lc-components/Table/index.js +11 -3
- package/lib/lowcode/view/lc-components/Table/meta.json +0 -7
- package/lib/lowcode/view/lc-components/Tabs/index.js +5 -1
- package/lib/lowcode/view/lc-components/Tabs/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Tree/index.js +3 -0
- package/lib/lowcode/view/lc-components/Tree/meta.json +1 -5
- package/lib/lowcode/view/lc-components/Wrapper.js +8 -0
- package/lib/services.js +25 -7
- package/lib/upload/FilesWall/index.js +13 -3
- package/lib/upload/Form/gridForm.js +13 -3
- package/lib/upload/FormItem/index.js +15 -3
- package/lib/utils/action.js +6 -0
- package/lib/utils/form.js +40 -5
- package/lib/utils/grid.js +13 -4
- package/package.json +1 -2
- package/es/lowcode/painter/panel-section/JSEditor.js +0 -49
- package/es/lowcode/view/errorBoundary.js +0 -61
- package/lib/lowcode/painter/panel-section/JSEditor.js +0 -57
- package/lib/lowcode/view/errorBoundary.js +0 -69
|
@@ -182,7 +182,6 @@
|
|
|
182
182
|
"name": "默认选中行",
|
|
183
183
|
"type": "_JSEditor",
|
|
184
184
|
"defaultCode": "function getRowDefaultSelected(data, node) { \n return false; \n}",
|
|
185
|
-
"mustConfirm": true,
|
|
186
185
|
"wrapper": "collapse",
|
|
187
186
|
"wrapperProps": {
|
|
188
187
|
"suppressIcon": true
|
|
@@ -193,7 +192,6 @@
|
|
|
193
192
|
"name": "行是否可选",
|
|
194
193
|
"type": "_JSEditor",
|
|
195
194
|
"defaultCode": "function getRowSelectable(data, node) { \n return true; \n}",
|
|
196
|
-
"mustConfirm": true,
|
|
197
195
|
"wrapper": "collapse",
|
|
198
196
|
"wrapperProps": {
|
|
199
197
|
"suppressIcon": true
|
|
@@ -322,7 +320,6 @@
|
|
|
322
320
|
"name": "格式化数据",
|
|
323
321
|
"type": "_JSEditor",
|
|
324
322
|
"defaultCode": "function formatDataSource(list, detail) { \n return []; \n}",
|
|
325
|
-
"mustConfirm": true,
|
|
326
323
|
"wrapper": "collapse",
|
|
327
324
|
"wrapperProps": {
|
|
328
325
|
"suppressIcon": true
|
|
@@ -333,7 +330,6 @@
|
|
|
333
330
|
"name": "构建树层级",
|
|
334
331
|
"type": "_JSEditor",
|
|
335
332
|
"defaultCode": "function getDataPath(data) { \n return []; \n}",
|
|
336
|
-
"mustConfirm": true,
|
|
337
333
|
"wrapper": "collapse",
|
|
338
334
|
"wrapperProps": {
|
|
339
335
|
"suppressIcon": true
|
|
@@ -345,7 +341,6 @@
|
|
|
345
341
|
"desc": "自定义某些表格列",
|
|
346
342
|
"type": "_JSEditor",
|
|
347
343
|
"defaultCode": "function columnsRewrite(columns) { \n return columns; \n}",
|
|
348
|
-
"mustConfirm": true,
|
|
349
344
|
"wrapper": "collapse",
|
|
350
345
|
"wrapperProps": {
|
|
351
346
|
"suppressIcon": true
|
|
@@ -357,7 +352,6 @@
|
|
|
357
352
|
"desc": "完全自定义所有表格列,优先级大于columnsRewrite",
|
|
358
353
|
"type": "_JSEditor",
|
|
359
354
|
"defaultCode": "function columnsReset(columns) { \n return columns; \n}",
|
|
360
|
-
"mustConfirm": true,
|
|
361
355
|
"wrapper": "collapse",
|
|
362
356
|
"wrapperProps": {
|
|
363
357
|
"suppressIcon": true
|
|
@@ -368,7 +362,6 @@
|
|
|
368
362
|
"name": "model参数",
|
|
369
363
|
"type": "_JSEditor",
|
|
370
364
|
"defaultCode": "function getModelParams() { \n return {}; \n}",
|
|
371
|
-
"mustConfirm": true,
|
|
372
365
|
"wrapper": "collapse",
|
|
373
366
|
"wrapperProps": {
|
|
374
367
|
"suppressIcon": true
|
|
@@ -205,7 +205,6 @@
|
|
|
205
205
|
"desc": "返回默认选中的数据主键",
|
|
206
206
|
"type": "_JSEditor",
|
|
207
207
|
"defaultCode": "function defaultSelect(treeData) { \n return null; \n}",
|
|
208
|
-
"mustConfirm": true,
|
|
209
208
|
"wrapper": "collapse",
|
|
210
209
|
"wrapperProps": {
|
|
211
210
|
"suppressIcon": true
|
|
@@ -268,7 +267,6 @@
|
|
|
268
267
|
"name": "节点是否有复选框",
|
|
269
268
|
"type": "_JSEditor",
|
|
270
269
|
"defaultCode": "function treeNodeCheckable(item) { \n return true; \n}",
|
|
271
|
-
"mustConfirm": true,
|
|
272
270
|
"wrapper": "collapse",
|
|
273
271
|
"wrapperProps": {
|
|
274
272
|
"suppressIcon": true
|
|
@@ -279,7 +277,6 @@
|
|
|
279
277
|
"name": "节点复选框是否禁用",
|
|
280
278
|
"type": "_JSEditor",
|
|
281
279
|
"defaultCode": "function treeNodeDisableCheckbox(item) { \n return false; \n}",
|
|
282
|
-
"mustConfirm": true,
|
|
283
280
|
"wrapper": "collapse",
|
|
284
281
|
"wrapperProps": {
|
|
285
282
|
"suppressIcon": true
|
|
@@ -290,7 +287,6 @@
|
|
|
290
287
|
"name": "节点是否禁用",
|
|
291
288
|
"type": "_JSEditor",
|
|
292
289
|
"defaultCode": "function treeNodeDisable(item) { \n return false; \n}",
|
|
293
|
-
"mustConfirm": true,
|
|
294
290
|
"wrapper": "collapse",
|
|
295
291
|
"wrapperProps": {
|
|
296
292
|
"suppressIcon": true
|
|
@@ -301,7 +297,7 @@
|
|
|
301
297
|
"name": "节点定制渲染",
|
|
302
298
|
"type": "_JSEditor",
|
|
303
299
|
"defaultCode": "function onTreeNodeRender(title, item) { \n return title; \n}",
|
|
304
|
-
"
|
|
300
|
+
"isjsx": true,
|
|
305
301
|
"wrapper": "collapse",
|
|
306
302
|
"wrapperProps": {
|
|
307
303
|
"suppressIcon": true
|
|
@@ -11,7 +11,10 @@ var _exportNames = {
|
|
|
11
11
|
useRemoteSource: true
|
|
12
12
|
};
|
|
13
13
|
exports.useRemoteSource = exports.useContext = exports.default = exports.Context = void 0;
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
15
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
16
|
+
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
17
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
19
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
20
|
var _ahooks = require("ahooks");
|
|
@@ -20,6 +23,11 @@ var _EventBusProvider = require("../EventBusProvider");
|
|
|
20
23
|
var _RemoteSourceProvider = _interopRequireWildcard(require("../RemoteSourceProvider"));
|
|
21
24
|
var _usePageVar2 = _interopRequireDefault(require("./usePageVar"));
|
|
22
25
|
var _useTodo3 = _interopRequireDefault(require("./useTodo"));
|
|
26
|
+
var _ApiConfig = _interopRequireDefault(require("@/services/ApiConfig"));
|
|
27
|
+
var _apiUrl = require("../../../constants/api-url");
|
|
28
|
+
var topics = _interopRequireWildcard(require("../../../constants/event-topics"));
|
|
29
|
+
var utils = _interopRequireWildcard(require("./utils"));
|
|
30
|
+
var router = _interopRequireWildcard(require("./router"));
|
|
23
31
|
var _usePageDataStore = require("./usePageDataStore");
|
|
24
32
|
Object.keys(_usePageDataStore).forEach(function (key) {
|
|
25
33
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -32,11 +40,6 @@ Object.keys(_usePageDataStore).forEach(function (key) {
|
|
|
32
40
|
}
|
|
33
41
|
});
|
|
34
42
|
});
|
|
35
|
-
var _ApiConfig = _interopRequireDefault(require("@/services/ApiConfig"));
|
|
36
|
-
var _apiUrl = require("../../../constants/api-url");
|
|
37
|
-
var topics = _interopRequireWildcard(require("../../../constants/event-topics"));
|
|
38
|
-
var utils = _interopRequireWildcard(require("./utils"));
|
|
39
|
-
var router = _interopRequireWildcard(require("./router"));
|
|
40
43
|
var Context = exports.Context = /*#__PURE__*/(0, _react.createContext)(null);
|
|
41
44
|
var useContext = exports.useContext = function useContext() {
|
|
42
45
|
return (0, _react.useContext)(Context);
|
|
@@ -83,10 +86,27 @@ var _default = exports.default = function _default(_ref) {
|
|
|
83
86
|
if (index !== -1) {
|
|
84
87
|
_componentList.current.splice(index, 1);
|
|
85
88
|
}
|
|
86
|
-
;
|
|
87
89
|
});
|
|
88
|
-
var _initRemoteApiMap = (0, _ahooks.useMemoizedFn)(function (_apiMap) {
|
|
89
|
-
|
|
90
|
+
var _initRemoteApiMap = (0, _ahooks.useMemoizedFn)(function (_apiMap, append) {
|
|
91
|
+
if (append) {
|
|
92
|
+
_remoteApiMap.current = new Map([].concat((0, _toConsumableArray2.default)(_remoteApiMap.current), (0, _toConsumableArray2.default)(_apiMap)));
|
|
93
|
+
} else {
|
|
94
|
+
_remoteApiMap.current = _apiMap;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
var _deleteRemoteApis = (0, _ahooks.useMemoizedFn)(function (keys) {
|
|
98
|
+
var _iterator = (0, _createForOfIteratorHelper2.default)(keys),
|
|
99
|
+
_step;
|
|
100
|
+
try {
|
|
101
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
102
|
+
var key = _step.value;
|
|
103
|
+
_remoteApiMap.current.delete(key);
|
|
104
|
+
}
|
|
105
|
+
} catch (err) {
|
|
106
|
+
_iterator.e(err);
|
|
107
|
+
} finally {
|
|
108
|
+
_iterator.f();
|
|
109
|
+
}
|
|
90
110
|
});
|
|
91
111
|
var getElementById = (0, _ahooks.useMemoizedFn)(function (compId) {
|
|
92
112
|
var _componentList$curren;
|
|
@@ -104,10 +124,9 @@ var _default = exports.default = function _default(_ref) {
|
|
|
104
124
|
if (!_parentId) return null;
|
|
105
125
|
return compMap.get(_parentId);
|
|
106
126
|
});
|
|
107
|
-
var want = (0, _ahooks.useMemoizedFn)(function (wanted) {
|
|
108
|
-
var _getModuleData;
|
|
127
|
+
var want = (0, _ahooks.useMemoizedFn)(function (wanted, _serials) {
|
|
109
128
|
if ((0, _lodash.isNil)(wanted)) return false;
|
|
110
|
-
var serials =
|
|
129
|
+
var serials = _serials || [];
|
|
111
130
|
var serialMap = serials.reduce(function (acc, cur, index) {
|
|
112
131
|
if (!acc[cur]) {
|
|
113
132
|
acc[cur] = Math.pow(2, index);
|
|
@@ -124,6 +143,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
124
143
|
_register: _register,
|
|
125
144
|
_unregister: _unregister,
|
|
126
145
|
_initRemoteApiMap: _initRemoteApiMap,
|
|
146
|
+
_deleteRemoteApis: _deleteRemoteApis,
|
|
127
147
|
/**
|
|
128
148
|
* @property {boolean} loading - loading状态
|
|
129
149
|
*/
|
|
@@ -202,9 +222,26 @@ var _default = exports.default = function _default(_ref) {
|
|
|
202
222
|
var _privateGetter$curren;
|
|
203
223
|
return (_privateGetter$curren = _privateGetter.current) === null || _privateGetter$curren === void 0 ? void 0 : _privateGetter$curren[property]();
|
|
204
224
|
} else if (property === 'state') {
|
|
205
|
-
|
|
225
|
+
var state = getState();
|
|
226
|
+
return new Proxy(Object.assign({}, state), {
|
|
227
|
+
get: function get(stateTarget, stateProperty, stateReceiver) {
|
|
228
|
+
return Reflect.get(stateTarget, stateProperty, stateReceiver);
|
|
229
|
+
},
|
|
230
|
+
set: function set(stateTarget, stateProperty, stateReceiver) {
|
|
231
|
+
setState((0, _defineProperty2.default)({}, stateProperty, stateReceiver));
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
206
235
|
} else if (property === 'global') {
|
|
207
|
-
return global.current
|
|
236
|
+
return new Proxy(Object.assign({}, global.current), {
|
|
237
|
+
get: function get(globalTarget, globalProperty, globalReceiver) {
|
|
238
|
+
return Reflect.get(globalTarget, globalProperty, globalReceiver);
|
|
239
|
+
},
|
|
240
|
+
set: function set(globalTarget, globalProperty, globalReceiver) {
|
|
241
|
+
setGlobal((0, _defineProperty2.default)({}, globalProperty, globalReceiver));
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
208
245
|
}
|
|
209
246
|
return Reflect.get(target, property, receiver);
|
|
210
247
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -13,8 +14,14 @@ Object.defineProperty(exports, "history", {
|
|
|
13
14
|
exports.push = push;
|
|
14
15
|
exports.replace = replace;
|
|
15
16
|
exports.stringifyQuery = stringifyQuery;
|
|
17
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
18
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
19
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
20
|
var _umi = require("umi");
|
|
17
21
|
var _lodash = require("lodash");
|
|
22
|
+
var _qs = require("qs");
|
|
23
|
+
var _excluded = ["title", "subTitle"],
|
|
24
|
+
_excluded2 = ["title", "subTitle"];
|
|
18
25
|
function push(path, params) {
|
|
19
26
|
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'push';
|
|
20
27
|
var blank = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
@@ -27,7 +34,21 @@ function push(path, params) {
|
|
|
27
34
|
method: 'replace'
|
|
28
35
|
});
|
|
29
36
|
} else if (type === 'layer') {
|
|
30
|
-
|
|
37
|
+
var _path$split = path.split('?'),
|
|
38
|
+
_path$split2 = (0, _slicedToArray2.default)(_path$split, 2),
|
|
39
|
+
_path = _path$split2[0],
|
|
40
|
+
argsStr = _path$split2[1];
|
|
41
|
+
var title = params.title,
|
|
42
|
+
subTitle = params.subTitle,
|
|
43
|
+
_params = (0, _objectWithoutProperties2.default)(params, _excluded);
|
|
44
|
+
var _parse = (0, _qs.parse)(argsStr),
|
|
45
|
+
_title = _parse.title,
|
|
46
|
+
_subTitle = _parse.subTitle,
|
|
47
|
+
args = (0, _objectWithoutProperties2.default)(_parse, _excluded2);
|
|
48
|
+
window.openUrl("layer:".concat(_path, "?").concat((0, _qs.stringify)((0, _objectSpread2.default)({
|
|
49
|
+
title: title || _title,
|
|
50
|
+
subTitle: subTitle || _subTitle
|
|
51
|
+
}, args))), _params);
|
|
31
52
|
} else if (type === 'iframe') {
|
|
32
53
|
window.openUrl("iframe:".concat(path));
|
|
33
54
|
} else if (type === 'sso') {
|
|
@@ -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;
|
|
@@ -267,20 +262,20 @@ var modifyNode = exports.modifyNode = function modifyNode(id, data) {
|
|
|
267
262
|
|
|
268
263
|
/**
|
|
269
264
|
* 移动页面中的一个节点到另一个位置。
|
|
270
|
-
*
|
|
265
|
+
*
|
|
271
266
|
* @param {string} sid - 源节点的ID。
|
|
272
267
|
* @param {string} tid - 目标节点的ID。
|
|
273
268
|
* @param {string} action - 移动类型,可以是 'inside', 'left', 'right' 中的一个。
|
|
274
269
|
* @param {string} newid - 新节点的ID,仅在创建新节点时使用。
|
|
275
270
|
* @param {Object} json - 新节点的初始属性,仅在创建新节点时使用。
|
|
276
|
-
*
|
|
271
|
+
*
|
|
277
272
|
* @description
|
|
278
273
|
* 此函数会更新页面数据状态,根据提供的动作类型(`action`),将源节点(`sourceNode`)移动到目标节点(`targetNode`)的相应位置。
|
|
279
274
|
* - 'inside': 将源节点作为目标节点的子节点。
|
|
280
275
|
* - 'left': 将源节点放在目标节点的左边(同一父节点下)。
|
|
281
276
|
* - 'right': 将源节点放在目标节点的右边(同一父节点下)。
|
|
282
277
|
* 如果 `sid` 是空但提供了 `newid`,则函数会创建一个新的节点。
|
|
283
|
-
*
|
|
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
|
+
};
|