@applica-software-guru/react-admin 1.4.199 → 1.4.201

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applica-software-guru/react-admin",
3
- "version": "1.4.199",
3
+ "version": "1.4.201",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -132,8 +132,6 @@ const DefaultState: ILayoutState = {
132
132
 
133
133
  function LayoutProvider(props: ILayoutProviderProps) {
134
134
  const authProvider = useAuthProvider<IApplicaAuthProvider>();
135
- // eslint-disable-next-line no-console
136
- console.log('authProvider: ', authProvider);
137
135
  const identity = useGetIdentity() as UseGetIdentityResult,
138
136
  theme = useTheme(),
139
137
  downMd = useMediaQuery(theme.breakpoints.down('md')),
@@ -2,6 +2,7 @@
2
2
  import {
3
3
  Button,
4
4
  EditContextProvider,
5
+ EditControllerProps,
5
6
  SaveButton,
6
7
  useEditController,
7
8
  useGetOne,
@@ -16,31 +17,39 @@ import { Edit } from '@mui/icons-material';
16
17
  import { Toolbar } from '../ra-forms';
17
18
  import { useAppConfig } from '../../hooks';
18
19
 
19
- type EditInDialogContentProps = {
20
+ type EditInDialogContentProps = EditControllerProps & {
20
21
  onClose: () => void;
21
22
  children: React.ReactElement;
22
23
  };
23
- const EditInDialogContent = ({ onClose, children }: EditInDialogContentProps) => {
24
+ const EditInDialogContent = ({ onClose, children, mutationMode = 'pessimistic', ...props }: EditInDialogContentProps) => {
24
25
  const notify = useNotify();
25
26
  const record = useRecordContext();
26
27
  const resource = useResourceContext();
27
28
  const { id } = record;
28
29
  const { isLoading, data } = useGetOne(resource, { id });
29
30
 
30
- const handleSuccess = useCallback(() => {
31
- notify('ra.notification.updated', {
32
- type: 'info',
33
- messageArgs: {
34
- smart_count: 1
31
+ const handleSuccess = useCallback(
32
+ (...args: any) => {
33
+ notify('ra.notification.updated', {
34
+ type: 'info',
35
+ messageArgs: {
36
+ smart_count: 1
37
+ }
38
+ });
39
+ onClose();
40
+ if (props.onSuccess) {
41
+ props.onSuccess(...args);
35
42
  }
36
- });
37
- onClose();
38
- }, [onClose, notify]);
43
+ },
44
+ [onClose, notify]
45
+ );
39
46
  const { save, saving } = useEditController({
47
+ ...props,
40
48
  resource,
41
49
  id,
42
- mutationMode: 'pessimistic',
50
+ mutationMode,
43
51
  mutationOptions: {
52
+ ...props?.mutationOptions,
44
53
  onSuccess: handleSuccess
45
54
  }
46
55
  });
@@ -67,7 +76,7 @@ const EditInDialogContent = ({ onClose, children }: EditInDialogContentProps) =>
67
76
  );
68
77
  };
69
78
 
70
- export type EditInDialogButtonProps = {
79
+ export type EditInDialogButtonProps = EditControllerProps & {
71
80
  fullWidth?: boolean;
72
81
  maxWidth?: false | Breakpoint | undefined;
73
82
  label?: string;
@@ -80,6 +89,7 @@ export function EditInDialogButton({
80
89
  maxWidth = 'md',
81
90
  label = 'ra.action.edit',
82
91
  style,
92
+ children,
83
93
  ...props
84
94
  }: EditInDialogButtonProps): JSX.Element {
85
95
  const [open, setOpen] = useState(false);
@@ -108,7 +118,9 @@ export function EditInDialogButton({
108
118
  fullWidth={fullWidth}
109
119
  maxWidth={maxWidth}
110
120
  >
111
- <EditInDialogContent onClose={handleClose}>{props?.children}</EditInDialogContent>
121
+ <EditInDialogContent {...props} onClose={handleClose}>
122
+ {children}
123
+ </EditInDialogContent>
112
124
  </Dialog>
113
125
  </>
114
126
  );
@@ -39,9 +39,9 @@ class ErrorEventHandler implements IErrorEventHandler {
39
39
  column: error.colno,
40
40
  stack: error.error?.stack,
41
41
  })
42
- }).catch(() => {
42
+ }).catch((error) => {
43
43
  // eslint-disable-next-line no-console
44
- console.log('Unable to send error to server');
44
+ console.warn('Unable to send error to server', error);
45
45
  this.#handledErrors.delete(hash);
46
46
  });
47
47
  return;