Skip to content

Commit

Permalink
feat(textarea): add readonly,allowInputOverMax props (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardji202 authored Jan 24, 2025
1 parent b216d55 commit 6a25616
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 6 deletions.
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
:: BASE_DOC ::

## API

### Textarea Props

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
allow-input-over-max | Boolean | false | \- | N
autofocus | Boolean | false | \- | N
autosize | Boolean / Object | false | Typescript:`boolean \| { maxHeight?: number, minHeight?: number }` | N
bordered | Boolean | false | \- | N
Expand All @@ -28,6 +28,7 @@ maxlength | Number | -1 | \- | N
placeholder | String | undefined | \- | N
placeholder-class | String | textarea-placeholder | \- | N
placeholder-style | String | - | \- | N
readonly | Boolean | undefined | \- | N
selection-end | Number | -1 | \- | N
selection-start | Number | -1 | \- | N
show-confirm-bar | Boolean | true | \- | N
Expand Down
3 changes: 2 additions & 1 deletion packages/products/tdesign-miniprogram/src/textarea/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
:: BASE_DOC ::

## API

### Textarea Props

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
adjust-position | Boolean | true | 键盘弹起时,是否自动上推页面 | N
allow-input-over-max | Boolean | false | 超出maxlength或maxcharacter之后是否还允许输入 | N
autofocus | Boolean | false | 自动聚焦,拉起键盘 | N
autosize | Boolean / Object | false | 是否自动增高,值为 true 时,style.height 不生效。支持传入对象,如 { maxHeight: 120, minHeight: 20 }。TS 类型:`boolean \| { maxHeight?: number, minHeight?: number }` | N
bordered | Boolean | false | 是否显示外边框 | N
Expand All @@ -28,6 +28,7 @@ maxlength | Number | -1 | 用户最多可以输入的字符个数,值为 -1
placeholder | String | undefined | 占位符 | N
placeholder-class | String | textarea-placeholder | 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight | N
placeholder-style | String | - | 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight | N
readonly | Boolean | undefined | 只读状态 | N
selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 | N
selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与 selection-end 搭配使用 | N
show-confirm-bar | Boolean | true | 是否显示键盘上方带有”完成“按钮那一栏 | N
Expand Down
10 changes: 10 additions & 0 deletions packages/products/tdesign-miniprogram/src/textarea/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ const props: TdTextareaProps = {
type: Boolean,
value: true,
},
/** 超出maxlength或maxcharacter之后是否还允许输入 */
allowInputOverMax: {
type: Boolean,
value: false,
},
/** 自动聚焦,拉起键盘 */
autofocus: {
type: Boolean,
Expand Down Expand Up @@ -104,6 +109,11 @@ const props: TdTextareaProps = {
type: String,
value: '',
},
/** 只读状态 */
readonly: {
type: null,
value: undefined,
},
/** 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 */
selectionEnd: {
type: Number,
Expand Down
15 changes: 15 additions & 0 deletions packages/products/tdesign-miniprogram/src/textarea/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ export interface TdTextareaProps {
type: BooleanConstructor;
value?: boolean;
};
/**
* 超出maxlength或maxcharacter之后是否还允许输入
* @default false
*/
allowInputOverMax?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 自动聚焦,拉起键盘
* @default false
Expand Down Expand Up @@ -161,6 +169,13 @@ export interface TdTextareaProps {
type: StringConstructor;
value?: string;
};
/**
* 只读状态
*/
readonly?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用
* @default -1
Expand Down
12 changes: 8 additions & 4 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -119892,7 +119892,8 @@
"4",
"8",
"16",
"32"
"32",
"64"
],
"component": "Textarea",
"field_category": 1,
Expand Down Expand Up @@ -119925,7 +119926,8 @@
"Angular(PC)",
"Vue(Mobile)",
"React(Mobile)",
"Angular(Mobile)"
"Angular(Mobile)",
"Miniprogram"
],
"field_type_text": [
"Boolean"
Expand Down Expand Up @@ -120898,7 +120900,8 @@
"4",
"8",
"16",
"32"
"32",
"64"
],
"component": "Textarea",
"field_category": 1,
Expand Down Expand Up @@ -120931,7 +120934,8 @@
"Angular(PC)",
"Vue(Mobile)",
"React(Mobile)",
"Angular(Mobile)"
"Angular(Mobile)",
"Miniprogram"
],
"field_type_text": [
"Boolean"
Expand Down

0 comments on commit 6a25616

Please sign in to comment.