@cloudbase/lowcode-builder 1.8.9 → 1.8.11

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 (36) hide show
  1. package/lib/builder/config/index.d.ts +2 -2
  2. package/lib/builder/config/index.js +2 -2
  3. package/lib/builder/core/index.d.ts +1 -1
  4. package/lib/builder/core/index.js +24 -20
  5. package/lib/builder/h5/generate.d.ts +7 -1
  6. package/lib/builder/h5/generate.js +16 -8
  7. package/lib/builder/h5/webpack.js +3 -1
  8. package/lib/builder/mp/BuildContext.d.ts +4 -0
  9. package/lib/builder/mp/index.js +4 -3
  10. package/lib/builder/mp/materials.js +1 -0
  11. package/lib/builder/mp/wxml.js +10 -0
  12. package/lib/builder/util/generateFiles.d.ts +1 -1
  13. package/lib/builder/util/generateFiles.js +13 -8
  14. package/package.json +3 -3
  15. package/template/html/index.html.ejs +5 -3
  16. package/template/mp/common/{event-emitter.ts → event-emitter.js} +25 -21
  17. package/template/mp/common/{flow.ts → flow.js} +11 -50
  18. package/template/mp/common/loading/index.js +30 -0
  19. package/template/mp/common/loading/index.json +4 -0
  20. package/template/mp/common/loading/index.wxml +8 -0
  21. package/template/mp/common/loading/index.wxss +44 -0
  22. package/template/mp/common/{query.ts → query.js} +21 -85
  23. package/template/mp/common/util.js +17 -9
  24. package/template/mp/common/weapp-page.js +20 -9
  25. package/dist/builder.web.js +0 -71
  26. package/lib/.turbo/turbo-build.log +0 -0
  27. package/lib/.turbo/turbo-develop.log +0 -0
  28. package/lib/builder.web.js +0 -71
  29. package/lib/event-emitter.d.ts +0 -32
  30. package/lib/event-emitter.js +0 -88
  31. package/lib/flow.d.ts +0 -32
  32. package/lib/flow.js +0 -60
  33. package/lib/query.d.ts +0 -48
  34. package/lib/query.js +0 -171
  35. package/lib/test.d.ts +0 -11
  36. package/lib/test.js +0 -717
@@ -6,12 +6,12 @@ export declare const materialsDirName = "materials";
6
6
  * src/template的代码,在IDE编辑器插件中构建builder
7
7
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
8
8
  */
9
- export declare const builderTemplateURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/template_20230213.zip";
9
+ export declare const builderTemplateURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/template_20230606.zip";
10
10
  /**
11
11
  * miniprogram的代码,IDE插件后续会提供端功能
12
12
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
13
13
  */
14
- export declare const miniprogramURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm_20230213.zip";
14
+ export declare const miniprogramURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm_20230606.zip";
15
15
  /**
16
16
  * miniprogram_npm存放目录。IDE插件builder用到
17
17
  */
@@ -45,12 +45,12 @@ exports.materialsDirName = 'materials'; // materials diretory of current project
45
45
  * src/template的代码,在IDE编辑器插件中构建builder
46
46
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
47
47
  */
48
- exports.builderTemplateURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/template_20230213.zip';
48
+ exports.builderTemplateURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/template_20230606.zip';
49
49
  /**
50
50
  * miniprogram的代码,IDE插件后续会提供端功能
51
51
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
52
52
  */
53
- exports.miniprogramURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm_20230213.zip';
53
+ exports.miniprogramURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm_20230606.zip';
54
54
  /**
55
55
  * miniprogram_npm存放目录。IDE插件builder用到
56
56
  */
@@ -48,7 +48,7 @@ export declare function buildWedaConfig({ output, domain, isPrivateMode, endpoin
48
48
  endpointType?: IBuildWedaApp['endpointType'];
49
49
  buildTypeList?: IBuildWedaApp['buildTypeList'];
50
50
  }): Promise<void>;
51
- export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<string | undefined>;
51
+ export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
52
52
  export declare function cleanComponentDir(): Promise<void>;
53
53
  export declare const version: any;
54
54
  export { getFiles, fileToZip, strToBuf } from '../util/generateFiles';
@@ -12,7 +12,6 @@ const common_1 = require("../types/common");
12
12
  const index_1 = require("../mp/index");
