diff --git a/packages/taro-components/package.json b/packages/taro-components/package.json index 310d9f1d333a..aad16dce2c18 100644 --- a/packages/taro-components/package.json +++ b/packages/taro-components/package.json @@ -63,7 +63,7 @@ "jquery": "^3.4.1", "karmatic": "^2.1.0", "lodash": "^4.17.21", - "miniapp-types": "1.1.21", + "miniapp-types": "1.6.0", "simulant": "^0.2.2", "style-loader": "1.3.0", "ts-node": "^10.9.1", diff --git a/packages/taro-components/types/Ad.d.ts b/packages/taro-components/types/Ad.d.ts index 0e9ec0e2a5a0..e156d2691824 100644 --- a/packages/taro-components/types/Ad.d.ts +++ b/packages/taro-components/types/Ad.d.ts @@ -34,6 +34,8 @@ interface AdProps extends StandardProps { /** 广告类型:banner、feed ,需和百青藤平台上的代码位类型相匹配 * @supported swan, tt, qq * @default feed + * @swan 支持 banner、feed + * @qq 支持 banner、card、feeds、block */ type?: string diff --git a/packages/taro-components/types/Button.d.ts b/packages/taro-components/types/Button.d.ts index 666803cae461..5e97d19a0665 100644 --- a/packages/taro-components/types/Button.d.ts +++ b/packages/taro-components/types/Button.d.ts @@ -83,7 +83,7 @@ interface ButtonProps extends StandardProps { /** 会话来源 * * 生效时机:`open-type="contact"` - * @supported weapp + * @supported weapp, swan */ sessionFrom?: string @@ -91,7 +91,7 @@ interface ButtonProps extends StandardProps { * * 生效时机:`open-type="contact"` * @default 当前标题 - * @supported weapp + * @supported weapp, swan */ sendMessageTitle?: string @@ -99,7 +99,7 @@ interface ButtonProps extends StandardProps { * * 生效时机:`open-type="contact"` * @default 当前标题 - * @supported weapp + * @supported weapp, swan */ sendMessagePath?: string @@ -107,7 +107,7 @@ interface ButtonProps extends StandardProps { * * 生效时机:`open-type="contact"` * @default 截图 - * @supported weapp + * @supported weapp, swan */ sendMessageImg?: string @@ -128,6 +128,7 @@ interface ButtonProps extends StandardProps { /** 显示会话内消息卡片 * * 生效时机:`open-type="contact"` + * @supported weapp, swan * @default false */ showMessageCard?: boolean @@ -149,7 +150,9 @@ interface ButtonProps extends StandardProps { */ subscribeId?: string - /** 打开群资料卡时,传递的群号 + /** 群聊 id + * @qq 打开群资料卡时,传递的群号 + * @tt 通过创建聊天群、查询群信息获取 * @supported qq */ groupId?: string @@ -219,7 +222,7 @@ interface ButtonProps extends StandardProps { /** 获取用户手机号回调 * - * 生效时机:`open-type="getphonenumber"` + * 生效时机:`open-type="getPhoneNumber"` * @supported weapp, alipay, swan, tt, jd */ onGetPhoneNumber?: CommonEventFunction @@ -234,7 +237,7 @@ interface ButtonProps extends StandardProps { /** 在打开授权设置页后回调 * * 生效时机:`open-type="openSetting"` - * @supported weapp, swan, qq, jd + * @supported weapp, swan, tt, qq, jd */ onOpenSetting?: CommonEventFunction @@ -330,7 +333,11 @@ declare namespace ButtonProps { } /** 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 { @@ -350,6 +357,12 @@ declare namespace ButtonProps { */ getPhoneNumber + /** + * 手机号实时验证,向用户申请,并在用户同意后,快速填写和实时验证手机号。(*小程序插件中不能使用*) + * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getRealtimePhoneNumber.html + */ + getRealtimePhoneNumber + /** 获取用户信息,可以从回调中获取到用户信息 */ getUserInfo @@ -366,6 +379,29 @@ declare namespace ButtonProps { /** 获取用户头像,可以从回调中获得具体信息 */ chooseAvatar + + /** + * 用户同意隐私协议按钮。可通过 bindagreeprivacyauthorization 监听用户同意隐私协议事件 + */ + agreePrivacyAuthorization + + /** + * 从基础库 2.32.3 版本起,隐私同意按钮支持与手机号快速验证组件耦合使用,调用方式为: + * * * + * * * ) * } @@ -620,6 +712,7 @@ declare namespace ButtonProps { * * * + * * * * diff --git a/packages/taro-components/types/Camera.d.ts b/packages/taro-components/types/Camera.d.ts index e0630a2b8f1e..18576b58d863 100644 --- a/packages/taro-components/types/Camera.d.ts +++ b/packages/taro-components/types/Camera.d.ts @@ -149,7 +149,7 @@ declare namespace CameraProps { /** 系统相机 * @classification media - * @supported weapp, alipay, swan, tt, qq, jd, rn + * @supported weapp, alipay, swan, tt, qq, jd, rn, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/component/camera.html */ declare const Camera: ComponentType diff --git a/packages/taro-components/types/Canvas.d.ts b/packages/taro-components/types/Canvas.d.ts index 1aa6e0f58086..b7ef21aac95c 100644 --- a/packages/taro-components/types/Canvas.d.ts +++ b/packages/taro-components/types/Canvas.d.ts @@ -7,7 +7,7 @@ interface CanvasProps extends StandardProps { type?: string /** canvas 组件的唯一标识符,若指定了 type 则无需再指定该属性 - * @supported weapp, swan, tt, qq, jd + * @supported weapp, swan, tt, qq, jd, h5 */ canvasId?: string @@ -17,49 +17,49 @@ interface CanvasProps extends StandardProps { */ disableScroll?: boolean - /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上 - * @supported h5 - */ - nativeProps?: Record - /** 组件唯一标识符。 * 注意:同一页面中的 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 + /** 手指触摸动作开始 - * @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 之后触发,触发了长按事件后进行移动不会触发屏幕的滚动 - * @supported weapp, alipay, swan, qq, jd + * @supported weapp, alipay, swan, qq, jd, h5 */ onLongTap?: CommonEventFunction diff --git a/packages/taro-components/types/ChannelLive.d.ts b/packages/taro-components/types/ChannelLive.d.ts new file mode 100644 index 000000000000..aad2af883acd --- /dev/null +++ b/packages/taro-components/types/ChannelLive.d.ts @@ -0,0 +1,22 @@ +import { ComponentType } from 'react' +import { StandardProps } from './common' +interface ChannelLiveProps extends StandardProps { + /** 视频 feedId + * @supported weapp + */ + feedId: string + + /** 视频号 id,以“sph”开头的id,可在视频号助手获取。视频号必须与当前小程序相同主体。 + * @supported weapp + */ + finderUserName: string +} + +/** + * 小程序内嵌视频号直播组件,展示视频号直播状态和封面,并无弹窗跳转至视频号。注意:使用该组件打开的视频号视频需要与小程序的主体一致。 + * @classification media + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/component/channel-live.html + */ +declare const ChannelLive: ComponentType +export { ChannelLive, ChannelLiveProps } diff --git a/packages/taro-components/types/ChannelVideo.d.ts b/packages/taro-components/types/ChannelVideo.d.ts new file mode 100644 index 000000000000..28104ad68108 --- /dev/null +++ b/packages/taro-components/types/ChannelVideo.d.ts @@ -0,0 +1,56 @@ +import { ComponentType } from 'react' +import { StandardProps, CommonEventFunction } from './common' +interface ChannelVideoProps extends StandardProps { + /** 仅视频号视频与小程序同主体时生效。若内嵌非同主体视频,请使用 feed-token。 + * @supported weapp + */ + feedId: string + + /** 视频号 id,以“sph”开头的id,可在视频号助手获取。视频号必须与当前小程序相同主体。 + * @supported weapp + */ + finderUserName: string + + /** 是否循环播放 + * @supported weapp + * @default false + */ + loop?: boolean + + /** 是否静音播放 + * @supported weapp + * @default false + */ + muted?: boolean + + /** 当视频大小与 video 容器大小不一致时,视频的表现形式 + * @supported weapp + * @default "contain" + */ + objectFit?: 'fill' | 'contain' | 'cover' + + /** 是否自动播放 + * @supported weapp + * @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 + */ + onError?: CommonEventFunction +} + +/** + * 小程序内嵌视频号视频组件,支持在小程序中播放视频号视频,并无弹窗跳转至视频号。注意:使用该组件打开的视频号视频需要与小程序相同主体或关联主体。 + * @classification media + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/component/channel-video.html + */ +declare const ChannelVideo: ComponentType +export { ChannelVideo, ChannelVideoProps } diff --git a/packages/taro-components/types/Checkbox.d.ts b/packages/taro-components/types/Checkbox.d.ts index e4479723c7e0..e80b781bf5ab 100644 --- a/packages/taro-components/types/Checkbox.d.ts +++ b/packages/taro-components/types/Checkbox.d.ts @@ -2,7 +2,7 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction, FormItemProps } from './common' interface CheckboxProps extends StandardProps { /** ``标识,选中时触发``的 change 事件,并携带 `` 的 value - * @supported weapp, alipay, swan, tt, qq, jd, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ value: string @@ -43,7 +43,7 @@ interface CheckboxProps extends StandardProps { /** 多选项目 * @classification forms - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * export default class PageCheckbox extends Component { diff --git a/packages/taro-components/types/CheckboxGroup.d.ts b/packages/taro-components/types/CheckboxGroup.d.ts index f98c44080964..3262a99e606d 100644 --- a/packages/taro-components/types/CheckboxGroup.d.ts +++ b/packages/taro-components/types/CheckboxGroup.d.ts @@ -16,7 +16,7 @@ interface CheckboxGroupProps extends StandardProps, FormItemProps { /** 多项选择器,内部由多个checkbox组成 * @classification forms - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example * ```tsx * export default class PageCheckbox extends Component { diff --git a/packages/taro-components/types/CommentDetail.d.ts b/packages/taro-components/types/CommentDetail.d.ts index a9af6abd42e5..bdab19c42e63 100644 --- a/packages/taro-components/types/CommentDetail.d.ts +++ b/packages/taro-components/types/CommentDetail.d.ts @@ -45,6 +45,11 @@ interface CommentDetailProps extends StandardProps { * @supported swan */ onDelete?: CommonEventFunction + + /** 评论发布成功时触发,返回数据为 {status, data:{srid}} + * @supported swan + */ + onReply?: CommonEventFunction } namespace CommentDetailProps { interface ICommentParam { diff --git a/packages/taro-components/types/CommentList.d.ts b/packages/taro-components/types/CommentList.d.ts index 35169cc801fd..ed10f1c085a0 100644 --- a/packages/taro-components/types/CommentList.d.ts +++ b/packages/taro-components/types/CommentList.d.ts @@ -65,6 +65,11 @@ interface CommentListProps extends StandardProps { * @supported swan */ onViewMore?: CommonEventFunction + + /** 评论发布成功时触发,返回数据为 {status, data:{srid}} + * @supported swan + */ + onReply?: CommonEventFunction } namespace CommentListProps { interface ICommentParam { diff --git a/packages/taro-components/types/CoverImage.d.ts b/packages/taro-components/types/CoverImage.d.ts index 5d3c5b4e9861..498ca1bf374f 100644 --- a/packages/taro-components/types/CoverImage.d.ts +++ b/packages/taro-components/types/CoverImage.d.ts @@ -2,7 +2,7 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction } from './common' interface CoverImageProps extends StandardProps { /** 图标路径,支持临时路径、网络地址、云文件ID。暂不支持base64格式。 - * @supported weapp, alipay, swan, qq, h5 + * @supported weapp, alipay, swan, qq, jd, h5 */ src: string @@ -42,12 +42,12 @@ interface CoverImageProps extends StandardProps { ariaLabel?: string /** 图片加载成功时触发 - * @supported weapp, swan, qq, h5 + * @supported weapp, swan, qq, jd, h5 */ onLoad?: CommonEventFunction /** 图片加载失败时触发 - * @supported weapp, swan, qq, h5 + * @supported weapp, swan, qq, jd, h5 */ onError?: CommonEventFunction @@ -59,7 +59,7 @@ interface CoverImageProps extends StandardProps { /** 覆盖在原生组件之上的图片视图。可覆盖的原生组件同cover-view,支持嵌套在cover-view里。 * @classification viewContainer - * @supported weapp, alipay, swan, qq, h5 + * @supported weapp, alipay, swan, qq, jd, h5, harmony * @example_react * ```tsx * // js diff --git a/packages/taro-components/types/CoverView.d.ts b/packages/taro-components/types/CoverView.d.ts index 7d883191578c..25b0d45781d7 100644 --- a/packages/taro-components/types/CoverView.d.ts +++ b/packages/taro-components/types/CoverView.d.ts @@ -3,7 +3,7 @@ import { CommonEventFunction } from './common' import { ViewProps } from './View' interface CoverViewProps extends ViewProps { /** 设置顶部滚动偏移量,仅在设置了 overflow-y: scroll 成为滚动元素后生效 - * @supported weapp, alipay, swan, qq + * @supported weapp, alipay, swan, qq, jd */ scrollTop?: number @@ -143,7 +143,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, h5 + * @supported weapp, alipay, swan, qq, jd, h5 * @example_react * ```tsx * // js diff --git a/packages/taro-components/types/CustomWrapper.d.ts b/packages/taro-components/types/CustomWrapper.d.ts index 9d352abdb433..b60ffd045d00 100644 --- a/packages/taro-components/types/CustomWrapper.d.ts +++ b/packages/taro-components/types/CustomWrapper.d.ts @@ -6,6 +6,7 @@ interface CustomWrapperProps extends StandardProps { /** custom-wrapper 自定义组件包裹器 * 当数据更新层级较深时,可用此组件将需要更新的区域包裹起来,这样更新层级将大大减少 + * @classification viewContainer * @supported weapp, swan, alipay, tt, jd, qq, h5 * @example * ```tsx diff --git a/packages/taro-components/types/Form.d.ts b/packages/taro-components/types/Form.d.ts index 83f1d9f0e677..bfd8255c3371 100644 --- a/packages/taro-components/types/Form.d.ts +++ b/packages/taro-components/types/Form.d.ts @@ -36,8 +36,21 @@ interface FormProps extends StandardProps { */ subscribeId?: string + /** 用于分发目的。取值:0 或 1,其中 0 表示默认,1 表示留资目标,需要和留资分发配置一起使用,详情见留资分发配置 + * @supported tt + * @default 0 + */ + conversionTarget?: number + + /** 用于分发目的。开发者在【小程序开发者后台 -> 进入目标小程序 -> 运营 -> 流量配置 -> 抖音 -> 留资分发配置】复制创建的配置 ID,需要和留资分发配置一起使用,详情见留资分发配置 + * + * @supported tt + * @default "" + */ + clueComponentId?: string + /** 携带 form 中的数据触发 submit 事件 - * @supported weapp, alipay, swan, tt, qq, jd, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ onSubmit?: CommonEventFunction @@ -66,7 +79,7 @@ declare namespace FormProps { * * 当点击 form 表单中 form-type 为 submit 的 button 组件时,会将表单组件中的 value 值进行提交,需要在表单组件中加上 name 来作为 key。 * @classification forms - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * class App extends Component { diff --git a/packages/taro-components/types/GridView.d.ts b/packages/taro-components/types/GridView.d.ts new file mode 100644 index 000000000000..6704f4efdf59 --- /dev/null +++ b/packages/taro-components/types/GridView.d.ts @@ -0,0 +1,42 @@ +import { ComponentType } from 'react' +import { StandardProps } from './common' +interface GridViewProps extends StandardProps { + /** 布局方式。masonry - 瀑布流,根据子元素高度自动布局。 aligned - 每行高度由同一行中最大高度子节点决定。 + * @supported weapp + * @default "aligned" + */ + type: string + + /** 交叉轴元素数量 + * @supported weapp + * @default 2 + */ + crossAxisCount?: number + + /** 主轴方向间隔 + * @supported weapp + * @default 0 + */ + mainAxisGap?: number + + /** 交叉轴方向间隔 + * @supported weapp + * @default 0 + */ + crossAxisGap?: number + + /** 交叉轴元素最大范围 + * @supported weapp + * @default 0 + */ + maxCrossAxisExtent?: number +} + +/** + * 网格布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点或 sticky-section 组件直接子节点。仅 Skyline 支持。 + * @classification skyline + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/component/grid-view.html + */ +declare const GridView: ComponentType +export { GridView, GridViewProps } diff --git a/packages/taro-components/types/Icon.d.ts b/packages/taro-components/types/Icon.d.ts index 116d80c992ba..042bcd900684 100644 --- a/packages/taro-components/types/Icon.d.ts +++ b/packages/taro-components/types/Icon.d.ts @@ -62,7 +62,7 @@ declare namespace IconProps { /** 图标。组件属性的长度单位默认为 px * @classification base - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * export default class PageView extends Component { diff --git a/packages/taro-components/types/Image.d.ts b/packages/taro-components/types/Image.d.ts index c75d80ed809f..724467a084ca 100644 --- a/packages/taro-components/types/Image.d.ts +++ b/packages/taro-components/types/Image.d.ts @@ -73,6 +73,12 @@ interface ImageProps extends StandardProps { */ ariaLabel?: string + /** 是否渐显 + * @supported weapp + * @default false + */ + fadeIn?: boolean + /** 当错误发生时,发布到 AppService 的事件名,事件对象 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ @@ -155,7 +161,7 @@ declare namespace ImageProps { * * **Note:** 为实现小程序的 `mode` 特性,在 H5 组件中使用一个 `div` 容器来对内部的 `img` 进行展示区域的裁剪,因此请勿使用元素选择器来重置 `img` 的样式! * @classification media - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * export default class PageView extends Component { diff --git a/packages/taro-components/types/Input.d.ts b/packages/taro-components/types/Input.d.ts index f2c14f14cc54..0b2e2c2c89e8 100644 --- a/packages/taro-components/types/Input.d.ts +++ b/packages/taro-components/types/Input.d.ts @@ -187,17 +187,17 @@ interface InputProps extends StandardProps, FormItemProps { */ alwaysSystem?: boolean - /** 使用原生键盘 - * @default true - * @supported alipay - */ - enableNative?: boolean - /** 无障碍访问,(属性)元素的额外描述 * @supported qq */ ariaLabel?: string + /** 用于分发目的。取值:0 和 1,其中 0 表示默认,1 表示手机号,需要和留资分发配置一起使用,详情见留资分发配置。 + * @supported tt + * @default 0 + */ + clueType?: number + /** 当键盘输入时,触发input事件,event.detail = {value, cursor, keyCode},处理函数可以直接 return 一个字符串,将替换输入框的内容。 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ @@ -215,14 +215,18 @@ interface InputProps extends StandardProps, FormItemProps { /** 点击完成按钮时触发 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn - * @h5 借用[Form 组件](./form)的`onSubmit`事件来替代 */ onConfirm?: CommonEventFunction /** 键盘高度发生变化的时候触发此事件 - * @supported weapp, qq + * @supported weapp, tt, qq */ onKeyboardHeightChange?: CommonEventFunction + + /** 用户昵称审核完毕后触发,仅在 type 为 "nickname" 时有效,event.detail = { pass, timeout } + * @supported weapp + */ + onNickNameReview?: CommonEventFunction } declare namespace InputProps { /** Input 类型 */ @@ -231,52 +235,66 @@ declare namespace InputProps { * @supported weapp, alipay, h5, rn */ text + /** 数字输入键盘 * @supported weapp, alipay, h5, rn */ number + /** 身份证输入键盘 *@supported weapp, alipay, rn */ idcard + /** 带小数点的数字键盘 * @supported weapp, alipay, h5, rn */ digit + /** 密码安全输入键盘[指引](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/safe-password.html) * @supported weapp, alipay */ 'safe-password' + /** 昵称输入键盘 * @supported weapp, alipay */ nickname + /** 数字输入键盘 * @supported alipay */ numberpad + /** 带小数点的数字键盘 * @supported alipay */ digitpad + /** 身份证输入键盘 * @supported alipay */ idcardpad } + /** Confirm 类型 */ interface ConfirmType { /** 右下角按钮为“发送” */ send + /** 右下角按钮为“搜索” */ search + /** 右下角按钮为“下一个” */ next + /** 右下角按钮为“前往” */ go + /** 右下角按钮为“完成” */ done } + /** > 注意:React-Native 端 `inputEventDetail` 仅实现参数 `value`,若需实时获取光标位置则可通过 [`onSelectionChange`](https://reactnative.dev/docs/textinput#onselectionchange) 实现。 */ interface inputEventDetail { /** 输入值 */ @@ -310,7 +328,7 @@ declare namespace InputProps { /** 输入框。该组件是原生组件,使用时请注意相关限制 * @classification forms - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * class App extends Component { diff --git a/packages/taro-components/types/Label.d.ts b/packages/taro-components/types/Label.d.ts index b93d388b82e7..22e2eb359c2e 100644 --- a/packages/taro-components/types/Label.d.ts +++ b/packages/taro-components/types/Label.d.ts @@ -1,7 +1,9 @@ import { ComponentType } from 'react' import { StandardProps } from './common' interface LabelProps extends StandardProps { - /** 绑定控件的 id */ + /** 绑定控件的 id + * @supported weapp, alipay, swan, tt, qq, jd, h5 + */ for?: string } @@ -9,7 +11,7 @@ interface LabelProps extends StandardProps { * * 使用for属性找到对应的id,或者将控件放在该标签下,当点击时,就会触发对应的控件。 for优先级高于内部控件,内部有多个控件的时候默认触发第一个控件。 目前可以绑定的控件有:button, checkbox, radio, switch。 * @classification forms - * @supported weapp, swan, alipay, tt, h5, rn + * @supported weapp, swan, alipay, tt, h5, rn, harmony * @example_react * ```tsx * class App extends Components { diff --git a/packages/taro-components/types/ListView.d.ts b/packages/taro-components/types/ListView.d.ts new file mode 100644 index 000000000000..3d24eb846b6b --- /dev/null +++ b/packages/taro-components/types/ListView.d.ts @@ -0,0 +1,12 @@ +import { ComponentType } from 'react' +import { StandardProps } from './common' +interface ListViewProps extends StandardProps {} + +/** + * 列表布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点或 sticky-section 组件直接子节点。仅 Skyline 支持。 + * @classification skyline + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/component/list-view.html + */ +declare const ListView: ComponentType +export { ListView, ListViewProps } diff --git a/packages/taro-components/types/LivePlayer.d.ts b/packages/taro-components/types/LivePlayer.d.ts index 747467750eb6..34dd80320ebe 100644 --- a/packages/taro-components/types/LivePlayer.d.ts +++ b/packages/taro-components/types/LivePlayer.d.ts @@ -73,11 +73,13 @@ interface LivePlayerProps extends StandardProps { pictureInPictureMode?: ('push' | 'pop')[] | 'push' | 'pop' | '' /** 当跳转到其它微信原生页面时,是否自动暂停本页面的实时音视频播放 + * @default true * @supported weapp, qq */ - autoPauseIfOpenNative?: string + autoPauseIfOpenNative?: boolean - /** 格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; + /** 格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html ,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; + * @default "no-referrer" * @supported weapp */ referrerPolicy?: 'origin' | 'no-referrer' @@ -101,7 +103,13 @@ interface LivePlayerProps extends StandardProps { * @supported weapp * @default false */ - enableAutoRotation?: string + enableAutoRotation?: boolean + + /** 是否支持投屏。开启后,可以通过 LivePlayerContext 上相关方法进行操作。 + * @supported weapp + * @default false + */ + enableCasting?: boolean /** 播放状态变化事件,detail = {code} * @supported weapp, swan, tt, qq, jd @@ -142,6 +150,26 @@ interface LivePlayerProps extends StandardProps { * @supported qq */ onMetaDataChange?: CommonEventFunction + + /** 用户选择投屏设备时触发 detail = { state: "success"/"fail" } + * @supported weapp + */ + onCastingUserSelect?: CommonEventFunction<{ + state: 'success' | 'fail' + }> + + /** 投屏成功/失败时触发 detail = { type, state: "success"/"fail" } + * @supported weapp + */ + onCastingStateChange?: CommonEventFunction<{ + type: any + state: 'success' | 'fail' + }> + + /** 投屏被中断时触发 + * @supported weapp + */ + onCastingInterrupt?: CommonEventFunction } declare namespace LivePlayerProps { /** mode 的合法值 */ diff --git a/packages/taro-components/types/LivePusher.d.ts b/packages/taro-components/types/LivePusher.d.ts index 6ca12d7be77f..5d185c883b5c 100644 --- a/packages/taro-components/types/LivePusher.d.ts +++ b/packages/taro-components/types/LivePusher.d.ts @@ -23,6 +23,12 @@ interface LivePusherProps extends StandardProps { */ autopush?: boolean + /** 自定义渲染,允许开发者自行处理所采集的视频帧 + * @default false + * @supported weapp + */ + enableVideoCustomRender?: boolean + /** 是否静音。即将废弃,可用 enable-mic 替代 * @default false * @deprecated @@ -191,6 +197,48 @@ interface LivePusherProps extends StandardProps { */ pictureInPictureMode?: string | any[] + /** 是否启动自定义特效,设定后不能更改 + * @supported weapp + * @default false + */ + customEffect?: boolean + + /** 自定义特效美白效果,取值 0~1。需要开启 custom-effect + * @supported weapp + * @default 0 + */ + skinWhiteness?: number + + /** 自定义特效磨皮效果,取值 0~1。需要开启 custom-effect + * @supported weapp + * @default 0 + */ + skinSmoothness?: number + + /** 自定义特效瘦脸效果,取值 0~1。需要开启 custom-effect + * @supported weapp + * @default 0 + */ + faceThinness?: number + + /** 自定义特效大眼效果,取值 0~1。需要开启 custom-effect + * @supported weapp + * @default 0 + */ + eyeBigness?: number + + /** 0:关闭变声;1:熊孩子;2:萝莉;3:大叔;4:重金属;6:外国人;7:困兽;8:死肥仔;9:强电流;10:重机械;11:空灵 + * @supported weapp + * @default 0 + */ + voiceChangerType?: number + + /** 帧率,有效值为 1~30 + * @supported weapp + * @default 15 + */ + fps?: number + /** 状态变化事件,detail = {code} * @supported weapp, qq */ @@ -287,6 +335,9 @@ declare namespace LivePusherProps { /** audioVolumeType 的合法值 */ interface AudioVolumeType { + /** 自动 */ + auto + /** 媒体音量 */ media diff --git a/packages/taro-components/types/Map.d.ts b/packages/taro-components/types/Map.d.ts index d96872b7c562..02779205cdbf 100644 --- a/packages/taro-components/types/Map.d.ts +++ b/packages/taro-components/types/Map.d.ts @@ -36,8 +36,9 @@ interface MapProps extends StandardProps { */ markers?: MapProps.marker[] - /** 标记点 + /** **即将移除,请使用 markers** * @supported weapp + * @deprecated */ covers?: any[] @@ -163,27 +164,29 @@ interface MapProps extends StandardProps { /** 覆盖物,自定义贴图 * @supported alipay */ - groundOverlays?: any[] + groundOverlays?: MapProps.groundOverlays[] /** 覆盖物,网格贴图 * @supported alipay */ - tileOverlay?: any[] + tileOverlay?: MapProps.tileOverlay /** 是否展示 POI 点 * @supported weapp, alipay, tt + * @default true */ - enablePoi?: string + enablePoi?: boolean /** 是否展示建筑物 * @supported weapp, alipay, tt + * @default true */ - enableBuilding?: string + enableBuilding?: boolean /** 覆盖物,多边形。 * @supported alipay */ - polygon?: string + polygon?: MapProps.polygon[] /** 设置地图样式。 * @@ -196,21 +199,27 @@ interface MapProps extends StandardProps { /** 基于 map 高级定制渲染,设置覆盖在地图上的 view。 * @supported alipay */ - panels?: string + panels?: MapProps.panels[] /** 否 * @supported jd */ theme?: string - /** 内联样式。 + /** 保持缩放比例不变 * @supported alipay + * @default false + */ + optimize?: boolean + + /** 开启最大俯视角,俯视角度从 45 度拓展到 75 度 + * @supported weapp + * @default false */ - optimize?: string + enableAutoMaxOverlooking?: boolean /** 展示3D楼块 * @supported weapp, swan, tt, qq - * @default false */ enable3D?: boolean @@ -257,12 +266,12 @@ interface MapProps extends StandardProps { /** 点击标记点对应的气泡时触发e.detail = {markerId} * @supported weapp, swan, tt, jd */ - onCallOutTap?: CommonEventFunction + onCallOutTap?: CommonEventFunction /** 点击定位标时触发,e.detail = {longitude, latitude} * @supported weapp, tt */ - onAnchorPointTap?: CommonEventFunction + onAnchorPointTap?: CommonEventFunction /** 点击 panel 时触发。 * @supported alipay @@ -485,11 +494,26 @@ declare namespace MapProps { /** 指定一系列坐标点,根据 points 坐标数据生成闭合多边形 */ interface polygon { + /** + * 边线虚线 + * @remarks 默认值 [0, 0] 为实线,[10, 10]表示十个像素的实线和十个像素的空白(如此反复)组成的虚线 + * @default [0,0] + * @supported weapp + */ + dashArray?: number[] + /** 经纬度数组 * @remarks [{latitude: 0, longitude: 0}] */ points: point[] + /** + * 线的颜色,用 8 位十六进制表示,后两位表示 alpha 值,如:#eeeeeeAA。 + * @remarks 当前 Android 与 iOS 上此属性默认值存在差异(分别为 transparent 与 #ff0000ff ),建议在代码中统一显式设置。 + * @supported alipay + */ + color?: string + /** 描边的宽度 */ strokeWidth?: number @@ -503,8 +527,34 @@ declare namespace MapProps { */ fillColor?: string + /** + * 线的宽度 + * @remarks 当前 Android 与 iOS 上此属性默认值存在差异(分别为 0 与 5),建议在代码中统一显式设置。 + * @supported alipay + */ + width?: number + /** 设置多边形Z轴数值 */ zIndex?: number + + /** + * 压盖关系 + * @supported weapp + * @remarks 默认为 abovelabels + */ + level?: string + + /** + * 标明在特定地图缩放级别下展示。 + * @remarks [{ from: 12, to: 17}] + * @supported alipay + */ + displayRanges?: [ + { + from: number + to: number + } + ] } /** 在地图上显示圆 */ @@ -588,6 +638,39 @@ declare namespace MapProps { */ height: number } + interface groundOverlays { + /**刷新的时候需要变更id值 */ + id: string + + /**右上 左下 */ + 'include-points': [ + { + latitude: number + longitude: number + }, + { + latitude: number + longitude: number + } + ] + image: string + alpha: number + zIndex: number + } + interface tileOverlay { + url: string + type: number + tileWidth: number + tileHeight: number + zIndex: number + } + interface panels { + id: number + layout: { + src: string + } + position: position + } interface onMarkerTapEventDetail { markerId: number | string } @@ -657,6 +740,22 @@ declare namespace MapProps { longitude: number latitude: number } + interface onPolylineTapEventDetail { + polylineId: number + longitude: number + latitude: number + } + interface onAbilityEventDetail { + ability: string + errCode: number + errMsg: string + } + interface onInterpolatePointEventDetail { + markerId: number + longitude: number + latitude: number + animationStatus: 'interpolating' | 'complete' + } } /** 地图。相关api Taro.createMapContext。 diff --git a/packages/taro-components/types/MovableArea.d.ts b/packages/taro-components/types/MovableArea.d.ts index ea31dbd88451..1551811ec5f3 100644 --- a/packages/taro-components/types/MovableArea.d.ts +++ b/packages/taro-components/types/MovableArea.d.ts @@ -3,14 +3,14 @@ import { StandardProps } from './common' interface MovableAreaProps extends StandardProps { /** 当里面的 movable-view 设置为支持双指缩放时,设置此值可将缩放手势生效区域修改为整个 movable-area * @default false - * @supported weapp, alipay, swan, tt, qq, h5 + * @supported weapp, alipay, swan, tt, qq, jd, h5 */ scaleArea?: boolean } /** movable-view 的可移动区域 * @classification viewContainer - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn * @example_react * ```tsx * class App extends Components { diff --git a/packages/taro-components/types/NativeSlot.d.ts b/packages/taro-components/types/NativeSlot.d.ts index 294826bb6be5..4f6176380375 100644 --- a/packages/taro-components/types/NativeSlot.d.ts +++ b/packages/taro-components/types/NativeSlot.d.ts @@ -1,6 +1,8 @@ -import { ComponentType } from 'react' +import { StandardProps } from './common' -interface NativeSlotProps { +import type { ComponentType, ReactNode } from 'react' + +interface NativeSlotProps extends StandardProps { /** 指定插入的 slot 位置 * @default none * @supported weapp, swan, alipay, tt, jd, qq @@ -9,7 +11,8 @@ interface NativeSlotProps { } /** 编译的原生组件支持使用 slot 插槽 - * @supported weapp, swan, alipay, tt, jd, qq + * @classification viewContainer + * @supported weapp, swan, alipay, tt, jd, qq, h5 * @version 3.5.7+ * @example * ```tsx diff --git a/packages/taro-components/types/NavigationBar.d.ts b/packages/taro-components/types/NavigationBar.d.ts index 5d969da7a08a..4a32f05777e1 100644 --- a/packages/taro-components/types/NavigationBar.d.ts +++ b/packages/taro-components/types/NavigationBar.d.ts @@ -36,7 +36,8 @@ interface NavigationBarProps extends StandardProps { /** 页面导航条配置节点,用于指定导航栏的一些属性。只能是 PageMeta 组件内的第一个节点,需要配合它一同使用。 * 通过这个节点可以获得类似于调用 Taro.setNavigationBarTitle Taro.setNavigationBarColor 等接口调用的效果。 - * @supported weapp + * @classification navig + * @supported weapp, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/component/navigation-bar.html */ declare const NavigationBar: ComponentType diff --git a/packages/taro-components/types/Navigator.d.ts b/packages/taro-components/types/Navigator.d.ts index 3fed5ba17260..79dc1f76c756 100644 --- a/packages/taro-components/types/Navigator.d.ts +++ b/packages/taro-components/types/Navigator.d.ts @@ -8,18 +8,18 @@ interface NavigatorProps extends StandardProps { target?: keyof NavigatorProps.Target /** 当前小程序内的跳转链接 - * @supported weapp, alipay, swan, tt, qq, jd + * @supported weapp, alipay, swan, tt, qq, jd, h5 */ url?: string /** 跳转方式 * @default "navigate" - * @supported weapp, alipay, swan, tt, qq, jd + * @supported weapp, alipay, swan, tt, qq, jd, h5 */ openType?: keyof NavigatorProps.OpenType /** 当 open-type 为 'navigateBack' 时有效,表示回退的层数 - * @supported weapp, swan, tt, qq, jd + * @supported weapp, swan, tt, qq, jd, h5 */ delta?: number @@ -45,7 +45,7 @@ interface NavigatorProps extends StandardProps { /** 指定按下去的样式类。当 `hover-class="none"` 时,没有点击态效果 * @default "navigator-hover" - * @supported weapp, alipay, swan, tt, qq, jd + * @supported weapp, alipay, swan, tt, qq, jd, h5 */ hoverClass?: string @@ -78,17 +78,17 @@ interface NavigatorProps extends StandardProps { ariaLabel?: string /** 当 `target="miniProgram"` 时有效,跳转小程序成功 - * @supported weapp, swan, qq + * @supported weapp, swan, qq, h5 */ onSuccess?: CommonEventFunction /** 当 `target="miniProgram"` 时有效,跳转小程序失败 - * @supported weapp, swan, qq + * @supported weapp, swan, qq, h5 */ onFail?: CommonEventFunction /** 当 `target="miniProgram"` 时有效,跳转小程序完成 - * @supported weapp, swan, qq + * @supported weapp, swan, qq, h5 */ onComplete?: CommonEventFunction } @@ -138,7 +138,7 @@ declare namespace NavigatorProps { /** 页面链接 * @classification navig - * @supported weapp, alipay, swan, tt, qq, jd + * @supported weapp, alipay, swan, tt, qq, jd, harmony, h5 * @see https://developers.weixin.qq.com/miniprogram/dev/component/navigator.html */ declare const Navigator: ComponentType diff --git a/packages/taro-components/types/Picker.d.ts b/packages/taro-components/types/Picker.d.ts index 54da4059538e..9aae5f52f02c 100644 --- a/packages/taro-components/types/Picker.d.ts +++ b/packages/taro-components/types/Picker.d.ts @@ -42,6 +42,10 @@ declare namespace PickerStandardProps { /** 省市区选择器 */ region } + interface PickerText { + okText?: string + cancelText?: string + } } /** 普通选择器:mode = selector */ @@ -88,6 +92,12 @@ interface PickerSelectorProps extends PickerStandardProps { * @supported weapp, h5, rn */ onChange: CommonEventFunction + + /** + * 用于替换组件内部文本 + * @supported h5 + */ + textProps?: PickerStandardProps.PickerText } declare namespace PickerSelectorProps { interface ChangeEventDetail { @@ -173,13 +183,13 @@ interface PickerTimeProps extends PickerStandardProps { value: string /** - * 仅当 mode = time|date 时有效,表示有效时间范围的开始,字符串格式为"hh:mm" + * 仅当 mode 为 "time" 或 "date" 时有效,表示有效时间范围的开始,字符串格式为"hh:mm" * @supported weapp, h5, rn */ start?: string /** - * 仅当 mode = time|date 时有效,表示有效时间范围的结束,字符串格式为"hh:mm" + * 仅当 mode 为 "time" 或 "date" 时有效,表示有效时间范围的结束,字符串格式为"hh:mm" * @supported weapp, h5, rn */ end?: string @@ -210,13 +220,13 @@ interface PickerDateProps extends PickerStandardProps { value: string /** - * 仅当 mode = time|date 时有效,表示有效时间范围的开始,字符串格式为"hh:mm" + * 仅当 mode 为 "time" 或 "date" 时有效,表示有效时间范围的开始,字符串格式为"YYYY-MM-DD" * @supported weapp, h5, rn */ start?: string /** - * 仅当 mode = time|date 时有效,表示有效时间范围的结束,字符串格式为"hh:mm" + * 仅当 mode 为 "time" 或 "date" 时有效,表示有效时间范围的结束,字符串格式为"YYYY-MM-DD" * @supported weapp, h5, rn */ end?: string @@ -261,7 +271,7 @@ interface PickerRegionProps extends PickerStandardProps { * @supported weapp, h5, rn * @default [] */ - value: string[] + value?: string[] /** * 可为每一列的顶部添加一个自定义的项 @@ -269,6 +279,13 @@ interface PickerRegionProps extends PickerStandardProps { */ customItem?: string + /** + * 选择器层级 + * @supported weapp + * @default "region" + */ + level?: keyof PickerRegionProps.Level + /** * 自定义省市区数据 * @supported rn @@ -297,12 +314,25 @@ declare namespace PickerRegionProps { code: string postcode?: string } + interface Level { + /** 省级选择器 */ + province + + /** 市级选择器 */ + city + + /** 区级选择器 */ + region + + /** 街道选择器 */ + 'sub-district' + } } /** * 从底部弹起的滚动选择器 * @classification forms - * @supported weapp, swan, alipay, tt, h5, rn + * @supported weapp, swan, alipay, tt, h5, rn, harmony * @example_react * ```tsx * export default class PagePicker extends Component { diff --git a/packages/taro-components/types/PickerView.d.ts b/packages/taro-components/types/PickerView.d.ts index a223ecc56556..383ee70d3561 100644 --- a/packages/taro-components/types/PickerView.d.ts +++ b/packages/taro-components/types/PickerView.d.ts @@ -27,7 +27,7 @@ interface PickerViewProps extends StandardProps { maskClass?: string /** 是否在手指松开时立即触发 change 事件。若不开启则会在滚动动画结束后触发 change 事件。 - * @supported weapp, tt + * @supported weapp, alipay, tt * @default false */ immediateChange?: boolean @@ -66,7 +66,7 @@ declare namespace PickerViewProps { /** 嵌入页面的滚动选择器 * 其中只可放置 picker-view-column 组件,其它节点不会显示 * @classification forms - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * export default class Picks extends Component { diff --git a/packages/taro-components/types/PickerViewColumn.d.ts b/packages/taro-components/types/PickerViewColumn.d.ts index 2d53485e2cb7..098b21a1dc1f 100644 --- a/packages/taro-components/types/PickerViewColumn.d.ts +++ b/packages/taro-components/types/PickerViewColumn.d.ts @@ -5,7 +5,7 @@ type PickerViewColumnProps = StandardProps /** 滚动选择器子项 * 仅可放置于 `` 中,其孩子节点的高度会自动设置成与 picker-view 的选中框的高度一致 * @classification forms - * @supported weapp, swan, alipay, tt, h5, rn + * @supported weapp, swan, alipay, tt, h5, rn, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/component/picker-view-column.html */ declare const PickerViewColumn: ComponentType diff --git a/packages/taro-components/types/Progress.d.ts b/packages/taro-components/types/Progress.d.ts index ffdf10b38667..6685e6077dde 100644 --- a/packages/taro-components/types/Progress.d.ts +++ b/packages/taro-components/types/Progress.d.ts @@ -64,7 +64,7 @@ interface ProgressProps extends StandardProps { /** 进度增加 1% 所需毫秒数 * @default 30 - * @supported weapp, swan, jd, h5 + * @supported weapp, swan, tt, jd, h5 */ duration?: number @@ -74,14 +74,14 @@ interface ProgressProps extends StandardProps { ariaLabel?: string /** 动画完成事件 - * @supported weapp, qq, jd, h5 + * @supported weapp, tt, qq, jd, h5 */ onActiveEnd?: CommonEventFunction } /** 进度条。组件属性的长度单位默认为 px * @classification base - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * export default class PageView extends Component { diff --git a/packages/taro-components/types/Radio.d.ts b/packages/taro-components/types/Radio.d.ts index 6486c217da29..b63c46372149 100644 --- a/packages/taro-components/types/Radio.d.ts +++ b/packages/taro-components/types/Radio.d.ts @@ -2,25 +2,25 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction, FormItemProps } from './common' interface RadioProps extends StandardProps { /** `` 标识。当该`` 选中时,``的 change 事件会携带``的 value - * @supported weapp, alipay, swan, tt, qq, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ value?: string /** 当前是否选中 * @default false - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ checked?: boolean /** 是否禁用 * @default false - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ disabled?: boolean /** Radio 的颜色,同 css 的 color * @default "#09BB07" - * @supported weapp, alipay, swan, tt, qq, rn + * @supported weapp, alipay, swan, tt, qq, jd, rn */ color?: string @@ -34,8 +34,8 @@ interface RadioProps extends StandardProps { */ ariaLabel?: string - /** 中的选中项发生变化时触发 change 事件,event.detail = {value: 选中项radio的value} - * @supported jd + /** 中的选中项发生变化时触发 change 事件 + * @supported h5, rn */ onChange?: CommonEventFunction<{ value?: string @@ -44,7 +44,7 @@ interface RadioProps extends StandardProps { /** 单选项目 * @classification forms - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, h5, rn, harmony * @example_react * ```tsx * export default class PageRadio extends Component { diff --git a/packages/taro-components/types/RadioGroup.d.ts b/packages/taro-components/types/RadioGroup.d.ts index bb880bfea177..bf2483795c32 100644 --- a/packages/taro-components/types/RadioGroup.d.ts +++ b/packages/taro-components/types/RadioGroup.d.ts @@ -7,7 +7,7 @@ interface RadioGroupProps extends StandardProps, FormItemProps { name?: string /** RadioGroup 中选中项发生改变时触发 change 事件,detail = {value:[选中的radio的value的数组]} - * @supported weapp, alipay, swan, tt, qq, h5 + * @supported weapp, alipay, swan, tt, qq, jd, h5 */ onChange?: CommonEventFunction } @@ -19,7 +19,7 @@ declare namespace RadioGroupProps { /** 单项选择器,内部由多个 Radio 组成。 * @classification forms - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/component/radio-group.html */ declare const RadioGroup: ComponentType diff --git a/packages/taro-components/types/RichText.d.ts b/packages/taro-components/types/RichText.d.ts index 26453e92a364..43b9d5d9eccb 100644 --- a/packages/taro-components/types/RichText.d.ts +++ b/packages/taro-components/types/RichText.d.ts @@ -3,21 +3,23 @@ import { CommonEventFunction, StandardProps } from './common' interface RichTextProps extends StandardProps { /** 文本是否可选,该属性会使节点显示为 block * @default false - * @supported weapp + * @supported weapp, h5 */ userSelect?: boolean - /** 节点列表/ HTML String */ + /** 节点列表/ HTML String + * @supported weapp, alipay, swan, tt, qq, h5, rn + */ nodes?: Nodes /** 显示连续空格 - * @supported weapp, qq, rn + * @supported weapp, alipay, tt, qq, h5, rn */ space?: keyof RichTextProps.TSpace /** 富文本是否可以长按选中,可用于复制,粘贴,长按搜索等场景 * @default false(基础库 3.150.1 以前版本)true(基础库 3.150.1 及以后版本) - * @supported swan + * @supported swan, h5 */ selectable?: string @@ -118,7 +120,7 @@ declare namespace RichTextProps { /** 富文本 * @classification base - * @supported weapp, swan, alipay, tt, h5, rn + * @supported weapp, swan, alipay, tt, h5, rn, harmony * @example_react * ```tsx * class App extends Components { diff --git a/packages/taro-components/types/RootPortal.d.ts b/packages/taro-components/types/RootPortal.d.ts index e7fe523e86f6..71cb23d981de 100644 --- a/packages/taro-components/types/RootPortal.d.ts +++ b/packages/taro-components/types/RootPortal.d.ts @@ -3,7 +3,7 @@ import { StandardProps } from './common' interface RootPortalProps extends StandardProps { /** * 是否从页面中脱离出来 - * @supported weapp + * @supported weapp, alipay * @default true */ enable?: boolean @@ -38,5 +38,4 @@ interface RootPortalProps extends StandardProps { * ``` */ declare const RootPortal: ComponentType - export { RootPortal, RootPortalProps } diff --git a/packages/taro-components/types/ScrollView.d.ts b/packages/taro-components/types/ScrollView.d.ts index 11ea4504a2b8..c2b5e3454943 100644 --- a/packages/taro-components/types/ScrollView.d.ts +++ b/packages/taro-components/types/ScrollView.d.ts @@ -1,5 +1,5 @@ import { ComponentType } from 'react' -import { StandardProps, CommonEventFunction, BaseEventOrigFunction } from './common' +import { BaseEventOrigFunction, CommonEventFunction, StandardProps } from './common' interface ScrollViewProps extends StandardProps { /** 允许横向滚动 * @default false @@ -97,13 +97,13 @@ interface ScrollViewProps extends StandardProps { refresherTriggered?: boolean /** 启用 scroll-view 增强特性 - * @supported weapp + * @supported weapp, swan * @default false */ enhanced?: boolean /** iOS 下 scroll-view 边界弹性控制 (同时开启 enhanced 属性后生效) - * @supported weapp + * @supported weapp, swan * @default true */ bounces?: boolean @@ -156,7 +156,42 @@ interface ScrollViewProps extends StandardProps { * @supported weapp * @default false */ - enablePassive?: string + enablePassive?: boolean + + /** 渲染模式 + * list - 列表模式。只会渲染在屏节点,会根据直接子节点是否在屏来按需渲染,若只有一个直接子节点则性能会退化 + * custom - 自定义模式。只会渲染在屏节点,子节点可以是 sticky-section list-view grid-view 等组件 + * @supported weapp + * @default 'list' + */ + type?: 'list' | 'custom' + + /** 是否反向滚动。一般初始滚动位置是在顶部,反向滚动则是在底部。 + * @supported weapp + * @default false + */ + reverse?: boolean + + /** 指定视口外渲染区域的距离,默认情况下视口外节点不渲染。指定 cache-extent 可优化滚动体验和加载速度,但会提高内存占用且影响首屏速度,可按需启用。 + * @supported weapp + */ + cacheExtent?: number + + /** 只 scroll-into-view 到 cacheExtent 以内的目标节点,性能更佳 + * @supported weapp + * @default false + */ + scrollIntoViewWithinExtent?: boolean + + /** 指定 scroll-into-view 目标节点在视口内的位置。 + * start - 目标节点显示在视口开始处 + * center - 目标节点显示在视口中间 + * end - 目标节点显示在视口结束处 + * nearest - 目标节点在就近的视口边缘显示,若节点已在视口内则不触发滚动 + * @supported weapp, h5 + * @default 'start' + */ + scrollIntoViewAlignment?: 'start' | 'center' | 'end' | 'nearest' /** 滚动到顶部/左边,会触发 scrolltoupper 事件 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn @@ -173,6 +208,16 @@ interface ScrollViewProps extends StandardProps { */ onScroll?: BaseEventOrigFunction + /** 滚动开始事件 + * @supported weapp + */ + onScrollStart?: BaseEventOrigFunction + + /** 滚动结束事件 + * @supported weapp + */ + onScrollEnd?: BaseEventOrigFunction + /** 自定义下拉刷新控件被下拉 * @supported weapp */ @@ -193,6 +238,11 @@ interface ScrollViewProps extends StandardProps { */ onRefresherAbort?: CommonEventFunction + /** 自定义下拉刷新即将触发刷新(拖动超过 refresher-threshold 时)的事件 + * @supported weapp + */ + onRefresherWillRefresh?: CommonEventFunction + /** 滑动开始事件 (同时开启 enhanced 属性后生效) * @supported weapp */ @@ -243,6 +293,7 @@ declare namespace ScrollViewProps { scrollWidth: number deltaX: number deltaY: number + isDrag?: boolean } interface onDragDetail { /** 横向滚动条位置 */ @@ -254,6 +305,30 @@ declare namespace ScrollViewProps { /** 滚动速度 */ velocity: number } + interface RefresherStatusChange { + status: RefreshStatus + dy: number + } + const enum RefreshStatus { + // 空闲 + Idle, + // 超过下拉刷新阈值,同 bind:refresherwillRefresh 触发时机 + CanRefresh, + // 下拉刷新,同 bind:refresherrefresh 触发时机 + Refreshing, + // 下拉刷新完成,同 bind:refresherrestore 触发时机 + Completed, + // 下拉刷新失败 + Failed, + // 超过下拉二级阈值 + CanTwoLevel, + // 开始打开二级 + TwoLevelOpening, + // 打开二级 + TwoLeveling, + // 开始关闭二级 + TwoLevelClosing, + } } /** 可滚动视图区域。使用竖向滚动时,需要给scroll-view一个固定高度,通过 WXSS 设置 height。组件属性的长度单位默认为 px @@ -262,7 +337,7 @@ declare namespace ScrollViewProps { * H5 中 ScrollView 组件是通过一个高度(或宽度)固定的容器内部滚动来实现的,因此务必正确的设置容器的高度。例如: 如果 ScrollView 的高度将 body 撑开,就会同时存在两个滚动条(body 下的滚动条,以及 ScrollView 的滚动条)。 * 微信小程序 中 ScrollView 组件如果设置 scrollX 横向滚动时,并且子元素为多个时(单个子元素时设置固定宽度则可以正常横向滚动),需要通过 WXSS 设置 `white-space: nowrap` 来保证元素不换行,并对 ScrollView 内部元素设置 `display: inline-block` 来使其能够横向滚动。 * @classification viewContainer - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * export default class PageView extends Component { diff --git a/packages/taro-components/types/ShareElement.d.ts b/packages/taro-components/types/ShareElement.d.ts index 278cd5bc7ff2..a7b6cd8fa704 100644 --- a/packages/taro-components/types/ShareElement.d.ts +++ b/packages/taro-components/types/ShareElement.d.ts @@ -2,17 +2,13 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction } from './common' interface ShareElementProps extends StandardProps { /** 映射标记 - * @supported weapp + * @supported weapp + * @deprecated 使用mapkey替换key */ key?: string /** 映射标记 - * @supported weapp - */ - mapkey?: string - - /** 映射标记 - * @supported alipay + * @supported alipay */ name?: string @@ -33,13 +29,52 @@ interface ShareElementProps extends StandardProps { * @supported weapp, alipay */ easingFunction?: string + + /** 手势返回时是否进行动画 + * @supported weapp + * @default false + */ + transitionOnGesture?: boolean + + /** 指定 push 阶段的飞跃物 + * @supported weapp + * @default "to" + */ + shuttleOnPush?: 'from' | 'to' | 'from' | 'to' + + /** 指定 pop 阶段的飞跃物 + * @supported weapp + * @default "to" + */ + shuttleOnPop?: string + + /** 动画插值曲线 + * @supported weapp + * @default "materialRectArc" + */ + rectTweenType?: + | 'materialRectArc' + | 'materialRectCenterArc' + | 'linear' + | 'elasticIn' + | 'elasticOut' + | 'elasticInOut' + | 'bounceIn' + | 'bounceOut' + | 'bounceInOut' + | 'cubic-bezier(x1,' + + /** 动画帧回调 + * @supported weapp + */ + onFrame?: string } /** 共享元素 * * 共享元素是一种动画形式,类似于 [`flutter Hero`](https://flutterchina.club/animations/hero-animations/) 动画,表现为元素像是在页面间穿越一样。该组件需与 [`PageContainer`](/docs/components/viewContainer/page-container) 组件结合使用。 * 使用时需在当前页放置 `ShareElement` 组件,同时在 `PageContainer` 容器中放置对应的 `ShareElement` 组件,对应关系通过属性值 key 映射。当设置 `PageContainer` `显示时,transform` 属性为 `true` 的共享元素会产生动画。当前页面容器退出时,会产生返回动画。 - * @classification viewContainer + * @classification skyline * @supported weapp, alipay * @example_react * ```tsx @@ -100,7 +135,7 @@ interface ShareElementProps extends StandardProps { * { * contacts.map((item, index) => ( * showNext(e, index)}> - * + * * {item.name} * * @@ -127,7 +162,7 @@ interface ShareElementProps extends StandardProps { * > * * - * + * * {contact.name} * * diff --git a/packages/taro-components/types/Slider.d.ts b/packages/taro-components/types/Slider.d.ts index 4c9a29e453e0..7d6f882b0d4f 100644 --- a/packages/taro-components/types/Slider.d.ts +++ b/packages/taro-components/types/Slider.d.ts @@ -118,7 +118,7 @@ declare namespace SliderProps { /** 滑动选择器 * @classification forms - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * export default class PageView extends Component { diff --git a/packages/taro-components/types/Slot.d.ts b/packages/taro-components/types/Slot.d.ts index fdfb95c8b48c..746a8da8fec8 100644 --- a/packages/taro-components/types/Slot.d.ts +++ b/packages/taro-components/types/Slot.d.ts @@ -1,6 +1,8 @@ -import { ComponentType } from 'react' +import { StandardProps } from './common' -interface SlotProps { +import type { ComponentType, ReactNode } from 'react' + +interface SlotProps extends StandardProps { /** 指定插入的 slot 位置 * @default none * @supported weapp, swan, alipay, tt, jd, qq @@ -14,7 +16,8 @@ interface SlotProps { } /** slot 插槽 - * @supported weapp, swan, alipay, tt, jd, qq + * @classification viewContainer + * @supported weapp, swan, alipay, tt, jd, qq, harmony, h5 * @example * ```tsx * import { Slot, View, Text } from '@tarojs/components' diff --git a/packages/taro-components/types/Snapshot.d.ts b/packages/taro-components/types/Snapshot.d.ts new file mode 100644 index 000000000000..a0c720c1ab32 --- /dev/null +++ b/packages/taro-components/types/Snapshot.d.ts @@ -0,0 +1,16 @@ +import { ComponentType } from 'react' + +import { StandardProps } from './common' + +interface SnapshotProps extends StandardProps { + id: string +} + +/** 截图组件。 + * 支持将其子节点的渲染结果导出成图片,该组件需配合 snapshot 接口使用。 目前仅在 Skyline 渲染引擎 下支持。 + * @classification skyline + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/component/snapshot.html + */ +declare const Snapshot: ComponentType +export { Snapshot, SnapshotProps } diff --git a/packages/taro-components/types/StickyHeader.d.ts b/packages/taro-components/types/StickyHeader.d.ts new file mode 100644 index 000000000000..5250527ed882 --- /dev/null +++ b/packages/taro-components/types/StickyHeader.d.ts @@ -0,0 +1,12 @@ +import { ComponentType } from 'react' +import { StandardProps } from './common' +interface StickyHeaderProps extends StandardProps {} + +/** + * 吸顶布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点或 sticky-section 组件直接子节点。仅 Skyline 支持。 + * @classification skyline + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/component/sticky-header.html + */ +declare const StickyHeader: ComponentType +export { StickyHeader, StickyHeaderProps } diff --git a/packages/taro-components/types/StickySection.d.ts b/packages/taro-components/types/StickySection.d.ts new file mode 100644 index 000000000000..16c2209e81e9 --- /dev/null +++ b/packages/taro-components/types/StickySection.d.ts @@ -0,0 +1,18 @@ +import { ComponentType } from 'react' +import { StandardProps } from './common' +interface StickySectionProps extends StandardProps { + /** 吸顶元素重叠时是否继续上推 + * @supported weapp + * @default true + */ + pushPinnedHeader?: boolean +} + +/** + * 吸顶布局容器,仅支持作为 scroll-view 自定义模式下的直接子节点。仅 Skyline 支持。 + * @classification skyline + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/component/sticky-section.html + */ +declare const StickySection: ComponentType +export { StickySection, StickySectionProps } diff --git a/packages/taro-components/types/Swiper.d.ts b/packages/taro-components/types/Swiper.d.ts index 667c5bb25e6a..47720da07bd1 100644 --- a/packages/taro-components/types/Swiper.d.ts +++ b/packages/taro-components/types/Swiper.d.ts @@ -75,7 +75,7 @@ interface SwiperProps extends StandardProps { /** * 当 swiper-item 的个数大于等于 2,关闭 circular 并且开启 previous-margin 或 next-margin 的时候,可以指定这个边距是否应用到第一个、最后一个元素 * @default false - * @supported weapp, alipay, jd + * @supported weapp, alipay */ snapToEdge?: boolean @@ -168,13 +168,25 @@ interface SwiperProps extends StandardProps { */ disableTouchmove?: string + /** 改变 current 时使用动画过渡 + * @supported weapp + * @default true + */ + scrollWithAnimation?: boolean + + /** 缓存区域大小,值为 1 表示提前渲染上下各一屏区域(swiper 容器大小) + * @supported weapp + * @default 0 + */ + cacheExtent?: number + /** current 改变时会触发 change 事件 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ onChange?: CommonEventFunction /** swiper-item 的位置发生改变时会触发 transition 事件 - * @supported weapp, alipay, tt, qq, jd + * @supported weapp, alipay, tt, qq */ onTransition?: CommonEventFunction @@ -247,7 +259,7 @@ declare namespace SwiperProps { /** 滑块视图容器。其中只可放置 swiper-item 组件,否则会导致未定义的行为。 * > 不要为 `SwiperItem` 设置 **style** 属性,可以通过 class 设置样式。[7147](https://github.com/NervJS/taro/issues/7147) * @classification viewContainer - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * class App extends Component { diff --git a/packages/taro-components/types/SwiperItem.d.ts b/packages/taro-components/types/SwiperItem.d.ts index a1e69a633345..84d0270e45de 100644 --- a/packages/taro-components/types/SwiperItem.d.ts +++ b/packages/taro-components/types/SwiperItem.d.ts @@ -16,7 +16,7 @@ interface SwiperItemProps extends StandardProps { /** 仅可放置在 swiper 组件中,宽高自动设置为100% * > 不要为 `SwiperItem` 设置 **style** 属性,可以通过 class 设置样式。[7147](https://github.com/NervJS/taro/issues/7147) * @classification viewContainer - * @supported weapp, alipay, swan, tt, jd, h5, rn + * @supported weapp, alipay, swan, tt, jd, h5, rn, harmony * @example_react * ```tsx * class App extends Component { diff --git a/packages/taro-components/types/Switch.d.ts b/packages/taro-components/types/Switch.d.ts index 91d0d44e2dc2..2e1abdf0a36b 100644 --- a/packages/taro-components/types/Switch.d.ts +++ b/packages/taro-components/types/Switch.d.ts @@ -9,7 +9,7 @@ interface SwitchProps extends StandardProps, FormItemProps { /** 是否禁用 * @default false - * @supported weapp, alipay, swan, tt, qq, rn + * @supported weapp, alipay, swan, tt, qq, h5, rn */ disabled?: boolean @@ -47,7 +47,7 @@ interface SwitchProps extends StandardProps, FormItemProps { ariaLabel?: string /** checked 改变时触发 change 事件 - * @supported weapp, alipay, swan, tt, qq, jd, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ onChange?: CommonEventFunction } @@ -93,7 +93,7 @@ declare namespace SwitchProps { * * * ``` - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @see https://developers.weixin.qq.com/miniprogram/dev/component/switch.html */ declare const Switch: ComponentType diff --git a/packages/taro-components/types/Text.d.ts b/packages/taro-components/types/Text.d.ts index 62731f89732c..c2100a468054 100644 --- a/packages/taro-components/types/Text.d.ts +++ b/packages/taro-components/types/Text.d.ts @@ -9,25 +9,31 @@ interface TextProps extends StandardProps { /** 文本是否可选,该属性会使文本节点显示为 inline-block * @default false - * @supported weapp + * @supported weapp, h5 */ userSelect?: boolean /** 显示连续空格 - * @supported weapp, alipay, swan, tt, qq, jd + * @supported weapp, alipay, swan, tt, qq, jd, h5 */ space?: keyof TextProps.TSpace /** 是否解码 * @default false * @supported weapp, alipay, tt, qq, jd + * @h5 默认解码,不支持设置 */ decode?: boolean /** 多行省略,值须大于等于 1,表现同 css 的 -webkit-line-clamp 属性一致。 * @supported alipay */ - numberOfLines?: string + numberOfLines?: number + + /** 限制文本最大行数 + * @supported weapp + */ + maxLines?: number } declare namespace TextProps { /** space 的合法值 */ diff --git a/packages/taro-components/types/Textarea.d.ts b/packages/taro-components/types/Textarea.d.ts index 11d3cd50c687..c16417fedae6 100644 --- a/packages/taro-components/types/Textarea.d.ts +++ b/packages/taro-components/types/Textarea.d.ts @@ -2,95 +2,95 @@ import { ComponentType } from 'react' import { StandardProps, CommonEventFunction, FormItemProps } from './common' interface TextareaProps extends StandardProps, FormItemProps { /** 输入框的内容 - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ value?: string /** 输入框为空时占位符 - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ placeholder?: string /** 指定 placeholder 的样式 - * @supported weapp, alipay, swan, tt, qq + * @supported weapp, alipay, swan, tt, qq, jd */ placeholderStyle?: string /** 指定 placeholder 的样式类 * @default "textarea-placeholder" - * @supported weapp, alipay, swan, tt, qq + * @supported weapp, alipay, swan, tt, qq, jd */ placeholderClass?: string /** 是否禁用 * @default false - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ disabled?: boolean /** 最大输入长度,设置为 -1 的时候不限制最大长度 * @default 140 - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ maxlength?: number /** 自动聚焦,拉起键盘 * @default false - * @supported weapp, swan, qq, h5 + * @supported weapp, swan, qq, jd, h5 */ autoFocus?: boolean /** 获取焦点 * @default false - * @supported weapp, alipay, swan, tt, qq, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ focus?: boolean /** 是否自动增高,设置 autoHeight 时,style.height不生效 * @default false - * @supported weapp, alipay, swan, tt, qq, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ autoHeight?: boolean /** 如果 Textarea 是在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true * @default false - * @supported weapp, swan, qq + * @supported weapp, swan, qq, jd */ fixed?: boolean /** 指定光标与键盘的距离,单位 px 。取 Textarea 距离底部的距离和 cursorSpacing 指定的距离的最小值作为光标与键盘的距离 * @default 0 - * @supported weapp, swan, tt, qq + * @supported weapp, swan, tt, qq, jd */ cursorSpacing?: number /** 指定 focus 时的光标位置 * @default -1 - * @supported weapp, swan, tt, qq + * @supported weapp, swan, tt, qq, jd */ cursor?: number /** 是否显示键盘上方带有”完成“按钮那一栏 * @default true - * @supported weapp, swan, tt, qq + * @supported weapp, swan, tt, qq, jd */ showConfirmBar?: boolean /** 光标起始位置,自动聚集时有效,需与 selectionEnd 搭配使用 * @default -1 - * @supported weapp, swan, tt, qq, rn + * @supported weapp, swan, tt, qq, jd, rn */ selectionStart?: number /** 光标结束位置,自动聚集时有效,需与 selectionStart 搭配使用 * @default -1 - * @supported weapp, swan, tt, qq, rn + * @supported weapp, swan, tt, qq, jd, rn */ selectionEnd?: number /** 键盘弹起时,是否自动上推页面 * @default true - * @supported weapp, swan, tt, qq + * @supported weapp, swan, tt, qq, jd */ adjustPosition?: boolean @@ -119,7 +119,7 @@ interface TextareaProps extends StandardProps, FormItemProps { /** 点击键盘右下角按钮时是否保持键盘不收起 * @supported weapp, swan, tt */ - confirmHold?: string + confirmHold?: boolean /** 组件名字,用于表单提交获取数据。 * @supported alipay @@ -127,55 +127,57 @@ interface TextareaProps extends StandardProps, FormItemProps { name?: string /** 是否渲染字数统计功能(是否删除默认计数器/是否显示字数统计)。 + * @default true * @supported alipay */ - showCount?: string + showCount?: boolean /** 是否为受控组件。为 true 时,value 内容会完全受 setData 控制。 - * @supported alipay - */ - controlled?: string - - /** 使用原生键盘 * @default false * @supported alipay */ - enableNative?: boolean + controlled?: boolean /** 无障碍访问,(属性)元素的额外描述 * @supported qq */ ariaLabel?: string + /** 键盘对齐位置 + * @supported weapp + * @default false + */ + adjustKeyboardTo?: boolean + /** 输入框聚焦时触发 - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ onFocus?: CommonEventFunction /** 输入框失去焦点时触发 - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ onBlur?: CommonEventFunction /** 输入框行数变化时调用 - * @supported weapp, swan, tt, qq, rn + * @supported weapp, swan, tt, qq, jd, rn */ onLineChange?: CommonEventFunction /** 当键盘输入时,触发 input 事件 * * **onInput 处理函数的返回值并不会反映到 textarea 上** - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ onInput?: CommonEventFunction /** 点击完成时, 触发 confirm 事件 - * @supported weapp, alipay, swan, tt, qq, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ onConfirm?: CommonEventFunction /** 键盘高度发生变化的时候触发此事件 - * @supported weapp + * @supported weapp, tt */ onKeyboardHeightChange?: CommonEventFunction } @@ -224,7 +226,7 @@ declare namespace TextareaProps { /** 多行输入框。该组件是原生组件,使用时请注意相关限制 * @classification forms - * @supported weapp, alipay, swan, tt, qq, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * export default class PageView extends Component { diff --git a/packages/taro-components/types/Video.d.ts b/packages/taro-components/types/Video.d.ts index 8f27aea058b4..158ec7407afa 100644 --- a/packages/taro-components/types/Video.d.ts +++ b/packages/taro-components/types/Video.d.ts @@ -53,12 +53,13 @@ interface VideoProps extends StandardProps { muted?: boolean /** 指定视频初始播放位置 - * @supported weapp, alipay, swan, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ initialTime?: number /** 在非全屏模式下,是否开启亮度与音量调节手势 * @default false + * @supported weapp, swan, qq */ pageGesture?: boolean @@ -199,7 +200,7 @@ interface VideoProps extends StandardProps { /** * 是否显示锁屏按钮,仅在全屏时显示,锁屏后控制栏的操作 - * @supported weapp + * @supported weapp, tt */ showScreenLockButton?: boolean @@ -228,8 +229,9 @@ interface VideoProps extends StandardProps { /** 是否展示底部进度条 * @supported weapp + * @default true */ - showBottomProgress?: string + showBottomProgress?: boolean /** 是否在小窗模式下显示播放进度 * @supported weapp @@ -244,7 +246,7 @@ interface VideoProps extends StandardProps { /** 是否是 DRM 视频源 * @supported weapp */ - isDrm?: string + isDrm?: boolean /** DRM 设备身份认证 url,仅 is-drm 为 true 时生效 (Android) * @supported weapp @@ -280,13 +282,7 @@ interface VideoProps extends StandardProps { * * @supported alipay, jd */ - mobilenetHintType?: string - - /** 使用原生 - * @default true - * @supported alipay - */ - enableNative?: boolean + mobilenetHintType?: number /** 浮窗设置。暂时不支持全局浮窗。 * 可选值: @@ -352,6 +348,16 @@ interface VideoProps extends StandardProps { */ preferredPeakBitRate?: number + /** 是否为直播源 + * @supported weapp + */ + isLive?: boolean + + /** 清晰度,设置清晰度列表和默认播放的清晰度。切换清晰度按钮仅在全屏时展示,属性说明详见 Definition 类型说明。需要保证 src 和 definition 中有一个为必填,若同时设置了 src 和 definition,definition 优先级高于 src + * @supported tt + */ + definition?: string + /** 当开始/继续播放时触发 play 事件 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn */ @@ -423,7 +429,7 @@ interface VideoProps extends StandardProps { onFullScreenChange?: CommonEventFunction /** 切换 controls 显示隐藏时触发。 - * @supported weapp + * @supported weapp, swan */ onControlsToggle?: CommonEventFunction @@ -532,6 +538,21 @@ interface VideoProps extends StandardProps { * @supported tt */ onAdLoad?: CommonEventFunction + + /** 用户选择投屏设备时触发 detail = { state: "success"/"fail" } + * @supported weapp + */ + onCastingUserSelect?: CommonEventFunction + + /** 投屏成功/失败时触发 detail = { type, state: "success"/"fail" } + * @supported weapp + */ + onCastingStateChange?: CommonEventFunction + + /** 投屏被中断时触发 + * @supported weapp + */ + onCastingInterrupt?: CommonEventFunction } declare namespace VideoProps { /** direction 的合法值 */ @@ -572,6 +593,16 @@ declare namespace VideoProps { /** 持续时间 */ duration: number + + /** 用户实际观看时长 + * @supported alipay + */ + userPlayDuration: number + + /** 视频总时长 + * @supported alipay + */ + videoDuration: number } interface onFullscreenChangeEventDetail { /** 方向 */ @@ -643,7 +674,7 @@ declare namespace VideoProps { /** 视频。相关api:Taro.createVideoContext * @classification media - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * export default class PageView extends Component { diff --git a/packages/taro-components/types/View.d.ts b/packages/taro-components/types/View.d.ts index 77c698b1797c..0a441b9deca7 100644 --- a/packages/taro-components/types/View.d.ts +++ b/packages/taro-components/types/View.d.ts @@ -38,7 +38,7 @@ interface ViewProps extends StandardProps { * @supported alipay * @default false */ - disableScroll?: string + disableScroll?: boolean /** 是否隐藏。 * @supported alipay @@ -142,7 +142,7 @@ interface ViewProps extends StandardProps { /** 视图容器 * @classification viewContainer - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * export default class PageView extends Component { diff --git a/packages/taro-components/types/VoipRoom.d.ts b/packages/taro-components/types/VoipRoom.d.ts index 76951bdc7d69..d1a836486175 100644 --- a/packages/taro-components/types/VoipRoom.d.ts +++ b/packages/taro-components/types/VoipRoom.d.ts @@ -19,6 +19,12 @@ interface VoipRoomProps extends StandardProps { */ openId?: string + /** 画面与容器比例不一致时,画面的表现形式 + * @supported weapp + * @default "fill" + */ + objectFit?: 'fill' | 'contain' | 'cover' + /** 创建对话窗口失败时触发 * @supported weapp */ diff --git a/packages/taro-components/types/WebView.d.ts b/packages/taro-components/types/WebView.d.ts index ad33a98b1485..900fb0c83b32 100644 --- a/packages/taro-components/types/WebView.d.ts +++ b/packages/taro-components/types/WebView.d.ts @@ -49,7 +49,7 @@ declare namespace WebViewProps { /** web-view 组件是一个可以用来承载网页的容器,会自动铺满整个小程序页面。个人类型与海外类型的小程序暂不支持使用。 * @classification open - * @supported weapp, alipay, swan, tt, qq, jd, h5, rn + * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony * @example_react * ```tsx * class App extends Component { diff --git a/packages/taro-components/types/index.d.ts b/packages/taro-components/types/index.d.ts index cf8ce3d5ccd3..3d96208bf8a1 100644 --- a/packages/taro-components/types/index.d.ts +++ b/packages/taro-components/types/index.d.ts @@ -12,7 +12,6 @@ export { MovableView } from './MovableView' export { PageContainer } from './PageContainer' export { RootPortal } from './RootPortal' export { ScrollView } from './ScrollView' -export { ShareElement } from './ShareElement' export { Swiper } from './Swiper' export { SwiperItem } from './SwiperItem' export { View } from './View' @@ -41,6 +40,14 @@ export { Slider } from './Slider' export { Switch } from './Switch' export { Textarea } from './Textarea' +/** Skyline */ +export { GridView } from './GridView' +export { ListView } from './ListView' +export { ShareElement } from './ShareElement' +export { Snapshot } from './SnapShot' +export { StickyHeader } from './StickyHeader' +export { StickySection } from './StickySection' + /** 导航 */ export { FunctionalPageNavigator } from './FunctionalPageNavigator' export { Navigator } from './Navigator' @@ -51,11 +58,14 @@ export { NavigationBar } from './NavigationBar' /** 媒体组件 */ export { Audio } from './Audio' export { Camera } from './Camera' +export { ChannelLive } from './ChannelLive' +export { ChannelVideo } from './ChannelVideo' export { Image } from './Image' export { LivePlayer } from './LivePlayer' export { LivePusher } from './LivePusher' export { Video } from './Video' export { VoipRoom } from './VoipRoom' +export { Lottie } from './Lottie' /** 地图 */ export { Map } from './Map' @@ -75,3 +85,4 @@ export { PageMeta } from './PageMeta' export { CustomWrapper } from './CustomWrapper' export { Slot } from './Slot' +export { NativeSlot } from './NativeSlot' diff --git a/packages/taro-components/types/index.vue3.d.ts b/packages/taro-components/types/index.vue3.d.ts index 071de67b6d46..d7cef457187e 100644 --- a/packages/taro-components/types/index.vue3.d.ts +++ b/packages/taro-components/types/index.vue3.d.ts @@ -13,57 +13,61 @@ import * as CSS from 'csstype' import { DefineComponent, VNodeRef } from 'vue' -/** 开放能力 */ import { AdProps } from './Ad' import { AdCustomProps } from './AdCustom' -/** 媒体组件 */ import { AudioProps } from './Audio' -/** 表单组件 */ import { ButtonProps } from './Button' import { CameraProps } from './Camera' -/** 画布 */ import { CanvasProps } from './Canvas' +import { ChannelLiveProps } from './ChannelLive' +import { ChannelVideoProps } from './ChannelVideo' import { CheckboxProps } from './Checkbox' import { CheckboxGroupProps } from './CheckboxGroup' import { StandardProps } from './common' -/** 视图容器 */ import { CoverImageProps } from './CoverImage' import { CoverViewProps } from './CoverView' import { CustomWrapperProps } from './CustomWrapper' import { EditorProps } from './Editor' import { FormProps } from './Form' -/** 导航 */ import { FunctionalPageNavigatorProps } from './FunctionalPageNavigator' -/** 基础内容 */ +import { GridViewProps } from './GridView' import { IconProps } from './Icon' import { ImageProps } from './Image' import { InputProps } from './Input' import { KeyboardAccessoryProps } from './KeyboardAccessory' import { LabelProps } from './Label' +import { ListViewProps } from './ListView' import { LivePlayerProps } from './LivePlayer' import { LivePusherProps } from './LivePusher' -/** 地图 */ import { MapProps } from './Map' import { MatchMediaProps } from './MatchMedia' import { MovableAreaProps } from './MovableArea' import { MovableViewProps } from './MovableView' +import { NativeSlotProps } from './NativeSlot' import { NavigationBarProps } from './NavigationBar' import { NavigatorProps } from './Navigator' import { OfficialAccountProps } from './OfficialAccount' import { OpenDataProps } from './OpenData' import { PageContainerProps } from './PageContainer' -/** 配置节点 */ import { PageMetaProps } from './PageMeta' -import { PickerDateProps, PickerMultiSelectorProps,PickerRegionProps, PickerSelectorProps, PickerTimeProps } from './Picker' +import { + PickerDateProps, PickerMultiSelectorProps, + PickerRegionProps, PickerSelectorProps, PickerTimeProps +} from './Picker' import { PickerViewProps } from './PickerView' +import { PickerViewColumnProps } from './PickerViewColumn' import { ProgressProps } from './Progress' import { RadioProps } from './Radio' import { RadioGroupProps } from './RadioGroup' import { RichTextProps } from './RichText' +import { RootPortalProps } from './RootPortal' import { ScrollViewProps } from './ScrollView' import { ShareElementProps } from './ShareElement' import { SliderProps } from './Slider' import { SlotProps } from './Slot' +import { SnapshotProps } from './SnapShot' +import { StickyHeaderProps } from './StickyHeader' +import { StickySectionProps } from './StickySection' import { SwiperProps } from './Swiper' import { SwiperItemProps } from './SwiperItem' import { SwitchProps } from './Switch' @@ -74,8 +78,17 @@ import { ViewProps } from './View' import { VoipRoomProps } from './VoipRoom' import { WebViewProps } from './WebView' +/** 因为react的事件是CamelCase而vue得是Camelcase, 所以需要转换 */ +type OnCamelCaseToOnCamelcase = T extends `on${infer Rest}` + ? `on${Capitalize>}` + : T; + +type TransformCamelCase> = { + [key in keyof T as OnCamelCaseToOnCamelcase]: T[key] +} + /** 联合类型不能用omit(比如picker) */ -type DistributiveOmit = T extends unknown ? Omit : never +type DistributiveOmit = T extends unknown ? TransformCamelCase> : never interface SlimProps { class?: any @@ -84,8 +97,8 @@ interface SlimProps { } /** 转换 react 的类型到 vue */ -type RemoveReactAttribute = 'className' | 'style' | 'key' | 'ref' | 'dangerouslySetInnerHTML' -type TransformReact2VueType

> = DistributiveOmit & SlimProps +export type RemoveReactAttribute = 'className' | 'style' | 'key' | 'ref' | 'dangerouslySetInnerHTML' +export type TransformReact2VueType

> = DistributiveOmit & SlimProps export type VueComponentType

> = DefineComponent> export * from './common' @@ -100,9 +113,8 @@ export declare const MatchMedia: VueComponentType export declare const MovableArea: VueComponentType export declare const MovableView: VueComponentType export declare const PageContainer: VueComponentType -export declare const RootPortal: VueComponentType +export declare const RootPortal: VueComponentType export declare const ScrollView: VueComponentType -export declare const ShareElement: VueComponentType export declare const Swiper: VueComponentType export declare const SwiperItem: VueComponentType export declare const View: VueComponentType @@ -122,12 +134,19 @@ export declare const KeyboardAccessory: VueComponentType export declare const Label: VueComponentType export declare const Picker: VueComponentType export declare const PickerView: VueComponentType -export declare const PickerViewColumn: VueComponentType +export declare const PickerViewColumn: VueComponentType export declare const Radio: VueComponentType export declare const RadioGroup: VueComponentType export declare const Slider: VueComponentType export declare const Switch: VueComponentType export declare const Textarea: VueComponentType +/** Skyline */ +export declare const GridView: VueComponentType +export declare const ListView: VueComponentType +export declare const Snapshot: VueComponentType +export declare const ShareElement: VueComponentType +export declare const StickyHeader: VueComponentType +export declare const StickySection: VueComponentType /** 导航 */ export declare const FunctionalPageNavigator: VueComponentType export declare const Navigator: VueComponentType @@ -135,6 +154,8 @@ export declare const NavigationBar: VueComponentType /** 媒体组件 */ export declare const Audio: VueComponentType export declare const Camera: VueComponentType +export declare const ChannelLive: VueComponentType +export declare const ChannelVideo: VueComponentType export declare const Image: VueComponentType export declare const LivePlayer: VueComponentType export declare const LivePusher: VueComponentType @@ -155,15 +176,16 @@ export declare const PageMeta: VueComponentType export declare const CustomWrapper: VueComponentType export declare const Slot: VueComponentType +export declare const NativeSlot: VueComponentType -type ReservedProps = { +export type ReservedProps = { key?: string | number | symbol ref?: VNodeRef ref_for?: boolean ref_key?: string } -type ElementAttrs = T & ReservedProps +export type ElementAttrs = T & ReservedProps declare global { namespace JSX { @@ -183,12 +205,10 @@ declare global { 'taro-movable-view-core': ElementAttrs> 'page-container': ElementAttrs> 'taro-page-container-core': ElementAttrs> - 'root-portal': ElementAttrs - 'taro-root-portal-core': ElementAttrs + 'root-portal': ElementAttrs> + 'taro-root-portal-core': ElementAttrs> 'scroll-view': ElementAttrs> 'taro-scroll-view-core': ElementAttrs> - 'share-element': ElementAttrs> - 'taro-share-element-core': ElementAttrs> swiper: ElementAttrs> 'taro-swiper-core': ElementAttrs> 'swiper-item': ElementAttrs> @@ -225,8 +245,8 @@ declare global { 'taro-picker-core': ElementAttrs> 'picker-view': ElementAttrs> 'taro-picker-view-core': ElementAttrs> - 'picker-view-column': ElementAttrs - 'taro-picker-view-column-core': ElementAttrs + 'picker-view-column': ElementAttrs> + 'taro-picker-view-column-core': ElementAttrs> radio: ElementAttrs> 'taro-radio-core': ElementAttrs> 'radio-group': ElementAttrs> @@ -237,6 +257,19 @@ declare global { 'taro-switch-core': ElementAttrs> textarea: ElementAttrs> 'taro-textarea-core': ElementAttrs> + /** Skyline */ + 'grid-view': ElementAttrs> + 'taro-grid-view-core': ElementAttrs> + 'list-view': ElementAttrs> + 'taro-list-view-core': ElementAttrs> + 'share-element': ElementAttrs> + 'taro-share-element-core': ElementAttrs> + 'snapshot': ElementAttrs> + 'taro-snapshot-core': ElementAttrs> + 'sticky-header': ElementAttrs> + 'taro-sticky-header-core': ElementAttrs> + 'sticky-section': ElementAttrs> + 'taro-sticky-section-core': ElementAttrs> /** 导航 */ 'functional-page-navigator': ElementAttrs> 'taro-functional-page-navigator-core': ElementAttrs> @@ -249,6 +282,10 @@ declare global { 'taro-audio-core': ElementAttrs> camera: ElementAttrs> 'taro-camera-core': ElementAttrs> + 'channel-live': ElementAttrs> + 'taro-channel-live-core': ElementAttrs> + 'channel-video': ElementAttrs> + 'taro-channel-video-core': ElementAttrs> image: ElementAttrs> 'taro-image-core': ElementAttrs> 'live-player': ElementAttrs> @@ -285,6 +322,8 @@ declare global { /** 为了不与vue3模板默认的slot冲突,增加 Record */ 'slot': ElementAttrs> & Record 'taro-slot-core': ElementAttrs> + 'native-slot': ElementAttrs> + 'taro-native-slot-core': ElementAttrs> } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fe6542e91b4f..da5101ae2637 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -571,7 +571,7 @@ importers: jquery: ^3.4.1 karmatic: ^2.1.0 lodash: ^4.17.21 - miniapp-types: 1.1.21 + miniapp-types: 1.6.0 resolve-pathname: ^3.0.0 simulant: ^0.2.2 style-loader: 1.3.0 @@ -604,7 +604,7 @@ importers: jquery: registry.npmjs.org/jquery/3.6.0 karmatic: registry.npmjs.org/karmatic/2.1.0_webpack@4.46.0 lodash: registry.npmjs.org/lodash/4.17.21 - miniapp-types: registry.npmjs.org/miniapp-types/1.1.21 + miniapp-types: registry.npmjs.org/miniapp-types/1.6.0 simulant: registry.npmjs.org/simulant/0.2.2 style-loader: registry.npmjs.org/style-loader/1.3.0_webpack@4.46.0 ts-node: registry.npmjs.org/ts-node/10.9.1_ah2igguqgj6e7ik4ubgohitm4e @@ -19246,7 +19246,7 @@ packages: version: 1.2.13 engines: {node: '>= 4.0'} os: [darwin] - deprecated: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. + deprecated: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2 requiresBuild: true dependencies: bindings: registry.npmjs.org/bindings/1.5.0 @@ -25162,10 +25162,10 @@ packages: webpack: registry.npmjs.org/webpack/5.69.0_esbuild@0.14.47 dev: false - registry.npmjs.org/miniapp-types/1.1.21: - resolution: {integrity: sha512-nhAgQjIYEPSO1VvAAvRxZOwvH/gEykbcMZdSGIG9HBE73bCE+I4IOdUt1O/CPjodH5C8husNGr3vTGq7JnfwVQ==, registry: https://registry.yarnpkg.com/, tarball: https://registry.npmjs.org/miniapp-types/-/miniapp-types-1.1.21.tgz} + registry.npmjs.org/miniapp-types/1.6.0: + resolution: {integrity: sha512-Un8UaEAKCXcf6SdXkA9GhI46jjVWaQUrY5aoy2ZWHkG54kjOjlmPJZ4h3v2J/Si4kNs8KHEFSyNKoAPA+qNJQA==, registry: https://registry.yarnpkg.com/, tarball: https://registry.npmjs.org/miniapp-types/-/miniapp-types-1.6.0.tgz} name: miniapp-types - version: 1.1.21 + version: 1.6.0 dev: true registry.npmjs.org/minimalistic-assert/1.0.1: @@ -34328,6 +34328,7 @@ packages: version: 3.17.4 engines: {node: '>=0.8.0'} hasBin: true + requiresBuild: true dev: true optional: true