Skip to content

Commit

Permalink
feat: modify API
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 23, 2024
1 parent 2b8ff38 commit ac3cb69
Show file tree
Hide file tree
Showing 196 changed files with 1,881 additions and 1,810 deletions.
4 changes: 2 additions & 2 deletions src/affix/affix.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ style | Object | - | 样式,Typescript:`React.CSSProperties` | N
children | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
container | String / Function | () => (() => window) | Typescript:`ScrollContainer`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
content | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
offsetBottom | Number | 0 | When the distance from the bottom of the container reaches the specified distance, the trigger is fixed | N
offsetTop | Number | 0 | When the distance from the top of the container reaches the specified distance, the trigger is fixed | N
offsetBottom | Number | 0 | \- | N
offsetTop | Number | 0 | \- | N
zIndex | Number | - | \- | N
onFixedChange | Function | | Typescript:`(affixed: boolean, context: { top: number }) => void`<br/> | N
2 changes: 1 addition & 1 deletion src/affix/defaultProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

import { TdAffixProps } from './type';

export const affixDefaultProps: TdAffixProps = { container: () => window, offsetBottom: 0, offsetTop: 0 };
export const affixDefaultProps: TdAffixProps = { container: '() => (() => window)', offsetBottom: 0, offsetTop: 0 };
6 changes: 3 additions & 3 deletions src/affix/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ export interface TdAffixProps {
children?: TNode;
/**
* 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body
* @default () => window
* @default () => (() => window)
*/
container?: ScrollContainer;
/**
* 内容
*/
content?: TNode;
/**
* 距离容器底部达到指定距离后触发固定
* 距离容器顶部达到指定距离后触发固定
* @default 0
*/
offsetBottom?: number;
/**
* 距离容器顶部达到指定距离后触发固定
* 距离容器底部达到指定距离后触发固定
* @default 0
*/
offsetTop?: number;
Expand Down
1 change: 1 addition & 0 deletions src/alert/alert.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
:: BASE_DOC ::

## API

### Alert Props

名称 | 类型 | 默认值 | 说明 | 必传
Expand Down
8 changes: 4 additions & 4 deletions src/anchor/anchor.en-US.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
:: BASE_DOC ::

## API

### Anchor Props

name | type | default | description | required
Expand All @@ -9,10 +10,9 @@ className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
affixProps | Object | - | Typescript:`Omit<AffixProps, 'children'>`[Affix API Documents](./affix?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/anchor/type.ts) | N
bounds | Number | 5 | \- | N
container | String / Function | () => window | Typescript:`ScrollContainer`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
container | String / Function | () => (() => window) | Typescript:`ScrollContainer`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
cursor | TElement | - | Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
getCurrentAnchor | Function | - | Custom Highlighted Anchor Points。Typescript:`(activeLink: string) => string` | N
size | String | medium | options: small/medium/large。Typescript:`SizeEnum`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
size | String | medium | options:small/medium/large。Typescript:`SizeEnum`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
targetOffset | Number | 0 | \- | N
onChange | Function | | Typescript:`(currentLink: string, prevLink: string) => void`<br/> | N
onClick | Function | | Typescript:`(link: { href: string; title: string; e: MouseEvent }) => void`<br/> | N
Expand All @@ -24,7 +24,7 @@ name | type | default | description | required
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
href | String | - | required | Y
target | String | _self | options: _self/_blank/_parent/_top | N
target | String | _self | options_self/_blank/_parent/_top | N
title | TNode | '' | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N

### AnchorTarget Props
Expand Down
4 changes: 2 additions & 2 deletions src/anchor/anchor.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
:: BASE_DOC ::

## API

### Anchor Props

名称 | 类型 | 默认值 | 说明 | 必传
Expand All @@ -9,9 +10,8 @@ className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
affixProps | Object | - | 透传 Affix 组件属性,即让 Anchor 组件支持所有 Affix 组件特性。TS 类型:`Omit<AffixProps, 'children'>`[Affix API Documents](./affix?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/anchor/type.ts) | N
bounds | Number | 5 | 锚点区域边界 | N
container | String / Function | () => window | 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`ScrollContainer`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
container | String / Function | () => (() => window) | 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`ScrollContainer`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
cursor | TElement | - | 用于自定义选中项左侧游标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
getCurrentAnchor | Function | - | 自定义高亮的锚点 。TS 类型:`(activeLink: string) => string` | N
size | String | medium | 组件尺寸,small(120px),medium(200px),large(320px)。可选项:small/medium/large。TS 类型:`SizeEnum`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
targetOffset | Number | 0 | 锚点滚动偏移量 | N
onChange | Function | | TS 类型:`(currentLink: string, prevLink: string) => void`<br/>锚点改变时触发 | N
Expand Down
2 changes: 1 addition & 1 deletion src/auto-complete/auto-complete.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ triggerElement | TNode | - | Typescript:`string \| TNode`。[see more ts defin
value | String | - | \- | N
defaultValue | String | - | uncontrolled property | N
onBlur | Function | | Typescript:`(context: { e: FocusEvent; value: string }) => void`<br/> | N
onChange | Function | | Typescript:`(value: string, context?: { e?: InputEvent \| MouseEvent \| CompositionEvent \| KeyboardEvent }) => void`<br/> | N
onChange | Function | | Typescript:`(value: string, context?: { e?: InputEvent \| MouseEvent \| KeyboardEvent }) => void`<br/> | N
onClear | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
onCompositionend | Function | | Typescript:`(context: { e: CompositionEvent; value: string }) => void`<br/>trigger on compositionend | N
onCompositionstart | Function | | Typescript:`(context: { e: CompositionEvent; value: string }) => void`<br/>trigger on compositionstart | N
Expand Down
2 changes: 1 addition & 1 deletion src/auto-complete/auto-complete.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ triggerElement | TNode | - | 触发显示联想词下拉框的元素,默认为
value | String | - | 输入框的值,即当前指定的联想词 | N
defaultValue | String | - | 输入框的值,即当前指定的联想词。非受控属性 | N
onBlur | Function | | TS 类型:`(context: { e: FocusEvent; value: string }) => void`<br/>失去焦点时触发 | N
onChange | Function | | TS 类型:`(value: string, context?: { e?: InputEvent \| MouseEvent \| CompositionEvent \| KeyboardEvent }) => void`<br/>输入框值发生变化时触发 | N
onChange | Function | | TS 类型:`(value: string, context?: { e?: InputEvent \| MouseEvent \| KeyboardEvent }) => void`<br/>输入框值发生变化时触发 | N
onClear | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>清空按钮点击时触发 | N
onCompositionend | Function | | TS 类型:`(context: { e: CompositionEvent; value: string }) => void`<br/>中文输入结束时触发 | N
onCompositionstart | Function | | TS 类型:`(context: { e: CompositionEvent; value: string }) => void`<br/>中文输入开始时触发 | N
Expand Down
10 changes: 4 additions & 6 deletions src/auto-complete/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ export interface TdAutoCompleteProps<T extends AutoCompleteOption = AutoComplete
*/
onChange?: (
value: string,
context?: {
e?: FormEvent<HTMLInputElement> | MouseEvent<HTMLLIElement> | CompositionEvent<HTMLDivElement> | KeyboardEvent;
},
context?: { e?: FormEvent<HTMLInputElement> | MouseEvent<HTMLLIElement> | KeyboardEvent },
) => void;
/**
* 清空按钮点击时触发
Expand All @@ -121,11 +119,11 @@ export interface TdAutoCompleteProps<T extends AutoCompleteOption = AutoComplete
/**
* 中文输入结束时触发
*/
onCompositionend?: (context: { e: CompositionEvent<HTMLDivElement>; value: string }) => void;
onCompositionend?: (context: { e: CompositionEvent<HTMLInputElement>; value: string }) => void;
/**
* 中文输入开始时触发
*/
onCompositionstart?: (context: { e: CompositionEvent<HTMLDivElement>; value: string }) => void;
onCompositionstart?: (context: { e: CompositionEvent<HTMLInputElement>; value: string }) => void;
/**
* 回车键按下时触发
*/
Expand All @@ -137,7 +135,7 @@ export interface TdAutoCompleteProps<T extends AutoCompleteOption = AutoComplete
/**
* 选中联想词时触发
*/
onSelect?: (value: string, context: { e: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement> }) => void;
onSelect?: (value: string, context: { e: MouseEvent<HTMLLIElement> | KeyboardEvent }) => void;
}

export type AutoCompleteOption = string | AutoCompleteOptionObj;
Expand Down
5 changes: 3 additions & 2 deletions src/avatar/avatar.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ image | String | - | images url | N
imageProps | Object | - | Typescript:`ImageProps`[Image API Documents](./image?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
shape | String | circle | shape。options:circle/round。Typescript:`ShapeEnum ` `type ShapeEnum = 'circle' \| 'round'`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
size | String | - | size | N
onError | Function | | Typescript:`(context: { e: ImageEvent }) => void`<br/>trigger on image load failed | N
onError | Function | | Typescript:`(context: { e: Event }) => void`<br/>trigger on image load failed | N

### AvatarGroup Props

Expand All @@ -27,5 +27,6 @@ style | Object | - | 样式,Typescript:`React.CSSProperties` | N
cascading | String | 'right-up' | multiple images cascading。options:left-up/right-up。Typescript:`CascadingValue` `type CascadingValue = 'left-up' \| 'right-up'`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
collapseAvatar | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
max | Number | - | \- | N
placement | String | - | popup placement。options:left/top/bottom/right。Typescript:`MaxOverPlacement` `type MaxOverPlacement = 'left' \| 'top' \| 'bottom' \| 'right'`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
popupProps | Object | - | Typescript:`PopupProps`[Popup API Documents](./popup?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
size | String | - | size | N
size | String | medium | size | N
5 changes: 3 additions & 2 deletions src/avatar/avatar.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ image | String | - | 图片地址 | N
imageProps | Object | - | 透传至 Image 组件。TS 类型:`ImageProps`[Image API Documents](./image?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
shape | String | circle | 形状。可选项:circle/round。TS 类型:`ShapeEnum ` `type ShapeEnum = 'circle' \| 'round'`[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
size | String | - | 尺寸,示例值:small/medium/large/24px/38px 等。优先级高于 AvatarGroup.size 。Avatar 单独存在时,默认值为 medium。如果父组件存在 AvatarGroup,默认值便由 AvatarGroup.size 决定 | N
onError | Function | | TS 类型:`(context: { e: ImageEvent }) => void`<br/>图片加载失败时触发 | N
onError | Function | | TS 类型:`(context: { e: Event }) => void`<br/>图片加载失败时触发 | N

### AvatarGroup Props

Expand All @@ -27,5 +27,6 @@ style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
cascading | String | 'right-up' | 图片之间的层叠关系,可选值:左侧图片在上和右侧图片在上。可选项:left-up/right-up。TS 类型:`CascadingValue` `type CascadingValue = 'left-up' \| 'right-up'`[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
collapseAvatar | TNode | - | 头像数量超出时,会出现一个头像折叠元素。该元素内容可自定义。默认为 `+N`。示例:`+5``...`, `更多`。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
max | Number | - | 能够同时显示的最多头像数量 | N
placement | String | - | 超出的头像呈现位置。可选项:left/top/bottom/right。TS 类型:`MaxOverPlacement` `type MaxOverPlacement = 'left' \| 'top' \| 'bottom' \| 'right'`[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
popupProps | Object | - | 头像右上角提示信息。TS 类型:`PopupProps`[Popup API Documents](./popup?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
size | String | - | 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size | N
size | String | medium | 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size | N
2 changes: 1 addition & 1 deletion src/avatar/defaultProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import { TdAvatarProps, TdAvatarGroupProps } from './type';

export const avatarDefaultProps: TdAvatarProps = { hideOnLoadFailed: false, shape: 'circle' };

export const avatarGroupDefaultProps: TdAvatarGroupProps = { cascading: 'right-up' };
export const avatarGroupDefaultProps: TdAvatarGroupProps = { cascading: 'right-up', size: 'medium' };
12 changes: 9 additions & 3 deletions src/avatar/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { ImageProps } from '../image';
import { PopupProps } from '../popup';
import { TNode, TElement, ImageEvent } from '../common';
import { TNode, TElement } from '../common';

export interface TdAvatarProps {
/**
Expand Down Expand Up @@ -53,7 +53,7 @@ export interface TdAvatarProps {
/**
* 图片加载失败时触发
*/
onError?: (context: { e: ImageEvent<HTMLImageElement> }) => void;
onError?: (context: { e: Event }) => void;
}

export interface TdAvatarGroupProps {
Expand All @@ -70,17 +70,23 @@ export interface TdAvatarGroupProps {
* 能够同时显示的最多头像数量
*/
max?: number;
/**
* 超出的头像呈现位置
*/
placement?: MaxOverPlacement;
/**
* 头像右上角提示信息
*/
popupProps?: PopupProps;
/**
* 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size
* @default ''
* @default medium
*/
size?: string;
}

export type ShapeEnum = 'circle' | 'round';

export type CascadingValue = 'left-up' | 'right-up';

export type MaxOverPlacement = 'left' | 'top' | 'bottom' | 'right';
1 change: 0 additions & 1 deletion src/back-top/back-top.en-US.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
:: BASE_DOC ::

## API

### BackTop Props

name | type | default | description | required
Expand Down
1 change: 0 additions & 1 deletion src/back-top/back-top.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
:: BASE_DOC ::

## API

### BackTop Props

名称 | 类型 | 默认值 | 说明 | 必传
Expand Down
8 changes: 0 additions & 8 deletions src/back-top/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ import { TNode, AttachNode } from '../common';
import { MouseEvent } from 'react';

export interface TdBackTopProps {
/**
* 类名
*/
className?: string;
/**
* 样式
*/
style?: React.CSSProperties;
/**
* 回到顶部内容,同 `content`
*/
Expand Down
1 change: 1 addition & 0 deletions src/badge/badge.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
:: BASE_DOC ::

## API

### Badge Props

名称 | 类型 | 默认值 | 说明 | 必传
Expand Down
20 changes: 20 additions & 0 deletions src/breadcrumb-item/breadcrumb-item.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
:: BASE_DOC ::

## API

### BreadcrumbItem Props

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
children | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
content | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
disabled | Boolean | - | \- | N
href | String | - | \- | N
icon | TElement | - | prefix icon in breadcrumb item。Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
maxWidth | String | undefined | \- | N
replace | Boolean | false | \- | N
router | Object | - | Typescript:`any` | N
target | String | _self | options:_blank/_self/_parent/_top | N
to | String / Object | - | Typescript:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
20 changes: 20 additions & 0 deletions src/breadcrumb-item/breadcrumb-item.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
:: BASE_DOC ::

## API

### BreadcrumbItem Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
children | TNode | - | 子元素,同 content。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
content | TNode | - | 子元素。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
disabled | Boolean | - | 是否禁用当前项点击 | N
href | String | - | 跳转链接 | N
icon | TElement | - | 面板屑项内的前置图标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
maxWidth | String | undefined | 最大宽度,超出后会以省略号形式呈现。优先级高于 Breadcrumb 中的 maxItemWidth | N
replace | Boolean | false | 路由跳转是否采用覆盖的方式(覆盖后将没有浏览器历史记录) | N
router | Object | - | 路由对象。如果项目存在 Router,则默认使用 Router。TS 类型:`any` | N
target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
3 changes: 2 additions & 1 deletion src/breadcrumb/breadcrumb.en-US.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
:: BASE_DOC ::

## API

### Breadcrumb Props

name | type | default | description | required
Expand All @@ -26,4 +27,4 @@ maxWidth | String | undefined | \- | N
replace | Boolean | false | \- | N
router | Object | - | Typescript:`any` | N
target | String | _self | options:_blank/_self/_parent/_top | N
to | String / Object | - | Typescript:`Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
to | String / Object | - | Typescript:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
Loading

0 comments on commit ac3cb69

Please sign in to comment.