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