UNPKG

@indielayer/ui

Version:

Indielayer UI Components with Tailwind CSS build for Vue 3

83 lines (82 loc) 2.75 kB
import { defineComponent as g, openBlock as o, createElementBlock as n, normalizeStyle as k, unref as s, normalizeClass as a, createElementVNode as r, renderSlot as v, createBlock as c, createCommentVNode as p, Fragment as m } from "vue"; import { useTheme as h } from "../../composables/useTheme.js"; import b from "../tooltip/ToggleTip.vue.js"; const x = { class: "flex items-center gap-1" }, B = { key: 2, d: "m3 9l4-4l4 4M7 5v14m14-4l-4 4l-4-4m4 4V5" }, d = { sort: [1, -1, void 0], textAlign: ["left", "center", "right"] }, A = { sort: { type: Number, validator: (l) => d.sort.includes(l) }, sortable: Boolean, textAlign: { type: String, default: "left", validator: (l) => d.textAlign.includes(l) }, tooltip: String }, C = { name: "XTableHeader", validators: d }, T = /* @__PURE__ */ g({ ...C, props: A, setup(l) { const u = l, { styles: y, classes: i, className: f } = h("TableHeader", {}, u); return (e, t) => (o(), n("th", { style: k(s(y)), class: a([s(f), s(i).th, "group/th"]) }, [ r("div", { class: a(s(i).header) }, [ r("div", x, [ v(e.$slots, "default"), e.tooltip ? (o(), c(b, { key: 0, content: e.tooltip }, null, 8, ["content"])) : p("", !0) ]), e.sortable ? (o(), n("svg", { key: 0, class: a(["shrink-0", [ s(i).sortIcon, e.textAlign === "right" ? "-mr-4 -translate-x-4" : "-ml-4 translate-x-4", [e.sort && [1, -1].includes(e.sort) ? "" : "invisible group-hover/th:visible"], [e.sort !== -1 && e.sort !== 1 ? "text-secondary-400 dark:text-secondary-500" : "text-primary-700 dark:text-primary-400"] ]]), width: "24", height: "24", viewBox: "0 0 24 24", stroke: "currentColor", "stroke-linejoin": "round", "stroke-linecap": "round", fill: "none", role: "presentation" }, [ e.sort === -1 ? (o(), n(m, { key: 0 }, [ t[0] || (t[0] = r("line", { x1: "12", y1: "5", x2: "12", y2: "19" }, null, -1)), t[1] || (t[1] = r("polyline", { points: "19 12 12 19 5 12" }, null, -1)) ], 64)) : e.sort === 1 ? (o(), n(m, { key: 1 }, [ t[2] || (t[2] = r("line", { x1: "12", y1: "19", x2: "12", y2: "5" }, null, -1)), t[3] || (t[3] = r("polyline", { points: "5 12 12 5 19 12" }, null, -1)) ], 64)) : (o(), n("path", B)) ], 2)) : p("", !0) ], 2) ], 6)); } }); export { T as default };