vue-element-ui-x 0.1.10-beta → 0.2.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/lib/components/Attachments/index.js +4 -4
- package/lib/components/Bubble/index.js +23 -28
- package/lib/components/BubbleList/index.js +32 -39
- package/lib/components/Conversations/index.js +3 -3
- package/lib/components/FilesCard/index.js +1 -1
- package/lib/components/Prompts/index.js +23 -23
- package/lib/components/Sender/index.js +6 -6
- package/lib/components/Thinking/index.js +5 -5
- package/lib/components/ThoughtChain/index.js +28 -35
- package/lib/components/Typewriter/index.js +22 -27
- package/lib/components/Welcome/index.js +5 -5
- package/lib/index.common.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +102 -364
- package/lib/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/Attachments/index.js +8 -8
- package/src/components/Bubble/index.js +6 -6
- package/src/components/Bubble/src/main.vue +299 -299
- package/src/components/BubbleList/index.js +8 -8
- package/src/components/BubbleList/src/loading.vue +75 -75
- package/src/components/Conversations/index.js +8 -8
- package/src/components/FilesCard/index.js +8 -8
- package/src/components/FilesCard/src/fileSvg/audio.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/code.vue +35 -35
- package/src/components/FilesCard/src/fileSvg/database.vue +94 -94
- package/src/components/FilesCard/src/fileSvg/excel.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/file.vue +40 -40
- package/src/components/FilesCard/src/fileSvg/image.vue +40 -40
- package/src/components/FilesCard/src/fileSvg/index.js +46 -46
- package/src/components/FilesCard/src/fileSvg/link.vue +54 -54
- package/src/components/FilesCard/src/fileSvg/mark.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/pdf.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/ppt.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/three.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/txt.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/unknown.vue +54 -54
- package/src/components/FilesCard/src/fileSvg/video.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/word.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/zip.vue +38 -38
- package/src/components/FilesCard/src/options.js +18 -18
- package/src/components/Prompts/index.js +8 -8
- package/src/components/Prompts/src/main.vue +248 -248
- package/src/components/Sender/index.js +8 -8
- package/src/components/Sender/src/components/ClearButton.vue +28 -28
- package/src/components/Sender/src/components/Loading.vue +53 -53
- package/src/components/Sender/src/components/LoadingButton.vue +39 -39
- package/src/components/Sender/src/components/SendButton.vue +26 -26
- package/src/components/Sender/src/components/SpeechButton.vue +24 -24
- package/src/components/Sender/src/components/SpeechLoading.vue +87 -87
- package/src/components/Sender/src/components/SpeechLoadingButton.vue +43 -43
- package/src/components/Thinking/index.js +8 -8
- package/src/components/ThoughtChain/index.js +8 -8
- package/src/components/Typewriter/index.js +8 -8
- package/src/components/Welcome/index.js +8 -8
- package/src/components/Welcome/src/main.vue +151 -151
- package/src/index.js +0 -3
- package/src/styles/Attachments.scss +236 -236
- package/src/styles/Bubble.scss +157 -157
- package/src/styles/BubbleList.scss +148 -148
- package/src/styles/Conversations.scss +260 -260
- package/src/styles/FilesCard.scss +221 -221
- package/src/styles/Prompts.scss +195 -195
- package/src/styles/Sender.scss +199 -199
- package/src/styles/Thinking.scss +2 -2
- package/src/styles/ThoughtChain.scss +113 -113
- package/src/styles/Typewriter.scss +66 -66
- package/src/styles/button.scss +302 -0
- package/src/styles/var.scss +1052 -0
- package/src/theme/var.scss +72 -72
- package/lib/components/Think/index.js +0 -799
- package/src/components/Think/index.js +0 -8
- package/src/components/Think/src/main.vue +0 -190
- package/src/styles/Think.scss +0 -134
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import ElXAttachments from './src/main.vue';
|
|
2
|
-
|
|
3
|
-
/* istanbul ignore next */
|
|
4
|
-
ElXAttachments.install = function (Vue) {
|
|
5
|
-
Vue.component(ElXAttachments.name, ElXAttachments);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default ElXAttachments;
|
|
1
|
+
import ElXAttachments from './src/main.vue';
|
|
2
|
+
|
|
3
|
+
/* istanbul ignore next */
|
|
4
|
+
ElXAttachments.install = function (Vue) {
|
|
5
|
+
Vue.component(ElXAttachments.name, ElXAttachments);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default ElXAttachments;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ElXBubble from './src/main.vue';
|
|
2
|
-
/* istanbul ignore next */
|
|
3
|
-
ElXBubble.install = function (Vue) {
|
|
4
|
-
Vue.component(ElXBubble.name, ElXBubble);
|
|
5
|
-
};
|
|
6
|
-
export default ElXBubble;
|
|
1
|
+
import ElXBubble from './src/main.vue';
|
|
2
|
+
/* istanbul ignore next */
|
|
3
|
+
ElXBubble.install = function (Vue) {
|
|
4
|
+
Vue.component(ElXBubble.name, ElXBubble);
|
|
5
|
+
};
|
|
6
|
+
export default ElXBubble;
|
|
@@ -1,299 +1,299 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="!internalDestroyed"
|
|
4
|
-
class="el-x-bubble"
|
|
5
|
-
:class="{
|
|
6
|
-
'el-x-bubble-start': placement === 'start',
|
|
7
|
-
'el-x-bubble-end': placement === 'end',
|
|
8
|
-
'el-x-bubble-no-style': noStyle,
|
|
9
|
-
'el-x-bubble-is-typing': isTypingClass,
|
|
10
|
-
}"
|
|
11
|
-
:style="{
|
|
12
|
-
'--el-box-shadow-tertiary': `0 1px 2px 0 rgba(0, 0, 0, 0.03),
|
|
13
|
-
0 1px 6px -1px rgba(0, 0, 0, 0.02),
|
|
14
|
-
0 2px 4px 0 rgba(0, 0, 0, 0.02)`,
|
|
15
|
-
'--bubble-content-max-width': `${maxWidth}`,
|
|
16
|
-
'--el-x-bubble-avatar-placeholder-width': `${
|
|
17
|
-
$scopedSlots.avatar || $slots.avatar ? '' : avatarSize + 'px'
|
|
18
|
-
}`,
|
|
19
|
-
'--el-x-bubble-avatar-placeholder-height': `${
|
|
20
|
-
$scopedSlots.avatar || $slots.avatar ? '' : avatarSize + 'px'
|
|
21
|
-
}`,
|
|
22
|
-
'--el-x-bubble-avatar-placeholder-gap': `${avatarGap}px`,
|
|
23
|
-
}"
|
|
24
|
-
>
|
|
25
|
-
<!-- 头像 -->
|
|
26
|
-
<div
|
|
27
|
-
v-if="!($scopedSlots.avatar || $slots.avatar) && avatar"
|
|
28
|
-
class="el-x-bubble-avatar el-x-bubble-avatar-size"
|
|
29
|
-
>
|
|
30
|
-
<el-avatar
|
|
31
|
-
:size="avatarSize"
|
|
32
|
-
:src="avatar"
|
|
33
|
-
:shape="avatarShape"
|
|
34
|
-
:icon="avatarIcon"
|
|
35
|
-
:src-set="avatarSrcSet"
|
|
36
|
-
:alt="avatarAlt"
|
|
37
|
-
@error="avatarError"
|
|
38
|
-
/>
|
|
39
|
-
</div>
|
|
40
|
-
<!-- 头像属性进行占位 -->
|
|
41
|
-
<div
|
|
42
|
-
v-if="!($scopedSlots.avatar || $slots.avatar) && !avatar && avatarSize"
|
|
43
|
-
class="el-x-bubble-avatar-placeholder"
|
|
44
|
-
/>
|
|
45
|
-
|
|
46
|
-
<div
|
|
47
|
-
v-if="$scopedSlots.avatar || $slots.avatar"
|
|
48
|
-
class="el-x-bubble-avatar"
|
|
49
|
-
>
|
|
50
|
-
<slot name="avatar" />
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<!-- 内容 -->
|
|
54
|
-
<div class="el-x-bubble-content-wrapper">
|
|
55
|
-
<!-- 头部内容 -->
|
|
56
|
-
<div
|
|
57
|
-
v-if="$scopedSlots.header || $slots.header"
|
|
58
|
-
class="el-x-bubble-header"
|
|
59
|
-
>
|
|
60
|
-
<slot name="header" />
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<div
|
|
64
|
-
class="el-x-bubble-content"
|
|
65
|
-
:class="{
|
|
66
|
-
'el-x-bubble-content-loading': loading,
|
|
67
|
-
'el-x-bubble-content-round': shape === 'round',
|
|
68
|
-
'el-x-bubble-content-corner': shape === 'corner',
|
|
69
|
-
'el-x-bubble-content-filled': variant === 'filled',
|
|
70
|
-
'el-x-bubble-content-borderless': variant === 'borderless',
|
|
71
|
-
'el-x-bubble-content-outlined': variant === 'outlined',
|
|
72
|
-
'el-x-bubble-content-shadow': variant === 'shadow',
|
|
73
|
-
}"
|
|
74
|
-
>
|
|
75
|
-
<div
|
|
76
|
-
v-if="!loading"
|
|
77
|
-
class="el-typewriter"
|
|
78
|
-
:class="{
|
|
79
|
-
'no-content': !content,
|
|
80
|
-
}"
|
|
81
|
-
>
|
|
82
|
-
<el-x-typewriter
|
|
83
|
-
v-if="!($scopedSlots.content || $slots.content) && content"
|
|
84
|
-
ref="typewriterRef"
|
|
85
|
-
:typing="_typing"
|
|
86
|
-
:content="content"
|
|
87
|
-
:is-markdown="isMarkdown"
|
|
88
|
-
:is-fog="isFog"
|
|
89
|
-
@start="onStart"
|
|
90
|
-
@writing="onWriting"
|
|
91
|
-
@finish="onFinish"
|
|
92
|
-
/>
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<!-- 内容-自定义 -->
|
|
96
|
-
<slot
|
|
97
|
-
v-if="!internalDestroyed && ($scopedSlots.content || $slots.content) && !loading"
|
|
98
|
-
name="content"
|
|
99
|
-
/>
|
|
100
|
-
|
|
101
|
-
<!-- 加载中-默认 -->
|
|
102
|
-
<div
|
|
103
|
-
v-if="loading && !($scopedSlots.loading || $slots.loading)"
|
|
104
|
-
class="el-x-bubble-loading-wrap"
|
|
105
|
-
>
|
|
106
|
-
<div
|
|
107
|
-
v-for="(_, index) in dots"
|
|
108
|
-
:key="index"
|
|
109
|
-
class="dot"
|
|
110
|
-
:style="{ animationDelay: `${index * 0.2}s` }"
|
|
111
|
-
/>
|
|
112
|
-
</div>
|
|
113
|
-
|
|
114
|
-
<!-- 加载中-自定义 -->
|
|
115
|
-
<div
|
|
116
|
-
v-if="loading && ($scopedSlots.loading || $slots.loading)"
|
|
117
|
-
class="el-x-bubble-loading-wrap"
|
|
118
|
-
>
|
|
119
|
-
<slot name="loading" />
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<div
|
|
124
|
-
v-if="$scopedSlots.footer || $slots.footer"
|
|
125
|
-
class="el-x-bubble-footer"
|
|
126
|
-
>
|
|
127
|
-
<slot name="footer" />
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
</template>
|
|
132
|
-
<script>
|
|
133
|
-
import ElXTypewriter from '../../Typewriter/index';
|
|
134
|
-
|
|
135
|
-
export default {
|
|
136
|
-
name: 'ElXBubble',
|
|
137
|
-
components: {
|
|
138
|
-
ElXTypewriter,
|
|
139
|
-
},
|
|
140
|
-
props: {
|
|
141
|
-
content: {
|
|
142
|
-
type: String,
|
|
143
|
-
default: '',
|
|
144
|
-
},
|
|
145
|
-
reasoning_content: {
|
|
146
|
-
type: String,
|
|
147
|
-
default: '',
|
|
148
|
-
},
|
|
149
|
-
avatar: {
|
|
150
|
-
type: String,
|
|
151
|
-
default: '',
|
|
152
|
-
},
|
|
153
|
-
placement: {
|
|
154
|
-
type: String,
|
|
155
|
-
default: 'start',
|
|
156
|
-
},
|
|
157
|
-
variant: {
|
|
158
|
-
type: String,
|
|
159
|
-
default: 'filled',
|
|
160
|
-
},
|
|
161
|
-
maxWidth: {
|
|
162
|
-
type: String,
|
|
163
|
-
default: '500px',
|
|
164
|
-
},
|
|
165
|
-
avatarSize: {
|
|
166
|
-
type: Number,
|
|
167
|
-
default: 0,
|
|
168
|
-
},
|
|
169
|
-
avatarGap: {
|
|
170
|
-
type: Number,
|
|
171
|
-
default: 12,
|
|
172
|
-
},
|
|
173
|
-
avatarShape: {
|
|
174
|
-
type: String,
|
|
175
|
-
default: 'circle',
|
|
176
|
-
},
|
|
177
|
-
avatarIcon: {
|
|
178
|
-
type: String,
|
|
179
|
-
default: '',
|
|
180
|
-
},
|
|
181
|
-
avatarSrcSet: {
|
|
182
|
-
type: String,
|
|
183
|
-
default: '',
|
|
184
|
-
},
|
|
185
|
-
avatarAlt: {
|
|
186
|
-
type: String,
|
|
187
|
-
default: '',
|
|
188
|
-
},
|
|
189
|
-
avatarFit: {
|
|
190
|
-
type: String,
|
|
191
|
-
default: 'cover',
|
|
192
|
-
},
|
|
193
|
-
noStyle: {
|
|
194
|
-
type: Boolean,
|
|
195
|
-
default: false,
|
|
196
|
-
},
|
|
197
|
-
typing: {
|
|
198
|
-
type: [Boolean, Object],
|
|
199
|
-
default: undefined,
|
|
200
|
-
},
|
|
201
|
-
loading: {
|
|
202
|
-
type: Boolean,
|
|
203
|
-
default: false,
|
|
204
|
-
},
|
|
205
|
-
shape: {
|
|
206
|
-
type: String,
|
|
207
|
-
default: '',
|
|
208
|
-
},
|
|
209
|
-
isMarkdown: {
|
|
210
|
-
type: Boolean,
|
|
211
|
-
default: false,
|
|
212
|
-
},
|
|
213
|
-
isFog: {
|
|
214
|
-
type: Boolean,
|
|
215
|
-
default: false,
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
data() {
|
|
219
|
-
return {
|
|
220
|
-
internalDestroyed: false,
|
|
221
|
-
isTypingClass: false,
|
|
222
|
-
};
|
|
223
|
-
},
|
|
224
|
-
computed: {
|
|
225
|
-
_step() {
|
|
226
|
-
if (typeof this.typing === 'object' && this.typing.step) return this.typing.step;
|
|
227
|
-
return 2;
|
|
228
|
-
},
|
|
229
|
-
_suffix() {
|
|
230
|
-
if (typeof this.typing === 'object' && this.typing.suffix) return this.typing.suffix;
|
|
231
|
-
return '|';
|
|
232
|
-
},
|
|
233
|
-
_interval() {
|
|
234
|
-
if (typeof this.typing === 'object' && this.typing.interval) return this.typing.interval;
|
|
235
|
-
return 50;
|
|
236
|
-
},
|
|
237
|
-
_typing() {
|
|
238
|
-
if (typeof this.typing === 'undefined') {
|
|
239
|
-
return false;
|
|
240
|
-
} else if (typeof this.typing === 'boolean') {
|
|
241
|
-
return this.typing;
|
|
242
|
-
} else {
|
|
243
|
-
return {
|
|
244
|
-
suffix: this._suffix,
|
|
245
|
-
step: this._step,
|
|
246
|
-
interval: this._interval,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
dots() {
|
|
251
|
-
return [1, 2, 3];
|
|
252
|
-
},
|
|
253
|
-
},
|
|
254
|
-
watch: {
|
|
255
|
-
content(newVal, oldVal) {
|
|
256
|
-
if (newVal !== oldVal && this.internalDestroyed) {
|
|
257
|
-
this.restart();
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
methods: {
|
|
262
|
-
onStart(instance) {
|
|
263
|
-
this.$emit('start', instance);
|
|
264
|
-
},
|
|
265
|
-
onFinish(instance) {
|
|
266
|
-
this.isTypingClass = false;
|
|
267
|
-
this.$emit('finish', instance);
|
|
268
|
-
},
|
|
269
|
-
onWriting(instance) {
|
|
270
|
-
this.isTypingClass = true;
|
|
271
|
-
this.$emit('writing', instance);
|
|
272
|
-
},
|
|
273
|
-
avatarError(e) {
|
|
274
|
-
this.$emit('avatarError', e);
|
|
275
|
-
},
|
|
276
|
-
interrupt() {
|
|
277
|
-
this.$refs.typewriterRef && this.$refs.typewriterRef.interrupt();
|
|
278
|
-
},
|
|
279
|
-
continueTyping() {
|
|
280
|
-
this.$refs.typewriterRef && this.$refs.typewriterRef.continueTyping();
|
|
281
|
-
},
|
|
282
|
-
restart() {
|
|
283
|
-
this.internalDestroyed = false;
|
|
284
|
-
this.$refs.typewriterRef && this.$refs.typewriterRef.restart();
|
|
285
|
-
},
|
|
286
|
-
destroy() {
|
|
287
|
-
this.$refs.typewriterRef && this.$refs.typewriterRef.destroy();
|
|
288
|
-
this.internalDestroyed = true;
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
beforeDestroy() {
|
|
292
|
-
this.destroy();
|
|
293
|
-
},
|
|
294
|
-
};
|
|
295
|
-
</script>
|
|
296
|
-
|
|
297
|
-
<style lang="scss" scoped>
|
|
298
|
-
@import '../../../styles/Bubble.scss';
|
|
299
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="!internalDestroyed"
|
|
4
|
+
class="el-x-bubble"
|
|
5
|
+
:class="{
|
|
6
|
+
'el-x-bubble-start': placement === 'start',
|
|
7
|
+
'el-x-bubble-end': placement === 'end',
|
|
8
|
+
'el-x-bubble-no-style': noStyle,
|
|
9
|
+
'el-x-bubble-is-typing': isTypingClass,
|
|
10
|
+
}"
|
|
11
|
+
:style="{
|
|
12
|
+
'--el-box-shadow-tertiary': `0 1px 2px 0 rgba(0, 0, 0, 0.03),
|
|
13
|
+
0 1px 6px -1px rgba(0, 0, 0, 0.02),
|
|
14
|
+
0 2px 4px 0 rgba(0, 0, 0, 0.02)`,
|
|
15
|
+
'--bubble-content-max-width': `${maxWidth}`,
|
|
16
|
+
'--el-x-bubble-avatar-placeholder-width': `${
|
|
17
|
+
$scopedSlots.avatar || $slots.avatar ? '' : avatarSize + 'px'
|
|
18
|
+
}`,
|
|
19
|
+
'--el-x-bubble-avatar-placeholder-height': `${
|
|
20
|
+
$scopedSlots.avatar || $slots.avatar ? '' : avatarSize + 'px'
|
|
21
|
+
}`,
|
|
22
|
+
'--el-x-bubble-avatar-placeholder-gap': `${avatarGap}px`,
|
|
23
|
+
}"
|
|
24
|
+
>
|
|
25
|
+
<!-- 头像 -->
|
|
26
|
+
<div
|
|
27
|
+
v-if="!($scopedSlots.avatar || $slots.avatar) && avatar"
|
|
28
|
+
class="el-x-bubble-avatar el-x-bubble-avatar-size"
|
|
29
|
+
>
|
|
30
|
+
<el-avatar
|
|
31
|
+
:size="avatarSize"
|
|
32
|
+
:src="avatar"
|
|
33
|
+
:shape="avatarShape"
|
|
34
|
+
:icon="avatarIcon"
|
|
35
|
+
:src-set="avatarSrcSet"
|
|
36
|
+
:alt="avatarAlt"
|
|
37
|
+
@error="avatarError"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
<!-- 头像属性进行占位 -->
|
|
41
|
+
<div
|
|
42
|
+
v-if="!($scopedSlots.avatar || $slots.avatar) && !avatar && avatarSize"
|
|
43
|
+
class="el-x-bubble-avatar-placeholder"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<div
|
|
47
|
+
v-if="$scopedSlots.avatar || $slots.avatar"
|
|
48
|
+
class="el-x-bubble-avatar"
|
|
49
|
+
>
|
|
50
|
+
<slot name="avatar" />
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<!-- 内容 -->
|
|
54
|
+
<div class="el-x-bubble-content-wrapper">
|
|
55
|
+
<!-- 头部内容 -->
|
|
56
|
+
<div
|
|
57
|
+
v-if="$scopedSlots.header || $slots.header"
|
|
58
|
+
class="el-x-bubble-header"
|
|
59
|
+
>
|
|
60
|
+
<slot name="header" />
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div
|
|
64
|
+
class="el-x-bubble-content"
|
|
65
|
+
:class="{
|
|
66
|
+
'el-x-bubble-content-loading': loading,
|
|
67
|
+
'el-x-bubble-content-round': shape === 'round',
|
|
68
|
+
'el-x-bubble-content-corner': shape === 'corner',
|
|
69
|
+
'el-x-bubble-content-filled': variant === 'filled',
|
|
70
|
+
'el-x-bubble-content-borderless': variant === 'borderless',
|
|
71
|
+
'el-x-bubble-content-outlined': variant === 'outlined',
|
|
72
|
+
'el-x-bubble-content-shadow': variant === 'shadow',
|
|
73
|
+
}"
|
|
74
|
+
>
|
|
75
|
+
<div
|
|
76
|
+
v-if="!loading"
|
|
77
|
+
class="el-typewriter"
|
|
78
|
+
:class="{
|
|
79
|
+
'no-content': !content,
|
|
80
|
+
}"
|
|
81
|
+
>
|
|
82
|
+
<el-x-typewriter
|
|
83
|
+
v-if="!($scopedSlots.content || $slots.content) && content"
|
|
84
|
+
ref="typewriterRef"
|
|
85
|
+
:typing="_typing"
|
|
86
|
+
:content="content"
|
|
87
|
+
:is-markdown="isMarkdown"
|
|
88
|
+
:is-fog="isFog"
|
|
89
|
+
@start="onStart"
|
|
90
|
+
@writing="onWriting"
|
|
91
|
+
@finish="onFinish"
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<!-- 内容-自定义 -->
|
|
96
|
+
<slot
|
|
97
|
+
v-if="!internalDestroyed && ($scopedSlots.content || $slots.content) && !loading"
|
|
98
|
+
name="content"
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
<!-- 加载中-默认 -->
|
|
102
|
+
<div
|
|
103
|
+
v-if="loading && !($scopedSlots.loading || $slots.loading)"
|
|
104
|
+
class="el-x-bubble-loading-wrap"
|
|
105
|
+
>
|
|
106
|
+
<div
|
|
107
|
+
v-for="(_, index) in dots"
|
|
108
|
+
:key="index"
|
|
109
|
+
class="dot"
|
|
110
|
+
:style="{ animationDelay: `${index * 0.2}s` }"
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<!-- 加载中-自定义 -->
|
|
115
|
+
<div
|
|
116
|
+
v-if="loading && ($scopedSlots.loading || $slots.loading)"
|
|
117
|
+
class="el-x-bubble-loading-wrap"
|
|
118
|
+
>
|
|
119
|
+
<slot name="loading" />
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div
|
|
124
|
+
v-if="$scopedSlots.footer || $slots.footer"
|
|
125
|
+
class="el-x-bubble-footer"
|
|
126
|
+
>
|
|
127
|
+
<slot name="footer" />
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</template>
|
|
132
|
+
<script>
|
|
133
|
+
import ElXTypewriter from '../../Typewriter/index';
|
|
134
|
+
|
|
135
|
+
export default {
|
|
136
|
+
name: 'ElXBubble',
|
|
137
|
+
components: {
|
|
138
|
+
ElXTypewriter,
|
|
139
|
+
},
|
|
140
|
+
props: {
|
|
141
|
+
content: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: '',
|
|
144
|
+
},
|
|
145
|
+
reasoning_content: {
|
|
146
|
+
type: String,
|
|
147
|
+
default: '',
|
|
148
|
+
},
|
|
149
|
+
avatar: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: '',
|
|
152
|
+
},
|
|
153
|
+
placement: {
|
|
154
|
+
type: String,
|
|
155
|
+
default: 'start',
|
|
156
|
+
},
|
|
157
|
+
variant: {
|
|
158
|
+
type: String,
|
|
159
|
+
default: 'filled',
|
|
160
|
+
},
|
|
161
|
+
maxWidth: {
|
|
162
|
+
type: String,
|
|
163
|
+
default: '500px',
|
|
164
|
+
},
|
|
165
|
+
avatarSize: {
|
|
166
|
+
type: Number,
|
|
167
|
+
default: 0,
|
|
168
|
+
},
|
|
169
|
+
avatarGap: {
|
|
170
|
+
type: Number,
|
|
171
|
+
default: 12,
|
|
172
|
+
},
|
|
173
|
+
avatarShape: {
|
|
174
|
+
type: String,
|
|
175
|
+
default: 'circle',
|
|
176
|
+
},
|
|
177
|
+
avatarIcon: {
|
|
178
|
+
type: String,
|
|
179
|
+
default: '',
|
|
180
|
+
},
|
|
181
|
+
avatarSrcSet: {
|
|
182
|
+
type: String,
|
|
183
|
+
default: '',
|
|
184
|
+
},
|
|
185
|
+
avatarAlt: {
|
|
186
|
+
type: String,
|
|
187
|
+
default: '',
|
|
188
|
+
},
|
|
189
|
+
avatarFit: {
|
|
190
|
+
type: String,
|
|
191
|
+
default: 'cover',
|
|
192
|
+
},
|
|
193
|
+
noStyle: {
|
|
194
|
+
type: Boolean,
|
|
195
|
+
default: false,
|
|
196
|
+
},
|
|
197
|
+
typing: {
|
|
198
|
+
type: [Boolean, Object],
|
|
199
|
+
default: undefined,
|
|
200
|
+
},
|
|
201
|
+
loading: {
|
|
202
|
+
type: Boolean,
|
|
203
|
+
default: false,
|
|
204
|
+
},
|
|
205
|
+
shape: {
|
|
206
|
+
type: String,
|
|
207
|
+
default: '',
|
|
208
|
+
},
|
|
209
|
+
isMarkdown: {
|
|
210
|
+
type: Boolean,
|
|
211
|
+
default: false,
|
|
212
|
+
},
|
|
213
|
+
isFog: {
|
|
214
|
+
type: Boolean,
|
|
215
|
+
default: false,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
data() {
|
|
219
|
+
return {
|
|
220
|
+
internalDestroyed: false,
|
|
221
|
+
isTypingClass: false,
|
|
222
|
+
};
|
|
223
|
+
},
|
|
224
|
+
computed: {
|
|
225
|
+
_step() {
|
|
226
|
+
if (typeof this.typing === 'object' && this.typing.step) return this.typing.step;
|
|
227
|
+
return 2;
|
|
228
|
+
},
|
|
229
|
+
_suffix() {
|
|
230
|
+
if (typeof this.typing === 'object' && this.typing.suffix) return this.typing.suffix;
|
|
231
|
+
return '|';
|
|
232
|
+
},
|
|
233
|
+
_interval() {
|
|
234
|
+
if (typeof this.typing === 'object' && this.typing.interval) return this.typing.interval;
|
|
235
|
+
return 50;
|
|
236
|
+
},
|
|
237
|
+
_typing() {
|
|
238
|
+
if (typeof this.typing === 'undefined') {
|
|
239
|
+
return false;
|
|
240
|
+
} else if (typeof this.typing === 'boolean') {
|
|
241
|
+
return this.typing;
|
|
242
|
+
} else {
|
|
243
|
+
return {
|
|
244
|
+
suffix: this._suffix,
|
|
245
|
+
step: this._step,
|
|
246
|
+
interval: this._interval,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
dots() {
|
|
251
|
+
return [1, 2, 3];
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
watch: {
|
|
255
|
+
content(newVal, oldVal) {
|
|
256
|
+
if (newVal !== oldVal && this.internalDestroyed) {
|
|
257
|
+
this.restart();
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
methods: {
|
|
262
|
+
onStart(instance) {
|
|
263
|
+
this.$emit('start', instance);
|
|
264
|
+
},
|
|
265
|
+
onFinish(instance) {
|
|
266
|
+
this.isTypingClass = false;
|
|
267
|
+
this.$emit('finish', instance);
|
|
268
|
+
},
|
|
269
|
+
onWriting(instance) {
|
|
270
|
+
this.isTypingClass = true;
|
|
271
|
+
this.$emit('writing', instance);
|
|
272
|
+
},
|
|
273
|
+
avatarError(e) {
|
|
274
|
+
this.$emit('avatarError', e);
|
|
275
|
+
},
|
|
276
|
+
interrupt() {
|
|
277
|
+
this.$refs.typewriterRef && this.$refs.typewriterRef.interrupt();
|
|
278
|
+
},
|
|
279
|
+
continueTyping() {
|
|
280
|
+
this.$refs.typewriterRef && this.$refs.typewriterRef.continueTyping();
|
|
281
|
+
},
|
|
282
|
+
restart() {
|
|
283
|
+
this.internalDestroyed = false;
|
|
284
|
+
this.$refs.typewriterRef && this.$refs.typewriterRef.restart();
|
|
285
|
+
},
|
|
286
|
+
destroy() {
|
|
287
|
+
this.$refs.typewriterRef && this.$refs.typewriterRef.destroy();
|
|
288
|
+
this.internalDestroyed = true;
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
beforeDestroy() {
|
|
292
|
+
this.destroy();
|
|
293
|
+
},
|
|
294
|
+
};
|
|
295
|
+
</script>
|
|
296
|
+
|
|
297
|
+
<style lang="scss" scoped>
|
|
298
|
+
@import '../../../styles/Bubble.scss';
|
|
299
|
+
</style>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import ElXBubbleList from './src/main.vue';
|
|
2
|
-
|
|
3
|
-
/* istanbul ignore next */
|
|
4
|
-
ElXBubbleList.install = function (Vue) {
|
|
5
|
-
Vue.component(ElXBubbleList.name, ElXBubbleList);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default ElXBubbleList;
|
|
1
|
+
import ElXBubbleList from './src/main.vue';
|
|
2
|
+
|
|
3
|
+
/* istanbul ignore next */
|
|
4
|
+
ElXBubbleList.install = function (Vue) {
|
|
5
|
+
Vue.component(ElXBubbleList.name, ElXBubbleList);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default ElXBubbleList;
|