@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.
Files changed (92) hide show
  1. package/dist/bricks.json +35 -35
  2. package/dist/chunks/2537.be4cf82c.js.map +1 -1
  3. package/dist/chunks/845.2f598dd9.js +3 -0
  4. package/dist/chunks/845.2f598dd9.js.map +1 -0
  5. package/dist/chunks/{9949.753e2720.js → 9949.3d28a915.js} +3 -3
  6. package/dist/chunks/9949.3d28a915.js.map +1 -0
  7. package/dist/chunks/eo-auto-complete.0ed854e4.js.map +1 -1
  8. package/dist/chunks/eo-checkbox.2d0a8dbc.js.map +1 -1
  9. package/dist/chunks/eo-color-picker.ecf0c4c0.js.map +1 -1
  10. package/dist/chunks/eo-date-picker.faa60507.js.map +1 -1
  11. package/dist/chunks/eo-dynamic-form-item.aa5f7d9e.js.map +1 -1
  12. package/dist/chunks/eo-form.9db78cdb.js.map +1 -1
  13. package/dist/chunks/eo-icon-select.6a7f7e12.js +3 -0
  14. package/dist/chunks/eo-icon-select.6a7f7e12.js.map +1 -0
  15. package/dist/chunks/eo-radio.b2ed57db.js.map +1 -1
  16. package/dist/chunks/eo-search.206dd65e.js.map +1 -1
  17. package/dist/chunks/eo-select.cd00c791.js.map +1 -1
  18. package/dist/chunks/eo-switch.f0a27c08.js.map +1 -1
  19. package/dist/chunks/eo-textarea.405851dd.js.map +1 -1
  20. package/dist/chunks/eo-time-picker.46e7a667.js.map +1 -1
  21. package/dist/chunks/eo-time-range-picker.5afbad69.js.map +1 -1
  22. package/dist/chunks/eo-upload-file.27a4288d.js.map +1 -1
  23. package/dist/chunks/eo-upload-image.b43c2329.js.map +1 -1
  24. package/dist/chunks/{main.8c394d3e.js → main.59f7a796.js} +2 -2
  25. package/dist/chunks/{main.8c394d3e.js.map → main.59f7a796.js.map} +1 -1
  26. package/dist/examples.json +27 -24
  27. package/dist/index.2c92cf90.js +2 -0
  28. package/dist/{index.7917bac6.js.map → index.2c92cf90.js.map} +1 -1
  29. package/dist/manifest.json +451 -385
  30. package/dist/types.json +2699 -2649
  31. package/dist-types/auto-complete/index.d.ts +4 -0
  32. package/dist-types/checkbox/index.d.ts +2 -2
  33. package/dist-types/color-picker/index.d.ts +2 -1
  34. package/dist-types/date-picker/index.d.ts +1 -1
  35. package/dist-types/form/index.d.ts +16 -1
  36. package/dist-types/form-item/index.d.ts +31 -2
  37. package/dist-types/general-switch/index.d.ts +1 -1
  38. package/dist-types/icon-select/index.d.ts +1 -1
  39. package/dist-types/input/index.d.ts +2 -2
  40. package/dist-types/radio/index.d.ts +4 -4
  41. package/dist-types/select/index.d.ts +1 -0
  42. package/dist-types/textarea/index.d.ts +1 -1
  43. package/dist-types/time-range-picker/index.d.ts +7 -4
  44. package/dist-types/upload/upload-file/index.d.ts +1 -1
  45. package/docs/eo-auto-complete.md +158 -8
  46. package/docs/eo-auto-complete.react.md +229 -0
  47. package/docs/eo-checkbox.md +107 -4
  48. package/docs/eo-checkbox.react.md +369 -0
  49. package/docs/eo-color-picker.md +102 -22
  50. package/docs/eo-color-picker.react.md +160 -0
  51. package/docs/eo-date-picker.md +82 -50
  52. package/docs/eo-date-picker.react.md +146 -0
  53. package/docs/eo-dynamic-form-item.md +60 -15
  54. package/docs/eo-dynamic-form-item.react.md +186 -0
  55. package/docs/eo-form-item.md +194 -0
  56. package/docs/eo-form-item.react.md +163 -0
  57. package/docs/eo-form.md +144 -3
  58. package/docs/eo-form.react.md +330 -0
  59. package/docs/eo-icon-select.md +80 -1
  60. package/docs/eo-icon-select.react.md +97 -0
  61. package/docs/eo-input.md +147 -22
  62. package/docs/eo-input.react.md +275 -0
  63. package/docs/eo-radio.md +145 -8
  64. package/docs/eo-radio.react.md +492 -0
  65. package/docs/eo-search.md +94 -1
  66. package/docs/eo-search.react.md +122 -0
  67. package/docs/eo-select.md +157 -9
  68. package/docs/eo-select.react.md +411 -0
  69. package/docs/eo-submit-buttons.md +120 -7
  70. package/docs/eo-submit-buttons.react.md +129 -0
  71. package/docs/eo-switch.md +57 -3
  72. package/docs/eo-switch.react.md +136 -0
  73. package/docs/eo-textarea.md +101 -22
  74. package/docs/eo-textarea.react.md +193 -0
  75. package/docs/eo-time-picker.md +70 -42
  76. package/docs/eo-time-picker.react.md +106 -0
  77. package/docs/eo-time-range-picker.md +89 -35
  78. package/docs/eo-time-range-picker.react.md +163 -0
  79. package/docs/eo-upload-file.md +101 -9
  80. package/docs/eo-upload-file.react.md +126 -0
  81. package/docs/eo-upload-image.md +70 -6
  82. package/docs/eo-upload-image.react.md +92 -0
  83. package/package.json +2 -2
  84. package/dist/chunks/845.c8b5b1e8.js +0 -3
  85. package/dist/chunks/845.c8b5b1e8.js.map +0 -1
  86. package/dist/chunks/9949.753e2720.js.map +0 -1
  87. package/dist/chunks/eo-icon-select.6ea15888.js +0 -3
  88. package/dist/chunks/eo-icon-select.6ea15888.js.map +0 -1
  89. package/dist/index.7917bac6.js +0 -2
  90. /package/dist/chunks/{845.c8b5b1e8.js.LICENSE.txt → 845.2f598dd9.js.LICENSE.txt} +0 -0
  91. /package/dist/chunks/{9949.753e2720.js.LICENSE.txt → 9949.3d28a915.js.LICENSE.txt} +0 -0
  92. /package/dist/chunks/{eo-icon-select.6ea15888.js.LICENSE.txt → eo-icon-select.6a7f7e12.js.LICENSE.txt} +0 -0
