UNPKG

@aplus-frontend/ui

Version:

71 lines (70 loc) 2.46 kB
import { defineComponent as _, useSlots as w, computed as B, ref as m, watch as S, createElementBlock as f, openBlock as v, normalizeClass as d, unref as e, withDirectives as g, createElementVNode as s, renderSlot as p, vShow as k, createCommentVNode as C, createTextVNode as h, toDisplayString as a, createVNode as N, withCtx as R } from "vue"; import { Button as V } from "@aplus-frontend/antdv"; import "../../config-provider/index.mjs"; import { useNamespace as $ } from "../../config-provider/hooks/use-namespace.mjs"; import { useLocale as b } from "../../config-provider/hooks/use-locale.mjs"; const x = { key: 0, class: "selected-desc" }, D = { class: "selected-desc-conut" }, E = { class: "selected-desc-clean" }, j = /* @__PURE__ */ _({ __name: "ApBatchAction", props: { selectedRowKeys: {}, clearAll: {}, showSelected: { type: Boolean, default: !0 } }, setup(y) { const { b: c } = $("ap-batch-action"), { t: r } = b(), l = y, u = w(), A = B(() => l.selectedRowKeys?.length || 0), n = m(!1), i = m(); return S( () => u.header, () => { setTimeout(() => { const t = u.header?.(); t?.length === 1 && t?.[0]?.type?.name === "ASpace" ? n.value = !!Array.prototype.slice.call(i.value?.children?.[0]?.children)?.filter?.((o) => o?.children?.length)?.length : n.value = !!i.value?.children?.length; }); }, { immediate: !0 } ), (t, o) => (v(), f("div", { class: d([e(c)()]) }, [ g(s("div", { ref_key: "headerRef", ref: i, class: d(e(c)("header")) }, [ p(t.$slots, "header") ], 2), [ [k, n.value] ]), s("div", { class: d(e(c)("body")) }, [ p(t.$slots, "prefix"), l.showSelected ? (v(), f("div", x, [ s("div", D, [ h(a(e(r)("ap.apBatchAction.selected")) + " ", 1), s("span", null, a(A.value), 1), h(" " + a(e(r)("ap.apBatchAction.piecesOfData")), 1) ]), s("div", E, [ N(e(V), { type: "link", onClick: o[0] || (o[0] = (H) => l.clearAll && l.clearAll()) }, { default: R(() => [ h(a(e(r)("ap.apBatchAction.empty")), 1) ]), _: 1 }) ]) ])) : C("", !0), p(t.$slots, "suffix") ], 2) ], 2)); } }); export { j as default };