Skip to content

Commit

Permalink
docs(textarea): sync api
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 committed Sep 3, 2024
1 parent 659fa5d commit 4595e0e
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 163 deletions.
38 changes: 29 additions & 9 deletions src/textarea/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,32 @@

name | type | default | description | required
-- | -- | -- | -- | --
style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
adjust-position | Boolean | true | \- | N
autofocus | Boolean | false | \- | N
autosize | Boolean | false | \- | N
autosize | Boolean / Object | false | Typescript:`boolean \| { maxHeight?: number, minHeight?: number }` | N
bordered | Boolean | false | \- | N
confirm-hold | Boolean | false | \- | N
confirm-type | String | return | options:return/send/search/next/go/done。Typescript:`'return' \| 'send' \| 'search' \| 'next' \| 'go' \| 'done'` | N
confirm-type | String | return | options: return/send/search/next/go/done。Typescript:`'return' \| 'send' \| 'search' \| 'next' \| 'go' \| 'done'` | N
cursor | Number | -1 | \- | N
cursor-spacing | Number | 0 | \- | N
disabled | Boolean | false | \- | N
external-classes | Array | - | `['t-class', 't-class-textarea', 't-class-label']` | N
disable-default-padding | Boolean | false | \- | N
disabled | Boolean | undefined | \- | N
fixed | Boolean | false | \- | N
focus | Boolean | false | \- | N
label | String / Slot | - | \- | N
hold-keyboard | Boolean | false | \- | N
indicator | Boolean | false | \- | N
label | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
maxcharacter | Number | - | \- | N
maxlength | Number | - | \- | N
maxlength | String / Number | - | \- | N
placeholder | String | undefined | \- | N
value | String | null | \- | N
default-value | String | '' | uncontrolled property | N
placeholder-style | String | - | \- | N
selection-end | Number | -1 | \- | N
selection-start | Number | -1 | \- | N
show-confirm-bar | Boolean | true | \- | N
value | String / Number | - | Typescript:`TextareaValue` `type TextareaValue = string \| number`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/textarea/type.ts) | N
default-value | String / Number | undefined | uncontrolled property。Typescript:`TextareaValue` `type TextareaValue = string \| number`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/textarea/type.ts) | N

### Textarea Events

Expand All @@ -30,7 +41,16 @@ blur | `(value: TextareaValue, cursor: number)` | \-
change | `(value: TextareaValue, cursor: number)` | \-
enter | `(value: TextareaValue)` | \-
focus | `(value: TextareaValue)` | \-
keyboardheightchange | `(height: number, duration: number)` | \-
line-change | `(value: TextareaValue)` | \-
### Textarea External Classes

className | Description
-- | --
t-class | \-
t-class-indicator | \-
t-class-label | \-
t-class-textarea | \-

### CSS Variables

Expand All @@ -44,4 +64,4 @@ Name | Default Value | Description
--td-textarea-indicator-text-color | @font-gray-3 | -
--td-textarea-label-color | @font-gray-1 | -
--td-textarea-placeholder-color | @font-gray-3 | -
--td-textarea-text-color | @font-gray-1 | -
--td-textarea-text-color | @font-gray-1 | -
49 changes: 25 additions & 24 deletions src/textarea/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,32 +67,34 @@ isComponent: true

### Textarea Props

