@luck-design-biz/luckda 0.0.25-6 → 0.0.25-8
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/LDActions/index.js +8 -10
- package/es/components/LDActions/index.less +7 -4
- package/es/components/LdAutoForm/index.js +26 -8
- package/es/components/LdFormList/index.js +37 -22
- package/es/components/LdGrid/index.js +14 -7
- package/es/components/LdGridForm/index.js +18 -6
- package/es/components/LdTree/index.js +33 -15
- package/es/helper/form.js +15 -8
- package/es/locales/zh-CN.js +16 -10
- package/es/lowcode/constants/api-url.js +120 -32
- package/es/lowcode/constants/event-topics.js +2 -0
- package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +4 -2
- package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +4 -2
- package/es/lowcode/engine/meta/box.props.json +3 -3
- package/es/lowcode/engine/meta/button.props.json +3 -3
- package/es/lowcode/engine/meta/components-list.json +6 -0
- package/es/lowcode/engine/meta/dialog.props.default.json +10 -5
- package/es/lowcode/engine/meta/dialog.props.json +72 -42
- package/es/lowcode/engine/meta/drawer.props.json +8 -20
- package/es/lowcode/engine/meta/form.props.json +16 -10
- 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/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.json +2 -2
- 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 +17 -11
- package/es/lowcode/engine/meta/tabs.props.json +3 -3
- package/es/lowcode/engine/meta/tree.props.default.json +2 -0
- package/es/lowcode/engine/meta/tree.props.json +62 -6
- package/es/lowcode/engine/provider/ContextProvider/index.js +20 -43
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +69 -24
- package/es/lowcode/engine/tools/dataProcess.js +4 -0
- package/es/lowcode/engine/tools/helper.js +2 -3
- package/es/lowcode/engine/tools/useCanvasRender.js +3 -2
- package/es/lowcode/engine/tools/usePageDataStore.js +176 -0
- package/es/lowcode/engine/tools/usePromiseState.js +12 -23
- package/es/lowcode/engine/tools/useTodo.js +20 -10
- package/es/lowcode/painter/DesignOperator.js +12 -23
- package/es/lowcode/painter/DesignToolbar.js +10 -45
- package/es/lowcode/painter/Outline.js +2 -4
- package/es/lowcode/painter/Panel.js +29 -28
- package/es/lowcode/painter/components/ActionBindModal.js +30 -24
- package/es/lowcode/painter/components/AdvancePanel.js +6 -1
- package/es/lowcode/painter/components/AttrsPanel.js +38 -29
- package/es/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
- 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 +162 -30
- package/es/lowcode/painter/components/field-setting/index.js +32 -63
- package/es/lowcode/painter/components/field-setting/meta/frontRules.js +53 -0
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +14 -17
- package/es/lowcode/painter/panel-section/ButtonType.js +4 -2
- package/es/lowcode/painter/panel-section/DataSetSelector.js +4 -1
- package/es/lowcode/painter/panel-section/FieldsSetting.js +53 -8
- package/es/lowcode/painter/panel-section/ImpExp.js +93 -6
- package/es/lowcode/painter/panel-section/ImpExpAlone.js +109 -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/index.js +10 -4
- 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 +1 -1
- 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 +4 -2
- package/es/lowcode/view/Canvas.js +6 -7
- package/es/lowcode/view/Page.js +2 -3
- package/es/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
- package/es/lowcode/view/lc-components/Box/meta.json +3 -3
- package/es/lowcode/view/lc-components/Button/index.js +2 -6
- package/es/lowcode/view/lc-components/Button/meta.json +3 -3
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +3 -10
- package/es/lowcode/view/lc-components/Dialog/index.js +114 -19
- package/es/lowcode/view/lc-components/Dialog/meta.json +65 -42
- package/es/lowcode/view/lc-components/Drawer/meta.json +8 -20
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +23 -33
- package/es/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
- package/es/lowcode/view/lc-components/Form/index.js +113 -21
- package/es/lowcode/view/lc-components/Form/meta.json +16 -10
- package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
- package/es/lowcode/view/lc-components/ImEx/index.js +260 -10
- 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/Layout/FunctionDesign.js +12 -19
- package/es/lowcode/view/lc-components/Layout/meta.json +2 -2
- 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 +3 -9
- package/es/lowcode/view/lc-components/Section/meta.json +2 -2
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +19 -20
- package/es/lowcode/view/lc-components/Split/index.js +5 -9
- package/es/lowcode/view/lc-components/Split/meta.json +4 -4
- package/es/lowcode/view/lc-components/Table/components/TopImex.js +138 -0
- package/es/lowcode/view/lc-components/Table/index.js +124 -39
- package/es/lowcode/view/lc-components/Table/meta.json +17 -11
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +10 -17
- package/es/lowcode/view/lc-components/Tabs/index.js +3 -1
- package/es/lowcode/view/lc-components/Tabs/meta.json +3 -3
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
- package/es/lowcode/view/lc-components/Tree/index.js +67 -18
- package/es/lowcode/view/lc-components/Tree/meta.json +62 -7
- package/es/lowcode/view/lc-components/Wrapper.js +9 -11
- 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/index.js +2 -1
- package/es/upload/FormItem/index.js +3 -5
- package/es/upload/index.js +2 -1
- package/es/utils/action.js +2 -2
- package/lib/components/LDActions/index.js +7 -9
- package/lib/components/LDActions/index.less +7 -4
- package/lib/components/LdAutoForm/index.js +25 -7
- package/lib/components/LdFormList/index.js +36 -21
- package/lib/components/LdGrid/index.js +14 -7
- package/lib/components/LdGridForm/index.js +16 -4
- package/lib/components/LdTree/index.js +33 -15
- package/lib/helper/form.js +14 -7
- package/lib/locales/zh-CN.js +16 -10
- package/lib/lowcode/constants/api-url.js +123 -32
- package/lib/lowcode/constants/event-topics.js +3 -1
- package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +4 -2
- package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +4 -2
- package/lib/lowcode/engine/meta/box.props.json +3 -3
- package/lib/lowcode/engine/meta/button.props.json +3 -3
- package/lib/lowcode/engine/meta/components-list.json +6 -0
- package/lib/lowcode/engine/meta/dialog.props.default.json +10 -5
- package/lib/lowcode/engine/meta/dialog.props.json +72 -42
- package/lib/lowcode/engine/meta/drawer.props.json +8 -20
- package/lib/lowcode/engine/meta/form.props.json +16 -10
- 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/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.json +2 -2
- 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 +17 -11
- package/lib/lowcode/engine/meta/tabs.props.json +3 -3
- package/lib/lowcode/engine/meta/tree.props.default.json +2 -0
- package/lib/lowcode/engine/meta/tree.props.json +62 -6
- package/lib/lowcode/engine/provider/ContextProvider/index.js +36 -43
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +68 -23
- package/lib/lowcode/engine/tools/dataProcess.js +4 -0
- package/lib/lowcode/engine/tools/helper.js +2 -3
- package/lib/lowcode/engine/tools/useCanvasRender.js +3 -2
- package/lib/lowcode/engine/tools/usePageDataStore.js +183 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +11 -21
- package/lib/lowcode/engine/tools/useTodo.js +19 -9
- package/lib/lowcode/painter/DesignOperator.js +11 -22
- package/lib/lowcode/painter/DesignToolbar.js +9 -44
- package/lib/lowcode/painter/Outline.js +1 -3
- package/lib/lowcode/painter/Panel.js +28 -27
- package/lib/lowcode/painter/components/ActionBindModal.js +28 -22
- package/lib/lowcode/painter/components/AdvancePanel.js +6 -1
- package/lib/lowcode/painter/components/AttrsPanel.js +37 -28
- package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
- 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 +159 -27
- package/lib/lowcode/painter/components/field-setting/index.js +32 -63
- package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +59 -0
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +13 -16
- package/lib/lowcode/painter/panel-section/ButtonType.js +4 -2
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +4 -1
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +53 -8
- package/lib/lowcode/painter/panel-section/ImpExp.js +92 -5
- package/lib/lowcode/painter/panel-section/ImpExpAlone.js +115 -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/index.js +10 -4
- 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 +1 -1
- 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 +4 -2
- package/lib/lowcode/view/Canvas.js +5 -6
- package/lib/lowcode/view/Page.js +2 -3
- package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
- package/lib/lowcode/view/lc-components/Box/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Button/index.js +2 -6
- package/lib/lowcode/view/lc-components/Button/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -9
- package/lib/lowcode/view/lc-components/Dialog/index.js +114 -19
- package/lib/lowcode/view/lc-components/Dialog/meta.json +65 -42
- package/lib/lowcode/view/lc-components/Drawer/meta.json +8 -20
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +20 -31
- package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
- package/lib/lowcode/view/lc-components/Form/index.js +110 -18
- package/lib/lowcode/view/lc-components/Form/meta.json +16 -10
- package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
- package/lib/lowcode/view/lc-components/ImEx/index.js +257 -8
- 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/Layout/FunctionDesign.js +11 -18
- package/lib/lowcode/view/lc-components/Layout/meta.json +2 -2
- 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 +2 -8
- package/lib/lowcode/view/lc-components/Section/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +19 -20
- package/lib/lowcode/view/lc-components/Split/index.js +2 -6
- package/lib/lowcode/view/lc-components/Split/meta.json +4 -4
- package/lib/lowcode/view/lc-components/Table/components/TopImex.js +145 -0
- package/lib/lowcode/view/lc-components/Table/index.js +123 -38
- package/lib/lowcode/view/lc-components/Table/meta.json +17 -11
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +11 -18
- package/lib/lowcode/view/lc-components/Tabs/index.js +3 -1
- package/lib/lowcode/view/lc-components/Tabs/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Tree/index.js +65 -16
- package/lib/lowcode/view/lc-components/Tree/meta.json +62 -7
- package/lib/lowcode/view/lc-components/Wrapper.js +8 -10
- 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/index.js +2 -1
- package/lib/upload/FormItem/index.js +3 -5
- package/lib/upload/index.js +8 -1
- package/lib/utils/action.js +2 -2
- package/package.json +5 -4
|
@@ -17,7 +17,18 @@
|
|
|
17
17
|
"key": "dataset",
|
|
18
18
|
"name": "数据集",
|
|
19
19
|
"desc": "选择系统中的可用树形数据集",
|
|
20
|
-
"type": "_DataSetSelector"
|
|
20
|
+
"type": "_DataSetSelector",
|
|
21
|
+
"next": {
|
|
22
|
+
"name": "字段配置",
|
|
23
|
+
"props": [
|
|
24
|
+
{
|
|
25
|
+
"key": "fields",
|
|
26
|
+
"name": "#字段配置器",
|
|
27
|
+
"type": "_FieldsSetting",
|
|
28
|
+
"component": "tree"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
21
32
|
},
|
|
22
33
|
{
|
|
23
34
|
"key": "title",
|
|
@@ -119,6 +130,32 @@
|
|
|
119
130
|
}
|
|
120
131
|
]
|
|
121
132
|
},
|
|
133
|
+
{
|
|
134
|
+
"key": "selectSetting",
|
|
135
|
+
"name": "选中设置",
|
|
136
|
+
"type": "group",
|
|
137
|
+
"props": [
|
|
138
|
+
{
|
|
139
|
+
"key": "cancelSelect",
|
|
140
|
+
"name": "取消选中",
|
|
141
|
+
"desc": "是否可以取消选中",
|
|
142
|
+
"type": "switch",
|
|
143
|
+
"default": true
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"key": "defaultSelect",
|
|
147
|
+
"name": "默认选中",
|
|
148
|
+
"desc": "返回默认选中的数据主键",
|
|
149
|
+
"type": "_JSEditor",
|
|
150
|
+
"defaultCode": "function defaultSelect(treeData) { \n return []; \n}",
|
|
151
|
+
"mustConfirm": true,
|
|
152
|
+
"wrapper": "collapse",
|
|
153
|
+
"wrapperProps": {
|
|
154
|
+
"suppressIcon": true
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
122
159
|
{
|
|
123
160
|
"key": "IconSetting",
|
|
124
161
|
"name": "图标设置",
|
|
@@ -170,6 +207,13 @@
|
|
|
170
207
|
"type": "switch",
|
|
171
208
|
"default": true
|
|
172
209
|
},
|
|
210
|
+
{
|
|
211
|
+
"key": "onlyRoot",
|
|
212
|
+
"name": "根节点唯一",
|
|
213
|
+
"desc": "树组件仅一个根节点,如数据根节点数大于0,则不允许根节点新增",
|
|
214
|
+
"type": "switch",
|
|
215
|
+
"default": false
|
|
216
|
+
},
|
|
173
217
|
{
|
|
174
218
|
"key": "rootAddSetting",
|
|
175
219
|
"name": "根节点配置",
|
|
@@ -272,31 +316,43 @@
|
|
|
272
316
|
"key": "onMount",
|
|
273
317
|
"name": "组件首次渲染时",
|
|
274
318
|
"desc": "在组件首次渲染时,执行方法",
|
|
275
|
-
"func": "(params)
|
|
319
|
+
"func": "function onMount(params) {\n\t\n}"
|
|
276
320
|
},
|
|
277
321
|
{
|
|
278
322
|
"key": "onUnmount",
|
|
279
323
|
"name": "组件卸载时",
|
|
280
324
|
"desc": "在组件卸载时,执行方法。",
|
|
281
|
-
"func": "()
|
|
325
|
+
"func": "function onUnmount() {\n\t\n}"
|
|
282
326
|
},
|
|
283
327
|
{
|
|
284
328
|
"key": "processDataSource",
|
|
285
329
|
"name": "数据预处理",
|
|
286
330
|
"desc": "数据渲染前预处理",
|
|
287
|
-
"func": "(data)
|
|
331
|
+
"func": "function processDataSource(data) {\n\t\n}"
|
|
288
332
|
},
|
|
289
333
|
{
|
|
290
334
|
"key": "onDoubleClick",
|
|
291
335
|
"name": "双击事件",
|
|
292
336
|
"desc": "树节点双击事件",
|
|
293
|
-
"func": "(e, rowData)
|
|
337
|
+
"func": "function onDoubleClick(e, rowData) {\n\t\n}"
|
|
294
338
|
},
|
|
295
339
|
{
|
|
296
340
|
"key": "onCheck",
|
|
297
341
|
"name": "复选框选择事件",
|
|
298
342
|
"desc": "点击复选框触发",
|
|
299
|
-
"func": "(checkedKeys, e)
|
|
343
|
+
"func": "function onCheck(checkedKeys, e) {\n\t\n}"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"key": "onSelect",
|
|
347
|
+
"name": "选中事件",
|
|
348
|
+
"desc": "节点选中事件",
|
|
349
|
+
"func": "function onSelect(checkedKeys, e) {\n\t\n}"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"key": "onDrop",
|
|
353
|
+
"name": "拖拽事件",
|
|
354
|
+
"desc": "节点拖拽事件",
|
|
355
|
+
"func": "function onDrop(info, dragInfo) {\n\t\n}"
|
|
300
356
|
}
|
|
301
357
|
]
|
|
302
358
|
}
|
|
@@ -5,68 +5,51 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
|
|
8
|
+
var _exportNames = {
|
|
9
|
+
Context: true,
|
|
10
|
+
useContext: true,
|
|
11
|
+
useRemoteSource: true
|
|
12
|
+
};
|
|
13
|
+
exports.useRemoteSource = exports.useContext = exports.default = exports.Context = void 0;
|
|
9
14
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
17
|
var _umi = require("umi");
|
|
13
18
|
var _ahooks = require("ahooks");
|
|
14
|
-
var _lodash = require("lodash");
|
|
15
19
|
var _EventBusProvider = require("../EventBusProvider");
|
|
16
20
|
var _RemoteSourceProvider = _interopRequireWildcard(require("../RemoteSourceProvider"));
|
|
17
21
|
var _useTodo3 = _interopRequireDefault(require("../../tools/useTodo"));
|
|
18
|
-
var _dataProcess = require("../../tools/dataProcess");
|
|
19
22
|
var topics = _interopRequireWildcard(require("../../../constants/event-topics"));
|
|
23
|
+
var _usePageDataStore = require("../../tools/usePageDataStore");
|
|
24
|
+
Object.keys(_usePageDataStore).forEach(function (key) {
|
|
25
|
+
if (key === "default" || key === "__esModule") return;
|
|
26
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
27
|
+
if (key in exports && exports[key] === _usePageDataStore[key]) return;
|
|
28
|
+
Object.defineProperty(exports, key, {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function get() {
|
|
31
|
+
return _usePageDataStore[key];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
20
35
|
var Context = exports.Context = /*#__PURE__*/(0, _react.createContext)(null);
|
|
21
36
|
var useContext = exports.useContext = function useContext() {
|
|
22
37
|
return (0, _react.useContext)(Context);
|
|
23
38
|
};
|
|
24
|
-
var usePageData = exports.usePageData = function usePageData(_) {
|
|
25
|
-
var _useReactContext = (0, _react.useContext)(_RemoteSourceProvider.RemoteSourceContext),
|
|
26
|
-
pageData = _useReactContext.pageData,
|
|
27
|
-
loading = _useReactContext.loading,
|
|
28
|
-
setPageData = _useReactContext.setPageData,
|
|
29
|
-
back = _useReactContext.back,
|
|
30
|
-
forward = _useReactContext.forward,
|
|
31
|
-
backLength = _useReactContext.backLength,
|
|
32
|
-
forwardLength = _useReactContext.forwardLength;
|
|
33
|
-
var _pageData;
|
|
34
|
-
if ((0, _lodash.isNil)(_)) {
|
|
35
|
-
_pageData = pageData;
|
|
36
|
-
} else if ((0, _lodash.isFunction)(_)) {
|
|
37
|
-
_pageData = _(pageData);
|
|
38
|
-
} else if ((0, _lodash.isArray)(_)) {
|
|
39
|
-
_pageData = (0, _lodash.reduce)(_, function (r, k) {
|
|
40
|
-
r.push((0, _lodash.get)(pageData, k));
|
|
41
|
-
return r;
|
|
42
|
-
}, []);
|
|
43
|
-
} else if ((0, _lodash.isObject)(_) && _.id) {
|
|
44
|
-
var _findNodeAndParent;
|
|
45
|
-
_pageData = (_findNodeAndParent = (0, _dataProcess.findNodeAndParent)(_.id, pageData)) === null || _findNodeAndParent === void 0 ? void 0 : _findNodeAndParent.node;
|
|
46
|
-
} else if ((0, _lodash.isString)(_)) {
|
|
47
|
-
_pageData = (0, _lodash.get)(pageData, _);
|
|
48
|
-
}
|
|
49
|
-
return [_pageData, {
|
|
50
|
-
loading: loading,
|
|
51
|
-
setPageData: setPageData,
|
|
52
|
-
back: back,
|
|
53
|
-
forward: forward,
|
|
54
|
-
backLength: backLength,
|
|
55
|
-
forwardLength: forwardLength
|
|
56
|
-
}];
|
|
57
|
-
};
|
|
58
39
|
var useRemoteSource = exports.useRemoteSource = function useRemoteSource() {
|
|
59
40
|
return (0, _react.useContext)(_RemoteSourceProvider.RemoteSourceContext);
|
|
60
41
|
};
|
|
61
42
|
var PRIVATE_KEYS = ['componentList', 'componentMap'];
|
|
62
43
|
var _default = exports.default = function _default(_ref) {
|
|
63
44
|
var children = _ref.children,
|
|
64
|
-
code = _ref.code
|
|
45
|
+
code = _ref.code,
|
|
46
|
+
debug = _ref.debug;
|
|
65
47
|
var eventBus = (0, _EventBusProvider.useLDEventBus)();
|
|
66
48
|
var _useTodo = (0, _useTodo3.default)(),
|
|
67
|
-
_useTodo2 = (0, _slicedToArray2.default)(_useTodo,
|
|
49
|
+
_useTodo2 = (0, _slicedToArray2.default)(_useTodo, 3),
|
|
68
50
|
todo = _useTodo2[0],
|
|
69
|
-
callBehavior = _useTodo2[1]
|
|
51
|
+
callBehavior = _useTodo2[1],
|
|
52
|
+
loading = _useTodo2[2];
|
|
70
53
|
|
|
71
54
|
/**
|
|
72
55
|
* 页面公共资源
|
|
@@ -74,7 +57,8 @@ var _default = exports.default = function _default(_ref) {
|
|
|
74
57
|
var _useSetState = (0, _ahooks.useSetState)(null),
|
|
75
58
|
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
|
76
59
|
pagePublicResource = _useSetState2[0],
|
|
77
|
-
|
|
60
|
+
setPagePublicResource = _useSetState2[1];
|
|
61
|
+
var prevPagePublicResource = (0, _ahooks.usePrevious)(pagePublicResource);
|
|
78
62
|
|
|
79
63
|
/**
|
|
80
64
|
* 组件列表
|
|
@@ -136,14 +120,22 @@ var _default = exports.default = function _default(_ref) {
|
|
|
136
120
|
* return:object
|
|
137
121
|
*/
|
|
138
122
|
var getUrlParams = (0, _ahooks.useMemoizedFn)(function () {});
|
|
123
|
+
(0, _ahooks.useUpdateEffect)(function () {
|
|
124
|
+
eventBus.$publisher(topics.PAGE_PUBLIC_RESOURCE_CHANGED, {
|
|
125
|
+
resource: pagePublicResource,
|
|
126
|
+
prevResource: prevPagePublicResource
|
|
127
|
+
});
|
|
128
|
+
}, [pagePublicResource]);
|
|
139
129
|
var ctx = new Proxy((0, _objectSpread2.default)({
|
|
140
|
-
_setPagePublicResource: _setPagePublicResource,
|
|
141
130
|
_register: _register,
|
|
142
131
|
_unregister: _unregister,
|
|
143
132
|
pagePublicResource: pagePublicResource,
|
|
133
|
+
setPagePublicResource: setPagePublicResource,
|
|
134
|
+
loading: loading,
|
|
144
135
|
history: _umi.history,
|
|
145
136
|
callBehavior: callBehavior,
|
|
146
137
|
topics: topics,
|
|
138
|
+
PRIMARY_KEY: window.appConfig.constraintKeys.PRIMARY,
|
|
147
139
|
getElementById: getElementById,
|
|
148
140
|
/**
|
|
149
141
|
* @method
|
|
@@ -180,6 +172,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
180
172
|
value: ctx
|
|
181
173
|
}, /*#__PURE__*/_react.default.createElement(_RemoteSourceProvider.default, {
|
|
182
174
|
code: code,
|
|
183
|
-
runtime: eventBus.runtime
|
|
175
|
+
runtime: eventBus.runtime,
|
|
176
|
+
debug: debug
|
|
184
177
|
}, children));
|
|
185
178
|
};
|
|
@@ -16,7 +16,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
16
16
|
var _ahooks = require("ahooks");
|
|
17
17
|
var _Builder = require("../../../components/Builder");
|
|
18
18
|
var _action2 = require("../../../helper/action");
|
|
19
|
-
var
|
|
19
|
+
var _usePageDataStore2 = _interopRequireDefault(require("../tools/usePageDataStore"));
|
|
20
20
|
var _dataProcess = require("../tools/dataProcess");
|
|
21
21
|
var _apiUrl = require("../../constants/api-url");
|
|
22
22
|
var _constants = require("../../constants");
|
|
@@ -25,16 +25,18 @@ var RemoteSourceContext = exports.RemoteSourceContext = /*#__PURE__*/(0, _react.
|
|
|
25
25
|
var _default = exports.default = function _default(_ref) {
|
|
26
26
|
var children = _ref.children,
|
|
27
27
|
code = _ref.code,
|
|
28
|
-
runtime = _ref.runtime
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
runtime = _ref.runtime,
|
|
29
|
+
debug = _ref.debug;
|
|
30
|
+
var _usePageDataStore = (0, _usePageDataStore2.default)(function (state) {
|
|
31
|
+
return {
|
|
32
|
+
initialize: state.initialize,
|
|
33
|
+
initializeModule: state.initializeModule,
|
|
34
|
+
reset: state.reset
|
|
35
|
+
};
|
|
36
|
+
}),
|
|
37
|
+
initialize = _usePageDataStore.initialize,
|
|
38
|
+
initializeModule = _usePageDataStore.initializeModule,
|
|
39
|
+
reset = _usePageDataStore.reset;
|
|
38
40
|
var _useSetState = (0, _ahooks.useSetState)({}),
|
|
39
41
|
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
|
40
42
|
remoteSource = _useSetState2[0],
|
|
@@ -51,6 +53,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
51
53
|
}
|
|
52
54
|
}, []);
|
|
53
55
|
(0, _ahooks.useUnmount)(function () {
|
|
56
|
+
!debug && reset();
|
|
54
57
|
setRuntime(prevRuntime.current);
|
|
55
58
|
});
|
|
56
59
|
|
|
@@ -70,6 +73,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
70
73
|
setRemoteSource({
|
|
71
74
|
module: data
|
|
72
75
|
});
|
|
76
|
+
initializeModule(data);
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
}),
|
|
@@ -111,6 +115,46 @@ var _default = exports.default = function _default(_ref) {
|
|
|
111
115
|
fetchAllSerialsLoading = _useRequest4.loading,
|
|
112
116
|
runFetchAllSerials = _useRequest4.run,
|
|
113
117
|
refreshSerials = _useRequest4.refreshAsync;
|
|
118
|
+
|
|
119
|
+
// 获取导入导出行为下拉数据
|
|
120
|
+
var _useRequest5 = (0, _ahooks.useRequest)(_apiUrl.fetchAllBehaviorEx, {
|
|
121
|
+
manual: true,
|
|
122
|
+
onSuccess: function onSuccess(_ref5) {
|
|
123
|
+
var code = _ref5.code,
|
|
124
|
+
data = _ref5.data;
|
|
125
|
+
if (code === 1) {
|
|
126
|
+
setRemoteSource({
|
|
127
|
+
impTypeList: data.map(function (item) {
|
|
128
|
+
return {
|
|
129
|
+
key: item.uid,
|
|
130
|
+
value: item.uid,
|
|
131
|
+
label: item.name
|
|
132
|
+
};
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
runFetchAllBehaviorImport = _useRequest5.run;
|
|
139
|
+
var _useRequest6 = (0, _ahooks.useRequest)(_apiUrl.fetchAllBehaviorEx, {
|
|
140
|
+
manual: true,
|
|
141
|
+
onSuccess: function onSuccess(_ref6) {
|
|
142
|
+
var code = _ref6.code,
|
|
143
|
+
data = _ref6.data;
|
|
144
|
+
if (code === 1) {
|
|
145
|
+
setRemoteSource({
|
|
146
|
+
expTypeList: data.map(function (item) {
|
|
147
|
+
return {
|
|
148
|
+
key: item.uid,
|
|
149
|
+
value: item.uid,
|
|
150
|
+
label: item.name
|
|
151
|
+
};
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}),
|
|
157
|
+
runFetchAllBehaviorExport = _useRequest6.run;
|
|
114
158
|
(0, _ahooks.useAsyncEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
115
159
|
var fetchPageDataRes, data, list, detail, _detail$list$, source, info;
|
|
116
160
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
@@ -123,7 +167,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
123
167
|
case 2:
|
|
124
168
|
fetchPageDataRes = _context.sent;
|
|
125
169
|
if (!(fetchPageDataRes.code === 1)) {
|
|
126
|
-
_context.next =
|
|
170
|
+
_context.next = 15;
|
|
127
171
|
break;
|
|
128
172
|
}
|
|
129
173
|
data = fetchPageDataRes.data, list = fetchPageDataRes.list, detail = fetchPageDataRes.detail;
|
|
@@ -134,6 +178,14 @@ var _default = exports.default = function _default(_ref) {
|
|
|
134
178
|
moduleCode: data.moduleCode
|
|
135
179
|
});
|
|
136
180
|
case 9:
|
|
181
|
+
runFetchAllBehaviorImport({
|
|
182
|
+
behaviorMode: 'IMPORT',
|
|
183
|
+
moduleCode: data.moduleCode
|
|
184
|
+
});
|
|
185
|
+
runFetchAllBehaviorExport({
|
|
186
|
+
behaviorMode: 'EXPORT',
|
|
187
|
+
moduleCode: data.moduleCode
|
|
188
|
+
});
|
|
137
189
|
runFetchAllDataset({
|
|
138
190
|
dataModelKey: data.dataModelKey
|
|
139
191
|
});
|
|
@@ -145,8 +197,8 @@ var _default = exports.default = function _default(_ref) {
|
|
|
145
197
|
relationship: data
|
|
146
198
|
}, info)
|
|
147
199
|
});
|
|
148
|
-
|
|
149
|
-
case
|
|
200
|
+
!debug && initialize((0, _dataProcess.decompress)(source));
|
|
201
|
+
case 15:
|
|
150
202
|
case "end":
|
|
151
203
|
return _context.stop();
|
|
152
204
|
}
|
|
@@ -159,20 +211,13 @@ var _default = exports.default = function _default(_ref) {
|
|
|
159
211
|
});
|
|
160
212
|
});
|
|
161
213
|
return /*#__PURE__*/_react.default.createElement(RemoteSourceContext.Provider, {
|
|
162
|
-
value: (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
163
|
-
pageData: pageData
|
|
164
|
-
}, remoteSource), {}, {
|
|
214
|
+
value: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, remoteSource), {}, {
|
|
165
215
|
loading: fetchPageDataLoading || fetchModlueDataLoading,
|
|
166
216
|
fetchAllDatasetLoading: fetchAllDatasetLoading,
|
|
167
217
|
fetchAllSerialsLoading: fetchAllSerialsLoading,
|
|
168
218
|
refreshModlueData: refreshModlueData,
|
|
169
219
|
refreshDataset: refreshDataset,
|
|
170
|
-
refreshSerials: refreshSerials
|
|
171
|
-
setPageData: setPageData,
|
|
172
|
-
back: back,
|
|
173
|
-
forward: forward,
|
|
174
|
-
backLength: backLength,
|
|
175
|
-
forwardLength: forwardLength
|
|
220
|
+
refreshSerials: refreshSerials
|
|
176
221
|
})
|
|
177
222
|
}, /*#__PURE__*/_react.default.createElement(_Builder.LuckDaContext.Provider, {
|
|
178
223
|
value: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, remoteSource.module), {}, {
|
|
@@ -54,6 +54,10 @@ function decompress(compressedData) {
|
|
|
54
54
|
*/
|
|
55
55
|
function findNodeAndParent(id, current) {
|
|
56
56
|
var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
57
|
+
if (!id) return {
|
|
58
|
+
node: null,
|
|
59
|
+
parent: null
|
|
60
|
+
};
|
|
57
61
|
if (!parent && current.props.id === id) {
|
|
58
62
|
return {
|
|
59
63
|
node: current,
|
|
@@ -110,9 +110,8 @@ function listReducer(state, action) {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
function getCtx(context) {
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
});
|
|
113
|
+
return context;
|
|
114
|
+
// return omitBy(context, (_, key) => startsWith(key, '_'));
|
|
116
115
|
}
|
|
117
116
|
function getFuncBody(funcCode) {
|
|
118
117
|
var regex = /{([\s\S]*?)}(?![\s\S]*})/;
|
|
@@ -22,8 +22,9 @@ var _excluded = ["props", "children"],
|
|
|
22
22
|
function useCanvasRender(data, deps) {
|
|
23
23
|
var dynamicCompMap = (0, _react.useRef)({});
|
|
24
24
|
var ctx = (0, _ContextProvider.useContext)();
|
|
25
|
-
var render = (0, _ahooks.useMemoizedFn)(function (
|
|
26
|
-
var
|
|
25
|
+
var render = (0, _ahooks.useMemoizedFn)(function () {
|
|
26
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
27
|
+
props = _ref.props,
|
|
27
28
|
children = _ref.children,
|
|
28
29
|
childrenMap = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
29
30
|
if (props && !_constants.LC_BUILDIN_UNIT_KEY_LIST.includes(props.id)) {
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useTask = exports.useGet = exports.resetPageData = exports.modifyNode = exports.getSelfAndParent = exports.getLevelNodes = 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 _dataProcess = require("./dataProcess");
|
|
17
|
+
var _constants = require("../../constants");
|
|
18
|
+
var findNode = function findNode(obj, id) {
|
|
19
|
+
for (var key in obj) {
|
|
20
|
+
if (!['props', 'children'].includes(key)) {
|
|
21
|
+
if (key === id) {
|
|
22
|
+
return {
|
|
23
|
+
target: obj[key],
|
|
24
|
+
parent: obj
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if ((0, _typeof2.default)(obj[key]) === 'object' && !Array.isArray(obj[key])) {
|
|
28
|
+
var result = findNode(obj[key], id);
|
|
29
|
+
if (result) {
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
var usePageDataStore = (0, _zustand.create)()((0, _immer.immer)((0, _middleware.subscribeWithSelector)(function (set) {
|
|
38
|
+
return {
|
|
39
|
+
pageData: null,
|
|
40
|
+
moduleData: null,
|
|
41
|
+
initialize: function initialize(data) {
|
|
42
|
+
return set(function (state) {
|
|
43
|
+
state.pageData = data;
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
initializeModule: function initializeModule(data) {
|
|
47
|
+
return set(function (state) {
|
|
48
|
+
state.moduleData = data;
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
reset: function reset(data) {
|
|
52
|
+
return set(function (state) {
|
|
53
|
+
state.pageData = data || null;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
})));
|
|
58
|
+
var _default = exports.default = usePageDataStore;
|
|
59
|
+
var resetPageData = exports.resetPageData = function resetPageData(data) {
|
|
60
|
+
usePageDataStore.setState(function (state) {
|
|
61
|
+
state.pageData = data || null;
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var addNode = exports.addNode = function addNode(parentId, id, data) {
|
|
65
|
+
usePageDataStore.setState(function (state) {
|
|
66
|
+
if (parentId === _constants.LC_BUILDIN_UNIT_KEY.PAGE_ROOT) {
|
|
67
|
+
state.pageData.children.push(id);
|
|
68
|
+
state.pageData[id] = {
|
|
69
|
+
props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
|
|
70
|
+
id: id,
|
|
71
|
+
parentId: parentId
|
|
72
|
+
})
|
|
73
|
+
};
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
var _ref = findNode(state.pageData, parentId) || {},
|
|
77
|
+
target = _ref.target;
|
|
78
|
+
if (!target) return;
|
|
79
|
+
if (!target.hasOwnProperty('children')) {
|
|
80
|
+
target.children = [];
|
|
81
|
+
}
|
|
82
|
+
if (!target.children.includes(id)) {
|
|
83
|
+
target.children.push(id);
|
|
84
|
+
target[id] = {
|
|
85
|
+
props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
|
|
86
|
+
id: id,
|
|
87
|
+
parentId: parentId
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
var deleteNode = exports.deleteNode = function deleteNode(id) {
|
|
94
|
+
usePageDataStore.setState(function (state) {
|
|
95
|
+
var _parent$children;
|
|
96
|
+
var _ref2 = findNode(state.pageData, id) || {},
|
|
97
|
+
parent = _ref2.parent;
|
|
98
|
+
if (!parent || !((_parent$children = parent.children) !== null && _parent$children !== void 0 && _parent$children.length)) return;
|
|
99
|
+
parent.children.splice(parent.children.indexOf(id), 1);
|
|
100
|
+
if (parent.children.length === 0) {
|
|
101
|
+
delete parent['children'];
|
|
102
|
+
}
|
|
103
|
+
delete parent[id];
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
var modifyNode = exports.modifyNode = function modifyNode(id, data) {
|
|
107
|
+
usePageDataStore.setState(function (state) {
|
|
108
|
+
if (id === _constants.LC_BUILDIN_UNIT_KEY.PAGE_ROOT) {
|
|
109
|
+
(0, _lodash.assign)(state.pageData.props, (0, _lodash.omit)(data, ['id', 'parentId', 'component', 'buildIn']));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
var _ref3 = findNode(state.pageData, id) || {},
|
|
113
|
+
target = _ref3.target;
|
|
114
|
+
if (!target) return;
|
|
115
|
+
(0, _lodash.forOwn)((0, _lodash.omit)(data, ['id', 'parentId', 'component', 'buildIn']), function (_val, _key) {
|
|
116
|
+
(0, _lodash.set)(target.props, _key, _val);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
var useTask = exports.useTask = function useTask(type) {
|
|
121
|
+
var promiseRef = (0, _react.useRef)(null);
|
|
122
|
+
var task = (0, _react.useCallback)(function () {
|
|
123
|
+
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
124
|
+
args[_key2] = arguments[_key2];
|
|
125
|
+
}
|
|
126
|
+
return new Promise(function (resolve) {
|
|
127
|
+
promiseRef.current = resolve;
|
|
128
|
+
switch (type) {
|
|
129
|
+
case 'add':
|
|
130
|
+
addNode.apply(void 0, args);
|
|
131
|
+
break;
|
|
132
|
+
case 'update':
|
|
133
|
+
case 'modify':
|
|
134
|
+
modifyNode.apply(void 0, args);
|
|
135
|
+
break;
|
|
136
|
+
case 'delete':
|
|
137
|
+
deleteNode.apply(void 0, args);
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}, []);
|
|
144
|
+
(0, _react.useEffect)(function () {
|
|
145
|
+
var unsub = usePageDataStore.subscribe(function (state, prevState) {
|
|
146
|
+
if (!promiseRef.current) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
promiseRef.current(state.pageData, prevState.pageData);
|
|
150
|
+
promiseRef.current = null;
|
|
151
|
+
});
|
|
152
|
+
return unsub;
|
|
153
|
+
}, []);
|
|
154
|
+
return task;
|
|
155
|
+
};
|
|
156
|
+
var useGet = exports.useGet = function useGet(_) {
|
|
157
|
+
var result = usePageDataStore((0, _shallow.useShallow)(function (state) {
|
|
158
|
+
if ((0, _lodash.isNil)(_)) {
|
|
159
|
+
return state.pageData;
|
|
160
|
+
} else if ((0, _lodash.isFunction)(_)) {
|
|
161
|
+
return _(state.pageData);
|
|
162
|
+
} else if ((0, _lodash.isArray)(_)) {
|
|
163
|
+
return _.map(function (k) {
|
|
164
|
+
var _findNode;
|
|
165
|
+
return k.includes('.') ? (0, _lodash.get)(state.pageData, k) : (_findNode = findNode(state.pageData, k)) === null || _findNode === void 0 ? void 0 : _findNode.target;
|
|
166
|
+
});
|
|
167
|
+
} else if ((0, _lodash.isObject)(_) && _.id) {
|
|
168
|
+
var _findNode2;
|
|
169
|
+
var path = _.path;
|
|
170
|
+
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;
|
|
171
|
+
return (0, _lodash.isNil)(path) ? _target : (0, _lodash.get)(_target, path);
|
|
172
|
+
} else if ((0, _lodash.isString)(_)) {
|
|
173
|
+
return (0, _lodash.get)(state.pageData, _);
|
|
174
|
+
}
|
|
175
|
+
}));
|
|
176
|
+
return result;
|
|
177
|
+
};
|
|
178
|
+
var getLevelNodes = exports.getLevelNodes = function getLevelNodes(id) {
|
|
179
|
+
return (0, _dataProcess.getPathNodesById)(usePageDataStore.getState().pageData, id);
|
|
180
|
+
};
|
|
181
|
+
var getSelfAndParent = exports.getSelfAndParent = function getSelfAndParent(id) {
|
|
182
|
+
return (0, _dataProcess.findNodeAndParent)(id, usePageDataStore.getState().pageData);
|
|
183
|
+
};
|
|
@@ -1,41 +1,31 @@
|
|
|
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
|
});
|
|
6
7
|
exports.default = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
9
|
var _react = require("react");
|
|
8
10
|
var _ahooks = require("ahooks");
|
|
9
|
-
var _lodash = require("lodash");
|
|
10
11
|
var usePromiseState = function usePromiseState(initialState) {
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
forwardLength = _useHistoryTravel.forwardLength,
|
|
16
|
-
back = _useHistoryTravel.back,
|
|
17
|
-
forward = _useHistoryTravel.forward;
|
|
12
|
+
var _useState = (0, _react.useState)(initialState),
|
|
13
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
14
|
+
state = _useState2[0],
|
|
15
|
+
setState = _useState2[1];
|
|
18
16
|
var promiseRef = (0, _react.useRef)(null);
|
|
19
|
-
var setStatePromise = (0, _react.useCallback)(function (
|
|
17
|
+
var setStatePromise = (0, _react.useCallback)(function (_state) {
|
|
20
18
|
return new Promise(function (resolve) {
|
|
21
19
|
promiseRef.current = resolve;
|
|
22
|
-
|
|
23
|
-
if (!(0, _lodash.isEqual)(value, _valStr)) {
|
|
24
|
-
setValue(_valStr);
|
|
25
|
-
}
|
|
20
|
+
setState(_state);
|
|
26
21
|
});
|
|
27
22
|
}, []);
|
|
28
23
|
(0, _ahooks.useUpdateLayoutEffect)(function () {
|
|
29
24
|
if (promiseRef.current) {
|
|
30
|
-
promiseRef.current(
|
|
25
|
+
promiseRef.current(state);
|
|
31
26
|
promiseRef.current = null;
|
|
32
27
|
}
|
|
33
|
-
}, [
|
|
34
|
-
return [
|
|
35
|
-
backLength: backLength - 1,
|
|
36
|
-
forwardLength: forwardLength,
|
|
37
|
-
back: back,
|
|
38
|
-
forward: forward
|
|
39
|
-
}];
|
|
28
|
+
}, [state]);
|
|
29
|
+
return [state, setStatePromise];
|
|
40
30
|
};
|
|
41
31
|
var _default = exports.default = usePromiseState;
|