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 Jun 1, 2024
1 parent e8ddabe commit 6fdf8a7
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 186 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
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/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
59 changes: 0 additions & 59 deletions packages/taro-components/types/ScrollView.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ interface ScrollViewProps extends StandardProps {
* @default false
*/
enhanced?: boolean
/** 使 scroll-view 下的 position sticky 特性生效,否则滚动一屏后 sticky 元素会被隐藏
* @supported weapp
* @default false
*/
usingSticky?: boolean
/** iOS 下 scroll-view 边界弹性控制 (同时开启 enhanced 属性后生效)
* @supported weapp, swan
* @default true
Expand Down Expand Up @@ -149,25 +144,10 @@ interface ScrollViewProps extends StandardProps {
* @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 @@ -182,41 +162,6 @@ interface ScrollViewProps extends StandardProps {
* @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, harmony_hybrid
*/
Expand Down Expand Up @@ -257,10 +202,6 @@ interface ScrollViewProps extends StandardProps {
* @supported weapp
*/
onRefresherWillRefresh?: CommonEventFunction
/** 下拉刷新状态回调
* @supported weapp
*/
onRefresherStatusChange?: CommonEventFunction<ScrollViewProps.RefresherStatusChange>
/** 滑动开始事件 (同时开启 enhanced 属性后生效)
* @supported weapp
*/
Expand Down
6 changes: 0 additions & 6 deletions packages/taro-components/types/StickySection.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ interface StickySectionProps extends StandardProps {
* @default true
*/
pushPinnedHeader?: boolean
/**
* 长度为 4 的数组,按 top、right、bottom、left 顺序指定内边距
* @supported weapp
* @default [0, 0, 0, 0]
*/
padding?: [number, number, number, number]
}
/**
* 吸顶布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点。仅 Skyline 支持。
Expand Down
6 changes: 0 additions & 6 deletions packages/taro-components/types/Text.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ interface TextProps extends StandardProps {
* @supported alipay
*/
numberOfLines?: number
/**
* 文本溢出处理
* @supported weapp-skyline
* @default 'visible'
*/
overflow?: keyof TextProps.Overflow
/** 限制文本最大行数
* @supported weapp
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/taro/types/api/network/request.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ declare module '../../index' {
/** 接口调用失败的回调函数 */
fail?: (res: TaroGeneral.CallbackResult) => void
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: (res: Partial<SuccessCallbackResult> & TaroGeneral.CallbackResult) => void
complete?: (res: TaroGeneral.CallbackResult) => void
/** 设置是否使用 jsonp 方式获取数据
* @default false
* @supported h5
Expand Down
1 change: 0 additions & 1 deletion packages/taro/types/compile/config/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './h5'
export * from './mini'
export * from './rn'

export * from './manifest'
export * from './project'
Expand Down
21 changes: 0 additions & 21 deletions packages/taro/types/compile/config/rn.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type Webpack from 'webpack'
import type Chain from 'webpack-chain'
import type webpackDevServer from 'webpack-dev-server'
import type HtmlWebpackPlugin from 'html-webpack-plugin'
import type { RollupOptions } from 'rollup'
import type { IOption, IPostcssOption } from './util'

export interface IRNConfig {
Expand Down Expand Up @@ -62,24 +61,4 @@ export interface IRNConfig {

/** 设计稿尺寸换算规则 */
deviceRatio?: TaroGeneral.TDeviceRatio

/** 原生组件编译配置 */
nativeComponents?: {
/**
* 外部依赖
*/
external?: Array<string | RegExp> | ((arr: Array<string | RegExp>) => Array<string | RegExp>)
/**
* 设置外部依赖,如果返回 string, 则将该值作为 external, 我们默认将 node_modules 路径下的文件设置为外部依赖
*/
exteranlResolve?: (importee: string, importer: string) => string
/**
* 组件输出路径,默认值为 'dist'
*/
output?: string
/**
* 修改 Rollup 打包配置
*/
modifyRollupConfig?: (config: RollupOptions, innerPlugins: { taroResolver: typeof taroResolver, styleTransformer: typeof styleTransformer }) => RollupOptions
}
}
Loading

0 comments on commit 6fdf8a7

Please sign in to comment.