@applica-software-guru/react-admin 1.5.274 → 1.5.276

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
@@ -106,5 +106,5 @@
106
106
  "type": "module",
107
107
  "types": "dist/index.d.ts",
108
108
  "typings": "dist/index.d.ts",
109
- "version": "1.5.274"
109
+ "version": "1.5.276"
110
110
  }
@@ -5,7 +5,11 @@ import { Menu, MenuItem, Stack, Typography } from '@mui/material';
5
5
  import { useLocaleState, useLocales } from 'ra-core';
6
6
  import { Fragment } from 'react/jsx-runtime';
7
7
 
8
- function LocaleButton(): JSX.Element | null {
8
+ type LocaleButtonProps = {
9
+ onClick?: (locale: string) => void;
10
+ };
11
+
12
+ function LocaleButton(props: LocaleButtonProps): JSX.Element | null {
9
13
  const { open, anchorEl, handleClose, handleToggle } = usePopoverState();
10
14
  const [locale, setLocale] = useLocaleState();
11
15
  const locales = useLocales();
@@ -13,6 +17,13 @@ function LocaleButton(): JSX.Element | null {
13
17
  return null;
14
18
  }
15
19
  function handleChooseLocale(locale: string) {
20
+ if (props?.onClick) {
21
+ props.onClick(locale);
22
+ }
23
+ if (locale === locale) {
24
+ return;
25
+ }
26
+
16
27
  setLocale(locale);
17
28
  handleClose();
18
29
  }
@@ -110,7 +110,16 @@ type CreateInDialogButtonProps = PropsWithChildren &
110
110
  onSubmit?: SubmitFunction;
111
111
  };
112
112
  function CreateInDialogButton(props: CreateInDialogButtonProps) {
113
- const { children, maxWidth = 'md', fullWidth = true, fullScreen, onSubmit, mutationOptions, scroll, ...rest } = props;
113
+ const {
114
+ children,
115
+ maxWidth = 'md',
116
+ fullWidth = true,
117
+ fullScreen,
118
+ onSubmit,
119
+ mutationOptions,
120
+ scroll = 'body',
121
+ ...rest
122
+ } = props;
114
123
  const queryClient = useQueryClient();
115
124
  const resource = useResourceContext();
116
125
  const translate = useTranslate();
@@ -144,22 +153,23 @@ function CreateInDialogButton(props: CreateInDialogButtonProps) {
144
153
  return (
145
154
  <>
146
155
  <ResponsiveButton {...(rest as any)} onClick={handleOpen} />
147
- <CreateBase
148
- {...props}
149
- mutationOptions={{
150
- ...mutationOptions,
151
- onSuccess: handleSuccess
152
- }}
156
+
157
+ <Dialog
158
+ open={open}
159
+ scroll={scroll}
160
+ onClose={handleClose}
161
+ maxWidth={maxWidth}
162
+ fullWidth={fullWidth}
163
+ fullScreen={fullScreen}
153
164
  >
154
- <Dialog
155
- open={open}
156
- scroll={scroll}
157
- onClose={handleClose}
158
- maxWidth={maxWidth}
159
- fullWidth={fullWidth}
160
- fullScreen={fullScreen}
161
- >
162
- <DialogContent sx={{ m: 0, p: 0 }}>
165
+ <DialogContent sx={{ m: 0, p: 0 }}>
166
+ <CreateBase
167
+ {...props}
168
+ mutationOptions={{
169
+ ...mutationOptions,
170
+ onSuccess: handleSuccess
171
+ }}
172
+ >
163
173
  {React.isValidElement(Child)
164
174
  ? React.cloneElement(Child, {
165
175
  ...Child.props,
@@ -178,9 +188,9 @@ function CreateInDialogButton(props: CreateInDialogButtonProps) {
178
188
  )
179
189
  })
180
190
  : null}
181
- </DialogContent>
182
- </Dialog>
183
- </CreateBase>
191
+ </CreateBase>
192
+ </DialogContent>
193
+ </Dialog>
184
194
  </>
185
195
  );
186
196
  }
@@ -83,7 +83,7 @@ function EditInDialogButton(props: EditInDialogButtonProps): JSX.Element {
83
83
  fullScreen,
84
84
  mutationOptions,
85
85
  onSubmit,
86
- scroll = 'paper',
86
+ scroll = 'body',
87
87
  ...rest
88
88
  } = props;
89
89
  const notify = useNotify();
@@ -106,25 +106,26 @@ function EditInDialogButton(props: EditInDialogButtonProps): JSX.Element {
106
106
  return (
107
107
  <>
108
108
  <ResponsiveButton {...rest} onClick={handleOpen} />
109
- <EditBase
110
- {...props}
111
- id={record.id}
112
- mutationMode="pessimistic"
113
- mutationOptions={{
114
- ...mutationOptions,
115
- onSuccess: handleSuccess
116
- }}
109
+
110
+ <Dialog
111
+ open={open}
112
+ scroll={scroll}
113
+ onClose={handleClose}
114
+ fullWidth={fullWidth}
115
+ maxWidth={maxWidth}
116
+ fullScreen={fullScreen}
117
+ keepMounted={false}
117
118
  >
118
- <Dialog
119
- open={open}
120
- scroll={scroll}
121
- onClose={handleClose}
122
- fullWidth={fullWidth}
123
- maxWidth={maxWidth}
124
- fullScreen={fullScreen}
125
- keepMounted={false}
126
- >
127
- <DialogContent sx={{ m: 0, p: 0 }}>
119
+ <DialogContent sx={{ m: 0, p: 0 }}>
120
+ <EditBase
121
+ {...props}
122
+ id={record.id}
123
+ mutationMode="pessimistic"
124
+ mutationOptions={{
125
+ ...mutationOptions,
126
+ onSuccess: handleSuccess
127
+ }}
128
+ >
128
129
  {React.isValidElement(Child)
129
130
  ? React.cloneElement(Child, {
130
131
  ...Child.props,
@@ -147,9 +148,9 @@ function EditInDialogButton(props: EditInDialogButtonProps): JSX.Element {
147
148
  )
148
149
  })
149
150
  : null}
150
- </DialogContent>
151
- </Dialog>
152
- </EditBase>
151
+ </EditBase>
152
+ </DialogContent>
153
+ </Dialog>
153
154
  </>
154
155
  );
155
156
  }