@mijadesign/nut-mcp 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -0
- package/dist/services/aliases.service.d.ts +1 -0
- package/dist/services/aliases.service.js +19 -0
- package/dist/services/doc-parser.service.d.ts +3 -0
- package/dist/services/doc-parser.service.js +162 -0
- package/dist/services/index.services.d.ts +3 -0
- package/dist/services/index.services.js +71 -0
- package/dist/services/paths.service.d.ts +5 -0
- package/dist/services/paths.service.js +18 -0
- package/dist/tools/base.tool.d.ts +8 -0
- package/dist/tools/base.tool.js +27 -0
- package/dist/tools/get-component-doc.tool.d.ts +12 -0
- package/dist/tools/get-component-doc.tool.js +40 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +4 -0
- package/dist/tools/list-components.tool.d.ts +8 -0
- package/dist/tools/list-components.tool.js +32 -0
- package/dist/tools/search-components.tool.d.ts +12 -0
- package/dist/tools/search-components.tool.js +61 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/index.js +1 -0
- package/docs/docs/aliases.json +59 -0
- package/docs/docs/components/base/button/index.md +415 -0
- package/docs/docs/components/base/cell/index.md +279 -0
- package/docs/docs/components/base/configprovider/index.md +215 -0
- package/docs/docs/components/base/image/index.md +282 -0
- package/docs/docs/components/base/overlay/index.md +288 -0
- package/docs/docs/components/dentry/cascader/index.md +1080 -0
- package/docs/docs/components/dentry/checkbox/index.md +842 -0
- package/docs/docs/components/dentry/datepicker/index.md +489 -0
- package/docs/docs/components/dentry/form/index.md +457 -0
- package/docs/docs/components/dentry/input/index.md +257 -0
- package/docs/docs/components/dentry/picker/index.md +621 -0
- package/docs/docs/components/dentry/radio/index.md +364 -0
- package/docs/docs/components/dentry/searchbar/index.md +317 -0
- package/docs/docs/components/dentry/selector/index.md +295 -0
- package/docs/docs/components/dentry/switch/index.md +300 -0
- package/docs/docs/components/dentry/textarea/index.md +231 -0
- package/docs/docs/components/dentry/uploader/index.md +745 -0
- package/docs/docs/components/exhibition/collapse/index.md +339 -0
- package/docs/docs/components/exhibition/swiper/index.md +385 -0
- package/docs/docs/components/exhibition/tag/index.md +253 -0
- package/docs/docs/components/feedback/dialog/index.md +306 -0
- package/docs/docs/components/feedback/drag/index.md +164 -0
- package/docs/docs/components/feedback/empty/index.md +211 -0
- package/docs/docs/components/feedback/infiniteloading/index.md +397 -0
- package/docs/docs/components/feedback/noticebar/index.md +175 -0
- package/docs/docs/components/feedback/popup/index.md +563 -0
- package/docs/docs/components/feedback/pulltorefresh/index.md +254 -0
- package/docs/docs/components/feedback/toast/index.md +355 -0
- package/docs/docs/components/layout/divider/index.md +162 -0
- package/docs/docs/components/layout/grid/index.md +386 -0
- package/docs/docs/components/layout/space/index.md +196 -0
- package/docs/docs/components/nav/tabs/index.md +955 -0
- package/docs/docs/components-index.json +233 -0
- package/package.json +34 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 26
|
|
3
|
+
demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/dentry/pages/textarea/index'
|
|
4
|
+
group:
|
|
5
|
+
title: 数据录入
|
|
6
|
+
order: 5
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# TextArea 文本域 <Badge>2.0.0</Badge>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
文本框内输入或编辑文字,支持限制输入数量。
|
|
13
|
+
|
|
14
|
+
## 引入
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { TextArea } from '@mijadesign/mjui-react-taro';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 示例代码
|
|
21
|
+
|
|
22
|
+
### 基础样式
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { TextArea } from '@mijadesign/mjui-react-taro'
|
|
27
|
+
import React from 'react'
|
|
28
|
+
|
|
29
|
+
const Demo1 = () => {
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<h4>通栏</h4>
|
|
33
|
+
<TextArea
|
|
34
|
+
align="left"
|
|
35
|
+
onChange={(value) => console.log('change', value)}
|
|
36
|
+
onBlur={() => console.log('blur')}
|
|
37
|
+
onFocus={() => console.log('focus')}
|
|
38
|
+
autoSize
|
|
39
|
+
underline
|
|
40
|
+
/>
|
|
41
|
+
<h4>卡片</h4>
|
|
42
|
+
<TextArea
|
|
43
|
+
align="left"
|
|
44
|
+
type="card"
|
|
45
|
+
underline={false}
|
|
46
|
+
onChange={(value) => console.log('change', value)}
|
|
47
|
+
onBlur={() => console.log('blur')}
|
|
48
|
+
onFocus={() => console.log('focus')}
|
|
49
|
+
autoSize
|
|
50
|
+
/>
|
|
51
|
+
</>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
export default Demo1
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 对齐方式
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import React from 'react'
|
|
63
|
+
import { TextArea } from '@mijadesign/mjui-react-taro'
|
|
64
|
+
|
|
65
|
+
const Demo8 = () => {
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<h4>左对齐</h4>
|
|
69
|
+
<TextArea align="left" underline />
|
|
70
|
+
<h4>右对齐</h4>
|
|
71
|
+
<TextArea underline />
|
|
72
|
+
</>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
export default Demo8
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 自定义字数限制
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import React from 'react'
|
|
84
|
+
import { ConfigProvider, TextArea } from '@mijadesign/mjui-react-taro'
|
|
85
|
+
|
|
86
|
+
const Demo5 = () => {
|
|
87
|
+
const customTheme = {
|
|
88
|
+
nutuiTextareaTextCurrorColor: `red`,
|
|
89
|
+
nutuiTextareaLimitColor: `red`,
|
|
90
|
+
}
|
|
91
|
+
return (
|
|
92
|
+
<ConfigProvider theme={customTheme}>
|
|
93
|
+
<TextArea align="left" underline showCount maxLength={30} />
|
|
94
|
+
</ConfigProvider>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
export default Demo5
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 自定义字数统计文本颜色
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import React from 'react'
|
|
106
|
+
import { TextArea } from '@mijadesign/mjui-react-taro'
|
|
107
|
+
|
|
108
|
+
const Demo9 = () => {
|
|
109
|
+
return (
|
|
110
|
+
<div style={{ '--nutui-color-text-help': 'red' }}>
|
|
111
|
+
<TextArea showCount maxLength={20} underline align="left" />
|
|
112
|
+
</div>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
export default Demo9
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 只读
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import React from 'react'
|
|
124
|
+
import { TextArea } from '@mijadesign/mjui-react-taro'
|
|
125
|
+
|
|
126
|
+
const Demo6 = () => {
|
|
127
|
+
return (
|
|
128
|
+
<>
|
|
129
|
+
<TextArea underline readOnly align="left" defaultValue="这是一段仅只读状态的文本内容" />
|
|
130
|
+
</>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
export default Demo6
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 禁用
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
import React from 'react'
|
|
142
|
+
import { TextArea } from '@mijadesign/mjui-react-taro'
|
|
143
|
+
|
|
144
|
+
const Demo7 = () => {
|
|
145
|
+
return (
|
|
146
|
+
<>
|
|
147
|
+
<TextArea underline disabled defaultValue="这是一段禁用状态的文本内容" align="left" />
|
|
148
|
+
</>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
export default Demo7
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 受控方式
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
import React, { useState } from 'react'
|
|
160
|
+
import { TextArea } from '@mijadesign/mjui-react-taro'
|
|
161
|
+
|
|
162
|
+
const Demo2 = () => {
|
|
163
|
+
const [value, setValue] = useState('')
|
|
164
|
+
return <TextArea underline value={value} onChange={(value) => setValue(value)} />
|
|
165
|
+
}
|
|
166
|
+
export default Demo2
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 显示字数统计
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import React from 'react'
|
|
175
|
+
import { TextArea } from '@mijadesign/mjui-react-taro'
|
|
176
|
+
|
|
177
|
+
const Demo3 = () => {
|
|
178
|
+
return <TextArea underline showCount maxLength={20} />
|
|
179
|
+
}
|
|
180
|
+
export default Demo3
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### 自定义行数,设置自动高度
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
import React from 'react'
|
|
189
|
+
import { TextArea } from '@mijadesign/mjui-react-taro'
|
|
190
|
+
|
|
191
|
+
const Demo4 = () => {
|
|
192
|
+
return <TextArea underline rows={1} autoSize />
|
|
193
|
+
}
|
|
194
|
+
export default Demo4
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## TextArea
|
|
199
|
+
|
|
200
|
+
### Props
|
|
201
|
+
|
|
202
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
203
|
+
| --- | --- | --- | --- |
|
|
204
|
+
| value | 输入框内容,受控 | `string` | `-` |
|
|
205
|
+
| defaultValue | 初始默认值,非受控 | `string` | `-` |
|
|
206
|
+
| placeholder | 设置占位提示文字 | `string` | `请输入内容` |
|
|
207
|
+
| maxLength | 限制最长输入字符,-1 表示无限制 | `number` | `140` |
|
|
208
|
+
| rows | textarea 的行数(仅支持H5) | `number` | `2` |
|
|
209
|
+
| align | textarea布局 | `left` \| `right` | `right` |
|
|
210
|
+
| showCount | textarea 是否展示输入字符。须配合`maxLength`使用 | `boolean` | `false` |
|
|
211
|
+
| autoSize | 高度是否可拉伸 | `boolean` | `false` |
|
|
212
|
+
| readOnly | 只读属性 | `boolean` | `false` |
|
|
213
|
+
| disabled | 禁用属性 | `boolean` | `false` |
|
|
214
|
+
| onChange | 输入内容时触发 | `(value) => void` | `-` |
|
|
215
|
+
| onFocus | 聚焦时触发 | `(event) => void` | `-` |
|
|
216
|
+
| onBlur | 失焦时触发 | `(event) => void` | `-` |
|
|
217
|
+
|
|
218
|
+
## 主题定制
|
|
219
|
+
|
|
220
|
+
### 样式变量
|
|
221
|
+
|
|
222
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
|
|
223
|
+
|
|
224
|
+
| 名称 | 说明 | 默认值 |
|
|
225
|
+
| --- | --- | --- |
|
|
226
|
+
| \--nutui-textarea-font | 字体大小 | `$font-size-2` |
|
|
227
|
+
| \--nutui-textarea-padding | 内边距 | `12px` |
|
|
228
|
+
| \--nutui-textarea-limit-color | 字数统计颜色 | `$color-text` |
|
|
229
|
+
| \--nutui-textarea-text-color | 文本颜色 | `$color-title` |
|
|
230
|
+
| \--nutui-textarea-text-curror-color | 光标颜色 | `$color-title` |
|
|
231
|
+
| \--nutui-textarea-disabled-color | 禁用颜色 | `$color-text-disabled` |
|