Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(types): sync components types #2

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/taro-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"esbuild": "^0.14.27",
"jquery": "^3.4.1",
"lodash": "^4.17.21",
"miniapp-types": "1.5.1",
"miniapp-types": "1.6.0",
"puppeteer": "^19.2.0",
"stencil-vue2-output-target": "0.0.4",
"ts-node": "^10.9.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Audio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ declare namespace AudioProps {
/** 音频。1.6.0版本开始,该组件不再维护。建议使用能力更强的 Taro.createInnerAudioContext 接口
* @classification media
* @deprecated
* @supported weapp, swan, qq, h5
* @supported weapp, swan, qq, h5, harmony_hybrid
* @example_react
* ```tsx
* export default class PageView extends Component {
Expand Down
84 changes: 74 additions & 10 deletions packages/taro-components/types/Button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,28 +70,28 @@ interface ButtonProps extends StandardProps {
/** 会话来源
*
* 生效时机:`open-type="contact"`
* @supported weapp
* @supported weapp, swan
*/
sessionFrom?: string
/** 会话内消息卡片标题
*
* 生效时机:`open-type="contact"`
* @default 当前标题
* @supported weapp
* @supported weapp, swan
*/
sendMessageTitle?: string
/** 会话内消息卡片点击跳转小程序路径
*
* 生效时机:`open-type="contact"`
* @default 当前标题
* @supported weapp
* @supported weapp, swan
*/
sendMessagePath?: string
/** 会话内消息卡片图片
*
* 生效时机:`open-type="contact"`
* @default 截图
* @supported weapp
* @supported weapp, swan
*/
sendMessageImg?: string
/** 打开 APP 时,向 APP 传递的参数
Expand All @@ -109,7 +109,7 @@ interface ButtonProps extends StandardProps {
/** 显示会话内消息卡片
*
* 生效时机:`open-type="contact"`
* @supported weapp
* @supported weapp, swan
* @default false
*/
showMessageCard?: boolean
Expand All @@ -127,7 +127,9 @@ interface ButtonProps extends StandardProps {
* @supported swan
*/
subscribeId?: string
/** 打开群资料卡时,传递的群号
/** 群聊 id
* @qq 打开群资料卡时,传递的群号
* @tt 通过创建聊天群、查询群信息获取
* @supported qq
*/
groupId?: string
Expand Down Expand Up @@ -185,7 +187,7 @@ interface ButtonProps extends StandardProps {
onContact?: CommonEventFunction<ButtonProps.onContactEventDetail>
/** 获取用户手机号回调
*
* 生效时机:`open-type="getphonenumber"`
* 生效时机:`open-type="getPhoneNumber"`
* @supported weapp, alipay, swan, tt, jd
*/
onGetPhoneNumber?: CommonEventFunction<ButtonProps.onGetPhoneNumberEventDetail>
Expand All @@ -198,7 +200,7 @@ interface ButtonProps extends StandardProps {
/** 在打开授权设置页后回调
*
* 生效时机:`open-type="openSetting"`
* @supported weapp, swan, qq, jd
* @supported weapp, swan, tt, qq, jd
*/
onOpenSetting?: CommonEventFunction<ButtonProps.onOpenSettingEventDetail>
/** 打开 APP 成功的回调
Expand Down Expand Up @@ -277,7 +279,11 @@ declare namespace ButtonProps {
reset
}
/** open-type 的合法值 */
type OpenType = keyof openTypeKeys['weapp'] | keyof openTypeKeys['alipay'] | keyof openTypeKeys['qq']
type OpenType =
| keyof openTypeKeys['weapp']
| keyof openTypeKeys['alipay']
| keyof openTypeKeys['qq']
| keyof openTypeKeys['tt']
/** open-type 的合法值 */
interface openTypeKeys {
weapp: {
Expand All @@ -293,6 +299,11 @@ declare namespace ButtonProps {
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html
*/
getPhoneNumber
/**
* 手机号实时验证,向用户申请,并在用户同意后,快速填写和实时验证手机号。(*小程序插件中不能使用*)
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getRealtimePhoneNumber.html
*/
getRealtimePhoneNumber
/** 获取用户信息,可以从回调中获取到用户信息 */
getUserInfo
/** 打开APP,可以通过 app-parameter 属性设定向APP传的参数
Expand All @@ -305,6 +316,25 @@ declare namespace ButtonProps {
feedback
/** 获取用户头像,可以从回调中获得具体信息 */
chooseAvatar
/**
* 用户同意隐私协议按钮。可通过 bindagreeprivacyauthorization 监听用户同意隐私协议事件
*/
agreePrivacyAuthorization
/**
* 从基础库 2.32.3 版本起,隐私同意按钮支持与手机号快速验证组件耦合使用,调用方式为:
* <button open-type="getPhoneNumber|agreePrivacyAuthorization">
*/
['getPhoneNumber|agreePrivacyAuthorization']
/**
* 从基础库 2.32.3 版本起,支持隐私同意按钮与手机号实时验证组件耦合使用,调用方式为:
* <button open-type="getRealtimePhoneNumber|agreePrivacyAuthorization">
*/
['getRealtimePhoneNumber|agreePrivacyAuthorization']
/**
* 从基础库 2.32.3 版本起,支持隐私同意按钮与获取用户信息组件耦合使用,调用方式为:
* <button open-type="getUserInfo|agreePrivacyAuthorization">
*/
['getUserInfo|agreePrivacyAuthorization']
}
/** 支付宝小程序专属的 open-type 合法值
* @see https://opendocs.alipay.com/mini/component/button
Expand Down Expand Up @@ -350,6 +380,35 @@ declare namespace ButtonProps {
/** 在自定义开放数据域组件中,向指定好友发起分享据 */
shareMessageToFriend
}
/** TT 小程序专属的 open-type 合法值
* @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
*/
tt: {
/** 触发用户转发, 可以配合 data-channel 属性来设置分享的 channel,具体请参考 ShareParam */
share
/** 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息,详情请参见获取手机号 */
getPhoneNumber
/** 跳转到抖音IM客服,详情请参见抖音IM客服能力 */
im
/** 跳转到抖音平台客服,详情请参见平台客服能力 */
platformIm
/** 跳转视频播放页,详情请参见跳转视频播放页 */
navigateToVideoView
/** 跳转抖音号个人页,详情请参见跳转抖音号个人页 */
openAwemeUserProfile
/** 跳转抖音直播间,详情请参见跳转抖音直播间 */
openWebcastRoom
/** 写入系统日历,详情请参见写入系统日历 */
addCalendarEvent
/** 添加到桌面,详情请参见添加到桌面 */
addShortcut
/** 加群,详情请参见加群 */
joinGroup
/** 私信,详情请参见私信 */
privateMessage
/** 主动授权私信,详情请参见主动授权私信 */
authorizePrivateMessage
}
}
/** lang 的合法值 */
interface Lang {
Expand Down Expand Up @@ -426,6 +485,9 @@ declare namespace ButtonProps {
*/
sign: string
}
interface onGetRealTimePhoneNumberEventDetail {
code: string
}
interface onOpenSettingEventDetail {
/* 打开授权设置页的调用状态 */
errMsg: string
Expand All @@ -435,7 +497,7 @@ declare namespace ButtonProps {
}
/** 按钮
* @classification forms
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid
* @example_react
* ```tsx
* export default class PageButton extends Component {
Expand Down Expand Up @@ -504,6 +566,7 @@ declare namespace ButtonProps {
* <Button size='mini' type='primary'>按钮</Button>
* <Button size='mini' >按钮</Button>
* <Button size='mini' type='warn'>按钮</Button>
* <Button openType='getPhoneNumber' onGetPhoneNumber="callback">按钮</Button>
* </View>
* )
* }
Expand All @@ -529,6 +592,7 @@ declare namespace ButtonProps {
* <button size="mini" type="primary">按钮</button>
* <button size="mini" >按钮</button>
* <button size="mini" type="warn">按钮</button>
* <button open-type="getPhoneNumber" `@getphonenumber="callback">按钮</button>
* </view>
* </template>
*
Expand Down
24 changes: 12 additions & 12 deletions packages/taro-components/types/Canvas.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@ interface CanvasProps extends StandardProps<any, CanvasTouchEvent> {
* @supported weapp, alipay, swan, qq, jd
*/
disableScroll?: boolean
/** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
* @supported h5
*/
nativeProps?: Record<string, unknown>
/** 组件唯一标识符。
* 注意:同一页面中的 id 不可重复。
* @supported alipay
* @supported alipay, h5
*/
id?: string
/**
* @supported alipay
* @supported alipay, h5
*/
width?: string
/**
* @supported alipay
* @supported alipay, h5
*/
height?: string
/** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
* @supported h5
*/
nativeProps?: Record<string, unknown>
/** 手指触摸动作开始
* @supported weapp, alipay, swan, tt, qq, jd
* @supported weapp, alipay, swan, tt, qq, jd, h5
*/
onTouchStart?: CanvasTouchEventFunction
/** 手指触摸后移动
* @supported weapp, alipay, swan, tt, qq, jd
* @supported weapp, alipay, swan, tt, qq, jd, h5
*/
onTouchMove?: CanvasTouchEventFunction
/** 手指触摸动作结束
* @supported weapp, alipay, swan, tt, qq, jd
* @supported weapp, alipay, swan, tt, qq, jd, h5
*/
onTouchEnd?: CanvasTouchEventFunction
/** 手指触摸动作被打断,如来电提醒,弹窗
* @supported weapp, alipay, swan, tt, qq, jd
* @supported weapp, alipay, swan, tt, qq, jd, h5
*/
onTouchCancel?: CanvasTouchEventFunction
/** 手指长按 500ms 之后触发,触发了长按事件后进行移动不会触发屏幕的滚动
Expand Down Expand Up @@ -73,7 +73,7 @@ declare namespace CanvasProps {
*
* `<Canvas />` 组件的 RN 版本尚未实现。
* @classification canvas
* @supported weapp, alipay, swan, tt, qq, jd, h5
* @supported weapp, alipay, swan, tt, qq, jd, h5, harmony_hybrid
* @example_react
* ```tsx
* class App extends Components {
Expand Down
6 changes: 5 additions & 1 deletion packages/taro-components/types/ChannelVideo.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentType } from 'react'
import { StandardProps, CommonEventFunction } from './common'
interface ChannelVideoProps extends StandardProps {
/** 视频 feedId
/** 仅视频号视频与小程序同主体时生效。若内嵌非同主体视频,请使用 feed-token。
* @supported weapp
*/
feedId: string
Expand Down Expand Up @@ -29,6 +29,10 @@ interface ChannelVideoProps extends StandardProps {
* @default false
*/
autoplay?: boolean
/** 仅内嵌小程序非同主体视频号视频时使用,获取方式参考[本指引](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/channels-activity.html#feed-token)。
* @supported weapp
*/
feedToken?: string
/** 视频播放出错时触发
* @supported weapp
*/
Expand Down
7 changes: 6 additions & 1 deletion packages/taro-components/types/Checkbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ interface CheckboxProps extends StandardProps {
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
color?: string
/**
* Checkbox 的名字
* @supported h5, harmony
*/
name?: string
/** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
* @supported h5
*/
Expand All @@ -36,7 +41,7 @@ interface CheckboxProps extends StandardProps {
}
/** 多选项目
* @classification forms
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid
* @example_react
* ```tsx
* export default class PageCheckbox extends Component {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/CheckboxGroup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface CheckboxGroupProps extends StandardProps, FormItemProps {
}
/** 多项选择器,内部由多个checkbox组成
* @classification forms
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony, harmony_hybrid
* @example
* ```tsx
* export default class PageCheckbox extends Component {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/CoverImage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interface CoverImageProps extends StandardProps {
}
/** 覆盖在原生组件之上的图片视图。可覆盖的原生组件同cover-view,支持嵌套在cover-view里。
* @classification viewContainer
* @supported weapp, alipay, swan, qq, jd, h5, harmony
* @supported weapp, alipay, swan, qq, jd, h5, harmony, harmony_hybrid
* @example_react
* ```tsx
* // js
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/CoverView.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ interface CoverViewProps extends ViewProps {
}
/** 覆盖在原生组件之上的文本视图。可覆盖的原生组件包括 map、video、canvas、camera、live-player、live-pusher 只支持嵌套 cover-view、cover-image,可在 cover-view 中使用 button。
* @classification viewContainer
* @supported weapp, alipay, swan, qq, jd, h5
* @supported weapp, alipay, swan, qq, jd, h5, harmony_hybrid
* @example_react
* ```tsx
* // js
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/CustomWrapper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface CustomWrapperProps extends StandardProps {
/** custom-wrapper 自定义组件包裹器
* 当数据更新层级较深时,可用此组件将需要更新的区域包裹起来,这样更新层级将大大减少
* @classification viewContainer
* @supported weapp, swan, alipay, tt, jd, qq, h5
* @supported weapp, swan, alipay, tt, jd, qq, h5, harmony_hybrid
* @example
* ```tsx
* import { Component } from 'react'
Expand Down
47 changes: 47 additions & 0 deletions packages/taro-components/types/DraggableSheet.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { ComponentType } from 'react'
import { StandardProps, CommonEventFunction } from './common'

interface DraggableSheetProps extends StandardProps {
/**
* 初始时占父容器的比例
* @supported weapp
* @default 0.5
*/
initialChildSize?: number
/**
* 最小时占父容器的比例
* @supported weapp
* @default 0.25
*/
minChildSize?: number
/**
* 最大时占父容器的比例
* @supported weapp
* @default 1.0
*/
maxChildSize?: number
/**
* 拖拽后是否自动对齐关键点
* @supported weapp
* @default false
*/
snap?: boolean
/**
* 拖拽后对齐的关键点,无需包含最小和最大值
* @supported weapp
* @default []
*/
snapSizes?: any[]
}

/**
* 半屏可拖拽组件
* 该组件需配合 DraggableSheetContext 接口使用。 目前仅在 Skyline 渲染引擎下支持。
* 页面内拖拽是一种常见的交互效果,开发者可通过手势系统灵活实现。draggable-sheet 组件封装了常见的交互逻辑,实现起来更加简单。
* 该组件需结合 scroll-view 使用。scroll-view 组件声明 associative-container 属性后,可与 draggable-sheet 关联起来。
* @classification skyline
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/component/draggable-sheet.html
*/
declare const DraggableSheet: ComponentType<DraggableSheetProps>
export { DraggableSheet, DraggableSheetProps }
Loading