@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.
- package/lib/builder/config/index.js +2 -5
- package/lib/builder/core/copy.d.ts.map +1 -1
- package/lib/builder/mp/materials.d.ts.map +1 -1
- package/lib/builder/mp/materials.js +30 -5
- package/package.json +5 -3
- package/template/webpack/web.prod.js +1 -0
- package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/cookie.js +0 -286
- package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/history.js +0 -133
- package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/local-storage.js +0 -103
- package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/location.js +0 -588
- package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/miniprogram.js +0 -101
- package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/navigator.js +0 -80
- package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/performance.js +0 -28
- package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/screen.js +0 -31
- package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/session-storage.js +0 -96
- package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/xml-http-request.js +0 -290
- package/template/dist/mp/miniprogram_npm/miniprogram-render/document.js +0 -396
- package/template/dist/mp/miniprogram_npm/miniprogram-render/event/custom-event.js +0 -12
- package/template/dist/mp/miniprogram_npm/miniprogram-render/event/event-target.js +0 -389
- package/template/dist/mp/miniprogram_npm/miniprogram-render/event/event.js +0 -186
- package/template/dist/mp/miniprogram_npm/miniprogram-render/index.js +0 -41
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/attribute.js +0 -226
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/class-list.js +0 -153
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/comment.js +0 -80
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/a.js +0 -165
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/canvas.js +0 -138
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/image.js +0 -177
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/input.js +0 -181
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/not-support.js +0 -60
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/option.js +0 -126
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/select.js +0 -155
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/textarea.js +0 -178
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/video.js +0 -165
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-component.js +0 -84
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-custom-component.js +0 -64
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element.js +0 -970
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/node.js +0 -140
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/style-list.js +0 -28
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/style.js +0 -158
- package/template/dist/mp/miniprogram_npm/miniprogram-render/node/text-node.js +0 -127
- package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/parser.js +0 -269
- package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/query-selector.js +0 -420
- package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/tree.js +0 -130
- package/template/dist/mp/miniprogram_npm/miniprogram-render/util/cache.js +0 -95
- package/template/dist/mp/miniprogram_npm/miniprogram-render/util/pool.js +0 -24
- package/template/dist/mp/miniprogram_npm/miniprogram-render/util/tool.js +0 -131
- package/template/dist/mp/miniprogram_npm/miniprogram-render/window.js +0 -651
- package/template/generator/app/common.js +0 -17
- package/template/generator/app/global-api.js +0 -163
- package/template/generator/app/handlers.js +0 -13
- package/template/generator/datasources/config.js.tpl +0 -21
- package/template/generator/datasources/dataset-profiles.js.tpl +0 -5
- package/template/generator/datasources/datasource-profiles.js.tpl +0 -4
- package/template/generator/datasources/index.js.tpl +0 -14
- package/template/generator/handlers/NodeRenderer.jsx +0 -471
- package/template/generator/handlers/RenderWrapper.jsx +0 -145
- package/template/generator/index.jsx +0 -116
- package/template/generator/index.less +0 -120
- package/template/generator/pages/app.tpl +0 -181
- package/template/generator/pages/composite.tpl +0 -267
- package/template/generator/router/index.tpl +0 -49
- package/template/generator/store/computed.js +0 -11
- package/template/generator/store/index.js +0 -5
- package/template/generator/utils/ScanCodeComponent.js +0 -345
- package/template/generator/utils/actionHandler.js +0 -119
- package/template/generator/utils/common.js +0 -225
- package/template/generator/utils/computed.js +0 -9
- package/template/generator/utils/date.js +0 -324
- package/template/generator/utils/error.jsx +0 -14
- package/template/generator/utils/eventProxy.js +0 -64
- package/template/generator/utils/history.js +0 -35
- package/template/generator/utils/hooks.js +0 -10
- package/template/generator/utils/index.js +0 -41
- package/template/generator/utils/initGlobalVar.js +0 -14
- package/template/generator/utils/lifecycle.js +0 -158
- package/template/generator/utils/monitor-jssdk.min.js +0 -881
- package/template/generator/utils/page.js +0 -10
- package/template/generator/utils/scan-code-action.js +0 -27
- package/template/generator/utils/style.js +0 -81
- package/template/generator/utils/widgets.js +0 -343
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
const Element = require('../element')
|
|
2
|
-
const Pool = require('../../util/pool')
|
|
3
|
-
const cache = require('../../util/cache')
|
|
4
|
-
const tool = require('../../util/tool')
|
|
5
|
-
|
|
6
|
-
const pool = new Pool()
|
|
7
|
-
|
|
8
|
-
class HTMLSelectElement extends Element {
|
|
9
|
-
/**
|
|
10
|
-
* 创建实例
|
|
11
|
-
*/
|
|
12
|
-
static $$create(options, tree) {
|
|
13
|
-
const config = cache.getConfig()
|
|
14
|
-
|
|
15
|
-
if (config.optimization.elementMultiplexing) {
|
|
16
|
-
// 复用 element 节点
|
|
17
|
-
const instance = pool.get()
|
|
18
|
-
|
|
19
|
-
if (instance) {
|
|
20
|
-
instance.$$init(options, tree)
|
|
21
|
-
return instance
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return new HTMLSelectElement(options, tree)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 覆写父类的 $$init 方法
|
|
30
|
-
*/
|
|
31
|
-
$$init(options, tree) {
|
|
32
|
-
super.$$init(options, tree)
|
|
33
|
-
this.$$resetOptions()
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 重置 options 显示
|
|
38
|
-
*/
|
|
39
|
-
$$resetOptions() {
|
|
40
|
-
const value = this.value
|
|
41
|
-
|
|
42
|
-
if (value !== undefined) {
|
|
43
|
-
this.options.forEach(child => child.$$updateSelected(child.value === value))
|
|
44
|
-
} else {
|
|
45
|
-
this.options.forEach((child, index) => child.$$updateSelected(index === 0))
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 覆写父类的回收实例方法
|
|
51
|
-
*/
|
|
52
|
-
$$recycle() {
|
|
53
|
-
this.$$destroy()
|
|
54
|
-
|
|
55
|
-
const config = cache.getConfig()
|
|
56
|
-
|
|
57
|
-
if (config.optimization.elementMultiplexing) {
|
|
58
|
-
// 复用 element 节点
|
|
59
|
-
pool.add(this)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* 调用 $_generateHtml 接口时用于处理额外的属性,
|
|
65
|
-
*/
|
|
66
|
-
$$dealWithAttrsForGenerateHtml(html, node) {
|
|
67
|
-
const value = node.value
|
|
68
|
-
if (value) html += ` value="${tool.escapeForHtmlGeneration(value)}"`
|
|
69
|
-
|
|
70
|
-
const disabled = node.disabled
|
|
71
|
-
if (disabled) html += ' disabled'
|
|
72
|
-
|
|
73
|
-
return html
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* 调用 outerHTML 的 setter 时用于处理额外的属性
|
|
78
|
-
*/
|
|
79
|
-
$$dealWithAttrsForOuterHTML(node) {
|
|
80
|
-
this.name = node.name || ''
|
|
81
|
-
this.value = node.value || ''
|
|
82
|
-
this.disabled = !!node.disabled
|
|
83
|
-
this.selectedIndex = node.selectedIndex || 0
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* 调用 cloneNode 接口时用于处理额外的属性
|
|
88
|
-
*/
|
|
89
|
-
$$dealWithAttrsForCloneNode() {
|
|
90
|
-
return {
|
|
91
|
-
value: this.value,
|
|
92
|
-
disabled: this.disabled,
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* 对外属性和方法
|
|
98
|
-
*/
|
|
99
|
-
get name() {
|
|
100
|
-
return this.$_attrs.get('name')
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
set name(value) {
|
|
104
|
-
value = '' + value
|
|
105
|
-
return this.$_attrs.set('name', value)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
get value() {
|
|
109
|
-
return this.$_attrs.get('value')
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
set value(value) {
|
|
113
|
-
value = '' + value
|
|
114
|
-
|
|
115
|
-
this.$_attrs.set('value', value)
|
|
116
|
-
|
|
117
|
-
// 同步更新 selectedIndex 属性
|
|
118
|
-
this.$_attrs.set('selectedIndex', this.options.findIndex(option => option.value === value))
|
|
119
|
-
|
|
120
|
-
// 同步更新 options 的 selected
|
|
121
|
-
this.$$resetOptions()
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
get disabled() {
|
|
125
|
-
return !!this.$_attrs.get('disabled')
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
set disabled(value) {
|
|
129
|
-
value = !!value
|
|
130
|
-
this.$_attrs.set('disabled', value)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
get selectedIndex() {
|
|
134
|
-
return +this.$_attrs.get('selectedIndex')
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
set selectedIndex(value) {
|
|
138
|
-
value = +value
|
|
139
|
-
|
|
140
|
-
this.$_attrs.set('selectedIndex', value)
|
|
141
|
-
|
|
142
|
-
// 同步更新 value 属性
|
|
143
|
-
this.$_attrs.set('value', this.options[value] && this.options[value].value || '')
|
|
144
|
-
|
|
145
|
-
// 同步更新 options 的 selected
|
|
146
|
-
this.$$resetOptions()
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
get options() {
|
|
150
|
-
// 只考虑儿子节点中的 option
|
|
151
|
-
return this.$_children.filter(child => child.tagName === 'OPTION' && !child.disabled)
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
module.exports = HTMLSelectElement
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
const Element = require('../element')
|
|
2
|
-
const Pool = require('../../util/pool')
|
|
3
|
-
const cache = require('../../util/cache')
|
|
4
|
-
const tool = require('../../util/tool')
|
|
5
|
-
|
|
6
|
-
const pool = new Pool()
|
|
7
|
-
|
|
8
|
-
class HTMLTextAreaElement extends Element {
|
|
9
|
-
/**
|
|
10
|
-
* 创建实例
|
|
11
|
-
*/
|
|
12
|
-
static $$create(options, tree) {
|
|
13
|
-
const config = cache.getConfig()
|
|
14
|
-
|
|
15
|
-
if (config.optimization.elementMultiplexing) {
|
|
16
|
-
// 复用 element 节点
|
|
17
|
-
const instance = pool.get()
|
|
18
|
-
|
|
19
|
-
if (instance) {
|
|
20
|
-
instance.$$init(options, tree)
|
|
21
|
-
return instance
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return new HTMLTextAreaElement(options, tree)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 覆写父类的回收实例方法
|
|
30
|
-
*/
|
|
31
|
-
$$recycle() {
|
|
32
|
-
this.$$destroy()
|
|
33
|
-
|
|
34
|
-
const config = cache.getConfig()
|
|
35
|
-
|
|
36
|
-
if (config.optimization.elementMultiplexing) {
|
|
37
|
-
// 复用 element 节点
|
|
38
|
-
pool.add(this)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* 调用 $_generateHtml 接口时用于处理额外的属性,
|
|
44
|
-
*/
|
|
45
|
-
$$dealWithAttrsForGenerateHtml(html, node) {
|
|
46
|
-
const type = node.type
|
|
47
|
-
if (type) html += ` type="${tool.escapeForHtmlGeneration(type)}"`
|
|
48
|
-
|
|
49
|
-
const value = node.value
|
|
50
|
-
if (value) html += ` value="${tool.escapeForHtmlGeneration(value)}"`
|
|
51
|
-
|
|
52
|
-
const disabled = node.disabled
|
|
53
|
-
if (disabled) html += ' disabled'
|
|
54
|
-
|
|
55
|
-
const maxlength = node.maxlength
|
|
56
|
-
if (maxlength) html += ` maxlength="${tool.escapeForHtmlGeneration(maxlength)}"`
|
|
57
|
-
|
|
58
|
-
const placeholder = node.placeholder
|
|
59
|
-
if (placeholder) html += ` placeholder="${tool.escapeForHtmlGeneration(placeholder.replace(/"/g, '\\"'))}"`
|
|
60
|
-
|
|
61
|
-
return html
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* 调用 outerHTML 的 setter 时用于处理额外的属性
|
|
66
|
-
*/
|
|
67
|
-
$$dealWithAttrsForOuterHTML(node) {
|
|
68
|
-
this.name = node.name || ''
|
|
69
|
-
this.type = node.type || ''
|
|
70
|
-
this.value = node.value || ''
|
|
71
|
-
this.disabled = !!node.disabled
|
|
72
|
-
this.maxlength = node.maxlength
|
|
73
|
-
this.placeholder = node.placeholder || ''
|
|
74
|
-
|
|
75
|
-
// 特殊字段
|
|
76
|
-
this.mpplaceholderclass = node.mpplaceholderclass || ''
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* 调用 cloneNode 接口时用于处理额外的属性
|
|
81
|
-
*/
|
|
82
|
-
$$dealWithAttrsForCloneNode() {
|
|
83
|
-
return {
|
|
84
|
-
type: this.type,
|
|
85
|
-
value: this.value,
|
|
86
|
-
disabled: this.disabled,
|
|
87
|
-
maxlength: this.maxlength,
|
|
88
|
-
placeholder: this.placeholder,
|
|
89
|
-
|
|
90
|
-
// 特殊字段
|
|
91
|
-
mpplaceholderclass: this.mpplaceholderclass,
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* 对外属性和方法
|
|
97
|
-
*/
|
|
98
|
-
get type() {
|
|
99
|
-
return this.$_attrs.get('type') || 'textarea'
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
set type(value) {
|
|
103
|
-
value = '' + value
|
|
104
|
-
this.$_attrs.set('type', value)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
get value() {
|
|
108
|
-
return this.$_attrs.get('value')
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
set value(value) {
|
|
112
|
-
value = '' + value
|
|
113
|
-
this.$_attrs.set('value', value)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
get disabled() {
|
|
117
|
-
return !!this.$_attrs.get('disabled')
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
set disabled(value) {
|
|
121
|
-
value = !!value
|
|
122
|
-
this.$_attrs.set('disabled', value)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
get maxlength() {
|
|
126
|
-
return this.$_attrs.get('maxlength')
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
set maxlength(value) {
|
|
130
|
-
this.$_attrs.set('maxlength', value)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
get placeholder() {
|
|
134
|
-
return this.$_attrs.get('placeholder') || ''
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
set placeholder(value) {
|
|
138
|
-
value = '' + value
|
|
139
|
-
this.$_attrs.set('placeholder', value)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
get autofocus() {
|
|
143
|
-
return !!this.$_attrs.get('autofocus')
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
set autofocus(value) {
|
|
147
|
-
value = !!value
|
|
148
|
-
this.$_attrs.set('autofocus', value)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
get selectionStart() {
|
|
152
|
-
const value = +this.$_attrs.get('selection-start')
|
|
153
|
-
return value !== undefined ? value : -1
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
set selectionStart(value) {
|
|
157
|
-
this.$_attrs.set('selection-start', value)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
get selectionEnd() {
|
|
161
|
-
const value = +this.$_attrs.get('selection-end')
|
|
162
|
-
return value !== undefined ? value : -1
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
set selectionEnd(value) {
|
|
166
|
-
this.$_attrs.set('selection-end', value)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
focus() {
|
|
170
|
-
this.$_attrs.set('focus', true)
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
blur() {
|
|
174
|
-
this.$_attrs.set('focus', false)
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
module.exports = HTMLTextAreaElement
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
const Element = require('../element')
|
|
2
|
-
const Pool = require('../../util/pool')
|
|
3
|
-
const cache = require('../../util/cache')
|
|
4
|
-
|
|
5
|
-
const pool = new Pool()
|
|
6
|
-
|
|
7
|
-
class HTMLVideoElement extends Element {
|
|
8
|
-
/**
|
|
9
|
-
* 创建实例
|
|
10
|
-
*/
|
|
11
|
-
static $$create(options, tree) {
|
|
12
|
-
const config = cache.getConfig()
|
|
13
|
-
|
|
14
|
-
if (config.optimization.elementMultiplexing) {
|
|
15
|
-
// 复用 element 节点
|
|
16
|
-
const instance = pool.get()
|
|
17
|
-
|
|
18
|
-
if (instance) {
|
|
19
|
-
instance.$$init(options, tree)
|
|
20
|
-
return instance
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return new HTMLVideoElement(options, tree)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 覆写父类的 $$init 方法
|
|
29
|
-
*/
|
|
30
|
-
$$init(options, tree) {
|
|
31
|
-
const width = options.width
|
|
32
|
-
const height = options.height
|
|
33
|
-
|
|
34
|
-
if (typeof width === 'number' && width >= 0) options.attrs.width = width
|
|
35
|
-
if (typeof height === 'number' && height >= 0) options.attrs.height = height
|
|
36
|
-
|
|
37
|
-
super.$$init(options, tree)
|
|
38
|
-
|
|
39
|
-
this.$_initRect()
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* 覆写父类的回收实例方法
|
|
44
|
-
*/
|
|
45
|
-
$$recycle() {
|
|
46
|
-
this.$$destroy()
|
|
47
|
-
|
|
48
|
-
const config = cache.getConfig()
|
|
49
|
-
|
|
50
|
-
if (config.optimization.elementMultiplexing) {
|
|
51
|
-
// 复用 element 节点
|
|
52
|
-
pool.add(this)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* 更新父组件树
|
|
58
|
-
*/
|
|
59
|
-
$_triggerParentUpdate() {
|
|
60
|
-
this.$_initRect()
|
|
61
|
-
super.$_triggerParentUpdate()
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* 初始化长宽
|
|
66
|
-
*/
|
|
67
|
-
$_initRect() {
|
|
68
|
-
const width = parseInt(this.$_attrs.get('width'), 10)
|
|
69
|
-
const height = parseInt(this.$_attrs.get('height'), 10)
|
|
70
|
-
|
|
71
|
-
if (typeof width === 'number' && width >= 0) this.$_style.width = `${width}px`
|
|
72
|
-
if (typeof height === 'number' && height >= 0) this.$_style.height = `${height}px`
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 对外属性和方法
|
|
77
|
-
*/
|
|
78
|
-
get src() {
|
|
79
|
-
return this.$_attrs.get('src') || ''
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
set src(value) {
|
|
83
|
-
if (!value || typeof value !== 'string') return
|
|
84
|
-
|
|
85
|
-
this.$_attrs.set('src', value)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
get width() {
|
|
89
|
-
return +this.$_attrs.get('width') || 0
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
set width(value) {
|
|
93
|
-
if (typeof value !== 'number' || !isFinite(value) || value < 0) return
|
|
94
|
-
|
|
95
|
-
this.$_attrs.set('width', value)
|
|
96
|
-
this.$_initRect()
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
get height() {
|
|
100
|
-
return +this.$_attrs.get('height') || 0
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
set height(value) {
|
|
104
|
-
if (typeof value !== 'number' || !isFinite(value) || value < 0) return
|
|
105
|
-
|
|
106
|
-
this.$_attrs.set('height', value)
|
|
107
|
-
this.$_initRect()
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
get autoplay() {
|
|
111
|
-
return !!this.$_attrs.get('autoplay')
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
set autoplay(value) {
|
|
115
|
-
value = !!value
|
|
116
|
-
this.$_attrs.set('autoplay', value)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
get loop() {
|
|
120
|
-
return !!this.$_attrs.get('loop')
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
set loop(value) {
|
|
124
|
-
value = !!value
|
|
125
|
-
this.$_attrs.set('loop', value)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
get muted() {
|
|
129
|
-
return !!this.$_attrs.get('muted')
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
set muted(value) {
|
|
133
|
-
value = !!value
|
|
134
|
-
this.$_attrs.set('muted', value)
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
get controls() {
|
|
138
|
-
const value = this.$_attrs.get('controls')
|
|
139
|
-
return value !== undefined ? !!value : true
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
set controls(value) {
|
|
143
|
-
this.$_attrs.set('controls', value)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
get poster() {
|
|
147
|
-
return this.$_attrs.get('poster')
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
set poster(value) {
|
|
151
|
-
if (!value || typeof value !== 'string') return
|
|
152
|
-
|
|
153
|
-
this.$_attrs.set('poster', value)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
get currentTime() {
|
|
157
|
-
return +this.$_attrs.get('currentTime') || 0
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
get buffered() {
|
|
161
|
-
return this.$_attrs.get('buffered')
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
module.exports = HTMLVideoElement
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
const Element = require('../element')
|
|
2
|
-
const Pool = require('../../util/pool')
|
|
3
|
-
const cache = require('../../util/cache')
|
|
4
|
-
|
|
5
|
-
const pool = new Pool()
|
|
6
|
-
|
|
7
|
-
class WxComponent extends Element {
|
|
8
|
-
/**
|
|
9
|
-
* 创建实例
|
|
10
|
-
*/
|
|
11
|
-
static $$create(options, tree) {
|
|
12
|
-
const config = cache.getConfig()
|
|
13
|
-
|
|
14
|
-
if (config.optimization.elementMultiplexing) {
|
|
15
|
-
// 复用 element 节点
|
|
16
|
-
const instance = pool.get()
|
|
17
|
-
|
|
18
|
-
if (instance) {
|
|
19
|
-
instance.$$init(options, tree)
|
|
20
|
-
return instance
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return new WxComponent(options, tree)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 覆写父类的回收实例方法
|
|
29
|
-
*/
|
|
30
|
-
$$recycle() {
|
|
31
|
-
this.$$destroy()
|
|
32
|
-
|
|
33
|
-
const config = cache.getConfig()
|
|
34
|
-
|
|
35
|
-
if (config.optimization.elementMultiplexing) {
|
|
36
|
-
// 复用 element 节点
|
|
37
|
-
pool.add(this)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get behavior() {
|
|
42
|
-
return this.$_attrs.get('behavior') || ''
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
set behavior(value) {
|
|
46
|
-
if (!value || typeof value !== 'string') return
|
|
47
|
-
|
|
48
|
-
this.$_attrs.set('behavior', value)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get value() {
|
|
52
|
-
return this.$_attrs.get('value')
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
set value(value) {
|
|
56
|
-
this.$_attrs.set('value', value)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get scrollTop() {
|
|
60
|
-
return this.$_attrs.get('scroll-top') || 0
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
set scrollTop(value) {
|
|
64
|
-
value = parseInt(value, 10)
|
|
65
|
-
|
|
66
|
-
if (!isNaN(value)) {
|
|
67
|
-
this.$_attrs.set('scroll-top', value)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
get scrollLeft() {
|
|
72
|
-
return this.$_attrs.get('scroll-left') || 0
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
set scrollLeft(value) {
|
|
76
|
-
value = parseInt(value, 10)
|
|
77
|
-
|
|
78
|
-
if (!isNaN(value)) {
|
|
79
|
-
this.$_attrs.set('scroll-left', value)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
module.exports = WxComponent
|
package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-custom-component.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const Element = require('../element')
|
|
2
|
-
const Pool = require('../../util/pool')
|
|
3
|
-
const cache = require('../../util/cache')
|
|
4
|
-
|
|
5
|
-
const pool = new Pool()
|
|
6
|
-
|
|
7
|
-
class WxCustomComponent extends Element {
|
|
8
|
-
/**
|
|
9
|
-
* 创建实例
|
|
10
|
-
*/
|
|
11
|
-
static $$create(options, tree) {
|
|
12
|
-
const config = cache.getConfig()
|
|
13
|
-
|
|
14
|
-
if (config.optimization.elementMultiplexing) {
|
|
15
|
-
// 复用 element 节点
|
|
16
|
-
const instance = pool.get()
|
|
17
|
-
|
|
18
|
-
if (instance) {
|
|
19
|
-
instance.$$init(options, tree)
|
|
20
|
-
return instance
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return new WxCustomComponent(options, tree)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 覆写父类的 $$init 方法
|
|
29
|
-
*/
|
|
30
|
-
$$init(options, tree) {
|
|
31
|
-
this.$_behavior = options.componentName
|
|
32
|
-
|
|
33
|
-
super.$$init(options, tree)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 覆写父类的 $$destroy 方法
|
|
38
|
-
*/
|
|
39
|
-
$$destroy() {
|
|
40
|
-
super.$$destroy()
|
|
41
|
-
|
|
42
|
-
this.$_behavior = null
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* 覆写父类的回收实例方法
|
|
47
|
-
*/
|
|
48
|
-
$$recycle() {
|
|
49
|
-
this.$$destroy()
|
|
50
|
-
|
|
51
|
-
const config = cache.getConfig()
|
|
52
|
-
|
|
53
|
-
if (config.optimization.elementMultiplexing) {
|
|
54
|
-
// 复用 element 节点
|
|
55
|
-
pool.add(this)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get behavior() {
|
|
60
|
-
return this.$_behavior
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
module.exports = WxCustomComponent
|