import { defineComponent as u, createElementBlock as t, openBlock as n, normalizeClass as l, createCommentVNode as i, createTextVNode as m, toDisplayString as p, withModifiers as f } from "vue";
import { showContextMenu as C } from "../contextMenu/index.js";
import { rotate as h } from "./domain.js";
const y = ["^data-col-id"], D = /* @__PURE__ */ u({
  __name: "ThCell",
  props: {
    col: {}
  },
  emits: ["delete:column", "expand:column", "change:sort"],
  setup(v, { emit: s }) {
    const c = s;
    function a(o) {
      o.preventDefault();
      const e = [];
      e.length && C(o, e);
    }
    function d(o) {
      var r;
      const e = ((r = o.sort) == null ? void 0 : r.direction) ?? "DESC";
      c("change:sort", {
        colId: o.id,
        direction: h(e, ["DESC", "ASC"])
      });
    }
    return (o, e) => (n(), t("div", {
      class: l(["cell th-cell", { "justify-center": o.col.justify, frozen: o.col.frozen }]),
      "^data-col-id": o.col.id,
      onContextmenu: a
    }, [
      o.col.valueType ? (n(), t("div", {
        key: 0,
        class: l(o.col.valueType)
      }, null, 2)) : i("", !0),
      m(" " + p(o.col.label) + " ", 1),
      o.col.sort ? (n(), t("div", {
        key: 1,
        class: l(["sort", o.col.sort.direction]),
        onClick: e[0] || (e[0] = f(() => d(o.col), ["stop"]))
      }, null, 2)) : i("", !0)
    ], 42, y));
  }
});
export {
  D as default
};
//# sourceMappingURL=ThCell.vue.js.map
