@cloudbase/framework-plugin-low-code 0.6.32 → 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 (79) 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/dist/mp/miniprogram_npm/miniprogram-render/bom/cookie.js +0 -286
  7. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/history.js +0 -133
  8. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/local-storage.js +0 -103
  9. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/location.js +0 -588
  10. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/miniprogram.js +0 -101
  11. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/navigator.js +0 -80
  12. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/performance.js +0 -28
  13. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/screen.js +0 -31
  14. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/session-storage.js +0 -96
  15. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/xml-http-request.js +0 -290
  16. package/template/dist/mp/miniprogram_npm/miniprogram-render/document.js +0 -396
  17. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/custom-event.js +0 -12
  18. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/event-target.js +0 -389
  19. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/event.js +0 -186
  20. package/template/dist/mp/miniprogram_npm/miniprogram-render/index.js +0 -41
  21. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/attribute.js +0 -226
  22. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/class-list.js +0 -153
  23. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/comment.js +0 -80
  24. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/a.js +0 -165
  25. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/canvas.js +0 -138
  26. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/image.js +0 -177
  27. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/input.js +0 -181
  28. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/not-support.js +0 -60
  29. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/option.js +0 -126
  30. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/select.js +0 -155
  31. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/textarea.js +0 -178
  32. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/video.js +0 -165
  33. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-component.js +0 -84
  34. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-custom-component.js +0 -64
  35. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element.js +0 -970
  36. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/node.js +0 -140
  37. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/style-list.js +0 -28
  38. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/style.js +0 -158
  39. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/text-node.js +0 -127
  40. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/parser.js +0 -269
  41. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/query-selector.js +0 -420
  42. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/tree.js +0 -130
  43. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/cache.js +0 -95
  44. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/pool.js +0 -24
  45. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/tool.js +0 -131
  46. package/template/dist/mp/miniprogram_npm/miniprogram-render/window.js +0 -651
  47. package/template/generator/app/common.js +0 -17
  48. package/template/generator/app/global-api.js +0 -163
  49. package/template/generator/app/handlers.js +0 -13
  50. package/template/generator/datasources/config.js.tpl +0 -21
  51. package/template/generator/datasources/dataset-profiles.js.tpl +0 -5
  52. package/template/generator/datasources/datasource-profiles.js.tpl +0 -4
  53. package/template/generator/datasources/index.js.tpl +0 -14
  54. package/template/generator/handlers/NodeRenderer.jsx +0 -471
  55. package/template/generator/handlers/RenderWrapper.jsx +0 -145
  56. package/template/generator/index.jsx +0 -116
  57. package/template/generator/index.less +0 -120
  58. package/template/generator/pages/app.tpl +0 -181
  59. package/template/generator/pages/composite.tpl +0 -267
  60. package/template/generator/router/index.tpl +0 -49
  61. package/template/generator/store/computed.js +0 -11
  62. package/template/generator/store/index.js +0 -5
  63. package/template/generator/utils/ScanCodeComponent.js +0 -345
  64. package/template/generator/utils/actionHandler.js +0 -119
  65. package/template/generator/utils/common.js +0 -225
  66. package/template/generator/utils/computed.js +0 -9
  67. package/template/generator/utils/date.js +0 -324
  68. package/template/generator/utils/error.jsx +0 -14
  69. package/template/generator/utils/eventProxy.js +0 -64
  70. package/template/generator/utils/history.js +0 -35
  71. package/template/generator/utils/hooks.js +0 -10
  72. package/template/generator/utils/index.js +0 -41
  73. package/template/generator/utils/initGlobalVar.js +0 -14
  74. package/template/generator/utils/lifecycle.js +0 -158
  75. package/template/generator/utils/monitor-jssdk.min.js +0 -881
  76. package/template/generator/utils/page.js +0 -10
  77. package/template/generator/utils/scan-code-action.js +0 -27
  78. package/template/generator/utils/style.js +0 -81
  79. package/template/generator/utils/widgets.js +0 -343
