@tarojs/plugin-platform-harmony-ets 4.0.0-beta.3 → 4.0.0-beta.31
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/dist/apis/base/system.ts +53 -20
- package/dist/apis/canvas/index.ts +10 -1
- package/dist/apis/framework/index.ts +1 -5
- package/dist/apis/index.ts +27 -12
- package/dist/apis/network/request.ts +5 -5
- package/dist/apis/route/index.ts +15 -0
- package/dist/apis/storage/index.ts +205 -63
- package/dist/apis/ui/animation/animation.ts +2 -1
- package/dist/apis/utils/index.ts +1 -1
- package/dist/apis/wxml/IntersectionObserver.ts +18 -10
- package/dist/apis/wxml/index.ts +2 -0
- package/dist/components-harmony-ets/button.ets +50 -78
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +23 -209
- package/dist/components-harmony-ets/form.ets +44 -158
- package/dist/components-harmony-ets/icon.ets +38 -83
- package/dist/components-harmony-ets/image.ets +29 -78
- package/dist/components-harmony-ets/index.ets +53 -0
- package/dist/components-harmony-ets/innerHtml.ets +11 -6
- package/dist/components-harmony-ets/input.ets +11 -67
- package/dist/components-harmony-ets/label.ets +58 -172
- package/dist/components-harmony-ets/movableArea.ets +96 -0
- package/dist/components-harmony-ets/movableView.ets +74 -0
- package/dist/components-harmony-ets/picker.ets +32 -147
- package/dist/components-harmony-ets/progress.ets +54 -0
- package/dist/components-harmony-ets/pseudo.ets +80 -0
- package/dist/components-harmony-ets/radio.ets +23 -210
- package/dist/components-harmony-ets/richText.ets +22 -102
- package/dist/components-harmony-ets/scrollView.ets +73 -169
- package/dist/components-harmony-ets/slider.ets +11 -72
- package/dist/components-harmony-ets/style.ets +280 -0
- package/dist/components-harmony-ets/swiper.ets +37 -87
- package/dist/components-harmony-ets/switch.ets +11 -71
- package/dist/components-harmony-ets/text.ets +57 -89
- package/dist/components-harmony-ets/textArea.ets +11 -67
- package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +1 -1
- package/dist/components-harmony-ets/utils/flexManager.ets +11 -9
- package/dist/components-harmony-ets/utils/helper.ets +4 -5
- package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
- package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
- package/dist/components-harmony-ets/utils/index.ts +50 -51
- package/dist/components-harmony-ets/utils/styles.ets +167 -87
- package/dist/components-harmony-ets/video.ets +41 -89
- package/dist/components-harmony-ets/view.ets +53 -159
- package/dist/components-harmony-ets/webView.ets +44 -99
- package/dist/index.d.ts +151 -0
- package/dist/index.js +69 -32
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/window.ts +7 -0
- package/dist/runtime-ets/current.ts +3 -0
- package/dist/runtime-ets/dom/bind.ts +20 -6
- package/dist/runtime-ets/dom/cssNesting.ts +393 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +12 -40
- package/dist/runtime-ets/dom/document.ts +22 -8
- package/dist/runtime-ets/dom/element/canvas.ts +136 -0
- package/dist/runtime-ets/dom/element/element.ts +128 -51
- package/dist/runtime-ets/dom/element/form.ts +15 -18
- package/dist/runtime-ets/dom/element/index.ts +16 -3
- package/dist/runtime-ets/dom/element/movableArea.ts +12 -0
- package/dist/runtime-ets/dom/element/movableView.ts +193 -0
- package/dist/runtime-ets/dom/element/normal.ts +8 -3
- package/dist/runtime-ets/dom/element/progress.ts +12 -0
- package/dist/runtime-ets/dom/element/scrollView.ts +1 -0
- package/dist/runtime-ets/dom/element/text.ts +1 -8
- package/dist/runtime-ets/dom/element/video.ts +5 -3
- package/dist/runtime-ets/dom/element/webView.ts +8 -0
- package/dist/runtime-ets/dom/event.ts +0 -1
- package/dist/runtime-ets/dom/eventTarget.ts +0 -3
- package/dist/runtime-ets/dom/node.ts +29 -27
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +189 -211
- package/dist/runtime-ets/dom/stylesheet/index.ts +28 -308
- package/dist/runtime-ets/dom/stylesheet/type.ts +18 -6
- package/dist/runtime-ets/dom/stylesheet/util.ts +31 -25
- package/dist/runtime-ets/index.ts +2 -2
- package/dist/runtime-ets/interface/event.ts +1 -1
- package/dist/runtime-ets/utils/index.ts +43 -10
- package/dist/runtime-ets/utils/info.ts +1 -1
- package/dist/runtime-framework/react/app.ts +7 -2
- package/dist/runtime-framework/react/index.ts +0 -2
- package/dist/runtime-framework/react/native-page.ts +22 -12
- package/dist/runtime-framework/react/page.ts +3 -8
- package/dist/runtime-framework/solid/app.ts +25 -45
- package/dist/runtime-framework/solid/connect.ts +21 -3
- package/dist/runtime-framework/solid/hooks.ts +16 -11
- package/dist/runtime-framework/solid/index.ts +6 -2
- package/dist/runtime-framework/solid/page.ts +84 -30
- package/dist/runtime-framework/solid/reconciler/props.ts +65 -20
- package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
- package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
- package/dist/runtime-framework/solid/utils/index.ts +0 -2
- package/dist/runtime-utils.d.ts +827 -0
- package/dist/runtime-utils.js +273 -109
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +273 -109
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +13 -13
- package/types/index.d.ts +4 -0
- package/dist/runtime-ets/utils/bind.ts +0 -24
- /package/dist/components-harmony-ets/{index.ts → tag.ts} +0 -0
- /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
2
|
+
import { EMPTY_OBJ, toCamelCase } from '@tarojs/shared'
|
|
2
3
|
|
|
3
4
|
import { ATTRIBUTES_CALLBACK_TRIGGER_MAP, ID } from '../../constant'
|
|
4
5
|
import { findChildNodeWithDFS } from '../../utils'
|
|
5
6
|
import { initComponentNodeInfo, triggerAttributesCallback } from '../../utils/info'
|
|
6
7
|
import { bindAnimation } from '../bind'
|
|
7
8
|
import { ClassList } from '../class-list'
|
|
9
|
+
import { type ICSSStyleDeclaration, createCSSStyleDeclaration } from '../cssStyleDeclaration'
|
|
8
10
|
import { NodeType, TaroNode } from '../node'
|
|
9
|
-
import StyleSheet from '../stylesheet'
|
|
11
|
+
import StyleSheet, { HarmonyStyle } from '../stylesheet'
|
|
10
12
|
|
|
11
|
-
import type { StandardProps } from '@tarojs/components/types'
|
|
13
|
+
import type { BaseTouchEvent, ITouchEvent, StandardProps } from '@tarojs/components/types'
|
|
12
14
|
import type { TaroAny } from '../../utils'
|
|
13
|
-
import type { ICSSStyleDeclaration } from '../cssStyleDeclaration'
|
|
14
15
|
|
|
15
|
-
type NamedNodeMap =
|
|
16
|
+
type NamedNodeMap = { name: string, value: string }[]
|
|
16
17
|
|
|
17
18
|
export interface TaroExtraProps {
|
|
18
19
|
compileMode?: string | boolean
|
|
@@ -20,48 +21,49 @@ export interface TaroExtraProps {
|
|
|
20
21
|
disabled?: boolean
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
export class TaroElement<
|
|
25
|
+
T extends StandardProps<any, U> = StandardProps,
|
|
26
|
+
U extends BaseTouchEvent<any> = ITouchEvent
|
|
27
|
+
> extends TaroNode {
|
|
25
28
|
public _innerHTML = ''
|
|
29
|
+
public _instance: TaroAny
|
|
26
30
|
public _nodeInfo: TaroAny = {}
|
|
27
31
|
public readonly tagName: string
|
|
32
|
+
public dataset: Record<string, unknown> = EMPTY_OBJ
|
|
28
33
|
public _attrs: T & TaroExtraProps = {} as T & TaroExtraProps
|
|
29
34
|
|
|
30
|
-
_client?: Area
|
|
31
|
-
_scroll?: Area
|
|
32
|
-
|
|
33
35
|
constructor(tagName: string) {
|
|
34
36
|
super(tagName.replace(new RegExp('(?<=.)([A-Z])', 'g'), '-$1').toUpperCase(), NodeType.ELEMENT_NODE)
|
|
35
37
|
this.tagName = this.nodeName
|
|
36
|
-
|
|
38
|
+
this._style = createCSSStyleDeclaration(this)
|
|
37
39
|
initComponentNodeInfo(this)
|
|
38
40
|
bindAnimation(this)
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
public set id
|
|
43
|
+
public set id(value: string) {
|
|
42
44
|
this.setAttribute('id', value)
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
public get id
|
|
47
|
+
public get id(): string {
|
|
46
48
|
return this.getAttribute('id') || this._nid
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
public set className
|
|
51
|
+
public set className(value: string) {
|
|
50
52
|
this.setAttribute('class', value)
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
public get className
|
|
55
|
+
public get className(): string {
|
|
54
56
|
return this.getAttribute('class') || ''
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
public get classList
|
|
59
|
+
public get classList(): ClassList {
|
|
58
60
|
return new ClassList(this.className, this)
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
public get attributes
|
|
63
|
+
public get attributes(): NamedNodeMap {
|
|
62
64
|
const list: NamedNodeMap = []
|
|
63
65
|
|
|
64
|
-
Object.keys(this._attrs).forEach(name => {
|
|
66
|
+
Object.keys(this._attrs).forEach((name) => {
|
|
65
67
|
const value: TaroAny = this._attrs[name]
|
|
66
68
|
|
|
67
69
|
list.push({ name, value })
|
|
@@ -70,14 +72,24 @@ export class TaroElement<T extends StandardProps = StandardProps> extends TaroNo
|
|
|
70
72
|
return list
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
public get children
|
|
74
|
-
return this.childNodes.filter(node => node.nodeType === NodeType.ELEMENT_NODE) as TaroElement[]
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public setAttribute
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
public get children(): TaroElement[] {
|
|
76
|
+
return this.childNodes.filter((node) => node.nodeType === NodeType.ELEMENT_NODE) as TaroElement[]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public setAttribute(name: string, value: TaroAny): void {
|
|
80
|
+
switch (name) {
|
|
81
|
+
case ID:
|
|
82
|
+
eventSource.delete(this._attrs.id)
|
|
83
|
+
eventSource.set(value, this as TaroAny)
|
|
84
|
+
break
|
|
85
|
+
default:
|
|
86
|
+
if (name.startsWith('data-')) {
|
|
87
|
+
if (this.dataset === EMPTY_OBJ) {
|
|
88
|
+
this.dataset = Object.create(null)
|
|
89
|
+
}
|
|
90
|
+
this.dataset[toCamelCase(name.replace(/^data-/, ''))] = value
|
|
91
|
+
}
|
|
92
|
+
break
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
this._attrs[name] = value
|
|
@@ -93,50 +105,64 @@ export class TaroElement<T extends StandardProps = StandardProps> extends TaroNo
|
|
|
93
105
|
}
|
|
94
106
|
}
|
|
95
107
|
|
|
96
|
-
public getAttribute
|
|
108
|
+
public getAttribute(name: string): string {
|
|
97
109
|
return this._attrs[name]
|
|
98
110
|
}
|
|
99
111
|
|
|
100
|
-
public removeAttribute
|
|
112
|
+
public removeAttribute(name: string): void {
|
|
101
113
|
this._attrs[name] = null
|
|
102
114
|
}
|
|
103
115
|
|
|
104
|
-
public hasAttribute
|
|
116
|
+
public hasAttribute(name: string): boolean {
|
|
105
117
|
return !!this._attrs[name]
|
|
106
118
|
}
|
|
107
119
|
|
|
108
|
-
public hasAttributes
|
|
120
|
+
public hasAttributes(): boolean {
|
|
109
121
|
return Object.keys(this._attrs).length > 0
|
|
110
122
|
}
|
|
111
123
|
|
|
112
|
-
public getElementById<T extends TaroElement = TaroElement>
|
|
113
|
-
return findChildNodeWithDFS<T>(
|
|
114
|
-
|
|
115
|
-
|
|
124
|
+
public getElementById<T extends TaroElement = TaroElement>(id: string | undefined | null) {
|
|
125
|
+
return findChildNodeWithDFS<T>(
|
|
126
|
+
this as TaroAny,
|
|
127
|
+
(el) => {
|
|
128
|
+
return el.id === id
|
|
129
|
+
},
|
|
130
|
+
false
|
|
131
|
+
)
|
|
116
132
|
}
|
|
117
133
|
|
|
118
|
-
public getElementsByTagName<T extends TaroElement = TaroElement>
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
134
|
+
public getElementsByTagName<T extends TaroElement = TaroElement>(tagName: string) {
|
|
135
|
+
return (
|
|
136
|
+
findChildNodeWithDFS<T>(
|
|
137
|
+
this as TaroAny,
|
|
138
|
+
(el) => {
|
|
139
|
+
return el.nodeName === tagName || (tagName === '*' && (this as TaroAny) !== el)
|
|
140
|
+
},
|
|
141
|
+
true
|
|
142
|
+
) || []
|
|
143
|
+
)
|
|
122
144
|
}
|
|
123
145
|
|
|
124
|
-
public getElementsByClassName<T extends TaroElement = TaroElement>
|
|
146
|
+
public getElementsByClassName<T extends TaroElement = TaroElement>(className: string) {
|
|
125
147
|
const classNames = className.trim().split(new RegExp('\\s+'))
|
|
126
148
|
|
|
127
|
-
return
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
return (
|
|
150
|
+
findChildNodeWithDFS<T>(
|
|
151
|
+
this as TaroAny,
|
|
152
|
+
(el) => {
|
|
153
|
+
const classList = el.classList
|
|
154
|
+
return classNames.every((c) => {
|
|
155
|
+
const bool = classList.contains(c)
|
|
131
156
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
157
|
+
return bool
|
|
158
|
+
})
|
|
159
|
+
},
|
|
160
|
+
true
|
|
161
|
+
) || []
|
|
162
|
+
)
|
|
135
163
|
}
|
|
136
164
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
public set innerHTML (value: string) {
|
|
165
|
+
public set innerHTML(value: string) {
|
|
140
166
|
if (this.nodeType === NodeType.ELEMENT_NODE && this.ownerDocument) {
|
|
141
167
|
const ele = this.ownerDocument.createElement('inner-html')
|
|
142
168
|
ele._innerHTML = value
|
|
@@ -144,20 +170,71 @@ export class TaroElement<T extends StandardProps = StandardProps> extends TaroNo
|
|
|
144
170
|
}
|
|
145
171
|
}
|
|
146
172
|
|
|
147
|
-
public get innerHTML
|
|
173
|
+
public get innerHTML(): string {
|
|
148
174
|
return this._innerHTML
|
|
149
175
|
}
|
|
150
176
|
|
|
177
|
+
// 存放的样式,获取其实跟获取style是一样的,只不过这里取的更快捷,不需要走style的get方法进到cssStyleDeclaration
|
|
151
178
|
public _st = new StyleSheet()
|
|
152
179
|
|
|
153
180
|
// 经转换后的鸿蒙样式
|
|
154
|
-
public get hmStyle
|
|
181
|
+
public get hmStyle() {
|
|
155
182
|
return this._st.hmStyle
|
|
156
183
|
}
|
|
157
184
|
|
|
158
185
|
public _style: ICSSStyleDeclaration | null = null
|
|
159
186
|
|
|
160
|
-
public get style
|
|
187
|
+
public get style(): ICSSStyleDeclaration | null {
|
|
161
188
|
return this._style
|
|
162
189
|
}
|
|
190
|
+
|
|
191
|
+
// 伪元素,不存在style动态设置,均已被转换为鸿蒙样式
|
|
192
|
+
// 可根据实际情况,迁移到具体的组件中,如View、ScrollView中,Text\Image其实是不需要的
|
|
193
|
+
public _pseudo_before: StyleSheet | null = null
|
|
194
|
+
|
|
195
|
+
public set_pseudo_before(value: HarmonyStyle | null) {
|
|
196
|
+
if (value) {
|
|
197
|
+
if (!this._pseudo_before) {
|
|
198
|
+
this._pseudo_before = new StyleSheet()
|
|
199
|
+
}
|
|
200
|
+
Object.keys(value).forEach(key => {
|
|
201
|
+
this._pseudo_before!.hmStyle[key] = value[key]
|
|
202
|
+
})
|
|
203
|
+
} else {
|
|
204
|
+
this._pseudo_before = null
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
public _pseudo_after: StyleSheet | null = null
|
|
209
|
+
|
|
210
|
+
public set_pseudo_after(value: HarmonyStyle | null) {
|
|
211
|
+
if (value) {
|
|
212
|
+
if (!this._pseudo_after) {
|
|
213
|
+
this._pseudo_after = new StyleSheet()
|
|
214
|
+
}
|
|
215
|
+
Object.keys(value).forEach(key => {
|
|
216
|
+
this._pseudo_after!.hmStyle[key] = value[key]
|
|
217
|
+
})
|
|
218
|
+
} else {
|
|
219
|
+
this._pseudo_after = null
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// 伪类,在获取的时候根据dom和parent的关系,动态设置
|
|
224
|
+
public _pseudo_class: Record<string, StyleSheet | null> = {
|
|
225
|
+
// ["::first-child"]: new StyleSheet(),
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
public set_pseudo_class(name: string, value: HarmonyStyle | null) {
|
|
229
|
+
if (value) {
|
|
230
|
+
if (!this._pseudo_class[name]) {
|
|
231
|
+
this._pseudo_class[name] = new StyleSheet()
|
|
232
|
+
}
|
|
233
|
+
Object.keys(value).forEach(key => {
|
|
234
|
+
this._pseudo_class[name]!.hmStyle[key] = value[key]
|
|
235
|
+
})
|
|
236
|
+
} else {
|
|
237
|
+
this._pseudo_class[name] = null
|
|
238
|
+
}
|
|
239
|
+
}
|
|
163
240
|
}
|
|
@@ -29,14 +29,10 @@ interface FormWidgetProps extends StandardProps {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
class TaroFormWidgetElement<T extends FormWidgetProps = FormWidgetProps> extends TaroElement<T> {
|
|
32
|
-
_instance
|
|
33
|
-
|
|
34
32
|
_isInit = false
|
|
35
33
|
|
|
36
34
|
_name = ''
|
|
37
35
|
|
|
38
|
-
_value: TaroAny = ''
|
|
39
|
-
|
|
40
36
|
_reset: TaroAny = ''
|
|
41
37
|
|
|
42
38
|
constructor (tagName: string) {
|
|
@@ -45,7 +41,7 @@ class TaroFormWidgetElement<T extends FormWidgetProps = FormWidgetProps> extends
|
|
|
45
41
|
bindFocus(this)
|
|
46
42
|
|
|
47
43
|
this._name = this._attrs.name || ''
|
|
48
|
-
this._value = this._attrs.value || ''
|
|
44
|
+
this._nodeInfo._value = this._attrs.value || ''
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
public setAttribute (name: string, value: any): void {
|
|
@@ -66,11 +62,10 @@ class TaroFormWidgetElement<T extends FormWidgetProps = FormWidgetProps> extends
|
|
|
66
62
|
|
|
67
63
|
public set name (val: string) {
|
|
68
64
|
this.updateFormWidgetName(val)
|
|
69
|
-
this.updateComponent()
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
public get value () {
|
|
73
|
-
return this._value
|
|
68
|
+
return this._nodeInfo._value
|
|
74
69
|
}
|
|
75
70
|
|
|
76
71
|
public set value (val: TaroAny) {
|
|
@@ -78,8 +73,6 @@ class TaroFormWidgetElement<T extends FormWidgetProps = FormWidgetProps> extends
|
|
|
78
73
|
|
|
79
74
|
if (this._instance) {
|
|
80
75
|
this._instance.value = val
|
|
81
|
-
} else {
|
|
82
|
-
this.updateComponent()
|
|
83
76
|
}
|
|
84
77
|
}
|
|
85
78
|
|
|
@@ -89,7 +82,7 @@ class TaroFormWidgetElement<T extends FormWidgetProps = FormWidgetProps> extends
|
|
|
89
82
|
}
|
|
90
83
|
|
|
91
84
|
public updateFormWidgetValue (val: TaroAny) {
|
|
92
|
-
this._value = val
|
|
85
|
+
this._nodeInfo._value = val
|
|
93
86
|
this._attrs.value = val
|
|
94
87
|
}
|
|
95
88
|
|
|
@@ -121,7 +114,6 @@ class TaroCheckedElement<T extends StandardProps & { checked?: boolean } = Stand
|
|
|
121
114
|
|
|
122
115
|
set checked (val: boolean) {
|
|
123
116
|
this.updateCheckedValue(val)
|
|
124
|
-
this.updateComponent()
|
|
125
117
|
}
|
|
126
118
|
|
|
127
119
|
public updateCheckedValue (val: boolean) {
|
|
@@ -134,6 +126,7 @@ class TaroCheckedElement<T extends StandardProps & { checked?: boolean } = Stand
|
|
|
134
126
|
}
|
|
135
127
|
}
|
|
136
128
|
|
|
129
|
+
@Observed
|
|
137
130
|
class TaroInputElement<T extends FormWidgetProps = InputProps> extends TaroFormWidgetElement<T> {
|
|
138
131
|
_height = 0
|
|
139
132
|
|
|
@@ -193,7 +186,7 @@ class TaroInputElement<T extends FormWidgetProps = InputProps> extends TaroFormW
|
|
|
193
186
|
}
|
|
194
187
|
}
|
|
195
188
|
|
|
196
|
-
|
|
189
|
+
@Observed
|
|
197
190
|
class TaroTextAreaElement extends TaroInputElement<TextareaProps>{
|
|
198
191
|
controller: TextAreaController = new TextAreaController()
|
|
199
192
|
|
|
@@ -201,13 +194,14 @@ class TaroTextAreaElement extends TaroInputElement<TextareaProps>{
|
|
|
201
194
|
super('TextArea')
|
|
202
195
|
}
|
|
203
196
|
}
|
|
204
|
-
|
|
197
|
+
@Observed
|
|
205
198
|
class TaroCheckboxElement extends TaroCheckedElement<CheckboxProps>{
|
|
206
199
|
constructor() {
|
|
207
200
|
super('Checkbox')
|
|
208
201
|
}
|
|
209
202
|
}
|
|
210
203
|
|
|
204
|
+
@Observed
|
|
211
205
|
class TaroRadioElement extends TaroCheckedElement<RadioProps>{
|
|
212
206
|
public group?: string
|
|
213
207
|
|
|
@@ -215,16 +209,16 @@ class TaroRadioElement extends TaroCheckedElement<RadioProps>{
|
|
|
215
209
|
super('Radio')
|
|
216
210
|
}
|
|
217
211
|
}
|
|
218
|
-
class TaroSliderElement extends TaroFormWidgetElement<SliderProps> {
|
|
219
|
-
_value = 0
|
|
220
212
|
|
|
213
|
+
@Observed
|
|
214
|
+
class TaroSliderElement extends TaroFormWidgetElement<SliderProps> {
|
|
221
215
|
constructor() {
|
|
222
216
|
super('Slider')
|
|
223
217
|
|
|
224
|
-
this._value = Number(this._attrs.value || 0)
|
|
218
|
+
this._nodeInfo._value = Number(this._attrs.value || 0)
|
|
225
219
|
}
|
|
226
220
|
}
|
|
227
|
-
|
|
221
|
+
@Observed
|
|
228
222
|
class TaroPickerElement extends TaroFormWidgetElement<PickerSelectorProps | PickerTimeProps | PickerDateProps | PickerMultiSelectorProps> {
|
|
229
223
|
constructor() {
|
|
230
224
|
super('Picker')
|
|
@@ -273,12 +267,13 @@ class TaroPickerElement extends TaroFormWidgetElement<PickerSelectorProps | Pick
|
|
|
273
267
|
}
|
|
274
268
|
}
|
|
275
269
|
|
|
270
|
+
@Observed
|
|
276
271
|
class TaroSwitchElement extends TaroCheckedElement<SwitchProps> {
|
|
277
272
|
constructor() {
|
|
278
273
|
super('Switch')
|
|
279
274
|
}
|
|
280
275
|
}
|
|
281
|
-
|
|
276
|
+
@Observed
|
|
282
277
|
class TaroCheckboxGroupElement extends TaroFormWidgetElement<CheckboxGroupProps> {
|
|
283
278
|
constructor() {
|
|
284
279
|
super('CheckboxGroup')
|
|
@@ -304,6 +299,7 @@ class TaroCheckboxGroupElement extends TaroFormWidgetElement<CheckboxGroupProps>
|
|
|
304
299
|
}
|
|
305
300
|
}
|
|
306
301
|
|
|
302
|
+
@Observed
|
|
307
303
|
class TaroRadioGroupElement extends TaroFormWidgetElement<RadioGroupProps> {
|
|
308
304
|
constructor() {
|
|
309
305
|
super('RadioGroup')
|
|
@@ -329,6 +325,7 @@ class TaroRadioGroupElement extends TaroFormWidgetElement<RadioGroupProps> {
|
|
|
329
325
|
}
|
|
330
326
|
}
|
|
331
327
|
|
|
328
|
+
@Observed
|
|
332
329
|
class TaroFormElement extends TaroFormWidgetElement {
|
|
333
330
|
constructor() {
|
|
334
331
|
super('Form')
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Current } from '../../current'
|
|
2
2
|
import { TaroTextNode } from '../node'
|
|
3
|
+
import { TaroCanvasElement } from './canvas'
|
|
3
4
|
import { TaroElement } from './element'
|
|
4
5
|
import {
|
|
5
6
|
FormElement,
|
|
@@ -14,6 +15,8 @@ import {
|
|
|
14
15
|
TaroSwitchElement,
|
|
15
16
|
TaroTextAreaElement
|
|
16
17
|
} from './form'
|
|
18
|
+
import { TaroMovableAreaElement } from './movableArea'
|
|
19
|
+
import { TaroMovableViewElement } from './movableView'
|
|
17
20
|
import {
|
|
18
21
|
TaroButtonElement,
|
|
19
22
|
TaroIconElement,
|
|
@@ -24,10 +27,11 @@ import {
|
|
|
24
27
|
TaroSwiperItemElement,
|
|
25
28
|
TaroViewElement
|
|
26
29
|
} from './normal'
|
|
30
|
+
import { TaroProgressElement } from './progress'
|
|
27
31
|
import { TaroScrollViewElement } from './scrollView'
|
|
28
32
|
import { TaroTextElement } from './text'
|
|
29
33
|
import { TaroVideoElement } from './video'
|
|
30
|
-
import { TaroWebViewElement } from './webView'
|
|
34
|
+
import { TaroInnerHtmlElement, TaroWebViewElement } from './webView'
|
|
31
35
|
|
|
32
36
|
export function initHarmonyElement () {
|
|
33
37
|
Current.createHarmonyElement = (tagName: string) => {
|
|
@@ -36,6 +40,9 @@ export function initHarmonyElement () {
|
|
|
36
40
|
case 'image': return new TaroImageElement()
|
|
37
41
|
case 'text': return new TaroTextElement()
|
|
38
42
|
case 'button': return new TaroButtonElement()
|
|
43
|
+
case 'movable-area': return new TaroMovableAreaElement()
|
|
44
|
+
case 'movable-view': return new TaroMovableViewElement()
|
|
45
|
+
case 'progress': return new TaroProgressElement()
|
|
39
46
|
case 'scroll-view': return new TaroScrollViewElement()
|
|
40
47
|
case 'checkbox-group': return new TaroCheckboxGroupElement()
|
|
41
48
|
case 'input': return new TaroInputElement()
|
|
@@ -49,11 +56,13 @@ export function initHarmonyElement () {
|
|
|
49
56
|
case 'icon': return new TaroIconElement()
|
|
50
57
|
case 'label': return new TaroLabelElement()
|
|
51
58
|
case 'rich-text': return new TaroRichTextElement()
|
|
59
|
+
case 'canvas': return new TaroCanvasElement()
|
|
52
60
|
case 'swiper': return new TaroSwiperElement()
|
|
53
61
|
case 'swiper-item': return new TaroSwiperItemElement()
|
|
54
62
|
case 'textarea': return new TaroTextAreaElement()
|
|
55
63
|
case 'form': return new TaroFormElement()
|
|
56
64
|
case 'web-view': return new TaroWebViewElement()
|
|
65
|
+
case 'inner-html': return new TaroInnerHtmlElement()
|
|
57
66
|
default: return new TaroElement(tagName)
|
|
58
67
|
}
|
|
59
68
|
}
|
|
@@ -67,15 +76,20 @@ export function initHarmonyElement () {
|
|
|
67
76
|
export {
|
|
68
77
|
FormElement,
|
|
69
78
|
TaroButtonElement,
|
|
79
|
+
TaroCanvasElement,
|
|
70
80
|
TaroCheckboxElement,
|
|
71
81
|
TaroCheckboxGroupElement,
|
|
72
82
|
TaroElement,
|
|
73
83
|
TaroFormElement,
|
|
74
84
|
TaroIconElement,
|
|
75
85
|
TaroImageElement,
|
|
86
|
+
TaroInnerHtmlElement,
|
|
76
87
|
TaroInputElement,
|
|
77
88
|
TaroLabelElement,
|
|
89
|
+
TaroMovableAreaElement,
|
|
90
|
+
TaroMovableViewElement,
|
|
78
91
|
TaroPickerElement,
|
|
92
|
+
TaroProgressElement,
|
|
79
93
|
TaroRadioElement,
|
|
80
94
|
TaroRadioGroupElement,
|
|
81
95
|
TaroRichTextElement,
|
|
@@ -88,5 +102,4 @@ export {
|
|
|
88
102
|
TaroTextElement,
|
|
89
103
|
TaroVideoElement,
|
|
90
104
|
TaroViewElement,
|
|
91
|
-
TaroWebViewElement
|
|
92
|
-
}
|
|
105
|
+
TaroWebViewElement }
|