@applica-software-guru/react-admin 1.5.341 → 1.5.343

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -108,5 +108,5 @@
108
108
  "type": "module",
109
109
  "types": "dist/index.d.ts",
110
110
  "typings": "dist/index.d.ts",
111
- "version": "1.5.341"
111
+ "version": "1.5.343"
112
112
  }
@@ -30,7 +30,7 @@ const StyledMenuPopover = styled(MenuPopover, {
30
30
  }
31
31
  }));
32
32
 
33
- type ActionsMenuProps = PropsWithChildren<{ horizontal?: boolean }>;
33
+ type ActionsMenuProps = PropsWithChildren<{ horizontal?: boolean; disabled?: boolean }>;
34
34
 
35
35
  /**
36
36
  * Allows you to draw a menu of actions grouped within a popover.
@@ -42,7 +42,7 @@ type ActionsMenuProps = PropsWithChildren<{ horizontal?: boolean }>;
42
42
  * <EditButton />
43
43
  * </ActionsMenu>
44
44
  */
45
- function ActionsMenu({ horizontal = false, children }: ActionsMenuProps): React.ReactElement | null {
45
+ function ActionsMenu({ horizontal = false, disabled = false, children }: ActionsMenuProps): React.ReactElement | null {
46
46
  const [open, setOpen] = useState(null);
47
47
  const actionRef = React.useRef(null);
48
48
 
@@ -75,7 +75,13 @@ function ActionsMenu({ horizontal = false, children }: ActionsMenuProps): React.
75
75
 
76
76
  return (
77
77
  <StyledRoot>
78
- <IconButton aria-label="more" aria-haspopup="true" onClick={handleClick} color={open ? 'inherit' : 'default'}>
78
+ <IconButton
79
+ aria-label="more"
80
+ aria-haspopup="true"
81
+ onClick={handleClick}
82
+ color={open ? 'inherit' : 'default'}
83
+ disabled={disabled}
84
+ >
79
85
  {horizontal ? <MoreHoriz /> : <MoreVert />}
80
86
  </IconButton>
81
87
  {/* @ts-ignore */}
@@ -4,9 +4,15 @@ import { Button, useAuthProvider, useRecordContext } from 'react-admin';
4
4
 
5
5
  type ImpersonateUserButtonProps = {
6
6
  label?: string;
7
+ redirect?: string;
8
+ [x: string]: any; // Allow other props to be passed through
7
9
  };
8
10
 
9
- function ImpersonateUserButton({ label = 'ra.auth.sign_in', ...props }: ImpersonateUserButtonProps): JSX.Element {
11
+ function ImpersonateUserButton({
12
+ label = 'ra.auth.sign_in',
13
+ redirect = '/',
14
+ ...props
15
+ }: ImpersonateUserButtonProps): JSX.Element {
10
16
  const record = useRecordContext();
11
17
  const [loading, setLoading] = useState(false);
12
18
  const authProvider = useAuthProvider();
@@ -17,10 +23,10 @@ function ImpersonateUserButton({ label = 'ra.auth.sign_in', ...props }: Imperson
17
23
  setLoading(true);
18
24
  authProvider.impersonate(record?.id).then(() => {
19
25
  setLoading(false);
20
- document.location.href = '/';
26
+ document.location.href = redirect;
21
27
  });
22
28
  },
23
- [authProvider, record?.id]
29
+ [authProvider, record?.id, redirect]
24
30
  );
25
31
  return (
26
32
  <Button