13
13
  const types_1 = require("../../types");
14
14
  const mixMode_1 = require("../mp/mixMode");
15
- const index_2 = require("../h5/index");
16
15
  const common_2 = require("../../utils/common");
17
16
  const postProcess_1 = require("../../utils/postProcess");
18
17
  const cals_1 = require("@cloudbase/cals");
@@ -62,7 +61,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
62
61
  isComposite: false,
63
62
  compProps: {},
64
63
  }, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, }, cb) {
65
- var _a, _b;
64
+ var _a, _b, _c;
66
65
  if (!cals) {
67
66
  console.error('无效的应用配置');
68
67
  return;
@@ -138,6 +137,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
138
137
  ? 'px'
139
138
  : 'rpx'),
140
139
  enablePageRoot,
140
+ enableLoading: (_c = cals === null || cals === void 0 ? void 0 : cals.extra) === null || _c === void 0 ? void 0 : _c.enableLoading,
141
141
  };
142
142
  const result = await (0, index_1.generateWxMp)({
143
143
  weapps: apps,
@@ -185,24 +185,28 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
185
185
  return outDir;
186
186
  }
187
187
  else {
188
- const h5BuildDir = await (0, index_2.buildH5App)({
189
- buildContext: { ...buildContext, isMixMode: false },
190
- cals,
191
- subAppCalsList,
192
- extraData,
193
- buildTypeList,
194
- mode,
195
- devTool,
196
- runtime,
197
- deployOptions,
198
- ignoreInstall,
199
- cdnEndpoints,
200
- });
201
- await (cb === null || cb === void 0 ? void 0 : cb(null, {
202
- outDir: h5BuildDir,
203
- timeElapsed: Date.now() - startTime,
204
- }));
205
- return h5BuildDir;
188
+ // web worker build 构建时注入, H5构建目前不支持web worker,web worker build时过滤掉
189
+ if (!process.env.IS_WEB_WORKER) {
190
+ const { buildH5App } = require('../h5/index');
191
+ const h5BuildDir = await buildH5App({
192
+ buildContext: { ...buildContext, isMixMode: false },
193
+ cals,
194
+ subAppCalsList,
195
+ extraData,
196
+ buildTypeList,
197
+ mode,
198
+ devTool,
199
+ runtime,
200
+ deployOptions,
201
+ ignoreInstall,
202
+ cdnEndpoints,
203
+ });
204
+ await (cb === null || cb === void 0 ? void 0 : cb(null, {
205
+ outDir: h5BuildDir,
206
+ timeElapsed: Date.now() - startTime,
207
+ }));
208
+ return h5BuildDir;
209
+ }
206
210
  }
207
211
  }
