import { useCssVars as V, unref as e, computed as A, ref as k, onMounted as E, openBlock as l, createElementBlock as n, normalizeClass as w, createElementVNode as a, normalizeStyle as i, withKeys as R, createVNode as C, toDisplayString as I, Fragment as m, renderList as p, createCommentVNode as N, renderSlot as $ } from "vue";
import { _ as K } from "./Shape-DNIrFW-J.js";
import O from "./BaseIcon-MqKW8Nkx.js";
import { _ as T } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const j = { class: "vue-ui-data-table" }, F = { style: { display: "flex", "align-items": "center", "justify-content": "flex-end", "padding-right": "3px", gap: "3px" } }, L = {
  key: 0,
  height: "12",
  width: "12",
  viewBox: "0 0 20 20",
  style: { background: "none" }
}, M = ["fill"], q = ["data-cell"], G = {
  dir: "auto",
  style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" }
}, H = {
  key: 0,
  height: "12",
  width: "12",
  viewBox: "0 0 20 20",
  style: { background: "none", overflow: "visible" }
}, J = {
  __name: "DataTable",
  props: {
    colNames: {
      type: Array,
      default() {
        return [];
      }
    },
    head: Array,
    body: Array,
    title: String,
    config: Object
  },
  emits: ["close"],
  setup(t, { emit: B }) {
    V((s) => ({
      "7fc6aa63": e(v)
    }));
    const b = t, { backgroundColor: f, color: y, outline: g } = b.config.th, { backgroundColor: z, color: D, outline: v } = b.config.td, S = A(() => b.config.breakpoint), h = k(null), _ = k(!1);
    E(() => {
      const s = new ResizeObserver((r) => {
        r.forEach((o) => {
          _.value = o.contentRect.width < S.value;
        });
      });
      h.value && s.observe(h.value);
    });
    const x = B;
    return (s, r) => (l(), n("div", {
      ref_key: "tableContainer",
      ref: h,
      style: { width: "100%", "container-type": "inline-size", position: "relative", "padding-top": "36px", overflow: "auto" },
      class: w({ "vue-ui-responsive": e(_) })
    }, [
      a("div", {
        "data-html2canvas-ignore": "",
        role: "button",
        tabindex: "0",
        style: i(`width:32px; position: absolute; top: 0; right:4px; padding: 0 0px; display: flex; align-items:center;justify-content:center;height: 36px; width: 32px; cursor:pointer; background:${e(f)};`),
        onClick: r[0] || (r[0] = (o) => x("close")),
        onKeypress: r[1] || (r[1] = R((o) => x("close"), ["enter"]))
      }, [
        C(O, {
          name: "close",
          stroke: e(y),
          "stroke-width": 2
        }, null, 8, ["stroke"])
      ], 36),
      a("table", j, [
        a("caption", {
          style: i({ backgroundColor: e(f), color: e(y), outline: e(g) }),
          class: "vue-ui-data-table__caption"
        }, I(t.title), 5),
        a("thead", null, [
          a("tr", {
            role: "row",
            style: i([{ "font-variant-numeric": "tabular-nums" }, { backgroundColor: e(f), color: e(y) }]),
            class: "vue-ui-data-table__thead-row"
          }, [
            (l(!0), n(m, null, p(t.head, (o, c) => (l(), n("th", {
              role: "cell",
              style: i({ outline: e(g) }),
              key: `th_${c}`
            }, [
              a("div", F, [
                o.color ? (l(), n("svg", L, [
                  a("circle", {
                    cx: "10",
                    cy: "10",
                    r: "10",
                    fill: o.color
                  }, null, 8, M)
                ])) : N("", !0),
                $(s.$slots, "th", { th: o }, void 0, !0)
              ])
            ], 4))), 128))
          ], 4)
        ]),
        a("tbody", null, [
          (l(!0), n(m, null, p(t.body, (o, c) => (l(), n("tr", {
            role: "row",
            style: i([{ "font-variant-numeric": "tabular-nums" }, { backgroundColor: e(z), color: e(D) }]),
            class: w({ "vue-ui-data-table__tbody__row": !0, "vue-ui-data-table__tbody__row-even": c % 2 === 0, "vue-ui-data-table__tbody__row-odd": c % 2 !== 0 })
          }, [
            (l(!0), n(m, null, p(o, (d, u) => (l(), n("td", {
              role: "cell",
              "data-cell": (t.colNames[u] && t.colNames[u].name ? t.colNames[u].name : "") || t.colNames[u] || "",
              style: i({ outline: e(v) }),
              class: "vue-ui-data-table__tbody__td"
            }, [
              a("div", G, [
                d.color ? (l(), n("svg", H, [
                  C(K, {
                    plot: { x: 10, y: 10 },
                    color: d.color,
                    radius: 9,
                    shape: t.config.shape || d.shape || "circle"
                  }, null, 8, ["color", "shape"])
                ])) : N("", !0),
                $(s.$slots, "td", { td: d }, void 0, !0)
              ])
            ], 12, q))), 256))
          ], 6))), 256))
        ])
      ])
    ], 2));
  }
}, X = /* @__PURE__ */ T(J, [["__scopeId", "data-v-2ff8c36f"]]);
export {
  X as D
};
