UNPKG

ant-design-x-vue

Version:
56 lines (55 loc) 2.5 kB
import { defineComponent as i, useSlots as r, computed as p, createVNode as g, Transition as l } from "vue"; import { _ as f } from "../chunks/helper-chunk.mjs"; const m = /* @__PURE__ */ i({ name: "AXTransitionCollapse", __name: "TransitionCollapse", props: { prefixCls: { type: String, required: !1, default: "ax" } }, setup(a, { expose: d }) { d(); const s = a, o = r(), n = p(() => s.prefixCls + "-transition-collapse"), e = { beforeEnter(t) { t.dataset || (t.dataset = {}), t.dataset.oldPaddingTop = t.style.paddingTop, t.dataset.oldPaddingBottom = t.style.paddingBottom, t.style.maxHeight = "0", t.style.paddingTop = "0", t.style.paddingBottom = "0"; }, enter(t) { t.dataset.oldOverflow = t.style.overflow, t.scrollHeight !== 0 ? (t.style.maxHeight = `${t.scrollHeight}px`, t.style.paddingTop = t.dataset.oldPaddingTop, t.style.paddingBottom = t.dataset.oldPaddingBottom) : (t.style.maxHeight = `${t.dataset.oldMaxHeight || "999"}px`, t.style.paddingTop = t.dataset.oldPaddingTop, t.style.paddingBottom = t.dataset.oldPaddingBottom), t.style.overflow = "hidden"; }, afterEnter(t) { t.style.maxHeight = "", t.style.overflow = t.dataset.oldOverflow; }, beforeLeave(t) { t.dataset || (t.dataset = {}), t.dataset.oldMaxHeight = t.scrollHeight, t.dataset.oldPaddingTop = t.style.paddingTop, t.dataset.oldPaddingBottom = t.style.paddingBottom, t.dataset.oldOverflow = t.style.overflow, t.style.overflow = "hidden", t.style.maxHeight = `${t.scrollHeight}px`; }, leave(t) { t.scrollHeight !== 0 && (t.style.maxHeight = "0", t.style.paddingTop = "0", t.style.paddingBottom = "0"); }, afterLeave(t) { t.style.maxHeight = "", t.style.overflow = t.dataset.oldOverflow, t.style.paddingTop = t.dataset.oldPaddingTop, t.style.paddingBottom = t.dataset.oldPaddingBottom; } }; return () => g(l, { name: n.value, onBeforeEnter: e.beforeEnter, onEnter: e.enter, onAfterEnter: e.afterEnter, onBeforeLeave: e.beforeLeave, onLeave: e.leave, onAfterLeave: e.afterLeave }, { default: () => { var t; return [(t = o.default) == null ? void 0 : t.call(o)]; } }); } }), c = /* @__PURE__ */ f(m, [["__file", "/Users/wangzhichao/办公/code/github/ant-design-x-vue-pure/ant-design-x-vue/src/transition-collapse/TransitionCollapse.vue"]]); export { c as default };