import { defineComponent as _, ref as b, openBlock as n, createBlock as r, unref as o, withCtx as i, createElementBlock as p, Fragment as d, renderList as k, mergeProps as g, createElementVNode as C, normalizeClass as f, createVNode as m, Transition as R, withDirectives as L, vShow as M, resolveDynamicComponent as B, h as D } from "vue";
import { LoadingOutlined as I } from "@ant-design/icons-vue";
import { Menu as v, MenuItem as N } from "@aplus-frontend/antdv";
import "../../config-provider/index.mjs";
import O from "./style/index.mjs";
import { useNamespace as S } from "../../config-provider/hooks/use-namespace.mjs";
const T = /* @__PURE__ */ _({
  __name: "MenuItemGroup",
  props: {
    selectedRows: {},
    buttonProps: {},
    menuList: {},
    setOpen: { type: Function }
  },
  setup(h) {
    const a = h, w = O("ap-batch-action-group"), { b: l } = S("ap-batch-action-group-menu-item"), s = b({});
    async function y(c, u) {
      const e = c?.id || u;
      s.value[e] = !0;
      try {
        await c?.onClick?.({ selectedRows: a?.selectedRows });
      } finally {
        a.setOpen(!1), s.value[e] = void 0;
      }
    }
    return (c, u) => (n(), r(o(v), null, {
      default: i(() => [
        (n(!0), p(d, null, k(a.menuList, (e, t) => (n(), p(d, {
          key: e === "divider" ? `divider-${t}` : e?.id || t
        }, [
          e === "divider" ? (n(), r(o(v).Divider, { key: 0 })) : (n(), r(o(N), g({
            key: e?.id || t
          }, { ref_for: !0 }, {
            ...e,
            onClick: () => y(e, t),
            disabled: s.value[e?.id || t] ?? (typeof e?.disabled == "function" ? e?.disabled({ selectedRows: a?.selectedRows }) : e?.disabled) ?? !1
          }), {
            default: i(() => [
              C("div", {
                class: f([o(w), o(l)()])
              }, [
                m(R, {
                  name: o(l)("loading-icon-wrapper-ease")
                }, {
                  default: i(() => [
                    L(m(o(I), {
                      class: f(o(l)("loading-icon"))
                    }, null, 8, ["class"]), [
                      [M, s.value[e?.id || t]]
                    ])
                  ]),
                  _: 2
                }, 1032, ["name"]),
                (n(), r(B(D(d, [e?.content]))))
              ], 2)
            ]),
            _: 2
          }, 1040))
        ], 64))), 128))
      ]),
      _: 1
    }));
  }
});
export {
  T as default
};
