import { defineComponent as L, openBlock as l, createElementBlock as i, normalizeClass as n, unref as t, Fragment as o, createVNode as s, withCtx as c, createBlock as d, resolveDynamicComponent as u, h, createElementVNode as y, renderSlot as b, createCommentVNode as S, normalizeStyle as N, createTextVNode as v, toDisplayString as B, renderList as $ } from "vue";
import { Button as M, Empty as T } from "@aplus-frontend/antdv";
import { ApTitle as x } from "../../ap-title/index.mjs";
import "../../../config-provider/index.mjs";
import { useLocale as A } from "../../../config-provider/hooks/use-locale.mjs";
import { useNamespace as V } from "../../../config-provider/hooks/use-namespace.mjs";
const F = /* @__PURE__ */ L({
  __name: "index",
  props: {
    leftTitle: { type: [String, Object, Number, Boolean, null, Array], default: "" },
    rightTitle: {},
    rightContentStyle: { type: [Boolean, null, String, Object, Array] },
    renderSelectedItem: {},
    selectedList: { default: () => [] }
  },
  emits: ["clear", "deleteItem"],
  setup(e, { emit: k }) {
    const { t: m } = A(), f = e, g = k, { m: r } = V("ap-table-modal"), I = () => {
      g("clear");
    }, C = (a) => {
      g("deleteItem", a);
    }, E = (a) => typeof f.rightTitle == "function" ? f.rightTitle(a) : `${m("ap.apTableModal.selected")} (${a})`;
    return (a, D) => (l(), i("div", {
      class: n([
        e.renderSelectedItem ? t(r)("table-layout") : "",
        { "complex-layout": !!e.renderSelectedItem }
      ])
    }, [
      e.renderSelectedItem ? (l(), i(o, { key: 0 }, [
        e.leftTitle ? (l(), i("div", {
          key: 0,
          class: n(t(r)("table-layout-left"))
        }, [
          s(t(x), { style: { "margin-bottom": "16px" } }, {
            prefix: c(() => [
              (l(), d(u(h(o, [e.leftTitle]))))
            ]),
            _: 1
          }),
          y("div", {
            class: n(t(r)("table-layout-left-content"))
          }, [
            b(a.$slots, "default")
          ], 2)
        ], 2)) : S("", !0),
        y("div", {
          class: n(t(r)("table-layout-right")),
          style: N(e.rightContentStyle)
        }, [
          s(t(x), {
            title: `${t(m)("ap.apTableModal.selected")} (${e.selectedList.length})`
          }, {
            prefix: c(() => [
              (l(), d(u(h(o, [E(e.selectedList.length)]))))
            ]),
            suffix: c(() => [
              s(t(M), {
                type: "link",
                style: { padding: "0px", height: "22px", "border-width": "0px" },
                onClick: I
              }, {
                default: c(() => [
                  v(B(t(m)("ap.apTableModal.clear")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["title"]),
          y("div", {
            class: n(t(r)("table-layout-right-content"))
          }, [
            (l(!0), i(o, null, $(e.selectedList, (p) => (l(), d(u(e.renderSelectedItem?.(p, { deleteItem: C })), { key: p }))), 128)),
            e.selectedList.length === 0 ? (l(), d(t(T), {
              key: 0,
              image: t(T).PRESENTED_IMAGE_SIMPLE,
              style: { "margin-top": "100px" }
            }, null, 8, ["image"])) : S("", !0)
          ], 2)
        ], 6)
      ], 64)) : b(a.$slots, "default", { key: 1 })
    ], 2));
  }
});
export {
  F as default
};
