Skip to content

Commit

Permalink
refactor(types): sync components types
Browse files Browse the repository at this point in the history
  • Loading branch information
learner-pm authored Feb 4, 2023
1 parent 6b09635 commit 3070a6a
Show file tree
Hide file tree
Showing 43 changed files with 195 additions and 106 deletions.
2 changes: 1 addition & 1 deletion packages/taro-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"jquery": "^3.4.1",
"karmatic": "^2.1.0",
"lodash": "^4.17.21",
"miniapp-types": "1.1.21",
"miniapp-types": "1.4.1",
"simulant": "^0.2.2",
"style-loader": "1.3.0",
"ts-node": "^10.9.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ declare namespace ButtonProps {

/** 按钮
* @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 PageButton extends Component {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Camera.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<CameraProps>
Expand Down
22 changes: 22 additions & 0 deletions packages/taro-components/types/ChannelLive.d.ts
Original file line number Diff line number Diff line change
@@ -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<ChannelLiveProps>
export { ChannelLive, ChannelLiveProps }
2 changes: 1 addition & 1 deletion packages/taro-components/types/Checkbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/CheckboxGroup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions packages/taro-components/types/CoverImage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-components/types/CoverView.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/taro-components/types/CustomWrapper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface CustomWrapperProps extends StandardProps {

/** custom-wrapper 自定义组件包裹器
* 当数据更新层级较深时,可用此组件将需要更新的区域包裹起来,这样更新层级将大大减少
* @classification viewContainer
* @supported weapp, swan, alipay, tt, jd, qq, h5
* @example
* ```tsx
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Form.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Icon.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Image.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,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 {
Expand Down
33 changes: 26 additions & 7 deletions packages/taro-components/types/Input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,17 @@ interface InputProps extends StandardProps, FormItemProps {
*/
alwaysSystem?: boolean

/** 使用原生键盘
* @default true
* @supported alipay
*/
enableNative?: boolean

/** 无障碍访问,(属性)元素的额外描述
* @supported qq
*/
ariaLabel?: string

/** 是否启用原生键盘。
* @supported alipay
* @default true
*/
enableNative?: boolean

/** 当键盘输入时,触发input事件,event.detail = {value, cursor, keyCode},处理函数可以直接 return 一个字符串,将替换输入框的内容。
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
Expand All @@ -223,6 +223,11 @@ interface InputProps extends StandardProps, FormItemProps {
* @supported weapp, qq
*/
onKeyboardHeightChange?: CommonEventFunction<InputProps.onKeyboardHeightChangeEventDetail>

/** 用户昵称审核完毕后触发,仅在 type 为 "nickname" 时有效,event.detail = { pass, timeout }
* @supported weapp
*/
onNickNameReview?: CommonEventFunction
}
declare namespace InputProps {
/** Input 类型 */
Expand All @@ -231,52 +236,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 {
/** 输入值 */
Expand Down Expand Up @@ -310,7 +329,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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Label.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,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 {
Expand Down
39 changes: 39 additions & 0 deletions packages/taro-components/types/LivePusher.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ interface LivePusherProps extends StandardProps {
*/
autopush?: boolean

/** 自定义渲染,允许开发者自行处理所采集的视频帧
* @default false
* @supported weapp
*/
enableVideoCustomRender?: boolean

/** 是否静音。即将废弃,可用 enable-mic 替代
* @default false
* @deprecated
Expand Down Expand Up @@ -191,6 +197,36 @@ 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

/** 状态变化事件,detail = {code}
* @supported weapp, qq
*/
Expand Down Expand Up @@ -287,6 +323,9 @@ declare namespace LivePusherProps {

/** audioVolumeType 的合法值 */
interface AudioVolumeType {
/** 自动 */
auto

/** 媒体音量 */
media

Expand Down
6 changes: 6 additions & 0 deletions packages/taro-components/types/Map.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ interface MapProps extends StandardProps {
*/
optimize?: string

/** 开启最大俯视角,俯视角度从 45 度拓展到 75 度
* @supported weapp
* @default false
*/
enableAutoMaxOverlooking?: boolean

/** 展示3D楼块
* @supported weapp, swan, tt, qq
* @default false
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-components/types/MovableArea.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions packages/taro-components/types/NativeSlot.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface NativeSlotProps {
}

/** 编译的原生组件支持使用 slot 插槽
* @classification viewContainer
* @supported weapp, swan, alipay, tt, jd, qq
* @version 3.5.7+
* @example
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-components/types/NavigationBar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<NavigationBarProps>
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Navigator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ declare namespace NavigatorProps {

/** 页面链接
* @classification navig
* @supported weapp, alipay, swan, tt, qq, jd
* @supported weapp, alipay, swan, tt, qq, jd, harmony
* @see https://developers.weixin.qq.com/miniprogram/dev/component/navigator.html
*/
declare const Navigator: ComponentType<NavigatorProps>
Expand Down
Loading

0 comments on commit 3070a6a

Please sign in to comment.