You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
4.9 KiB
1 line
4.9 KiB
{"version":3,"file":"collapse-transition.mjs","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":[],"mappings":";;;;;mCASc,CAAA;AAAA,EACZ,IAAM,EAAA,sBAAA;AACR,CAAA,CAAA,CAAA;;;;AAEA,IAAM,MAAA,EAAA,GAAK,aAAa,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,EAAA,CAAG,OAAS;AAEjB,UAAG,EAAA,CAAA,OAAwB,GAAA,EAAA,CAAA;AAC3B,QAAG,EAAA,CAAA,OAAA,CAAQ,aAAmB,GAAA,EAAA,CAAA,KAAS,CAAA,UAAA,CAAA;AACvC,QAAA,EAAA,CAAA,OAAa,CAAA,gBAAmB,GAAA,EAAA,CAAA,KAAA,CAAA,aAAoB,CAAM;AAE1D,QAAA,YAAqB,CAAA,MAAA;AACrB,UAAA,UAAsB,CAAA,cAAA,GAAA,EAAA,CAAA,KAAA,CAAA,MAAA,CAAA;AACtB,QAAA,EAA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