@tarojs/components 3.4.0-beta.3 → 3.5.0-canary.1

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 (67) hide show
  1. package/dist/cjs/taro-input-core.cjs.entry.js +13 -1
  2. package/dist/cjs/taro-scroll-view-core.cjs.entry.js +3 -3
  3. package/dist/cjs/taro-tabbar.cjs.entry.js +1 -1
  4. package/dist/collection/components/input/input.js +27 -1
  5. package/dist/collection/components/scroll-view/scroll-view.js +3 -3
  6. package/dist/collection/components/tabbar/style/index.css +1 -1
  7. package/dist/esm/taro-input-core.entry.js +13 -1
  8. package/dist/esm/taro-scroll-view-core.entry.js +3 -3
  9. package/dist/esm/taro-tabbar.entry.js +1 -1
  10. package/dist/esm-es5/taro-input-core.entry.js +1 -1
  11. package/dist/esm-es5/taro-scroll-view-core.entry.js +1 -1
  12. package/dist/esm-es5/taro-tabbar.entry.js +1 -1
  13. package/dist/taro-components/p-33ee636a.system.js +1 -1
  14. package/dist/taro-components/p-9dc9c615.system.entry.js +1 -0
  15. package/dist/taro-components/p-abe415b4.system.entry.js +1 -0
  16. package/dist/taro-components/p-b55fedc1.entry.js +1 -0
  17. package/dist/taro-components/{p-6965567d.entry.js → p-cc818a13.entry.js} +1 -1
  18. package/dist/taro-components/{p-dd34408a.entry.js → p-e1040131.entry.js} +1 -1
  19. package/dist/taro-components/{p-13c1404f.system.entry.js → p-fd0d1168.system.entry.js} +1 -1
  20. package/dist/taro-components/taro-components.esm.js +1 -1
  21. package/dist/types/components/input/input.d.ts +3 -0
  22. package/dist/types/components.d.ts +1 -0
  23. package/dist-h5/vue/components/picker.js +2 -1
  24. package/package.json +3 -3
  25. package/types/Ad.d.ts +13 -1
  26. package/types/Audio.d.ts +22 -2
  27. package/types/Button.d.ts +84 -11
  28. package/types/Camera.d.ts +1 -1
  29. package/types/Canvas.d.ts +14 -1
  30. package/types/Checkbox.d.ts +65 -1
  31. package/types/CoverImage.d.ts +48 -6
  32. package/types/CoverView.d.ts +51 -8
  33. package/types/Editor.d.ts +57 -0
  34. package/types/Form.d.ts +33 -2
  35. package/types/Icon.d.ts +17 -1
  36. package/types/Image.d.ts +22 -2
  37. package/types/Input.d.ts +66 -5
  38. package/types/Label.d.ts +18 -4
  39. package/types/LivePlayer.d.ts +7 -1
  40. package/types/LivePusher.d.ts +7 -1
  41. package/types/Map.d.ts +55 -1
  42. package/types/MatchMedia.d.ts +24 -5
  43. package/types/MovableArea.d.ts +9 -3
  44. package/types/MovableView.d.ts +20 -6
  45. package/types/OfficialAccount.d.ts +0 -6
  46. package/types/OpenData.d.ts +7 -1
  47. package/types/PageContainer.d.ts +6 -0
  48. package/types/Picker.d.ts +64 -1
  49. package/types/PickerView.d.ts +66 -2
  50. package/types/PickerViewColumn.d.ts +1 -1
  51. package/types/Progress.d.ts +12 -1
  52. package/types/Radio.d.ts +77 -1
  53. package/types/RichText.d.ts +33 -1
  54. package/types/ScrollView.d.ts +91 -9
  55. package/types/Slider.d.ts +14 -1
  56. package/types/Swiper.d.ts +26 -1
  57. package/types/SwiperItem.d.ts +28 -3
  58. package/types/Switch.d.ts +21 -3
  59. package/types/Text.d.ts +38 -1
  60. package/types/Textarea.d.ts +17 -1
  61. package/types/Video.d.ts +41 -21
  62. package/types/View.d.ts +33 -1
  63. package/types/VoipRoom.d.ts +5 -6
  64. package/types/WebView.d.ts +7 -1
  65. package/dist/taro-components/p-665e8461.system.entry.js +0 -1
  66. package/dist/taro-components/p-6fcaadc7.entry.js +0 -1
  67. package/dist/taro-components/p-bb0d4567.system.entry.js +0 -1
