@cloudbase/lowcode-builder 1.3.7 → 1.3.9

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.
@@ -63,7 +63,17 @@ function generateWxml(ctx, widgets, docTag, wxmlDataPrefix, usingComponents, com
63
63
  // slot prop
64
64
  const slotNodes = createXml(properties, parent, parentForNodes);
65
65
  slotNodes.forEach((node) => {
66
- node.attributes.slot = id;
66
+ if (node.name == 'block') {
67
+ /**
68
+ * block 组件上的 slot 属性不生效,只能透传到下面的组件
69
+ */
70
+ (node.elements || []).forEach((node) => {
71
+ node.attributes.slot = id;
72
+ });
73
+ }
74
+ else {
75
+ node.attributes.slot = id;
76
+ }
67
77
  elements === null || elements === void 0 ? void 0 : elements.push(node);
68
78
  });
69
79
  if (parent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
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",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@cloudbase/cals": "^0.5.10",
42
- "@cloudbase/lowcode-generator": "^1.3.3",
42
+ "@cloudbase/lowcode-generator": "^1.3.4",
43
43
  "axios": "^0.21.0",
44
44
  "browserfs": "^1.4.3",
45
45
  "browserify-zlib": "^0.2.0",
@@ -475,7 +475,7 @@
475
475
  crossorigin
476
476
  src="<%=
477
477
  cdnEndpoints.cdngo
478
- %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.dc06b72ade1c0972ca04.bundle.js"
478
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.93e5fcdaff8b78e37e71.bundle.js"
479
479
  ></script>
480
480
  </body>
481
481
  </html>
@@ -15,12 +15,16 @@ export function getDatapatch(base, pendingData) {
15
15
 
16
16
  function patchProp(baseWidget, pendingWidget, patch, prefixes) {
17
17
  if (Array.isArray(pendingWidget)) {
18
- if (pendingWidget.length < baseWidget.length) { // array element deleted
18
+ /**
19
+ * 数组长度发生变化,更新整个数组
20
+ * 通过 array[0].xxx 进行更新,id 不会更新,疑似 mp 实现 bug
21
+ */
22
+ if (pendingWidget.length != baseWidget.length) {
19
23
  patch[prefixes] = pendingWidget
20
24
  return
21
25
  }
22
26
  for (let i = 0; i < pendingWidget.length; i++) {
23
- if (!baseWidget[i]) { // new array element
27
+ if (!baseWidget[i]) {
24
28
  patch[prefixes + '[' + i + ']'] = pendingWidget[i]
25
29
  } else {
26
30
  patchProp(baseWidget[i], pendingWidget[i], patch, prefixes + '[' + i + ']')
@@ -341,7 +341,6 @@ export function formatErrorMsg(e) {
341
341
  * 检查页面权限
342
342
  **/
343
343
  export async function checkAuth(app, appId, $page) {
344
- return true;
345
344
  const loginPage = findLoginPage(app);
346
345
  if (loginPage?.id === $page.id) {
347
346
  return true;
@@ -372,9 +371,11 @@ export async function checkAuth(app, appId, $page) {
372
371
  try {
373
372
  if (isAnonymousUser) {
374
373
  redirectToLogin($page);
374
+ return false
375
375
  }
376
376
  } catch (e) {
377
377
  redirectToLogin($page);
378
+ return false
378
379
  }
379
380
  }
380
381
  return isAccess;
@@ -456,7 +457,7 @@ async function getGeneralOptions(optionName) {
456
457
  data: {
457
458
  PageSize: 1,
458
459
  PageIndex: 1,
459
- LikeNameOrTitle: optionName,
460
+ OptNameList: [optionName],
460
461
  },
461
462
  });
462
463
  }
@@ -146,17 +146,15 @@ export function createPage(
146
146
  app.__internal__.activePage = $page;
147
147
  this._pageActive = true;
148
148
 
149
- const hook = lifecycle.onShow || lifecycle.onPageShow;
150
- hook?.call?.($page);
151
-
152
149
  // 权限检查
153
150
  if (await checkAuth(app, app.id, $page)) {
154
151
  this.setData({
155
152
  weDaHasLogin: true,
156
153
  });
154
+ const hook = lifecycle.onShow || lifecycle.onPageShow;
155
+ hook?.call?.($page);
156
+ this.invokeEventHandler(id, 'show');
157
157
  }
158
-
159
- this.invokeEventHandler(id, 'show');
160
158
  },
161
159
  onHide() {
162
160
  const $page = this._getInstance();
@@ -214,7 +212,7 @@ export function createPage(
214
212
  componentInstance = components;
215
213
  }
216
214
 
217
- const currentInstanceRef = componentInstance?._getInstanceRef()?.current;
215
+ const currentInstanceRef = componentInstance?._getInstanceRef()?.current || {};
218
216
  const { methods = {}, ...restInstanceRef } = currentInstanceRef;
219
217
 
220
218
  const readonlyMap = {
@@ -42,7 +42,7 @@ const EXTRA_PROPS_MAP = [
42
42
  /**
43
43
  * widgetProps 附带值
44
44
  */
45
- '_id',
45
+ // '_id',
46
46
  '_order',
47
47
  'classList',
48
48
  ].reduce((map, key) => {
@@ -671,8 +671,8 @@ get description() {
671
671
  const { id } = this._widget;
672
672
  return `
673
673
  使用说明:
674
- 1. w 命名空间下为内置方法,可通过 $w.${id}.w.<成员> 或 $w.${id}.<成员> 访问。
675
- 访问 id 示例: $w.${id}.id 或 $w.${id}.w.id
674
+ 1. sys 命名空间下为内置方法,可通过 $w.${id}.sys.<成员> 或 $w.${id}.<成员> 访问。
675
+ 访问 id 示例: $w.${id}.id 或 $w.${id}.sys.id
676
676
  2. custom 命名空间下为用户自定义对外暴露的成员,可通过 $w.${id}.custom.<成员> 或 $w.${id}.<成员> 访问。
677
677
  访问自定义方法 hello 示例: $w.${id}.hello() 或 $w.${id}.custom.hello()
678
678
  3. 通过 $w.${id}.<成员> 访问时,如果自定义成员与内置成员重名,则自定义成员覆盖内置成员。
@@ -698,7 +698,8 @@ constructor(widget) {
698
698
  if (buildinMember) return buildinMember;
699
699
 
700
700
  // 兼容原来的 widget。最后直接代理到 widget 上,主要是访问组件的属性
701
- return target._widget[prop];
701
+ // return target._widget[prop];
702
+ return undefined
702
703
  },
703
704
  });
704
705
  }