@artmate/chat
Version:
**开箱即用的AI组件库(基于 Vue3 + ElementPlus)**
2 lines (1 loc) • 2.76 kB
JavaScript
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),b=require("../hooks/useNamespace.js"),g=require("./GroupTitle.vue.js"),S=require("./hooks/useGroupable.js"),k=require("./item.vue.js");;/* empty css */const h=e.defineComponent({__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(d,{emit:p}){const t=d,B=p,r=b.useNamespace("conversations"),u=e.computed(()=>t.activeKey||t.defaultActiveKey||""),[v,_]=S.default(t.groupable,t.items),C=e.computed(()=>[r.b(),t.className,{[r.b("rtl")]:t.direction==="rtl"}]);function m(l){t.onActiveChange&&t.onActiveChange(l.key)===!1||B("update:activeKey",l.key)}return(l,f)=>(e.openBlock(),e.createElementBlock("ul",{class:e.normalizeClass(C.value),style:e.normalizeStyle(t.style)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(v),(a,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y},[e.unref(_)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(),e.createElementBlock("li",{key:a.name||`key-${y}`},[l.$slots.title?e.renderSlot(l.$slots,"title",{key:0,info:a}):(e.openBlock(),e.createBlock(g.default,{key:a.name},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.name),1)]),_:2},1024))])),e.createElementVNode("ul",{class:e.normalizeClass([e.unref(r).b("list")])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.data,(n,c)=>{var s,i;return e.openBlock(),e.createBlock(k.default,{key:n.key||`key-${c}`,active:u.value===n.key,"class-name":(s=t.classNames)==null?void 0:s.item,direction:t.direction,info:n,menu:typeof t.menu=="function"?t.menu(n):t.menu,style:e.normalizeStyle((i=t.styles)==null?void 0:i.item),onClick:m},{label:e.withCtx(({item:o})=>[e.renderSlot(l.$slots,"item",{item:o})]),icon:e.withCtx(()=>[e.renderSlot(l.$slots,"icon")]),_:2},1032,["active","class-name","direction","info","menu","style"])}),128))],2)],64)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.data,(n,c)=>{var s,i;return e.openBlock(),e.createBlock(k.default,{key:n.key||`key-${c}`,active:u.value===n.key,"class-name":(s=t.classNames)==null?void 0:s.item,direction:t.direction,info:n,menu:typeof t.menu=="function"?t.menu(n):t.menu,style:e.normalizeStyle((i=t.styles)==null?void 0:i.item),onClick:m},{label:e.withCtx(({item:o})=>[e.renderSlot(l.$slots,"item",{item:o})]),icon:e.withCtx(()=>[e.renderSlot(l.$slots,"icon")]),_:2},1032,["active","class-name","direction","info","menu","style"])}),128))],64))),128))],6))}});exports.default=h;