@applica-software-guru/react-admin 1.5.369 → 1.5.370
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/ra-lists/Empty.d.ts +6 -1
- package/dist/components/ra-lists/Empty.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +1 -1
- package/dist/react-admin.cjs.js.gz +0 -0
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +14 -13
- package/dist/react-admin.es.js.gz +0 -0
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +1 -1
- 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/ra-lists/Empty.tsx +12 -5
package/package.json
CHANGED
|
@@ -47,6 +47,11 @@ type EmptyProps = {
|
|
|
47
47
|
**/
|
|
48
48
|
subtitle?: string | React.ReactNode;
|
|
49
49
|
sx?: SxProps;
|
|
50
|
+
/**
|
|
51
|
+
* If true the component height fits its content (auto),
|
|
52
|
+
* otherwise it takes the full available height.
|
|
53
|
+
*/
|
|
54
|
+
fitContent?: boolean;
|
|
50
55
|
};
|
|
51
56
|
|
|
52
57
|
const StyledToolbar = styled('div')(({ theme }) => ({
|
|
@@ -69,16 +74,17 @@ interface RootProps {
|
|
|
69
74
|
sx?: SxProps;
|
|
70
75
|
className?: string;
|
|
71
76
|
children?: React.ReactNode;
|
|
77
|
+
fitContent?: boolean;
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
const Root = styled('div', {
|
|
75
81
|
name: PREFIX,
|
|
76
82
|
slot: 'Root',
|
|
77
83
|
overridesResolver: (_, styles) => styles.root,
|
|
78
|
-
shouldForwardProp: (prop) => prop !== 'horizontal'
|
|
79
|
-
})<RootProps>(({ theme, horizontal }) => ({
|
|
84
|
+
shouldForwardProp: (prop) => prop !== 'horizontal' && prop !== 'fitContent'
|
|
85
|
+
})<RootProps>(({ theme, horizontal, fitContent }) => ({
|
|
80
86
|
flex: 1,
|
|
81
|
-
height: horizontal ? 'calc(100vh - 240px)' : 'calc(100vh - 200px)',
|
|
87
|
+
height: fitContent ? 'auto' : horizontal ? 'calc(100vh - 240px)' : 'calc(100vh - 200px)',
|
|
82
88
|
[`& .${EmptyClasses.message}`]: {
|
|
83
89
|
textAlign: 'center',
|
|
84
90
|
opacity: theme.palette.mode === 'light' ? 1 : 0.8,
|
|
@@ -118,11 +124,12 @@ function Empty({
|
|
|
118
124
|
title,
|
|
119
125
|
subtitle,
|
|
120
126
|
sx,
|
|
127
|
+
fitContent = false,
|
|
121
128
|
...props
|
|
122
129
|
}: EmptyProps): JSX.Element {
|
|
123
130
|
const { hasCreate } = useResourceDefinition(props);
|
|
124
131
|
const canCreate = hasCreateProp !== undefined ? hasCreateProp : hasCreate;
|
|
125
|
-
const resource = useResourceContext(
|
|
132
|
+
const resource = useResourceContext();
|
|
126
133
|
const translate = useTranslate();
|
|
127
134
|
const getResourceLabel = useGetResourceLabel();
|
|
128
135
|
const resourceName = resource
|
|
@@ -138,7 +145,7 @@ function Empty({
|
|
|
138
145
|
const isHorizontal = themeOrientation === 'horizontal';
|
|
139
146
|
|
|
140
147
|
return (
|
|
141
|
-
<Root className={clsx(`${PREFIX}-root`, className)} sx={sx} horizontal={isHorizontal}>
|
|
148
|
+
<Root className={clsx(`${PREFIX}-root`, className)} sx={sx} horizontal={isHorizontal} fitContent={fitContent}>
|
|
142
149
|
<Box className={EmptyClasses.message}>
|
|
143
150
|
{getEmptyIcon({ icon, className })}
|
|
144
151
|
<Typography variant="h4" paragraph>
|