Skip to content

Commit

Permalink
refactor(types): sync components types
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode authored Dec 7, 2024
1 parent 8501202 commit 09d76d9
Show file tree
Hide file tree
Showing 19 changed files with 185 additions and 538 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
20 changes: 10 additions & 10 deletions packages/taro-components/types/Editor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,48 @@ import { StandardProps, CommonEventFunction } from './common'
interface EditorProps extends StandardProps {
/** 设置编辑器为只读
* @default false
* @supported weapp, jd
* @supported weapp
*/
readOnly?: boolean
/** 提示信息
* @supported weapp, jd
* @supported weapp
*/
placeholder?: string
/** 点击图片时显示图片大小控件
* @default false
* @supported weapp, jd
* @supported weapp
*/
showImgSize?: boolean
/** 点击图片时显示工具栏控件
* @default false
* @supported weapp, jd
* @supported weapp
*/
showImgToolbar?: boolean
/** 点击图片时显示修改尺寸控件
* @default false
* @supported weapp, jd
* @supported weapp
*/
showImgResize?: boolean
/** 编辑器初始化完成时触发
* @supported weapp, jd
* @supported weapp
*/
onReady?: CommonEventFunction
/** 编辑器聚焦时触发
* @supported weapp, jd
* @supported weapp
*/
onFocus?: CommonEventFunction<EditorProps.editorEventDetail>
/** 编辑器失去焦点时触发
* detail = { html, text, delta }
* @supported weapp, jd
* @supported weapp
*/
onBlur?: CommonEventFunction<EditorProps.editorEventDetail>
/** 编辑器内容改变时触发
* detail = { html, text, delta }
* @supported weapp, jd
* @supported weapp
*/
onInput?: CommonEventFunction<EditorProps.editorEventDetail>
/** 通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式
* @supported weapp, jd
* @supported weapp
*/
onStatusChange?: CommonEventFunction
}
Expand Down
7 changes: 0 additions & 7 deletions packages/taro-components/types/GridView.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@ interface GridViewProps extends StandardProps {
* @default 0
*/
maxCrossAxisExtent?: number
/**
* 长度为 4 的数组,按 top、right、bottom、left 顺序指定内边距
* @supported weapp
* @default [0, 0, 0, 0]
*/
padding?: [number, number, number, number]
}

