@agentscope-ai/design 1.0.26-beta.1767840384443 → 1.0.26-beta.1767843408082

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/llms/all.llms.txt CHANGED
@@ -96,50 +96,115 @@
96
96
 
97
97
 
98
98
 
99
- <DemoTitle title="Video" desc="视频展示">
99
+ <DemoTitle title="TimePicker" desc="输入或选择时间的控件。">
100
100
  #### API
101
101
 
102
- | 属性名 | 描述 | 类型 | 默认值 |
103
- |--------|--------|--------|--------|
104
- | mouseEnterAutoPlay | 鼠标进入时是否自动播放 | boolean | false |
105
- | children | video内部设置了按钮在暗色背景下的样式,如果有一些操作按钮想继承这个样式可以在这里传入 | React.ReactNode | |
102
+ <AntdApiRef url="https://ant.design/components/time-picker-cn/#api"></AntdApiRef>
106
103
 
107
104
 
105
+ ## antd API
108
106
 
109
107
 
110
108
 
109
+ 通用属性参考:[通用属性](/docs/react/common-props)
111
110
 
112
- <DemoTitle title="Tag" desc="进行标记和分类的小标签">
113
- #### API
114
111
 
115
- | 属性名 | 描述 | 类型 | 默认值 |
116
- |--------|--------|--------|--------|
117
- | size | 尺寸 | 'small' \| 'middle' | 'middle' |
118
- | color | 标签色 | SparkTagColors \| string | 'purple' |
112
+ ```jsx
113
+ import dayjs from 'dayjs';
114
+ import customParseFormat from 'dayjs/plugin/customParseFormat'
119
115
 
120
- <AntdApiRef url="https://ant.design/components/tag-cn/#api"></AntdApiRef>
116
+ dayjs.extend(customParseFormat)
117
+ <TimePicker defaultValue={dayjs('13:30:56', 'HH:mm:ss')} />;
118
+ ```
121
119
 
122
120
 