名称 | 类型 | 默认值 | 说明 | 必传
名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
adjust-position | Boolean | true | 键盘弹起时,是否自动上推页面 | N
autofocus | Boolean | false | 自动聚焦,拉起键盘 | N
autosize | Boolean / Object | false | 是否自动增高,值为 true 时,style.height 不生效。支持传入对象,如 { maxHeight: 120, minHeight: 20 } | N
autosize | Boolean / Object | false | 是否自动增高,值为 true 时,style.height 不生效。支持传入对象,如 { maxHeight: 120, minHeight: 20 }。TS 类型:`boolean \| { maxHeight?: number, minHeight?: number }` | N
bordered | Boolean | false | 是否显示外边框 | N
confirm-hold | Boolean | false | 点击键盘右下角按钮时是否保持键盘不收起点 | N
confirm-type | String | return | 设置键盘右下角按钮的文字,仅在 type='text'时生效。可选项:return/send/search/next/go/done。TS 类型:`'return' \| 'send' \| 'search' \| 'next' \| 'go' \| 'done'` | N
cursor | Number | -1 | 指定 focus 时的光标位置 | N
cursor-spacing | Number | 0 | 指定光标与键盘的距离。取textarea距离底部的距离和cursor-spacing指定的距离的最小值作为光标与键盘的距离 | N
disabled | Boolean | false | 是否禁用文本框 | N
disable-default-padding | Boolean | false | 是否去掉 iOS 下的默认内边距 | N
disabled | Boolean | undefined | 是否禁用文本框 | N
fixed | Boolean | false | 如果 textarea 是在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true | N
focus | Boolean | false | 自动聚焦 | N
label | String / Slot | - | 左侧文本 | N
maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度 | N
maxlength | Number | -1 | 用户最多可以输入的字符个数。默认为 -1,不限制输入长度 | N
hold-keyboard | Boolean | false | focus时,点击页面的时候不收起键盘 | N
indicator | Boolean | false | 显示文本计数器,如 0/140。当 `maxlength < 0 && maxcharacter < 0` 成立时, indicator无效 | N
label | String / Slot | - | 左侧文本。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度 | N
maxlength | String / Number | - | 用户最多可以输入的字符个数 | N
placeholder | String | undefined | 占位符 | N
placeholderStyle | String | '' | 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight | N
value | String | null | 文本框值 | N
default-value | String | '' | 文本框值。非受控属性 | N
fixed | Boolean | false | 如果 textarea 是在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true | N
bordered | Boolean | false | 是否显示外边框 | N
cursor | Number | -1 | 指定 focus 时的光标位置 | N
disable-default-padding | Boolean | false | 是否去掉 iOS 下的默认内边距 | N
show-confirm-bar | Boolean | true | 是否显示键盘上方带有”完成“按钮那一栏 | N
selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与 selection-end 搭配使用 | N
placeholder-style | String | - | 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight | N
selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 | N
hold-keyboard | Boolean | false | focus时,点击页面的时候不收起键盘 | N
selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与 selection-end 搭配使用 | N
show-confirm-bar | Boolean | true | 是否显示键盘上方带有”完成“按钮那一栏 | N
value | String / Number | - | 文本框值。TS 类型:`TextareaValue` `type TextareaValue = string \| number`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/textarea/type.ts) | N
default-value | String / Number | undefined | 文本框值。非受控属性。TS 类型:`TextareaValue` `type TextareaValue = string \| number`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/textarea/type.ts) | N

### Textarea Events

Expand All @@ -102,19 +104,18 @@ blur | `(value: TextareaValue, cursor: number)` | 失去焦点时触发
change | `(value: TextareaValue, cursor: number)` | 输入内容变化时触发
enter | `(value: TextareaValue)` | 点击完成时触发
focus | `(value: TextareaValue)` | 获得焦点时触发
line-change | `(value: TextareaValue)` | 行高发生变化时触发
keyboardheightchange | `(height: number, duration: number)` | 键盘高度发生变化的时候触发此事件
line-change | `(value: TextareaValue)` | 行高发生变化时触发
### Textarea External Classes

### Textarea 外部样式类

类名 | 说明
类名 | 描述
-- | --
t-class | 根节点样式类
t-class-textarea | 占位符样式类
t-class-label | 左侧文本样式类
t-class-indicator | 计数器样式类
t-class-label | 左侧文本样式类
t-class-textarea | 占位符样式类

### CSS 变量
### CSS Variables

