UNPKG

@artmate/chat

Version:

**开箱即用的AI组件库(基于 Vue3 + ElementPlus)**

108 lines (107 loc) 3.66 kB
import { defineComponent as E, computed as N, createElementBlock as n, openBlock as t, normalizeStyle as k, normalizeClass as A, Fragment as c, renderList as p, unref as f, createElementVNode as G, renderSlot as o, createBlock as v, withCtx as r, createTextVNode as L, toDisplayString as V } from "vue"; import { useNamespace as j } from "../hooks/useNamespace.js"; import w from "./GroupTitle.vue.js"; import D from "./hooks/useGroupable.js"; import K from "./item.vue.js"; /* empty css */ const M = /* @__PURE__ */ E({ __name: "index", props: { style: {}, className: {}, direction: {}, groupable: { type: [Boolean, Object] }, items: {}, defaultActiveKey: {}, activeKey: {}, onActiveChange: { type: Function }, classNames: {}, styles: {}, menu: { type: [Function, Array] } }, emits: ["update:activeKey"], setup(_, { emit: h }) { const e = _, g = h, u = j("conversations"), C = N(() => e.activeKey || e.defaultActiveKey || ""), [B, F] = D(e.groupable, e.items), S = N(() => [ u.b(), e.className, { [u.b("rtl")]: e.direction === "rtl" } ]); function $(i) { e.onActiveChange && e.onActiveChange(i.key) === !1 || g("update:activeKey", i.key); } return (i, z) => (t(), n("ul", { class: A(S.value), style: k(e.style) }, [ (t(!0), n(c, null, p(f(B), (a, b) => (t(), n(c, { key: b }, [ f(F) ? (t(), n(c, { key: 0 }, [ (t(), n("li", { key: a.name || `key-${b}` }, [ i.$slots.title ? o(i.$slots, "title", { key: 0, info: a }) : (t(), v(w, { key: a.name }, { default: r(() => [ L(V(a.name), 1) ]), _: 2 }, 1024)) ])), G("ul", { class: A([f(u).b("list")]) }, [ (t(!0), n(c, null, p(a.data, (s, y) => { var l, m; return t(), v(K, { key: s.key || `key-${y}`, active: C.value === s.key, "class-name": (l = e.classNames) == null ? void 0 : l.item, direction: e.direction, info: s, menu: typeof e.menu == "function" ? e.menu(s) : e.menu, style: k((m = e.styles) == null ? void 0 : m.item), onClick: $ }, { label: r(({ item: d }) => [ o(i.$slots, "item", { item: d }) ]), icon: r(() => [ o(i.$slots, "icon") ]), _: 2 }, 1032, ["active", "class-name", "direction", "info", "menu", "style"]); }), 128)) ], 2) ], 64)) : (t(!0), n(c, { key: 1 }, p(a.data, (s, y) => { var l, m; return t(), v(K, { key: s.key || `key-${y}`, active: C.value === s.key, "class-name": (l = e.classNames) == null ? void 0 : l.item, direction: e.direction, info: s, menu: typeof e.menu == "function" ? e.menu(s) : e.menu, style: k((m = e.styles) == null ? void 0 : m.item), onClick: $ }, { label: r(({ item: d }) => [ o(i.$slots, "item", { item: d }) ]), icon: r(() => [ o(i.$slots, "icon") ]), _: 2 }, 1032, ["active", "class-name", "direction", "info", "menu", "style"]); }), 128)) ], 64))), 128)) ], 6)); } }); export { M as default };