@tarojs/plugin-platform-harmony-ets 3.7.0-alpha.27

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.
Files changed (212) hide show
  1. package/LICENSE +160 -0
  2. package/dist/apis/apis.ts +15 -0
  3. package/dist/apis/base/index.ts +5 -0
  4. package/dist/apis/base/system.ts +77 -0
  5. package/dist/apis/device/accelerometer.ts +76 -0
  6. package/dist/apis/device/battery.ts +24 -0
  7. package/dist/apis/device/clipboard.ts +70 -0
  8. package/dist/apis/device/index.ts +9 -0
  9. package/dist/apis/device/keyboard.ts +62 -0
  10. package/dist/apis/device/memory.ts +4 -0
  11. package/dist/apis/device/network.ts +72 -0
  12. package/dist/apis/device/phone.ts +43 -0
  13. package/dist/apis/device/screen.ts +79 -0
  14. package/dist/apis/device/vibrate.ts +24 -0
  15. package/dist/apis/files/index.ts +135 -0
  16. package/dist/apis/files/manager.ts +941 -0
  17. package/dist/apis/framework/index.ts +32 -0
  18. package/dist/apis/index.ts +124 -0
  19. package/dist/apis/location/index.ts +133 -0
  20. package/dist/apis/media/common.ts +74 -0
  21. package/dist/apis/media/image.ts +122 -0
  22. package/dist/apis/media/index.ts +3 -0
  23. package/dist/apis/media/video.ts +86 -0
  24. package/dist/apis/navigate/index.ts +8 -0
  25. package/dist/apis/network/downloadFile.ts +113 -0
  26. package/dist/apis/network/index.ts +4 -0
  27. package/dist/apis/network/request.ts +113 -0
  28. package/dist/apis/network/uploadFile.ts +158 -0
  29. package/dist/apis/network/webSocket.ts +130 -0
  30. package/dist/apis/open-api/index.ts +7 -0
  31. package/dist/apis/open-api/user-info/index.ts +85 -0
  32. package/dist/apis/page/index.ts +92 -0
  33. package/dist/apis/route/index.ts +138 -0
  34. package/dist/apis/storage/index.ts +133 -0
  35. package/dist/apis/tabbar/index.ts +147 -0
  36. package/dist/apis/ui/animation.ts +222 -0
  37. package/dist/apis/ui/background.ts +35 -0
  38. package/dist/apis/ui/index.ts +14 -0
  39. package/dist/apis/ui/interaction/index.ts +195 -0
  40. package/dist/apis/ui/navigation-bar/index.ts +33 -0
  41. package/dist/apis/ui/pull-down-refresh.ts +41 -0
  42. package/dist/apis/utils/handler.ts +116 -0
  43. package/dist/apis/utils/index.ts +85 -0
  44. package/dist/apis/utils/types.ts +12 -0
  45. package/dist/apis/utils/validate.ts +87 -0
  46. package/dist/apis/wxml/IntersectionObserver.ts +119 -0
  47. package/dist/apis/wxml/index.ts +12 -0
  48. package/dist/apis/wxml/nodesRef.ts +56 -0
  49. package/dist/apis/wxml/selectorQuery.ts +287 -0
  50. package/dist/components/components-react.js +51 -0
  51. package/dist/components/components-react.js.map +1 -0
  52. package/dist/components-harmony/button/index.css +109 -0
  53. package/dist/components-harmony/button/index.hml +31 -0
  54. package/dist/components-harmony/button/index.js +105 -0
  55. package/dist/components-harmony/camera/index.hml +6 -0
  56. package/dist/components-harmony/camera/index.js +12 -0
  57. package/dist/components-harmony/checkbox/index.hml +11 -0
  58. package/dist/components-harmony/checkbox/index.js +60 -0
  59. package/dist/components-harmony/checkbox-group/index.hml +3 -0
  60. package/dist/components-harmony/checkbox-group/index.js +22 -0
  61. package/dist/components-harmony/cover-image/index.css +4 -0
  62. package/dist/components-harmony/cover-image/index.hml +9 -0
  63. package/dist/components-harmony/cover-image/index.js +15 -0
  64. package/dist/components-harmony/form/index.hml +10 -0
  65. package/dist/components-harmony/form/index.js +11 -0
  66. package/dist/components-harmony/icon/index.css +27 -0
  67. package/dist/components-harmony/icon/index.hml +54 -0
  68. package/dist/components-harmony/icon/index.js +17 -0
  69. package/dist/components-harmony/image/index.css +5 -0
  70. package/dist/components-harmony/image/index.hml +11 -0
  71. package/dist/components-harmony/image/index.js +28 -0
  72. package/dist/components-harmony/input/index.hml +21 -0
  73. package/dist/components-harmony/input/index.js +98 -0
  74. package/dist/components-harmony/label/index.hml +3 -0
  75. package/dist/components-harmony/label/index.js +6 -0
  76. package/dist/components-harmony/navbar/index.css +56 -0
  77. package/dist/components-harmony/navbar/index.hml +9 -0
  78. package/dist/components-harmony/navbar/index.js +30 -0
  79. package/dist/components-harmony/navigator/index.css +8 -0
  80. package/dist/components-harmony/navigator/index.hml +9 -0
  81. package/dist/components-harmony/navigator/index.js +104 -0
  82. package/dist/components-harmony/picker/index.hml +25 -0
  83. package/dist/components-harmony/picker/index.js +132 -0
  84. package/dist/components-harmony/picker-view/index.hml +23 -0
  85. package/dist/components-harmony/picker-view/index.js +161 -0
  86. package/dist/components-harmony/picker-view-column/index.hml +3 -0
  87. package/dist/components-harmony/picker-view-column/index.js +3 -0
  88. package/dist/components-harmony/progress/index.css +4 -0
  89. package/dist/components-harmony/progress/index.hml +28 -0
  90. package/dist/components-harmony/progress/index.js +23 -0
  91. package/dist/components-harmony/radio/index.hml +11 -0
  92. package/dist/components-harmony/radio/index.js +41 -0
  93. package/dist/components-harmony/radio-group/index.hml +3 -0
  94. package/dist/components-harmony/radio-group/index.js +11 -0
  95. package/dist/components-harmony/rich-text/index.hml +5 -0
  96. package/dist/components-harmony/rich-text/index.js +16 -0
  97. package/dist/components-harmony/scroll-view/index.css +5 -0
  98. package/dist/components-harmony/scroll-view/index.hml +12 -0
  99. package/dist/components-harmony/scroll-view/index.js +65 -0
  100. package/dist/components-harmony/slider/index.hml +16 -0
  101. package/dist/components-harmony/slider/index.js +53 -0
  102. package/dist/components-harmony/swiper/index.css +3 -0
  103. package/dist/components-harmony/swiper/index.hml +14 -0
  104. package/dist/components-harmony/swiper/index.js +19 -0
  105. package/dist/components-harmony/switch/index.hml +7 -0
  106. package/dist/components-harmony/switch/index.js +16 -0
  107. package/dist/components-harmony/tabbar/index.css +7 -0
  108. package/dist/components-harmony/tabbar/index.hml +26 -0
  109. package/dist/components-harmony/tabbar/index.js +42 -0
  110. package/dist/components-harmony/textarea/index.hml +24 -0
  111. package/dist/components-harmony/textarea/index.js +92 -0
  112. package/dist/components-harmony/utils/index.js +41 -0
  113. package/dist/components-harmony/video/index.hml +7 -0
  114. package/dist/components-harmony/video/index.js +73 -0
  115. package/dist/components-harmony/web-view/index.hml +8 -0
  116. package/dist/components-harmony/web-view/index.js +22 -0
  117. package/dist/components-harmony-ets/base.ets +63 -0
  118. package/dist/components-harmony-ets/button.ets +119 -0
  119. package/dist/components-harmony-ets/checkbox.ets +219 -0
  120. package/dist/components-harmony-ets/element.ets +223 -0
  121. package/dist/components-harmony-ets/form.ets +149 -0
  122. package/dist/components-harmony-ets/icon.ets +84 -0
  123. package/dist/components-harmony-ets/image.ets +85 -0
  124. package/dist/components-harmony-ets/index.ts +49 -0
  125. package/dist/components-harmony-ets/innerHtml.ets +79 -0
  126. package/dist/components-harmony-ets/input.ets +195 -0
  127. package/dist/components-harmony-ets/label.ets +111 -0
  128. package/dist/components-harmony-ets/picker.ets +370 -0
  129. package/dist/components-harmony-ets/radio.ets +225 -0
  130. package/dist/components-harmony-ets/richText.ets +97 -0
  131. package/dist/components-harmony-ets/scrollView.ets +199 -0
  132. package/dist/components-harmony-ets/slider.ets +159 -0
  133. package/dist/components-harmony-ets/swiper.ets +204 -0
  134. package/dist/components-harmony-ets/switch.ets +113 -0
  135. package/dist/components-harmony-ets/text.ets +97 -0
  136. package/dist/components-harmony-ets/textArea.ets +169 -0
  137. package/dist/components-harmony-ets/utils/AttributeManager.ets +250 -0
  138. package/dist/components-harmony-ets/utils/DynamicCenter.ts +48 -0
  139. package/dist/components-harmony-ets/utils/constant/event.ets +25 -0
  140. package/dist/components-harmony-ets/utils/constant/icon.ts +19 -0
  141. package/dist/components-harmony-ets/utils/constant/style.ets +88 -0
  142. package/dist/components-harmony-ets/utils/events.ts +24 -0
  143. package/dist/components-harmony-ets/utils/flexManager.ets +107 -0
  144. package/dist/components-harmony-ets/utils/helper.ets +99 -0
  145. package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +103 -0
  146. package/dist/components-harmony-ets/utils/htmlParser/index.ts +56 -0
  147. package/dist/components-harmony-ets/utils/index.ts +83 -0
  148. package/dist/components-harmony-ets/utils/styles.ets +91 -0
  149. package/dist/components-harmony-ets/video.ets +161 -0
  150. package/dist/components-harmony-ets/view.ets +79 -0
  151. package/dist/index.js +1183 -0
  152. package/dist/index.js.map +1 -0
  153. package/dist/runtime-ets/bom/document.ts +38 -0
  154. package/dist/runtime-ets/bom/getComputedStyle.ts +5 -0
  155. package/dist/runtime-ets/bom/navigator.ts +21 -0
  156. package/dist/runtime-ets/bom/raf.ts +37 -0
  157. package/dist/runtime-ets/bom/window.ts +44 -0
  158. package/dist/runtime-ets/constant.ts +29 -0
  159. package/dist/runtime-ets/current.ts +16 -0
  160. package/dist/runtime-ets/dom/class-list.ts +117 -0
  161. package/dist/runtime-ets/dom/comment.ts +10 -0
  162. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +105 -0
  163. package/dist/runtime-ets/dom/document.ts +108 -0
  164. package/dist/runtime-ets/dom/element.ts +457 -0
  165. package/dist/runtime-ets/dom/event.ts +164 -0
  166. package/dist/runtime-ets/dom/eventTarget.ts +98 -0
  167. package/dist/runtime-ets/dom/node.ts +215 -0
  168. package/dist/runtime-ets/dom/stylesheet/index.ts +687 -0
  169. package/dist/runtime-ets/dom/stylesheet/type.ts +136 -0
  170. package/dist/runtime-ets/dom/stylesheet/util.ts +134 -0
  171. package/dist/runtime-ets/dom/text.ts +19 -0
  172. package/dist/runtime-ets/index.ts +19 -0
  173. package/dist/runtime-ets/interface/event.ts +9 -0
  174. package/dist/runtime-ets/interface/index.ts +1 -0
  175. package/dist/runtime-ets/utils/bind.ts +35 -0
  176. package/dist/runtime-ets/utils/index.ts +135 -0
  177. package/dist/runtime-ets/utils/info.ts +128 -0
  178. package/dist/runtime-framework/react/app.ts +256 -0
  179. package/dist/runtime-framework/react/connect.ts +24 -0
  180. package/dist/runtime-framework/react/constant.ts +5 -0
  181. package/dist/runtime-framework/react/hooks.ts +101 -0
  182. package/dist/runtime-framework/react/index.ts +16 -0
  183. package/dist/runtime-framework/react/page.ts +263 -0
  184. package/dist/runtime-framework/react/utils/index.ts +25 -0
  185. package/dist/runtime-framework/react/utils/is.ts +46 -0
  186. package/dist/runtime-framework/solid/README.md +99 -0
  187. package/dist/runtime-framework/solid/app.ts +200 -0
  188. package/dist/runtime-framework/solid/connect.ts +11 -0
  189. package/dist/runtime-framework/solid/contant.ts +5 -0
  190. package/dist/runtime-framework/solid/hooks.ts +88 -0
  191. package/dist/runtime-framework/solid/index.ts +10 -0
  192. package/dist/runtime-framework/solid/page.ts +202 -0
  193. package/dist/runtime-framework/solid/reconciler/h.ts +132 -0
  194. package/dist/runtime-framework/solid/reconciler/index.ts +3 -0
  195. package/dist/runtime-framework/solid/reconciler/props.ts +151 -0
  196. package/dist/runtime-framework/solid/reconciler/render.ts +61 -0
  197. package/dist/runtime-framework/solid/reconciler/use.ts +8 -0
  198. package/dist/runtime-framework/solid/utils/index.ts +49 -0
  199. package/dist/runtime-framework/solid/utils/is.ts +46 -0
  200. package/dist/runtime-utils.js +4149 -0
  201. package/dist/runtime-utils.js.map +1 -0
  202. package/dist/runtime.js +4150 -0
  203. package/dist/runtime.js.map +1 -0
  204. package/dist/template/container.js +7 -0
  205. package/index.js +4 -0
  206. package/package.json +54 -0
  207. package/types/api.d.ts +4 -0
  208. package/types/component.d.ts +4 -0
  209. package/types/harmony.d.ts +11 -0
  210. package/types/runtime.d.ts +15 -0
  211. package/types/taro.d.ts +7 -0
  212. package/types/webpack-sources.d.ts +108 -0
