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