fix: Typography.Paragraph\Text\Title ts (#29787)

* fix: Typography.Paragraph\Text\Title ts

* feat: add doc

* feat: title ts

* feat: cr

* chore: revert

* chore: ts

* feat: doc/sort & drop onChange
This commit is contained in:
CodingYingYingYing 2021-03-23 13:32:37 +08:00 committed by GitHub
parent dc4d85583f
commit a21c1a88c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 7 deletions

View File

@ -1,7 +1,9 @@
import * as React from 'react'; import * as React from 'react';
import Base, { BlockProps } from './Base'; import Base, { BlockProps } from './Base';
export interface ParagraphProps extends BlockProps {} export interface ParagraphProps extends BlockProps {
onClick?: (e?: React.MouseEvent<HTMLDivElement>) => void;
}
const Paragraph: React.FC<ParagraphProps> = props => <Base {...props} component="div" />; const Paragraph: React.FC<ParagraphProps> = props => <Base {...props} component="div" />;

View File

@ -5,6 +5,7 @@ import Base, { BlockProps, EllipsisConfig } from './Base';
export interface TextProps extends BlockProps { export interface TextProps extends BlockProps {
ellipsis?: boolean | Omit<EllipsisConfig, 'expandable' | 'rows' | 'onExpand'>; ellipsis?: boolean | Omit<EllipsisConfig, 'expandable' | 'rows' | 'onExpand'>;
onClick?: (e?: React.MouseEvent<HTMLDivElement>) => void;
} }
const Text: React.FC<TextProps> = ({ ellipsis, ...restProps }) => { const Text: React.FC<TextProps> = ({ ellipsis, ...restProps }) => {

View File

@ -5,7 +5,13 @@ import { tupleNum, Omit } from '../_util/type';
const TITLE_ELE_LIST = tupleNum(1, 2, 3, 4, 5); const TITLE_ELE_LIST = tupleNum(1, 2, 3, 4, 5);
export type TitleProps = Omit<BlockProps & { level?: typeof TITLE_ELE_LIST[number] }, 'strong'>; export type TitleProps = Omit<
BlockProps & {
level?: typeof TITLE_ELE_LIST[number];
onClick?: (e?: React.MouseEvent<HTMLDivElement>) => void;
},
'strong'
>;
const Title: React.FC<TitleProps> = props => { const Title: React.FC<TitleProps> = props => {
const { level = 1, ...restProps } = props; const { level = 1, ...restProps } = props;

View File

@ -27,10 +27,10 @@ Basic text writing, including headings, body text, lists, and more.
| ellipsis | Display ellipsis when text overflows | boolean | false | | | ellipsis | Display ellipsis when text overflows | boolean | false | |
| keyboard | Keyboard style | boolean | false | 4.3.0 | | keyboard | Keyboard style | boolean | false | 4.3.0 |
| mark | Marked style | boolean | false | | | mark | Marked style | boolean | false | |
| onClick | Set the handler to handle click event | (event) => void | - | |
| strong | Bold style | boolean | false | | | strong | Bold style | boolean | false | |
| type | Content type | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 | | type | Content type | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 |
| underline | Underlined style | boolean | false | | | underline | Underlined style | boolean | false | |
| onChange | Trigger when user edits the content | function(string) | - | |
### Typography.Title ### Typography.Title
@ -44,9 +44,9 @@ Basic text writing, including headings, body text, lists, and more.
| ellipsis | Display ellipsis when text overflows, can configure rows and expandable by using object | boolean \| [ellipsis](#ellipsis) | false | [ellipsis](#ellipsis) | | ellipsis | Display ellipsis when text overflows, can configure rows and expandable by using object | boolean \| [ellipsis](#ellipsis) | false | [ellipsis](#ellipsis) |
| level | Set content importance. Match with `h1`, `h2`, `h3`, `h4`, `h5` | number: 1, 2, 3, 4, 5 | 1 | 5: 4.6.0 | | level | Set content importance. Match with `h1`, `h2`, `h3`, `h4`, `h5` | number: 1, 2, 3, 4, 5 | 1 | 5: 4.6.0 |
| mark | Marked style | boolean | false | | | mark | Marked style | boolean | false | |
| onClick | Set the handler to handle click event | (event) => void | - | |
| type | Content type | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 | | type | Content type | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 |
| underline | Underlined style | boolean | false | | | underline | Underlined style | boolean | false | |
| onChange | Trigger when user edits the content | function(string) | - | |
### Typography.Paragraph ### Typography.Paragraph
@ -59,10 +59,10 @@ Basic text writing, including headings, body text, lists, and more.
| editable | If editable. Can control edit state when is object | boolean \| [editable](#editable) | false | [editable](#editable) | | editable | If editable. Can control edit state when is object | boolean \| [editable](#editable) | false | [editable](#editable) |
| ellipsis | Display ellipsis when text overflows, can configure rows and expandable by using object | boolean \| [ellipsis](#ellipsis) | false | [ellipsis](#ellipsis) | | ellipsis | Display ellipsis when text overflows, can configure rows and expandable by using object | boolean \| [ellipsis](#ellipsis) | false | [ellipsis](#ellipsis) |
| mark | Marked style | boolean | false | | | mark | Marked style | boolean | false | |
| onClick | Set the handler to handle click event | (event) => void | - | |
| strong | Bold style | boolean | false | | | strong | Bold style | boolean | false | |
| type | Content type | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 | | type | Content type | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 |
| underline | Underlined style | boolean | false | | | underline | Underlined style | boolean | false | |
| onChange | Trigger when user edits the content | function(string) | - | |
### copyable ### copyable

View File

@ -28,6 +28,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/GOM1KQ24O/Typography.svg
| ellipsis | 自动溢出省略 | boolean | false | | | ellipsis | 自动溢出省略 | boolean | false | |
| keyboard | 添加键盘样式 | boolean | false | 4.3.0 | | keyboard | 添加键盘样式 | boolean | false | 4.3.0 |
| mark | 添加标记样式 | boolean | false | | | mark | 添加标记样式 | boolean | false | |
| onClick | 点击 Text 时的回调 | (event) => void | - | |
| strong | 是否加粗 | boolean | false | | | strong | 是否加粗 | boolean | false | |
| type | 文本类型 | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 | | type | 文本类型 | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 |
| underline | 添加下划线样式 | boolean | false | | | underline | 添加下划线样式 | boolean | false | |
@ -44,9 +45,9 @@ cover: https://gw.alipayobjects.com/zos/alicdn/GOM1KQ24O/Typography.svg
| ellipsis | 自动溢出省略,为对象时可设置省略行数、是否可展开、添加后缀等 | boolean \| [ellipsis](#ellipsis) | false | [ellipsis](#ellipsis) | | ellipsis | 自动溢出省略,为对象时可设置省略行数、是否可展开、添加后缀等 | boolean \| [ellipsis](#ellipsis) | false | [ellipsis](#ellipsis) |
| level | 重要程度,相当于 `h1`、`h2`、`h3`、`h4`、`h5` | number: 1, 2, 3, 4, 5 | 1 | 5: 4.6.0 | | level | 重要程度,相当于 `h1`、`h2`、`h3`、`h4`、`h5` | number: 1, 2, 3, 4, 5 | 1 | 5: 4.6.0 |
| mark | 添加标记样式 | boolean | false | | | mark | 添加标记样式 | boolean | false | |
| onClick | 点击 Title 时的回调 | (event) => void | - | |
| type | 文本类型 | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 | | type | 文本类型 | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 |
| underline | 添加下划线样式 | boolean | false | | | underline | 添加下划线样式 | boolean | false | |
| onChange | 当用户提交编辑内容时触发 | function(string) | - | |
### Typography.Paragraph ### Typography.Paragraph
@ -59,10 +60,10 @@ cover: https://gw.alipayobjects.com/zos/alicdn/GOM1KQ24O/Typography.svg
| editable | 是否可编辑,为对象时可对编辑进行控制 | boolean \| [editable](#editable) | false | [editable](#editable) | | editable | 是否可编辑,为对象时可对编辑进行控制 | boolean \| [editable](#editable) | false | [editable](#editable) |
| ellipsis | 自动溢出省略,为对象时可设置省略行数、是否可展开、添加后缀等 | boolean \| [ellipsis](#ellipsis) | false | [ellipsis](#ellipsis) | | ellipsis | 自动溢出省略,为对象时可设置省略行数、是否可展开、添加后缀等 | boolean \| [ellipsis](#ellipsis) | false | [ellipsis](#ellipsis) |
| mark | 添加标记样式 | boolean | false | | | mark | 添加标记样式 | boolean | false | |
| onClick | 点击 Paragraph 时的回调 | (event) => void | - | |
| strong | 是否加粗 | boolean | false | | | strong | 是否加粗 | boolean | false | |
| type | 文本类型 | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 | | type | 文本类型 | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 |
| underline | 添加下划线样式 | boolean | false | | | underline | 添加下划线样式 | boolean | false | |
| onChange | 当用户提交编辑内容时触发 | function(string) | - | |
### copyable ### copyable