comic-plus
Version:
<p align="center"> <img width="200px" src="./logo.png"/> </p>
69 lines (68 loc) • 2.62 kB
JavaScript
import { defineComponent, inject, computed, openBlock, createElementBlock, normalizeStyle, createElementVNode, renderSlot, createTextVNode, toDisplayString, createVNode, unref, normalizeClass, withCtx, withDirectives, vShow } from "vue";
import { CuTransitionCollapse } from "../../transition-collapse/index.mjs";
import { collapseItemProps } from "./item.props.mjs";
import { COLLAPSE_PROVIDE } from "./type.mjs";
import "../../../icons/index.mjs";
import { Right } from "../../../icons/components/components.mjs";
const _hoisted_1 = { class: "cu-collapse-item__content" };
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "CuCollapseItem"
},
__name: "item",
props: collapseItemProps,
setup(__props) {
const props = __props;
const { props: injectProps, activeValue, collapseChange } = inject(COLLAPSE_PROVIDE);
const showItem = computed(() => {
return injectProps.accordion ? activeValue.value === props.name : activeValue.value.includes(props.name) || false;
});
const style = computed(() => {
return {
background: injectProps.fill ? props.background ?? injectProps.background : void 0,
color: props.color ?? injectProps.color
};
});
const changeShow = function() {
collapseChange(!showItem.value, props.name);
};
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: "cu-collapse-item",
style: normalizeStyle(style.value)
}, [
createElementVNode("div", {
class: "cu-collapse-item__head",
onClick: changeShow
}, [
renderSlot(_ctx.$slots, "head", {}, () => [
createElementVNode("span", null, [
renderSlot(_ctx.$slots, "label", {}, () => [
createTextVNode(toDisplayString(_ctx.label), 1)
])
]),
_cache[0] || (_cache[0] = createElementVNode("span", { class: "cu-collapse-item__line" }, null, -1)),
createVNode(unref(Right), {
class: normalizeClass(["cu-collapse--icon", { active: showItem.value }])
}, null, 8, ["class"])
])
]),
createVNode(unref(CuTransitionCollapse), null, {
default: withCtx(() => [
withDirectives(createElementVNode("div", null, [
createElementVNode("div", _hoisted_1, [
renderSlot(_ctx.$slots, "default")
])
], 512), [
[vShow, showItem.value]
])
]),
_: 3
})
], 4);
};
}
});
export {
_sfc_main as default
};