组件提供了下列 CSS 变量,可用于自定义样式。
名称 | 默认值 | 描述
Expand All @@ -126,4 +127,4 @@ t-class-indicator | 计数器样式类
--td-textarea-indicator-text-color | @font-gray-3 | -
--td-textarea-label-color | @font-gray-1 | -
--td-textarea-placeholder-color | @font-gray-3 | -
--td-textarea-text-color | @font-gray-1 | -
--td-textarea-text-color | @font-gray-1 | -
109 changes: 53 additions & 56 deletions src/textarea/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ const props: TdTextareaProps = {
type: Boolean,
value: false,
},
/** 是否自动增高,值为 autosize 时,style.height 不生效 */
/** 是否自动增高,值为 true 时,style.height 不生效。支持传入对象,如 { maxHeight: 120, minHeight: 20 } */
autosize: {
type: null,
value: false,
},
/** 是否显示外边框 */
bordered: {
type: Boolean,
value: false,
},
/** 点击键盘右下角按钮时是否保持键盘不收起点 */
confirmHold: {
type: Boolean,
Expand All @@ -31,77 +36,80 @@ const props: TdTextareaProps = {
type: String,
value: 'return',
},
/** 指定 focus 时的光标位置 */
cursor: {
type: Number,
value: -1,
},
/** 指定光标与键盘的距离。取textarea距离底部的距离和cursor-spacing指定的距离的最小值作为光标与键盘的距离 */
cursorSpacing: {
type: Number,
value: 0,
},
/** 是否去掉 iOS 下的默认内边距 */
disableDefaultPadding: {
type: Boolean,
value: false,
},
/** 是否禁用文本框 */
disabled: {
type: null,
value: undefined,
},
/** 如果 textarea 是在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true */
fixed: {
type: Boolean,
value: false,
value: null,
},
/** 组件类名,分别用于表示组件外层元素、输入框、占位符、标签名等元素类名 */
externalClasses: {
type: Array,
/** 如果 textarea 是在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true,非受控属性 */
defaultFixed: {
type: Boolean,
value: false,
},
/** 自动聚焦 */
focus: {
type: Boolean,
value: false,
},
/** 左侧文本 */
label: {
type: String,
/** focus时,点击页面的时候不收起键盘 */
holdKeyboard: {
type: Boolean,
value: false,
},
/** 如果 textarea 是在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true */
fixed: {
/** 显示文本计数器,如 0/140。当 `maxlength < 0 && maxcharacter < 0` 成立时, indicator无效 */
indicator: {
type: Boolean,
value: false,
},
/** 左侧文本 */
label: {
type: String,
},
/** 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度 */
maxcharacter: {
type: Number,
},
/** 用户最多可以输入的字符个数。默认为 -1,不限制输入长度 */
/** 用户最多可以输入的字符个数 */
maxlength: {
type: Number,
value: -1,
type: null,
},
/** 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight */
/** 占位符 */
placeholder: {
type: String,
value: undefined,
},
/** 占位符样式 */
/** 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight */
placeholderStyle: {
type: String,
value: '',
},
/** 文本框值 */
value: {
type: String,
value: null,
},
/** 文本框值,非受控属性 */
defaultValue: {
type: String,
value: '',
},
/** 是否显示外边框 */
bordered: {
type: Boolean,
value: false,
},
/**
* 显示文本计数器,如 0/140。当 `maxlength < 0 && maxcharacter < 0` 成立时, indicator无效
*/
indicator: {
type: Boolean,
value: false,
/** 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 */
selectionEnd: {
type: Number,
value: -1,
},
/** 指定focus时的光标位置 */
cursor: {
/** 光标起始位置,自动聚集时有效,需与 selection-end 搭配使用 */
selectionStart: {
type: Number,
value: -1,
},
Expand All @@ -110,25 +118,14 @@ const props: TdTextareaProps = {
type: Boolean,
value: true,
},
/** 光标起始位置,自动聚集时有效,需与selection-end搭配使用 */
selectionStart: {
type: Number,
value: -1,
},
/** 光标结束位置,自动聚集时有效,需与selection-start搭配使用 */
selectionEnd: {
type: Number,
value: -1,
},
/** 是否去掉 iOS 下的默认内边距 */
disableDefaultPadding: {
type: Boolean,
value: false,
/** 文本框值 */
value: {
type: null,
value: null,
},
/** focus时,点击页面的时候不收起键盘 */
holdKeyboard: {
type: Boolean,
value: false,
/** 文本框值,非受控属性 */
defaultValue: {
type: null,
},
};

Expand Down
Loading

0 comments on commit 4595e0e

Please sign in to comment.