|
1 | 1 | import * as React from 'react'; |
2 | | -import { UseMutationOptions } from '@tanstack/react-query'; |
3 | 2 | import { |
4 | 3 | RaRecord, |
5 | | - MutationMode, |
6 | | - DeleteParams, |
7 | 4 | useRecordContext, |
8 | 5 | useSaveContext, |
9 | 6 | SaveContextValue, |
10 | | - RedirectionSideEffect, |
11 | 7 | useResourceContext, |
12 | 8 | useCanAccess, |
13 | 9 | } from 'ra-core'; |
14 | 10 | import { useThemeProps } from '@mui/material/styles'; |
15 | 11 |
|
16 | | -import { ButtonProps } from './Button'; |
17 | | -import { DeleteWithUndoButton } from './DeleteWithUndoButton'; |
18 | | -import { DeleteWithConfirmButton } from './DeleteWithConfirmButton'; |
| 12 | +import { |
| 13 | + DeleteWithUndoButton, |
| 14 | + DeleteWithUndoButtonProps, |
| 15 | +} from './DeleteWithUndoButton'; |
| 16 | +import { |
| 17 | + DeleteWithConfirmButton, |
| 18 | + DeleteWithConfirmButtonProps, |
| 19 | +} from './DeleteWithConfirmButton'; |
19 | 20 |
|
20 | 21 | /** |
21 | 22 | * Button used to delete a single record. Added by default by the <Toolbar> of edit and show views. |
@@ -95,26 +96,14 @@ export const DeleteButton = <RecordType extends RaRecord = any>( |
95 | 96 | ); |
96 | 97 | }; |
97 | 98 |
|
98 | | -export interface DeleteButtonProps< |
| 99 | +export type DeleteButtonProps< |
99 | 100 | RecordType extends RaRecord = any, |
100 | 101 | MutationOptionsError = unknown, |
101 | | -> extends ButtonProps, |
102 | | - SaveContextValue { |
103 | | - confirmTitle?: React.ReactNode; |
104 | | - confirmContent?: React.ReactNode; |
105 | | - confirmColor?: 'primary' | 'warning'; |
106 | | - icon?: React.ReactNode; |
107 | | - mutationMode?: MutationMode; |
108 | | - mutationOptions?: UseMutationOptions< |
109 | | - RecordType, |
110 | | - MutationOptionsError, |
111 | | - DeleteParams<RecordType> |
112 | | - >; |
113 | | - record?: RecordType; |
114 | | - redirect?: RedirectionSideEffect; |
115 | | - resource?: string; |
116 | | - successMessage?: string; |
117 | | -} |
| 102 | +> = SaveContextValue & |
| 103 | + ( |
| 104 | + | DeleteWithUndoButtonProps<RecordType, MutationOptionsError> |
| 105 | + | DeleteWithConfirmButtonProps<RecordType, MutationOptionsError> |
| 106 | + ); |
118 | 107 |
|
119 | 108 | const PREFIX = 'RaDeleteButton'; |
120 | 109 |
|
|
0 commit comments