@cloudbase/lowcode-builder 1.8.72 → 1.8.74

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.72",
3
+ "version": "1.8.74",
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.58",
49
+ "@cloudbase/cals": "^1.0.63",
50
50
  "@cloudbase/lowcode-generator": "^1.8.24",
51
51
  "axios": "^0.21.0",
52
52
  "browserfs": "^1.4.3",
@@ -454,7 +454,7 @@
454
454
  <script type="module" src="/src/index.jsx"></script>
455
455
  <% } %> <% if(!isAdminPortal){ %>
456
456
  <script src="<%= wedaPrivateConfigEndpoint ? wedaPrivateConfigEndpoint : '' %>/weda-config/weda-private.js"></script>
457
- <script src="<%= cdnEndpoints.cloudbase %>/cloudbase-js-sdk/2.4.7-beta.0/cloudbase.full.js?v=1"></script>
457
+ <script src="<%= cdnEndpoints.cloudbase %>/cloudbase-js-sdk/2.5.36-beta.0/cloudbase.full.js?v=1"></script>
458
458
  <% }%>
459
459
  <script>
460
460
  if (window.cloudbase && window._aegis) {
@@ -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.a24a8e628a0ab3a0c8b5.bundle.js"
546
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.6b0be6e6436fb7ead047.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(toDash(key) + ':' + style[key] + ';')
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: `<%= 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({
@@ -197,9 +225,10 @@ export function createPage({
197
225
  ...mergeRenderer,
198
226
  async beforePageCustomLaunch(query) {
199
227
  if (!this._beforePageCustomLaunchPromise) {
200
- this._beforePageCustomLaunchPromise = new Promise(async (resolve) => {
228
+ this._beforePageCustomLaunchPromise = new Promise(async (resolve, reject) => {
201
229
  await wxApp.globaldata?._beforePageCustomLaunchPromise;
202
230
  const $page = this._getInstance();
231
+ let weDaHasLogin
203
232
  if (query) {
204
233
  EXTRA_API.setParams($page.uuid, query);
205
234
  }
@@ -207,18 +236,21 @@ export function createPage({
207
236
  this.setData({ _isCheckingAtuh: true });
208
237
  const auth = await checkAuth(app, app.id, $page);
209
238
  if (auth) {
239
+ weDaHasLogin = true
210
240
  this.setData({
211
- weDaHasLogin: true,
241
+ weDaHasLogin,
212
242
  });
213
243
  createStateDataSourceVar($page.uuid, generateParamsParser({ app, $page, $w: $page.__internal__?.$w }));
214
244
  } else {
245
+ weDaHasLogin = false
215
246
  this.setData({
216
- weDaHasLogin: false,
247
+ weDaHasLogin,
217
248
  });
218
249
  }
219
250
  } catch(e) {
251
+ weDaHasLogin = false
220
252
  this.setData({
221
- weDaHasLogin: false,
253
+ weDaHasLogin,
222
254
  loginError: { message: e.message }
223
255
  });
224
256
  } finally {
@@ -241,7 +273,11 @@ export function createPage({
241
273
  });
242
274
  }
243
275
  }
244
- resolve();
276
+ if(weDaHasLogin===false) {
277
+ reject(new Error('permission denied') )
278
+ }else {
279
+ resolve()
280
+ }
245
281
  });
246
282
  }
247
283
  return this._beforePageCustomLaunchPromise;
@@ -1,2 +1,4 @@
1
1
  <% importStyles.map(style => {%>
2
2
  @import '<%= style %>';<%})%>
3
+
4
+ <%= content || '' %>
@@ -5,8 +5,8 @@
5
5
  "dependencies": {<% if(importJSSDK) {%>
6
6
  "@cloudbase/js-sdk": "2.5.6-beta.1",<% } %>
7
7
  "@cloudbase/oauth": "0.1.1-alpha.5",
8
- "@cloudbase/weda-client": "1.0.20",
9
- "@cloudbase/weda-cloud-sdk": "1.0.53",
8
+ "@cloudbase/weda-client": "1.0.22",
9
+ "@cloudbase/weda-cloud-sdk": "1.0.56",
10
10
  "mobx": "^5.15.4",
11
11
  "lodash.get": "^4.4.2",
12
12
  "lodash.set": "^4.3.2",
@@ -1,14 +1,13 @@
1
1
  import { $w as baseAPI } from '<%= subLevelPath %>../../app/weapps-api'
2
2
 
3
- export const $page = {
3
+ export const $page = <%= JSON.stringify( {
4
4
  __internal__: {
5
5
  active: false,
6
- packageName: '<%= packageName %>',
6
+ packageName,
7
7
  },
8
- uuid: '<%= uuid %>',
9
- label: '<%= label %>',
10
-
11
- };
8
+ uuid,
9
+ label,
10
+ }, undefined, 2) %>;
12
11
 
13
12
  export const $w = new Proxy(
14
13
  baseAPI,
@@ -2,7 +2,8 @@
2
2
  "name": "lcap-<%= appId%>",
3
3
  "version": "1.0.0",
4
4
  "scripts": {
5
- "build-web": "webpack --config ./webpack/webpack.web.prod.js"
5
+ "build-web": "webpack --config ./webpack/webpack.web.prod.js",
6
+ "dev": "webpack-dev-server --mode development --config ./webpack/web.dev.js --open"
6
7
  },
7
8
  "dependencies": {
8
9
  "@cloudbase/js-sdk": "2.4.0-beta.0",
@@ -52,13 +53,13 @@
52
53
  "terser-webpack-plugin": "^3.0.2",
53
54
  "mini-css-extract-plugin": "^0.8.0",
54
55
  "hard-source-webpack-plugin": "^0.13.1",
55
- "html-webpack-plugin": "^3.2.0",
56
+ "html-webpack-plugin": "^4.5.2",
56
57
  "ts-loader": "^8.3.0",
57
58
  "typescript": "^4.4.4",
58
59
  "vue-loader": "15.9.8",
59
60
  "vue-template-compiler": "2.6.14",
60
- "webpack": "^4.41.4",
61
- "webpack-cli": "^4.2.0",
62
- "webpack-dev-server": "^3.11.0"
61
+ "webpack": "^4.47.0",
62
+ "webpack-dev-server": "^3.11.3",
63
+ "webpack-cli": "^3.3.12"
63
64
  }
64
65
  }
@@ -0,0 +1,21 @@
1
+ const webpack = require('webpack');
2
+ const prodConfig = require('./webpack.web.prod.js');
3
+
4
+ prodConfig.plugins.forEach((plugin) => {
5
+ if (plugin instanceof webpack.DefinePlugin) {
6
+ plugin.definitions['process.env.historyType'] = JSON.stringify('HASH');
7
+ }
8
+ });
9
+
10
+ const config = Object.assign({}, prodConfig, {
11
+ mode: 'development',
12
+ watch: true,
13
+ devServer: {
14
+ compress: true,
15
+ hot: true,
16
+ liveReload: true,
17
+ port: 9001,
18
+ },
19
+ });
20
+
21
+ module.exports = config;