Skip to content

Commit

Permalink
Merge branch 'AntmJS:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tianxing0923 authored Oct 9, 2024
2 parents 6461c7e + e745379 commit eefae1c
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/vantui/src/rate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export function Rate(props: RateProps) {
gutter,
icon = 'star',
voidIcon = 'star-o',
disabled,
disabled = false,
size,
disabledColor,
color,
voidColor,
allowHalf,
readonly,
readonly = false,
touchable = true,
value,
onChange,
Expand Down
56 changes: 55 additions & 1 deletion packages/vantui/types/collapse.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,62 @@ import { FunctionComponent, ReactNode } from 'react'
import { ITouchEvent, ViewProps } from '@tarojs/components'

export interface CollapseProps extends ViewProps {
/**
* @description 当前展开面板的 name
*/
value?: Array<string | number> | string
/**
* @description 是否开启手风琴模式
* @default false
*/
accordion?: boolean
/**
* @description 是否显示外边框
* @default true
*/
border?: boolean
/**
* @description
*/
children?: Array<ReactNode> | ReactNode
/**
* @description 切换面板时触发
*/
onChange?: (event: ITouchEvent) => any
/**
* @description 打开面板时触发
*/
onOpen?: (event: ITouchEvent) => any
/**
* @description 关闭面板时触发
*/
onClose?: (event: ITouchEvent) => any
}

export interface CollapseItemProps extends ViewProps {
/**
* @description 唯一标识符,默认为索引值
* @default index
*/
name?: string | number
/**
* @description 标题栏左侧内容
*/
title?: string | number
/**
* @description 标题栏右侧内容
*/
value?: string | number
/**
* @description 对应Icon的name
* @description 对应Icon的name 可选值见 Icon 组件
*/
icon?: string
/**
* @description 标题栏描述信息
*/
label?: ReactNode
/**
* @description 是否禁用面板
* @default false
*/
disabled?: boolean
Expand All @@ -29,21 +66,38 @@ export interface CollapseItemProps extends ViewProps {
*/
clickable?: boolean
/**
* @description 是否显示内边框
* @default true
*/
border?: boolean
/**
* @description 是否展示标题栏右侧箭头并开启点击反馈
* @default true
*/
isLink?: boolean
/**
* @description 面板item内容
*/
children?: ReactNode
/**
* @description 自定义标题,优先级低于title
*/
renderTitle?: ReactNode
/**
* @description 自定义icon,优先级低于icon
*/
renderIcon?: ReactNode
/**
* @description isLink 设置为 false
*/
renderRightIcon?: ReactNode
/**
* @description 自定义value,优先级低于value
*/
renderValue?: ReactNode
/**
* @description 标题栏大小,可选值为 large
*/
size?: 'large'
/**
* @description 微信端使用时, 所在元素层级太深,需要设置元素层级不是很深的父元素的className(‘.xx’)或id(#xx), 支持当前组件获取rect信息
Expand Down
48 changes: 48 additions & 0 deletions packages/vantui/types/count-down.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,75 @@ import { ReactNode } from 'react'
import { ViewProps } from '@tarojs/components'

export interface ICountDownRef {
/**
* @description 开始倒计时
*/
start: () => void
/**
* @description 暂停倒计时
*/
pause: () => void
/**
* @description 重设倒计时,若autoStart为true,重设后会自动开始倒计时
*/
reset: () => void
}

export interface ITimeData {
/**
* @description 剩余天数
*/
days: number
/**
* @description 剩余小时
*/
hours: number
/**
* @description 剩余分钟
*/
minutes: number
/**
* @description 剩余秒数
*/
seconds: number
/**
* @description 剩余毫秒
*/
milliseconds: number
}

export interface CountDownProps extends ViewProps {
/**
* @description 是否开启毫秒级渲染
* @default false
*/
millisecond?: boolean
/**
* @description 倒计时时长,单位毫秒
*/
time?: number
/**
* @description 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒
* @default HH:mm:ss
*/
format?: string
/**
* @description 是否自动开始倒计时
* @default true
*/
autoStart?: boolean
/**
* @description 倒计时的内容
*/
children?: ReactNode
onChange?: (timeData: { detail: ITimeData }) => void
/**
* @description 倒计时结束时触发
*/
onFinish?: () => void
/**
* @description 倒计时实例
*/
ref?: React.MutableRefObject<ICountDownRef | undefined>
}

Expand Down
50 changes: 50 additions & 0 deletions packages/vantui/types/radio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,74 @@ import { FunctionComponent, ReactNode } from 'react'
import { ITouchEvent, ViewProps } from '@tarojs/components'

export interface RadioProps extends ViewProps {
/**
* @description 标识符
*/
name?: string | number
/**
* @description
*/
value?: any
/**
* @description 是否为禁用状态
* @default false
*/
disabled?: boolean
/**
* @description 选中状态颜色
* @default #07c160
*/
checkedColor?: string
/**
* @description 文本位置,可选值为 left
* @default right
*/
labelPosition?: string
/**
* @description 是否禁用文本内容点击
* @default false
*/
labelDisabled?: boolean
/**
* @description 形状,可选值为 square
* @default round
*/
shape?: 'round' | 'square'
/**
* @description 图标大小,默认单位为px
* @default 20px
*/
iconSize?: number | string
children?: ReactNode
/**
* @description 自定义图标
*/
renderIcon?: ReactNode
/**
* @description 当绑定值变化时触发的事件
*/
onChange?: (event: ITouchEvent) => any
}

export interface RadioGroupProps extends ViewProps {
/**
* @description 当前选中项的标识符
*/
value?: any
/**
* @description 单选框排列方向
* @default vertical
*/
direction?: 'vertical' | 'horizontal'
/**
* @description 是否禁用所有单选框
* @default false
*/
disabled?: boolean
children?: ReactNode
/**
* @description 当绑定值变化时触发的事件
*/
onChange?: (event: ITouchEvent) => any
}

Expand Down
25 changes: 23 additions & 2 deletions packages/vantui/types/rate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,46 @@ import { FunctionComponent } from 'react'
import { ViewProps, ITouchEvent } from '@tarojs/components'

export interface RateProps extends ViewProps {
/**
* @description 当前分值
*/
value?: number
/**
* @description 默认值
* @description 默认分值
*/
defaultValue?: number
/**
* @description 是否只可读
* @default false
*/
readonly?: boolean
/**
* @description 是否禁用
* @default false
*/
disabled?: boolean
/**
* @description 是否允许选择一般
* @description 是否允许半选
* @default false
*/
allowHalf?: boolean
/**
* @description 图标大小,默认单位为px
*/
size?: string | number
/**
* @description 自定义图标的classPrefix
* @default van-icon
*/
iconClassPrefix?: string
/**
* @description 选中图标
* @default star
*/
icon?: string
/**
* @description 未选中图标
* @default star-o
*/
voidIcon?: string
/**
Expand All @@ -42,17 +54,26 @@ export interface RateProps extends ViewProps {
voidColor?: string
/**
* @description 禁用颜色
* @default #c8c9cc
*/
disabledColor?: string
/**
* @description 总体数量
* @default 5
*/
count?: number
/**
* @description 图标间距,默认单位为 px
*/
gutter?: string | number
/**
* @description 是否可以通过滑动手势选择评分
* @default true
*/
touchable?: boolean
/**
* @description 当前分值变化时触发的事件
*/
onChange?: (e: ITouchEvent) => any
}

Expand Down
23 changes: 22 additions & 1 deletion packages/vantui/types/toast.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface ToastProps extends ViewProps {
*/
loadingType?: 'circular' | 'spinner' | undefined
/**
* @description 自定义选择器, 对应元素id
* @description 自定义选择器,对应元素id
* @default van-toast
*/
selector?: string
Expand All @@ -64,12 +64,33 @@ export interface ToastProps extends ViewProps {
* @description 调用方式传入ToastProps或者ToastProps.message执行
*/
export interface toastProps {
/**
* @description 展示提示
*/
show: (options: ToastProps | string) => any
/**
* @description 展示加载提示
*/
loading: (options: ToastProps | string) => any
/**
* @description 展示成功提示
*/
success: (options: ToastProps | string) => any
/**
* @description 展示失败提示
*/
fail: (options: ToastProps | string) => any
/**
* @description 关闭提示
*/
clear: (options?: ToastProps) => void
/**
* @description 修改默认配置,对所有 Toast 生效。传入 type 可以修改指定类型的默认配置
*/
setDefaultOptions: (options: ToastProps) => void
/**
* @description 重置默认配置,对所有 Toast 生效。传入 type 可以重置指定类型的默认配置
*/
resetDefaultOptions: (options: any) => void
/**
* @description 获取唯一的toast组件,不需要手动设置id和selector
Expand Down

0 comments on commit eefae1c

Please sign in to comment.