vue-element-ui-x 1.0.41-beta → 1.0.43-beta
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/lib/components/Sender/index.js +1 -1
- package/lib/components/ThoughtChain/index.js +30 -30
- package/lib/index.common.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +774 -774
- package/lib/index.ssr.js +90 -0
- package/lib/index.umd.js +1 -1
- package/package.json +5 -5
- package/src/components/Attachments/index.js +0 -8
- package/src/components/Attachments/src/main.vue +0 -529
- package/src/components/Bubble/index.js +0 -6
- package/src/components/Bubble/src/main.vue +0 -288
- package/src/components/BubbleList/index.js +0 -8
- package/src/components/BubbleList/src/loading.vue +0 -75
- package/src/components/BubbleList/src/main.vue +0 -444
- package/src/components/Conversations/index.js +0 -8
- package/src/components/Conversations/src/components/item.vue +0 -350
- package/src/components/Conversations/src/main.vue +0 -587
- package/src/components/FilesCard/index.js +0 -8
- package/src/components/FilesCard/src/fileSvg/audio.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/changeFileName.bat +0 -18
- package/src/components/FilesCard/src/fileSvg/code.vue +0 -35
- package/src/components/FilesCard/src/fileSvg/database.vue +0 -94
- package/src/components/FilesCard/src/fileSvg/excel.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/file.vue +0 -40
- package/src/components/FilesCard/src/fileSvg/image.vue +0 -40
- package/src/components/FilesCard/src/fileSvg/index.js +0 -46
- package/src/components/FilesCard/src/fileSvg/link.vue +0 -54
- package/src/components/FilesCard/src/fileSvg/mark.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/pdf.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/ppt.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/three.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/txt.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/unknown.vue +0 -54
- package/src/components/FilesCard/src/fileSvg/video.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/word.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/zip.vue +0 -38
- package/src/components/FilesCard/src/main.vue +0 -403
- package/src/components/FilesCard/src/options.js +0 -18
- package/src/components/Prompts/index.js +0 -8
- package/src/components/Prompts/src/main.vue +0 -248
- package/src/components/Sender/index.js +0 -8
- package/src/components/Sender/src/components/ClearButton.vue +0 -28
- package/src/components/Sender/src/components/Loading.vue +0 -53
- package/src/components/Sender/src/components/LoadingButton.vue +0 -37
- package/src/components/Sender/src/components/SendButton.vue +0 -26
- package/src/components/Sender/src/components/SpeechButton.vue +0 -24
- package/src/components/Sender/src/components/SpeechLoading.vue +0 -87
- package/src/components/Sender/src/components/SpeechLoadingButton.vue +0 -41
- package/src/components/Sender/src/main.vue +0 -803
- package/src/components/Thinking/index.js +0 -8
- package/src/components/Thinking/src/main.vue +0 -199
- package/src/components/ThoughtChain/index.js +0 -8
- package/src/components/ThoughtChain/src/main.vue +0 -291
- package/src/components/Typewriter/index.js +0 -8
- package/src/components/Typewriter/src/main.vue +0 -255
- package/src/components/Welcome/index.js +0 -8
- package/src/components/Welcome/src/main.vue +0 -151
- package/src/index.js +0 -104
- package/src/locale/index.js +0 -97
- package/src/locale/lang/ar.js +0 -18
- package/src/locale/lang/de.js +0 -18
- package/src/locale/lang/en.js +0 -18
- package/src/locale/lang/es.js +0 -18
- package/src/locale/lang/fr.js +0 -18
- package/src/locale/lang/index.js +0 -62
- package/src/locale/lang/it.js +0 -18
- package/src/locale/lang/ja.js +0 -18
- package/src/locale/lang/ko.js +0 -18
- package/src/locale/lang/pt-br.js +0 -18
- package/src/locale/lang/ru-RU.js +0 -18
- package/src/locale/lang/zh-CN.js +0 -18
- package/src/locale/lang/zh-TW.js +0 -18
- package/src/locale/mixin.js +0 -9
- package/src/mixins/index.js +0 -49
- package/src/mixins/recordMixin.js +0 -117
- package/src/mixins/sendMixin.js +0 -450
- package/src/mixins/streamMixin.js +0 -497
- package/src/styles/Attachments.scss +0 -236
- package/src/styles/Bubble.scss +0 -158
- package/src/styles/BubbleList.scss +0 -148
- package/src/styles/Conversations.scss +0 -283
- package/src/styles/FilesCard.scss +0 -222
- package/src/styles/Prompts.scss +0 -197
- package/src/styles/Sender.scss +0 -207
- package/src/styles/Thinking.scss +0 -142
- package/src/styles/ThoughtChain.scss +0 -113
- package/src/styles/Typewriter.scss +0 -66
- package/src/styles/Welcome.scss +0 -283
- package/src/theme/var.scss +0 -183
- package/src/utils/index.js +0 -199
- package/src/utils/scrollDetector.js +0 -34
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<li
|
|
3
|
-
:key="item.key"
|
|
4
|
-
class="el-x-conversation-item"
|
|
5
|
-
:class="{
|
|
6
|
-
disabled: item.disabled,
|
|
7
|
-
active: active,
|
|
8
|
-
hovered: item.disabled ? false : isHovered,
|
|
9
|
-
'menu-opened': isShowMenuBtn,
|
|
10
|
-
}"
|
|
11
|
-
:style="{
|
|
12
|
-
...itemsStyle,
|
|
13
|
-
...(isHovered ? itemsHoverStyle : {}),
|
|
14
|
-
...(isShowMenuBtn ? itemsMenuOpenedStyle : {}),
|
|
15
|
-
...(active ? itemsActiveStyle : {}),
|
|
16
|
-
}"
|
|
17
|
-
@click="handleClick(item.key)"
|
|
18
|
-
@mouseenter="handleMouseEnter"
|
|
19
|
-
@mouseleave="handleMouseLeave"
|
|
20
|
-
>
|
|
21
|
-
<div class="el-x-conversation-content">
|
|
22
|
-
<!-- 标签区域 - 通过插槽自定义 -->
|
|
23
|
-
<div class="el-x-conversation-content-main">
|
|
24
|
-
<slot name="label">
|
|
25
|
-
<!-- 前缀图标 -->
|
|
26
|
-
<span
|
|
27
|
-
v-if="prefixIconRender"
|
|
28
|
-
class="el-x-conversation-prefix-icon"
|
|
29
|
-
>
|
|
30
|
-
<i :class="prefixIcon"></i>
|
|
31
|
-
</span>
|
|
32
|
-
|
|
33
|
-
<!-- 标签和时间戳 -->
|
|
34
|
-
<div class="el-x-conversation-label-container">
|
|
35
|
-
<el-tooltip
|
|
36
|
-
v-if="showTooltip && isTextOverflow(item.label)"
|
|
37
|
-
:content="item.label"
|
|
38
|
-
:placement="tooltipPlacement"
|
|
39
|
-
:offset="tooltipOffset"
|
|
40
|
-
effect="dark"
|
|
41
|
-
>
|
|
42
|
-
<span
|
|
43
|
-
class="el-x-conversation-label"
|
|
44
|
-
:class="{ 'text-gradient': isTextOverflow(item.label) }"
|
|
45
|
-
:style="labelStyle"
|
|
46
|
-
>
|
|
47
|
-
{{ item.label }}
|
|
48
|
-
</span>
|
|
49
|
-
</el-tooltip>
|
|
50
|
-
<span
|
|
51
|
-
v-else
|
|
52
|
-
class="el-x-conversation-label"
|
|
53
|
-
:class="{ 'text-gradient': isTextOverflow(item.label) }"
|
|
54
|
-
:style="labelStyle"
|
|
55
|
-
>
|
|
56
|
-
{{ item.label }}
|
|
57
|
-
</span>
|
|
58
|
-
</div>
|
|
59
|
-
</slot>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<!-- 后缀图标 -->
|
|
63
|
-
<span
|
|
64
|
-
v-if="suffixIcon"
|
|
65
|
-
class="el-x-conversation-suffix-icon"
|
|
66
|
-
>
|
|
67
|
-
<i :class="suffixIcon"></i>
|
|
68
|
-
</span>
|
|
69
|
-
|
|
70
|
-
<!-- 菜单区域 - 只在hover或active状态下显示 -->
|
|
71
|
-
<div v-if="shouldShowMenu && showBuiltInMenu">
|
|
72
|
-
<div
|
|
73
|
-
v-if="menu && menu.length"
|
|
74
|
-
ref="menuButtonRef"
|
|
75
|
-
class="el-x-conversation-dropdown-more"
|
|
76
|
-
@click.stop
|
|
77
|
-
>
|
|
78
|
-
<el-dropdown
|
|
79
|
-
trigger="click"
|
|
80
|
-
:placement="menuPlacement"
|
|
81
|
-
:disabled="item.disabled"
|
|
82
|
-
@visible-change="updateMenuStatus"
|
|
83
|
-
@command="onMenuCommand"
|
|
84
|
-
>
|
|
85
|
-
<span class="el-dropdown-link">
|
|
86
|
-
<slot
|
|
87
|
-
name="more-filled"
|
|
88
|
-
:item="item"
|
|
89
|
-
:is-hovered="item.disabled ? false : isHovered"
|
|
90
|
-
:is-active="active"
|
|
91
|
-
:is-menu-opened="isShowMenuBtn"
|
|
92
|
-
:is-disabled="item.disabled"
|
|
93
|
-
>
|
|
94
|
-
<i class="el-icon-more el-x-conversation-dropdown-more-icon"></i>
|
|
95
|
-
</slot>
|
|
96
|
-
</span>
|
|
97
|
-
<el-dropdown-menu
|
|
98
|
-
slot="dropdown"
|
|
99
|
-
:style="mergedMenuStyle"
|
|
100
|
-
>
|
|
101
|
-
<slot name="menu">
|
|
102
|
-
<el-dropdown-item
|
|
103
|
-
v-for="menuItem in menu"
|
|
104
|
-
:key="menuItem.key"
|
|
105
|
-
:icon="menuItem.icon"
|
|
106
|
-
:disabled="menuItem.disabled"
|
|
107
|
-
:divided="menuItem.divided"
|
|
108
|
-
:command="menuItem.command"
|
|
109
|
-
:style="menuItem.menuItemStyle"
|
|
110
|
-
>
|
|
111
|
-
{{ menuItem.label }}
|
|
112
|
-
</el-dropdown-item>
|
|
113
|
-
</slot>
|
|
114
|
-
</el-dropdown-menu>
|
|
115
|
-
</el-dropdown>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
</li>
|
|
120
|
-
</template>
|
|
121
|
-
|
|
122
|
-
<script>
|
|
123
|
-
export default {
|
|
124
|
-
name: 'ConversationsItem',
|
|
125
|
-
|
|
126
|
-
props: {
|
|
127
|
-
item: {
|
|
128
|
-
type: Object,
|
|
129
|
-
required: true,
|
|
130
|
-
},
|
|
131
|
-
itemsStyle: {
|
|
132
|
-
type: Object,
|
|
133
|
-
default: () => ({}),
|
|
134
|
-
},
|
|
135
|
-
itemsHoverStyle: {
|
|
136
|
-
type: Object,
|
|
137
|
-
default: () => ({}),
|
|
138
|
-
},
|
|
139
|
-
itemsActiveStyle: {
|
|
140
|
-
type: Object,
|
|
141
|
-
default: () => ({}),
|
|
142
|
-
},
|
|
143
|
-
itemsMenuOpenedStyle: {
|
|
144
|
-
type: Object,
|
|
145
|
-
default: () => ({}),
|
|
146
|
-
},
|
|
147
|
-
prefixIcon: {
|
|
148
|
-
type: [String, Object],
|
|
149
|
-
default: null,
|
|
150
|
-
},
|
|
151
|
-
suffixIcon: {
|
|
152
|
-
type: [String, Object],
|
|
153
|
-
default: null,
|
|
154
|
-
},
|
|
155
|
-
showTooltip: {
|
|
156
|
-
type: Boolean,
|
|
157
|
-
default: false,
|
|
158
|
-
},
|
|
159
|
-
labelMaxWidth: {
|
|
160
|
-
type: Number,
|
|
161
|
-
default: undefined,
|
|
162
|
-
},
|
|
163
|
-
menu: {
|
|
164
|
-
type: Array,
|
|
165
|
-
default: () => [],
|
|
166
|
-
},
|
|
167
|
-
showBuiltInMenu: {
|
|
168
|
-
type: Boolean,
|
|
169
|
-
default: false,
|
|
170
|
-
},
|
|
171
|
-
tooltipPlacement: {
|
|
172
|
-
type: String,
|
|
173
|
-
default: 'top',
|
|
174
|
-
},
|
|
175
|
-
tooltipOffset: {
|
|
176
|
-
type: Number,
|
|
177
|
-
default: 12,
|
|
178
|
-
},
|
|
179
|
-
menuPlacement: {
|
|
180
|
-
type: String,
|
|
181
|
-
default: 'bottom-start',
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
menuStyle: {
|
|
185
|
-
type: Object,
|
|
186
|
-
default: () => ({}),
|
|
187
|
-
},
|
|
188
|
-
menuShowArrow: {
|
|
189
|
-
type: Boolean,
|
|
190
|
-
default: false,
|
|
191
|
-
},
|
|
192
|
-
active: {
|
|
193
|
-
type: Boolean,
|
|
194
|
-
default: false,
|
|
195
|
-
},
|
|
196
|
-
activeKey: {
|
|
197
|
-
type: [String, Number],
|
|
198
|
-
default: '',
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
data() {
|
|
203
|
-
return {
|
|
204
|
-
isHovered: false,
|
|
205
|
-
isShowMenuBtn: false,
|
|
206
|
-
menuButtonRef: null,
|
|
207
|
-
};
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
computed: {
|
|
211
|
-
prefixIconRender() {
|
|
212
|
-
return this.prefixIcon;
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
suffixIconRender() {
|
|
216
|
-
return this.suffixIcon;
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
isTextOverflow() {
|
|
220
|
-
return (label = '') => {
|
|
221
|
-
// 如果没有设置labelMaxWidth,直接返回false
|
|
222
|
-
if (!this.labelMaxWidth) return false;
|
|
223
|
-
|
|
224
|
-
// 创建一个临时的span元素来测量文本宽度
|
|
225
|
-
const span = document.createElement('span');
|
|
226
|
-
span.style.visibility = 'hidden';
|
|
227
|
-
span.style.position = 'absolute';
|
|
228
|
-
span.style.whiteSpace = 'nowrap';
|
|
229
|
-
span.style.fontSize = '14px'; // 与CSS中定义的字体大小一致
|
|
230
|
-
span.textContent = label;
|
|
231
|
-
|
|
232
|
-
document.body.appendChild(span);
|
|
233
|
-
const textWidth = span.offsetWidth;
|
|
234
|
-
document.body.removeChild(span);
|
|
235
|
-
|
|
236
|
-
// 如果文本宽度大于最大宽度,则返回true表示溢出
|
|
237
|
-
return textWidth > this.labelMaxWidth;
|
|
238
|
-
};
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
labelStyle() {
|
|
242
|
-
// 如果有labelMaxWidth,设置最大宽度并使用截断样式
|
|
243
|
-
if (this.labelMaxWidth) {
|
|
244
|
-
return {
|
|
245
|
-
maxWidth: `${this.labelMaxWidth}px`,
|
|
246
|
-
overflow: 'hidden',
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
// 否则返回空对象
|
|
250
|
-
return {};
|
|
251
|
-
},
|
|
252
|
-
|
|
253
|
-
shouldShowMenu() {
|
|
254
|
-
return this.isHovered || this.active || this.isShowMenuBtn;
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
mergedMenuStyle() {
|
|
258
|
-
return {
|
|
259
|
-
...this.menuStyle,
|
|
260
|
-
};
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
methods: {
|
|
265
|
-
handleMouseEnter() {
|
|
266
|
-
this.isHovered = true;
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
handleMouseLeave() {
|
|
270
|
-
this.isHovered = false;
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
handleClick(key) {
|
|
274
|
-
this.$emit('click', key);
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
// 辅助函数:驼峰式转短横线格式
|
|
278
|
-
camelToKebab(str) {
|
|
279
|
-
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
280
|
-
},
|
|
281
|
-
|
|
282
|
-
// 当菜单显示、隐藏时候触发
|
|
283
|
-
updateMenuStatus(isOpen) {
|
|
284
|
-
this.isShowMenuBtn = isOpen;
|
|
285
|
-
if (isOpen) {
|
|
286
|
-
// 延迟执行,确保菜单已经渲染完成
|
|
287
|
-
// 展开菜单时候 决定隐藏箭头
|
|
288
|
-
this.$nextTick(() => {
|
|
289
|
-
// 获取页面的所有 el-dropdown-menu el-popper 组件
|
|
290
|
-
const dropdownMenu = document.querySelectorAll('.el-dropdown-menu.el-popper');
|
|
291
|
-
|
|
292
|
-
if (dropdownMenu.length === 0) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
dropdownMenu.forEach(dropdownMenuItem => {
|
|
296
|
-
// 将它子元素中所有 popper__arrow 元素的 display 设置为 none
|
|
297
|
-
// 如果 dropdownMenuItem 存在,且display 不为 none
|
|
298
|
-
if (dropdownMenuItem && dropdownMenuItem.style.display !== 'none') {
|
|
299
|
-
// 隐藏箭头
|
|
300
|
-
const arrows = dropdownMenuItem.querySelectorAll('.popper__arrow');
|
|
301
|
-
if (arrows.length === 0) {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
arrows.forEach(arrow => {
|
|
305
|
-
arrow.style.display = this.menuShowArrow ? 'block' : 'none';
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
// 设置 .el-dropdown-menu__item 悬停样式
|
|
309
|
-
const items = dropdownMenuItem.querySelectorAll('.el-dropdown-menu__item');
|
|
310
|
-
if (items.length === 0) {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
items.forEach((item, index) => {
|
|
314
|
-
if (!this.menu || this.menu.length === 0) {
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
const menuItemHoverStyle = this.menu[index].menuItemHoverStyle || {};
|
|
318
|
-
// 生成固定类名(基于索引)
|
|
319
|
-
const className = `custom-hover-${index}`;
|
|
320
|
-
item.classList.add(className);
|
|
321
|
-
// 动态插入样式规则
|
|
322
|
-
const style = document.createElement('style');
|
|
323
|
-
style.textContent = `
|
|
324
|
-
.${className}:hover,
|
|
325
|
-
.${className}:focus {
|
|
326
|
-
${Object.entries(menuItemHoverStyle)
|
|
327
|
-
.map(([prop, val]) => `${this.camelToKebab(prop)}: ${val} !important;`)
|
|
328
|
-
.join(' ')}
|
|
329
|
-
}
|
|
330
|
-
`;
|
|
331
|
-
document.head.appendChild(style);
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
|
|
339
|
-
// 菜单命令处理
|
|
340
|
-
onMenuCommand(command) {
|
|
341
|
-
// 如果已经有自定义插槽,则不执行这个函数
|
|
342
|
-
// 菜单的所有内容由开发者自行处理
|
|
343
|
-
if (this.$scopedSlots.menu) {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
this.$emit('menu-command', command, this.item);
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
};
|
|
350
|
-
</script>
|