@tarojs/plugin-platform-harmony-ets 3.7.0-alpha.27 → 4.0.0-alpha.10
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/apis.ts +6 -2
- package/dist/apis/base/crypto.ts +4 -0
- package/dist/apis/base/debug.ts +5 -0
- package/dist/apis/base/index.ts +9 -1
- package/dist/apis/base/performance.ts +8 -0
- package/dist/apis/base/system.ts +74 -21
- package/dist/apis/base/update.ts +5 -0
- package/dist/apis/base/weapp/app-event.ts +75 -0
- package/dist/apis/base/weapp/life-cycle.ts +21 -0
- package/dist/apis/canvas/index.ts +27 -0
- package/dist/apis/data-analysis/index.ts +6 -0
- package/dist/apis/device/accelerometer.ts +2 -1
- package/dist/apis/device/accessibility.ts +4 -0
- package/dist/apis/device/battery.ts +2 -2
- package/dist/apis/device/bluetooth-ble.ts +19 -0
- package/dist/apis/device/bluetooth-peripheral.ts +6 -0
- package/dist/apis/device/bluetooth.ts +16 -0
- package/dist/apis/device/calendar.ts +5 -0
- package/dist/apis/device/clipboard.ts +17 -9
- package/dist/apis/device/compass.ts +21 -0
- package/dist/apis/device/contact.ts +5 -0
- package/dist/apis/device/crypto.ts +4 -0
- package/dist/apis/device/gyroscope.ts +7 -0
- package/dist/apis/device/iBeacon.ts +10 -0
- package/dist/apis/device/index.ts +15 -0
- package/dist/apis/device/keyboard.ts +2 -1
- package/dist/apis/device/memory.ts +10 -3
- package/dist/apis/device/motion.ts +6 -0
- package/dist/apis/device/network.ts +26 -9
- package/dist/apis/device/nfc.ts +10 -0
- package/dist/apis/device/phone.ts +2 -1
- package/dist/apis/device/scan.ts +4 -0
- package/dist/apis/device/screen.ts +2 -1
- package/dist/apis/device/sms.ts +4 -0
- package/dist/apis/device/vibrate.ts +19 -11
- package/dist/apis/device/wifi.ts +15 -0
- package/dist/apis/ext/index.ts +5 -0
- package/dist/apis/files/index.ts +2 -1
- package/dist/apis/files/manager.ts +2 -1
- package/dist/apis/framework/index.ts +3 -8
- package/dist/apis/index.ts +27 -17
- package/dist/apis/location/index.ts +61 -68
- package/dist/apis/media/EditorContext.ts +32 -0
- package/dist/apis/media/audio/index.ts +18 -0
- package/dist/apis/media/background-audio/index.ts +16 -0
- package/dist/apis/media/camera.ts +16 -0
- package/dist/apis/media/common.ts +2 -1
- package/dist/apis/media/{image.ts → image/index.ts} +4 -3
- package/dist/apis/media/index.ts +10 -0
- package/dist/apis/media/live.ts +5 -0
- package/dist/apis/media/map.ts +4 -0
- package/dist/apis/media/media-recorder.ts +4 -0
- package/dist/apis/media/recorder.ts +6 -0
- package/dist/apis/media/video/VideoContext.ts +68 -0
- package/dist/apis/media/{video.ts → video/index.ts} +13 -2
- package/dist/apis/media/video-decoder.ts +4 -0
- package/dist/apis/media/video-processing.ts +4 -0
- package/dist/apis/media/voip.ts +19 -0
- package/dist/apis/network/index.ts +3 -0
- package/dist/apis/network/mdns.ts +13 -0
- package/dist/apis/network/request.ts +7 -6
- package/dist/apis/network/tcp.ts +4 -0
- package/dist/apis/network/udp.ts +4 -0
- package/dist/apis/network/webSocket.ts +2 -6
- package/dist/apis/open-api/account.ts +4 -0
- package/dist/apis/open-api/address.ts +4 -0
- package/dist/apis/open-api/authorize.ts +5 -0
- package/dist/apis/open-api/card.ts +5 -0
- package/dist/apis/open-api/channels-live.ts +11 -0
- package/dist/apis/open-api/customer-service.ts +4 -0
- package/dist/apis/open-api/device-voip.ts +5 -0
- package/dist/apis/open-api/facial.ts +7 -0
- package/dist/apis/open-api/favorites.ts +5 -0
- package/dist/apis/open-api/group.ts +4 -0
- package/dist/apis/open-api/index.ts +20 -6
- package/dist/apis/open-api/invoice.ts +5 -0
- package/dist/apis/open-api/license-plate.ts +4 -0
- package/dist/apis/open-api/login.ts +6 -0
- package/dist/apis/open-api/my-miniprogram.ts +4 -0
- package/dist/apis/open-api/privacy.ts +7 -0
- package/dist/apis/open-api/red-package.ts +4 -0
- package/dist/apis/open-api/settings.ts +5 -0
- package/dist/apis/open-api/soter.ts +6 -0
- package/dist/apis/open-api/subscribe-message.ts +6 -0
- package/dist/apis/open-api/{user-info/index.ts → user-info.ts} +1 -16
- package/dist/apis/open-api/werun.ts +5 -0
- package/dist/apis/payment/index.ts +6 -0
- package/dist/apis/route/index.ts +19 -28
- package/dist/apis/share/index.ts +33 -0
- package/dist/apis/storage/background-fetch.ts +7 -0
- package/dist/apis/storage/cache-manager.ts +4 -0
- package/dist/apis/storage/index.ts +158 -88
- package/dist/apis/ui/{animation.ts → animation/animation.ts} +73 -31
- package/dist/apis/ui/animation/index.ts +7 -0
- package/dist/apis/ui/background.ts +4 -19
- package/dist/apis/ui/custom-component.ts +8 -0
- package/dist/apis/ui/fonts.ts +4 -0
- package/dist/apis/ui/index.ts +8 -10
- package/dist/apis/ui/interaction/index.ts +45 -59
- package/dist/apis/ui/menu.ts +4 -0
- package/dist/apis/ui/navigation-bar/index.ts +60 -21
- package/dist/apis/ui/pull-down-refresh.ts +10 -4
- package/dist/apis/{page → ui/scroll}/index.ts +32 -27
- package/dist/apis/ui/sticky.ts +4 -0
- package/dist/apis/{tabbar/index.ts → ui/tab-bar.ts} +6 -8
- package/dist/apis/ui/window.ts +20 -0
- package/dist/apis/utils/handler.ts +4 -4
- package/dist/apis/utils/index.ts +1 -1
- package/dist/apis/worker/index.ts +4 -0
- package/dist/apis/wxml/IntersectionObserver.ts +24 -25
- package/dist/apis/wxml/index.ts +7 -2
- package/dist/apis/wxml/nodesRef.ts +2 -2
- package/dist/apis/wxml/selectorQuery.ts +29 -17
- package/dist/components-harmony-ets/button.ets +106 -80
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +82 -148
- package/dist/components-harmony-ets/form.ets +45 -132
- package/dist/components-harmony-ets/icon.ets +66 -69
- package/dist/components-harmony-ets/image.ets +26 -61
- package/dist/components-harmony-ets/index.ets +92 -0
- package/dist/components-harmony-ets/innerHtml.ets +7 -70
- package/dist/components-harmony-ets/input.ets +60 -146
- package/dist/components-harmony-ets/label.ets +86 -92
- package/dist/components-harmony-ets/listView.ets +26 -0
- package/dist/components-harmony-ets/movableArea.ets +124 -0
- package/dist/components-harmony-ets/movableView.ets +93 -0
- package/dist/components-harmony-ets/navigationBar.ets +65 -0
- package/dist/components-harmony-ets/pageMeta.ets +94 -0
- package/dist/components-harmony-ets/picker.ets +172 -198
- package/dist/components-harmony-ets/progress.ets +52 -0
- package/dist/components-harmony-ets/pseudo.ets +80 -0
- package/dist/components-harmony-ets/radio.ets +85 -155
- package/dist/components-harmony-ets/richText.ets +15 -87
- package/dist/components-harmony-ets/scrollList.ets +94 -0
- package/dist/components-harmony-ets/scrollView.ets +81 -149
- package/dist/components-harmony-ets/slider.ets +47 -94
- package/dist/components-harmony-ets/stickySection.ets +42 -0
- package/dist/components-harmony-ets/style.ets +396 -0
- package/dist/components-harmony-ets/swiper.ets +51 -151
- package/dist/components-harmony-ets/switch.ets +35 -76
- package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
- package/dist/components-harmony-ets/text.ets +131 -76
- package/dist/components-harmony-ets/textArea.ets +64 -140
- package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +4 -13
- package/dist/components-harmony-ets/utils/constant/style.ets +9 -6
- package/dist/components-harmony-ets/utils/flexManager.ets +68 -85
- package/dist/components-harmony-ets/utils/helper.ets +18 -65
- 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 +55 -51
- package/dist/components-harmony-ets/utils/styles.ets +177 -65
- package/dist/components-harmony-ets/video.ets +70 -116
- package/dist/components-harmony-ets/view.ets +58 -64
- package/dist/components-harmony-ets/webView.ets +56 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.js +230 -60
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/document.ts +6 -4
- package/dist/runtime-ets/bom/getComputedStyle.ts +2 -2
- package/dist/runtime-ets/bom/window.ts +9 -2
- package/dist/runtime-ets/current.ts +3 -0
- package/dist/runtime-ets/dom/bind.ts +96 -0
- package/dist/runtime-ets/dom/class-list.ts +4 -6
- package/dist/runtime-ets/dom/comment.ts +1 -2
- package/dist/runtime-ets/dom/cssNesting.ts +409 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -20
- package/dist/runtime-ets/dom/dataSource.ts +64 -0
- package/dist/runtime-ets/dom/document.ts +36 -51
- package/dist/runtime-ets/dom/element/canvas.ts +136 -0
- package/dist/runtime-ets/dom/element/element.ts +439 -0
- package/dist/runtime-ets/dom/element/form.ts +403 -0
- package/dist/runtime-ets/dom/element/index.ts +120 -0
- package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
- package/dist/runtime-ets/dom/element/movableView.ts +242 -0
- package/dist/runtime-ets/dom/element/normal.ts +103 -0
- package/dist/runtime-ets/dom/element/progress.ts +11 -0
- package/dist/runtime-ets/dom/element/scrollView.ts +15 -0
- package/dist/runtime-ets/dom/element/text.ts +10 -0
- package/dist/runtime-ets/dom/element/video.ts +50 -0
- package/dist/runtime-ets/dom/element/webView.ts +68 -0
- package/dist/runtime-ets/dom/event.ts +26 -5
- package/dist/runtime-ets/dom/eventTarget.ts +3 -3
- package/dist/runtime-ets/dom/node.ts +114 -49
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +805 -0
- package/dist/runtime-ets/dom/stylesheet/index.ts +122 -429
- package/dist/runtime-ets/dom/stylesheet/type.ts +93 -17
- package/dist/runtime-ets/dom/stylesheet/util.ts +145 -17
- package/dist/runtime-ets/index.ts +2 -3
- package/dist/runtime-ets/interface/event.ts +3 -2
- package/dist/runtime-ets/utils/index.ts +87 -17
- package/dist/runtime-ets/utils/info.ts +21 -47
- package/dist/runtime-framework/react/app.ts +20 -28
- package/dist/runtime-framework/react/hooks.ts +3 -4
- package/dist/runtime-framework/react/index.ts +1 -2
- package/dist/runtime-framework/react/native-page.ts +421 -0
- package/dist/runtime-framework/react/page.ts +5 -17
- 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 +17 -12
- package/dist/runtime-framework/solid/index.ts +6 -2
- package/dist/runtime-framework/solid/page.ts +84 -36
- package/dist/runtime-framework/solid/reconciler/props.ts +70 -25
- 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 +1633 -549
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +1633 -549
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +14 -15
- package/static/media/cancel.svg +1 -0
- package/static/media/circle.svg +1 -0
- package/static/media/clear.svg +1 -0
- package/static/media/download.svg +1 -0
- package/static/media/info.svg +1 -0
- package/static/media/info_circle.svg +1 -0
- package/static/media/search.svg +1 -0
- package/static/media/success.svg +1 -0
- package/static/media/success_no_circle.svg +1 -0
- package/static/media/taro_arrow_left.svg +1 -0
- package/static/media/taro_home.svg +1 -0
- package/static/media/waiting.svg +1 -0
- package/static/media/warn.svg +1 -0
- package/types/harmony.d.ts +4 -0
- package/types/index.d.ts +4 -0
- package/types/runtime.d.ts +7 -1
- package/LICENSE +0 -160
- package/dist/components-harmony-ets/base.ets +0 -63
- package/dist/components-harmony-ets/element.ets +0 -223
- package/dist/components-harmony-ets/utils/constant/icon.ts +0 -19
- package/dist/runtime-ets/dom/element.ts +0 -457
- package/dist/runtime-ets/dom/text.ts +0 -19
- package/dist/runtime-ets/utils/bind.ts +0 -35
- package/types/api.d.ts +0 -4
- /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
|
@@ -1,457 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
ButtonProps,
|
|
6
|
-
CheckboxGroupProps,
|
|
7
|
-
CheckboxProps,
|
|
8
|
-
FormProps,
|
|
9
|
-
IconProps,
|
|
10
|
-
ImageProps, InputProps,
|
|
11
|
-
LabelProps,
|
|
12
|
-
PickerDateProps,
|
|
13
|
-
PickerMultiSelectorProps,
|
|
14
|
-
PickerSelectorProps,
|
|
15
|
-
PickerTimeProps,
|
|
16
|
-
RadioGroupProps,
|
|
17
|
-
RadioProps,
|
|
18
|
-
RichTextProps,
|
|
19
|
-
ScrollViewProps,
|
|
20
|
-
SliderProps,
|
|
21
|
-
StandardProps,
|
|
22
|
-
SwiperItemProps,
|
|
23
|
-
SwiperProps,
|
|
24
|
-
SwitchProps,
|
|
25
|
-
TextareaProps,
|
|
26
|
-
TextProps,
|
|
27
|
-
VideoProps
|
|
28
|
-
} from '../../components/types'
|
|
29
|
-
import { ATTRIBUTES_CALLBACK_TRIGGER_MAP, ID } from '../constant'
|
|
30
|
-
import { findChildNodeWithDFS, isElement, TaroAny } from '../utils'
|
|
31
|
-
import { triggerAttributesCallback } from '../utils/info'
|
|
32
|
-
import { ClassList } from './class-list'
|
|
33
|
-
import { NodeType, TaroNode } from './node'
|
|
34
|
-
import StyleSheet from './stylesheet'
|
|
35
|
-
|
|
36
|
-
import type { ICSSStyleDeclaration } from './cssStyleDeclaration'
|
|
37
|
-
|
|
38
|
-
type NamedNodeMap = ({ name: string, value: string })[]
|
|
39
|
-
|
|
40
|
-
interface TaroAttributeProps extends StandardProps {
|
|
41
|
-
compileMode?: string | boolean
|
|
42
|
-
compileIf?: boolean
|
|
43
|
-
disabled?: boolean
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export class TaroElement<T extends TaroAttributeProps = TaroAttributeProps> extends TaroNode {
|
|
47
|
-
|
|
48
|
-
public _attrs: T = {}
|
|
49
|
-
|
|
50
|
-
private _innerHTML = ''
|
|
51
|
-
public readonly tagName: string
|
|
52
|
-
|
|
53
|
-
// 用于标记元素是否已经出现
|
|
54
|
-
private _appearResolve: (value?: unknown) => void
|
|
55
|
-
public awaitAppear: Promise<unknown>
|
|
56
|
-
public resolveAppear = () => this._appearResolve()
|
|
57
|
-
|
|
58
|
-
// public changeRecord = ''
|
|
59
|
-
|
|
60
|
-
constructor(tagName: string) {
|
|
61
|
-
super(tagName.replace(/(?<=.)([A-Z])/g, '-$1').toUpperCase(), NodeType.ELEMENT_NODE)
|
|
62
|
-
this.tagName = this.nodeName
|
|
63
|
-
|
|
64
|
-
this.awaitAppear = new Promise(resolve => { this._appearResolve = resolve })
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public set id (value: string) {
|
|
68
|
-
this.setAttribute('id', value)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public get id (): string {
|
|
72
|
-
return this.getAttribute('id') || this._nid
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public set className (value: string) {
|
|
76
|
-
this.setAttribute('class', value)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public get className (): string {
|
|
80
|
-
return this.getAttribute('class') || ''
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public get classList (): ClassList {
|
|
84
|
-
return new ClassList(this.className, this)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
public get attributes (): NamedNodeMap {
|
|
88
|
-
const list: NamedNodeMap = []
|
|
89
|
-
for (const name in this._attrs) {
|
|
90
|
-
const value = this._attrs[name]
|
|
91
|
-
list.push({ name, value })
|
|
92
|
-
}
|
|
93
|
-
return list
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public get children (): TaroElement[] {
|
|
97
|
-
return this.childNodes.filter(isElement)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public setAttribute (name: string, value: any): void {
|
|
101
|
-
if (name === ID) {
|
|
102
|
-
eventSource.delete(this._attrs.id)
|
|
103
|
-
eventSource.set(value, this as any)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
this._attrs[name] = value
|
|
107
|
-
|
|
108
|
-
const attributeTriggerValue = ATTRIBUTES_CALLBACK_TRIGGER_MAP[name]
|
|
109
|
-
if (attributeTriggerValue) {
|
|
110
|
-
const { triggerName, valueInspect } = attributeTriggerValue
|
|
111
|
-
|
|
112
|
-
if (valueInspect && !valueInspect(value)) return
|
|
113
|
-
|
|
114
|
-
triggerAttributesCallback(this, triggerName)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public getAttribute (name: string): string {
|
|
119
|
-
return this._attrs[name]
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public removeAttribute (name: string): void {
|
|
123
|
-
delete this._attrs[name]
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
public hasAttribute (name: string): boolean {
|
|
127
|
-
return this._attrs.hasOwnProperty(name)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public hasAttributes (): boolean {
|
|
131
|
-
return Object.keys(this._attrs).length > 0
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public getElementById (id: string | undefined | null): TaroElement | null {
|
|
135
|
-
return findChildNodeWithDFS(this, (el) => {
|
|
136
|
-
return el.id === id
|
|
137
|
-
}, false)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
public getElementsByTagName<T> (tagName: string): T[] {
|
|
141
|
-
return findChildNodeWithDFS(this, (el) => {
|
|
142
|
-
return el.nodeName === tagName || (tagName === '*' && this !== el)
|
|
143
|
-
}, true) || []
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
public getElementsByClassName (className: string): TaroElement[] {
|
|
147
|
-
const classNames = className.trim().split(/\s+/)
|
|
148
|
-
|
|
149
|
-
return findChildNodeWithDFS(this, (el) => {
|
|
150
|
-
const classList = el.classList
|
|
151
|
-
return classNames.every(c => classList.contains(c))
|
|
152
|
-
}, true) || []
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// TODO dataset
|
|
156
|
-
|
|
157
|
-
public set innerHTML (value: string) {
|
|
158
|
-
if (this.nodeType === NodeType.ELEMENT_NODE) {
|
|
159
|
-
const ele = this.ownerDocument.createElement('inner-html')
|
|
160
|
-
ele._innerHTML = value
|
|
161
|
-
this.appendChild(ele)
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
public get innerHTML (): string {
|
|
166
|
-
return this._innerHTML
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
public _st = new StyleSheet()
|
|
170
|
-
|
|
171
|
-
// 经转换后的鸿蒙样式
|
|
172
|
-
public get hmStyle () {
|
|
173
|
-
return this._st.hmStyle
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
public _style: ICSSStyleDeclaration
|
|
177
|
-
|
|
178
|
-
public get style (): ICSSStyleDeclaration {
|
|
179
|
-
return this._style
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export class TaroViewElement extends TaroElement {
|
|
184
|
-
constructor() {
|
|
185
|
-
super('View')
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export class TaroTextElement extends TaroElement<TextProps> {
|
|
190
|
-
constructor() {
|
|
191
|
-
super('Text')
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export class TaroImageElement extends TaroElement<ImageProps> {
|
|
196
|
-
constructor() {
|
|
197
|
-
super('Image')
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export class TaroButtonElement extends TaroElement<ButtonProps> {
|
|
202
|
-
constructor() {
|
|
203
|
-
super('Button')
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
export class TaroFormWidgetElement<T extends TaroAttributeProps = TaroAttributeProps> extends TaroElement<T> {
|
|
209
|
-
|
|
210
|
-
public get name () {
|
|
211
|
-
return this._attrs.name
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
public set name (val) {
|
|
215
|
-
this._attrs.name = val
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
public get value () {
|
|
219
|
-
return ''
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
public set value (val: any) {
|
|
223
|
-
if (this._instance) {
|
|
224
|
-
this._instance.value = val
|
|
225
|
-
}
|
|
226
|
-
this._attrs.value = val
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export class TaroInputElement extends TaroFormWidgetElement<InputProps> {
|
|
231
|
-
constructor() {
|
|
232
|
-
super('Input')
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
public get value () {
|
|
236
|
-
if (this._instance) {
|
|
237
|
-
return this._instance.text
|
|
238
|
-
} else {
|
|
239
|
-
return this._attrs.value || ''
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
public set value (val) {
|
|
244
|
-
if (this._instance) {
|
|
245
|
-
this._instance.text = val
|
|
246
|
-
}
|
|
247
|
-
this._attrs.value = val
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export class TaroSliderElement extends TaroFormWidgetElement<SliderProps> {
|
|
252
|
-
constructor() {
|
|
253
|
-
super('Slider')
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
public get value () {
|
|
257
|
-
if (this._instance) {
|
|
258
|
-
return this._instance.value
|
|
259
|
-
} else {
|
|
260
|
-
return this._attrs.value || ''
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
public set value (val) {
|
|
265
|
-
if (this._instance) {
|
|
266
|
-
this._instance.value = val
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export class TaroSwitchElement extends TaroFormWidgetElement<SwitchProps> {
|
|
272
|
-
constructor() {
|
|
273
|
-
super('Switch')
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
public get value () {
|
|
277
|
-
if (this._instance) {
|
|
278
|
-
return this._instance.value
|
|
279
|
-
} else {
|
|
280
|
-
return this._attrs.checked || ''
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
public set value (val) {
|
|
285
|
-
if (this._instance) {
|
|
286
|
-
this._instance.value = val
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export class TaroCheckboxGroupElement extends TaroFormWidgetElement<CheckboxGroupProps> {
|
|
292
|
-
constructor() {
|
|
293
|
-
super('CheckboxGroup')
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
public get value () {
|
|
297
|
-
if (this._instance) {
|
|
298
|
-
return this._instance.getValues()
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
export class TaroRadioGroupElement extends TaroFormWidgetElement<RadioGroupProps> {
|
|
304
|
-
constructor() {
|
|
305
|
-
super('RadioGroup')
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
public get value () {
|
|
309
|
-
if (this._instance) {
|
|
310
|
-
return this._instance.getValue()
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
export class TaroPickerElement extends TaroFormWidgetElement<PickerSelectorProps | PickerTimeProps | PickerDateProps | PickerMultiSelectorProps> {
|
|
317
|
-
constructor() {
|
|
318
|
-
super('Picker')
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
public get value () {
|
|
322
|
-
if (this._instance) {
|
|
323
|
-
if (this._instance.select instanceof Array) {
|
|
324
|
-
return this._instance.select.join(',')
|
|
325
|
-
}
|
|
326
|
-
return this._instance.select
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
public set value (val) {
|
|
331
|
-
if (this._instance) {
|
|
332
|
-
this._instance.select = val
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
export class TaroVideoElement extends TaroElement<VideoProps> {
|
|
338
|
-
constructor() {
|
|
339
|
-
super('Video')
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
async play() {
|
|
343
|
-
try {
|
|
344
|
-
this._instance.controller.start()
|
|
345
|
-
return Promise.resolve()
|
|
346
|
-
} catch (e) {
|
|
347
|
-
return Promise.reject(e)
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
pause() {
|
|
352
|
-
try {
|
|
353
|
-
this._instance.controller.pause()
|
|
354
|
-
return Promise.resolve()
|
|
355
|
-
} catch (e) {
|
|
356
|
-
return Promise.reject(e)
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
stop() {
|
|
361
|
-
try {
|
|
362
|
-
this._instance.controller.stop()
|
|
363
|
-
return Promise.resolve()
|
|
364
|
-
} catch (e) {
|
|
365
|
-
return Promise.reject(e)
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
get currentTime() {
|
|
370
|
-
return this._instance.nodeInfoMap[this._nid].currentTime || 0
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
set currentTime(val: number) {
|
|
374
|
-
this._instance.nodeInfoMap[this._nid].currentTime = val
|
|
375
|
-
this._instance.controller.setCurrentTime(val)
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
export class TaroScrollViewElement extends TaroElement<ScrollViewProps> {
|
|
380
|
-
constructor() {
|
|
381
|
-
super('ScrollView')
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
export class TaroCheckboxElement extends TaroElement<CheckboxProps> {
|
|
385
|
-
constructor() {
|
|
386
|
-
super('Checkbox')
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
export class TaroRadioElement extends TaroElement<RadioProps> {
|
|
390
|
-
constructor() {
|
|
391
|
-
super('Radio')
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
public group?: string
|
|
395
|
-
}
|
|
396
|
-
export class TaroIconElement extends TaroElement<IconProps> {
|
|
397
|
-
constructor() {
|
|
398
|
-
super('Icon')
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
export class TaroLabelElement extends TaroElement<LabelProps> {
|
|
402
|
-
constructor() {
|
|
403
|
-
super('Label')
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
export class TaroRichTextElement extends TaroElement<RichTextProps> {
|
|
407
|
-
constructor() {
|
|
408
|
-
super('RichText')
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
export class TaroSwiperElement extends TaroElement<SwiperProps> {
|
|
412
|
-
constructor() {
|
|
413
|
-
super('Swiper')
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
export class TaroSwiperItemElement extends TaroElement<SwiperItemProps> {
|
|
417
|
-
constructor() {
|
|
418
|
-
super('SwiperItem')
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
export class TaroTextAreaElement extends TaroElement<TextareaProps> {
|
|
422
|
-
constructor() {
|
|
423
|
-
super('TextArea')
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
export class TaroIgnoreElement extends TaroElement {
|
|
428
|
-
isIgnore = true
|
|
429
|
-
|
|
430
|
-
constructor() {
|
|
431
|
-
super('Ignore')
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
export class FormElement extends TaroElement<FormProps> {
|
|
436
|
-
constructor() {
|
|
437
|
-
super('Form')
|
|
438
|
-
}
|
|
439
|
-
// public get type () {
|
|
440
|
-
// return this._attrs.type ?? ''
|
|
441
|
-
// }
|
|
442
|
-
//
|
|
443
|
-
// public set type (val: string) {
|
|
444
|
-
// this.setAttribute('type', val)
|
|
445
|
-
// }
|
|
446
|
-
|
|
447
|
-
public get value () {
|
|
448
|
-
// eslint-disable-next-line dot-notation
|
|
449
|
-
const val = this._attrs.value
|
|
450
|
-
return val == null ? '' : val
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
public set value (val: string | boolean | number | any[]) {
|
|
454
|
-
this.setAttribute('value', val)
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { NodeType, TaroNode } from './node'
|
|
2
|
-
|
|
3
|
-
class TextNode extends TaroNode {
|
|
4
|
-
constructor(value = '', nodeName = '#text', nodeType: NodeType = NodeType.TEXT_NODE) {
|
|
5
|
-
super(nodeName, nodeType)
|
|
6
|
-
this.textContent = value
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
public get data (): string {
|
|
10
|
-
return this.textContent
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public set data (value: string) {
|
|
14
|
-
this.textContent = value
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@Observed
|
|
19
|
-
export class TaroTextNode extends TextNode {}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { bindAttributesCallback } from './info'
|
|
2
|
-
|
|
3
|
-
import type { TaroElement } from '../dom/element'
|
|
4
|
-
|
|
5
|
-
// function convertToCamelCase(str) {
|
|
6
|
-
// return str.replace(/-(.)/g, (_, char) => char.toUpperCase()).replace(/^\w/, firstChar => firstChar.toUpperCase())
|
|
7
|
-
// }
|
|
8
|
-
|
|
9
|
-
export function bindInstanceToNode (node: TaroElement, instance: any) {
|
|
10
|
-
if (!node) return
|
|
11
|
-
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
node._instance = instance
|
|
14
|
-
|
|
15
|
-
// 触发appear,让node监听到TaroNode已经和ete自定义组件绑定上
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
node.resolveAppear?.() // #text node节点没有实现该方法
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function bindScrollTo (node: TaroElement, instance: any) {
|
|
21
|
-
bindAttributesCallback(node, 'scrollTo', () => {
|
|
22
|
-
instance.scroller.scrollTo({
|
|
23
|
-
xOffset: node._attrs.scrollLeft || 0,
|
|
24
|
-
yOffset: node._attrs.scrollTop || 0,
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function bindFocus (node: TaroElement) {
|
|
30
|
-
bindAttributesCallback(node, 'focus', () => {
|
|
31
|
-
// TODO: ETS转TS
|
|
32
|
-
// focusControl.requestFocus(node._nid)
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
|
package/types/api.d.ts
DELETED
|
File without changes
|