package/docs/eo-radio.md CHANGED
@@ -1,4 +1,45 @@
1
- 表单单选构件。
1
+ ---
2
+ tagName: eo-radio
3
+ displayName: WrappedEoRadio
4
+ description: 通用单选构件
5
+ category: form-input-basic
6
+ source: "@next-bricks/form"
7
+ ---
8
+
9
+ # eo-radio
10
+
11
+ > 通用单选构件
12
+
13
+ ## Props
14
+
15
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
16
+ | ------------ | ------------------------ | ---- | ----------- | ---------------------- |
17
+ | name | `string` | - | - | 字段名称 |
18
+ | label | `string` | - | - | 单选框字段说明 |
19
+ | options | `GeneralOption[]` | - | - | 单选框选项表 |
20
+ | value | `any` | - | - | 单选框当前选中值 |
21
+ | required | `boolean` | - | - | 是否必填 |
22
+ | message | `Record<string, string>` | - | - | 校验文本信息 |
23
+ | disabled | `boolean` | - | - | 是否禁用 |
24
+ | type | `RadioType` | - | `"default"` | 单选框样式类型 |
25
+ | ui | `UIType` | - | - | UI样式 |
26
+ | size | `ComponentSize` | - | - | 大小,只对按钮样式生效 |
27
+ | customStyle | `React.CSSProperties` | - | - | 自定义radio的外层样式 |
28
+ | useBrick | `UseSingleBrickConf` | - | - | 自定义radio的内容 |
29
+ | themeVariant | `"default" \| "elevo"` | - | - | 主题变体 |
30
+
31
+ ## Events
32
+
33
+ | 事件 | detail | 说明 |
34
+ | -------------- | ---------------------------------------------------------------------------- | ---------------- |
35
+ | change | `GeneralComplexOption \| undefined` — 当前选中项的完整选项对象 | 值变化事件 |
36
+ | options.change | `{ options: GeneralComplexOption[]; name: string }` — 最新的选项列表及字段名 | 选项列表变化事件 |
37
+
38
+ ## Examples
39
+
40
+ ### Basic
41
+
42
+ 基本用法,展示简单的单选框列表。
2
43
 
