@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,79 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
TaroEvent
|
|
4
|
-
} from '@tarojs/runtime'
|
|
5
|
-
import { createNode } from './render'
|
|
6
|
-
import TaroComponentWrapper from './base'
|
|
1
|
+
import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, TaroPickerElement, createTaroEvent } from '@tarojs/runtime'
|
|
2
|
+
import commonStyleModify from './style'
|
|
7
3
|
import { getSingleSelector, getMultiSelector } from './utils'
|
|
8
4
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
9
|
-
import { FlexManager } from './utils/
|
|
10
|
-
import {
|
|
11
|
-
import { getNormalAttributes, shouldBindEvent, getNodeThresholds, bindAnimation } from './utils/helper'
|
|
5
|
+
import { FlexManager } from './utils/flexManager'
|
|
6
|
+
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
12
7
|
|
|
13
|
-
import type {
|
|
14
|
-
import type { TaroStyleType } from '@tarojs/runtime'
|
|
8
|
+
import type { TaroAny, TaroEvent } from '@tarojs/runtime'
|
|
15
9
|
|
|
16
|
-
import { PickerDateProps, PickerMultiSelectorProps, PickerSelectorProps, PickerTimeProps } from '
|
|
17
|
-
|
|
18
|
-
@Extend(TextPicker)
|
|
19
|
-
function textPickerAttrs (style: TaroStyleType) {
|
|
20
|
-
.id(style.id)
|
|
21
|
-
.key(style.id)
|
|
22
|
-
.padding(style.padding)
|
|
23
|
-
.margin(style.margin)
|
|
24
|
-
.width(style.width || '100%')
|
|
25
|
-
.height(style.height)
|
|
26
|
-
.constraintSize(style.constraintSize)
|
|
27
|
-
.flexGrow(style.flexGrow)
|
|
28
|
-
.flexShrink(style.flexShrink)
|
|
29
|
-
.flexBasis(style.flexBasis)
|
|
30
|
-
.alignSelf(style.alignSelf)
|
|
31
|
-
.backgroundColor(style.backgroundColor || '#fff')
|
|
32
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
33
|
-
.backgroundImageSize(style.backgroundImageSize)
|
|
34
|
-
.rotate(style.rotate)
|
|
35
|
-
.scale(style.scale)
|
|
36
|
-
.translate(style.translate)
|
|
37
|
-
.transform(style.transform)
|
|
38
|
-
.borderStyle(style.borderStyle)
|
|
39
|
-
.borderWidth(style.borderWidth)
|
|
40
|
-
.borderColor(style.borderColor)
|
|
41
|
-
.borderRadius(style.borderRadius)
|
|
42
|
-
.linearGradient(style.linearGradient)
|
|
43
|
-
.zIndex(style.zIndex)
|
|
44
|
-
.opacity(style.opacity)
|
|
45
|
-
.clip(style.clip)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@Extend(DatePicker)
|
|
49
|
-
function datePickerAttrs (style: TaroStyleType) {
|
|
50
|
-
.id(style.id)
|
|
51
|
-
.key(style.id)
|
|
52
|
-
.padding(style.padding)
|
|
53
|
-
.margin(style.margin)
|
|
54
|
-
.width(style.width || '100%')
|
|
55
|
-
.height(style.height)
|
|
56
|
-
.constraintSize(style.constraintSize)
|
|
57
|
-
.flexGrow(style.flexGrow)
|
|
58
|
-
.flexShrink(style.flexShrink)
|
|
59
|
-
.flexBasis(style.flexBasis)
|
|
60
|
-
.alignSelf(style.alignSelf)
|
|
61
|
-
.backgroundColor(style.backgroundColor || '#fff')
|
|
62
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
63
|
-
.backgroundImageSize(style.backgroundImageSize)
|
|
64
|
-
.rotate(style.rotate)
|
|
65
|
-
.scale(style.scale)
|
|
66
|
-
.translate(style.translate)
|
|
67
|
-
.transform(style.transform)
|
|
68
|
-
.borderStyle(style.borderStyle)
|
|
69
|
-
.borderWidth(style.borderWidth)
|
|
70
|
-
.borderColor(style.borderColor)
|
|
71
|
-
.borderRadius(style.borderRadius)
|
|
72
|
-
.linearGradient(style.linearGradient)
|
|
73
|
-
.zIndex(style.zIndex)
|
|
74
|
-
.opacity(style.opacity)
|
|
75
|
-
.clip(style.clip)
|
|
76
|
-
}
|
|
10
|
+
import { PickerDateProps, PickerMultiSelectorProps, PickerSelectorProps, PickerTimeProps } from '@tarojs/components/types'
|
|
77
11
|
|
|
78
12
|
interface TimeRange {
|
|
79
13
|
startHH: number
|
|
@@ -84,10 +18,7 @@ interface TimeRange {
|
|
|
84
18
|
|
|
85
19
|
@CustomDialog
|
|
86
20
|
export struct PickerView {
|
|
87
|
-
|
|
88
|
-
@ObjectLink node: TaroPickerElement
|
|
89
|
-
|
|
90
|
-
@Link select: string | number
|
|
21
|
+
node: TaroPickerElement | null = null
|
|
91
22
|
|
|
92
23
|
controller?: CustomDialogController
|
|
93
24
|
|
|
@@ -96,7 +27,7 @@ export struct PickerView {
|
|
|
96
27
|
showSelector: number[] = []
|
|
97
28
|
|
|
98
29
|
getDateOptions (): DatePickerOptions {
|
|
99
|
-
const _attrs = this.node
|
|
30
|
+
const _attrs = this.node?._attrs as PickerDateProps
|
|
100
31
|
return {
|
|
101
32
|
start: new Date(_attrs.start || ''),
|
|
102
33
|
end: new Date(_attrs.end || ''),
|
|
@@ -105,9 +36,9 @@ export struct PickerView {
|
|
|
105
36
|
}
|
|
106
37
|
|
|
107
38
|
getTextOptions (): TextPickerOptions {
|
|
108
|
-
let mode: string = this.node
|
|
39
|
+
let mode: string = this.node?._attrs.mode || 'selector'
|
|
109
40
|
if (!mode) {
|
|
110
|
-
const _attrs = this.node
|
|
41
|
+
const _attrs = this.node?._attrs as PickerSelectorProps
|
|
111
42
|
const range = _attrs.range
|
|
112
43
|
if (range && range.length && range[0] instanceof Array) {
|
|
113
44
|
mode = 'multiSelector'
|
|
@@ -116,7 +47,7 @@ export struct PickerView {
|
|
|
116
47
|
}
|
|
117
48
|
switch (mode) {
|
|
118
49
|
case 'time': {
|
|
119
|
-
const _attrs = this.node
|
|
50
|
+
const _attrs = this.node?._attrs as PickerTimeProps
|
|
120
51
|
let timeRange: TimeRange = {
|
|
121
52
|
startHH: 0,
|
|
122
53
|
startMM: 0,
|
|
@@ -136,37 +67,34 @@ export struct PickerView {
|
|
|
136
67
|
const left = generateNumberArray(timeRange.startHH, timeRange.endHH)
|
|
137
68
|
const right = generateNumberArray(timeRange.startMM, timeRange.endMM)
|
|
138
69
|
const range = [left, right]
|
|
139
|
-
const _selected = _attrs.value
|
|
70
|
+
const _selected = _attrs.value?.split(':') as string[]
|
|
140
71
|
return {
|
|
141
72
|
range: range,
|
|
142
73
|
selected: [left.findIndex(i => parseInt(_selected[0]) === Number(i)), right.findIndex(i => parseInt(_selected[1]) === Number(i))],
|
|
143
74
|
}
|
|
144
75
|
}
|
|
145
76
|
case 'multiSelector': {
|
|
146
|
-
const _attrs = this.node
|
|
147
|
-
const value = _attrs.value as number[]
|
|
77
|
+
const _attrs = this.node?._attrs as PickerMultiSelectorProps
|
|
148
78
|
let showRange = _attrs.range as string[][]
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
selects = selects.split(',').map(i => Number(i))
|
|
154
|
-
}
|
|
79
|
+
const selected: number[] = this.node?.value
|
|
80
|
+
this.showSelector = selected
|
|
81
|
+
showRange = getMultiSelector(this, _attrs.range, _attrs.rangeKey, selected)
|
|
82
|
+
|
|
155
83
|
return {
|
|
84
|
+
selected,
|
|
156
85
|
range: showRange,
|
|
157
|
-
selected: selects || value
|
|
158
86
|
}
|
|
159
87
|
}
|
|
160
88
|
default: {
|
|
161
|
-
const _attrs = this.node
|
|
89
|
+
const _attrs = this.node?._attrs as PickerSelectorProps
|
|
162
90
|
const range = _attrs.range
|
|
163
91
|
let showRange = _attrs.range as string[]
|
|
164
92
|
if (_attrs.rangeKey && typeof range[0] === 'object') {
|
|
165
|
-
showRange = getSingleSelector(
|
|
93
|
+
showRange = getSingleSelector(range, _attrs.rangeKey)
|
|
166
94
|
}
|
|
167
95
|
return {
|
|
168
96
|
range: showRange,
|
|
169
|
-
selected:
|
|
97
|
+
selected: this.node?.value
|
|
170
98
|
}
|
|
171
99
|
}
|
|
172
100
|
}
|
|
@@ -179,7 +107,7 @@ export struct PickerView {
|
|
|
179
107
|
}
|
|
180
108
|
|
|
181
109
|
getText = () => {
|
|
182
|
-
if (this.node
|
|
110
|
+
if (this.node?._attrs.mode === 'selector') {
|
|
183
111
|
const _attrs = this.node._attrs as PickerSelectorProps
|
|
184
112
|
return [_attrs.textProps?.okText || '确认', _attrs.textProps?.cancelText || '取消']
|
|
185
113
|
} else {
|
|
@@ -190,83 +118,101 @@ export struct PickerView {
|
|
|
190
118
|
@Builder
|
|
191
119
|
showDialog() {
|
|
192
120
|
Column() {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
this.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
Text(this.getText()[0]).fontSize(15).padding({top: 20, bottom: 40}).fontColor('#1aad19').onClick(() => {
|
|
203
|
-
this.emitEvent('change', { value: this.select})
|
|
204
|
-
this.controller?.close()
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
.width('100%')
|
|
208
|
-
.backgroundColor('#fff')
|
|
209
|
-
.padding({
|
|
210
|
-
left: 20,
|
|
211
|
-
right: 20
|
|
212
|
-
})
|
|
213
|
-
if (this.node._attrs.mode === 'selector') {
|
|
214
|
-
TextPicker(this.getTextOptions())
|
|
215
|
-
.selectedTextStyle({
|
|
216
|
-
color: '#000'
|
|
217
|
-
})
|
|
218
|
-
.canLoop(false)
|
|
219
|
-
.textPickerAttrs(getNormalAttributes(this.node))
|
|
220
|
-
.onChange((value, index) => {
|
|
221
|
-
this.select = index as number
|
|
121
|
+
if (this.node) {
|
|
122
|
+
Flex({
|
|
123
|
+
direction: FlexDirection.Row,
|
|
124
|
+
justifyContent: FlexAlign.SpaceBetween,
|
|
125
|
+
alignItems: ItemAlign.Center
|
|
126
|
+
}) {
|
|
127
|
+
Text(this.getText()[1]).fontSize(15).padding({top: 20, bottom: 40}).fontColor('#888').onClick(() => {
|
|
128
|
+
this.emitEvent('cancel')
|
|
129
|
+
this.controller?.close()
|
|
222
130
|
})
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
color: '#000'
|
|
131
|
+
Text(this.getText()[0]).fontSize(15).padding({top: 20, bottom: 40}).fontColor('#1aad19').onClick(() => {
|
|
132
|
+
this.emitEvent('change', { value: this.node?.value })
|
|
133
|
+
this.controller?.close()
|
|
227
134
|
})
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
135
|
+
}
|
|
136
|
+
.width('100%')
|
|
137
|
+
.backgroundColor('#fff')
|
|
138
|
+
.padding({
|
|
139
|
+
left: 20,
|
|
140
|
+
right: 20
|
|
141
|
+
})
|
|
142
|
+
if (this.node._attrs.mode === 'selector') {
|
|
143
|
+
TextPicker(this.getTextOptions())
|
|
144
|
+
.selectedTextStyle({
|
|
145
|
+
color: '#000'
|
|
146
|
+
})
|
|
147
|
+
.canLoop(false)
|
|
148
|
+
.attributeModifier(commonStyleModify.setNode(this.node, {
|
|
149
|
+
width: '100%',
|
|
150
|
+
backgroundColor: '#fff'
|
|
151
|
+
}))
|
|
152
|
+
.onChange((_, index) => {
|
|
153
|
+
this.node?.updateFormWidgetValue(index)
|
|
154
|
+
})
|
|
155
|
+
} else if (this.node?._attrs.mode === 'multiSelector') {
|
|
156
|
+
TextPicker(this.getTextOptions())
|
|
157
|
+
.selectedTextStyle({
|
|
158
|
+
color: '#000'
|
|
159
|
+
})
|
|
160
|
+
.canLoop(false)
|
|
161
|
+
.attributeModifier(commonStyleModify.setNode(this.node, {
|
|
162
|
+
width: '100%',
|
|
163
|
+
backgroundColor: '#fff'
|
|
164
|
+
}))
|
|
165
|
+
.onChange((_, index) => {
|
|
166
|
+
if (index instanceof Array) {
|
|
167
|
+
this.node?.updateFormWidgetValue(index)
|
|
168
|
+
// 计算几列发生了变化
|
|
169
|
+
const originIndexs: number[] = this.multiColumnIndex || this.showSelector
|
|
170
|
+
this.multiColumnIndex = index
|
|
171
|
+
let changeValue: number | undefined
|
|
172
|
+
const changeIndex = index.findIndex((item, i) => {
|
|
173
|
+
const originIndex = originIndexs[i]
|
|
174
|
+
if (originIndex != item) {
|
|
175
|
+
changeValue = item
|
|
176
|
+
return true
|
|
177
|
+
}
|
|
178
|
+
return false
|
|
179
|
+
})
|
|
180
|
+
if (changeIndex < 0) {
|
|
181
|
+
return
|
|
242
182
|
}
|
|
243
|
-
|
|
244
|
-
})
|
|
245
|
-
if (changeIndex < 0) {
|
|
246
|
-
return
|
|
183
|
+
this.emitEvent('columnChange', { column: changeIndex, value: changeValue })
|
|
247
184
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
185
|
+
})
|
|
186
|
+
} else if (this.node._attrs.mode === 'date') {
|
|
187
|
+
DatePicker(this.getDateOptions())
|
|
188
|
+
.selectedTextStyle({
|
|
189
|
+
color: '#000'
|
|
190
|
+
})
|
|
191
|
+
.attributeModifier(commonStyleModify.setNode(this.node, {
|
|
192
|
+
width: '100%',
|
|
193
|
+
backgroundColor: '#fff'
|
|
194
|
+
}))
|
|
195
|
+
.onDateChange(value => {
|
|
196
|
+
const data = value.toLocaleDateString().split('/')
|
|
197
|
+
const day = data[1]
|
|
198
|
+
const month = data[0]
|
|
199
|
+
const year = data[2]
|
|
200
|
+
this.node?.updateFormWidgetValue(`${year}-${month}-${day}`)
|
|
201
|
+
})
|
|
202
|
+
} else if (this.node._attrs.mode === 'time') {
|
|
203
|
+
TextPicker(this.getTextOptions())
|
|
204
|
+
.selectedTextStyle({
|
|
205
|
+
color: '#000'
|
|
206
|
+
})
|
|
207
|
+
.canLoop(false)
|
|
208
|
+
.attributeModifier(commonStyleModify.setNode(this.node, {
|
|
209
|
+
width: '100%',
|
|
210
|
+
backgroundColor: '#fff'
|
|
211
|
+
}))
|
|
212
|
+
.onChange((value) => {
|
|
213
|
+
this.node?.updateFormWidgetValue(`${('00'+value[0]).slice(-2)}:${('00'+value[1]).slice(-2)}`)
|
|
214
|
+
})
|
|
215
|
+
}
|
|
270
216
|
}
|
|
271
217
|
}
|
|
272
218
|
}
|
|
@@ -277,40 +223,61 @@ export struct PickerView {
|
|
|
277
223
|
}
|
|
278
224
|
|
|
279
225
|
|
|
280
|
-
|
|
281
226
|
@Component
|
|
282
227
|
export default struct TaroPicker {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
@State select: string = ''
|
|
286
|
-
|
|
228
|
+
@Builder customBuilder() {}
|
|
229
|
+
@BuilderParam createLazyChildren: (node: TaroPickerElement) => void = this.customBuilder
|
|
287
230
|
@ObjectLink node: TaroPickerElement
|
|
288
231
|
|
|
289
232
|
aboutToAppear () {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
233
|
+
this.node?.addEventListener('click', this.handleClick)
|
|
234
|
+
|
|
235
|
+
if (this.node && !this.node._isInit) {
|
|
236
|
+
let defaultResetValue: TaroAny = ''
|
|
237
|
+
switch (this.node._attrs.mode) {
|
|
238
|
+
case 'selector':
|
|
239
|
+
defaultResetValue = 0
|
|
240
|
+
break
|
|
241
|
+
case 'multiSelector':
|
|
242
|
+
defaultResetValue = this.node._attrs.range.map((_: TaroAny) => 0)
|
|
243
|
+
break
|
|
244
|
+
case 'time': {
|
|
245
|
+
const hour = new Date().getHours()
|
|
246
|
+
const minute = new Date().getMinutes()
|
|
247
|
+
|
|
248
|
+
defaultResetValue = `${('00'+hour).slice(-2)}:${('00'+minute).slice(-2)}`
|
|
249
|
+
break
|
|
250
|
+
}
|
|
251
|
+
case 'date': {
|
|
252
|
+
const data = new Date().toLocaleDateString().split('/')
|
|
253
|
+
const day = data[1]
|
|
254
|
+
const month = data[0]
|
|
255
|
+
const year = data[2]
|
|
256
|
+
|
|
257
|
+
defaultResetValue = `${year}-${month}-${day}`
|
|
258
|
+
break
|
|
259
|
+
}
|
|
260
|
+
default:
|
|
261
|
+
defaultResetValue = ''
|
|
262
|
+
break
|
|
263
|
+
}
|
|
296
264
|
|
|
297
|
-
|
|
265
|
+
this.node._isInit = true
|
|
266
|
+
this.node._reset = this.node.value || defaultResetValue
|
|
267
|
+
}
|
|
298
268
|
}
|
|
299
269
|
|
|
300
270
|
dialogController: CustomDialogController | null = null
|
|
301
271
|
|
|
302
272
|
aboutToDisappear() {
|
|
303
273
|
this.dialogController = null // 将dialogController置空
|
|
274
|
+
this.node?.removeEventListener('click', this.handleClick)
|
|
304
275
|
}
|
|
305
276
|
|
|
306
|
-
|
|
307
277
|
handleClick = () => {
|
|
308
|
-
if (!this.dialogController) {
|
|
278
|
+
if (!this.dialogController && this.node) {
|
|
309
279
|
this.dialogController = new CustomDialogController({
|
|
310
|
-
builder: PickerView({
|
|
311
|
-
node: this.node,
|
|
312
|
-
select: this.select
|
|
313
|
-
}),
|
|
280
|
+
builder: PickerView({ node: this.node }),
|
|
314
281
|
customStyle: true,
|
|
315
282
|
cornerRadius: '0vp',
|
|
316
283
|
autoCancel: true,
|
|
@@ -324,7 +291,7 @@ export default struct TaroPicker {
|
|
|
324
291
|
}
|
|
325
292
|
})
|
|
326
293
|
}
|
|
327
|
-
this.dialogController
|
|
294
|
+
this.dialogController?.open()
|
|
328
295
|
}
|
|
329
296
|
|
|
330
297
|
@Styles defaultEvent () {
|
|
@@ -332,9 +299,10 @@ export default struct TaroPicker {
|
|
|
332
299
|
eventHandler(e, 'click', this.node)
|
|
333
300
|
})
|
|
334
301
|
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
335
|
-
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, res => {
|
|
336
|
-
|
|
337
|
-
|
|
302
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
303
|
+
if (this.node) {
|
|
304
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
305
|
+
}
|
|
338
306
|
}))
|
|
339
307
|
}
|
|
340
308
|
|
|
@@ -343,20 +311,26 @@ export default struct TaroPicker {
|
|
|
343
311
|
}
|
|
344
312
|
|
|
345
313
|
build() {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
createNode(item)
|
|
350
|
-
}, (item: TaroElement) => item._nid)
|
|
314
|
+
if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
|
|
315
|
+
Row() {
|
|
316
|
+
this.createLazyChildren(this.node)
|
|
351
317
|
}
|
|
352
|
-
|
|
353
|
-
|
|
318
|
+
.defaultEvent()
|
|
319
|
+
.visibleChangeEvent()
|
|
320
|
+
.alignItems(FlexManager.alignItems<VerticalAlign>(this.node))
|
|
321
|
+
.justifyContent(FlexManager.justifyContent(this.node))
|
|
322
|
+
} else {
|
|
323
|
+
Column() {
|
|
324
|
+
this.createLazyChildren(this.node)
|
|
325
|
+
}
|
|
326
|
+
.defaultEvent()
|
|
327
|
+
.visibleChangeEvent()
|
|
328
|
+
.alignItems(FlexManager.alignItems<HorizontalAlign>(this.node))
|
|
329
|
+
.justifyContent(FlexManager.justifyContent(this.node))
|
|
354
330
|
}
|
|
355
331
|
}
|
|
356
332
|
}
|
|
357
333
|
|
|
358
|
-
|
|
359
|
-
|
|
360
334
|
function generateNumberArray(x: number, y: number) {
|
|
361
335
|
// 创建一个空数组来存储结果
|
|
362
336
|
let result: string[] = []
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { TaroProgressElement, TaroAny } from '@tarojs/runtime'
|
|
2
|
+
import commonStyleModify from './style'
|
|
3
|
+
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
4
|
+
import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
|
|
5
|
+
|
|
6
|
+
const PROGRESS_ACTIVECOLOR = '#09BB07'
|
|
7
|
+
const PROGRESS_BACKGROUNDCOLOR = '#EBEBEB'
|
|
8
|
+
const PROGRESS_DEFAULTINFOFONTSIZE = 16
|
|
9
|
+
|
|
10
|
+
@Component
|
|
11
|
+
export default struct TaroProgress {
|
|
12
|
+
@Builder customBuilder() {}
|
|
13
|
+
@BuilderParam createLazyChildren: (node: TaroProgressElement) => void = this.customBuilder
|
|
14
|
+
@ObjectLink node: TaroProgressElement
|
|
15
|
+
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
16
|
+
|
|
17
|
+
aboutToAppear(): void {
|
|
18
|
+
if (this.node) {
|
|
19
|
+
this.node._instance = this
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
build() {
|
|
24
|
+
Row({ space: 5 }) {
|
|
25
|
+
Progress({
|
|
26
|
+
value: parseFloat(this.node.getAttribute('percent')),
|
|
27
|
+
type: ProgressType.Linear
|
|
28
|
+
})
|
|
29
|
+
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
30
|
+
.color(this.node.getAttribute('activeColor') ?? PROGRESS_ACTIVECOLOR)
|
|
31
|
+
.backgroundColor(this.node.getAttribute('backgroundColor') ?? PROGRESS_BACKGROUNDCOLOR)
|
|
32
|
+
.style({
|
|
33
|
+
strokeWidth: this.node.getAttribute('strokeWidth'),
|
|
34
|
+
strokeRadius: parseFloat(this.node.getAttribute('borderRadius')),
|
|
35
|
+
enableSmoothEffect: Boolean(this.node.getAttribute('active')),
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
39
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
40
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
41
|
+
if (this.node) {
|
|
42
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
43
|
+
}
|
|
44
|
+
}))
|
|
45
|
+
|
|
46
|
+
if (this.node.getAttribute('showInfo')) {
|
|
47
|
+
Text(`${this.node.getAttribute('percent')}%`)
|
|
48
|
+
.fontSize(this.node.getAttribute('fontSize') ?? PROGRESS_DEFAULTINFOFONTSIZE)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { getFontAttributes } from './utils/helper'
|
|
2
|
+
import { pseudoModify } from './style'
|
|
3
|
+
|
|
4
|
+
import type { TaroViewElement, TaroStyleType, TaroTextStyleType, TaroAny } from '@tarojs/runtime'
|
|
5
|
+
|
|
6
|
+
@Extend(Flex)
|
|
7
|
+
function flexAttrs (style: TaroStyleType) {
|
|
8
|
+
.constraintSize({
|
|
9
|
+
minWidth: style.minWidth,
|
|
10
|
+
maxWidth: style.maxWidth,
|
|
11
|
+
minHeight: style.minHeight || style.height,
|
|
12
|
+
maxHeight: style.maxHeight
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@Extend(Text)
|
|
18
|
+
function textNormalFontStyle (style: TaroStyleType) {
|
|
19
|
+
.id(style.id)
|
|
20
|
+
.key(style.id)
|
|
21
|
+
.opacity(style.opacity)
|
|
22
|
+
.fontColor(style.color)
|
|
23
|
+
.fontSize(style.fontSize)
|
|
24
|
+
.fontWeight(style.fontWeight)
|
|
25
|
+
.fontStyle(style.fontStyle)
|
|
26
|
+
.fontFamily(style.fontFamily)
|
|
27
|
+
.decoration({
|
|
28
|
+
type: style.textDecoration?.type || TextDecorationType.None,
|
|
29
|
+
color: style.color
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@Extend(Text)
|
|
34
|
+
function textSpecialFontStyle(attr: TaroTextStyleType) {
|
|
35
|
+
.textAlign(attr.textAlign)
|
|
36
|
+
.align(attr.verticalAlign)
|
|
37
|
+
.textOverflow(attr.textOverflow)
|
|
38
|
+
.maxLines(attr.WebkitLineClamp)
|
|
39
|
+
.letterSpacing(attr.letterSpacing)
|
|
40
|
+
.lineHeight(attr.lineHeight)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Component
|
|
44
|
+
export default struct PseduoChildren {
|
|
45
|
+
@Builder customBuilder() {}
|
|
46
|
+
@BuilderParam createLazyChildren: (node: TaroAny) => void = this.customBuilder
|
|
47
|
+
@ObjectLink node: TaroViewElement
|
|
48
|
+
|
|
49
|
+
build () {
|
|
50
|
+
if (true) {
|
|
51
|
+
// 伪类::Before
|
|
52
|
+
if (this.node._pseudo_before) {
|
|
53
|
+
if (this.node._pseudo_before?.hmStyle.content) {
|
|
54
|
+
Text(this.node._pseudo_before.hmStyle.content)
|
|
55
|
+
.attributeModifier(pseudoModify.setStyle(this.node._pseudo_before.hmStyle))
|
|
56
|
+
.textNormalFontStyle(this.node._pseudo_before.hmStyle || {})
|
|
57
|
+
.textSpecialFontStyle(getFontAttributes(this.node))
|
|
58
|
+
} else {
|
|
59
|
+
Flex() {}
|
|
60
|
+
.attributeModifier(pseudoModify.setStyle(this.node._pseudo_before.hmStyle || {}))
|
|
61
|
+
.flexAttrs(this.node._pseudo_before.hmStyle || {})
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
this.createLazyChildren(this.node)
|
|
65
|
+
// 伪类::After
|
|
66
|
+
if (this.node._pseudo_after) {
|
|
67
|
+
if (this.node._pseudo_after?.hmStyle.content) {
|
|
68
|
+
Text(this.node._pseudo_after.hmStyle.content)
|
|
69
|
+
.attributeModifier(pseudoModify.setStyle(this.node._pseudo_after.hmStyle))
|
|
70
|
+
.textNormalFontStyle(this.node._pseudo_after.hmStyle || {})
|
|
71
|
+
.textSpecialFontStyle(getFontAttributes(this.node))
|
|
72
|
+
} else {
|
|
73
|
+
Flex() {}
|
|
74
|
+
.attributeModifier(pseudoModify.setStyle(this.node._pseudo_after.hmStyle || {}))
|
|
75
|
+
.flexAttrs(this.node._pseudo_after.hmStyle || {})
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|