@applica-software-guru/react-admin 1.5.346 → 1.5.347
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 +3 -3
- package/dist/components/ra-lists/Empty.d.ts.map +1 -1
- package/dist/components/ra-lists/List.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +448 -61
- package/dist/react-admin.cjs.js.gz +0 -0
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +11667 -10656
- package/dist/react-admin.es.js.gz +0 -0
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +449 -62
- 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 +16 -13
- package/src/components/ra-lists/List.tsx +19 -1
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable filenames/match-regex */
|
|
2
|
-
import { DropboxOutlined } from '@ant-design/icons';
|
|
3
2
|
import { Box, SxProps, Typography, styled } from '@mui/material';
|
|
4
3
|
import { useGetResourceLabel, useResourceContext, useResourceDefinition, useTranslate } from 'ra-core';
|
|
5
4
|
import * as React from 'react';
|
|
6
5
|
import { CreateButton } from '@/components/ra-buttons';
|
|
7
6
|
import clsx from 'clsx';
|
|
7
|
+
import { EmptyIcon, NotFoundIcon } from './icons';
|
|
8
8
|
|
|
9
9
|
type EmptyProps = {
|
|
10
10
|
/**
|
|
@@ -72,25 +72,31 @@ const Root = styled('span', {
|
|
|
72
72
|
height: 'calc(100vh - 200px)',
|
|
73
73
|
[`& .${EmptyClasses.message}`]: {
|
|
74
74
|
textAlign: 'center',
|
|
75
|
-
opacity: theme.palette.mode === 'light' ?
|
|
75
|
+
opacity: theme.palette.mode === 'light' ? 1 : 0.8,
|
|
76
76
|
margin: '0 1em',
|
|
77
77
|
color: theme.palette.mode === 'light' ? 'inherit' : theme.palette.text.primary
|
|
78
78
|
},
|
|
79
|
-
|
|
80
79
|
[`& .${EmptyClasses.icon}`]: {
|
|
81
80
|
fontSize: '9em',
|
|
82
81
|
marginTop: '16px',
|
|
83
82
|
marginBottom: '16px'
|
|
84
83
|
},
|
|
85
|
-
|
|
86
84
|
[`& .${EmptyClasses.toolbar}`]: {
|
|
87
85
|
textAlign: 'center'
|
|
88
86
|
}
|
|
89
87
|
}));
|
|
90
88
|
|
|
89
|
+
function getEmptyIcon({ icon, className }: { icon?: React.ReactNode; className?: string }) {
|
|
90
|
+
if (icon !== undefined) return icon;
|
|
91
|
+
if (className?.includes('RaList-noResults')) {
|
|
92
|
+
return <NotFoundIcon className={EmptyClasses.icon} />;
|
|
93
|
+
}
|
|
94
|
+
return <EmptyIcon className={EmptyClasses.icon} />;
|
|
95
|
+
}
|
|
96
|
+
|
|
91
97
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
98
|
+
* Mostra una pagina vuota per le liste senza risultati o senza dati.
|
|
99
|
+
* Da usare solo all'interno di un componente List.
|
|
94
100
|
*
|
|
95
101
|
* @example
|
|
96
102
|
* <List empty={<Empty actions={<Button label="Add" onClick={add} />} />} />
|
|
@@ -98,19 +104,17 @@ const Root = styled('span', {
|
|
|
98
104
|
function Empty({
|
|
99
105
|
actions,
|
|
100
106
|
className,
|
|
101
|
-
hasCreate:
|
|
102
|
-
icon
|
|
107
|
+
hasCreate: hasCreateProp,
|
|
108
|
+
icon,
|
|
103
109
|
title,
|
|
104
110
|
subtitle,
|
|
105
111
|
sx,
|
|
106
112
|
...props
|
|
107
113
|
}: EmptyProps): JSX.Element {
|
|
108
114
|
const { hasCreate } = useResourceDefinition(props);
|
|
109
|
-
const canCreate =
|
|
115
|
+
const canCreate = hasCreateProp !== undefined ? hasCreateProp : hasCreate;
|
|
110
116
|
const resource = useResourceContext(props);
|
|
111
|
-
|
|
112
117
|
const translate = useTranslate();
|
|
113
|
-
|
|
114
118
|
const getResourceLabel = useGetResourceLabel();
|
|
115
119
|
const resourceName = resource
|
|
116
120
|
? translate(`resources.${resource}.forcedCaseName`, {
|
|
@@ -118,14 +122,13 @@ function Empty({
|
|
|
118
122
|
_: getResourceLabel(resource, 0)
|
|
119
123
|
})
|
|
120
124
|
: translate('ra.empty.no_resource');
|
|
121
|
-
|
|
122
125
|
const emptyMessage = translate('ra.page.empty', { name: resourceName });
|
|
123
126
|
const inviteMessage = translate('ra.page.invite');
|
|
124
127
|
|
|
125
128
|
return (
|
|
126
129
|
<Root className={clsx(`${PREFIX}-root`, className)} sx={sx}>
|
|
127
130
|
<Box className={EmptyClasses.message}>
|
|
128
|
-
{icon}
|
|
131
|
+
{getEmptyIcon({ icon, className })}
|
|
129
132
|
<Typography variant="h4" paragraph>
|
|
130
133
|
{title ||
|
|
131
134
|
translate(`resources.${resource}.empty`, {
|
|
@@ -121,10 +121,15 @@ const StyledList = styled(RaList, { slot: 'root' })(({ theme }) => ({
|
|
|
121
121
|
'& .MuiButton-root': {
|
|
122
122
|
margin: 0
|
|
123
123
|
},
|
|
124
|
+
|
|
124
125
|
'& .RaList-actions': {
|
|
125
126
|
minHeight: 80,
|
|
126
127
|
alignItems: 'center',
|
|
127
128
|
padding: theme.spacing(2.5),
|
|
129
|
+
borderTopLeftRadius: `${theme.shape.borderRadius}px`,
|
|
130
|
+
borderTopRightRadius: `${theme.shape.borderRadius}px`,
|
|
131
|
+
borderBottomLeftRadius: 0,
|
|
132
|
+
borderBottomRightRadius: 0,
|
|
128
133
|
[theme.breakpoints.down('sm')]: {
|
|
129
134
|
flexDirection: 'row'
|
|
130
135
|
},
|
|
@@ -193,10 +198,23 @@ const StyledList = styled(RaList, { slot: 'root' })(({ theme }) => ({
|
|
|
193
198
|
flexDirection: 'column',
|
|
194
199
|
justifyContent: 'center',
|
|
195
200
|
alignItems: 'center',
|
|
196
|
-
height: 'calc(100vh - 260px)'
|
|
201
|
+
height: 'calc(100vh - 260px)',
|
|
202
|
+
backgroundColor: theme.palette.background.paper,
|
|
203
|
+
border: '1px solid',
|
|
204
|
+
borderTop: 'none',
|
|
205
|
+
borderColor: theme.palette.mode === 'dark' ? theme.palette.divider : theme.palette.grey.A800,
|
|
206
|
+
borderBottomLeftRadius: `${theme.shape.borderRadius}px`,
|
|
207
|
+
borderBottomRightRadius: `${theme.shape.borderRadius}px`
|
|
197
208
|
}
|
|
198
209
|
},
|
|
199
210
|
|
|
211
|
+
'& .RaList-noResults': {
|
|
212
|
+
backgroundColor: theme.palette.background.paper,
|
|
213
|
+
border: '1px solid',
|
|
214
|
+
borderColor: theme.palette.mode === 'dark' ? theme.palette.divider : theme.palette.grey.A800,
|
|
215
|
+
borderRadius: `${theme.shape.borderRadius}px`
|
|
216
|
+
},
|
|
217
|
+
|
|
200
218
|
'& .RaEmpty-toolbar': {
|
|
201
219
|
margin: theme.spacing(2)
|
|
202
220
|
}
|