@@ -0,0 +1,28 @@
1
+ <div class="progress">
2
+ <div
3
+ if="{{showInfo && type == 'horizontal'}}"
4
+ class="progress-horizontal-showInfo"
5
+ style="min-height: {{fontSize}}px;"
6
+ >
7
+ <progress
8
+ style="color: {{progressColor}};background-color:{{progressBgColor}};stroke-width:{{strokeWidth}}"
9
+ type="{{type}}"
10
+ percent="{{percent}}"
11
+ secondarypercent="{{secondarypercent}}"
12
+ clockwise="{{clockwise}}"
13
+ >
14
+ </progress>
15
+ <text
16
+ style="font-size: {{fontSize}};width: 80px; text-align: center;"
17
+ >{{percent}}%</text>
18
+ </div>
19
+ <progress
20
+ else
21
+ style="color: {{progressColor}};background-color:{{progressBgColor}};stroke-width:{{strokeWidth}}"
22
+ type="{{type}}"
23
+ percent="{{percent}}"
24
+ secondarypercent="{{secondarypercent}}"
25
+ clockwise="{{clockwise}}"
26
+ >
27
+ </progress>
28
+ </div>
@@ -0,0 +1,23 @@
1
+ import { covertHex3ToHex6 } from '../utils'
2
+
3
+ export default {
4
+ props: [
5
+ 'type',
6
+ 'percent',
7
+ 'secondarypercent',
8
+ 'clockwise',
9
+ 'showInfo',
10
+ 'fontSize',
11
+ 'strokeWidth',
12
+ 'activeColor',
13
+ 'backgroundColor'
14
+ ],
15
+ computed: {
16
+ progressColor () {
17
+ return covertHex3ToHex6(this.activeColor)
18
+ },
19
+ progressBgColor () {
20
+ return covertHex3ToHex6(this.backgroundColor)
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,11 @@
1
+ <input
2
+ id="{{ id }}"
3
+ value="{{ value }}"
4
+ type="radio"
5
+ name="{{ nameValue }}"
6
+ disabled="{{disabled}}"
7
+ checked="{{ checked }}"
8
+ @change="onChange"
9
+ >
10
+ </input>
11
+
@@ -0,0 +1,41 @@
1
+ export default {
2
+ props: [
3
+ 'id',
4
+ 'name',
5
+ 'groupId',
6
+ 'value',
7
+ 'checked',
8
+ 'disabled'
9
+ ],
10
+
11
+ computed: {
12
+ nameValue () {
13
+ let name = this.name
14
+ if (this.groupId) {
15
+ name = this.groupId
16
+ }
17
+ return name
18
+ }
19
+ },
20
+
21
+ onChange (e) {
22
+ if (e.checked) {
23
+ const radioGroup = this.findRadioGroup()
24
+ if (radioGroup && radioGroup.onChange) {
25
+ radioGroup.onChange({ id: this.id, value: e.value })
26
+ }
27
+ }
28
+ },
29
+
30
+ findRadioGroup () {
31
+ let parent = this.$parent()
32
+ while (parent) {
33
+ if (!parent.$child) break
34
+ const radioGroup = parent.$child(this.groupId)
35
+ if (radioGroup) {
36
+ return radioGroup
37
+ }
38
+ parent = parent.$parent()
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,3 @@
1
+ <div id="{{ id }}">
2
+ <slot></slot>
3
+ </div>
@@ -0,0 +1,11 @@
1
+ import { createOption } from '../utils'
2
+
3
+ export default createOption({
4
+ props: [
5
+ 'id'
6
+ ],
7
+
8
+ onChange (e) {
9
+ this.$trigger('change', { value: e.value })
10
+ }
11
+ })
@@ -0,0 +1,5 @@
1
+ <richtext
2
+ id="{{ id }}"
3
+ class="{{ cls }}">
4
+ {{ nodeData }}
5
+ </richtext>
@@ -0,0 +1,16 @@
1
+ export default {
2
+ props: {
3
+ id: String,
4
+ cls: String,
5
+ nodes: String || Array
6
+ },
7
+ computed: {
8
+ nodeData () {
9
+ if (this.nodes && Array.isArray(this.nodes)) {
10
+ console.error('暂不支持节点列表参数')
11
+ return ''
12
+ }
13
+ return this.nodes
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,5 @@
1
+ .container {
2
+ width: 100%;
3
+ overflow: scroll;
4
+ align-items: center;
5
+ }
@@ -0,0 +1,12 @@
1
+ <div
2
+ id="{{id}}"
3
+ class="container"
4
+ style="flex-direction: {{flexDirection}};"
5
+ ref="el"
6
+ onreachstart="{{onReachStart}}"
7
+ onreachend="{{onReachEnd}}"
8
+ onreachtop="{{onReachTop}}"
9
+ onreachbottom="{{onReachBottom}}"
10
+ >
11
+ <slot></slot>
12
+ </div>
@@ -0,0 +1,65 @@
1
+ import { createOption } from '../utils'
2
+
3
+ export default createOption({
4
+ props: {
5
+ id: String,
6
+ scrollX: {
7
+ default: false
8
+ },
9
+ scrollY: {
10
+ default: false
11
+ },
12
+ scrollTop: Number,
13
+ scrollLeft: Number,
14
+ scrollWithAnimation: {
15
+ default: false
16
+ }
17
+ },
18
+ computed: {
19
+ flexDirection () {
20
+ return this.scrollX ? 'row' : (this.scrollY && 'column')
21
+ }
22
+ },
23
+ onInit () {
24
+ this.$watch('scrollTop', 'onScrollTopChange')
25
+ this.$watch('scrollLeft', 'onScrollLeftChange')
26
+ },
27
+ onScrollTopChange (newVal) {
28
+ this.scrollTo('y', newVal)
29
+ },
30
+ onScrollLeftChange (newVal) {
31
+ this.scrollTo('x', newVal)
32
+ },
33
+ scrollTo (direction, offset) {
34
+ const el = this.$refs.el
35
+ const options = {
36
+ smooth: this.scrollWithAnimation
37
+ }
38
+ options['d' + direction] = offset - el.getScrollOffset()[direction]
39
+ el.scrollBy(options)
40
+ },
41
+ onReachStart () {
42
+ this.triggerScrollToUpper('left')
43
+ },
44
+ onReachEnd () {
45
+ this.triggerScrollToLower('right')
46
+ },
47
+ onReachTop () {
48
+ this.triggerScrollToUpper('top')
49
+ },
50
+ onReachBottom () {
51
+ this.triggerScrollToLower('bottom')
52
+ },
53
+ triggerScrollToUpper (direction) {
54
+ this.$trigger('scrolltoupper', {
55
+ type: 'scrolltoupper',
56
+ detail: { direction }
57
+ })
58
+ },
59
+ triggerScrollToLower (direction) {
60
+ this.$trigger('scrolltolower', {
61
+ type: 'scrolltolower',
62
+ detail: { direction }
63
+ })
64
+ }
65
+ })
@@ -0,0 +1,16 @@
1
+ <div>
2
+ <slider
3
+ id="{{id}}"
4
+ style="color: {{color}};selected-color: {{selectedColor}};block-color: {{sliderBlockColor}}"
5
+ min="{{min}}"
6
+ max="{{max}}"
7
+ step="{{step}}"
8
+ disabled="{{disabled}}"
9
+ value="{{value}}"
10
+ showsteps="{{showsteps}}"
11
+ showtips="{{showtips}}"
12
+ onchange="onChange"
13
+ ></slider>
14
+ <text if="{{showValue}}" style="width: {{valueWidth}}; font-size: 14vp; color: gray">{{currentValue}}</text>
15
+ </div>
16
+
@@ -0,0 +1,53 @@
1
+ import { covertHex3ToHex6, createOption } from '../utils'
2
+
3
+ export default createOption({
4
+ props: [
5
+ 'id',
6
+ 'min',
7
+ 'max',
8
+ 'step',
9
+ 'disabled',
10
+ 'value',
11
+ 'backgroundcolor',
12
+ 'activecolor',
13
+ 'blockColor',
14
+ 'showValue',
15
+ 'showsteps',
16
+ 'showtips'
17
+ // 命名规则不一致因为 internalComponents 中有些使用驼峰,有些是短线,和其保持一致
18
+ ],
19
+ computed: {
20
+ color () {
21
+ return covertHex3ToHex6(this.backgroundcolor)
22
+ },
23
+ selectedColor () {
24
+ return covertHex3ToHex6(this.activecolor)
25
+ },
26
+ sliderBlockColor () {
27
+ return covertHex3ToHex6(this.blockColor)
28
+ },
29
+ valueWidth () {
30
+ if (!this.showValue) {
31
+ return '0px'
32
+ }
33
+ let baseWidth = 28
34
+ const maxLen = Math.max(this.min.toString()?.length, this.max.toString()?.length, this.step.toString()?.length)
35
+ if (maxLen > 3) {
36
+ baseWidth = baseWidth + (maxLen - 3) * 15
37
+ }
38
+ return baseWidth + 'vp'
39
+ }
40
+ },
41
+ data () {
42
+ return {
43
+ currentValue: this.value || 0
44
+ }
45
+ },
46
+ onChange (e) {
47
+ if (e.isEnd === 'true') {
48
+ this.$trigger('change', { progress: e.progress, isEnd: e.isEnd, value: e.value })
49
+ }
50
+ this.$trigger('changing', { progress: e.progress, isEnd: e.isEnd, value: e.value })
51
+ this.currentValue = e.value
52
+ }
53
+ })
@@ -0,0 +1,3 @@
1
+ swiper {
2
+ height: 150vp;
3
+ }
@@ -0,0 +1,14 @@
1
+ <swiper
2
+ style="indicator-color: {{indicatorColor}};indicator-selected-color: {{indicatorActiveColor}}"
3
+ id="{{id}}"
4
+ index="{{current}}"
5
+ autoplay="{{autoplay}}"
6
+ interval="{{interval}}"
7
+ indicator="{{indicatorDots}}"
8
+ duration="{{duration}}"
9
+ loop="{{circular}}"
10
+ vertical="{{vertical}}"
11
+ @change="onChange"
12
+ >
13
+ <slot></slot>
14
+ </swiper>
@@ -0,0 +1,19 @@
1
+ import { createOption } from '../utils'
2
+
3
+ export default createOption({
4
+ props: [
5
+ 'id',
6
+ 'indicatorDots',
7
+ 'indicatorColor',
8
+ 'indicatorActiveColor',
9
+ 'autoplay',
10
+ 'current',
11
+ 'interval',
12
+ 'duration',
13
+ 'circular',
14
+ 'vertical'
15
+ ],
16
+ onChange (e) {
17
+ this.$trigger('change', { current: e.index })
18
+ }
19
+ })
@@ -0,0 +1,7 @@
1
+ <div class="switch">
2
+ <input if="{{type === 'checkbox'}}" id="{{id}}" type="checkbox" checked="{{checked}}"
3
+ disabled="{{disabled}}" @change="onChange"></input>
4
+ <switch else id="{{id}}" checked="{{checked}}" disabled="{{disabled}}" showtext="{{showtext}}"
5
+ texton="{{texton}}" textoff="{{textoff}}" @change="onChange">
6
+ </switch>
7
+ </div>
@@ -0,0 +1,16 @@
1
+ import { createOption } from '../utils'
2
+
3
+ export default createOption({
4
+ props: [
5
+ 'id',
6
+ 'type',
7
+ 'checked',
8
+ 'disabled',
9
+ 'showtext',
10
+ 'texton',
11
+ 'textoff'
12
+ ],
13
+ onChange (e) {
14
+ this.$trigger('change', { value: e.checked })
15
+ }
16
+ })
@@ -0,0 +1,7 @@
1
+ toolbar {
2
+ position: fixed;
3
+ bottom: 0px;
4
+ left: 0;
5
+ right: 0;
6
+ border-top: 1px solid;
7
+ }
@@ -0,0 +1,26 @@
1
+ <toolbar style="border-color: {{borderStyle}};background-color: {{backgroundColor}};">
2
+ <block
3
+ for="{{tabbarData.list}}"
4
+ tid="pagePath"
5
+ >
6
+ <!--
7
+ 选用 if else 这种冗余的写法是因为这种写法:
8
+ color: {{$idx == selected ? selectedColor: color}}; 在 props 更新时不能正确触发 computed
9
+ 待框架修复这个问题或能兼容 Hex3 后,可以进行合并。
10
+ -->
11
+ <toolbar-item if="{{$idx != selected}}"
12
+ icon="{{$item.iconPath}}"
13
+ value="{{$item.text}}"
14
+ style="color: {{color}};background-color: transparent;"
15
+ onclick="jump($item.pagePath)"
16
+ >
17
+ </toolbar-item>
18
+ <toolbar-item else
19
+ icon="{{$item.selectedIconPath}}"
20
+ value="{{$item.text}}"
21
+ style="color: {{selectedColor}};background-color: transparent;"
22
+ onclick="jump($item.pagePath)"
23
+ >
24
+ </toolbar-item>
25
+ </block>
26
+ </toolbar>
@@ -0,0 +1,42 @@
1
+ import router from '@system.router'
2
+
3
+ import { covertHex3ToHex6 } from '../utils'
4
+
5
+ export default {
6
+ props: {
7
+ tabbarData: {
8
+ default: {}
9
+ },
10
+ selected: Number
11
+ },
12
+ computed: {
13
+ borderStyle () {
14
+ return this.tabbarData.borderStyle || 'black'
15
+ },
16
+ color () {
17
+ return covertHex3ToHex6(this.tabbarData.color)
18
+ },
19
+ selectedColor () {
20
+ return covertHex3ToHex6(this.tabbarData.selectedColor)
21
+ },
22
+ backgroundColor () {
23
+ return covertHex3ToHex6(this.tabbarData.backgroundColor)
24
+ }
25
+ },
26
+ jump (pagePath) {
27
+ // TODO 如果跳的 tabbar 页已打开过,优先复用
28
+ const app = getApp()
29
+ const pages = app.pageStack
30
+
31
+ for (let i = 0; i < pages.length; i++) {
32
+ const item = pages[i]
33
+ if (item === pagePath) {
34
+ return router.back({
35
+ uri: item
36
+ })
37
+ }
38
+ }
39
+
40
+ router.push({ uri: pagePath })
41
+ }
42
+ }
@@ -0,0 +1,24 @@
1
+ <textarea
2
+ id={{id}}
3
+ value="{{value}}"
4
+ placeholder="{{placeholder}}"
5
+ maxlength="{{maxlength}}"
6
+ disabled="{{disabled}}"
7
+ headericon="{{headericon}}"
8
+ extend="{{autoHeight}}"
9
+ showcounter="{{showcounter}}"
10
+ menuoptions="{{menuoptions}}"
11
+ autofocus="{{autoFocus}}"
12
+ selectedstart="{{selectionStart}}"
13
+ selectedend="{{selectionEnd}}"
14
+ softkeyboardenabled="{{softkeyboardenabled}}"
15
+ @change="onInput"
16
+ @focus="onFocus"
17
+ @blur="onBlur"
18
+ @translate="onTranslate"
19
+ @share="onShare"
20
+ @search="onSearch"
21
+ @optionselect="onOptionSelect"
22
+ @selectchange="onSelectChange"
23
+ >
24
+ </textarea>
@@ -0,0 +1,92 @@
1
+ import window from '@ohos.window'
2
+
3
+ import { createOption } from '../utils'
4
+
5
+ export default createOption({
6
+ data () {
7
+ return {
8
+ textareaValue: this.value || '',
9
+ height: 0
10
+ }
11
+ },
12
+
13
+ props: [
14
+ 'id',
15
+ 'value',
16
+ 'disabled',
17
+ 'placeholder',
18
+ 'maxlength',
19
+ 'autoFocus',
20
+ 'autoHeight',
21
+ 'selectionStart',
22
+ 'selectionEnd',
23
+ 'headericon',
24
+ 'showcounter',
25
+ 'menuoptions',
26
+ 'softkeyboardenabled'
27
+ ],
28
+
29
+ onInit () {
30
+ this.windowClass = window.getTopWindow()
31
+ this.windowClass.then(win => {
32
+ win.on('keyboardHeightChange', (err, data) => {
33
+ if (!err) {
34
+ if (this.height !== data.height) {
35
+ this.onKeyboardHeightChange(data.height)
36
+ }
37
+ this.height = data.height
38
+ }
39
+ })
40
+ })
41
+ this.$watch('value', 'onPropertyChange')
42
+ },
43
+
44
+ onPropertyChange (newV) {
45
+ this.textareaValue = newV
46
+ },
47
+
48
+ onInput (e) {
49
+ this.textareaValue = e.value
50
+ this.$trigger('input', {
51
+ value: e.text, cursor: e.text.length, keyCode: null
52
+ })
53
+ },
54
+
55
+ onFocus () {
56
+ this.$trigger('focus', {
57
+ value: this.textareaValue, height: this.height
58
+ })
59
+ },
60
+
61
+ onBlur () {
62
+ this.$trigger('blur', {
63
+ value: this.textareaValue, height: this.height
64
+ })
65
+ },
66
+
67
+ onTranslate (e) {
68
+ this.$trigger('translate', e)
69
+ },
70
+
71
+ onShare (e) {
72
+ this.$trigger('share', e)
73
+ },
74
+
75
+ onSearch (e) {
76
+ this.$trigger('search', e)
77
+ },
78
+
79
+ onOptionSelect (e) {
80
+ this.$trigger('optionselect', e)
81
+ },
82
+
83
+ onSelectChange (e) {
84
+ this.$trigger('selectchange', e)
85
+ },
86
+
87
+ onKeyboardHeightChange (height) {
88
+ this.$trigger('keyboardheightchange', {
89
+ height, duration: 0
90
+ })
91
+ }
92
+ })
@@ -0,0 +1,41 @@
1
+ export function covertHex3ToHex6 (color) {
2
+ return color && color.replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i, '#$1$1$2$2$3$3')
3
+ }
4
+
5
+ export function createOption (option) {
6
+ option.$trigger = function (event, params) {
7
+ this.$emit(event, { id: this.id, ...params })
8
+ }
9
+ return option
10
+ }
11
+
12
+ export function queryToJson (str) {
13
+ const dec = decodeURIComponent
14
+ const qp = str.split('&')
15
+ const ret = {}
16
+ let name
17
+ let val
18
+ for (let i = 0, l = qp.length, item; i < l; ++i) {
19
+ item = qp[i]
20
+ if (item.length) {
21
+ const s = item.indexOf('=')
22
+ if (s < 0) {
23
+ name = dec(item)
24
+ val = ''
25
+ } else {
26
+ name = dec(item.slice(0, s))
27
+ val = dec(item.slice(s + 1))
28
+ }
29
+ if (typeof ret[name] === 'string') {
30
+ ret[name] = [ret[name]]
31
+ }
32
+
33
+ if (Array.isArray(ret[name])) {
34
+ ret[name].push(val)
35
+ } else {
36
+ ret[name] = val
37
+ }
38
+ }
39
+ }
40
+ return ret
41
+ }
@@ -0,0 +1,7 @@
1
+ <div>
2
+ <video id="{{id}}" style="object-fit:{{objectFit}};" src="{{src}}" muted="{{muted}}"
3
+ autoplay="{{autoplay}}" poster="{{poster}}" controls="{{controls}}" direction="{{videoDirection}}" loop="{{loop}}" starttime="{{initialTime}}"
4
+ speed="{{speed}}" @prepared="preparedCallback" @start="startCallback" @pause="pauseCallback"
5
+ @finish="finishCallback" @stop="stopCallback" @error="errorCallback" @seeked="seekedCallback"
6
+ @timeupdate="timeupdateCallback" @fullscreenchange="fullscreenChangeCallback" @click="clickCallback"></video>
7
+ </div>