Skip to content

Commit

Permalink
refactor(types): sync components types
Browse files Browse the repository at this point in the history
  • Loading branch information
PengBoUESTC authored Nov 11, 2023
1 parent adc3221 commit 8c91382
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 126 deletions.
32 changes: 1 addition & 31 deletions packages/taro-components/types/Button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ interface ButtonProps extends StandardProps {
/** 群聊 id
* @qq 打开群资料卡时,传递的群号
* @tt 通过创建聊天群、查询群信息获取
* @supported qq, tt
* @supported qq
*/
groupId?: string
/** 打开频道页面时,传递的频道号
Expand Down Expand Up @@ -167,15 +167,6 @@ interface ButtonProps extends StandardProps {
* @supported qq
*/
shareMessageImg?: string
/** 跳转抖音号个人页,只支持小程序绑定的品牌号、员工号、合作号
* @supported tt
*/
dataAwemeId?: string
/**
* 是否开启半屏模式
* @supported tt
*/
dataIsHalfPage?: boolean
/** 用户点击该按钮时,会返回获取到的用户信息,回调的detail数据与 Taro.getUserInfo 返回的一致
*
* 生效时机: `open-type="getUserInfo"`
Expand All @@ -200,11 +191,6 @@ interface ButtonProps extends StandardProps {
* @supported weapp, alipay, swan, tt, jd
*/
onGetPhoneNumber?: CommonEventFunction<ButtonProps.onGetPhoneNumberEventDetail>
/**
* 手机号实时验证回调,`open-type="getRealtimePhoneNumber"` 时有效
* @supported weapp
*/
onGetRealTimePhoneNumber?: CommonEventFunction<ButtonProps.onGetRealTimePhoneNumberEventDetail>
/** 当使用开放能力时,发生错误的回调
*
* 生效时机:`open-type="launchApp"`
Expand All @@ -229,11 +215,6 @@ interface ButtonProps extends StandardProps {
* @supported weapp
*/
onChooseAvatar?: CommonEventFunction
/**
* 用户同意隐私协议事件回调,`open-type="agreePrivacyAuthorization"`时有效
* @supported weapp
*/
onAgreePrivacyAuthorization?: CommonEventFunction
/** 点击。
* 说明: 每点击一次会触发一次事件,建议自行使用代码防止重复点击,可以使用 js 防抖和节流实现。
* @supported alipay
Expand Down Expand Up @@ -272,17 +253,6 @@ interface ButtonProps extends StandardProps {
* @supported qq
*/
onAddGroupApp?: CommonEventFunction
/** 监听跳转抖音号个人页的回调
*
* 生效时机:`open-type="openAwemeUserProfile"`
* @supported tt
*/
onOpenAwemeUserProfile?: CommonEventFunction
/**
* 加群后触发
* @supported tt
*/
onJoinGroup?: CommonEventFunction<{ errMsg: string; errNo: number }>
}
declare namespace ButtonProps {
/** size 的合法值 */
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Form.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface FormProps extends StandardProps {
reportSubmitTimeout?: number
/** 模板消息的类型,report-submit 为 true 时填写有效
* 取值:default / subscribe
* @default 'default'
* @default "default"
* @supported swan
*/
reportType?: string
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/LivePlayer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ interface LivePlayerProps extends StandardProps {
*/
autoPauseIfOpenNative?: boolean
/** 格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html ,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;
* @default 'no-referrer'
* @default "no-referrer"
* @supported weapp
*/
referrerPolicy?: 'origin' | 'no-referrer'
Expand Down
26 changes: 0 additions & 26 deletions packages/taro-components/types/Map.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,30 +218,6 @@ interface MapProps extends StandardProps {
* @supported weapp, swan, qq
*/
onPoiTap?: CommonEventFunction<MapProps.onPoiTapEventDetail>
/** 点击地图路线时触发,e.detail = {longitude, latitude}
* @supported weapp, swan, qq
*/
onPolylineTap?: CommonEventFunction<MapProps.onPolylineTapEventDetail>
/** 地图能力生效时触发,e.detail = {ability, errCode, errMsg}
* @supported weapp
*/
onAbilitySuccess?: CommonEventFunction<MapProps.onAbilityEventDetail>
/** 地图能力失败时触发,e.detail = {ability, errCode, errMsg}
* @supported weapp
*/
onAbilityFailed?: CommonEventFunction<MapProps.onAbilityEventDetail>
/** 地图鉴权结果成功时触发,e.detail = {errCode, errMsg}
* @supported weapp
*/
onAuthSuccess?: CommonEventFunction<{ errCode: number; errMsg: string }>
/** MapContext.moveAlong 插值动画时触发。e.detail = {markerId, longitude, latitude, animationStatus: "interpolating" | "complete"}
* @supported weapp
*/
onInterpolatePoint?: CommonEventFunction<MapProps.onInterpolatePointEventDetail>
/** 组件错误时触发,例如创建或鉴权失败,e.detail = {longitude, latitude}
* @supported weapp
*/
onError: CommonEventFunction<MapProps.point>
/** 点击标记点对应的气泡时触发e.detail = {markerId}
* @supported weapp, swan, tt, jd
*/
Expand Down Expand Up @@ -637,7 +613,6 @@ declare namespace MapProps {
longitude: number
latitude: number
}

interface onPolylineTapEventDetail {
polylineId: number
longitude: number
Expand All @@ -648,7 +623,6 @@ declare namespace MapProps {
errCode: number
errMsg: string
}

interface onInterpolatePointEventDetail {
markerId: number
longitude: number
Expand Down
62 changes: 4 additions & 58 deletions packages/taro-components/types/ScrollView.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ interface ScrollViewProps extends StandardProps {
refresherThreshold?: number
/** 设置自定义下拉刷新默认样式,支持设置 `black | white | none`, none 表示不使用默认样式
* @supported weapp
* @default 'black'
* @default "black"
*/
refresherDefaultStyle?: string
/** 设置自定义下拉刷新区域背景颜色
* @supported weapp
* @default '#FFF'
* @default "#FFF"
*/
refresherBackground?: string
/** 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
Expand Down Expand Up @@ -135,33 +135,18 @@ interface ScrollViewProps extends StandardProps {
* list - 列表模式。只会渲染在屏节点,会根据直接子节点是否在屏来按需渲染,若只有一个直接子节点则性能会退化
* custom - 自定义模式。只会渲染在屏节点,子节点可以是 sticky-section list-view grid-view 等组件
* @supported weapp
* @default 'list'
* @default "list"
*/
type?: 'list' | 'custom'
/** 是否反向滚动。一般初始滚动位置是在顶部,反向滚动则是在底部。
* @supported weapp
* @default false
*/
reverse?: boolean
/** 是否对溢出进行裁剪,默认开启
* @supported weapp
* @default true
*/
clip?: boolean
/** 指定视口外渲染区域的距离,默认情况下视口外节点不渲染。指定 cache-extent 可优化滚动体验和加载速度,但会提高内存占用且影响首屏速度,可按需启用。
* @supported weapp
*/
cacheExtent?: number
/** 指定 scroll-view 触发滚动的最小拖动距离。仅在 scroll-view 和其他组件存在手势冲突时使用,可通过调整该属性使得滚动更加灵敏。
* @supported weapp
* @default 18
*/
minDragDistance?: number
/** 长度为 4 的数组,按 top、right、bottom、left 顺序指定内边距
* @supported weapp
* @default [0,0,0,0]
*/
padding?: [number, number, number, number]
/** 只 scroll-into-view 到 cacheExtent 以内的目标节点,性能更佳
* @supported weapp
* @default false
Expand All @@ -173,44 +158,9 @@ interface ScrollViewProps extends StandardProps {
* end - 目标节点显示在视口结束处
* nearest - 目标节点在就近的视口边缘显示,若节点已在视口内则不触发滚动
* @supported weapp, h5
* @default 'start'
* @default "start"
*/
scrollIntoViewAlignment?: 'start' | 'center' | 'end' | 'nearest'
/** 开启下拉二级能力
* @supported weapp
* @default false
*/
refresherTwoLevelEnabled?: boolean
/** 设置打开/关闭二级
* @supported weapp
* @default false
*/
refresherTwoLevelTriggered?: boolean
/** 下拉二级阈值
* @supported weapp
* @default 150
*/
refresherTwoLevelThreshold?: number
/** 滑动返回时关闭二级的阈值
* @supported weapp
* @default 80
*/
refresherTwoLevelCloseThreshold?: number
/** 处于二级状态时是否可滑动
* @supported weapp
* @default false
*/
refresherTwoLevelScrollEnabled?: boolean
/** 惯性滚动是否触发下拉刷新
* @supported weapp
* @default false
*/
refresherBallisticRefreshEnabled?: boolean
/** 即将打开二级时否定住
* @supported weapp
* @default false
*/
refresherTwoLevelPinned?: boolean
/** 滚动到顶部/左边,会触发 scrolltoupper 事件
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
Expand Down Expand Up @@ -251,10 +201,6 @@ interface ScrollViewProps extends StandardProps {
* @supported weapp
*/
onRefresherWillRefresh?: CommonEventFunction
/** 下拉刷新状态回调
* @supported weapp
*/
onRefresherStatusChange?: CommonEventFunction<ScrollViewProps.RefresherStatusChange>
/** 滑动开始事件 (同时开启 enhanced 属性后生效)
* @supported weapp
*/
Expand Down
4 changes: 0 additions & 4 deletions packages/taro-components/types/ShareElement.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ interface ShareElementProps extends StandardProps {
* @deprecated 使用mapkey替换key
*/
key?: string
/** 映射标记
* @supported weapp
*/
mapkey?: string
/** 映射标记
* @supported alipay
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-components/types/Video.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ interface VideoProps extends StandardProps {
* - `bottom`: controls bar 上
* - `center`: 视频中间
*
* @default 'bottom'
* @default "bottom"
* @supported weapp, tt, qq
*/
playBtnPosition?: keyof VideoProps.PlayBtnPosition
Expand Down Expand Up @@ -315,7 +315,7 @@ interface VideoProps extends StandardProps {
onTimeUpdate?: CommonEventFunction<VideoProps.onTimeUpdateEventDetail>
/** 当视频进入和退出全屏时触发
*
* @supported h5, rn, alipay
* @supported h5, rn
*/
onFullscreenChange?: CommonEventFunction<VideoProps.onFullscreenChangeEventDetail>
/** 视频出现缓冲时触发
Expand Down
6 changes: 3 additions & 3 deletions packages/taro/types/api/files/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ declare module '../../index' {
apFilePath: string
/**
* 计算文件摘要的算法
* @default 'md5'
* @default "md5"
*/
digestAlgorithm?: 'md5' | 'sha1'
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
Expand Down Expand Up @@ -608,7 +608,7 @@ declare module '../../index' {
filePath: string
/**
* 计算文件摘要的算法
* @default 'md5'
* @default "md5"
*/
digestAlgorithm?: 'md5' | 'sha1'
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
Expand Down Expand Up @@ -664,7 +664,7 @@ declare module '../../index' {
/** 创建的目录路径 */
dirPath: string
/** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。
* 如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
* 如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
* @default false
*/
recursive?: boolean
Expand Down

0 comments on commit 8c91382

Please sign in to comment.