UNPKG

ant-design-x-vue-next

Version:

Ant Design X for Vue — community continuation aligned with @ant-design/x

89 lines (88 loc) 2.41 kB
import { defineComponent as $, useAttrs as g, computed as a, createVNode as s, mergeProps as _ } from "vue"; import { P as x, b as c } from "../chunks/module-chunk.mjs"; import N from "../locale/useLocale.mjs"; import P from "./style/index.mjs"; const I = /* @__PURE__ */ $({ name: "AXConversationsCreation", inheritAttrs: !1, __name: "Creation", props: { label: { type: Function, default: void 0 }, align: { default: "center" }, prefixCls: { default: "ant-conversations-creation" }, className: { default: "" }, style: { default: () => ({}) }, disabled: { type: Boolean, default: !1 }, icon: { type: Function, default: void 0 }, onClick: { type: Function }, shortcutKeysIcon: null }, emits: ["click"], setup(i, { emit: r }) { const e = i, u = r, o = g(), [d] = N("Conversations"), t = a(() => e.prefixCls || "ant-conversations-creation"), f = a(() => t.value.replace(/-creation$/, "") || "ant-conversations"), [p, m, v] = P(f), y = a(() => e.icon ? typeof e.icon == "function" ? e.icon() : e.icon : s(x, { class: `${t.value}-icon` }, null)), b = a(() => { if (e.label !== void 0 && e.label !== null) return typeof e.label == "function" ? e.label() : e.label; const l = e.shortcutKeysIcon || []; return s("div", { class: c(`${t.value}-label`, { [`${t.value}-label-shortcut-keys-show`]: l.length > 0 }) }, [s("span", null, [d.value.create]), l.length > 0 && s("span", { class: `${t.value}-shortcut-keys` }, [l.map((n) => s("span", { class: `${t.value}-shortcut-key`, key: n }, [n]))])]); }), C = a(() => c(t.value, e.className, o.class, `${t.value}-${e.align || "center"}`, m.value, v, { [`${t.value}-disabled`]: e.disabled })), h = (l) => { var n; e.disabled || ((n = e.onClick) == null || n.call(e, l), u("click", l)); }; return () => { const { class: l, style: n, onClick: S, ...k } = o; return p(s("button", _({ type: "button" }, k, { disabled: e.disabled, onClick: h, style: { ...e.style, ...n }, class: C.value }), [y.value, b.value])); }; } }); export { I as default };