@cloudbase/framework-plugin-low-code 0.6.52 → 0.6.55

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.
Files changed (64) hide show
  1. package/lib/builder/config/common.js +1 -1
  2. package/lib/builder/config/index.js +2 -2
  3. package/lib/builder/config/mp.js +1 -1
  4. package/lib/builder/core/copy.js +3 -3
  5. package/lib/builder/core/generate.js +11 -11
  6. package/lib/builder/core/index.js +13 -13
  7. package/lib/builder/core/material.js +6 -6
  8. package/lib/builder/core/plugin.js +3 -3
  9. package/lib/builder/core/prepare.js +2 -2
  10. package/lib/builder/core/webpack.js +5 -5
  11. package/lib/builder/mp/index.js +47 -47
  12. package/lib/builder/mp/lowcode.js +4 -4
  13. package/lib/builder/mp/materials.js +16 -16
  14. package/lib/builder/mp/mixMode.js +12 -12
  15. package/lib/builder/mp/mp_config.js +11 -11
  16. package/lib/builder/mp/util.js +6 -6
  17. package/lib/builder/mp/wxml.js +4 -4
  18. package/lib/builder/service/builder/copy.js +11 -11
  19. package/lib/builder/service/builder/generate.js +56 -52
  20. package/lib/builder/service/builder/index.js +2 -2
  21. package/lib/builder/service/builder/plugin.js +2 -2
  22. package/lib/builder/service/builder/webpack.js +24 -23
  23. package/lib/builder/types/common.js +1 -0
  24. package/lib/builder/util/common.js +8 -6
  25. package/lib/builder/util/console.js +1 -1
  26. package/lib/builder/util/generateFiles.js +2 -2
  27. package/lib/builder/util/index.js +1 -1
  28. package/lib/builder/util/junk.js +4 -2
  29. package/lib/builder/util/mp.js +1 -1
  30. package/lib/builder/util/net.js +1 -1
  31. package/lib/builder/util/style.js +1 -1
  32. package/lib/builder/util/weapp.js +1 -1
  33. package/lib/generate.js +2 -2
  34. package/lib/generator/config/index.js +2 -2
  35. package/lib/generator/core/generate.js +36 -34
  36. package/lib/generator/core/index.js +4 -4
  37. package/lib/generator/core/material.js +14 -14
  38. package/lib/generator/types/common.js +6 -3
  39. package/lib/generator/util/index.js +1 -1
  40. package/lib/generator/util/style.js +2 -2
  41. package/lib/index.d.ts.map +1 -1
  42. package/lib/index.js +81 -76
  43. package/lib/utils/common.d.ts +1 -1
  44. package/lib/utils/common.d.ts.map +1 -1
  45. package/lib/utils/common.js +2 -2
  46. package/lib/utils/dataSource.js +2 -2
  47. package/lib/utils/index.js +1 -1
  48. package/lib/utils/postProcess.js +3 -3
  49. package/lib/weapps-core/config/index.js +1 -1
  50. package/lib/weapps-core/index.js +2 -2
  51. package/lib/weapps-core/types/index.js +1 -1
  52. package/lib/weapps-core/utils/appbuild.js +6 -3
  53. package/lib/weapps-core/utils/common.js +3 -2
  54. package/lib/weapps-core/utils/file.d.ts +1 -1
  55. package/lib/weapps-core/utils/formily.js +37 -37
  56. package/lib/weapps-core/utils/index.js +1 -1
  57. package/lib/weapps-core/utils/style.js +15 -15
  58. package/package.json +1 -1
  59. package/template/html/index.html.ejs +8 -2
  60. package/template/mp/app/weapps-api.js +9 -0
  61. package/template/mp/common/weapp-page.js +11 -0
  62. package/template/mp/common/weapp-sdk.js +35 -0
  63. package/template/src/app/global-api.js +3 -0
  64. package/template/webpack/web.prod.js +6 -2
