Skip to content

Commit

Permalink
feat: generate web vue/react api
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaosansiji committed May 25, 2022
1 parent f639eef commit e8d194b
Show file tree
Hide file tree
Showing 386 changed files with 30,073 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
lib
node_modules
common
packages/products
14 changes: 14 additions & 0 deletions packages/products/tdesign-react/src/affix/affix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
:: BASE_DOC ::

## API
### Affix Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
container | String / Function | () => (() => window) | 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`ScrollContainer` | N
offsetBottom | Number | 0 | 距离容器顶部达到指定距离后触发固定 | N
offsetTop | Number | 0 | 距离容器底部达到指定距离后触发固定 | N
zIndex | Number | - | 固钉定位层级,样式默认为 500 | N
onFixedChange | Function | | TS 类型:`(affixed: boolean, context: { top: number }) => void`<br/>固定状态发生变化时触发 | N
7 changes: 7 additions & 0 deletions packages/products/tdesign-react/src/affix/defaultProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdAffixProps } from './type';

export const affixDefaultProps: TdAffixProps = { container: '() => (() => window)', offsetBottom: 0, offsetTop: 0 };
33 changes: 33 additions & 0 deletions packages/products/tdesign-react/src/affix/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { ScrollContainer } from '../common';

export interface TdAffixProps {
/**
* 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body
* @default () => (() => window)
*/
container?: ScrollContainer;
/**
* 距离容器顶部达到指定距离后触发固定
* @default 0
*/
offsetBottom?: number;
/**
* 距离容器底部达到指定距离后触发固定
* @default 0
*/
offsetTop?: number;
/**
* 固钉定位层级,样式默认为 500
*/
zIndex?: number;
/**
* 固定状态发生变化时触发
*/
onFixedChange?: (affixed: boolean, context: { top: number }) => void;
}
18 changes: 18 additions & 0 deletions packages/products/tdesign-react/src/alert/alert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
:: BASE_DOC ::

## API
### Alert Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
close | TNode | false | 关闭按钮。值为 true 则显示默认关闭按钮;值为 false 则不显示按钮;值类型为 string 则直接显示;值类型为 Function 则可以自定关闭按钮。TS 类型:`string | boolean | TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
icon | TElement | - | 图标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
maxLine | Number | 0 | 内容显示最大行数,超出的内容会折叠收起,用户点击后再展开。值为 0 表示不折叠 | N
message | TNode | - | 内容(子元素)。TS 类型:`string | TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
operation | TElement | - | 跟在告警内容后面的操作区。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
theme | String | info | 组件风格。可选项:success/info/warning/error | N
title | TNode | - | 标题。TS 类型:`string | TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
onClose | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>关闭按钮点击时触发 | N
onClosed | Function | | TS 类型:`(context: { e: TransitionEvent }) => void`<br/>告警提示框关闭动画结束后触发 | N
7 changes: 7 additions & 0 deletions packages/products/tdesign-react/src/alert/defaultProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdAlertProps } from './type';

export const alertDefaultProps: TdAlertProps = { close: false, maxLine: 0, theme: 'info' };
50 changes: 50 additions & 0 deletions packages/products/tdesign-react/src/alert/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TNode, TElement } from '../common';
import { MouseEvent, TransitionEvent } from 'react';

export interface TdAlertProps {
/**
* 关闭按钮。值为 true 则显示默认关闭按钮;值为 false 则不显示按钮;值类型为 string 则直接显示;值类型为 Function 则可以自定关闭按钮
* @default false
*/
close?: TNode;
/**
* 图标
*/
icon?: TElement;
/**
* 内容显示最大行数,超出的内容会折叠收起,用户点击后再展开。值为 0 表示不折叠
* @default 0
*/
maxLine?: number;
/**
* 内容(子元素)
*/
message?: TNode;
/**
* 跟在告警内容后面的操作区
*/
operation?: TElement;
/**
* 组件风格
* @default info
*/
theme?: 'success' | 'info' | 'warning' | 'error';
/**
* 标题
*/
title?: TNode;
/**
* 关闭按钮点击时触发
*/
onClose?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
/**
* 告警提示框关闭动画结束后触发
*/
onClosed?: (context: { e: TransitionEvent<HTMLDivElement> }) => void;
}
36 changes: 36 additions & 0 deletions packages/products/tdesign-react/src/anchor/anchor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
:: BASE_DOC ::

## API
### Anchor Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
affixProps | Object | - | 透传 Affix 组件属性,即让 Anchor 组件支持所有 Affix 组件特性。TS 类型:`AffixProps`[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` | N
cursor | TElement | - | 用于自定义选中项左侧游标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | 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
onClick | Function | | TS 类型:`(link: { href: string; title: string; e: MouseEvent }) => void`<br/>锚点被点击时触发 | N

