@cloudbase/lowcode-builder 1.8.70 → 1.8.72

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.70",
3
+ "version": "1.8.72",
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.57",
49
+ "@cloudbase/cals": "^1.0.58",
50
50
  "@cloudbase/lowcode-generator": "^1.8.24",
51
51
  "axios": "^0.21.0",
52
52
  "browserfs": "^1.4.3",
@@ -80,7 +80,6 @@
80
80
  "@types/weixin-app": "^2.9.0",
81
81
  "cross-env": "^7.0.3",
82
82
  "csstype": "^2.6.10",
83
- "jest": "^27.5.1",
84
83
  "ts-loader": "^8.3.0",
85
84
  "ts-node": "^10.4.0",
86
85
  "tsc-watch": "^6.0.4",
@@ -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.5d28c337dc394d80cf5d.bundle.js"
546
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.a24a8e628a0ab3a0c8b5.bundle.js"
547
547
  ></script>
548
548
  </body>
549
549
  </html>
@@ -1,12 +1,11 @@
1
1
  import { observable } from 'mobx'
2
2
  import { createMpApp } from '@cloudbase/weda-client';
3
- import { createComputed, formatEnum, enumOptions } from '<%= subLevelPath %>../common/util'
3
+ import { createComputed, formatEnum, enumOptions, generateDatasetQuery } from '<%= subLevelPath %>../common/util'
4
4
  import appGlobal from '<%= subLevelPath %>../app/app-global'
5
5
  import { createDataset } from '<%= subLevelPath %>../datasources/index'
6
6
 
7
7
  import lodashGet from 'lodash.get';
8
8
  import config from '<%= subLevelPath %>../common/config';
9
- import { generateDatasetQuery } from '../common/util';
10
9
 
11
10
 
12
11
  <%= importor.state? `import state from '../lowcode/state'` : "const state = {}" %>
@@ -17,17 +17,20 @@ function patchProp(baseWidget, pendingWidget, patch, prefixes) {
17
17
  if (Array.isArray(pendingWidget)) {
18
18
  /**
19
19
  * 数组长度发生变化,更新整个数组
20
+ * 当启用 _WaForKey,且可以取到key时,更新整个数组
20
21
  * 通过 array[0].xxx 进行更新,id 不会更新,疑似 mp 实现 bug
21
22
  */
22
23
  if (pendingWidget.length != baseWidget.length) {
23
24
  patch[prefixes] = pendingWidget
24
- return
25
- }
26
- for (let i = 0; i < pendingWidget.length; i++) {
27
- if (!baseWidget[i]) {
28
- patch[prefixes + '[' + i + ']'] = pendingWidget[i]
29
- } else {
30
- patchProp(baseWidget[i], pendingWidget[i], patch, prefixes + '[' + i + ']')
25
+ } else if (pendingWidget?.some(item=>item._waForKey) && pendingWidget[0]?._key) {
26
+ patch[prefixes] = pendingWidget
27
+ } else {
28
+ for (let i = 0; i < pendingWidget.length; i++) {
29
+ if (!baseWidget[i]) {
30
+ patch[prefixes + '[' + i + ']'] = pendingWidget[i]
31
+ } else {
32
+ patchProp(baseWidget[i], pendingWidget[i], patch, prefixes + '[' + i + ']')
33
+ }
31
34
  }
32
35
  }
33
36
  } else {
@@ -201,7 +201,7 @@ export function createEventHandlers(
201
201
  if (!self[nextHandler.handlerName] && error) {
202
202
  const message = generateErrorDebugMessage(error) || error.errMsg || ''
203
203
  console.error(`Action error:`, message, error?.stack);
204
- if (!looseError) {
204
+ if (!looseError && !/scanCode:fail cancel/.test(message)) {
205
205
  if (app.__internal__?.env?.type !== 'production') {
206
206
  app.showModal({
207
207
  title: `事件响应失败`,
@@ -77,7 +77,7 @@ export function resolveWidgetData(props, widgetId) {
77
77
  if (!Array.isArray(props)) {
78
78
  return resolveWidgetProp(props, widgetId);
79
79
  }
80
- return props.map(prop => resolveWidgetData(prop, widgetId));
80
+ return props.map((prop) => resolveWidgetData(prop, widgetId));
81
81
  }
82
82
 
83
83
  export function createWidgets(widgetProps, dataBinds, ownerMpInst, widgetHolder) {
@@ -135,7 +135,8 @@ function createSubWidgetTree(
135
135
  (node, parentNode, cache) => {
136
136
  const parentForWidgetArr = ownerForWidgetHolder[node.id] || [];
137
137
  const { _waForKey } = node.value;
138
- const key = forContext.forItems?.[node.id]?.[_waForKey];
138
+
139
+ const key = forContext.forItems?.[node.id]?.[_waForKey] || currentIndex;
139
140
  let forExistingWidgetMap = {};
140
141
  let forExsitWidget;
141
142
 
@@ -280,8 +281,8 @@ function runFor(curForNode, dataBinds, ownerMpInst, forContext, ownerForWidgetHo
280
281
  // dispose widgets before reused instead
281
282
  // disposeWidgets(parentForWidgets[curForNode.id])
282
283
  const exsitMap = forList.reduce((map, item, index) => {
283
- const cache = item?.[_waForKey];
284
- if (map[cache] === undefined) {
284
+ const cache = item?.[_waForKey] || index;
285
+ if (cache !== undefined && map[cache] === undefined) {
285
286
  map[cache] = index;
286
287
  }
287
288
  return map;
@@ -291,17 +292,18 @@ function runFor(curForNode, dataBinds, ownerMpInst, forContext, ownerForWidgetHo
291
292
  const existingWidgetIndexMap = {};
292
293
  const extraWidgetsIndexMap = {};
293
294
  forWidgets.forEach((widget, index) => {
294
- if (exsitMap[widget._key] !== undefined) {
295
+ const cecheKey = widget._key || index;
296
+ if (exsitMap[cecheKey] !== undefined) {
295
297
  const nodeId = widget.id?.split(ID_SEPARATOR)[0];
296
- existingWidgetMap[widget._key] = { index: exsitMap[widget._key], widgets: { [nodeId]: widget } };
298
+ existingWidgetMap[cecheKey] = { index: exsitMap[cecheKey], widgets: { [nodeId]: widget } };
297
299
  /**
298
- * 此处依赖了 existingWidgetMap[widget._key].widgets 的引用,
300
+ * 此处依赖了 existingWidgetMap[cecheKey].widgets 的引用,
299
301
  * 为了直接可以通过 index 访问到 existingWidgetMap 里的值进行编辑
300
302
  * 但是依赖引用关系,存在维护风险
301
303
  */
302
- existingWidgetIndexMap[index] = existingWidgetMap[widget._key].widgets;
304
+ existingWidgetIndexMap[index] = existingWidgetMap[cecheKey].widgets;
303
305
  // need to use uqique key
304
- exsitMap[widget._key] = undefined;
306
+ exsitMap[cecheKey] = undefined;
305
307
  } else {
306
308
  extraWidgetsIndexMap[index] = widget;
307
309
  }