import { defineComponent as I, computed as L, openBlock as n, createElementBlock as y, normalizeStyle as v, normalizeClass as r, unref as e, createElementVNode as i, createBlock as h, withCtx as d, resolveDynamicComponent as M, h as O, Fragment as b, createCommentVNode as S, renderSlot as s, createVNode as p, createTextVNode as T, toDisplayString as k, renderList as V } from "vue";
import { Button as R, Empty as C } from "@aplus-frontend/antdv";
import { ApTitle as B } from "../../ap-title/index.mjs";
import "../../../config-provider/index.mjs";
import { useAgGridModalInject as j } from "../hooks/use-ag-grid-instance.mjs";
import D from "../style/index.mjs";
import { useLocale as z } from "../../../config-provider/hooks/use-locale.mjs";
import { useNamespace as G } from "../../../config-provider/hooks/use-namespace.mjs";
const W = /* @__PURE__ */ I({
  __name: "index",
  props: {
    leftTitle: { type: [String, Object, Number, Boolean, null, Array], default: "" },
    rightContentStyle: { type: [Boolean, null, String, Object, Array] },
    dividerOffset: {},
    bordered: { type: Boolean },
    isReverse: { type: Boolean, default: !0 },
    layoutType: { default: void 0 }
  },
  setup(l) {
    const { t: g } = z(), u = j(), c = l, a = L(() => {
      const t = u?.selectedRows?.value || [];
      return c.isReverse ? [...t].reverse() : t;
    }), x = () => {
      if (c.dividerOffset != null)
        return {
          "--ag-grid-modal-layout-divider-offset": `${c.dividerOffset}px`
        };
    }, E = () => {
      u?.clearAllSelected();
    }, m = (t) => {
      u?.removeSelected(t);
    }, { e: $, m: o, b: A } = G("ag-grid-modal"), N = D("ag-grid-modal");
    return (t, w) => l.layoutType === "two-column" ? (n(), y("div", {
      key: 0,
      class: r([e(A)(), e(o)("table-layout"), l.bordered ? e(o)("bordered") : "", e(N)]),
      style: v(x())
    }, [
      i("div", {
        class: r(e(o)("table-layout-left"))
      }, [
        l.leftTitle ? (n(), h(e(B), {
          key: 0,
          style: { "margin-bottom": "16px" }
        }, {
          prefix: d(() => [
            (n(), h(M(O(b, [l.leftTitle]))))
          ]),
          _: 1
        })) : S("", !0),
        i("div", {
          class: r(e(o)("table-layout-left-content"))
        }, [
          s(t.$slots, "default")
        ], 2)
      ], 2),
      i("div", {
        class: r(e(o)("table-layout-right")),
        style: v(l.rightContentStyle)
      }, [
        p(e(B), null, {
          prefix: d(() => [
            s(t.$slots, "rightTitle", {
              count: a.value.length
            }, () => [
              T(k(`${e(g)("ap.apTableModal.selected")} (${a.value.length})`), 1)
            ])
          ]),
          suffix: d(() => [
            p(e(R), {
              type: "link",
              style: { padding: "0px", height: "22px", "border-width": "0px" },
              onClick: E
            }, {
              default: d(() => [
                T(k(e(g)("ap.apTableModal.clear")), 1)
              ]),
              _: 1
            })
          ]),
          _: 3
        }),
        i("div", {
          class: r(e(o)("table-layout-right-content"))
        }, [
          (n(!0), y(b, null, V(a.value, (f) => s(t.$slots, "renderSelectedItem", {
            key: f,
            record: f,
            actions: { deleteItem: m, deleteCurrent: () => m(f) }
          })), 128)),
          a.value.length === 0 ? (n(), y("div", {
            key: 0,
            class: r(e($)("empty"))
          }, [
            p(e(C), {
              image: e(C).PRESENTED_IMAGE_SIMPLE
            }, null, 8, ["image"])
          ], 2)) : S("", !0)
        ], 2),
        i("div", null, [
          s(t.$slots, "rightBottom", {
            records: a.value,
            actions: { deleteItem: m }
          })
        ])
      ], 6)
    ], 6)) : s(t.$slots, "default", { key: 1 });
  }
});
export {
  W as default
};
