@vuesax-alpha/nightly
Version:
A Component Library for Vue 3
80 lines (77 loc) • 2.66 kB
JavaScript
import { defineComponent, ref, watch, nextTick, openBlock, createBlock, Transition, withCtx, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, createCommentVNode } from 'vue';
import '../../../hooks/index.mjs';
import { expandProps } from './expand.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
const _hoisted_1 = ["colspan"];
const __default__ = defineComponent({
name: "VsTableExpand"
});
const _sfc_main = defineComponent({
...__default__,
props: expandProps,
setup(__props) {
const ns = useNamespace("table");
const hidden = ref(true);
const trRef = ref();
const contentRef = ref();
watch(hidden, (val) => {
if (!val) {
nextTick(() => {
const content = contentRef.value;
if (!content)
return;
content.style.height = `${content.scrollHeight}px`;
});
}
});
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, { name: "fade-expand" }, {
default: withCtx(() => [
!hidden.value ? (openBlock(), createElementBlock(
"tr",
{
key: 0,
ref_key: "trRef",
ref: trRef,
class: normalizeClass(unref(ns).be("tr-expand", "row"))
},
[
createElementVNode("td", {
class: normalizeClass(unref(ns).be("tr-expand", "td")),
colspan: _ctx.colspan
}, [
createElementVNode(
"div",
{
ref_key: "contentRef",
ref: contentRef,
class: normalizeClass(unref(ns).be("tr-expand", "content"))
},
[
createElementVNode(
"div",
{
class: normalizeClass(unref(ns).bem("tr-expand", "content", "inner"))
},
[
renderSlot(_ctx.$slots, "default")
],
2
)
],
2
)
], 10, _hoisted_1)
],
2
)) : createCommentVNode("v-if", true)
]),
_: 3
});
};
}
});
var expand = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/vuesax-alpha/vuesax-alpha/packages/components/table/src/expand.vue"]]);
export { expand as default };
//# sourceMappingURL=expand2.mjs.map