{"version":3,"file":"collapse-transition.js","sources":["../../../../../../packages/components/collapse-transition/src/collapse-transition.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b()\" v-on=\"on\">\n <slot />\n </transition>\n</template>\n<script lang=\"ts\" setup>\nimport { useNamespace } from '@element-plus/hooks'\nimport type { RendererElement } from '@vue/runtime-core'\n\ndefineOptions({\n name: 'ElCollapseTransition',\n})\n\nconst ns = useNamespace('collapse-transition')\n\nconst reset = (el: RendererElement) => {\n el.style.maxHeight = ''\n el.style.overflow = el.dataset.oldOverflow\n el.style.paddingTop = el.dataset.oldPaddingTop\n el.style.paddingBottom = el.dataset.oldPaddingBottom\n}\n\nconst on = {\n beforeEnter(el: RendererElement) {\n if (!el.dataset) el.dataset = {}\n\n el.dataset.oldPaddingTop = el.style.paddingTop\n el.dataset.oldPaddingBottom = el.style.paddingBottom\n if (el.style.height) el.dataset.elExistsHeight = el.style.height\n\n el.style.maxHeight = 0\n el.style.paddingTop = 0\n el.style.paddingBottom = 0\n },\n\n enter(el: RendererElement) {\n requestAnimationFrame(() => {\n el.dataset.oldOverflow = el.style.overflow\n if (el.dataset.elExistsHeight) {\n el.style.maxHeight = el.dataset.elExistsHeight\n } else if (el.scrollHeight !== 0) {\n el.style.maxHeight = `${el.scrollHeight}px`\n } else {\n el.style.maxHeight = 0\n }\n\n el.style.paddingTop = el.dataset.oldPaddingTop\n el.style.paddingBottom = el.dataset.oldPaddingBottom\n el.style.overflow = 'hidden'\n })\n },\n\n afterEnter(el: RendererElement) {\n el.style.maxHeight = ''\n el.style.overflow = el.dataset.oldOverflow\n },\n\n enterCancelled(el: RendererElement) {\n reset(el)\n },\n\n beforeLeave(el: RendererElement) {\n if (!el.dataset) el.dataset = {}\n el.dataset.oldPaddingTop = el.style.paddingTop\n el.dataset.oldPaddingBottom = el.style.paddingBottom\n el.dataset.oldOverflow = el.style.overflow\n\n el.style.maxHeight = `${el.scrollHeight}px`\n el.style.overflow = 'hidden'\n },\n\n leave(el: RendererElement) {\n if (el.scrollHeight !== 0) {\n el.style.maxHeight = 0\n el.style.paddingTop = 0\n el.style.paddingBottom = 0\n }\n },\n\n afterLeave(el: RendererElement) {\n reset(el)\n },\n\n leaveCancelled(el: RendererElement) {\n reset(el)\n },\n}\n</script>\n"],"names":["useNamespace"],"mappings":";;;;;;;;;uCASc,CAAA;AAAA,EACZ,IAAM,EAAA,sBAAA;AACR,CAAA,CAAA,CAAA;;;;AAEA,IAAM,MAAA,EAAA,GAAKA,mBAAa,qBAAqB,CAAA,CAAA;AAE7C,IAAM,MAAA,KAAA,GAAQ,CAAC,EAAwB,KAAA;AACrC,MAAA,EAAA,CAAG,MAAM,SAAY,GAAA,EAAA,CAAA;AACrB,MAAG,EAAA,CAAA,KAAA,CAAM,QAAW,GAAA,EAAA,CAAG,OAAQ,CAAA,WAAA,CAAA;AAC/B,MAAG,EAAA,CAAA,KAAA,CAAM,UAAa,GAAA,EAAA,CAAG,OAAQ,CAAA,aAAA,CAAA;AACjC,MAAG,EAAA,CAAA,KAAA,CAAM,aAAgB,GAAA,EAAA,CAAG,OAAQ,CAAA,gBAAA,CAAA;AAAA,KACtC,CAAA;AAEA,IAAA,MAAM,EAAK,GAAA;AAAA,MACT,YAAY,EAAqB,EAAA;AAC/B,QAAA,IAAI,CAAC,EAAG,CAAA,OAAA;AAAS,UAAA,EAAA,CAAG,UAAU,EAAC,CAAA;AAE/B,QAAG,EAAA,CAAA,OAAA,CAAQ,aAAgB,GAAA,EAAA,CAAG,KAAM,CAAA,UAAA,CAAA;AACpC,QAAG,EAAA,CAAA,OAAA,CAAQ,gBAAmB,GAAA,EAAA,CAAG,KAAM,CAAA,aAAA,CAAA;AACvC,QAAA,IAAI,GAAG,KAAM,CAAA,MAAA;AAAQ,UAAG,EAAA,CAAA,OAAA,CAAQ,cAAiB,GAAA,EAAA,CAAG,KAAM,CAAA,MAAA,CAAA;AAE1D,QAAA,EAAA,CAAG,MAAM,SAAY,GAAA,CAAA,CAAA;AACrB,QAAA,EAAA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