UNPKG

@vuesax-alpha/nightly

Version:
122 lines (119 loc) 4.02 kB
import { defineComponent, provide, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot, createCommentVNode, createElementVNode, createTextVNode, toDisplayString } from 'vue'; import '../../../hooks/index.mjs'; import '../../../tokens/index.mjs'; import { tableProps, tableEmits } from './table.mjs'; import './composables/index.mjs'; import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs'; import { useNamespace } from '../../../hooks/use-namespace/index.mjs'; import { useLocale } from '../../../hooks/use-locale/index.mjs'; import { useTable } from './composables/use-table.mjs'; import { tableContextKey } from '../../../tokens/table.mjs'; const _hoisted_1 = ["colspan"]; const __default__ = defineComponent({ name: "VsTable" }); const _sfc_main = defineComponent({ ...__default__, props: tableProps, emits: tableEmits, setup(__props, { emit }) { const props = __props; const ns = useNamespace("table"); const { t } = useLocale(); const { tableKls, colspan, selected, theadRef } = useTable(props, emit); provide(tableContextKey, { selected, colspan, multiple: computed(() => props.multiple), modelValue: computed(() => props.modelValue) }); return (_ctx, _cache) => { return openBlock(), createElementBlock( "div", { class: normalizeClass(unref(ns).b("wrapper")) }, [ _ctx.$slots.header ? (openBlock(), createElementBlock( "div", { key: 0, class: normalizeClass(unref(ns).be("wrapper", "header")) }, [ renderSlot(_ctx.$slots, "header") ], 2 )) : createCommentVNode("v-if", true), createElementVNode( "div", { class: normalizeClass(unref(tableKls)) }, [ createElementVNode("table", null, [ createElementVNode( "thead", { ref_key: "theadRef", ref: theadRef, class: normalizeClass(unref(ns).e("thead")) }, [ renderSlot(_ctx.$slots, "thead") ], 2 ), createElementVNode( "tbody", { class: normalizeClass(unref(ns).e("tbody")) }, [ renderSlot(_ctx.$slots, "tbody") ], 2 ), createElementVNode( "tbody", { class: normalizeClass(unref(ns).e("not-found")) }, [ createElementVNode("tr", null, [ createElementVNode("td", { colspan: unref(colspan) }, [ renderSlot(_ctx.$slots, "notFound", {}, () => [ createTextVNode( toDisplayString(unref(t)("vs.table.noMatch")), 1 ) ]) ], 8, _hoisted_1) ]) ], 2 ) ]) ], 2 ), _ctx.$slots.footer ? (openBlock(), createElementBlock( "div", { key: 1, class: normalizeClass(unref(ns).e("footer")) }, [ renderSlot(_ctx.$slots, "footer") ], 2 )) : createCommentVNode("v-if", true) ], 2 ); }; } }); var Table = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/vuesax-alpha/vuesax-alpha/packages/components/table/src/table.vue"]]); export { Table as default }; //# sourceMappingURL=table2.mjs.map