@cloudbase/framework-plugin-low-code 0.6.32 → 0.6.35

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/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 +30 -5
  5. package/package.json +5 -3
  6. package/template/webpack/web.prod.js +1 -0
  7. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/cookie.js +0 -286
  8. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/history.js +0 -133
  9. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/local-storage.js +0 -103
  10. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/location.js +0 -588
  11. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/miniprogram.js +0 -101
  12. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/navigator.js +0 -80
  13. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/performance.js +0 -28
  14. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/screen.js +0 -31
  15. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/session-storage.js +0 -96
  16. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/xml-http-request.js +0 -290
  17. package/template/dist/mp/miniprogram_npm/miniprogram-render/document.js +0 -396
  18. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/custom-event.js +0 -12
  19. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/event-target.js +0 -389
  20. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/event.js +0 -186
  21. package/template/dist/mp/miniprogram_npm/miniprogram-render/index.js +0 -41
  22. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/attribute.js +0 -226
  23. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/class-list.js +0 -153
  24. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/comment.js +0 -80
  25. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/a.js +0 -165
  26. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/canvas.js +0 -138
  27. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/image.js +0 -177
  28. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/input.js +0 -181
  29. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/not-support.js +0 -60
  30. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/option.js +0 -126
  31. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/select.js +0 -155
  32. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/textarea.js +0 -178
  33. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/video.js +0 -165
  34. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-component.js +0 -84
  35. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-custom-component.js +0 -64
  36. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element.js +0 -970
  37. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/node.js +0 -140
  38. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/style-list.js +0 -28
  39. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/style.js +0 -158
  40. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/text-node.js +0 -127
  41. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/parser.js +0 -269
  42. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/query-selector.js +0 -420
  43. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/tree.js +0 -130
  44. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/cache.js +0 -95
  45. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/pool.js +0 -24
  46. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/tool.js +0 -131
  47. package/template/dist/mp/miniprogram_npm/miniprogram-render/window.js +0 -651
  48. package/template/generator/app/common.js +0 -17
  49. package/template/generator/app/global-api.js +0 -163
  50. package/template/generator/app/handlers.js +0 -13
  51. package/template/generator/datasources/config.js.tpl +0 -21
  52. package/template/generator/datasources/dataset-profiles.js.tpl +0 -5
  53. package/template/generator/datasources/datasource-profiles.js.tpl +0 -4
  54. package/template/generator/datasources/index.js.tpl +0 -14
  55. package/template/generator/handlers/NodeRenderer.jsx +0 -471
  56. package/template/generator/handlers/RenderWrapper.jsx +0 -145
  57. package/template/generator/index.jsx +0 -116
  58. package/template/generator/index.less +0 -120
  59. package/template/generator/pages/app.tpl +0 -181
  60. package/template/generator/pages/composite.tpl +0 -267
  61. package/template/generator/router/index.tpl +0 -49
  62. package/template/generator/store/computed.js +0 -11
  63. package/template/generator/store/index.js +0 -5
  64. package/template/generator/utils/ScanCodeComponent.js +0 -345
  65. package/template/generator/utils/actionHandler.js +0 -119
  66. package/template/generator/utils/common.js +0 -225
  67. package/template/generator/utils/computed.js +0 -9
  68. package/template/generator/utils/date.js +0 -324
  69. package/template/generator/utils/error.jsx +0 -14
  70. package/template/generator/utils/eventProxy.js +0 -64
  71. package/template/generator/utils/history.js +0 -35
  72. package/template/generator/utils/hooks.js +0 -10
  73. package/template/generator/utils/index.js +0 -41
  74. package/template/generator/utils/initGlobalVar.js +0 -14
  75. package/template/generator/utils/lifecycle.js +0 -158
  76. package/template/generator/utils/monitor-jssdk.min.js +0 -881
  77. package/template/generator/utils/page.js +0 -10
  78. package/template/generator/utils/scan-code-action.js +0 -27
  79. package/template/generator/utils/style.js +0 -81
  80. package/template/generator/utils/widgets.js +0 -343
