@cloudbase/framework-plugin-low-code 1.0.3-beta.11 → 1.0.3-beta.12

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 (80) hide show
  1. package/lib/builder/config/common.js +5 -1
  2. package/lib/builder/config/index.js +5 -1
  3. package/lib/builder/config/mp.js +5 -1
  4. package/lib/builder/core/copy.js +5 -1
  5. package/lib/builder/core/material.js +5 -1
  6. package/lib/builder/core/prepare.js +5 -1
  7. package/lib/builder/mp/index.js +5 -1
  8. package/lib/builder/mp/materials.js +5 -1
  9. package/lib/builder/mp/mixMode.js +5 -1
  10. package/lib/builder/mp/mp_config.js +7 -3
  11. package/lib/builder/service/builder/copy.js +5 -1
  12. package/lib/builder/service/builder/generate.js +8 -8
  13. package/lib/builder/service/builder/plugin.js +5 -1
  14. package/lib/builder/util/console.js +5 -1
  15. package/lib/builder/util/generateFiles.js +5 -1
  16. package/lib/builder/util/index.js +5 -1
  17. package/lib/builder/util/mp.js +5 -1
  18. package/lib/builder/util/net.js +5 -1
  19. package/lib/builder/util/process.d.ts +1 -0
  20. package/lib/builder/util/process.d.ts.map +1 -1
  21. package/lib/builder/util/style.js +5 -1
  22. package/lib/builder/util/weapp.js +5 -1
  23. package/lib/generator/config/index.js +5 -1
  24. package/lib/generator/core/generate.js +10 -10
  25. package/lib/generator/core/material.js +5 -1
  26. package/lib/generator/util/index.js +5 -1
  27. package/lib/weapps-core/config/index.js +5 -1
  28. package/lib/weapps-core/index.js +5 -1
  29. package/lib/weapps-core/types/index.js +5 -1
  30. package/lib/weapps-core/utils/file.d.ts +1 -1
  31. package/lib/weapps-core/utils/index.js +5 -1
  32. package/package.json +3 -3
  33. package/template/src/app/common.js +0 -13
  34. package/template/src/app/global-api.js +0 -132
  35. package/template/src/app/handlers.js +0 -13
  36. package/template/src/app/material-actions.js +0 -16
  37. package/template/src/app/mountAppApis.js +0 -25
  38. package/template/src/app/mountMpApis.js +0 -4
  39. package/template/src/datasources/config.js.tpl +0 -27
  40. package/template/src/datasources/dataset-profiles.js.tpl +0 -5
  41. package/template/src/datasources/datasource-profiles.js.tpl +0 -4
  42. package/template/src/datasources/index.js.tpl +0 -27
  43. package/template/src/handlers/FieldMiddleware/renderer.jsx +0 -536
  44. package/template/src/handlers/HotAreas.js +0 -36
  45. package/template/src/handlers/PositionHandler.jsx +0 -8
  46. package/template/src/handlers/actionHandler/utils.js +0 -154
  47. package/template/src/handlers/componentEventActionEmitter.js +0 -29
  48. package/template/src/handlers/componentNodeMap.js +0 -24
  49. package/template/src/handlers/controller.js +0 -5
  50. package/template/src/handlers/emitComponentEvent.js +0 -8
  51. package/template/src/handlers/eventListener/componentEventListener.js +0 -15
  52. package/template/src/handlers/eventListener/hotAreaEventListener.js +0 -32
  53. package/template/src/handlers/eventListener/index.js +0 -29
  54. package/template/src/handlers/eventListener/pageEventListener.js +0 -11
  55. package/template/src/handlers/eventListener/types.js +0 -32
  56. package/template/src/handlers/hooks/index.js +0 -15
  57. package/template/src/handlers/initWebEnv.js +0 -4
  58. package/template/src/handlers/injectStyle.js +0 -14
  59. package/template/src/handlers/instanceMap.js +0 -39
  60. package/template/src/handlers/lifecycle.js +0 -222
  61. package/template/src/handlers/render.jsx +0 -170
  62. package/template/src/handlers/utils/common.js +0 -298
  63. package/template/src/handlers/utils/eventProxy.js +0 -64
  64. package/template/src/handlers/utils/events.js +0 -8
  65. package/template/src/handlers/utils/index.js +0 -4
  66. package/template/src/handlers/utils/widgets.js +0 -307
  67. package/template/src/index.jsx +0 -185
  68. package/template/src/index.less +0 -119
  69. package/template/src/libraries/default-lib/wx_yypt_report_v2.js +0 -441
  70. package/template/src/pages/app.tpl +0 -200
  71. package/template/src/pages/composite.tpl +0 -171
  72. package/template/src/router/index.tpl +0 -29
  73. package/template/src/store/computed.js +0 -11
  74. package/template/src/store/index.js +0 -40
  75. package/template/src/utils/formatEnum.js +0 -42
  76. package/template/src/utils/history.js +0 -66
  77. package/template/src/utils/index.js +0 -82
  78. package/template/src/utils/kbone.js +0 -18
  79. package/template/src/utils/monitor-jssdk.min.js +0 -763
  80. package/template/src/utils/request.js +0 -5
