UNPKG

ra-core

Version:

Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React

19 lines 917 B
import * as React from 'react'; import { Translate } from "../i18n/Translate.js"; import { useDeleteController, } from "../controller/button/useDeleteController.js"; import { useRecordContext } from "../controller/record/useRecordContext.js"; export const DeleteButton = (props) => { const record = useRecordContext(); const controllerProps = useDeleteController({ record, mutationMode: 'optimistic', ...props, }); return (React.createElement("button", { type: "button", onClick: event => { event.stopPropagation(); controllerProps.handleDelete(); } }, typeof props.label !== 'string' ? (props.label) : (React.createElement(Translate, { i18nKey: typeof props.label === 'string' ? props.label : 'ra.action.delete' }, typeof props.label === 'string' ? props.label : 'Delete')))); }; //# sourceMappingURL=DeleteButton.js.map