@applica-software-guru/react-admin 1.5.318 → 1.5.319
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/Datagrid/Datagrid.d.ts.map +1 -1
- package/dist/components/ra-lists/Empty.d.ts +6 -6
- package/dist/components/ra-lists/Empty.d.ts.map +1 -1
- package/dist/components/ra-lists/List.d.ts.map +1 -1
- package/dist/components/ra-lists/SimpleList.d.ts +3 -13
- package/dist/components/ra-lists/SimpleList.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +48 -48
- package/dist/react-admin.cjs.js.gz +0 -0
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +2741 -2730
- package/dist/react-admin.es.js.gz +0 -0
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +53 -53
- 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/Datagrid/Datagrid.tsx +1 -2
- package/src/components/ra-lists/Empty.tsx +45 -41
- package/src/components/ra-lists/List.tsx +8 -1
- package/src/components/ra-lists/SimpleList.tsx +18 -10
package/package.json
CHANGED
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
DatagridProps as RaDatagridProps
|
|
19
19
|
} from 'react-admin';
|
|
20
20
|
import { Empty } from '@/components/ra-lists/Empty';
|
|
21
|
-
import { DropboxOutlined } from '@ant-design/icons';
|
|
22
21
|
|
|
23
22
|
const defaultBulkActionButtons = <BulkDeleteButton />;
|
|
24
23
|
|
|
@@ -169,7 +168,7 @@ const Datagrid = React.forwardRef((props, ref) => {
|
|
|
169
168
|
|
|
170
169
|
const DefaultEmpty = (
|
|
171
170
|
<Empty
|
|
172
|
-
|
|
171
|
+
sx={{ '& .ApplicaEmpty-icon': { fontSize: '7em' } }}
|
|
173
172
|
title={
|
|
174
173
|
<Typography variant="subtitle1" style={{ color: 'inherit' }} gutterBottom>
|
|
175
174
|
{translate('ra.navigation.no_results')}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable filenames/match-regex */
|
|
2
2
|
import { DropboxOutlined } from '@ant-design/icons';
|
|
3
|
-
import { Box, Typography } from '@mui/material';
|
|
4
|
-
import { SxProps, styled } from '@mui/material/styles';
|
|
3
|
+
import { Box, SxProps, Typography, styled } from '@mui/material';
|
|
5
4
|
import { useGetResourceLabel, useResourceContext, useResourceDefinition, useTranslate } from 'ra-core';
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import { CreateButton } from '@/components/ra-buttons';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
8
|
|
|
9
9
|
type EmptyProps = {
|
|
10
10
|
/**
|
|
@@ -52,6 +52,39 @@ const StyledToolbar = styled('div')(({ theme }) => ({
|
|
|
52
52
|
padding: theme.spacing(2)
|
|
53
53
|
}));
|
|
54
54
|
|
|
55
|
+
const PREFIX = 'ApplicaEmpty';
|
|
56
|
+
|
|
57
|
+
const EmptyClasses = {
|
|
58
|
+
message: `${PREFIX}-message`,
|
|
59
|
+
icon: `${PREFIX}-icon`,
|
|
60
|
+
toolbar: `${PREFIX}-toolbar`
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const Root = styled('span', {
|
|
64
|
+
name: PREFIX,
|
|
65
|
+
slot: 'Root',
|
|
66
|
+
overridesResolver: (_, styles) => styles.root
|
|
67
|
+
})(({ theme }) => ({
|
|
68
|
+
flex: 1,
|
|
69
|
+
height: 'calc(100vh - 200px)',
|
|
70
|
+
[`& .${EmptyClasses.message}`]: {
|
|
71
|
+
textAlign: 'center',
|
|
72
|
+
opacity: theme.palette.mode === 'light' ? 0.5 : 0.8,
|
|
73
|
+
margin: '0 1em',
|
|
74
|
+
color: theme.palette.mode === 'light' ? 'inherit' : theme.palette.text.primary
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
[`& .${EmptyClasses.icon}`]: {
|
|
78
|
+
fontSize: '9em',
|
|
79
|
+
marginTop: '16px',
|
|
80
|
+
marginBottom: '16px'
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
[`& .${EmptyClasses.toolbar}`]: {
|
|
84
|
+
textAlign: 'center'
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
|
|
55
88
|
/**
|
|
56
89
|
* The Empty component is used to display a message when the list is empty.
|
|
57
90
|
* This component can be used only inside a List component.
|
|
@@ -85,7 +118,7 @@ function Empty({
|
|
|
85
118
|
const inviteMessage = translate('ra.page.invite');
|
|
86
119
|
|
|
87
120
|
return (
|
|
88
|
-
<Root className={className} sx={sx}>
|
|
121
|
+
<Root className={clsx(`${PREFIX}-root`, className)} sx={sx}>
|
|
89
122
|
<Box className={EmptyClasses.message}>
|
|
90
123
|
{icon}
|
|
91
124
|
<Typography variant="h4" paragraph>
|
|
@@ -94,50 +127,21 @@ function Empty({
|
|
|
94
127
|
_: emptyMessage
|
|
95
128
|
})}
|
|
96
129
|
</Typography>
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
translate(`resources.${resource}.invite`, {
|
|
130
|
+
{subtitle ||
|
|
131
|
+
(canCreate ? (
|
|
132
|
+
<Typography variant="body1">
|
|
133
|
+
{translate(`resources.${resource}.invite`, {
|
|
101
134
|
_: inviteMessage
|
|
102
135
|
})}
|
|
103
|
-
|
|
104
|
-
|
|
136
|
+
</Typography>
|
|
137
|
+
) : null)}
|
|
105
138
|
</Box>
|
|
106
|
-
<StyledToolbar className={EmptyClasses.toolbar}>
|
|
139
|
+
<StyledToolbar className={EmptyClasses.toolbar}>
|
|
140
|
+
{(canCreate ? <CreateButton disableFloatingButton /> : null) || actions}
|
|
141
|
+
</StyledToolbar>
|
|
107
142
|
</Root>
|
|
108
143
|
);
|
|
109
144
|
}
|
|
110
145
|
|
|
111
|
-
const PREFIX = 'ApplicaEmpty';
|
|
112
|
-
|
|
113
|
-
const EmptyClasses = {
|
|
114
|
-
message: `${PREFIX}-message`,
|
|
115
|
-
icon: `${PREFIX}-icon`,
|
|
116
|
-
toolbar: `${PREFIX}-toolbar`
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const Root = styled('span', {
|
|
120
|
-
name: PREFIX,
|
|
121
|
-
overridesResolver: (_, styles) => styles.root
|
|
122
|
-
})(({ theme }) => ({
|
|
123
|
-
flex: 1,
|
|
124
|
-
height: 'calc(100vh - 200px)',
|
|
125
|
-
[`& .${EmptyClasses.message}`]: {
|
|
126
|
-
textAlign: 'center',
|
|
127
|
-
opacity: theme.palette.mode === 'light' ? 0.5 : 0.8,
|
|
128
|
-
margin: '0 1em',
|
|
129
|
-
color: theme.palette.mode === 'light' ? 'inherit' : theme.palette.text.primary
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
[`& .${EmptyClasses.icon}`]: {
|
|
133
|
-
fontSize: '9em',
|
|
134
|
-
marginBottom: '16px'
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
[`& .${EmptyClasses.toolbar}`]: {
|
|
138
|
-
textAlign: 'center'
|
|
139
|
-
}
|
|
140
|
-
}));
|
|
141
|
-
|
|
142
146
|
export { Empty, EmptyClasses };
|
|
143
147
|
export type { EmptyProps };
|
|
@@ -181,12 +181,19 @@ const StyledList = styled(RaList, { slot: 'root' })(({ theme }) => ({
|
|
|
181
181
|
paddingTop: 0,
|
|
182
182
|
paddingBottom: 0
|
|
183
183
|
},
|
|
184
|
-
// Resolve a defect related to the usage of
|
|
184
|
+
// Resolve a defect related to the usage of AntDesign icons with Mantis and React-Admin.
|
|
185
185
|
// These two lines are not needed if you are not using AntDesign icons.
|
|
186
186
|
'& .icon span': {
|
|
187
187
|
top: -1,
|
|
188
188
|
left: -1
|
|
189
189
|
}
|
|
190
|
+
},
|
|
191
|
+
'& .ApplicaEmpty-root': {
|
|
192
|
+
display: 'flex',
|
|
193
|
+
flexDirection: 'column',
|
|
194
|
+
justifyContent: 'center',
|
|
195
|
+
alignItems: 'center',
|
|
196
|
+
height: 'calc(100vh - 260px)'
|
|
190
197
|
}
|
|
191
198
|
},
|
|
192
199
|
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { SimpleList as RaSimpleList, SimpleListProps, useTranslate } from 'react-admin';
|
|
2
|
+
import { Empty } from '@/components/ra-lists/Empty';
|
|
3
|
+
import { Typography } from '@mui/material';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
5
|
+
function SimpleList({ empty, ...props }: SimpleListProps): JSX.Element {
|
|
6
|
+
const translate = useTranslate();
|
|
7
|
+
const DefaultEmpty = (
|
|
8
|
+
<Empty
|
|
9
|
+
sx={{ '& .ApplicaEmpty-icon': { fontSize: '7em' } }}
|
|
10
|
+
title={
|
|
11
|
+
<Typography variant="subtitle1" style={{ color: 'inherit' }} gutterBottom>
|
|
12
|
+
{translate('ra.navigation.no_results')}
|
|
13
|
+
</Typography>
|
|
14
|
+
}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return <RaSimpleList {...props} empty={empty || DefaultEmpty} />;
|
|
19
|
+
}
|
|
12
20
|
|
|
13
21
|
export { SimpleList };
|