@cloudbase/framework-plugin-low-code 0.6.30 → 0.6.33

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 (82) hide show
  1. package/lib/builder/config/index.js +2 -5
  2. package/lib/builder/core/copy.d.ts.map +1 -1
  3. package/lib/builder/mp/materials.d.ts.map +1 -1
  4. package/lib/builder/mp/materials.js +21 -5
  5. package/package.json +5 -3
  6. package/template/src/handlers/FieldMiddleware/renderer.jsx +11 -6
  7. package/template/src/handlers/actionHandler/utils.js +41 -17
  8. package/template/webpack/web.prod.js +65 -85
  9. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/cookie.js +0 -286
  10. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/history.js +0 -133
  11. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/local-storage.js +0 -103
  12. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/location.js +0 -588
  13. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/miniprogram.js +0 -101
  14. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/navigator.js +0 -80
  15. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/performance.js +0 -28
  16. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/screen.js +0 -31
  17. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/session-storage.js +0 -96
  18. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/xml-http-request.js +0 -290
  19. package/template/dist/mp/miniprogram_npm/miniprogram-render/document.js +0 -396
  20. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/custom-event.js +0 -12
  21. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/event-target.js +0 -389
  22. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/event.js +0 -186
  23. package/template/dist/mp/miniprogram_npm/miniprogram-render/index.js +0 -41
  24. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/attribute.js +0 -226
  25. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/class-list.js +0 -153
  26. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/comment.js +0 -80
  27. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/a.js +0 -165
  28. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/canvas.js +0 -138
  29. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/image.js +0 -177
  30. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/input.js +0 -181
  31. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/not-support.js +0 -60
  32. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/option.js +0 -126
  33. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/select.js +0 -155
  34. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/textarea.js +0 -178
  35. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/video.js +0 -165
  36. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-component.js +0 -84
  37. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-custom-component.js +0 -64
  38. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element.js +0 -970
  39. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/node.js +0 -140
  40. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/style-list.js +0 -28
  41. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/style.js +0 -158
  42. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/text-node.js +0 -127
  43. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/parser.js +0 -269
  44. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/query-selector.js +0 -420
  45. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/tree.js +0 -130
  46. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/cache.js +0 -95
  47. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/pool.js +0 -24
  48. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/tool.js +0 -131
  49. package/template/dist/mp/miniprogram_npm/miniprogram-render/window.js +0 -651
  50. package/template/generator/app/common.js +0 -17
  51. package/template/generator/app/global-api.js +0 -163
  52. package/template/generator/app/handlers.js +0 -13
  53. package/template/generator/datasources/config.js.tpl +0 -21
  54. package/template/generator/datasources/dataset-profiles.js.tpl +0 -5
  55. package/template/generator/datasources/datasource-profiles.js.tpl +0 -4
  56. package/template/generator/datasources/index.js.tpl +0 -14
  57. package/template/generator/handlers/NodeRenderer.jsx +0 -471
  58. package/template/generator/handlers/RenderWrapper.jsx +0 -145
  59. package/template/generator/index.jsx +0 -116
  60. package/template/generator/index.less +0 -120
  61. package/template/generator/pages/app.tpl +0 -181
  62. package/template/generator/pages/composite.tpl +0 -267
  63. package/template/generator/router/index.tpl +0 -49
  64. package/template/generator/store/computed.js +0 -11
  65. package/template/generator/store/index.js +0 -5
  66. package/template/generator/utils/ScanCodeComponent.js +0 -345
  67. package/template/generator/utils/actionHandler.js +0 -119
  68. package/template/generator/utils/common.js +0 -225
  69. package/template/generator/utils/computed.js +0 -9
  70. package/template/generator/utils/date.js +0 -324
  71. package/template/generator/utils/error.jsx +0 -14
  72. package/template/generator/utils/eventProxy.js +0 -64
  73. package/template/generator/utils/history.js +0 -35
  74. package/template/generator/utils/hooks.js +0 -10
  75. package/template/generator/utils/index.js +0 -41
  76. package/template/generator/utils/initGlobalVar.js +0 -14
  77. package/template/generator/utils/lifecycle.js +0 -158
  78. package/template/generator/utils/monitor-jssdk.min.js +0 -881
  79. package/template/generator/utils/page.js +0 -10
  80. package/template/generator/utils/scan-code-action.js +0 -27
  81. package/template/generator/utils/style.js +0 -81
  82. package/template/generator/utils/widgets.js +0 -343
