UNPKG

@glodon-aiot/react-components

Version:

aiot react components

60 lines (59 loc) 1.41 kB
var C = Object.defineProperty; var l = Object.getOwnPropertySymbols; var d = Object.prototype.hasOwnProperty, h = Object.prototype.propertyIsEnumerable; var a = (n, t, r) => t in n ? C(n, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[t] = r, u = (n, t) => { for (var r in t || (t = {})) d.call(t, r) && a(n, r, t[r]); if (l) for (var r of l(t)) h.call(t, r) && a(n, r, t[r]); return n; }; import { jsx as o } from "react/jsx-runtime"; import { useState as k, useEffect as y } from "react"; import s from "antd/es/button"; import B from "antd/es/popconfirm"; const b = (n) => { const { name: t, type: r, style: x, className: i, children: c, onConfirm: m } = n, [f, e] = k(null); return y(() => { if (!n.confirm) { e(null); return; } if (n.confirm === !0) { e({ text: `确认${t}吗?` }); return; } e(n.confirm); }, [n.confirm]), f ? /* @__PURE__ */ o(B, { rootClassName: "track-map-popconfirm", okText: "确定", cancelText: "取消", title: f.text, trigger: "click", onConfirm: m, children: /* @__PURE__ */ o(s, { className: i, type: r, style: u({}, x), children: c || t }) }) : /* @__PURE__ */ o(s, { className: i, type: r, onClick: m, children: c || t }); }, j = b; export { j as default };