UNPKG

@aplus-frontend/ui

Version:

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