ant-design-x-vue
Version:
Craft AI-driven interfaces effortlessly
117 lines (116 loc) • 2.9 kB
JavaScript
import { defineComponent as I, computed as l, createVNode as s, mergeProps as f, isVNode as P } from "vue";
import { Tooltip as j } from "ant-design-vue";
import { b as c } from "../chunks/module-chunk.mjs";
import V from "../_util/pick-attrs.mjs";
import $ from "../_util/hooks/use-x-component-config.mjs";
import "../x-provider/index.mjs";
import X from "./ActionMenu.mjs";
import w from "./style/index.mjs";
import M from "../x-provider/hooks/use-x-provider-context.mjs";
import { _ as O } from "../chunks/helper-chunk.mjs";
function T(i) {
return typeof i == "function" || Object.prototype.toString.call(i) === "[object Object]" && !P(i);
}
const z = /* @__PURE__ */ I({
name: "AXActions",
__name: "Actions",
props: {
items: {
type: Array,
required: !0,
default: () => []
},
rootClassName: {
type: String,
required: !1,
default: ""
},
block: {
type: Boolean,
required: !1,
default: !1
},
onClick: {
type: Function,
required: !1
},
style: {
required: !1
},
variant: {
type: String,
required: !1,
default: "borderless"
},
prefixCls: {
type: String,
required: !1
}
},
emits: ["click"],
setup(i, {
expose: m,
emit: d
}) {
m();
const r = i, a = d, {
getPrefixCls: C,
direction: y
} = M(), o = C("actions", r.prefixCls), u = $("actions"), [k, v, g] = w(o), x = l(() => c(o, u.value.className, r.rootClassName, g, v.value, {
[`${o}-rtl`]: y.value === "rtl"
})), b = l(() => ({
...u.value.style,
...typeof r.style == "object" ? r.style : {}
})), h = (e, t, n) => t ? s(j, f(n, {
title: t
}), T(e) ? e : {
default: () => [e]
}) : e, S = (e, t, n) => {
if (t.onItemClick) {
t.onItemClick(t);
return;
}
a("click", {
key: e,
item: t,
keyPath: [e],
domEvent: n
});
}, _ = (e) => {
a("click", e);
}, A = (e) => {
const {
icon: t,
label: n,
key: p
} = e;
return s("div", {
class: c(`${o}-list-item`),
onClick: (N) => S(p, e, N),
key: p
}, [h(s("div", {
class: `${o}-list-item-icon`
}, [t]), n)]);
}, q = l(() => V(r, {
aria: !0,
data: !0
}));
return () => k(s("div", f({
class: x.value
}, q.value, {
style: b.value
}), [s("div", {
class: c(`${o}-list`, r.variant, {
block: r.block
})
}, [r.items.map((e) => "children" in e && e.children ? s(X, {
key: e.key,
item: e,
prefixCls: o,
onClick: _
}, null) : A(e))])]));
}
}), Q = /* @__PURE__ */ O(z, [["__file", "/Users/wangzhichao/办公/code/github/ant-design-x-vue-pure/ant-design-x-vue/src/actions/Actions.vue"]]);
export {
Q as default
};