@@ -1,80 +0,0 @@
1
- class Navigator {
2
- constructor() {
3
- this.$_language = ''
4
- this.$_wxVersion = ''
5
- this.$_brand = '' // 手机品牌
6
- this.$_model = '' // 手机型号
7
- this.$_platform = ''
8
- this.$_system = '' // 操作系统版本
9
-
10
- this.$_userAgent = ''
11
- }
12
-
13
- /**
14
- * 重置实例
15
- */
16
- $$reset(info) {
17
- this.$_language = info.language
18
- this.$_wxVersion = info.version
19
- this.$_brand = info.brand
20
- this.$_model = info.model
21
- this.$_platform = info.platform
22
- this.$_system = info.system
23
-
24
- // 拼装 userAgent
25
- const appVersion = '5.0'
26
- const appleWebKitVersion = '602.3.12'
27
- let platformContext
28
- if (this.$_platform === 'ios') {
29
- // 拆分系统版本号
30
- let systemVersion = this.$_system.split(' ')
31
- if (systemVersion.length >= 2) {
32
- systemVersion = systemVersion[1].split('.').join('_')
33
- } else {
34
- systemVersion = ''
35
- }
36
-
37
- platformContext = `${this.$_brand}; CPU ${this.$_brand} OS ${systemVersion} like Mac OS X`
38
- } else if (this.$_platform === 'android') {
39
- platformContext = `Linux; ${this.$_system}; ${this.$_model}`
40
- } else {
41
- // 在开发者工具上,默认在 windows x64 上运行
42
- platformContext = 'Windows NT 6.1; win64; x64'
43
- }
44
-
45
- this.$_userAgent = `${this.appCodeName}/${appVersion} (${platformContext}) AppleWebKit/${appleWebKitVersion} (KHTML, like Gecko) Mobile MicroMessenger/${this.$_wxVersion} Language/${this.language}`
46
- }
47
-
48
- /**
49
- * 对外属性和方法
50
- */
51
- get userAgent() {
52
- return this.$_userAgent
53
- }
54
-
55
- get appCodeName() {
56
- return 'Mozilla'
57
- }
58
-
59
- get appName() {
60
- return 'Netscape'
61
- }
62
-
63
- get language() {
64
- return this.$_language
65
- }
66
-
67
- get languages() {
68
- return [this.$_language]
69
- }
70
-
71
- get platform() {
72
- return this.$_platform
73
- }
74
-
75
- get product() {
76
- return 'Gecko'
77
- }
78
- }
79
-
80
- module.exports = Navigator
@@ -1,28 +0,0 @@
1
- class Performance {
2
- constructor(timeOrigin) {
3
- this.$_timeOrigin = timeOrigin
4
- }
5
-
6
- /**
7
- * 对外属性和方法
8
- */
9
- get navigation() {
10
- console.warn('performance.navigation is not supported')
11
- return null
12
- }
13
-
14
- get timing() {
15
- console.warn('performance.timing is not supported')
16
- return null
17
- }
18
-
19
- get timeOrigin() {
20
- return this.$_timeOrigin
21
- }
22
-
23
- now() {
24
- return +new Date() - this.$_timeOrigin
25
- }
26
- }
27
-
28
- module.exports = Performance
@@ -1,31 +0,0 @@
1
- const EventTarget = require('../event/event-target')
2
-
3
- class Screen extends EventTarget {
4
- constructor() {
5
- super()
6
-
7
- this.$_width = 0
8
- this.$_height = 0
9
- }
10
-
11
- /**
12
- * 重置实例
13
- */
14
- $$reset(info) {
15
- this.$_width = info.screenWidth
16
- this.$_height = info.screenHeight
17
- }
18
-
19
- /**
20
- * 对外属性和方法
21
- */
22
- get width() {
23
- return this.$_width
24
- }
25
-
26
- get height() {
27
- return this.$_height
28
- }
29
- }
30
-
31
- module.exports = Screen
@@ -1,96 +0,0 @@
1
- const Event = require('../event/event')
2
-
3
- class SessionStorage {
4
- constructor(window) {
5
- this.$_keys = []
6
- this.$_map = {}
7
- this.$_window = window
8
- }
9
-
10
- /**
11
- * 触发 window 的 storage 事件
12
- */
13
- $_triggerStorage(key, newValue, oldValue, force) {
14
- if (!force && newValue === oldValue) return
15
-
16
- const pages = getCurrentPages() || []
17
- pages.forEach(page => {
18
- if (page && page.window && page.window !== this.$_window) {
19
- page.window.$$trigger('storage', {
20
- event: new Event({
21
- name: 'storage',
22
- target: page.window,
23
- $$extra: {
24
- key,
25
- newValue,
26
- oldValue,
27
- storageArea: this,
28
- url: this.$_window.location.href,
29
- }
30
- })
31
- })
32
- }
33
- })
34
- }
35
-
36
- /**
37
- * 对外属性和方法
38
- */
39
- get length() {
40
- return this.$_keys.length
41
- }
42
-
43
- key(num) {
44
- if (typeof num !== 'number' || !isFinite(num) || num < 0) return null
45
-
46
- return this.$_keys[num] || null
47
- }
48
-
49
- getItem(key) {
50
- if (!key || typeof key !== 'string') return null
51
-
52
- return this.$_map[key] || null
53
- }
54
-
55
- setItem(key, data) {
56
- if (!key || typeof key !== 'string') return
57
- data = '' + data
58
-
59
- const oldValue = this.$_map[key] || null
60
-
61
- this.$_map[key] = data
62
-
63
- // 调整顺序
64
- const index = this.$_keys.indexOf(key)
65
- if (index >= 0) this.$_keys.splice(index, 1)
66
- this.$_keys.push(key)
67
-
68
- this.$_triggerStorage(key, data, oldValue)
69
- }
70
-
71
- removeItem(key) {
72
- if (!key || typeof key !== 'string') return
73
-
74
- const oldValue = this.$_map[key] || null
75
-
76
- delete this.$_map[key]
77
-
78
- // 删除 key
79
- const index = this.$_keys.indexOf(key)
80
- if (index >= 0) this.$_keys.splice(index, 1)
81
-
82
- this.$_triggerStorage(key, null, oldValue)
83
- }
84
-
85
- clear() {
86
- this.$_keys.forEach(key => {
87
- delete this.$_map[key]
88
- })
89
-
90
- this.$_keys.length = 0
91
-
92
- this.$_triggerStorage(null, null, null, true)
93
- }
94
- }
95
-
96
- module.exports = SessionStorage
@@ -1,290 +0,0 @@
1
- const EventTarget = require('../event/event-target')
2
-
3
- const SUPPORT_METHOD = ['OPTIONS', 'GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'TRACE', 'CONNECT']
4
- const STATUS_TEXT_MAP = {
5
- 100: 'Continue',
6
- 101: 'Switching protocols',
7
-
8
- 200: 'OK',
9
- 201: 'Created',
10
- 202: 'Accepted',
11
- 203: 'Non-Authoritative Information',
12
- 204: 'No Content',
13
- 205: 'Reset Content',
14
- 206: 'Partial Content',
15
-
16
- 300: 'Multiple Choices',
17
- 301: 'Moved Permanently',
18
- 302: 'Found',
19
- 303: 'See Other',
20
- 304: 'Not Modified',
21
- 305: 'Use Proxy',
22
- 307: 'Temporary Redirect',
23
-
24
- 400: 'Bad Request',
25
- 401: 'Unauthorized',
26
- 402: 'Payment Required',
27
- 403: 'Forbidden',
28
- 404: 'Not Found',
29
- 405: 'Method Not Allowed',
30
- 406: 'Not Acceptable',
31
- 407: 'Proxy Authentication Required',
32
- 408: 'Request Timeout',
33
- 409: 'Conflict',
34
- 410: 'Gone',
35
- 411: 'Length Required',
36
- 412: 'Precondition Failed',
37
- 413: 'Request Entity Too Large',
38
- 414: 'Request-URI Too Long',
39
- 415: 'Unsupported Media Type',
40
- 416: 'Requested Range Not Suitable',
41
- 417: 'Expectation Failed',
42
-
43
- 500: 'Internal Server Error',
44
- 501: 'Not Implemented',
45
- 502: 'Bad Gateway',
46
- 503: 'Service Unavailable',
47
- 504: 'Gateway Timeout',
48
- 505: 'HTTP Version Not Supported',
49
- }
50
-
51
- class XMLHttpRequest extends EventTarget {
52
- constructor(window) {
53
- super()
54
-
55
- this.$_window = window
56
- this.$_method = ''
57
- this.$_url = ''
58
- this.$_data = null
59
- this.$_status = 0
60
- this.$_statusText = ''
61
- this.$_readyState = XMLHttpRequest.UNSENT
62
- this.$_header = {
63
- Accept: '*/*'
64
- }
65
- this.$_responseType = ''
66
- this.$_resHeader = null
67
- this.$_response = null
68
- this.$_timeout = 0
69
- this.$_startTime = null
70
-
71
- this.$_requestTask = null
72
- this.$_requestSuccess = this.$_requestSuccess.bind(this)
73
- this.$_requestFail = this.$_requestFail.bind(this)
74
- this.$_requestComplete = this.$_requestComplete.bind(this)
75
- }
76
-
77
- /**
78
- * readyState 变化
79
- */
80
- $_callReadyStateChange(readyState) {
81
- const hasChange = readyState !== this.$_readyState
82
- this.$_readyState = readyState
83
-
84
- if (hasChange) this.$$trigger('readystatechange')
85
- }
86
-
87
- /**
88
- * 执行请求
89
- */
90
- $_callRequest() {
91
- if (this.$_timeout) {
92
- this.$_startTime = +new Date()
93
-
94
- setTimeout(() => {
95
- if (!this.$_status && this.$_readyState !== XMLHttpRequest.DONE) {
96
- // 超时
97
- if (this.$_requestTask) this.$_requestTask.abort()
98
- this.$_callReadyStateChange(XMLHttpRequest.DONE)
99
- this.$$trigger('timeout')
100
- }
101
- }, this.$_timeout)
102
- }
103
-
104
- // 重置各种状态
105
- this.$_status = 0
106
- this.$_statusText = ''
107
- this.$_readyState = XMLHttpRequest.OPENED
108
- this.$_resHeader = null
109
- this.$_response = null
110
-
111
- // 头信息
112
- const header = Object.assign({}, this.$_header)
113
- if (this.$_window) {
114
- header.cookie = this.$_window.document.$$cookie
115
- }
116
-
117
- // 补完 url
118
- let url = this.$_url
119
- url = url.indexOf('//') === -1 ? this.$_window.location.origin + url : url
120
-
121
- this.$_requestTask = wx.request({
122
- url,
123
- data: this.$_data || {},
124
- header,
125
- method: this.$_method,
126
- dataType: this.$_responseType === 'json' ? 'json' : 'text',
127
- responseType: this.$_responseType === 'arraybuffer' ? 'arraybuffer' : 'text',
128
- success: this.$_requestSuccess,
129
- fail: this.$_requestFail,
130
- complete: this.$_requestComplete,
131
- })
132
- }
133
-
134
- /**
135
- * 请求成功
136
- */
137
- $_requestSuccess({data, statusCode, header}) {
138
- this.$_status = statusCode
139
- this.$_resHeader = header
140
-
141
- this.$_callReadyStateChange(XMLHttpRequest.HEADERS_RECEIVED)
142
-
143
- // 处理 set-cookie
144
- if (this.$_window) {
145
- const setCookie = header['Set-Cookie']
146
-
147
- if (setCookie && typeof setCookie === 'string') {
148
- this.$_window.document.$$setCookie(setCookie)
149
- }
150
- }
151
-
152
- // 处理返回数据
153
- if (data) {
154
- this.$_callReadyStateChange(XMLHttpRequest.LOADING)
155
- this.$$trigger('loadstart')
156
- this.$_response = data
157
- this.$$trigger('loadend')
158
- }
159
- }
160
-
161
- /**
162
- * 请求失败
163
- */
164
- $_requestFail({errMsg}) {
165
- this.$_status = 0
166
- this.$_statusText = errMsg
167
-
168
- this.$$trigger('error')
169
- }
170
-
171
- /**
172
- * 请求完成
173
- */
174
- $_requestComplete() {
175
- this.$_startTime = null
176
- this.$_requestTask = null
177
- this.$_callReadyStateChange(XMLHttpRequest.DONE)
178
-
179
- if (this.$_status) {
180
- this.$$trigger('load')
181
- }
182
- }
183
-
184
- /**
185
- * 对外属性和方法
186
- */
187
- get timeout() {
188
- return this.$_timeout
189
- }
190
-
191
- set timeout(timeout) {
192
- if (typeof timeout !== 'number' || !isFinite(timeout) || timeout <= 0) return
193
-
194
- this.$_timeout = timeout
195
- }
196
-
197
- get status() {
198
- return this.$_status
199
- }
200
-
201
- get statusText() {
202
- if (this.$_readyState === XMLHttpRequest.UNSENT || this.$_readyState === XMLHttpRequest.OPENED) return ''
203
-
204
- return STATUS_TEXT_MAP[this.$_status + ''] || this.$_statusText || ''
205
- }
206
-
207
- get readyState() {
208
- return this.$_readyState
209
- }
210
-
211
- get responseType() {
212
- return this.$_responseType
213
- }
214
-
215
- set responseType(value) {
216
- if (typeof value !== 'string') return
217
-
218
- this.$_responseType = value
219
- }
220
-
221
- get responseText() {
222
- if (!this.$_responseType || this.$_responseType === 'text') {
223
- return this.$_response
224
- }
225
-
226
- return null
227
- }
228
-
229
- get response() {
230
- return this.$_response
231
- }
232
-
233
- abort() {
234
- if (this.$_requestTask) {
235
- this.$_requestTask.abort()
236
- this.$$trigger('abort')
237
- }
238
- }
239
-
240
- getAllResponseHeaders() {
241
- if (this.$_readyState === XMLHttpRequest.UNSENT || this.$_readyState === XMLHttpRequest.OPENED || !this.$_resHeader) return ''
242
-
243
- return Object.keys(this.$_resHeader)
244
- .map(key => `${key}: ${this.$_resHeader[key]}`)
245
- .join('\r\n')
246
- }
247
-
248
- getResponseHeader(name) {
249
- if (this.$_readyState === XMLHttpRequest.UNSENT || this.$_readyState === XMLHttpRequest.OPENED || !this.$_resHeader) return null
250
-
251
- // 处理大小写不敏感
252
- const key = Object.keys(this.$_resHeader).find(item => item.toLowerCase() === name.toLowerCase())
253
- const value = key ? this.$_resHeader[key] : null
254
-
255
- return typeof value === 'string' ? value : null
256
- }
257
-
258
- open(method, url) {
259
- if (typeof method === 'string') method = method.toUpperCase()
260
-
261
- if (SUPPORT_METHOD.indexOf(method) < 0) return
262
- if (!url || typeof url !== 'string') return
263
-
264
- this.$_method = method
265
- this.$_url = url
266
-
267
- this.$_callReadyStateChange(XMLHttpRequest.OPENED)
268
- }
269
-
270
- setRequestHeader(header, value) {
271
- if (typeof header === 'string' && typeof value === 'string') {
272
- this.$_header[header] = value
273
- }
274
- }
275
-
276
- send(data) {
277
- if (this.$_readyState !== XMLHttpRequest.OPENED) return
278
-
279
- this.$_data = data
280
- this.$_callRequest()
281
- }
282
- }
283
-
284
- XMLHttpRequest.UNSENT = 0
285
- XMLHttpRequest.OPENED = 1
286
- XMLHttpRequest.HEADERS_RECEIVED = 2
287
- XMLHttpRequest.LOADING = 3
288
- XMLHttpRequest.DONE = 4
289
-
290
- module.exports = XMLHttpRequest