208
212
  catch (err) {
@@ -6,7 +6,12 @@ import { BuildType } from '../types/common';
6
6
  * 该函数从 @govcloud/generate 取到需要的模版文件
7
7
  */
8
8
  export declare function generateProjectFiles(buildData: BuildAppProps): Promise<void>;
9
- export declare function generateHTML({ appId, envId, description, appBuildDir, externalResources, mode, devTool, isBuildApp, buildTypeList, cdnEndpoints, }: {
9
+ export declare function generateHTML({ appId, envId, description, appBuildDir, externalResources, mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
10
+ /**
11
+ * 由于存量兜底逻辑存在
12
+ * 默认值为 undefined 否则应为 false
13
+ */
14
+ enableLoading, }: {
10
15
  appId: string;
11
16
  envId: string;
12
17
  description?: string;
@@ -17,6 +22,7 @@ export declare function generateHTML({ appId, envId, description, appBuildDir, e
17
22
  isBuildApp: boolean;
18
23
  buildTypeList: BuildType[];
19
24
  cdnEndpoints?: ICDN_ENDPOINTS_COFIG;
25
+ enableLoading?: boolean;
20
26
  }): Promise<void>;
21
27
  export declare function handleAssets({ appBuildDir, buildTypeList, assets, }: {
22
28
  appBuildDir: string;
@@ -25,7 +25,12 @@ async function generateProjectFiles(buildData) {
25
25
  }));
26
26
  }
27
27
  exports.generateProjectFiles = generateProjectFiles;
28
- async function generateHTML({ appId, envId, description = '', appBuildDir, externalResources = [], mode, devTool, isBuildApp, buildTypeList, cdnEndpoints, }) {
28
+ async function generateHTML({ appId, envId, description = '', appBuildDir, externalResources = [], mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
29
+ /**
30
+ * 由于存量兜底逻辑存在
31
+ * 默认值为 undefined 否则应为 false
32
+ */
33
+ enableLoading = undefined, }) {
29
34
  const templatePath = path_1.default.join(config_1.appTemplateDir, 'html', 'index.html.ejs');
30
35
  const dstFilePath = path_1.default.join(appBuildDir, 'index.html');
31
36
  const packageTpl = await fs_extra_1.default.readFile(templatePath, { encoding: 'utf8' });
@@ -56,14 +61,17 @@ async function generateHTML({ appId, envId, description = '', appBuildDir, exter
56
61
  cdnEndpoints: (0, config_1.generateCdnEndpoints)(cdnEndpoints),
57
62
  /**
58
63
  * @deprecated
59
- * 临时先这么添加白名单
64
+ * 此次临时保留白名单兜底逻辑
65
+ * 当应用数据补充完成后可以祛除
60
66
  */
61
- enableStaticLoading: [
62
- 'lowcode-4gzdsu5k66946492',
63
- 'lowcode-2gay8jgh25c7b1cf',
64
- 'lowcode-4g9b78bx94404d85',
65
- 'lowcode-8gmx7bat3135e2de',
66
- ].includes(envId) && !(0, common_2.buildAsAdminPortalByBuildType)(buildTypeList),
67
+ enableLoading: !(0, common_2.buildAsAdminPortalByBuildType)(buildTypeList) && enableLoading === undefined
68
+ ? [
69
+ 'lowcode-4gzdsu5k66946492',
70
+ 'lowcode-2gay8jgh25c7b1cf',
71
+ 'lowcode-4g9b78bx94404d85',
72
+ 'lowcode-8gmx7bat3135e2de',
73
+ ].includes(envId)
74
+ : enableLoading,
67
75
  }));
68
76
  }
69
77
  exports.generateHTML = generateHTML;
@@ -6,6 +6,7 @@ const webpack_1 = require("../service/webpack");
6
6
  const generate_1 = require("./generate");
7
7
  const cals_1 = require("@cloudbase/cals");
8
8
  async function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir, publicPath, mode = common_1.WebpackModeType.NONE, appKey, buildTypeList = [common_1.BuildType.WEB], mpConfig, assets = [], devTool = 'vite', generateMpType = common_1.GenerateMpType.APP, cdnEndpoints, }) {
9
+ var _a;
9
10
  console.time('runWebpackCore');
10
11
  console.time('webpackGenerate');
11
12
  const allAppDataList = subAppDataList.concat(mainAppData);
@@ -29,7 +30,8 @@ async function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir,
29
30
  await (0, generate_1.generateHTML)({
30
31
  appId: mainAppData.id || appKey,
31
32
  envId: mainAppData.envId || '',
32
- description: cals.description || '',
33
+ description: cals.description /* || cals.label */ || '',
34
+ enableLoading: (_a = cals.extra) === null || _a === void 0 ? void 0 : _a.enableLoading,
33
35
  appBuildDir,
34
36
  externalResources: (cals.externalResources || []).concat(assets.map((url) => ({
35
37
  type: cals_1.EExternalResourceType.CSSUrl,
@@ -31,6 +31,10 @@ export interface IBuildContext {
31
31
  * 并设置 #page-root-id
32
32
  */
33
33
  enablePageRoot?: boolean;
34
+ /**
35
+ * 是否使用默认加载
36
+ */
37
+ enableLoading?: boolean;
34
38
  /**
35
39
  * 应用版本
36
40
  */
@@ -118,13 +118,14 @@ async function generateWxMp({ buildContext, weapps, plugins, deployOptions, opti
118
118
  debug: buildContext.debugMode,
119
119
  },
120
120
  'common/data-patch.js': {},
121
- 'common/event-emitter.ts': {},
121
+ 'common/event-emitter.js': {},
122
122
  'common/watch.js': {},
123
123
  'common/constant.js': {
124
124
  REPEATER: JSON.stringify(config_1.REPEATER, undefined, 2),
125
125
  },
126
- 'common/query.ts': {},
127
- 'common/flow.ts': {},
126
+ 'common/query.js': {},
127
+ 'common/flow.js': {},
128
+ 'common/loading': {},
128
129
  /**
129
130
  * 调试用
130
131
  */
@@ -238,6 +238,7 @@ async function generateCompositeComponent(ctx, compositedComp, compLibCommonReso
238
238
  const compositeCtx = {
239
239
  ...ctx,
240
240
  isPage: false,
241
+ enableLoading: false,
241
242
  };
242
243
  const { materialName } = compositedComp;
243
244
  const outDir = path.join(compositeCtx.projDir, compositeCtx.rootPath || '', // 混合模式下,可能会有 rootPath
@@ -66,6 +66,16 @@ function generateWxml(ctx, widgets, docTag, wxmlDataPrefix, usingComponents, com
66
66
  _parent: null,
67
67
  },
68
68
  ];
69
+ if (ctx.enableLoading) {
70
+ usingComponents['wd-loading'] = '/common/loading/index';
71
+ xmlJson.elements.push({
72
+ type: 'element',
73
+ name: 'wd-loading',
74
+ attributes: {
75
+ ['wx:if']: '{{_isCheckingAtuh}}',
76
+ },
77
+ });
78
+ }
69
79
  }
70
80
  function createXml(widgets, parent = null, parentForNodes = []) {
71
81
  var _a, _b, _c, _d, _e, _f;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { OutputType } from 'jszip';
3
3
  export declare const generatedFileContents: {};
4
- export default function generateFiles(appFileData: any, srcDir: string, dstDir: string): Promise<string[]>;
4
+ export default function generateFiles(appFileData: any, srcDir: string, dstDir: string): Promise<void>;
5
5
  export declare function writeFile(outFile: string, content: string): Promise<boolean>;
6
6
  export declare function removeFile(file: string): void;
7
7
  /**
@@ -42,16 +42,21 @@ async function generateFiles(appFileData, srcDir, dstDir) {
42
42
  const fileNameList = file.split('|');
43
43
  const srcFileName = fileNameList[0];
44
44
  const outFileName = fileNameList[1] || fileNameList[0];
45
- const tplStr = await fs_extra_1.default.readFile(path_1.default.join(srcDir, srcFileName), {
46
- encoding: 'utf8',
47
- });
48
- let generatedCode = (0, lodash_1.template)(tplStr, { interpolate: /<%=([\s\S]+?)%>/ })(appFileData[file]);
49
- const outFile = path_1.default.resolve(dstDir, outFileName.replace(/\.tpl$/, ''));
50
- if (await writeFile(outFile, generatedCode)) {
51
- filesGenerated.push(outFileName);
45
+ const srcePath = path_1.default.join(srcDir, srcFileName);
46
+ if (fs_extra_1.default.lstatSync(srcePath).isDirectory()) {
47
+ (0, exports.copyRecursiveSync)(srcePath, path_1.default.join(dstDir, outFileName));
48
+ }
49
+ else {
50
+ const tplStr = await fs_extra_1.default.readFile(path_1.default.join(srcDir, srcFileName), {
51
+ encoding: 'utf8',
52
+ });
53
+ let generatedCode = (0, lodash_1.template)(tplStr, { interpolate: /<%=([\s\S]+?)%>/ })(appFileData[file]);
54
+ const outFile = path_1.default.resolve(dstDir, outFileName.replace(/\.tpl$/, ''));
55
+ if (await writeFile(outFile, generatedCode)) {
56
+ filesGenerated.push(outFileName);
57
+ }
52
58
  }
53
59
  }
54
- return filesGenerated;
55
60
  }
56
61
  exports.default = generateFiles;
57
62
  async function writeFile(outFile, content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.8.9",
3
+ "version": "1.8.11",
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",
@@ -38,8 +38,8 @@
38
38
  "url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
39
39
  },
40
40
  "dependencies": {
41
- "@cloudbase/cals": "^1.0.9-alpha.0",
42
- "@cloudbase/lowcode-generator": "^1.8.0",
41
+ "@cloudbase/cals": "^1.0.9",
42
+ "@cloudbase/lowcode-generator": "^1.8.3",
43
43
  "axios": "^0.21.0",
44
44
  "browserfs": "^1.4.3",
45
45
  "browserify-zlib": "^0.2.0",
@@ -9,7 +9,9 @@
9
9
  content="width=device-width,initial-scale=1.0,user-scalable=no<% if(!isBuildApp) {%>,viewport-fit=cover<%}%>"
10
10
  />
11
11
  <meta name="format-detection" content="telephone=no" />
12
- <!-- <meta name="description" content="<%= desc %>" /> -->
12
+ <% if(desc){ %>
13
+ <meta name="description" content="<%= desc %>" />
14
+ <% } %>
13
15
  <link
14
16
  rel="stylesheet"
15
17
  href="<%=
@@ -389,7 +391,7 @@
389
391
 
390
392
  <body data-weui-theme="light">
391
393
  <div id="root" class="main-wrap">
392
- <% if(enableStaticLoading){ %>
394
+ <% if(enableLoading){ %>
393
395
  <style type="text/css">
394
396
  .weda-loading-container {
395
397
  position: fixed;
@@ -549,7 +551,7 @@
549
551
  crossorigin
550
552
  src="<%=
551
553
  cdnEndpoints.cdngo
552
- %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.babe263dcf07a0b2f76e.bundle.js"
554
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.4e08e64803c057479d66.bundle.js"
553
555
  ></script>
554
556
  </body>
555
557
  </html>
@@ -43,37 +43,41 @@ export default class EventEmitter {
43
43
  }
44
44
  }
45
45
 
46
+ // interface IEventProps {
47
+ // type: string;
48
+ // currentTarget: any;
49
+ // target?: any;
50
+ // detail?: any;
51
+ // _isCapturePhase?: boolean;
52
+ // origin?: Event;
53
+ // }
54
+
46
55
  export class Event {
47
- type: string;
48
- detail: any;
56
+ type /* : string*/;
57
+ detail /* : any*/;
49
58
  /**
50
59
  * 类别应当为 typeof UserWidget
51
60
  * 当前类别为 typeof $page.widgets.xxxx
52
61
  * 添加上报确定用量
53
62
  */
54
- currentTarget: any /* typeof UserWidget */;
55
- target?: any /* typeof UserWidget */;
63
+ currentTarget /* : any */ /* typeof UserWidget */;
64
+ target /* ?: any */ /* typeof UserWidget */;
56
65
  /**
57
66
  * 内部实现
58
67
  * 外部不应该进行访问
59
68
  */
60
- _isCapturePhase: boolean;
61
- origin: Event;
62
- constructor({
63
- type = '',
64
- detail = undefined,
65
- currentTarget = undefined,
66
- target = undefined,
67
- _isCapturePhase = false,
68
- origin,
69
- }: {
70
- type: string;
71
- currentTarget: any;
72
- target?: any;
73
- detail?: any;
74
- _isCapturePhase?: boolean;
75
- origin?: Event;
76
- }) {
69
+ _isCapturePhase; /* : boolean; */
70
+ origin /* : Event */;
71
+ constructor(
72
+ {
73
+ type = '',
74
+ detail = undefined,
75
+ currentTarget = undefined,
76
+ target = undefined,
77
+ _isCapturePhase = false,
78
+ origin,
79
+ } /* : IEventProps*/,
80
+ ) {
77
81
  function proxyWrapper(target, key) {
78
82
  try {
79
83
  return new Proxy(target, {
@@ -1,50 +1,19 @@
1
1
  import { createEventHandlers, getMpEventHandlerName } from './util';
2
2
  import { Event } from './event-emitter';
3
- type IGenerateContext = any;
4
-
5
- export interface IEventFlowContext extends IGenerateContext {
6
- $page?: any;
7
- $app?: any;
8
- target?: any; // widget
9
- }
10
-
11
- interface IMPEventFlowGenerateOptions {
12
- looseError?: boolean;
13
- isComposite?: boolean;
14
- }
15
-
16
3
  export class EventFlow {
17
- id: string;
18
- description: string;
19
- private _eventHandlerMap: Record<string, Function> = {};
20
- private _context: IEventFlowContext;
21
-
22
- constructor({
23
- schema,
24
- context,
25
- options,
26
- }: {
27
- schema: {
28
- id?: string;
29
- description?: string;
30
- /**
31
- * 预处理后 event handler listeners
32
- */
33
- eventHandlers?: Record<string, any>;
34
- };
35
- context: IEventFlowContext;
36
- options?: IMPEventFlowGenerateOptions;
37
- }) {
4
+ constructor({ schema, context, options }) {
5
+ this._eventHandlerMap = {};
38
6
  this._context = context;
39
7
  const { id, description, eventHandlers = {} } = schema || {};
40
8
  this.id = id || '';
41
9
  this.description = description || '';
42
-
43
- this._eventHandlerMap = Object.entries(createEventHandlers(eventHandlers, {
44
- looseError: true,
45
- isComposite: options?.isComposite || false,
46
- syncCall: true
47
- })).reduce(
10
+ this._eventHandlerMap = Object.entries(
11
+ createEventHandlers(eventHandlers, {
12
+ looseError: true,
13
+ isComposite: options?.isComposite || false,
14
+ syncCall: true,
15
+ }),
16
+ ).reduce(
48
17
  (map, [key, fn]) => {
49
18
  map[key] = fn;
50
19
  return map;
@@ -53,11 +22,9 @@ export class EventFlow {
53
22
  _getInstance: () => this._context.$page || this._context.$app,
54
23
  },
55
24
  );
56
-
57
25
  return this;
58
26
  }
59
-
60
- trigger(additionalScope, options: Partial<IEventFlowContext> = {}) {
27
+ trigger(additionalScope, options = {}) {
61
28
  const mergedContext = {
62
29
  ...this._context,
63
30
  ...options,
@@ -87,14 +54,8 @@ export class EventFlow {
87
54
  // return emit(`${this.id}.start`, additionalScope);
88
55
  }
89
56
  }
90
-
91
- export function generateEventFlows(
92
- flows: { id: string }[] = [],
93
- context: IEventFlowContext,
94
- options?: IMPEventFlowGenerateOptions,
95
- ) {
57
+ export function generateEventFlows(flows = [], context, options) {
96
58
  const result = {};
97
-
98
59
  for (let flow of flows) {
99
60
  result[flow.id] = new EventFlow({ schema: flow, context, options });
100
61
  }
@@ -0,0 +1,30 @@
1
+ Component({
2
+ /**
3
+ * 组件的属性列表
4
+ */
5
+ properties: {
6
+ message: String
7
+ },
8
+
9
+ /**
10
+ * 组件的初始数据
11
+ */
12
+ data: {
13
+ message: '',
14
+ visible: false
15
+ },
16
+
17
+ /**
18
+ * 组件的方法列表
19
+ */
20
+ methods: {
21
+
22
+ },
23
+ lifetimes: {
24
+ attached() {
25
+ setTimeout(() => {
26
+ this.setData({ visible: true, message: '登录鉴权中...' })
27
+ }, 100)
28
+ },
29
+ },
30
+ })
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,8 @@
1
+ <view id="loading" class="weda-loading-container" wx:if="{{visible}}">
2
+ <view class="logo">
3
+ <view class="sp sp-circle"></view>
4
+ </view>
5
+ <view class="text" id="message">
6
+ {{message}}
7
+ </view>
8
+ </view>
@@ -0,0 +1,44 @@
1
+ .weda-loading-container {
2
+ position: fixed;
3
+ left:0;
4
+ top:0;
5
+ width: 100%;
6
+ display: flex;
7
+ justify-content: center;
8
+ align-items: center;
9
+ flex-direction: column;
10
+ height:100%;
11
+ padding: 0 20px;
12
+ }
13
+ .weda-loading-container .logo {
14
+ width: 100%;
15
+ display: flex;
16
+ justify-content: center;
17
+ text-align: center;
18
+ margin-bottom: 50rpx;
19
+ }
20
+
21
+ .weda-loading-container .text {
22
+ font-size: 14px;
23
+ }
24
+
25
+ .weda-loading-container .sp{
26
+ width: 48px;
27
+ height:48px;
28
+ }
29
+
30
+ .weda-loading-container .sp-circle {
31
+ border: 6px rgba(0,82,217,0.25) solid;
32
+ border-top: 6px rgba(0,82,217,1) solid;
33
+ border-radius: 50%;
34
+ -webkit-animation: spCircRot .6s infinite linear;
35
+ animation: spCircRot .6s infinite linear;
36
+ }
37
+ @-webkit-keyframes spCircRot {
38
+ from { -webkit-transform: rotate(0deg); }
39
+ to { -webkit-transform: rotate(359deg); }
40
+ }
41
+ @keyframes spCircRot {
42
+ from { transform: rotate(0deg); }
43
+ to { transform: rotate(359deg); }
44
+ }