@@ -1,651 +0,0 @@
1
- const Document = require('./document')
2
- const EventTarget = require('./event/event-target')
3
- const Event = require('./event/event')
4
- const OriginalCustomEvent = require('./event/custom-event')
5
- const Location = require('./bom/location')
6
- const Navigator = require('./bom/navigator')
7
- const Screen = require('./bom/screen')
8
- const History = require('./bom/history')
9
- const Miniprogram = require('./bom/miniprogram')
10
- const LocalStorage = require('./bom/local-storage')
11
- const SessionStorage = require('./bom/session-storage')
12
- const Performance = require('./bom/performance')
13
- const OriginalXMLHttpRequest = require('./bom/xml-http-request')
14
- const Node = require('./node/node')
15
- const Element = require('./node/element')
16
- const TextNode = require('./node/text-node')
17
- const Comment = require('./node/comment')
18
- const ClassList = require('./node/class-list')
19
- const Style = require('./node/style')
20
- const Attribute = require('./node/attribute')
21
- const cache = require('./util/cache')
22
- const tool = require('./util/tool')
23
-
24
- let lastRafTime = 0
25
- const WINDOW_PROTOTYPE_MAP = {
26
- location: Location.prototype,
27
- navigator: Navigator.prototype,
28
- performance: Performance.prototype,
29
- screen: Screen.prototype,
30
- history: History.prototype,
31
- localStorage: LocalStorage.prototype,
32
- sessionStorage: SessionStorage.prototype,
33
- event: Event.prototype,
34
- }
35
- const ELEMENT_PROTOTYPE_MAP = {
36
- attribute: Attribute.prototype,
37
- classList: ClassList.prototype,
38
- style: Style.prototype,
39
- }
40
- const subscribeMap = {}
41
- const globalObject = {}
42
-
43
- class Window extends EventTarget {
44
- constructor(pageId) {
45
- super()
46
-
47
- const timeOrigin = +new Date()
48
- const that = this
49
-
50
- this.$_pageId = pageId
51
-
52
- this.$_outerHeight = 0
53
- this.$_outerWidth = 0
54
- this.$_innerHeight = 0
55
- this.$_innerWidth = 0
56
-
57
- this.$_location = new Location(pageId)
58
- this.$_navigator = new Navigator()
59
- this.$_screen = new Screen()
60
- this.$_history = new History(this.$_location)
61
- this.$_miniprogram = new Miniprogram(pageId)
62
- this.$_localStorage = new LocalStorage(this)
63
- this.$_sessionStorage = new SessionStorage(this)
64
- this.$_performance = new Performance(timeOrigin)
65
-
66
- this.$_nowFetchingWebviewInfoPromise = null // 正在拉取 webview 端信息的 promise 实例
67
-
68
- this.$_fetchDeviceInfo()
69
- this.$_initInnerEvent()
70
-
71
- // 补充实例的属性,用于 'xxx' in XXX 判断
72
- this.onhashchange = null
73
-
74
- this.$_elementConstructor = function HTMLElement(...args) {
75
- return Element.$$create(...args)
76
- }
77
- this.$_customEventConstructor = class CustomEvent extends OriginalCustomEvent {
78
- constructor(name = '', options = {}) {
79
- options.timeStamp = +new Date() - timeOrigin
80
- super(name, options)
81
- }
82
- }
83
- this.$_xmlHttpRequestConstructor = class XMLHttpRequest extends OriginalXMLHttpRequest {
84
- constructor() {
85
- super(that)
86
- }
87
- }
88
-
89
- // react 环境兼容
90
- this.HTMLIFrameElement = function() {}
91
- }
92
-
93
- /**
94
- * 初始化内部事件
95
- */
96
- $_initInnerEvent() {
97
- // 监听 location 的事件
98
- this.$_location.addEventListener('hashchange', ({oldURL, newURL}) => {
99
- this.$$trigger('hashchange', {
100
- event: new Event({
101
- name: 'hashchange',
102
- target: this,
103
- eventPhase: Event.AT_TARGET,
104
- $$extra: {
105
- oldURL,
106
- newURL,
107
- },
108
- }),
109
- currentTarget: this,
110
- })
111
- })
112
-
113
- // 监听 history 的事件
114
- this.$_history.addEventListener('popstate', ({state}) => {
115
- this.$$trigger('popstate', {
116
- event: new Event({
117
- name: 'popstate',
118
- target: this,
119
- eventPhase: Event.AT_TARGET,
120
- $$extra: {state},
121
- }),
122
- currentTarget: this,
123
- })
124
- })
125
-
126
- // 监听滚动事件
127
- this.addEventListener('scroll', () => {
128
- const document = this.document
129
- // 记录最近一次滚动事件触发的时间戳
130
- if (document) document.documentElement.$$scrollTimeStamp = +new Date()
131
- })
132
- }
133
-
134
- /**
135
- * 拉取设备参数
136
- */
137
- $_fetchDeviceInfo() {
138
- try {
139
- const info = wx.getSystemInfoSync()
140
-
141
- this.$_outerHeight = info.screenHeight
142
- this.$_outerWidth = info.screenWidth
143
- this.$_innerHeight = info.windowHeight
144
- this.$_innerWidth = info.windowWidth
145
-
146
- this.$_screen.$$reset(info)
147
- this.$_navigator.$$reset(info)
148
- } catch (err) {
149
- // ignore
150
- }
151
- }
152
-
153
- /**
154
- * 拉取处理切面必要的信息
155
- */
156
- $_getAspectInfo(descriptor) {
157
- if (!descriptor || typeof descriptor !== 'string') return
158
-
159
- descriptor = descriptor.split('.')
160
- const main = descriptor[0]
161
- const sub = descriptor[1]
162
- let method = descriptor[1]
163
- let type = descriptor[2]
164
- let prototype
165
-
166
- // 找出对象原型
167
- if (main === 'window') {
168
- if (WINDOW_PROTOTYPE_MAP[sub]) {
169
- prototype = WINDOW_PROTOTYPE_MAP[sub]
170
- method = type
171
- type = descriptor[3]
172
- } else {
173
- prototype = Window.prototype
174
- }
175
- } else if (main === 'document') {
176
- prototype = Document.prototype
177
- } else if (main === 'element') {
178
- if (ELEMENT_PROTOTYPE_MAP[sub]) {
179
- prototype = ELEMENT_PROTOTYPE_MAP[sub]
180
- method = type
181
- type = descriptor[3]
182
- } else {
183
- prototype = Element.prototype
184
- }
185
- } else if (main === 'textNode') {
186
- prototype = TextNode.prototype
187
- } else if (main === 'comment') {
188
- prototype = Comment.prototype
189
- }
190
-
191
- return {prototype, method, type}
192
- }
193
-
194
- /**
195
- * 暴露给小程序用的对象
196
- */
197
- get $$miniprogram() {
198
- return this.$_miniprogram
199
- }
200
-
201
- /**
202
- * 获取全局共享对象
203
- */
204
- get $$global() {
205
- return globalObject
206
- }
207
-
208
- /**
209
- * 销毁实例
210
- */
211
- $$destroy() {
212
- super.$$destroy()
213
-
214
- const pageId = this.$_pageId
215
-
216
- Object.keys(subscribeMap).forEach(name => {
217
- const handlersMap = subscribeMap[name]
218
- if (handlersMap[pageId]) handlersMap[pageId] = null
219
- })
220
- }
221
-
222
- /**
223
- * 小程序端的 getComputedStyle 实现
224
- * https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.fields.html
225
- */
226
- $$getComputedStyle(dom, computedStyle = []) {
227
- tool.flushThrottleCache() // 先清空 setData
228
- return new Promise((resolve, reject) => {
229
- if (dom.tagName === 'BODY') {
230
- this.$$createSelectorQuery().select('.miniprogram-root').fields({computedStyle}, res => (res ? resolve(res) : reject())).exec()
231
- } else {
232
- this.$$createSelectorQuery().select(`.miniprogram-root >>> .node-${dom.$$nodeId}`).fields({computedStyle}, res => (res ? resolve(res) : reject())).exec()
233
- }
234
- })
235
- }
236
-
237
- /**
238
- * 强制清空 setData 缓存
239
- */
240
- $$forceRender() {
241
- tool.flushThrottleCache()
242
- }
243
-
244
- /**
245
- * 触发节点事件
246
- */
247
- $$trigger(eventName, options = {}) {
248
- if (eventName === 'error' && typeof options.event === 'string') {
249
- // 此处触发自 App.onError 钩子
250
- const errStack = options.event
251
- const errLines = errStack.split('\n')
252
- let message = ''
253
- for (let i = 0, len = errLines.length; i < len; i++) {
254
- const line = errLines[i]
255
- if (line.trim().indexOf('at') !== 0) {
256
- message += (line + '\n')
257
- } else {
258
- break
259
- }
260
- }
261
-
262
- const error = new Error(message)
263
- error.stack = errStack
264
- options.event = new this.$_customEventConstructor('error', {
265
- target: this,
266
- $$extra: {
267
- message,
268
- filename: '',
269
- lineno: 0,
270
- colno: 0,
271
- error,
272
- },
273
- })
274
- options.args = [message, error]
275
-
276
- // window.onerror 比较特殊,需要调整参数
277
- if (typeof this.onerror === 'function' && !this.onerror.$$isOfficial) {
278
- const oldOnError = this.onerror
279
- this.onerror = (event, message, error) => {
280
- oldOnError.call(this, message, '', 0, 0, error)
281
- }
282
- this.onerror.$$isOfficial = true // 标记为官方封装的方法
283
- }
284
- }
285
-
286
- super.$$trigger(eventName, options)
287
- }
288
-
289
- /**
290
- * 获取原型
291
- */
292
- $$getPrototype(descriptor) {
293
- if (!descriptor || typeof descriptor !== 'string') return
294
-
295
- descriptor = descriptor.split('.')
296
- const main = descriptor[0]
297
- const sub = descriptor[1]
298
-
299
- if (main === 'window') {
300
- if (WINDOW_PROTOTYPE_MAP[sub]) {
301
- return WINDOW_PROTOTYPE_MAP[sub]
302
- } else if (!sub) {
303
- return Window.prototype
304
- }
305
- } else if (main === 'document') {
306
- if (!sub) {
307
- return Document.prototype
308
- }
309
- } else if (main === 'element') {
310
- if (ELEMENT_PROTOTYPE_MAP[sub]) {
311
- return ELEMENT_PROTOTYPE_MAP[sub]
312
- } else if (!sub) {
313
- return Element.prototype
314
- }
315
- } else if (main === 'textNode') {
316
- if (!sub) {
317
- return TextNode.prototype
318
- }
319
- } else if (main === 'comment') {
320
- if (!sub) {
321
- return Comment.prototype
322
- }
323
- }
324
- }
325
-
326
- /**
327
- * 扩展 dom/bom 对象
328
- */
329
- $$extend(descriptor, options) {
330
- if (!descriptor || !options || typeof descriptor !== 'string' || typeof options !== 'object') return
331
-
332
- const prototype = this.$$getPrototype(descriptor)
333
- const keys = Object.keys(options)
334
-
335
- if (prototype) keys.forEach(key => prototype[key] = options[key])
336
- }
337
-
338
- /**
339
- * 对 dom/bom 对象方法追加切面方法
340
- */
341
- $$addAspect(descriptor, func) {
342
- if (!descriptor || !func || typeof descriptor !== 'string' || typeof func !== 'function') return
343
-
344
- const {prototype, method, type} = this.$_getAspectInfo(descriptor)
345
-
346
- // 处理切面
347
- if (prototype && method && type) {
348
- const methodInPrototype = prototype[method]
349
- if (typeof methodInPrototype !== 'function') return
350
-
351
- // 重写原始方法
352
- if (!methodInPrototype.$$isHook) {
353
- prototype[method] = function(...args) {
354
- const beforeFuncs = prototype[method].$$before || []
355
- const afterFuncs = prototype[method].$$after || []
356
-
357
- if (beforeFuncs.length) {
358
- for (const beforeFunc of beforeFuncs) {
359
- const isStop = beforeFunc.apply(this, args)
360
- if (isStop) return
361
- }
362
- }
363
-
364
- const res = methodInPrototype.apply(this, args)
365
-
366
- if (afterFuncs.length) {
367
- for (const afterFunc of afterFuncs) {
368
- afterFunc.call(this, res)
369
- }
370
- }
371
-
372
- return res
373
- }
374
- prototype[method].$$isHook = true
375
- prototype[method].$$originalMethod = methodInPrototype
376
- }
377
-
378
- // 追加切面方法
379
- if (type === 'before') {
380
- prototype[method].$$before = prototype[method].$$before || []
381
- prototype[method].$$before.push(func)
382
- } else if (type === 'after') {
383
- prototype[method].$$after = prototype[method].$$after || []
384
- prototype[method].$$after.push(func)
385
- }
386
- }
387
- }
388
-
389
- /**
390
- * 删除对 dom/bom 对象方法追加前置/后置处理
391
- */
392
- $$removeAspect(descriptor, func) {
393
- if (!descriptor || !func || typeof descriptor !== 'string' || typeof func !== 'function') return
394
-
395
- const {prototype, method, type} = this.$_getAspectInfo(descriptor)
396
-
397
- // 处理切面
398
- if (prototype && method && type) {
399
- const methodInPrototype = prototype[method]
400
- if (typeof methodInPrototype !== 'function' || !methodInPrototype.$$isHook) return
401
-
402
- // 移除切面方法
403
- if (type === 'before' && methodInPrototype.$$before) {
404
- methodInPrototype.$$before.splice(methodInPrototype.$$before.indexOf(func), 1)
405
- } else if (type === 'after' && methodInPrototype.$$after) {
406
- methodInPrototype.$$after.splice(methodInPrototype.$$after.indexOf(func), 1)
407
- }
408
-
409
- if ((!methodInPrototype.$$before || !methodInPrototype.$$before.length) && (!methodInPrototype.$$after || !methodInPrototype.$$after.length)) {
410
- prototype[method] = methodInPrototype.$$originalMethod
411
- }
412
- }
413
- }
414
-
415
- /**
416
- * 订阅广播事件
417
- */
418
- $$subscribe(name, handler) {
419
- if (typeof name !== 'string' || typeof handler !== 'function') return
420
-
421
- const pageId = this.$_pageId
422
- subscribeMap[name] = subscribeMap[name] || {}
423
- subscribeMap[name][pageId] = subscribeMap[name][pageId] || []
424
- subscribeMap[name][pageId].push(handler)
425
- }
426
-
427
- /**
428
- * 取消订阅广播事件
429
- */
430
- $$unsubscribe(name, handler) {
431
- const pageId = this.$_pageId
432
-
433
- if (typeof name !== 'string' || !subscribeMap[name] || !subscribeMap[name][pageId]) return
434
-
435
- const handlers = subscribeMap[name][pageId]
436
- if (!handler) {
437
- // 取消所有 handler 的订阅
438
- handlers.length = 0
439
- } else if (typeof handler === 'function') {
440
- const index = handlers.indexOf(handler)
441
- if (index !== -1) handlers.splice(index, 1)
442
- }
443
- }
444
-
445
- /**
446
- * 发布广播事件
447
- */
448
- $$publish(name, data) {
449
- if (typeof name !== 'string' || !subscribeMap[name]) return
450
-
451
- Object.keys(subscribeMap[name]).forEach(pageId => {
452
- const handlers = subscribeMap[name][pageId]
453
- if (handlers && handlers.length) {
454
- handlers.forEach(handler => {
455
- if (typeof handler !== 'function') return
456
-
457
- try {
458
- handler.call(null, data)
459
- } catch (err) {
460
- console.error(err)
461
- }
462
- })
463
- }
464
- })
465
- }
466
-
467
- /**
468
- * 对外属性和方法
469
- */
470
- get document() {
471
- return cache.getDocument(this.$_pageId) || null
472
- }
473
-
474
- get location() {
475
- return this.$_location
476
- }
477
-
478
- set location(href) {
479
- this.$_location.href = href
480
- }
481
-
482
- get navigator() {
483
- return this.$_navigator
484
- }
485
-
486
- get CustomEvent() {
487
- return this.$_customEventConstructor
488
- }
489
-
490
- get Event() {
491
- return Event
492
- }
493
-
494
- get self() {
495
- return this
496
- }
497
-
498
- get localStorage() {
499
- return this.$_localStorage
500
- }
501
-
502
- get sessionStorage() {
503
- return this.$_sessionStorage
504
- }
505
-
506
- get screen() {
507
- return this.$_screen
508
- }
509
-
510
- get history() {
511
- return this.$_history
512
- }
513
-
514
- get outerHeight() {
515
- return this.$_outerHeight
516
- }
517
-
518
- get outerWidth() {
519
- return this.$_outerWidth
520
- }
521
-
522
- get innerHeight() {
523
- return this.$_innerHeight
524
- }
525
-
526
- get innerWidth() {
527
- return this.$_innerWidth
528
- }
529
-
530
- get Image() {
531
- return this.document.$$imageConstructor
532
- }
533
-
534
- get setTimeout() {
535
- return setTimeout.bind(null)
536
- }
537
-
538
- get clearTimeout() {
539
- return clearTimeout.bind(null)
540
- }
541
-
542
- get setInterval() {
543
- return setInterval.bind(null)
544
- }
545
-
546
- get clearInterval() {
547
- return clearInterval.bind(null)
548
- }
549
-
550
- get HTMLElement() {
551
- return this.$_elementConstructor
552
- }
553
-
554
- get Element() {
555
- return Element
556
- }
557
-
558
- get Node() {
559
- return Node
560
- }
561
-
562
- get RegExp() {
563
- return RegExp
564
- }
565
-
566
- get Math() {
567
- return Math
568
- }
569
-
570
- get Number() {
571
- return Number
572
- }
573
-
574
- get Boolean() {
575
- return Boolean
576
- }
577
-
578
- get String() {
579
- return String
580
- }
581
-
582
- get Date() {
583
- return Date
584
- }
585
-
586
- get Symbol() {
587
- return Symbol
588
- }
589
-
590
- get parseInt() {
591
- return parseInt
592
- }
593
-
594
- get parseFloat() {
595
- return parseFloat
596
- }
597
-
598
- get performance() {
599
- return this.$_performance
600
- }
601
-
602
- get SVGElement() {
603
- // 不作任何实现,只作兼容使用
604
- console.warn('window.SVGElement is not supported')
605
- return function() {}
606
- }
607
-
608
- get XMLHttpRequest() {
609
- return this.$_xmlHttpRequestConstructor
610
- }
611
-
612
- open(url) {
613
- // 不支持 windowName 和 windowFeatures
614
- this.location.$$open(url)
615
- }
616
-
617
- close() {
618
- wx.navigateBack({
619
- delta: 1,
620
- })
621
- }
622
-
623
- getComputedStyle() {
624
- // 不作任何实现,只作兼容使用
625
- console.warn('window.getComputedStyle is not supported, please use window.$$getComputedStyle instead of it')
626
- return {
627
- // vue transition 组件使用
628
- transitionDelay: '',
629
- transitionDuration: '',
630
- animationDelay: '',
631
- animationDuration: '',
632
- }
633
- }
634
-
635
- requestAnimationFrame(callback) {
636
- if (typeof callback !== 'function') return
637
-
638
- const now = new Date()
639
- const nextRafTime = Math.max(lastRafTime + 16, now)
640
- return setTimeout(() => {
641
- callback(nextRafTime)
642
- lastRafTime = nextRafTime
643
- }, nextRafTime - now)
644
- }
645
-
646
- cancelAnimationFrame(timeId) {
647
- return clearTimeout(timeId)
648
- }
649
- }
650
-
651
- module.exports = Window
@@ -1,17 +0,0 @@
1
- <% mods.forEach((mod) => {%>
2
- import * as <%= mod %> from '../lowcode/common/<%= mod %>'<%}) %>
3
-
4
- // 支持 ESM 和 WEBPACK_EMS
5
- function getModule(targetModule) {
6
- if(
7
- Object.prototype.toString.call(targetModule) === '[object Module]'
8
- || targetModule.__esModule) {
9
- return targetModule.default ? targetModule.default : targetModule
10
- }
11
- return targetModule.default ? targetModule.default : targetModule
12
- }
13
-
14
- export default {
15
- <% mods.forEach((mod) => {%>
16
- <%= mod %>: getModule(<%= mod %>),<%}) %>
17
- }