/**
* 网格布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点或 sticky-section 组件直接子节点。仅 Skyline 支持。
* @classification skyline
Expand Down
24 changes: 0 additions & 24 deletions packages/taro-components/types/Input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ interface InputProps extends StandardProps, FormItemProps {
* @supported weapp, alipay, swan, tt, qq, jd, rn, harmony
*/
cursor?: number
/** 光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制
* @supported weapp
*/
cursorColor?: string
/** 光标起始位置,自动聚集时有效,需与selection-end搭配使用
* @default -1
* @supported weapp, alipay, swan, tt, qq, jd, rn
Expand Down Expand Up @@ -198,26 +194,6 @@ interface InputProps extends StandardProps, FormItemProps {
* @supported weapp
*/
onNickNameReview?: CommonEventFunction
/** 选区改变事件, {selectionStart, selectionEnd}
* @supported weapp
*/
onSelectionChange?: CommonEventFunction
/** 输入法开始新的输入时触发 (仅当输入法支持时触发)
* @supported weapp
*/
onKeyboardCompositionStart?: CommonEventFunction
/** 输入法输入字符时触发(仅当输入法支持时触发)
* @supported weapp
*/
onKeyboardCompositionUpdate?: CommonEventFunction
/** 输入法输入结束时触发(仅当输入法支持时触发)
* @supported weapp
*/
onKeyboardCompositionEnd?: CommonEventFunction
/** 键盘高度变化时触发。event.detail = {height: height, pageBottomPadding: pageBottomPadding}; height: 键盘高度,pageBottomPadding: 页面上推高度
* @supported weapp
*/
onKeyoardHeightChangeWorklet?: string
}
declare namespace InputProps {
/** Input 类型 */
Expand Down
24 changes: 0 additions & 24 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
14 changes: 7 additions & 7 deletions packages/taro-components/types/MatchMedia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ import { ComponentType } from 'react'
import { StandardProps } from './common'
interface MatchMediaProps extends StandardProps {
/** 页面最小宽度( px 为单位)
* @supported weapp, alipay, jd
* @supported weapp, alipay
*/
minWidth?: number
/** 页面最大宽度( px 为单位)
* @supported weapp, alipay, jd
* @supported weapp, alipay
*/
maxWidth?: number
/** 页面宽度( px 为单位)
* @supported weapp, alipay, jd
* @supported weapp, alipay
*/
width?: number
/** 页面最小高度( px 为单位)
* @supported weapp, alipay, jd
* @supported weapp, alipay
*/
minHeight?: number
/** 页面最大高度( px 为单位)
* @supported weapp, alipay, jd
* @supported weapp, alipay
*/
maxHeight?: number
/** 页面高度( px 为单位)
* @supported weapp, alipay, jd
* @supported weapp, alipay
*/
height?: number
/** 屏幕方向( landscape 或 portrait )
* @supported weapp, alipay, jd
* @supported weapp, alipay
*/
orientation?: string
}
Expand Down
30 changes: 15 additions & 15 deletions packages/taro-components/types/PageContainer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { StandardProps, CommonEventFunction } from './common'
interface PageContainerProps extends StandardProps {
/** 是否显示容器组件
* @default false
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
show?: boolean
/** 动画时长,单位毫秒
* @default 300
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
duration?: number
/** z-index 层级
Expand All @@ -18,58 +18,58 @@ interface PageContainerProps extends StandardProps {
zIndex?: number
/** 是否显示遮罩层
* @default true
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
overlay?: boolean
/** 弹出位置,可选值为 top bottom right center
* @default bottom
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
position?: keyof PageContainerProps.Position
/** 是否显示圆角
* @default false
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
round?: boolean
/** 自定义遮罩层样式
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
overlayStyle?: string
/** 自定义弹出层样式
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
customStyle?: string
/** 是否在下滑一段距离后关闭
* @supported weapp, alipay, jd
* @supported weapp, alipay
* @default false
*/
closeOnSlideDown?: boolean
/** 进入前触发
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
onBeforeEnter?: CommonEventFunction
/** 进入中触发
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
onEnter?: CommonEventFunction
/** 进入后触发
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
onAfterEnter?: CommonEventFunction
/** 离开前触发
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
onBeforeLeave?: CommonEventFunction
/** 离开中触发
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
onLeave?: CommonEventFunction
/** 离开后触发
* @supported weapp, alipay, jd, rn
* @supported weapp, alipay, rn
*/
onAfterLeave?: CommonEventFunction
/** 点击遮罩层时触发
* @supported weapp, alipay, jd
* @supported weapp, alipay
*/
onClickOverlay?: CommonEventFunction
/** 进入被打断时触发(通过 a: if 打断时不会触发)。
Expand Down
11 changes: 3 additions & 8 deletions packages/taro-components/types/RichText.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { CommonEventFunction, StandardProps } from './common'
interface RichTextProps extends StandardProps {
/** 文本是否可选,该属性会使节点显示为 block
* @default false
* @supported weapp, jd, h5, harmony_hybrid
* @supported weapp, h5, harmony_hybrid
*/
userSelect?: boolean
/** 节点列表/ HTML String
* @supported weapp, jd, alipay, swan, tt, qq, h5, rn, harmony, harmony_hybrid
* @supported weapp, alipay, swan, tt, qq, h5, rn, harmony, harmony_hybrid
*/
nodes?: Nodes
/** 显示连续空格
* @supported weapp, jd, alipay, tt, qq, h5, rn, harmony_hybrid
* @supported weapp, alipay, tt, qq, h5, rn, harmony_hybrid
*/
space?: keyof RichTextProps.TSpace
/** 富文本是否可以长按选中,可用于复制,粘贴,长按搜索等场景
Expand Down Expand Up @@ -52,11 +52,6 @@ interface RichTextProps extends StandardProps {
* @supported alipay
*/
onLongtap?: CommonEventFunction
/** 布局兼容模式
* @supported weapp
* @default default
*/
mode?: 'default' | 'compat' | 'aggressive' | 'inline-block' | 'web'
}
/** 节点类型
* > 现支持两种节点,通过type来区分,分别是元素节点和文本节点,默认是元素节点,在富文本区域里显示的HTML节点 元素节点:type = node*
Expand Down
Loading

0 comments on commit 09d76d9

Please sign in to comment.