bhd-components 0.9.28 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.es5.development.css +970 -0
- package/dist/index.esm.es5.development.js +2831 -153
- package/dist/index.esm.es5.production.css +10 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +8138 -1570
- package/dist/vendor.esm.es5.production.js +157 -149
- package/es2017/AIMessageList/components/content/index.d.ts +4 -0
- package/es2017/AIMessageList/components/content/index.js +29 -0
- package/es2017/AIMessageList/components/content/index.module.less +8 -0
- package/es2017/AIMessageList/components/copyIcon/index.d.ts +7 -0
- package/es2017/AIMessageList/components/copyIcon/index.js +58 -0
- package/es2017/AIMessageList/components/copyIcon/index.module.less +22 -0
- package/es2017/AIMessageList/components/errorCallback/index.d.ts +3 -0
- package/es2017/AIMessageList/components/errorCallback/index.js +6 -0
- package/es2017/AIMessageList/components/fileList/fileIcon.d.ts +3 -0
- package/es2017/AIMessageList/components/fileList/fileIcon.js +970 -0
- package/es2017/AIMessageList/components/fileList/index.d.ts +4 -0
- package/es2017/AIMessageList/components/fileList/index.js +299 -0
- package/es2017/AIMessageList/components/fileList/index.module.less +95 -0
- package/es2017/AIMessageList/components/footer/index.d.ts +10 -0
- package/es2017/AIMessageList/components/footer/index.js +296 -0
- package/es2017/AIMessageList/components/footer/index.module.less +51 -0
- package/es2017/AIMessageList/components/header/index.d.ts +9 -0
- package/es2017/AIMessageList/components/header/index.js +94 -0
- package/es2017/AIMessageList/components/header/index.module.less +31 -0
- package/es2017/AIMessageList/components/referencesIcon/index.d.ts +9 -0
- package/es2017/AIMessageList/components/referencesIcon/index.js +37 -0
- package/es2017/AIMessageList/components/referencesIcon/index.module.less +13 -0
- package/es2017/AIMessageList/components/renderReferrnce/index.d.ts +10 -0
- package/es2017/AIMessageList/components/renderReferrnce/index.js +68 -0
- package/es2017/AIMessageList/components/renderReferrnce/index.module.less +64 -0
- package/es2017/AIMessageList/components/sendBtn/index.d.ts +4 -0
- package/es2017/AIMessageList/components/sendBtn/index.js +46 -0
- package/es2017/AIMessageList/components/sendBtn/index.module.less +25 -0
- package/es2017/AIMessageList/components/uplodaFileBtn/index.d.ts +4 -0
- package/es2017/AIMessageList/components/uplodaFileBtn/index.js +33 -0
- package/es2017/AIMessageList/components/uplodaFileBtn/index.module.less +5 -0
- package/es2017/AIMessageList/components/virtuosoList/index.d.ts +5 -0
- package/es2017/AIMessageList/components/virtuosoList/index.js +507 -0
- package/es2017/AIMessageList/components/virtuosoList/index.module.less +381 -0
- package/es2017/AIMessageList/index.d.ts +4 -0
- package/es2017/AIMessageList/index.js +58 -0
- package/es2017/AIMessageList/index.module.less +20 -0
- package/es2017/AIMessageList/type.d.ts +242 -0
- package/es2017/bhdEditor/index.d.ts +2 -0
- package/es2017/bhdEditor/index.js +3 -0
- package/es2017/bhdModalCropper/index.d.ts +10 -0
- package/es2017/bhdModalCropper/index.js +144 -0
- package/es2017/bhdModalCropper/index.module.less +362 -0
- package/es2017/customerService/index.js +1 -0
- package/es2017/images/loading2.js +2 -0
- package/es2017/index.d.ts +2 -0
- package/es2017/index.js +2 -0
- package/es2017/utils/Date.d.ts +2 -1
- package/es2017/utils/Date.js +2 -1
- package/es2017/utils/dom.d.ts +4 -1
- package/es2017/utils/dom.js +44 -1
- package/es2017/utils/number.d.ts +1 -0
- package/es2017/utils/number.js +9 -0
- package/esm/AIMessageList/components/content/index.d.ts +4 -0
- package/esm/AIMessageList/components/content/index.js +29 -0
- package/esm/AIMessageList/components/content/index.module.less +8 -0
- package/esm/AIMessageList/components/copyIcon/index.d.ts +7 -0
- package/esm/AIMessageList/components/copyIcon/index.js +61 -0
- package/esm/AIMessageList/components/copyIcon/index.module.less +22 -0
- package/esm/AIMessageList/components/errorCallback/index.d.ts +3 -0
- package/esm/AIMessageList/components/errorCallback/index.js +6 -0
- package/esm/AIMessageList/components/fileList/fileIcon.d.ts +3 -0
- package/esm/AIMessageList/components/fileList/fileIcon.js +970 -0
- package/esm/AIMessageList/components/fileList/index.d.ts +4 -0
- package/esm/AIMessageList/components/fileList/index.js +325 -0
- package/esm/AIMessageList/components/fileList/index.module.less +95 -0
- package/esm/AIMessageList/components/footer/index.d.ts +10 -0
- package/esm/AIMessageList/components/footer/index.js +304 -0
- package/esm/AIMessageList/components/footer/index.module.less +51 -0
- package/esm/AIMessageList/components/header/index.d.ts +9 -0
- package/esm/AIMessageList/components/header/index.js +96 -0
- package/esm/AIMessageList/components/header/index.module.less +31 -0
- package/esm/AIMessageList/components/referencesIcon/index.d.ts +9 -0
- package/esm/AIMessageList/components/referencesIcon/index.js +39 -0
- package/esm/AIMessageList/components/referencesIcon/index.module.less +13 -0
- package/esm/AIMessageList/components/renderReferrnce/index.d.ts +10 -0
- package/esm/AIMessageList/components/renderReferrnce/index.js +72 -0
- package/esm/AIMessageList/components/renderReferrnce/index.module.less +64 -0
- package/esm/AIMessageList/components/sendBtn/index.d.ts +4 -0
- package/esm/AIMessageList/components/sendBtn/index.js +48 -0
- package/esm/AIMessageList/components/sendBtn/index.module.less +25 -0
- package/esm/AIMessageList/components/uplodaFileBtn/index.d.ts +4 -0
- package/esm/AIMessageList/components/uplodaFileBtn/index.js +33 -0
- package/esm/AIMessageList/components/uplodaFileBtn/index.module.less +5 -0
- package/esm/AIMessageList/components/virtuosoList/index.d.ts +5 -0
- package/esm/AIMessageList/components/virtuosoList/index.js +484 -0
- package/esm/AIMessageList/components/virtuosoList/index.module.less +381 -0
- package/esm/AIMessageList/index.d.ts +4 -0
- package/esm/AIMessageList/index.js +58 -0
- package/esm/AIMessageList/index.module.less +20 -0
- package/esm/AIMessageList/type.d.ts +242 -0
- package/esm/bhdEditor/index.d.ts +2 -0
- package/esm/bhdEditor/index.js +3 -0
- package/esm/bhdModalCropper/index.d.ts +10 -0
- package/esm/bhdModalCropper/index.js +151 -0
- package/esm/bhdModalCropper/index.module.less +362 -0
- package/esm/customerService/index.js +1 -0
- package/esm/images/loading2.js +2 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/utils/Date.d.ts +2 -1
- package/esm/utils/Date.js +2 -1
- package/esm/utils/dom.d.ts +4 -1
- package/esm/utils/dom.js +45 -1
- package/esm/utils/number.d.ts +1 -0
- package/esm/utils/number.js +9 -0
- package/package.json +7 -2
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
.virtuosoList-wrapper {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
.loadingIcon {
|
|
5
|
+
width: 100%;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
padding: 16px 0 24px 0;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
& > img {
|
|
12
|
+
width: 32px;
|
|
13
|
+
height: 32px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.msg-date {
|
|
18
|
+
width: 100%;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
padding: 16px 32px 16px 32px;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
gap: 16px;
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
color: rgba(0, 0, 0, 0.25);
|
|
27
|
+
&:before {
|
|
28
|
+
content: "";
|
|
29
|
+
display: block;
|
|
30
|
+
flex: 1;
|
|
31
|
+
width: 50%;
|
|
32
|
+
height: 1px;
|
|
33
|
+
background: #ebebeb;
|
|
34
|
+
}
|
|
35
|
+
&:after {
|
|
36
|
+
content: "";
|
|
37
|
+
display: block;
|
|
38
|
+
flex: 1;
|
|
39
|
+
width: 50%;
|
|
40
|
+
height: 1px;
|
|
41
|
+
background: #ebebeb;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.msgItem {
|
|
46
|
+
width: 100%;
|
|
47
|
+
padding: 0px 16px;
|
|
48
|
+
padding-top: 0;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
display: flex;
|
|
51
|
+
.msgItem-box {
|
|
52
|
+
max-width: 80%;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
color: rgba(0, 0, 0, 0.65);
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
.msgItem-content {
|
|
58
|
+
position: relative;
|
|
59
|
+
width: fit-content;
|
|
60
|
+
max-width: 100%;
|
|
61
|
+
.msgItem-text {
|
|
62
|
+
padding: 12px 16px;
|
|
63
|
+
.copyCode {
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: flex-end;
|
|
66
|
+
align-items: center;
|
|
67
|
+
border-radius: 4px 4px 0px 0px;
|
|
68
|
+
border: 1px solid rgba(0, 0, 0, 0.06);
|
|
69
|
+
border-bottom-color: rgba(0, 0, 0, 0.06);
|
|
70
|
+
background: rgba(0, 0, 0, 0.02);
|
|
71
|
+
text-align: right;
|
|
72
|
+
height: 37px;
|
|
73
|
+
line-height: 37px !important;
|
|
74
|
+
padding: 0 !important;
|
|
75
|
+
padding-right: 16px !important;
|
|
76
|
+
position: relative;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
font-weight: 400 !important;
|
|
79
|
+
top: 6px;
|
|
80
|
+
&.copyCodeFun {
|
|
81
|
+
display: flex;
|
|
82
|
+
}
|
|
83
|
+
.copyCodeText {
|
|
84
|
+
line-height: 1;
|
|
85
|
+
}
|
|
86
|
+
.icon {
|
|
87
|
+
display: none;
|
|
88
|
+
margin-right: 8px;
|
|
89
|
+
color: rgba(0, 0, 0, 0.65);
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
&.copy {
|
|
92
|
+
display: block;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
&.copy_success {
|
|
96
|
+
.copyCode {
|
|
97
|
+
color: #f4523b;
|
|
98
|
+
}
|
|
99
|
+
.copy {
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
.copy_success_flag {
|
|
103
|
+
display: inline-block;
|
|
104
|
+
color: #f4523b;
|
|
105
|
+
}
|
|
106
|
+
.copyCodeText {
|
|
107
|
+
color: #f4523b;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
& > div {
|
|
112
|
+
h1,
|
|
113
|
+
h2,
|
|
114
|
+
h3,
|
|
115
|
+
h4,
|
|
116
|
+
h5,
|
|
117
|
+
h6 {
|
|
118
|
+
color: rgba(0, 0, 0, 0.85);
|
|
119
|
+
}
|
|
120
|
+
pre::-webkit-scrollbar {
|
|
121
|
+
background-color: #eaedf1;
|
|
122
|
+
background-color: transparent;
|
|
123
|
+
width: 4px;
|
|
124
|
+
height: 4px;
|
|
125
|
+
}
|
|
126
|
+
pre::-webkit-scrollbar-thumb {
|
|
127
|
+
border-radius: 4px;
|
|
128
|
+
background-color: rgba(0, 0, 0, 0.25);
|
|
129
|
+
}
|
|
130
|
+
p {
|
|
131
|
+
word-break: break-all;
|
|
132
|
+
white-space: break-spaces;
|
|
133
|
+
}
|
|
134
|
+
p,
|
|
135
|
+
li {
|
|
136
|
+
line-height: 1.5;
|
|
137
|
+
color: rgba(0, 0, 0, 0.85);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
li {
|
|
141
|
+
margin-top: 8px;
|
|
142
|
+
&:first-child {
|
|
143
|
+
margin-top: 0;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
& > h3 {
|
|
148
|
+
font-size: 16px;
|
|
149
|
+
font-weight: 600;
|
|
150
|
+
padding: 10px 0;
|
|
151
|
+
}
|
|
152
|
+
ol {
|
|
153
|
+
list-style: decimal;
|
|
154
|
+
padding-inline-start: 20px;
|
|
155
|
+
|
|
156
|
+
li {
|
|
157
|
+
list-style-type: auto;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
li p {
|
|
161
|
+
// padding: 4px 0;
|
|
162
|
+
font-size: 14px;
|
|
163
|
+
font-weight: 600;
|
|
164
|
+
}
|
|
165
|
+
li > ul li {
|
|
166
|
+
// padding-bottom: 8px;
|
|
167
|
+
list-style: inside;
|
|
168
|
+
color: rgba(0, 0, 0, 0.85);
|
|
169
|
+
&::marker {
|
|
170
|
+
color: #d9d9d9 !important;
|
|
171
|
+
}
|
|
172
|
+
&:first-child {
|
|
173
|
+
padding-top: 8px !important;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
li > ol li {
|
|
177
|
+
// padding-bottom: 8px;
|
|
178
|
+
&::marker {
|
|
179
|
+
color: rgba(0, 0, 0, 0.45) !important;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&:first-child {
|
|
183
|
+
padding-top: 8px !important;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
> li:last-of-type {
|
|
187
|
+
pre {
|
|
188
|
+
margin-bottom: 0;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// li{
|
|
193
|
+
// margin-top:16px;
|
|
194
|
+
// }
|
|
195
|
+
// > * + ul, > * + ol {
|
|
196
|
+
// margin-top:16px;
|
|
197
|
+
// }
|
|
198
|
+
// > ul + *, > ol + * {
|
|
199
|
+
// margin-top:16px;
|
|
200
|
+
// }
|
|
201
|
+
> *:not(pre) {
|
|
202
|
+
padding-top: 8px;
|
|
203
|
+
padding-bottom: 8px;
|
|
204
|
+
&:first-child {
|
|
205
|
+
padding-top: 0 !important;
|
|
206
|
+
}
|
|
207
|
+
&:last-child {
|
|
208
|
+
padding-bottom: 0 !important;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
> h3,
|
|
212
|
+
> h4 {
|
|
213
|
+
padding-top: 8px;
|
|
214
|
+
padding-bottom: 4px;
|
|
215
|
+
}
|
|
216
|
+
> p + p {
|
|
217
|
+
padding-top: 4px;
|
|
218
|
+
padding-bottom: 4px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
> pre:last-of-type {
|
|
222
|
+
margin-bottom: 0;
|
|
223
|
+
|
|
224
|
+
& + * {
|
|
225
|
+
margin-top: 8px;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
hr {
|
|
229
|
+
height: 0;
|
|
230
|
+
padding: 0;
|
|
231
|
+
margin: 0;
|
|
232
|
+
border: none;
|
|
233
|
+
}
|
|
234
|
+
table {
|
|
235
|
+
width: 100%;
|
|
236
|
+
padding: 0 !important;
|
|
237
|
+
margin: 8px 0;
|
|
238
|
+
border-collapse: separate;
|
|
239
|
+
border-top: 1px solid #dfe6ec;
|
|
240
|
+
border-left: 1px solid #dfe6ec;
|
|
241
|
+
thead tr th {
|
|
242
|
+
background-color: #f8f8f9;
|
|
243
|
+
padding: 8px;
|
|
244
|
+
text-align: center;
|
|
245
|
+
border-bottom: 1px solid #dfe6ec;
|
|
246
|
+
border-right: 1px solid #dfe6ec;
|
|
247
|
+
}
|
|
248
|
+
tbody tr td {
|
|
249
|
+
padding: 8px;
|
|
250
|
+
line-height: 21px;
|
|
251
|
+
height: 37px; //设置单元格最小高度
|
|
252
|
+
border-bottom: 1px solid #dfe6ec;
|
|
253
|
+
border-right: 1px solid #dfe6ec;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
pre {
|
|
258
|
+
background: #fafafa;
|
|
259
|
+
border: 1px solid rgba(0, 0, 0, 0.06);
|
|
260
|
+
border-top: none;
|
|
261
|
+
|
|
262
|
+
padding: 12px;
|
|
263
|
+
line-height: 1.5;
|
|
264
|
+
margin: 4px 0;
|
|
265
|
+
margin-bottom: 8px;
|
|
266
|
+
border-radius: 0 0 4px 4px;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
.msgItem-action {
|
|
271
|
+
border-top: 1px solid rgba(0, 0, 0, 0.06);
|
|
272
|
+
padding: 12px 16px;
|
|
273
|
+
width: 100%;
|
|
274
|
+
display: flex;
|
|
275
|
+
align-items: center;
|
|
276
|
+
justify-content: space-between;
|
|
277
|
+
.msgItem-action-right {
|
|
278
|
+
}
|
|
279
|
+
.msgItem-action-right {
|
|
280
|
+
display: flex;
|
|
281
|
+
align-items: center;
|
|
282
|
+
gap: 8px;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
.msgItem-action-operate {
|
|
287
|
+
height: 24px;
|
|
288
|
+
position: relative;
|
|
289
|
+
.msgItem-action-popover {
|
|
290
|
+
position: absolute;
|
|
291
|
+
width: max-content;
|
|
292
|
+
border-radius: 4px !important;
|
|
293
|
+
background: #fff;
|
|
294
|
+
line-height: 1;
|
|
295
|
+
z-index: 9;
|
|
296
|
+
padding: 4px 8px;
|
|
297
|
+
.msgItem-action-right {
|
|
298
|
+
display: flex;
|
|
299
|
+
gap: 8px;
|
|
300
|
+
}
|
|
301
|
+
&.msgItem-action-popover-floatTop {
|
|
302
|
+
bottom: 4px;
|
|
303
|
+
right: 0;
|
|
304
|
+
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1);
|
|
305
|
+
}
|
|
306
|
+
&.msgItem-action-popover-floatBottom {
|
|
307
|
+
box-shadow: 0 4px 10px 4px rgba(0, 0, 0, 0.1);
|
|
308
|
+
right: 0;
|
|
309
|
+
top: 4px;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.msgItem-references-text {
|
|
316
|
+
padding: 8px;
|
|
317
|
+
border-radius: 2px;
|
|
318
|
+
background: #e7e7e7;
|
|
319
|
+
font-size: 12px;
|
|
320
|
+
color: rgba(0, 0, 0, 0.65);
|
|
321
|
+
margin-top: 8px;
|
|
322
|
+
& > div {
|
|
323
|
+
width: 100%;
|
|
324
|
+
max-height: 36px;
|
|
325
|
+
word-break: break-all;
|
|
326
|
+
display: -webkit-box;
|
|
327
|
+
-webkit-line-clamp: 2;
|
|
328
|
+
-webkit-box-orient: vertical;
|
|
329
|
+
overflow: hidden;
|
|
330
|
+
text-overflow: ellipsis;
|
|
331
|
+
word-wrap: break-word;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
&.msgItem-left {
|
|
335
|
+
justify-content: flex-start;
|
|
336
|
+
.msgItem-box {
|
|
337
|
+
align-items: flex-start;
|
|
338
|
+
.msgItem-content {
|
|
339
|
+
background: #ffffff;
|
|
340
|
+
border-radius: 2px 20px 20px 20px;
|
|
341
|
+
.msgItem-action {
|
|
342
|
+
border-radius: 0px 0px 20px 20px;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
.msgItem-action-operate {
|
|
346
|
+
margin-left: auto;
|
|
347
|
+
.msgItem-action-popover {
|
|
348
|
+
display: none;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
&.msgItem-right {
|
|
354
|
+
justify-content: flex-end;
|
|
355
|
+
padding-bottom: 24px;
|
|
356
|
+
.msgItem-box {
|
|
357
|
+
align-items: flex-end;
|
|
358
|
+
&:hover {
|
|
359
|
+
.msgItem-action-operate {
|
|
360
|
+
.msgItem-action-popover {
|
|
361
|
+
display: flex;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
.msgItem-content {
|
|
366
|
+
border-radius: 20px 2px 20px 20px;
|
|
367
|
+
background: #d1e4ff;
|
|
368
|
+
.msgItem-action {
|
|
369
|
+
border-radius: 0px 0px 20px 20px;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.msgItem-action-operate {
|
|
374
|
+
.msgItem-action-popover {
|
|
375
|
+
display: none;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useRef, forwardRef, useImperativeHandle } from "react";
|
|
4
|
+
import styles from "./index.module.less";
|
|
5
|
+
import Header from "./components/header";
|
|
6
|
+
import Content from "./components/content";
|
|
7
|
+
import Footer from "./components/footer";
|
|
8
|
+
import errorCallbackDefault from "./components/errorCallback";
|
|
9
|
+
var AIMessageList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
10
|
+
var _props_prefix = props.prefix, prefix = _props_prefix === void 0 ? "bhd-AIMessageList" : _props_prefix, _props_className = props.className, className = _props_className === void 0 ? "" : _props_className, headerConfig = props.headerConfig, footerConfig = props.footerConfig, _props_errorCallback = props.errorCallback, errorCallback = _props_errorCallback === void 0 ? errorCallbackDefault : _props_errorCallback, contentConfig = props.contentConfig;
|
|
11
|
+
var footerRef = useRef(null);
|
|
12
|
+
var contentRef = useRef(null);
|
|
13
|
+
var apiRef = useRef({
|
|
14
|
+
contentApi: null,
|
|
15
|
+
footerApi: null
|
|
16
|
+
});
|
|
17
|
+
useImperativeHandle(ref, function() {
|
|
18
|
+
apiRef.current.contentApi = contentRef.current;
|
|
19
|
+
apiRef.current.footerApi = footerRef.current;
|
|
20
|
+
return apiRef.current;
|
|
21
|
+
});
|
|
22
|
+
var getCls = function(clsName) {
|
|
23
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
24
|
+
};
|
|
25
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
26
|
+
className: "".concat(getCls("root"), " ").concat(className),
|
|
27
|
+
children: [
|
|
28
|
+
/*#__PURE__*/ _jsx("div", {
|
|
29
|
+
className: getCls("rootHeader"),
|
|
30
|
+
children: /*#__PURE__*/ _jsx(Header, {
|
|
31
|
+
headerConfig: headerConfig,
|
|
32
|
+
prefix: prefix,
|
|
33
|
+
errorCallback: errorCallback
|
|
34
|
+
})
|
|
35
|
+
}),
|
|
36
|
+
/*#__PURE__*/ _jsx("div", {
|
|
37
|
+
className: getCls("rootContent"),
|
|
38
|
+
children: /*#__PURE__*/ _jsx(Content, {
|
|
39
|
+
prefix: prefix,
|
|
40
|
+
contentConfig: contentConfig,
|
|
41
|
+
ref: contentRef,
|
|
42
|
+
apiRef: apiRef.current
|
|
43
|
+
})
|
|
44
|
+
}),
|
|
45
|
+
/*#__PURE__*/ _jsx("div", {
|
|
46
|
+
className: getCls("rootFooter"),
|
|
47
|
+
children: /*#__PURE__*/ _jsx(Footer, {
|
|
48
|
+
footerConfig: footerConfig,
|
|
49
|
+
prefix: prefix,
|
|
50
|
+
errorCallback: errorCallback,
|
|
51
|
+
ref: footerRef,
|
|
52
|
+
apiRef: apiRef.current
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
export default AIMessageList;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
background: #f5f5f5;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
.rootHeader {
|
|
9
|
+
width: 100%;
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
}
|
|
12
|
+
.rootContent {
|
|
13
|
+
width: 100%;
|
|
14
|
+
flex: 1;
|
|
15
|
+
}
|
|
16
|
+
.rootFooter {
|
|
17
|
+
width: 100%;
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
export interface AIMessageListProps {
|
|
2
|
+
prefix?: string; // 类名前缀 默认为 "bhd-AIMessageList"
|
|
3
|
+
className?: string; //全局的className
|
|
4
|
+
headerConfig: headerConfigProps;
|
|
5
|
+
footerConfig: footerConfigProps;
|
|
6
|
+
contentConfig: contentConfigProps;
|
|
7
|
+
errorCallback?: (error: errorMessageProps) => void;
|
|
8
|
+
|
|
9
|
+
// sendMsgAjax: () => any; //发送消息
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface AIMessageListRefProps {
|
|
13
|
+
footerApi: footerRefProps;
|
|
14
|
+
contentApi: contentRefProps;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// header Props
|
|
18
|
+
|
|
19
|
+
export interface headerConfigProps {
|
|
20
|
+
icon?: React.ReactNode; // 不传存在默认图标
|
|
21
|
+
title: React.ReactNode;
|
|
22
|
+
className?: string;
|
|
23
|
+
renderRightHead?: () => React.ReactNode; // 右侧区域的自定义渲染
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface msgActionProps {
|
|
27
|
+
renderLeft?: (
|
|
28
|
+
copyNode: React.ReactNode,
|
|
29
|
+
referencesNode: React.ReactNode
|
|
30
|
+
) => React.ReactNode;
|
|
31
|
+
renderRight?: (
|
|
32
|
+
copyNode: React.ReactNode,
|
|
33
|
+
referencesNode: React.ReactNode
|
|
34
|
+
) => React.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface contentConfigProps {
|
|
38
|
+
className?: string;
|
|
39
|
+
msgAction?: string[] | msgActionProps;
|
|
40
|
+
// transformItem:(item: any) => dataItemType;
|
|
41
|
+
getList: (
|
|
42
|
+
page: number,
|
|
43
|
+
pageSize: number
|
|
44
|
+
) => Promise<{
|
|
45
|
+
total: number;
|
|
46
|
+
dataSource: dataItemType[];
|
|
47
|
+
}>; // 列表数据
|
|
48
|
+
loadMore?: boolean; // 是否开启加载更多 // 默认为true
|
|
49
|
+
helloMsg?: string; //欢迎语
|
|
50
|
+
coverRenderText?: (item, html) => React.ReactNode; // 覆盖文本内容
|
|
51
|
+
coverRenderReferences?: (item:dataItemType,referenceNode:React.ReactNode) => React.ReactNode;//覆盖引用内容
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// content props
|
|
55
|
+
|
|
56
|
+
export interface contentProps {
|
|
57
|
+
prefix: string;
|
|
58
|
+
contentConfig: contentConfigProps;
|
|
59
|
+
apiRef: AIMessageListRefProps;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// footer Props
|
|
63
|
+
|
|
64
|
+
export interface footerConfigProps {
|
|
65
|
+
placeholder?: string; // placeholder 默认值为“请输入内容”
|
|
66
|
+
className?: string;
|
|
67
|
+
maxLength?: number | ((value: string) => boolean); //字符长度 默认500
|
|
68
|
+
renderAction?: (
|
|
69
|
+
sendBtn: React.ReactNode,
|
|
70
|
+
uploadFileBtn: React.ReactNode
|
|
71
|
+
) => React.ReactNode; // 自定义渲染操作栏
|
|
72
|
+
fileUpload?: boolean | fileUploadProps; // 默认为false
|
|
73
|
+
sendMsgAjaxParams: sendMsgAjaxParams;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface sendMsgAjaxParams {
|
|
77
|
+
url: string;
|
|
78
|
+
method?: string;
|
|
79
|
+
headers?: object;
|
|
80
|
+
params: (
|
|
81
|
+
value: string,
|
|
82
|
+
refereces: referenceType,
|
|
83
|
+
fileList: fileCustomProps[]
|
|
84
|
+
) => string;
|
|
85
|
+
onOpen?: (res: Response) => void;
|
|
86
|
+
onMessage?: (ev: EventSourceMessage) => { id: string; content: string };
|
|
87
|
+
onClose?: () => void;
|
|
88
|
+
onError?: (err: any) => void;
|
|
89
|
+
coverProps?: object;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// footer file Props
|
|
93
|
+
// 文件上传(需覆盖两种场景:存在解析和不存在解析的场景) flase 则不显示文件上传的 icon
|
|
94
|
+
export interface fileUploadProps {
|
|
95
|
+
accept?: string; //文件类型 默认值 ".pdf,.ppt,.pptx,.doc,.docx,.xls,.xlsx,.txt,.text,.png,.jpg,.jpeg,.gif,.webp"
|
|
96
|
+
maxCount?: number; // 上传文件数量限制 -1为不限制 默认为10
|
|
97
|
+
maxSize?: number; // 默认为50Mb 目前不考虑切片上传 业务上不要设置太大
|
|
98
|
+
multiple?: boolean; // 是否允许多选
|
|
99
|
+
customRequest: (
|
|
100
|
+
file: File
|
|
101
|
+
) => Promise<{ url: string; fileId: string; source: File,status:fileStatus }>; // 自定义上传方法
|
|
102
|
+
mapUploadCount?: number; // 并发上传的数量 默认为1
|
|
103
|
+
deleteFileAjax?: (fileId: string) => Promise<{ fileId: string }>; // 删除文件的ajax 返回删除文件的fileId
|
|
104
|
+
statusText?: (status: fileStatus) => React.ReactNode; // 自定义状态显示
|
|
105
|
+
parseFileAjax?: (fileId: string) => { status: fileStatus; fileId; string }; //文件解析的 ajax 请求 如不存在解析过程,可在此函数内直接返回上传成功的状态
|
|
106
|
+
iconFileRender?: (suffix: string) => React.ReactNode; // 文件上传的 icon。参数 文件对象file 返回值为图标
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// file status 文件状态
|
|
110
|
+
// 等待上传/上传中/上传失败/等待解析/解析中/解析成功/解析失败/上传成功
|
|
111
|
+
export type fileStatus =
|
|
112
|
+
| "waiting"
|
|
113
|
+
| "uploading"
|
|
114
|
+
| "uploadError"
|
|
115
|
+
| "waitParse"
|
|
116
|
+
| "parsing"
|
|
117
|
+
| "parsingError"
|
|
118
|
+
| "success";
|
|
119
|
+
|
|
120
|
+
// footer Ref Props
|
|
121
|
+
|
|
122
|
+
export interface footerRefProps {
|
|
123
|
+
setTextValue: (value: string) => void; // 设置输入框的值
|
|
124
|
+
sendMsg: (value: string) => void; // 发送消息
|
|
125
|
+
clearText: () => void; // 清空输入框
|
|
126
|
+
getCanSendMsg: () => boolean; //获取当前是否允许发送消息的状态
|
|
127
|
+
stopMessage: () => void; //停止发送消息
|
|
128
|
+
setReferences:(reference:referenceType)=>void;// 添加引用
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// sendBtn Props
|
|
132
|
+
|
|
133
|
+
export interface sendBtnProps {
|
|
134
|
+
prefix: string;
|
|
135
|
+
canSendMsg: boolean;
|
|
136
|
+
sending: boolean;
|
|
137
|
+
stopMessage: () => void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// uploadFileBtn Props
|
|
141
|
+
export interface uploadFileBtnProps {
|
|
142
|
+
prefix: string;
|
|
143
|
+
fileUpload: fileUploadProps;
|
|
144
|
+
customRequest: (options: any) => void;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// fileList Props
|
|
148
|
+
|
|
149
|
+
export interface fileListProps {
|
|
150
|
+
prefix: string;
|
|
151
|
+
fileUpload: fileUploadProps;
|
|
152
|
+
errorCallback: (error: errorMessageProps) => void;
|
|
153
|
+
changeFileCanSending:(flag:boolean)=>void;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
// file 自定义对象
|
|
158
|
+
|
|
159
|
+
export interface fileCustomProps {
|
|
160
|
+
name: string;
|
|
161
|
+
suffix: string;
|
|
162
|
+
fileId: string;
|
|
163
|
+
url: string;
|
|
164
|
+
status: fileStatus | undefined;
|
|
165
|
+
source: File | undefined;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// FileList 组件 ref props
|
|
169
|
+
|
|
170
|
+
export interface FileListRefProps {
|
|
171
|
+
addFile: (file: File) => void;
|
|
172
|
+
changePage: (page: number) => void;
|
|
173
|
+
deleteFile: (fileId: string) => void;
|
|
174
|
+
updateFile: (fileId: string, status: fileStatus) => void;
|
|
175
|
+
getFileList: () => fileCustomProps[];
|
|
176
|
+
vaildFile: (file: File,fileId?:string) => boolean;// 校验文件是否合规
|
|
177
|
+
fileToCustomFile:(file:File)=>fileCustomProps
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// error Message
|
|
181
|
+
|
|
182
|
+
export interface errorMessageProps {
|
|
183
|
+
type: errorMessageType;
|
|
184
|
+
message: string;
|
|
185
|
+
}
|
|
186
|
+
/*
|
|
187
|
+
fileAcceptError 文件类型错误
|
|
188
|
+
fileSizeEmpty 文件大小为空
|
|
189
|
+
fileSizeOver 文件大小超出限制
|
|
190
|
+
fileCountOver 文件数量超出限制
|
|
191
|
+
fileNameExist 文件名称已存在
|
|
192
|
+
*/
|
|
193
|
+
export type errorMessageType =
|
|
194
|
+
| "fileAcceptError"
|
|
195
|
+
| "fileSizeEmpty"
|
|
196
|
+
| "fileSizeOver"
|
|
197
|
+
| "fileCountOver"
|
|
198
|
+
| "fileNameExist";
|
|
199
|
+
|
|
200
|
+
// 引用数据类型
|
|
201
|
+
|
|
202
|
+
export type referenceType = referenceTypeText | referenceTypeFile;
|
|
203
|
+
|
|
204
|
+
export type referenceTypeText = {
|
|
205
|
+
type: "text";
|
|
206
|
+
value: string;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export type referenceTypeFile = {
|
|
210
|
+
type: "file";
|
|
211
|
+
value: fileCustomProps;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export interface VirtuosoListProps {
|
|
215
|
+
prefix: string;
|
|
216
|
+
contentConfig: contentConfigProps;
|
|
217
|
+
apiRef: AIMessageListRefProps;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export interface VirtuosoListRefProps {
|
|
221
|
+
addMsg: (msg: dataItemType) => void;
|
|
222
|
+
updateMsg: (id: string, obj: any) => void;
|
|
223
|
+
clearInputing: () => void;//清楚正在输入的inputing
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface contentRefProps extends VirtuosoListRefProps {}
|
|
227
|
+
|
|
228
|
+
export interface EventSourceMessage {
|
|
229
|
+
id: string;
|
|
230
|
+
event: string;
|
|
231
|
+
data: string;
|
|
232
|
+
retry?: number;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface dataItemType {
|
|
236
|
+
id: string; // 唯一id
|
|
237
|
+
createTime: string | number; //创建时间
|
|
238
|
+
content: string; //消息内容
|
|
239
|
+
location: "left" | "right"; // 消息显示在左边还是右边
|
|
240
|
+
reference: referenceType | null; // 引用数据
|
|
241
|
+
source: any; //原消息对象
|
|
242
|
+
}
|