@blueking/chat-x 0.0.51-beta.5 → 0.0.52-dev.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/README.md +15 -8
- package/dist/ag-ui/types/contents.d.ts +2 -0
- package/dist/ag-ui/types/messages.d.ts +6 -1
- package/dist/common/constants.d.ts +2 -0
- package/dist/components/ai-buttons/add-menu-btn/add-menu-btn.vue.d.ts +24 -0
- package/dist/components/chat-content/collapsible-content/collapsible-content.vue.d.ts +28 -0
- package/dist/components/chat-content/file-content/upload-file-item.vue.d.ts +5 -2
- package/dist/components/chat-content/file-content/upload-image-item.vue.d.ts +1 -0
- package/dist/components/chat-content/flow-agent-content/use-flow-node-actions.d.ts +1 -1
- package/dist/components/chat-input/ai-slash-input/ai-slash-input.vue.d.ts +21 -10
- package/dist/components/chat-input/ai-slash-input/command.d.ts +6 -3
- package/dist/components/chat-input/ai-slash-input/constants.d.ts +2 -0
- package/dist/components/chat-input/ai-slash-input/use-menu-trigger.d.ts +17 -0
- package/dist/components/chat-input/build-default-placeholder.d.ts +9 -3
- package/dist/components/chat-input/chat-input.vue.d.ts +30 -18
- package/dist/components/chat-input/input-menu/constants.d.ts +60 -0
- package/dist/components/chat-input/input-menu/index.d.ts +4 -0
- package/dist/components/chat-input/input-menu/input-menu-option.vue.d.ts +14 -0
- package/dist/components/chat-input/input-menu/input-menu-panel.vue.d.ts +17 -0
- package/dist/components/chat-input/input-menu/use-input-menu.d.ts +22 -0
- package/dist/components/chat-input/model-selector/types.d.ts +3 -2
- package/dist/components/chat-message/message-container/message-container.vue.d.ts +1 -1
- package/dist/components/chat-message/user-message/user-message.vue.d.ts +1 -1
- package/dist/components/mention/create-mention-tippy.d.ts +27 -0
- package/dist/components/mention/index.d.ts +4 -0
- package/dist/components/{chat-input/ai-slash-input/ai-prompt-list/ai-prompt-list.vue.d.ts → mention/mention-popover.vue.d.ts} +3 -2
- package/dist/components/{chat-input/ai-slash-input/ai-skill-list/ai-skill-list.vue.d.ts → mention/mention-tag.vue.d.ts} +7 -3
- package/dist/components/{chat-input/ai-slash-input/ai-slash-menu/ai-slash-menu.vue.d.ts → mention/mention-text.vue.d.ts} +3 -3
- package/dist/components/resource-icon/index.d.ts +1 -0
- package/dist/components/resource-icon/resource-icon.vue.d.ts +11 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/use-artifact-preview.d.ts +5 -2
- package/dist/composables/use-common.d.ts +0 -9
- package/dist/composables/use-global-config.d.ts +4 -0
- package/dist/composables/use-input-mention.d.ts +13 -0
- package/dist/composables/use-message-group.d.ts +1011 -72
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/input.d.ts +21 -0
- package/dist/icons/menu-item.d.ts +22 -0
- package/dist/index.css +1 -1
- package/dist/index.js +4953 -4429
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +13 -3
- package/dist/mcp/generated/docs/activity-message.md +3 -3
- package/dist/mcp/generated/docs/add-menu-btn.md +91 -0
- package/dist/mcp/generated/docs/ai-slash-input.md +72 -26
- package/dist/mcp/generated/docs/assistant-message.md +7 -1
- package/dist/mcp/generated/docs/chat-container.md +45 -6
- package/dist/mcp/generated/docs/chat-input.md +327 -483
- package/dist/mcp/generated/docs/collapsible-content.md +78 -0
- package/dist/mcp/generated/docs/constants.md +36 -3
- package/dist/mcp/generated/docs/execution-summary.md +1 -23
- package/dist/mcp/generated/docs/file-artifact-panel.md +24 -5
- package/dist/mcp/generated/docs/file-content.md +4 -0
- package/dist/mcp/generated/docs/file-upload-btn.md +15 -12
- package/dist/mcp/generated/docs/flow-agent-content.md +10 -12
- package/dist/mcp/generated/docs/input-menu-panel.md +166 -0
- package/dist/mcp/generated/docs/mention-tag.md +83 -0
- package/dist/mcp/generated/docs/mention-text.md +86 -0
- package/dist/mcp/generated/docs/message-container.md +1 -1
- package/dist/mcp/generated/docs/message-render.md +1 -1
- package/dist/mcp/generated/docs/message-tools.md +15 -4
- package/dist/mcp/generated/docs/messages.md +3 -0
- package/dist/mcp/generated/docs/model-selector.md +4 -2
- package/dist/mcp/generated/docs/overflow-tips.md +3 -3
- package/dist/mcp/generated/docs/resource-icon.md +102 -0
- package/dist/mcp/generated/docs/text-content.md +7 -3
- package/dist/mcp/generated/docs/theme.md +27 -35
- package/dist/mcp/generated/docs/use-artifact-preview.md +7 -3
- package/dist/mcp/generated/docs/use-command-selection.md +1 -1
- package/dist/mcp/generated/docs/use-container-scroll.md +2 -1
- package/dist/mcp/generated/docs/use-flow-node-actions.md +8 -15
- package/dist/mcp/generated/docs/use-global-config.md +11 -4
- package/dist/mcp/generated/docs/use-input-mention.md +119 -0
- package/dist/mcp/generated/docs/use-menu-keydown.md +15 -16
- package/dist/mcp/generated/docs/use-message-group.md +3 -6
- package/dist/mcp/generated/docs/user-message.md +39 -17
- package/dist/mcp/generated/index.json +233 -81
- package/dist/types/editor.d.ts +0 -29
- package/dist/types/index.d.ts +1 -0
- package/dist/types/input-menu.d.ts +46 -0
- package/dist/utils/artifact-tags.d.ts +36 -0
- package/dist/utils/collect-message-artifacts.d.ts +14 -0
- package/dist/utils/file.d.ts +3 -3
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/upload-file.d.ts +6 -1
- package/package.json +3 -2
- package/skills/blueking-chat-x/SKILL.md +143 -0
- package/skills/blueking-chat-x/references/_index.md +153 -0
- package/skills/blueking-chat-x/references/components/activity-layout.md +134 -0
- package/skills/blueking-chat-x/references/components/activity-message.md +486 -0
- package/skills/blueking-chat-x/references/components/add-menu-btn.md +88 -0
- package/skills/blueking-chat-x/references/components/ai-image.md +230 -0
- package/skills/blueking-chat-x/references/components/ai-loading.md +131 -0
- package/skills/blueking-chat-x/references/components/ai-selection.md +439 -0
- package/skills/blueking-chat-x/references/components/ai-slash-input.md +102 -0
- package/skills/blueking-chat-x/references/components/animation-text.md +202 -0
- package/skills/blueking-chat-x/references/components/assistant-message.md +504 -0
- package/skills/blueking-chat-x/references/components/chat-container.md +912 -0
- package/skills/blueking-chat-x/references/components/chat-input.md +614 -0
- package/skills/blueking-chat-x/references/components/cite-content.md +142 -0
- package/skills/blueking-chat-x/references/components/code-content.md +211 -0
- package/skills/blueking-chat-x/references/components/collapsible-content.md +76 -0
- package/skills/blueking-chat-x/references/components/common-error-content.md +73 -0
- package/skills/blueking-chat-x/references/components/content-render.md +233 -0
- package/skills/blueking-chat-x/references/components/delete-tool.md +191 -0
- package/skills/blueking-chat-x/references/components/desc-panel.md +162 -0
- package/skills/blueking-chat-x/references/components/detail-section.md +91 -0
- package/skills/blueking-chat-x/references/components/execution-summary.md +150 -0
- package/skills/blueking-chat-x/references/components/file-artifact-panel.md +307 -0
- package/skills/blueking-chat-x/references/components/file-content.md +340 -0
- package/skills/blueking-chat-x/references/components/file-icon.md +109 -0
- package/skills/blueking-chat-x/references/components/file-upload-btn.md +162 -0
- package/skills/blueking-chat-x/references/components/flow-agent-content.md +266 -0
- package/skills/blueking-chat-x/references/components/flow-agent-node-detail.md +236 -0
- package/skills/blueking-chat-x/references/components/highlight-keyword.md +146 -0
- package/skills/blueking-chat-x/references/components/image-content.md +182 -0
- package/skills/blueking-chat-x/references/components/image-preview-group.md +184 -0
- package/skills/blueking-chat-x/references/components/image-preview.md +226 -0
- package/skills/blueking-chat-x/references/components/info-message.md +144 -0
- package/skills/blueking-chat-x/references/components/input-attachment.md +49 -0
- package/skills/blueking-chat-x/references/components/input-info-alert.md +42 -0
- package/skills/blueking-chat-x/references/components/input-menu-panel.md +162 -0
- package/skills/blueking-chat-x/references/components/interrupt-message.md +212 -0
- package/skills/blueking-chat-x/references/components/key-value-content.md +128 -0
- package/skills/blueking-chat-x/references/components/knowledge-rag-content.md +122 -0
- package/skills/blueking-chat-x/references/components/latex-content.md +200 -0
- package/skills/blueking-chat-x/references/components/loading-message.md +192 -0
- package/skills/blueking-chat-x/references/components/markdown-content.md +232 -0
- package/skills/blueking-chat-x/references/components/mention-tag.md +79 -0
- package/skills/blueking-chat-x/references/components/mention-text.md +83 -0
- package/skills/blueking-chat-x/references/components/mermaid-content.md +189 -0
- package/skills/blueking-chat-x/references/components/message-container.md +645 -0
- package/skills/blueking-chat-x/references/components/message-loading.md +118 -0
- package/skills/blueking-chat-x/references/components/message-render.md +327 -0
- package/skills/blueking-chat-x/references/components/message-time.md +177 -0
- package/skills/blueking-chat-x/references/components/message-tools.md +427 -0
- package/skills/blueking-chat-x/references/components/model-selector.md +157 -0
- package/skills/blueking-chat-x/references/components/preview-toolbar.md +42 -0
- package/skills/blueking-chat-x/references/components/questions-container.md +85 -0
- package/skills/blueking-chat-x/references/components/reasoning-message.md +232 -0
- package/skills/blueking-chat-x/references/components/reference-content.md +135 -0
- package/skills/blueking-chat-x/references/components/reference-doc-content.md +109 -0
- package/skills/blueking-chat-x/references/components/resource-icon.md +98 -0
- package/skills/blueking-chat-x/references/components/scroll-btn.md +159 -0
- package/skills/blueking-chat-x/references/components/selection-footer.md +78 -0
- package/skills/blueking-chat-x/references/components/selection-question.md +88 -0
- package/skills/blueking-chat-x/references/components/shortcut-btn.md +204 -0
- package/skills/blueking-chat-x/references/components/shortcut-btns.md +266 -0
- package/skills/blueking-chat-x/references/components/shortcut-render.md +424 -0
- package/skills/blueking-chat-x/references/components/simple-table.md +101 -0
- package/skills/blueking-chat-x/references/components/text-content.md +80 -0
- package/skills/blueking-chat-x/references/components/tool-approval-card.md +183 -0
- package/skills/blueking-chat-x/references/components/tool-btn.md +317 -0
- package/skills/blueking-chat-x/references/components/tool-message.md +235 -0
- package/skills/blueking-chat-x/references/components/toolcall-render.md +348 -0
- package/skills/blueking-chat-x/references/components/user-feedback.md +233 -0
- package/skills/blueking-chat-x/references/components/user-message.md +444 -0
- package/skills/blueking-chat-x/references/components/user-question-answered-card.md +104 -0
- package/skills/blueking-chat-x/references/components/user-question-card.md +231 -0
- package/skills/blueking-chat-x/references/components/user-question-choice.md +105 -0
- package/skills/blueking-chat-x/references/components/user-question-option.md +42 -0
- package/skills/blueking-chat-x/references/components/vnode-renderer.md +122 -0
- package/skills/blueking-chat-x/references/composables/use-animation-text.md +196 -0
- package/skills/blueking-chat-x/references/composables/use-artifact-preview.md +235 -0
- package/skills/blueking-chat-x/references/composables/use-clipboard.md +203 -0
- package/skills/blueking-chat-x/references/composables/use-command-selection.md +150 -0
- package/skills/blueking-chat-x/references/composables/use-container-scroll.md +57 -0
- package/skills/blueking-chat-x/references/composables/use-custom-tab.md +158 -0
- package/skills/blueking-chat-x/references/composables/use-flow-node-actions.md +164 -0
- package/skills/blueking-chat-x/references/composables/use-full-screen.md +112 -0
- package/skills/blueking-chat-x/references/composables/use-global-config.md +155 -0
- package/skills/blueking-chat-x/references/composables/use-input-mention.md +115 -0
- package/skills/blueking-chat-x/references/composables/use-menu-keydown.md +161 -0
- package/skills/blueking-chat-x/references/composables/use-message-group.md +244 -0
- package/skills/blueking-chat-x/references/composables/use-observer-visible-list.md +188 -0
- package/skills/blueking-chat-x/references/composables/use-parent-scrolling.md +46 -0
- package/skills/blueking-chat-x/references/directives/index.md +61 -0
- package/skills/blueking-chat-x/references/directives/overflow-tips.md +205 -0
- package/skills/blueking-chat-x/references/icons/index.md +185 -0
- package/skills/blueking-chat-x/references/plugins/index.md +56 -0
- package/skills/blueking-chat-x/references/plugins/markdown-container.md +55 -0
- package/skills/blueking-chat-x/references/plugins/markdown-latex.md +205 -0
- package/skills/blueking-chat-x/references/plugins/markdown-mermaid.md +247 -0
- package/skills/blueking-chat-x/references/theme/theme.md +423 -0
- package/skills/blueking-chat-x/references/types/constants.md +340 -0
- package/skills/blueking-chat-x/references/types/index.md +120 -0
- package/skills/blueking-chat-x/references/types/interrupt.md +379 -0
- package/skills/blueking-chat-x/references/types/messages.md +556 -0
- package/skills/blueking-chat-x/references/types/schema.md +91 -0
- package/skills/blueking-chat-x/references/utils/index.md +196 -0
- package/skills/blueking-chat-x/scripts/generate-references.mjs +536 -0
- package/dist/components/chat-input/ai-slash-editor/ai-slash-editor.vue.d.ts +0 -28
- package/dist/components/chat-input/ai-slash-editor/theme.d.ts +0 -24
- package/dist/mcp/generated/docs/ai-prompt-list.md +0 -45
- package/dist/mcp/generated/docs/ai-skill-list.md +0 -75
- package/dist/mcp/generated/docs/ai-slash-editor.md +0 -43
- package/dist/mcp/generated/docs/ai-slash-menu.md +0 -42
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# AiImage 图片展示
|
|
2
|
+
|
|
3
|
+
> 能力域:媒体文件 | 导入:`import { AiImage } from '@blueking/chat-x'` | since 1.0.0
|
|
4
|
+
|
|
5
|
+
图片展示组件,组合加载、错误、预览和 extra 插槽。 源码位置:src/components/image-preview/image.vue。
|
|
6
|
+
|
|
7
|
+
**关联**:image-preview(独立模式下内嵌全屏预览,单图预览入口)、image-preview-group(组内注册子图并统一打开多图预览)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# AiImage 图片展示
|
|
12
|
+
## 源码事实
|
|
13
|
+
|
|
14
|
+
- **源码位置**:`src/components/image-preview/image.vue`
|
|
15
|
+
- **能力域**:媒体文件
|
|
16
|
+
- **能力说明**:图片展示组件,组合加载、错误、预览和 extra 插槽。
|
|
17
|
+
|
|
18
|
+
> **能力域**:媒体文件
|
|
19
|
+
|
|
20
|
+
图片展示组件,支持加载状态、加载失败重试、懒加载、点击预览等功能。可独立使用(单图预览),也可配合 `ImagePreviewGroup` 实现多图预览。
|
|
21
|
+
|
|
22
|
+
## 组件结构
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
.ai-image(display: inline-block,border-radius: 4px)
|
|
26
|
+
├── <img>(v-if status !== 'error' && actualSrc,object-fit: cover)
|
|
27
|
+
├── .ai-image-error(v-if status === 'error')
|
|
28
|
+
│ └── ImageErrorIcon(24×24,color: #c4c6cc)
|
|
29
|
+
├── .ai-image-error-overlay(v-if status === 'error',hover 时显示)
|
|
30
|
+
│ ├── ReloadIcon(16×16)
|
|
31
|
+
│ └── <span>"重新加载"</span>
|
|
32
|
+
├── <slot />
|
|
33
|
+
└── ImagePreview(v-if !groupContext && preview && previewVisible)
|
|
34
|
+
独立模式下的内置全屏预览
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 基础用法
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<template>
|
|
41
|
+
<AiImage
|
|
42
|
+
src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?w=400&h=300&fit=crop"
|
|
43
|
+
:width="200"
|
|
44
|
+
:height="150"
|
|
45
|
+
alt="风景图"
|
|
46
|
+
@load="handleLoad"
|
|
47
|
+
@error="handleError"
|
|
48
|
+
@preview="handlePreview"
|
|
49
|
+
/>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup lang="ts">
|
|
53
|
+
import { AiImage } from '@blueking/chat-x';
|
|
54
|
+
|
|
55
|
+
const handleLoad = (ev: Event) => {
|
|
56
|
+
console.log('图片加载成功', ev);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleError = (ev: Event) => {
|
|
60
|
+
console.log('图片加载失败', ev);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const handlePreview = () => {
|
|
64
|
+
console.log('触发预览');
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 加载失败与重新加载
|
|
70
|
+
|
|
71
|
+
当图片加载失败时,显示错误占位图标,鼠标悬停后出现"重新加载"遮罩,点击可重新加载(内部通过追加时间戳参数实现缓存破坏):
|
|
72
|
+
|
|
73
|
+
```vue
|
|
74
|
+
<template>
|
|
75
|
+
<AiImage
|
|
76
|
+
src="https://invalid-url.example.com/not-exist.png"
|
|
77
|
+
:width="200"
|
|
78
|
+
:height="150"
|
|
79
|
+
/>
|
|
80
|
+
</template>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 禁用预览
|
|
84
|
+
|
|
85
|
+
将 `preview` 设为 `false` 可禁用点击预览功能,此时图片不显示 `zoom-in` 光标:
|
|
86
|
+
|
|
87
|
+
```vue
|
|
88
|
+
<template>
|
|
89
|
+
<AiImage
|
|
90
|
+
src="https://images.unsplash.com/photo-1469474968028-56623f02e42e?w=400&h=300&fit=crop"
|
|
91
|
+
:width="200"
|
|
92
|
+
:height="150"
|
|
93
|
+
:preview="false"
|
|
94
|
+
/>
|
|
95
|
+
</template>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 预览属性配置
|
|
99
|
+
|
|
100
|
+
通过 `previewProps` 可为预览弹窗配置不同的图片源(如高清原图)、名称、尺寸信息等:
|
|
101
|
+
|
|
102
|
+
```vue
|
|
103
|
+
<template>
|
|
104
|
+
<AiImage
|
|
105
|
+
src="https://images.unsplash.com/photo-1447752875215-b2761acb3c5d?w=400&h=300&fit=crop"
|
|
106
|
+
:width="200"
|
|
107
|
+
:height="150"
|
|
108
|
+
:preview-props="{
|
|
109
|
+
src: 'https://images.unsplash.com/photo-1447752875215-b2761acb3c5d?w=1920',
|
|
110
|
+
name: '森林.jpg',
|
|
111
|
+
width: 1920,
|
|
112
|
+
resolution: '1920×1080',
|
|
113
|
+
}"
|
|
114
|
+
:show-info="true"
|
|
115
|
+
/>
|
|
116
|
+
</template>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## 多图预览(配合 ImagePreviewGroup)
|
|
120
|
+
|
|
121
|
+
将多个 `AiImage` 放在 `ImagePreviewGroup` 中,点击任意图片会打开多图预览模式,支持左右切换:
|
|
122
|
+
|
|
123
|
+
```vue
|
|
124
|
+
<template>
|
|
125
|
+
<ImagePreviewGroup>
|
|
126
|
+
<AiImage
|
|
127
|
+
v-for="(src, i) in images"
|
|
128
|
+
:key="i"
|
|
129
|
+
:src="src"
|
|
130
|
+
:width="160"
|
|
131
|
+
:height="120"
|
|
132
|
+
/>
|
|
133
|
+
</ImagePreviewGroup>
|
|
134
|
+
</template>
|
|
135
|
+
|
|
136
|
+
<script setup lang="ts">
|
|
137
|
+
import { AiImage, ImagePreviewGroup } from '@blueking/chat-x';
|
|
138
|
+
|
|
139
|
+
const images = [
|
|
140
|
+
'https://images.unsplash.com/photo-1506744038136-46273834b3fb?w=400&h=300&fit=crop',
|
|
141
|
+
'https://images.unsplash.com/photo-1469474968028-56623f02e42e?w=400&h=300&fit=crop',
|
|
142
|
+
'https://images.unsplash.com/photo-1447752875215-b2761acb3c5d?w=400&h=300&fit=crop',
|
|
143
|
+
];
|
|
144
|
+
</script>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## 自定义下载
|
|
148
|
+
|
|
149
|
+
通过 `onDownload` 自定义下载行为(例如调用后端接口),不传时使用默认的 `<a>` 标签下载:
|
|
150
|
+
|
|
151
|
+
```vue
|
|
152
|
+
<template>
|
|
153
|
+
<AiImage
|
|
154
|
+
src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?w=400&h=300&fit=crop"
|
|
155
|
+
:width="200"
|
|
156
|
+
:height="150"
|
|
157
|
+
:on-download="handleDownload"
|
|
158
|
+
/>
|
|
159
|
+
</template>
|
|
160
|
+
|
|
161
|
+
<script setup lang="ts">
|
|
162
|
+
import { AiImage } from '@blueking/chat-x';
|
|
163
|
+
|
|
164
|
+
const handleDownload = (url: string) => {
|
|
165
|
+
console.log('自定义下载:', url);
|
|
166
|
+
};
|
|
167
|
+
</script>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## API
|
|
171
|
+
|
|
172
|
+
### Props
|
|
173
|
+
|
|
174
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
175
|
+
| ------------ | ----------------------- | ------- | --------------------------------------------------------------- |
|
|
176
|
+
| src | `string` | — | **必填**,图片地址 |
|
|
177
|
+
| alt | `string` | `''` | 图片 alt 属性 |
|
|
178
|
+
| width | `number \| string` | — | 容器宽度,数字时单位为 px |
|
|
179
|
+
| height | `number \| string` | — | 容器高度,数字时单位为 px |
|
|
180
|
+
| lazy | `boolean` | `false` | 是否懒加载(IntersectionObserver,rootMargin: 200px) |
|
|
181
|
+
| preview | `boolean` | `true` | 是否启用点击预览;为 `true` 且图片加载成功时显示 `zoom-in` 光标 |
|
|
182
|
+
| previewProps | `ImagePreviewConfig` | — | 预览弹窗配置(可指定高清源、名称、尺寸等) |
|
|
183
|
+
| showInfo | `boolean` | `false` | 预览工具栏是否显示图片尺寸信息 |
|
|
184
|
+
| onDownload | `(url: string) => void` | — | 自定义下载回调;不传时使用默认 `<a>` 标签下载 |
|
|
185
|
+
|
|
186
|
+
### Events
|
|
187
|
+
|
|
188
|
+
| 事件名 | 参数 | 说明 |
|
|
189
|
+
| ------- | ------------- | ------------------ |
|
|
190
|
+
| load | `(ev: Event)` | 图片加载成功时触发 |
|
|
191
|
+
| error | `(ev: Event)` | 图片加载失败时触发 |
|
|
192
|
+
| preview | — | 点击触发预览时触发 |
|
|
193
|
+
|
|
194
|
+
### Slots
|
|
195
|
+
|
|
196
|
+
| 插槽名 | 说明 |
|
|
197
|
+
| ------- | ----------------------------------------------- |
|
|
198
|
+
| default | 覆盖在图片上方的自定义内容 |
|
|
199
|
+
| extra | 预览工具栏的额外操作区域(透传给 ImagePreview) |
|
|
200
|
+
|
|
201
|
+
### Expose
|
|
202
|
+
|
|
203
|
+
| 属性名 | 类型 | 说明 |
|
|
204
|
+
| -------------- | -------------- | -------------------------------- |
|
|
205
|
+
| previewVisible | `Ref<boolean>` | 当前预览弹窗是否可见(独立模式) |
|
|
206
|
+
|
|
207
|
+
## 类型定义
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
interface ImagePreviewConfig {
|
|
211
|
+
src?: string;
|
|
212
|
+
name?: string;
|
|
213
|
+
width?: number;
|
|
214
|
+
height?: number;
|
|
215
|
+
resolution?: string;
|
|
216
|
+
downloadUrl?: string;
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## 使用场景
|
|
221
|
+
|
|
222
|
+
- AI 对话中的图片消息展示
|
|
223
|
+
- 需要点击放大查看的缩略图
|
|
224
|
+
- 多图浏览场景(配合 `ImagePreviewGroup`)
|
|
225
|
+
- 懒加载长列表中的图片
|
|
226
|
+
|
|
227
|
+
## 关联组件
|
|
228
|
+
|
|
229
|
+
- [ImagePreview](/components/medias/image-preview) — 独立模式下的全屏预览
|
|
230
|
+
- [ImagePreviewGroup](/components/medias/image-preview-group) — 多图注册与预览上下文
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# AiLoading 三点加载
|
|
2
|
+
|
|
3
|
+
> 能力域:辅助能力 | 导入:`import { AiLoading } from '@blueking/chat-x'` | since 1.0.0
|
|
4
|
+
|
|
5
|
+
小尺寸 AI 加载动效。 源码位置:src/components/ai-loading/ai-loading.vue。
|
|
6
|
+
|
|
7
|
+
**关联**:loading-message(列表末尾加载占位)、reasoning-message(推理进行中的加载指示)、activity-message(活动消息加载态指示)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# AiLoading AI 加载动画
|
|
12
|
+
## 源码事实
|
|
13
|
+
|
|
14
|
+
- **源码位置**:`src/components/ai-loading/ai-loading.vue`
|
|
15
|
+
- **能力域**:辅助能力
|
|
16
|
+
- **能力说明**:小尺寸 AI 加载动效。
|
|
17
|
+
|
|
18
|
+
> **能力域**:辅助能力
|
|
19
|
+
|
|
20
|
+
AI 加载动画基础组件。由两层 SVG 叠加构成:外层旋转光环(带渐变弧线)+ 内层脉冲星形图标,两者共用同一套蓝→紫→粉渐变色。
|
|
21
|
+
|
|
22
|
+
## 组件结构
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
.ai-loading(inline-flex,position: relative,width/height 由 size prop 控制)
|
|
26
|
+
│ CSS 同时定义 width/height: 1em 兜底,inline style 优先
|
|
27
|
+
│
|
|
28
|
+
├── .ai-loading-ring(position: absolute,svg 100%×100%)
|
|
29
|
+
│ 旋转弧线:ai-loading-rotate 0.8s linear infinite
|
|
30
|
+
│ 渐变:#235DFA → #8A77EC → #EB8CEC(蓝 → 紫 → 粉)
|
|
31
|
+
│
|
|
32
|
+
└── .ai-loading-star(position: absolute,svg 100%×100%)
|
|
33
|
+
脉冲星形:ai-loading-pulse 0.8s ease-in-out infinite
|
|
34
|
+
关键帧:scale(0.5) → scale(1) → scale(0.5)(小→大→小)
|
|
35
|
+
渐变:同上
|
|
36
|
+
|
|
37
|
+
stopLoading=true → 根元素加 .ai-loading-stopped
|
|
38
|
+
→ .ai-loading-stopped .ai-loading-ring { animation-play-state: paused }
|
|
39
|
+
→ .ai-loading-stopped .ai-loading-star { animation-play-state: paused }
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 基础用法
|
|
43
|
+
|
|
44
|
+
```vue
|
|
45
|
+
<template>
|
|
46
|
+
<AiLoading />
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup lang="ts">
|
|
50
|
+
import { AiLoading } from '@blueking/chat-x';
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 自定义尺寸
|
|
55
|
+
|
|
56
|
+
通过 `size` 属性控制图标大小(单位 px),默认 `16`:
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<template>
|
|
60
|
+
<AiLoading />
|
|
61
|
+
<!-- 16px(默认) -->
|
|
62
|
+
<AiLoading :size="24" />
|
|
63
|
+
<AiLoading :size="32" />
|
|
64
|
+
<AiLoading :size="48" />
|
|
65
|
+
</template>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 暂停动画
|
|
69
|
+
|
|
70
|
+
`stopLoading` 为 `true` 时,组件根元素添加 `.ai-loading-stopped` class,两层动画同时进入 `paused` 状态(不移除元素,仅冻结帧):
|
|
71
|
+
|
|
72
|
+
```vue
|
|
73
|
+
<template>
|
|
74
|
+
<AiLoading :stop-loading="isPaused" />
|
|
75
|
+
<button @click="isPaused = !isPaused">
|
|
76
|
+
{{ isPaused ? '恢复' : '暂停' }}
|
|
77
|
+
</button>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<script setup lang="ts">
|
|
81
|
+
import { ref } from 'vue';
|
|
82
|
+
import { AiLoading } from '@blueking/chat-x';
|
|
83
|
+
|
|
84
|
+
const isPaused = ref(false);
|
|
85
|
+
</script>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 多实例渐变隔离
|
|
89
|
+
|
|
90
|
+
每个 `AiLoading` 实例通过**模块级 `uid` 计数器**生成唯一的 SVG 渐变 ID:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
ai-loading-ring-{instanceId}
|
|
94
|
+
ai-loading-star-{instanceId}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
同一页面挂载多个实例时,渐变互不影响。ring 和 star 的 `instanceId` 始终相同(同一组件内),SVG `<path fill="url(#...)" />` 正确引用各自实例的渐变定义。
|
|
98
|
+
|
|
99
|
+
## 动画规格
|
|
100
|
+
|
|
101
|
+
| 层 | 动画名 | 时长 | 缓动 | 关键帧 |
|
|
102
|
+
| ------------------ | ------------------- | ---- | ----------- | --------------------------------------- |
|
|
103
|
+
| `.ai-loading-ring` | `ai-loading-rotate` | 0.8s | linear | `0deg → 360deg` 匀速旋转 |
|
|
104
|
+
| `.ai-loading-star` | `ai-loading-pulse` | 0.8s | ease-in-out | `0%/100%: scale(0.5)` → `50%: scale(1)` |
|
|
105
|
+
|
|
106
|
+
脉冲动画节奏:以**半尺寸**起始 → 膨胀至**全尺寸**(0.4s)→ 收缩回**半尺寸**(0.4s),循环往复。
|
|
107
|
+
|
|
108
|
+
## API
|
|
109
|
+
|
|
110
|
+
### Props
|
|
111
|
+
|
|
112
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
113
|
+
| ----------- | --------- | ------- | -------------------------------------------------- |
|
|
114
|
+
| size | `number` | `16` | 图标尺寸(px),应用为 inline style,覆盖 CSS 默认 |
|
|
115
|
+
| stopLoading | `boolean` | `false` | `true` 时两层动画均 `paused`,图标停在当前帧 |
|
|
116
|
+
|
|
117
|
+
## 使用场景
|
|
118
|
+
|
|
119
|
+
组件库内部以下场景自动使用 `AiLoading`:
|
|
120
|
+
|
|
121
|
+
| 使用方 | 触发时机 | 固定尺寸 |
|
|
122
|
+
| ------------------ | ---------------------------------------------- | --------- |
|
|
123
|
+
| `LoadingMessage` | 等待 AI 首次响应(loading 消息占位) | 18px |
|
|
124
|
+
| `ReasoningMessage` | `status` 为 `pending`/`streaming` 时(思考中) | 默认 16px |
|
|
125
|
+
| `ActivityMessage` | 活动消息加载状态 | 默认 16px |
|
|
126
|
+
|
|
127
|
+
## 关联组件
|
|
128
|
+
|
|
129
|
+
- [LoadingMessage](/components/message/loading-message) — 对话加载消息
|
|
130
|
+
- [ReasoningMessage](/components/message/reasoning-message) — 推理加载态
|
|
131
|
+
- [ActivityMessage](/components/message/activity-message) — 活动加载态
|