UNPKG

ant-design-x-vue-next

Version:

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

83 lines (82 loc) 2.31 kB
import { defineComponent as _, useAttrs as g, computed as O, createVNode as r, mergeProps as v, isVNode as x } from "vue"; import { Tooltip as T } from "ant-design-vue"; import { b as R, C as V, f as $ } from "../chunks/module-chunk.mjs"; import { useMobile as h } from "../_util/hooks/use-mobile.mjs"; import "../x-provider/index.mjs"; import { ACTIONS_ITEM_STATUS as i } from "./constants.mjs"; import j from "./style/index.mjs"; import E from "../x-provider/hooks/use-x-provider-context.mjs"; function L(s) { return typeof s == "function" || Object.prototype.toString.call(s) === "[object Object]" && !x(s); } const q = /* @__PURE__ */ _({ name: "AXActionsItem", inheritAttrs: !1, __name: "ActionsItem", props: { status: { default: "default" }, defaultIcon: { default: void 0 }, label: { default: void 0 }, runningIcon: { default: void 0 }, prefixCls: { default: void 0 }, rootClassName: { default: "" }, classNames: { default: () => ({}) }, styles: { default: () => ({}) } }, setup(s) { const t = s, u = g(), m = h(), { direction: p, getPrefixCls: C } = E(), l = C("actions", t.prefixCls), [N, I, A] = j(l), c = `${l}-button-item`, S = O(() => { var e, o, n; return R(c, I.value, A, t.rootClassName, u.class, (e = t.classNames) == null ? void 0 : e.root, l, `${l}-item`, { [`${c}-rtl`]: p.value === "rtl", [`${(o = t.classNames) == null ? void 0 : o[t.status]}`]: (n = t.classNames) == null ? void 0 : n[t.status] }); }); return () => { var d, f; const e = t.status, o = { [i.LOADING]: r($, null, null), [i.ERROR]: r(V, null, null), [i.RUNNING]: t.runningIcon, [i.DEFAULT]: t.defaultIcon }, n = e && o[e] ? o[e] : t.defaultIcon, { class: M, style: b, ...y } = u, a = r("div", v(y, { class: S.value, style: { ...b, ...(d = t.styles) == null ? void 0 : d.root, ...(f = t.styles) == null ? void 0 : f[e] } }), [n]); return N(m.value ? a : r(T, { title: t.label }, L(a) ? a : { default: () => [a] })); }; } }); export { q as default };