import { defineComponent as I, computed as t, useSlots as O, openBlock as l, createBlock as p, unref as r, mergeProps as f, createSlots as S, withCtx as n, createElementVNode as j, normalizeStyle as q, resolveDynamicComponent as g, h as k, createVNode as i, renderList as L, renderSlot as A, normalizeProps as v, guardReactiveProps as b, normalizeClass as F, createCommentVNode as H } from "vue";
import { DownOutlined as J } from "@ant-design/icons-vue";
import { DropdownButton as K, Dropdown as M } from "@aplus-frontend/antdv";
import { useInjectApTable as Q } from "../../ap-table/context.mjs";
import "../../ap-button/index.mjs";
import "../../config-provider/index.mjs";
import "./MenuItemGroup.vue.mjs";
import U from "./style/index.mjs";
import { useNamespace as W } from "../../config-provider/hooks/use-namespace.mjs";
import { useLocale as X } from "../../config-provider/hooks/use-locale.mjs";
import { useGlobalConfig as Y } from "../../config-provider/hooks/use-global-config.mjs";
import B from "./MenuItemGroup.vue2.mjs";
import Z from "../../ap-button/ap-button.vue.mjs";
const me = /* @__PURE__ */ I({
  __name: "ApBatchActionGroup",
  props: {
    selectedRows: {},
    buttonProps: {},
    menuList: {}
  },
  setup(C, { expose: $ }) {
    const { b: h } = W("ap-batch-action-group"), D = U("ap-batch-action-group"), { t: G } = X(), { columns: R, dataSource: T } = Q(), e = C, N = Y("apExportGroup"), x = t(() => N.value?.hasPermission), y = O(), w = t(
      () => e?.buttonProps?.dropdownType || "default"
    ), a = t(
      () => e?.buttonProps?.type || "borderLink"
    ), P = t(
      () => e?.buttonProps?.content || G("ap.apApBatchActionGroup.batchOperation")
    ), z = t(() => e?.selectedRows || []), c = t(
      () => e?.buttonProps?.disabled ?? (Array.isArray(e.selectedRows) ? z.value.length === 0 : !1)
    ), E = t(() => a.value === "borderLink" ? c.value ? void 0 : "var(--ap-button-border-link-color)" : void 0), u = t(() => e?.menuList?.filter((o) => {
      if (o === "divider")
        return !0;
      let d = o?.ifShow;
      return !o?.ifShow && o?.auth && (d = () => x.value?.(o.auth)), d?.() ?? !0;
    }) || []);
    function _() {
      return e?.buttonProps ? {
        ...e.buttonProps,
        type: a.value === "borderLink" ? "default" : a.value
      } : {};
    }
    return $({
      columns: R,
      dataSource: T
    }), (o, d) => u.value.length && w.value === "dropdown" ? (l(), p(r(K), f({
      key: 0,
      class: [r(h)(), r(D)]
    }, {
      ...o.$attrs,
      ..._(),
      disabled: c.value
    }), S({
      overlay: n(() => [
        i(B, f({
          ...e
        }, { "menu-list": u.value }), null, 16, ["menu-list"])
      ]),
      default: n(() => [
        j("span", {
          style: q({
            color: E.value
          })
        }, [
          (l(), p(g(k("span", [P.value]))))
        ], 4)
      ]),
      _: 2
    }, [
      L(y, (V, s) => ({
        name: s,
        fn: n((m) => [
          A(o.$slots, s, v(b(m || {})))
        ])
      }))
    ]), 1040, ["class"])) : u.value.length && w.value === "default" ? (l(), p(r(M), {
      key: 1,
      class: F([r(h)()]),
      disabled: c.value
    }, S({
      overlay: n(() => [
        i(B, f({
          ...e
        }, { "menu-list": u.value }), null, 16, ["menu-list"])
      ]),
      default: n(() => [
        i(r(Z), v(b({
          ...o.$attrs,
          ..._(),
          type: a.value
        })), {
          default: n(() => [
            (l(), p(g(k("span", [P.value])))),
            i(r(J))
          ]),
          _: 1
        }, 16)
      ]),
      _: 2
    }, [
      L(y, (V, s) => ({
        name: s,
        fn: n((m) => [
          A(o.$slots, s, v(b(m || {})))
        ])
      }))
    ]), 1032, ["class", "disabled"])) : H("", !0);
  }
});
export {
  me as default
};
