@tarojs/components 3.4.4 → 3.4.7

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 (175) hide show
  1. package/dist/cjs/index-bf151ad6.js +13 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/taro-button-core.cjs.entry.js +1 -1
  4. package/dist/cjs/taro-canvas-core.cjs.entry.js +1 -1
  5. package/dist/cjs/taro-checkbox-core_2.cjs.entry.js +1 -1
  6. package/dist/cjs/taro-components.cjs.js +1 -1
  7. package/dist/cjs/taro-image-core.cjs.entry.js +1 -1
  8. package/dist/cjs/taro-input-core.cjs.entry.js +1 -1
  9. package/dist/cjs/taro-navigator-core.cjs.entry.js +2 -2
  10. package/dist/cjs/taro-picker-view-column-core.cjs.entry.js +79 -3
  11. package/dist/cjs/taro-picker-view-core.cjs.entry.js +71 -2
  12. package/dist/cjs/taro-pull-to-refresh.cjs.entry.js +1 -1
  13. package/dist/cjs/taro-scroll-view-core.cjs.entry.js +5 -13
  14. package/dist/cjs/taro-swiper-core_2.cjs.entry.js +5 -13
  15. package/dist/cjs/taro-tabbar.cjs.entry.js +23 -23
  16. package/dist/cjs/taro-text-core.cjs.entry.js +1 -1
  17. package/dist/cjs/taro-textarea-core.cjs.entry.js +4 -2
  18. package/dist/cjs/taro-video-control_3.cjs.entry.js +1 -1
  19. package/dist/cjs/taro-view-core.cjs.entry.js +1 -1
  20. package/dist/cjs/taro-web-view-core.cjs.entry.js +1 -1
  21. package/dist/collection/components/button/style/index.css +49 -49
  22. package/dist/collection/components/canvas/canvas.js +1 -1
  23. package/dist/collection/components/canvas/style/index.css +6 -6
  24. package/dist/collection/components/checkbox/style/index.css +21 -22
  25. package/dist/collection/components/image/image.js +1 -1
  26. package/dist/collection/components/image/style/index.css +7 -4
  27. package/dist/collection/components/input/index.css +2 -2
  28. package/dist/collection/components/navigator/navigator.js +2 -2
  29. package/dist/collection/components/navigator/{navigator.css → style/index.css} +3 -3
  30. package/dist/collection/components/picker/style/index.css +2 -1
  31. package/dist/collection/components/picker-view/picker-view-column.js +218 -4
  32. package/dist/collection/components/picker-view/picker-view.js +217 -3
  33. package/dist/collection/components/picker-view/style/column.css +12 -0
  34. package/dist/collection/components/picker-view/style/index.css +28 -0
  35. package/dist/collection/components/pull-to-refresh/pull-to-refresh.js +1 -1
  36. package/dist/collection/components/pull-to-refresh/style/index.css +53 -50
  37. package/dist/collection/components/scroll-view/scroll-view.js +3 -11
  38. package/dist/collection/components/swiper/swiper.js +2 -10
  39. package/dist/collection/components/tabbar/style/index.css +7 -6
  40. package/dist/collection/components/text/style/index.css +0 -6
  41. package/dist/collection/components/textarea/style/index.css +5 -5
  42. package/dist/collection/components/textarea/textarea.js +3 -1
  43. package/dist/collection/components/video/style/index.css +89 -109
  44. package/dist/collection/components/view/style/index.css +3 -5
  45. package/dist/collection/components/web-view/style/index.css +1 -1
  46. package/dist/collection/utils/index.js +13 -73
  47. package/dist/collection/utils/style.js +10 -0
  48. package/dist/collection/utils/url.js +67 -0
  49. package/dist/esm/index-c58e5e14.js +11 -0
  50. package/dist/esm/loader.js +1 -1
  51. package/dist/esm/taro-button-core.entry.js +1 -1
  52. package/dist/esm/taro-canvas-core.entry.js +1 -1
  53. package/dist/esm/taro-checkbox-core_2.entry.js +1 -1
  54. package/dist/esm/taro-components.js +1 -1
  55. package/dist/esm/taro-image-core.entry.js +1 -1
  56. package/dist/esm/taro-input-core.entry.js +1 -1
  57. package/dist/esm/taro-navigator-core.entry.js +2 -2
  58. package/dist/esm/taro-picker-view-column-core.entry.js +80 -4
  59. package/dist/esm/taro-picker-view-core.entry.js +72 -3
  60. package/dist/esm/taro-pull-to-refresh.entry.js +1 -1
  61. package/dist/esm/taro-scroll-view-core.entry.js +3 -11
  62. package/dist/esm/taro-swiper-core_2.entry.js +1 -9
  63. package/dist/esm/taro-tabbar.entry.js +23 -23
  64. package/dist/esm/taro-text-core.entry.js +1 -1
  65. package/dist/esm/taro-textarea-core.entry.js +4 -2
  66. package/dist/esm/taro-video-control_3.entry.js +1 -1
  67. package/dist/esm/taro-view-core.entry.js +1 -1
  68. package/dist/esm/taro-web-view-core.entry.js +1 -1
  69. package/dist/esm-es5/index-c58e5e14.js +1 -0
  70. package/dist/esm-es5/loader.js +1 -1
  71. package/dist/esm-es5/taro-button-core.entry.js +1 -1
  72. package/dist/esm-es5/taro-canvas-core.entry.js +1 -1
  73. package/dist/esm-es5/taro-checkbox-core_2.entry.js +1 -1
  74. package/dist/esm-es5/taro-components.js +1 -1
  75. package/dist/esm-es5/taro-image-core.entry.js +1 -1
  76. package/dist/esm-es5/taro-input-core.entry.js +1 -1
  77. package/dist/esm-es5/taro-navigator-core.entry.js +1 -1
  78. package/dist/esm-es5/taro-picker-view-column-core.entry.js +1 -1
  79. package/dist/esm-es5/taro-picker-view-core.entry.js +1 -1
  80. package/dist/esm-es5/taro-pull-to-refresh.entry.js +1 -1
  81. package/dist/esm-es5/taro-scroll-view-core.entry.js +1 -1
  82. package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
  83. package/dist/esm-es5/taro-tabbar.entry.js +1 -1
  84. package/dist/esm-es5/taro-text-core.entry.js +1 -1
  85. package/dist/esm-es5/taro-textarea-core.entry.js +1 -1
  86. package/dist/esm-es5/taro-video-control_3.entry.js +1 -1
  87. package/dist/esm-es5/taro-view-core.entry.js +1 -1
  88. package/dist/esm-es5/taro-web-view-core.entry.js +1 -1
  89. package/dist/taro-components/{p-4dbed323.entry.js → p-07062966.entry.js} +1 -1
  90. package/dist/taro-components/p-092d81b8.system.entry.js +1 -0
  91. package/dist/taro-components/{p-9fc88fc1.system.entry.js → p-0c18bd18.system.entry.js} +1 -1
  92. package/dist/taro-components/{p-5ae86835.system.entry.js → p-15b51e54.system.entry.js} +1 -1
  93. package/dist/taro-components/{p-17cf8b5b.entry.js → p-1b48afb1.entry.js} +1 -1
  94. package/dist/taro-components/p-1c625d7d.entry.js +1 -0
  95. package/dist/taro-components/p-2c05106f.system.entry.js +1 -0
  96. package/dist/taro-components/p-33ee636a.system.js +1 -1
  97. package/dist/taro-components/p-34188530.system.entry.js +1 -0
  98. package/dist/taro-components/{p-71e14298.entry.js → p-4039bcb5.entry.js} +1 -1
  99. package/dist/taro-components/p-4aa4de0f.system.entry.js +1 -0
  100. package/dist/taro-components/{p-50066d5e.system.entry.js → p-4cd044c4.system.entry.js} +1 -1
  101. package/dist/taro-components/{p-2b0d5c90.system.entry.js → p-58623cdd.system.entry.js} +1 -1
  102. package/dist/taro-components/p-5c6aeb55.entry.js +1 -0
  103. package/dist/taro-components/{p-9eb7dfa8.entry.js → p-5d5baadf.entry.js} +1 -1
  104. package/dist/taro-components/p-724abeb7.js +1 -0
  105. package/dist/taro-components/{p-d567b95e.entry.js → p-758fb1ba.entry.js} +1 -1
  106. package/dist/taro-components/p-7fdd59f0.entry.js +1 -0
  107. package/dist/taro-components/{p-fd8312e5.system.entry.js → p-8e0150eb.system.entry.js} +1 -1
  108. package/dist/taro-components/p-9086b901.system.entry.js +1 -0
  109. package/dist/taro-components/p-92a31933.system.entry.js +1 -0
  110. package/dist/taro-components/p-93fe9ea6.system.entry.js +1 -0
  111. package/dist/taro-components/p-a05d66d1.system.entry.js +1 -0
  112. package/dist/taro-components/p-b246a0d1.entry.js +1 -0
  113. package/dist/taro-components/p-c5a86c19.system.entry.js +1 -0
  114. package/dist/taro-components/{p-8bc82aaa.entry.js → p-d0c608a8.entry.js} +1 -1
  115. package/dist/taro-components/p-d2be4eb3.entry.js +1 -0
  116. package/dist/taro-components/p-d8862a47.entry.js +1 -0
  117. package/dist/taro-components/p-d91ab597.system.entry.js +1 -0
  118. package/dist/taro-components/{p-fe156231.system.entry.js → p-da8edf69.system.entry.js} +1 -1
  119. package/dist/taro-components/p-e12cb218.entry.js +1 -0
  120. package/dist/taro-components/p-e35230e0.entry.js +1 -0
  121. package/dist/taro-components/p-f05cac3f.entry.js +1 -0
  122. package/dist/taro-components/{p-4e54216b.entry.js → p-f5fe8711.entry.js} +1 -1
  123. package/dist/taro-components/p-f885783f.system.js +1 -0
  124. package/dist/taro-components/taro-components.esm.js +1 -1
  125. package/dist/types/components/image/image.d.ts +1 -1
  126. package/dist/types/components/picker-view/picker-view-column.d.ts +15 -1
  127. package/dist/types/components/picker-view/picker-view.d.ts +24 -0
  128. package/dist/types/components/scroll-view/scroll-view.d.ts +1 -1
  129. package/dist/types/components.d.ts +22 -0
  130. package/dist/types/utils/index.d.ts +4 -8
  131. package/dist/types/utils/style.d.ts +1 -0
  132. package/dist/types/utils/url.d.ts +6 -0
  133. package/dist-h5/react/components/input.js +2 -2
  134. package/dist-h5/react/utils/reactify-wc.js +2 -2
  135. package/dist-h5/vue/components/picker.js +2 -2
  136. package/dist-h5/vue/components/scroll-view.js +2 -2
  137. package/dist-h5/vue/createFormsComponent.js +2 -2
  138. package/dist-h5/vue/mixins/listeners.js +2 -2
  139. package/dist-h5/vue3/components/icon.js +3 -0
  140. package/dist-h5/vue3/components/image.js +3 -0
  141. package/dist-h5/vue3/components/scroll-view.js +3 -0
  142. package/dist-h5/vue3/components/text.js +3 -0
  143. package/dist-h5/vue3/createComponent.js +3 -0
  144. package/dist-h5/vue3/createFormsComponent.js +5 -2
  145. package/dist-h5/vue3/forwardRef.js +11 -0
  146. package/dist-h5/vue3/index.js +41 -5
  147. package/package.json +3 -3
  148. package/types/Button.d.ts +24 -26
  149. package/types/Input.d.ts +23 -19
  150. package/types/KeyboardAccessory.d.ts +19 -7
  151. package/types/Picker.d.ts +3 -3
  152. package/types/PickerViewColumn.d.ts +2 -2
  153. package/types/ShareElement.d.ts +193 -0
  154. package/types/common.d.ts +1 -1
  155. package/types/index.vue3.d.ts +159 -0
  156. package/virtual-list/react/createListComponent.js +2 -2
  157. package/dist/taro-components/p-2dc57c71.system.entry.js +0 -1
  158. package/dist/taro-components/p-32937866.entry.js +0 -1
  159. package/dist/taro-components/p-431197bc.entry.js +0 -1
  160. package/dist/taro-components/p-43de2f12.system.entry.js +0 -1
  161. package/dist/taro-components/p-5c420456.entry.js +0 -1
  162. package/dist/taro-components/p-63ff7fa7.entry.js +0 -1
  163. package/dist/taro-components/p-6de12779.entry.js +0 -1
  164. package/dist/taro-components/p-83dedaa2.entry.js +0 -1
  165. package/dist/taro-components/p-8486c251.system.entry.js +0 -1
  166. package/dist/taro-components/p-95529dc0.entry.js +0 -1
  167. package/dist/taro-components/p-b15d0302.system.entry.js +0 -1
  168. package/dist/taro-components/p-cc818a13.entry.js +0 -1
  169. package/dist/taro-components/p-d394a61f.system.entry.js +0 -1
  170. package/dist/taro-components/p-d5971476.entry.js +0 -1
  171. package/dist/taro-components/p-e0af1d0d.system.entry.js +0 -1
  172. package/dist/taro-components/p-fb2252b7.system.entry.js +0 -1
  173. package/dist/taro-components/p-fcc1c676.system.entry.js +0 -1
  174. package/dist/taro-components/p-fd0d1168.system.entry.js +0 -1
  175. package/dist/taro-components/p-fde3a009.system.entry.js +0 -1
