@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,138 +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 HTMLCanvasElement 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 HTMLCanvasElement(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.$_node = null
|
|
40
|
-
|
|
41
|
-
this.$_initRect()
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 覆写父类的回收实例方法
|
|
46
|
-
*/
|
|
47
|
-
$$recycle() {
|
|
48
|
-
this.$$destroy()
|
|
49
|
-
|
|
50
|
-
const config = cache.getConfig()
|
|
51
|
-
|
|
52
|
-
if (config.optimization.elementMultiplexing) {
|
|
53
|
-
// 复用 element 节点
|
|
54
|
-
pool.add(this)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 准备 canvas 节点
|
|
60
|
-
*/
|
|
61
|
-
$$prepare() {
|
|
62
|
-
return new Promise((resolve, reject) => {
|
|
63
|
-
this.$$getNodesRef().then(nodesRef => nodesRef.node(res => {
|
|
64
|
-
this.$_node = res.node
|
|
65
|
-
|
|
66
|
-
// 设置 canvas 宽高
|
|
67
|
-
this.$_node.width = this.width
|
|
68
|
-
this.$_node.height = this.height
|
|
69
|
-
|
|
70
|
-
resolve(this)
|
|
71
|
-
}).exec()).catch(reject)
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
get $$node() {
|
|
76
|
-
return this.$_node
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* 更新父组件树
|
|
81
|
-
*/
|
|
82
|
-
$_triggerParentUpdate() {
|
|
83
|
-
this.$_initRect()
|
|
84
|
-
super.$_triggerParentUpdate()
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* 初始化长宽
|
|
89
|
-
*/
|
|
90
|
-
$_initRect() {
|
|
91
|
-
const width = parseInt(this.$_attrs.get('width'), 10)
|
|
92
|
-
const height = parseInt(this.$_attrs.get('height'), 10)
|
|
93
|
-
|
|
94
|
-
if (typeof width === 'number' && width >= 0) {
|
|
95
|
-
this.$_style.width = `${width}px`
|
|
96
|
-
}
|
|
97
|
-
if (typeof height === 'number' && height >= 0) {
|
|
98
|
-
this.$_style.height = `${height}px`
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* 对外属性和方法
|
|
104
|
-
*/
|
|
105
|
-
get width() {
|
|
106
|
-
if (this.$_node) return this.$_node.width
|
|
107
|
-
else return +this.$_attrs.get('width') || 0
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
set width(value) {
|
|
111
|
-
if (typeof value !== 'number' || !isFinite(value) || value < 0) return
|
|
112
|
-
|
|
113
|
-
if (this.$_node) this.$_node.width = value
|
|
114
|
-
else this.$_attrs.set('width', value)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
get height() {
|
|
118
|
-
if (this.$_node) return this.$_node.height
|
|
119
|
-
else return +this.$_attrs.get('height') || 0
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
set height(value) {
|
|
123
|
-
if (typeof value !== 'number' || !isFinite(value) || value < 0) return
|
|
124
|
-
|
|
125
|
-
if (this.$_node) this.$_node.height = value
|
|
126
|
-
else this.$_attrs.set('height', value)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
getContext(type) {
|
|
130
|
-
if (!this.$_node) {
|
|
131
|
-
console.warn('canvas is not prepared, please call $$prepare method first')
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
return this.$_node.getContext(type)
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
module.exports = HTMLCanvasElement
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
const Element = require('../element')
|
|
2
|
-
const Event = require('../../event/event')
|
|
3
|
-
const Pool = require('../../util/pool')
|
|
4
|
-
const cache = require('../../util/cache')
|
|
5
|
-
|
|
6
|
-
const pool = new Pool()
|
|
7
|
-
|
|
8
|
-
class Image 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 Image(options, tree)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 覆写父类的 $$init 方法
|
|
30
|
-
*/
|
|
31
|
-
$$init(options, tree) {
|
|
32
|
-
const width = options.width
|
|
33
|
-
const height = options.height
|
|
34
|
-
|
|
35
|
-
if (typeof width === 'number' && width >= 0) options.attrs.width = width
|
|
36
|
-
if (typeof height === 'number' && height >= 0) options.attrs.height = height
|
|
37
|
-
|
|
38
|
-
super.$$init(options, tree)
|
|
39
|
-
|
|
40
|
-
this.$_naturalWidth = 0
|
|
41
|
-
this.$_naturalHeight = 0
|
|
42
|
-
|
|
43
|
-
this.$_initRect()
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 覆写父类的 $$destroy 方法
|
|
48
|
-
*/
|
|
49
|
-
$$destroy() {
|
|
50
|
-
super.$$destroy()
|
|
51
|
-
|
|
52
|
-
this.$_naturalWidth = null
|
|
53
|
-
this.$_naturalHeight = null
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* 覆写父类的回收实例方法
|
|
58
|
-
*/
|
|
59
|
-
$$recycle() {
|
|
60
|
-
this.$$destroy()
|
|
61
|
-
|
|
62
|
-
const config = cache.getConfig()
|
|
63
|
-
|
|
64
|
-
if (config.optimization.elementMultiplexing) {
|
|
65
|
-
// 复用 element 节点
|
|
66
|
-
pool.add(this)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* 更新父组件树
|
|
72
|
-
*/
|
|
73
|
-
$_triggerParentUpdate() {
|
|
74
|
-
this.$_initRect()
|
|
75
|
-
super.$_triggerParentUpdate()
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* 初始化长宽
|
|
80
|
-
*/
|
|
81
|
-
$_initRect() {
|
|
82
|
-
const width = parseInt(this.$_attrs.get('width'), 10)
|
|
83
|
-
const height = parseInt(this.$_attrs.get('height'), 10)
|
|
84
|
-
|
|
85
|
-
if (typeof width === 'number' && width >= 0) this.$_style.width = `${width}px`
|
|
86
|
-
if (typeof height === 'number' && height >= 0) this.$_style.height = `${height}px`
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* 重置长宽
|
|
91
|
-
*/
|
|
92
|
-
$_resetRect(rect = {}) {
|
|
93
|
-
this.$_naturalWidth = rect.width || 0
|
|
94
|
-
this.$_naturalHeight = rect.height || 0
|
|
95
|
-
|
|
96
|
-
this.$_initRect()
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* 对外属性和方法
|
|
101
|
-
*/
|
|
102
|
-
get src() {
|
|
103
|
-
return this.$_attrs.get('src') || ''
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
set src(value) {
|
|
107
|
-
if (!value || typeof value !== 'string') return
|
|
108
|
-
|
|
109
|
-
this.$_attrs.set('src', value)
|
|
110
|
-
|
|
111
|
-
setTimeout(() => {
|
|
112
|
-
wx.getImageInfo({
|
|
113
|
-
src: this.src,
|
|
114
|
-
success: res => {
|
|
115
|
-
// 加载成功,调整图片的宽高
|
|
116
|
-
this.$_resetRect(res)
|
|
117
|
-
|
|
118
|
-
// 触发 load 事件
|
|
119
|
-
this.$$trigger('load', {
|
|
120
|
-
event: new Event({
|
|
121
|
-
name: 'load',
|
|
122
|
-
target: this,
|
|
123
|
-
eventPhase: Event.AT_TARGET
|
|
124
|
-
}),
|
|
125
|
-
currentTarget: this,
|
|
126
|
-
})
|
|
127
|
-
},
|
|
128
|
-
fail: () => {
|
|
129
|
-
// 加载失败,调整图片的宽高
|
|
130
|
-
this.$_resetRect({width: 0, height: 0})
|
|
131
|
-
|
|
132
|
-
// 触发 error 事件
|
|
133
|
-
this.$$trigger('error', {
|
|
134
|
-
event: new Event({
|
|
135
|
-
name: 'error',
|
|
136
|
-
target: this,
|
|
137
|
-
eventPhase: Event.AT_TARGET
|
|
138
|
-
}),
|
|
139
|
-
currentTarget: this,
|
|
140
|
-
})
|
|
141
|
-
},
|
|
142
|
-
})
|
|
143
|
-
}, 0)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
get width() {
|
|
147
|
-
return +this.$_attrs.get('width') || 0
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
set width(value) {
|
|
151
|
-
if (typeof value !== 'number' || !isFinite(value) || value < 0) return
|
|
152
|
-
|
|
153
|
-
this.$_attrs.set('width', value)
|
|
154
|
-
this.$_initRect()
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
get height() {
|
|
158
|
-
return +this.$_attrs.get('height') || 0
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
set height(value) {
|
|
162
|
-
if (typeof value !== 'number' || !isFinite(value) || value < 0) return
|
|
163
|
-
|
|
164
|
-
this.$_attrs.set('height', value)
|
|
165
|
-
this.$_initRect()
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
get naturalWidth() {
|
|
169
|
-
return this.$_naturalWidth
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
get naturalHeight() {
|
|
173
|
-
return this.$_naturalHeight
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
module.exports = Image
|
|
@@ -1,181 +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 HTMLInputElement 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 HTMLInputElement(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)}"`
|
|
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 name() {
|
|
99
|
-
return this.$_attrs.get('name')
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
set name(value) {
|
|
103
|
-
value = '' + value
|
|
104
|
-
this.$_attrs.set('name', value)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
get type() {
|
|
108
|
-
return this.$_attrs.get('type') || 'text'
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
set type(value) {
|
|
112
|
-
value = '' + value
|
|
113
|
-
this.$_attrs.set('type', value)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
get value() {
|
|
117
|
-
const type = this.$_attrs.get('type')
|
|
118
|
-
const value = this.$_attrs.get('value')
|
|
119
|
-
|
|
120
|
-
if ((type === 'radio' || type === 'checkbox') && value === undefined) return 'on'
|
|
121
|
-
return value
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
set value(value) {
|
|
125
|
-
value = '' + value
|
|
126
|
-
this.$_attrs.set('value', value)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
get disabled() {
|
|
130
|
-
return !!this.$_attrs.get('disabled')
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
set disabled(value) {
|
|
134
|
-
value = !!value
|
|
135
|
-
this.$_attrs.set('disabled', value)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
get maxlength() {
|
|
139
|
-
return this.$_attrs.get('maxlength')
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
set maxlength(value) {
|
|
143
|
-
this.$_attrs.set('maxlength', value)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
get placeholder() {
|
|
147
|
-
return this.$_attrs.get('placeholder') || ''
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
set placeholder(value) {
|
|
151
|
-
value = '' + value
|
|
152
|
-
this.$_attrs.set('placeholder', value)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
get autofocus() {
|
|
156
|
-
return !!this.$_attrs.get('autofocus')
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
set autofocus(value) {
|
|
160
|
-
value = !!value
|
|
161
|
-
this.$_attrs.set('autofocus', value)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
set checked(value) {
|
|
165
|
-
this.$_attrs.set('checked', value)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
get checked() {
|
|
169
|
-
return this.$_attrs.get('checked') || ''
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
focus() {
|
|
173
|
-
this.$_attrs.set('focus', true)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
blur() {
|
|
177
|
-
this.$_attrs.set('focus', false)
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
module.exports = HTMLInputElement
|
|
@@ -1,60 +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 NotSupport 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 NotSupport(options, tree)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 覆写父类的 $$init 方法
|
|
29
|
-
*/
|
|
30
|
-
$$init(options, tree) {
|
|
31
|
-
super.$$init(options, tree)
|
|
32
|
-
|
|
33
|
-
// 处理特殊节点
|
|
34
|
-
const window = cache.getWindow(this.$_pageId)
|
|
35
|
-
if (window.onDealWithNotSupportDom) window.onDealWithNotSupportDom(this)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* 覆写父类的 $$destroy 方法
|
|
40
|
-
*/
|
|
41
|
-
$$destroy() {
|
|
42
|
-
super.$$destroy()
|
|
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
|
-
|
|
60
|
-
module.exports = NotSupport
|
|
@@ -1,126 +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 HTMLOptionElement 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 HTMLOptionElement(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
|
-
* 覆写父类的 $$init 方法
|
|
44
|
-
*/
|
|
45
|
-
$$init(options, tree) {
|
|
46
|
-
super.$$init(options, tree)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 调用 $_generateHtml 接口时用于处理额外的属性,
|
|
51
|
-
*/
|
|
52
|
-
$$dealWithAttrsForGenerateHtml(html, node) {
|
|
53
|
-
const value = node.value
|
|
54
|
-
if (value) html += ` value="${tool.tool.escapeForHtmlGeneration(value)}"`
|
|
55
|
-
|
|
56
|
-
const label = node.label
|
|
57
|
-
if (label) html += ` label="${tool.tool.escapeForHtmlGeneration(label)}"`
|
|
58
|
-
|
|
59
|
-
const selected = node.selected
|
|
60
|
-
if (selected) html += ' selected'
|
|
61
|
-
|
|
62
|
-
return html
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* 调用 outerHTML 的 setter 时用于处理额外的属性
|
|
67
|
-
*/
|
|
68
|
-
$$dealWithAttrsForOuterHTML(node) {
|
|
69
|
-
this.label = node.label || ''
|
|
70
|
-
this.value = node.value || ''
|
|
71
|
-
this.disabled = !!node.disabled
|
|
72
|
-
this.selected = !!node.selected
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 更新 selected,不触发 select 的更新
|
|
77
|
-
*/
|
|
78
|
-
$$updateSelected(value) {
|
|
79
|
-
value = !!value
|
|
80
|
-
this.$_attrs.set('selected', value)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
get label() {
|
|
84
|
-
return this.$_attrs.get('label') || this.textContent
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
set label(value) {
|
|
88
|
-
value = '' + value
|
|
89
|
-
this.$_attrs.set('label', value)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
get value() {
|
|
93
|
-
const value = this.$_attrs.get('value')
|
|
94
|
-
return value !== undefined ? value : this.label
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
set value(value) {
|
|
98
|
-
value = '' + value
|
|
99
|
-
this.$_attrs.set('value', value)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
get disabled() {
|
|
103
|
-
return !!this.$_attrs.get('disabled')
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
set disabled(value) {
|
|
107
|
-
value = !!value
|
|
108
|
-
this.$_attrs.set('disabled', value)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
set selected(value) {
|
|
112
|
-
this.$$updateSelected(value)
|
|
113
|
-
|
|
114
|
-
// 同步更新 select 的 selectedIndex 和 value,只考虑父亲节点中 select
|
|
115
|
-
const parentNode = this.parentNode
|
|
116
|
-
if (parentNode && parentNode.tagName === 'SELECT') {
|
|
117
|
-
parentNode.value = this.value
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
get selected() {
|
|
122
|
-
return !!this.$_attrs.get('selected')
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
module.exports = HTMLOptionElement
|