@cloudbase/lowcode-builder 1.8.52 → 1.8.54

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.
@@ -296,7 +296,7 @@ async function generateCompositeComponent(ctx, compositedComp, compLibCommonReso
296
296
  .map((m) => m.name),
297
297
  eventHandlers: (0, util_3.createEventHandlers)(compositeCtx, componentInstances, weapps_core_1.COMPONENT_API_PREFIX),
298
298
  // protectEventKeys: builtinMpEvents,
299
- emitEvents: compositedComp.emitEvents.map((evt) => evt.eventName),
299
+ emitEvents: (compositedComp.emitEvents || []).map((evt) => evt.eventName),
300
300
  widgetProps: (0, util_3.createWidgetProps)(compositeCtx, componentInstances),
301
301
  compApi: weapps_core_1.COMPONENT_API_PREFIX,
302
302
  jsonSchemaType2jsClass: mp_1.jsonSchemaType2jsClass,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.8.52",
3
+ "version": "1.8.54",
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",
@@ -89,4 +89,4 @@
89
89
  "webpack-dev-server": "^4.7.3",
90
90
  "worker-loader": "^3.0.8"
91
91
  }
92
- }
92
+ }
@@ -450,9 +450,7 @@
450
450
  </div>
451
451
  <% }%>
452
452
  </div>
453
- <% jsApis.forEach(function(jsApi){%>
454
- <script src="<%=jsApi %>"></script>
455
- <% })%> <% if(canUseVite){ %>
453
+ <% if(canUseVite){ %>
456
454
  <script type="module" src="/src/index.jsx"></script>
457
455
  <% } %> <% if(!isAdminPortal){ %>
458
456
  <script src="/weda-config/weda-private.js"></script>
@@ -538,11 +536,14 @@
538
536
  cdnEndpoints.cdngo
539
537
  %>/lcap/lcap-resource-cdngo/-/release/_url/qcloud/lowcode/static/ide/assets/js/babel.min.js"
540
538
  ></script>
539
+ <% jsApis.forEach(function(jsApi){%>
540
+ <script src="<%=jsApi %>"></script>
541
+ <% })%>
541
542
  <script
542
543
  crossorigin
543
544
  src="<%=
544
545
  cdnEndpoints.cdngo
545
- %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.b91c0084b8c065947b40.bundle.js"
546
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.24b6f4f560a5d284c4ff.bundle.js"
546
547
  ></script>
547
548
  </body>
548
549
  </html>
@@ -131,11 +131,17 @@ App({
131
131
  } finally {
132
132
  for (const queryId in app.dataset?.query || {}) {
133
133
  if (app.dataset.query[queryId]?._schema?.trigger === 'auto') {
134
- try {
135
- app.dataset?.query?.[queryId]?.trigger?.();
136
- } catch (e) {
137
- console.error(`query ${queryId} 初始化失败:`, e);
138
- }
134
+ /**
135
+ * query 初始化不阻塞生命周期
136
+ */
137
+ Promise.resolve()
138
+ .then(async () => {
139
+ await app.dataset?.query?.[queryId]?.initPromise;
140
+ return app.dataset?.query?.[queryId]?.trigger?.();
141
+ })
142
+ .catch((e) => {
143
+ console.error(`query ${queryId} 初始化失败:`, e);
144
+ });
139
145
  }
140
146
  }
141
147
  resolve();
@@ -9,7 +9,8 @@ export class Query {
9
9
  #disposes = [];
10
10
  #dataBinds = {};
11
11
  #triggered = false;
12
- #watched = false;
12
+ initPromise;
13
+ #initedResolver = (value) => {};
13
14
  #paramsRef = observable({ current: null });
14
15
  #currentRequestKey = null;
15
16
  #observableValue = observable({ data: null, error: null, isFetching: false });
@@ -22,24 +23,31 @@ export class Query {
22
23
  trigger: schema.trigger,
23
24
  };
24
25
  this.#context = context;
26
+
27
+ this.initPromise = new Promise((resolve) => {
28
+ this.#initedResolver = resolve;
29
+ });
30
+
25
31
  if (this.#schema?.trigger === 'auto') {
26
32
  this.#disposes.push(
27
33
  autorun(
28
34
  (r) => {
29
35
  try {
30
36
  const data = this.#resolveParams();
31
- if (this.#watched && this.#triggered) {
37
+ if (this.#triggered) {
32
38
  this.#debounceTrigger(data);
33
39
  }
34
40
  } catch (e) {
35
41
  console.error(e);
36
42
  } finally {
37
- this.#watched = true
43
+ this.#initedResolver(true);
38
44
  }
39
45
  },
40
46
  { delay: 50 },
41
47
  ),
42
48
  );
49
+ } else {
50
+ this.#initedResolver(true);
43
51
  }
44
52
  this.#paramsRef.current = this.#schema.data;
45
53
  this.#dataBinds = Object.entries(this.#schema.dataBinds || {}).reduce((map, [prop, fn]) => {
@@ -52,7 +60,7 @@ export class Query {
52
60
  const { $w } = this.#context;
53
61
 
54
62
  this.#action =
55
- this.#schema.type === 'sql'
63
+ this.#schema.type === 'sql' || this.#schema.type === 'sqlserver'
56
64
  ? async function (data) {
57
65
  const Data = await $w.cloud.callWedaApi({
58
66
  action: 'RunPluginQuery',
@@ -245,7 +245,7 @@ export function getDeep(target, key, keySeparator = '.') {
245
245
  return target;
246
246
  }
247
247
  const keys = `${key}`.split(keySeparator);
248
- while (keys.length > 0 && target != null) {
248
+ while (keys.length > 0 && target != null && target !== undefined) {
249
249
  target = target[keys.shift()];
250
250
  }
251
251
  return keys.length === 0 ? target : undefined;
@@ -225,12 +225,17 @@ export function createPage({
225
225
  // eslint-disable-next-line no-restricted-syntax
226
226
  for (const queryId in $page.dataset?.query || {}) {
227
227
  if ($page.dataset.query[queryId]?._schema?.trigger === 'auto') {
228
- try {
229
- $page.dataset.query[queryId].trigger();
230
- this._disposers.push(() => $page.dataset.query[queryId].destroy());
231
- } catch (e) {
232
- console.error(`query ${queryId} 初始化失败:`, e);
233
- }
228
+ /**
229
+ * query 初始化不阻塞生命周期
230
+ */
231
+ Promise.resolve()
232
+ .then(async () => {
233
+ await $page.dataset.query[queryId]?.initPromise;
234
+ return $page.dataset.query[queryId].trigger();
235
+ })
236
+ .catch((e) => {
237
+ console.error(`query ${queryId} 初始化失败:`, e);
238
+ });
234
239
  }
235
240
  }
236
241
  resolve();