@next-bricks/form 1.21.11 → 1.21.13
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/dist/bricks.json +35 -35
- package/dist/chunks/2537.be4cf82c.js.map +1 -1
- package/dist/chunks/845.2f598dd9.js +3 -0
- package/dist/chunks/845.2f598dd9.js.map +1 -0
- package/dist/chunks/{9949.753e2720.js → 9949.3d28a915.js} +3 -3
- package/dist/chunks/9949.3d28a915.js.map +1 -0
- package/dist/chunks/eo-auto-complete.0ed854e4.js.map +1 -1
- package/dist/chunks/eo-checkbox.2d0a8dbc.js.map +1 -1
- package/dist/chunks/eo-color-picker.ecf0c4c0.js.map +1 -1
- package/dist/chunks/eo-date-picker.faa60507.js.map +1 -1
- package/dist/chunks/eo-dynamic-form-item.aa5f7d9e.js.map +1 -1
- package/dist/chunks/eo-form.9db78cdb.js.map +1 -1
- package/dist/chunks/eo-icon-select.6a7f7e12.js +3 -0
- package/dist/chunks/eo-icon-select.6a7f7e12.js.map +1 -0
- package/dist/chunks/eo-radio.b2ed57db.js.map +1 -1
- package/dist/chunks/eo-search.206dd65e.js.map +1 -1
- package/dist/chunks/eo-select.cd00c791.js.map +1 -1
- package/dist/chunks/eo-switch.f0a27c08.js.map +1 -1
- package/dist/chunks/eo-textarea.405851dd.js.map +1 -1
- package/dist/chunks/eo-time-picker.46e7a667.js.map +1 -1
- package/dist/chunks/eo-time-range-picker.5afbad69.js.map +1 -1
- package/dist/chunks/eo-upload-file.27a4288d.js.map +1 -1
- package/dist/chunks/eo-upload-image.b43c2329.js.map +1 -1
- package/dist/chunks/{main.8c394d3e.js → main.59f7a796.js} +2 -2
- package/dist/chunks/{main.8c394d3e.js.map → main.59f7a796.js.map} +1 -1
- package/dist/examples.json +27 -24
- package/dist/index.2c92cf90.js +2 -0
- package/dist/{index.7917bac6.js.map → index.2c92cf90.js.map} +1 -1
- package/dist/manifest.json +451 -385
- package/dist/types.json +2699 -2649
- package/dist-types/auto-complete/index.d.ts +4 -0
- package/dist-types/checkbox/index.d.ts +2 -2
- package/dist-types/color-picker/index.d.ts +2 -1
- package/dist-types/date-picker/index.d.ts +1 -1
- package/dist-types/form/index.d.ts +16 -1
- package/dist-types/form-item/index.d.ts +31 -2
- package/dist-types/general-switch/index.d.ts +1 -1
- package/dist-types/icon-select/index.d.ts +1 -1
- package/dist-types/input/index.d.ts +2 -2
- package/dist-types/radio/index.d.ts +4 -4
- package/dist-types/select/index.d.ts +1 -0
- package/dist-types/textarea/index.d.ts +1 -1
- package/dist-types/time-range-picker/index.d.ts +7 -4
- package/dist-types/upload/upload-file/index.d.ts +1 -1
- package/docs/eo-auto-complete.md +158 -8
- package/docs/eo-auto-complete.react.md +229 -0
- package/docs/eo-checkbox.md +107 -4
- package/docs/eo-checkbox.react.md +369 -0
- package/docs/eo-color-picker.md +102 -22
- package/docs/eo-color-picker.react.md +160 -0
- package/docs/eo-date-picker.md +82 -50
- package/docs/eo-date-picker.react.md +146 -0
- package/docs/eo-dynamic-form-item.md +60 -15
- package/docs/eo-dynamic-form-item.react.md +186 -0
- package/docs/eo-form-item.md +194 -0
- package/docs/eo-form-item.react.md +163 -0
- package/docs/eo-form.md +144 -3
- package/docs/eo-form.react.md +330 -0
- package/docs/eo-icon-select.md +80 -1
- package/docs/eo-icon-select.react.md +97 -0
- package/docs/eo-input.md +147 -22
- package/docs/eo-input.react.md +275 -0
- package/docs/eo-radio.md +145 -8
- package/docs/eo-radio.react.md +492 -0
- package/docs/eo-search.md +94 -1
- package/docs/eo-search.react.md +122 -0
- package/docs/eo-select.md +157 -9
- package/docs/eo-select.react.md +411 -0
- package/docs/eo-submit-buttons.md +120 -7
- package/docs/eo-submit-buttons.react.md +129 -0
- package/docs/eo-switch.md +57 -3
- package/docs/eo-switch.react.md +136 -0
- package/docs/eo-textarea.md +101 -22
- package/docs/eo-textarea.react.md +193 -0
- package/docs/eo-time-picker.md +70 -42
- package/docs/eo-time-picker.react.md +106 -0
- package/docs/eo-time-range-picker.md +89 -35
- package/docs/eo-time-range-picker.react.md +163 -0
- package/docs/eo-upload-file.md +101 -9
- package/docs/eo-upload-file.react.md +126 -0
- package/docs/eo-upload-image.md +70 -6
- package/docs/eo-upload-image.react.md +92 -0
- package/package.json +2 -2
- package/dist/chunks/845.c8b5b1e8.js +0 -3
- package/dist/chunks/845.c8b5b1e8.js.map +0 -1
- package/dist/chunks/9949.753e2720.js.map +0 -1
- package/dist/chunks/eo-icon-select.6ea15888.js +0 -3
- package/dist/chunks/eo-icon-select.6ea15888.js.map +0 -1
- package/dist/index.7917bac6.js +0 -2
- /package/dist/chunks/{845.c8b5b1e8.js.LICENSE.txt → 845.2f598dd9.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{9949.753e2720.js.LICENSE.txt → 9949.3d28a915.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-icon-select.6ea15888.js.LICENSE.txt → eo-icon-select.6a7f7e12.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-select
|
|
3
|
+
displayName: WrappedEoSelect
|
|
4
|
+
description: 通用下拉选择构件
|
|
5
|
+
category: form-input-basic
|
|
6
|
+
source: "@next-bricks/form"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# WrappedEoSelect
|
|
10
|
+
|
|
11
|
+
> 通用下拉选择构件
|
|
12
|
+
|
|
13
|
+
## 导入
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { WrappedEoSelect } from "@easyops/wrapped-components";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
22
|
+
| ------------------- | ------------------------------------ | ---- | ------ | ---------------------------------------------------------------------------------------------- |
|
|
23
|
+
| name | `string` | - | - | 字段名称 |
|
|
24
|
+
| placeholder | `string` | - | - | 占位说明 |
|
|
25
|
+
| label | `string` | - | - | 字段文本 |
|
|
26
|
+
| options | `GeneralComplexOption[]` | 是 | - | 选项列表 |
|
|
27
|
+
| value | `any` | - | - | 值 |
|
|
28
|
+
| required | `boolean` | - | - | 是否必填 |
|
|
29
|
+
| message | `Record<string, string>` | - | - | 校验文本信息 |
|
|
30
|
+
| disabled | `boolean` | - | - | 是否禁用 |
|
|
31
|
+
| mode | `"tags" \| "multiple"` | - | - | 类型 |
|
|
32
|
+
| tokenSeparators | `string[]` | - | - | 自动分词的分隔符,仅在 mode="tags" 时生效 |
|
|
33
|
+
| maxTagCount | `number` | - | - | 最多显示多少个 tag, 剩余的 tag 将被隐藏 |
|
|
34
|
+
| groupBy | `string` | - | - | 分组字段 |
|
|
35
|
+
| suffix | `{ useBrick: UseSingleBrickConf }` | - | - | 后缀内容,使用 useBrick 在选项及选中值旁显示额外信息 |
|
|
36
|
+
| clearable | `boolean` | - | `true` | 是否支持清除 |
|
|
37
|
+
| fields | `{ label?: string; value?: string }` | - | - | 列表指定字段作为 label 和 value |
|
|
38
|
+
| useBackend | `UseBackendConf` | - | - | 后端搜索 |
|
|
39
|
+
| debounceSearchDelay | `number` | - | - | 设置时,同时对 useBackend 和 onSearch 事件进行防抖。未设置时,useBackend 有默认的 300ms 防抖。 |
|
|
40
|
+
| inputStyle | `React.CSSProperties` | - | - | 输入框样式 |
|
|
41
|
+
| dropdownStyle | `React.CSSProperties` | - | - | 下拉框样式 |
|
|
42
|
+
| dropdownHoist | `boolean` | - | - | 下拉框是否使用固定定位防止内容被裁切 |
|
|
43
|
+
| themeVariant | `"default" \| "elevo"` | - | - | 主题变体 |
|
|
44
|
+
|
|
45
|
+
## Events
|
|
46
|
+
|
|
47
|
+
| 事件 | detail | 说明 |
|
|
48
|
+
| --------------- | ------------------------------------------------------------------------ | --------------------------------- |
|
|
49
|
+
| onChange | `ChangeEventDetail` — { value: 选中的值, options: 对应选项列表 } | 下拉选择事件 |
|
|
50
|
+
| onChangeV2 | `string \| string[]` — 选中的值 | 下拉选择事件 v2(仅传递选中的值) |
|
|
51
|
+
| onSearch | `SearchEventDetail` — { value: 当前输入的搜索词 } | 下拉框search事件 |
|
|
52
|
+
| onSelectFocus | - | 下拉框focus事件 |
|
|
53
|
+
| onOptionsChange | `OptionsChangeEventDetail` — { options: 最新的选项列表, name: 字段名称 } | 选项列表变化事件 |
|
|
54
|
+
|
|
55
|
+
## Examples
|
|
56
|
+
|
|
57
|
+
### Basic
|
|
58
|
+
|
|
59
|
+
基本用法,展示简单的下拉选择框。
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<WrappedEoSelect options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]} />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Label
|
|
66
|
+
|
|
67
|
+
设置 label 属性为下拉框添加字段说明。
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
<WrappedEoSelect
|
|
71
|
+
label="city"
|
|
72
|
+
options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
|
|
73
|
+
/>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Value
|
|
77
|
+
|
|
78
|
+
设置 value 属性指定默认选中项。
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
<WrappedEoSelect
|
|
82
|
+
label="city"
|
|
83
|
+
value="Shanghai"
|
|
84
|
+
options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
|
|
85
|
+
/>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Options
|
|
89
|
+
|
|
90
|
+
多种选项格式:字符串数组、对象数组和布尔值数组。
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
<>
|
|
94
|
+
<WrappedEoSelect
|
|
95
|
+
label="string"
|
|
96
|
+
options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
|
|
97
|
+
value="Guangzhou"
|
|
98
|
+
/>
|
|
99
|
+
<div style={{ height: "20px" }} />
|
|
100
|
+
<WrappedEoSelect
|
|
101
|
+
label="Array<object>"
|
|
102
|
+
options={[
|
|
103
|
+
{ label: "Beijing", value: 0 },
|
|
104
|
+
{ label: "Shanghai", value: 1 },
|
|
105
|
+
{ label: "Guangzhou", value: 2 },
|
|
106
|
+
{ label: "Shenzhen", value: 3 },
|
|
107
|
+
]}
|
|
108
|
+
value={2}
|
|
109
|
+
/>
|
|
110
|
+
<div style={{ height: "20px" }} />
|
|
111
|
+
<WrappedEoSelect label="boolean" options={[true, false]} />
|
|
112
|
+
</>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Disabled
|
|
116
|
+
|
|
117
|
+
禁用单个选项或整体禁用下拉框。
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<>
|
|
121
|
+
<WrappedEoSelect
|
|
122
|
+
options={[
|
|
123
|
+
{ label: "Beijing", value: 0, disabled: true },
|
|
124
|
+
{ label: "Shanghai", value: 1 },
|
|
125
|
+
{ label: "Guangzhou", value: 2 },
|
|
126
|
+
{ label: "Shenzhen", value: 3 },
|
|
127
|
+
]}
|
|
128
|
+
/>
|
|
129
|
+
<WrappedEoSelect
|
|
130
|
+
disabled={true}
|
|
131
|
+
options={[
|
|
132
|
+
{ label: "Beijing", value: 0 },
|
|
133
|
+
{ label: "Shanghai", value: 1 },
|
|
134
|
+
{ label: "Guangzhou", value: 2 },
|
|
135
|
+
{ label: "Shenzhen", value: 3 },
|
|
136
|
+
]}
|
|
137
|
+
/>
|
|
138
|
+
</>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Multiple
|
|
142
|
+
|
|
143
|
+
多选模式,支持同时选择多个选项。
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
<WrappedEoSelect
|
|
147
|
+
label="multiple"
|
|
148
|
+
mode="multiple"
|
|
149
|
+
value={["Beijing", "Guangzhou"]}
|
|
150
|
+
options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
|
|
151
|
+
/>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Tags
|
|
155
|
+
|
|
156
|
+
标签模式,支持自定义输入新标签、自动分词和最大标签数限制。
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
<WrappedEoSelect
|
|
160
|
+
label="tags"
|
|
161
|
+
mode="tags"
|
|
162
|
+
tokenSeparators={[" ", ";", ";"]}
|
|
163
|
+
maxTagCount={3}
|
|
164
|
+
options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
|
|
165
|
+
/>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Placeholder
|
|
169
|
+
|
|
170
|
+
设置 placeholder 占位说明。
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
<WrappedEoSelect
|
|
174
|
+
placeholder="This is placeholder..."
|
|
175
|
+
options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
|
|
176
|
+
/>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Suffix
|
|
180
|
+
|
|
181
|
+
使用 suffix 的 useBrick 在选项旁显示额外信息。
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
<WrappedEoSelect
|
|
185
|
+
placeholder="This is placeholder..."
|
|
186
|
+
options={[
|
|
187
|
+
{ label: "Beijing", value: 1, color: "red", tag: "京" },
|
|
188
|
+
{ label: "Shanghai", value: 2, color: "green", tag: "沪" },
|
|
189
|
+
{ label: "Guangzhou", value: 3, color: "blue", tag: "粤" },
|
|
190
|
+
{ label: "Shenzhen", value: 4, color: "yellow", tag: "粤" },
|
|
191
|
+
]}
|
|
192
|
+
suffix={{
|
|
193
|
+
useBrick: {
|
|
194
|
+
brick: "eo-tag",
|
|
195
|
+
properties: {
|
|
196
|
+
textContent: "<% DATA.tag %>",
|
|
197
|
+
color: "<% DATA.color %>",
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
}}
|
|
201
|
+
/>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### GroupBy
|
|
205
|
+
|
|
206
|
+
使用 groupBy 属性按指定字段对选项进行分组展示。
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
<WrappedEoSelect
|
|
210
|
+
placeholder="This is placeholder..."
|
|
211
|
+
groupBy="tag"
|
|
212
|
+
options={[
|
|
213
|
+
{ label: "Beijing", value: 1, color: "red", tag: "京" },
|
|
214
|
+
{ label: "Shanghai", value: 2, color: "green", tag: "沪" },
|
|
215
|
+
{ label: "Guangzhou", value: 3, color: "blue", tag: "粤" },
|
|
216
|
+
{ label: "Shenzhen", value: 4, color: "yellow", tag: "粤" },
|
|
217
|
+
]}
|
|
218
|
+
/>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Caption
|
|
222
|
+
|
|
223
|
+
使用 caption 展示下拉候选项说明文案。
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
<WrappedEoSelect
|
|
227
|
+
placeholder="This is placeholder..."
|
|
228
|
+
options={[
|
|
229
|
+
{ caption: "如nginx、api_gateway等", label: "接入层", value: "接入层" },
|
|
230
|
+
{ caption: "如DB等", label: "数据层", value: "数据层" },
|
|
231
|
+
{ caption: "如业务逻辑组件", label: "业务层", value: "业务层" },
|
|
232
|
+
{ caption: "如平台通用组件", label: "中台层", value: "中台层" },
|
|
233
|
+
]}
|
|
234
|
+
/>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Fields
|
|
238
|
+
|
|
239
|
+
使用 fields 属性指定选项列表中哪些字段作为 label 和 value。
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
<WrappedEoSelect
|
|
243
|
+
placeholder="This is placeholder..."
|
|
244
|
+
fields={{ label: "name", value: "city" }}
|
|
245
|
+
value={3}
|
|
246
|
+
options={[
|
|
247
|
+
{ name: "Beijing", city: 1, color: "red", tag: "京" },
|
|
248
|
+
{ name: "Shanghai", city: 2, color: "green", tag: "沪" },
|
|
249
|
+
{ name: "Guangzhou", city: 3, color: "blue", tag: "粤" },
|
|
250
|
+
{ name: "Shenzhen", city: 4, color: "yellow", tag: "粤" },
|
|
251
|
+
]}
|
|
252
|
+
/>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### UseBackend
|
|
256
|
+
|
|
257
|
+
使用后端搜索从远程接口获取选项数据。
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
<WrappedEoSelect
|
|
261
|
+
label="useBackend"
|
|
262
|
+
placeholder="后端搜索"
|
|
263
|
+
value="Shenzhen"
|
|
264
|
+
useBackend={{
|
|
265
|
+
provider: "basic.http-request",
|
|
266
|
+
transform: (data: any) => data,
|
|
267
|
+
onValueChangeArgs: [
|
|
268
|
+
(q: string) => `//api.weatherapi.com/v1/search.json?q=${q}&key=YOUR_KEY`,
|
|
269
|
+
],
|
|
270
|
+
args: [
|
|
271
|
+
(q: string) =>
|
|
272
|
+
`//api.weatherapi.com/v1/search.json?q=${q ? q : "China"}&key=YOUR_KEY`,
|
|
273
|
+
],
|
|
274
|
+
}}
|
|
275
|
+
fields={{ label: "name", value: "name" }}
|
|
276
|
+
suffix={{
|
|
277
|
+
useBrick: {
|
|
278
|
+
brick: "eo-tag",
|
|
279
|
+
properties: {
|
|
280
|
+
textContent: "<% DATA.country %>",
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
}}
|
|
284
|
+
/>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Input Style
|
|
288
|
+
|
|
289
|
+
使用 inputStyle 自定义输入框样式。
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
<WrappedEoSelect
|
|
293
|
+
inputStyle={{ width: "180px" }}
|
|
294
|
+
options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
|
|
295
|
+
/>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Dropdown Style And Hoist
|
|
299
|
+
|
|
300
|
+
使用 dropdownStyle 自定义下拉框样式,dropdownHoist 使用固定定位防止内容被裁切。
|
|
301
|
+
|
|
302
|
+
```tsx
|
|
303
|
+
<WrappedEoSelect
|
|
304
|
+
label="自定义下拉框样式"
|
|
305
|
+
dropdownStyle={{ maxHeight: "150px" }}
|
|
306
|
+
dropdownHoist={true}
|
|
307
|
+
options={[
|
|
308
|
+
"Beijing",
|
|
309
|
+
"Shanghai",
|
|
310
|
+
"Guangzhou",
|
|
311
|
+
"Shenzhen",
|
|
312
|
+
"Hangzhou",
|
|
313
|
+
"Chengdu",
|
|
314
|
+
]}
|
|
315
|
+
/>
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Clearable
|
|
319
|
+
|
|
320
|
+
设置 clearable 为 false 禁用清除按钮。
|
|
321
|
+
|
|
322
|
+
```tsx
|
|
323
|
+
<WrappedEoSelect
|
|
324
|
+
label="不可清除"
|
|
325
|
+
clearable={false}
|
|
326
|
+
value="Beijing"
|
|
327
|
+
options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
|
|
328
|
+
/>
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### themeVariant
|
|
332
|
+
|
|
333
|
+
设置主题变体为 elevo 风格。
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
<WrappedEoSelect
|
|
337
|
+
themeVariant="elevo"
|
|
338
|
+
label="Elevo 风格"
|
|
339
|
+
options={["Beijing", "Shanghai", "Guangzhou"]}
|
|
340
|
+
value="Beijing"
|
|
341
|
+
/>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Event
|
|
345
|
+
|
|
346
|
+
监听 onChange、onChangeV2、onSearch、onSelectFocus 和 onOptionsChange 事件。
|
|
347
|
+
|
|
348
|
+
```tsx
|
|
349
|
+
function SelectEventDemo() {
|
|
350
|
+
const [options, setOptions] = useState([
|
|
351
|
+
"Beijing",
|
|
352
|
+
"Shanghai",
|
|
353
|
+
"Guangzhou",
|
|
354
|
+
"Shenzhen",
|
|
355
|
+
]);
|
|
356
|
+
|
|
357
|
+
return (
|
|
358
|
+
<>
|
|
359
|
+
<WrappedEoSelect
|
|
360
|
+
label="Single"
|
|
361
|
+
debounceSearchDelay={500}
|
|
362
|
+
options={options}
|
|
363
|
+
onChange={(e) => console.log("change:", e.detail)}
|
|
364
|
+
onChangeV2={(e) => console.log("change.v2:", e.detail)}
|
|
365
|
+
onSearch={(e) => console.log("search:", e.detail)}
|
|
366
|
+
onSelectFocus={() => console.log("select focused")}
|
|
367
|
+
onOptionsChange={(e) => console.log("options.change:", e.detail)}
|
|
368
|
+
/>
|
|
369
|
+
<WrappedEoSelect
|
|
370
|
+
label="Multiple"
|
|
371
|
+
mode="multiple"
|
|
372
|
+
options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
|
|
373
|
+
onChange={(e) => console.log("change:", e.detail)}
|
|
374
|
+
/>
|
|
375
|
+
<WrappedEoButton
|
|
376
|
+
textContent="Click to change options"
|
|
377
|
+
onClick={() =>
|
|
378
|
+
setOptions([
|
|
379
|
+
"Beijing",
|
|
380
|
+
"Shanghai",
|
|
381
|
+
"Guangzhou",
|
|
382
|
+
"Shenzhen",
|
|
383
|
+
"Hangzhou",
|
|
384
|
+
])
|
|
385
|
+
}
|
|
386
|
+
/>
|
|
387
|
+
<div style={{ height: "20px" }} />
|
|
388
|
+
</>
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### With Form
|
|
394
|
+
|
|
395
|
+
在表单中使用下拉选择框,支持 required 校验和 message 自定义校验文本。
|
|
396
|
+
|
|
397
|
+
```tsx
|
|
398
|
+
<WrappedEoForm
|
|
399
|
+
onValidateSuccess={(e) => console.log(e.detail)}
|
|
400
|
+
onValuesChange={(e) => console.log(e.detail)}
|
|
401
|
+
>
|
|
402
|
+
<WrappedEoSelect
|
|
403
|
+
options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
|
|
404
|
+
label="选择框"
|
|
405
|
+
name="select"
|
|
406
|
+
required={true}
|
|
407
|
+
message={{ required: "请选择一个选项" }}
|
|
408
|
+
/>
|
|
409
|
+
<WrappedEoSubmitButtons />
|
|
410
|
+
</WrappedEoForm>
|
|
411
|
+
```
|
|
@@ -1,14 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-submit-buttons
|
|
3
|
+
displayName: WrappedEoSubmitButtons
|
|
4
|
+
description: 表单提交按钮
|
|
5
|
+
category: form-input-basic
|
|
6
|
+
source: "@next-bricks/form"
|
|
7
|
+
---
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
# eo-submit-buttons
|
|
10
|
+
|
|
11
|
+
> 表单提交按钮
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
16
|
+
| ----------------- | ---------------------- | ---- | -------- | -------------------------------------- |
|
|
17
|
+
| submitText | `string` | 是 | `"提交"` | 提交按钮的文字 |
|
|
18
|
+
| cancelText | `string` | 否 | - | 取消按钮的文字,不设置则不显示取消按钮 |
|
|
19
|
+
| disableAfterClick | `boolean` | 否 | - | 点击确定按钮后自动禁用 |
|
|
20
|
+
| submitDisabled | `boolean` | 否 | - | 禁用提交按钮 |
|
|
21
|
+
| submitType | `ButtonType` | 否 | - | 提交按钮类型 |
|
|
22
|
+
| cancelType | `ButtonType` | 否 | - | 取消按钮类型 |
|
|
23
|
+
| themeVariant | `"default" \| "elevo"` | 否 | - | 主题变体 |
|
|
24
|
+
|
|
25
|
+
## Events
|
|
26
|
+
|
|
27
|
+
| 事件 | detail | 说明 |
|
|
28
|
+
| ------ | ------ | ---------------------- |
|
|
29
|
+
| submit | `void` | 点击提交按钮触发的事件 |
|
|
30
|
+
| cancel | `void` | 点击取消按钮触发的事件 |
|
|
7
31
|
|
|
8
32
|
## Examples
|
|
9
33
|
|
|
10
34
|
### Basic
|
|
11
35
|
|
|
36
|
+
展示提交按钮与取消按钮的基本用法,并监听点击事件。
|
|
37
|
+
|
|
12
38
|
```yaml preview
|
|
13
39
|
- brick: eo-submit-buttons
|
|
14
40
|
properties:
|
|
@@ -25,7 +51,9 @@
|
|
|
25
51
|
- Cancel
|
|
26
52
|
```
|
|
27
53
|
|
|
28
|
-
### Button
|
|
54
|
+
### Button Types
|
|
55
|
+
|
|
56
|
+
通过 submitType 和 cancelType 自定义按钮的样式类型。
|
|
29
57
|
|
|
30
58
|
```yaml preview
|
|
31
59
|
- brick: eo-submit-buttons
|
|
@@ -36,7 +64,9 @@
|
|
|
36
64
|
cancelType: default
|
|
37
65
|
```
|
|
38
66
|
|
|
39
|
-
### Disable
|
|
67
|
+
### Disable Submit Button
|
|
68
|
+
|
|
69
|
+
展示 submitDisabled 禁用提交按钮的效果。
|
|
40
70
|
|
|
41
71
|
```yaml preview
|
|
42
72
|
- brick: eo-submit-buttons
|
|
@@ -45,3 +75,86 @@
|
|
|
45
75
|
cancelText: Cancel
|
|
46
76
|
submitDisabled: true
|
|
47
77
|
```
|
|
78
|
+
|
|
79
|
+
### Disable After Click
|
|
80
|
+
|
|
81
|
+
演示 disableAfterClick 在点击提交后自动禁用按钮,防止重复提交。
|
|
82
|
+
|
|
83
|
+
```yaml preview
|
|
84
|
+
- brick: eo-submit-buttons
|
|
85
|
+
properties:
|
|
86
|
+
submitText: 提交
|
|
87
|
+
cancelText: 取消
|
|
88
|
+
disableAfterClick: true
|
|
89
|
+
events:
|
|
90
|
+
submit:
|
|
91
|
+
- action: message.success
|
|
92
|
+
args:
|
|
93
|
+
- 已提交,按钮已禁用
|
|
94
|
+
cancel:
|
|
95
|
+
- action: message.info
|
|
96
|
+
args:
|
|
97
|
+
- 已取消
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Theme Variant Elevo
|
|
101
|
+
|
|
102
|
+
展示 Elevo 主题变体下提交按钮的样式。
|
|
103
|
+
|
|
104
|
+
```yaml preview
|
|
105
|
+
- brick: eo-submit-buttons
|
|
106
|
+
properties:
|
|
107
|
+
submitText: 提交
|
|
108
|
+
cancelText: 取消
|
|
109
|
+
themeVariant: elevo
|
|
110
|
+
submitType: primary
|
|
111
|
+
cancelType: default
|
|
112
|
+
events:
|
|
113
|
+
submit:
|
|
114
|
+
- action: message.success
|
|
115
|
+
args:
|
|
116
|
+
- 提交成功
|
|
117
|
+
cancel:
|
|
118
|
+
- action: message.info
|
|
119
|
+
args:
|
|
120
|
+
- 已取消
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### In Form
|
|
124
|
+
|
|
125
|
+
与 eo-form 搭配使用,演示完整的表单提交流程。
|
|
126
|
+
|
|
127
|
+
```yaml preview
|
|
128
|
+
- brick: eo-form
|
|
129
|
+
events:
|
|
130
|
+
validate.success:
|
|
131
|
+
- action: message.success
|
|
132
|
+
args:
|
|
133
|
+
- 表单提交成功
|
|
134
|
+
validate.error:
|
|
135
|
+
- action: message.error
|
|
136
|
+
args:
|
|
137
|
+
- 表单校验失败
|
|
138
|
+
slots:
|
|
139
|
+
"":
|
|
140
|
+
bricks:
|
|
141
|
+
- brick: eo-input
|
|
142
|
+
properties:
|
|
143
|
+
required: true
|
|
144
|
+
name: name
|
|
145
|
+
label: 姓名
|
|
146
|
+
- brick: eo-select
|
|
147
|
+
properties:
|
|
148
|
+
required: true
|
|
149
|
+
name: city
|
|
150
|
+
label: 城市
|
|
151
|
+
options:
|
|
152
|
+
- label: 北京
|
|
153
|
+
value: beijing
|
|
154
|
+
- label: 上海
|
|
155
|
+
value: shanghai
|
|
156
|
+
- brick: eo-submit-buttons
|
|
157
|
+
properties:
|
|
158
|
+
submitText: 提交
|
|
159
|
+
cancelText: 取消
|
|
160
|
+
```
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-submit-buttons
|
|
3
|
+
displayName: WrappedEoSubmitButtons
|
|
4
|
+
description: 表单提交按钮
|
|
5
|
+
category: form-input-basic
|
|
6
|
+
source: "@next-bricks/form"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# WrappedEoSubmitButtons
|
|
10
|
+
|
|
11
|
+
> 表单提交按钮
|
|
12
|
+
|
|
13
|
+
## 导入
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { WrappedEoSubmitButtons } from "@easyops/wrapped-components";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
22
|
+
| ----------------- | ---------------------- | ---- | -------- | -------------------------------------- |
|
|
23
|
+
| submitText | `string` | 是 | `"提交"` | 提交按钮的文字 |
|
|
24
|
+
| cancelText | `string` | 否 | - | 取消按钮的文字,不设置则不显示取消按钮 |
|
|
25
|
+
| disableAfterClick | `boolean` | 否 | - | 点击确定按钮后自动禁用 |
|
|
26
|
+
| submitDisabled | `boolean` | 否 | - | 禁用提交按钮 |
|
|
27
|
+
| submitType | `ButtonType` | 否 | - | 提交按钮类型 |
|
|
28
|
+
| cancelType | `ButtonType` | 否 | - | 取消按钮类型 |
|
|
29
|
+
| themeVariant | `"default" \| "elevo"` | 否 | - | 主题变体 |
|
|
30
|
+
|
|
31
|
+
## Events
|
|
32
|
+
|
|
33
|
+
| 事件 | detail | 说明 |
|
|
34
|
+
| -------- | ------ | ---------------------- |
|
|
35
|
+
| onSubmit | `void` | 点击提交按钮触发的事件 |
|
|
36
|
+
| onCancel | `void` | 点击取消按钮触发的事件 |
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
### Basic
|
|
41
|
+
|
|
42
|
+
展示提交按钮与取消按钮的基本用法,并监听点击事件。
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<WrappedEoSubmitButtons
|
|
46
|
+
submitText="Submit"
|
|
47
|
+
cancelText="Cancel"
|
|
48
|
+
onSubmit={() => console.log("Submit")}
|
|
49
|
+
onCancel={() => console.log("Cancel")}
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Button Types
|
|
54
|
+
|
|
55
|
+
通过 submitType 和 cancelType 自定义按钮的样式类型。
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
<WrappedEoSubmitButtons
|
|
59
|
+
submitText="Submit"
|
|
60
|
+
cancelText="Cancel"
|
|
61
|
+
submitType="primary"
|
|
62
|
+
cancelType="default"
|
|
63
|
+
/>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Disable Submit Button
|
|
67
|
+
|
|
68
|
+
展示 submitDisabled 禁用提交按钮的效果。
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<WrappedEoSubmitButtons
|
|
72
|
+
submitText="Submit"
|
|
73
|
+
cancelText="Cancel"
|
|
74
|
+
submitDisabled
|
|
75
|
+
/>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Disable After Click
|
|
79
|
+
|
|
80
|
+
演示 disableAfterClick 在点击提交后自动禁用按钮,防止重复提交。
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
<WrappedEoSubmitButtons
|
|
84
|
+
submitText="提交"
|
|
85
|
+
cancelText="取消"
|
|
86
|
+
disableAfterClick
|
|
87
|
+
onSubmit={() => console.log("已提交,按钮已禁用")}
|
|
88
|
+
onCancel={() => console.log("已取消")}
|
|
89
|
+
/>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Theme Variant Elevo
|
|
93
|
+
|
|
94
|
+
展示 Elevo 主题变体下提交按钮的样式。
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
<WrappedEoSubmitButtons
|
|
98
|
+
submitText="提交"
|
|
99
|
+
cancelText="取消"
|
|
100
|
+
themeVariant="elevo"
|
|
101
|
+
submitType="primary"
|
|
102
|
+
cancelType="default"
|
|
103
|
+
onSubmit={() => console.log("提交成功")}
|
|
104
|
+
onCancel={() => console.log("已取消")}
|
|
105
|
+
/>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### In Form
|
|
109
|
+
|
|
110
|
+
与 WrappedEoForm 搭配使用,演示完整的表单提交流程。
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
<WrappedEoForm
|
|
114
|
+
onValidateSuccess={(e) => console.log("表单提交成功", e.detail)}
|
|
115
|
+
onValidateError={(e) => console.log("表单校验失败", e.detail)}
|
|
116
|
+
>
|
|
117
|
+
<WrappedEoInput required name="name" label="姓名" />
|
|
118
|
+
<WrappedEoSelect
|
|
119
|
+
required
|
|
120
|
+
name="city"
|
|
121
|
+
label="城市"
|
|
122
|
+
options={[
|
|
123
|
+
{ label: "北京", value: "beijing" },
|
|
124
|
+
{ label: "上海", value: "shanghai" },
|
|
125
|
+
]}
|
|
126
|
+
/>
|
|
127
|
+
<WrappedEoSubmitButtons submitText="提交" cancelText="取消" />
|
|
128
|
+
</WrappedEoForm>
|
|
129
|
+
```
|