@hsu-react/ui 0.0.1 → 0.0.2
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/es/components/ChainGraph/index.module.less +1 -1
- package/es/components/Chat/ChatInput/_components/SendButton/index.module.less +1 -1
- package/es/components/Chat/ChatInput/_components/UploadButton/index.module.less +1 -1
- package/es/components/Chat/ChatInput/index.module.less +2 -2
- package/es/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.less +1 -1
- package/es/components/Checkbox/CheckboxGroup/index.module.less +16 -16
- package/es/components/Checkbox/index.module.less +13 -13
- package/es/components/CodeMirror/index.module.less +4 -4
- package/es/components/DatePicker/RangePicker/index.module.less +1 -1
- package/es/components/DatePicker/StepPicker/index.module.less +1 -1
- package/es/components/DatePicker/index.module.less +1 -1
- package/es/components/Form/DrawerForm/index.module.less +2 -2
- package/es/components/FormItem/FormRadio/index.module.less +9 -9
- package/es/components/FormItem/FormSegmented/index.module.less +2 -2
- package/es/components/FormItem/FormUpload/index.module.less +4 -4
- package/es/components/FormItem/ItemContainer/index.module.less +22 -22
- package/es/components/Icon/index.js +9 -24
- package/es/components/Input/Number/index.module.less +9 -9
- package/es/components/Input/Password/index.module.less +3 -3
- package/es/components/Input/Search/index.module.less +5 -5
- package/es/components/Input/TextArea/index.module.less +5 -5
- package/es/components/Input/index.module.less +4 -4
- package/es/components/Modal/index.module.less +2 -2
- package/es/components/Operate/index.module.less +2 -2
- package/es/components/Panel/IframePanel/index.module.less +1 -1
- package/es/components/Panel/ListPanel/_components/ColumnMgt/index.module.less +1 -1
- package/es/components/Search/index.module.less +2 -2
- package/es/components/Select/AutoCompleteSelect/index.module.less +35 -35
- package/es/components/Select/IconSelect/index.module.less +3 -3
- package/es/components/Select/TreeSelect/index.module.less +17 -17
- package/es/components/Select/index.module.less +34 -34
- package/es/components/Slider/index.module.less +4 -4
- package/es/components/Spreadsheet/index.module.less +4 -4
- package/es/components/Table/_components/Pagination/index.module.less +23 -23
- package/es/components/Table/index.module.less +61 -61
- package/es/components/Tree/index.module.less +11 -11
- package/es/components/Upload/index.module.less +3 -3
- package/es/styles/antd-overload.less +1 -1
- package/lib/components/ChainGraph/index.module.less +1 -1
- package/lib/components/Chat/ChatInput/_components/SendButton/index.module.less +1 -1
- package/lib/components/Chat/ChatInput/_components/UploadButton/index.module.less +1 -1
- package/lib/components/Chat/ChatInput/index.module.less +2 -2
- package/lib/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.less +1 -1
- package/lib/components/Checkbox/CheckboxGroup/index.module.less +16 -16
- package/lib/components/Checkbox/index.module.less +13 -13
- package/lib/components/CodeMirror/index.module.less +4 -4
- package/lib/components/DatePicker/RangePicker/index.module.less +1 -1
- package/lib/components/DatePicker/StepPicker/index.module.less +1 -1
- package/lib/components/DatePicker/index.module.less +1 -1
- package/lib/components/Form/DrawerForm/index.module.less +2 -2
- package/lib/components/FormItem/FormRadio/index.module.less +9 -9
- package/lib/components/FormItem/FormSegmented/index.module.less +2 -2
- package/lib/components/FormItem/FormUpload/index.module.less +4 -4
- package/lib/components/FormItem/ItemContainer/index.module.less +22 -22
- package/lib/components/Icon/index.js +9 -27
- package/lib/components/Input/Number/index.module.less +9 -9
- package/lib/components/Input/Password/index.module.less +3 -3
- package/lib/components/Input/Search/index.module.less +5 -5
- package/lib/components/Input/TextArea/index.module.less +5 -5
- package/lib/components/Input/index.module.less +4 -4
- package/lib/components/Modal/index.module.less +2 -2
- package/lib/components/Operate/index.module.less +2 -2
- package/lib/components/Panel/IframePanel/index.module.less +1 -1
- package/lib/components/Panel/ListPanel/_components/ColumnMgt/index.module.less +1 -1
- package/lib/components/Search/index.module.less +2 -2
- package/lib/components/Select/AutoCompleteSelect/index.module.less +35 -35
- package/lib/components/Select/IconSelect/index.module.less +3 -3
- package/lib/components/Select/TreeSelect/index.module.less +17 -17
- package/lib/components/Select/index.module.less +34 -34
- package/lib/components/Slider/index.module.less +4 -4
- package/lib/components/Spreadsheet/index.module.less +4 -4
- package/lib/components/Table/_components/Pagination/index.module.less +23 -23
- package/lib/components/Table/index.module.less +61 -61
- package/lib/components/Tree/index.module.less +11 -11
- package/lib/components/Upload/index.module.less +3 -3
- package/lib/styles/antd-overload.less +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.md +2 -3
- package/src/components/ChainGraph/index.md +66 -1
- package/src/components/ChainGraph/index.module.less +1 -1
- package/src/components/Chart/index.md +78 -1
- package/src/components/Chat/ChatInput/_components/SendButton/index.module.less +1 -1
- package/src/components/Chat/ChatInput/_components/UploadButton/index.module.less +1 -1
- package/src/components/Chat/ChatInput/index.module.less +2 -2
- package/src/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.less +1 -1
- package/src/components/Chat/index.md +97 -1
- package/src/components/Checkbox/CheckboxGroup/index.module.less +16 -16
- package/src/components/Checkbox/index.md +53 -1
- package/src/components/Checkbox/index.module.less +13 -13
- package/src/components/CodeMirror/index.md +41 -1
- package/src/components/CodeMirror/index.module.less +4 -4
- package/src/components/DatePicker/RangePicker/index.module.less +1 -1
- package/src/components/DatePicker/StepPicker/index.module.less +1 -1
- package/src/components/DatePicker/index.md +43 -1
- package/src/components/DatePicker/index.module.less +1 -1
- package/src/components/Descriptions/index.md +45 -1
- package/src/components/Editor/index.md +40 -1
- package/src/components/FileCol/index.md +24 -1
- package/src/components/FilePreview/index.md +45 -1
- package/src/components/FlexFill/index.md +46 -1
- package/src/components/Form/DrawerForm/index.module.less +2 -2
- package/src/components/Form/index.md +92 -1
- package/src/components/FormItem/FormRadio/index.module.less +9 -9
- package/src/components/FormItem/FormSegmented/index.module.less +2 -2
- package/src/components/FormItem/FormUpload/index.module.less +4 -4
- package/src/components/FormItem/ItemContainer/index.module.less +22 -22
- package/src/components/FormItem/index.md +459 -1
- package/src/components/Icon/index.md +21 -3
- package/src/components/Icon/index.tsx +9 -37
- package/src/components/Input/Number/index.module.less +9 -9
- package/src/components/Input/Password/index.module.less +3 -3
- package/src/components/Input/Search/index.module.less +5 -5
- package/src/components/Input/TextArea/index.module.less +5 -5
- package/src/components/Input/index.md +35 -1
- package/src/components/Input/index.module.less +4 -4
- package/src/components/Markdown/index.md +71 -1
- package/src/components/Modal/index.md +43 -1
- package/src/components/Modal/index.module.less +2 -2
- package/src/components/Operate/index.md +43 -1
- package/src/components/Operate/index.module.less +2 -2
- package/src/components/Panel/IframePanel/index.module.less +1 -1
- package/src/components/Panel/ListPanel/_components/ColumnMgt/index.module.less +1 -1
- package/src/components/Panel/index.md +146 -1
- package/src/components/Search/index.md +73 -1
- package/src/components/Search/index.module.less +2 -2
- package/src/components/SecondConf/index.md +39 -1
- package/src/components/Select/AutoCompleteSelect/index.module.less +35 -35
- package/src/components/Select/IconSelect/index.module.less +3 -3
- package/src/components/Select/TreeSelect/index.module.less +17 -17
- package/src/components/Select/index.md +47 -1
- package/src/components/Select/index.module.less +34 -34
- package/src/components/Slider/index.md +29 -1
- package/src/components/Slider/index.module.less +4 -4
- package/src/components/Spreadsheet/index.md +42 -1
- package/src/components/Spreadsheet/index.module.less +4 -4
- package/src/components/Switch/index.md +33 -1
- package/src/components/TabBar/index.md +53 -1
- package/src/components/Table/_components/Pagination/index.module.less +23 -23
- package/src/components/Table/index.md +60 -1
- package/src/components/Table/index.module.less +61 -61
- package/src/components/Tags/index.md +23 -1
- package/src/components/TextEllipsis/index.md +29 -1
- package/src/components/Tree/index.md +66 -1
- package/src/components/Tree/index.module.less +11 -11
- package/src/components/Upload/index.md +72 -1
- package/src/components/Upload/index.module.less +3 -3
- package/src/styles/antd-overload.less +1 -1
|
@@ -56,25 +56,25 @@
|
|
|
56
56
|
overflow-y: auto;
|
|
57
57
|
scrollbar-gutter: stable;
|
|
58
58
|
|
|
59
|
-
.ant-tree-treenode {
|
|
59
|
+
:global(.ant-tree-treenode) {
|
|
60
60
|
&:hover {
|
|
61
61
|
background: var(--cf-subtle);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
&:has(> .ant-tree-node-selected) {
|
|
64
|
+
&:has(> :global(.ant-tree-node-selected)) {
|
|
65
65
|
background-color: #e6f4ff;
|
|
66
66
|
|
|
67
|
-
.ant-tree-node-selected {
|
|
67
|
+
:global(.ant-tree-node-selected) {
|
|
68
68
|
background-color: transparent;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
.ant-tree-indent-unit {
|
|
73
|
+
:global(.ant-tree-indent-unit) {
|
|
74
74
|
width: var(--tree-indent-unit-width);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
.ant-tree-switcher {
|
|
77
|
+
:global(.ant-tree-switcher) {
|
|
78
78
|
display: inline-flex;
|
|
79
79
|
align-items: center;
|
|
80
80
|
justify-content: center;
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
.ant-tree-node-content-wrapper {
|
|
98
|
+
:global(.ant-tree-node-content-wrapper) {
|
|
99
99
|
display: inline-flex;
|
|
100
100
|
align-items: center;
|
|
101
101
|
column-gap: 4px;
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
|
|
106
106
|
padding: 2px 0px;
|
|
107
107
|
|
|
108
|
-
.ant-tree-title {
|
|
108
|
+
:global(.ant-tree-title) {
|
|
109
109
|
display: inline-block;
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
background: transparent;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.ant-tree-iconEle {
|
|
116
|
+
:global(.ant-tree-iconEle) {
|
|
117
117
|
display: inline-flex;
|
|
118
118
|
align-items: center;
|
|
119
119
|
|
|
@@ -123,17 +123,17 @@
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
&.hideLeafExpand {
|
|
126
|
-
.ant-tree-switcher-noop {
|
|
126
|
+
:global(.ant-tree-switcher-noop) {
|
|
127
127
|
display: none;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
&.legacyHasSelectedNodeBackground {
|
|
132
132
|
.treeContainer {
|
|
133
|
-
.ant-tree-treenode.ant-tree-treenode-selected {
|
|
133
|
+
:global(.ant-tree-treenode):global(.ant-tree-treenode-selected) {
|
|
134
134
|
background-color: #e6f4ff;
|
|
135
135
|
|
|
136
|
-
.ant-tree-node-selected {
|
|
136
|
+
:global(.ant-tree-node-selected) {
|
|
137
137
|
background-color: transparent;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
width: 100%;
|
|
5
5
|
height: 100%;
|
|
6
6
|
|
|
7
|
-
span.ant-upload {
|
|
7
|
+
span:global(.ant-upload) {
|
|
8
8
|
display: inline-flex;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.ant-upload-list {
|
|
11
|
+
:global(.ant-upload-list) {
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
row-gap: 5px;
|
|
15
15
|
|
|
16
16
|
width: 100%;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
&:global(.ant-upload-list-picture-card) {
|
|
19
19
|
flex-direction: row;
|
|
20
20
|
flex-wrap: wrap;
|
|
21
21
|
gap: 5px;
|
package/package.json
CHANGED
|
@@ -21,10 +21,9 @@ import { Button } from "@hsu-react/ui";
|
|
|
21
21
|
```tsx
|
|
22
22
|
import React from "react";
|
|
23
23
|
import { Button } from "@hsu-react/ui";
|
|
24
|
-
import { Space } from "antd";
|
|
25
24
|
|
|
26
25
|
export default () => (
|
|
27
|
-
<
|
|
26
|
+
<div style={{ display: "flex", gap: 12, flexWrap: "wrap", alignItems: "center" }}>
|
|
28
27
|
<Button type="primary">主要按钮</Button>
|
|
29
28
|
<Button>默认按钮</Button>
|
|
30
29
|
<Button type="dashed">虚线按钮</Button>
|
|
@@ -32,7 +31,7 @@ export default () => (
|
|
|
32
31
|
<Button type="primary" disabled>
|
|
33
32
|
禁用
|
|
34
33
|
</Button>
|
|
35
|
-
</
|
|
34
|
+
</div>
|
|
36
35
|
);
|
|
37
36
|
```
|
|
38
37
|
|
|
@@ -8,10 +8,75 @@ title: ChainGraph 关系图
|
|
|
8
8
|
|
|
9
9
|
# ChainGraph 关系图
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
基于 `@antv/g6` 封装的树状关系图,支持节点展开/收起、搜索、缩略图、自适应布局与自定义节点渲染。
|
|
12
12
|
|
|
13
13
|
## 引入
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { ChainGraph } from "@hsu-react/ui";
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
## 基础用法
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import React from "react";
|
|
23
|
+
import { ChainGraph } from "@hsu-react/ui";
|
|
24
|
+
|
|
25
|
+
// TreeGraphData:每个节点含 id / label / 可选 children;level 用于标记根节点层级
|
|
26
|
+
const data = {
|
|
27
|
+
id: "root",
|
|
28
|
+
label: "根节点",
|
|
29
|
+
level: 1,
|
|
30
|
+
children: [
|
|
31
|
+
{ id: "a", label: "节点 A", level: 2 },
|
|
32
|
+
{
|
|
33
|
+
id: "b",
|
|
34
|
+
label: "节点 B",
|
|
35
|
+
level: 2,
|
|
36
|
+
children: [{ id: "b-1", label: "节点 B-1", level: 3 }],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default () => (
|
|
42
|
+
<div style={{ height: 320, width: "100%" }}>
|
|
43
|
+
<ChainGraph
|
|
44
|
+
data={data}
|
|
45
|
+
showSearch
|
|
46
|
+
showMiniMap
|
|
47
|
+
showExpandBtn
|
|
48
|
+
onClick={(node) => console.log(node)}
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## API
|
|
55
|
+
|
|
56
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
57
|
+
| --- | --- | --- | --- |
|
|
58
|
+
| data | 树状图数据(可携带 `origin` 原始数据) | `TreeGraphData` | - |
|
|
59
|
+
| octopus | 是否启用八爪鱼(双向)布局 | `boolean` | - |
|
|
60
|
+
| level | 默认展开层级 | `number` | `1` |
|
|
61
|
+
| rootLevel | 根节点层级 | `number` | `1` |
|
|
62
|
+
| onClick | 节点点击回调 | `(node?: TreeGraphData) => void` | - |
|
|
63
|
+
| styles | 节点样式配置 | `ChainGraphServicesStyles` | - |
|
|
64
|
+
| showPort | 是否显示连接端点 | `boolean` | `true` |
|
|
65
|
+
| showMiniMap | 是否显示缩略图 | `boolean` | `true` |
|
|
66
|
+
| miniMapSize | 缩略图尺寸 | `[number, number]` | `[200, 150]` |
|
|
67
|
+
| getImage | 获取图表快照(base64) | `(img: string) => void` | - |
|
|
68
|
+
| className | 内层容器类名 | `string` | - |
|
|
69
|
+
| wrapperClassName | 外层(Spin)容器类名 | `string` | - |
|
|
70
|
+
| showSearch | 是否显示搜索框 | `boolean` | `true` |
|
|
71
|
+
| showExpandBtn | 是否显示展开/收起按钮 | `boolean` | `true` |
|
|
72
|
+
| expandClassName | 展开按钮类名 | `string` | - |
|
|
73
|
+
| resize | 是否监听容器尺寸自适应 | `boolean` | `true` |
|
|
74
|
+
| offset | 容器宽高偏移 `[x, y]` | `[number, number]` | `[0, 0]` |
|
|
75
|
+
| fitLeft | 是否左对齐布局 | `boolean` | `false` |
|
|
76
|
+
| paddingLeft | 左侧内边距 | `number` | `20` |
|
|
77
|
+
| loading | 是否加载中 | `boolean` | `false` |
|
|
78
|
+
| hasHover | 是否启用 hover 效果 | `boolean` | `true` |
|
|
79
|
+
| hasSelected | 是否启用选中效果 | `boolean` | `true` |
|
|
80
|
+
| minZoom | 最小缩放比例 | `number` | - |
|
|
81
|
+
| labelRender | 自定义节点文本 | `(label: TreeGraphData) => string` | - |
|
|
82
|
+
| addShape | 自定义节点图形绘制 | `(group: IGroup, cfg: ModelConfig & { origin?: Record<string, unknown> }) => void` | - |
|
|
@@ -8,10 +8,87 @@ title: Chart 图表
|
|
|
8
8
|
|
|
9
9
|
# Chart 图表
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
基于 echarts 封装的图表集合,以 `Chart.Line`、`Chart.Bar`、`Chart.Pie` 等子组件形式提供常用图表,自动处理实例创建、容器自适应与销毁。
|
|
12
12
|
|
|
13
13
|
## 引入
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { Chart } from "@hsu-react/ui";
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
## 基础用法
|
|
20
|
+
|
|
21
|
+
以 `Chart.Line` 为例,传入 `xAxisData` 与 `seriesData` 即可渲染折线图:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import React from "react";
|
|
25
|
+
import { Chart } from "@hsu-react/ui";
|
|
26
|
+
|
|
27
|
+
export default () => (
|
|
28
|
+
<Chart.Line
|
|
29
|
+
style={{ height: 300 }}
|
|
30
|
+
legendData={["销量"]}
|
|
31
|
+
xAxisData={["周一", "周二", "周三", "周四", "周五", "周六", "周日"]}
|
|
32
|
+
seriesData={[120, 200, 150, 80, 70, 110, 130]}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 子组件
|
|
38
|
+
|
|
39
|
+
`Chart` 提供以下子组件:
|
|
40
|
+
|
|
41
|
+
| 子组件 | 说明 |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| Chart.Line | 折线图 |
|
|
44
|
+
| Chart.Bar | 柱状图 |
|
|
45
|
+
| Chart.Pie | 饼图(另含 `Chart.Pie.Three` 3D 饼图) |
|
|
46
|
+
| Chart.Polar | 极坐标图 |
|
|
47
|
+
| Chart.Gauge | 仪表盘 |
|
|
48
|
+
| Chart.Sankey | 桑基图 |
|
|
49
|
+
| Chart.Tree | 树图 |
|
|
50
|
+
| Chart.Bubble | 气泡图 |
|
|
51
|
+
| Chart.Heatmap | 热力图 |
|
|
52
|
+
| Chart.Radar | 雷达图 |
|
|
53
|
+
| Chart.Group | 组合图表(可在 `Line`/`Bar`/`Pie` 间切换) |
|
|
54
|
+
| Chart.Common | 通用图表,直接透传 echarts 的 `EChartsOption` |
|
|
55
|
+
|
|
56
|
+
## API
|
|
57
|
+
|
|
58
|
+
### Chart.Line / Chart.Bar
|
|
59
|
+
|
|
60
|
+
在 echarts `EChartsOption` 基础上扩展(`Chart.Bar` 同此表):
|
|
61
|
+
|
|
62
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
63
|
+
| --- | --- | --- | --- |
|
|
64
|
+
| xAxisData | X 轴类目数据 | `string[]` | - |
|
|
65
|
+
| seriesData | 系列数据,可为数字数组或带 `name`/`series` 的对象数组 | `SeriesDataType` | - |
|
|
66
|
+
| legendData | 图例数据 | `string[]` | - |
|
|
67
|
+
| chartTitle | 图表标题 | `string` | - |
|
|
68
|
+
| scrollConfig | 滚动/缩放配置 | `ChartScrollConfig` | - |
|
|
69
|
+
| insideDataZoom | 内置型数据缩放配置 | `DataZoomComponentOption` | - |
|
|
70
|
+
| sliderDataZoom | 滑动条型数据缩放配置 | `DataZoomComponentOption` | - |
|
|
71
|
+
| enableLegendAutoScroll | 是否启用图例自动滚动 | `boolean` | `false` |
|
|
72
|
+
| legendVisibleCount | 图例每页可见数量 | `number` | `8` |
|
|
73
|
+
| legendScrollInterval | 图例滚动间隔(ms) | `number` | `1500` |
|
|
74
|
+
| onClick | 图元点击回调 | `(event: ECElementEvent) => void` | - |
|
|
75
|
+
| className | 容器类名 | `string` | - |
|
|
76
|
+
| style | 容器样式 | `ChartCSSProperties` | - |
|
|
77
|
+
|
|
78
|
+
> `Chart.Line` 额外支持 `yAxisNameOffsets?: number[]`;其余 echarts 原生配置项(`grid`、`xAxis`、`yAxis`、`tooltip`、`series` 等)均可直接透传。
|
|
79
|
+
|
|
80
|
+
### Chart.Pie
|
|
81
|
+
|
|
82
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
83
|
+
| --- | --- | --- | --- |
|
|
84
|
+
| seriesData | 系列数据 | `SeriesDataType` | - |
|
|
85
|
+
| chartTitle | 图表中心标题 | `string` | - |
|
|
86
|
+
| extendSeries | 追加的额外系列 | `Series[]` | `[]` |
|
|
87
|
+
| isSemiCircle | 是否为半圆 | `boolean` | `false` |
|
|
88
|
+
| position | 半圆贴边位置 | `'top' \| 'bottom' \| 'left' \| 'right'` | `'bottom'` |
|
|
89
|
+
| spanAngle | 显示角度 | `number` | `180` |
|
|
90
|
+
| center | 中心位置 | `[string, string]` | - |
|
|
91
|
+
| radius | 半径配置 | `[string, string]` | - |
|
|
92
|
+
| enableLegendAutoScroll | 是否启用图例自动滚动 | `boolean` | `false` |
|
|
93
|
+
| onClick | 图元点击回调 | `(event: ECElementEvent) => void` | - |
|
|
94
|
+
| onChart | 图表实例就绪回调 | `(chart: EChartsType) => void` | - |
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
opacity: 0.8;
|
|
58
58
|
width: 140px;
|
|
59
59
|
height: 100%;
|
|
60
|
-
.ant-select-selector {
|
|
60
|
+
:global(.ant-select-selector) {
|
|
61
61
|
border: none;
|
|
62
62
|
margin: 1px 0 0;
|
|
63
63
|
}
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
|
|
93
93
|
border-radius: 4px;
|
|
94
94
|
|
|
95
|
-
.ant-btn-icon {
|
|
95
|
+
:global(.ant-btn-icon) {
|
|
96
96
|
display: flex;
|
|
97
97
|
align-items: center;
|
|
98
98
|
justify-content: center;
|
|
@@ -8,10 +8,106 @@ title: Chat 对话
|
|
|
8
8
|
|
|
9
9
|
# Chat 对话
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
基于 `@ant-design/x` 封装的 AI 对话组件集合,以 `Chat.List`(消息列表)、`Chat.Input`(输入框)、`Chat.History`(历史会话)三个子组件构成完整对话界面。
|
|
12
12
|
|
|
13
13
|
## 引入
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { Chat } from "@hsu-react/ui";
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
## 基础用法
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import React, { useState } from "react";
|
|
23
|
+
import { Chat } from "@hsu-react/ui";
|
|
24
|
+
|
|
25
|
+
export default () => {
|
|
26
|
+
const [list, setList] = useState([
|
|
27
|
+
{
|
|
28
|
+
query: { query: "你好,请介绍一下你自己" },
|
|
29
|
+
answers: [
|
|
30
|
+
{ answer: "你好!我是 AI 助手,有什么可以帮你的吗?", messageId: "1" },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
const handleSend = (value) => {
|
|
36
|
+
setList((prev) => [
|
|
37
|
+
...prev,
|
|
38
|
+
{
|
|
39
|
+
query: { query: value },
|
|
40
|
+
answers: [{ answer: `已收到:${value}`, messageId: String(Date.now()) }],
|
|
41
|
+
},
|
|
42
|
+
]);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div style={{ display: "flex", flexDirection: "column", height: 420 }}>
|
|
47
|
+
<div style={{ flex: 1, overflow: "auto" }}>
|
|
48
|
+
<Chat.List list={list} />
|
|
49
|
+
</div>
|
|
50
|
+
<Chat.Input onSend={handleSend} uploadEnabled={false} />
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Chat.List
|
|
57
|
+
|
|
58
|
+
消息列表,渲染用户提问与 AI 回答。
|
|
59
|
+
|
|
60
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| list | 消息列表数据 | `ChatMessage[]` | `[]` |
|
|
63
|
+
| assistanting | AI 是否正在回答中 | `boolean` | - |
|
|
64
|
+
| onAgain | 重新生成回调 | `(query: string) => void` | - |
|
|
65
|
+
| onLikeChange | 点赞/点踩变化回调 | `(messageId: string, like: boolean \| null, content: string) => void` | - |
|
|
66
|
+
| hideTool | 是否隐藏消息工具栏 | `boolean` | - |
|
|
67
|
+
| defaultAnswer | 默认(空态)回答内容 | `string` | - |
|
|
68
|
+
| userName / assistantName | 用户/助手名称 | `string` | - |
|
|
69
|
+
| userAvatar / assistantAvatar | 用户/助手头像 | `ReactNode` | - |
|
|
70
|
+
| userRenderContent | 自定义用户消息内容 | `(originContent: ReactNode, item: QueryMessage) => ReactNode` | - |
|
|
71
|
+
| userRenderQuery | 自定义用户提问文本 | `(query: string \| undefined, item: QueryMessage) => string \| undefined` | - |
|
|
72
|
+
| noAnswerTip | 无回答时的提示文案 | `string` | - |
|
|
73
|
+
| className | 容器类名 | `string` | - |
|
|
74
|
+
|
|
75
|
+
> 另有 `defaultAnswerClassName`、`userClassName`、`assistantClassName`、`userHeaderClassName`、`assistantHeaderClassName` 等多个样式类名属性。
|
|
76
|
+
|
|
77
|
+
## Chat.Input
|
|
78
|
+
|
|
79
|
+
对话输入框,支持文件上传、模型切换、功能(agent)开关。
|
|
80
|
+
|
|
81
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
82
|
+
| --- | --- | --- | --- |
|
|
83
|
+
| onSend | 发送回调 | `(value: string) => void` | - |
|
|
84
|
+
| assistanting | AI 是否回答中(显示停止按钮) | `boolean` | - |
|
|
85
|
+
| onStop | 停止回答回调 | `() => void` | - |
|
|
86
|
+
| fileList | 文件列表 | `UploadFile[]` | `[]` |
|
|
87
|
+
| onFileListChange | 文件列表变化回调 | `(fileList: UploadFile[]) => void` | - |
|
|
88
|
+
| uploadEnabled | 是否启用上传 | `boolean` | `true` |
|
|
89
|
+
| uploadConfig | 上传配置 | `UploadConfig` | - |
|
|
90
|
+
| modelConfig | 模型切换配置 | `{ modelList: ModelConfig[]; modelType: string; setModelType: (value: string) => void }` | - |
|
|
91
|
+
| agents | 功能开关配置 | `AgentToggleConfig[]` | `[]` |
|
|
92
|
+
| agentsState | 功能开关状态(受控) | `AgentConfig[]` | - |
|
|
93
|
+
| onAgentsChange | 功能开关变化回调 | `(agents: AgentConfig[]) => void` | - |
|
|
94
|
+
| placeholder | 占位提示文字 | `string` | `'询问问题'` |
|
|
95
|
+
| sendIcon / stopIcon | 发送/停止图标 | `string` | - |
|
|
96
|
+
| buttonGroup | 额外按钮组 | `ButtonProps[]` | - |
|
|
97
|
+
| wrapperClassName | 容器类名 | `string` | - |
|
|
98
|
+
|
|
99
|
+
## Chat.History
|
|
100
|
+
|
|
101
|
+
历史会话列表,支持新建、重命名、删除会话。
|
|
102
|
+
|
|
103
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
104
|
+
| --- | --- | --- | --- |
|
|
105
|
+
| historyList | 分组历史会话数据 | `Record<string, ChatHistoryData[]>` | - |
|
|
106
|
+
| currentChatId | 当前选中的会话 id | `string` | - |
|
|
107
|
+
| onNewChat | 新建会话回调 | `() => void` | - |
|
|
108
|
+
| onChatItemClick | 会话点击回调 | `(item: ChatHistoryData) => void` | - |
|
|
109
|
+
| updateTitle | 重命名回调 | `(chatId: string, title: string) => void` | - |
|
|
110
|
+
| deleteHistory | 删除会话回调 | `(item?: ChatHistoryData) => void` | - |
|
|
111
|
+
| onScrollEnd | 滚动到底部回调(加载更多) | `() => void` | - |
|
|
112
|
+
| width | 容器宽度 | `string` | - |
|
|
113
|
+
| tools | 顶部自定义工具区 | `ReactNode` | - |
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
height: 100%;
|
|
11
11
|
|
|
12
12
|
// 当 hasAll 为 true 时,Group 作为子元素
|
|
13
|
-
> .ant-checkbox-group {
|
|
13
|
+
> :global(.ant-checkbox-group) {
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
row-gap: 8px;
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
&.outline {
|
|
31
|
-
.ant-checkbox-wrapper {
|
|
32
|
-
.ant-checkbox {
|
|
33
|
-
.ant-checkbox-inner {
|
|
31
|
+
:global(.ant-checkbox-wrapper) {
|
|
32
|
+
:global(.ant-checkbox) {
|
|
33
|
+
:global(.ant-checkbox-inner) {
|
|
34
34
|
border-color: rgba(204, 204, 204, 1) !important;
|
|
35
35
|
|
|
36
36
|
background: transparent !important;
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
.ant-checkbox-inner {
|
|
44
|
+
&:global(.ant-checkbox-checked) {
|
|
45
|
+
:global(.ant-checkbox-inner) {
|
|
46
46
|
background: rgba(255, 255, 255, 1) !important;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
.ant-checkbox {
|
|
53
|
-
.ant-checkbox-inner {
|
|
51
|
+
&:global(.ant-checkbox-wrapper-disabled) {
|
|
52
|
+
:global(.ant-checkbox) {
|
|
53
|
+
:global(.ant-checkbox-inner) {
|
|
54
54
|
background: rgba(0, 0, 0, 0.04) !important;
|
|
55
55
|
|
|
56
56
|
&::after {
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
.ant-checkbox-inner {
|
|
61
|
+
&:global(.ant-checkbox-checked) {
|
|
62
|
+
:global(.ant-checkbox-inner) {
|
|
63
63
|
background: rgba(0, 0, 0, 0.04) !important;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
.ant-checkbox-wrapper {
|
|
71
|
+
:global(.ant-checkbox-wrapper) {
|
|
72
72
|
align-items: center;
|
|
73
73
|
|
|
74
74
|
font-family: inherit;
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
font-weight: inherit;
|
|
77
77
|
color: inherit;
|
|
78
78
|
|
|
79
|
-
.ant-checkbox {
|
|
79
|
+
:global(.ant-checkbox) {
|
|
80
80
|
width: 16px;
|
|
81
81
|
min-width: 16px;
|
|
82
82
|
height: 16px;
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
|
|
85
85
|
border-radius: 2px;
|
|
86
86
|
|
|
87
|
-
input[type="checkbox"].ant-checkbox-input {
|
|
87
|
+
input[type="checkbox"]:global(.ant-checkbox-input) {
|
|
88
88
|
width: 100%;
|
|
89
89
|
height: 100%;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
.ant-checkbox-inner {
|
|
92
|
+
:global(.ant-checkbox-inner) {
|
|
93
93
|
width: 100%;
|
|
94
94
|
height: 100%;
|
|
95
95
|
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
&-indeterminate {
|
|
109
|
-
.ant-checkbox-inner {
|
|
109
|
+
:global(.ant-checkbox-inner) {
|
|
110
110
|
&::after {
|
|
111
111
|
left: 50%;
|
|
112
112
|
top: 50%;
|
|
@@ -8,10 +8,62 @@ title: Checkbox 多选框
|
|
|
8
8
|
|
|
9
9
|
# Checkbox 多选框
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
基于 antd `Checkbox` 封装的多选框,额外提供 `outline` 描边样式,并附带支持全选、布局方向的 `Checkbox.Group`。
|
|
12
12
|
|
|
13
13
|
## 引入
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { Checkbox } from "@hsu-react/ui";
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
## 基础用法
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import React from "react";
|
|
23
|
+
import { Checkbox } from "@hsu-react/ui";
|
|
24
|
+
|
|
25
|
+
const options = [
|
|
26
|
+
{ label: "苹果", value: "apple" },
|
|
27
|
+
{ label: "香蕉", value: "banana" },
|
|
28
|
+
{ label: "橙子", value: "orange" },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export default () => {
|
|
32
|
+
const [value, setValue] = React.useState(["apple"]);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
style={{
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexDirection: "column",
|
|
39
|
+
gap: 12,
|
|
40
|
+
alignItems: "flex-start",
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<Checkbox outline>描边多选框</Checkbox>
|
|
44
|
+
<Checkbox.Group options={options} value={value} onChange={setValue} />
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## API
|
|
51
|
+
|
|
52
|
+
### Checkbox
|
|
53
|
+
|
|
54
|
+
在 [antd CheckboxProps](https://ant.design/components/checkbox-cn) 基础上扩展:
|
|
55
|
+
|
|
56
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
57
|
+
| --- | --- | --- | --- |
|
|
58
|
+
| outline | 是否使用描边样式 | `boolean` | - |
|
|
59
|
+
|
|
60
|
+
### Checkbox.Group
|
|
61
|
+
|
|
62
|
+
在 antd `Checkbox.Group` 基础上扩展:
|
|
63
|
+
|
|
64
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
65
|
+
| --- | --- | --- | --- |
|
|
66
|
+
| outline | 是否使用描边样式 | `boolean` | - |
|
|
67
|
+
| hasAll | 是否显示"全选"选项 | `boolean` | - |
|
|
68
|
+
| layout | 选项排列方向 | `'vertical' \| 'horizontal'` | `'horizontal'` |
|
|
69
|
+
| allMaxHeight | 含全选时容器最大高度(px) | `number` | - |
|