import { w as withInstall } from "../badge/index2.js"; import { defineComponent, inject, computed, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, createTextVNode, toDisplayString, normalizeStyle, unref, createVNode, withCtx, createCommentVNode } from "vue"; import { _ as _sfc_main$1 } from "../transition/index2.js"; const _hoisted_1 = { class: "layui-colla-item" }; const _hoisted_2 = { key: 0 }; const _hoisted_3 = { class: "layui-colla-content" }; const __default__ = { name: "LayCollapseItem" }; const _sfc_main = defineComponent({ ...__default__, props: { id: null, title: null, disabled: { type: Boolean, default: false } }, setup(__props) { const props = __props; const { accordion, activeValues, emit, collapseTransition } = inject("layCollapse"); let isShow = computed(() => { return activeValues.value.includes(props.id); }); const showHandle = function() { if (props.disabled) { return; } const _isShow = isShow.value; if (accordion) { activeValues.value = !_isShow ? [props.id] : []; } else if (_isShow) { activeValues.value.splice(activeValues.value.indexOf(props.id), 1); } else { activeValues.value.push(props.id); } emit("update:modelValue", accordion ? activeValues.value[0] || null : activeValues.value); emit("change", props.id, !_isShow, activeValues.value); }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("h2", { class: normalizeClass(["layui-colla-title", { "layui-disabled": __props.disabled }]), onClick: showHandle }, [ renderSlot(_ctx.$slots, "title", { props }, () => [ createTextVNode(toDisplayString(__props.title), 1) ]), createElementVNode("i", { class: "layui-icon layui-colla-icon layui-icon-right", style: normalizeStyle({ transform: unref(isShow) ? "rotate(90deg)" : "none", transition: unref(collapseTransition) ? "all 0.2s ease 0s" : "" }) }, null, 4) ], 2), createVNode(_sfc_main$1, { enable: unref(collapseTransition) }, { default: withCtx(() => [ unref(isShow) ? (openBlock(), createElementBlock("div", _hoisted_2, [ createElementVNode("div", _hoisted_3, [ createElementVNode("p", null, [ renderSlot(_ctx.$slots, "default", { props }) ]) ]) ])) : createCommentVNode("", true) ]), _: 3 }, 8, ["enable"]) ]); }; } }); const component = withInstall(_sfc_main); export { component as default };