-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Textarea):the maxlength props only supports number type
- Loading branch information
Showing
12 changed files
with
179 additions
and
8 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/products/tdesign-mobile-react/src/textarea/defaultProps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
import { TdTextareaProps } from './type'; | ||
|
||
export const textareaDefaultProps: TdTextareaProps = { | ||
allowInputOverMax: false, | ||
autofocus: false, | ||
autosize: false, | ||
bordered: false, | ||
disabled: undefined, | ||
indicator: false, | ||
layout: 'horizontal', | ||
placeholder: undefined, | ||
readonly: false, | ||
}; |
29 changes: 29 additions & 0 deletions
29
packages/products/tdesign-mobile-react/src/textarea/textarea.en-US.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
:: BASE_DOC :: | ||
|
||
## API | ||
|
||
|
||
### Textarea Props | ||
|
||
name | type | default | description | required | ||
-- | -- | -- | -- | -- | ||
className | String | - | className of component | N | ||
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N | ||
allowInputOverMax | Boolean | false | \- | N | ||
autofocus | Boolean | false | \- | N | ||
autosize | Boolean / Object | false | Typescript:`boolean \| { minRows?: number; maxRows?: number }` | N | ||
bordered | Boolean | false | \- | N | ||
disabled | Boolean | undefined | \- | N | ||
indicator | Boolean | false | \- | N | ||
label | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N | ||
layout | String | horizontal | options: vertical/horizontal | N | ||
maxcharacter | Number | - | \- | N | ||
maxlength | Number | - | \- | N | ||
name | String | - | \- | N | ||
placeholder | String | undefined | \- | N | ||
readonly | Boolean | false | \- | N | ||
value | String / Number | - | Typescript:`TextareaValue` `type TextareaValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/textarea/type.ts) | N | ||
defaultValue | String / Number | - | uncontrolled property。Typescript:`TextareaValue` `type TextareaValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/textarea/type.ts) | N | ||
onBlur | Function | | Typescript:`(value: TextareaValue, context: { e: FocusEvent }) => void`<br/> | N | ||
onChange | Function | | Typescript:`(value: TextareaValue, context?: { e?: InputEvent }) => void`<br/> | N | ||
onFocus | Function | | Typescript:`(value: TextareaValue, context : { e: FocusEvent }) => void`<br/> | N |
29 changes: 29 additions & 0 deletions
29
packages/products/tdesign-mobile-react/src/textarea/textarea.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
:: BASE_DOC :: | ||
|
||
## API | ||
|
||
|
||
### Textarea Props | ||
|
||
名称 | 类型 | 默认值 | 描述 | 必传 | ||
-- | -- | -- | -- | -- | ||
className | String | - | 类名 | N | ||
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N | ||
allowInputOverMax | Boolean | false | 超出maxlength或maxcharacter之后是否还允许输入 | N | ||
autofocus | Boolean | false | 自动聚焦,拉起键盘 | N | ||
autosize | Boolean / Object | false | 高度自动撑开。 autosize = true 表示组件高度自动撑开,同时,依旧允许手动拖高度。如果设置了 autosize.maxRows 或者 autosize.minRows 则不允许手动调整高度。TS 类型:`boolean \| { minRows?: number; maxRows?: number }` | N | ||
bordered | Boolean | false | 是否显示外边框 | N | ||
disabled | Boolean | undefined | 是否禁用文本框 | N | ||
indicator | Boolean | false | 显示文本计数器,如 0/140。当 `maxlength < 0 && maxcharacter < 0` 成立时, indicator无效 | N | ||
label | TNode | - | 左侧文本。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N | ||
layout | String | horizontal | 标题输入框布局方式。可选项:vertical/horizontal | N | ||
maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度 | N | ||
maxlength | Number | - | 用户最多可以输入的字符个数 | N | ||
name | String | - | 名称,HTML 元素原生属性 | N | ||
placeholder | String | undefined | 占位符 | N | ||
readonly | Boolean | false | 只读状态 | N | ||
value | String / Number | - | 文本框值。TS 类型:`TextareaValue` `type TextareaValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/textarea/type.ts) | N | ||
defaultValue | String / Number | - | 文本框值。非受控属性。TS 类型:`TextareaValue` `type TextareaValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/textarea/type.ts) | N | ||
onBlur | Function | | TS 类型:`(value: TextareaValue, context: { e: FocusEvent }) => void`<br/>失去焦点时触发 | N | ||
onChange | Function | | TS 类型:`(value: TextareaValue, context?: { e?: InputEvent }) => void`<br/>输入内容变化时触发 | N | ||
onFocus | Function | | TS 类型:`(value: TextareaValue, context : { e: FocusEvent }) => void`<br/>获得焦点时触发 | N |
93 changes: 93 additions & 0 deletions
93
packages/products/tdesign-mobile-react/src/textarea/type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* eslint-disable */ | ||
|
||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
import { TNode } from '../common'; | ||
import { FocusEvent, FormEvent } from 'react'; | ||
|
||
export interface TdTextareaProps { | ||
/** | ||
* 超出maxlength或maxcharacter之后是否还允许输入 | ||
* @default false | ||
*/ | ||
allowInputOverMax?: boolean; | ||
/** | ||
* 自动聚焦,拉起键盘 | ||
* @default false | ||
*/ | ||
autofocus?: boolean; | ||
/** | ||
* 高度自动撑开。 autosize = true 表示组件高度自动撑开,同时,依旧允许手动拖高度。如果设置了 autosize.maxRows 或者 autosize.minRows 则不允许手动调整高度 | ||
* @default false | ||
*/ | ||
autosize?: boolean | { minRows?: number; maxRows?: number }; | ||
/** | ||
* 是否显示外边框 | ||
* @default false | ||
*/ | ||
bordered?: boolean; | ||
/** | ||
* 是否禁用文本框 | ||
*/ | ||
disabled?: boolean; | ||
/** | ||
* 显示文本计数器,如 0/140。当 `maxlength < 0 && maxcharacter < 0` 成立时, indicator无效 | ||
* @default false | ||
*/ | ||
indicator?: boolean; | ||
/** | ||
* 左侧文本 | ||
*/ | ||
label?: TNode; | ||
/** | ||
* 标题输入框布局方式 | ||
* @default horizontal | ||
*/ | ||
layout?: 'vertical' | 'horizontal'; | ||
/** | ||
* 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度 | ||
*/ | ||
maxcharacter?: number; | ||
/** | ||
* 用户最多可以输入的字符个数 | ||
*/ | ||
maxlength?: number; | ||
/** | ||
* 名称,HTML 元素原生属性 | ||
* @default '' | ||
*/ | ||
name?: string; | ||
/** | ||
* 占位符 | ||
*/ | ||
placeholder?: string; | ||
/** | ||
* 只读状态 | ||
* @default false | ||
*/ | ||
readonly?: boolean; | ||
/** | ||
* 文本框值 | ||
*/ | ||
value?: TextareaValue; | ||
/** | ||
* 文本框值,非受控属性 | ||
*/ | ||
defaultValue?: TextareaValue; | ||
/** | ||
* 失去焦点时触发 | ||
*/ | ||
onBlur?: (value: TextareaValue, context: { e: FocusEvent<HTMLTextAreaElement> }) => void; | ||
/** | ||
* 输入内容变化时触发 | ||
*/ | ||
onChange?: (value: TextareaValue, context?: { e?: FormEvent<HTMLTextAreaElement> }) => void; | ||
/** | ||
* 获得焦点时触发 | ||
*/ | ||
onFocus?: (value: TextareaValue, context: { e: FocusEvent<HTMLTextAreaElement> }) => void; | ||
} | ||
|
||
export type TextareaValue = string | number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters