feat: 引入antdesignxvue

This commit is contained in:
2026-09-19 00:54:06 +08:00
parent bc73668737
commit ffb9f2ca90
10 changed files with 358 additions and 103 deletions
+4 -1
View File
@@ -11,6 +11,7 @@ from application.session_service import SessionService
from config.settings import Settings from config.settings import Settings
from domain.models import Actor, ChatMessage, MessageRole from domain.models import Actor, ChatMessage, MessageRole
from domain.ports import ChatStreamer, MessageRepository, SessionRepository from domain.ports import ChatStreamer, MessageRepository, SessionRepository
from infrastructure.builtin_tools import builtin_tools
from infrastructure.mcp_client import load_mcp_tools from infrastructure.mcp_client import load_mcp_tools
@@ -55,9 +56,11 @@ class ChatService:
actor, thread_id=thread_id, text=text actor, thread_id=thread_id, text=text
) )
memory_lines = await self._memory.lines_for_prompt(actor) memory_lines = await self._memory.lines_for_prompt(actor)
tools = await load_mcp_tools( mcp_tools = await load_mcp_tools(
self._settings, company_id=actor.company_id, user_id=actor.user_id self._settings, company_id=actor.company_id, user_id=actor.user_id
) )
# 本地时间工具始终挂上,不依赖 MCP 是否可用
tools = [*builtin_tools(), *mcp_tools]
history = await self._messages.list_recent( history = await self._messages.list_recent(
actor.company_id, actor.company_id,
@@ -0,0 +1,47 @@
"""本地工具:不依赖 MCP / 业务库,只提供模型无法自行得知的环境信息。"""
from __future__ import annotations
import json
from datetime import date, datetime, timedelta
from zoneinfo import ZoneInfo
from langchain_core.tools import BaseTool, tool
# 与后端业务库、BI 日期口径一致
_TZ = ZoneInfo("Asia/Shanghai")
_WEEKDAYS = ("周一", "周二", "周三", "周四", "周五", "周六", "周日")
def builtin_tools() -> list[BaseTool]:
return [get_current_time]
@tool
def get_current_time() -> str:
"""获取当前业务时间(Asia/Shanghai)。
用户说近 N 天、昨天、本周、本月等相对日期时必须先调用本工具,
用返回的 ranges 或 today 换算 yyyy-MM-dd 后再查经营数据,不要向用户索要日期。
近 N 天含今天,共 N 个自然日。
"""
now = datetime.now(_TZ)
today = now.date()
payload = {
"timezone": "Asia/Shanghai",
"now": now.isoformat(timespec="seconds"),
"today": today.isoformat(),
"weekday": _WEEKDAYS[today.weekday()],
"ranges": {
"yesterday": _span(today - timedelta(days=1), today - timedelta(days=1)),
"last_7_days": _span(today - timedelta(days=6), today),
"last_30_days": _span(today - timedelta(days=29), today),
"this_week": _span(today - timedelta(days=today.weekday()), today),
"this_month": _span(today.replace(day=1), today),
},
}
return json.dumps(payload, ensure_ascii=False)
def _span(start: date, end: date) -> dict[str, str]:
return {"startDate": start.isoformat(), "endDate": end.isoformat()}
+4 -1
View File
@@ -13,7 +13,10 @@ from domain.ports import ChatStreamer
_BASE_SYSTEM = ( _BASE_SYSTEM = (
"你是电商 DMB 系统的经营助手。回答简洁、可执行。" "你是电商 DMB 系统的经营助手。回答简洁、可执行。"
"需要经营数据时优先调用可用工具;缺少参数时向用户确认。" "需要经营数据时优先调用可用工具。"
"用户说近 N 天、昨天、本周、本月等相对日期时,先调用 get_current_time,"
"用返回的 ranges 或 today 换算 yyyy-MM-dd 后再查数,不要向用户索要日期范围。"
"仅当缺少店铺、商品等业务标识时才向用户确认。"
"若工具失败或无权限,请说明原因并给出可操作建议。" "若工具失败或无权限,请说明原因并给出可操作建议。"
) )
@@ -77,8 +77,10 @@ public class UserMenuServiceImpl implements UserMenuService {
List<MenuVO> menus; List<MenuVO> menus;
if (isSuper) { if (isSuper) {
// 超级管理员获取所有系统菜单,不需要公司上下文 // 超管:全部菜单中仅启用项进入动态路由(与 getMenusForRoute 一致,避免已下线 component 报错)
menus = menuService.getAllMenus(); menus = menuService.getAllMenus().stream()
.filter(menu -> Integer.valueOf(1).equals(menu.getStatus()))
.collect(Collectors.toList());
} else { } else {
// 普通用户,根据公司成员角色判断 // 普通用户,根据公司成员角色判断
Long companyIdForUser = currentUserContext.getCurrentCompanyId(); Long companyIdForUser = currentUserContext.getCurrentCompanyId();
+1
View File
@@ -42,6 +42,7 @@
"@vben/utils": "workspace:*", "@vben/utils": "workspace:*",
"@vueuse/core": "catalog:", "@vueuse/core": "catalog:",
"ant-design-vue": "catalog:", "ant-design-vue": "catalog:",
"ant-design-x-vue": "^1.6.0",
"dayjs": "catalog:", "dayjs": "catalog:",
"dompurify": "^3.4.15", "dompurify": "^3.4.15",
"marked": "^18.0.13", "marked": "^18.0.13",
+48 -1
View File
@@ -1,6 +1,7 @@
import type { import type {
ComponentRecordType, ComponentRecordType,
GenerateMenuAndRoutesOptions, GenerateMenuAndRoutesOptions,
RouteRecordStringComponent,
} from '@vben/types'; } from '@vben/types';
import { generateAccessible } from '@vben/access'; import { generateAccessible } from '@vben/access';
@@ -14,6 +15,52 @@ import { $t } from '#/locales';
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue'); const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
/** 将 glob key 规范成与后端 component 一致的 /xxx/index.vue */
function normalizePageKey(path: string): string {
const normalized = path.replace(/^(\.\/|\.\.\/)+/, '');
const withSlash = normalized.startsWith('/') ? normalized : `/${normalized}`;
const viewPath = withSlash.replace(/^\/views/, '');
return viewPath.endsWith('.vue') ? viewPath : `${viewPath}.vue`;
}
/**
* 过滤掉本地不存在的页面组件(已下线菜单仍下发时避免 console.error)。
* layout / iframe 名称保留。
*/
function filterMissingPageRoutes(
routes: RouteRecordStringComponent[],
pageMap: ComponentRecordType,
layoutMap: ComponentRecordType,
): RouteRecordStringComponent[] {
const knownPages = new Set(
Object.keys(pageMap).map((k) => normalizePageKey(k)),
);
const walk = (
nodes: RouteRecordStringComponent[],
): RouteRecordStringComponent[] => {
const result: RouteRecordStringComponent[] = [];
for (const node of nodes) {
const children = node.children?.length
? walk(node.children as RouteRecordStringComponent[])
: undefined;
const component = node.component;
if (!component || layoutMap[component]) {
result.push(children ? { ...node, children } : node);
continue;
}
const pageKey = normalizePageKey(component);
if (!knownPages.has(pageKey)) {
continue;
}
result.push(children ? { ...node, children } : node);
}
return result;
};
return walk(routes);
}
async function generateAccess(options: GenerateMenuAndRoutesOptions) { async function generateAccess(options: GenerateMenuAndRoutesOptions) {
const pageMap: ComponentRecordType = import.meta.glob('../views/**/*.vue'); const pageMap: ComponentRecordType = import.meta.glob('../views/**/*.vue');
@@ -31,7 +78,7 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
}); });
try { try {
const routes = await getUserMenuApi(); const routes = await getUserMenuApi();
return routes; return filterMissingPageRoutes(routes || [], pageMap, layoutMap);
} catch (error) { } catch (error) {
console.error('❌ 获取用户菜单路由失败:', error); console.error('❌ 获取用户菜单路由失败:', error);
throw error; throw error;
@@ -1,7 +1,19 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'; import type {
BubbleListProps,
BubbleProps,
Conversation,
} from 'ant-design-x-vue';
import { computed, h, nextTick, onBeforeUnmount, ref, watch } from 'vue';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import {
PlusOutlined,
RobotOutlined,
SettingOutlined,
UserOutlined,
} from '@ant-design/icons-vue';
import { import {
Button, Button,
@@ -11,9 +23,10 @@ import {
Input, Input,
InputPassword, InputPassword,
Modal, Modal,
Textarea, Spin,
message, message,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { BubbleList, Conversations, Sender } from 'ant-design-x-vue';
import { import {
createAgentSessionApi, createAgentSessionApi,
@@ -23,8 +36,8 @@ import {
listAgentMessagesApi, listAgentMessagesApi,
listAgentSessionsApi, listAgentSessionsApi,
streamAgentChat, streamAgentChat,
updateAgentLlmSettingsApi,
type AgentVO, type AgentVO,
updateAgentLlmSettingsApi,
} from '#/api/agent'; } from '#/api/agent';
import { renderAgentMarkdown } from './markdown'; import { renderAgentMarkdown } from './markdown';
@@ -37,7 +50,7 @@ const sending = ref(false);
const sessions = ref<AgentVO.Session[]>([]); const sessions = ref<AgentVO.Session[]>([]);
const activeThreadId = ref<string | null>(null); const activeThreadId = ref<string | null>(null);
const messages = ref<AgentVO.Message[]>([]); const messages = ref<AgentVO.Message[]>([]);
/** 当前流式助手正文(与 messages 末条同步,避免列表被 loading 遮挡时丢更新) */ /** 当前流式助手正文(与 messages 末条同步) */
const streamingText = ref(''); const streamingText = ref('');
const draft = ref(''); const draft = ref('');
const settingsOpen = ref(false); const settingsOpen = ref(false);
@@ -50,9 +63,13 @@ const llmForm = ref({
apiKeyMasked: '' as string | null, apiKeyMasked: '' as string | null,
configured: false, configured: false,
}); });
const messagePaneRef = ref<HTMLElement | null>(null); const bubbleListRef = ref<{
scrollTo?: (info: {
key?: string | number;
block?: ScrollLogicalPosition;
}) => void;
} | null>(null);
let abort: AbortController | null = null; let abort: AbortController | null = null;
/** 丢弃过期的 loadMessages */
let messagesLoadSeq = 0; let messagesLoadSeq = 0;
const activeSession = computed(() => const activeSession = computed(() =>
@@ -63,23 +80,79 @@ const showMessageLoading = computed(
() => loadingMessages.value && !sending.value && messages.value.length === 0, () => loadingMessages.value && !sending.value && messages.value.length === 0,
); );
function bubbleHtml(m: AgentVO.Message, idx: number): string { const renderAssistantMarkdown: BubbleProps['messageRender'] = (content) => {
const html = renderAgentMarkdown(String(content ?? ''));
return h('div', { class: 'agent-md', innerHTML: html || '…' });
};
/** Bubble.List 角色预设:SSE 已流式输出,关闭组件自带 typing 动画 */
const bubbleRoles: BubbleListProps['roles'] = {
assistant: {
placement: 'start',
variant: 'filled',
avatar: {
icon: h(RobotOutlined),
style: { background: '#1677ff', color: '#fff' },
},
messageRender: renderAssistantMarkdown,
styles: { content: { maxWidth: 'min(720px, 85%)' } },
},
user: {
placement: 'end',
variant: 'filled',
avatar: {
icon: h(UserOutlined),
style: { background: '#87d068', color: '#fff' },
},
styles: { content: { maxWidth: 'min(720px, 85%)' } },
},
};
const bubbleItems = computed<BubbleListProps['items']>(() =>
messages.value.map((m, idx) => {
const isStreamingAssistant = const isStreamingAssistant =
sending.value && sending.value &&
idx === messages.value.length - 1 && idx === messages.value.length - 1 &&
m.role === 'assistant'; m.role === 'assistant';
const text = isStreamingAssistant ? streamingText.value : m.content || ''; const content = isStreamingAssistant
if (!text) { ? streamingText.value || m.content || ''
return isStreamingAssistant ? '…' : ''; : m.content || '';
const role = m.role === 'user' ? 'user' : 'assistant';
return {
key: m.id || `${m.seq}-${idx}`,
role,
content,
loading: isStreamingAssistant && !content,
};
}),
);
/** 侧栏会话列表:映射为 Conversations items(label 用字符串,避免 Typography ellipsis+children 告警) */
const conversationItems = computed<Conversation[]>(() =>
sessions.value.map((s) => {
const ts = s.updatedAt || s.lastMessageAt || s.createdAt;
const timeMs = ts ? Date.parse(ts) : undefined;
return {
key: s.threadId,
label: s.title || '新对话',
timestamp: Number.isFinite(timeMs) ? timeMs : undefined,
};
}),
);
function onConversationActiveChange(key: string) {
if (sending.value) {
message.warning('回复生成中,请稍候再切换会话');
return;
} }
if (m.role === 'user') { activeThreadId.value = key;
return text }
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;') function scrollBubblesToBottom() {
.replace(/>/g, '&gt;') const items = bubbleItems.value || [];
.replace(/\n/g, '<br>'); const last = items[items.length - 1];
} if (last?.key == null) return;
return renderAgentMarkdown(text); bubbleListRef.value?.scrollTo?.({ key: last.key, block: 'end' });
} }
async function refreshSessions() { async function refreshSessions() {
@@ -102,13 +175,17 @@ async function loadMessages(threadId: string) {
loadingMessages.value = true; loadingMessages.value = true;
try { try {
const res = await listAgentMessagesApi(threadId); const res = await listAgentMessagesApi(threadId);
if (seq !== messagesLoadSeq || sending.value || threadId !== activeThreadId.value) { if (
seq !== messagesLoadSeq ||
sending.value ||
threadId !== activeThreadId.value
) {
return; return;
} }
messages.value = res.items || []; messages.value = res.items || [];
streamingText.value = ''; streamingText.value = '';
await nextTick(); await nextTick();
scrollToBottom(); scrollBubblesToBottom();
} catch (e: any) { } catch (e: any) {
if (seq === messagesLoadSeq && !sending.value) { if (seq === messagesLoadSeq && !sending.value) {
message.error(e?.message || '加载消息失败'); message.error(e?.message || '加载消息失败');
@@ -120,11 +197,6 @@ async function loadMessages(threadId: string) {
} }
} }
function scrollToBottom() {
const el = messagePaneRef.value;
if (el) el.scrollTop = el.scrollHeight;
}
watch(activeThreadId, (id) => { watch(activeThreadId, (id) => {
if (sending.value) return; if (sending.value) return;
if (id) void loadMessages(id); if (id) void loadMessages(id);
@@ -209,11 +281,11 @@ function appendStreamToken(t: string) {
if (last?.role === 'assistant') { if (last?.role === 'assistant') {
messages.value[idx] = { ...last, content: streamingText.value }; messages.value[idx] = { ...last, content: streamingText.value };
} }
void nextTick().then(scrollToBottom); void nextTick().then(scrollBubblesToBottom);
} }
async function send() { async function send(textOverride?: string) {
const text = draft.value.trim(); const text = (textOverride ?? draft.value).trim();
if (!text || sending.value) return; if (!text || sending.value) return;
if (!activeThreadId.value) { if (!activeThreadId.value) {
await createSession(); await createSession();
@@ -237,7 +309,7 @@ async function send() {
content: '', content: '',
}); });
await nextTick(); await nextTick();
scrollToBottom(); scrollBubblesToBottom();
abort?.abort(); abort?.abort();
abort = streamAgentChat({ abort = streamAgentChat({
@@ -268,6 +340,15 @@ async function send() {
}); });
} }
function onSenderSubmit(msg: string) {
void send(msg);
}
function onSenderCancel() {
abort?.abort();
sending.value = false;
}
onBeforeUnmount(() => abort?.abort()); onBeforeUnmount(() => abort?.abort());
void refreshSessions(); void refreshSessions();
@@ -279,43 +360,37 @@ void refreshSessions();
<aside <aside
class="flex w-64 shrink-0 flex-col border-r border-border bg-card" class="flex w-64 shrink-0 flex-col border-r border-border bg-card"
> >
<div class="flex items-center gap-2 border-b border-border p-3"> <div class="border-b border-border p-3">
<Button type="primary" block @click="createSession">新对话</Button> <Button type="primary" block @click="createSession">
<template #icon><PlusOutlined /></template>
新对话
</Button>
</div> </div>
<div class="min-h-0 flex-1 overflow-y-auto p-2"> <div class="relative min-h-0 flex-1">
<div <div
v-if="loadingSessions" v-if="loadingSessions"
class="text-muted-foreground py-6 text-center text-sm" class="absolute inset-0 z-10 flex items-center justify-center bg-background/50"
> >
加载中… <Spin size="small" />
</div> </div>
<template v-else>
<button
v-for="s in sessions"
:key="s.threadId"
type="button"
class="mb-1 w-full rounded-md px-3 py-2 text-left text-sm transition-colors"
:class="
s.threadId === activeThreadId
? 'bg-primary/10 text-primary'
: 'hover:bg-muted'
"
@click="activeThreadId = s.threadId"
>
<div class="truncate font-medium">{{ s.title }}</div>
<div class="text-muted-foreground mt-0.5 truncate text-xs">
{{ s.updatedAt || '' }}
</div>
</button>
<Empty <Empty
v-if="sessions.length === 0" v-if="!loadingSessions && conversationItems.length === 0"
class="mt-8" class="mt-10 px-2"
description="暂无会话" description="暂无会话"
/> />
</template> <Conversations
v-else
class="agent-conversations h-full overflow-y-auto px-3 py-2"
:items="conversationItems"
:active-key="activeThreadId ?? undefined"
@active-change="onConversationActiveChange"
/>
</div> </div>
<div class="border-t border-border p-3"> <div class="border-t border-border p-3">
<Button block @click="openSettings">模型 API 设置</Button> <Button block @click="openSettings">
<template #icon><SettingOutlined /></template>
模型 API 设置
</Button>
</div> </div>
</aside> </aside>
@@ -327,51 +402,39 @@ void refreshSessions();
{{ activeSession?.title || '智能助手' }} {{ activeSession?.title || '智能助手' }}
</span> </span>
</header> </header>
<div
ref="messagePaneRef" <div class="relative min-h-0 flex-1">
class="relative min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-4"
>
<div <div
v-if="showMessageLoading" v-if="showMessageLoading"
class="text-muted-foreground py-6 text-center text-sm" class="text-muted-foreground absolute inset-0 z-10 flex items-center justify-center bg-background/60 text-sm"
> >
加载消息… 加载消息…
</div> </div>
<Empty <Empty
v-else-if="messages.length === 0" v-if="!showMessageLoading && messages.length === 0"
class="absolute inset-0 flex items-center justify-center"
description="开始提问吧(需先配置公司模型 API)" description="开始提问吧(需先配置公司模型 API)"
/> />
<div <BubbleList
v-for="(m, idx) in messages" v-show="messages.length > 0"
:key="`${m.seq}-${idx}`" ref="bubbleListRef"
class="flex" class="h-full px-4 py-4"
:class="m.role === 'user' ? 'justify-end' : 'justify-start'" :roles="bubbleRoles"
> :items="bubbleItems"
<div :auto-scroll="true"
class="agent-md max-w-[75%] rounded-2xl px-3 py-2 text-sm leading-relaxed"
:class="
m.role === 'user'
? 'bg-primary text-primary-foreground whitespace-pre-wrap'
: 'bg-muted text-foreground'
"
v-html="bubbleHtml(m, idx)"
></div>
</div>
</div>
<footer class="shrink-0 border-t border-border p-3">
<div class="flex gap-2">
<Textarea
v-model:value="draft"
:rows="2"
:disabled="sending"
placeholder="输入问题,Enter 发送(Shift+Enter 换行)"
class="flex-1"
@keydown.enter.exact.prevent="send"
/> />
<Button type="primary" :loading="sending" @click="send">
发送
</Button>
</div> </div>
<footer class="shrink-0 border-t border-border p-3">
<Sender
v-model:value="draft"
:loading="sending"
placeholder="输入问题,Enter 发送(Shift+Enter 换行)"
:auto-size="{ minRows: 2, maxRows: 6 }"
submit-type="enter"
@submit="onSenderSubmit"
@cancel="onSenderCancel"
/>
</footer> </footer>
</section> </section>
</div> </div>
@@ -436,6 +499,9 @@ void refreshSessions();
</template> </template>
<style scoped> <style scoped>
.agent-conversations :deep(.ant-conversations-list) {
padding-inline: 0;
}
.agent-md :deep(p) { .agent-md :deep(p) {
margin: 0.35em 0; margin: 0.35em 0;
} }
@@ -0,0 +1,38 @@
diff --git a/es/conversations/ConversationsItem.mjs b/es/conversations/ConversationsItem.mjs
index 7245467416f4bff50d882a1cc4b0e6085150d507..45ccd67847af10d4706e476e6d2682aac1b13a16 100644
--- a/es/conversations/ConversationsItem.mjs
+++ b/es/conversations/ConversationsItem.mjs
@@ -84,14 +84,18 @@ const j = /* @__PURE__ */ h({
onClick: x
}), [e.info.icon && n("div", {
class: `${e.prefixCls}-icon`
- }, [e.info.icon]), n(M.Text, {
- class: `${e.prefixCls}-label`,
- ellipsis: {
- onEllipsis: v
- }
- }, {
- default: () => [e.info.label]
- }), !o.value && e.menu && n(N, {
+ }, [e.info.icon]), (() => {
+ const A = e.info.label, S = typeof A == "string" || typeof A == "number";
+ return n(M.Text, {
+ class: `${e.prefixCls}-label`,
+ content: S ? A : void 0,
+ ellipsis: {
+ onEllipsis: v
+ }
+ }, S ? void 0 : {
+ default: () => [A]
+ });
+ })(), !o.value && e.menu && n(N, {
placement: e.direction === "rtl" ? "bottomLeft" : "bottomRight",
trigger: ["click"],
disabled: o.value,
diff --git a/lib/conversations/ConversationsItem.js b/lib/conversations/ConversationsItem.js
index ded16c252b0d9b4c5fe8bdb98bad0366f77ebe2c..582665631e71ac65215803f616b74d0d88bfd869 100644
--- a/lib/conversations/ConversationsItem.js
+++ b/lib/conversations/ConversationsItem.js
@@ -1 +1 @@
-"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),d=require("../chunks/helper-chunk.js"),s=require("../chunks/module-chunk.js"),P=require("../_util/pick-attrs.js"),a=require("ant-design-vue"),c=require("../_util/hooks/use-state.js"),N=t.defineComponent({name:"AXConversationsItem",__name:"ConversationsItem",props:{info:{type:Object,required:!0},prefixCls:{type:String,required:!1},direction:{required:!1},menu:{type:Object,required:!1},active:{type:Boolean,required:!1},onClick:{type:Function,required:!1}},setup(e,{expose:f}){f();const g=d.createPropsRestProxy(e,["prefixCls","info","class","direction","onClick","active","menu"]);t.toRef(e,"class");const m=t.computed(()=>P.default(g,{aria:!0,data:!0,attr:!0})),v=n=>{n.stopPropagation()},i=t.computed(()=>e.info.disabled),[C,p]=c.default(!1),[b,r]=c.default(!1),x=t.computed(()=>s.classnames(e.class,`${e.prefixCls}-item`,{[`${e.prefixCls}-item-active`]:e.active&&!i.value},{[`${e.prefixCls}-item-disabled`]:i.value})),h=()=>{!i.value&&e.onClick&&e.onClick(e.info)},k=n=>{n&&r(!n)},o=t.computed(()=>{var n;return(n=e.menu)==null?void 0:n.trigger}),u=t.computed(()=>{const{trigger:n,...l}=e.menu||{};return l}),q=t.computed(()=>{var n;return(n=u.value)==null?void 0:n.getPopupContainer}),y=n=>{const l=t.createVNode(s.EllipsisOutlined,{onClick:v,class:`${e.prefixCls}-menu-icon`},null);return o.value?typeof o.value=="function"?o.value(n,{originNode:l}):o.value:l};return()=>t.createVNode(a.Tooltip,{title:e.info.label,open:C.value&&b.value,onOpenChange:r,placement:e.direction==="rtl"?"left":"right"},{default:()=>[t.createVNode("li",t.mergeProps(m.value,{class:x.value,onClick:h}),[e.info.icon&&t.createVNode("div",{class:`${e.prefixCls}-icon`},[e.info.icon]),t.createVNode(a.Typography.Text,{class:`${e.prefixCls}-label`,ellipsis:{onEllipsis:p}},{default:()=>[e.info.label]}),!i.value&&e.menu&&t.createVNode(a.Dropdown,{placement:e.direction==="rtl"?"bottomLeft":"bottomRight",trigger:["click"],disabled:i.value,onOpenChange:k,getPopupContainer:q.value},{default:()=>y(e.info),overlay:()=>t.createVNode(a.Menu,u.value,null)})])]})}}),O=d._export_sfc(N,[["__file","/Users/wangzhichao/办公/code/github/ant-design-x-vue-pure/ant-design-x-vue/src/conversations/ConversationsItem.vue"]]);exports.default=O;
+"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),d=require("../chunks/helper-chunk.js"),s=require("../chunks/module-chunk.js"),P=require("../_util/pick-attrs.js"),a=require("ant-design-vue"),c=require("../_util/hooks/use-state.js"),N=t.defineComponent({name:"AXConversationsItem",__name:"ConversationsItem",props:{info:{type:Object,required:!0},prefixCls:{type:String,required:!1},direction:{required:!1},menu:{type:Object,required:!1},active:{type:Boolean,required:!1},onClick:{type:Function,required:!1}},setup(e,{expose:f}){f();const g=d.createPropsRestProxy(e,["prefixCls","info","class","direction","onClick","active","menu"]);t.toRef(e,"class");const m=t.computed(()=>P.default(g,{aria:!0,data:!0,attr:!0})),v=n=>{n.stopPropagation()},i=t.computed(()=>e.info.disabled),[C,p]=c.default(!1),[b,r]=c.default(!1),x=t.computed(()=>s.classnames(e.class,`${e.prefixCls}-item`,{[`${e.prefixCls}-item-active`]:e.active&&!i.value},{[`${e.prefixCls}-item-disabled`]:i.value})),h=()=>{!i.value&&e.onClick&&e.onClick(e.info)},k=n=>{n&&r(!n)},o=t.computed(()=>{var n;return(n=e.menu)==null?void 0:n.trigger}),u=t.computed(()=>{const{trigger:n,...l}=e.menu||{};return l}),q=t.computed(()=>{var n;return(n=u.value)==null?void 0:n.getPopupContainer}),y=n=>{const l=t.createVNode(s.EllipsisOutlined,{onClick:v,class:`${e.prefixCls}-menu-icon`},null);return o.value?typeof o.value=="function"?o.value(n,{originNode:l}):o.value:l};return()=>t.createVNode(a.Tooltip,{title:e.info.label,open:C.value&&b.value,onOpenChange:r,placement:e.direction==="rtl"?"left":"right"},{default:()=>[t.createVNode("li",t.mergeProps(m.value,{class:x.value,onClick:h}),[e.info.icon&&t.createVNode("div",{class:`${e.prefixCls}-icon`},[e.info.icon]),((A)=>{const S=typeof A=="string"||typeof A=="number";return t.createVNode(a.Typography.Text,{class:`${e.prefixCls}-label`,content:S?A:void 0,ellipsis:{onEllipsis:p}},S?void 0:{default:()=>[A]})})(e.info.label),!i.value&&e.menu&&t.createVNode(a.Dropdown,{placement:e.direction==="rtl"?"bottomLeft":"bottomRight",trigger:["click"],disabled:i.value,onOpenChange:k,getPopupContainer:q.value},{default:()=>y(e.info),overlay:()=>t.createVNode(a.Menu,u.value,null)})])]})}}),O=d._export_sfc(N,[["__file","/Users/wangzhichao/办公/code/github/ant-design-x-vue-pure/ant-design-x-vue/src/conversations/ConversationsItem.vue"]]);exports.default=O;
+44
View File
@@ -495,6 +495,11 @@ overrides:
pinia: ^3.0.3 pinia: ^3.0.3
vue: ^3.5.17 vue: ^3.5.17
patchedDependencies:
ant-design-x-vue@1.6.0:
hash: 15b9ba8f92857d7d64088f3653d435adc7cda2a1ea36685f4803ca1322162bc8
path: patches/ant-design-x-vue@1.6.0.patch
importers: importers:
.: .:
@@ -653,6 +658,9 @@ importers:
ant-design-vue: ant-design-vue:
specifier: 'catalog:' specifier: 'catalog:'
version: 4.2.6(vue@3.5.17(typescript@5.8.3)) version: 4.2.6(vue@3.5.17(typescript@5.8.3))
ant-design-x-vue:
specifier: ^1.6.0
version: 1.6.0(patch_hash=15b9ba8f92857d7d64088f3653d435adc7cda2a1ea36685f4803ca1322162bc8)(ant-design-vue@4.2.6(vue@3.5.17(typescript@5.8.3)))(vue@3.5.17(typescript@5.8.3))
dayjs: dayjs:
specifier: 'catalog:' specifier: 'catalog:'
version: 1.11.13 version: 1.11.13
@@ -1756,6 +1764,10 @@ packages:
'@ant-design/colors@6.0.0': '@ant-design/colors@6.0.0':
resolution: {integrity: sha512-qAZRvPzfdWHtfameEGP2Qvuf838NhergR35o+EuVyB5XvSA98xod5r4utvi4TJ3ywmevm290g9nsCG5MryrdWQ==} resolution: {integrity: sha512-qAZRvPzfdWHtfameEGP2Qvuf838NhergR35o+EuVyB5XvSA98xod5r4utvi4TJ3ywmevm290g9nsCG5MryrdWQ==}
'@ant-design/fast-color@2.0.6':
resolution: {integrity: sha512-y2217gk4NqL35giHl72o6Zzqji9O7vHh9YmhUVkPtAOpoTCH4uWxo/pr4VE8t0+ChEPs0qo4eJRC5Q1eXWo3vA==}
engines: {node: '>=8.x'}
'@ant-design/icons-svg@4.4.2': '@ant-design/icons-svg@4.4.2':
resolution: {integrity: sha512-vHbT+zJEVzllwP+CM+ul7reTEfBR0vgxFe7+lREAsAA7YGsYpboiq2sQNeQeRvh09GfQgs/GyFEvZpJ9cLXpXA==} resolution: {integrity: sha512-vHbT+zJEVzllwP+CM+ul7reTEfBR0vgxFe7+lREAsAA7YGsYpboiq2sQNeQeRvh09GfQgs/GyFEvZpJ9cLXpXA==}
@@ -3023,6 +3035,9 @@ packages:
'@emotion/hash@0.9.2': '@emotion/hash@0.9.2':
resolution: {integrity: sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==} resolution: {integrity: sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==}
'@emotion/unitless@0.10.0':
resolution: {integrity: sha512-dFoMUuQA20zvtVTuxZww6OHoJYgrzfKM1t52mVySDJnMSEa08ruEvdYQbhvyu6soU+NeLVd3yKfTfT0NeV6qGg==}
'@emotion/unitless@0.8.1': '@emotion/unitless@0.8.1':
resolution: {integrity: sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==} resolution: {integrity: sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==}
@@ -4648,6 +4663,12 @@ packages:
peerDependencies: peerDependencies:
vue: ^3.5.17 vue: ^3.5.17
ant-design-x-vue@1.6.0:
resolution: {integrity: sha512-dZ/j35WI7nif17AD8wiG2dV2y5UNCk+JdNb35lUVd0FCK5d1apgd/8U/yWtNcnpd2IJt6GMhtYuUzCIcG8dQtA==}
peerDependencies:
ant-design-vue: '>=4.0.0'
vue: ^3.5.17
any-promise@1.3.0: any-promise@1.3.0:
resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
@@ -4991,6 +5012,9 @@ packages:
class-variance-authority@0.7.1: class-variance-authority@0.7.1:
resolution: {integrity: sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==} resolution: {integrity: sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==}
classnames@2.5.1:
resolution: {integrity: sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==}
clean-css@5.3.3: clean-css@5.3.3:
resolution: {integrity: sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==} resolution: {integrity: sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==}
engines: {node: '>= 10.0'} engines: {node: '>= 10.0'}
@@ -10427,6 +10451,10 @@ snapshots:
dependencies: dependencies:
'@ctrl/tinycolor': 4.1.0 '@ctrl/tinycolor': 4.1.0
'@ant-design/fast-color@2.0.6':
dependencies:
'@babel/runtime': 7.27.6
'@ant-design/icons-svg@4.4.2': {} '@ant-design/icons-svg@4.4.2': {}
'@ant-design/icons-vue@7.0.1(vue@3.5.17(typescript@5.8.3))': '@ant-design/icons-vue@7.0.1(vue@3.5.17(typescript@5.8.3))':
@@ -11980,6 +12008,8 @@ snapshots:
'@emotion/hash@0.9.2': {} '@emotion/hash@0.9.2': {}
'@emotion/unitless@0.10.0': {}
'@emotion/unitless@0.8.1': {} '@emotion/unitless@0.8.1': {}
'@es-joy/jsdoccomment@0.50.2': '@es-joy/jsdoccomment@0.50.2':
@@ -13735,6 +13765,18 @@ snapshots:
vue-types: 3.0.2(vue@3.5.17(typescript@5.8.3)) vue-types: 3.0.2(vue@3.5.17(typescript@5.8.3))
warning: 4.0.3 warning: 4.0.3
ant-design-x-vue@1.6.0(patch_hash=15b9ba8f92857d7d64088f3653d435adc7cda2a1ea36685f4803ca1322162bc8)(ant-design-vue@4.2.6(vue@3.5.17(typescript@5.8.3)))(vue@3.5.17(typescript@5.8.3)):
dependencies:
'@ant-design/fast-color': 2.0.6
'@emotion/hash': 0.9.2
'@emotion/unitless': 0.10.0
'@vueuse/core': 13.4.0(vue@3.5.17(typescript@5.8.3))
ant-design-vue: 4.2.6(vue@3.5.17(typescript@5.8.3))
classnames: 2.5.1
csstype: 3.1.3
stylis: 4.3.6
vue: 3.5.17(typescript@5.8.3)
any-promise@1.3.0: {} any-promise@1.3.0: {}
anymatch@3.1.3: anymatch@3.1.3:
@@ -14144,6 +14186,8 @@ snapshots:
dependencies: dependencies:
clsx: 2.1.1 clsx: 2.1.1
classnames@2.5.1: {}
clean-css@5.3.3: clean-css@5.3.3:
dependencies: dependencies:
source-map: 0.6.1 source-map: 0.6.1
+4
View File
@@ -13,6 +13,10 @@ packages:
- docs - docs
- playground - playground
# ConversationsItem:Typography ellipsis 改用 content,消除 ant-design-vue 控制台告警
patchedDependencies:
ant-design-x-vue@1.6.0: patches/ant-design-x-vue@1.6.0.patch
catalog: catalog:
'@ast-grep/napi': ^0.37.0 '@ast-grep/napi': ^0.37.0
'@changesets/changelog-github': ^0.5.1 '@changesets/changelog-github': ^0.5.1