3
44
  ```yaml preview
4
45
  - brick: eo-radio
@@ -10,10 +51,10 @@
10
51
  - Shenzhen
11
52
  ```
12
53
 
13
- ## Examples
14
-
15
54
  ### Label
16
55
 
56
+ 设置 label 属性为单选框添加字段说明。
57
+
17
58
  ```yaml preview
18
59
  - brick: eo-radio
19
60
  properties:
@@ -27,6 +68,8 @@
27
68
 
28
69
  ### Value
29
70
 
71
+ 设置 value 属性指定默认选中项。
72
+
30
73
  ```yaml preview
31
74
  - brick: eo-radio
32
75
  properties:
@@ -40,6 +83,8 @@
40
83
 
41
84
  ### Options
42
85
 
86
+ 多种选项格式:字符串数组、对象数组和布尔值数组。
87
+
43
88
  ```yaml preview
44
89
  - brick: eo-radio
45
90
  properties:
@@ -70,6 +115,8 @@
70
115
 
71
116
  ### Emoji
72
117
 
118
+ 按钮类型单选框支持 emoji 图标。
119
+
73
120
  ```yaml preview
74
121
  - brick: eo-radio
75
122
  properties:
@@ -78,18 +125,20 @@
78
125
  type: button
79
126
  options:
80
127
  - label: 差
81
- emoji: 😔
128
+ emoji: "\U0001F614"
82
129
  value: -1
83
130
  - label: 一般
84
- emoji: 😐
131
+ emoji: "\U0001F610"
85
132
  value: 0
86
133
  - label: 好
87
- emoji: 😊
134
+ emoji: "\U0001F60A"
88
135
  value: 1
89
136
  ```
90
137
 
91
138
  ### Disabled
92
139
 
140
+ 禁用单个选项或整体禁用单选框,支持各种类型。
141
+
93
142
  ```yaml preview
94
143
  - brick: eo-flex-layout
95
144
  properties:
@@ -157,7 +206,6 @@
157
206
  properties:
158
207
  label: Button
159
208
  type: button
160
- value: Shanghai
161
209
  disabled: true
162
210
  value: Beijing
163
211
  options:
@@ -251,7 +299,7 @@
251
299
 
252
300
  ### Size
253
301
 
254
- Used only when `type` is `button`.
302
+ 设置 size 属性控制按钮样式单选框的大小。
255
303
 
256
304
  ```yaml preview
257
305
  - brick: eo-radio
@@ -296,6 +344,8 @@ Used only when `type` is `button`.
296
344
 
297
345
  ### Type
298
346
 
347
+ 展示 default、button、icon、icon-circle、icon-square 等各种样式类型。
348
+
299
349
  ```yaml preview
300
350
  - brick: eo-flex-layout
301
351
  properties:
