Skip to content

Commit 29af99d

Browse files
authored
refactor(types): sync components types
1 parent 5bba1fc commit 29af99d

File tree

7 files changed

+65
-31
lines changed

7 files changed

+65
-31
lines changed

packages/taro-components/types/Button.d.ts

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,6 @@ interface ButtonProps extends StandardProps {
189189
* @supported weapp, alipay, swan, tt, jd
190190
*/
191191
onGetPhoneNumber?: CommonEventFunction<ButtonProps.onGetPhoneNumberEventDetail>
192-
/**
193-
* 手机号实时验证回调,`open-type="getRealtimePhoneNumber"` 时有效
194-
* @supported weapp
195-
*/
196-
onGetRealTimePhoneNumber?: CommonEventFunction<ButtonProps.onGetRealTimePhoneNumberEventDetail>
197192
/** 当使用开放能力时,发生错误的回调
198193
*
199194
* 生效时机:`open-type="launchApp"`
@@ -218,11 +213,6 @@ interface ButtonProps extends StandardProps {
218213
* @supported weapp
219214
*/
220215
onChooseAvatar?: CommonEventFunction
221-
/**
222-
* 用户同意隐私协议事件回调,`open-type="agreePrivacyAuthorization"`时有效
223-
* @supported weapp
224-
*/
225-
onAgreePrivacyAuthorization?: CommonEventFunction
226216
/** 点击。
227217
* 说明: 每点击一次会触发一次事件,建议自行使用代码防止重复点击,可以使用 js 防抖和节流实现。
228218
* @supported alipay
@@ -287,7 +277,11 @@ declare namespace ButtonProps {
287277
reset
288278
}
289279
/** open-type 的合法值 */
290-
type OpenType = keyof openTypeKeys['weapp'] | keyof openTypeKeys['alipay'] | keyof openTypeKeys['qq']
280+
type OpenType =
281+
| keyof openTypeKeys['weapp']
282+
| keyof openTypeKeys['alipay']
283+
| keyof openTypeKeys['qq']
284+
| keyof openTypeKeys['tt']
291285
/** open-type 的合法值 */
292286
interface openTypeKeys {
293287
weapp: {
@@ -324,6 +318,21 @@ declare namespace ButtonProps {
324318
* 用户同意隐私协议按钮。可通过 bindagreeprivacyauthorization 监听用户同意隐私协议事件
325319
*/
326320
agreePrivacyAuthorization
321+
/**
322+
* 从基础库 2.32.3 版本起,隐私同意按钮支持与手机号快速验证组件耦合使用,调用方式为:
323+
* <button open-type="getPhoneNumber|agreePrivacyAuthorization">
324+
*/
325+
['getPhoneNumber|agreePrivacyAuthorization']
326+
/**
327+
* 从基础库 2.32.3 版本起,支持隐私同意按钮与手机号实时验证组件耦合使用,调用方式为:
328+
* <button open-type="getRealtimePhoneNumber|agreePrivacyAuthorization">
329+
*/
330+
['getRealtimePhoneNumber|agreePrivacyAuthorization']
331+
/**
332+
* 从基础库 2.32.3 版本起,支持隐私同意按钮与获取用户信息组件耦合使用,调用方式为:
333+
* <button open-type="getUserInfo|agreePrivacyAuthorization">
334+
*/
335+
['getUserInfo|agreePrivacyAuthorization']
327336
}
328337
/** 支付宝小程序专属的 open-type 合法值
329338
* @see https://opendocs.alipay.com/mini/component/button
@@ -369,6 +378,35 @@ declare namespace ButtonProps {
369378
/** 在自定义开放数据域组件中,向指定好友发起分享据 */
370379
shareMessageToFriend
371380
}
381+
/** TT 小程序专属的 open-type 合法值
382+
* @see https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/component/list/button/#open-type-%E7%9A%84%E5%90%88%E6%B3%95%E5%80%BC
383+
*/
384+
tt: {
385+
/** 触发用户转发, 可以配合 data-channel 属性来设置分享的 channel,具体请参考 ShareParam */
386+
share
387+
/** 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息,详情请参见获取手机号 */
388+
getPhoneNumber
389+
/** 跳转到抖音IM客服,详情请参见抖音IM客服能力 */
390+
im
391+
/** 跳转到抖音平台客服,详情请参见平台客服能力 */
392+
platformIm
393+
/** 跳转视频播放页,详情请参见跳转视频播放页 */
394+
navigateToVideoView
395+
/** 跳转抖音号个人页,详情请参见跳转抖音号个人页 */
396+
openAwemeUserProfile
397+
/** 跳转抖音直播间,详情请参见跳转抖音直播间 */
398+
openWebcastRoom
399+
/** 写入系统日历,详情请参见写入系统日历 */
400+
addCalendarEvent
401+
/** 添加到桌面,详情请参见添加到桌面 */
402+
addShortcut
403+
/** 加群,详情请参见加群 */
404+
joinGroup
405+
/** 私信,详情请参见私信 */
406+
privateMessage
407+
/** 主动授权私信,详情请参见主动授权私信 */
408+
authorizePrivateMessage
409+
}
372410
}
373411
/** lang 的合法值 */
374412
interface Lang {

packages/taro-components/types/Canvas.d.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,37 @@ interface CanvasProps extends StandardProps<any, CanvasTouchEvent> {
1414
* @supported weapp, alipay, swan, qq, jd
1515
*/
1616
disableScroll?: boolean
17-
/** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
18-
* @supported h5
19-
*/
20-
nativeProps?: Record<string, unknown>
2117
/** 组件唯一标识符。
2218
* 注意:同一页面中的 id 不可重复。
23-
* @supported alipay
19+
* @supported alipay, h5
2420
*/
2521
id?: string
2622
/**
27-
* @supported alipay
23+
* @supported alipay, h5
2824
*/
2925
width?: string
3026
/**
31-
* @supported alipay
27+
* @supported alipay, h5
3228
*/
3329
height?: string
30+
/** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
31+
* @supported h5
32+
*/
33+
nativeProps?: Record<string, unknown>
3434
/** 手指触摸动作开始
35-
* @supported weapp, alipay, swan, tt, qq, jd
35+
* @supported weapp, alipay, swan, tt, qq, jd, h5
3636
*/
3737
onTouchStart?: CanvasTouchEventFunction
3838
/** 手指触摸后移动
39-
* @supported weapp, alipay, swan, tt, qq, jd
39+
* @supported weapp, alipay, swan, tt, qq, jd, h5
4040
*/
4141
onTouchMove?: CanvasTouchEventFunction
4242
/** 手指触摸动作结束
43-
* @supported weapp, alipay, swan, tt, qq, jd
43+
* @supported weapp, alipay, swan, tt, qq, jd, h5
4444
*/
4545
onTouchEnd?: CanvasTouchEventFunction
4646
/** 手指触摸动作被打断,如来电提醒,弹窗
47-
* @supported weapp, alipay, swan, tt, qq, jd
47+
* @supported weapp, alipay, swan, tt, qq, jd, h5
4848
*/
4949
onTouchCancel?: CanvasTouchEventFunction
5050
/** 手指长按 500ms 之后触发,触发了长按事件后进行移动不会触发屏幕的滚动

packages/taro-components/types/NativeSlot.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface NativeSlotProps {
1010

1111
/** 编译的原生组件支持使用 slot 插槽
1212
* @classification viewContainer
13-
* @supported weapp, swan, alipay, tt, jd, qq
13+
* @supported weapp, swan, alipay, tt, jd, qq, h5
1414
* @version 3.5.7+
1515
* @example
1616
* ```tsx

packages/taro-components/types/ScrollView.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComponentType } from 'react'
2-
import { StandardProps, CommonEventFunction, BaseEventOrigFunction } from './common'
2+
import { BaseEventOrigFunction, CommonEventFunction, StandardProps } from './common'
33
interface ScrollViewProps extends StandardProps {
44
/** 允许横向滚动
55
* @default false
@@ -157,7 +157,7 @@ interface ScrollViewProps extends StandardProps {
157157
* center - 目标节点显示在视口中间
158158
* end - 目标节点显示在视口结束处
159159
* nearest - 目标节点在就近的视口边缘显示,若节点已在视口内则不触发滚动
160-
* @supported weapp
160+
* @supported weapp, h5
161161
* @default 'start'
162162
*/
163163
scrollIntoViewAlignment?: 'start' | 'center' | 'end' | 'nearest'

packages/taro-components/types/ShareElement.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ interface ShareElementProps extends StandardProps {
66
* @deprecated 使用mapkey替换key
77
*/
88
key?: string
9-
/** 映射标记
10-
* @supported weapp
11-
*/
12-
mapkey?: string
139
/** 映射标记
1410
* @supported alipay
1511
*/

packages/taro-components/types/Slot.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface SlotProps {
1515

1616
/** slot 插槽
1717
* @classification viewContainer
18-
* @supported weapp, swan, alipay, tt, jd, qq, harmony
18+
* @supported weapp, swan, alipay, tt, jd, qq, harmony, h5
1919
* @example
2020
* ```tsx
2121
* import { Slot, View, Text } from '@tarojs/components'

packages/taro-components/types/Textarea.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ interface TextareaProps extends StandardProps, FormItemProps {
9999
/** 点击键盘右下角按钮时是否保持键盘不收起
100100
* @supported weapp, swan, tt
101101
*/
102-
confirmHold?: string
102+
confirmHold?: boolean
103103
/** 组件名字,用于表单提交获取数据。
104104
* @supported alipay
105105
*/

0 commit comments

Comments
 (0)