package/types/Button.d.ts CHANGED
@@ -168,19 +168,13 @@ interface ButtonProps extends StandardProps {
168
168
  */
169
169
  onGetPhoneNumber?: CommonEventFunction<ButtonProps.onGetPhoneNumberEventDetail>
170
170
 
171
- /** 获取头像信息
172
- *
173
- * 生效时机:`open-type="chooseavatar"`
174
- * @supported weapp
175
- */
176
- onChooseAvatar?: CommonEventFunction<ButtonProps.onChooseAvatarEventDetail>
177
-
178
171
  /** 获取用户实名
179
172
  *
180
173
  * 生效时机:`open-type="getRealnameAuthInfo"`
174
+ * @deprecated
181
175
  * @supported weapp
182
176
  */
183
- onGetRealnameAuthInfo?: CommonEventFunction
177
+ onGetRealNameAuthInfo?: CommonEventFunction
184
178
 
185
179
  /** 当使用开放能力时,发生错误的回调
186
180
  *
@@ -201,7 +195,14 @@ interface ButtonProps extends StandardProps {
201
195
  * 生效时机:`open-type="launchApp"`
202
196
  * @supported weapp
203
197
  */
204
- onLaunchapp?: CommonEventFunction
198
+ onLaunchApp?: CommonEventFunction
199
+
200
+ /** 获取用户头像回调
201
+ *
202
+ * 生效时机:`open-type="chooseAvatar"`
203
+ * @supported weapp
204
+ */
205
+ onChooseAvatar?: CommonEventFunction
205
206
  }
