@applica-software-guru/react-admin 1.5.228 → 1.5.230
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/.eslintrc +2 -1
- package/.husky/pre-commit +1 -1
- package/dist/components/@extended/AnimateButton.d.ts +3 -4
- package/dist/components/@extended/AnimateButton.d.ts.map +1 -1
- package/dist/components/@extended/Avatar.d.ts +3 -4
- package/dist/components/@extended/Avatar.d.ts.map +1 -1
- package/dist/components/@extended/IconButton.d.ts +10 -5
- package/dist/components/@extended/IconButton.d.ts.map +1 -1
- package/dist/components/@extended/LoadingButton.d.ts +12 -5
- package/dist/components/@extended/LoadingButton.d.ts.map +1 -1
- package/dist/components/@extended/Tooltip.d.ts +3 -4
- package/dist/components/@extended/Tooltip.d.ts.map +1 -1
- package/dist/components/@extended/Transitions.d.ts +7 -7
- package/dist/components/@extended/Transitions.d.ts.map +1 -1
- package/dist/components/ActionsMenu.d.ts +3 -4
- package/dist/components/ActionsMenu.d.ts.map +1 -1
- package/dist/components/AppStateProvider.d.ts +3 -2
- package/dist/components/AppStateProvider.d.ts.map +1 -1
- package/dist/components/AuthCard.d.ts +3 -5
- package/dist/components/AuthCard.d.ts.map +1 -1
- package/dist/components/AuthWrapper.d.ts +3 -4
- package/dist/components/AuthWrapper.d.ts.map +1 -1
- package/dist/components/Layout/MenuProvider.d.ts +4 -5
- package/dist/components/Layout/MenuProvider.d.ts.map +1 -1
- package/dist/components/Layout/Navigation/NavList.d.ts +3 -4
- package/dist/components/Layout/Navigation/NavList.d.ts.map +1 -1
- package/dist/components/Layout/ThemeProvider.d.ts +3 -4
- package/dist/components/Layout/ThemeProvider.d.ts.map +1 -1
- package/dist/components/MenuPopover/MenuPopover.d.ts +3 -4
- package/dist/components/MenuPopover/MenuPopover.d.ts.map +1 -1
- package/dist/components/ra-buttons/CreateInDialogButton.d.ts +3 -4
- package/dist/components/ra-buttons/CreateInDialogButton.d.ts.map +1 -1
- package/dist/components/ra-buttons/EditInDialogButton.d.ts +3 -4
- package/dist/components/ra-buttons/EditInDialogButton.d.ts.map +1 -1
- package/dist/components/ra-fields/ReadonlyField.d.ts +3 -4
- package/dist/components/ra-fields/ReadonlyField.d.ts.map +1 -1
- package/dist/components/ra-forms/CardForm.d.ts +5 -7
- package/dist/components/ra-forms/CardForm.d.ts.map +1 -1
- package/dist/components/ra-forms/Create.d.ts +5 -5
- package/dist/components/ra-forms/Create.d.ts.map +1 -1
- package/dist/components/ra-forms/TabbedForm.d.ts +2 -4
- package/dist/components/ra-forms/TabbedForm.d.ts.map +1 -1
- package/dist/components/ra-inputs/LabeledArrayInput.d.ts +3 -4
- package/dist/components/ra-inputs/LabeledArrayInput.d.ts.map +1 -1
- package/dist/components/ra-inputs/ReferenceArrayInput.d.ts +2 -4
- package/dist/components/ra-inputs/ReferenceArrayInput.d.ts.map +1 -1
- package/dist/components/ra-inputs/ReferenceInput.d.ts +2 -4
- package/dist/components/ra-inputs/ReferenceInput.d.ts.map +1 -1
- package/dist/components/ra-lists/Datagrid/DatagridContextProvider.d.ts +5 -4
- package/dist/components/ra-lists/Datagrid/DatagridContextProvider.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +42 -42
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +3400 -3405
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +45 -45
- package/dist/react-admin.umd.js.map +1 -1
- package/dist/themes/index.d.ts +0 -7
- package/dist/themes/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/@extended/AnimateButton.tsx +3 -3
- package/src/components/@extended/Avatar.tsx +3 -3
- package/src/components/@extended/IconButton.tsx +5 -7
- package/src/components/@extended/LoadingButton.tsx +5 -7
- package/src/components/@extended/Tooltip.tsx +5 -6
- package/src/components/@extended/Transitions.tsx +3 -4
- package/src/components/ActionsMenu.tsx +2 -5
- package/src/components/AppStateProvider.tsx +6 -2
- package/src/components/AuthCard.tsx +4 -5
- package/src/components/AuthWrapper.tsx +3 -4
- package/src/components/Layout/MenuProvider.tsx +4 -5
- package/src/components/Layout/Navigation/NavList.tsx +2 -4
- package/src/components/Layout/ThemeProvider.tsx +3 -5
- package/src/components/MenuPopover/MenuPopover.tsx +3 -4
- package/src/components/ra-buttons/CreateInDialogButton.tsx +68 -65
- package/src/components/ra-buttons/EditInDialogButton.tsx +25 -22
- package/src/components/ra-fields/ReadonlyField.tsx +16 -14
- package/src/components/ra-forms/CardForm.tsx +9 -10
- package/src/components/ra-forms/Create.tsx +7 -7
- package/src/components/ra-forms/TabbedForm.tsx +4 -4
- package/src/components/ra-inputs/LabeledArrayInput.tsx +3 -4
- package/src/components/ra-inputs/ReferenceArrayInput.tsx +6 -7
- package/src/components/ra-inputs/ReferenceInput.tsx +5 -6
- package/src/components/ra-lists/Datagrid/DatagridContextProvider.tsx +5 -8
- package/src/playground/.prettierrc +1 -1
- package/src/playground/components/pages/CustomPage.jsx +6 -1
- package/src/playground/components/ra-forms/DeviceForm.jsx +8 -1
- package/src/playground/components/ra-lists/DeviceList.jsx +9 -1
- package/src/playground/components/ra-lists/I18nMessageList.jsx +9 -1
- package/src/themes/index.tsx +0 -6
package/dist/themes/index.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { getColors } from './getColors';
|
|
2
2
|
import { getShadow } from './getShadow';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { PropsWithChildren } from 'react';
|
|
5
4
|
type ThemeCustomizationProps = PropsWithChildren<{
|
|
6
5
|
themeOverrides: unknown;
|
|
7
6
|
}>;
|
|
8
7
|
declare function ThemeCustomization({ themeOverrides, children }: ThemeCustomizationProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
declare namespace ThemeCustomization {
|
|
10
|
-
var propTypes: {
|
|
11
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
12
|
-
themeOverrides: PropTypes.Requireable<object>;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
8
|
export { ThemeCustomization, getColors as getThemeColor, getShadow as getThemeShadow };
|
|
16
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/themes/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAUxC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/themes/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAUxC,OAAO,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAEnD,KAAK,uBAAuB,GAAG,iBAAiB,CAAC;IAAE,cAAc,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAE9E,iBAAS,kBAAkB,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,uBAAuB,2CAiEhF;AAED,OAAO,EAAE,kBAAkB,EAAE,SAAS,IAAI,aAAa,EAAE,SAAS,IAAI,cAAc,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { motion, useCycle } from 'framer-motion';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
2
3
|
|
|
3
|
-
type AnimateButtonProps = {
|
|
4
|
-
children: React.ReactNode;
|
|
4
|
+
type AnimateButtonProps = PropsWithChildren<{
|
|
5
5
|
type?: 'rotate' | 'slide' | 'scale';
|
|
6
6
|
direction?: 'up' | 'down' | 'left' | 'right';
|
|
7
7
|
offset?: number;
|
|
8
8
|
scale?: number | { hover: number; tap: number };
|
|
9
|
-
}
|
|
9
|
+
}>;
|
|
10
10
|
|
|
11
11
|
function AnimateButton({
|
|
12
12
|
children,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getColors } from '@/themes/getColors';
|
|
2
2
|
import { default as MuiAvatar } from '@mui/material/Avatar';
|
|
3
3
|
import { Theme, styled, useTheme } from '@mui/material/styles';
|
|
4
|
+
import { PropsWithChildren } from 'react';
|
|
4
5
|
|
|
5
6
|
type GetColorStyleProps = {
|
|
6
7
|
theme: any;
|
|
@@ -101,13 +102,12 @@ const AvatarStyle = styled(MuiAvatar, {
|
|
|
101
102
|
})
|
|
102
103
|
}));
|
|
103
104
|
|
|
104
|
-
type AvatarProps = {
|
|
105
|
-
children: React.ReactNode;
|
|
105
|
+
type AvatarProps = PropsWithChildren<{
|
|
106
106
|
color: string;
|
|
107
107
|
type: 'filled' | 'outlined' | 'combined';
|
|
108
108
|
size: 'badge' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
109
109
|
variant: 'circular' | 'rounded' | 'square';
|
|
110
|
-
}
|
|
110
|
+
}>;
|
|
111
111
|
|
|
112
112
|
function Avatar({ variant = 'circular', children, color = 'primary', type, size = 'md', ...others }: AvatarProps) {
|
|
113
113
|
const theme = useTheme();
|
|
@@ -2,7 +2,7 @@ import { getColors } from '@/themes/getColors';
|
|
|
2
2
|
import { getShadow } from '@/themes/getShadow';
|
|
3
3
|
import { default as MuiIconButton } from '@mui/material/IconButton';
|
|
4
4
|
import { Theme, alpha, styled, useTheme } from '@mui/material/styles';
|
|
5
|
-
import { forwardRef } from 'react';
|
|
5
|
+
import { PropsWithChildren, forwardRef } from 'react';
|
|
6
6
|
|
|
7
7
|
type GetColorStyleProps = {
|
|
8
8
|
variant: string;
|
|
@@ -91,13 +91,12 @@ function getColorStyle({ variant, theme, color }: GetColorStyleProps) {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
type IconButtonStyleProps = {
|
|
94
|
+
type IconButtonStyleProps = PropsWithChildren<{
|
|
95
95
|
variant: string;
|
|
96
96
|
shape: string;
|
|
97
|
-
children: React.ReactNode;
|
|
98
97
|
color: string;
|
|
99
98
|
theme: Theme;
|
|
100
|
-
}
|
|
99
|
+
}>;
|
|
101
100
|
|
|
102
101
|
const IconButtonStyle = styled(MuiIconButton, {
|
|
103
102
|
shouldForwardProp: (prop) => prop !== 'variant' && prop !== 'shape'
|
|
@@ -143,12 +142,11 @@ const IconButtonStyle = styled(MuiIconButton, {
|
|
|
143
142
|
...getColorStyle({ variant, theme, color })
|
|
144
143
|
}));
|
|
145
144
|
|
|
146
|
-
type IconButtonProps = {
|
|
145
|
+
type IconButtonProps = PropsWithChildren<{
|
|
147
146
|
variant?: string;
|
|
148
147
|
shape?: string;
|
|
149
|
-
children: React.ReactNode;
|
|
150
148
|
color?: string;
|
|
151
|
-
}
|
|
149
|
+
}>;
|
|
152
150
|
|
|
153
151
|
const IconButton = forwardRef(
|
|
154
152
|
({ variant = 'text', shape = 'square', children, color = 'primary', ...others }: IconButtonProps, ref) => {
|
|
@@ -2,7 +2,7 @@ import { getColors } from '@/themes/getColors';
|
|
|
2
2
|
import { getShadow } from '@/themes/getShadow';
|
|
3
3
|
import { default as MuiLoadingButton } from '@mui/lab/LoadingButton';
|
|
4
4
|
import { Theme, alpha, styled, useTheme } from '@mui/material/styles';
|
|
5
|
-
import { forwardRef } from 'react';
|
|
5
|
+
import { PropsWithChildren, forwardRef } from 'react';
|
|
6
6
|
|
|
7
7
|
type GetColorStyleProps = {
|
|
8
8
|
variant: string;
|
|
@@ -121,15 +121,14 @@ function getColorStyle({ variant, theme, color, loadingPosition }: GetColorStyle
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
type LoadingButtonStyleProps = {
|
|
124
|
+
type LoadingButtonStyleProps = PropsWithChildren<{
|
|
125
125
|
variant: string;
|
|
126
126
|
shape: string;
|
|
127
|
-
children: React.ReactNode;
|
|
128
127
|
color: string;
|
|
129
128
|
loading: boolean;
|
|
130
129
|
loadingPosition: string;
|
|
131
130
|
theme: Theme;
|
|
132
|
-
}
|
|
131
|
+
}>;
|
|
133
132
|
|
|
134
133
|
const LoadingButtonStyle = styled(MuiLoadingButton, {
|
|
135
134
|
shouldForwardProp: (prop) => prop !== 'shape' && prop !== 'variant'
|
|
@@ -207,14 +206,13 @@ const LoadingButtonStyle = styled(MuiLoadingButton, {
|
|
|
207
206
|
}
|
|
208
207
|
}));
|
|
209
208
|
|
|
210
|
-
type LoadingButtonProps = {
|
|
209
|
+
type LoadingButtonProps = PropsWithChildren<{
|
|
211
210
|
variant?: 'text' | 'outlined' | 'contained';
|
|
212
211
|
shape: string;
|
|
213
|
-
children: React.ReactNode;
|
|
214
212
|
loading: boolean;
|
|
215
213
|
loadingPosition: 'center' | 'start' | 'end';
|
|
216
214
|
color: 'inherit' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | undefined;
|
|
217
|
-
}
|
|
215
|
+
}>;
|
|
218
216
|
|
|
219
217
|
const LoadingButton = forwardRef(
|
|
220
218
|
(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getColors } from '@/themes/getColors';
|
|
2
2
|
import { Box, Tooltip as MuiTooltip, tooltipClasses } from '@mui/material';
|
|
3
3
|
import { styled, useTheme } from '@mui/material/styles';
|
|
4
|
+
import { PropsWithChildren } from 'react';
|
|
4
5
|
|
|
5
6
|
type GetVariantStyleProps = {
|
|
6
7
|
color: string;
|
|
@@ -37,12 +38,11 @@ function getVariantStyle({ color, theme, labelColor }: GetVariantStyleProps) {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
type TooltipStyleProps = {
|
|
41
|
+
type TooltipStyleProps = PropsWithChildren<{
|
|
41
42
|
color: string;
|
|
42
43
|
labelColor: string;
|
|
43
|
-
children: React.ReactNode;
|
|
44
44
|
title: string;
|
|
45
|
-
}
|
|
45
|
+
}>;
|
|
46
46
|
|
|
47
47
|
const TooltipStyle = styled(
|
|
48
48
|
// @ts-ignore
|
|
@@ -54,12 +54,11 @@ const TooltipStyle = styled(
|
|
|
54
54
|
...(color && getVariantStyle({ color, theme, labelColor }))
|
|
55
55
|
}));
|
|
56
56
|
|
|
57
|
-
type TooltipProps = {
|
|
58
|
-
children: React.ReactNode;
|
|
57
|
+
type TooltipProps = PropsWithChildren<{
|
|
59
58
|
arrow: boolean;
|
|
60
59
|
labelColor?: string;
|
|
61
60
|
rest: any;
|
|
62
|
-
}
|
|
61
|
+
}>;
|
|
63
62
|
|
|
64
63
|
function Tooltip({ children, arrow, labelColor = '', ...rest }: TooltipProps) {
|
|
65
64
|
const theme = useTheme();
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Box, Collapse, Fade, Grow, Slide, Zoom } from '@mui/material';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
2
|
+
import { PropsWithChildren, forwardRef } from 'react';
|
|
3
3
|
|
|
4
|
-
type TransitionsProps = {
|
|
5
|
-
children: React.ReactNode;
|
|
4
|
+
type TransitionsProps = PropsWithChildren<{
|
|
6
5
|
type?: 'grow' | 'fade' | 'collapse' | 'slide' | 'zoom';
|
|
7
6
|
position?: 'top-left' | 'top-right' | 'top' | 'bottom-left' | 'bottom-right' | 'bottom';
|
|
8
7
|
direction?: 'up' | 'down' | 'left' | 'right';
|
|
9
|
-
}
|
|
8
|
+
}>;
|
|
10
9
|
|
|
11
10
|
const Transitions = forwardRef(
|
|
12
11
|
({ children, position = 'top-left', type = 'grow', direction = 'up', ...others }: TransitionsProps, ref) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MenuPopover } from '@/components/MenuPopover';
|
|
2
2
|
import { MoreHoriz, MoreVert } from '@mui/icons-material';
|
|
3
3
|
import { IconButton, MenuItem, styled } from '@mui/material';
|
|
4
|
-
import React, { Children, useCallback, useState } from 'react';
|
|
4
|
+
import React, { Children, PropsWithChildren, useCallback, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
const BUTTON_STYLES = { width: '100%', justifyContent: 'flex-start' };
|
|
7
7
|
|
|
@@ -25,10 +25,7 @@ const StyledMenuPopover = styled(MenuPopover, {
|
|
|
25
25
|
}
|
|
26
26
|
}));
|
|
27
27
|
|
|
28
|
-
type ActionsMenuProps = {
|
|
29
|
-
children: React.ReactNode;
|
|
30
|
-
horizontal?: boolean;
|
|
31
|
-
};
|
|
28
|
+
type ActionsMenuProps = PropsWithChildren<{ horizontal?: boolean }>;
|
|
32
29
|
|
|
33
30
|
/**
|
|
34
31
|
* Allows you to draw a menu of actions grouped within a popover.
|
|
@@ -28,7 +28,11 @@ const initialState: AppState = {
|
|
|
28
28
|
|
|
29
29
|
const AppStateContext = createContext<AppState>(initialState);
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
type AppStateProviderProps = {
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function AppStateProvider(props: AppStateProviderProps) {
|
|
32
36
|
const [config, setConfig] = useState<AppState>(initialState);
|
|
33
37
|
function openDialog(id: string, callback: () => void) {
|
|
34
38
|
setConfig((config: AppState) => ({ ...config, openDialogs: [...config.openDialogs, id] }));
|
|
@@ -55,7 +59,7 @@ function AppStateProvider({ children }: { children: React.ReactNode }) {
|
|
|
55
59
|
getCurrentDialog
|
|
56
60
|
}}
|
|
57
61
|
>
|
|
58
|
-
{children}
|
|
62
|
+
{props.children}
|
|
59
63
|
</AppStateContext.Provider>
|
|
60
64
|
);
|
|
61
65
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MainCard } from '@/components/MainCard';
|
|
2
2
|
import { Box } from '@mui/material';
|
|
3
3
|
import { useTheme } from '@mui/material/styles';
|
|
4
|
+
import { PropsWithChildren } from 'react';
|
|
4
5
|
|
|
5
|
-
type AuthCardProps =
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
function AuthCard({ children, ...other }: AuthCardProps) {
|
|
6
|
+
type AuthCardProps = PropsWithChildren;
|
|
7
|
+
|
|
8
|
+
function AuthCard({ children }: AuthCardProps) {
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
return (
|
|
11
11
|
<MainCard
|
|
@@ -18,7 +18,6 @@ function AuthCard({ children, ...other }: AuthCardProps) {
|
|
|
18
18
|
}
|
|
19
19
|
}}
|
|
20
20
|
content={false}
|
|
21
|
-
{...other}
|
|
22
21
|
border={false}
|
|
23
22
|
boxShadow
|
|
24
23
|
// @ts-ignore
|
|
@@ -3,16 +3,15 @@ import { AuthCard } from '@/components/AuthCard';
|
|
|
3
3
|
import { Footer } from '@/components/Layout/Footer';
|
|
4
4
|
import { MainIcon } from '@/components/MainIcon';
|
|
5
5
|
import { Box, Grid } from '@mui/material';
|
|
6
|
-
import React from 'react';
|
|
6
|
+
import React, { PropsWithChildren } from 'react';
|
|
7
7
|
|
|
8
|
-
type AuthWrapperProps = {
|
|
8
|
+
type AuthWrapperProps = PropsWithChildren<{
|
|
9
9
|
version: string;
|
|
10
10
|
name: string;
|
|
11
11
|
copy?: string;
|
|
12
12
|
background?: React.ReactNode | React.ComponentType;
|
|
13
|
-
children: React.ReactNode;
|
|
14
13
|
logo?: React.ReactNode;
|
|
15
|
-
}
|
|
14
|
+
}>;
|
|
16
15
|
|
|
17
16
|
function AuthWrapper({ version, name, copy, children, logo, background = AuthBackground }: AuthWrapperProps) {
|
|
18
17
|
return (
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useResourceDefinitions,
|
|
10
10
|
useTranslate
|
|
11
11
|
} from 'ra-core';
|
|
12
|
-
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
12
|
+
import { PropsWithChildren, createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
13
13
|
import { useLocation } from 'react-router';
|
|
14
14
|
|
|
15
15
|
type MenuItem = {
|
|
@@ -252,13 +252,12 @@ const initialState: MenuProviderContextProps = {
|
|
|
252
252
|
setMenu: notImplemented
|
|
253
253
|
};
|
|
254
254
|
|
|
255
|
-
type MenuProviderProps = {
|
|
255
|
+
type MenuProviderProps = PropsWithChildren<{
|
|
256
256
|
menu: MenuItem[];
|
|
257
|
-
|
|
258
|
-
};
|
|
257
|
+
}>;
|
|
259
258
|
const MenuContext = createContext<MenuProviderContextProps>(initialState);
|
|
260
259
|
|
|
261
|
-
function MenuConfigProvider({ menu, children }: MenuProviderProps)
|
|
260
|
+
function MenuConfigProvider({ menu, children }: MenuProviderProps) {
|
|
262
261
|
const [menuConfig, setMenuConfig] = useState<MenuProviderContextProps>({ ...initialState, menu }) as any;
|
|
263
262
|
function setMenu(menu: MenuItem[]) {
|
|
264
263
|
setMenuConfig((menuConfig: MenuProviderContextProps) => ({ ...menuConfig, menu }));
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { useLayoutDrawerState, useLayoutMediaState } from '@/components/Layout/Provider';
|
|
2
2
|
import { useSx } from '@/hooks';
|
|
3
3
|
import { Box, SxProps } from '@mui/material';
|
|
4
|
+
import { PropsWithChildren } from 'react';
|
|
4
5
|
|
|
5
|
-
type NavListProps = {
|
|
6
|
-
sx?: SxProps;
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
};
|
|
6
|
+
type NavListProps = PropsWithChildren<{ sx?: SxProps }>;
|
|
9
7
|
|
|
10
8
|
function NavList(props: NavListProps): JSX.Element {
|
|
11
9
|
const { horizontal } = useLayoutMediaState();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useLocalStorage } from '@/hooks';
|
|
2
|
-
import { createContext, useContext } from 'react';
|
|
2
|
+
import { PropsWithChildren, createContext, useContext } from 'react';
|
|
3
3
|
|
|
4
4
|
type ThemeMode = 'light' | 'dark';
|
|
5
5
|
type ThemeOrientation = 'vertical' | 'horizontal';
|
|
@@ -50,10 +50,8 @@ type ThemeConfig = {
|
|
|
50
50
|
isHorizontalLayout: (layout: ThemeDirection) => boolean;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
type ThemeProvierProps = {
|
|
54
|
-
|
|
55
|
-
initialConfig: ThemeConfig;
|
|
56
|
-
};
|
|
53
|
+
type ThemeProvierProps = PropsWithChildren<{ initialConfig: ThemeConfig }>;
|
|
54
|
+
|
|
57
55
|
function notImplemented(): void {
|
|
58
56
|
throw new Error('Method must be implemented');
|
|
59
57
|
}
|
|
@@ -2,15 +2,14 @@ import { StyledArrow } from './styles';
|
|
|
2
2
|
import { getPosition } from '@/components/MenuPopover/getPosition';
|
|
3
3
|
import { Arrow } from '@/components/MenuPopover/types';
|
|
4
4
|
import { Popover } from '@mui/material';
|
|
5
|
-
import
|
|
5
|
+
import { PropsWithChildren } from 'react';
|
|
6
6
|
|
|
7
|
-
type MenuPopoverProps = {
|
|
7
|
+
type MenuPopoverProps = PropsWithChildren<{
|
|
8
8
|
open: HTMLElement;
|
|
9
|
-
children: React.ReactNode;
|
|
10
9
|
arrow?: Arrow;
|
|
11
10
|
disabledArrow?: boolean;
|
|
12
11
|
sx?: object;
|
|
13
|
-
}
|
|
12
|
+
}>;
|
|
14
13
|
|
|
15
14
|
function MenuPopover({ open, children, arrow = 'top-right', disabledArrow, sx, ...other }: MenuPopoverProps) {
|
|
16
15
|
const { style, anchorOrigin, transformOrigin } = getPosition(arrow);
|
|
@@ -4,7 +4,7 @@ import ContentAdd from '@mui/icons-material/Add';
|
|
|
4
4
|
import { Dialog, Fab, useMediaQuery } from '@mui/material';
|
|
5
5
|
import { SxProps, Theme, styled } from '@mui/material/styles';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import React, { useCallback, useState } from 'react';
|
|
7
|
+
import React, { Children, PropsWithChildren, useCallback, useState } from 'react';
|
|
8
8
|
import {
|
|
9
9
|
Button,
|
|
10
10
|
CreateButtonClasses,
|
|
@@ -110,6 +110,7 @@ function CreateInDialogContent({
|
|
|
110
110
|
onError,
|
|
111
111
|
...props
|
|
112
112
|
}: CreateInDialogContentProps) {
|
|
113
|
+
const Child = Children.only(children);
|
|
113
114
|
const queryClient = useQueryClient();
|
|
114
115
|
const resource = useResourceContext();
|
|
115
116
|
const redirect = useRedirect();
|
|
@@ -173,22 +174,24 @@ function CreateInDialogContent({
|
|
|
173
174
|
} as CreateControllerResult
|
|
174
175
|
}
|
|
175
176
|
>
|
|
176
|
-
{React.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
177
|
+
{React.isValidElement(Child)
|
|
178
|
+
? React.cloneElement(Child, {
|
|
179
|
+
...Child.props,
|
|
180
|
+
modal: true,
|
|
181
|
+
toolbar: (
|
|
182
|
+
<Toolbar>
|
|
183
|
+
<Button
|
|
184
|
+
variant="text"
|
|
185
|
+
size="medium"
|
|
186
|
+
label="ra.action.cancel"
|
|
187
|
+
onClick={onClose}
|
|
188
|
+
disabled={createProps?.saving}
|
|
189
|
+
/>
|
|
190
|
+
<SaveButton type="button" disabled={createProps?.saving} />
|
|
191
|
+
</Toolbar>
|
|
192
|
+
)
|
|
193
|
+
})
|
|
194
|
+
: null}
|
|
192
195
|
</CreateContextProvider>
|
|
193
196
|
);
|
|
194
197
|
}
|
|
@@ -211,55 +214,55 @@ const StyledFab = styled(Fab, { overridesResolver: (_props, styles) => styles.ro
|
|
|
211
214
|
}
|
|
212
215
|
}));
|
|
213
216
|
|
|
214
|
-
type CreateInDialogButtonProps = CreateControllerProps &
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
217
|
+
type CreateInDialogButtonProps = CreateControllerProps &
|
|
218
|
+
PropsWithChildren<{
|
|
219
|
+
fullWidth?: boolean;
|
|
220
|
+
maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | false;
|
|
221
|
+
label?: string;
|
|
222
|
+
record?: any;
|
|
223
|
+
redirect?: RedirectionSideEffect;
|
|
224
|
+
scrollToTop?: boolean;
|
|
225
|
+
className?: string;
|
|
226
|
+
sx?: SxProps;
|
|
227
|
+
style?: React.CSSProperties;
|
|
228
|
+
/**
|
|
229
|
+
* If set to false, the button will always render as a regular button, regardless of the screen size.
|
|
230
|
+
*/
|
|
231
|
+
fab: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* @deprecated Use mutationOptions.onSubmit instead
|
|
234
|
+
*/
|
|
235
|
+
onSubmit?: (record: any, close: () => void) => void;
|
|
236
|
+
/**
|
|
237
|
+
* @deprecated Use mutationOptions.onSuccess instead
|
|
238
|
+
*/
|
|
239
|
+
onSuccess?: (data: any) => void;
|
|
240
|
+
/**
|
|
241
|
+
*
|
|
242
|
+
* @deprecated Use mutationOptions.onError instead
|
|
243
|
+
*/
|
|
244
|
+
onError?: (error: any) => void;
|
|
245
|
+
}>;
|
|
243
246
|
|
|
244
|
-
type CreateInDialogContentProps = CreateControllerProps &
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
247
|
+
type CreateInDialogContentProps = CreateControllerProps &
|
|
248
|
+
PropsWithChildren<{
|
|
249
|
+
onClose: () => void;
|
|
250
|
+
record?: any;
|
|
251
|
+
redirect: RedirectionSideEffect | boolean | undefined;
|
|
252
|
+
/**
|
|
253
|
+
* You can use it to handle the form submission yourself.
|
|
254
|
+
* Good luck with that.
|
|
255
|
+
*/
|
|
256
|
+
onSubmit?: (record: any, close: () => void) => void;
|
|
257
|
+
/**
|
|
258
|
+
* @deprecated Use mutationOptions.onSuccess instead
|
|
259
|
+
*/
|
|
260
|
+
onSuccess?: (data: any, close: () => void) => void;
|
|
261
|
+
/**
|
|
262
|
+
* @deprecated Use mutationOptions.onError instead
|
|
263
|
+
*/
|
|
264
|
+
onError?: (error: any) => void;
|
|
265
|
+
}>;
|
|
263
266
|
|
|
264
267
|
export { CreateInDialogButton };
|
|
265
268
|
export type { CreateInDialogButtonProps };
|
|
@@ -2,7 +2,7 @@ import { useAppConfig } from '@/components/AppStateProvider';
|
|
|
2
2
|
import { Toolbar } from '@/components/ra-forms';
|
|
3
3
|
import { Edit } from '@mui/icons-material';
|
|
4
4
|
import { Breakpoint, Dialog } from '@mui/material';
|
|
5
|
-
import React, { useCallback, useState } from 'react';
|
|
5
|
+
import React, { Children, PropsWithChildren, useCallback, useState } from 'react';
|
|
6
6
|
import {
|
|
7
7
|
Button,
|
|
8
8
|
EditContextProvider,
|
|
@@ -15,11 +15,12 @@ import {
|
|
|
15
15
|
useResourceContext
|
|
16
16
|
} from 'react-admin';
|
|
17
17
|
|
|
18
|
-
type EditInDialogContentProps = EditControllerProps &
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
18
|
+
type EditInDialogContentProps = EditControllerProps &
|
|
19
|
+
PropsWithChildren<{
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
}>;
|
|
22
22
|
function EditInDialogContent({ onClose, children, mutationMode = 'pessimistic', ...props }: EditInDialogContentProps) {
|
|
23
|
+
const Child = Children.only(children);
|
|
23
24
|
const notify = useNotify();
|
|
24
25
|
const record = useRecordContext();
|
|
25
26
|
const resource = useResourceContext();
|
|
@@ -63,16 +64,18 @@ function EditInDialogContent({ onClose, children, mutationMode = 'pessimistic',
|
|
|
63
64
|
saving: saving
|
|
64
65
|
}}
|
|
65
66
|
>
|
|
66
|
-
{React.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
{React.isValidElement(Child)
|
|
68
|
+
? React.cloneElement(Child, {
|
|
69
|
+
...Child.props,
|
|
70
|
+
modal: true,
|
|
71
|
+
toolbar: (
|
|
72
|
+
<Toolbar>
|
|
73
|
+
<Button variant="text" size="medium" label="ra.action.cancel" onClick={onClose} />
|
|
74
|
+
<SaveButton type="button" />
|
|
75
|
+
</Toolbar>
|
|
76
|
+
)
|
|
77
|
+
})
|
|
78
|
+
: null}
|
|
76
79
|
</EditContextProvider>
|
|
77
80
|
);
|
|
78
81
|
}
|
|
@@ -104,13 +107,13 @@ function EditInDialogButton({
|
|
|
104
107
|
);
|
|
105
108
|
}
|
|
106
109
|
|
|
107
|
-
type EditInDialogButtonProps = EditControllerProps &
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
110
|
+
type EditInDialogButtonProps = EditControllerProps &
|
|
111
|
+
PropsWithChildren<{
|
|
112
|
+
fullWidth?: boolean;
|
|
113
|
+
maxWidth?: false | Breakpoint | undefined;
|
|
114
|
+
label?: string;
|
|
115
|
+
style?: React.CSSProperties;
|
|
116
|
+
}>;
|
|
114
117
|
|
|
115
118
|
export { EditInDialogButton };
|
|
116
119
|
export type { EditInDialogButtonProps };
|