@@ -431,8 +481,68 @@ Used only when `type` is `button`.
431
481
  lib: "antd"
432
482
  ```
433
483
 
484
+ ### customStyle
485
+
486
+ 使用 customStyle 自定义单选项的外层样式。
487
+
488
+ ```yaml preview
489
+ - brick: eo-radio
490
+ properties:
491
+ label: 自定义样式
492
+ options:
493
+ - Beijing
494
+ - Shanghai
495
+ - Guangzhou
496
+ customStyle:
497
+ padding: 8px
498
+ border: 1px solid #d9d9d9
499
+ borderRadius: 4px
500
+ ```
501
+
502
+ ### useBrick
503
+
504
+ 使用 useBrick 自定义单选框内容渲染(需搭配 type="custom")。
505
+
506
+ ```yaml preview
507
+ - brick: eo-radio
508
+ properties:
509
+ label: 自定义内容
510
+ type: custom
511
+ value: a
512
+ options:
513
+ - label: 选项A
514
+ value: a
515
+ - label: 选项B
516
+ value: b
517
+ useBrick:
518
+ brick: span
519
+ properties:
520
+ textContent: <% DATA.label %>
521
+ style:
522
+ color: green
523
+ fontWeight: bold
524
+ ```
525
+
526
+ ### themeVariant
527
+
528
+ 设置主题变体为 elevo 风格。
529
+
530
+ ```yaml preview
531
+ - brick: eo-radio
532
+ properties:
533
+ themeVariant: elevo
534
+ label: Elevo 风格
535
+ options:
536
+ - Beijing
537
+ - Shanghai
538
+ - Guangzhou
539
+ value: Beijing
540
+ ```
541
+
434
542
  ### Event
435
543
 
544
+ 监听 change 和 options.change 事件,通过按钮动态修改选项触发 options.change 事件。
545
+
436
546
  ```yaml preview
437
547
  - brick: eo-radio
438
548
  properties:
@@ -474,3 +584,30 @@ Used only when `type` is `button`.
474
584
  - label: Hangzhou
475
585
  value: 4
