Skip to content

Commit 0d75ec7

Browse files
committed
chore(textarea): generate api
1 parent 92d92ba commit 0d75ec7

File tree

4 files changed

+46
-34
lines changed

4 files changed

+46
-34
lines changed

src/textarea/README.en-US.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
## API
44

5+
56
### Textarea Props
67

78
name | type | default | description | required
89
-- | -- | -- | -- | --
910
style | Object | - | CSS(Cascading Style Sheets) | N
1011
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
1112
adjust-position | Boolean | true | \- | N
13+
allow-input-over-max | Boolean | false | \- | N
1214
autofocus | Boolean | false | \- | N
1315
autosize | Boolean / Object | false | Typescript:`boolean \| { maxHeight?: number, minHeight?: number }` | N
1416
bordered | Boolean | false | \- | N
@@ -26,7 +28,9 @@ label | String / Slot | - | [see more ts definition](https://github.com/Tencent/
2628
maxcharacter | Number | - | \- | N
2729
maxlength | Number | -1 | \- | N
2830
placeholder | String | undefined | \- | N
31+
placeholder-class | String | textarea-placeholder | \- | N
2932
placeholder-style | String | - | \- | N
33+
readonly | Boolean | undefined | \- | N
3034
selection-end | Number | -1 | \- | N
3135
selection-start | Number | -1 | \- | N
3236
show-confirm-bar | Boolean | true | \- | N

src/textarea/README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,12 @@ isComponent: true
4747

4848
{{ maxcharacter }}
4949

50-
允许超出最大字符个数
51-
52-
{{ allowInputOverMax }}
53-
5450
### 组件状态
5551

5652
禁用多行文本框
5753

5854
{{ disabled }}
5955

60-
多行文本框只读
61-
62-
{{ readonly }}
63-
6456
### 自定义组件样式
6557

6658
标签外置输入框
@@ -73,13 +65,15 @@ isComponent: true
7365

7466
## API
7567

68+
7669
### Textarea Props
7770

7871
名称 | 类型 | 默认值 | 描述 | 必传
7972
-- | -- | -- | -- | --
8073
style | Object | - | 样式 | N
8174
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
8275
adjust-position | Boolean | true | 键盘弹起时,是否自动上推页面 | N
76+
allow-input-over-max | Boolean | false | 超出maxlength或maxcharacter之后是否还允许输入 | N
8377
autofocus | Boolean | false | 自动聚焦,拉起键盘 | N
8478
autosize | Boolean / Object | false | 是否自动增高,值为 true 时,style.height 不生效。支持传入对象,如 { maxHeight: 120, minHeight: 20 }。TS 类型:`boolean \| { maxHeight?: number, minHeight?: number }` | N
8579
bordered | Boolean | false | 是否显示外边框 | N
@@ -89,17 +83,17 @@ cursor | Number | -1 | 指定 focus 时的光标位置 | N
8983
cursor-spacing | Number | 0 | 指定光标与键盘的距离。取textarea距离底部的距离和cursor-spacing指定的距离的最小值作为光标与键盘的距离 | N
9084
disable-default-padding | Boolean | false | 是否去掉 iOS 下的默认内边距 | N
9185
disabled | Boolean | undefined | 是否禁用文本框 | N
92-
readonly | Boolean | undefined | 是否只读 | N
9386
fixed | Boolean | false | 如果 textarea 是在一个 `position:fixed` 的区域,需要显式指定属性 fixed 为 true | N
9487
focus | Boolean | false | 自动聚焦 | N
9588
hold-keyboard | Boolean | false | focus时,点击页面的时候不收起键盘 | N
9689
indicator | Boolean | false | 显示文本计数器,如 0/140。当 `maxlength < 0 && maxcharacter < 0` 成立时, indicator无效 | N
9790
label | String / Slot | - | 左侧文本。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
9891
maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度 | N
9992
maxlength | Number | -1 | 用户最多可以输入的字符个数,值为 -1 的时候不限制最大长度 | N
100-
allowInputOverMax | Boolean | false | 是否允许超出最大字符数限制,默认不允许 | N
10193
placeholder | String | undefined | 占位符 | N
94+
placeholder-class | String | textarea-placeholder | 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight | N
10295
placeholder-style | String | - | 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight | N
96+
readonly | Boolean | undefined | 只读状态 | N
10397
selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 | N
10498
selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与 selection-end 搭配使用 | N
10599
show-confirm-bar | Boolean | true | 是否显示键盘上方带有”完成“按钮那一栏 | N
@@ -124,7 +118,7 @@ line-change | `(value: TextareaValue)` | 行高发生变化时触发
124118
t-class | 根节点样式类
125119
t-class-indicator | 计数器样式类
126120
t-class-label | 左侧文本样式类
127-
t-class-textarea | 占位符样式类
121+
t-class-textarea | 多行文本框样式类
128122

129123
### CSS Variables
130124

src/textarea/props.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ const props: TdTextareaProps = {
1111
type: Boolean,
1212
value: true,
1313
},
14+
/** 超出maxlength或maxcharacter之后是否还允许输入 */
15+
allowInputOverMax: {
16+
type: Boolean,
17+
value: false,
18+
},
1419
/** 自动聚焦,拉起键盘 */
1520
autofocus: {
1621
type: Boolean,
@@ -56,11 +61,6 @@ const props: TdTextareaProps = {
5661
type: null,
5762
value: undefined,
5863
},
59-
/** 是否只读状态 */
60-
readonly: {
61-
type: null,
62-
value: undefined,
63-
},
6464
/** 如果 textarea 是在一个 `position:fixed` 的区域,需要显式指定属性 fixed 为 true */
6565
fixed: {
6666
type: Boolean,
@@ -94,21 +94,26 @@ const props: TdTextareaProps = {
9494
type: Number,
9595
value: -1,
9696
},
97-
/** 是否允许超出最大字符数限制,默认不允许 */
98-
allowInputOverMax: {
99-
type: Boolean,
100-
value: false,
101-
},
10297
/** 占位符 */
10398
placeholder: {
10499
type: String,
105100
value: undefined,
106101
},
102+
/** 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight */
103+
placeholderClass: {
104+
type: String,
105+
value: 'textarea-placeholder',
106+
},
107107
/** 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight */
108108
placeholderStyle: {
109109
type: String,
110110
value: '',
111111
},
112+
/** 只读状态 */
113+
readonly: {
114+
type: null,
115+
value: undefined,
116+
},
112117
/** 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 */
113118
selectionEnd: {
114119
type: Number,

src/textarea/type.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ export interface TdTextareaProps {
1313
type: BooleanConstructor;
1414
value?: boolean;
1515
};
16+
/**
17+
* 超出maxlength或maxcharacter之后是否还允许输入
18+
* @default false
19+
*/
20+
allowInputOverMax?: {
21+
type: BooleanConstructor;
22+
value?: boolean;
23+
};
1624
/**
1725
* 自动聚焦,拉起键盘
1826
* @default false
@@ -84,13 +92,6 @@ export interface TdTextareaProps {
8492
type: BooleanConstructor;
8593
value?: boolean;
8694
};
87-
/**
88-
* 只读状态
89-
*/
90-
readonly?: {
91-
type: BooleanConstructor;
92-
value?: boolean;
93-
};
9495
/**
9596
* 如果 textarea 是在一个 `position:fixed` 的区域,需要显式指定属性 fixed 为 true
9697
* @default false
@@ -146,16 +147,17 @@ export interface TdTextareaProps {
146147
value?: number;
147148
};
148149
/**
149-
* 是否允许超出最大字符数限制
150+
* 占位符
150151
*/
151-
allowInputOverMax?: {
152-
type: BooleanConstructor;
153-
value?: boolean;
152+
placeholder?: {
153+
type: StringConstructor;
154+
value?: string;
154155
};
155156
/**
156-
* 占位符
157+
* 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight
158+
* @default textarea-placeholder
157159
*/
158-
placeholder?: {
160+
placeholderClass?: {
159161
type: StringConstructor;
160162
value?: string;
161163
};
@@ -167,6 +169,13 @@ export interface TdTextareaProps {
167169
type: StringConstructor;
168170
value?: string;
169171
};
172+
/**
173+
* 只读状态
174+
*/
175+
readonly?: {
176+
type: BooleanConstructor;
177+
value?: boolean;
178+
};
170179
/**
171180
* 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用
172181
* @default -1

0 commit comments

Comments
 (0)