@@ -1,132 +0,0 @@
1
- import * as sdk from '@tcwd/weapps-sdk';
2
- import {
3
- createWebApp,
4
- _ACTIONS_KEY as ACTIONS_KEY,
5
- _ROUTER_KEY as ROUTER_KEY,
6
- } from '@cloudbase/weda-client';
7
- import { createComputed } from 'utils';
8
- import { createDataset } from '../datasources';
9
- import store, { subPackageName } from '../store';
10
- import computed from '../store/computed';
11
- import common from './common';
12
- import { formatEnum, enumOptions } from '../utils/formatEnum';
13
- import { _isMobile } from '../utils';
14
- import actionMap from './material-actions';
15
- import { get as lodashGet } from 'lodash';
16
-
17
- const mainAppKey = '__weappsMainApp';
18
- const appGlobal = process.env.isMiniprogram ? getApp() : window;
19
-
20
- export const app = createGlboalApi();
21
- export const $page = createPageApi();
22
-
23
- function createGlboalApi() {
24
- const webApp = createWebApp({
25
- id: '<%= appId %>',
26
- domain: '<%= domain %>',
27
- appConfig: <%= appConfig %>,
28
- });
29
- const globalAPI = {
30
- id: '<%= appId %>',
31
- domain: '<%= domain %>',
32
- formActions: {},
33
- pages: {},
34
- session: {
35
- // configure: sdk.configure,
36
- // request: sdk.request,
37
- // getSessionId: sdk.getSessionId,
38
- },
39
- state: store,
40
- computed: createComputed(computed.global),
41
- common,
42
- invoke(params) {
43
- return $page.invokeComponentMethod(params);
44
- },
45
- ...webApp,
46
- };
47
-
48
- globalAPI.__internal__.enumOptions = enumOptions;
49
- globalAPI.utils.formatEnum = formatEnum;
50
- globalAPI.utils._getConfig = () => {
51
- console.warn('deprecated app.utils._getConfig');
52
- return globalAPI.__internal__.getConfig();
53
- }
54
-
55
- const dataset = createDataset('$global');
56
- globalAPI.dataset = dataset;
57
- globalAPI.state.dataset = dataset;
58
- globalAPI.setState = (userSetState) => {
59
- Object.keys(userSetState).forEach((keyPath) => {
60
- globalAPI.utils.set(globalAPI.dataset.state, keyPath, userSetState[keyPath]);
61
- });
62
- };
63
- if (subPackageName) {
64
- // is sub app
65
- globalAPI.mainApp = appGlobal[mainAppKey];
66
- } else {
67
- // is mainApp
68
- appGlobal.app = globalAPI;
69
- appGlobal[mainAppKey] = globalAPI;
70
- }
71
-
72
- // 挂运营平台上报对象到app里
73
- globalAPI.yyptReport = appGlobal.yyptReport;
74
-
75
- // # expose some sdk modules
76
- const sdkModsIncluded = ['flow', 'getPageOptions', 'getLaunchOptions'];
77
- sdkModsIncluded.forEach((key) => {
78
- globalAPI[key] = sdk[key];
79
- });
80
- return globalAPI;
81
- }
82
- function createPageApi() {
83
- const $page = {
84
- state: {},
85
- computed: {},
86
- handler: {},
87
- props: {},
88
- widgets: {},
89
- // 页面数据源变量存储位置
90
- dataVar: {},
91
- };
92
- $page.invokeComponentMethod = ({ component, method, params }) => {
93
- const widgetData = lodashGet($page.widgets, component);
94
- if (Array.isArray(widgetData)) {
95
- throw new Error('调用方法失败:id为' + component + '的组件拥有多个实例');
96
- // widgetData.forEach(widget => {
97
- // if(!widget._methods[method]) {
98
- // throw new Error('NOT_FOUND')
99
- // } else {
100
- // actions.push(widget._methods[method])
101
- // }
102
- // })
103
- } else {
104
- if (!widgetData._methods[method] || typeof widgetData._methods[method] != 'function') {
105
- throw new Error('调用方法失败:未找到id为' + component + '下的方法' + method);
106
- }
107
- return widgetData._methods[method](params);
108
- }
109
- };
110
- return $page;
111
- }
112
-
113
- // 分app 和 wx 挂载app
114
- export const mountAPIs = (sdks) => {
115
- Object.keys(sdks).forEach((item) => {
116
- let action = sdks[item];
117
- if(item === 'showModal') {
118
- const OFFICIAL_COMPONENT_LIB = 'gsd-h5-react';
119
- const showModal = actionMap[OFFICIAL_COMPONENT_LIB]?.showModal;
120
- if (!_isMobile() && showModal) {
121
- action = function (params) {
122
- return showModal({ data: params });
123
- };
124
- }
125
- app[item] = action;
126
- }
127
- else if (!(item in ACTIONS_KEY) && !(item in ROUTER_KEY)) {
128
- app[item] = action;
129
- }
130
- });
131
- return app;
132
- };
@@ -1,13 +0,0 @@
1
- <%for(const pageId in pageModules) {
2
- pageModules[pageId].filter(mod => mod.type === 'handler-fn' && mod.name !== '____index____').forEach(mod => {%>
3
- import <%= pageId%>_<%= mod.name%> from '../lowcode/<%= pageId%>/handler/<%= mod.name%>'<%
4
- })
5
- }%>
6
-
7
- <% for(const pageId in pageModules) {%>
8
- export const $$_<%=pageId %> = {<%
9
- pageModules[pageId].filter(mod => mod.type === 'handler-fn' && mod.name !== '____index____').forEach(mod => {%>
10
- ['<%= mod.name%>']: <%= pageId%>_<%= mod.name%>,<%
11
- }) %>
12
- }
13
- <%}%>
@@ -1,16 +0,0 @@
1
- // Imports all material actions
2
- <% materials.map((material,index) => { if(material.entries && material.entries.actions){ %>
3
- import * as <%= _.camelCase(material.name)%>Actions_<%= index%> from 'libraries/<%=material.name%>@<%= material.version %>/<%=material.entries.actions%>';
4
- <% } else if(material.entries && material.entries.entry) {%>
5
- import <%= _.camelCase(material.name)%>_<%= index%> from 'libraries/<%=material.name%>@<%= material.version %>/<%=material.entries.entry%>';
6
- const <%= _.camelCase(material.name)%>Actions_<%= index%> = <%= _.camelCase(material.name)%>_<%= index%>.actions
7
- <% } else { (material.actions || []).map(act => {%>
8
- import <%= _.camelCase(material.name)%>_<%=act.name%> from 'libraries/<%=material.name%>@<%= material.version %>/actions/<%= act.name %>'
9
- <% }) }}) %>
10
- export default {
11
- <% materials.map((material, index) => {
12
- %> ['<%= material.name%>']:<% if(material.entries && (material.entries.entry || material.entries.actions)){ %> <%=_.camelCase(material.name)%>Actions_<%= index%>,
13
- <% }else{ %> {<% (material.actions || []).map(act => { %>
14
- ['<%= act.name%>']: <%= _.camelCase(material.name)%>_<%=act.name%>,<%})%>
15
- },
16
- <%}}) %>}
@@ -1,25 +0,0 @@
1
- import { mountAPIs } from './global-api';
2
- import sdk from '@tcwd/weapps-sdk/lib/app-h5-sdk';
3
-
4
- mountAPIs(sdk);
5
-
6
- /**
7
- * 适配 wx.navigateTo 用法
8
- */
9
- function navigateTo({ url }) {
10
- let paths = url.split('?');
11
- let result = /pages\/([0-9a-zA-z_]+)\/index/.exec(paths[0]);
12
- let hash = '';
13
- if (result.length > 1) {
14
- hash = `/${result[0]}`;
15
- }
16
- let path = `/${hash}`;
17
- location.hash = `${path}${paths[1] ? `?${paths[1]}` : ''}`;
18
- }
19
- if (process.env.isApp) {
20
- window.wx = {
21
- ...(window.wx || {}),
22
- ...sdk,
23
- navigateTo,
24
- };
25
- }
@@ -1,4 +0,0 @@
1
- import { mountAPIs } from './global-api'
2
- import sdk from 'libraries/compatible-sdk/wx-sdk'
3
-
4
- mountAPIs(sdk)
@@ -1,27 +0,0 @@
1
- import dataSourceProfiles from './datasource-profiles'
2
- import datasetProfiles from './dataset-profiles'
3
-
4
- /**
5
- * 数据源基本配置
6
- */
7
- export default {
8
- /** 当前是否处于正式发布模式 */
9
- isProd: <%= isProd %>,
10
- /** 低码应用ID */
11
- appID: '<%= appID %>',
12
- /** 云开发环境ID */
13
- envID: '<%= envID %>',
14
- /** 应用端ID */
15
- tcbClientId: '<%= clientID %>',
16
- /** 数据源描述对象数组 */
17
- dataSourceProfiles: dataSourceProfiles,
18
- /**
19
- * 新的dataset变量配置对象
20
- * key 为页面ID(全局为$global), val 为变量配置数组
21
- */
22
- datasetProfiles: datasetProfiles,
23
- /**
24
- * 是否开启私有化
25
- */
26
- isPrivate: window._isPrivate || false
27
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * 全局及页面的数据源变量定义文件
3
- */
4
-
5
- export default <%= datasetProfiles %>
@@ -1,4 +0,0 @@
1
- /**
2
- * 数据源摘要描述数组
3
- */
4
- export default <%= datasourceProfiles %>
@@ -1,27 +0,0 @@
1
- import { _WEDA_CLOUD_SDK as WEDA_CLOUD_SDK } from '@cloudbase/weda-client'
2
- import config from './config';
3
-
4
- const {
5
- setConfig,
6
- initTcb,
7
- createDataset,
8
- createStateDataSourceVar,
9
- generateParamsParser,
10
- EXTRA_API,
11
- CLOUD_SDK,
12
- DS_SDK
13
- } = WEDA_CLOUD_SDK
14
-
15
- export {
16
- createDataset,
17
- createStateDataSourceVar,
18
- generateParamsParser,
19
- EXTRA_API,
20
- CLOUD_SDK,
21
- DS_SDK,
22
- }
23
-
24
- setConfig(config);
25
- <% if(!isXPage){ %>
26
- initTcb();
27
- <%}%>