import { defineComponent as O, computed as A, openBlock as u, createElementBlock as k, normalizeClass as a, unref as e, createElementVNode as m, createVNode as r, createCommentVNode as d, createBlock as f, resolveDynamicComponent as D, withCtx as p } from "vue";
import { HolderOutlined as j, VerticalAlignTopOutlined as b, VerticalAlignMiddleOutlined as z, DeleteOutlined as M } from "@ant-design/icons-vue";
import { Space as S, Tooltip as v } from "@aplus-frontend/antdv";
import { useInjectApTable as U } from "../../../context.mjs";
import "../../../../config-provider/index.mjs";
import H from "../images/icon_carst_down.svg.mjs";
import _ from "../images/icon_fill_right.svg.mjs";
import { useInjectSorterMethods as q } from "../sorter/context.mjs";
import { getLabelRenderNode as G } from "../utils.mjs";
import { useNamespace as J } from "../../../../config-provider/hooks/use-namespace.mjs";
import { useLocale as K } from "../../../../config-provider/hooks/use-locale.mjs";
const P = ["src"], ie = /* @__PURE__ */ O({
  __name: "item",
  props: {
    value: {},
    "onUpdate:value": { type: Function },
    level: {},
    open: { type: Boolean }
  },
  emits: ["update:open", "update:value"],
  setup(c, { emit: g }) {
    const n = c, T = g, { b: l, be: h, is: y } = J("ap-column-setting-sortable-item-meta"), { fixedToLeft: C, fixedToRight: w, unFixed: F } = q(), { columnsBackup: V } = U(), { t: s } = K(), i = A(() => {
      const t = V?.value.find(
        (o) => n.value.key === o.key
      );
      return t ? t.lockFixed ?? !1 : !1;
    });
    function x(t) {
      const o = n.value;
      return o.fixed = t, o.children?.forEach((E) => E.fixed = t), o;
    }
    function L() {
      if (i.value)
        return;
      const t = x("left");
      C(t);
    }
    function R() {
      if (i.value)
        return;
      const t = x("right");
      w(t);
    }
    function B() {
      if (i.value)
        return;
      const t = x(void 0);
      F(t);
    }
    function I() {
      T("update:open", !n.open);
    }
    function N() {
      const t = n.value;
      t.show = !1, t.children?.forEach((o) => o.show = !1);
    }
    return (t, o) => (u(), k("div", {
      class: a(e(l)())
    }, [
      m("span", {
        class: a(e(l)("left"))
      }, [
        r(e(j), {
          class: a(e(h)("left", "holder")),
          style: { "font-size": "16px", color: "#abb7cc" }
        }, null, 8, ["class"]),
        m("span", {
          class: a(e(h)("left", "indicator")),
          onClick: I
        }, [
          c.value.children?.length ? (u(), k("img", {
            key: 0,
            alt: "",
            src: n.open ? e(_) : e(H)
          }, null, 8, P)) : d("", !0)
        ], 2),
        m("span", {
          class: a([e(h)("left", "label-wrapper"), e(y)("level2", n.level === 2)])
        }, [
          (u(), f(D(e(G)(c.value.label))))
        ], 2)
      ], 2),
      m("span", {
        class: a(e(l)("right"))
      }, [
        r(e(S), null, {
          default: p(() => [
            n.level !== 2 && c.value.fixed !== "left" ? (u(), f(e(v), {
              key: 0,
              title: i.value ? e(s)("ap.apTable.setting.lockFixed") : e(s)("ap.apTable.setting.fixToLeft")
            }, {
              default: p(() => [
                r(e(b), {
                  rotate: 270,
                  class: a([
                    e(l)("action-icon"),
                    { [e(l)("action-icon-disabled")]: i.value }
                  ]),
                  onClick: L
                }, null, 8, ["class"])
              ]),
              _: 1
            }, 8, ["title"])) : d("", !0),
            n.level !== 2 && c.value.fixed ? (u(), f(e(v), {
              key: 1,
              title: i.value ? e(s)("ap.apTable.setting.lockFixed") : e(s)("ap.apTable.setting.unFixed")
            }, {
              default: p(() => [
                r(e(z), {
                  class: a([
                    e(l)("action-icon"),
                    { [e(l)("action-icon-disabled")]: i.value }
                  ]),
                  onClick: B
                }, null, 8, ["class"])
              ]),
              _: 1
            }, 8, ["title"])) : d("", !0),
            n.level !== 2 && c.value.fixed !== "right" ? (u(), f(e(v), {
              key: 2,
              title: i.value ? e(s)("ap.apTable.setting.lockFixed") : e(s)("ap.apTable.setting.fixToRight")
            }, {
              default: p(() => [
                r(e(b), {
                  rotate: 90,
                  class: a([
                    e(l)("action-icon"),
                    { [e(l)("action-icon-disabled")]: i.value }
                  ]),
                  onClick: R
                }, null, 8, ["class"])
              ]),
              _: 1
            }, 8, ["title"])) : d("", !0),
            c.value.disabled ? d("", !0) : (u(), f(e(v), {
              key: 3,
              title: e(s)("ap.apTable.setting.delete")
            }, {
              default: p(() => [
                r(e(M), {
                  class: a(e(l)("action-icon")),
                  onClick: N
                }, null, 8, ["class"])
              ]),
              _: 1
            }, 8, ["title"]))
          ]),
          _: 1
        })
      ], 2)
    ], 2));
  }
});
export {
  ie as default
};