package/types/Text.d.ts CHANGED
@@ -41,7 +41,7 @@ declare namespace TextProps {
41
41
  /** 文本
42
42
  * @classification base
43
43
  * @supported weapp, swan, alipay, tt, h5, rn
44
- * @example
44
+ * @example_react
45
45
  * ```tsx
46
46
  * export default class PageView extends Component {
47
47
  * state = {
@@ -84,6 +84,43 @@ declare namespace TextProps {
84
84
  * }
85
85
  * }
86
86
  * ```
87
+ * @example_vue
88
+ * ``` html
89
+ * <template>
90
+ * <view class="container">
91
+ * <view v-for="(item, index) in contents">
92
+ * <text>{{item.text}} line {{index + 1}}</text>
93
+ * </view>
94
+ * <button class="btn-max-w button_style" :plain="true" type="default" `@tap="add">add line</button>
95
+ * <button class="btn-max-w button_style" :plain="true" type="default" :disabled="contentsLen ? false : true" `@tap="remove">remove line</button>
96
+ * </template>
97
+ *
98
+ * <script>
99
+ * export default {
100
+ * data() {
101
+ * return {
102
+ * contents: [],
103
+ * contentsLen: 0
104
+ * }
105
+ * },
106
+ * methods: {
107
+ * add () {
108
+ * const cot = this.contents.slice()
109
+ * cot.push({ text: 'hello world' })
110
+ * this.contents = cot
111
+ * this.contentsLen = cot.length
112
+ * },
113
+ *
114
+ * remove () {
115
+ * const cot = this.contents.slice()
116
+ * cot.pop()
117
+ * this.contents = cot
118
+ * this.contentsLen = cot.length
119
+ * }
120
+ * }
121
+ * }
122
+ * </script>
123
+ * ```
87
124
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/text.html
88
125
  */
89
126
  declare const Text: ComponentType<TextProps>
@@ -138,6 +138,11 @@ interface TextareaProps extends StandardProps, FormItemProps {
138
138
  * @supported weapp
139
139
  */
140
140
  onKeyboardHeightChange?: CommonEventFunction<TextareaProps.onKeyboardHeightChangeEventDetail>
141
+
142
+ /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
143
+ * @supported h5
144
+ */
145
+ nativeProps?: Record<string, unknown>
141
146
  }
142
147
 
143
148
  declare namespace TextareaProps {
@@ -181,7 +186,7 @@ declare namespace TextareaProps {
181
186
  /** 多行输入框。该组件是原生组件,使用时请注意相关限制
182
187
  * @classification forms
183
188
  * @supported weapp, h5, rn
184
- * @example
189
+ * @example_react
185
190
  * ```tsx
186
191
  * export default class PageView extends Component {
187
192
  * constructor() {
@@ -200,6 +205,17 @@ declare namespace TextareaProps {
200
205
  * }
201
206
  * }
202
207
  * ```
208
+ * @example_vue
209
+ * ```html
210
+ * <template>
211
+ * <view class="components-page">
212
+ * <text>输入区域高度自适应,不会出现滚动条</text>
213
+ * <textarea style="background:#efefef;width:100%;min-height:80px;padding:0 30rpx;" :auto-height="true" />
214
+ * <text>这是一个可以自动聚焦的 textarea</text>
215
+ * <textarea style="background:#efefef;width:100%;height:80px;padding:0 30rpx;" :auto-focusd="true" />
216
+ * </view>
217
+ * </template>
218
+ * ```
203
219
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/textarea.html
204
220
  */
205
221
  declare const Textarea: ComponentType<TextareaProps>
package/types/Video.d.ts CHANGED
@@ -3,19 +3,19 @@ import { StandardProps, CommonEventFunction } from './common'
3
3
 
4
4
  interface VideoProps extends StandardProps {
5
5
  /** 要播放视频的资源地址
6
- * @supported weapp, h5, swan, alipay, tt
6
+ * @supported weapp, h5, swan, alipay, tt, rn
7
7
  */
8
8
  src: string
9
9
 
10
10
  /** 指定视频时长
11
- * @supported weapp, swan, alipay
11
+ * @supported weapp, swan, alipay, rn
12
12
  * @h5 待定
13
13
  */
14
14
  duration?: number
15
15
 
16
16
  /** 是否显示默认播放控件(播放/暂停按钮、播放进度、时间)
17
17
  * @default true
18
- * @supported weapp, h5, swan, alipay, tt
18
+ * @supported weapp, h5, swan, alipay, tt, rn
19
19
  */
20
20
  controls?: boolean
21
21
 
@@ -41,24 +41,24 @@ interface VideoProps extends StandardProps {
41
41
 
42
42
  /** 是否自动播放
43
43
  * @default false
44
- * @supported weapp, h5, swan, alipay, tt
44
+ * @supported weapp, h5, swan, alipay, tt, rn
45
45
  */
46
46
  autoplay?: boolean
47
47
 
48
48
  /** 是否循环播放
49
49
  * @default false
50
- * @supported weapp, h5, swan, alipay, tt
50
+ * @supported weapp, h5, swan, alipay, tt, rn
51
51
  */
52
52
  loop?: boolean
53
53
 
54
54
  /** 是否静音播放
55
55
  * @default false
56
- * @supported weapp, h5, swan, alipay, tt
56
+ * @supported weapp, h5, swan, alipay, tt, rn
57
57
  */
58
58
  muted?: boolean
59
59
 
60
60
  /** 指定视频初始播放位置
61
- * @supported weapp, h5, swan, alipay, tt
61
+ * @supported weapp, h5, swan, alipay, tt, rn
62
62
  */
63
63
  initialTime?: number
64
64
 
@@ -97,7 +97,7 @@ interface VideoProps extends StandardProps {
97
97
 
98
98
  /** 是否显示视频中间的播放按钮
99
99
  * @default true
100
- * @supported weapp, swan, alipay
100
+ * @supported weapp, swan, alipay, rn
101
101
  * @h5 待定
102
102
  */
103
103
  showCenterPlayBtn?: boolean
@@ -117,7 +117,7 @@ interface VideoProps extends StandardProps {
117
117
  objectFit?: keyof VideoProps.objectFit
118
118
 
119
119
  /** 视频封面的图片网络资源地址,如果 controls 属性值为 false 则设置 poster 无效
120
- * @supported weapp, h5, swan, alipay, tt
120
+ * @supported weapp, h5, swan, alipay, tt, rn
121
121
  */
122
122
  poster?: string
123
123
 
@@ -225,31 +225,31 @@ interface VideoProps extends StandardProps {
225
225
  showScreenLockButton?: boolean
226
226
 
227
227
  /** 当开始/继续播放时触发 play 事件
228
- * @supported weapp, h5, swan, alipay, tt
228
+ * @supported weapp, h5, swan, alipay, tt, rn
229
229
  */
230
230
  onPlay?: CommonEventFunction
231
231
 
232
232
  /** 当暂停播放时触发 pause 事件
233
- * @supported weapp, h5, swan, alipay, tt
233
+ * @supported weapp, h5, swan, alipay, tt, rn
234
234
  */
235
235
  onPause?: CommonEventFunction
236
236
 
237
237
  /** 当播放到末尾时触发 ended 事件
238
- * @supported weapp, h5, swan, alipay, tt
238
+ * @supported weapp, h5, swan, alipay, tt, rn
239
239
  */
240
240
  onEnded?: CommonEventFunction
241
241
 
242
242
  /** 播放进度变化时触发, 触发频率 250ms 一次
243
243
  *
244
244
  * event.detail = {currentTime, duration}
245
- * @supported weapp, h5, swan, alipay, tt
245
+ * @supported weapp, h5, swan, alipay, tt, rn
246
246
  */
247
247
  onTimeUpdate?: CommonEventFunction<VideoProps.onTimeUpdateEventDetail>
248
248
 
249
249
  /** 当视频进入和退出全屏时触发
250
250
  *
251
251
  * event.detail = {fullScreen, direction},direction取为 vertical 或 horizontal
252
- * @supported weapp, swan, alipay
252
+ * @supported weapp, swan, alipay, rn
253
253
  * @h5 待定
254
254
  */
255
255
  onFullscreenChange?: CommonEventFunction<VideoProps.onFullscreenChangeEventDetail>
@@ -263,7 +263,7 @@ interface VideoProps extends StandardProps {
263
263
  onWaiting?: CommonEventFunction<VideoProps.onWaitingEventDetail>
264
264
 
265
265
  /** 视频播放出错时触发
266
- * @supported weapp, h5, swan, alipay, tt
266
+ * @supported weapp, h5, swan, alipay, tt, rn
267
267
  */
268
268
  onError?: CommonEventFunction
269
269
  /** 加载进度变化时触发,只支持一段加载
@@ -273,7 +273,7 @@ interface VideoProps extends StandardProps {
273
273
  onProgress?: CommonEventFunction<VideoProps.onProgressEventDetail>
274
274
 
275
275
  /** 视频元数据加载完成时触发。event.detail = {width, height, duration}
276
- * @supported weapp
276
+ * @supported weapp, rn
277
277
  */
278
278
  onLoadedMetaData?: CommonEventFunction
279
279
 
@@ -300,6 +300,11 @@ interface VideoProps extends StandardProps {
300
300
  * @supported weapp
301
301
  */
302
302
  onSeekComplete?: CommonEventFunction
303
+
304
+ /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
305
+ * @supported h5
306
+ */
307
+ nativeProps?: Record<string, unknown>
303
308
  }
304
309
 
305
310
  declare namespace VideoProps {
@@ -363,7 +368,7 @@ declare namespace VideoProps {
363
368
  * 备注:h5上因为没有测试,所以暂时写了“待定”,需要`Video`来确认。
364
369
  * @classification media
365
370
  * @supported weapp, h5, swan, alipay, tt
366
- * @example
371
+ * @example_react
367
372
  * ```tsx
368
373
  * export default class PageView extends Component {
369
374
  * constructor() {
@@ -374,12 +379,12 @@ declare namespace VideoProps {
374
379
  * return (
375
380
  * <View className='components-page'>
376
381
  * <Video
377
- * src='http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
382
+ * id='video'
383
+ * src='https://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
384
+ * poster='https://misc.aotu.io/booxood/mobile-video/cover_900x500.jpg'
385
+ * initialTime='0'
378
386
  * controls={true}
379
387
  * autoplay={false}
380
- * poster='http://misc.aotu.io/booxood/mobile-video/cover_900x500.jpg'
381
- * initialTime='0'
382
- * id='video'
383
388
  * loop={false}
384
389
  * muted={false}
385
390
  * />
@@ -388,6 +393,21 @@ declare namespace VideoProps {
388
393
  * }
389
394
  * }
390
395
  * ```
396
+ * @example_vue
397
+ * ```html
398
+ * <template>
399
+ * <video
400
+ * id="video"
401
+ * src="https://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400"
402
+ * poster="https://misc.aotu.io/booxood/mobile-video/cover_900x500.jpg"
403
+ * initial-time="0"
404
+ * :controls="true"
405
+ * :autoplay="false"
406
+ * :loop="false"
407
+ * :muted="false"
408
+ * />
409
+ * </template>
410
+ * ```
391
411
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/video.html
392
412
  */
393
413
  declare const Video: ComponentType<VideoProps>
package/types/View.d.ts CHANGED
@@ -41,7 +41,7 @@ interface ViewProps extends StandardProps {
41
41
  /** 视图容器
42
42
  * @classification viewContainer
43
43
  * @supported weapp, swan, alipay, tt, h5, rn
44
- * @example
44
+ * @example_react
45
45
  * ```tsx
46
46
  * export default class PageView extends Component {
47
47
  * constructor() {
@@ -68,6 +68,38 @@ interface ViewProps extends StandardProps {
68
68
  * }
69
69
  * }
70
70
  * ```
71
+ * @example_vue
72
+ * ```html
73
+ * <template>
74
+ * <view class="components-page">
75
+ * <text>flex-direction: row 横向布局</text>
76
+ * <view class="flex-wrp flex-wrp-row" hover-class="hover" >
77
+ * <view class="flex-item demo-text-1" :hover-stop-propagation="true" />
78
+ * <view class="flex-item demo-text-2" hover-start-time="1000" hover-class="hover" />
79
+ * <view class="flex-item demo-text-3" hover-stayTime="1000" hover-class="hover" />
80
+ * </view>
81
+ * <text>flex-direction: column 纵向布局</text>
82
+ * <view class="flex-wrp flex-wrp-column">
83
+ * <view class="flex-item flex-item-V demo-text-1" />
84
+ * <view class="flex-item flex-item-V demo-text-2" />
85
+ * <view class="flex-item flex-item-V demo-text-3" />
86
+ * </view>
87
+ * </view>
88
+ * </template>
89
+ *
90
+ * <style>
91
+ * .flex-wrp { display: flex; }
92
+ * .flex-wrp-column{ flex-direction: column; }
93
+ * .flex-wrp-row { flex-direction:row; padding: 20px; background: #f1f1f1; }
94
+ * .flex-item { width: 180px; height: 90px; }
95
+ * .demo-text-1 { background: #ccc; }
96
+ * .demo-text-2 { background: #999; }
97
+ * .demo-text-3 { background: #666; }
98
+ * .hover {
99
+ * background: #000;
100
+ * }
101
+ * </style>
102
+ * ```
71
103
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/view.html
72
104
  */
73
105
  declare const View: ComponentType<ViewProps>
@@ -1,23 +1,22 @@
1
1
  import { ComponentType } from 'react'
2
- import { StandardProps } from './common'
3
- import { StyleProp, ViewStyle } from 'react-native'
2
+ import { CommonEventFunction, StandardProps } from './common'
4
3
 
5
4
  interface VoipRoomProps extends StandardProps {
6
5
  /** 进入房间用户的 openid
7
6
  * @default none
8
- * @supported weapp, swan, alipay, tt, h5
7
+ * @supported weapp
9
8
  */
10
9
  openId?: string
11
10
 
12
11
  /** 对话窗口类型,自身传入 camera,其它用户传入 video
13
12
  * @default camera
14
- * @supported weapp, swan, alipay, tt, h5
13
+ * @supported weapp
15
14
  */
16
15
  mode?: keyof VoipRoomProps.mode
17
16
 
18
17
  /** 仅在 mode 为 camera 时有效,前置或后置,值为front, back
19
18
  * @default front
20
- * @supported weapp, swan, alipay, tt, h5
19
+ * @supported weapp
21
20
  */
22
21
  devicePosition?: keyof VoipRoomProps.devicePosition
23
22
 
@@ -27,7 +26,7 @@ interface VoipRoomProps extends StandardProps {
27
26
  onError?: CommonEventFunction
28
27
  }
29
28
 
30
- namespace VoipRoomProps {
29
+ declare namespace VoipRoomProps {
31
30
  /** 对话窗口类型 */
32
31
  interface mode {
33
32
  camera
@@ -41,7 +41,7 @@ declare namespace WebViewProps {
41
41
  /** web-view 组件是一个可以用来承载网页的容器,会自动铺满整个小程序页面。个人类型与海外类型的小程序暂不支持使用。
42
42
  * @classification open
43
43
  * @supported weapp, h5, rn
44
- * @example
44
+ * @example_react
45
45
  * ```tsx
46
46
  * class App extends Component {
47
47
  * handleMessage () {}
@@ -53,6 +53,12 @@ declare namespace WebViewProps {
53
53
  * }
54
54
  * }
55
55
  * ```
56
+ * @example_vue
57
+ * ```html
58
+ * <template>
59
+ * <web-view src='https://mp.weixin.qq.com/' `@message="handleMessage" />
60
+ * </template>
61
+ * ```
56
62
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/web-view.html
57
63
  */
58
64
  declare const WebView: ComponentType<WebViewProps>
@@ -1 +0,0 @@
1
- var __spreadArray=this&&this.__spreadArray||function(e,t){for(var r=0,a=t.length,o=e.length;r<a;r++,o++)e[o]=t[r];return e};System.register(["./p-b2d01686.system.js","@tarojs/taro","./p-94c20f60.system.js"],(function(e){"use strict";var t,r,a,o,n,i,s;return{setters:[function(e){t=e.h;r=e.r;a=e.c;o=e.H;n=e.g},function(e){i=e.default},function(e){s=e.c}],execute:function(){function l(e){return e.charAt(0)==="/"}function d(e,t){for(var r=t,a=r+1,o=e.length;a<o;r+=1,a+=1){e[r]=e[a]}e.pop()}function b(e,t){if(t===undefined)t="";var r=e&&e.split("/")||[];var a=t&&t.split("/")||[];var o=e&&l(e);var n=t&&l(t);var i=o||n;if(e&&l(e)){a=r}else if(r.length){a.pop();a=a.concat(r)}if(!a.length)return"/";var s;if(a.length){var b=a[a.length-1];s=b==="."||b===".."||b===""}else{s=false}var h=0;for(var c=a.length;c>=0;c--){var f=a[c];if(f==="."){d(a,c)}else if(f===".."){d(a,c);h++}else if(h){d(a,c);h--}}if(!i)for(;h--;h)a.unshift("..");if(i&&a[0]!==""&&(!a[0]||!l(a[0])))a.unshift("");var u=a.join("/");if(s&&u.substr(-1)!=="/")u+="/";return u}var h=function(e){var t=e||"";var r;var a={path:null,query:null,fragment:null};r=t.indexOf("#");if(r>-1){a.fragment=t.substring(r+1);t=t.substring(0,r)}r=t.indexOf("?");if(r>-1){a.query=t.substring(r+1);t=t.substring(0,r)}a.path=t;return a};var c=function(e){var r=e.index,a=e.isSelected,o=a===void 0?false:a,n=e.textColor,i=e.iconPath,l=e.badgeText,d=e.showRedDot,b=d===void 0?false:d,h=e.text,c=e.onSelect;var f=s("weui-tabbar__item",{"weui-bar__item_on":o});var u={position:"absolute",top:"-2px",right:"-13px"};var v={position:"absolute",top:"0",right:"-6px"};function g(){c(r)}return t("a",{key:r,href:"javascript:;",class:f,onClick:g},t("span",{style:{display:"inline-block",position:"relative"}},t("img",{src:i,alt:"",class:"weui-tabbar__icon"}),!!l&&t("span",{class:"weui-badge taro-tabbar-badge",style:u},l),b&&t("span",{class:"weui-badge weui-badge_dot",style:v})),t("p",{class:"weui-tabbar__label",style:{color:n}},h))};var f="html,body{height:100%}#app{height:100%}.taro-tabbar__border-white::before{border-top-color:#fff !important}.taro-tabbar__container{display:-ms-flexbox;display:flex;height:100%;-ms-flex-direction:column;flex-direction:column;overflow:hidden}.taro-tabbar__panel{-ms-flex:1;flex:1;position:relative;overflow:auto;-webkit-overflow-scrolling:touch}.taro-tabbar__tabbar{position:relative;height:50px;width:100%;-webkit-transition:bottom 0.2s, top 0.2s;transition:bottom 0.2s, top 0.2s}.taro-tabbar__tabbar-top{top:0}.taro-tabbar__tabbar-bottom{bottom:0}.taro-tabbar__tabbar-hide{display:none}.taro-tabbar__tabbar-slideout{top:-52px;-ms-flex:0 0;flex:0 0}.taro-tabbar__panel+.taro-tabbar__tabbar-slideout{top:auto;bottom:-52px}";var u=function(e){return e[0]==="/"?e:"/"+e};var v=function(e,t){return new RegExp("^"+t+"(\\/|\\?|#|$)","i").test(e)};var g=function(e,t){return v(e,t)?e.substr(t.length):e};var _=0;var p=1;var T=2;var B="taro-tabbar__tabbar";var m="taro-tabbar__tabbar-hide";var H="taro-tabbar__tabbar-slideout";var x=e("taro_tabbar",function(){function e(e){var t=this;r(this,e);this.onLongPress=a(this,"longpress",7);this.homePage="";this.customRoutes=[];this.tabbarPos="bottom";this.selectedIndex=-1;this.status=_;this.getOriginUrl=function(e){var r=t.customRoutes.filter((function(t){var r=t[1];var a=h(r).path;var o=h(e).path;return a===o}));return r.length?r[0][0]:e};this.getSelectedIndex=function(e){var r=-1;t.list.forEach((function(t,a){var o=t.pagePath;var n=h(e).path;var i=h(o).path;if(n===i){r=a}}));return r};this.switchTab=function(e){t.selectedIndex=e;i.switchTab({url:t.list[e].pagePath})};this.switchTabHandler=function(e){var r=e.url,a=e.successHandler,o=e.errorHandler;var n=t.getOriginUrl(t.getCurrentUrl()||t.homePage);var i=b(r,n);var s=t.getSelectedIndex(i);if(s>-1){t.switchTab(s);a({errMsg:"switchTab:ok"})}else{o({errMsg:'switchTab:fail page "'+i+'" is not found'})}};this.routerChangeHandler=function(e){var r;var a;if(e){r=e.toLocation}if(r&&r.path){var o=u(r.path);a=g(o==="/"?t.homePage:o,t.conf.basename||"/")}else{a=t.getCurrentUrl()}t.selectedIndex=t.getSelectedIndex(t.getOriginUrl(a))};this.setTabBarBadgeHandler=function(e){var r=e.index,a=e.text,o=e.successHandler,n=e.errorHandler;var i=__spreadArray([],t.list);if(r in i){i[r].showRedDot=false;i[r].badgeText=a;o({errMsg:"setTabBarBadge:ok"})}else{n({errMsg:"setTabBarBadge:fail tabbar item not found"})}t.list=i};this.removeTabBarBadgeHandler=function(e){var r=e.index,a=e.successHandler,o=e.errorHandler;var n=__spreadArray([],t.list);if(r in n){n[r].badgeText=null;n[r].badgeText=null;a({errMsg:"removeTabBarBadge:ok"})}else{o({errMsg:"removeTabBarBadge:fail tabbar item not found"})}t.list=n};this.showTabBarRedDotHandler=function(e){var r=e.index,a=e.successHandler,o=e.errorHandler;var n=__spreadArray([],t.list);if(r in n){n[r].badgeText=null;n[r].showRedDot=true;a({errMsg:"showTabBarRedDot:ok"})}else{o({errMsg:"showTabBarRedDot:fail tabbar item not found"})}t.list=n};this.hideTabBarRedDotHandler=function(e){var r=e.index,a=e.successHandler,o=e.errorHandler;var n=__spreadArray([],t.list);if(r in n){n[r].showRedDot=false;a({errMsg:"hideTabBarRedDot:ok"})}else{o({errMsg:"hideTabBarRedDot:fail tabbar item not found"})}t.list=n};this.showTabBarHandler=function(e){var r=e.successHandler;t.status=_;r({errMsg:"showTabBar:ok"})};this.hideTabBarHandler=function(e){var r=e.animation,a=e.successHandler;t.status=r?T:p;a({errMsg:"hideTabBar:ok"})};this.setTabBarStyleHandler=function(e){var r=e.color,a=e.selectedColor,o=e.backgroundColor,n=e.borderStyle,i=e.successHandler;if(o)t.backgroundColor=o;if(n)t.borderStyle=n;if(r)t.color=r;if(a)t.selectedColor=a;i({errMsg:"setTabBarStyle:ok"})};this.setTabBarItemHandler=function(e){var r=e.index,a=e.iconPath,o=e.selectedIconPath,n=e.text,i=e.successHandler,s=e.errorHandler;var l=__spreadArray([],t.list);if(r in l){if(a)l[r].iconPath=a;if(o)l[r].selectedIconPath=o;if(n)l[r].text=n;i({errMsg:"setTabBarItem:ok"})}else{s({errMsg:"setTabBarItem:fail tabbar item not found"})}t.list=l};var o=this.conf.list;var n=this.conf.customRoutes;if(Object.prototype.toString.call(o)!=="[object Array]"||o.length<2||o.length>5){throw new Error("tabBar 配置错误")}this.homePage=u(this.conf.homePage);var s=function(e){var t;var r=n[e];e=u(e);if(typeof r==="string"){l.customRoutes.push([e,u(r)])}else if((r===null||r===void 0?void 0:r.length)>0){(t=l.customRoutes).push.apply(t,r.map((function(t){return[e,u(t)]})))}};var l=this;for(var d in n){s(d)}o.forEach((function(e){if(e.pagePath.indexOf("/")!==0){e.pagePath="/"+e.pagePath}}));this.list=o;this.borderStyle=this.conf.borderStyle;this.backgroundColor=this.conf.backgroundColor;this.color=this.conf.color;this.selectedColor=this.conf.selectedColor}e.prototype.getCurrentUrl=function(){var e=this.conf.mode;var t=this.conf.basename||"/";var r;if(e==="hash"){var a=window.location.href;var o=a.indexOf("#");r=o===-1?"":a.substring(o+1)}else{r=location.pathname}var n=u(g(r,t));return n==="/"?this.homePage:n};e.prototype.bindEvent=function(){i.eventCenter.on("__taroRouterChange",this.routerChangeHandler);i.eventCenter.on("__taroSwitchTab",this.switchTabHandler);i.eventCenter.on("__taroSetTabBarBadge",this.setTabBarBadgeHandler);i.eventCenter.on("__taroRemoveTabBarBadge",this.removeTabBarBadgeHandler);i.eventCenter.on("__taroShowTabBarRedDotHandler",this.showTabBarRedDotHandler);i.eventCenter.on("__taroHideTabBarRedDotHandler",this.hideTabBarRedDotHandler);i.eventCenter.on("__taroShowTabBar",this.showTabBarHandler);i.eventCenter.on("__taroHideTabBar",this.hideTabBarHandler);i.eventCenter.on("__taroSetTabBarStyle",this.setTabBarStyleHandler);i.eventCenter.on("__taroSetTabBarItem",this.setTabBarItemHandler)};e.prototype.removeEvent=function(){i.eventCenter.off("__taroRouterChange",this.routerChangeHandler);i.eventCenter.off("__taroSwitchTab",this.switchTabHandler);i.eventCenter.off("__taroSetTabBarBadge",this.setTabBarBadgeHandler);i.eventCenter.off("__taroRemoveTabBarBadge",this.removeTabBarBadgeHandler);i.eventCenter.off("__taroShowTabBarRedDotHandler",this.showTabBarRedDotHandler);i.eventCenter.off("__taroHideTabBarRedDotHandler",this.hideTabBarRedDotHandler);i.eventCenter.off("__taroShowTabBar",this.showTabBarHandler);i.eventCenter.off("__taroHideTabBar",this.hideTabBarHandler);i.eventCenter.off("__taroSetTabBarStyle",this.setTabBarStyleHandler);i.eventCenter.off("__taroSetTabBarItem",this.setTabBarItemHandler)};e.prototype.componentDidLoad=function(){this.tabbarPos=this.tabbar.nextElementSibling?"top":"bottom";this.bindEvent();this.routerChangeHandler()};e.prototype.disconnectedCallback=function(){this.removeEvent()};e.prototype.render=function(){var e,r;var a=this;var n=this.tabbarPos,i=n===void 0?"bottom":n;var l=this.status;var d=s("weui-tabbar",(e={},e["taro-tabbar__border-"+(this.borderStyle||"black")]=true,e));var b=this.selectedIndex===-1||l===p;var h=l===T;return t(o,{class:s(B,B+"-"+i,(r={},r[m]=b,r[H]=h,r))},t("div",{class:d,style:{backgroundColor:this.backgroundColor||""}},this.list.map((function(e,r){var o=a.selectedIndex===r;var n;var i;if(o){n=a.selectedColor||"";i=e.selectedIconPath}else{n=a.color||"";i=e.iconPath}return t(c,{index:r,onSelect:a.switchTab.bind(a),isSelected:o,textColor:n,iconPath:i,text:e.text,badgeText:e.badgeText,showRedDot:e.showRedDot})}))))};Object.defineProperty(e.prototype,"tabbar",{get:function(){return n(this)},enumerable:false,configurable:true});return e}());x.style=f}}}));
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,g as e}from"./p-f05e1558.js";function h(t,i,s){if("search"===i&&(t="search"),s&&(t="password"),void 0===t)return"text";if(!t)throw new Error("unexpected type");return"digit"===t&&(t="number"),t}let o=class{constructor(s){t(this,s),this.onInput=i(this,"input",7),this.onFocus=i(this,"focus",7),this.onBlur=i(this,"blur",7),this.onConfirm=i(this,"confirm",7),this.onChange=i(this,"change",7),this.onKeyDown=i(this,"keydown",7),this.isOnComposition=!1,this.onInputExcuted=!1,this.password=!1,this.disabled=!1,this.maxlength=140,this.autoFocus=!1,this.confirmType="done",this.nativeProps={},this.handleInput=t=>{t.stopPropagation();const{type:i,maxlength:s,confirmType:e,password:o}=this;if(!this.isOnComposition&&!this.onInputExcuted){let n=t.target.value;const a=h(i,e,o);this.onInputExcuted=!0,"number"===a&&n&&s<=n.length&&(n=n.substring(0,s),t.target.value=n),this._value=n,this.onInput.emit({value:n,cursor:n.length})}},this.handleFocus=t=>{this.onInputExcuted=!1,this.onFocus.emit({value:t.target.value})},this.handleBlur=t=>{this.onBlur.emit({value:t.target.value})},this.handleChange=t=>{t.stopPropagation(),this.onChange.emit({value:t.target.value})},this.handleKeyDown=t=>{const{value:i}=t.target,s=t.keyCode||t.code;this.onInputExcuted=!1,t.stopPropagation(),this.onKeyDown.emit({value:i,cursor:i.length,keyCode:s}),13===s&&this.onConfirm.emit({value:i})},this.handleComposition=t=>{t.target instanceof HTMLInputElement&&("compositionend"===t.type?(this.isOnComposition=!1,this.onInput.emit({value:t.target.value})):this.isOnComposition=!0)}}watchHandler(t,i){t!==i&&(this._value=t)}watchFocus(t,i){var s;!i&&t&&(null===(s=this.inputRef)||void 0===s||s.focus())}componentWillLoad(){this._value=this.value}componentDidLoad(){var t,i,s;"file"===this.type?(this.fileListener=()=>{this.onInput.emit()},null===(t=this.inputRef)||void 0===t||t.addEventListener("change",this.fileListener)):(null===(i=this.inputRef)||void 0===i||i.addEventListener("compositionstart",this.handleComposition),null===(s=this.inputRef)||void 0===s||s.addEventListener("compositionend",this.handleComposition)),Object.defineProperty(this.el,"value",{get:()=>{var t;return null===(t=this.inputRef)||void 0===t?void 0:t.value},set:t=>{this._value=t},configurable:!0})}disconnectedCallback(){var t;"file"===this.type&&(null===(t=this.inputRef)||void 0===t||t.removeEventListener("change",this.fileListener))}render(){const{_value:t,type:i,password:e,placeholder:o,autoFocus:n,disabled:a,maxlength:r,confirmType:l,name:c,nativeProps:u}=this;return s("input",Object.assign({ref:t=>{this.inputRef=t},class:"weui-input",value:(d=t,null!=d?d:""),type:h(i,l,e),placeholder:o,autoFocus:n,disabled:a,maxlength:r,name:c,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onChange:this.handleChange,onKeyDown:this.handleKeyDown},u));var d}get el(){return e(this)}static get watchers(){return{value:["watchHandler"],autoFocus:["watchFocus"]}}};o.style="taro-input-core{display:block}input{display:block;height:1.4rem;text-align:inherit;text-overflow:clip;overflow:hidden;white-space:nowrap}";export{o as taro_input_core}
@@ -1 +0,0 @@
1
- System.register(["./p-b2d01686.system.js"],(function(t){"use strict";var e,n,i,o;return{setters:[function(t){e=t.r;n=t.c;i=t.h;o=t.g}],execute:function(){var s="taro-input-core{display:block}input{display:block;height:1.4rem;text-align:inherit;text-overflow:clip;overflow:hidden;white-space:nowrap}";function u(t,e,n){if(e==="search")t="search";if(n)t="password";if(typeof t==="undefined"){return"text"}if(!t){throw new Error("unexpected type")}if(t==="digit")t="number";return t}function a(t){return t!==null&&t!==void 0?t:""}var r=t("taro_input_core",function(){function t(t){var i=this;e(this,t);this.onInput=n(this,"input",7);this.onFocus=n(this,"focus",7);this.onBlur=n(this,"blur",7);this.onConfirm=n(this,"confirm",7);this.onChange=n(this,"change",7);this.onKeyDown=n(this,"keydown",7);this.isOnComposition=false;this.onInputExcuted=false;this.password=false;this.disabled=false;this.maxlength=140;this.autoFocus=false;this.confirmType="done";this.nativeProps={};this.handleInput=function(t){t.stopPropagation();var e=i,n=e.type,o=e.maxlength,s=e.confirmType,a=e.password;if(!i.isOnComposition&&!i.onInputExcuted){var r=t.target.value;var l=u(n,s,a);i.onInputExcuted=true;if(l==="number"&&r&&o<=r.length){r=r.substring(0,o);t.target.value=r}i._value=r;i.onInput.emit({value:r,cursor:r.length})}};this.handleFocus=function(t){i.onInputExcuted=false;i.onFocus.emit({value:t.target.value})};this.handleBlur=function(t){i.onBlur.emit({value:t.target.value})};this.handleChange=function(t){t.stopPropagation();i.onChange.emit({value:t.target.value})};this.handleKeyDown=function(t){var e=t.target.value;var n=t.keyCode||t.code;i.onInputExcuted=false;t.stopPropagation();i.onKeyDown.emit({value:e,cursor:e.length,keyCode:n});n===13&&i.onConfirm.emit({value:e})};this.handleComposition=function(t){if(!(t.target instanceof HTMLInputElement))return;if(t.type==="compositionend"){i.isOnComposition=false;i.onInput.emit({value:t.target.value})}else{i.isOnComposition=true}}}t.prototype.watchHandler=function(t,e){if(t!==e){this._value=t}};t.prototype.watchFocus=function(t,e){var n;if(!e&&t){(n=this.inputRef)===null||n===void 0?void 0:n.focus()}};t.prototype.componentWillLoad=function(){this._value=this.value};t.prototype.componentDidLoad=function(){var t=this;var e,n,i;if(this.type==="file"){this.fileListener=function(){t.onInput.emit()};(e=this.inputRef)===null||e===void 0?void 0:e.addEventListener("change",this.fileListener)}else{(n=this.inputRef)===null||n===void 0?void 0:n.addEventListener("compositionstart",this.handleComposition);(i=this.inputRef)===null||i===void 0?void 0:i.addEventListener("compositionend",this.handleComposition)}Object.defineProperty(this.el,"value",{get:function(){var e;return(e=t.inputRef)===null||e===void 0?void 0:e.value},set:function(e){t._value=e},configurable:true})};t.prototype.disconnectedCallback=function(){var t;if(this.type==="file"){(t=this.inputRef)===null||t===void 0?void 0:t.removeEventListener("change",this.fileListener)}};t.prototype.render=function(){var t=this;var e=this,n=e._value,o=e.type,s=e.password,r=e.placeholder,l=e.autoFocus,h=e.disabled,c=e.maxlength,p=e.confirmType,f=e.name,d=e.nativeProps;return i("input",Object.assign({ref:function(e){t.inputRef=e},class:"weui-input",value:a(n),type:u(o,p,s),placeholder:r,autoFocus:l,disabled:h,maxlength:c,name:f,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onChange:this.handleChange,onKeyDown:this.handleKeyDown},d))};Object.defineProperty(t.prototype,"el",{get:function(){return o(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{value:["watchHandler"],autoFocus:["watchFocus"]}},enumerable:false,configurable:true});return t}());r.style=s}}}));