UNPKG

@artmate/chat

Version:

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

36 lines (35 loc) 853 B
import { computed as p } from "vue"; const s = "__ungrouped"; function f(u, i = []) { const o = p(() => { if (!u) return [!1, void 0, void 0]; let e = { sort: void 0, title: void 0 }; return typeof u == "object" && (e = { ...e, ...u }), [!0, e.sort, e.title]; }); return p(() => { if (!o.value[0]) return [[ { name: s, data: i, title: void 0 } ], o.value[0]]; const e = i.reduce((t, n) => { const r = n.group || s; return t[r] || (t[r] = []), t[r].push(n), t; }, {}); return [(o.value[1] && typeof o.value[1] != "boolean" ? Object.keys(e).sort(o.value[1]) : Object.keys(e)).map((t) => ({ name: t === s ? void 0 : t, title: o.value[2], data: e[t] })), o.value[0]]; }).value; } export { f as default };