476
586
  ```
587
+
588
+ ### With Form
589
+
590
+ 在表单中使用单选框,支持 required 校验和 message 自定义校验文本。
591
+
592
+ ```yaml preview
593
+ - brick: eo-form
594
+ events:
595
+ validate.success:
596
+ - action: console.log
597
+ values.change:
598
+ - action: console.log
599
+ children:
600
+ - brick: eo-radio
601
+ properties:
602
+ name: city
603
+ label: 城市
604
+ required: true
605
+ message:
606
+ required: 请选择一个城市
607
+ options:
608
+ - Beijing
609
+ - Shanghai
610
+ - Guangzhou
611
+ - Shenzhen
612
+ - brick: eo-submit-buttons
613
+ ```
@@ -0,0 +1,492 @@
1
+ ---
2
+ tagName: eo-radio
3
+ displayName: WrappedEoRadio
4
+ description: 通用单选构件
5
+ category: form-input-basic
6
+ source: "@next-bricks/form"
7
+ ---
8
+
9
+ # WrappedEoRadio
10
+
11
+ > 通用单选构件
12
+
13
+ ## 导入
14
+
15
+ ```tsx
16
+ import { WrappedEoRadio } from "@easyops/wrapped-components";
17
+ ```
18
+
19
+ ## Props
20
+
21
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
22
+ | ------------ | ------------------------ | ---- | ----------- | ---------------------- |
23
+ | name | `string` | - | - | 字段名称 |
24
+ | label | `string` | - | - | 单选框字段说明 |
25
+ | options | `GeneralOption[]` | - | - | 单选框选项表 |
26
+ | value | `any` | - | - | 单选框当前选中值 |
27
+ | required | `boolean` | - | - | 是否必填 |
28
+ | message | `Record<string, string>` | - | - | 校验文本信息 |
29
+ | disabled | `boolean` | - | - | 是否禁用 |
30
+ | type | `RadioType` | - | `"default"` | 单选框样式类型 |
31
+ | ui | `UIType` | - | - | UI样式 |
32
+ | size | `ComponentSize` | - | - | 大小,只对按钮样式生效 |
33
+ | customStyle | `React.CSSProperties` | - | - | 自定义radio的外层样式 |
34
+ | useBrick | `UseSingleBrickConf` | - | - | 自定义radio的内容 |
35
+ | themeVariant | `"default" \| "elevo"` | - | - | 主题变体 |
36
+
37
+ ## Events
38
+
39
+ | 事件 | detail | 说明 |
40
+ | --------------- | ---------------------------------------------------------------------------- | ---------------- |
41
+ | onValueChange | `GeneralComplexOption \| undefined` — 当前选中项的完整选项对象 | 值变化事件 |
42
+ | onOptionsChange | `{ options: GeneralComplexOption[]; name: string }` — 最新的选项列表及字段名 | 选项列表变化事件 |
43
+
44
+ ## Examples
45
+
46
+ ### Basic
47
+
48
+ 基本用法,展示简单的单选框列表。
49
+
50
+ ```tsx
51
+ <WrappedEoRadio options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]} />
52
+ ```
53
+
54
+ ### Label
55
+
56
+ 设置 label 属性为单选框添加字段说明。
57
+
58
+ ```tsx
59
+ <WrappedEoRadio
60
+ label="city"
61
+ options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
62
+ />
63
+ ```
64
+
65
+ ### Value
66
+
67
+ 设置 value 属性指定默认选中项。
68
+
69
+ ```tsx
70
+ <WrappedEoRadio
71
+ options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
72
+ value="Guangzhou"
73
+ />
74
+ ```
75
+
76
+ ### Options
77
+
78
+ 多种选项格式:字符串数组、对象数组和布尔值数组。
79
+
80
+ ```tsx
81
+ <>
82
+ <WrappedEoRadio
83
+ options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
84
+ value="Guangzhou"
85
+ />
86
+ <WrappedEoRadio
87
+ options={[
88
+ { label: "Beijing", value: 0 },
89
+ { label: "Shanghai", value: 1 },
90
+ { label: "Guangzhou", value: 2 },
91
+ { label: "Shenzhen", value: 3 },
92
+ ]}
93
+ value={2}
94
+ />
95
+ <WrappedEoRadio options={[true, false]} />
96
+ </>
97
+ ```
98
+
99
+ ### Emoji
100
+
101
+ 按钮类型单选框支持 emoji 图标。
102
+
103
+ ```tsx
104
+ <WrappedEoRadio
105
+ name="overall"
106
+ label="总体满意度"
107
+ type="button"
108
+ options={[
109
+ { label: "差", emoji: "\u{1F614}", value: -1 },
110
+ { label: "一般", emoji: "\u{1F610}", value: 0 },
111
+ { label: "好", emoji: "\u{1F60A}", value: 1 },
112
+ ]}
113
+ />
114
+ ```
115
+
116
+ ### Disabled
117
+
118
+ 禁用单个选项或整体禁用单选框,支持各种类型。
119
+
120
+ ```tsx
121
+ <WrappedEoFlexLayout gap="20px" flexDirection="column">
122
+ <WrappedEoRadio
123
+ value={0}
124
+ options={[
125
+ { label: "Beijing", value: 0, disabled: true },
126
+ { label: "Shanghai", value: 1 },
127
+ { label: "Guangzhou", value: 2 },
128
+ { label: "Shenzhen", value: 3 },
129
+ ]}
130
+ />
131
+ <WrappedEoRadio
132
+ disabled={true}
133
+ value={1}
134
+ options={[
135
+ { label: "Beijing", value: 0 },
136
+ { label: "Shanghai", value: 1 },
137
+ { label: "Guangzhou", value: 2 },
138
+ { label: "Shenzhen", value: 3 },
139
+ ]}
140
+ />
141
+ <WrappedEoRadio
142
+ label="Icon"
143
+ type="default"
144
+ disabled={true}
145
+ value={0}
146
+ options={[
147
+ {
148
+ label: "Python",
149
+ value: 0,
150
+ icon: { lib: "easyops", category: "colored-common", icon: "python" },
151
+ },
152
+ {
153
+ label: "Javascript",
154
+ value: 1,
155
+ icon: {
156
+ lib: "easyops",
157
+ category: "program-language",
158
+ icon: "javascript",
159
+ },
160
+ },
161
+ {
162
+ label: "Powershell",
163
+ value: 2,
164
+ icon: {
165
+ lib: "easyops",
166
+ category: "colored-common",
167
+ icon: "powershell",
168
+ },
169
+ },
170
+ {
171
+ label: "Shell",
172
+ value: 3,
173
+ icon: { lib: "easyops", category: "colored-common", icon: "shell" },
174
+ },
175
+ ]}
176
+ />
177
+ <WrappedEoRadio
178
+ label="Button"
179
+ type="button"
180
+ disabled={true}
181
+ value="Beijing"
182
+ options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
183
+ />
184
+ <WrappedEoRadio
185
+ label="dashboard"
186
+ type="button"
187
+ ui="dashboard"
188
+ value="Shanghai"
189
+ options={[
190
+ { label: "Beijing", value: "Beijing" },
191
+ { label: "Shanghai", value: "Shanghai", disabled: true },
192
+ { label: "Guangzhou", value: "Guangzhou" },
193
+ { label: "Shenzhen", value: "Shenzhen" },
194
+ ]}
195
+ />
196
+ <WrappedEoRadio
197
+ label="Icon"
198
+ type="icon"
199
+ value={1}
200
+ disabled={true}
201
+ options={[
202
+ { label: "Beijing", value: 0, icon: { icon: "area-chart", lib: "antd" } },
203
+ { label: "Shanghai", value: 1, icon: { icon: "bar-chart", lib: "antd" } },
204
+ {
205
+ label: "Guangzhou",
206
+ value: 2,
207
+ icon: { icon: "area-chart", lib: "antd" },
208
+ },
209
+ ]}
210
+ />
211
+ <WrappedEoRadio
212
+ label="Icon Cricle"
213
+ type="icon-circle"
214
+ value={0}
215
+ disabled={true}
216
+ options={[
217
+ { label: "Beijing", value: 0, icon: { icon: "area-chart", lib: "antd" } },
218
+ { label: "Shanghai", value: 1, icon: { icon: "bar-chart", lib: "antd" } },
219
+ {
220
+ label: "Guangzhou",
221
+ value: 2,
222
+ icon: { icon: "area-chart", lib: "antd" },
223
+ },
224
+ ]}
225
+ />
226
+ <WrappedEoRadio
227
+ label="Icon Square"
228
+ type="icon-square"
229
+ value={2}
230
+ disabled={true}
231
+ options={[
232
+ { label: "Beijing", value: 0, icon: { icon: "area-chart", lib: "antd" } },
233
+ { label: "Shanghai", value: 1, icon: { icon: "bar-chart", lib: "antd" } },
234
+ {
235
+ label: "Guangzhou",
236
+ value: 2,
237
+ icon: { icon: "area-chart", lib: "antd" },
238
+ },
239
+ ]}
240
+ />
241
+ </WrappedEoFlexLayout>
242
+ ```
243
+
244
+ ### Size
245
+
246
+ 设置 size 属性控制按钮样式单选框的大小。
247
+
248
+ ```tsx
249
+ <>
250
+ <WrappedEoRadio
251
+ label="large"
252
+ size="large"
253
+ type="button"
254
+ options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
255
+ />
256
+ <div style={{ height: "20px" }} />
257
+ <WrappedEoRadio
258
+ label="medium"
259
+ size="medium"
260
+ type="button"
261
+ options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
262
+ />
263
+ <div style={{ height: "20px" }} />
264
+ <WrappedEoRadio
265
+ label="small"
266
+ size="small"
267
+ type="button"
268
+ options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
269
+ />
270
+ </>
271
+ ```
272
+
273
+ ### Type
274
+
275
+ 展示 default、button、icon、icon-circle、icon-square 等各种样式类型。
276
+
277
+ ```tsx
278
+ <WrappedEoFlexLayout gap="20px" flexDirection="column">
279
+ <WrappedEoRadio
280
+ label="Default"
281
+ type="default"
282
+ value="Beijing"
283
+ options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
284
+ />
285
+ <WrappedEoRadio
286
+ label="Icon"
287
+ type="default"
288
+ options={[
289
+ {
290
+ label: "Python",
291
+ value: 0,
292
+ icon: { lib: "easyops", category: "colored-common", icon: "python" },
293
+ },
294
+ {
295
+ label: "Javascript",
296
+ value: 1,
297
+ icon: {
298
+ lib: "easyops",
299
+ category: "program-language",
300
+ icon: "javascript",
301
+ },
302
+ },
303
+ {
304
+ label: "Powershell",
305
+ value: 2,
306
+ icon: {
307
+ lib: "easyops",
308
+ category: "colored-common",
309
+ icon: "powershell",
310
+ },
311
+ },
312
+ {
313
+ label: "Shell",
314
+ value: 3,
315
+ icon: { lib: "easyops", category: "colored-common", icon: "shell" },
316
+ },
317
+ ]}
318
+ />
319
+ <WrappedEoRadio
320
+ label="Button"
321
+ type="button"
322
+ value="Shanghai"
323
+ options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
324
+ />
325
+ <WrappedEoRadio
326
+ label="dashboard"
327
+ type="button"
328
+ ui="dashboard"
329
+ value="Shanghai"
330
+ options={[
331
+ { label: "Beijing", value: "Beijing" },
332
+ { label: "Shanghai", value: "Shanghai" },
333
+ { label: "Guangzhou", value: "Guangzhou" },
334
+ { label: "Shenzhen", value: "Shenzhen" },
335
+ ]}
336
+ />
337
+ <WrappedEoRadio
338
+ label="Icon"
339
+ type="icon"
340
+ value={1}
341
+ options={[
342
+ { label: "Beijing", value: 0, icon: { icon: "area-chart", lib: "antd" } },
343
+ { label: "Shanghai", value: 1, icon: { icon: "bar-chart", lib: "antd" } },
344
+ {
345
+ label: "Guangzhou",
346
+ value: 2,
347
+ icon: { icon: "area-chart", lib: "antd" },
348
+ },
349
+ ]}
350
+ />
351
+ <WrappedEoRadio
352
+ label="Icon Cricle"
353
+ type="icon-circle"
354
+ value={0}
355
+ options={[
356
+ { label: "Beijing", value: 0, icon: { icon: "area-chart", lib: "antd" } },
357
+ { label: "Shanghai", value: 1, icon: { icon: "bar-chart", lib: "antd" } },
358
+ {
359
+ label: "Guangzhou",
360
+ value: 2,
361
+ icon: { icon: "area-chart", lib: "antd" },
362
+ },
363
+ ]}
364
+ />
365
+ <WrappedEoRadio
366
+ label="Icon Square"
367
+ type="icon-square"
368
+ value={2}
369
+ options={[
370
+ { label: "Beijing", value: 0, icon: { icon: "area-chart", lib: "antd" } },
371
+ { label: "Shanghai", value: 1, icon: { icon: "bar-chart", lib: "antd" } },
372
+ {
373
+ label: "Guangzhou",
374
+ value: 2,
375
+ icon: { icon: "area-chart", lib: "antd" },
376
+ },
377
+ ]}
378
+ />
379
+ </WrappedEoFlexLayout>
380
+ ```
381
+
382
+ ### customStyle
383
+
384
+ 使用 customStyle 自定义单选项的外层样式。
385
+
386
+ ```tsx
387
+ <WrappedEoRadio
388
+ label="自定义样式"
389
+ options={["Beijing", "Shanghai", "Guangzhou"]}
390
+ customStyle={{
391
+ padding: "8px",
392
+ border: "1px solid #d9d9d9",
393
+ borderRadius: "4px",
394
+ }}
395
+ />
396
+ ```
397
+
398
+ ### useBrick
399
+
400
+ 使用 useBrick 自定义单选框内容渲染(需搭配 type="custom")。
401
+
402
+ ```tsx
403
+ <WrappedEoRadio
404
+ label="自定义内容"
405
+ type="custom"
406
+ value="a"
407
+ options={[
408
+ { label: "选项A", value: "a" },
409
+ { label: "选项B", value: "b" },
410
+ ]}
411
+ useBrick={{
412
+ brick: "span",
413
+ properties: {
414
+ textContent: "<% DATA.label %>",
415
+ style: {
416
+ color: "green",
417
+ fontWeight: "bold",
418
+ },
419
+ },
420
+ }}
421
+ />
422
+ ```
423
+
424
+ ### themeVariant
425
+
426
+ 设置主题变体为 elevo 风格。
427
+
428
+ ```tsx
429
+ <WrappedEoRadio
430
+ themeVariant="elevo"
431
+ label="Elevo 风格"
432
+ options={["Beijing", "Shanghai", "Guangzhou"]}
433
+ value="Beijing"
434
+ />
435
+ ```
436
+
437
+ ### Event
438
+
439
+ 监听 onValueChange 和 onOptionsChange 事件,通过按钮动态修改选项触发 onOptionsChange 事件。
440
+
441
+ ```tsx
442
+ function RadioEventDemo() {
443
+ const [options, setOptions] = useState([
444
+ { label: "Beijing", value: 0 },
445
+ { label: "Shanghai", value: 1 },
446
+ { label: "Guangzhou", value: 2 },
447
+ { label: "Shenzhen", value: 3 },
448
+ ]);
449
+
450
+ return (
451
+ <>
452
+ <WrappedEoRadio
453
+ options={options}
454
+ onValueChange={(e) => console.log("change:", e.detail)}
455
+ onOptionsChange={(e) => console.log("options.change:", e.detail)}
456
+ />
457
+ <WrappedEoButton
458
+ textContent="Click to Change Radio Option"
459
+ onClick={() =>
460
+ setOptions([
461
+ { label: "Beijing", value: 0 },
462
+ { label: "Shanghai", value: 1 },
463
+ { label: "Guangzhou", value: 2 },
464
+ { label: "Shenzhen", value: 3 },
465
+ { label: "Hangzhou", value: 4 },
466
+ ])
467
+ }
468
+ />
469
+ </>
470
+ );
471
+ }
472
+ ```
473
+
474
+ ### With Form
475
+
476
+ 在表单中使用单选框,支持 required 校验和 message 自定义校验文本。
477
+
478
+ ```tsx
479
+ <WrappedEoForm
480
+ onValidateSuccess={(e) => console.log(e.detail)}
481
+ onValuesChange={(e) => console.log(e.detail)}
482
+ >
483
+ <WrappedEoRadio
484
+ name="city"
485
+ label="城市"
486
+ required={true}
487
+ message={{ required: "请选择一个城市" }}
488
+ options={["Beijing", "Shanghai", "Guangzhou", "Shenzhen"]}
489
+ />
490
+ <WrappedEoSubmitButtons />
491
+ </WrappedEoForm>
492
+ ```