@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,51 @@
1
+ const View = 'view';
2
+ const Icon = 'icon';
3
+ const Progress = 'progress';
4
+ const RichText = 'rich-text';
5
+ const Text = 'text';
6
+ const Button = 'button';
7
+ const Checkbox = 'checkbox';
8
+ const CheckboxGroup = 'checkbox-group';
9
+ const Form = 'form';
10
+ const Input = 'input';
11
+ const Label = 'label';
12
+ const Picker = 'picker';
13
+ const PickerView = 'picker-view';
14
+ const PickerViewColumn = 'picker-view-column';
15
+ const Radio = 'radio';
16
+ const RadioGroup = 'radio-group';
17
+ const Slider = 'slider';
18
+ const Switch = 'switch';
19
+ const CoverImage = 'cover-image';
20
+ const Textarea = 'textarea';
21
+ const CoverView = 'cover-view';
22
+ const MovableArea = 'movable-area';
23
+ const MovableView = 'movable-view';
24
+ const ScrollView = 'scroll-view';
25
+ const Swiper = 'swiper';
26
+ const SwiperItem = 'swiper-item';
27
+ const Navigator = 'navigator';
28
+ const Audio = 'audio';
29
+ const Camera = 'camera';
30
+ const Image = 'image';
31
+ const LivePlayer = 'live-player';
32
+ const Video = 'video';
33
+ const Canvas = 'canvas';
34
+ const Ad = 'ad';
35
+ const WebView = 'web-view';
36
+ const Block = 'block';
37
+ const Map = 'map';
38
+ const Slot = 'slot';
39
+ const NativeSlot = 'native-slot';
40
+ const CustomWrapper = 'custom-wrapper';
41
+
42
+ // For React.createElement's type
43
+ const Span = 'span';
44
+ const Tabs = 'tabs';
45
+ const TabBar = 'tab-bar';
46
+ const TabContent = 'tab-content';
47
+ const List = 'list';
48
+ const ListItem = 'list-item';
49
+
50
+ export { Ad, Audio, Block, Button, Camera, Canvas, Checkbox, CheckboxGroup, CoverImage, CoverView, CustomWrapper, Form, Icon, Image, Input, Label, List, ListItem, LivePlayer, Map, MovableArea, MovableView, NativeSlot, Navigator, Picker, PickerView, PickerViewColumn, Progress, Radio, RadioGroup, RichText, ScrollView, Slider, Slot, Span, Swiper, SwiperItem, Switch, TabBar, TabContent, Tabs, Text, Textarea, Video, View, WebView };
51
+ //# sourceMappingURL=components-react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-react.js","sources":["../../src/components/components-react.ts"],"sourcesContent":["// For React.createElement's type\nexport * from '@tarojs/components/mini'\nexport const Span = 'span'\nexport const Tabs = 'tabs'\nexport const TabBar = 'tab-bar'\nexport const TabContent = 'tab-content'\nexport const List = 'list'\nexport const ListItem = 'list-item'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAEO,MAAM,IAAI,GAAG,OAAM;AACnB,MAAM,IAAI,GAAG,OAAM;AACnB,MAAM,MAAM,GAAG,UAAS;AACxB,MAAM,UAAU,GAAG,cAAa;AAChC,MAAM,IAAI,GAAG,OAAM;AACnB,MAAM,QAAQ,GAAG;;;;"}
@@ -0,0 +1,109 @@
1
+ div {
2
+ display: flex;
3
+ justify-content: center;
4
+ margin-top: 20px;
5
+ margin-bottom: 20px;
6
+ }
7
+
8
+ button {
9
+ height: 98px;
10
+ font-size: 36px;
11
+ }
12
+
13
+ .type-default {
14
+ background-color: #f8f8f8;
15
+ text-color: #000;
16
+ border: 1px solid #eee;
17
+ }
18
+
19
+ .type-primary {
20
+ background-color: #1aad19;
21
+ text-color: #fff;
22
+ }
23
+
24
+ .type-warn {
25
+ background-color: #e64340;
26
+ text-color: #fff;
27
+ }
28
+
29
+ .type-warn-plain {
30
+ background-color: transparent;
31
+ border: 1px solid #e64340;
32
+ text-color: #e64340;
33
+ }
34
+
35
+ .type-default-plain {
36
+ background-color: transparent;
37
+ border: 1px solid #353535;
38
+ text-color: #353535;
39
+ }
40
+
41
+ .type-primary-plain {
42
+ background-color: transparent;
43
+ border: 1px solid #1aad19;
44
+ text-color: #1aad19;
45
+ }
46
+
47
+ .disbaled {
48
+ text-color: hsla(0,0%,100%,.6);
49
+ }
50
+
51
+ .type-default-disabled {
52
+ background-color: #f7f7f7;
53
+ text-color: rgba(0,0,0,.3);
54
+ border: 1px solid #eee;
55
+ }
56
+
57
+ .type-primary-disabled {
58
+ background-color: #9ed99d;
59
+ }
60
+
61
+ .type-warn-disabled {
62
+ background-color: #ec8b89;
63
+ }
64
+
65
+ .type-default-plain-disabled {
66
+ border-color: rgba(0,0,0,.2);
67
+ text-color: rgba(0,0,0,.2);
68
+ }
69
+
70
+ .type-primary-plain-disabled {
71
+ border-color: rgba(0,0,0,.2);
72
+ text-color: rgba(0,0,0,.2);
73
+ }
74
+
75
+ .type-warn-plain-disabled {
76
+ border-color: rgba(0,0,0,.2);
77
+ text-color: rgba(0,0,0,.2);
78
+ }
79
+
80
+ .type-default-loading {
81
+ background-color: #dedede;
82
+ color: rgba(0,0,0,.6);
83
+ }
84
+
85
+ .type-warn-loading {
86
+ background-color: #ce3c39;
87
+ color: hsla(0,0%,100%,.6);
88
+ }
89
+
90
+ .type-primary-loading {
91
+ background-color: #179b16;
92
+ color: hsla(0,0%,100%,.6);
93
+ }
94
+
95
+ .size-default {
96
+ width: 100%;
97
+ }
98
+
99
+ .size-mini {
100
+ width: 200px;
101
+ height: 72px;
102
+ font-size: 26px;
103
+ }
104
+
105
+ .button-hover {
106
+ background-color: #dedede;
107
+ text-color: rgba(0,0,0,.6);
108
+ transition: all linear 0.2s;
109
+ }
@@ -0,0 +1,31 @@
1
+ <div>
2
+ <input
3
+ type='submit'
4
+ if="{{formType === 'submit'}}"
5
+ id="{{id}}"
6
+ class="{{cls}} {{clsType}} {{clsSize}} {{clsPlain}} {{clsDisable}} {{clsDisableType}} {{clsLoading}} {{clsHover}}"
7
+ disabled="{{disabled}}"
8
+ @touchstart="onTouchStart"
9
+ @touchend="onTouchEnd"
10
+ >{{value}}</input>
11
+ <input
12
+ type='reset'
13
+ elif="{{formType === 'reset'}}"
14
+ id="{{id}}"
15
+ class="{{cls}} {{clsType}} {{clsSize}} {{clsPlain}} {{clsDisable}} {{clsDisableType}} {{clsLoading}} {{clsHover}}"
16
+ disabled="{{disabled}}"
17
+ @touchstart="onTouchStart"
18
+ @touchend="onTouchEnd"
19
+ >{{value}}</input>
20
+ <button
21
+ else
22
+ id="{{id}}"
23
+ class="{{cls}} {{clsType}} {{clsSize}} {{clsPlain}} {{clsDisable}} {{clsDisableType}} {{clsLoading}} {{clsHover}}"
24
+ type="{{harmonyType}}"
25
+ disabled="{{disabled}}"
26
+ waiting="{{loading}}"
27
+ @click="onClick"
28
+ @touchstart="onTouchStart"
29
+ @touchend="onTouchEnd"
30
+ >{{value}}</button>
31
+ </div>
@@ -0,0 +1,105 @@
1
+ import { createOption } from '../utils'
2
+
3
+ export default createOption({
4
+ props: {
5
+ id: {
6
+ default: ''
7
+ },
8
+ cls: {
9
+ default: ''
10
+ },
11
+ type: {
12
+ default: 'default'
13
+ },
14
+ harmonyType: {
15
+ default: 'capsule'
16
+ },
17
+ size: {
18
+ default: 'default'
19
+ },
20
+ plain: {
21
+ default: false
22
+ },
23
+ disabled: {
24
+ default: false
25
+ },
26
+ loading: {
27
+ default: false
28
+ },
29
+ hoverStartTime: {
30
+ default: 20
31
+ },
32
+ hoverStayTime: {
33
+ default: 70
34
+ },
35
+ hoverClass: {
36
+ default: 'button-hover'
37
+ },
38
+ formType: {
39
+ default: null
40
+ },
41
+ cn: {
42
+ default: []
43
+ }
44
+ },
45
+ data () {
46
+ return {
47
+ hover: false,
48
+ touch: false
49
+ }
50
+ },
51
+ computed: {
52
+ clsType () {
53
+ return `type-${this.type}`
54
+ },
55
+ clsSize () {
56
+ return `size-${this.size}`
57
+ },
58
+ clsPlain () {
59
+ if (!this.plain) return ''
60
+ return `type-${this.type}-plain`
61
+ },
62
+ clsDisable () {
63
+ if (!this.disabled) return ''
64
+ return 'disabled'
65
+ },
66
+ clsLoading () {
67
+ if (!this.loading) return ''
68
+ return `type-${this.type}-loading`
69
+ },
70
+ clsDisableType () {
71
+ if (!this.disabled) return ''
72
+ if (this.plain) return `type-${this.type}-plain-disabled`
73
+ return `type-${this.type}-disabled`
74
+ },
75
+ clsHover () {
76
+ return this.hover && !this.disabled ? this.hoverClass : ''
77
+ },
78
+ value () {
79
+ return this.cn.map(i => i.v).join('')
80
+ }
81
+ },
82
+ onTouchStart () {
83
+ this.touch = true
84
+ if (this.hoverClass && !this.disabled) {
85
+ setTimeout(() => {
86
+ if (this.touch) {
87
+ this.hover = true
88
+ }
89
+ }, this.hoverStartTime)
90
+ }
91
+ },
92
+ onTouchEnd () {
93
+ this.touch = false
94
+ if (this.hoverClass && !this.disabled) {
95
+ setTimeout(() => {
96
+ if (!this.touch) {
97
+ this.hover = false
98
+ }
99
+ }, this.hoverStayTime)
100
+ }
101
+ },
102
+ onClick () {
103
+ this.$trigger('tap')
104
+ }
105
+ })
@@ -0,0 +1,6 @@
1
+ <camera
2
+ id="{{id}}"
3
+ flash="{{flash}}"
4
+ deviceposition="{{devicePosition}}"
5
+ @error="onError"
6
+ ></camera>
@@ -0,0 +1,12 @@
1
+ import { createOption } from '../utils'
2
+
3
+ export default createOption({
4
+ props: [
5
+ 'id',
6
+ 'flash',
7
+ 'devicePosition'
8
+ ],
9
+ onError () {
10
+ this.$trigger('error', { errMsg: '用户不允许使用摄像头' })
11
+ }
12
+ })
@@ -0,0 +1,11 @@
1
+ <div>
2
+ <input
3
+ id="{{id}}"
4
+ name="{{name}}"
5
+ type="checkbox"
6
+ checked="{{checked}}"
7
+ disabled="{{disabled}}"
8
+ @change="onChange"
9
+ ></input>
10
+ <text if="{{textValue !== ''}}">{{textValue}}</text>
11
+ </div>
@@ -0,0 +1,60 @@
1
+ export default {
2
+ props: [
3
+ 'id',
4
+ 'value',
5
+ 'name',
6
+ 'disabled',
7
+ 'checked',
8
+ 'groupId',
9
+ 'cn'
10
+ ],
11
+ computed: {
12
+ textValue () {
13
+ const cn = this.cn
14
+ return cn && cn[0] && cn[0].nn === '#text' ? cn[0].v : ''
15
+ }
16
+ },
17
+ onAttached () {
18
+ const checkboxGroup = this.findCheckboxGroup()
19
+ if (checkboxGroup && this.checked) {
20
+ checkboxGroup.collectValue(this.value)
21
+ }
22
+ },
23
+ onChange (e) {
24
+ const checkboxGroup = this.findCheckboxGroup()
25
+
26
+ if (!checkboxGroup) return
27
+
28
+ if (e.checked) {
29
+ checkboxGroup.collectValue(this.value)
30
+ } else {
31
+ checkboxGroup.removeValue(this.value)
32
+ }
33
+ checkboxGroup.onChange()
34
+ },
35
+ onDestroy () {
36
+ let checkboxGroup
37
+
38
+ try {
39
+ // 可能父元素已经卸载了,不 catch 会报错
40
+ checkboxGroup = this.findCheckboxGroup()
41
+ // eslint-disable-next-line no-empty
42
+ } catch (error) {}
43
+
44
+ if (checkboxGroup && this.checked) {
45
+ checkboxGroup.removeValue(this.value)
46
+ }
47
+ },
48
+ findCheckboxGroup () {
49
+ let parent = this.$parent()
50
+ while (parent && parent.$child) {
51
+ // parent.$child(this.groupId) 这是鸿蒙的 bug。
52
+ // 等待修复后,直接 parent 就行
53
+ const checkboxGroup = parent.$child(this.groupId)
54
+ if (checkboxGroup) {
55
+ return checkboxGroup
56
+ }
57
+ parent = parent.$parent()
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,3 @@
1
+ <div id="{{id}}">
2
+ <slot></slot>
3
+ </div>
@@ -0,0 +1,22 @@
1
+ import { createOption } from '../utils'
2
+
3
+ export default createOption({
4
+ data: {
5
+ values: []
6
+ },
7
+ props: [
8
+ 'id'
9
+ ],
10
+ onChange () {
11
+ this.$trigger('change', { value: this.values })
12
+ },
13
+ collectValue (value) {
14
+ this.values.push(value)
15
+ },
16
+ removeValue (value) {
17
+ const idx = this.values.indexOf(value)
18
+ if (idx > -1) {
19
+ this.values.splice(idx, 1)
20
+ }
21
+ }
22
+ })
@@ -0,0 +1,4 @@
1
+ .cover-image {
2
+ height: 240vp;
3
+ width: 320vp;
4
+ }
@@ -0,0 +1,9 @@
1
+ <div class="cover-image">
2
+ <image
3
+ id="{{id}}"
4
+ alt="{{alt}}"
5
+ src="{{src}}"
6
+ @complete="onLoad"
7
+ @error="onError"
8
+ ></image>
9
+ </div>
@@ -0,0 +1,15 @@
1
+ import { createOption } from '../utils'
2
+
3
+ export default createOption({
4
+ props: [
5
+ 'id',
6
+ 'src',
7
+ 'alt'
8
+ ],
9
+ onLoad (e) {
10
+ this.$trigger('load', { width: e.width, height: e.height })
11
+ },
12
+ onError () {
13
+ this.$trigger('error', { errMsg: '图片加载异常' })
14
+ }
15
+ })
@@ -0,0 +1,10 @@
1
+ <div>
2
+ <form
3
+ id="{{id}}"
4
+ class="{{cls}}"
5
+ @submit="onSubmit"
6
+ @reset="onReset"
7
+ >
8
+ <slot></slot>
9
+ </form>
10
+ </div>
@@ -0,0 +1,11 @@
1
+ import { createOption } from '../utils'
2
+
3
+ export default createOption({
4
+ props: ['cls', 'id'],
5
+ onSubmit (e) {
6
+ this.$trigger('submit', { value: e.value })
7
+ },
8
+ onReset () {
9
+ this.$trigger('reset')
10
+ }
11
+ })
@@ -0,0 +1,27 @@
1
+ @font-face {
2
+ font-family: taroicon;
3
+ src: url('https://storage.360buyimg.com/datapool/iconfont.ttf');
4
+ }
5
+ .taro-icon {
6
+ font-family: taroicon;
7
+ font-size: 23vp;
8
+ font-style: normal;
9
+ }
10
+ .icon-success,
11
+ .icon-success_no_circle,
12
+ .icon-download,
13
+ .icon-info_circle {
14
+ color: #09bb07;
15
+ }
16
+ .icon-info,
17
+ .icon-waiting {
18
+ color: #10aeff;
19
+ }
20
+ .icon-warn,
21
+ .icon-cancel {
22
+ color: #f76260;
23
+ }
24
+ .icon-clear,
25
+ .icon-search {
26
+ color: #b2b2b2;
27
+ }
@@ -0,0 +1,54 @@
1
+ <div
2
+ id="{{id}}"
3
+ >
4
+ <text
5
+ if="{{type === 'success'}}"
6
+ class="taro-icon icon-success"
7
+ style=" color: {{iconColor}};font-size: {{size}}vp;min-width: {{size}}vp;"
8
+ >&#xe60c;</text>
9
+ <text
10
+ if="{{type === 'success_no_circle'}}"
11
+ class="taro-icon icon-success_no_circle"
12
+ style=" color: {{iconColor}};font-size: {{size}}vp;min-width: {{size}}vp;"
13
+ >&#xe60d;</text>
14
+ <text
15
+ if="{{type === 'info'}}"
16
+ class="taro-icon icon-info"
17
+ style=" color: {{iconColor}};font-size: {{size}}vp;min-width: {{size}}vp;"
18
+ >&#xe60e;</text>
19
+ <text
20
+ if="{{type === 'info_circle'}}"
21
+ class="taro-icon icon-info_circle"
22
+ style=" color: {{iconColor}};font-size: {{size}}vp;min-width: {{size}}vp;"
23
+ >&#xe608;</text>
24
+ <text
25
+ if="{{type === 'warn'}}"
26
+ class="taro-icon icon-warn"
27
+ style=" color: {{iconColor}};font-size: {{size}}vp;min-width: {{size}}vp;"
28
+ >&#xe60b;</text>
29
+ <text
30
+ if="{{type === 'waiting'}}"
31
+ class="taro-icon icon-waiting"
32
+ style=" color: {{iconColor}};font-size: {{size}}vp;min-width: {{size}}vp;"
33
+ >&#xe60a;</text>
34
+ <text
35
+ if="{{type === 'cancel'}}"
36
+ class="taro-icon icon-cancel"
37
+ style=" color: {{iconColor}};font-size: {{size}}vp;min-width: {{size}}vp;"
38
+ >&#xe607;</text>
39
+ <text
40
+ if="{{type === 'download'}}"
41
+ class="taro-icon icon-download"
42
+ style=" color: {{iconColor}};font-size: {{size}}vp;min-width: {{size}}vp;"
43
+ >&#xe606;</text>
44
+ <text
45
+ if="{{type === 'search'}}"
46
+ class="taro-icon icon-search"
47
+ style=" color: {{iconColor}};font-size: {{size}}vp;min-width: {{size}}vp;"
48
+ >&#xe609;</text>
49
+ <text
50
+ if="{{type === 'clear'}}"
51
+ class="taro-icon icon-clear"
52
+ style=" color: {{iconColor}};font-size: {{size}}vp;min-width: {{size}}vp;"
53
+ >&#xe605;</text>
54
+ </div>
@@ -0,0 +1,17 @@
1
+ import { covertHex3ToHex6 } from '../utils'
2
+
3
+ export default {
4
+ props: {
5
+ size: {
6
+ default: 23
7
+ },
8
+ type: String,
9
+ id: String,
10
+ color: String
11
+ },
12
+ computed: {
13
+ iconColor () {
14
+ return covertHex3ToHex6(this.color)
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,5 @@
1
+ .image {
2
+ height: 240vp;
3
+ width: 320vp;
4
+ }
5
+
@@ -0,0 +1,11 @@
1
+ <div class="image">
2
+ <image
3
+ id="{{id}}"
4
+ style="object-fit: {{objectFit}};"
5
+ src="{{src}}"
6
+ alt="{{alt}}"
7
+ @complete="onLoad"
8
+ @error="onError"
9
+ ></image>
10
+ </div>
11
+
@@ -0,0 +1,28 @@
1
+ import { createOption } from '../utils'
2
+
3
+ const modeMap = {
4
+ scaleToFill: 'fill',
5
+ aspectFit: 'contain',
6
+ aspectFill: 'cover'
7
+ }
8
+
9
+ export default createOption({
10
+ props: [
11
+ 'id',
12
+ 'mode',
13
+ 'src',
14
+ 'alt',
15
+ 'style'
16
+ ],
17
+ computed: {
18
+ objectFit () {
19
+ return modeMap[this.mode] || ''
20
+ }
21
+ },
22
+ onLoad (e) {
23
+ this.$trigger('load', { width: e.width, height: e.height })
24
+ },
25
+ onError () {
26
+ this.$trigger('error', { errMsg: '图片加载异常' })
27
+ }
28
+ })
@@ -0,0 +1,21 @@
1
+ <div>
2
+ <input
3
+ id="{{ id }}"
4
+ value="{{ value }}"
5
+ name="{{ name }}"
6
+ type="{{ realType }}"
7
+ placeholder="{{ placeholder }}"
8
+ style="placeholder-color: {{placeholderColor}};"
9
+ autofocus="{{ focus }}"
10
+ enterkeytype="{{ confirmType }}"
11
+ maxlength="{{ maxlength }}"
12
+ disabled="{{ disabled }}"
13
+
14
+ @change="onInput"
15
+ @focus="onFocus"
16
+ @blur="onBlur"
17
+ @enterkeyclick="onEnterKeyClick"
18
+ >
19
+ </input>
20
+ </div>
21
+