206
207
 
207
208
  declare namespace ButtonProps {
@@ -233,7 +234,7 @@ declare namespace ButtonProps {
233
234
  /** open-type 的合法值 */
234
235
  interface openTypeKeys {
235
236
  weapp: {
236
- /** 打开客服会话,如果用户在会话中点击消息卡片后返回小程序,可以从 bindcontact 回调中获得具体信息
237
+ /** 打开客服会话,如果用户在会话中点击消息卡片后返回小程序,可以从回调中获得具体信息
237
238
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/customer-message.html
238
239
  */
239
240
  contact
@@ -241,19 +242,17 @@ declare namespace ButtonProps {
241
242
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%BC%95
242
243
  */
243
244
  share
244
- /** 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息
245
+ /** 获取用户手机号,可以从回调中获取到用户信息
245
246
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html
246
247
  */
247
248
  getPhoneNumber
248
- /** 获取用户头像,可以从 bindchooseavatar 回调中获取到头像信息
249
- * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/userProfile.html
250
- */
251
- chooseAvatar
252
- /** 获取用户信息,可以从 bindgetuserinfo 回调中获取到用户信息 */
249
+ /** 获取用户信息,可以从回调中获取到用户信息 */
253
250
  getUserInfo
254
- /** 用户实名信息授权,已经弃用 */
255
- getRealnameAuthInfo
256
- /** 打开APP,可以通过app-parameter属性设定向APP传的参数
251
+ /** 用户实名信息授权
252
+ * @deprecated
253
+ */
254
+ getRealNameAuthInfo
255
+ /** 打开APP,可以通过 app-parameter 属性设定向APP传的参数
257
256
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html
258
257
  */
259
258
  launchApp
@@ -261,6 +260,8 @@ declare namespace ButtonProps {
261
260
  openSetting
262
261
  /** 打开“意见反馈”页面,用户可提交反馈内容并上传日志,开发者可以登录小程序管理后台后进入左侧菜单“客服反馈”页面获取到反馈内容 */
263
262
  feedback
263
+ /** 获取用户头像,可以从回调中获得具体信息 */
264
+ chooseAvatar
264
265
  }
265
266
  /** 支付宝小程序专属的 open-type 合法值
266
267
  * @see https://opendocs.alipay.com/mini/component/button
@@ -372,13 +373,10 @@ declare namespace ButtonProps {
372
373
  encryptedData: string
373
374
  /** 加密算法的初始向量 */
374
375
  iv: string
375
- /** 动态令牌。可通过动态令牌换取用户手机号。使用方法详情 [phonenumber.getPhoneNumber](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/phonenumber/phonenumber.getPhoneNumber.html) 接口 */
376
- code:string
377
- }
378
-
379
- interface onChooseAvatarEventDetail {
380
- /* 获取用户头像的临时链接 */
381
- avatarUrl: string
376
+ /** 动态令牌。可通过动态令牌换取用户手机号。
377
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%BC%95
378
+ */
379
+ code?: string
382
380
  }
383
381
 
384
382
  interface onOpenSettingEventDetail {
package/types/Input.d.ts CHANGED
@@ -25,7 +25,7 @@ interface InputProps extends StandardProps, FormItemProps {
25
25
  placeholder?: string
26
26
 
27
27
  /** 指定 placeholder 的样式
28
- * @supported weapp
28
+ * @supported weapp, rn
29
29
  */
30
30
  placeholderStyle?: string
31
31
 
@@ -35,6 +35,11 @@ interface InputProps extends StandardProps, FormItemProps {
35
35
  */
36
36
  placeholderClass?: string
37
37
 
38
+ /** 指定 placeholder 的文本颜色
39
+ * @supported rn
40
+ */
41
+ placeholderTextColor?: string
42
+
38
43
  /** 是否禁用
39
44
  * @supported weapp, h5, rn
40
45
  */
@@ -233,25 +238,24 @@ declare namespace InputProps {
233
238
  * @example_react
234
239
  * ```tsx
235
240
  * class App extends Component {
236
- *
237
241
  * render () {
238
242
  * return (
239
- * <View className='example-body'>
240
- * <Text>可以自动聚焦的 input</Text>
241
- * <Input type='text' placeholder='将会获取焦点' focus/>
242
- * <Text>控制最大输入长度的 input</Text>
243
- * <Input type='text' placeholder='最大输入长度为 10' maxlength='10'/>
244
- * <Text>数字输入的 input</Text>
245
- * <Input type='number' placeholder='这是一个数字输入框'/>
246
- * <Text>密码输入的 input</Text>
247
- * <Input type='password' password placeholder='这是一个密码输入框'/>
248
- * <Text>带小数点的 input</Text>
249
- * <Input type='digit' placeholder='带小数点的数字键盘'/>
250
- * <Text>身份证输入的 input</Text>
251
- * <Input type='idcard' placeholder='身份证输入键盘'/>
252
- * <Text>控制占位符颜色的 input</Text>
253
- * <Input type='text' placeholder='占位符字体是红色的' placeholderStyle='color:red'/>
254
- * </View>
243
+ * <View className='example-body'>
244
+ * <Text>可以自动聚焦的 input</Text>
245
+ * <Input type='text' placeholder='将会获取焦点' focus/>
246
+ * <Text>控制最大输入长度的 input</Text>
247
+ * <Input type='text' placeholder='最大输入长度为 10' maxLength='10'/>
248
+ * <Text>数字输入的 input</Text>
249
+ * <Input type='number' placeholder='这是一个数字输入框'/>
250
+ * <Text>密码输入的 input</Text>
251
+ * <Input type='password' password placeholder='这是一个密码输入框'/>
252
+ * <Text>带小数点的 input</Text>
253
+ * <Input type='digit' placeholder='带小数点的数字键盘'/>
254
+ * <Text>身份证输入的 input</Text>
255
+ * <Input type='idcard' placeholder='身份证输入键盘'/>
256
+ * <Text>控制占位符颜色的 input</Text>
257
+ * <Input type='text' placeholder='占位符字体是红色的' placeholderStyle='color:red'/>
258
+ * </View>
255
259
  * )
256
260
  * }
257
261
  * }
@@ -263,7 +267,7 @@ declare namespace InputProps {
263
267
  * <text>可以自动聚焦的 input</text>
264
268
  * <input type="text" placeholder="将会获取焦点" :focus="true" />
265
269
  * <text>控制最大输入长度的 input</text>
266
- * <input type="text" placeholder="最大输入长度为 10" maxlength="10"/>
270
+ * <input type="text" placeholder="最大输入长度为 10" maxLength="10"/>
267
271
  * <text>数字输入的 input</text>
268
272
  * <input type="number" placeholder="这是一个数字输入框"/>
269
273
  * <text>密码输入的 input</text>
@@ -4,21 +4,33 @@ import { StandardProps } from './common'
4
4
  /** @ignore */
5
5
  type KeyboardAccessoryProps = StandardProps
6
6
 
7
- /** 设置 input / textarea 聚焦时键盘上方 cover-view / cover-image 工具栏视图
7
+ /** 设置 Input / Textarea 聚焦时键盘上方 CoverView / CoverImage 工具栏视图。需要配置 Taro 插件 `@tarojs/plugin-platform-weapp` 的 `enablekeyboardAccessory` 参数为 `true` 后才能使用,请参考:[#9548](https://github.com/NervJS/taro/issues/9548#issuecomment-891682216)。
8
8
  *
9
9
  * @classification forms
10
10
  * @supported weapp
11
11
  * @example
12
+ * ```js
13
+ * // config/index.js
14
+ * {
15
+ * // ...
16
+ * plugins: [
17
+ * ['@tarojs/plugin-platform-weapp', {
18
+ * enablekeyboardAccessory: true
19
+ * }]
20
+ * ]
21
+ * }
22
+ * ```
23
+ *
12
24
  * ```tsx
13
25
  * class App extends Component {
14
26
  * render () {
15
27
  * return (
16
- * <Textarea holdKeyboard="{{true}}">
17
- * <KeyboardAccessory className="container" style={{ height: 50 }} >
18
- * <CoverView onClick={() => { TODO }} style={{ flex: 1, background: 'green' }}>1</CoverView>
19
- * <CoverView onClick={() => { TODO }} style={{ flex: 1, background: 'red' }}>2</CoverView>
20
- * </KeyboardAccessory>
21
- * </Textarea>
28
+ * <Textarea holdKeyboard="{{true}}">
29
+ * <KeyboardAccessory className="container" style={{ height: 50 }} >
30
+ * <CoverView onClick={() => { TODO }} style={{ flex: 1, background: 'green' }}>1</CoverView>
31
+ * <CoverView onClick={() => { TODO }} style={{ flex: 1, background: 'red' }}>2</CoverView>
32
+ * </KeyboardAccessory>
33
+ * </Textarea>
22
34
  * )
23
35
  * }
24
36
  * }
package/types/Picker.d.ts CHANGED
@@ -350,7 +350,7 @@ declare namespace PickerRegionProps {
350
350
  * </view>
351
351
  * </view>
352
352
  * </template>
353
- *
353
+ *
354
354
  * <script>
355
355
  * export default {
356
356
  * data() {
@@ -365,11 +365,11 @@ declare namespace PickerRegionProps {
365
365
  * onChange: function(e) {
366
366
  * this.selectorChecked = this.selector[e.detail.value]
367
367
  * },
368
- *
368
+ *
369
369
  * onTimeChange: function(e) {
370
370
  * this.timeSel = e.detail.value
371
371
  * },
372
- *
372
+ *
373
373
  * onDateChange: function(e) {
374
374
  * this.dateSel = e.detail.value
375
375
  * }
@@ -1,10 +1,10 @@
1
1
  import { ComponentType } from 'react'
2
- import { StandardProps, CommonEventFunction } from './common'
2
+ import { StandardProps } from './common'
3
3
 
4
4
  /** 滚动选择器子项
5
5
  * 仅可放置于 `<PickerView />` 中,其孩子节点的高度会自动设置成与 picker-view 的选中框的高度一致
6
6
  * @classification forms
7
- * @supported weapp, swan, alipay, tt, rn
7
+ * @supported weapp, swan, alipay, tt, h5, rn
8
8
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/picker-view-column.html
9
9
  */
10
10
  declare const PickerViewColumn: ComponentType<StandardProps>
@@ -32,6 +32,199 @@ interface ShareElementProps extends StandardProps {
32
32
  * 使用时需在当前页放置 `ShareElement` 组件,同时在 `PageContainer` 容器中放置对应的 `ShareElement` 组件,对应关系通过属性值 key 映射。当设置 `PageContainer` `显示时,transform` 属性为 `true` 的共享元素会产生动画。当前页面容器退出时,会产生返回动画。
33
33
  * @classification viewContainer
34
34
  * @supported weapp
35
+ * @example_react
36
+ * ```tsx
37
+ * // index.js
38
+ * import { useState, useCallback } from 'react'
39
+ * import { View, Button, PageContainer, ShareElement } from '@tarojs/components'
40
+ *
41
+ * import './index.scss'
42
+ *
43
+ * const contacts = [
44
+ * { id: 1, name: 'Frank', img: 'frank.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
45
+ * { id: 2, name: 'Susan', img: 'susan.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
46
+ * { id: 3, name: 'Emma', img: 'emma.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
47
+ * { id: 4, name: 'Scott', img: 'scott.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
48
+ * { id: 5, name: 'Bob', img: 'bob.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
49
+ * { id: 6, name: 'Olivia', img: 'olivia.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
50
+ * { id: 7, name: 'Anne', img: 'anne.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
51
+ * { id: 8, name: 'sunny', img: 'olivia.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' }
52
+ * ]
53
+ *
54
+ * export default function () {
55
+ * const [show, setShow] = useState(false)
56
+ * const [contact, setContact] = useState(contacts[0])
57
+ * const [transformIdx, setTransformIdx] = useState(0)
58
+ *
59
+ * const onBeforeEnter = useCallback((res) => {
60
+ * console.log('onBeforeEnter: ', res)
61
+ * }, [])
62
+ * const onEnter = useCallback((res) => {
63
+ * console.log('onEnter: ', res)
64
+ * }, [])
65
+ * const onAfterEnter = useCallback((res) => {
66
+ * console.log('onAfterEnter: ', res)
67
+ * }, [])
68
+ * const onBeforeLeave = useCallback((res) => {
69
+ * console.log('onBeforeLeave: ', res)
70
+ * }, [])
71
+ * const onLeave = useCallback((res) => {
72
+ * console.log('onLeave: ', res)
73
+ * }, [])
74
+ * const onAfterLeave = useCallback((res) => {
75
+ * console.log('onAfterLeave: ', res)
76
+ * }, [])
77
+ *
78
+ * const showNext = (e, index) => {
79
+ * setShow(true)
80
+ * setContact(contacts[index])
81
+ * setTransformIdx(index)
82
+ * }
83
+ *
84
+ * const showPrev = useCallback(() => {
85
+ * setShow(false)
86
+ * }, [])
87
+ *
88
+ * return (
89
+ * <View>
90
+ * <View className="screen screen1">
91
+ * {
92
+ * contacts.map((item, index) => (
93
+ * <View key={item.id} className="contact" onClick={e => showNext(e, index)}>
94
+ * <ShareElement duration={300} className="name" mapkey="name" transform={transformIdx === index}>
95
+ * {item.name}
96
+ * </ShareElement>
97
+ * <View className="list">
98
+ * <View>Phone: {item.phone}</View>
99
+ * <View>Mobile: {item.mobile}</View>
100
+ * <View>Email: {item.email}</View>
101
+ * </View>
102
+ * </View>
103
+ * ))
104
+ * }
105
+ * </View>
106
+ * <PageContainer
107
+ * show={show}
108
+ * overlay={false}
109
+ * closeOnSlideDown
110
+ * duration={300}
111
+ * position='center'
112
+ * onBeforeEnter={onBeforeEnter}
113
+ * onEnter={onEnter}
114
+ * onAfterEnter={onAfterEnter}
115
+ * onBeforeLeave={onBeforeLeave}
116
+ * onLeave={onLeave}
117
+ * onAfterLeave={onAfterLeave}
118
+ * >
119
+ * <View className="screen screen2">
120
+ * <View className="contact">
121
+ * <ShareElement className="name" mapkey="name" duration={300} transform>
122
+ * {contact.name}
123
+ * </ShareElement>
124
+ * <View className={`paragraph ${show ? 'enter' : ''}`}>
125
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus nisl enim, sodales non augue efficitur, sagittis
126
+ * varius neque. Fusce dolor turpis, maximus eu volutpat quis, pellentesque et ligula. Ut vehicula metus in nibh
127
+ * mollis ornare. Etiam aliquam lacinia malesuada. Vestibulum dignissim mollis quam a tristique. Maecenas neque
128
+ * mauris, malesuada vitae magna eu, congue consectetur risus. Etiam vitae pulvinar ex. Maecenas suscipit mi ac
129
+ * imperdiet pretium. Aliquam velit mauris, euismod quis elementum sed, malesuada non dui. Nunc rutrum sagittis
130
+ * ligula in dapibus. Cras suscipit ut augue eget mollis. Donec auctor feugiat ipsum id viverra. Vestibulum eu nisi
131
+ * risus. Vestibulum eleifend dignissim.
132
+ *
133
+ * </View>
134
+ * <Button className="screen2-button" onClick={showPrev} hidden={!show} hoverClass="none">Click Me</Button>
135
+ * </View>
136
+ * </View>
137
+ * </PageContainer>
138
+ * </View>
139
+ * )
140
+ * }
141
+ * ```
142
+ * ```scss
143
+ * \/** index.scss *\/
144
+ * page {
145
+ * color: #333;
146
+ * background-color: #ddd;
147
+ * overflow: hidden;
148
+ * }
149
+ *
150
+ * button {
151
+ * border: 0 solid #0010ae;
152
+ * background-color: #1f2afe;
153
+ * color: #fff;
154
+ * font-size: 120%;
155
+ * padding: 8px 16px;
156
+ * outline-width: 0;
157
+ * -webkit-appearance: none;
158
+ * box-shadow: 0 8px 17px rgba(0, 0, 0, 0.2);
159
+ * }
160
+ *
161
+ * .screen {
162
+ * position: absolute;
163
+ * top: 0;
164
+ * bottom: 0;
165
+ * left: 0;
166
+ * right: 0;
167
+ * padding: 16px;
168
+ * -webkit-overflow-scrolling: touch;
169
+ * }
170
+ *
171
+ * .contact {
172
+ * position: relative;
173
+ * padding: 16px;
174
+ * background-color: #fff;
175
+ * width: 100%;
176
+ * height: 100%;
177
+ * box-sizing: border-box;
178
+ * }
179
+ *
180
+ * .avatar {
181
+ * position: absolute;
182
+ * top: 16px;
183
+ * left: 16px;
184
+ * font-size: 0;
185
+ * }
186
+ *
187
+ * .name {
188
+ * height: 65px;
189
+ * font-size: 2em;
190
+ * font-weight: bold;
191
+ * text-align: center;
192
+ * margin: 10px 0;
193
+ * }
194
+ *
195
+ * .list {
196
+ * padding-top: 8px;
197
+ * padding-left: 32px;
198
+ * }
199
+ *
200
+ * .screen1 {
201
+ * overflow-y: scroll;
202
+ * padding: 0;
203
+ * }
204
+ *
205
+ * .screen1 .contact {
206
+ * margin: 16px;
207
+ * height: auto;
208
+ * width: auto;
209
+ * box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.2);
210
+ * }
211
+ *
212
+ * .screen2-button {
213
+ * display: block;
214
+ * margin: 24px auto;
215
+ * }
216
+ *
217
+ * .paragraph {
218
+ * -webkit-transition: transform ease-in-out 300ms;
219
+ * transition: transform ease-in-out 300ms;
220
+ * -webkit-transform: scale(0.6);
221
+ * transform: scale(0.6);
222
+ * }
223
+ *
224
+ * .enter.paragraph {
225
+ * transform: none;
226
+ * }
227
+ * ```
35
228
  * @see https://developers.weixin.qq.com/miniprogram/dev/component/share-element.html
36
229
  */
37
230
  declare const ShareElement: ComponentType<ShareElementProps>
package/types/common.d.ts CHANGED
@@ -19,7 +19,7 @@ export interface StandardProps<T = any, TouchEvent extends BaseTouchEvent<any> =
19
19
  ref?: LegacyRef<T>
20
20
  /**
21
21
  * 渲染 HTML
22
- * @see https://taro-docs.jd.com/taro/docs/html
22
+ * @see /docs/html
23
23
  */
24
24
  dangerouslySetInnerHTML?: {
25
25
  __html: string
@@ -0,0 +1,159 @@
1
+ /**
2
+ * vue tsx @tarojs/components 类型提示文件
3
+ * 如何使用?
4
+ * 请在醒目全局的类型文件中写入以下代码,覆盖默认的组件类型提示
5
+ * ```typescript
6
+ * export declare module '@tarojs/components' {
7
+ * export * from '@tarojs/components/types/index.vue3'
8
+ * }
9
+ * ```
10
+ */
11
+ import { TaroElement } from '@tarojs/runtime'
12
+ import { StandardProps } from './common'
13
+ import * as CSS from 'csstype'
14
+ /** 视图容器 */
15
+ import { CoverImageProps } from './CoverImage'
16
+ import { CoverViewProps } from './CoverView'
17
+ import { MatchMediaProps } from './MatchMedia'
18
+ import { MovableAreaProps } from './MovableArea'
19
+ import { MovableViewProps } from './MovableView'
20
+ import { PageContainerProps } from './PageContainer'
21
+ import { ScrollViewProps } from './ScrollView'
22
+ import { ShareElementProps } from './ShareElement'
23
+ import { SwiperProps } from './Swiper'
24
+ import { SwiperItemProps } from './SwiperItem'
25
+ import { ViewProps } from './View'
26
+ /** 基础内容 */
27
+ import { IconProps } from './Icon'
28
+ import { ProgressProps } from './Progress'
29
+ import { RichTextProps } from './RichText'
30
+ import { TextProps } from './Text'
31
+ /** 表单组件 */
32
+ import { ButtonProps } from './Button'
33
+ import { CheckboxProps } from './Checkbox'
34
+ import { CheckboxGroupProps } from './CheckboxGroup'
35
+ import { EditorProps } from './Editor'
36
+ import { FormProps } from './Form'
37
+ import { InputProps } from './Input'
38
+ import { KeyboardAccessoryProps } from './KeyboardAccessory'
39
+ import { LabelProps } from './Label'
40
+ import { PickerDateProps, PickerTimeProps, PickerRegionProps, PickerSelectorProps, PickerMultiSelectorProps } from './Picker'
41
+ import { PickerViewProps } from './PickerView'
42
+ import { RadioProps } from './Radio'
43
+ import { RadioGroupProps } from './RadioGroup'
44
+ import { SliderProps } from './Slider'
45
+ import { SwitchProps } from './Switch'
46
+ import { TextareaProps } from './Textarea'
47
+ /** 导航 */
48
+ import { FunctionalPageNavigatorProps } from './FunctionalPageNavigator'
49
+ import { NavigatorProps } from './Navigator'
50
+ import { NavigationBarProps } from './NavigationBar'
51
+ /** 媒体组件 */
52
+ import { AudioProps } from './Audio'
53
+ import { CameraProps } from './Camera'
54
+ import { ImageProps } from './Image'
55
+ import { LivePlayerProps } from './LivePlayer'
56
+ import { LivePusherProps } from './LivePusher'
57
+ import { VideoProps } from './Video'
58
+ import { VoipRoomProps } from './VoipRoom'
59
+ /** 地图 */
60
+ import { MapProps } from './Map'
61
+ /** 画布 */
62
+ import { CanvasProps } from './Canvas'
63
+ /** 开放能力 */
64
+ import { AdProps } from './Ad'
65
+ import { AdCustomProps } from './AdCustom'
66
+ import { OfficialAccountProps } from './OfficialAccount'
67
+ import { OpenDataProps } from './OpenData'
68
+ import { WebViewProps } from './WebView'
69
+ /** 配置节点 */
70
+ import { PageMetaProps } from './PageMeta'
71
+
72
+ import { CustomWrapperProps } from './CustomWrapper'
73
+ import { SlotProps } from './Slot'
74
+
75
+ // 联合类型不能用omit(比如picker)
76
+ type DistributiveOmit<T, K extends keyof T> = T extends unknown
77
+ ? Omit<T, K>
78
+ : never;
79
+
80
+ type SlimProps = {
81
+ class?: any
82
+ style?: CSS.Properties<string | number>
83
+ innerHTML?: string
84
+ }
85
+
86
+ /** 转换react的类型到vue */
87
+ type RemoveReactAttribute = keyof Omit<StandardProps, 'id' | 'hidden' | 'animation'>
88
+ export type TransformReact2VueType<P extends StandardProps = Record<string, never>> = DistributiveOmit<P, RemoveReactAttribute> & SlimProps
89
+
90
+ export declare class VueComponentType<P = Record<string, never>> extends TaroElement {
91
+ $props: TransformReact2VueType<P>
92
+ /** WebStorm 提示貌似找的是props */
93
+ props: this['$props']
94
+ }
95
+
96
+ /** 视图容器 */
97
+ export declare class Block extends VueComponentType {}
98
+ export declare class CoverImage extends VueComponentType<CoverImageProps> {}
99
+ export declare class CoverView extends VueComponentType<CoverViewProps> {}
100
+ export declare class MatchMedia extends VueComponentType<MatchMediaProps> {}
101
+ export declare class MovableArea extends VueComponentType<MovableAreaProps> {}
102
+ export declare class MovableView extends VueComponentType<MovableViewProps> {}
103
+ export declare class PageContainer extends VueComponentType<PageContainerProps> {}
104
+ export declare class ScrollView extends VueComponentType<ScrollViewProps> {}
105
+ export declare class ShareElement extends VueComponentType<ShareElementProps> {}
106
+ export declare class Swiper extends VueComponentType<SwiperProps> {}
107
+ export declare class SwiperItem extends VueComponentType<SwiperItemProps> {}
108
+ export declare class View extends VueComponentType<ViewProps> {}
109
+ /** 基础内容 */
110
+ export declare class Icon extends VueComponentType<IconProps> {}
111
+ export declare class Progress extends VueComponentType<ProgressProps> {}
112
+ export declare class RichText extends VueComponentType<RichTextProps> {}
113
+ export declare class Text extends VueComponentType<TextProps> {}
114
+ /** 表单组件 */
115
+ export declare class Button extends VueComponentType<ButtonProps> {}
116
+ export declare class Checkbox extends VueComponentType<CheckboxProps> {}
117
+ export declare class CheckboxGroup extends VueComponentType<CheckboxGroupProps> {}
118
+ export declare class Editor extends VueComponentType<EditorProps> {}
119
+ export declare class Form extends VueComponentType<FormProps> {}
120
+ export declare class Input extends VueComponentType<InputProps> {}
121
+ export declare class KeyboardAccessory extends VueComponentType<KeyboardAccessoryProps> {}
122
+ export declare class Label extends VueComponentType<LabelProps> {}
123
+ export declare class Picker extends VueComponentType<PickerMultiSelectorProps | PickerTimeProps | PickerDateProps | PickerRegionProps | PickerSelectorProps> {}
124
+ export declare class PickerView extends VueComponentType<PickerViewProps> {}
125
+ export declare class PickerViewColumn extends VueComponentType {}
126
+ export declare class Radio extends VueComponentType<RadioProps> {}
127
+ export declare class RadioGroup extends VueComponentType<RadioGroupProps> {}
128
+ export declare class Slider extends VueComponentType<SliderProps> {}
129
+ export declare class Switch extends VueComponentType<SwitchProps> {}
130
+ export declare class Textarea extends VueComponentType<TextareaProps> {}
131
+ /** 导航 */
132
+ export declare class FunctionalPageNavigator extends VueComponentType<FunctionalPageNavigatorProps> {}
133
+ export declare class Navigator extends VueComponentType<NavigatorProps> {}
134
+ export declare class NavigationBar extends VueComponentType<NavigationBarProps> {}
135
+ /** 媒体组件 */
136
+ export declare class Audio extends VueComponentType<AudioProps> {}
137
+ export declare class Camera extends VueComponentType<CameraProps> {}
138
+ export declare class Image extends VueComponentType<ImageProps> {}
139
+ export declare class LivePlayer extends VueComponentType<LivePlayerProps> {}
140
+ export declare class LivePusher extends VueComponentType<LivePusherProps> {}
141
+ export declare class Video extends VueComponentType<VideoProps> {}
142
+ export declare class VoipRoom extends VueComponentType<VoipRoomProps> {}
143
+ /** 地图 */
144
+ export declare class Map extends VueComponentType<MapProps> {}
145
+ /** 画布 */
146
+ export declare class Canvas extends VueComponentType<CanvasProps> {}
147
+ /** 开放能力 */
148
+ export declare class Ad extends VueComponentType<AdProps> {}
149
+ export declare class AdCustom extends VueComponentType<AdCustomProps> {}
150
+ export declare class OfficialAccount extends VueComponentType<OfficialAccountProps> {}
151
+ export declare class OpenData extends VueComponentType<OpenDataProps> {}
152
+ export declare class WebView extends VueComponentType<WebViewProps> {}
153
+ /** 配置节点 */
154
+ export declare class PageMeta extends VueComponentType<PageMetaProps> {}
155
+
156
+ export declare class CustomWrapper extends VueComponentType<CustomWrapperProps> {}
157
+ export declare class Slot extends VueComponentType<SlotProps> {}
158
+
159
+ export * from './index'
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable no-case-declarations */
3
3
  /* eslint-disable no-void */
4
4
  /* eslint-disable no-return-assign */
5
- import Taro from '@tarojs/taro'
5
+ import { createSelectorQuery } from '@tarojs/taro'
6
6
  import { getRTLOffsetType } from '../domHelpers'
7
7
  import { memoizeOne } from '../memoize'
8
8
  import { createElement, PureComponent } from 'react'
@@ -22,7 +22,7 @@ export function isRtlFunc ({ direction }) {
22
22
  return direction === 'rtl'
23
23
  }
24
24
  export function getRectSize (id, success = () => {}, fail = () => {}) {
25
- const query = Taro.createSelectorQuery()
25
+ const query = createSelectorQuery()
26
26
  query.select(id).boundingClientRect((res) => {
27
27
  if (res) {
28
28
  success(res)
@@ -1 +0,0 @@
1
- System.register(["./p-b2d01686.system.js"],(function(e){"use strict";var t,n,i,a;return{setters:[function(e){t=e.r;n=e.c;i=e.h;a=e.g}],execute:function(){var o="taro-textarea-core{display:block;width:300px}taro-textarea-core .auto-height{height:auto}.taro-textarea{-webkit-appearance:none;cursor:auto;width:100%;height:150px;border:0;display:block;position:relative;line-height:1.5}.taro-textarea:focus{outline:none}";function r(e){return e!==null&&e!==void 0?e:""}var h=e("taro_textarea_core",function(){function e(e){var i=this;t(this,e);this.onInput=n(this,"input",7);this.onFocus=n(this,"focus",7);this.onBlur=n(this,"blur",7);this.onChange=n(this,"change",7);this.onLineChange=n(this,"linechange",7);this.disabled=false;this.maxlength=140;this.autoFocus=false;this.autoHeight=false;this.nativeProps={};this.line=1;this.handleInput=function(e){e.stopPropagation();i.handleLineChange();i.onInput.emit({value:e.target.value,cursor:e.target.value.length})};this.handleFocus=function(e){i.onFocus.emit({value:e.target.value})};this.handleBlur=function(e){i.onBlur.emit({value:e.target.value})};this.handleChange=function(e){e.stopPropagation();i.onChange.emit({value:e.target.value})};this.handleLineChange=function(){var e=i.getNumberOfLines();if(e!==i.line){i.line=e;i.onLineChange.emit({height:i.textareaRef.clientHeight,lineCount:i.line})}};this.calculateContentHeight=function(e,t){var n=e.style.height,i=e.offsetHeight,a=e.scrollHeight,o=e.style.overflow;if(i>=a){e.style.height=i+t+"px";e.style.overflow="hidden";if(a<e.scrollHeight){while(e.offsetHeight>=e.scrollHeight){e.style.height=(i-=t)+"px"}while(e.offsetHeight<e.scrollHeight){e.style.height=i+++"px"}e.style.height=n;e.style.overflow=o;return i}}else{return a}};this.getNumberOfLines=function(){var e=i.textareaRef,t=window.getComputedStyle?window.getComputedStyle(e):e.style,n=parseInt(t.lineHeight,10),a=i.calculateContentHeight(e,n),o=Math.floor(a/n);return o}}e.prototype.componentDidLoad=function(){var e=this;Object.defineProperty(this.el,"value",{get:function(){return e.textareaRef.value},set:function(t){return e.value=t},configurable:true});this.autoFocus&&this.textareaRef.focus()};e.prototype.render=function(){var e=this;var t=this,n=t.value,a=t.placeholder,o=t.disabled,h=t.maxlength,l=t.autoFocus,s=t.autoHeight,u=t.name,c=t.nativeProps,g=t.handleInput,f=t.handleFocus,p=t.handleBlur,d=t.handleChange;var v={};if(s){v.rows=this.line}return i("textarea",Object.assign({ref:function(t){if(t){e.textareaRef=t}},class:"taro-textarea "+(s?"auto-height":""),value:r(n),placeholder:a,name:u,disabled:o,maxlength:h,autofocus:l,onInput:g,onFocus:f,onBlur:p,onChange:d},c,v))};Object.defineProperty(e.prototype,"el",{get:function(){return a(this)},enumerable:false,configurable:true});return e}());h.style=o}}}));