@cloudbase/lowcode-builder 1.8.98 → 1.8.100
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.100",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@babel/core": "7.21.4",
|
|
49
49
|
"@babel/preset-env": "7.21.4",
|
|
50
|
-
"@cloudbase/cals": "^1.0.
|
|
50
|
+
"@cloudbase/cals": "^1.0.80",
|
|
51
51
|
"@cloudbase/lowcode-generator": "^1.8.29",
|
|
52
52
|
"axios": "^0.21.0",
|
|
53
53
|
"browserfs": "^1.4.3",
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
setConfig,
|
|
20
20
|
} from './cloud-sdk';
|
|
21
21
|
import { runWatchers, watchAndSyncDatasetState2Local } from './watch';
|
|
22
|
-
import { getWedaAPI } from '@cloudbase/weda-client';
|
|
22
|
+
import { getWedaAPI, urlJoinParams } from '@cloudbase/weda-client';
|
|
23
23
|
import { Event } from './event-emitter';
|
|
24
24
|
import { mergeDynamic2StaticData, patchWdigetPropsWithEvtListeners } from './util';
|
|
25
25
|
import { styleToCss } from './style';
|
|
@@ -28,7 +28,32 @@ export const PAGE_ROOT_SYMBOL = Symbol('@@page_route@@')
|
|
|
28
28
|
|
|
29
29
|
const wxApp = getApp();
|
|
30
30
|
|
|
31
|
-
function
|
|
31
|
+
function resolveParticialPageData(ctx, key, data = {}, dataBinds = {}) {
|
|
32
|
+
const reg = new RegExp(`^${key}`)
|
|
33
|
+
let merge = { [key]: data[key] }
|
|
34
|
+
const pickedDataBinds = {}
|
|
35
|
+
for (const key in dataBinds) {
|
|
36
|
+
if (reg.test(key)) {
|
|
37
|
+
pickedDataBinds[key] = dataBinds[key]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
merge = mergeDynamic2StaticData(merge, pickedDataBinds, {
|
|
42
|
+
codeContext: {
|
|
43
|
+
/**
|
|
44
|
+
* $page 或 $comp 实例
|
|
45
|
+
*/
|
|
46
|
+
instance: ctx.app?.__internal__?.activePage,
|
|
47
|
+
},
|
|
48
|
+
$w: ctx.app?.__internal__?.activePage?.__internal__?.$w,
|
|
49
|
+
})
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.warn('分享设置绑定计算错误:', e)
|
|
52
|
+
}
|
|
53
|
+
return merge
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function extractLifecycles(ctx, lifecycle, appShareMessage, shareTimeline, dataBinds, resetShare = true) {
|
|
32
57
|
const result = {};
|
|
33
58
|
Object.keys(lifecycle).map((name) => {
|
|
34
59
|
result[name] = function () {
|
|
@@ -41,20 +66,7 @@ function extractLifecycles(ctx, lifecycle, appShareMessage, dataBinds, resetShar
|
|
|
41
66
|
if (res?.from === 'button' && res?.target?.dataset?.weda_share_info) {
|
|
42
67
|
return res?.target?.dataset?.weda_share_info;
|
|
43
68
|
} else if (res?.from === 'menu' && appShareMessage?.enable) {
|
|
44
|
-
let mergedData = { appShareMessage }
|
|
45
|
-
try {
|
|
46
|
-
mergedData = mergeDynamic2StaticData({ appShareMessage }, dataBinds, {
|
|
47
|
-
codeContext: {
|
|
48
|
-
/**
|
|
49
|
-
* $page 或 $comp 实例
|
|
50
|
-
*/
|
|
51
|
-
instance: ctx.app?.__internal__?.activePage,
|
|
52
|
-
},
|
|
53
|
-
$w: ctx.app?.__internal__?.activePage?.__internal__?.$w,
|
|
54
|
-
})
|
|
55
|
-
} catch(e) {
|
|
56
|
-
console.warn('分享设置绑定计算错误:', e)
|
|
57
|
-
}
|
|
69
|
+
let mergedData = resolveParticialPageData(ctx, 'appShareMessage', { appShareMessage }, dataBinds);
|
|
58
70
|
|
|
59
71
|
let { pageId, params, imageUrl, title, packageName } = mergedData.appShareMessage || {};
|
|
60
72
|
const url = ctx.app?.__internal__?.generatePageUrl({
|
|
@@ -80,6 +92,32 @@ function extractLifecycles(ctx, lifecycle, appShareMessage, dataBinds, resetShar
|
|
|
80
92
|
};
|
|
81
93
|
}
|
|
82
94
|
|
|
95
|
+
if (shareTimeline?.enable || lifecycle?.['onShareTimeline']) {
|
|
96
|
+
result['onShareTimeline'] = () => {
|
|
97
|
+
if (shareTimeline?.enable) {
|
|
98
|
+
let mergedData = resolveParticialPageData(ctx, 'shareTimeline', { shareTimeline }, dataBinds);
|
|
99
|
+
|
|
100
|
+
let { params, imageUrl, title } = mergedData.shareTimeline || {};
|
|
101
|
+
const query = urlJoinParams('/fake', Array.isArray(params) ? params.reduce((map, { key, value }) => {
|
|
102
|
+
map[key] = value
|
|
103
|
+
return map
|
|
104
|
+
}, {}) : params).replace(/^\/fake\?/, '')
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
query,
|
|
108
|
+
imageUrl: ctx.app?.__internal__?.resolveStaticResourceUrl?.(imageUrl) || imageUrl,
|
|
109
|
+
title,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
return lifecycle?.['onShareTimeline']?.() || {};
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.log(error);
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
83
121
|
// 更新设备信息 窗口信息
|
|
84
122
|
result['onResize'] = (res) => {
|
|
85
123
|
const { $w } = getWedaAPI()
|
|
@@ -228,7 +266,7 @@ export function createPage({
|
|
|
228
266
|
_disposers: [],
|
|
229
267
|
|
|
230
268
|
/** page lifecycles **/
|
|
231
|
-
...extractLifecycles({ app }, lifecycle, pageAttributes?.appShareMessage, pageRootDataBinds, resetShare),
|
|
269
|
+
...extractLifecycles({ app }, lifecycle, pageAttributes?.appShareMessage, pageAttributes?.shareTimeline, pageRootDataBinds, resetShare),
|
|
232
270
|
...evtHandlers,
|
|
233
271
|
...mergeRenderer,
|
|
234
272
|
async beforePageCustomLaunch(query) {
|
package/template/mp/package.json
CHANGED