### AnchorItem Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
href | String | - | 必需。锚点链接, 如果是 hash 模式需要加上当前 path | Y
target | String | _self | 锚点文本。可选项:_self/_blank/_parent/_top | N
title | TNode | '' | 锚点文本。TS 类型:`string | TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N

### AnchorTarget Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
id | String | - | 必需。目标内容 id | Y
tag | String | div | 渲染的标签 | N
16 changes: 16 additions & 0 deletions packages/products/tdesign-react/src/anchor/defaultProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdAnchorProps, TdAnchorItemProps, TdAnchorTargetProps } from './type';

export const anchorDefaultProps: TdAnchorProps = {
bounds: 5,
container: '() => (() => window)',
size: 'medium',
targetOffset: 0,
};

export const anchorItemDefaultProps: TdAnchorItemProps = { target: '_self' };

export const anchorTargetDefaultProps: TdAnchorTargetProps = { tag: 'div' };
79 changes: 79 additions & 0 deletions packages/products/tdesign-react/src/anchor/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { AffixProps } from '../affix';
import { TNode, TElement, SizeEnum, ScrollContainer } from '../common';
import { MouseEvent } from 'react';

export interface TdAnchorProps {
/**
* 透传 Affix 组件属性,即让 Anchor 组件支持所有 Affix 组件特性
*/
affixProps?: AffixProps;
/**
* 锚点区域边界
* @default 5
*/
bounds?: number;
/**
* 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body
* @default () => (() => window)
*/
container?: ScrollContainer;
/**
* 用于自定义选中项左侧游标
*/
cursor?: TElement;
/**
* 组件尺寸,small(120px),medium(200px),large(320px)
* @default medium
*/
size?: SizeEnum;
/**
* 锚点滚动偏移量
* @default 0
*/
targetOffset?: number;
/**
* 锚点改变时触发
*/
onChange?: (currentLink: string, prevLink: string) => void;
/**
* 锚点被点击时触发
*/
onClick?: (link: { href: string; title: string; e: MouseEvent<HTMLDivElement> }) => void;
}

export interface TdAnchorTargetProps {
/**
* 目标内容 id
* @default ''
*/
id: string;
/**
* 渲染的标签
* @default div
*/
tag?: string;
}

export interface TdAnchorItemProps {
/**
* 锚点链接, 如果是 hash 模式需要加上当前 path
* @default ''
*/
href: string;
/**
* 锚点文本
* @default _self
*/
target?: '_self' | '_blank' | '_parent' | '_top';
/**
* 锚点文本
* @default ''
*/
title?: TNode;
}
29 changes: 29 additions & 0 deletions packages/products/tdesign-react/src/avatar/avatar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
:: BASE_DOC ::

## API
### Avatar Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
alt | String | - | 头像替换文本,仅当图片加载失败时有效 | N
hideOnLoadFailed | Boolean | false | 加载失败时隐藏图片 | N
icon | TElement | - | 图标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
image | String | - | 图片地址 | 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 等,默认为 large | N
onError | Function | | TS 类型:`() => void`<br/>图片加载失败时触发 | N

### AvatarGroup Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
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 | medium | 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size | N
9 changes: 9 additions & 0 deletions packages/products/tdesign-react/src/avatar/defaultProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdAvatarProps, TdAvatarGroupProps } from './type';

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

export const avatarGroupDefaultProps: TdAvatarGroupProps = { cascading: 'right-up', size: 'medium' };
79 changes: 79 additions & 0 deletions packages/products/tdesign-react/src/avatar/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

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

export interface TdAvatarProps {
/**
* 头像替换文本,仅当图片加载失败时有效
* @default ''
*/
alt?: string;
/**
* 加载失败时隐藏图片
* @default false
*/
hideOnLoadFailed?: boolean;
/**
* 图标
*/
icon?: TElement;
/**
* 图片地址
* @default ''
*/
image?: string;
/**
* 形状
* @default circle
*/
shape?: ShapeEnum;
/**
* 尺寸,示例值:small/medium/large/24px/38px 等,默认为 large
* @default ''
*/
size?: string;
/**
* 图片加载失败时触发
*/
onError?: () => void;
}

export interface TdAvatarGroupProps {
/**
* 图片之间的层叠关系,可选值:左侧图片在上和右侧图片在上
* @default 'right-up'
*/
cascading?: CascadingValue;
/**
* 头像数量超出时,会出现一个头像折叠元素。该元素内容可自定义。默认为 `+N`。示例:`+5`,`...`, `更多`
*/
collapseAvatar?: TNode;
/**
* 能够同时显示的最多头像数量
*/
max?: number;
/**
* 超出的头像呈现位置
*/
placement?: MaxOverPlacement;
/**
* 头像右上角提示信息
*/
popupProps?: PopupProps;
/**
* 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size
* @default medium
*/
size?: string;
}

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

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

export type MaxOverPlacement = 'left' | 'top' | 'bottom' | 'right';
Loading

0 comments on commit e8d194b

Please sign in to comment.