@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/dist/components/Layout/Header/Buttons/LocaleButton.d.ts +4 -1
- package/dist/components/Layout/Header/Buttons/LocaleButton.d.ts.map +1 -1
- package/dist/components/ra-buttons/CreateInDialogButton.d.ts.map +1 -1
- package/dist/components/ra-buttons/EditInDialogButton.d.ts.map +1 -1
- package/dist/components/ra-lists/SimpleList.d.ts +2 -2
- package/dist/components/ra-lists/SimpleList.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +45 -45
- package/dist/react-admin.cjs.js.gz +0 -0
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +2931 -2922
- package/dist/react-admin.es.js.gz +0 -0
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +47 -47
- package/dist/react-admin.umd.js.gz +0 -0
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Layout/Header/Buttons/LocaleButton.tsx +12 -1
- package/src/components/ra-buttons/CreateInDialogButton.tsx +29 -19
- package/src/components/ra-buttons/EditInDialogButton.tsx +23 -22
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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 {
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
-
</
|
|
182
|
-
</
|
|
183
|
-
</
|
|
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 = '
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
</
|
|
151
|
-
</
|
|
152
|
-
</
|
|
151
|
+
</EditBase>
|
|
152
|
+
</DialogContent>
|
|
153
|
+
</Dialog>
|
|
153
154
|
</>
|
|
154
155
|
);
|
|
155
156
|
}
|