@@ -1,64 +0,0 @@
1
- /**
2
- * @author elliothu@tencent.com
3
- * @date 2019-05-07
4
- * @desc 事件系统,用于全局通信
5
- */
6
-
7
- export class EventProxy {
8
- proxies = {};
9
-
10
- onceProxies = {};
11
-
12
- on = (eventName, handler) => {
13
- if (this.proxies[eventName]) {
14
- return this.proxies[eventName].push(handler);
15
- }
16
- this.proxies[eventName] = [handler];
17
- };
18
-
19
- only = (eventName, handler) => {
20
- this.proxies[eventName] = [handler];
21
- };
22
-
23
- once = (eventName, handler) => {
24
- if (this.onceProxies[eventName]) {
25
- return this.onceProxies[eventName].push(handler);
26
- }
27
- this.onceProxies[eventName] = [handler];
28
- };
29
-
30
- emit = (eventName, ...args) => {
31
- if (this.proxies[eventName]) {
32
- this.proxies[eventName].forEach(handler => handler(...args));
33
- }
34
- if (this.onceProxies[eventName]) {
35
- this.onceProxies[eventName].forEach(handler => handler(...args));
36
- this.onceProxies[eventName] = [];
37
- }
38
- };
39
-
40
- cancel = (eventName, handler) => {
41
- if (!this.proxies[eventName]) { return; }
42
- this.proxies[eventName] = this.proxies[eventName].filter(h => h !== handler);
43
- };
44
-
45
- cancelOnce = (eventName, handler) => {
46
- if (!this.onceProxies[eventName]) { return; }
47
- this.onceProxies[eventName] = this.onceProxies[eventName].filter(h => h !== handler);
48
- };
49
-
50
- cancelAll = eventName => {
51
- if (!this.proxies[eventName]) { return; }
52
- this.proxies[eventName] = [];
53
- };
54
-
55
- cancelAllOnce = eventName => {
56
- if (!this.onceProxies[eventName]) { return; }
57
- this.onceProxies[eventName] = [];
58
- };
59
-
60
- clear = () => {
61
- this.proxies = {};
62
- this.onceProxies = {};
63
- };
64
- }
@@ -1,35 +0,0 @@
1
- import { createHashHistory, createBrowserHistory } from 'history';
2
-
3
- const createHistory = (options, isHash = false) => {
4
- if (process.env.isApp || process.env.isAdminPortal || isHash) {
5
- return createHashHistory({
6
- basename: '', // The base URL of the app (see below)
7
- ...options,
8
- });
9
- }
10
- return createBrowserHistory(options);
11
- };
12
-
13
- let history = createHistory(
14
- {
15
- basename: '', // The base URL of the app (see below)
16
- // forceRefresh: false, // Set true to force full page refreshes
17
- // keyLength: 6, // The length of location.key
18
- },
19
- true
20
- );
21
- window._WEAPPS_HISTORY = history;
22
-
23
- function generateBrowserHistory(param) {
24
- history = createBrowserHistory(param);
25
- window._WEAPPS_HISTORY = history;
26
- return history;
27
- }
28
-
29
- function generateHashHistory(param) {
30
- history = createHashHistory(param);
31
- window._WEAPPS_HISTORY = history;
32
- return history;
33
- }
34
-
35
- export { history, createHistory, generateBrowserHistory, generateHashHistory };
@@ -1,10 +0,0 @@
1
- import * as React from 'react'
2
- import { useLocation } from 'react-router-dom'
3
-
4
- export function useScrollTop() {
5
- const { pathname } = useLocation()
6
- React.useEffect(() => {
7
- window.scrollTo(0, 0)
8
- }, [pathname])
9
- return null
10
- }
@@ -1,41 +0,0 @@
1
- import { get as lodashGet, set as lodashSet } from 'lodash';
2
-
3
- export * from './actionHandler';
4
- export * from './common';
5
- export * from './computed';
6
- export * from './history';
7
- export * from './widgets';
8
- export * from './style';
9
-
10
- /*
11
- 根据 object对象的path路径获取值。 如果解析 value 是 undefined 会以 defaultValue 取代。
12
- */
13
- export function getter(context, path, defaultValue = undefined) {
14
- return lodashGet(context, path, defaultValue);
15
- }
16
-
17
- /*
18
- 设置 object对象中对应 path 属性路径上的值,如果path不存在,则创建。 缺少的索引属性会创建为数组,而缺少的属性会创建为对象。 使用_.setWith 定制path创建
19
- */
20
- export function setter(context, path, value = undefined) {
21
- return lodashSet(context, path, value);
22
- }
23
-
24
- export function _isMobile() {
25
- if (window.matchMedia) {
26
- return Boolean(window.matchMedia('(max-width: 1024px)')?.matches);
27
- }
28
- let check = false;
29
- (function (a) {
30
- if (
31
- /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
32
- a
33
- ) ||
34
- /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
35
- a.substr(0, 4)
36
- )
37
- )
38
- check = true;
39
- })(navigator.userAgent || navigator.vendor || window.opera);
40
- return check;
41
- }
@@ -1,14 +0,0 @@
1
- import { app } from '../app/global-api'
2
- import { createComputed } from '/src/utils/computed'
3
- import globalCommon from '../app/common'
4
- import globalState from '../store'
5
- import globalComputed from '../lowcode/computed'
6
-
7
- // 防止页面重复引用
8
- let isInit = false
9
- if(!isInit) {
10
- window.$$global = window.$$global || {}
11
- app.common = globalCommon
12
- app.state = globalState
13
- app.computed = createComputed(globalComputed)
14
- }
@@ -1,158 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-empty-function */
2
- /**
3
- * 生命周期处理函数
4
- */
5
- import throttle from 'lodash.throttle';
6
- import * as querystring from 'query-string';
7
- import appLifeCycle from '../lowcode/lifecycle';
8
-
9
- // 小程序 端使用lifeCycle
10
- let alreadyInitAppLifeCycle = false;
11
- export function initAppLifeCycle(app, { beforeCustomLaunch }) {
12
- const onAppLaunch = (query) => {
13
- beforeCustomLaunch(query);
14
- appLifeCycle?.onAppLaunch(query);
15
- };
16
- // 应用级别事件监听
17
- if (!alreadyInitAppLifeCycle) {
18
- onAppLaunch(app.getLaunchOptionsSync());
19
- appLifeCycle?.onAppShow(app.getLaunchOptionsSync());
20
-
21
- // 预留等客户端来触发
22
- // window.addEventListener('appLaunch', (...args) => onAppLaunch(...args))
23
- window.addEventListener('appShow', (...args) =>
24
- appLifeCycle?.onAppShow(...args)
25
- );
26
- window.addEventListener('appHide', (...args) =>
27
- appLifeCycle?.onAppHide(...args)
28
- );
29
- window.addEventListener('error', (...args) =>
30
- appLifeCycle?.onAppError(...args)
31
- );
32
- window.addEventListener('unhandledrejection', (event) =>
33
- appLifeCycle?.onAppUnhandledRejection(event?.reason)
34
- );
35
- alreadyInitAppLifeCycle = true;
36
- }
37
- }
38
-
39
- let isReachBottom = false;
40
- // web 端使用lifeCycle
41
- export function pageLifeCycleMount(
42
- useEffect,
43
- {
44
- beforePageCustomLaunch,
45
- onPageLoad,
46
- onPageShow,
47
- onPageReady,
48
- onPageHide,
49
- onPageUnload,
50
- onPullDownRefresh,
51
- onReachBottom,
52
- onShareAppMessage,
53
- onPageScroll,
54
- onResize,
55
- onAddToFavorites,
56
- onShareTimeline,
57
- onTabItemTap,
58
- },
59
- app = {},
60
- pageCodeContext
61
- ) {
62
- // 预览区调试栏可调试
63
- window.$page = pageCodeContext;
64
- // royhyang 此处个人认为应该走调用一次的方案
65
- useEffect(() => {
66
- const _onPageLoad = async function (query) {
67
- await (beforePageCustomLaunch && beforePageCustomLaunch(query));
68
- return typeof onPageLoad === 'function' ? onPageLoad(query) : () => {};
69
- };
70
- _onPageLoad.call(pageCodeContext, getCurrentPageQuery());
71
- }, []);
72
-
73
- useEffect(() => {
74
- typeof onPageReady === 'function' && onPageReady.call(pageCodeContext);
75
- typeof onPageShow === 'function' && onPageShow.call(pageCodeContext);
76
- if (typeof onPullDownRefresh === 'function') {
77
- app.onPullDownRefresh && app.onPullDownRefresh(onPullDownRefresh);
78
- }
79
- if (
80
- typeof onPageScroll === 'function' ||
81
- typeof onReachBottom === 'function'
82
- ) {
83
- window.onscroll = throttle(() => {
84
- //变量scrollTop是滚动条滚动时,滚动条上端距离顶部的距离
85
- let scrollTop =
86
- document.documentElement.scrollTop || document.body.scrollTop;
87
-
88
- //变量windowHeight是可视区的高度
89
- let windowHeight =
90
- document.documentElement.clientHeight || document.body.clientHeight;
91
-
92
- //变量scrollHeight是滚动条的总高度(当前可滚动的页面的总高度)
93
- let scrollHeight =
94
- document.documentElement.scrollHeight || document.body.scrollHeight;
95
- if (typeof onPageScroll === 'function') {
96
- onPageScroll.call(pageCodeContext, {
97
- scrollTop: window.pageYOffset,
98
- });
99
- }
100
-
101
- // console.log(scrollTop, windowHeight, scrollTop + windowHeight, scrollHeight, isReachBottom)
102
- //滚动条到底部
103
- if (scrollTop + windowHeight >= scrollHeight && !isReachBottom) {
104
- //要进行的操作
105
- isReachBottom = true;
106
- if (typeof onReachBottom === 'function') {
107
- onReachBottom.call(pageCodeContext);
108
- }
109
- }
110
- // 容许用户回弹50然后执行ReachBottom, 50为测试最佳值
111
- if (scrollTop + windowHeight < scrollHeight - 50) {
112
- isReachBottom = false;
113
- }
114
- }, 300);
115
- }
116
- // todo
117
- if (typeof onShareAppMessage === 'function') {
118
- window.onShareAppMessage = onShareAppMessage.bind(pageCodeContext);
119
- }
120
-
121
- if (typeof onResize === 'function') {
122
- window.onresize = () => {
123
- onResize.call(pageCodeContext, {
124
- size: {
125
- windowWidth: window.innerWidth,
126
- windowHeight: window.innerHeight,
127
- },
128
- });
129
- };
130
- }
131
- return () => {
132
- typeof onPageHide === 'function' && onPageHide.call(pageCodeContext, {});
133
- typeof onPageUnload === 'function' &&
134
- onPageUnload.call(pageCodeContext, {});
135
- if (typeof onPullDownRefresh === 'function') {
136
- app.offPullDownRefresh &&
137
- app.offPullDownRefresh(onPullDownRefresh.bind(pageCodeContext));
138
- }
139
-
140
- window.onscroll = null;
141
- window.onresize = null;
142
- };
143
- }, []);
144
- }
145
-
146
- function getCurrentPageQuery() {
147
- let queryText = location.href.split('?')[1];
148
- let query = querystring.parse(queryText) || {};
149
- Object.keys(query).forEach((key) => {
150
- query[key] = decodeURIComponent(query[key]);
151
- });
152
- return query;
153
- }
154
-
155
- export function initWebConfig(app, appConfig) {
156
- // miniprogram.config 配置截取
157
- app.setConfig(appConfig);
158
- }