@@ -17,9 +17,9 @@ function serialize(webRuntimeAppData) {
17
17
  vars: webRuntimeAppData.vars || { data: [] },
18
18
  dataset: webRuntimeAppData.dataset,
19
19
  };
20
- common_1.setValidValue(weAppData, 'appConfig', webRuntimeAppData.appConfig);
21
- common_1.setValidValue(weAppData, 'themeVars', webRuntimeAppData.themeVars);
22
- common_1.setValidValue(weAppData, 'presetColors', webRuntimeAppData.presetColors);
20
+ (0, common_1.setValidValue)(weAppData, 'appConfig', webRuntimeAppData.appConfig);
21
+ (0, common_1.setValidValue)(weAppData, 'themeVars', webRuntimeAppData.themeVars);
22
+ (0, common_1.setValidValue)(weAppData, 'presetColors', webRuntimeAppData.presetColors);
23
23
  handlePageInstanceList(webRuntimeAppData.pageInstanceList, weAppData.pageInstanceList);
24
24
  function handlePageInstanceList(pageInstanceList, collection) {
25
25
  pageInstanceList.map((pageData) => {
@@ -27,20 +27,20 @@ function serialize(webRuntimeAppData) {
27
27
  const newPage = {
28
28
  id: pageData.id,
29
29
  };
30
- common_1.setValidValue(newPage, 'isHome', pageData.isHome);
31
- common_1.setValidValue(newPage, 'data', readDynamicData(pageData));
32
- common_1.setValidValue(newPage, 'commonStyle', style_1.removeInvalidStyleFormValue(pageData.style));
33
- common_1.setValidValue(newPage, 'styleBindPath', pageData.styleBindPath);
34
- if (common_1.isValidStyleBind(pageData.styleBind)) {
35
- common_1.setValidValue(newPage, 'styleBind', pageData.styleBind);
30
+ (0, common_1.setValidValue)(newPage, 'isHome', pageData.isHome);
31
+ (0, common_1.setValidValue)(newPage, 'data', readDynamicData(pageData));
32
+ (0, common_1.setValidValue)(newPage, 'commonStyle', (0, style_1.removeInvalidStyleFormValue)(pageData.style));
33
+ (0, common_1.setValidValue)(newPage, 'styleBindPath', pageData.styleBindPath);
34
+ if ((0, common_1.isValidStyleBind)(pageData.styleBind)) {
35
+ (0, common_1.setValidValue)(newPage, 'styleBind', pageData.styleBind);
36
36
  }
37
- if (common_1.isValidClassNameListBind(pageData.classNameListBind)) {
38
- common_1.setValidValue(newPage, 'classNameListBind', pageData.classNameListBind);
37
+ if ((0, common_1.isValidClassNameListBind)(pageData.classNameListBind)) {
38
+ (0, common_1.setValidValue)(newPage, 'classNameListBind', pageData.classNameListBind);
39
39
  }
40
- common_1.setValidValue(newPage, 'componentInstances', readComponents(pageData.componentSchemaJson.properties));
41
- common_1.setValidValue(newPage, 'listeners', readListeners(pageData.listenerInstances));
42
- common_1.setValidValue(newPage, 'pluginInstances', pageData.pluginInstances);
43
- common_1.setValidValue(newPage, 'lowCodes', pageData.codeModules);
40
+ (0, common_1.setValidValue)(newPage, 'componentInstances', readComponents(pageData.componentSchemaJson.properties));
41
+ (0, common_1.setValidValue)(newPage, 'listeners', readListeners(pageData.listenerInstances));
42
+ (0, common_1.setValidValue)(newPage, 'pluginInstances', pageData.pluginInstances);
43
+ (0, common_1.setValidValue)(newPage, 'lowCodes', pageData.codeModules);
44
44
  if ((_a = pageData.children) === null || _a === void 0 ? void 0 : _a.length) {
45
45
  newPage.children = newPage.children || [];
46
46
  handlePageInstanceList(pageData.children, newPage.children);
@@ -60,41 +60,41 @@ function serialize(webRuntimeAppData) {
60
60
  if (srcProps) {
61
61
  const cmpParts = srcProps.sourceKey.split(':');
62
62
  cmps[key] = { genericComp: srcCmp['genericComp'] };
63
- common_1.setValidValue(cmps[key], 'xComponent', {
63
+ (0, common_1.setValidValue)(cmps[key], 'xComponent', {
64
64
  moduleName: cmpParts[0],
65
65
  name: cmpParts[1],
66
66
  });
67
67
  const componentXProps = {};
68
- common_1.setValidValue(componentXProps, 'data', readDynamicData(srcProps));
69
- common_1.setValidValue(componentXProps, 'listeners', readListeners(srcProps.listenerInstances));
70
- common_1.setValidValue(componentXProps, 'staticResourceAttribute', srcProps.staticResourceAttribute);
71
- common_1.setValidValue(componentXProps, 'directives', readDirectives(srcProps));
72
- common_1.setValidValue(componentXProps, 'customDataForm', srcProps.customDataForm);
73
- common_1.setValidValue(componentXProps, 'style', srcProps.style);
74
- common_1.setValidValue(componentXProps, 'commonStyle', style_1.removeInvalidStyleFormValue(srcProps.commonStyle));
75
- common_1.setValidValue(componentXProps, 'styleBindPath', srcProps.styleBindPath);
68
+ (0, common_1.setValidValue)(componentXProps, 'data', readDynamicData(srcProps));
69
+ (0, common_1.setValidValue)(componentXProps, 'listeners', readListeners(srcProps.listenerInstances));
70
+ (0, common_1.setValidValue)(componentXProps, 'staticResourceAttribute', srcProps.staticResourceAttribute);
71
+ (0, common_1.setValidValue)(componentXProps, 'directives', readDirectives(srcProps));
72
+ (0, common_1.setValidValue)(componentXProps, 'customDataForm', srcProps.customDataForm);
73
+ (0, common_1.setValidValue)(componentXProps, 'style', srcProps.style);
74
+ (0, common_1.setValidValue)(componentXProps, 'commonStyle', (0, style_1.removeInvalidStyleFormValue)(srcProps.commonStyle));
75
+ (0, common_1.setValidValue)(componentXProps, 'styleBindPath', srcProps.styleBindPath);
76
76
  if ((_a = srcProps.styleBind) === null || _a === void 0 ? void 0 : _a.bindDataPath) {
77
77
  componentXProps.styleBind = {
78
78
  type: srcProps.styleBind.type,
79
79
  value: srcProps.styleBind.bindDataPath,
80
80
  };
81
81
  }
82
- if (common_1.isValidClassNameListBind(srcProps.classNameListBind)) {
82
+ if ((0, common_1.isValidClassNameListBind)(srcProps.classNameListBind)) {
83
83
  const classList = srcProps.classNameListBind;
84
- common_1.setValidValue(componentXProps, 'classListBind', {
84
+ (0, common_1.setValidValue)(componentXProps, 'classListBind', {
85
85
  type: classList.type,
86
86
  value: classList.bindDataPath,
87
87
  });
88
88
  }
89
89
  if (srcProps.classNameList) {
90
- common_1.setValidValue(componentXProps, 'classList', srcProps.classNameList);
90
+ (0, common_1.setValidValue)(componentXProps, 'classList', srcProps.classNameList);
91
91
  }
92
- common_1.setValidValue(cmps[key], 'xProps', componentXProps);
93
- common_1.setValidValue(cmps[key], 'xIndex', srcCmp['x-index']);
92
+ (0, common_1.setValidValue)(cmps[key], 'xProps', componentXProps);
93
+ (0, common_1.setValidValue)(cmps[key], 'xIndex', srcCmp['x-index']);
94
94
  const excludeKeys = (srcProps.dataTypes || [])
95
95
  .filter((dataType) => dataType.type !== 'slot')
96
96
  .map((dataType) => dataType.propertyPath);
97
- common_1.setValidValue(cmps[key], 'properties', readComponents(srcCmp.properties, excludeKeys));
97
+ (0, common_1.setValidValue)(cmps[key], 'properties', readComponents(srcCmp.properties, excludeKeys));
98
98
  }
99
99
  else {
100
100
  cmps[key] = { properties: readComponents(srcCmp.properties) };
@@ -212,7 +212,7 @@ function deserialize(weAppData) {
212
212
  page.vars = srcPage.vars ? srcPage.vars : page.vars;
213
213
  page.isHome = srcPage.isHome || false;
214
214
  page.style = srcPage.commonStyle || {};
215
- common_1.setValidValue(page, 'styleBindPath', srcPage.styleBindPath);
215
+ (0, common_1.setValidValue)(page, 'styleBindPath', srcPage.styleBindPath);
216
216
  page.codeModules = srcPage.lowCodes || [];
217
217
  page.pluginInstances = srcPage.pluginInstances || [];
218
218
  page.componentSchemaJson = {
@@ -264,7 +264,7 @@ function readCmpInstances(cmps) {
264
264
  xProps.style = cmp.xProps.style || {};
265
265
  xProps.commonStyle = cmp.xProps.commonStyle || {};
266
266
  xProps.staticResourceAttribute = cmp.xProps.staticResourceAttribute || [];
267
- common_1.setValidValue(xProps, 'styleBindPath', cmp.xProps.styleBindPath);
267
+ (0, common_1.setValidValue)(xProps, 'styleBindPath', cmp.xProps.styleBindPath);
268
268
  let { classList, classListBind } = cmp.xProps;
269
269
  const { styleBind } = cmp.xProps;
270
270
  const legacyClassList = classList;
@@ -277,9 +277,9 @@ function readCmpInstances(cmps) {
277
277
  classListBind = classListBind;
278
278
  }
279
279
  }
280
- classList && common_1.setValidValue(xProps, 'classNameList', classList);
280
+ classList && (0, common_1.setValidValue)(xProps, 'classNameList', classList);
281
281
  classListBind &&
282
- common_1.setValidValue(xProps, 'classNameListBind', {
282
+ (0, common_1.setValidValue)(xProps, 'classNameListBind', {
283
283
  type: classListBind.type,
284
284
  propertyPath: 'classNameList',
285
285
  bindDataPath: classListBind.value,
@@ -330,10 +330,10 @@ function readCmpInstances(cmps) {
330
330
  xProps.data = xProps.data || {};
331
331
  xProps.data._visible = true;
332
332
  }
333
- common_1.setValidValue(target, 'x-component', xCmp.toLocaleLowerCase());
334
- common_1.setValidValue(xProps, 'customDataForm', cmp.xProps.customDataForm);
333
+ (0, common_1.setValidValue)(target, 'x-component', xCmp.toLocaleLowerCase());
334
+ (0, common_1.setValidValue)(xProps, 'customDataForm', cmp.xProps.customDataForm);
335
335
  target['x-props'] = xProps;
336
- common_1.setValidValue(target, 'x-index', cmp.xIndex);
336
+ (0, common_1.setValidValue)(target, 'x-index', cmp.xIndex);
337
337
  }
338
338
  }
339
339
  return properties;
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
7
7
  o[k2] = m[k];
8
8
  }));
9
9
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./formily"), exports);
@@ -76,9 +76,9 @@ function toCssStyle(commonStyle = {}, options = { toRem: true, ignoreSelf: false
76
76
  if (radius !== undefined) {
77
77
  setStyleValue(style, 'borderRadius', _handleStyleNumValue(radius, !!options.addPXUnit));
78
78
  }
79
- if (radiusInfo && !common_1.isEmptyObj(radiusInfo)) {
79
+ if (radiusInfo && !(0, common_1.isEmptyObj)(radiusInfo)) {
80
80
  if (Object.keys(radiusInfo).length === 4) {
81
- if (uniq_1.default(map_1.default(radiusInfo, (val) => val)).length === 1) {
81
+ if ((0, uniq_1.default)((0, map_1.default)(radiusInfo, (val) => val)).length === 1) {
82
82
  setStyleValue(style, 'borderRadius', _handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit));
83
83
  }
84
84
  else if (radiusInfo.topLeft === radiusInfo.bottomRight &&
@@ -120,7 +120,7 @@ function toCssStyle(commonStyle = {}, options = { toRem: true, ignoreSelf: false
120
120
  setStyleValue(style, 'backgroundSize', _handleStyleNumValue(size, !!options.addPXUnit));
121
121
  }
122
122
  setStyleValue(style, 'backgroundPosition', position);
123
- if (positionObj && !common_1.isEmptyObj(positionObj)) {
123
+ if (positionObj && !(0, common_1.isEmptyObj)(positionObj)) {
124
124
  style.background += ` ${_handleStyleNumValue(positionObj.left, !!options.addPXUnit)} ${_handleStyleNumValue(positionObj.top, !!options.addPXUnit)}`;
125
125
  }
126
126
  }
@@ -166,7 +166,7 @@ exports.toCssStyle = toCssStyle;
166
166
  function removeInvalidStyleFormValue(styleForm = {}) {
167
167
  return Object.keys(styleForm).reduce((result, key) => {
168
168
  const propStyleFormData = styleForm[key];
169
- if (common_1.isPlainObject(propStyleFormData)) {
169
+ if ((0, common_1.isPlainObject)(propStyleFormData)) {
170
170
  setStyleValue(result, key, removeInvalidStyleFormValue(propStyleFormData));
171
171
  }
172
172
  else {
@@ -178,24 +178,24 @@ function removeInvalidStyleFormValue(styleForm = {}) {
178
178
  exports.removeInvalidStyleFormValue = removeInvalidStyleFormValue;
179
179
  function setDistanceStyle(style, distance, attr, addPXUnit) {
180
180
  if (Object.keys(distance).length === 4) {
181
- if (uniq_1.default(map_1.default(distance, (val) => val)).length === 1) {
182
- setStyleValue(style, common_1.camelcase(`${attr}`), _handleStyleNumValue(distance.top, addPXUnit));
181
+ if ((0, uniq_1.default)((0, map_1.default)(distance, (val) => val)).length === 1) {
182
+ setStyleValue(style, (0, common_1.camelcase)(`${attr}`), _handleStyleNumValue(distance.top, addPXUnit));
183
183
  }
184
184
  else if (distance.top === distance.bottom &&
185
185
  distance.left === distance.right) {
186
- setStyleValue(style, common_1.camelcase(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)}`);
186
+ setStyleValue(style, (0, common_1.camelcase)(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)}`);
187
187
  }
188
188
  else if (distance.left === distance.right) {
189
- setStyleValue(style, common_1.camelcase(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)} ${_handleStyleNumValue(distance.bottom, addPXUnit)}`);
189
+ setStyleValue(style, (0, common_1.camelcase)(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)} ${_handleStyleNumValue(distance.bottom, addPXUnit)}`);
190
190
  }
191
191
  else {
192
- setStyleValue(style, common_1.camelcase(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)} ${_handleStyleNumValue(distance.bottom, addPXUnit)} ${_handleStyleNumValue(distance.left, addPXUnit)}`);
192
+ setStyleValue(style, (0, common_1.camelcase)(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)} ${_handleStyleNumValue(distance.bottom, addPXUnit)} ${_handleStyleNumValue(distance.left, addPXUnit)}`);
193
193
  }
194
194
  }
195
195
  else {
196
196
  config_1.DISTANCE_KEY_LIST.forEach((key) => {
197
197
  if (distance[key] !== undefined)
198
- setStyleValue(style, common_1.camelcase(`${attr}_${key}`), _handleStyleNumValue(distance[key], addPXUnit));
198
+ setStyleValue(style, (0, common_1.camelcase)(`${attr}_${key}`), _handleStyleNumValue(distance[key], addPXUnit));
199
199
  });
200
200
  }
201
201
  }
@@ -227,10 +227,10 @@ function setStyleValue(object, key, value) {
227
227
  if (key === 'open') {
228
228
  return;
229
229
  }
230
- if (common_1.isEmptyObj(value)) {
230
+ if ((0, common_1.isEmptyObj)(value)) {
231
231
  return;
232
232
  }
233
- object[common_1.camelcase(key)] = value;
233
+ object[(0, common_1.camelcase)(key)] = value;
234
234
  }
235
235
  function calPxToREM(px) {
236
236
  if (Number.isNaN(px / 28))
@@ -280,7 +280,7 @@ exports.toRPX = toRPX;
280
280
  function removeWrapperBadEffectStyle(commonStyle = {}) {
281
281
  return Object.keys(commonStyle).reduce((result, key) => {
282
282
  const value = commonStyle[key];
283
- const camelcaseKey = common_1.camelcase(key);
283
+ const camelcaseKey = (0, common_1.camelcase)(key);
284
284
  if (config_1.WRAPPER_REMOVE_STYLE_KEY_LIST.includes(camelcaseKey)) {
285
285
  return result;
286
286
  }
@@ -296,7 +296,7 @@ function removeEffectTwiceStyle(commonStyle = {}) {
296
296
  const style = {};
297
297
  Object.keys(commonStyle).map((key) => {
298
298
  const value = commonStyle[key];
299
- const camelcaseKey = common_1.camelcase(key);
299
+ const camelcaseKey = (0, common_1.camelcase)(key);
300
300
  if (config_1.SELF_REMOVE_STYLE_KEY_LIST.includes(camelcaseKey)) {
301
301
  return false;
302
302
  }
@@ -313,7 +313,7 @@ function toCssText(style, className = '.some-class-name') {
313
313
  const attrText = Object.keys(style)
314
314
  .map((key) => {
315
315
  const value = style[key];
316
- return `${common_1.kebabCase(key)}: ${value};`;
316
+ return `${(0, common_1.kebabCase)(key)}: ${value};`;
317
317
  })
318
318
  .join('\n');
319
319
  return `${className} { ${attrText} }\n`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/framework-plugin-low-code",
3
- "version": "0.6.52",
3
+ "version": "0.6.55",
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",
@@ -428,7 +428,7 @@
428
428
  let promise = _callFunction.call(window.cloudbase, ...arguments);
429
429
  if (promise instanceof Promise) {
430
430
  return promise
431
- .then((res) => {
431
+ .then(function (res) {
432
432
  const { name, data = {} } = args || {};
433
433
  try {
434
434
  if (res.result && res.result.code) {
@@ -449,7 +449,7 @@
449
449
  } catch (e) {}
450
450
  return res;
451
451
  })
452
- .catch((e) => {
452
+ .catch(function (e) {
453
453
  try {
454
454
  _aegis.report({
455
455
  msg:
@@ -481,6 +481,12 @@
481
481
  crossorigin="anonymous"
482
482
  src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.5/dist/h5.browser.js?v=1"
483
483
  ></script>
484
+ <script>
485
+ // zxing polifill
486
+ if (!this.globalThis) {
487
+ this.globalThis = this;
488
+ }
489
+ </script>
484
490
  <script
485
491
  crossorigin="anonymous"
486
492
  src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js?v=1"
@@ -56,6 +56,15 @@ function createGlboalApi() {
56
56
  _getConfig: function () {
57
57
  return <%= appConfig %>;
58
58
  },
59
+ async getWXContext() {
60
+ const { Data } = await globalAPI.cloud.callWedaApi({
61
+ action: 'InvokeComponentWxModule',
62
+ data: {
63
+ Method: 'GetWxContext',
64
+ },
65
+ });
66
+ return typeof Data === 'string' ? JSON.parse(Data) : Data
67
+ }
59
68
  },
60
69
  // ... other sdk apis & apis from mp
61
70
  } // The global api exposed to lowcode
@@ -38,6 +38,17 @@ export function createPage(
38
38
  delete result[e[1]];
39
39
  }
40
40
  });
41
+ result['onShareAppMessage'] = (res) => {
42
+ if (res?.from === 'button' && res?.target?.dataset?.weda_share_info) {
43
+ return res?.target?.dataset?.weda_share_info;
44
+ }
45
+ try {
46
+ return lifecycle?.['onShareAppMessage']?.() || {};
47
+ } catch (error) {
48
+ console.log(error);
49
+ return {};
50
+ }
51
+ }
41
52
  return result;
42
53
  }
43
54
 
@@ -15,6 +15,12 @@ function createNavigatorFn(fnName) {
15
15
  ? `/${packageName}/pages/${pageId}/index`
16
16
  : `/pages/${pageId}/index`
17
17
  }
18
+
19
+ if (fnName === 'navigateTo') {
20
+ navigateToFn(urlJoinParams(url, params), { events, success, fail, complete});
21
+ return;
22
+ }
23
+
18
24
  wx[fnName]({
19
25
  url: urlJoinParams(url, params),
20
26
  events,
@@ -25,6 +31,35 @@ function createNavigatorFn(fnName) {
25
31
  }
26
32
  }
27
33
 
34
+ /**
35
+ * 页面堆栈10以内使用wx.navigateTo,超过10则使用wx.redirectTo
36
+ * @param url
37
+ * @param param1
38
+ * @returns
39
+ */
40
+ function navigateToFn(url, { events, success, fail, complete}) {
41
+ const pages = getCurrentPages();
42
+ if(pages && pages.length >= 10) {
43
+ wx.redirectTo({
44
+ url,
45
+ success,
46
+ fail,
47
+ complete
48
+ });
49
+ return;
50
+ }
51
+
52
+ wx.navigateTo({
53
+ url,
54
+ // @types/weixin-app@2.9.3没有events的定义,但实际上官方文档有:https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html
55
+ // @ts-ignore
56
+ events,
57
+ success,
58
+ fail,
59
+ complete
60
+ });
61
+ }
62
+
28
63
  const navigateTo = createNavigatorFn('navigateTo')
29
64
  const reLaunch = createNavigatorFn('reLaunch')
30
65
  const redirectTo = createNavigatorFn('redirectTo')
@@ -50,6 +50,9 @@ function createGlboalApi() {
50
50
  _getConfig: function () {
51
51
  return <%= appConfig %>;
52
52
  },
53
+ getWXContext: async function() {
54
+ return {}
55
+ }
53
56
  },
54
57
 
55
58
  // ... other sdk apis & apis from mp
@@ -41,7 +41,8 @@ module.exports = function (options) {
41
41
  {
42
42
  modules: false,
43
43
  targets: {
44
- esmodules: true,
44
+ // esmodules: true,
45
+ browsers: ['defaults', 'iOS >= 10', 'safari >= 10'],
45
46
  },
46
47
  },
47
48
  ],
@@ -220,7 +221,7 @@ module.exports = function (options) {
220
221
  },
221
222
  {
222
223
  test: /\.(js|jsx)$/,
223
- exclude: /node_modules\/(?!(@cloudbase\/weda-ui)|(@tcwd\/vuera))|gsd-kbone-react/,
224
+ exclude: /node_modules\/(?!(@cloudbase\/weda-ui)|(@tcwd\/vuera)|(@tcwd\/weapps-core)|(@tcwd\/weapps-core))|gsd-kbone-react/,
224
225
  use: ['happypack/loader?id=babel'],
225
226
  },
226
227
  {
@@ -303,6 +304,9 @@ module.exports = function (options) {
303
304
  cache: false,
304
305
  parallel: true,
305
306
  sourceMap: false,
307
+ terserOptions: {
308
+ safari10: true,
309
+ },
306
310
  }),
307
311
  ],
308
312
  }),