@cloudbase/lowcode-builder 1.8.72 → 1.8.73
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/lib/builder/mp/index.js +14 -5
- package/lib/builder.web.js +13 -13
- package/package.json +2 -2
- package/template/html/index.html.ejs +1 -1
- package/template/mp/common/data-patch.js +1 -1
- package/template/mp/common/merge-renderer.js +1 -5
- package/template/mp/common/style.js +1 -1
- package/template/mp/common/weapp-page.js +30 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.73",
|
|
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",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@babel/core": "7.21.4",
|
|
48
48
|
"@babel/preset-env": "7.21.4",
|
|
49
|
-
"@cloudbase/cals": "^1.0.
|
|
49
|
+
"@cloudbase/cals": "^1.0.59",
|
|
50
50
|
"@cloudbase/lowcode-generator": "^1.8.24",
|
|
51
51
|
"axios": "^0.21.0",
|
|
52
52
|
"browserfs": "^1.4.3",
|
|
@@ -543,7 +543,7 @@
|
|
|
543
543
|
crossorigin
|
|
544
544
|
src="<%=
|
|
545
545
|
cdnEndpoints.cdngo
|
|
546
|
-
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.
|
|
546
|
+
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.72ae321d6810e4fa769a.bundle.js"
|
|
547
547
|
></script>
|
|
548
548
|
</body>
|
|
549
549
|
</html>
|
|
@@ -4,7 +4,7 @@ export function getDatapatch(base, pendingData) {
|
|
|
4
4
|
for (const widgetId in pendingData) {
|
|
5
5
|
const baseWidget = base[widgetId]
|
|
6
6
|
const pendingWidget = pendingData[widgetId]
|
|
7
|
-
if (!baseWidget) {
|
|
7
|
+
if (!baseWidget || typeof pendingWidget === 'string') {
|
|
8
8
|
patch[widgetId] = pendingWidget
|
|
9
9
|
} else {
|
|
10
10
|
patchProp(baseWidget, pendingWidget, patch, widgetId)
|
|
@@ -5,13 +5,9 @@ import { getDatapatch } from './data-patch'
|
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
// Attention, must be called at the end of attached or page load to make sure user init take effect
|
|
8
|
-
initMergeRenderer(widgets) {
|
|
8
|
+
initMergeRenderer(widgets, dataFactory = {}) {
|
|
9
9
|
this.flushPendingData = throttle(this.flushPendingData.bind(this), 18)
|
|
10
10
|
|
|
11
|
-
const dataFactory = {
|
|
12
|
-
// <%= dataPropNames.pageState %>: () => pageState,
|
|
13
|
-
// <%= dataPropNames.pageComputed %>: () => pageComputed,
|
|
14
|
-
}
|
|
15
11
|
for (const id in widgets) {
|
|
16
12
|
const props = widgets[id]
|
|
17
13
|
dataFactory['<%= dataPropNames.widgetProp %>' + id] = () => resolveWidgetData(props, id)
|
|
@@ -5,7 +5,7 @@ import { toDash } from './util'
|
|
|
5
5
|
export function styleToCss(style) {
|
|
6
6
|
const styleDeclars = [] // ['color: red;', 'background-color: green']
|
|
7
7
|
for (const key in style) {
|
|
8
|
-
styleDeclars.push(
|
|
8
|
+
styleDeclars.push(`${/^--/.test(key) ? key : toDash(key)}:${style[key]};`)
|
|
9
9
|
}
|
|
10
10
|
return styleDeclars.join('')
|
|
11
11
|
}
|
|
@@ -22,6 +22,7 @@ import { $w as baseAPI } from '../app/weapps-api';
|
|
|
22
22
|
import { Event } from './event-emitter';
|
|
23
23
|
import { generatePageUrl } from '@cloudbase/weda-client';
|
|
24
24
|
import { mergeDynamic2StaticData, patchWdigetPropsWithEvtListeners } from './util';
|
|
25
|
+
import { styleToCss } from './style';
|
|
25
26
|
|
|
26
27
|
export const PAGE_ROOT_SYMBOL = Symbol('@@page_route@@')
|
|
27
28
|
|
|
@@ -118,6 +119,7 @@ export function createPage({
|
|
|
118
119
|
|
|
119
120
|
const evtHandlers = createEventHandlers(evtListeners);
|
|
120
121
|
const {[PAGE_ROOT_SYMBOL]: pageRootDataBinds, ...componentDataBinds} = dataBinds
|
|
122
|
+
const staticPageStyle = <%= pageStyle || '{}' %>
|
|
121
123
|
|
|
122
124
|
return Component({
|
|
123
125
|
_componentType: 'page',
|
|
@@ -127,7 +129,7 @@ export function createPage({
|
|
|
127
129
|
_expiredMessage: '',
|
|
128
130
|
weDaHasLogin: null,
|
|
129
131
|
loginError: null,
|
|
130
|
-
pageStyle:
|
|
132
|
+
pageStyle: styleToCss(staticPageStyle)
|
|
131
133
|
},
|
|
132
134
|
lifetimes: {
|
|
133
135
|
attached() {
|
|
@@ -158,7 +160,33 @@ export function createPage({
|
|
|
158
160
|
const widget = getWidget($page.widgets, e.target.id);
|
|
159
161
|
widget._methods = {};
|
|
160
162
|
};
|
|
161
|
-
this._disposers.push(...this.initMergeRenderer($page.widgets
|
|
163
|
+
this._disposers.push(...this.initMergeRenderer($page.widgets, {
|
|
164
|
+
pageStyle: () => {
|
|
165
|
+
let pageStyle = { ...staticPageStyle }
|
|
166
|
+
try {
|
|
167
|
+
if ( pageRootDataBinds.style ) {
|
|
168
|
+
const { style } = mergeDynamic2StaticData({}, {
|
|
169
|
+
style: pageRootDataBinds.style
|
|
170
|
+
}, {
|
|
171
|
+
codeContext: {
|
|
172
|
+
/**
|
|
173
|
+
* $page 或 $comp 实例
|
|
174
|
+
*/
|
|
175
|
+
instance: $page,
|
|
176
|
+
},
|
|
177
|
+
$w: $page?.__internal__?.$w,
|
|
178
|
+
})
|
|
179
|
+
pageStyle = {
|
|
180
|
+
...pageStyle,
|
|
181
|
+
...style
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
} catch(e) {
|
|
185
|
+
console.warn('页面动态style绑定计算失败:', e)
|
|
186
|
+
}
|
|
187
|
+
return styleToCss(pageStyle)
|
|
188
|
+
}
|
|
189
|
+
}));
|
|
162
190
|
getExpiredMessage(<%= expirationStartTimesnap %>).then(message => {
|
|
163
191
|
if (message) {
|
|
164
192
|
this.setData({
|