From a63c281febfa618fa70a55da985066bf97f052b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com>
Date: Wed, 14 Aug 2024 11:14:08 +0800
Subject: [PATCH] docs: sync api
---
src/tag/defaultProps.ts | 3 ++-
src/tag/tag.en-US.md | 44 +++++++++++++++++++++++++++++++++++++++++
src/tag/tag.md | 11 ++++++-----
src/tag/type.ts | 28 +++++++++++++++-----------
4 files changed, 68 insertions(+), 18 deletions(-)
create mode 100644 src/tag/tag.en-US.md
diff --git a/src/tag/defaultProps.ts b/src/tag/defaultProps.ts
index fba81011f..d336e0b86 100644
--- a/src/tag/defaultProps.ts
+++ b/src/tag/defaultProps.ts
@@ -2,7 +2,7 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */
-import { TdCheckTagProps, TdTagProps } from './type';
+import { TdTagProps, TdCheckTagProps } from './type';
export const tagDefaultProps: TdTagProps = {
closable: false,
@@ -15,6 +15,7 @@ export const tagDefaultProps: TdTagProps = {
};
export const checkTagDefaultProps: TdCheckTagProps = {
+ defaultChecked: undefined,
closable: false,
disabled: false,
shape: 'square',
diff --git a/src/tag/tag.en-US.md b/src/tag/tag.en-US.md
new file mode 100644
index 000000000..9f20d86a4
--- /dev/null
+++ b/src/tag/tag.en-US.md
@@ -0,0 +1,44 @@
+:: BASE_DOC ::
+
+## API
+
+### Tag Props
+
+name | type | default | description | required
+-- | -- | -- | -- | --
+className | String | - | className of component | N
+style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
+children | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
+closable | Boolean | false | \- | N
+content | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
+disabled | Boolean | false | \- | N
+icon | TElement | undefined | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
+maxWidth | String / Number | - | \- | N
+shape | String | square | options: square/round/mark | N
+size | String | medium | options: small/medium/large/extra-large | N
+theme | String | default | options: default/primary/warning/danger/success | N
+variant | String | dark | options: dark/light/outline/light-outline | N
+onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
+onClose | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
+
+
+### CheckTag Props
+
+name | type | default | description | required
+-- | -- | -- | -- | --
+className | String | - | className of component | N
+style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
+checked | Boolean | undefined | \- | N
+defaultChecked | Boolean | undefined | uncontrolled property | N
+children | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
+closable | Boolean | false | \- | N
+content | TNode | - | Typescript:`string \| number \| string[] \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
+disabled | Boolean | false | \- | N
+icon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
+shape | String | square | options: square/round/mark | N
+size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
+uncheckedProps | Object | - | used to set unchecked tag props。Typescript:`TdTagProps` | N
+variant | String | dark | options: dark/light/outline/light-outline | N
+onChange | Function | | Typescript:`(checked: boolean) => void`
| N
+onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
+onClose | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
diff --git a/src/tag/tag.md b/src/tag/tag.md
index 5a12c2a23..c26f2ad89 100644
--- a/src/tag/tag.md
+++ b/src/tag/tag.md
@@ -8,7 +8,7 @@
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
-children | TNode | - | 组件子元素,同`content`。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
+children | TNode | - | 组件子元素,同 `content`。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
closable | Boolean | false | 标签是否可关闭 | N
content | TNode | - | 组件子元素。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
disabled | Boolean | false | 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态 | N
@@ -28,15 +28,16 @@ onClose | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
-checked | Boolean | - | 标签选中的状态,默认风格(theme=default)才有选中态 | N
+checked | Boolean | undefined | 标签选中的状态,默认风格(theme=default)才有选中态 | N
+defaultChecked | Boolean | undefined | 标签选中的状态,默认风格(theme=default)才有选中态。非受控属性 | N
children | TNode | - | 组件子元素。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
closable | Boolean | false | 标签是否可关闭 | N
-content | TNode | - | 组件子元素;传入数组时:[选中内容,非选中内容]。TS 类型:`string \| number \| array \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
-defaultChecked | Boolean | - | 标签选中的状态,默认风格(theme=default)才有选中态。非受控属性 | N
+content | TNode | - | 组件子元素;传入数组时:[选中内容,非选中内容]。TS 类型:`string \| number \| string[] \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
disabled | Boolean | false | 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态 | N
icon | TElement | - | 标签中的图标,可自定义图标呈现。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
-shape | String | square | 标签类型,有三种:方形、圆角方形、标记型。。可选项:square/round/mark | N
+shape | String | square | 标签类型,有三种:方形、圆角方形、标记型。可选项:square/round/mark | N
size | String | medium | 标签尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
+uncheckedProps | Object | - | 透传标签未选态属性。TS 类型:`TdTagProps` | N
variant | String | dark | 标签风格变体。可选项:dark/light/outline/light-outline | N
onChange | Function | | TS 类型:`(checked: boolean) => void`
状态切换时触发 | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击标签时触发 | N
diff --git a/src/tag/type.ts b/src/tag/type.ts
index bf0fb60c0..ee6c17c55 100644
--- a/src/tag/type.ts
+++ b/src/tag/type.ts
@@ -4,12 +4,12 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */
+import { TNode, TElement, SizeEnum } from '../common';
import { MouseEvent } from 'react';
-import { SizeEnum, TElement, TNode } from '../common';
export interface TdTagProps {
/**
- * 组件子元素,同`content`
+ * 组件子元素,同 `content`
*/
children?: TNode;
/**
@@ -57,11 +57,11 @@ export interface TdTagProps {
/**
* 点击时触发
*/
- onClick?: (context: { e: MouseEvent }) => void;
+ onClick?: (context: { e: MouseEvent }) => void;
/**
* 如果关闭按钮存在,点击关闭按钮时触发
*/
- onClose?: (context: { e: MouseEvent }) => void;
+ onClose?: (context: { e: MouseEvent }) => void;
}
export interface TdCheckTagProps {
@@ -69,6 +69,10 @@ export interface TdCheckTagProps {
* 标签选中的状态,默认风格(theme=default)才有选中态
*/
checked?: boolean;
+ /**
+ * 标签选中的状态,默认风格(theme=default)才有选中态,非受控属性
+ */
+ defaultChecked?: boolean;
/**
* 组件子元素
*/
@@ -81,11 +85,7 @@ export interface TdCheckTagProps {
/**
* 组件子元素;传入数组时:[选中内容,非选中内容]
*/
- content?: TNode;
- /**
- * 标签选中的状态,默认风格(theme=default)才有选中态。非受控属性
- */
- defaultChecked?: boolean;
+ content?: [] | TNode;
/**
* 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态
* @default false
@@ -96,7 +96,7 @@ export interface TdCheckTagProps {
*/
icon?: TElement;
/**
- * 标签类型,有三种:方形、圆角方形、标记型。
+ * 标签类型,有三种:方形、圆角方形、标记型
* @default square
*/
shape?: 'square' | 'round' | 'mark';
@@ -105,6 +105,10 @@ export interface TdCheckTagProps {
* @default medium
*/
size?: SizeEnum;
+ /**
+ * 透传标签未选态属性
+ */
+ uncheckedProps?: TdTagProps;
/**
* 标签风格变体
* @default dark
@@ -117,9 +121,9 @@ export interface TdCheckTagProps {
/**
* 点击标签时触发
*/
- onClick?: (context: { e: MouseEvent }) => void;
+ onClick?: (context: { e: MouseEvent }) => void;
/**
* 如果关闭按钮存在,点击关闭按钮时触发
*/
- onClose?: (context: { e: MouseEvent }) => void;
+ onClose?: (context: { e: MouseEvent }) => void;
}