123
- ## antd API
121
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
122
+ |--------|--------|--------|--------|--------|
123
+ | allowClear | 自定义清除按钮 | boolean \| { clearIcon?: ReactNode } | true | 5.8.0: 支持对象类型 |
124
+ | autoFocus | 自动获取焦点 | boolean | false | |
125
+ | cellRender | 自定义单元格的内容 | (current: number, info: { originNode: React.ReactNode, today: dayjs, range?: 'start' \| 'end', subType: 'hour' \| 'minute' \| 'second' \| 'meridiem' }) => React.ReactNode | - | 5.4.0 |
126
+ | changeOnScroll | 在滚动时改变选择值 | boolean | false | 5.14.0 |
127
+ | className | 选择器类名 | string | - | |
128
+ | defaultValue | 默认时间 | | - | |
129
+ | disabled | 禁用全部操作 | boolean | false | |
130
+ | disabledTime | 不可选择的时间 | | - | 4.19.0 |
131
+ | format | 展示的时间格式 | string | HH:mm:ss | |
132
+ | getPopupContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | - | |
133
+ | hideDisabledOptions | 隐藏禁止选择的选项 | boolean | false | |
134
+ | hourStep | 小时选项间隔 | number | 1 | |
135
+ | inputReadOnly | 设置输入框为只读(避免在移动设备上打开虚拟键盘) | boolean | false | |
136
+ | minuteStep | 分钟选项间隔 | number | 1 | |
137
+ | needConfirm | 是否需要确认按钮,为 | boolean | - | 5.14.0 |
138
+ | open | 面板是否打开 | boolean | false | |
139
+ | placeholder | 没有值的时候显示的内容 | string \| [string, string] | 请选择时间 | |
140
+ | placement | 选择框弹出的位置 | bottomLeft | bottomLeft | |
141
+ | popupClassName | 弹出层类名 | string | - | |
142
+ | popupStyle | 弹出层样式对象 | object | - | |
143
+ | prefix | 自定义前缀 | ReactNode | - | 5.22.0 |
144
+ | renderExtraFooter | 选择框底部显示自定义的内容 | () => ReactNode | - | |
145
+ | secondStep | 秒选项间隔 | number | 1 | |
146
+ | showNow | 面板是否显示“此刻”按钮 | boolean | - | 4.4.0 |
147
+ | size | 输入框大小, | large | - | |
148
+ | status | 设置校验状态 | 'error' \| 'warning' | - | 4.19.0 |
149
+ | suffixIcon | 自定义的选择框后缀图标 | ReactNode | - | |
150
+ | use12Hours | 使用 12 小时制,为 true 时 | boolean | false | |
151
+ | value | 当前时间 | | - | |
152
+ | variant | 形态变体 | outlined | outlined | 5.13.0 \| |
153
+ | onCalendarChange | 待选日期发生变化的回调。 | function(dates: [dayjs, dayjs], dateStrings: [string, string], info: { range: | - | |
154
+ | onChange | 时间发生变化的回调 | function(time: dayjs, timeString: string): void | - | |
155
+ | onOpenChange | 面板打开/关闭时的回调 | (open: boolean) => void | - | |
124
156
 
125
- 通用属性参考:[通用属性](/docs/react/common-props)
126
157
 
127
- ### Tag
158
+ #### DisabledTime
159
+
160
+
161
+ ```typescript
162
+ type DisabledTime = (now: Dayjs) => {
163
+ disabledHours?: () => number[];
164
+ disabledMinutes?: (selectedHour: number) => number[];
165
+ disabledSeconds?: (selectedHour: number, selectedMinute: number) => number[];
166
+ disabledMilliseconds?: (
167
+ selectedHour: number,
168
+ selectedMinute: number,
169
+ selectedSecond: number,
170
+ ) => number[];
171
+ };
172
+ ```
173
+
174
+
175
+ 注意:`disabledMilliseconds` 为 `5.14.0` 新增。
176
+
177
+ ## 方法
178
+
179
+ | 名称 | 描述 | 版本 |
180
+ |--------|--------|--------|
181
+ | blur() | 移除焦点 | |
182
+ | focus() | 获取焦点 | |
183
+
184
+
185
+ ## RangePicker
186
+
187
+ 属性与 DatePicker 的 [RangePicker](/components/date-picker-cn#rangepicker) 相同。还包含以下属性:
128
188
 
129
189
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
130
190
  |--------|--------|--------|--------|--------|
131
- | closeIcon | 自定义关闭按钮。5.7.0:设置为 | ReactNode | false | 4.4.0 |
132
- | icon | 设置图标 | ReactNode | - | |
133
- | bordered | 是否有边框 | boolean | true | 5.4.0 |
134
- | onClose | 关闭时的回调(可通过 | (e: React.MouseEvent) => void | - | |
191
+ | disabledTime | 不可选择的时间 | | - | 4.19.0 |
192
+ | order | 始末时间是否自动排序 | boolean | true | 4.1.0 |
135
193
 
136
194
 
137
- ### Tag.CheckableTag
195
+ ### RangeDisabledTime
138
196
 
139
- | 参数 | 说明 | 类型 | 默认值 |
140
- |--------|--------|--------|--------|
141
- | checked | 设置标签的选中状态 | boolean | false |
142
- | onChange | 点击标签时触发的回调 | (checked) => void | - |
197
+
198
+ ```typescript
199
+ type RangeDisabledTime = (
200
+ now: Dayjs,
201
+ type = 'start' | 'end',
202
+ ) => {
203
+ disabledHours?: () => number[];
204
+ disabledMinutes?: (selectedHour: number) => number[];
205
+ disabledSeconds?: (selectedHour: number, selectedMinute: number) => number[];
206
+ };
207
+ ```
143
208
 
144
209
 
145
210
 
@@ -191,6 +256,124 @@
191
256
 
192
257
 
193
258
 
259
+ <DemoTitle title="Video" desc="视频展示">
260
+ #### API
261
+
262
+ | 属性名 | 描述 | 类型 | 默认值 |
263
+ |--------|--------|--------|--------|
264
+ | mouseEnterAutoPlay | 鼠标进入时是否自动播放 | boolean | false |
265
+ | children | video内部设置了按钮在暗色背景下的样式,如果有一些操作按钮想继承这个样式可以在这里传入 | React.ReactNode | |
266
+
267
+
268
+
269
+
270
+
271
+
272
+ <DemoTitle title="Tag" desc="进行标记和分类的小标签">
273
+ #### API
274
+
275
+ | 属性名 | 描述 | 类型 | 默认值 |
276
+ |--------|--------|--------|--------|
277
+ | size | 尺寸 | 'small' \| 'middle' | 'middle' |
278
+ | color | 标签色 | SparkTagColors \| string | 'purple' |
279
+
280
+ <AntdApiRef url="https://ant.design/components/tag-cn/#api"></AntdApiRef>
281
+
282
+
283
+ ## antd API
284
+
285
+ 通用属性参考:[通用属性](/docs/react/common-props)
286
+
287
+ ### Tag
288
+
289
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
290
+ |--------|--------|--------|--------|--------|
291
+ | closeIcon | 自定义关闭按钮。5.7.0:设置为 | ReactNode | false | 4.4.0 |
292
+ | icon | 设置图标 | ReactNode | - | |
293
+ | bordered | 是否有边框 | boolean | true | 5.4.0 |
294
+ | onClose | 关闭时的回调(可通过 | (e: React.MouseEvent) => void | - | |
295
+
296
+
297
+ ### Tag.CheckableTag
298
+
299
+ | 参数 | 说明 | 类型 | 默认值 |
300
+ |--------|--------|--------|--------|
301
+ | checked | 设置标签的选中状态 | boolean | false |
302
+ | onChange | 点击标签时触发的回调 | (checked) => void | - |
303
+
304
+
305
+
306
+
307
+ <DemoTitle title="Tabs" desc="用户可以通过点击不同的标签在同一页面中查看不同的内容区域。">
308
+ #### API
309
+
310
+ | 属性名 | 描述 | 类型 | 默认值 |
311
+ |--------|--------|--------|--------|
312
+ | type | 类型 | 'line' \| 'card' \| 'editable-card' \| 'segmented' | true |
313
+
314
+
315
+ <AntdApiRef url="https://ant.design/components/tabs-cn/#api"></AntdApiRef>
316
+
317
+
318
+ ## antd API
319
+
320
+ 通用属性参考:[通用属性](/docs/react/common-props)
321
+
322
+ ### Tabs
323
+
324
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
325
+ |--------|--------|--------|--------|--------|
326
+ | activeKey | 当前激活 tab 面板的 key | string | - | |
327
+ | addIcon | 自定义添加按钮,设置 | ReactNode | | 4.4.0 |
328
+ | animated | 是否使用动画切换 Tabs | boolean\| { inkBar: boolean, tabPane: boolean } | { inkBar: true, tabPane: false } | |
329
+ | centered | 标签居中展示 | boolean | false | 4.4.0 |
330
+ | defaultActiveKey | 初始化选中面板的 key,如果没有设置 activeKey | string | 第一个面板的 key | |
331
+ | hideAdd | 是否隐藏加号图标,在 | boolean | false | |
332
+ | indicator | 自定义指示条的长度和对齐方式 | { size?: number \| (origin: number) => number; align: | - | 5.13.0 |
333
+ | items | 配置选项卡内容 | | [] | 4.23.0 |
334
+ | more | 自定义折叠菜单属性 | | { icon: | |
335
+ | removeIcon | 自定义删除按钮,设置 | ReactNode | | 5.15.0 |
336
+ | popupClassName | 更多菜单的 | string | - | 4.21.0 |
337
+ | renderTabBar | 替换 TabBar,用于二次封装标签头 | (props: DefaultTabBarProps, DefaultTabBar: React.ComponentClass) => React.ReactElement | - | |
338
+ | size | 大小,提供 | string | middle | |
339
+ | tabBarExtraContent | tab bar 上额外的元素 | ReactNode \| {left?: ReactNode, right?: ReactNode} | - | object: 4.6.0 |
340
+ | tabBarGutter | tabs 之间的间隙 | number | - | |
341
+ | tabBarStyle | tab bar 的样式对象 | CSSProperties | - | |
342
+ | tabPosition | 页签位置,可选值有 | string | top | |
343
+ | destroyOnHidden | 被隐藏时是否销毁 DOM 结构 | boolean | false | 5.25.0 |
344
+ | onChange | 切换面板的回调 | (activeKey: string) => void | - | |
345
+ | onEdit | 新增和删除页签的回调,在 | (action === 'add' ? event : targetKey, action) => void | - | |
346
+ | onTabClick | tab 被点击的回调 | (key: string, event: MouseEvent) => void | - | |
347
+ | onTabScroll | tab 滚动时触发 | ({ direction: | - | 4.3.0 |
348
+
349
+
350
+ 更多属性查看 [rc-tabs tabs](https://github.com/react-component/tabs#tabs)
351
+
352
+ ### TabItemType
353
+
354
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
355
+ |--------|--------|--------|--------|--------|
356
+ | closeIcon | 自定义关闭图标,在 | ReactNode | - | |
357
+ | destroyOnHidden | 被隐藏时是否销毁 DOM 结构 | boolean | false | 5.25.0 |
358
+ | disabled | 禁用某一项 | boolean | false | |
359
+ | forceRender | 被隐藏时是否渲染 DOM 结构 | boolean | false | |
360
+ | key | 对应 activeKey | string | - | |
361
+ | label | 选项卡头显示文字 | ReactNode | - | |
362
+ | icon | 选项卡头显示图标 | ReactNode | - | 5.12.0 |
363
+ | children | 选项卡头显示内容 | ReactNode | - | |
364
+ | closable | 是否显示选项卡的关闭按钮,在 | boolean | true | |
365
+
366
+
367
+ ### MoreProps
368
+
369
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
370
+ |--------|--------|--------|--------|--------|
371
+ | icon | 自定义折叠图标 | ReactNode | - | |
372
+ | | | | | |
373
+
374
+
375
+
376
+
194
377
  <DemoTitle title="Table" desc="展示行列数据。">
195
378
  #### API
196
379
 
@@ -446,197 +629,14 @@ TypeScript 里使用 Table 的 [CodeSandbox 实例](https://codesandbox.io/s/ser
446
629
 
447
630
 
448
631
 
449
- <DemoTitle title="Tabs" desc="用户可以通过点击不同的标签在同一页面中查看不同的内容区域。">
632
+ <DemoTitle title="Switch" desc="使用开关切换两种状态之间。">
450
633
  #### API
451
634
 
452
635
  | 属性名 | 描述 | 类型 | 默认值 |
453
636
  |--------|--------|--------|--------|
454
- | type | 类型 | 'line' \| 'card' \| 'editable-card' \| 'segmented' | true |
455
-
637
+ | label | Switch后的内容 | ReactNode | |
456
638
 
457
- <AntdApiRef url="https://ant.design/components/tabs-cn/#api"></AntdApiRef>
458
-
459
-
460
- ## antd API
461
-
462
- 通用属性参考:[通用属性](/docs/react/common-props)
463
-
464
- ### Tabs
465
-
466
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
467
- |--------|--------|--------|--------|--------|
468
- | activeKey | 当前激活 tab 面板的 key | string | - | |
469
- | addIcon | 自定义添加按钮,设置 | ReactNode | | 4.4.0 |
470
- | animated | 是否使用动画切换 Tabs | boolean\| { inkBar: boolean, tabPane: boolean } | { inkBar: true, tabPane: false } | |
471
- | centered | 标签居中展示 | boolean | false | 4.4.0 |
472
- | defaultActiveKey | 初始化选中面板的 key,如果没有设置 activeKey | string | 第一个面板的 key | |
473
- | hideAdd | 是否隐藏加号图标,在 | boolean | false | |
474
- | indicator | 自定义指示条的长度和对齐方式 | { size?: number \| (origin: number) => number; align: | - | 5.13.0 |
475
- | items | 配置选项卡内容 | | [] | 4.23.0 |
476
- | more | 自定义折叠菜单属性 | | { icon: | |
477
- | removeIcon | 自定义删除按钮,设置 | ReactNode | | 5.15.0 |
478
- | popupClassName | 更多菜单的 | string | - | 4.21.0 |
479
- | renderTabBar | 替换 TabBar,用于二次封装标签头 | (props: DefaultTabBarProps, DefaultTabBar: React.ComponentClass) => React.ReactElement | - | |
480
- | size | 大小,提供 | string | middle | |
481
- | tabBarExtraContent | tab bar 上额外的元素 | ReactNode \| {left?: ReactNode, right?: ReactNode} | - | object: 4.6.0 |
482
- | tabBarGutter | tabs 之间的间隙 | number | - | |
483
- | tabBarStyle | tab bar 的样式对象 | CSSProperties | - | |
484
- | tabPosition | 页签位置,可选值有 | string | top | |
485
- | destroyOnHidden | 被隐藏时是否销毁 DOM 结构 | boolean | false | 5.25.0 |
486
- | onChange | 切换面板的回调 | (activeKey: string) => void | - | |
487
- | onEdit | 新增和删除页签的回调,在 | (action === 'add' ? event : targetKey, action) => void | - | |
488
- | onTabClick | tab 被点击的回调 | (key: string, event: MouseEvent) => void | - | |
489
- | onTabScroll | tab 滚动时触发 | ({ direction: | - | 4.3.0 |
490
-
491
-
492
- 更多属性查看 [rc-tabs tabs](https://github.com/react-component/tabs#tabs)
493
-
494
- ### TabItemType
495
-
496
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
497
- |--------|--------|--------|--------|--------|
498
- | closeIcon | 自定义关闭图标,在 | ReactNode | - | |
499
- | destroyOnHidden | 被隐藏时是否销毁 DOM 结构 | boolean | false | 5.25.0 |
500
- | disabled | 禁用某一项 | boolean | false | |
501
- | forceRender | 被隐藏时是否渲染 DOM 结构 | boolean | false | |
502
- | key | 对应 activeKey | string | - | |
503
- | label | 选项卡头显示文字 | ReactNode | - | |
504
- | icon | 选项卡头显示图标 | ReactNode | - | 5.12.0 |
505
- | children | 选项卡头显示内容 | ReactNode | - | |
506
- | closable | 是否显示选项卡的关闭按钮,在 | boolean | true | |
507
-
508
-
509
- ### MoreProps
510
-
511
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
512
- |--------|--------|--------|--------|--------|
513
- | icon | 自定义折叠图标 | ReactNode | - | |
514
- | | | | | |
515
-
516
-
517
-
518
-
519
- <DemoTitle title="TimePicker" desc="输入或选择时间的控件。">
520
- #### API
521
-
522
- <AntdApiRef url="https://ant.design/components/time-picker-cn/#api"></AntdApiRef>
523
-
524
-
525
- ## antd API
526
-
527
-
528
-
529
- 通用属性参考:[通用属性](/docs/react/common-props)
530
-
531
-
532
- ```jsx
533
- import dayjs from 'dayjs';
534
- import customParseFormat from 'dayjs/plugin/customParseFormat'
535
-
536
- dayjs.extend(customParseFormat)
537
- <TimePicker defaultValue={dayjs('13:30:56', 'HH:mm:ss')} />;
538
- ```
539
-
540
-
541
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
542
- |--------|--------|--------|--------|--------|
543
- | allowClear | 自定义清除按钮 | boolean \| { clearIcon?: ReactNode } | true | 5.8.0: 支持对象类型 |
544
- | autoFocus | 自动获取焦点 | boolean | false | |
545
- | cellRender | 自定义单元格的内容 | (current: number, info: { originNode: React.ReactNode, today: dayjs, range?: 'start' \| 'end', subType: 'hour' \| 'minute' \| 'second' \| 'meridiem' }) => React.ReactNode | - | 5.4.0 |
546
- | changeOnScroll | 在滚动时改变选择值 | boolean | false | 5.14.0 |
547
- | className | 选择器类名 | string | - | |
548
- | defaultValue | 默认时间 | | - | |
549
- | disabled | 禁用全部操作 | boolean | false | |
550
- | disabledTime | 不可选择的时间 | | - | 4.19.0 |
551
- | format | 展示的时间格式 | string | HH:mm:ss | |
552
- | getPopupContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | - | |
553
- | hideDisabledOptions | 隐藏禁止选择的选项 | boolean | false | |
554
- | hourStep | 小时选项间隔 | number | 1 | |
555
- | inputReadOnly | 设置输入框为只读(避免在移动设备上打开虚拟键盘) | boolean | false | |
556
- | minuteStep | 分钟选项间隔 | number | 1 | |
557
- | needConfirm | 是否需要确认按钮,为 | boolean | - | 5.14.0 |
558
- | open | 面板是否打开 | boolean | false | |
559
- | placeholder | 没有值的时候显示的内容 | string \| [string, string] | 请选择时间 | |
560
- | placement | 选择框弹出的位置 | bottomLeft | bottomLeft | |
561
- | popupClassName | 弹出层类名 | string | - | |
562
- | popupStyle | 弹出层样式对象 | object | - | |
563
- | prefix | 自定义前缀 | ReactNode | - | 5.22.0 |
564
- | renderExtraFooter | 选择框底部显示自定义的内容 | () => ReactNode | - | |
565
- | secondStep | 秒选项间隔 | number | 1 | |
566
- | showNow | 面板是否显示“此刻”按钮 | boolean | - | 4.4.0 |
567
- | size | 输入框大小, | large | - | |
568
- | status | 设置校验状态 | 'error' \| 'warning' | - | 4.19.0 |
569
- | suffixIcon | 自定义的选择框后缀图标 | ReactNode | - | |
570
- | use12Hours | 使用 12 小时制,为 true 时 | boolean | false | |
571
- | value | 当前时间 | | - | |
572
- | variant | 形态变体 | outlined | outlined | 5.13.0 \| |
573
- | onCalendarChange | 待选日期发生变化的回调。 | function(dates: [dayjs, dayjs], dateStrings: [string, string], info: { range: | - | |
574
- | onChange | 时间发生变化的回调 | function(time: dayjs, timeString: string): void | - | |
575
- | onOpenChange | 面板打开/关闭时的回调 | (open: boolean) => void | - | |
576
-
577
-
578
- #### DisabledTime
579
-
580
-
581
- ```typescript
582
- type DisabledTime = (now: Dayjs) => {
583
- disabledHours?: () => number[];
584
- disabledMinutes?: (selectedHour: number) => number[];
585
- disabledSeconds?: (selectedHour: number, selectedMinute: number) => number[];
586
- disabledMilliseconds?: (
587
- selectedHour: number,
588
- selectedMinute: number,
589
- selectedSecond: number,
590
- ) => number[];
591
- };
592
- ```
593
-
594
-
595
- 注意:`disabledMilliseconds` 为 `5.14.0` 新增。
596
-
597
- ## 方法
598
-
599
- | 名称 | 描述 | 版本 |
600
- |--------|--------|--------|
601
- | blur() | 移除焦点 | |
602
- | focus() | 获取焦点 | |
603
-
604
-
605
- ## RangePicker
606
-
607
- 属性与 DatePicker 的 [RangePicker](/components/date-picker-cn#rangepicker) 相同。还包含以下属性:
608
-
609
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
610
- |--------|--------|--------|--------|--------|
611
- | disabledTime | 不可选择的时间 | | - | 4.19.0 |
612
- | order | 始末时间是否自动排序 | boolean | true | 4.1.0 |
613
-
614
-
615
- ### RangeDisabledTime
616
-
617
-
618
- ```typescript
619
- type RangeDisabledTime = (
620
- now: Dayjs,
621
- type = 'start' | 'end',
622
- ) => {
623
- disabledHours?: () => number[];
624
- disabledMinutes?: (selectedHour: number) => number[];
625
- disabledSeconds?: (selectedHour: number, selectedMinute: number) => number[];
626
- };
627
- ```
628
-
629
-
630
-
631
-
632
- <DemoTitle title="Switch" desc="使用开关切换两种状态之间。">
633
- #### API
634
-
635
- | 属性名 | 描述 | 类型 | 默认值 |
636
- |--------|--------|--------|--------|
637
- | label | Switch后的内容 | ReactNode | |
638
-
639
- <AntdApiRef url="https://ant.design/components/switch-cn/#api"></AntdApiRef>
639
+ <AntdApiRef url="https://ant.design/components/switch-cn/#api"></AntdApiRef>
640
640
 
641
641
 
642
642
  ## antd API
@@ -1029,20 +1029,15 @@ type RangeDisabledTime = (
1029
1029
 
1030
1030
 
1031
1031
 
1032
- <DemoTitle title="Result" desc="为操作结果提供反馈信息的展示。">
1033
- ## API
1032
+ <DemoTitle title="RadioButton" desc="用于在多个备选项中选中单个状态。">
1033
+ #### API
1034
1034
 
1035
1035
  | 属性名 | 描述 | 类型 | 默认值 |
1036
1036
  |--------|--------|--------|--------|
1037
- | texture | 是否显示纹理 | boolean | false |
1038
-
1039
-
1040
-
1041
-
1042
-
1037
+ | bordered | 边框 | boolean | false |
1038
+ | ghost | 按钮背景色类型 | boolean | true |
1039
+ | gap | 间距 | number | 12 px |
1043
1040
 
1044
- <DemoTitle title="Radio" desc="用于在多个备选项中选中单个状态。">
1045
- #### API
1046
1041
 
1047
1042
  <AntdApiRef url="https://ant.design/components/radio-cn/#api"></AntdApiRef>
1048
1043
 
@@ -1126,16 +1121,9 @@ type RangeDisabledTime = (
1126
1121
 
1127
1122
 
1128
1123
 
1129
- <DemoTitle title="RadioButton" desc="用于在多个备选项中选中单个状态。">
1124
+ <DemoTitle title="Radio" desc="用于在多个备选项中选中单个状态。">
1130
1125
  #### API
1131
1126
 
1132
- | 属性名 | 描述 | 类型 | 默认值 |
1133
- |--------|--------|--------|--------|
1134
- | bordered | 边框 | boolean | false |
1135
- | ghost | 按钮背景色类型 | boolean | true |
1136
- | gap | 间距 | number | 12 px |
1137
-
1138
-
1139
1127
  <AntdApiRef url="https://ant.design/components/radio-cn/#api"></AntdApiRef>
1140
1128
 
1141
1129
 
@@ -1201,6 +1189,18 @@ type RangeDisabledTime = (
1201
1189
 
1202
1190
 
1203
1191
 
1192
+ <DemoTitle title="Result" desc="为操作结果提供反馈信息的展示。">
1193
+ ## API
1194
+
1195
+ | 属性名 | 描述 | 类型 | 默认值 |
1196
+ |--------|--------|--------|--------|
1197
+ | texture | 是否显示纹理 | boolean | false |
1198
+
1199
+
1200
+
1201
+
1202
+
1203
+
1204
1204
  <DemoTitle title="Progress" desc="用于指示任务的完成进度">
1205
1205
  ## antd API
1206
1206
 
@@ -1297,82 +1297,25 @@ type RangeDisabledTime = (
1297
1297
 
1298
1298
 
1299
1299
 
1300
- <DemoTitle title="Popconfirm" desc="点击元素,弹出气泡式的确认框。">
1301
- #### API
1300
+ <DemoTitle title="Pagination" desc="分页器用于分隔长列表,每次只加载一个页面。">
1301
+ ## API
1302
1302
 
1303
1303
  | 属性名 | 描述 | 类型 | 默认值 |
1304
1304
  |--------|--------|--------|--------|
1305
- | type | 类型 | 'info' \| 'warning' \| 'error' \| 'success' \| 'confirm' | 'confirm' |
1305
+ | hideSwitchButton | 是否展示上一页/下一页的切换按钮 | boolean | false |
1306
1306
 
1307
1307
 
1308
- <AntdApiRef url="https://ant.design/components/popconfirm-cn/#api"></AntdApiRef>
1308
+ <AntdApiRef url="https://ant.design/components/pagination-cn/#api"></AntdApiRef>
1309
1309
 
1310
1310
 
1311
1311
  ## antd API
1312
1312
 
1313
1313
  通用属性参考:[通用属性](/docs/react/common-props)
1314
1314
 
1315
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
1316
- |--------|--------|--------|--------|--------|
1317
- | cancelButtonProps | cancel 按钮 props | | - | |
1318
- | cancelText | 取消按钮文字 | string | 取消 | |
1319
- | disabled | 阻止点击 Popconfirm 子元素时弹出确认框 | boolean | false | |
1320
- | icon | 自定义弹出气泡 Icon 图标 | ReactNode | | |
1321
- | okButtonProps | ok 按钮 props | | - | |
1322
- | okText | 确认按钮文字 | string | 确定 | |
1323
- | okType | 确认按钮类型 | string | primary | |
1324
- | showCancel | 是否显示取消按钮 | boolean | true | 4.18.0 |
1325
- | title | 确认框标题 | ReactNode \| () => ReactNode | - | |
1326
- | description | 确认内容的详细描述 | ReactNode \| () => ReactNode | - | 5.1.0 |
1327
- | onCancel | 点击取消的回调 | function(e) | - | |
1328
- | onConfirm | 点击确认的回调 | function(e) | - | |
1329
- | onPopupClick | 弹出气泡点击事件 | function(e) | - | 5.5.0 |
1330
1315
 
1331
-
1332
- <!-- 共同的 API -->
1333
- 以下 API 为 Tooltip、Popconfirm、Popover 共享的 API。
1334
-
1335
- <!-- prettier-ignore -->
1336
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
1337
- |--------|--------|--------|--------|--------|
1338
- | align | 该值将合并到 placement 的配置中,设置参考 | object | - | |
1339
- | arrow | 修改箭头的显示状态以及修改箭头是否指向目标元素中心 | boolean \| { pointAtCenter: boolean } | true | 5.2.0 |
1340
- | autoAdjustOverflow | 气泡被遮挡时自动调整位置 | boolean | true | |
1341
- | color | 背景颜色 | string | - | 4.3.0 |
1342
- | defaultOpen | 默认是否显隐 | boolean | false | 4.23.0 |
1343
- | destroyOnHidden | 关闭后是否销毁 dom | boolean | false | 5.25.0 |
1344
- | fresh | 默认情况下,Tooltip 在关闭时会缓存内容。设置该属性后会始终保持更新 | boolean | false | 5.10.0 |
1345
- | getPopupContainer | 浮层渲染父节点,默认渲染到 body 上 | (triggerNode: HTMLElement) => HTMLElement | () => document.body | |
1346
- | mouseEnterDelay | 鼠标移入后延时多少才显示 Tooltip,单位:秒 | number | 0.1 | |
1347
- | mouseLeaveDelay | 鼠标移出后延时多少才隐藏 Tooltip,单位:秒 | number | 0.1 | |
1348
- | placement | 气泡框位置,可选 | string | top | |
1349
- | trigger | 触发行为,可选 | string \| string[] | hover | |
1350
- | open | 用于手动控制浮层显隐,小于 4.23.0 使用 | boolean | false | 4.23.0 |
1351
- | zIndex | 设置 Tooltip 的 | number | - | |
1352
- | onOpenChange | 显示隐藏的回调 | (open: boolean) => void | - | 4.23.0 |
1353
-
1354
-
1355
-
1356
-
1357
- <DemoTitle title="Pagination" desc="分页器用于分隔长列表,每次只加载一个页面。">
1358
- ## API
1359
-
1360
- | 属性名 | 描述 | 类型 | 默认值 |
1361
- |--------|--------|--------|--------|
1362
- | hideSwitchButton | 是否展示上一页/下一页的切换按钮 | boolean | false |
1363
-
1364
-
1365
- <AntdApiRef url="https://ant.design/components/pagination-cn/#api"></AntdApiRef>
1366
-
1367
-
1368
- ## antd API
1369
-
1370
- 通用属性参考:[通用属性](/docs/react/common-props)
1371
-
1372
-
1373
- ```jsx
1374
- <Pagination onChange={onChange} total={50} />
1375
- ```
1316
+ ```jsx
1317
+ <Pagination onChange={onChange} total={50} />
1318
+ ```
1376
1319
 
1377
1320
 
1378
1321
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
@@ -1571,102 +1514,6 @@ const confirmed = await modal.confirm({ ... });
1571
1514
 
1572
1515
 
1573
1516
 
1574
- <DemoTitle title="Notification" desc="用于指示任务的完成进度">
1575
- #### API
1576
-
1577
- <AntdApiRef url="https://ant.design/components/notification-cn/#api"></AntdApiRef>
1578
-
1579
-
1580
- ## antd API
1581
-
1582
- 通用属性参考:[通用属性](/docs/react/common-props)
1583
-
1584
-
1585
- - `notification.success(config)`
1586
- - `notification.error(config)`
1587
- - `notification.info(config)`
1588
- - `notification.warning(config)`
1589
- - `notification.open(config)`
1590
- - `notification.destroy(key?: String)`
1591
-
1592
- config 参数如下:
1593
-
1594
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
1595
- |--------|--------|--------|--------|--------|
1596
- | actions | 自定义按钮组 | ReactNode | - | 5.24.0 |
1597
- | className | 自定义 CSS class | string | - | - |
1598
- | closeIcon | 自定义关闭图标 | ReactNode | true | 5.7.0:设置为 null 或 false 时隐藏关闭按钮 |
1599
- | description | 通知提醒内容,必选 | ReactNode | - | - |
1600
- | duration | 默认 4.5 秒后自动关闭,配置为 null 则不自动关闭 | number | 4.5 | - |
1601
- | showProgress | 显示自动关闭通知框的进度条 | boolean | | 5.18.0 |
1602
- | pauseOnHover | 悬停时是否暂停计时器 | boolean | true | 5.18.0 |
1603
- | icon | 自定义图标 | ReactNode | - | - |
1604
- | key | 当前通知唯一标志 | string | - | - |
1605
- | message | 通知提醒标题,必选 | ReactNode | - | - |
1606
- | placement | 弹出位置,可选 | string | topRight | - |
1607
- | style | 自定义内联样式 | | - | - |
1608
- | role | 供屏幕阅读器识别的通知内容语义,默认为 | alert \| status | alert | 5.6.0 |
1609
- | onClick | 点击通知时触发的回调函数 | function | - | - |
1610
- | onClose | 当通知关闭时触发 | function | - | - |
1611
- | props | 透传至通知 | Object | - | - |
1612
-
1613
-
1614
-
1615
- - `notification.useNotification(config)`
1616
-
1617
- config 参数如下:
1618
-
1619
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
1620
- |--------|--------|--------|--------|--------|
1621
- | bottom | 消息从底部弹出时,距离底部的位置,单位像素 | number | 24 | |
1622
- | closeIcon | 自定义关闭图标 | ReactNode | true | 5.7.0:设置为 null 或 false 时隐藏关闭按钮 |
1623
- | getContainer | 配置渲染节点的输出位置 | () => HTMLNode | () => document.body | |
1624
- | placement | 弹出位置,可选 | string | topRight | |
1625
- | showProgress | 显示自动关闭通知框的进度条 | boolean | | 5.18.0 |
1626
- | pauseOnHover | 悬停时是否暂停计时器 | boolean | true | 5.18.0 |
1627
- | rtl | 是否开启 RTL 模式 | boolean | false | |
1628
- | stack | 堆叠模式,超过阈值时会将所有消息收起 | boolean \| | { threshold: 3 } | 5.10.0 |
1629
- | top | 消息从顶部弹出时,距离顶部的位置,单位像素 | number | 24 | |
1630
- | maxCount | 最大显示数,超过限制时,最早的消息会被自动关闭 | number | - | 4.17.0 |
1631
-
1632
-
1633
- ### 全局配置
1634
-
1635
- 还提供了一个全局配置方法,在调用前提前配置,全局一次生效。
1636
-
1637
- `notification.config(options)`
1638
-
1639
- 当你使用 `ConfigProvider` 进行全局化配置时,系统会默认自动开启 RTL 模式。(4.3.0+)当你想单独使用,可通过如下设置开启 RTL 模式。
1640
-
1641
-
1642
- ```js
1643
- notification.config({
1644
- placement: 'bottomRight',
1645
- bottom: 50,
1646
- duration: 3,
1647
- rtl: true,
1648
- });
1649
- ```
1650
-
1651
-
1652
- #### notification.config
1653
-
1654
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
1655
- |--------|--------|--------|--------|--------|
1656
- | bottom | 消息从底部弹出时,距离底部的位置,单位像素 | number | 24 | |
1657
- | closeIcon | 自定义关闭图标 | ReactNode | true | 5.7.0:设置为 null 或 false 时隐藏关闭按钮 |
1658
- | duration | 默认自动关闭延时,单位秒 | number | 4.5 | |
1659
- | showProgress | 显示自动关闭通知框的进度条 | boolean | | 5.18.0 |
1660
- | pauseOnHover | 悬停时是否暂停计时器 | boolean | true | 5.18.0 |
1661
- | getContainer | 配置渲染节点的输出位置,但依旧为全屏展示 | () => HTMLNode | () => document.body | |
1662
- | placement | 弹出位置,可选 | string | topRight | |
1663
- | rtl | 是否开启 RTL 模式 | boolean | false | |
1664
- | top | 消息从顶部弹出时,距离顶部的位置,单位像素 | number | 24 | |
1665
- | maxCount | 最大显示数,超过限制时,最早的消息会被自动关闭 | number | - | 4.17.0 |
1666
-
1667
-
1668
-
1669
-
1670
1517
  <DemoTitle title="Message" desc="一条简洁且临时显示的消息,为操作提供全局反馈">
1671
1518
  #### API
1672
1519
 
@@ -1767,137 +1614,208 @@ message.config({
1767
1614
 
1768
1615
 
1769
1616
 
1770
- <DemoTitle title="Input" desc="通过鼠标或键盘输入内容,为表单提供输入字段的基础容器。。">
1617
+ <DemoTitle title="Popconfirm" desc="点击元素,弹出气泡式的确认框。">
1771
1618
  #### API
1772
1619
 
1773
1620
  | 属性名 | 描述 | 类型 | 默认值 |
1774
1621
  |--------|--------|--------|--------|
1775
- | shape | 形态 | 'default' \| 'round' | default 默认 |
1622
+ | type | 类型 | 'info' \| 'warning' \| 'error' \| 'success' \| 'confirm' | 'confirm' |
1776
1623
 
1777
1624
 
1778
- <AntdApiRef url="https://ant.design/components/input-cn/#api"></AntdApiRef>
1625
+ <AntdApiRef url="https://ant.design/components/popconfirm-cn/#api"></AntdApiRef>
1779
1626
 
1780
1627
 
1781
1628
  ## antd API
1782
1629
 
1783
1630
  通用属性参考:[通用属性](/docs/react/common-props)
1784
1631
 
1785
- ### Input
1786
-
1787
1632
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
1788
1633
  |--------|--------|--------|--------|--------|
1789
- | addonAfter | 带标签的 input,设置后置标签 | ReactNode | - | |
1790
- | addonBefore | 带标签的 input,设置前置标签 | ReactNode | - | |
1791
- | allowClear | 可以点击清除图标删除内容 | boolean \| { clearIcon: ReactNode } | - | |
1792
- | classNames | 语义化结构 class | Record< | - | 5.4.0 |
1793
- | count | 字符计数配置 | | - | 5.10.0 |
1794
- | defaultValue | 输入框默认内容 | string | - | |
1795
- | disabled | 是否禁用状态,默认为 false | boolean | false | |
1796
- | id | 输入框的 id | string | - | |
1797
- | maxLength | 最大长度 | number | - | |
1798
- | prefix | 带有前缀图标的 input | ReactNode | - | |
1799
- | showCount | 是否展示字数 | boolean \| { formatter: (info: { value: string, count: number, maxLength?: number }) => ReactNode } | false | 4.18.0 info.value: 4.23.0 |
1800
- | status | 设置校验状态 | 'error' \| 'warning' | - | 4.19.0 |
1801
- | styles | 语义化结构 style | Record< | - | 5.4.0 |
1802
- | size | 控件大小。注:标准表单内的输入框大小限制为 | large | - | |
1803
- | suffix | 带有后缀图标的 input | ReactNode | - | |
1804
- | type | 声明 input 类型,同原生 input 标签的 type 属性,见: | string | text | |
1805
- | value | 输入框内容 | string | - | |
1806
- | variant | 形态变体 | outlined | outlined | 5.13.0 \| |
1807
- | onChange | 输入框内容变化时的回调 | function(e) | - | |
1808
- | onPressEnter | 按下回车的回调 | function(e) | - | |
1809
- | onClear | 按下清除按钮的回调 | () => void | - | 5.20.0 |
1634
+ | cancelButtonProps | cancel 按钮 props | | - | |
1635
+ | cancelText | 取消按钮文字 | string | 取消 | |
1636
+ | disabled | 阻止点击 Popconfirm 子元素时弹出确认框 | boolean | false | |
1637
+ | icon | 自定义弹出气泡 Icon 图标 | ReactNode | | |
1638
+ | okButtonProps | ok 按钮 props | | - | |
1639
+ | okText | 确认按钮文字 | string | 确定 | |
1640
+ | okType | 确认按钮类型 | string | primary | |
1641
+ | showCancel | 是否显示取消按钮 | boolean | true | 4.18.0 |
1642
+ | title | 确认框标题 | ReactNode \| () => ReactNode | - | |
1643
+ | description | 确认内容的详细描述 | ReactNode \| () => ReactNode | - | 5.1.0 |
1644
+ | onCancel | 点击取消的回调 | function(e) | - | |
1645
+ | onConfirm | 点击确认的回调 | function(e) | - | |
1646
+ | onPopupClick | 弹出气泡点击事件 | function(e) | - | 5.5.0 |
1810
1647
 
1811
1648
 
1812
- 如果 `Input` `Form.Item` 内,并且 `Form.Item` 设置了 `id` 属性,则 `value` `defaultValue` 和 `id` 属性会被自动设置。
1649
+ <!-- 共同的 API -->
1650
+ 以下 API 为 Tooltip、Popconfirm、Popover 共享的 API。
1813
1651
 
1814
- Input 的其他属性和 React 自带的 [input](https://reactjs.org/docs/dom-elements.html#all-supported-html-attributes) 一致。
1652
+ <!-- prettier-ignore -->
1653
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
1654
+ |--------|--------|--------|--------|--------|
1655
+ | align | 该值将合并到 placement 的配置中,设置参考 | object | - | |
1656
+ | arrow | 修改箭头的显示状态以及修改箭头是否指向目标元素中心 | boolean \| { pointAtCenter: boolean } | true | 5.2.0 |
1657
+ | autoAdjustOverflow | 气泡被遮挡时自动调整位置 | boolean | true | |
1658
+ | color | 背景颜色 | string | - | 4.3.0 |
1659
+ | defaultOpen | 默认是否显隐 | boolean | false | 4.23.0 |
1660
+ | destroyOnHidden | 关闭后是否销毁 dom | boolean | false | 5.25.0 |
1661
+ | fresh | 默认情况下,Tooltip 在关闭时会缓存内容。设置该属性后会始终保持更新 | boolean | false | 5.10.0 |
1662
+ | getPopupContainer | 浮层渲染父节点,默认渲染到 body 上 | (triggerNode: HTMLElement) => HTMLElement | () => document.body | |
1663
+ | mouseEnterDelay | 鼠标移入后延时多少才显示 Tooltip,单位:秒 | number | 0.1 | |
1664
+ | mouseLeaveDelay | 鼠标移出后延时多少才隐藏 Tooltip,单位:秒 | number | 0.1 | |
1665
+ | placement | 气泡框位置,可选 | string | top | |
1666
+ | trigger | 触发行为,可选 | string \| string[] | hover | |
1667
+ | open | 用于手动控制浮层显隐,小于 4.23.0 使用 | boolean | false | 4.23.0 |
1668
+ | zIndex | 设置 Tooltip 的 | number | - | |
1669
+ | onOpenChange | 显示隐藏的回调 | (open: boolean) => void | - | 4.23.0 |
1815
1670
 
1816
- #### CountConfig
1817
1671
 
1818
1672
 
1819
- ```tsx
1820
- interface CountConfig {
1821
- // 最大字符数,不同于原生 `maxLength`,超出后标红但不会截断
1822
- max?: number;
1823
- // 自定义字符计数,例如标准 emoji 长度大于 1,可以自定义计数策略将其改为 1
1824
- strategy?: (value: string) => number;
1825
- // 同 `showCount`
1826
- show?: boolean | ((args: { value: string; count: number; maxLength?: number }) => ReactNode);
1827
- // 当字符数超出 `count.max` 时的自定义裁剪逻辑,不配置时不进行裁剪
1828
- exceedFormatter?: (value: string, config: { max: number }) => string;
1829
- }
1830
- ```
1831
1673
 
1674
+ <DemoTitle title="Notification" desc="用于指示任务的完成进度">
1675
+ #### API
1832
1676
 
1833
- ### Input.TextArea
1677
+ <AntdApiRef url="https://ant.design/components/notification-cn/#api"></AntdApiRef>
1834
1678
 
1835
- 同 Input 属性,外加:
1836
1679
 
1837
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
1838
- |--------|--------|--------|--------|--------|
1839
- | autoSize | 自适应内容高度,可设置为 true \| false 或对象:{ minRows: 2, maxRows: 6 } | boolean \| object | false | |
1840
- | classNames | 语义化结构 class | Record< | - | 5.4.0 |
1841
- | styles | 语义化结构 style | Record< | - | 5.4.0 |
1680
+ ## antd API
1842
1681
 
1682
+ 通用属性参考:[通用属性](/docs/react/common-props)
1843
1683
 
1844
- `Input.TextArea` 的其他属性和浏览器自带的 [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) 一致。
1845
1684
 
1846
- ### Input.Search
1685
+ - `notification.success(config)`
1686
+ - `notification.error(config)`
1687
+ - `notification.info(config)`
1688
+ - `notification.warning(config)`
1689
+ - `notification.open(config)`
1690
+ - `notification.destroy(key?: String)`
1847
1691
 
1848
- | 参数 | 说明 | 类型 | 默认值 |
1849
- |--------|--------|--------|--------|
1850
- | enterButton | 是否有确认按钮,可设为按钮文字。该属性会与 | ReactNode | false |
1851
- | loading | 搜索 loading | boolean | false |
1852
- | onSearch | 点击搜索图标、清除图标,或按下回车键时的回调 | function(value, event, { source: "input" \| "clear" }) | - |
1692
+ config 参数如下:
1693
+
1694
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
1695
+ |--------|--------|--------|--------|--------|
1696
+ | actions | 自定义按钮组 | ReactNode | - | 5.24.0 |
1697
+ | className | 自定义 CSS class | string | - | - |
1698
+ | closeIcon | 自定义关闭图标 | ReactNode | true | 5.7.0:设置为 null 或 false 时隐藏关闭按钮 |
1699
+ | description | 通知提醒内容,必选 | ReactNode | - | - |
1700
+ | duration | 默认 4.5 秒后自动关闭,配置为 null 则不自动关闭 | number | 4.5 | - |
1701
+ | showProgress | 显示自动关闭通知框的进度条 | boolean | | 5.18.0 |
1702
+ | pauseOnHover | 悬停时是否暂停计时器 | boolean | true | 5.18.0 |
1703
+ | icon | 自定义图标 | ReactNode | - | - |
1704
+ | key | 当前通知唯一标志 | string | - | - |
1705
+ | message | 通知提醒标题,必选 | ReactNode | - | - |
1706
+ | placement | 弹出位置,可选 | string | topRight | - |
1707
+ | style | 自定义内联样式 | | - | - |
1708
+ | role | 供屏幕阅读器识别的通知内容语义,默认为 | alert \| status | alert | 5.6.0 |
1709
+ | onClick | 点击通知时触发的回调函数 | function | - | - |
1710
+ | onClose | 当通知关闭时触发 | function | - | - |
1711
+ | props | 透传至通知 | Object | - | - |
1853
1712
 
1854
1713
 
1855
- 其余属性和 Input 一致。
1856
1714
 
1857
- ### Input.Password
1715
+ - `notification.useNotification(config)`
1716
+
1717
+ config 参数如下:
1858
1718
 
1859
1719
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
1860
1720
  |--------|--------|--------|--------|--------|
1861
- | iconRender | 自定义切换按钮 | (visible) => ReactNode | (visible) => (visible ? : ) | 4.3.0 |
1862
- | visibilityToggle | 是否显示切换按钮或者控制密码显隐 | boolean \| | true | |
1721
+ | bottom | 消息从底部弹出时,距离底部的位置,单位像素 | number | 24 | |
1722
+ | closeIcon | 自定义关闭图标 | ReactNode | true | 5.7.0:设置为 null 或 false 时隐藏关闭按钮 |
1723
+ | getContainer | 配置渲染节点的输出位置 | () => HTMLNode | () => document.body | |
1724
+ | placement | 弹出位置,可选 | string | topRight | |
1725
+ | showProgress | 显示自动关闭通知框的进度条 | boolean | | 5.18.0 |
1726
+ | pauseOnHover | 悬停时是否暂停计时器 | boolean | true | 5.18.0 |
1727
+ | rtl | 是否开启 RTL 模式 | boolean | false | |
1728
+ | stack | 堆叠模式,超过阈值时会将所有消息收起 | boolean \| | { threshold: 3 } | 5.10.0 |
1729
+ | top | 消息从顶部弹出时,距离顶部的位置,单位像素 | number | 24 | |
1730
+ | maxCount | 最大显示数,超过限制时,最早的消息会被自动关闭 | number | - | 4.17.0 |
1863
1731
 
1864
1732
 
1865
- ### Input.OTP
1733
+ ### 全局配置
1866
1734
 
1867
- `5.16.0` 新增。
1735
+ 还提供了一个全局配置方法,在调用前提前配置,全局一次生效。
1868
1736
 
1869
- 开发者注意事项:当 `mask` 属性的类型为 string 时,我们强烈推荐接收单个字符或单个 emoji,如果传入多个字符或多个 emoji,则会在控制台抛出警告。
1737
+ `notification.config(options)`
1738
+
1739
+ 当你使用 `ConfigProvider` 进行全局化配置时,系统会默认自动开启 RTL 模式。(4.3.0+)当你想单独使用,可通过如下设置开启 RTL 模式。
1740
+
1741
+
1742
+ ```js
1743
+ notification.config({
1744
+ placement: 'bottomRight',
1745
+ bottom: 50,
1746
+ duration: 3,
1747
+ rtl: true,
1748
+ });
1749
+ ```
1750
+
1751
+
1752
+ #### notification.config
1870
1753
 
1871
1754
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
1872
1755
  |--------|--------|--------|--------|--------|
1873
- | defaultValue | 默认值 | string | - | |
1874
- | disabled | 是否禁用 | boolean | false | |
1875
- | formatter | 格式化展示,留空字段会被 | (value: string) => string | - | |
1876
- | separator | 分隔符,在指定索引的输入框后渲染分隔符 | ReactNode \|((i: number) => ReactNode) | - | 5.24.0 |
1877
- | mask | 自定义展示,和 | boolean \| string | false | 5.17.0 |
1878
- | length | 输入元素数量 | number | 6 | |
1879
- | status | 设置校验状态 | 'error' \| 'warning' | - | |
1880
- | size | 输入框大小 | small | middle | |
1881
- | variant | 形态变体 | outlined | outlined | underlined |
1882
- | value | 输入框内容 | string | - | |
1883
- | onChange | 当输入框内容全部填充时触发回调 | (value: string) => void | - | |
1884
- | onInput | 输入值变化时触发的回调 | (value: string[]) => void | - | 5.22.0 |
1756
+ | bottom | 消息从底部弹出时,距离底部的位置,单位像素 | number | 24 | |
1757
+ | closeIcon | 自定义关闭图标 | ReactNode | true | 5.7.0:设置为 null 或 false 时隐藏关闭按钮 |
1758
+ | duration | 默认自动关闭延时,单位秒 | number | 4.5 | |
1759
+ | showProgress | 显示自动关闭通知框的进度条 | boolean | | 5.18.0 |
1760
+ | pauseOnHover | 悬停时是否暂停计时器 | boolean | true | 5.18.0 |
1761
+ | getContainer | 配置渲染节点的输出位置,但依旧为全屏展示 | () => HTMLNode | () => document.body | |
1762
+ | placement | 弹出位置,可选 | string | topRight | |
1763
+ | rtl | 是否开启 RTL 模式 | boolean | false | |
1764
+ | top | 消息从顶部弹出时,距离顶部的位置,单位像素 | number | 24 | |
1765
+ | maxCount | 最大显示数,超过限制时,最早的消息会被自动关闭 | number | - | 4.17.0 |
1885
1766
 
1886
1767
 
1887
- #### VisibilityToggle
1888
1768
 
1889
- | Property | Description | Type | Default | Version |
1769
+
1770
+ <DemoTitle title="InputNumber" desc="通过鼠标或键盘,输入范围内的数值。">
1771
+ #### API
1772
+
1773
+ <AntdApiRef url="https://ant.design/components/input-number-cn/#api"></AntdApiRef>
1774
+
1775
+
1776
+ ## antd API
1777
+
1778
+ 通用属性参考:[通用属性](/docs/react/common-props)
1779
+
1780
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
1890
1781
  |--------|--------|--------|--------|--------|
1891
- | visible | 用于手动控制密码显隐 | boolean | false | 4.24 |
1892
- | onVisibleChange | 显隐密码的回调 | (visible) => void | - | 4.24 |
1782
+ | addonAfter | 带标签的 input,设置后置标签 | ReactNode | - | 4.17.0 |
1783
+ | addonBefore | 带标签的 input,设置前置标签 | ReactNode | - | 4.17.0 |
1784
+ | autoFocus | 自动获取焦点 | boolean | false | - |
1785
+ | changeOnBlur | 是否在失去焦点时,触发 | boolean | true | 5.11.0 |
1786
+ | changeOnWheel | 允许鼠标滚轮改变数值 | boolean | - | 5.14.0 |
1787
+ | controls | 是否显示增减按钮,也可设置自定义箭头图标 | boolean \| { upIcon?: React.ReactNode; downIcon?: React.ReactNode; } | - | 4.19.0 |
1788
+ | decimalSeparator | 小数点 | string | - | - |
1789
+ | placeholder | 占位符 | string | - | |
1790
+ | defaultValue | 初始值 | number | - | - |
1791
+ | disabled | 禁用 | boolean | false | - |
1792
+ | formatter | 指定输入框展示值的格式 | function(value: number \| string, info: { userTyping: boolean, input: string }): string | - | info: 4.17.0 |
1793
+ | keyboard | 是否启用键盘快捷行为 | boolean | true | 4.12.0 |
1794
+ | max | 最大值 | number | | - |
1795
+ | min | 最小值 | number | | - |
1796
+ | parser | 指定从 | function(string): number | - | - |
1797
+ | precision | 数值精度,配置 | number | - | - |
1798
+ | readOnly | 只读 | boolean | false | - |
1799
+ | status | 设置校验状态 | 'error' \| 'warning' | - | 4.19.0 |
1800
+ | prefix | 带有前缀图标的 input | ReactNode | - | 4.17.0 |
1801
+ | suffix | 带有后缀图标的 input | ReactNode | - | 5.20.0 |
1802
+ | size | 输入框大小 | large | - | - |
1803
+ | step | 每次改变步数,可以为小数 | number \| string | 1 | - |
1804
+ | stringMode | 字符值模式,开启后支持高精度小数。同时 | boolean | false | 4.13.0 |
1805
+ | value | 当前值 | number | - | - |
1806
+ | variant | 形态变体 | outlined | outlined | 5.13.0 \| |
1807
+ | onChange | 变化回调 | function(value: number \| string \| null) | - | - |
1808
+ | onPressEnter | 按下回车的回调 | function(e) | - | - |
1809
+ | onStep | 点击上下箭头的回调 | (value: number, info: { offset: number, type: 'up' \| 'down' }) => void | - | 4.7.0 |
1893
1810
 
1894
1811
 
1895
- #### Input Methods
1812
+ ## Ref
1896
1813
 
1897
1814
  | 名称 | 说明 | 参数 | 版本 |
1898
1815
  |--------|--------|--------|--------|
1899
- | blur | 取消焦点 | - | |
1900
- | focus | 获取焦点 | (option?: { preventScroll?: boolean, cursor?: 'start' \| 'end' \| 'all' }) | option - 4.10.0 |
1816
+ | blur() | 移除焦点 | - | |
1817
+ | focus() | 获取焦点 | (option?: { preventScroll?: boolean, cursor?: 'start' \| 'end' \| 'all' }) | cursor - 5.22.0 |
1818
+ | nativeElement | 获取原生 DOM 元素 | - | 5.17.3 |
1901
1819
 
1902
1820
 
1903
1821
 
@@ -2069,55 +1987,137 @@ type TransformAction =
2069
1987
 
2070
1988
 
2071
1989
 
2072
- <DemoTitle title="InputNumber" desc="通过鼠标或键盘,输入范围内的数值。">
1990
+ <DemoTitle title="Input" desc="通过鼠标或键盘输入内容,为表单提供输入字段的基础容器。。">
2073
1991
  #### API
2074
1992
 
2075
- <AntdApiRef url="https://ant.design/components/input-number-cn/#api"></AntdApiRef>
1993
+ | 属性名 | 描述 | 类型 | 默认值 |
1994
+ |--------|--------|--------|--------|
1995
+ | shape | 形态 | 'default' \| 'round' | default 默认 |
1996
+
1997
+
1998
+ <AntdApiRef url="https://ant.design/components/input-cn/#api"></AntdApiRef>
2076
1999
 
2077
2000
 
2078
2001
  ## antd API
2079
2002
 
2080
2003
  通用属性参考:[通用属性](/docs/react/common-props)
2081
2004
 
2005
+ ### Input
2006
+
2082
2007
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
2083
2008
  |--------|--------|--------|--------|--------|
2084
- | addonAfter | 带标签的 input,设置后置标签 | ReactNode | - | 4.17.0 |
2085
- | addonBefore | 带标签的 input,设置前置标签 | ReactNode | - | 4.17.0 |
2086
- | autoFocus | 自动获取焦点 | boolean | false | - |
2087
- | changeOnBlur | 是否在失去焦点时,触发 | boolean | true | 5.11.0 |
2088
- | changeOnWheel | 允许鼠标滚轮改变数值 | boolean | - | 5.14.0 |
2089
- | controls | 是否显示增减按钮,也可设置自定义箭头图标 | boolean \| { upIcon?: React.ReactNode; downIcon?: React.ReactNode; } | - | 4.19.0 |
2090
- | decimalSeparator | 小数点 | string | - | - |
2091
- | placeholder | 占位符 | string | - | |
2092
- | defaultValue | 初始值 | number | - | - |
2093
- | disabled | 禁用 | boolean | false | - |
2094
- | formatter | 指定输入框展示值的格式 | function(value: number \| string, info: { userTyping: boolean, input: string }): string | - | info: 4.17.0 |
2095
- | keyboard | 是否启用键盘快捷行为 | boolean | true | 4.12.0 |
2096
- | max | 最大值 | number | | - |
2097
- | min | 最小值 | number | | - |
2098
- | parser | 指定从 | function(string): number | - | - |
2099
- | precision | 数值精度,配置 | number | - | - |
2100
- | readOnly | 只读 | boolean | false | - |
2009
+ | addonAfter | 带标签的 input,设置后置标签 | ReactNode | - | |
2010
+ | addonBefore | 带标签的 input,设置前置标签 | ReactNode | - | |
2011
+ | allowClear | 可以点击清除图标删除内容 | boolean \| { clearIcon: ReactNode } | - | |
2012
+ | classNames | 语义化结构 class | Record< | - | 5.4.0 |
2013
+ | count | 字符计数配置 | | - | 5.10.0 |
2014
+ | defaultValue | 输入框默认内容 | string | - | |
2015
+ | disabled | 是否禁用状态,默认为 false | boolean | false | |
2016
+ | id | 输入框的 id | string | - | |
2017
+ | maxLength | 最大长度 | number | - | |
2018
+ | prefix | 带有前缀图标的 input | ReactNode | - | |
2019
+ | showCount | 是否展示字数 | boolean \| { formatter: (info: { value: string, count: number, maxLength?: number }) => ReactNode } | false | 4.18.0 info.value: 4.23.0 |
2101
2020
  | status | 设置校验状态 | 'error' \| 'warning' | - | 4.19.0 |
2102
- | prefix | 带有前缀图标的 input | ReactNode | - | 4.17.0 |
2103
- | suffix | 带有后缀图标的 input | ReactNode | - | 5.20.0 |
2104
- | size | 输入框大小 | large | - | - |
2105
- | step | 每次改变步数,可以为小数 | number \| string | 1 | - |
2106
- | stringMode | 字符值模式,开启后支持高精度小数。同时 | boolean | false | 4.13.0 |
2107
- | value | 当前值 | number | - | - |
2021
+ | styles | 语义化结构 style | Record< | - | 5.4.0 |
2022
+ | size | 控件大小。注:标准表单内的输入框大小限制为 | large | - | |
2023
+ | suffix | 带有后缀图标的 input | ReactNode | - | |
2024
+ | type | 声明 input 类型,同原生 input 标签的 type 属性,见: | string | text | |
2025
+ | value | 输入框内容 | string | - | |
2108
2026
  | variant | 形态变体 | outlined | outlined | 5.13.0 \| |
2109
- | onChange | 变化回调 | function(value: number \| string \| null) | - | - |
2110
- | onPressEnter | 按下回车的回调 | function(e) | - | - |
2111
- | onStep | 点击上下箭头的回调 | (value: number, info: { offset: number, type: 'up' \| 'down' }) => void | - | 4.7.0 |
2027
+ | onChange | 输入框内容变化时的回调 | function(e) | - | |
2028
+ | onPressEnter | 按下回车的回调 | function(e) | - | |
2029
+ | onClear | 按下清除按钮的回调 | () => void | - | 5.20.0 |
2112
2030
 
2113
2031
 
2114
- ## Ref
2032
+ 如果 `Input` 在 `Form.Item` 内,并且 `Form.Item` 设置了 `id` 属性,则 `value` `defaultValue` 和 `id` 属性会被自动设置。
2033
+
2034
+ Input 的其他属性和 React 自带的 [input](https://reactjs.org/docs/dom-elements.html#all-supported-html-attributes) 一致。
2035
+
2036
+ #### CountConfig
2037
+
2038
+
2039
+ ```tsx
2040
+ interface CountConfig {
2041
+ // 最大字符数,不同于原生 `maxLength`,超出后标红但不会截断
2042
+ max?: number;
2043
+ // 自定义字符计数,例如标准 emoji 长度大于 1,可以自定义计数策略将其改为 1
2044
+ strategy?: (value: string) => number;
2045
+ // 同 `showCount`
2046
+ show?: boolean | ((args: { value: string; count: number; maxLength?: number }) => ReactNode);
2047
+ // 当字符数超出 `count.max` 时的自定义裁剪逻辑,不配置时不进行裁剪
2048
+ exceedFormatter?: (value: string, config: { max: number }) => string;
2049
+ }
2050
+ ```
2051
+
2052
+
2053
+ ### Input.TextArea
2054
+
2055
+ 同 Input 属性,外加:
2056
+
2057
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
2058
+ |--------|--------|--------|--------|--------|
2059
+ | autoSize | 自适应内容高度,可设置为 true \| false 或对象:{ minRows: 2, maxRows: 6 } | boolean \| object | false | |
2060
+ | classNames | 语义化结构 class | Record< | - | 5.4.0 |
2061
+ | styles | 语义化结构 style | Record< | - | 5.4.0 |
2062
+
2063
+
2064
+ `Input.TextArea` 的其他属性和浏览器自带的 [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) 一致。
2065
+
2066
+ ### Input.Search
2067
+
2068
+ | 参数 | 说明 | 类型 | 默认值 |
2069
+ |--------|--------|--------|--------|
2070
+ | enterButton | 是否有确认按钮,可设为按钮文字。该属性会与 | ReactNode | false |
2071
+ | loading | 搜索 loading | boolean | false |
2072
+ | onSearch | 点击搜索图标、清除图标,或按下回车键时的回调 | function(value, event, { source: "input" \| "clear" }) | - |
2073
+
2074
+
2075
+ 其余属性和 Input 一致。
2076
+
2077
+ ### Input.Password
2078
+
2079
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
2080
+ |--------|--------|--------|--------|--------|
2081
+ | iconRender | 自定义切换按钮 | (visible) => ReactNode | (visible) => (visible ? : ) | 4.3.0 |
2082
+ | visibilityToggle | 是否显示切换按钮或者控制密码显隐 | boolean \| | true | |
2083
+
2084
+
2085
+ ### Input.OTP
2086
+
2087
+ `5.16.0` 新增。
2088
+
2089
+ 开发者注意事项:当 `mask` 属性的类型为 string 时,我们强烈推荐接收单个字符或单个 emoji,如果传入多个字符或多个 emoji,则会在控制台抛出警告。
2090
+
2091
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
2092
+ |--------|--------|--------|--------|--------|
2093
+ | defaultValue | 默认值 | string | - | |
2094
+ | disabled | 是否禁用 | boolean | false | |
2095
+ | formatter | 格式化展示,留空字段会被 | (value: string) => string | - | |
2096
+ | separator | 分隔符,在指定索引的输入框后渲染分隔符 | ReactNode \|((i: number) => ReactNode) | - | 5.24.0 |
2097
+ | mask | 自定义展示,和 | boolean \| string | false | 5.17.0 |
2098
+ | length | 输入元素数量 | number | 6 | |
2099
+ | status | 设置校验状态 | 'error' \| 'warning' | - | |
2100
+ | size | 输入框大小 | small | middle | |
2101
+ | variant | 形态变体 | outlined | outlined | underlined |
2102
+ | value | 输入框内容 | string | - | |
2103
+ | onChange | 当输入框内容全部填充时触发回调 | (value: string) => void | - | |
2104
+ | onInput | 输入值变化时触发的回调 | (value: string[]) => void | - | 5.22.0 |
2105
+
2106
+
2107
+ #### VisibilityToggle
2108
+
2109
+ | Property | Description | Type | Default | Version |
2110
+ |--------|--------|--------|--------|--------|
2111
+ | visible | 用于手动控制密码显隐 | boolean | false | 4.24 |
2112
+ | onVisibleChange | 显隐密码的回调 | (visible) => void | - | 4.24 |
2113
+
2114
+
2115
+ #### Input Methods
2115
2116
 
2116
2117
  | 名称 | 说明 | 参数 | 版本 |
2117
2118
  |--------|--------|--------|--------|
2118
- | blur() | 移除焦点 | - | |
2119
- | focus() | 获取焦点 | (option?: { preventScroll?: boolean, cursor?: 'start' \| 'end' \| 'all' }) | cursor - 5.22.0 |
2120
- | nativeElement | 获取原生 DOM 元素 | - | 5.17.3 |
2119
+ | blur | 取消焦点 | - | |
2120
+ | focus | 获取焦点 | (option?: { preventScroll?: boolean, cursor?: 'start' \| 'end' \| 'all' }) | option - 4.10.0 |
2121
2121
 
2122
2122
 
2123
2123
 
@@ -2728,153 +2728,55 @@ type Rule = RuleConfig | ((form: FormInstance) => RuleConfig);
2728
2728
 
2729
2729
 
2730
2730
 
2731
- <DemoTitle title="Dropdown" desc="向下弹出的列表。">
2731
+ <DemoTitle title="FloatButton" desc="用于网站上的全局功能;无论浏览到何处都可以看见的按钮。">
2732
2732
  #### API
2733
2733
 
2734
- <AntdApiRef url="https://ant.design/components/dropdown-cn/#api"></AntdApiRef>
2734
+ <AntdApiRef url="https://ant.design/components/float-button-cn/#api"></AntdApiRef>
2735
2735
 
2736
2736
 
2737
2737
  ## antd API
2738
2738
 
2739
2739
  通用属性参考:[通用属性](/docs/react/common-props)
2740
2740
 
2741
- ### Dropdown
2741
+ `antd@5.0.0` 版本开始提供该组件。
2742
+
2743
+ ### 共同的 API
2742
2744
 
2743
2745
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
2744
2746
  |--------|--------|--------|--------|--------|
2745
- | arrow | 下拉框箭头是否显示 | boolean \| { pointAtCenter: boolean } | false | |
2746
- | autoAdjustOverflow | 下拉框被遮挡时自动调整位置 | boolean | true | 5.2.0 |
2747
- | autoFocus | 打开后自动聚焦下拉框 | boolean | false | 4.21.0 |
2748
- | disabled | 菜单是否禁用 | boolean | - | |
2749
- | destroyOnHidden | 关闭后是否销毁 Dropdown | boolean | false | 5.25.0 |
2750
- | popupRender | 自定义弹出框内容 | (menus: ReactNode) => ReactNode | - | 5.25.0 |
2751
- | getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。 | (triggerNode: HTMLElement) => HTMLElement | () => document.body | |
2752
- | menu | 菜单配置项 | | - | 4.24.0 |
2753
- | overlayClassName | 下拉根元素的类名称 | string | - | |
2754
- | overlayStyle | 下拉根元素的样式 | CSSProperties | - | |
2755
- | placement | 菜单弹出位置: | string | bottomLeft | |
2756
- | trigger | 触发下拉的行为,移动端不支持 hover | Array< | [ | |
2757
- | open | 菜单是否显示,小于 4.23.0 使用 | boolean | - | 4.23.0 |
2758
- | onOpenChange | 菜单显示状态改变时调用,点击菜单按钮导致的消失不会触发。小于 4.23.0 使用 | (open: boolean, info: { source: 'trigger' \| 'menu' }) => void | - | info.source |
2759
-
2760
-
2761
- ### Dropdown.Button
2762
-
2763
- 属性与 Dropdown 的相同。还包含以下属性:
2764
-
2765
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
2766
- |--------|--------|--------|--------|--------|
2767
- | buttonsRender | 自定义左右两个按钮 | (buttons: ReactNode[]) => ReactNode[] | - | |
2768
- | loading | 设置按钮载入状态,和 | boolean \| { delay: number, icon: ReactNode } | false | icon: 5.23.0 |
2769
- | danger | 设置危险按钮 | boolean | - | 4.23.0 |
2770
- | icon | 右侧的 icon | ReactNode | - | |
2771
- | size | 按钮大小,和 | large | middle | |
2772
- | type | 按钮类型,和 | primary | default | |
2773
- | onClick | 点击左侧按钮的回调,和 | (event: React.MouseEvent) => void | - | |
2774
-
2775
-
2776
- ## 注意
2777
-
2778
- 请确保 `Dropdown` 的子元素能接受 `onMouseEnter`、`onMouseLeave`、`onFocus`、`onClick` 事件。
2779
- ## antd API
2780
-
2781
- ### Menu
2782
-
2783
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
2784
- |--------|--------|--------|--------|--------|
2785
- | defaultOpenKeys | 初始展开的 SubMenu 菜单项 key 数组 | string[] | - | |
2786
- | defaultSelectedKeys | 初始选中的菜单项 key 数组 | string[] | - | |
2787
- | expandIcon | 自定义展开图标 | ReactNode \| | - | 4.9.0 |
2788
- | forceSubMenuRender | 在子菜单展示之前就渲染进 DOM | boolean | false | |
2789
- | inlineCollapsed | inline 时菜单是否收起状态 | boolean | - | |
2790
- | inlineIndent | inline 模式的菜单缩进宽度 | number | 24 | |
2791
- | items | 菜单内容 | | - | 4.20.0 |
2792
- | mode | 菜单类型,现在支持垂直、水平、和内嵌模式三种 | vertical | vertical | |
2793
- | multiple | 是否允许多选 | boolean | false | |
2794
- | openKeys | 当前展开的 SubMenu 菜单项 key 数组 | string[] | - | |
2795
- | overflowedIndicator | 用于自定义 Menu 水平空间不足时的省略收缩的图标 | ReactNode | | |
2796
- | selectable | 是否允许选中 | boolean | true | |
2797
- | selectedKeys | 当前选中的菜单项 key 数组 | string[] | - | |
2798
- | style | 根节点样式 | CSSProperties | - | |
2799
- | subMenuCloseDelay | 用户鼠标离开子菜单后关闭延时,单位:秒 | number | 0.1 | |
2800
- | subMenuOpenDelay | 用户鼠标进入子菜单后开启延时,单位:秒 | number | 0 | |
2801
- | theme | 主题颜色 | light | light | |
2802
- | triggerSubMenuAction | SubMenu 展开/关闭的触发行为 | hover | hover | |
2803
- | onClick | 点击 MenuItem 调用此函数 | function({ item, key, keyPath, domEvent }) | - | |
2804
- | onDeselect | 取消选中时调用,仅在 multiple 生效 | function({ item, key, keyPath, selectedKeys, domEvent }) | - | |
2805
- | onOpenChange | SubMenu 展开/关闭的回调 | function(openKeys: string[]) | - | |
2806
- | onSelect | 被选中时调用 | function({ item, key, keyPath, selectedKeys, domEvent }) | -   | |
2807
-
2808
-
2809
- 更多属性查看 [rc-menu](https://github.com/react-component/menu#api)
2810
-
2811
- ### ItemType
2812
-
2813
- type ItemType = [MenuItemType](#menuitemtype) | [SubMenuType](#submenutype) | [MenuItemGroupType](#menuitemgrouptype) | [MenuDividerType](#menudividertype);
2814
-
2815
- #### MenuItemType
2816
-
2817
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
2818
- |--------|--------|--------|--------|--------|
2819
- | danger | 展示错误状态样式 | boolean | false | |
2820
- | disabled | 是否禁用 | boolean | false | |
2821
- | extra | 额外节点 | ReactNode | - | 5.21.0 |
2822
- | icon | 菜单图标 | ReactNode | - | |
2823
- | key | item 的唯一标志 | string | - | |
2824
- | label | 菜单项标题 | ReactNode | - | |
2825
- | title | 设置收缩时展示的悬浮标题 | string | - | |
2826
-
2827
-
2828
- #### SubMenuType
2829
-
2830
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
2831
- |--------|--------|--------|--------|--------|
2832
- | children | 子菜单的菜单项 | | - | |
2833
- | disabled | 是否禁用 | boolean | false | |
2834
- | icon | 菜单图标 | ReactNode | - | |
2835
- | key | 唯一标志 | string | - | |
2836
- | label | 菜单项标题 | ReactNode | - | |
2837
- | popupClassName | 子菜单样式, | string | - | |
2838
- | popupOffset | 子菜单偏移量, | [number, number] | - | |
2839
- | onTitleClick | 点击子菜单标题 | function({ key, domEvent }) | - | |
2840
- | theme | 设置子菜单的主题,默认从 Menu 上继承 | light | - | |
2841
-
2842
-
2843
- #### MenuItemGroupType
2844
-
2845
- 定义类型为 `group` 时,会作为分组处理:
2846
-
2747
+ | icon | 自定义图标 | ReactNode | - | |
2748
+ | description | 文字及其它内容 | ReactNode | - | |
2749
+ | tooltip | 气泡卡片的内容 | ReactNode \| | - | TooltipProps: 5.25.0 |
2750
+ | type | 设置按钮类型 | default | default | |
2751
+ | shape | 设置按钮形状 | circle | circle | |
2752
+ | onClick | 点击按钮时的回调 | (event) => void | - | |
2753
+ | href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - | |
2754
+ | target | 相当于 a 标签的 target 属性,href 存在时生效 | string | - | |
2755
+ | htmlType | 设置 | submit | button | 5.21.0 |
2756
+ | badge | 带徽标数字的悬浮按钮(不支持 | | - | 5.4.0 |
2847
2757
 
2848
- ```ts
2849
- const groupItem = {
2850
- type: 'group', // Must have
2851
- label: 'My Group',
2852
- children: [],
2853
- };
2854
- ```
2855
2758
 
2759
+ ### FloatButton.Group
2856
2760
 
2857
2761
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
2858
2762
  |--------|--------|--------|--------|--------|
2859
- | children | 分组的菜单项 | | - | |
2860
- | label | 分组标题 | ReactNode | - | |
2861
-
2862
-
2863
- #### MenuDividerType
2864
-
2865
- 菜单项分割线,只用在弹出菜单内,需要定义类型为 `divider`:
2866
-
2763
+ | shape | 设置包含的 FloatButton 按钮形状 | circle | circle | |
2764
+ | trigger | 触发方式(有触发方式为菜单模式) | click | - | |
2765
+ | open | 受控展开,需配合 trigger 一起使用 | boolean | - | |
2766
+ | closeIcon | 自定义关闭按钮 | React.ReactNode | | |
2767
+ | placement | 自定义菜单弹出位置 | top | top | 5.21.0 |
2768
+ | onOpenChange | 展开收起时的回调,需配合 trigger 一起使用 | (open: boolean) => void | - | |
2769
+ | onClick | 点击按钮时的回调(仅在菜单模式中有效) | (event) => void | - | 5.3.0 |
2867
2770
 
2868
- ```ts
2869
- const dividerItem = {
2870
- type: 'divider', // Must have
2871
- };
2872
- ```
2873
2771
 
2772
+ ### FloatButton.BackTop
2874
2773
 
2875
2774
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
2876
2775
  |--------|--------|--------|--------|--------|
2877
- | dashed | 是否虚线 | boolean | false | |
2776
+ | duration | 回到顶部所需时间(ms) | number | 450 | |
2777
+ | target | 设置需要监听其滚动事件的元素 | () => HTMLElement | () => window | |
2778
+ | visibilityHeight | 滚动高度达到此参数值才出现 BackTop | number | 400 | |
2779
+ | onClick | 点击按钮的回调函数 | () => void | - | |
2878
2780
 
2879
2781
 
2880
2782
 
@@ -2923,228 +2825,191 @@ const dividerItem = {
2923
2825
 
2924
2826
 
2925
2827
 
2926
- <DemoTitle title="FloatButton" desc="用于网站上的全局功能;无论浏览到何处都可以看见的按钮。">
2828
+ <DemoTitle title="Descriptions" desc="展示多个只读字段的组合">
2927
2829
  #### API
2928
2830
 
2929
- <AntdApiRef url="https://ant.design/components/float-button-cn/#api"></AntdApiRef>
2831
+ <AntdApiRef url="https://ant.design/components/descriptions-cn/#api"></AntdApiRef>
2930
2832
 
2931
2833
 
2932
2834
  ## antd API
2933
2835
 
2934
2836
  通用属性参考:[通用属性](/docs/react/common-props)
2935
2837
 
2936
- `antd@5.0.0` 版本开始提供该组件。
2937
-
2938
- ### 共同的 API
2838
+ ### Descriptions
2939
2839
 
2940
2840
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
2941
2841
  |--------|--------|--------|--------|--------|
2942
- | icon | 自定义图标 | ReactNode | - | |
2943
- | description | 文字及其它内容 | ReactNode | - | |
2944
- | tooltip | 气泡卡片的内容 | ReactNode \| | - | TooltipProps: 5.25.0 |
2945
- | type | 设置按钮类型 | default | default | |
2946
- | shape | 设置按钮形状 | circle | circle | |
2947
- | onClick | 点击按钮时的回调 | (event) => void | - | |
2948
- | href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - | |
2949
- | target | 相当于 a 标签的 target 属性,href 存在时生效 | string | - | |
2950
- | htmlType | 设置 | submit | button | 5.21.0 |
2951
- | badge | 带徽标数字的悬浮按钮(不支持 | | - | 5.4.0 |
2842
+ | bordered | 是否展示边框 | boolean | false | |
2843
+ | colon | 配置 | boolean | true | |
2844
+ | column | 一行的 | number \| | 3 | |
2845
+ | extra | 描述列表的操作区域,显示在右上方 | ReactNode | - | 4.5.0 |
2846
+ | items | 描述列表项内容 | | - | 5.8.0 |
2847
+ | layout | 描述布局 | horizontal | horizontal | |
2848
+ | size | 设置列表的大小。可以设置为 | default | - | |
2849
+ | title | 描述列表的标题,显示在最顶部 | ReactNode | - | |
2850
+ | classNames | 语义化结构 class | | - | 5.23.0 |
2851
+ | styles | 语义化结构 style | | - | 5.23.0 |
2952
2852
 
2953
2853
 
2954
- ### FloatButton.Group
2854
+ ### DescriptionItem
2955
2855
 
2956
2856
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
2957
2857
  |--------|--------|--------|--------|--------|
2958
- | shape | 设置包含的 FloatButton 按钮形状 | circle | circle | |
2959
- | trigger | 触发方式(有触发方式为菜单模式) | click | - | |
2960
- | open | 受控展开,需配合 trigger 一起使用 | boolean | - | |
2961
- | closeIcon | 自定义关闭按钮 | React.ReactNode | | |
2962
- | placement | 自定义菜单弹出位置 | top | top | 5.21.0 |
2963
- | onOpenChange | 展开收起时的回调,需配合 trigger 一起使用 | (open: boolean) => void | - | |
2964
- | onClick | 点击按钮时的回调(仅在菜单模式中有效) | (event) => void | - | 5.3.0 |
2858
+ | label | 内容的描述 | ReactNode | - | |
2859
+ | span | 包含列的数量( | number\| | 1 | screens: 5.9.0 |
2965
2860
 
2966
2861
 
2967
- ### FloatButton.BackTop
2968
-
2969
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
2970
- |--------|--------|--------|--------|--------|
2971
- | duration | 回到顶部所需时间(ms) | number | 450 | |
2972
- | target | 设置需要监听其滚动事件的元素 | () => HTMLElement | () => window | |
2973
- | visibilityHeight | 滚动高度达到此参数值才出现 BackTop | number | 400 | |
2974
- | onClick | 点击按钮的回调函数 | () => void | - | |
2975
-
2862
+ span 是 Description.Item 的数量。 span={2} 会占用两个 DescriptionItem 的宽度。当同时配置 `style` 和 `labelStyle`(或 `contentStyle`)时,两者会同时作用。样式冲突时,后者会覆盖前者。
2976
2863
 
2977
2864
 
2978
2865
 
2979
- <DemoTitle title="Drawer" desc="从页面一侧滑入的操作面板,用于承载临时界面内容。">
2866
+ <DemoTitle title="Dropdown" desc="向下弹出的列表。">
2980
2867
  #### API
2981
2868
 
2982
- | 属性名 | 描述 | 类型 | 默认值 |
2983
- |--------|--------|--------|--------|
2984
- | showDivider | 是否显示分割线 | boolean | true |
2985
-
2986
- ##### Drawer.Confirm - 带按钮的抽屉
2987
-
2988
- | 属性名 | 描述 | 类型 | 默认值 |
2989
- |--------|--------|--------|--------|
2990
- | footer | 自定义底部内容 | React.ReactNode | |
2991
- | onOk | 点击确定回调 | () => void | |
2992
- | okText | 确认按钮文字 | string | |
2993
- | okButtonProps | 确认按钮属性 | ButtonProps | |
2994
- | onCancel | 点击取消回调 | () => void | |
2995
- | cancelText | 取消按钮文字 | string | |
2996
- | cancelButtonProps | 取消按钮属性 | ButtonProps | |
2997
- | info | 底部额外内容 | React.ReactNode | |
2998
-
2999
- <AntdApiRef url="https://ant.design/components/drawer-cn/#api"></AntdApiRef>
2869
+ <AntdApiRef url="https://ant.design/components/dropdown-cn/#api"></AntdApiRef>
3000
2870
 
3001
2871
 
3002
2872
  ## antd API
3003
2873
 
3004
2874
  通用属性参考:[通用属性](/docs/react/common-props)
3005
2875
 
3006
- <!-- prettier-ignore -->
3007
- <Container type="warning" title="注意">
3008
- v5 使用 `rootClassName` 与 `rootStyle` 来配置最外层元素样式。原 v4 `className` 与 `style` 改至配置 Drawer 窗体样式以和 Modal 对齐。
3009
- </Container>
2876
+ ### Dropdown
2877
+
3010
2878
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
3011
2879
  |--------|--------|--------|--------|--------|
3012
- | autoFocus | 抽屉展开后是否将焦点切换至其 DOM 节点 | boolean | true | 4.17.0 |
3013
- | afterOpenChange | 切换抽屉时动画结束后的回调 | function(open) | - | |
3014
- | className | Drawer 容器外层 className 设置,如果需要设置最外层,请使用 rootClassName | string | - | |
3015
- | classNames | 语义化结构 className | | - | 5.10.0 |
3016
- | closeIcon | 自定义关闭图标。5.7.0:设置为 | ReactNode | | |
3017
- | destroyOnHidden | 关闭时销毁 Drawer 里的子元素 | boolean | false | 5.25.0 |
3018
- | extra | 抽屉右上角的操作区域 | ReactNode | - | 4.17.0 |
3019
- | footer | 抽屉的页脚 | ReactNode | - | |
3020
- | forceRender | 预渲染 Drawer 内元素 | boolean | false | |
3021
- | getContainer | 指定 Drawer 挂载的节点, | HTMLElement \| () => HTMLElement \| Selectors \| false | body | |
3022
- | height | 高度,在 | string \| number | 378 | |
3023
- | keyboard | 是否支持键盘 esc 关闭 | boolean | true | |
3024
- | mask | 是否展示遮罩 | boolean | true | |
3025
- | maskClosable | 点击蒙层是否允许关闭 | boolean | true | |
3026
- | placement | 抽屉的方向 | top | right | |
3027
- | push | 用于设置多层 Drawer 的推动行为 | boolean \| { distance: string \| number } | { distance: 180 } | 4.5.0+ |
3028
- | rootStyle | 可用于设置 Drawer 最外层容器的样式,和 | CSSProperties | - | |
3029
- | size | 预设抽屉宽度(或高度),default | 'default' \| 'large' | 'default' | 4.17.0 |
3030
- | style | 设计 Drawer 容器样式,如果你只需要设置内容部分请使用 | CSSProperties | - | |
3031
- | styles | 语义化结构 style | | - | 5.10.0 |
3032
- | title | 标题 | ReactNode | - | |
3033
- | loading | 显示骨架屏 | boolean | false | 5.17.0 |
3034
- | open | Drawer 是否可见 | boolean | - |
3035
- | width | 宽度 | string \| number | 378 | |
3036
- | zIndex | 设置 Drawer 的 | number | 1000 | |
3037
- | onClose | 点击遮罩层或左上角叉或取消按钮的回调 | function(e) | - | |
3038
- | drawerRender | 自定义渲染抽屉 | (node: ReactNode) => ReactNode | - | 5.18.0 |
2880
+ | arrow | 下拉框箭头是否显示 | boolean \| { pointAtCenter: boolean } | false | |
2881
+ | autoAdjustOverflow | 下拉框被遮挡时自动调整位置 | boolean | true | 5.2.0 |
2882
+ | autoFocus | 打开后自动聚焦下拉框 | boolean | false | 4.21.0 |
2883
+ | disabled | 菜单是否禁用 | boolean | - | |
2884
+ | destroyOnHidden | 关闭后是否销毁 Dropdown | boolean | false | 5.25.0 |
2885
+ | popupRender | 自定义弹出框内容 | (menus: ReactNode) => ReactNode | - | 5.25.0 |
2886
+ | getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。 | (triggerNode: HTMLElement) => HTMLElement | () => document.body | |
2887
+ | menu | 菜单配置项 | | - | 4.24.0 |
2888
+ | overlayClassName | 下拉根元素的类名称 | string | - | |
2889
+ | overlayStyle | 下拉根元素的样式 | CSSProperties | - | |
2890
+ | placement | 菜单弹出位置: | string | bottomLeft | |
2891
+ | trigger | 触发下拉的行为,移动端不支持 hover | Array< | [ | |
2892
+ | open | 菜单是否显示,小于 4.23.0 使用 | boolean | - | 4.23.0 |
2893
+ | onOpenChange | 菜单显示状态改变时调用,点击菜单按钮导致的消失不会触发。小于 4.23.0 使用 | (open: boolean, info: { source: 'trigger' \| 'menu' }) => void | - | info.source |
3039
2894
 
3040
2895
 
2896
+ ### Dropdown.Button
3041
2897
 
2898
+ 属性与 Dropdown 的相同。还包含以下属性:
3042
2899
 
3043
- <DemoTitle title="Descriptions" desc="展示多个只读字段的组合">
3044
- #### API
2900
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
2901
+ |--------|--------|--------|--------|--------|
2902
+ | buttonsRender | 自定义左右两个按钮 | (buttons: ReactNode[]) => ReactNode[] | - | |
2903
+ | loading | 设置按钮载入状态,和 | boolean \| { delay: number, icon: ReactNode } | false | icon: 5.23.0 |
2904
+ | danger | 设置危险按钮 | boolean | - | 4.23.0 |
2905
+ | icon | 右侧的 icon | ReactNode | - | |
2906
+ | size | 按钮大小,和 | large | middle | |
2907
+ | type | 按钮类型,和 | primary | default | |
2908
+ | onClick | 点击左侧按钮的回调,和 | (event: React.MouseEvent) => void | - | |
3045
2909
 
3046
- <AntdApiRef url="https://ant.design/components/descriptions-cn/#api"></AntdApiRef>
3047
2910
 
2911
+ ## 注意
3048
2912
 
2913
+ 请确保 `Dropdown` 的子元素能接受 `onMouseEnter`、`onMouseLeave`、`onFocus`、`onClick` 事件。
3049
2914
  ## antd API
3050
2915
 
3051
- 通用属性参考:[通用属性](/docs/react/common-props)
3052
-
3053
- ### Descriptions
2916
+ ### Menu
3054
2917
 
3055
2918
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
3056
2919
  |--------|--------|--------|--------|--------|
3057
- | bordered | 是否展示边框 | boolean | false | |
3058
- | colon | 配置 | boolean | true | |
3059
- | column | 一行的 | number \| | 3 | |
3060
- | extra | 描述列表的操作区域,显示在右上方 | ReactNode | - | 4.5.0 |
3061
- | items | 描述列表项内容 | | - | 5.8.0 |
3062
- | layout | 描述布局 | horizontal | horizontal | |
3063
- | size | 设置列表的大小。可以设置为 | default | - | |
3064
- | title | 描述列表的标题,显示在最顶部 | ReactNode | - | |
3065
- | classNames | 语义化结构 class | | - | 5.23.0 |
3066
- | styles | 语义化结构 style | | - | 5.23.0 |
2920
+ | defaultOpenKeys | 初始展开的 SubMenu 菜单项 key 数组 | string[] | - | |
2921
+ | defaultSelectedKeys | 初始选中的菜单项 key 数组 | string[] | - | |
2922
+ | expandIcon | 自定义展开图标 | ReactNode \| | - | 4.9.0 |
2923
+ | forceSubMenuRender | 在子菜单展示之前就渲染进 DOM | boolean | false | |
2924
+ | inlineCollapsed | inline 时菜单是否收起状态 | boolean | - | |
2925
+ | inlineIndent | inline 模式的菜单缩进宽度 | number | 24 | |
2926
+ | items | 菜单内容 | | - | 4.20.0 |
2927
+ | mode | 菜单类型,现在支持垂直、水平、和内嵌模式三种 | vertical | vertical | |
2928
+ | multiple | 是否允许多选 | boolean | false | |
2929
+ | openKeys | 当前展开的 SubMenu 菜单项 key 数组 | string[] | - | |
2930
+ | overflowedIndicator | 用于自定义 Menu 水平空间不足时的省略收缩的图标 | ReactNode | | |
2931
+ | selectable | 是否允许选中 | boolean | true | |
2932
+ | selectedKeys | 当前选中的菜单项 key 数组 | string[] | - | |
2933
+ | style | 根节点样式 | CSSProperties | - | |
2934
+ | subMenuCloseDelay | 用户鼠标离开子菜单后关闭延时,单位:秒 | number | 0.1 | |
2935
+ | subMenuOpenDelay | 用户鼠标进入子菜单后开启延时,单位:秒 | number | 0 | |
2936
+ | theme | 主题颜色 | light | light | |
2937
+ | triggerSubMenuAction | SubMenu 展开/关闭的触发行为 | hover | hover | |
2938
+ | onClick | 点击 MenuItem 调用此函数 | function({ item, key, keyPath, domEvent }) | - | |
2939
+ | onDeselect | 取消选中时调用,仅在 multiple 生效 | function({ item, key, keyPath, selectedKeys, domEvent }) | - | |
2940
+ | onOpenChange | SubMenu 展开/关闭的回调 | function(openKeys: string[]) | - | |
2941
+ | onSelect | 被选中时调用 | function({ item, key, keyPath, selectedKeys, domEvent }) | -   | |
3067
2942
 
3068
2943
 
3069
- ### DescriptionItem
2944
+ 更多属性查看 [rc-menu](https://github.com/react-component/menu#api)
3070
2945
 
3071
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
3072
- |--------|--------|--------|--------|--------|
3073
- | label | 内容的描述 | ReactNode | - | |
3074
- | span | 包含列的数量( | number\| | 1 | screens: 5.9.0 |
2946
+ ### ItemType
3075
2947
 
2948
+ type ItemType = [MenuItemType](#menuitemtype) | [SubMenuType](#submenutype) | [MenuItemGroupType](#menuitemgrouptype) | [MenuDividerType](#menudividertype);
3076
2949
 
3077
- span 是 Description.Item 的数量。 span={2} 会占用两个 DescriptionItem 的宽度。当同时配置 `style` 和 `labelStyle`(或 `contentStyle`)时,两者会同时作用。样式冲突时,后者会覆盖前者。
2950
+ #### MenuItemType
3078
2951
 
2952
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
2953
+ |--------|--------|--------|--------|--------|
2954
+ | danger | 展示错误状态样式 | boolean | false | |
2955
+ | disabled | 是否禁用 | boolean | false | |
2956
+ | extra | 额外节点 | ReactNode | - | 5.21.0 |
2957
+ | icon | 菜单图标 | ReactNode | - | |
2958
+ | key | item 的唯一标志 | string | - | |
2959
+ | label | 菜单项标题 | ReactNode | - | |
2960
+ | title | 设置收缩时展示的悬浮标题 | string | - | |
3079
2961
 
3080
2962
 
3081
- <DemoTitle title="CollapsePanel" desc="折叠面板">
3082
- #### API
2963
+ #### SubMenuType
3083
2964
 
3084
- | 属性名 | 描述 | 类型 | 默认值 |
3085
- |--------|--------|--------|--------|
3086
- | collapsedHeight | 收起状态下显示的内容高度 | number | 0 |
3087
- | expandedHeight | 展开状态下的内容高度,设置后内容超出时可滚动,不设置则自适应内容高度 | number | 300 |
3088
- | title | 面板标题 | string \| React.ReactNode | "" |
3089
- | expandOnPanelClick | 是否允许点击整个面板进行展开 | boolean | false |
3090
- | extra | 面板右侧内容 | React.ReactNode | |
3091
- | children | 面板内容 | React.ReactNode | |
3092
- | defaultExpanded | 是否默认展开 | boolean | false |
3093
- | classNames | 语义化的classNames | Partial> | |
3094
- | styles | 语义化的styles | Partial<
3095
- Record
3096
- > | |
2965
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
2966
+ |--------|--------|--------|--------|--------|
2967
+ | children | 子菜单的菜单项 | | - | |
2968
+ | disabled | 是否禁用 | boolean | false | |
2969
+ | icon | 菜单图标 | ReactNode | - | |
2970
+ | key | 唯一标志 | string | - | |
2971
+ | label | 菜单项标题 | ReactNode | - | |
2972
+ | popupClassName | 子菜单样式, | string | - | |
2973
+ | popupOffset | 子菜单偏移量, | [number, number] | - | |
2974
+ | onTitleClick | 点击子菜单标题 | function({ key, domEvent }) | - | |
2975
+ | theme | 设置子菜单的主题,默认从 Menu 上继承 | light | - | |
3097
2976
 
3098
2977
 
2978
+ #### MenuItemGroupType
3099
2979
 
3100
- ## antd API
2980
+ 定义类型为 `group` 时,会作为分组处理:
3101
2981
 
3102
- 通用属性参考:[通用属性](/docs/react/common-props)
3103
2982
 
3104
- ### Collapse
2983
+ ```ts
2984
+ const groupItem = {
2985
+ type: 'group', // Must have
2986
+ label: 'My Group',
2987
+ children: [],
2988
+ };
2989
+ ```
2990
+
3105
2991
 
3106
2992
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
3107
2993
  |--------|--------|--------|--------|--------|
3108
- | accordion | 手风琴模式 | boolean | false | |
3109
- | activeKey | 当前激活 tab 面板的 key | string[] \| string | | |
3110
- | bordered | 带边框风格的折叠面板 | boolean | true | |
3111
- | collapsible | 所有子面板是否可折叠或指定可折叠触发区域 | header | - | 4.9.0 |
3112
- | defaultActiveKey | 初始化选中面板的 key | string[] \| string | - | |
3113
- | destroyOnHidden | 销毁折叠隐藏的面板 | boolean | false | 5.25.0 |
3114
- | expandIcon | 自定义切换图标 | (panelProps) => ReactNode | - | |
3115
- | expandIconPosition | 设置图标位置 | start | - | 4.21.0 |
3116
- | ghost | 使折叠面板透明且无边框 | boolean | false | 4.4.0 |
3117
- | size | 设置折叠面板大小 | large | middle | 5.2.0 |
3118
- | onChange | 切换面板的回调 | function | - | |
3119
- | items | 折叠项目内容 | | - | 5.6.0 |
2994
+ | children | 分组的菜单项 | | - | |
2995
+ | label | 分组标题 | ReactNode | - | |
3120
2996
 
3121
2997
 
3122
- ### ItemType
2998
+ #### MenuDividerType
3123
2999
 
3124
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
3125
- |--------|--------|--------|--------|--------|
3126
- | classNames | 语义化结构 className | | - | 5.21.0 |
3127
- | collapsible | 是否可折叠或指定可折叠触发区域 | header | - | |
3128
- | forceRender | 被隐藏时是否渲染 body 区域 DOM 结构 | boolean | false | |
3129
- | key | 对应 activeKey | string \| number | - | |
3130
- | label | 面板标题 | ReactNode | - | - |
3131
- | showArrow | 是否展示当前面板上的箭头(为 false 时,collapsible 不能设为 icon) | boolean | true | |
3132
- | styles | 语义化结构 style | | - | 5.21.0 |
3000
+ 菜单项分割线,只用在弹出菜单内,需要定义类型为 `divider`:
3133
3001
 
3134
3002
 
3135
- ### Collapse.Panel
3003
+ ```ts
3004
+ const dividerItem = {
3005
+ type: 'divider', // Must have
3006
+ };
3007
+ ```
3008
+
3136
3009
 
3137
- <!-- prettier-ignore -->
3138
- <Container type="warning" title="已废弃">
3139
- 版本 >= 5.6.0 时请使用 items 方式配置面板。
3140
- </Container>
3141
3010
  | 参数 | 说明 | 类型 | 默认值 | 版本 |
3142
3011
  |--------|--------|--------|--------|--------|
3143
- | collapsible | 是否可折叠或指定可折叠触发区域 | header | - | 4.9.0 (icon: 4.24.0) |
3144
- | forceRender | 被隐藏时是否渲染 body 区域 DOM 结构 | boolean | false | |
3145
- | header | 面板标题 | ReactNode | - | |
3146
- | key | 对应 activeKey | string \| number | - | |
3147
- | showArrow | 是否展示当前面板上的箭头(为 false 时,collapsible 不能设为 icon) | boolean | true | |
3012
+ | dashed | 是否虚线 | boolean | false | |
3148
3013
 
3149
3014
 
3150
3015
 
@@ -3371,17 +3236,137 @@ export type FormatType =
3371
3236
 
3372
3237
 
3373
3238
 
3374
- <DemoTitle title="CodeBlock" desc="代码块">
3239
+ <DemoTitle title="CollapsePanel" desc="折叠面板">
3375
3240
  #### API
3376
3241
 
3377
3242
  | 属性名 | 描述 | 类型 | 默认值 |
3378
3243
  |--------|--------|--------|--------|
3379
- | language | 语言 | string \| string[] | (必填) |
3380
- | value | | string | |
3381
- | className | 类名 | string | |
3382
- | theme | 主题 | 'dark' \| 'light' | |
3383
- | readOnly | 只读 | boolean | |
3384
- | onChange | | (value?: string) => void | |
3244
+ | collapsedHeight | 收起状态下显示的内容高度 | number | 0 |
3245
+ | expandedHeight | 展开状态下的内容高度,设置后内容超出时可滚动,不设置则自适应内容高度 | number | 300 |
3246
+ | title | 面板标题 | string \| React.ReactNode | "" |
3247
+ | expandOnPanelClick | 是否允许点击整个面板进行展开 | boolean | false |
3248
+ | extra | 面板右侧内容 | React.ReactNode | |
3249
+ | children | 面板内容 | React.ReactNode | |
3250
+ | defaultExpanded | 是否默认展开 | boolean | false |
3251
+ | classNames | 语义化的classNames | Partial> | |
3252
+ | styles | 语义化的styles | Partial<
3253
+ Record
3254
+ > | |
3255
+
3256
+
3257
+
3258
+ ## antd API
3259
+
3260
+ 通用属性参考:[通用属性](/docs/react/common-props)
3261
+
3262
+ ### Collapse
3263
+
3264
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
3265
+ |--------|--------|--------|--------|--------|
3266
+ | accordion | 手风琴模式 | boolean | false | |
3267
+ | activeKey | 当前激活 tab 面板的 key | string[] \| string | | |
3268
+ | bordered | 带边框风格的折叠面板 | boolean | true | |
3269
+ | collapsible | 所有子面板是否可折叠或指定可折叠触发区域 | header | - | 4.9.0 |
3270
+ | defaultActiveKey | 初始化选中面板的 key | string[] \| string | - | |
3271
+ | destroyOnHidden | 销毁折叠隐藏的面板 | boolean | false | 5.25.0 |
3272
+ | expandIcon | 自定义切换图标 | (panelProps) => ReactNode | - | |
3273
+ | expandIconPosition | 设置图标位置 | start | - | 4.21.0 |
3274
+ | ghost | 使折叠面板透明且无边框 | boolean | false | 4.4.0 |
3275
+ | size | 设置折叠面板大小 | large | middle | 5.2.0 |
3276
+ | onChange | 切换面板的回调 | function | - | |
3277
+ | items | 折叠项目内容 | | - | 5.6.0 |
3278
+
3279
+
3280
+ ### ItemType
3281
+
3282
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
3283
+ |--------|--------|--------|--------|--------|
3284
+ | classNames | 语义化结构 className | | - | 5.21.0 |
3285
+ | collapsible | 是否可折叠或指定可折叠触发区域 | header | - | |
3286
+ | forceRender | 被隐藏时是否渲染 body 区域 DOM 结构 | boolean | false | |
3287
+ | key | 对应 activeKey | string \| number | - | |
3288
+ | label | 面板标题 | ReactNode | - | - |
3289
+ | showArrow | 是否展示当前面板上的箭头(为 false 时,collapsible 不能设为 icon) | boolean | true | |
3290
+ | styles | 语义化结构 style | | - | 5.21.0 |
3291
+
3292
+
3293
+ ### Collapse.Panel
3294
+
3295
+ <!-- prettier-ignore -->
3296
+ <Container type="warning" title="已废弃">
3297
+ 版本 >= 5.6.0 时请使用 items 方式配置面板。
3298
+ </Container>
3299
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
3300
+ |--------|--------|--------|--------|--------|
3301
+ | collapsible | 是否可折叠或指定可折叠触发区域 | header | - | 4.9.0 (icon: 4.24.0) |
3302
+ | forceRender | 被隐藏时是否渲染 body 区域 DOM 结构 | boolean | false | |
3303
+ | header | 面板标题 | ReactNode | - | |
3304
+ | key | 对应 activeKey | string \| number | - | |
3305
+ | showArrow | 是否展示当前面板上的箭头(为 false 时,collapsible 不能设为 icon) | boolean | true | |
3306
+
3307
+
3308
+
3309
+
3310
+ <DemoTitle title="Drawer" desc="从页面一侧滑入的操作面板,用于承载临时界面内容。">
3311
+ #### API
3312
+
3313
+ | 属性名 | 描述 | 类型 | 默认值 |
3314
+ |--------|--------|--------|--------|
3315
+ | showDivider | 是否显示分割线 | boolean | true |
3316
+
3317
+ ##### Drawer.Confirm - 带按钮的抽屉
3318
+
3319
+ | 属性名 | 描述 | 类型 | 默认值 |
3320
+ |--------|--------|--------|--------|
3321
+ | footer | 自定义底部内容 | React.ReactNode | |
3322
+ | onOk | 点击确定回调 | () => void | |
3323
+ | okText | 确认按钮文字 | string | |
3324
+ | okButtonProps | 确认按钮属性 | ButtonProps | |
3325
+ | onCancel | 点击取消回调 | () => void | |
3326
+ | cancelText | 取消按钮文字 | string | |
3327
+ | cancelButtonProps | 取消按钮属性 | ButtonProps | |
3328
+ | info | 底部额外内容 | React.ReactNode | |
3329
+
3330
+ <AntdApiRef url="https://ant.design/components/drawer-cn/#api"></AntdApiRef>
3331
+
3332
+
3333
+ ## antd API
3334
+
3335
+ 通用属性参考:[通用属性](/docs/react/common-props)
3336
+
3337
+ <!-- prettier-ignore -->
3338
+ <Container type="warning" title="注意">
3339
+ v5 使用 `rootClassName` 与 `rootStyle` 来配置最外层元素样式。原 v4 `className` 与 `style` 改至配置 Drawer 窗体样式以和 Modal 对齐。
3340
+ </Container>
3341
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
3342
+ |--------|--------|--------|--------|--------|
3343
+ | autoFocus | 抽屉展开后是否将焦点切换至其 DOM 节点 | boolean | true | 4.17.0 |
3344
+ | afterOpenChange | 切换抽屉时动画结束后的回调 | function(open) | - | |
3345
+ | className | Drawer 容器外层 className 设置,如果需要设置最外层,请使用 rootClassName | string | - | |
3346
+ | classNames | 语义化结构 className | | - | 5.10.0 |
3347
+ | closeIcon | 自定义关闭图标。5.7.0:设置为 | ReactNode | | |
3348
+ | destroyOnHidden | 关闭时销毁 Drawer 里的子元素 | boolean | false | 5.25.0 |
3349
+ | extra | 抽屉右上角的操作区域 | ReactNode | - | 4.17.0 |
3350
+ | footer | 抽屉的页脚 | ReactNode | - | |
3351
+ | forceRender | 预渲染 Drawer 内元素 | boolean | false | |
3352
+ | getContainer | 指定 Drawer 挂载的节点, | HTMLElement \| () => HTMLElement \| Selectors \| false | body | |
3353
+ | height | 高度,在 | string \| number | 378 | |
3354
+ | keyboard | 是否支持键盘 esc 关闭 | boolean | true | |
3355
+ | mask | 是否展示遮罩 | boolean | true | |
3356
+ | maskClosable | 点击蒙层是否允许关闭 | boolean | true | |
3357
+ | placement | 抽屉的方向 | top | right | |
3358
+ | push | 用于设置多层 Drawer 的推动行为 | boolean \| { distance: string \| number } | { distance: 180 } | 4.5.0+ |
3359
+ | rootStyle | 可用于设置 Drawer 最外层容器的样式,和 | CSSProperties | - | |
3360
+ | size | 预设抽屉宽度(或高度),default | 'default' \| 'large' | 'default' | 4.17.0 |
3361
+ | style | 设计 Drawer 容器样式,如果你只需要设置内容部分请使用 | CSSProperties | - | |
3362
+ | styles | 语义化结构 style | | - | 5.10.0 |
3363
+ | title | 标题 | ReactNode | - | |
3364
+ | loading | 显示骨架屏 | boolean | false | 5.17.0 |
3365
+ | open | Drawer 是否可见 | boolean | - |
3366
+ | width | 宽度 | string \| number | 378 | |
3367
+ | zIndex | 设置 Drawer 的 | number | 1000 | |
3368
+ | onClose | 点击遮罩层或左上角叉或取消按钮的回调 | function(e) | - | |
3369
+ | drawerRender | 自定义渲染抽屉 | (node: ReactNode) => ReactNode | - | 5.18.0 |
3385
3370
 
3386
3371
 
3387
3372
 
@@ -3444,6 +3429,21 @@ export type FormatType =
3444
3429
 
3445
3430
 
3446
3431
 
3432
+ <DemoTitle title="CodeBlock" desc="代码块">
3433
+ #### API
3434
+
3435
+ | 属性名 | 描述 | 类型 | 默认值 |
3436
+ |--------|--------|--------|--------|
3437
+ | language | 语言 | string \| string[] | (必填) |
3438
+ | value | 值 | string | |
3439
+ | className | 类名 | string | |
3440
+ | theme | 主题 | 'dark' \| 'light' | |
3441
+ | readOnly | 只读 | boolean | |
3442
+ | onChange | | (value?: string) => void | |
3443
+
3444
+
3445
+
3446
+
3447
3447
  <DemoTitle title="Checkbox" desc="收集用户的多项选择。">
3448
3448
  #### API
3449
3449
 
@@ -3502,16 +3502,71 @@ interface Option {
3502
3502
  ```
3503
3503
 
3504
3504
 
3505
- ### 方法
3505
+ ### 方法
3506
+
3507
+ #### Checkbox
3508
+
3509
+ | 名称 | 描述 | 版本 |
3510
+ |--------|--------|--------|
3511
+ | blur() | 移除焦点 | |
3512
+ | focus() | 获取焦点 | |
3513
+ | nativeElement | 返回 Checkbox 的 DOM 节点 | 5.17.3 |
3514
+
3515
+
3516
+
3517
+
3518
+ <DemoTitle title="Button" desc="按钮用于开始一个即时操作。">
3519
+ #### API
3520
+
3521
+ | 属性名 | 描述 | 类型 | 默认值 |
3522
+ |--------|--------|--------|--------|
3523
+ | size | 按钮大小 | 'small' \| 'middle' \| 'large' | 'middle' |
3524
+ | type | 类型 | \| 'primary'
3525
+ \| 'dashed'
3526
+ \| 'link'
3527
+ \| 'text'
3528
+ \| 'default'
3529
+ \| 'primaryLess'
3530
+ \| 'textCompact' | 'deafult' |
3531
+ | tooltipContent | hover上去tooltip的内容 | string \| ReactNode | |
3532
+ | iconType | 百炼图标iconfont的key,依赖ConfigProvider传入的iconfont,例如bl-icon-add | string | |
3533
+ | iconSize | 图标大小 | SparkIconFontProps['size'] | |
3534
+
3535
+ <AntdApiRef url="https://ant.design/components/button-cn/#api"></AntdApiRef>
3536
+
3537
+
3538
+ ## antd API
3539
+
3540
+ 通用属性参考:[通用属性](/docs/react/common-props)
3541
+
3542
+ 通过设置 Button 的属性来产生不同的按钮样式,推荐顺序为:`type` -> `shape` -> `size` -> `loading` -> `disabled`。
3543
+
3544
+ 按钮的属性说明如下:
3545
+
3546
+ | 属性 | 说明 | 类型 | 默认值 | 版本 |
3547
+ |--------|--------|--------|--------|--------|
3548
+ | autoInsertSpace | 我们默认提供两个汉字之间的空格,可以设置 | boolean | true | 5.17.0 |
3549
+ | block | 将按钮宽度调整为其父宽度的选项 | boolean | false | |
3550
+ | classNames | 语义化结构 class | | - | 5.4.0 |
3551
+ | color | 设置按钮的颜色 | default | - | default |
3552
+ | danger | 语法糖,设置危险按钮。当设置 | boolean | false | |
3553
+ | disabled | 设置按钮失效状态 | boolean | false | |
3554
+ | ghost | 幽灵属性,使按钮背景透明 | boolean | false | |
3555
+ | href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - | |
3556
+ | htmlType | 设置 | submit | button | |
3557
+ | iconPosition | 设置按钮图标组件的位置 | start | start | 5.17.0 |
3558
+ | loading | 设置按钮载入状态 | boolean \| { delay: number, icon: ReactNode } | false | icon: 5.23.0 |
3559
+ | styles | 语义化结构 style | | - | 5.4.0 |
3560
+ | target | 相当于 a 链接的 target 属性,href 存在时生效 | string | - | |
3561
+ | onClick | 点击按钮时的回调 | (event: React.MouseEvent) => void | - | |
3562
+ | variant | 设置按钮的变体 | outlined | - | 5.21.0 |
3563
+
3506
3564
 
3507
- #### Checkbox
3565
+ 支持原生 button 的其他所有属性。
3508
3566
 
3509
- | 名称 | 描述 | 版本 |
3510
- |--------|--------|--------|
3511
- | blur() | 移除焦点 | |
3512
- | focus() | 获取焦点 | |
3513
- | nativeElement | 返回 Checkbox 的 DOM 节点 | 5.17.3 |
3567
+ ### PresetColors
3514
3568
 
3569
+ type PresetColors = 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold';
3515
3570
 
3516
3571
 
3517
3572
 
@@ -3578,61 +3633,6 @@ interface Option {
3578
3633
 
3579
3634
 
3580
3635
 
3581
- <DemoTitle title="Button" desc="按钮用于开始一个即时操作。">
3582
- #### API
3583
-
3584
- | 属性名 | 描述 | 类型 | 默认值 |
3585
- |--------|--------|--------|--------|
3586
- | size | 按钮大小 | 'small' \| 'middle' \| 'large' | 'middle' |
3587
- | type | 类型 | \| 'primary'
3588
- \| 'dashed'
3589
- \| 'link'
3590
- \| 'text'
3591
- \| 'default'
3592
- \| 'primaryLess'
3593
- \| 'textCompact' | 'deafult' |
3594
- | tooltipContent | hover上去tooltip的内容 | string \| ReactNode | |
3595
- | iconType | 百炼图标iconfont的key,依赖ConfigProvider传入的iconfont,例如bl-icon-add | string | |
3596
- | iconSize | 图标大小 | SparkIconFontProps['size'] | |
3597
-
3598
- <AntdApiRef url="https://ant.design/components/button-cn/#api"></AntdApiRef>
3599
-
3600
-
3601
- ## antd API
3602
-
3603
- 通用属性参考:[通用属性](/docs/react/common-props)
3604
-
3605
- 通过设置 Button 的属性来产生不同的按钮样式,推荐顺序为:`type` -> `shape` -> `size` -> `loading` -> `disabled`。
3606
-
3607
- 按钮的属性说明如下:
3608
-
3609
- | 属性 | 说明 | 类型 | 默认值 | 版本 |
3610
- |--------|--------|--------|--------|--------|
3611
- | autoInsertSpace | 我们默认提供两个汉字之间的空格,可以设置 | boolean | true | 5.17.0 |
3612
- | block | 将按钮宽度调整为其父宽度的选项 | boolean | false | |
3613
- | classNames | 语义化结构 class | | - | 5.4.0 |
3614
- | color | 设置按钮的颜色 | default | - | default |
3615
- | danger | 语法糖,设置危险按钮。当设置 | boolean | false | |
3616
- | disabled | 设置按钮失效状态 | boolean | false | |
3617
- | ghost | 幽灵属性,使按钮背景透明 | boolean | false | |
3618
- | href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - | |
3619
- | htmlType | 设置 | submit | button | |
3620
- | iconPosition | 设置按钮图标组件的位置 | start | start | 5.17.0 |
3621
- | loading | 设置按钮载入状态 | boolean \| { delay: number, icon: ReactNode } | false | icon: 5.23.0 |
3622
- | styles | 语义化结构 style | | - | 5.4.0 |
3623
- | target | 相当于 a 链接的 target 属性,href 存在时生效 | string | - | |
3624
- | onClick | 点击按钮时的回调 | (event: React.MouseEvent) => void | - | |
3625
- | variant | 设置按钮的变体 | outlined | - | 5.21.0 |
3626
-
3627
-
3628
- 支持原生 button 的其他所有属性。
3629
-
3630
- ### PresetColors
3631
-
3632
- type PresetColors = 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold';
3633
-
3634
-
3635
-
3636
3636
  <DemoTitle title="Breadcrumb" desc="显示当前页面在系统层级结构中的位置,并能向上返回。">
3637
3637
  #### API
3638
3638
 
@@ -3752,6 +3752,15 @@ return <Breadcrumb itemRender={itemRender} items={items} />;
3752
3752
 
3753
3753
 
3754
3754
 
3755
+ <DemoTitle title="Audio" desc="音频展示">
3756
+ #### API
3757
+
3758
+ ApiParser解析结果为空
3759
+
3760
+
3761
+
3762
+
3763
+
3755
3764
  <DemoTitle title="Avatar" desc="用来代表用户或事物,支持图片、图标或字符展示。">
3756
3765
  #### API
3757
3766
 
@@ -3791,15 +3800,6 @@ Tip:你可以设置 `icon` 或 `children` 作为图片加载失败的默认 fa
3791
3800
 
3792
3801
 
3793
3802
 
3794
- <DemoTitle title="Audio" desc="音频展示">
3795
- #### API
3796
-
3797
- ApiParser解析结果为空
3798
-
3799
-
3800
-
3801
-
3802
-
3803
3803
  <DemoTitle title="Anchor" desc="用于跳转到页面指定位置。">
3804
3804
  #### API
3805
3805
 
@@ -4060,349 +4060,6 @@ const confirmed = await modal.confirm({ ... });
4060
4060
 
4061
4061
 
4062
4062
 
4063
- <div align="center"><a name="readme-top"></a>
4064
- <img height="120" src="https://img.alicdn.com/imgextra/i1/O1CN01ipemFb1EzmZI9LiTe_!!6000000000423-55-tps-28-28.svg" style="border: none">
4065
- <h1>Alibaba Cloud Spark Design</h1>
4066
- </div>
4067
-
4068
- # 概述
4069
-
4070
- Alibaba Cloud Spark Design 是一个基于 Ant Design 的 React UI 组件库,包含丰富的基础组件和场景组件,专为构建优秀的 LLM 产品而设计。
4071
- <br />
4072
- <br />
4073
-
4074
- ## ✨ 特性
4075
-
4076
-
4077
- - <img height="15" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"> 基于 Ant Design,兼容 Ant Design 生态系统。您可以无需修改代码即可切换到 Spark Design。
4078
- - 🛡 使用 TypeScript 编写,具有可预测的静态类型。
4079
- - 🧠 为 LLM 产品设计的各种场景组件。
4080
- - 💡 与@agentscope-ai/chat 和 @agentscope-ai/flow 配合使用,构建企业级 LLM 应用。
4081
- - 🎨 多种预设主题。
4082
- - ☀️ 轻松切换明暗模式。
4083
-
4084
- ## 📦 安装
4085
-
4086
-
4087
- ```bash
4088
- npm install antd @agentscope-ai/icons @agentscope-ai/design --save
4089
- ```
4090
-
4091
-
4092
- ## Tree Shaking 支持
4093
-
4094
- @agentscope-ai/design 默认基于 ES 模块支持 tree shaking
4095
-
4096
- ## TypeScript
4097
-
4098
- @agentscope-ai/chat 使用 TypeScript 编写并提供完整的定义文件。
4099
-
4100
- ## 内置主题
4101
-
4102
- 我们提供四种内置主题:
4103
-
4104
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #615CED;"></span> purpleTheme</div>
4105
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #5551CC;"></span> purpleDarkTheme(暗色模式)</div>
4106
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: rgba(26, 26, 29, 1);"></span> carbonTheme</div>
4107
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #676767;"></span> carbonDarkTheme(暗色模式)</div>
4108
-
4109
- ## 🏗️ 开源
4110
-
4111
- [@agentscope-ai/design](https://www.npmjs.com/package/@agentscope-ai/design) 和 [@agentscope-ai/chat](https://www.npmjs.com/package/@agentscope-ai/chat) 正在积极推进开源,预计将在 2025 年底完成。目前,您可以通过 npm 访问我们的项目。
4112
-
4113
-
4114
-
4115
- ## 内置主题
4116
-
4117
- Alibaba Cloud Spark Design 提供四种内置主题:
4118
-
4119
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #615CED;"></span> purpleTheme</div>
4120
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #5551CC;"></span> purpleDarkTheme(暗色模式)</div>
4121
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: rgba(26, 26, 29, 1);"></span> carbonTheme</div>
4122
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #676767;"></span> carbonDarkTheme(暗色模式)</div>
4123
-
4124
- ### 示例用法
4125
-
4126
-
4127
- ```tsx
4128
- import { ConfigProvider, purpleTheme } from '@agentscope-ai/design';
4129
-
4130
- const App = () => {
4131
- return <ConfigProvider {...purpleTheme}>Hello Spark Design!</ConfigProvider>;
4132
- };
4133
-
4134
- export default App;
4135
- ```
4136
-
4137
-
4138
- ## 从 Antd token 生成您自己的主题
4139
-
4140
- 如果您已经有了 Antd 主题,仍然可以使用 generateThemeByToken 生成 spark 风格的主题
4141
-
4142
-
4143
- ```tsx
4144
- import { ConfigProvider, generateThemeByToken } from '@agentscope-ai/design';
4145
- const yourToken = {
4146
- borderRadiusXS: 2,
4147
- borderRadiusSM: 4,
4148
- borderRadius: 6,
4149
- borderRadiusLG: 8,
4150
- borderRadiusXL: 12,
4151
- borderRadiusFull: 999,
4152
- wireframe: false,
4153
- colorPrimaryBg: '#F2F0FF',
4154
- colorPrimaryBgHover: '#F2F0FF',
4155
- colorPrimaryBorder: '#E2DEFF',
4156
- colorPrimaryBorderHover: '#BCB5FF',
4157
- // ... 您可以在下一个文档中找到完整版本的 tokens:Tokens 和 CSS 变量
4158
- };
4159
- const darkMode = false;
4160
- const yourThemeWithSparkStyle = generateThemeByToken(yourToken, darkMode);
4161
- const App = () => {
4162
- return (
4163
- <ConfigProvider {...yourThemeWithSparkStyle}>
4164
- Hello Spark Design!
4165
- </ConfigProvider>
4166
- );
4167
- };
4168
-
4169
- export default App;
4170
- ```
4171
-
4172
-
4173
- 您仍然可以修改生成的主题:`yourThemeWithSparkStyle`,但不建议这样做。我们建议您保持原始主题以获得 Spark Design 的最佳体验。
4174
-
4175
-
4176
-
4177
- # 使用
4178
-
4179
- 如果您有自己的 iconfont 项目,可以将您的图标集成到 Spark Design 中,并通过简单的符号名称访问您的图标。
4180
-
4181
-
4182
- ```tsx
4183
- import {
4184
- ConfigProvider,
4185
- purpleTheme,
4186
- Button,
4187
- IconFont,
4188
- IconButton,
4189
- } from '@agentscope-ai/design';
4190
- import { Flex } from 'antd';
4191
- import zhCN from 'antd/locale/zh_CN';
4192
- import { useState } from 'react';
4193
-
4194
- const App = () => {
4195
- const prefix = 'sps';
4196
- const iconSymbol = 'spark-effciency-line';
4197
- const iconfont = '//at.alicdn.com/t/a/font_4807885_ugexdeaoq7.js'; // 您可以从 https://www.iconfont.cn/ 获取
4198
- return (
4199
- <ConfigProvider
4200
- {...purpleTheme}
4201
- prefix={prefix}
4202
- prefixCls={prefix}
4203
- iconfont={iconfont}
4204
- locale={zhCN}
4205
- style={{
4206
- width: '100%',
4207
- height: '100%',
4208
- }}
4209
- >
4210
- <Flex
4211
- style={{
4212
- width: '100%',
4213
- height: '100%',
4214
- backgroundColor: `var(--${prefix}-color-bg-base)`,
4215
- }}
4216
- justify="center"
4217
- align="center"
4218
- >
4219
- <Flex vertical gap={16} style={{ width: '300px', padding: '12px 0' }}>
4220
- <Flex gap={8}>
4221
- <div style={{ width: '100px', lineHeight: '32px' }}>IconFont:</div>
4222
- <IconFont type={iconSymbol} />
4223
- </Flex>
4224
- <Flex gap={8}>
4225
- <div style={{ width: '100px', lineHeight: '32px' }}>Button:</div>
4226
- <Button type="primary" iconType={iconSymbol}>
4227
- 添加用户
4228
- </Button>
4229
- </Flex>
4230
- <Flex gap={8}>
4231
- <div style={{ width: '100px', lineHeight: '32px' }}>
4232
- IconButton:
4233
- </div>
4234
- <IconButton iconType={iconSymbol}></IconButton>
4235
- </Flex>
4236
- </Flex>
4237
- </Flex>
4238
- </ConfigProvider>
4239
- );
4240
- };
4241
-
4242
- export default App;
4243
- ```
4244
-
4245
-
4246
-
4247
-
4248
- # 从 Antd 迁移
4249
-
4250
- ## 📦 安装
4251
-
4252
-
4253
- ```bash
4254
- $ npm install @agentscope-ai/icons @agentscope-ai/design --save
4255
- ```
4256
-
4257
-
4258
- ## 🔨 使用
4259
-
4260
- 从 @agentscope-ai/design 导出的所有同名组件在 API 方面都与 antd 的对应组件兼容,这意味着您无需学习如何使用它们。如果您想充分利用 Alibaba Cloud Spark Design 的新功能,可以尝试使用这些组件而不是 antd 的组件。
4261
-
4262
-
4263
- ```tsx
4264
- import {
4265
- Button,
4266
- Image,
4267
- ConfigProvider,
4268
- purpleDarkTheme,
4269
- purpleTheme,
4270
- } from '@agentscope-ai/design';
4271
- import { SparkSunLine, SparkMoonLine } from '@agentscope-ai/icons';
4272
- import { Flex } from 'antd';
4273
- import zhCN from 'antd/locale/zh_CN';
4274
- import { useState } from 'react';
4275
-
4276
- const App = () => {
4277
- const [colorMode, setColorMode] = useState('light');
4278
- const theme = colorMode === 'light' ? purpleTheme : purpleDarkTheme;
4279
-
4280
- const prefix = 'sps';
4281
- return (
4282
- <ConfigProvider
4283
- {...theme} // 您可以从 purpleTheme、purpleDarkTheme、carbonTheme 和 carbonDarkTheme 中选择
4284
- prefix={prefix} // Ant Design 和 @agentscope-ai/design 的前缀
4285
- prefixCls={prefix}
4286
- iconfont="//at.alicdn.com/t/a/font_4807885_ugexdeaoq7.js" // 可选参数,您可以从 https://www.iconfont.cn/ 获取
4287
- locale={zhCN} // 来自 Ant Design 的语言包
4288
- style={{
4289
- width: '100%',
4290
- height: '100%',
4291
- }}
4292
- >
4293
- <div
4294
- style={{
4295
- width: '100%',
4296
- height: '100%',
4297
- backgroundColor: `var(--${prefix}-color-bg-base)`,
4298
- }}
4299
- >
4300
- <Flex vertical gap={16} align="center" style={{ padding: '12px 0' }}>
4301
- <Image
4302
- width={120}
4303
- src="https://img.alicdn.com/imgextra/i1/O1CN01Py27NU1re2pgohzqU_!!6000000005655-0-tps-480-480.jpg"
4304
- />
4305
- <div
4306
- style={{
4307
- color: `var(--${prefix}-ant-color-text-base)`,
4308
- fontSize: '24px',
4309
- textAlign: 'center',
4310
- }}
4311
- >
4312
- Hello Spark Design!
4313
- </div>
4314
- <Button
4315
- type="primary"
4316
- onClick={() => {
4317
- setColorMode(colorMode === 'light' ? 'dark' : 'light');
4318
- }}
4319
- icon={colorMode === 'light' ? <SparkMoonLine /> : <SparkSunLine />}
4320
- >
4321
- {colorMode === 'light' ? '暗色' : '亮色'} 模式
4322
- </Button>
4323
- </Flex>
4324
- </div>
4325
- </ConfigProvider>
4326
- );
4327
- };
4328
-
4329
- export default App;
4330
- ```
4331
-
4332
-
4333
- 如果您想继续使用 antd 的组件,那也没问题。您只需要将 antd 的 ConfigProvider 替换为 @agentscope-ai/design 的即可。
4334
-
4335
-
4336
- ```tsx
4337
- import {
4338
- ConfigProvider,
4339
- purpleDarkTheme,
4340
- purpleTheme,
4341
- } from '@agentscope-ai/design';
4342
- import { Button, Image, Flex } from 'antd';
4343
- import { SparkSunLine, SparkMoonLine } from '@agentscope-ai/icons';
4344
- import zhCN from 'antd/locale/zh_CN';
4345
- import { useState } from 'react';
4346
-
4347
- const App = () => {
4348
- const [colorMode, setColorMode] = useState('light');
4349
- const theme = colorMode === 'light' ? purpleTheme : purpleDarkTheme;
4350
-
4351
- const prefix = 'sps';
4352
- return (
4353
- <ConfigProvider
4354
- {...theme} // 您可以从 purpleTheme、purpleDarkTheme、carbonTheme 和 carbonDarkTheme 中选择
4355
- prefix={prefix} // Ant Design 和 @agentscope-ai/design 的前缀
4356
- prefixCls={prefix}
4357
- iconfont="//at.alicdn.com/t/a/font_4807885_ugexdeaoq7.js" // 可选参数,您可以从 https://www.iconfont.cn/ 获取
4358
- locale={zhCN} // 来自 Ant Design 的语言包
4359
- style={{
4360
- width: '100%',
4361
- height: '100%',
4362
- }}
4363
- >
4364
- <div
4365
- style={{
4366
- width: '100%',
4367
- height: '100%',
4368
- backgroundColor: `var(--${prefix}-color-bg-base)`,
4369
- }}
4370
- >
4371
- <Flex vertical gap={16} align="center" style={{ padding: '12px 0' }}>
4372
- <Image
4373
- width={120}
4374
- src="https://img.alicdn.com/imgextra/i1/O1CN01Py27NU1re2pgohzqU_!!6000000005655-0-tps-480-480.jpg"
4375
- />
4376
- <div
4377
- style={{
4378
- color: `var(--${prefix}-ant-color-text-base)`,
4379
- fontSize: '24px',
4380
- textAlign: 'center',
4381
- }}
4382
- >
4383
- Hello Spark Design!
4384
- </div>
4385
- <Button
4386
- type="primary"
4387
- onClick={() => {
4388
- setColorMode(colorMode === 'light' ? 'dark' : 'light');
4389
- }}
4390
- icon={colorMode === 'light' ? <SparkMoonLine /> : <SparkSunLine />}
4391
- >
4392
- {colorMode === 'light' ? '暗色' : '亮色'} 模式
4393
- </Button>
4394
- </Flex>
4395
- </div>
4396
- </ConfigProvider>
4397
- );
4398
- };
4399
-
4400
- export default App;
4401
- ```
4402
-
4403
-
4404
-
4405
-
4406
4063
  # 使用
4407
4064
 
4408
4065
 
@@ -4425,574 +4082,4 @@ export default () => {
4425
4082
 
4426
4083
  基本用法
4427
4084
 
4428
- 访问 [Icon Library](https://sparkdesign.agentscope.io/#/resources/icons) 查看全部 Icon
4429
-
4430
-
4431
-
4432
- # Vibe 编程
4433
-
4434
- ## LLMs.txt
4435
-
4436
- 为了让 Cursor 和 Claude Code 等工具理解 Spark Design,我们支持 LLMs.txt 文件,使 Spark Design 的文档可供大型语言模型使用。
4437
-
4438
-
4439
- - [index.llms.txt](https://g.alicdn.com/code/npm/@ali/agentscope-ai-design/4.7.2/docs-dist/llms/index.llms.txt):主要的 LLMs.txt 索引文件
4440
- - [all.llms.txt](https://g.alicdn.com/code/npm/@ali/agentscope-ai-design/4.7.2/docs-dist/llms/all.llms.txt):Spark Design 的完整文档
4441
-
4442
- 在 Cursor 中使用 @Docs 功能将 LLMs.txt 文件包含在您的项目中。[了解更多](https://docs.cursor.com/en/context/@-symbols/@-docs)
4443
-
4444
- ## D2C
4445
-
4446
- 在前端使用 Alibaba Cloud Spark Design、设计稿使用 Spark Design 套件的前提下,通过 masterGo 视觉稿生成代码可以做到以下几点:
4447
-
4448
-
4449
- - 准确识别 icon
4450
- - 使用标准 css token
4451
- - 无需测量间距、圆角等数据,AI 直接还原布局(90%以上概率准确生成)
4452
- - 使用标准组件还原页面,大部分标准组件可一次性正确生成,无需二次调整
4453
-
4454
- <div>
4455
- <video style="width: 100%" controls src="https://cloud.video.taobao.com/vod/PrrYzvYJkoDlbJwoL8Ei1Bo_60LrKAROCojWxB_EAYs.mp4" />
4456
- </div>
4457
-
4458
- 我们会在不久的将来开放 masterGo 的设计套件和 rules,帮助您高效率还原视觉稿
4459
-
4460
-
4461
-
4462
- # 从零开始使用
4463
-
4464
- ## 📦 安装
4465
-
4466
-
4467
- ```bash
4468
- $ npm install antd @agentscope-ai/icons @agentscope-ai/design --save
4469
- ```
4470
-
4471
-
4472
- ## 🔨 使用
4473
-
4474
-
4475
- ```tsx
4476
- import {
4477
- Button,
4478
- Image,
4479
- ConfigProvider,
4480
- purpleDarkTheme,
4481
- purpleTheme,
4482
- } from '@agentscope-ai/design';
4483
- import { SparkSunLine, SparkMoonLine } from '@agentscope-ai/icons';
4484
- import { Flex } from 'antd';
4485
- import zhCN from 'antd/locale/zh_CN';
4486
- import { useState } from 'react';
4487
-
4488
- const App = () => {
4489
- const [colorMode, setColorMode] = useState('light');
4490
- const theme = colorMode === 'light' ? purpleTheme : purpleDarkTheme;
4491
-
4492
- const prefix = 'sps';
4493
- return (
4494
- <ConfigProvider
4495
- {...theme} // 您可以从 purpleTheme、purpleDarkTheme、carbonTheme 和 carbonDarkTheme 中选择
4496
- prefix={prefix} // Ant Design 和 @agentscope-ai/design 的前缀
4497
- prefixCls={prefix}
4498
- iconfont="//at.alicdn.com/t/a/font_4807885_ugexdeaoq7.js" // 可选参数,您可以从 https://www.iconfont.cn/ 获取
4499
- locale={zhCN} // 来自 Ant Design 的语言包
4500
- style={{
4501
- width: '100%',
4502
- height: '100%',
4503
- }}
4504
- >
4505
- <div
4506
- style={{
4507
- width: '100%',
4508
- height: '100%',
4509
- backgroundColor: `var(--${prefix}-color-bg-base)`,
4510
- }}
4511
- >
4512
- <Flex vertical gap={16} align="center" style={{ padding: '12px 0' }}>
4513
- <Image
4514
- width={120}
4515
- src="https://img.alicdn.com/imgextra/i1/O1CN01Py27NU1re2pgohzqU_!!6000000005655-0-tps-480-480.jpg"
4516
- />
4517
- <div
4518
- style={{
4519
- color: `var(--${prefix}-ant-color-text-base)`,
4520
- fontSize: '24px',
4521
- textAlign: 'center',
4522
- }}
4523
- >
4524
- Hello Spark Design!
4525
- </div>
4526
- <Button
4527
- type="primary"
4528
- onClick={() => {
4529
- setColorMode(colorMode === 'light' ? 'dark' : 'light');
4530
- }}
4531
- icon={colorMode === 'light' ? <SparkMoonLine /> : <SparkSunLine />}
4532
- >
4533
- {colorMode === 'light' ? '暗色' : '亮色'} 模式
4534
- </Button>
4535
- </Flex>
4536
- </div>
4537
- </ConfigProvider>
4538
- );
4539
- };
4540
-
4541
- export default App;
4542
- ```
4543
-
4544
-
4545
-
4546
-
4547
- # Tokens
4548
-
4549
- 除了来自 [antd](https://ant.design/theme-editor) 的固有 tokens 之外,Spark Design 在原有基础上扩展了更多变量。完整的 token 示例如下所示:
4550
-
4551
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #615CED;"></span> purpleTheme</div>
4552
-
4553
- ```json
4554
- {
4555
- "borderRadiusXS": 2,
4556
- "borderRadiusSM": 4,
4557
- "borderRadius": 6,
4558
- "borderRadiusLG": 8,
4559
- "borderRadiusXL": 12,
4560
- "borderRadiusFull": 999,
4561
- "wireframe": false,
4562
- "colorPrimaryBg": "rgba(97, 92, 237, 0.08)",
4563
- "colorPrimaryBgHover": "#F2F0FF",
4564
- "colorPrimaryBorder": "#E2DEFF",
4565
- "colorPrimaryBorderHover": "#BCB5FF",
4566
- "colorPrimaryHover": "#9189FA",
4567
- "colorPrimary": "#615CED",
4568
- "colorPrimaryActive": "#4444C7",
4569
- "colorPrimaryTextHover": "#9189FA",
4570
- "colorPrimaryText": "#615CED",
4571
- "colorPrimaryTextActive": "#4444C7",
4572
- "colorTextBase": "#26244c",
4573
- "colorBgBase": "#FFFFFF",
4574
- "colorText": "rgba(38, 36, 76, 0.88)",
4575
- "colorTextSecondary": "rgba(38, 36, 76, 0.65)",
4576
- "colorTextTertiary": "rgba(38, 36, 76, 0.45)",
4577
- "colorTextQuaternary": "rgba(38, 36, 76, 0.25)",
4578
- "colorBorder": "#cdd0dc",
4579
- "colorBorderSecondary": "#e6e8ee",
4580
- "colorFill": "#cdd0dc5c",
4581
- "colorFillSecondary": "#cdd0dc33",
4582
- "colorFillTertiary": "#cdd0dc26",
4583
- "colorFillQuaternary": "#cdd0dc1a",
4584
- "colorBgContainer": "#FFFFFF",
4585
- "colorBgElevated": "#FFFFFF",
4586
- "colorBgLayout": "#f9fafd",
4587
- "colorBgSpotlight": "rgba(38, 36, 76, 0.85)",
4588
- "colorBgMask": "rgba(20, 19, 39, 0.45)",
4589
- "colorInfo": "#0B83F1",
4590
- "colorInfoHover": "#5EBCFF",
4591
- "colorInfoBorder": "#87D1FF",
4592
- "colorInfoText": "#0B83F1",
4593
- "colorInfoBg": "#E6F7FF",
4594
- "colorInfoBgHover": "#B0E3FF",
4595
- "colorInfoBorderHover": "#5EBCFF",
4596
- "colorSuccess": "#5BB98B",
4597
- "colorSuccessHover": "#ABD4BE",
4598
- "colorSuccessBg": "#EBFAF0",
4599
- "colorSuccessBgHover": "#DFEDE4",
4600
- "colorSuccessBorder": "#D3E0D9",
4601
- "colorSuccessBorderHover": "#ABD4BE",
4602
- "colorWarning": "#FAAD14",
4603
- "colorWarningHover": "#FFD666",
4604
- "colorWarningBg": "#FFFBE6",
4605
- "colorWarningBgHover": "#FFF1B8",
4606
- "colorWarningBorder": "#FFE58F",
4607
- "colorWarningBorderHover": "#FFD666",
4608
- "colorError": "#FF4D4F",
4609
- "colorErrorHover": "#FF7875",
4610
- "colorErrorBg": "#FFF2F0",
4611
- "colorErrorBgHover": "#FFF1F0",
4612
- "colorErrorBorder": "#FFCCC7",
4613
- "colorErrorBorderHover": "#FFA39E",
4614
- "colorLink": "#615CED",
4615
- "boxShadow": "0px 4px 6px 0px rgba(0, 0, 0, 0.08)",
4616
- "boxShadowSecondary": "0px 12px 24px -16px rgba(0, 0, 0, 0.06),0px 8px 40px 0px rgba(0, 0, 0, 0.12),0px 0px 1px 0px rgba(0, 0, 0, 0.04)",
4617
-
4618
- "colorTextWhite": "#ffffff",
4619
- "colorTextOnPrimary": "#ffffff",
4620
- "colorFillDisable": "#DBDAE7",
4621
- "colorPurple": "#615CED",
4622
- "colorPurpleHover": "#8080FF",
4623
- "colorPurpleBg": "rgba(226, 222, 255, 0.8)",
4624
- "colorPink": "#EC4899",
4625
- "colorPinkHover": "#E593BC",
4626
- "colorPinkBg": "rgba(251, 220, 239, 0.8)",
4627
- "colorYellow": "#EAB308",
4628
- "colorYellowHover": "#F1D372",
4629
- "colorYellowBg": "rgba(255, 250, 184, 0.8)",
4630
- "colorOrange": "#FA8125",
4631
- "colorOrangeHover": "#E88C45",
4632
- "colorOrangeBg": "rgba(255, 232, 201, 0.8)",
4633
- "colorTeal": "#14B8A6",
4634
- "colorTealHover": "#5FB3A9",
4635
- "colorTealBg": "rgba(200, 244, 233, 0.8)",
4636
- "colorBlue": "#0090FF",
4637
- "colorBlueHover": "#72BCF5",
4638
- "colorBlueBg": "rgba(194, 229, 255, 0.8)",
4639
- "colorMauve": "#8E8C99",
4640
- "colorMauveHover": "#C0BFC8",
4641
- "colorMauveBg": "rgba(239, 240, 243, 0.8)",
4642
- "colorSlate": "#1E293B",
4643
- "colorSlateHover": "#475569",
4644
- "colorSlateBg": "#E2E8F0",
4645
- "colorLavender": "#A77BFF",
4646
- "colorLavenderHover": "#BB99FF",
4647
- "colorLavenderBg": "rgba(226, 212, 255, 0.8)",
4648
-
4649
- "boxShadowTertiary": "0px 12px 32px -16px rgba(0, 0, 0, 0.24),0px 12px 60px 0px rgba(0, 0, 0, 0.12),0px 0px 1px 0px rgba(0, 0, 0, 0.04)",
4650
- "boxShadowTertiaryLeft": "-12px 0px 32px -16px rgba(0, 0, 0, 0.24),-12px 0px 60px 0px rgba(0, 0, 0, 0.12),0px 0px 1px 0px rgba(0, 0, 0, 0.04)",
4651
- "boxShadowInput": "0px 12px 24px -16px rgba(54, 54, 73, 0.04),0px 12px 40px 0px rgba(51, 51, 71, 0.08),0px 0px 1px 0px rgba(44, 44, 54, 0.02)"
4652
- }
4653
- ```
4654
-
4655
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #5551CC;"></span> purpleDarkTheme(暗色模式)</div>
4656
-
4657
- ```json
4658
- {
4659
- "borderRadiusXS": 2,
4660
- "borderRadiusSM": 4,
4661
- "borderRadius": 6,
4662
- "borderRadiusLG": 8,
4663
- "borderRadiusXL": 12,
4664
- "borderRadiusFull": 999,
4665
- "wireframe": false,
4666
- "colorPrimaryBg": "#202041",
4667
- "colorPrimaryBgHover": "#202041",
4668
- "colorPrimaryBorder": "#2B2A55",
4669
- "colorPrimaryBorderHover": "#373476",
4670
- "colorPrimaryHover": "#857DE3",
4671
- "colorPrimary": "#5551CC",
4672
- "colorPrimaryActive": "#4643A1",
4673
- "colorPrimaryTextHover": "#857DE3",
4674
- "colorPrimaryText": "#5551CC",
4675
- "colorPrimaryTextActive": "#4643A1",
4676
- "colorTextBase": "#E7E7ED",
4677
- "colorBgBase": "#000000",
4678
- "colorText": "rgba(231, 231, 237, 0.88)",
4679
- "colorTextSecondary": "rgba(231, 231, 237, 0.65)",
4680
- "colorTextTertiary": "rgba(231, 231, 237, 0.45)",
4681
- "colorTextQuaternary": "rgba(231, 231, 237, 0.25)",
4682
- "colorBorder": "rgba(71, 71, 97, 0.8)",
4683
- "colorBorderSecondary": "rgba(56, 56, 76, 0.8)",
4684
- "colorFill": "rgba(231, 231, 237, 0.18)",
4685
- "colorFillSecondary": "rgba(231, 231, 237, 0.12)",
4686
- "colorFillTertiary": "rgba(231, 231, 237, 0.08)",
4687
- "colorFillQuaternary": "rgba(231, 231, 237, 0.04)",
4688
- "colorBgContainer": "#0F0F14",
4689
- "colorBgElevated": "#0F0F14",
4690
- "colorBgLayout": "#0F0F14",
4691
- "colorBgSpotlight": "rgba(71, 71, 97, 0.85)",
4692
- "colorBgMask": "rgba(5, 5, 8, 0.8)",
4693
- "colorInfo": "#0B83F1",
4694
- "colorInfoHover": "rgba(42, 114, 165, 1)",
4695
- "colorInfoBorder": "rgba(135, 209, 255, 0.2)",
4696
- "colorInfoText": "#0B83F1",
4697
- "colorInfoBg": "rgba(27, 73, 115, 0.25)",
4698
- "colorInfoBgHover": "rgba(27, 73, 115, 0.32)",
4699
- "colorInfoBorderHover": "rgba(94, 188, 255, 0.2)",
4700
- "colorSuccess": "#5BB98B",
4701
- "colorSuccessHover": "rgba(87, 141, 112, 1)",
4702
- "colorSuccessBg": "rgba(0, 50, 26, 0.25)",
4703
- "colorSuccessBgHover": "rgba(0, 50, 26, 0.32)",
4704
- "colorSuccessBorder": "rgba(211, 224, 217, 0.2)",
4705
- "colorSuccessBorderHover": "rgba(171, 212, 190, 0.2)",
4706
- "colorWarning": "#FAAD14",
4707
- "colorWarningHover": "rgba(170, 136, 43, 1)",
4708
- "colorWarningBg": "rgba(129, 116, 49, 0.25)",
4709
- "colorWarningBgHover": "rgba(129, 116, 49, 0.32)",
4710
- "colorWarningBorder": "rgba(255, 229, 143, 0.2)",
4711
- "colorWarningBorderHover": "rgba(255, 214, 102, 0.2)",
4712
- "colorError": "#FF4D4F",
4713
- "colorErrorHover": "rgba(165, 50, 48, 1)",
4714
- "colorErrorBg": "rgba(129, 46, 46, 0.25)",
4715
- "colorErrorBgHover": "rgba(129, 46, 46, 0.32)",
4716
- "colorErrorBorder": "rgba(255, 204, 199, 0.2)",
4717
- "colorErrorBorderHover": "rgba(255, 163, 158, 0.2)",
4718
- "colorLink": "#5551CC",
4719
- "boxShadow": "0px 4px 6px 0px rgba(255, 255, 255, 0.08)",
4720
- "boxShadowSecondary": "0px 12px 24px -16px rgba(255, 255, 255, 0.04),0px 8px 40px 0px rgba(255, 255, 255, 0.06),0px 0px 1px 0px rgba(255, 255, 255, 0.02)",
4721
-
4722
- "colorTextWhite": "#fff",
4723
- "colorTextOnPrimary": "#fff",
4724
- "colorFillDisable": "#8D8C98",
4725
- "colorPurple": "#5551CC",
4726
- "colorPurpleHover": "#8383F0",
4727
- "colorPurpleBg": "rgba(226, 222, 255, 0.2)",
4728
- "colorPink": "#EC4899",
4729
- "colorPinkHover": "#E494BC",
4730
- "colorPinkBg": "rgba(251, 220, 239, 0.2)",
4731
- "colorYellow": "#EAB308",
4732
- "colorYellowHover": "#DBBE62",
4733
- "colorYellowBg": "rgba(255, 250, 184, 0.2)",
4734
- "colorOrange": "#FA8125",
4735
- "colorOrangeHover": "#F7A25F",
4736
- "colorOrangeBg": "rgba(255, 232, 201, 0.2)",
4737
- "colorTeal": "#14B8A6",
4738
- "colorTealHover": "#7BC7BE",
4739
- "colorTealBg": "rgba(200, 244, 233, 0.2)",
4740
- "colorBlue": "#0090FF",
4741
- "colorBlueHover": "#83BFED",
4742
- "colorBlueBg": "rgba(194, 229, 255, 0.2)",
4743
- "colorMauve": "#8E8C99",
4744
- "colorMauveHover": "#BBB8CA",
4745
- "colorMauveBg": "rgba(239, 240, 243, 0.2)",
4746
- "colorSlate": "#2C3A50",
4747
- "colorSlateHover": "#354252",
4748
- "colorSlateBg": "#232B36",
4749
- "colorLavender": "#A77BFF",
4750
- "colorLavenderHover": "#BFA5F3",
4751
- "colorLavenderBg": "rgba(150, 143, 167, 0.48)",
4752
-
4753
- "boxShadowTertiary": "0px 12px 32px -16px rgba(255, 255, 255, 0.16),0px 12px 60px 0px rgba(255, 255, 255, 0.08),0px 0px 1px 0px rgba(255, 255, 255, 0.02)",
4754
- "boxShadowTertiaryLeft": "-12px 0px 32px -16px rgba(255, 255, 255, 0.16),-12px 0px 60px 0px rgba(255, 255, 255, 0.08),0px 0px 1px 0px rgba(255, 255, 255, 0.02);",
4755
- "boxShadowInput": "0px 12px 24px -16px rgba(255, 255, 255, 0.08),0px 12px 40px 0px rgba(255, 255, 255, 0.16),0px 0px 1px 0px rgba(255, 255, 255, 0.04)"
4756
- }
4757
-
4758
- ```
4759
-
4760
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: rgba(26, 26, 29, 1);"></span> carbonTheme</div>
4761
-
4762
- ```json
4763
- {
4764
- "borderRadiusXS": 2,
4765
- "borderRadiusSM": 4,
4766
- "borderRadius": 6,
4767
- "borderRadiusLG": 8,
4768
- "borderRadiusXL": 12,
4769
- "borderRadiusFull": 999,
4770
- "wireframe": false,
4771
- "colorPrimaryBg": "rgba(244, 244, 247, 1)",
4772
- "colorPrimaryBgHover": "rgba(239, 239, 244, 1)",
4773
- "colorPrimaryBorder": "rgba(62, 63, 66, 1)",
4774
- "colorPrimaryBorderHover": "rgba(130, 132, 137, 1)",
4775
- "colorPrimaryHover": "rgba(38, 38, 41, 1)",
4776
- "colorPrimary": "rgba(26, 26, 29, 1)",
4777
- "colorPrimaryActive": "rgba(0, 0, 0, 1)",
4778
- "colorPrimaryTextHover": "rgba(38, 38, 41, 1)",
4779
- "colorPrimaryText": "rgba(26, 26, 29, 1)",
4780
- "colorPrimaryTextActive": "rgba(0, 0, 0, 1)",
4781
- "colorTextBase": "rgba(26, 26, 29, 1)",
4782
- "colorBgBase": "rgba(255, 255, 255, 1)",
4783
- "colorText": "rgba(26, 26, 29, 0.88)",
4784
- "colorTextSecondary": "rgba(26, 26, 29, 0.65)",
4785
- "colorTextTertiary": "rgba(26, 26, 29, 0.45)",
4786
- "colorTextQuaternary": "rgba(26, 26, 29, 0.25)",
4787
- "colorBorder": "rgba(187, 187, 193, 1)",
4788
- "colorBorderSecondary": "rgba(234, 234, 234, 1)",
4789
- "colorFill": "rgba(0, 0, 43, 0.06)",
4790
- "colorFillSecondary": "rgba(0, 0, 85, 0.03)",
4791
- "colorFillTertiary": "rgba(205, 208, 220, 0.15)",
4792
- "colorFillQuaternary": "rgba(205, 208, 220, 0.1)",
4793
- "colorBgContainer": "rgba(255, 255, 255, 1)",
4794
- "colorBgElevated": "rgba(255, 255, 255, 1)",
4795
- "colorBgLayout": "rgba(250, 250, 251, 1)",
4796
- "colorBgSpotlight": "rgba(26, 26, 29, 0.85)",
4797
- "colorBgMask": "rgba(0, 0, 0, 0.45)",
4798
- "colorInfo": "rgba(11, 131, 241, 1)",
4799
- "colorInfoHover": "rgba(94, 188, 255, 1)",
4800
- "colorInfoBorder": "rgba(135, 209, 255, 1)",
4801
- "colorInfoText": "rgba(11, 131, 241, 1)",
4802
- "colorInfoBg": "rgba(230, 247, 255, 1)",
4803
- "colorInfoBgHover": "rgba(176, 227, 255, 1)",
4804
- "colorInfoBorderHover": "rgba(94, 188, 255, 1)",
4805
- "colorSuccess": "rgba(91, 185, 139, 1)",
4806
- "colorSuccessHover": "rgba(171, 212, 190, 1)",
4807
- "colorSuccessBg": "rgba(235, 250, 240, 1)",
4808
- "colorSuccessBgHover": "rgba(223, 237, 228, 1)",
4809
- "colorSuccessBorder": "rgba(211, 224, 217, 1)",
4810
- "colorSuccessBorderHover": "rgba(171, 212, 190, 1)",
4811
- "colorWarning": "rgba(250, 173, 20, 1)",
4812
- "colorWarningHover": "rgba(255, 214, 102, 1)",
4813
- "colorWarningBg": "rgba(255, 251, 230, 1)",
4814
- "colorWarningBgHover": "rgba(255, 241, 184, 1)",
4815
- "colorWarningBorder": "rgba(255, 229, 143, 1)",
4816
- "colorWarningBorderHover": "rgba(255, 214, 102, 1)",
4817
- "colorError": "rgba(255, 77, 79, 1)",
4818
- "colorErrorHover": "rgba(255, 120, 117, 1)",
4819
- "colorErrorBg": "rgba(255, 242, 240, 1)",
4820
- "colorErrorBgHover": "rgba(255, 241, 240, 1)",
4821
- "colorErrorBorder": "rgba(255, 204, 199, 1)",
4822
- "colorErrorBorderHover": "rgba(255, 163, 158, 1)",
4823
- "colorLink": "rgba(0, 77, 255, 1)",
4824
- "boxShadow": "0px 4px 6px 0px rgba(0, 0, 0, 0.08)",
4825
- "boxShadowSecondary": "0px 12px 24px -16px rgba(0, 0, 0, 0.06),0px 8px 40px 0px rgba(0, 0, 0, 0.12),0px 0px 1px 0px rgba(0, 0, 0, 0.04)",
4826
-
4827
- "colorTextWhite": "#ffffff",
4828
- "colorTextOnPrimary": "#ffffff",
4829
- "colorFillDisable": "rgba(232, 232, 235, 1)",
4830
- "colorPurple": "rgba(97, 92, 237, 1)",
4831
- "colorPurpleHover": "#8080FF",
4832
- "colorPurpleBg": "rgba(226, 222, 255, 0.8)",
4833
- "colorPink": "rgba(236, 72, 153, 1)",
4834
- "colorPinkHover": "#E593BC",
4835
- "colorPinkBg": "rgba(251, 220, 239, 0.8)",
4836
- "colorYellow": "rgba(234, 179, 8, 1)",
4837
- "colorYellowHover": "#F1D372",
4838
- "colorYellowBg": "rgba(255, 250, 184, 0.8)",
4839
- "colorOrange": "rgba(250, 129, 37, 1)",
4840
- "colorOrangeHover": "#E88C45",
4841
- "colorOrangeBg": "rgba(255, 232, 201, 0.8)",
4842
- "colorTeal": "rgba(20, 184, 166, 1)",
4843
- "colorTealHover": "#5FB3A9",
4844
- "colorTealBg": "rgba(200, 244, 233, 0.8)",
4845
- "colorBlue": "rgba(0, 144, 255, 1)",
4846
- "colorBlueHover": "#72BCF5",
4847
- "colorBlueBg": "rgba(194, 229, 255, 0.8)",
4848
- "colorMauve": "rgba(142, 140, 153, 1)",
4849
- "colorMauveHover": "#C0BFC8",
4850
- "colorMauveBg": "rgba(239, 240, 243, 0.8)",
4851
- "colorSlate": "#2C3A50",
4852
- "colorSlateHover": "#354252",
4853
- "colorSlateBg": "#232B36",
4854
- "boxShadowTertiary": "0px 12px 32px -16px rgba(0, 0, 0, 0.24),0px 12px 60px 0px rgba(0, 0, 0, 0.12),0px 0px 1px 0px rgba(0, 0, 0, 0.04)",
4855
- "boxShadowTertiaryLeft": "-12px 0px 32px -16px rgba(0, 0, 0, 0.24),-12px 0px 60px 0px rgba(0, 0, 0, 0.12),0px 0px 1px 0px rgba(0, 0, 0, 0.04)",
4856
- "boxShadowInput": "0px 12px 24px -16px rgba(54, 54, 73, 0.04),0px 12px 40px 0px rgba(51, 51, 71, 0.08),0px 0px 1px 0px rgba(44, 44, 54, 0.02)"
4857
- }
4858
-
4859
- ```
4860
-
4861
- <div><span style="display: inline-block; width: 12px; height: 12px; background-color: rgba(26, 26, 29, 1);"></span> carbonDarkTheme</div>
4862
-
4863
- ```json
4864
- {
4865
- "borderRadiusXS": 2,
4866
- "borderRadiusSM": 4,
4867
- "borderRadius": 6,
4868
- "borderRadiusLG": 8,
4869
- "borderRadiusXL": 12,
4870
- "borderRadiusFull": 999,
4871
- "wireframe": false,
4872
- "colorPrimaryBg": "#181818",
4873
- "colorPrimaryBgHover": "#2E2E2E",
4874
- "colorPrimaryBorder": "#323232",
4875
- "colorPrimaryBorderHover": "#2C2C2C",
4876
- "colorPrimaryHover": "#DFDFDF",
4877
- "colorPrimary": "#E4E4E4",
4878
- "colorPrimaryActive": "#7E7E7E",
4879
- "colorPrimaryTextHover": "#909090",
4880
- "colorPrimaryText": "#676767",
4881
- "colorPrimaryTextActive": "#959595",
4882
- "colorTextBase": "#E7E7ED",
4883
- "colorBgBase": "#0A0A0B",
4884
- "colorText": "#E7E7EDC7",
4885
- "colorTextSecondary": "#E7E7EDA6",
4886
- "colorTextTertiary": "#E7E7ED73",
4887
- "colorTextQuaternary": "#E7E7ED40",
4888
- "colorBorder": "#5B5B5BCC",
4889
- "colorBorderSecondary": "#323232CC",
4890
- "colorFill": "#E7E7ED2E",
4891
- "colorFillSecondary": "#E7E7ED1F",
4892
- "colorFillTertiary": "#E7E7ED14",
4893
- "colorFillQuaternary": "#E7E7ED0A",
4894
- "colorBgContainer": "#121212",
4895
- "colorBgElevated": "#212121",
4896
- "colorBgLayout": "#141414",
4897
- "colorBgSpotlight": "#525252D9",
4898
- "colorBgMask": "#050508CC",
4899
- "colorInfo": "#0B83F1",
4900
- "colorInfoHover": "#5EBCFF",
4901
- "colorInfoBorder": "#3990C9",
4902
- "colorInfoText": "#0B83F1",
4903
- "colorInfoBg": "#112233",
4904
- "colorInfoBgHover": "#264866",
4905
- "colorInfoBorderHover": "#5EBCFF",
4906
- "colorSuccess": "#5BB98B",
4907
- "colorSuccessHover": "#74A47C",
4908
- "colorSuccessBg": "#293631",
4909
- "colorSuccessBgHover": "#3F5147",
4910
- "colorSuccessBorder": "#73A377",
4911
- "colorSuccessBorderHover": "#ABD4BE",
4912
- "colorWarning": "#FAAD14",
4913
- "colorWarningHover": "#FF8C28",
4914
- "colorWarningBg": "#2D231A",
4915
- "colorWarningBgHover": "#4D3B23",
4916
- "colorWarningBorder": "#FFA628",
4917
- "colorWarningBorderHover": "#FFD666",
4918
- "colorError": "#FF4D4F",
4919
- "colorErrorHover": "#EE654E",
4920
- "colorErrorBg": "#2B0B08",
4921
- "colorErrorBgHover": "#4A2A28",
4922
- "colorErrorBorder": "#EE5B4E",
4923
- "colorErrorBorderHover": "#FFA39E",
4924
- "colorLink": "#4D7DFF",
4925
- "boxShadow": "0px 4px 6px 0px rgba(255, 255, 255, 0.08)",
4926
- "boxShadowSecondary": "0px 12px 24px -16px rgba(255, 255, 255, 0.06),0px 8px 40px 0px rgba(255, 255, 255, 0.12),0px 0px 1px 0px rgba(255, 255, 255, 0.04)",
4927
-
4928
- "colorTextWhite": "#ffffff",
4929
- "colorTextBlack": "#000000",
4930
- "colorTextOnPrimary": "#ffffff",
4931
- "colorFillDisable": "#898989",
4932
- "colorPurple": "#615CED",
4933
- "colorPurpleHover": "#8383F0",
4934
- "colorPurpleBg": "#6964877A",
4935
- "colorPink": "#EC4899",
4936
- "colorPinkHover": "#E494BC",
4937
- "colorPinkBg": "#53424D7A",
4938
- "colorYellow": "#EAB308",
4939
- "colorYellowHover": "#DBBE62",
4940
- "colorYellowBg": "#9585527A",
4941
- "colorOrange": "#FA8125",
4942
- "colorOrangeHover": "#F7A25F",
4943
- "colorOrangeBg": "#6F58417A",
4944
- "colorTeal": "#14B8A6",
4945
- "colorTealHover": "#7BC7BE",
4946
- "colorTealBg": "#4658547A",
4947
- "colorBlue": "#0090FF",
4948
- "colorBlueHover": "#83BFED",
4949
- "colorBlueBg": "#5E76897A",
4950
- "colorMauve": "#8E8C99",
4951
- "colorMauveHover": "#BBB8CA",
4952
- "colorMauveBg": "#5859647A",
4953
- "colorSlate": "#2C3A50",
4954
- "colorSlateHover": "#354252",
4955
- "colorSlateBg": "#232B36",
4956
- "colorLavender": "#A77BFF",
4957
- "colorLavenderHover": "#BFA5F3",
4958
- "colorLavenderBg": "rgba(150, 143, 167, 0.48)",
4959
-
4960
- "boxShadowTertiary": "0px 12px 32px -16px rgba(255, 255, 255, 0.24),0px 12px 60px 0px rgba(255, 255, 255, 0.12),0px 0px 1px 0px rgba(255, 255, 255, 0.04)",
4961
- "boxShadowTertiaryLeft": "-12px 0px 32px -16px rgba(255, 255, 255, 0.24),-12px 0px 60px 0px rgba(255, 255, 255, 0.12),0px 0px 1px 0px rgba(255, 255, 255, 0.04)",
4962
- "boxShadowInput": "0px 12px 24px -16px rgba(255, 255, 255, 0.08),0px 12px 40px 0px rgba(255, 255, 255, 0.16),0px 0px 1px 0px rgba(255, 255, 255, 0.04)"
4963
-
4964
- }
4965
- ```
4966
-
4967
- # CSS 变量
4968
-
4969
- Spark Design 默认启用 cssVar 模式,因此您可以利用 从 token 派生出的 CSS 变量来构建自己的样式。
4970
-
4971
-
4972
- ```less
4973
- .example {
4974
- background: var(--sps-color-bg-base);
4975
- color: var(--sps-color-pink);
4976
- }
4977
- // 提示:您可以将 'sps' 替换为您自己的前缀
4978
- ```
4979
-
4980
-
4981
-
4982
-
4983
- ### 1.0.21
4984
- `2025-12-25`
4985
-
4986
- ##### Changed
4987
-
4988
- - AlertDialog 组件:定位距离顶部的默认高度调整为当前窗口高度的 36%
4989
- - Table 组件:表格行 hover 背景色修改为 `color-bg-layout` 颜色变量;表格行选中背景色修改为 `color-primary-bg-hover` 颜色变量
4990
- - Select 组件:多选模式的选中项背景色调整
4991
- - 主题色变量更新:,
4992
- - bailianDarkTheme:添加 `"colorLinkHover": "#857DE3"`
4993
- - bailianTheme:添加 `"colorLinkHover": "#8080FF"`
4994
- - carbonDarkTheme:修改 `"colorTextOnPrimary": "#ffffff"`
4995
-
4996
- ##### Fixed
4997
-
4998
- - Slider 组件:水平滑动条组件取消默认左右两边的外边距 margin,操作按钮 handle 在最左侧与最右侧不超出滑动轨道宽度
4085
+ 访问 [Icon Library](https://sparkdesign.agentscope.io/#/resources/icons) 查看全部 Icon