@vuesax-alpha/nightly
Version:
A Component Library for Vue 3
63 lines (60 loc) • 2.06 kB
JavaScript
import { defineComponent, ref, computed, onMounted, openBlock, createElementBlock, normalizeClass, createElementVNode, unref, renderSlot, createVNode, createCommentVNode } from 'vue';
import { IconArrow } from '../../icon/index.mjs';
import '../../../hooks/index.mjs';
import { tableThProps } from './th.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
const __default__ = defineComponent({
name: "VsTh"
});
const _sfc_main = defineComponent({
...__default__,
props: tableThProps,
setup(__props) {
const props = __props;
const ns = useNamespace("table");
const thRef = ref();
const thKls = computed(() => [ns.b("th"), ns.is("sort", props.sort)]);
onMounted(() => {
thRef.value.style.width = `${thRef.value.scrollWidth}px`;
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock(
"th",
{
ref_key: "thRef",
ref: thRef,
class: normalizeClass(thKls.value)
},
[
createElementVNode(
"div",
{
class: normalizeClass(unref(ns).be("th", "content"))
},
[
renderSlot(_ctx.$slots, "default"),
_ctx.sort ? (openBlock(), createElementBlock(
"div",
{
key: 0,
class: normalizeClass(unref(ns).be("th", "icons"))
},
[
createVNode(unref(IconArrow), { class: "icon-sort-1" }),
createVNode(unref(IconArrow), { class: "icon-sort-2" })
],
2
)) : createCommentVNode("v-if", true)
],
2
)
],
2
);
};
}
});
var Th = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/vuesax-alpha/vuesax-alpha/packages/components/table/src/th.vue"]]);
export { Th as default };
//# sourceMappingURL=th2.mjs.map