@aplus-frontend/ui
Version:
80 lines (79 loc) • 2.56 kB
JavaScript
import { defineComponent as k, computed as m, unref as c, createBlock as n, openBlock as o, withCtx as A, createElementBlock as a, createCommentVNode as y, Fragment as p, renderList as v, mergeProps as s } from "vue";
import { Space as w } from "@aplus-frontend/antdv";
import "../item/index.vue.mjs";
import "../item-modal/index.vue2.mjs";
import "../item-popconfirm/index.vue2.mjs";
import "../item-dropdown/index.vue2.mjs";
import "../../config-provider/index.mjs";
import { isUndefined as x } from "lodash-unified";
import { useLocale as B } from "../../config-provider/hooks/use-locale.mjs";
import f from "../item-dropdown/index.vue.mjs";
import F from "../item-modal/index.vue.mjs";
import $ from "../item-popconfirm/index.vue.mjs";
import b from "../item/index.vue2.mjs";
const q = /* @__PURE__ */ k({
name: "ApActionGroup",
__name: "index",
props: {
count: { default: 3 },
trigger: { default: () => ["hover"] },
placement: { default: "bottomRight" },
actions: { default: () => [] },
iconFirst: { type: Boolean }
},
setup(_) {
const r = _, { t: g } = B(), l = m(
() => r.actions.filter(
(e) => e.visible || x(e.visible)
)
), d = m(() => c(l).length > r.count), u = m(() => {
const e = c(l);
if (e.length <= r.count)
return {
showActions: e,
menuActions: []
};
let i = e.slice(0, r.count - 1);
return r.iconFirst && (i = i.map((t) => ({
...t,
iconFirst: !0
}))), {
showActions: i,
menuActions: e.slice(r.count - 1)
};
});
return (e, i) => (o(), n(c(w), {
size: 16,
align: "center"
}, {
default: A(() => [
(o(!0), a(p, null, v(u.value.showActions, (t, h) => (o(), a(p, { key: h }, [
t.actions ? (o(), n(f, s({
key: 0,
ref_for: !0
}, t), null, 16)) : t.modalProps ? (o(), n(F, s({
key: 1,
ref_for: !0
}, t), null, 16)) : t.popconfirmProps ? (o(), n($, s({
key: 2,
ref_for: !0
}, t), null, 16)) : (o(), n(b, s({
key: 3,
ref_for: !0
}, t), null, 16))
], 64))), 128)),
d.value ? (o(), n(f, {
key: 0,
actions: u.value.menuActions,
placement: e.placement,
trigger: e.trigger,
text: c(g)("ap.common.more")
}, null, 8, ["actions", "placement", "trigger", "text"])) : y("", !0)
]),
_: 1
}));
}
});
export {
q as default
};