ant-design-x-vue
Version:
Craft AI-driven interfaces effortlessly
66 lines (65 loc) • 1.6 kB
JavaScript
import { defineComponent as d, toRef as u, useSlots as f, computed as s, createVNode as m, mergeProps as y } from "vue";
import { a as b, c as p } from "../../../attachments/Attachments2.mjs";
import { Button as C } from "ant-design-vue";
import { useActionButtonContextInject as x } from "./context.mjs";
const A = /* @__PURE__ */ d({
name: "AXSenderActionButton",
__name: "index",
props: {
action: {},
prefixCls: {},
type: {
default: "text"
},
htmlType: {},
shape: {},
size: {},
loading: {
type: [Boolean, Object]
},
disabled: {
type: Boolean,
default: void 0
},
ghost: {
type: Boolean
},
block: {
type: Boolean
},
danger: {
type: Boolean
},
icon: {},
href: {},
target: {},
title: {},
onClick: {},
onMousedown: {}
},
setup(e) {
const c = b(e, ["action", "type", "disabled", "onClick"]);
u(e, "disabled");
const r = f(), n = x(), l = s(() => {
var o;
const a = n.value.disabled, t = (o = n.value) == null ? void 0 : o[`${e.action}Disabled`];
return e.disabled ?? a ?? t;
}), i = s(() => n.value.prefixCls);
return () => m(C, y({
type: e.type
}, c, {
onClick: (a) => {
var t, o;
l.value || ((o = (t = n.value) == null ? void 0 : t[e.action]) == null || o.call(t), e.onClick && !Array.isArray(e.onClick) && e.onClick(a));
},
class: p(i.value, {
[`${i.value}-disabled`]: l.value
})
}), {
icon: () => r.default()
});
}
});
export {
A as default
};