index.js 1.1 KB

123456789101112
  1. import { __awaiter } from "tslib";
  2. import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
  3. import { Button, Popconfirm } from 'antd';
  4. export const DageTableActions = ({ renderBefore, showDelete = true, showEdit = true, size = 'small', onDelete, onEdit, }) => {
  5. const handleEdit = () => {
  6. onEdit === null || onEdit === void 0 ? void 0 : onEdit();
  7. };
  8. const handleDelete = () => __awaiter(void 0, void 0, void 0, function* () {
  9. yield (onDelete === null || onDelete === void 0 ? void 0 : onDelete());
  10. });
  11. return (_jsxs(_Fragment, { children: [renderBefore, showEdit && (_jsx(Button, { className: "dage-table-action__edit", size: size, type: "link", onClick: handleEdit, children: "\u7F16\u8F91" })), showDelete && (_jsx(Popconfirm, { title: "\u5220\u9664\u540E\u65E0\u6CD5\u6062\u590D\uFF0C\u662F\u5426\u5220\u9664?", okText: "\u5220\u9664", cancelText: "\u53D6\u6D88", onConfirm: handleDelete, children: _jsx(Button, { className: "dage-table-action_del", size: size, type: "link", danger: true, children: "\u5220\u9664" }) }))] }));
  12. };