@artmate/chat
Version:
借鉴字节开源react库AntX,通过vue实现的版本
51 lines (50 loc) • 1.91 kB
JavaScript
import { defineComponent as b, useSlots as h, computed as S, createElementBlock as m, openBlock as t, normalizeStyle as i, normalizeClass as g, Fragment as z, renderList as p, createBlock as B, unref as l, createSlots as N, withCtx as $, renderSlot as v, mergeProps as E } from "vue";
import { useNamespace as w } from "../hooks/useNamespace.js";
import F from "./hooks/useCollapsible.js";
import I from "./item.vue.js";
/* empty css */
const G = /* @__PURE__ */ b({
__name: "index",
props: {
items: { default: () => [] },
collapsible: { type: Boolean, default: !1 },
size: { default: "middle" },
styles: { default: () => ({}) },
classNames: { default: () => ({}) },
prefixCls: { default: "" },
rootClassName: { default: "" },
rootStyle: {}
},
setup(u) {
const a = w("thought-chain"), e = u, d = h(), [f, y, _] = F(e.collapsible), k = S(() => [a.b(), e.rootClassName, e.prefixCls, a.b(e.size)]);
return (x, K) => (t(), m("div", {
class: g(k.value),
style: i(e.rootStyle)
}, [
(t(!0), m(z, null, p(e.items, (s, o) => {
var r, n;
return t(), B(I, {
key: s.key || `key_${o}`,
"class-name": (r = e.classNames) == null ? void 0 : r.item,
style: i(e.styles.item),
styles: e.styles,
info: { ...s },
"header-click": l(_),
"next-status": ((n = e.items[o + 1]) == null ? void 0 : n.status) || s.status,
"enable-collapse": l(f),
"expanded-keys": l(y)
}, N({ _: 2 }, [
p(d, (L, c) => ({
name: c,
fn: $((C) => [
v(x.$slots, c, E({ ref_for: !0 }, { ...C }))
])
}))
]), 1032, ["class-name", "style", "styles", "info", "header-click", "next-status", "enable-collapse", "expanded-keys"]);
}), 128))
], 6));
}
});
export {
G as default
};