@luck-design-biz/luckda 0.0.25-17 → 0.0.25-19
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/LdGrid/index.js +6 -9
- package/es/locales/zh-CN.js +5 -1
- package/es/lowcode/constants/event-topics.js +1 -1
- package/es/lowcode/engine/launcher.js +2 -0
- package/es/lowcode/engine/meta/form.props.json +0 -6
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +5 -17
- package/es/lowcode/engine/meta/page.props.json +6 -0
- package/es/lowcode/engine/meta/table.props.json +10 -4
- package/es/lowcode/engine/meta/tree.props.default.json +6 -6
- package/es/lowcode/engine/meta/tree.props.json +57 -63
- package/es/lowcode/engine/provider/ContextProvider/index.js +30 -33
- package/es/lowcode/engine/provider/ContextProvider/usePageState.js +21 -0
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +8 -13
- package/es/lowcode/engine/tools/diff.js +1 -1
- package/es/lowcode/engine/tools/helper.js +24 -12
- package/es/lowcode/engine/tools/useCombinedRefs.js +14 -0
- package/es/lowcode/painter/DesignToolbar.js +52 -23
- package/es/lowcode/painter/components/PreviewIframe.js +1 -1
- package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
- package/es/lowcode/painter/style/design.less +1 -0
- package/es/lowcode/preview/index.js +2 -4
- package/es/lowcode/view/Canvas.js +15 -2
- package/es/lowcode/view/lc-components/Form/index.js +42 -64
- package/es/lowcode/view/lc-components/Form/meta.json +0 -6
- package/es/lowcode/view/lc-components/Page/meta.json +6 -0
- package/es/lowcode/view/lc-components/PageLayout/index.js +2 -2
- package/es/lowcode/view/lc-components/Table/components/TopImex.js +2 -2
- package/es/lowcode/view/lc-components/Table/index.js +181 -195
- package/es/lowcode/view/lc-components/Table/meta.json +10 -4
- package/es/lowcode/view/lc-components/Tree/index.js +0 -20
- package/es/lowcode/view/lc-components/Tree/meta.json +57 -63
- package/lib/components/LdGrid/index.js +6 -9
- package/lib/locales/zh-CN.js +5 -1
- package/lib/lowcode/constants/event-topics.js +2 -2
- package/lib/lowcode/engine/launcher.js +2 -0
- package/lib/lowcode/engine/meta/form.props.json +0 -6
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +5 -17
- package/lib/lowcode/engine/meta/page.props.json +6 -0
- package/lib/lowcode/engine/meta/table.props.json +10 -4
- package/lib/lowcode/engine/meta/tree.props.default.json +6 -6
- package/lib/lowcode/engine/meta/tree.props.json +57 -63
- package/lib/lowcode/engine/provider/ContextProvider/index.js +29 -32
- package/lib/lowcode/engine/provider/ContextProvider/usePageState.js +28 -0
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +8 -13
- package/lib/lowcode/engine/tools/diff.js +1 -1
- package/lib/lowcode/engine/tools/helper.js +26 -12
- package/lib/lowcode/engine/tools/useCombinedRefs.js +20 -0
- package/lib/lowcode/painter/DesignToolbar.js +51 -22
- package/lib/lowcode/painter/components/PreviewIframe.js +1 -1
- package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
- package/lib/lowcode/painter/style/design.less +1 -0
- package/lib/lowcode/preview/index.js +2 -4
- package/lib/lowcode/view/Canvas.js +15 -2
- package/lib/lowcode/view/lc-components/Form/index.js +42 -64
- package/lib/lowcode/view/lc-components/Form/meta.json +0 -6
- package/lib/lowcode/view/lc-components/Page/meta.json +6 -0
- package/lib/lowcode/view/lc-components/PageLayout/index.js +2 -2
- package/lib/lowcode/view/lc-components/Table/components/TopImex.js +2 -2
- package/lib/lowcode/view/lc-components/Table/index.js +178 -192
- package/lib/lowcode/view/lc-components/Table/meta.json +10 -4
- package/lib/lowcode/view/lc-components/Tree/index.js +0 -20
- package/lib/lowcode/view/lc-components/Tree/meta.json +57 -63
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["columns", "resources", "actions", "doAction", "afterInit", "namespace", "wrapperRef", "list", "detail", "params", "filters", "_loading", "loading", "unclosableSet", "onQuery", "doQuery", "pagination", "pageno", "pagesize", "totalCount", "columnsRewrite", "columnsReset", "batchOperations", "formatDataSource", "resultSet", "actionsColumn", "readFilter", "isFlow", "isTreeGrid", "writable"
|
|
5
|
+
var _excluded = ["columns", "resources", "actions", "doAction", "afterInit", "namespace", "wrapperRef", "list", "detail", "params", "filters", "_loading", "loading", "unclosableSet", "onQuery", "doQuery", "pagination", "pageno", "pagesize", "totalCount", "columnsRewrite", "columnsReset", "batchOperations", "formatDataSource", "resultSet", "actionsColumn", "readFilter", "isFlow", "isTreeGrid", "writable"],
|
|
6
6
|
_excluded2 = ["ldId", "moduleCode", "suppressInit", "overModel", "afterQuery", "isTreeGrid"];
|
|
7
7
|
import React, { forwardRef, useImperativeHandle, useRef, useEffect } from 'react';
|
|
8
8
|
import { getDvaApp } from 'umi';
|
|
@@ -45,8 +45,6 @@ var LdGrid = function LdGrid(_ref) {
|
|
|
45
45
|
isFlow = _ref.isFlow,
|
|
46
46
|
isTreeGrid = _ref.isTreeGrid,
|
|
47
47
|
writable = _ref.writable,
|
|
48
|
-
_ref$autoRowClick = _ref.autoRowClick,
|
|
49
|
-
autoRowClick = _ref$autoRowClick === void 0 ? false : _ref$autoRowClick,
|
|
50
48
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
51
49
|
var gridRef = useRef(null);
|
|
52
50
|
var treeConfig = useCreation(function () {
|
|
@@ -67,17 +65,16 @@ var LdGrid = function LdGrid(_ref) {
|
|
|
67
65
|
useEffect(function () {
|
|
68
66
|
readFilter && readFilter(params, filters);
|
|
69
67
|
}, [params, filters]);
|
|
70
|
-
useEffect(function () {
|
|
71
|
-
if (autoRowClick) {
|
|
72
|
-
if (list[0]) props.onRowClick && props.onRowClick(detail[list[0]], 0);else props.onRowClick && props.onRowClick(null);
|
|
73
|
-
}
|
|
74
|
-
}, [list[0]]);
|
|
75
68
|
useImperativeHandle(wrapperRef, function () {
|
|
76
69
|
return _objectSpread(_objectSpread({}, gridRef.current), {}, {
|
|
77
70
|
getProps: function getProps() {
|
|
78
71
|
var _getDvaApp;
|
|
79
72
|
return {
|
|
80
|
-
apiUrl: (_getDvaApp = getDvaApp()) === null || _getDvaApp === void 0 || (_getDvaApp = _getDvaApp._store.getState()[namespace]) === null || _getDvaApp === void 0 ? void 0 : _getDvaApp.apiUrl
|
|
73
|
+
apiUrl: (_getDvaApp = getDvaApp()) === null || _getDvaApp === void 0 || (_getDvaApp = _getDvaApp._store.getState()[namespace]) === null || _getDvaApp === void 0 ? void 0 : _getDvaApp.apiUrl,
|
|
74
|
+
filter: {
|
|
75
|
+
filters: filters,
|
|
76
|
+
params: params
|
|
77
|
+
}
|
|
81
78
|
};
|
|
82
79
|
},
|
|
83
80
|
onLdQuery: function onLdQuery() {
|
package/es/locales/zh-CN.js
CHANGED
|
@@ -13,6 +13,9 @@ export default {
|
|
|
13
13
|
"luckda.lowcode.modal": "模态视图层",
|
|
14
14
|
"luckda.lowcode.painter.I18n.search": "搜索文案",
|
|
15
15
|
"luckda.lowcode.painter.I18n.add": "新增文案",
|
|
16
|
+
"luckda.lowcode.design.toolbar.save.on": "保存中...",
|
|
17
|
+
"luckda.lowcode.design.toolbar.save.success": "保存成功",
|
|
18
|
+
"luckda.lowcode.design.toolbar.save.error": "保存失败",
|
|
16
19
|
"luckda.lowcode.design.toolbar.clear.tip": "清除提示",
|
|
17
20
|
"luckda.lowcode.design.toolbar.clear": "清除缓存",
|
|
18
21
|
"luckda.lowcode.error.pagedata": "页面数据错误",
|
|
@@ -90,7 +93,8 @@ export default {
|
|
|
90
93
|
"luckda.lowcode.painter.panel-section.style-panel.margin.down": "下间距",
|
|
91
94
|
"luckda.lowcode.painter.panel-section.style-panel.margin.left": "左间距",
|
|
92
95
|
"luckda.lowcode.painter.panel-section.style-panel.group-name": "样式设置",
|
|
93
|
-
"luckda.lowcode.painter.panel-section.style-panel.width": "
|
|
96
|
+
"luckda.lowcode.painter.panel-section.style-panel.width": "请输入宽度",
|
|
97
|
+
"luckda.lowcode.painter.panel-section.style-panel.height": "请输入宽高度",
|
|
94
98
|
"luckda.lowcode.painter.panel-section.style-panel.display": "显示",
|
|
95
99
|
"luckda.lowcode.painter.panel-section.style-panel.margin.superbig": "超大(24px)",
|
|
96
100
|
"luckda.lowcode.painter.panel-section.style-panel.margin.big": "大(20px)",
|
|
@@ -6,7 +6,7 @@ export var COMPONENT_MOUNT = 'component-mount';
|
|
|
6
6
|
// 组件的卸载事件
|
|
7
7
|
export var COMPONENT_UNMOUNT = 'component-unmount';
|
|
8
8
|
// 页面公共资源变化事件
|
|
9
|
-
export var
|
|
9
|
+
export var PAGE_STATE_CHANGED = 'page-state-changed';
|
|
10
10
|
|
|
11
11
|
/******************************** 通用Topic结束 ********************************/
|
|
12
12
|
|
|
@@ -2,4 +2,6 @@ import { loadScript } from "./tools/helper";
|
|
|
2
2
|
export default function launcher() {
|
|
3
3
|
console.log('%c LuckdaLowCodeEngine %c v'.concat(BIZ_VERSION, ' '), 'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;', 'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;');
|
|
4
4
|
window.loadScript = loadScript;
|
|
5
|
+
window.PRIMARY_KEY = window.appConfig.constraintKeys.PRIMARY;
|
|
6
|
+
window.PARENT_KEY = window.appConfig.constraintKeys.PARENT;
|
|
5
7
|
}
|
|
@@ -663,12 +663,6 @@
|
|
|
663
663
|
"name": "表单内容发生改变时的回调",
|
|
664
664
|
"desc": "表单内容发生改变时的回调",
|
|
665
665
|
"func": "function onChildChange(instance) {\n\t\n}"
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
"key": "onPagePublicResourceChanged",
|
|
669
|
-
"name": "页面共享资源变化后",
|
|
670
|
-
"desc": "当页面共享资源发生变化后(pagePublicResourceChanged),执行方法",
|
|
671
|
-
"func": "function onPagePublicResourceChanged(resource, prevResource, instance) {\n\t\n}"
|
|
672
666
|
}
|
|
673
667
|
]
|
|
674
668
|
}
|
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
"label": "getInstance",
|
|
83
83
|
"kind": "method",
|
|
84
84
|
"insertText": "getInstance",
|
|
85
|
-
"documentation": " /**\n * 获取表格实例\n * @method\n
|
|
85
|
+
"documentation": " /**\r\n * 获取表格实例\r\n * @method\r\n */\r"
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"label": "submit",
|
|
89
89
|
"kind": "method",
|
|
90
90
|
"insertText": "submit",
|
|
91
|
-
"documentation": " /**\n * 提交表格数据\n * @method\n
|
|
91
|
+
"documentation": " /**\r\n * 提交表格数据\r\n * @method\r\n */\r"
|
|
92
92
|
}
|
|
93
93
|
]
|
|
94
94
|
},
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"label": "getInstance",
|
|
166
166
|
"kind": "method",
|
|
167
167
|
"insertText": "getInstance",
|
|
168
|
-
"documentation": " /**\n * 获取表格实例\n * @method\n
|
|
168
|
+
"documentation": " /**\r\n * 获取表格实例\r\n * @method\r\n */\r"
|
|
169
169
|
}
|
|
170
170
|
]
|
|
171
171
|
},
|
|
@@ -188,18 +188,6 @@
|
|
|
188
188
|
"name": "ContextProvider",
|
|
189
189
|
"triggerWord": "ctx",
|
|
190
190
|
"completions": [
|
|
191
|
-
{
|
|
192
|
-
"label": "pagePublicResource",
|
|
193
|
-
"kind": "property",
|
|
194
|
-
"insertText": "pagePublicResource",
|
|
195
|
-
"documentation": " /**\r\n * @property {object} pagePublicResource - 页面公共资源\r\n */\r"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
"label": "setPagePublicResource",
|
|
199
|
-
"kind": "method",
|
|
200
|
-
"insertText": "setPagePublicResource(key, value)",
|
|
201
|
-
"documentation": " /**\r\n * @method - 设置页面公共资源\r\n * @param {string} key - 页面公共资源键\r\n * @param {any} value - 页面公共资源值\r\n */\r"
|
|
202
|
-
},
|
|
203
191
|
{
|
|
204
192
|
"label": "loading",
|
|
205
193
|
"kind": "property",
|
|
@@ -216,7 +204,7 @@
|
|
|
216
204
|
"label": "callBehavior",
|
|
217
205
|
"kind": "method",
|
|
218
206
|
"insertText": "callBehavior(evns, params, data)",
|
|
219
|
-
"documentation": "
|
|
207
|
+
"documentation": " /**\r\n * @method - 执行行为接口\r\n * @param {object} evns - moduleCode: 模块编码,datasetCode:数据集编码,behaviorKey:行为key\r\n * @param {object} params - 链接参数\r\n * @param {object} data - body参数\r\n */\r"
|
|
220
208
|
},
|
|
221
209
|
{
|
|
222
210
|
"label": "topics",
|
|
@@ -234,7 +222,7 @@
|
|
|
234
222
|
"label": "getElementById",
|
|
235
223
|
"kind": "method",
|
|
236
224
|
"insertText": "getElementById(compId)",
|
|
237
|
-
"documentation": "
|
|
225
|
+
"documentation": " /**\r\n * @method - 根据组件ID获取实例\r\n * @param {string} compId - 组件ID\r\n * @return {object} target - 组件实例\r\n */\r"
|
|
238
226
|
},
|
|
239
227
|
{
|
|
240
228
|
"label": "getParentElement",
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"css": "background-color: transparent;",
|
|
33
33
|
"advance": {
|
|
34
34
|
"events": [
|
|
35
|
+
{
|
|
36
|
+
"key": "onStateChanged",
|
|
37
|
+
"name": "页面状态变化",
|
|
38
|
+
"desc": "在页面状态发生变化时,执行方法",
|
|
39
|
+
"func": "function onStateChanged(state, prevState, diff){\n\t\n}"
|
|
40
|
+
},
|
|
35
41
|
{
|
|
36
42
|
"key": "onPageMount",
|
|
37
43
|
"name": "页面首次渲染完成",
|
|
@@ -423,10 +423,16 @@
|
|
|
423
423
|
"func": "function onRowDragged(toId, fromId, params) {\n\t\n}"
|
|
424
424
|
},
|
|
425
425
|
{
|
|
426
|
-
"key": "
|
|
427
|
-
"name": "
|
|
428
|
-
"desc": "
|
|
429
|
-
"func": "function
|
|
426
|
+
"key": "onExpectRowChanged",
|
|
427
|
+
"name": "期望行变化后",
|
|
428
|
+
"desc": "表格的期望行发生变化后,执行方法",
|
|
429
|
+
"func": "function onExpectRowChanged(data) {\n\t\n}"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"key": "onFilterChanged",
|
|
433
|
+
"name": "表格过滤条件变化后",
|
|
434
|
+
"desc": "表格过滤条件变化后,执行方法",
|
|
435
|
+
"func": "function onFilterChanged(params, filters) {\n\t\n}"
|
|
430
436
|
},
|
|
431
437
|
{
|
|
432
438
|
"key": "afterInit",
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
"draggable": true,
|
|
11
11
|
"asyncLoad": false,
|
|
12
12
|
"parentKey": "iparentid",
|
|
13
|
+
"showRootAdd": true,
|
|
14
|
+
"onlyRoot": false,
|
|
15
|
+
"rootAddSetting": {},
|
|
16
|
+
"actions": {
|
|
17
|
+
"todoList": []
|
|
18
|
+
},
|
|
13
19
|
"width": "100%",
|
|
14
20
|
"height": "100%",
|
|
15
21
|
"showLine": false,
|
|
@@ -18,12 +24,6 @@
|
|
|
18
24
|
"cancelSelect": true,
|
|
19
25
|
"showIcon": true,
|
|
20
26
|
"treeNodeIcon": [],
|
|
21
|
-
"showRootAdd": true,
|
|
22
|
-
"onlyRoot": false,
|
|
23
|
-
"rootAddSetting": {},
|
|
24
|
-
"actions": {
|
|
25
|
-
"todoList": []
|
|
26
|
-
},
|
|
27
27
|
"doubleClickExpand": true,
|
|
28
28
|
"checkable": false,
|
|
29
29
|
"advance": {
|
|
@@ -64,6 +64,63 @@
|
|
|
64
64
|
"type": "string",
|
|
65
65
|
"default": "iparentid"
|
|
66
66
|
},
|
|
67
|
+
{
|
|
68
|
+
"key": "actions",
|
|
69
|
+
"name": "操作项",
|
|
70
|
+
"desc": "树节点操作项",
|
|
71
|
+
"type": "group",
|
|
72
|
+
"default": true,
|
|
73
|
+
"next": {
|
|
74
|
+
"name": "操作项",
|
|
75
|
+
"props": [
|
|
76
|
+
{
|
|
77
|
+
"key": "rootAdd",
|
|
78
|
+
"name": "根节点",
|
|
79
|
+
"desc": "根节点操作项",
|
|
80
|
+
"type": "group",
|
|
81
|
+
"props": [
|
|
82
|
+
{
|
|
83
|
+
"key": "showRootAdd",
|
|
84
|
+
"name": "是否显示",
|
|
85
|
+
"desc": "是否显示",
|
|
86
|
+
"type": "switch",
|
|
87
|
+
"default": true
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"key": "onlyRoot",
|
|
91
|
+
"name": "根节点唯一",
|
|
92
|
+
"desc": "树组件仅一个根节点,如数据根节点数大于0,则不允许根节点新增",
|
|
93
|
+
"type": "switch",
|
|
94
|
+
"default": false
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"key": "rootAddSetting",
|
|
98
|
+
"name": "根节点配置",
|
|
99
|
+
"desc": "根节点配置",
|
|
100
|
+
"type": "_TreeRootEditor",
|
|
101
|
+
"default": {}
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"key": "actions",
|
|
107
|
+
"name": "节点操作项",
|
|
108
|
+
"type": "_ActionsEditor",
|
|
109
|
+
"default": {
|
|
110
|
+
"todoList": []
|
|
111
|
+
},
|
|
112
|
+
"defaultCode": "function onActionClick(data) {\n\n}",
|
|
113
|
+
"suppressDisplay": true,
|
|
114
|
+
"suppressMax": true,
|
|
115
|
+
"suppressMore": true,
|
|
116
|
+
"wrapper": "collapse",
|
|
117
|
+
"wrapperProps": {
|
|
118
|
+
"suppressIcon": true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
},
|
|
67
124
|
{
|
|
68
125
|
"key": "styleSetting",
|
|
69
126
|
"name": "风格和样式",
|
|
@@ -185,63 +242,6 @@
|
|
|
185
242
|
]
|
|
186
243
|
}
|
|
187
244
|
},
|
|
188
|
-
{
|
|
189
|
-
"key": "actions",
|
|
190
|
-
"name": "操作项",
|
|
191
|
-
"desc": "树节点操作项",
|
|
192
|
-
"type": "group",
|
|
193
|
-
"default": true,
|
|
194
|
-
"next": {
|
|
195
|
-
"name": "操作项",
|
|
196
|
-
"props": [
|
|
197
|
-
{
|
|
198
|
-
"key": "rootAdd",
|
|
199
|
-
"name": "根节点",
|
|
200
|
-
"desc": "根节点操作项",
|
|
201
|
-
"type": "group",
|
|
202
|
-
"props": [
|
|
203
|
-
{
|
|
204
|
-
"key": "showRootAdd",
|
|
205
|
-
"name": "是否显示",
|
|
206
|
-
"desc": "是否显示",
|
|
207
|
-
"type": "switch",
|
|
208
|
-
"default": true
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"key": "onlyRoot",
|
|
212
|
-
"name": "根节点唯一",
|
|
213
|
-
"desc": "树组件仅一个根节点,如数据根节点数大于0,则不允许根节点新增",
|
|
214
|
-
"type": "switch",
|
|
215
|
-
"default": false
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
"key": "rootAddSetting",
|
|
219
|
-
"name": "根节点配置",
|
|
220
|
-
"desc": "根节点配置",
|
|
221
|
-
"type": "_TreeRootEditor",
|
|
222
|
-
"default": {}
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
"key": "actions",
|
|
228
|
-
"name": "节点操作项",
|
|
229
|
-
"type": "_ActionsEditor",
|
|
230
|
-
"default": {
|
|
231
|
-
"todoList": []
|
|
232
|
-
},
|
|
233
|
-
"defaultCode": "function onActionClick(data) {\n\n}",
|
|
234
|
-
"suppressDisplay": true,
|
|
235
|
-
"suppressMax": true,
|
|
236
|
-
"suppressMore": true,
|
|
237
|
-
"wrapper": "collapse",
|
|
238
|
-
"wrapperProps": {
|
|
239
|
-
"suppressIcon": true
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
]
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
245
|
{
|
|
246
246
|
"key": "rowSelectionSetting",
|
|
247
247
|
"name": "节点控制器",
|
|
@@ -354,12 +354,6 @@
|
|
|
354
354
|
"name": "拖拽事件",
|
|
355
355
|
"desc": "节点拖拽事件",
|
|
356
356
|
"func": "function onDrop(info, dragInfo) {\n\t\n}"
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
"key": "onPagePublicResourceChanged",
|
|
360
|
-
"name": "页面共享资源变化后",
|
|
361
|
-
"desc": "当页面共享资源发生变化后(pagePublicResourceChanged),执行方法",
|
|
362
|
-
"func": "function onPagePublicResourceChanged(resource, prevResource, instance) {\n\t\n}"
|
|
363
357
|
}
|
|
364
358
|
]
|
|
365
359
|
}
|
|
@@ -2,9 +2,11 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import React, { createContext, useContext as useReactContext, useRef } from 'react';
|
|
4
4
|
import { history } from 'umi';
|
|
5
|
-
import { useMemoizedFn,
|
|
5
|
+
import { useMemoizedFn, useUpdateEffect } from 'ahooks';
|
|
6
|
+
import diff from "../../tools/diff";
|
|
6
7
|
import { useLDEventBus } from "../EventBusProvider";
|
|
7
8
|
import RemoteSourceProvider, { RemoteSourceContext } from "../RemoteSourceProvider";
|
|
9
|
+
import usePageState from "./usePageState";
|
|
8
10
|
import useTodo from "../../tools/useTodo";
|
|
9
11
|
import * as topics from "../../../constants/event-topics";
|
|
10
12
|
export var Context = /*#__PURE__*/createContext(null);
|
|
@@ -18,8 +20,7 @@ export * from "../../tools/usePageDataStore";
|
|
|
18
20
|
var PRIVATE_KEYS = ['componentList', 'componentMap'];
|
|
19
21
|
export default (function (_ref) {
|
|
20
22
|
var children = _ref.children,
|
|
21
|
-
code = _ref.code
|
|
22
|
-
debug = _ref.debug;
|
|
23
|
+
code = _ref.code;
|
|
23
24
|
var eventBus = useLDEventBus();
|
|
24
25
|
var _useTodo = useTodo(),
|
|
25
26
|
_useTodo2 = _slicedToArray(_useTodo, 3),
|
|
@@ -30,11 +31,11 @@ export default (function (_ref) {
|
|
|
30
31
|
/**
|
|
31
32
|
* 页面公共资源
|
|
32
33
|
*/
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
var _usePageState = usePageState(null),
|
|
35
|
+
state = _usePageState.state,
|
|
36
|
+
prevState = _usePageState.prevState,
|
|
37
|
+
setState = _usePageState.setState,
|
|
38
|
+
getState = _usePageState.getState;
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
41
|
* 组件列表
|
|
@@ -105,24 +106,16 @@ export default (function (_ref) {
|
|
|
105
106
|
return history.location.query;
|
|
106
107
|
});
|
|
107
108
|
useUpdateEffect(function () {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
var _diff = diff(prevState, state);
|
|
110
|
+
eventBus.$publisher(topics.PAGE_STATE_CHANGED, {
|
|
111
|
+
state: state,
|
|
112
|
+
prevState: prevState,
|
|
113
|
+
diff: _diff
|
|
111
114
|
});
|
|
112
|
-
}, [
|
|
115
|
+
}, [state, prevState]);
|
|
113
116
|
var ctx = new Proxy(_objectSpread({
|
|
114
117
|
_register: _register,
|
|
115
118
|
_unregister: _unregister,
|
|
116
|
-
/**
|
|
117
|
-
* @property {object} pagePublicResource - 页面公共资源
|
|
118
|
-
*/
|
|
119
|
-
pagePublicResource: pagePublicResource,
|
|
120
|
-
/**
|
|
121
|
-
* @method - 设置页面公共资源
|
|
122
|
-
* @param {string} key - 页面公共资源键
|
|
123
|
-
* @param {any} value - 页面公共资源值
|
|
124
|
-
*/
|
|
125
|
-
setPagePublicResource: setPagePublicResource,
|
|
126
119
|
/**
|
|
127
120
|
* @property {boolean} loading - loading状态
|
|
128
121
|
*/
|
|
@@ -132,11 +125,11 @@ export default (function (_ref) {
|
|
|
132
125
|
*/
|
|
133
126
|
history: history,
|
|
134
127
|
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
128
|
+
* @method - 执行行为接口
|
|
129
|
+
* @param {object} evns - moduleCode: 模块编码,datasetCode:数据集编码,behaviorKey:行为key
|
|
130
|
+
* @param {object} params - 链接参数
|
|
131
|
+
* @param {object} data - body参数
|
|
132
|
+
*/
|
|
140
133
|
callBehavior: callBehavior,
|
|
141
134
|
/**
|
|
142
135
|
* @property {object} topics - 内置的事件话题
|
|
@@ -148,10 +141,10 @@ export default (function (_ref) {
|
|
|
148
141
|
PRIMARY_KEY: window.appConfig.constraintKeys.PRIMARY,
|
|
149
142
|
PARENT_KEY: window.appConfig.constraintKeys.PARENT,
|
|
150
143
|
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
144
|
+
* @method - 根据组件ID获取实例
|
|
145
|
+
* @param {string} compId - 组件ID
|
|
146
|
+
* @return {object} target - 组件实例
|
|
147
|
+
*/
|
|
155
148
|
getElementById: getElementById,
|
|
156
149
|
/**
|
|
157
150
|
* @method - 根据组件ID获取父组件实例
|
|
@@ -177,12 +170,17 @@ export default (function (_ref) {
|
|
|
177
170
|
if (PRIVATE_KEYS.includes(property)) {
|
|
178
171
|
var _privateGetter$curren;
|
|
179
172
|
return (_privateGetter$curren = _privateGetter.current) === null || _privateGetter$curren === void 0 ? void 0 : _privateGetter$curren[property]();
|
|
173
|
+
} else if (property === 'state') {
|
|
174
|
+
return getState();
|
|
180
175
|
}
|
|
181
176
|
return Reflect.get(target, property, receiver);
|
|
182
177
|
},
|
|
183
178
|
set: function set(target, property, receiver) {
|
|
184
179
|
if (PRIVATE_KEYS.includes(property)) {
|
|
185
180
|
throw new Error("\u5C5E\u6027 \"".concat(property, "\" \u662F\u53EA\u8BFB\u7684"));
|
|
181
|
+
} else if (property === 'state') {
|
|
182
|
+
setState(receiver);
|
|
183
|
+
return true;
|
|
186
184
|
} else {
|
|
187
185
|
return Reflect.set(target, property, receiver);
|
|
188
186
|
}
|
|
@@ -192,7 +190,6 @@ export default (function (_ref) {
|
|
|
192
190
|
value: ctx
|
|
193
191
|
}, /*#__PURE__*/React.createElement(RemoteSourceProvider, {
|
|
194
192
|
code: code,
|
|
195
|
-
eventBus: eventBus
|
|
196
|
-
debug: debug
|
|
193
|
+
eventBus: eventBus
|
|
197
194
|
}, children));
|
|
198
195
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import { usePrevious, useGetState, useMemoizedFn } from 'ahooks';
|
|
4
|
+
var usePageState = function usePageState(defaultValue) {
|
|
5
|
+
var _useGetState = useGetState(defaultValue),
|
|
6
|
+
_useGetState2 = _slicedToArray(_useGetState, 3),
|
|
7
|
+
state = _useGetState2[0],
|
|
8
|
+
setState = _useGetState2[1],
|
|
9
|
+
getState = _useGetState2[2];
|
|
10
|
+
var prevState = usePrevious(state);
|
|
11
|
+
var setPageState = useMemoizedFn(function (newState) {
|
|
12
|
+
setState(_objectSpread(_objectSpread({}, prevState), newState));
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
state: state,
|
|
16
|
+
prevState: prevState,
|
|
17
|
+
setState: setPageState,
|
|
18
|
+
getState: getState
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default usePageState;
|
|
@@ -19,8 +19,7 @@ export var RemoteSourceContext = /*#__PURE__*/createContext(null);
|
|
|
19
19
|
export default (function (_ref) {
|
|
20
20
|
var children = _ref.children,
|
|
21
21
|
code = _ref.code,
|
|
22
|
-
eventBus = _ref.eventBus
|
|
23
|
-
debug = _ref.debug;
|
|
22
|
+
eventBus = _ref.eventBus;
|
|
24
23
|
var _usePageDataStore = usePageDataStore(function (state) {
|
|
25
24
|
return {
|
|
26
25
|
initialize: state.initialize,
|
|
@@ -51,7 +50,7 @@ export default (function (_ref) {
|
|
|
51
50
|
setRuntime = _useCookieState2[1];
|
|
52
51
|
var prevRuntime = useRef(cookieRuntime);
|
|
53
52
|
useCreation(function () {
|
|
54
|
-
|
|
53
|
+
launcher();
|
|
55
54
|
pause();
|
|
56
55
|
if (eventBus.runtime !== cookieRuntime) {
|
|
57
56
|
prevRuntime.current = cookieRuntime;
|
|
@@ -59,10 +58,8 @@ export default (function (_ref) {
|
|
|
59
58
|
}
|
|
60
59
|
}, []);
|
|
61
60
|
useUnmount(function () {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
clear();
|
|
65
|
-
}
|
|
61
|
+
reset();
|
|
62
|
+
clear();
|
|
66
63
|
setRuntime(prevRuntime.current);
|
|
67
64
|
});
|
|
68
65
|
|
|
@@ -176,7 +173,7 @@ export default (function (_ref) {
|
|
|
176
173
|
case 2:
|
|
177
174
|
fetchPageDataRes = _context.sent;
|
|
178
175
|
if (!(fetchPageDataRes.code === 1)) {
|
|
179
|
-
_context.next =
|
|
176
|
+
_context.next = 16;
|
|
180
177
|
break;
|
|
181
178
|
}
|
|
182
179
|
data = fetchPageDataRes.data, list = fetchPageDataRes.list, detail = fetchPageDataRes.detail;
|
|
@@ -201,12 +198,10 @@ export default (function (_ref) {
|
|
|
201
198
|
runFetchAllSerials({
|
|
202
199
|
uid: data.moduleId
|
|
203
200
|
});
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
resume();
|
|
207
|
-
}
|
|
201
|
+
initialize(decompress(source));
|
|
202
|
+
resume();
|
|
208
203
|
eventBus.$publisher(PAGE_LOAD_MOUNT);
|
|
209
|
-
case
|
|
204
|
+
case 16:
|
|
210
205
|
case "end":
|
|
211
206
|
return _context.stop();
|
|
212
207
|
}
|
|
@@ -149,25 +149,37 @@ export function isColor(str) {
|
|
|
149
149
|
var rgbaRegex = /^rgba?\(\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(,\s*(0|1|0?\.\d+))?\s*\)$/;
|
|
150
150
|
return hexRegex.test(str) || rgbaRegex.test(str);
|
|
151
151
|
}
|
|
152
|
-
export function
|
|
153
|
-
var meta = document.querySelector("meta[name=\"".concat(
|
|
152
|
+
export function setMetaAttrs(name, data) {
|
|
153
|
+
var meta = document.querySelector("meta[name=\"".concat(name, "\"]"));
|
|
154
154
|
if (!meta) {
|
|
155
155
|
meta = document.createElement('meta');
|
|
156
156
|
}
|
|
157
|
-
meta.name =
|
|
158
|
-
meta.content = new URLSearchParams(data).toString().replaceAll('&', ',');
|
|
157
|
+
meta.name = name;
|
|
158
|
+
meta.content = isString(data) ? data : new URLSearchParams(data).toString().replaceAll('&', ',');
|
|
159
159
|
document.head.appendChild(meta);
|
|
160
160
|
}
|
|
161
|
-
export function
|
|
161
|
+
export function getMetaAttr(name, _) {
|
|
162
162
|
if (isNil(name)) return void 0;
|
|
163
|
-
var meta = document.querySelector("meta[name=\"".concat(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return
|
|
168
|
-
}
|
|
163
|
+
var meta = document.querySelector("meta[name=\"".concat(name, "\"]"));
|
|
164
|
+
if (meta.content.includes(',')) {
|
|
165
|
+
var data = new URLSearchParams(meta.content.replaceAll(',', '&'));
|
|
166
|
+
if (isNil(_)) {
|
|
167
|
+
return Object.fromEntries(data.entries());
|
|
168
|
+
}
|
|
169
|
+
if (isArray(_)) {
|
|
170
|
+
return _.map(function (n) {
|
|
171
|
+
return data.get(n);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return data.get(_);
|
|
169
175
|
}
|
|
170
|
-
return
|
|
176
|
+
return meta.content;
|
|
177
|
+
}
|
|
178
|
+
export function setLDMetaAttrs(data) {
|
|
179
|
+
setMetaAttrs(META_TAG_NAME, data);
|
|
180
|
+
}
|
|
181
|
+
export function getLDMetaAttr(_) {
|
|
182
|
+
return getMetaAttr(META_TAG_NAME, _);
|
|
171
183
|
}
|
|
172
184
|
export function extractKeywords(obj, keys) {
|
|
173
185
|
var keywords = [];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
var useCombinedRefs = function useCombinedRefs(forwardedRef) {
|
|
3
|
+
var innerRef = useRef(null);
|
|
4
|
+
useEffect(function () {
|
|
5
|
+
if (!forwardedRef) return;
|
|
6
|
+
if (typeof forwardedRef === 'function') {
|
|
7
|
+
forwardedRef(innerRef.current);
|
|
8
|
+
} else {
|
|
9
|
+
forwardedRef.current = innerRef.current;
|
|
10
|
+
}
|
|
11
|
+
}, [forwardedRef]);
|
|
12
|
+
return forwardedRef || innerRef;
|
|
13
|
+
};
|
|
14
|
+
export default useCombinedRefs;
|